PageSourceSearch

https://mockup-editor-pixi.vercel.app/assets/vendor-three-BMg0ZKH7.js

js mockup-editor-pixi.vercel.app collected 2026-10-03 07:19:39 UTC 667,016 bytes, 3,686 lines download raw bytes

1/**
2 * @license
3 * Copyright 2010-2023 Three.js Authors
4 * SPDX-License-Identifier: MIT
5 */const ua="160",af={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},of={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},zh=0,Ro=1,kh=2,lf=3,cf=0,xl=1,Vh=2,cn=3,Cn=0,Ot=1,hn=2,hf=2,An=0,gi=1,Po=2,Lo=3,Io=4,Hh=5,kn=100,Gh=101,Wh=102,Uo=103,Do=104,Xh=200,qh=201,Yh=202,Zh=203,ra=204,aa=205,Jh=206,$h=207,Kh=208,Qh=209,jh=210,eu=211,tu=212,nu=213,iu=214,su=0,ru=1,au=2,ws=3,ou=4,lu=5,cu=6,hu=7,Zs=0,uu=1,du=2,Tn=0,fu=1,pu=2,mu=3,gu=4,_u=5,xu=6,No="attached",vu="detached",da=300,Rn=301,Wn=302,Cs=303,Rs=304,ss=306,Ps=1e3,Rt=1001,Ls=1002,ft=1003,oa=1004,uf=1004,Ss=1005,df=1005,pt=1006,vl=1007,ff=1007,Xn=1008,pf=1008,wn=1009,yu=1010,Mu=1011,fa=1012,yl=1013,bn=1014,nn=1015,ji=1016,Ml=1017,Sl=1018,Vn=1020,Su=1021,Vt=1023,bu=1024,Eu=1025,Hn=1026,yi=1027,Au=1028,bl=1029,Tu=1030,El=1031,Al=1033,Qr=33776,jr=33777,ea=33778,ta=33779,Oo=35840,Fo=35841,Bo=35842,zo=35843,Tl=36196,ko=37492,Vo=37496,Ho=37808,Go=37809,Wo=37810,Xo=37811,qo=37812,Yo=37813,Zo=37814,Jo=37815,$o=37816,Ko=37817,Qo=37818,jo=37819,el=37820,tl=37821,na=36492,nl=36494,il=36495,wu=36283,sl=36284,rl=36285,al=36286,Cu=2200,Ru=2201,Pu=2202,Is=2300,Us=2301,ia=2302,di=2400,fi=2401,Ds=2402,pa=2500,wl=2501,mf=0,gf=1,_f=2,Cl=3e3,Gn=3001,Lu=3200,Iu=3201,Yn=0,Uu=1,Zt="",_t="srgb",dn="srgb-linear",ma="display-p3",Js="display-p3-linear",Ns="linear",st="srgb",Os="rec709",Fs="p3",xf=0,ci=7680,vf=7681,yf=7682,Mf=7683,Sf=34055,bf=34056,Ef=538
vendor: 6,042 bytes, line 5
56,Af=512,Tf=513,wf=514,Cf=515,Rf=516,Pf=517,Lf=518,ol=519,Du=512,Nu=513,Ou=514,Rl=515,Fu=516,Bu=517,zu=518,ku=519,Bs=35044,If=35048,Uf=35040,Df=35045,Nf=35049,Of=35041,Ff=35046,Bf=35050,zf=35042,kf="100",ll="300 es",la=1035,sn=2e3,es=2001;class Ln{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const Tt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let hc=1234567;const _i=Math.PI/180,ts=180/Math.PI;function Jt(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Tt[r&255]+Tt[r>>8&255]+Tt[r>>16&255]+Tt[r>>24&255]+"-"+Tt[e&255]+Tt[e>>8&255]+"-"+Tt[e>>16&15|64]+Tt[e>>24&255]+"-"+Tt[t&63|128]+Tt[t>>8&255]+"-"+Tt[t>>16&255]+Tt[t>>24&255]+Tt[n&255]+Tt[n>>8&255]+Tt[n>>16&255]+Tt[n>>24&255]).toLowerCase()}function ht(r,e,t){return Math.max(e,Math.min(t,r))}function Pl(r,e){return(r%e+e)%e}function Vf(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Hf(r,e,t){return r!==e?(t-r)/(e-r):0}function bs(r,e,t){return(1-t)*r+t*e}function Gf(r,e,t,n){return bs(r,e,1-Math.exp(-t*n))}function Wf(r,e=1){return e-Math.abs(Pl(r,e*2)-e)}function Xf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function qf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Yf(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Zf(r,e){return r+Math.random()*(e-r)}function Jf(r){return r*(.5-Math.random())}function $f(r){r!==void 0&&(hc=r);let e=hc+=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 Kf(r){return r*_i}function Qf(r){return r*ts}function cl(r){return(r&r-1)===0&&r!==0}function jf(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function ca(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function ep(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),h=a((e+n)/2),u=s((e-n)/2),d=a((e-n)/2),f=s((n-e)/2),m=a((n-e)/2);switch(i){case"XYX":r.set(o*h,l*u,l*d,o*c);break;case"YZY":r.set(l*d,o*h,l*u,o*c);break;case"ZXZ":r.set(l*u,l*d,o*h,o*c);break;case"XZX":r.set(o*h,l*m,l*f,o*c);break;case"YXY":r.set(l*f,o*h,l*m,o*c);break;case"ZYZ":r.set(l*m,l*f,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ht(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 ke(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 tp={DEG2RAD:_i,RAD2DEG:ts,generateUUID:Jt,clamp:ht,euclideanModulo:Pl,mapLinear:Vf,inverseLerp:Hf,lerp:bs,damp:Gf,pingpong:Wf,smoothstep:Xf,smootherstep:qf,randInt:Yf,randFloat:Zf,randFloatSpread:Jf,seededRandom:$f,degToRad:Kf,radToDeg:Qf,isPowerOfTwo:cl,ceilPowerOfTwo:jf,floorPowerOfTwo:ca,setQuaternionFromProperEuler:ep,normalize:ke,denormalize:Ht};class Z{constructor(e=0,t=0){Z.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}
vendor: 16,246 bytes, line 5
5sub(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(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class He{constructor(e,t,n,i,s,a,o,l,c){He.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c)}set(e,t,n,i,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],_=i[0],g=i[3],p=i[6],v=i[1],x=i[4],y=i[7],R=i[2],T=i[5],C=i[8];return s[0]=a*_+o*v+l*R,s[3]=a*g+o*x+l*T,s[6]=a*p+o*y+l*C,s[1]=c*_+h*v+u*R,s[4]=c*g+h*x+u*T,s[7]=c*p+h*y+u*C,s[2]=d*_+f*v+m*R,s[5]=d*g+f*x+m*T,s[8]=d*p+f*y+m*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,d=o*l-h*s,f=c*s-a*l,m=t*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/m;return e[0]=u*_,e[1]=(i*c-h*n)*_,e[2]=(o*n-i*a)*_,e[3]=d*_,e[4]=(h*t-i*l)*_,e[5]=(i*s-o*t)*_,e[6]=f*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Xa.makeScale(e,t)),this}rotate(e){return this.premultiply(Xa.makeRotation(-e)),this}translate(e,t){return this.premultiply(Xa.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 Xa=new He;function Vu(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const np={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Yi(r,e){return new np[r](e)}function zs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Hu(){const r=zs("canvas");return r.style.display="block",r}const uc={};function Es(r){r in uc||(uc[r]=!0,console.warn(r))}const dc=new He().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),fc=new He().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ar={[dn]:{transfer:Ns,primaries:Os,toReference:r=>r,fromReference:r=>r},[_t]:{transfer:st,primaries:Os,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[Js]:{transfer:Ns,primaries:Fs,toReference:r=>r.applyMatrix3(fc),fromReference:r=>r.applyMatrix3(dc)},[ma]:{transfer:st,primaries:Fs,toReference:r=>r.convertSRGBToLinear().applyMatrix3(fc),fromReference:r=>r.applyMatrix3(dc).convertLinearToSRGB()}},ip=new Set([dn,Js]),Qe={enabled:!0,_workingColorSpace:dn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!ip.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=ar[e].toReference,i=ar[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 ar[r].primaries},getTransfer:function(r){return r===Zt?Ns:ar[r].transfer}};function Qi(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function qa(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Ti;class Ll{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ti===void 0&&(Ti=zs("canvas")),Ti.width=e.width,Ti.height=e.height;const n=Ti.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ti}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=zs("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=Qi(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Qi(t[n]/255)*255):t[n]=Qi(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let sp=0;class pi{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:sp++}),this.uuid=Jt(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(Ya(i[a].image)):s.push(Ya(i[a]))}else s=Ya(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Ya(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?Ll.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let rp=0;class mt extends Ln{constructor(e=mt.DEFAULT_IMAGE,t=mt.DEFAULT_MAPPING,n=Rt,i=Rt,s=pt,a=Xn,o=Vt,l=wn,c=mt.DEFAULT_ANISOTROPY,h=Zt){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:rp++}),this.uuid=Jt(),this.name="",this.source=new pi(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Z(0,0),this.repeat=new Z(1,1),this.center=new Z(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new He,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof h=="string"?this.colorSpace=h:(Es("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=h===Gn?_t:Zt),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==da)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ps:e.x=e.x-Math.floor(e.x);break;case Rt:e.x=e.x<0?0:1;break;case Ls: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 Ps:e.y=e.y-Math.floor(e.y);break;case Rt:e.y=e.y<0?0:1;break;case Ls: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 Es("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===_t?Gn:Cl}set encoding(e){Es("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Gn?_t:Zt}}mt.DEFAULT_IMAGE=null;mt.DEFAULT_MAPPING=da;mt.DEFAULT_ANISOTROPY=1;class je{constructor(e=0,t=0,n=0,i=1){je.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const l=e.elements,c=l[0],h=l[4],u=l[8],d=l[1],f=l[5],m=l[9],_=l[2],g=l[6],p=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(m+g)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,y=(f+1)/2,R=(p+1)/2,T=(h+d)/4,C=(u+_)/4,U=(m+g)/4;return x>y&&x>R?x<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(x),i=T/n,s=C/n):y>R?y<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(y),n=T/i,s=U/i):R<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(R),n=C/s,i=U/s),this.set(n,i,s,t),this}let v=Math.sqrt((g-m)*(g-m)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(u-_)/v,this.z=(d-h
vendor: 2,890 bytes, line 5
5)/v,this.w=Math.acos((c+f+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 Gu extends Ln{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new je(0,0,e,t),this.scissorTest=!1,this.viewport=new je(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(Es("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace
vendor: 4,998 bytes, line 5
5=n.encoding===Gn?_t:Zt),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:pt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new mt(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 pi(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 rn extends Gu{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ga extends mt{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=ft,this.minFilter=ft,this.wrapR=Rt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ap extends rn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new ga(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Il extends mt{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=ft,this.minFilter=ft,this.wrapR=Rt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class op extends rn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Il(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class lp extends rn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let a=0;a<n;a++)this.texture[a]=s.clone(),this.texture[a].isRenderTargetTexture=!0}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.texture.length;i<s;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class Gt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let l=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3];const d=s[a+0],f=s[a+1],m=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=m,e[t+3]=_;return}if(u!==_||l!==d||c!==f||h!==m){let g=1-o;const p=l*d+c*f+h*m+u*_,v=p>=0?1:-1,x=1-p*p;if(x>Number.EPSILON){const R=Math.sqrt(x),T=Math.atan2(R,p*v);g=Math.sin(g*T)/R,o=Math.sin(o*T)/R}const y=o*v;if(l=l*g+d*y,c=c*g+f*y,h=h*g+m*y,u=u*g+_*y,g===1-o){const R=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=R,c*=R,h*=R,u*=R}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],u=s[a],d=s[a+1],f=s[a+2],m=s[a+3];return e[t]=o*m+h*u+l*f-c*d,e[t+1]=l*m+h*d+c*u-o*f,e[t+2]=c*m+h*f+o*d-l*u,e[t+3]=h*m-o*u-l*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),u=o(s/2),d=l(n/2),f=l(i/2),m=l(s/2);switch(a){case"XYZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m-
vendor: 5,098 bytes, line 5
5d*f*u,this._w=c*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"YZX":this._x=d*h*u+c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u-d*f*m;break;case"XZY":this._x=d*h*u-c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10],d=n+o+u;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-l)*f,this._y=(s-c)*f,this._z=(a-i)*f}else if(n>o&&n>u){const f=2*Math.sqrt(1+n-o-u);this._w=(h-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+c)/f}else if(o>u){const f=2*Math.sqrt(1+o-n-u);this._w=(s-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+h)/f}else{const f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(s+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ht(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+i*c-s*l,this._y=i*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-i*o,this._w=a*h-n*o-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,a=this._w;let o=a*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,d=Math.sin(t*h)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=s*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class w{constructor(e=0,t=0,n=0){w.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}
vendor: 48,838 bytes, line 5
5sub(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(pc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(pc.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),h=2*(o*t-s*i),u=2*(s*n-a*t);return this.x=t+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=i+l*u+s*h-a*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,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Za.copy(this).projectOnVector(e),this.sub(Za)}reflect(e){return this.sub(Za.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(ht(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 Za=new w,pc=new Gt;class Ft{constructor(e=new w(1/0,1/0,1/0),t=new w(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Qt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Qt.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Qt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Qt):Qt.fromBufferAttribute(s,a),Qt.applyMatrix4(e.matrixWorld),this.expandByPoint(Qt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),or.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),or.copy(n.boundingBox)),or.applyMatrix4(e.matrixWorld),this.union(or)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Qt),Qt.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(hs),lr.subVectors(this.max,hs),wi.subVectors(e.a,hs),Ci.subVectors(e.b,hs),Ri.subVectors(e.c,hs),In.subVectors(Ci,wi),Un.subVectors(Ri,Ci),jn.subVectors(wi,Ri);let t=[0,-In.z,In.y,0,-Un.z,Un.y,0,-jn.z,jn.y,In.z,0,-In.x,Un.z,0,-Un.x,jn.z,0,-jn.x,-In.y,In.x,0,-Un.y,Un.x,0,-jn.y,jn.x,0];return!Ja(t,wi,Ci,Ri,lr)||(t=[1,0,0,0,1,0,0,0,1],!Ja(t,wi,Ci,Ri,lr))?!1:(cr.crossVectors(In,Un),t=[cr.x,cr.y,cr.z],Ja(t,wi,Ci,Ri,lr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Qt).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:(gn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),gn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),gn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),gn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),gn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),gn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),gn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),gn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(gn),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 gn=[new w,new w,new w,new w,new w,new w,new w,new w],Qt=new w,or=new Ft,wi=new w,Ci=new w,Ri=new w,In=new w,Un=new w,jn=new w,hs=new w,lr=new w,cr=new w,ei=new w;function Ja(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){ei.fromArray(r,s);const o=i.x*Math.abs(ei.x)+i.y*Math.abs(ei.y)+i.z*Math.abs(ei.z),l=e.dot(ei),c=t.dot(ei),h=n.dot(ei);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const cp=new Ft,us=new w,$a=new w;class Pt{constructor(e=new w,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):cp.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;us.subVectors(e,this.center);const t=us.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(us,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):($a.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(us.copy(e.center).add($a)),this.expandByPoint(us.copy(e.center).sub($a))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const _n=new w,Ka=new w,hr=new w,Dn=new w,Qa=new w,ur=new w,ja=new w;class rs{constructor(e=new w,t=new w(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,_n)),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=_n.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(_n.copy(this.origin).addScaledVector(this.direction,t),_n.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ka.copy(e).add(t).multiplyScalar(.5),hr.copy(t).sub(e).normalize(),Dn.copy(this.origin).sub(Ka);const s=e.distanceTo(t)*.5,a=-this.direction.dot(hr),o=Dn.dot(this.direction),l=-Dn.dot(hr),c=Dn.lengthSq(),h=Math.abs(1-a*a);let u,d,f,m;if(h>0)if(u=a*l-o,d=a*o-l,m=s*h,u>=0)if(d>=-m)if(d<=m){const _=1/h;u*=_,d*=_,f=u*(u+a*d+2*o)+d*(a*u+d+2*l)+c}else d=s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d=-s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d<=-m?(u=Math.max(0,-(-a*s+o)),d=u>0?-s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c):d<=m?(u=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(u=Math.max(0,-(a*s+o)),d=u>0?s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c);else d=a>0?-s:s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Ka).addScaledVector(hr,d),f}intersectSphere(e,t){_n.subVectors(e.center,this.origin);const n=_n.dot(this.direction),i=_n.dot(_n)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-d.z)*u,l=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,l=(e.min.z-d.z)*u),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,_n)!==null}intersectTriangle(e,t,n,i,s){Qa.subVectors(t,e),ur.subVectors(n,e),ja.crossVectors(Qa,ur);let a=this.direction.dot(ja),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Dn.subVectors(this.origin,e);const l=o*this.direction.dot(ur.crossVectors(Dn,ur));if(l<0)return null;const c=o*this.direction.dot(Qa.cross(Dn));if(c<0||l+c>a)return null;const h=-o*Dn.dot(ja);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Re{constructor(e,t,n,i,s,a,o,l,c,h,u,d,f,m,_,g){Re.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c,h,u,d,f,m,_,g)}set(e,t,n,i,s,a,o,l,c,h,u,d,f,m,_,g){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=m,p[11]=_,p[15]=g,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 Re().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/Pi.setFromMatrixColumn(e,0).length(),s=1/Pi.setFromMatrixColumn(e,1).length(),a=1/Pi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const d=a*h,f=a*u,m=o*h,_=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=f+m*c,t[5]=d-_*c,t[9]=-o*l,t[2]=_-d*c,t[6]=m+f*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*h,f=l*u,m=c*h,_=c*u;t[0]=d+_*o,t[4]=m*o-f,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-m,t[6]=_+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*h,f=l*u,m=c*h,_=c*u;t[0]=d-_*o,t[4]=-a*u,t[8]=m+f*o,t[1]=f+m*o,t[5]=a*h,t[9]=_-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*h,f=a*u,m=o*h,_=o*u;t[0]=l*h,t[4]=m*c-f,t[8]=d*c+_,t[1]=l*u,t[5]=_*c+d,t[9]=f*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,f=a*c,m=o*l,_=o*c;t[0]=l*h,t[4]=_-d*u,t[8]=m*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=f*u+m,t[10]=d-_*u}else if(e.order==="XZY"){const d=a*l,f=a*c,m=o*l,_=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=d*u+_,t[5]=a*h,t[9]=f*u-m,t[2]=m*u-f,t[6]=o*h,t[10]=_*u+d}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(hp,e,up)}lookAt(e,t,n){const i=this.elements;return qt.subVectors(e,t),qt.lengthSq()===0&&(qt.z=1),qt.normalize(),Nn.crossVectors(n,qt),Nn.lengthSq()===0&&(Math.abs(n.z)===1?qt.x+=1e-4:qt.z+=1e-4,qt.normalize(),Nn.crossVectors(n,qt)),Nn.normalize(),dr.crossVectors(qt,Nn),i[0]=Nn.x,i[4]=dr.x,i[8]=qt.x,i[1]=Nn.y,i[5]=dr.y,i[9]=qt.y,i[2]=Nn.z,i[6]=dr.z,i[10]=qt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],d=n[9],f=n[13],m=n[2],_=n[6],g=n[10],p=n[14],v=n[3],x=n[7],y=n[11],R=n[15],T=i[0],C=i[4],U=i[8],S=i[12],E=i[1],N=i[5],G=i[9],ie=i[13],I=i[2],F=i[6],V=i[10],J=i[14],Y=i[3],W=i[7],ee=i[11],te=i[15];return s[0]=a*T+o*E+l*I+c*Y,s[4]=a*C+o*N+l*F+c*W,s[8]=a*U+o*G+l*V+c*ee,s[12]=a*S+o*ie+l*J+c*te,s[1]=h*T+u*E+d*I+f*Y,s[5]=h*C+u*N+d*F+f*W,s[9]=h*U+u*G+d*V+f*ee,s[13]=h*S+u*ie+d*J+f*te,s[2]=m*T+_*E+g*I+p*Y,s[6]=m*C+_*N+g*F+p*W,s[10]=m*U+_*G+g*V+p*ee,s[14]=m*S+_*ie+g*J+p*te,s[3]=v*T+x*E+y*I+R*Y,s[7]=v*C+x*N+y*F+R*W,s[11]=v*U+x*G+y*V+R*ee,s[15]=v*S+x*ie+y*J+R*te,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],d=e[10],f=e[14],m=e[3],_=e[7],g=e[11],p=e[15];return m*(+s*l*u-i*c*u-s*o*d+n*c*d+i*o*f-n*l*f)+_*(+t*l*f-t*c*d+s*a*d-i*a*f+i*c*h-s*l*h)+g*(+t*c*u-t*o*f-s*a*u+n*a*f+s*o*h-n*c*h)+p*(-i*o*h-t*l*u+t*o*d+i*a*u-n*a*d+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],f=e[11],m=e[12],_=e[13],g=e[14],p=e[15],v=u*g*c-_*d*c+_*l*f-o*g*f-u*l*p+o*d*p,x=m*d*c-h*g*c-m*l*f+a*g*f+h*l*p-a*d*p,y=h*_*c-m*u*c+m*o*f-a*_*f-h*o*p+a*u*p,R=m*u*l-h*_*l-m*o*d+a*_*d+h*o*g-a*u*g,T=t*v+n*x+i*y+s*R;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/T;return e[0]=v*C,e[1]=(_*d*s-u*g*s-_*i*f+n*g*f+u*i*p-n*d*p)*C,e[2]=(o*g*s-_*l*s+_*i*c-n*g*c-o*i*p+n*l*p)*C,e[3]=(u*l*s-o*d*s-u*i*c+n*d*c+o*i*f-n*l*f)*C,e[4]=x*C,e[5]=(h*g*s-m*d*s+m*i*f-t*g*f-h*i*p+t*d*p)*C,e[6]=(m*l*s-a*g*s-m*i*c+t*g*c+a*i*p-t*l*p)*C,e[7]=(a*d*s-h*l*s+h*i*c-t*d*c-a*i*f+t*l*f)*C,e[8]=y*C,e[9]=(m*u*s-h*_*s-m*n*f+t*_*f+h*n*p-t*u*p)*C,e[10]=(a*_*s-m*o*s+m*n*c-t*_*c-a*n*p+t*o*p)*C,e[11]=(h*o*s-a*u*s-h*n*c+t*u*c+a*n*f-t*o*f)*C,e[12]=R*C,e[13]=(h*_*i-m*u*i+m*n*d-t*_*d-h*n*g+t*u*g)*C,e[14]=(m*o*i-a*_*i-m*n*l+t*_*l+a*n*g-t*o*g)*C,e[15]=(a*u*i-h*o*i+h*n*l-t*u*l-a*n*d+t*o*d)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,h*o+n,h*l-i*a,0,c*l-i*o,h*l+i*a,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,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,u=o+o,d=s*c,f=s*h,m=s*u,_=a*h,g=a*u,p=o*u,v=l*c,x=l*h,y=l*u,R=n.x,T=n.y,C=n.z;return i[0]=(1-(_+p))*R,i[1]=(f+y)*R,i[2]=(m-x)*R,i[3]=0,i[4]=(f-y)*T,i[5]=(1-(d+p))*T,i[6]=(g+v)*T,i[7]=0,i[8]=(m+x)*C,i[9]=(g-v)*C,i[10]=(1-(d+_))*C,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=Pi.set(i[0],i[1],i[2]).length();const a=Pi.set(i[4],i[5],i[6]).length(),o=Pi.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],jt.copy(this);const c=1/s,h=1/a,u=1/o;return jt.elements[0]*=c,jt.elements[1]*=c,jt.elements[2]*=c,jt.elements[4]*=h,jt.elements[5]*=h,jt.elements[6]*=h,jt.elements[8]*=u,jt.elements[9]*=u,jt.elements[10]*=u,t.setFromRotationMatrix(jt),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a,o=sn){const l=this.elements,c=2*s/(t-e),h=2*s/(n-i),u=(t+e)/(t-e),d=(n+i)/(n-i);let f,m;if(o===sn)f=-(a+s)/(a-s),m=-2*a*s/(a-s);else if(o===es)f=-a/(a-s),m=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=sn){const l=this.elements,c=1/(t-e),h=1/(n-i),u=1/(a-s),d=(t+e)*c,f=(n+i)*h;let m,_;if(o===sn)m=(a+s)*u,_=-2*u;else if(o===es)m=s*u,_=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=_,l[14]=-m,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 Pi=new w,jt=new Re,hp=new w(0,0,0),up=new w(1,1,1),Nn=new w,dr=new w,qt=new w,mc=new Re,gc=new Gt;class $s{constructor(e=0,t=0,n=0,i=$s.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(ht(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ht(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(ht(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ht(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ht(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-ht(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,f),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 mc.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mc,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return gc.setFromEuler(this),this.setFromQuaternion(gc,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}}$s.DEFAULT_ORDER="XYZ";class _a{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let dp=0;const _c=new w,Li=new Gt,xn=new Re,fr=new w,ds=new w,fp=new w,pp=new Gt,xc=new w(1,0,0),vc=new w(0,1,0),yc=new w(0,0,1),mp={type:"added"},gp={type:"removed"};class Je extends Ln{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:dp++}),this.uuid=Jt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Je.DEFAULT_UP.clone();const e=new w,t=new $s,n=new Gt,i=new w(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Re},normalMatrix:{value:new He}}),this.matrix=new Re,this.matrixWorld=new Re,this.matrixAutoUpdate=Je.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Je.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new _a,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Li.setFromAxisAngle(e,t),this.quaternion.multiply(Li),this}rotateOnWorldAxis(e,t){return Li.setFromAxisAngle(e,t),this.quaternion.premultiply(Li),this}rotateX(e){return this.rotateOnAxis(xc,e)}rotateY(e){return this.rotateOnAxis(vc,e)}rotateZ(e){return this.rotateOnAxis(yc,e)}translateOnAxis(e,t){return _c.copy(e).applyQuaternion(this.quaternion),this.position.add(_c.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(xc,e)}translateY(e){return this.translateOnAxis(vc,e)}translateZ(e){return this.translateOnAxis(yc,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(xn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?fr.copy(e):fr.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),ds.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?xn.lookAt(ds,fr,this.up):xn.lookAt(fr,ds,this.up),this.quaternion.setFromRotationMatrix(xn),i&&(xn.extractRotation(i.matrixWorld),Li.setFromRotationMatrix(xn),this.quaternion.premultiply(Li.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(mp)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(gp)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),xn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),xn.multiply(e.parent.matrixWorld)),e.applyMatrix4(xn),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ds,e,fp),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ds,pp,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++){const o=i[s];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),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(o,l){return o[l.uuid]===void 0&&(o[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 o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),f=a(e.animations),m=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=i,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}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;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Je.DEFAULT_UP=new w(0,1,0);Je.DEFAULT_MATRIX_AUTO_UPDATE=!0;Je.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const en=new w,vn=new w,eo=new w,yn=new w,Ii=new w,Ui=new w,Mc=new w,to=new w,no=new w,io=new w;let pr=!1;class kt{constructor(e=new w,t=new w,n=new w){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),en.subVectors(e,t),i.cross(en);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){en.subVectors(i,t),vn.subVectors(n,t),eo.subVectors(e,t);const a=en.dot(en),o=en.dot(vn),l=en.dot(eo),c=vn.dot(vn),h=vn.dot(eo),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const d=1/u,f=(c*l-o*h)*d,m=(a*h-o*l)*d;return s.set(1-f-m,m,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,yn)===null?!1:yn.x>=0&&yn.y>=0&&yn.x+yn.y<=1}static getUV(e,t,n,i,s,a,o,l){return pr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),pr=!0),this.getInterpolation(e,t,n,i,s,a,o,l)}static getInterpolation(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,yn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,yn.x),l.addScaledVector(a,yn.y),l.addScaledVector(o,yn.z),l)}static isFrontFacing(e,t,n,i){return en.subVectors(n,t),vn.subVectors(e,t),en.cross(vn).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 en.subVectors(this.c,this.b),vn.subVectors(this.a,this.b),en.cross(vn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return kt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return kt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return pr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),pr=!0),kt.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return kt.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return kt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return kt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;Ii.subVectors(i,n),Ui.subVectors(s,n),to.subVectors(e,n);const l=Ii.dot(to),c=Ui.dot(to);if(l<=0&&c<=0)return t.copy(n);no.subVectors(e,i);const h=Ii.dot(no),u=Ui.dot(no);if(h>=0&&u<=h)return t.copy(i);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(Ii,a);io.subVectors(e,s);const f=Ii.dot(io),m=Ui.dot(io);if(m>=0&&f<=m)return t.copy(s);const _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(n).addScaledVector(Ui,o);const g=h*m-f*u;if(g<=0&&u-h>=0&&f-m>=0)return Mc.subVectors(s,i),o=(u-h)/(u-h+(f-m)),t.copy(i).addScaledVector(Mc,o);const p=1/(g+_+d);return a=_*p,o=d*p,t.copy(n).addScaledVector(Ii,a).addScaledVector(Ui,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Wu={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},On={h:0,s:0,l:0},mr={h:0,s:0,l:0};function so(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 pe{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=_t){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Qe.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Qe.workingColorSpace){return this.r=e,this.g=t,this.b=n,Qe.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Qe.workingColorSpace){if(e=Pl(e,1),t=ht(t,0,1),n=ht(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=so(a,s,e+1/3),this.g=so(a,s,e),this.b=so(a,s,e-1/3)}return Qe.toWorkingColorSpace(this,i),this}setStyle(e,t=_t){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,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(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=_t){const n=Wu[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=Qi(e.r),this.g=Qi(e.g),this.b=Qi(e.b),this}copyLinearToSRGB(e){return this.r=qa(e.r),this.g=qa(e.g),this.b=qa(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_t){return Qe.fromWorkingColorSpace(wt.copy(this),e),Math.round(ht(wt.r*255,0,255))*65536+Math.round(ht(wt.g*255,0,255))*256+Math.round(ht(wt.b*255,0,255))}getHexString(e=_t){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Qe.workingColorSpace){Qe.fromWorkingColorSpace(wt.copy(this),t);const n=wt.r,i=wt.g,s=wt.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(i-s)/u+(i<s?6:0);break;case i:l=(s-n)/u+2;break;case s:l=(n-i)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=Qe.workingColorSpace){return Qe.fromWorkingColorSpace(wt.copy(this),t),e.r=wt.r,e.g=wt.g,e.b=wt.b,e}getStyle(e=_t){Qe.fromWorkingColorSpace(wt.copy(this),e);const t=wt.r,n=wt.g,i=wt.b;return e!==_t?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(On),this.setHSL(On.h+e,On.s+t,On.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}
vendor: 2,644 bytes, line 5
5lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(On),e.getHSL(mr);const n=bs(On.h,mr.h,t),i=bs(On.s,mr.s,t),s=bs(On.l,mr.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const wt=new pe;pe.NAMES=Wu;let _p=0;class Lt extends Ln{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:_p++}),this.uuid=Jt(),this.name="",this.type="Material",this.blending=gi,this.side=Cn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ra,this.blendDst=aa,this.blendEquation=kn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new pe(0,0,0),this.blendAlpha=0,this.depthFunc=ws,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ol,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ci,this.stencilZFail=ci,this.stencilZPass=ci,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 19,914 bytes, line 5
5n.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!==gi&&(n.blending=this.blending),this.side!==Cn&&(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!==ra&&(n.blendSrc=this.blendSrc),this.blendDst!==aa&&(n.blendDst=this.blendDst),this.blendEquation!==kn&&(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!==ws&&(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!==ol&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ci&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ci&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ci&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Zn extends Lt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new pe(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=Zs,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 Sn=xp();function xp(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;!(c&8388608);)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function zt(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=ht(r,-65504,65504),Sn.floatView[0]=r;const e=Sn.uint32View[0],t=e>>23&511;return Sn.baseTable[t]+((e&8388607)>>Sn.shiftTable[t])}function Ms(r){const e=r>>10;return Sn.uint32View[0]=Sn.mantissaTable[Sn.offsetTable[e]+(r&1023)]+Sn.exponentTable[e],Sn.floatView[0]}const vp={toHalfFloat:zt,fromHalfFloat:Ms},gt=new w,gr=new Z;class et{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=Bs,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=nn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)gr.fromBufferAttribute(this,t),gr.applyMatrix3(e),this.setXY(t,gr.x,gr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyMatrix3(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyMatrix4(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyNormalMatrix(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.transformDirection(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Ht(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ke(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ht(t,this.array)),t}setX(e,t){return this.normalized&&(t=ke(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ht(t,this.array)),t}setY(e,t){return this.normalized&&(t=ke(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Ht(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ke(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Ht(t,this.array)),t}setW(e,t){return this.normalized&&(t=ke(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ke(t,this.array),n=ke(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ke(t,this.array),n=ke(n,this.array),i=ke(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=ke(t,this.array),n=ke(n,this.array),i=ke(i,this.array),s=ke(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Bs&&(e.usage=this.usage),e}}class yp extends et{constructor(e,t,n){super(new Int8Array(e),t,n)}}class Mp extends et{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class Sp extends et{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class bp extends et{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Ul extends et{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ep extends et{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Dl extends et{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Ap extends et{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Ms(this.array[e*this.itemSize]);return this.normalized&&(t=Ht(t,this.array)),t}setX(e,t){return this.normalized&&(t=ke(t,this.array)),this.array[e*this.itemSize]=zt(t),this}getY(e){let t=Ms(this.array[e*this.itemSize+1]);return this.normalized&&(t=Ht(t,this.array)),t}setY(e,t){return this.normalized&&(t=ke(t,this.array)),this.array[e*this.itemSize+1]=zt(t),this}getZ(e){let t=Ms(this.array[e*this.itemSize+2]);return this.normalized&&(t=Ht(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ke(t,this.array)),this.array[e*this.itemSize+2]=zt(t),this}getW(e){let t=Ms(this.array[e*this.itemSize+3]);return this.normalized&&(t=Ht(t,this.array)),t}setW(e,t){return this.normalized&&(t=ke(t,this.array)),this.array[e*this.itemSize+3]=zt(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ke(t,this.array),n=ke(n,this.array)),this.array[e+0]=zt(t),this.array[e+1]=zt(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ke(t,this.array),n=ke(n,this.array),i=ke(i,this.array)),this.array[e+0]=zt(t),this.array[e+1]=zt(n),this.array[e+2]=zt(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=ke(t,this.array),n=ke(n,this.array),i=ke(i,this.array),s=ke(s,this.array)),this.array[e+0]=zt(t),this.array[e+1]=zt(n),this.array[e+2]=zt(i),this.array[e+3]=zt(s),this}}class ve extends et{constructor(e,t,n){super(new Float32Array(e),t,n)}}class Tp extends et{constructor(e,t,n){super(new Float64Array(e),t,n)}}let wp=0;const Kt=new Re,ro=new Je,Di=new w,Yt=new Ft,fs=new Ft,bt=new w;class Ge extends Ln{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:wp++}),this.uuid=Jt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Vu(e)?Dl:Ul)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new He().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Kt.makeRotationFromQuaternion(e),this.applyMatrix4(Kt),this}rotateX(e){return Kt.makeRotationX(e),this.applyMatrix4(Kt),this}rotateY(e){return Kt.makeRotationY(e),this.applyMatrix4(Kt),this}rotateZ(e){return Kt.makeRotationZ(e),this.applyMatrix4(Kt),this}translate(e,t,n){return Kt.makeTranslation(e,t,n),this.applyMatrix4(Kt),this}scale(e,t,n){return Kt.makeScale(e,t,n),this.applyMatrix4(Kt),this}lookAt(e){return ro.lookAt(e),ro.updateMatrix(),this.applyMatrix4(ro.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Di).negate(),this.translate(Di.x,Di.y,Di.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new ve(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ft);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingBox.set(new w(-1/0,-1/0,-1/0),new w(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];Yt.setFromBufferAttribute(s),this.morphTargetsRelative?(bt.addVectors(this.boundingBox.min,Yt.min),this.boundingBox.expandByPoint(bt),bt.addVectors(this.boundingBox.max,Yt.max),this.boundingBox.expandByPoint(bt)):(this.boundingBox.expandByPoint(Yt.min),this.boundingBox.expandByPoint(Yt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Pt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingSphere.set(new w,1/0);return}if(e){const n=this.boundingSphere.center;if(Yt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];fs.setFromBufferAttribute(o),this.morphTargetsRelative?(bt.addVectors(Yt.min,fs.min),Yt.expandByPoint(bt),bt.addVectors(Yt.max,fs.max),Yt.expandByPoint(bt)):(Yt.expandByPoint(fs.min),Yt.expandByPoint(fs.max))}Yt.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)bt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(bt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)bt.fromBufferAttribute(o,c),l&&(Di.fromBufferAttribute(e,c),bt.add(Di)),i=Math.max(i,n.distanceToSquared(bt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,s=t.normal.array,a=t.uv.array,o=i.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new et(new Float32Array(4*o),4));const l=this.getAttribute("tangent").array,c=[],h=[];for(let E=0;E<o;E++)c[E]=new w,h[E]=new w;const u=new w,d=new w,f=new w,m=new Z,_=new Z,g=new Z,p=new w,v=new w;function x(E,N,G){u.fromArray(i,E*3),d.fromArray(i,N*3),f.fromArray(i,G*3),m.fromArray(a,E*2),_.fromArray(a,N*2),g.fromArray(a,G*2),d.sub(u),f.sub(u),_.sub(m),g.sub(m);const ie=1/(_.x*g.y-g.x*_.y);isFinite(ie)&&(p.copy(d).multiplyScalar(g.y).addScaledVector(f,-_.y).multiplyScalar(ie),v.copy(f).multiplyScalar(_.x).addScaledVector(d,-g.x).multiplyScalar(ie),c[E].add(p),c[N].add(p),c[G].add(p),h[E].add(v),h[N].add(v),h[G].add(v))}let y=this.groups;y.length===0&&(y=[{start:0,count:n.length}]);for(let E=0,N=y.length;E<N;++E){const G=y[E],ie=G.start,I=G.count;for(let F=ie,V=ie+I;F<V;F+=3)x(n[F+0],n[F+1],n[F+2])}const R=new w,T=new w,C=new w,U=new w;function S(E){C.fromArray(s,E*3),U.copy(C);const N=c[E];R.copy(N),R.sub(C.multiplyScalar(C.dot(N))).normalize(),T.crossVectors(U,N);const ie=T.dot(h[E])<0?-1:1;l[E*4]=R.x,l[E*4+1]=R.y,l[E*4+2]=R.z,l[E*4+3]=ie}for(let E=0,N=y.length;E<N;++E){const G=y[E],ie=G.start,I=G.count;for(let F=ie,V=ie+I;F<V;F+=3)S(n[F+0]),S(n[F+1]),S(n[F+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new et(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new w,s=new w,a=new w,o=new w,l=new w,c=new w,h=new w,u=new w;if(e)for(let d=0,f=e.count;d<f;d+=3){const m=e.getX(d+0),_=e.getX(d+1),g=e.getX(d+2);i.fromBufferAttribute(t,m),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,g),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),o.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,g),o.add(h),l.add(h),c.add(h),n.setXYZ(m,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)bt.fromBufferAttribute(e,t),bt.normalize(),e.setXYZ(t,bt.x,bt.y,bt.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,u=o.normalized,d=new c.constructor(l.length*h);let f=0,m=0;for(let _=0,g=l.length;_<g;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*h;for(let p=0;p<h;p++)d[m++]=c[f++]}return new et(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ge,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){const d=c[h],f=e(d,n);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 26,208 bytes, lines 5-98
5if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const 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],h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u];h.push(f.toJSON(e.data))}h.length>0&&(i[l]=h,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.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 h=i[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],u=s[c];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Sc=new Re,ti=new rs,_r=new Pt,bc=new w,Ni=new w,Oi=new w,Fi=new w,ao=new w,xr=new w,vr=new Z,yr=new Z,Mr=new Z,Ec=new w,Ac=new w,Tc=new w,Sr=new w,br=new w;class xt extends Je{constructor(e=new Ge,t=new Zn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){xr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],u=s[l];h!==0&&(ao.fromBufferAttribute(u,e),a?xr.addScaledVector(ao,h):xr.addScaledVector(ao.sub(t),h))}t.add(xr)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),_r.copy(n.boundingSphere),_r.applyMatrix4(s),ti.copy(e.ray).recast(e.near),!(_r.containsPoint(ti.origin)===!1&&(ti.intersectSphere(_r,bc)===null||ti.origin.distanceToSquared(bc)>(e.far-e.near)**2))&&(Sc.copy(s).invert(),ti.copy(e.ray).applyMatrix4(Sc),!(n.boundingBox!==null&&ti.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ti)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],v=Math.max(g.start,f.start),x=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let y=v,R=x;y<R;y+=3){const T=o.getX(y),C=o.getX(y+1),U=o.getX(y+2);i=Er(this,p,e,n,c,h,u,T,C,U),i&&(i.faceIndex=Math.floor(y/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const v=o.getX(g),x=o.getX(g+1),y=o.getX(g+2);i=Er(this,a,e,n,c,h,u,v,x,y),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],v=Math.max(g.start,f.start),x=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let y=v,R=x;y<R;y+=3){const T=y,C=y+1,U=y+2;i=Er(this,p,e,n,c,h,u,T,C,U),i&&(i.faceIndex=Math.floor(y/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const v=g,x=g+1,y=g+2;i=Er(this,a,e,n,c,h,u,v,x,y),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}}}function Cp(r,e,t,n,i,s,a,o){let l;if(e.side===Ot?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,e.side===Cn,o),l===null)return null;br.copy(o),br.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(br);return c<t.near||c>t.far?null:{distance:c,point:br.clone(),object:r}}function Er(r,e,t,n,i,s,a,o,l,c){r.getVertexPosition(o,Ni),r.getVertexPosition(l,Oi),r.getVertexPosition(c,Fi);const h=Cp(r,e,t,n,Ni,Oi,Fi,Sr);if(h){i&&(vr.fromBufferAttribute(i,o),yr.fromBufferAttribute(i,l),Mr.fromBufferAttribute(i,c),h.uv=kt.getInterpolation(Sr,Ni,Oi,Fi,vr,yr,Mr,new Z)),s&&(vr.fromBufferAttribute(s,o),yr.fromBufferAttribute(s,l),Mr.fromBufferAttribute(s,c),h.uv1=kt.getInterpolation(Sr,Ni,Oi,Fi,vr,yr,Mr,new Z),h.uv2=h.uv1),a&&(Ec.fromBufferAttribute(a,o),Ac.fromBufferAttribute(a,l),Tc.fromBufferAttribute(a,c),h.normal=kt.getInterpolation(Sr,Ni,Oi,Fi,Ec,Ac,Tc,new w),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const u={a:o,b:l,c,normal:new w,materialIndex:0};kt.getNormal(Ni,Oi,Fi,u.normal),h.face=u}return h}class bi extends Ge{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0,f=0;m("z","y","x",-1,-1,n,t,e,a,s,0),m("z","y","x",1,-1,n,t,-e,a,s,1),m("x","z","y",1,1,e,n,t,i,a,2),m("x","z","y",1,-1,e,n,-t,i,a,3),m("x","y","z",1,-1,e,t,n,i,s,4),m("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new ve(c,3)),this.setAttribute("normal",new ve(h,3)),this.setAttribute("uv",new ve(u,2));function m(_,g,p,v,x,y,R,T,C,U,S){const E=y/C,N=R/U,G=y/2,ie=R/2,I=T/2,F=C+1,V=U+1;let J=0,Y=0;const W=new w;for(let ee=0;ee<V;ee++){const te=ee*N-ie;for(let ue=0;ue<F;ue++){const H=ue*E-G;W[_]=H*v,W[g]=te*x,W[p]=I,c.push(W.x,W.y,W.z),W[_]=0,W[g]=0,W[p]=T>0?1:-1,h.push(W.x,W.y,W.z),u.push(ue/C),u.push(1-ee/U),J+=1}}for(let ee=0;ee<U;ee++)for(let te=0;te<C;te++){const ue=d+te+F*ee,H=d+te+F*(ee+1),K=d+(te+1)+F*(ee+1),de=d+(te+1)+F*ee;l.push(ue,H,de),l.push(H,K,de),Y+=6}o.addGroup(f,Y,S),f+=Y,d+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ns(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Nt(r){const e={};for(let t=0;t<r.length;t++){const n=ns(r[t]);for(const i in n)e[i]=n[i]}return e}function Rp(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function Xu(r){return r.getRenderTarget()===null?r.outputColorSpace:Qe.workingColorSpace}const qu={clone:ns,merge:Nt};var Pp=`void main() {
6	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7}`,Lp=`void main() {
8	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9}`;class fn extends Lt{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Pp,this.fragmentShader=Lp,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,clipCullDistance:!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=ns(e.uniforms),this.uniformsGroups=Rp(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 a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}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 xa extends Je{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Re,this.projectionMatrix=new Re,this.projectionMatrixInverse=new Re,this.coordinateSystem=sn}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 Et extends xa{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=ts*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(_i*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ts*2*Math.atan(Math.tan(_i*.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,a){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=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(_i*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/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 Bi=-90,zi=1;class Yu extends Je{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Et(Bi,zi,e,t);i.layers=this.layers,this.add(i);const s=new Et(Bi,zi,e,t);s.layers=this.layers,this.add(s);const a=new Et(Bi,zi,e,t);a.layers=this.layers,this.add(a);const o=new Et(Bi,zi,e,t);o.layers=this.layers,this.add(o);const l=new Et(Bi,zi,e,t);l.layers=this.layers,this.add(l);const c=new Et(Bi,zi,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===sn)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),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===es)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),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.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,a,o,l,c,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class Ks extends mt{constructor(e,t,n,i,s,a,o,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:Rn,super(e,t,n,i,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Zu extends rn{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&&(Es("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Gn?_t:Zt),this.texture=new Ks(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:pt}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:`
10
11				varying vec3 vWorldDirection;
12
13				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
14
15					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
16
17				}
18
19				void main() {
20
21					vWorldDirection = transformDirection( position, modelMatrix );
22
23					#include <begin_vertex>
24					#include <project_vertex>
25
26				}
27			`,fragmentShader:`
28
29				uniform sampler2D tEquirect;
30
31				varying vec3 vWorldDirection;
32
33				#include <common>
34
35				void main() {
36
37					vec3 direction = normalize( vWorldDirection );
38
39					vec2 sampleUV = equirectUv( direction );
40
41					gl_FragColor = texture2D( tEquirect, sampleUV );
42
43				}
44			`},i=new bi(5,5,5),s=new fn({name:"CubemapFromEquirect",uniforms:ns(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ot,blending:An});s.uniforms.tEquirect.value=t;const a=new xt(i,s),o=t.minFilter;return t.minFilter===Xn&&(t.minFilter=pt),new Yu(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}const oo=new w,Ip=new w,Up=new He;class zn{constructor(e=new w(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=oo.subVectors(n,t).cross(Ip.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(oo),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||Up.getNormalMatrix(e),i=this.coplanarPoint(oo).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 ni=new Pt,Ar=new w;class Qs{constructor(e=new zn,t=new zn,n=new zn,i=new zn,s=new zn,a=new zn){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),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=sn){const n=this.planes,i=e.elements,s=i[0],a=i[1],o=i[2],l=i[3],c=i[4],h=i[5],u=i[6],d=i[7],f=i[8],m=i[9],_=i[10],g=i[11],p=i[12],v=i[13],x=i[14],y=i[15];if(n[0].setComponents(l-s,d-c,g-f,y-p).normalize(),n[1].setComponents(l+s,d+c,g+f,y+p).normalize(),n[2].setComponents(l+a,d+h,g+m,y+v).normalize(),n[3].setComponents(l-a,d-h,g-m,y-v).normalize(),n[4].setComponents(l-o,d-u,g-_,y-x).normalize(),t===sn)n[5].setComponents(l+o,d+u,g+_,y+x).normalize();else if(t===es)n[5].setComponents(o,u,_,x).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(),ni.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ni.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ni)}intersectsSprite(e){return ni.center.set(0,0,0),ni.radius=.7071067811865476,ni.applyMatrix4(e.matrixWorld),this.intersectsSphere(ni)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Ar.x=i.normal.x>0?e.max.x:e.min.x,Ar.y=i.normal.y>0?e.max.y:e.min.y,Ar.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ar)<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 Ju(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),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,h){const u=c.array,d=c.usage,f=u.byteLength,m=r.createBuffer();r.bindBuffer(h,m),r.bufferData(h,u,d),c.onUploadCallback();let _;if(u instanceof Float32Array)_=r.FLOAT;else if(u instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)_=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=r.UNSIGNED_SHORT;else if(u instanceof Int16Array)_=r.SHORT;else if(u instanceof Uint32Array)_=r.UNSIGNED_INT;else if(u instanceof Int32Array)_=r.INT;else if(u instanceof Int8Array)_=r.BYTE;else if(u instanceof Uint8Array)_=r.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)_=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:m,type:_,bytesPerElement:u.BYTES_PER_ELEMENT,version:c.version,size:f}}function s(c,h,u){const d=h.array,f=h._updateRange,m=h.updateRanges;if(r.bindBuffer(u,c),f.count===-1&&m.length===0&&r.bufferSubData(u,0,d),m.length!==0){for(let _=0,g=m.length;_<g;_++){const p=m[_];t?r.bufferSubData(u,p.start*d.BYTES_PER_ELEMENT,d,p.start,p.count):r.bufferSubData(u,p.start*d.BYTES_PER_ELEMENT,d.subarray(p.start,p.start+p.count))}h.clearUpdateRanges()}f.count!==-1&&(t?r.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d,f.offset,f.count):r.bufferSubData(u,f.offset*d.BYTES_PER_ELEMENT,d.subarray(f.offset,f.offset+f.count)),f.count=-1),h.onUploadCallback()}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const h=n.get(c);h&&(r.deleteBuffer(h.buffer),n.delete(c))}function l(c,h){if(c.isGLBufferAttribute){const d=n.get(c);(!d||d.version<c.version)&&n.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const u=n.get(c);if(u===void 0)n.set(c,i(c,h));else if(u.version<c.version){if(u.size!==c.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");s(u.buffer,c,h),u.version=c.version}}return{get:a,remove:o,update:l}}class js extends Ge{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(i),c=o+1,h=l+1,u=e/o,d=t/l,f=[],m=[],_=[],g=[];for(let p=0;p<h;p++){const v=p*d-a;for(let x=0;x<c;x++){const y=x*u-s;m.push(y,-v,0),_.push(0,0,1),g.push(x/o),g.push(1-p/l)}}for(let p=0;p<l;p++)for(let v=0;v<o;v++){const x=v+c*p,y=v+c*(p+1),R=v+1+c*(p+1),T=v+1+c*p;f.push(x,y,T),f.push(y,R,T)}this.setIndex(f),this.setAttribute("position",new ve(m,3)),this.setAttribute("normal",new ve(_,3)),this.setAttribute("uv",new ve(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new js(e.width,e.height,e.widthSegments,e.heightSegments)}}var Np=`#ifdef USE_ALPHAHASH
45	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
46#endif`,Op=`#ifdef USE_ALPHAHASH
47	const float ALPHA_HASH_SCALE = 0.05;
48	float hash2D( vec2 value ) {
49		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
50	}
51	float hash3D( vec3 value ) {
52		return hash2D( vec2( hash2D( value.xy ), value.z ) );
53	}
54	float getAlphaHashThreshold( vec3 position ) {
55		float maxDeriv = max(
56			length( dFdx( position.xyz ) ),
57			length( dFdy( position.xyz ) )
58		);
59		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
60		vec2 pixScales = vec2(
61			exp2( floor( log2( pixScale ) ) ),
62			exp2( ceil( log2( pixScale ) ) )
63		);
64		vec2 alpha = vec2(
65			hash3D( floor( pixScales.x * position.xyz ) ),
66			hash3D( floor( pixScales.y * position.xyz ) )
67		);
68		float lerpFactor = fract( log2( pixScale ) );
69		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
70		float a = min( lerpFactor, 1.0 - lerpFactor );
71		vec3 cases = vec3(
72			x * x / ( 2.0 * a * ( 1.0 - a ) ),
73			( x - 0.5 * a ) / ( 1.0 - a ),
74			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
75		);
76		float threshold = ( x < ( 1.0 - a ) )
77			? ( ( x < a ) ? cases.x : cases.y )
78			: cases.z;
79		return clamp( threshold , 1.0e-6, 1.0 );
80	}
81#endif`,Fp=`#ifdef USE_ALPHAMAP
82	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
83#endif`,Bp=`#ifdef USE_ALPHAMAP
84	uniform sampler2D alphaMap;
85#endif`,zp=`#ifdef USE_ALPHATEST
86	if ( diffuseColor.a < alphaTest ) discard;
87#endif`,kp=`#ifdef USE_ALPHATEST
88	uniform float alphaTest;
89#endif`,Vp=`#ifdef USE_AOMAP
90	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
91	reflectedLight.indirectDiffuse *= ambientOcclusion;
92	#if defined( USE_CLEARCOAT ) 
93		clearcoatSpecularIndirect *= ambientOcclusion;
94	#endif
95	#if defined( USE_SHEEN ) 
96		sheenSpecularIndirect *= ambientOcclusion;
97	#endif
98	#if defined( USE_ENVMAP ) && defined( STANDARD )
99		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
100		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
101	#endif
102#endif`,Hp=`#ifdef USE_AOMAP
103	uniform sampler2D aoMap;
104	uniform float aoMapIntensity;
105#endif`,Gp=`#ifdef USE_BATCHING
106	attribute float batchId;
107	uniform highp sampler2D batchingTexture;
108	mat4 getBatchingMatrix( const in float i ) {
109		int size = textureSize( batchingTexture, 0 ).x;
110		int j = int( i ) * 4;
111		int x = j % size;
112		int y = j / size;
113		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
114		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
115		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
116		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
117		return mat4( v1, v2, v3, v4 );
118	}
119#endif`,Wp=`#ifdef USE_BATCHING
120	mat4 batchingMatrix = getBatchingMatrix( batchId );
121#endif`,Xp=`vec3 transformed = vec3( position );
122#ifdef USE_ALPHAHASH
123	vPosition = vec3( position );
124#endif`,qp=`vec3 objectNormal = vec3( normal );
125#ifdef USE_TANGENT
126	vec3 objectTangent = vec3( tangent.xyz );
127#endif`,Yp=`float G_BlinnPhong_Implicit( ) {
128	return 0.25;
129}
130float D_BlinnPhong( const in float shininess, const in float dotNH ) {
131	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
132}
133vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
134	vec3 halfDir = normalize( lightDir + viewDir );
135	float dotNH = saturate( dot( normal, halfDir ) );
136	float dotVH = saturate( dot( viewDir, halfDir ) );
137	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
138	float G = G_BlinnPhong_Implicit( );
139	float D = D_BlinnPhong( shininess, dotNH );
140	return F * ( G * D );
141} // validated`,Zp=`#ifdef USE_IRIDESCENCE
142	const mat3 XYZ_TO_REC709 = mat3(
143		 3.2404542, -0.9692660,  0.0556434,
144		-1.5371385,  1.8760108, -0.2040259,
145		-0.4985314,  0.0415560,  1.0572252
146	);
147	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
148		vec3 sqrtF0 = sqrt( fresnel0 );
149		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
150	}
151	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
152		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
153	}
154	float IorToFresnel0( float transmittedIor, float incidentIor ) {
155		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
156	}
157	vec3 evalSensitivity( float OPD, vec3 shift ) {
158		float phase = 2.0 * PI * OPD * 1.0e-9;
159		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
160		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
161		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
162		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
163		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
164		xyz /= 1.0685e-7;
165		vec3 rgb = XYZ_TO_REC709 * xyz;
166		return rgb;
167	}
168	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
169		vec3 I;
170		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
171		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
172		float cosTheta2Sq = 1.0 - sinTheta2Sq;
173		if ( cosTheta2Sq < 0.0 ) {
174			return vec3( 1.0 );
175		}
176		float cosTheta2 = sqrt( cosTheta2Sq );
177		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
178		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
179		float T121 = 1.0 - R12;
180		float phi12 = 0.0;
181		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
182		float phi21 = PI - phi12;
183		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
184		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
185		vec3 phi23 = vec3( 0.0 );
186		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
187		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
188		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
189		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
190		vec3 phi = vec3( phi21 ) + phi23;
191		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
192		vec3 r123 = sqrt( R123 );
193		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
194		vec3 C0 = R12 + Rs;
195		I = C0;
196		vec3 Cm = Rs - T121;
197		for ( int m = 1; m <= 2; ++ m ) {
198			Cm *= r123;
199			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
200			I += Cm * Sm;
201		}
202		return max( I, vec3( 0.0 ) );
203	}
204#endif`,Jp=`#ifdef USE_BUMPMAP
205	uniform sampler2D bumpMap;
206	uniform float bumpScale;
207	vec2 dHdxy_fwd() {
208		vec2 dSTdx = dFdx( vBumpMapUv );
209		vec2 dSTdy = dFdy( vBumpMapUv );
210		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
211		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
212		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
213		return vec2( dBx, dBy );
214	}
215	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
216		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
217		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
218		vec3 vN = surf_norm;
219		vec3 R1 = cross( vSigmaY, vN );
220		vec3 R2 = cross( vN, vSigmaX );
221		float fDet = dot( vSigmaX, R1 ) * faceDirection;
222		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
223		return normalize( abs( fDet ) * surf_norm - vGrad );
224	}
225#endif`,$p=`#if NUM_CLIPPING_PLANES > 0
226	vec4 plane;
227	#pragma unroll_loop_start
228	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
229		plane = clippingPlanes[ i ];
230		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
231	}
232	#pragma unroll_loop_end
233	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
234		bool clipped = true;
235		#pragma unroll_loop_start
236		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
237			plane = clippingPlanes[ i ];
238			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
239		}
240		#pragma unroll_loop_end
241		if ( clipped ) discard;
242	#endif
243#endif`,Kp=`#if NUM_CLIPPING_PLANES > 0
244	varying vec3 vClipPosition;
245	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
246#endif`,Qp=`#if NUM_CLIPPING_PLANES > 0
247	varying vec3 vClipPosition;
248#endif`,jp=`#if NUM_CLIPPING_PLANES > 0
249	vClipPosition = - mvPosition.xyz;
250#endif`,em=`#if defined( USE_COLOR_ALPHA )
251	diffuseColor *= vColor;
252#elif defined( USE_COLOR )
253	diffuseColor.rgb *= vColor;
254#endif`,tm=`#if defined( USE_COLOR_ALPHA )
255	varying vec4 vColor;
256#elif defined( USE_COLOR )
257	varying vec3 vColor;
258#endif`,nm=`#if defined( USE_COLOR_ALPHA )
259	varying vec4 vColor;
260#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
261	varying vec3 vColor;
262#endif`,im=`#if defined( USE_COLOR_ALPHA )
263	vColor = vec4( 1.0 );
264#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
265	vColor = vec3( 1.0 );
266#endif
267#ifdef USE_COLOR
268	vColor *= color;
269#endif
270#ifdef USE_INSTANCING_COLOR
271	vColor.xyz *= instanceColor.xyz;
272#endif`,sm=`#define PI 3.141592653589793
273#define PI2 6.283185307179586
274#define PI_HALF 1.5707963267948966
275#define RECIPROCAL_PI 0.3183098861837907
276#define RECIPROCAL_PI2 0.15915494309189535
277#define EPSILON 1e-6
278#ifndef saturate
279#define saturate( a ) clamp( a, 0.0, 1.0 )
280#endif
281#define whiteComplement( a ) ( 1.0 - saturate( a ) )
282float pow2( const in float x ) { return x*x; }
283vec3 pow2( const in vec3 x ) { return x*x; }
284float pow3( const in float x ) { return x*x*x; }
285float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
286float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
287float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
288highp float rand( const in vec2 uv ) {
289	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
290	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
291	return fract( sin( sn ) * c );
292}
293#ifdef HIGH_PRECISION
294	float precisionSafeLength( vec3 v ) { return length( v ); }
295#else
296	float precisionSafeLength( vec3 v ) {
297		float maxComponent = max3( abs( v ) );
298		return length( v / maxComponent ) * maxComponent;
299	}
300#endif
301struct IncidentLight {
302	vec3 color;
303	vec3 direction;
304	bool visible;
305};
306struct ReflectedLight {
307	vec3 directDiffuse;
308	vec3 directSpecular;
309	vec3 indirectDiffuse;
310	vec3 indirectSpecular;
311};
312#ifdef USE_ALPHAHASH
313	varying vec3 vPosition;
314#endif
315vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
316	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
317}
318vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
319	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
320}
321mat3 transposeMat3( const in mat3 m ) {
322	mat3 tmp;
323	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
324	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
325	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
326	return tmp;
327}
328float luminance( const in vec3 rgb ) {
329	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
330	return dot( weights, rgb );
331}
332bool isPerspectiveMatrix( mat4 m ) {
333	return m[ 2 ][ 3 ] == - 1.0;
334}
335vec2 equirectUv( in vec3 dir ) {
336	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
337	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
338	return vec2( u, v );
339}
340vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
341	return RECIPROCAL_PI * diffuseColor;
342}
343vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
344	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
345	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
346}
347float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
348	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
349	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
350} // validated`,rm=`#ifdef ENVMAP_TYPE_CUBE_UV
351	#define cubeUV_minMipLevel 4.0
352	#define cubeUV_minTileSize 16.0
353	float getFace( vec3 direction ) {
354		vec3 absDirection = abs( direction );
355		float face = - 1.0;
356		if ( absDirection.x > absDirection.z ) {
357			if ( absDirection.x > absDirection.y )
358				face = direction.x > 0.0 ? 0.0 : 3.0;
359			else
360				face = direction.y > 0.0 ? 1.0 : 4.0;
361		} else {
362			if ( absDirection.z > absDirection.y )
363				face = direction.z > 0.0 ? 2.0 : 5.0;
364			else
365				face = direction.y > 0.0 ? 1.0 : 4.0;
366		}
367		return face;
368	}
369	vec2 getUV( vec3 direction, float face ) {
370		vec2 uv;
371		if ( face == 0.0 ) {
372			uv = vec2( direction.z, direction.y ) / abs( direction.x );
373		} else if ( face == 1.0 ) {
374			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
375		} else if ( face == 2.0 ) {
376			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
377		} else if ( face == 3.0 ) {
378			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
379		} else if ( face == 4.0 ) {
380			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
381		} else {
382			uv = vec2( direction.x, direction.y ) / abs( direction.z );
383		}
384		return 0.5 * ( uv + 1.0 );
385	}
386	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
387		float face = getFace( direction );
388		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
389		mipInt = max( mipInt, cubeUV_minMipLevel );
390		float faceSize = exp2( mipInt );
391		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
392		if ( face > 2.0 ) {
393			uv.y += faceSize;
394			face -= 3.0;
395		}
396		uv.x += face * faceSize;
397		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
398		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
399		uv.x *= CUBEUV_TEXEL_WIDTH;
400		uv.y *= CUBEUV_TEXEL_HEIGHT;
401		#ifdef texture2DGradEXT
402			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
403		#else
404			return texture2D( envMap, uv ).rgb;
405		#endif
406	}
407	#define cubeUV_r0 1.0
408	#define cubeUV_m0 - 2.0
409	#define cubeUV_r1 0.8
410	#define cubeUV_m1 - 1.0
411	#define cubeUV_r4 0.4
412	#define cubeUV_m4 2.0
413	#define cubeUV_r5 0.305
414	#define cubeUV_m5 3.0
415	#define cubeUV_r6 0.21
416	#define cubeUV_m6 4.0
417	float roughnessToMip( float roughness ) {
418		float mip = 0.0;
419		if ( roughness >= cubeUV_r1 ) {
420			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
421		} else if ( roughness >= cubeUV_r4 ) {
422			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
423		} else if ( roughness >= cubeUV_r5 ) {
424			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
425		} else if ( roughness >= cubeUV_r6 ) {
426			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
427		} else {
428			mip = - 2.0 * log2( 1.16 * roughness );		}
429		return mip;
430	}
431	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
432		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
433		float mipF = fract( mip );
434		float mipInt = floor( mip );
435		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
436		if ( mipF == 0.0 ) {
437			return vec4( color0, 1.0 );
438		} else {
439			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
440			return vec4( mix( color0, color1, mipF ), 1.0 );
441		}
442	}
443#endif`,am=`vec3 transformedNormal = objectNormal;
444#ifdef USE_TANGENT
445	vec3 transformedTangent = objectTangent;
446#endif
447#ifdef USE_BATCHING
448	mat3 bm = mat3( batchingMatrix );
449	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
450	transformedNormal = bm * transformedNormal;
451	#ifdef USE_TANGENT
452		transformedTangent = bm * transformedTangent;
453	#endif
454#endif
455#ifdef USE_INSTANCING
456	mat3 im = mat3( instanceMatrix );
457	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
458	transformedNormal = im * transformedNormal;
459	#ifdef USE_TANGENT
460		transformedTangent = im * transformedTangent;
461	#endif
462#endif
463transformedNormal = normalMatrix * transformedNormal;
464#ifdef FLIP_SIDED
465	transformedNormal = - transformedNormal;
466#endif
467#ifdef USE_TANGENT
468	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
469	#ifdef FLIP_SIDED
470		transformedTangent = - transformedTangent;
471	#endif
472#endif`,om=`#ifdef USE_DISPLACEMENTMAP
473	uniform sampler2D displacementMap;
474	uniform float displacementScale;
475	uniform float displacementBias;
476#endif`,lm=`#ifdef USE_DISPLACEMENTMAP
477	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
477placementBias );
478#endif`,cm=`#ifdef USE_EMISSIVEMAP
479	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
480	totalEmissiveRadiance *= emissiveColor.rgb;
481#endif`,hm=`#ifdef USE_EMISSIVEMAP
482	uniform sampler2D emissiveMap;
483#endif`,um="gl_FragColor = linearToOutputTexel( gl_FragColor );",dm=`
484const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
485	vec3( 0.8224621, 0.177538, 0.0 ),
486	vec3( 0.0331941, 0.9668058, 0.0 ),
487	vec3( 0.0170827, 0.0723974, 0.9105199 )
488);
489const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
490	vec3( 1.2249401, - 0.2249404, 0.0 ),
491	vec3( - 0.0420569, 1.0420571, 0.0 ),
492	vec3( - 0.0196376, - 0.0786361, 1.0982735 )
493);
494vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
495	return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
496}
497vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
498	return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
499}
500vec4 LinearTransferOETF( in vec4 value ) {
501	return value;
502}
503vec4 sRGBTransferOETF( in vec4 value ) {
504	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
505}
506vec4 LinearToLinear( in vec4 value ) {
507	return value;
508}
509vec4 LinearTosRGB( in vec4 value ) {
510	return sRGBTransferOETF( value );
511}`,fm=`#ifdef USE_ENVMAP
512	#ifdef ENV_WORLDPOS
513		vec3 cameraToFrag;
514		if ( isOrthographic ) {
515			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
516		} else {
517			cameraToFrag = normalize( vWorldPosition - cameraPosition );
518		}
519		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
520		#ifdef ENVMAP_MODE_REFLECTION
521			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
522		#else
523			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
524		#endif
525	#else
526		vec3 reflectVec = vReflect;
527	#endif
528	#ifdef ENVMAP_TYPE_CUBE
529		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
530	#else
531		vec4 envColor = vec4( 0.0 );
532	#endif
533	#ifdef ENVMAP_BLENDING_MULTIPLY
534		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
535	#elif defined( ENVMAP_BLENDING_MIX )
536		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
537	#elif defined( ENVMAP_BLENDING_ADD )
538		outgoingLight += envColor.xyz * specularStrength * reflectivity;
539	#endif
540#endif`,pm=`#ifdef USE_ENVMAP
541	uniform float envMapIntensity;
542	uniform float flipEnvMap;
543	#ifdef ENVMAP_TYPE_CUBE
544		uniform samplerCube envMap;
545	#else
546		uniform sampler2D envMap;
547	#endif
548	
549#endif`,mm=`#ifdef USE_ENVMAP
550	uniform float reflectivity;
551	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
552		#define ENV_WORLDPOS
553	#endif
554	#ifdef ENV_WORLDPOS
555		varying vec3 vWorldPosition;
556		uniform float refractionRatio;
557	#else
558		varying vec3 vReflect;
559	#endif
560#endif`,gm=`#ifdef USE_ENVMAP
561	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
562		#define ENV_WORLDPOS
563	#endif
564	#ifdef ENV_WORLDPOS
565		
566		varying vec3 vWorldPosition;
567	#else
568		varying vec3 vReflect;
569		uniform float refractionRatio;
570	#endif
571#endif`,_m=`#ifdef USE_ENVMAP
572	#ifdef ENV_WORLDPOS
573		vWorldPosition = worldPosition.xyz;
574	#else
575		vec3 cameraToVertex;
576		if ( isOrthographic ) {
577			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
578		} else {
579			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
580		}
581		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
582		#ifdef ENVMAP_MODE_REFLECTION
583			vReflect = reflect( cameraToVertex, worldNormal );
584		#else
585			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
586		#endif
587	#endif
588#endif`,xm=`#ifdef USE_FOG
589	vFogDepth = - mvPosition.z;
590#endif`,vm=`#ifdef USE_FOG
591	varying float vFogDepth;
592#endif`,ym=`#ifdef USE_FOG
593	#ifdef FOG_EXP2
594		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
595	#else
596		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
597	#endif
598	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
599#endif`,Mm=`#ifdef USE_FOG
600	uniform vec3 fogColor;
601	varying float vFogDepth;
602	#ifdef FOG_EXP2
603		uniform float fogDensity;
604	#else
605		uniform float fogNear;
606		uniform float fogFar;
607	#endif
608#endif`,Sm=`#ifdef USE_GRADIENTMAP
609	uniform sampler2D gradientMap;
610#endif
611vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
612	float dotNL = dot( normal, lightDirection );
613	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
614	#ifdef USE_GRADIENTMAP
615		return vec3( texture2D( gradientMap, coord ).r );
616	#else
617		vec2 fw = fwidth( coord ) * 0.5;
618		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
619	#endif
620}`,bm=`#ifdef USE_LIGHTMAP
621	vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
622	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
623	reflectedLight.indirectDiffuse += lightMapIrradiance;
624#endif`,Em=`#ifdef USE_LIGHTMAP
625	uniform sampler2D lightMap;
626	uniform float lightMapIntensity;
627#endif`,Am=`LambertMaterial material;
628material.diffuseColor = diffuseColor.rgb;
629material.specularStrength = specularStrength;`,Tm=`varying vec3 vViewPosition;
630struct LambertMaterial {
631	vec3 diffuseColor;
632	float specularStrength;
633};
634void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
635	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
636	vec3 irradiance = dotNL * directLight.color;
637	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
638}
639void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
640	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
641}
642#define RE_Direct				RE_Direct_Lambert
643#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,wm=`uniform bool receiveShadow;
644uniform vec3 ambientLightColor;
645#if defined( USE_LIGHT_PROBES )
646	uniform vec3 lightProbe[ 9 ];
647#endif
648vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
649	float x = normal.x, y = normal.y, z = normal.z;
650	vec3 result = shCoefficients[ 0 ] * 0.886227;
651	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
652	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
653	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
654	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
655	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
656	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
657	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
658	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
659	return result;
660}
661vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
662	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
663	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
664	return irradiance;
665}
666vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
667	vec3 irradiance = ambientLightColor;
668	return irradiance;
669}
670float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
671	#if defined ( LEGACY_LIGHTS )
672		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
673			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
674		}
675		return 1.0;
676	#else
677		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
678		if ( cutoffDistance > 0.0 ) {
679			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
680		}
681		return distanceFalloff;
682	#endif
683}
684float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
685	return smoothstep( coneCosine, penumbraCosine, angleCosine );
686}
687#if NUM_DIR_LIGHTS > 0
688	struct DirectionalLight {
689		vec3 direction;
690		vec3 color;
691	};
692	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
693	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
694		light.color = directionalLight.color;
695		light.direction = directionalLight.direction;
696		light.visible = true;
697	}
698#endif
699#if NUM_POINT_LIGHTS > 0
700	struct PointLight {
701		vec3 position;
702		vec3 color;
703		float distance;
704		float decay;
705	};
706	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
707	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
708		vec3 lVector = pointLight.position - geometryPosition;
709		light.direction = normalize( lVector );
710		float lightDistance = length( lVector );
711		light.color = pointLight.color;
712		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
713		light.visible = ( light.color != vec3( 0.0 ) );
714	}
715#endif
716#if NUM_SPOT_LIGHTS > 0
717	struct SpotLight {
718		vec3 position;
719		vec3 direction;
720		vec3 color;
721		float distance;
722		float decay;
723		float coneCos;
724		float penumbraCos;
725	};
726	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
727	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
728		vec3 lVector = spotLight.position - geometryPosition;
729		light.direction = normalize( lVector );
730		float angleCos = dot( light.direction, spotLight.direction );
731		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
732		if ( spotAttenuation > 0.0 ) {
733			float lightDistance = length( lVector );
734			light.color = spotLight.color * spotAttenuation;
735			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
736			light.visible = ( light.color != vec3( 0.0 ) );
737		} else {
738			light.color = vec3( 0.0 );
739			light.visible = false;
740		}
741	}
742#endif
743#if NUM_RECT_AREA_LIGHTS > 0
744	struct RectAreaLight {
745		vec3 color;
746		vec3 position;
747		vec3 halfWidth;
748		vec3 halfHeight;
749	};
750	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
751	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
752#endif
753#if NUM_HEMI_LIGHTS > 0
754	struct HemisphereLight {
755		vec3 direction;
756		vec3 skyColor;
757		vec3 groundColor;
758	};
759	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
760	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
761		float dotNL = dot( normal, hemiLight.direction );
762		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
763		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
764		return irradiance;
765	}
766#endif`,Cm=`#ifdef USE_ENVMAP
767	vec3 getIBLIrradiance( const in vec3 normal ) {
768		#ifdef ENVMAP_TYPE_CUBE_UV
769			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
770			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
771			return PI * envMapColor.rgb * envMapIntensity;
772		#else
773			return vec3( 0.0 );
774		#endif
775	}
776	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
777		#ifdef ENVMAP_TYPE_CUBE_UV
778			vec3 reflectVec = reflect( - viewDir, normal );
779			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
780			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
781			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
782			return envMapColor.rgb * envMapIntensity;
783		#else
784			return vec3( 0.0 );
785		#endif
786	}
787	#ifdef USE_ANISOTROPY
788		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
789			#ifdef ENVMAP_TYPE_CUBE_UV
790				vec3 bentNormal = cross( bitangent, viewDir );
791				bentNormal = normalize( cross( bentNormal, bitangent ) );
792				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
793				return getIBLRadiance( viewDir, bentNormal, roughness );
794			#else
795				return vec3( 0.0 );
796			#endif
797		}
798	#endif
799#endif`,Rm=`ToonMaterial material;
800material.diffuseColor = diffuseColor.rgb;`,Pm=`varying vec3 vViewPosition;
801struct ToonMaterial {
802	vec3 diffuseColor;
803};
804void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
805	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
806	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
807}
808void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
809	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
810}
811#define RE_Direct				RE_Direct_Toon
812#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Lm=`BlinnPhongMaterial material;
813material.diffuseColor = diffuseColor.rgb;
814material.specularColor = specular;
815material.specularShininess = shininess;
816material.specularStrength = specularStrength;`,Im=`varying vec3 vViewPosition;
817struct BlinnPhongMaterial {
818	vec3 diffuseColor;
819	vec3 specularColor;
820	float specularShininess;
821	float specularStrength;
822};
823void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
824	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
825	vec3 irradiance = dotNL * directLight.color;
826	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
827	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
828}
829void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
830	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
831}
832#define RE_Direct				RE_Direct_BlinnPhong
833#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,Um=`PhysicalMaterial material;
834material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
835vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
836float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
837material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
838material.roughness = min( material.roughness, 1.0 );
839#ifdef IOR
840	material.ior = ior;
841	#ifdef USE_SPECULAR
842		float specularIntensityFactor = specularIntensity;
843		vec3 specularColorFactor = specularColor;
844		#ifdef USE_SPECULAR_COLORMAP
845			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
846		#endif
847		#ifdef USE_SPECULAR_INTENSITYMAP
848			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
849		#endif
850		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
851	#else
852		float specularIntensityFactor = 1.0;
853		vec3 specularColorFactor = vec3( 1.0 );
854		material.specularF90 = 1.0;
855	#endif
856	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
857#else
858	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
859	material.specularF90 = 1.0;
860#endif
861#ifdef USE_CLEARCOAT
862	material.clearcoat = clearcoat;
863	material.clearcoatRoughness = clearcoatRoughness;
864	material.clearcoatF0 = vec3( 0.04 );
865	material.clearcoatF90 = 1.0;
866	#ifdef USE_CLEARCOATMAP
867		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
868	#endif
869	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
870		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
871	#endif
872	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
873	material.clearcoatRoughness += geometryRoughness;
874	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
875#endif
876#ifdef USE_IRIDESCENCE
877	material.iridescence = iridescence;
878	material.iridescenceIOR = iridescenceIOR;
879	#ifdef USE_IRIDESCENCEMAP
880		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
881	#endif
882	#ifdef USE_IRIDESCENCE_THICKNESSMAP
883		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
884	#else
885		material.iridescenceThickness = iridescenceThicknessMaximum;
886	#endif
887#endif
888#ifdef USE_SHEEN
889	material.sheenColor = sheenColor;
890	#ifdef USE_SHEEN_COLORMAP
891		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
892	#endif
893	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
894	#ifdef USE_SHEEN_ROUGHNESSMAP
895		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
896	#endif
897#endif
898#ifdef USE_ANISOTROPY
899	#ifdef USE_ANISOTROPYMAP
900		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
901		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
902		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
903	#else
904		vec2 anisotropyV = anisotropyVector;
905	#endif
906	material.anisotropy = length( anisotropyV );
907	if( material.anisotropy == 0.0 ) {
908		anisotropyV = vec2( 1.0, 0.0 );
909	} else {
910		anisotropyV /= material.anisotropy;
911		material.anisotropy = saturate( material.anisotropy );
912	}
913	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
914	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
915	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
916#endif`,Dm=`struct PhysicalMaterial {
917	vec3 diffuseColor;
918	float roughness;
919	vec3 specularColor;
920	float specularF90
vendor: 14,563 bytes, lines 920-1216
920;
921	#ifdef USE_CLEARCOAT
922		float clearcoat;
923		float clearcoatRoughness;
924		vec3 clearcoatF0;
925		float clearcoatF90;
926	#endif
927	#ifdef USE_IRIDESCENCE
928		float iridescence;
929		float iridescenceIOR;
930		float iridescenceThickness;
931		vec3 iridescenceFresnel;
932		vec3 iridescenceF0;
933	#endif
934	#ifdef USE_SHEEN
935		vec3 sheenColor;
936		float sheenRoughness;
937	#endif
938	#ifdef IOR
939		float ior;
940	#endif
941	#ifdef USE_TRANSMISSION
942		float transmission;
943		float transmissionAlpha;
944		float thickness;
945		float attenuationDistance;
946		vec3 attenuationColor;
947	#endif
948	#ifdef USE_ANISOTROPY
949		float anisotropy;
950		float alphaT;
951		vec3 anisotropyT;
952		vec3 anisotropyB;
953	#endif
954};
955vec3 clearcoatSpecularDirect = vec3( 0.0 );
956vec3 clearcoatSpecularIndirect = vec3( 0.0 );
957vec3 sheenSpecularDirect = vec3( 0.0 );
958vec3 sheenSpecularIndirect = vec3(0.0 );
959vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
960    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
961    float x2 = x * x;
962    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
963    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
964}
965float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
966	float a2 = pow2( alpha );
967	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
968	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
969	return 0.5 / max( gv + gl, EPSILON );
970}
971float D_GGX( const in float alpha, const in float dotNH ) {
972	float a2 = pow2( alpha );
973	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
974	return RECIPROCAL_PI * a2 / pow2( denom );
975}
976#ifdef USE_ANISOTROPY
977	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
978		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
979		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
980		float v = 0.5 / ( gv + gl );
981		return saturate(v);
982	}
983	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
984		float a2 = alphaT * alphaB;
985		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
986		highp float v2 = dot( v, v );
987		float w2 = a2 / v2;
988		return RECIPROCAL_PI * a2 * pow2 ( w2 );
989	}
990#endif
991#ifdef USE_CLEARCOAT
992	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
993		vec3 f0 = material.clearcoatF0;
994		float f90 = material.clearcoatF90;
995		float roughness = material.clearcoatRoughness;
996		float alpha = pow2( roughness );
997		vec3 halfDir = normalize( lightDir + viewDir );
998		float dotNL = saturate( dot( normal, lightDir ) );
999		float dotNV = saturate( dot( normal, viewDir ) );
1000		float dotNH = saturate( dot( normal, halfDir ) );
1001		float dotVH = saturate( dot( viewDir, halfDir ) );
1002		vec3 F = F_Schlick( f0, f90, dotVH );
1003		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1004		float D = D_GGX( alpha, dotNH );
1005		return F * ( V * D );
1006	}
1007#endif
1008vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1009	vec3 f0 = material.specularColor;
1010	float f90 = material.specularF90;
1011	float roughness = material.roughness;
1012	float alpha = pow2( roughness );
1013	vec3 halfDir = normalize( lightDir + viewDir );
1014	float dotNL = saturate( dot( normal, lightDir ) );
1015	float dotNV = saturate( dot( normal, viewDir ) );
1016	float dotNH = saturate( dot( normal, halfDir ) );
1017	float dotVH = saturate( dot( viewDir, halfDir ) );
1018	vec3 F = F_Schlick( f0, f90, dotVH );
1019	#ifdef USE_IRIDESCENCE
1020		F = mix( F, material.iridescenceFresnel, material.iridescence );
1021	#endif
1022	#ifdef USE_ANISOTROPY
1023		float dotTL = dot( material.anisotropyT, lightDir );
1024		float dotTV = dot( material.anisotropyT, viewDir );
1025		float dotTH = dot( material.anisotropyT, halfDir );
1026		float dotBL = dot( material.anisotropyB, lightDir );
1027		float dotBV = dot( material.anisotropyB, viewDir );
1028		float dotBH = dot( material.anisotropyB, halfDir );
1029		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1030		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1031	#else
1032		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1033		float D = D_GGX( alpha, dotNH );
1034	#endif
1035	return F * ( V * D );
1036}
1037vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1038	const float LUT_SIZE = 64.0;
1039	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1040	const float LUT_BIAS = 0.5 / LUT_SIZE;
1041	float dotNV = saturate( dot( N, V ) );
1042	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1043	uv = uv * LUT_SCALE + LUT_BIAS;
1044	return uv;
1045}
1046float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1047	float l = length( f );
1048	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1049}
1050vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1051	float x = dot( v1, v2 );
1052	float y = abs( x );
1053	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1054	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1055	float v = a / b;
1056	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1057	return cross( v1, v2 ) * theta_sintheta;
1058}
1059vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1060	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1061	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1062	vec3 lightNormal = cross( v1, v2 );
1063	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1064	vec3 T1, T2;
1065	T1 = normalize( V - N * dot( V, N ) );
1066	T2 = - cross( N, T1 );
1067	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1068	vec3 coords[ 4 ];
1069	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1070	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1071	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1072	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1073	coords[ 0 ] = normalize( coords[ 0 ] );
1074	coords[ 1 ] = normalize( coords[ 1 ] );
1075	coords[ 2 ] = normalize( coords[ 2 ] );
1076	coords[ 3 ] = normalize( coords[ 3 ] );
1077	vec3 vectorFormFactor = vec3( 0.0 );
1078	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1079	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1080	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1081	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1082	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1083	return vec3( result );
1084}
1085#if defined( USE_SHEEN )
1086float D_Charlie( float roughness, float dotNH ) {
1087	float alpha = pow2( roughness );
1088	float invAlpha = 1.0 / alpha;
1089	float cos2h = dotNH * dotNH;
1090	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1091	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1092}
1093float V_Neubelt( float dotNV, float dotNL ) {
1094	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1095}
1096vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1097	vec3 halfDir = normalize( lightDir + viewDir );
1098	float dotNL = saturate( dot( normal, lightDir ) );
1099	float dotNV = saturate( dot( normal, viewDir ) );
1100	float dotNH = saturate( dot( normal, halfDir ) );
1101	float D = D_Charlie( sheenRoughness, dotNH );
1102	float V = V_Neubelt( dotNV, dotNL );
1103	return sheenColor * ( D * V );
1104}
1105#endif
1106float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1107	float dotNV = saturate( dot( normal, viewDir ) );
1108	float r2 = roughness * roughness;
1109	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1110	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1111	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1112	return saturate( DG * RECIPROCAL_PI );
1113}
1114vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1115	float dotNV = saturate( dot( normal, viewDir ) );
1116	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1117	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1118	vec4 r = roughness * c0 + c1;
1119	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1120	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1121	return fab;
1122}
1123vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1124	vec2 fab = DFGApprox( normal, viewDir, roughness );
1125	return specularColor * fab.x + specularF90 * fab.y;
1126}
1127#ifdef USE_IRIDESCENCE
1128void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1129#else
1130void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1131#endif
1132	vec2 fab = DFGApprox( normal, viewDir, roughness );
1133	#ifdef USE_IRIDESCENCE
1134		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1135	#else
1136		vec3 Fr = specularColor;
1137	#endif
1138	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1139	float Ess = fab.x + fab.y;
1140	float Ems = 1.0 - Ess;
1141	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1142	singleScatter += FssEss;
1143	multiScatter += Fms * Ems;
1144}
1145#if NUM_RECT_AREA_LIGHTS > 0
1146	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1147		vec3 normal = geometryNormal;
1148		vec3 viewDir = geometryViewDir;
1149		vec3 position = geometryPosition;
1150		vec3 lightPos = rectAreaLight.position;
1151		vec3 halfWidth = rectAreaLight.halfWidth;
1152		vec3 halfHeight = rectAreaLight.halfHeight;
1153		vec3 lightColor = rectAreaLight.color;
1154		float roughness = material.roughness;
1155		vec3 rectCoords[ 4 ];
1156		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1157		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1158		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1159		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1160		vec4 t1 = texture2D( ltc_1, uv );
1161		vec4 t2 = texture2D( ltc_2, uv );
1162		mat3 mInv = mat3(
1163			vec3( t1.x, 0, t1.y ),
1164			vec3(    0, 1,    0 ),
1165			vec3( t1.z, 0, t1.w )
1166		);
1167		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1168		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1169		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1170	}
1171#endif
1172void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1173	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1174	vec3 irradiance = dotNL * directLight.color;
1175	#ifdef USE_CLEARCOAT
1176		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1177		vec3 ccIrradiance = dotNLcc * directLight.color;
1178		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1179	#endif
1180	#ifdef USE_SHEEN
1181		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1182	#endif
1183	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1184	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1185}
1186void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1187	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1188}
1189void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1190	#ifdef USE_CLEARCOAT
1191		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1192	#endif
1193	#ifdef USE_SHEEN
1194		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1195	#endif
1196	vec3 singleScattering = vec3( 0.0 );
1197	vec3 multiScattering = vec3( 0.0 );
1198	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1199	#ifdef USE_IRIDESCENCE
1200		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1201	#else
1202		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1203	#endif
1204	vec3 totalScattering = singleScattering + multiScattering;
1205	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1206	reflectedLight.indirectSpecular += radiance * singleScattering;
1207	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1208	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1209}
1210#define RE_Direct				RE_Direct_Physical
1211#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1212#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1213#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1214float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1215	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1216}`,
1216Nm=`
1217vec3 geometryPosition = - vViewPosition;
1218vec3 geometryNormal = normal;
1219vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1220vec3 geometryClearcoatNormal = vec3( 0.0 );
1221#ifdef USE_CLEARCOAT
1222	geometryClearcoatNormal = clearcoatNormal;
1223#endif
1224#ifdef USE_IRIDESCENCE
1225	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1226	if ( material.iridescenceThickness == 0.0 ) {
1227		material.iridescence = 0.0;
1228	} else {
1229		material.iridescence = saturate( material.iridescence );
1230	}
1231	if ( material.iridescence > 0.0 ) {
1232		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1233		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1234	}
1235#endif
1236IncidentLight directLight;
1237#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1238	PointLight pointLight;
1239	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1240	PointLightShadow pointLightShadow;
1241	#endif
1242	#pragma unroll_loop_start
1243	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1244		pointLight = pointLights[ i ];
1245		getPointLightInfo( pointLight, geometryPosition, directLight );
1246		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1247		pointLightShadow = pointLightShadows[ i ];
1248		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1249		#endif
1250		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1251	}
1252	#pragma unroll_loop_end
1253#endif
1254#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1255	SpotLight spotLight;
1256	vec4 spotColor;
1257	vec3 spotLightCoord;
1258	bool inSpotLightMap;
1259	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1260	SpotLightShadow spotLightShadow;
1261	#endif
1262	#pragma unroll_loop_start
1263	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1264		spotLight = spotLights[ i ];
1265		getSpotLightInfo( spotLight, geometryPosition, directLight );
1266		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1267		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1268		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1269		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1270		#else
1271		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1272		#endif
1273		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1274			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1275			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1276			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1277			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1278		#endif
1279		#undef SPOT_LIGHT_MAP_INDEX
1280		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1281		spotLightShadow = spotLightShadows[ i ];
1282		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1283		#endif
1284		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1285	}
1286	#pragma unroll_loop_end
1287#endif
1288#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1289	DirectionalLight directionalLight;
1290	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1291	DirectionalLightShadow directionalLightShadow;
1292	#endif
1293	#pragma unroll_loop_start
1294	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1295		directionalLight = directionalLights[ i ];
1296		getDirectionalLightInfo( directionalLight, directLight );
1297		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1298		directionalLightShadow = directionalLightShadows[ i ];
1299		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1300		#endif
1301		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1302	}
1303	#pragma unroll_loop_end
1304#endif
1305#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1306	RectAreaLight rectAreaLight;
1307	#pragma unroll_loop_start
1308	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1309		rectAreaLight = rectAreaLights[ i ];
1310		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1311	}
1312	#pragma unroll_loop_end
1313#endif
1314#if defined( RE_IndirectDiffuse )
1315	vec3 iblIrradiance = vec3( 0.0 );
1316	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1317	#if defined( USE_LIGHT_PROBES )
1318		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1319	#endif
1320	#if ( NUM_HEMI_LIGHTS > 0 )
1321		#pragma unroll_loop_start
1322		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1323			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1324		}
1325		#pragma unroll_loop_end
1326	#endif
1327#endif
1328#if defined( RE_IndirectSpecular )
1329	vec3 radiance = vec3( 0.0 );
1330	vec3 clearcoatRadiance = vec3( 0.0 );
1331#endif`,Om=`#if defined( RE_IndirectDiffuse )
1332	#ifdef USE_LIGHTMAP
1333		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1334		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1335		irradiance += lightMapIrradiance;
1336	#endif
1337	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1338		iblIrradiance += getIBLIrradiance( geometryNormal );
1339	#endif
1340#endif
1341#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1342	#ifdef USE_ANISOTROPY
1343		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1344	#else
1345		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1346	#endif
1347	#ifdef USE_CLEARCOAT
1348		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1349	#endif
1350#endif`,Fm=`#if defined( RE_IndirectDiffuse )
1351	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1352#endif
1353#if defined( RE_IndirectSpecular )
1354	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1355#endif`,Bm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1356	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1357#endif`,zm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1358	uniform float logDepthBufFC;
1359	varying float vFragDepth;
1360	varying float vIsPerspective;
1361#endif`,km=`#ifdef USE_LOGDEPTHBUF
1362	#ifdef USE_LOGDEPTHBUF_EXT
1363		varying float vFragDepth;
1364		varying float vIsPerspective;
1365	#else
1366		uniform float logDepthBufFC;
1367	#endif
1368#endif`,Vm=`#ifdef USE_LOGDEPTHBUF
1369	#ifdef USE_LOGDEPTHBUF_EXT
1370		vFragDepth = 1.0 + gl_Position.w;
1371		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1372	#else
1373		if ( isPerspectiveMatrix( projectionMatrix ) ) {
1374			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
1375			gl_Position.z *= gl_Position.w;
1376		}
1377	#endif
1378#endif`,Hm=`#ifdef USE_MAP
1379	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1380	#ifdef DECODE_VIDEO_TEXTURE
1381		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 );
1382	
1383	#endif
1384	diffuseColor *= sampledDiffuseColor;
1385#endif`,Gm=`#ifdef USE_MAP
1386	uniform sampler2D map;
1387#endif`,Wm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1388	#if defined( USE_POINTS_UV )
1389		vec2 uv = vUv;
1390	#else
1391		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1392	#endif
1393#endif
1394#ifdef USE_MAP
1395	diffuseColor *= texture2D( map, uv );
1396#endif
1397#ifdef USE_ALPHAMAP
1398	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1399#endif`,Xm=`#if defined( USE_POINTS_UV )
1400	varying vec2 vUv;
1401#else
1402	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1403		uniform mat3 uvTransform;
1404	#endif
1405#endif
1406#ifdef USE_MAP
1407	uniform sampler2D map;
1408#endif
1409#ifdef USE_ALPHAMAP
1410	uniform sampler2D alphaMap;
1411#endif`,qm=`float metalnessFactor = metalness;
1412#ifdef USE_METALNESSMAP
1413	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1414	metalnessFactor *= texelMetalness.b;
1415#endif`,Ym=`#ifdef USE_METALNESSMAP
1416	uniform sampler2D metalnessMap;
1417#endif`,Zm=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
1418	vColor *= morphTargetBaseInfluence;
1419	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1420		#if defined( USE_COLOR_ALPHA )
1421			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1422		#elif defined( USE_COLOR )
1423			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1424		#endif
1425	}
1426#endif`,Jm=`#ifdef USE_MORPHNORMALS
1427	objectNormal *= morphTargetBaseInfluence;
1428	#ifdef MORPHTARGETS_TEXTURE
1429		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1430			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1431		}
1432	#else
1433		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
1434		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
1435		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
1436		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
1437	#endif
1438#endif`,$m=`#ifdef USE_MORPHTARGETS
1439	uniform float morphTargetBaseInfluence;
1440	#ifdef MORPHTARGETS_TEXTURE
1441		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1442		uniform sampler2DArray morphTargetsTexture;
1443		uniform ivec2 morphTargetsTextureSize;
1444		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1445			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1446			int y = texelIndex / morphTargetsTextureSize.x;
1447			int x = texelIndex - y * morphTargetsTextureSize.x;
1448			ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1449			return texelFetch( morphTargetsTexture, morphUV, 0 );
1450		}
1451	#else
1452		#ifndef USE_MORPHNORMALS
1453			uniform float morphTargetInfluences[ 8 ];
1454		#else
1455			uniform float morphTargetInfluences[ 4 ];
1456		#endif
1457	#endif
1458#endif`,Km=`#ifdef USE_MORPHTARGETS
1459	transformed *= morphTargetBaseInfluence;
1460	#ifdef MORPHTARGETS_TEXTURE
1461		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1462			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1463		}
1464	#else
1465		transformed += morphTarget0 * morphTargetInfluences[ 0 ];
1466		transformed += morphTarget1 * morphTargetInfluences[ 1 ];
1467		transformed += morphTarget2 * morphTargetInfluences[ 2 ];
1468		transformed += morphTarget3 * morphTargetInfluences[ 3 ];
1469		#ifndef USE_MORPHNORMALS
1470			transformed += morphTarget4 * morphTargetInfluences[ 4 ];
1471			transformed += morphTarget5 * morphTargetInfluences[ 5 ];
1472			transformed += morphTarget6 * morphTargetInfluences[ 6 ];
1473			transformed += morphTarget7 * morphTargetInfluences[ 7 ];
1474		#endif
1475	#endif
1476#endif`,Qm=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1477#ifdef FLAT_SHADED
1478	vec3 fdx = dFdx( vViewPosition );
1479	vec3 fdy = dFdy( vViewPosition );
1480	vec3 normal = normalize( cross( fdx, fdy ) );
1481#else
1482	vec3 normal = normalize( vNormal );
1483	#ifdef DOUBLE_SIDED
1484		normal *= faceDirection;
1485	#endif
1486#endif
1487#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1488	#ifdef USE_TANGENT
1489		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1490	#else
1491		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1492		#if defined( USE_NORMALMAP )
1493			vNormalMapUv
1494		#elif defined( USE_CLEARCOAT_NORMALMAP )
1495			vClearcoatNormalMapUv
1496		#else
1497			vUv
1498		#endif
1499		);
1500	#endif
1501	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1502		tbn[0] *= faceDirection;
1503		tbn[1] *= faceDirection;
1504	#endif
1505#endif
1506#ifdef USE_CLEARCOAT_NORMALMAP
1507	#ifdef USE_TANGENT
1508		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1509	#else
1510		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1511	#endif
1512	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1513		tbn2[0] *= faceDirection;
1514		tbn2[1] *= faceDirection;
1515	#endif
1516#endif
1517vec3 nonPerturbedNormal = normal;`,jm=`#ifdef USE_NORMALMAP_OBJECTSPACE
1518	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1519	#ifdef FLIP_SIDED
1520		normal = - normal;
1521	#endif
1522	#ifdef DOUBLE_SIDED
1523		normal = normal * faceDirection;
1524	#endif
1525	normal = normalize( normalMatrix * normal );
1526#elif defined( USE_NORMALMAP_TANGENTSPACE )
1527	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1528	mapN.xy *= normalScale;
1529	normal = normalize( tbn * mapN );
1530#elif defined( USE_BUMPMAP )
1531	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1532#endif`,eg=`#ifndef FLAT_SHADED
1533	varying vec3 vNormal;
1534	#ifdef USE_TANGENT
1535		varying vec3 vTangent;
1536		varying vec3 vBitangent;
1537	#endif
1538#endif`,tg=`#ifndef FLAT_SHADED
1539	varying vec3 vNormal;
1540	#ifdef USE_TANGENT
1541		varying vec3 vTangent;
1542		varying vec3 vBitangent;
1543	#endif
1544#endif`,ng=`#ifndef FLAT_SHADED
1545	vNormal = normalize( transformedNormal );
1546	#ifdef USE_TANGENT
1547		vTangent = normalize( transformedTangent );
1548		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1549	#endif
1550#endif`,ig=`#ifdef USE_NORMALMAP
1551	uniform sampler2D normalMap;
1552	uniform vec2 normalScale;
1553#endif
1554#ifdef USE_NORMALMAP_OBJECTSPACE
1555	uniform mat3 normalMatrix;
1556#endif
1557#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1558	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1559		vec3 q0 = dFdx( eye_pos.xyz );
1560		vec3 q1 = dFdy( eye_pos.xyz );
1561		vec2 st0 = dFdx( uv.st );
1562		vec2 st1 = dFdy( uv.st );
1563		vec3 N = surf_norm;
1564		vec3 q1perp = cross( q1, N );
1565		vec3 q0perp = cross( N, q0 );
1566		vec3 T = q1perp * st0.x + q0perp * st1.x;
1567		vec3 B = q1perp * st0.y + q0perp * st1.y;
1568		float det = max( dot( T, T ), dot( B, B ) );
1569		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1570		return mat3( T * scale, B * scale, N );
1571	}
1572#endif`,sg=`#ifdef USE_CLEARCOAT
1573	vec3 clearcoatNormal = nonPerturbedNormal;
1574#endif`,rg=`#ifdef USE_CLEARCOAT_NORMALMAP
1575	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1576	clearcoatMapN.xy *= clearcoatNormalScale;
1577	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1578#endif`,ag=`#ifdef USE_CLEARCOATMAP
1579	uniform sampler2D clearcoatMap;
1580#endif
1581#ifdef USE_CLEARCOAT_NORMALMAP
1582	uniform sampler2D clearcoatNormalMap;
1583	uniform vec2 clearcoatNormalScale;
1584#endif
1585#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1586	uniform sampler2D clearcoatRoughnessMap;
1587#endif`,og=`#ifdef USE_IRIDESCENCEMAP
1588	uniform sampler2D iridescenceMap;
1589#endif
1590#ifdef USE_IRIDESCENCE_THICKNESSMAP
1591	uniform sampler2D iridescenceThicknessMap;
1592#endif`,lg=`#ifdef OPAQUE
1593diffuseColor.a = 1.0;
1594#endif
1595#ifdef USE_TRANSMISSION
1596diffuseColor.a *= material.transmissionAlpha;
1597#endif
1598gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,cg=`vec3 packNormalToRGB( const in vec3 normal ) {
1599	return normalize( normal ) * 0.5 + 0.5;
1600}
1601vec3 unpackRGBToNormal( const in vec3 rgb ) {
1602	return 2.0 * rgb.xyz - 1.0;
1603}
1604const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
1605const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
1606const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
1607const float ShiftRight8 = 1. / 256.;
1608vec4 packDepthToRGBA( const in float v ) {
1609	vec4 r = vec4( fract( v * PackFactors ), v );
1610	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
1611}
1612float unpackRGBAToDepth( const in vec4 v ) {
1613	return dot( v, UnpackFactors );
1614}
1615vec2 packDepthToRG( in highp float v ) {
1616	return packDepthToRGBA( v ).yx;
1617}
1618float unpackRGToDepth( const in highp vec2 v ) {
1619	return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
1620}
1621vec4 pack2HalfToRGBA( vec2 v ) {
1622	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1623	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1624}
1625vec2 unpackRGBATo2Half( vec4 v ) {
1626	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1627}
1628float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1629	return ( viewZ + near ) / ( near - far );
1630}
1631float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1632	return depth * ( near - far ) - near;
1633}
1634float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1635	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1636}
1637float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1638	return ( near * far ) / ( ( far - near ) * depth - far );
1639}`,hg=`#ifdef PREMULTIPLIED_ALPHA
1640	gl_FragColor.rgb *= gl_FragColor.a;
1641#endif`,ug=`vec4 mvPosition = vec4( transformed, 1.0 );
1642#ifdef USE_BATCHING
1643	mvPosition = batchingMatrix * mvPosition;
1644#endif
1645#ifdef USE_INSTANCING
1646	mvPosition = instanceMatrix * mvPosition;
1647#endif
1648mvPosition = modelViewMatrix * mvPosition;
1649gl_Position = projectionMatrix * mvPosition;`,dg=`#ifdef DITHERING
1650	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1651#endif`,fg=`#ifdef DITHERING
1652	vec3 dithering( vec3 color ) {
1653		float grid_position = rand( gl_FragCoord.xy );
1654		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1655		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1656		return color + dither_shift_RGB;
1657	}
1658#endif`,pg=`float roughnessFactor = roughness;
1659#ifdef USE_ROUGHNESSMAP
1660	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1661	roughnessFactor *= texelRoughness.g;
1662#endif`,mg=`#ifdef USE_ROUGHNESSMAP
1663	uniform sampler2D roughnessMap;
1664#endif`,gg=`#if NUM_SPOT_LIGHT_COORDS > 0
1665	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1666#endif
1667#if NUM_SPOT_LIGHT_MAPS > 0
1668	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1669#endif
1670#ifdef USE_SHADOWMAP
1671	#if NUM_DIR_LIGHT_SHADOWS > 0
1672		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1673		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1674		struct DirectionalLightShadow {
1675			float shadowBias;
1676			float shadowNormalBias;
1677			float shadowRadius;
1678			vec2 shadowMapSize;
1679		};
1680		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1681	#endif
1682	#if NUM_SPOT_LIGHT_SHADOWS > 0
1683		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1684		struct SpotLightShadow {
1685			float shadowBias;
1686			float shadowNormalBias;
1687			float shadowRadius;
1688			vec2 shadowMapSize;
1689		};
1690		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1691	#endif
1692	#if NUM_POINT_LIGHT_SHADOWS > 0
1693		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1694		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1695		struct PointLightShadow {
1696			float shadowBias;
1697			float shadowNormalBias;
1698			float shadowRadius;
1699			vec2 shadowMapSize;
1700			float shadowCameraNear;
1701			float shadowCameraFar;
1702		};
1703		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1704	#endif
1705	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1706		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1707	}
1708	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1709		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1710	}
1711	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1712		float occlusion = 1.0;
1713		vec2 distribution = texture2DDistribution( shadow, uv );
1714		float hard_shadow = step( compare , distribution.x );
1715		if (hard_shadow != 1.0 ) {
1716			float distance = compare - distribution.x ;
1717			float variance = max( 0.00000, distribution.y * distribution.y );
1718			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
1719		}
1720		return occlusion;
1721	}
1722	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1723		float shadow = 1.0;
1724		shadowCoord.xyz /= shadowCoord.w;
1725		shadowCoord.z += shadowBias;
1726		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1727		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1728		if ( frustumTest ) {
1729		#if defined( SHADOWMAP_TYPE_PCF )
1730			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1731			float dx0 = - texelSize.x * shadowRadius;
1732			float dy0 = - texelSize.y * shadowRadius;
1733			float dx1 = + texelSize.x * shadowRadius;
1734			float dy1 = + texelSize.y * shadowRadius;
1735			float dx2 = dx0 / 2.0;
1736			float dy2 = dy0 / 2.0;
1737			float dx3 = dx1 / 2.0;
1738			float dy3 = dy1 / 2.0;
1739			shadow = (
1740				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1741				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1742				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1743				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1744				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1745				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1746				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1747				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1748				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1749				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1750				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1751				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1752				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1753				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1754				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1755				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1756				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1757			) * ( 1.0 / 17.0 );
1758		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1759			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1760			float dx = texelSize.x;
1761			float dy = texelSize.y;
1762			vec2 uv = shadowCoord.xy;
1763			vec2 f = fract( uv * shadowMapSize + 0.5 );
1764			uv -= f * texelSize;
1765			shadow = (
1766				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1767				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1768				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1769				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1770				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1771					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1772					 f.x ) +
1773				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1774					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1775					 f.x ) +
1776				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1777					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1778					 f.y ) +
1779				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1780					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1781					 f.y ) +
1782				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1783						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1784						  f.x ),
1785					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1786						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1787						  f.x ),
1788					 f.y )
1789			) * ( 1.0 / 9.0 );
1790		#elif defined( SHADOWMAP_TYPE_VSM )
1791			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1792		#else
1793			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1794		#endif
1795		}
1796		return shadow;
1797	}
1798	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1799		vec3 absV = abs( v );
1800		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1801		absV *= scaleToCube;
1802		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1803		vec2 planar = v.xy;
1804		float almostATexel = 1.5 * texelSizeY;
1805		float almostOne = 1.0 - almostATexel;
1806		if ( absV.z >= almostOne ) {
1807			if ( v.z > 0.0 )
1808				planar.x = 4.0 - v.x;
1809		} else if ( absV.x >= almostOne ) {
1810			float signX = sign( v.x );
1811			planar.x = v.z * signX + 2.0 * signX;
1812		} else if ( absV.y >= almostOne ) {
1813			float signY = sign( v.y );
1814			planar.x = v.x + 2.0 * signY + 2.0;
1815			planar.y = v.z * signY - 2.0;
1816		}
1817		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1818	}
1819	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1820		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1821		vec3 lightToPosition = shadowCoord.xyz;
1822		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
1823		vec3 bd3D = normalize( lightToPosition );
1824		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1825			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1826			return (
1827				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1828				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1829				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1830				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1831				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1832				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1833				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1834				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1835				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1836			) * ( 1.0 / 9.0 );
1837		#else
1838			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1839		#endif
1840	}
1841#endif`,_g=`#if NUM_SPOT_LIGHT_COORDS > 0
1842	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1843	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1844#endif
1845#ifdef USE_SHADOWMAP
1846	#if NUM_DIR_LIGHT_SHADOWS > 0
1847		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1848		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1849		struct DirectionalLightShadow {
1850			float shadowBias;
1851			float shadowNormalBias;
1852			float shadowRadius;
1853			vec2 shadowMapSize;
1854		};
1855		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1856	#endif
1857	#if NUM_SPOT_LIGHT_SHADOWS > 0
1858		struct SpotLightShadow {
1859			float shadowBias;
1860			float shadowNormalBias;
1861			float shadowRadius;
1862			vec2 shadowMapSize;
1863		};
1864		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1865	#endif
1866	#if NUM_POINT_LIGHT_SHADOWS > 0
1867		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1868		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1869		struct PointLightShadow {
1870			float shadowBias;
1871			float shadowNormalBias;
1872			float shadowRadius;
1873			vec2 shadowMapSize;
1874			float shadowCameraNear;
1875			float shadowCameraFar;
1876		};
1877		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1878	#endif
1879#endif`,xg=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1880	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1881	vec4 shadowWorldPosition;
1882#endif
1883#if defined( USE_SHADOWMAP )
1884	#if NUM_DIR_LIGHT_SHADOWS > 0
1885		#pragma unroll_loop_start
1886		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1887			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1888			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1889		}
1890		#pragma unroll_loop_end
1891	#endif
1892	#if NUM_POINT_LIGHT_SHADOWS > 0
1893		#pragma unroll_loop_start
1894		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1895			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1896			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1897		}
1898		#pragma unroll_loop_end
1899	#endif
1900#endif
1901#if NUM_SPOT_LIGHT_COORDS > 0
1902	#pragma unroll_loop_start
1903	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1904		shadowWorldPosition = worldPosition;
1905		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1906			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1907		#endif
1908		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1909	}
1910	#pragma unroll_loop_end
1911#endif`,vg=`float getShadowMask() {
1912	float shadow = 1.0;
1913	#ifdef USE_SHADOWMAP
1914	#if NUM_DIR_LIGHT_SHADOWS > 0
1915	DirectionalLightShadow directionalLight;
1916	#pragma unroll_loop_start
1917	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1918		directionalLight = directionalLightShadows[ i ];
1919		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1920	}
1921	#pragma unroll_loop_end
1922	#endif
1923	#if NUM_SPOT_LIGHT_SHADOWS > 0
1924	SpotLightShadow spotLight;
1925	#pragma unroll_loop_start
1926	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1927		spotLight = spotLightShadows[ i ];
1928		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1929	}
1930	#pragma unroll_loop_end
1931	#endif
1932	#if NUM_POINT_LIGHT_SHADOWS > 0
1933	PointLightShadow pointLight;
1934	#pragma unroll_loop_start
1935	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1936		pointLight = pointLightShadows[ i ];
1937		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1938	}
1939	#pragma unroll_loop_end
1940	#endif
1941	#endif
1942	return shadow;
1943}`,yg=`#ifdef USE_SKINNING
1944	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1945	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1946	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1947	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1948#endif`,Mg=`#ifdef USE_SKINNING
1949	uniform mat4 bindMatrix;
1950	uniform mat4 bindMatrixInverse;
1951	uniform highp sampler2D boneTexture;
1952	mat4 getBoneMatrix( const in float i ) {
1953		int size = textureSize( boneTexture, 0 ).x;
1954		int j = int( i ) * 4;
1955		int x = j % size;
1956		int y = j / size;
1957		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
1958		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
1959		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
1960		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
1961		return mat4( v1, v2, v3, v4 );
1962	}
1963#endif`,Sg=`#ifdef USE_SKINNING
1964	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
1965	vec4 skinned = vec4( 0.0 );
1966	skinned += boneMatX * skinVertex * skinWeight.x;
1967	skinned += boneMatY * skinVertex * skinWeight.y;
1968	skinned += boneMatZ * skinVertex * skinWeight.z;
1969	skinned += boneMatW * skinVertex * skinWeight.w;
1970	transformed = ( bindMatrixInverse * skinned ).xyz;
1971#endif`,bg=`#ifdef USE_SKINNING
1972	mat4 skinMatrix = mat4( 0.0 );
1973	skinMatrix += skinWeight.x * boneMatX;
1974	skinMatrix += skinWeight.y * boneMatY;
1975	skinMatrix += skinWeight.z * boneMatZ;
1976	skinMatrix += skinWeight.w * boneMatW;
1977	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
1978	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
1979	#ifdef USE_TANGENT
1980		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
1981	#endif
1982#endif`,Eg=`float specularStrength;
1983#ifdef USE_SPECULARMAP
1984	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
1985	specularStrength = texelSpecular.r;
1986#else
1987	specularStrength = 1.0;
1988#endif`,Ag=`#ifdef USE_SPECULARMAP
1989	uniform sampler2D specularMap;
1990#endif`,Tg=`#if defined( TONE_MAPPING )
1991	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
1992#endif`,wg=`#ifndef saturate
1993#define saturate( a ) clamp( a, 0.0, 1.0 )
1994#endif
1995uniform float toneMappingExposure;
1996vec3 LinearToneMapping( vec3 color ) {
1997	return saturate( toneMappingExposure * color );
1998}
1999vec3 ReinhardToneMapping( vec3 color ) {
2000	color *= toneMappingExposure;
2001	return saturate( color / ( vec3( 1.0 ) + color ) );
2002}
2003vec3 OptimizedCineonToneMapping( vec3 color ) {
2004	color *= toneMappingExposure;
2005	color = max( vec3( 0.0 ), color - 0.004 );
2006	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2007}
2008vec3 RRTAndODTFit( vec3 v ) {
2009	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2010	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2011	return a / b;
2012}
2013vec3 ACESFilmicToneMapping( vec3 color ) {
2014	const mat3 ACESInputMat = mat3(
2015		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2016		vec3( 0.04823, 0.01566, 0.83777 )
2017	);
2018	const mat3 ACESOutputMat = mat3(
2019		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2020		vec3( -0.07367, -0.00605,  1.07602 )
2021	);
2022	color *= toneMappingExposure / 0.6;
2023	color = ACESInputMat * color;
2024	color = RRTAndODTFit( color );
2025	color = ACESOutputMat * color;
2026	return saturate( color );
2027}
2028const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2029	vec3( 1.6605, - 0.1246, - 0.0182 ),
2030	vec3( - 0.5876, 1.1329, - 0.1006 ),
2031	vec3( - 0.0728, - 0.0083, 1.1187 )
2032);
2033const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2034	vec3( 0.6274, 0.0691, 0.0164 ),
2035	vec3( 0.3293, 0.9195, 0.0880 ),
2036	vec3( 0.0433, 0.0113, 0.8956 )
2037);
2038vec3 agxDefaultContrastApprox( vec3 x ) {
2039	vec3 x2 = x * x;
2040	vec3 x4 = x2 * x2;
2041	return + 15.5 * x4 * x2
2042		- 40.14 * x4 * x
2043		+ 31.96 * x4
2044		- 6.868 * x2 * x
2045		+ 0.4298 * x2
2046		+ 0.1191 * x
2047		- 0.00232;
2048}
2049vec3 AgXToneMapping( vec3 color ) {
2050	const mat3 AgXInsetMatrix = mat3(
2051		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2052		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2053		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2054	);
2055	const mat3 AgXOutsetMatrix = mat3(
2056		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2057		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2058		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2059	);
2060	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2061	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2062	color *= toneMappingExposure;
2063	color = AgXInsetMatrix * color;
2064	color = max( color, 1e-10 );	color = log2( color );
2065	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2066	color = clamp( color, 0.0, 1.0 );
2067	color = agxDefaultContrastApprox( color );
2068	color = AgXOutsetMatrix * color;
2069	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2070	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2071	return color;
2072}
2073vec3 CustomToneMapping( vec3 color ) { return color; }`,Cg=`#ifdef USE_TRANSMISSION
2074	material.transmission = transmission;
2075	material.transmissionAlpha = 1.0;
2076	material.thickness = thickness;
2077	material.attenuationDistance = attenuationDistance;
2078	material.attenuationColor = attenuationColor;
2079	#ifdef USE_TRANSMISSIONMAP
2080		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2081	#endif
2082	#ifdef USE_THICKNESSMAP
2083		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2084	#endif
2085	vec3 pos = vWorldPosition;
2086	vec3 v = normalize( cameraPosition - pos );
2087	vec3 n = inverseTransformDirection( normal, viewMatrix );
2088	vec4 transmitted = getIBLVolumeRefraction(
2089		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2090		pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
2091		material.attenuationColor, material.attenuationDistance );
2092	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2093	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2094#endif`,Rg=`#ifdef USE_TRANSMISSION
2095	uniform float transmission;
2096	uniform float thickness;
2097	uniform float attenuationDistance;
2098	uniform vec3 attenuationColor;
2099	#ifdef USE_TRANSMISSIONMAP
2100		uniform sampler2D transmissionMap;
2101	#endif
2102	#ifdef USE_THICKNESSMAP
2103		uniform sampler2D thicknessMap;
2104	#endif
2105	uniform vec2 transmissionSamplerSize;
2106	uniform sampler2D transmissionSamplerMap;
2107	uniform mat4 modelMatrix;
2108	uniform mat4 projectionMatrix;
2109	varying vec3 vWorldPosition;
2110	float w0( float a ) {
2111		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2112	}
2113	float w1( float a ) {
2114		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2115	}
2116	float w2( float a ){
2117		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2118	}
2119	float w3( float a ) {
2120		return ( 1.0 / 6.0 ) * ( a * a * a );
2121	}
2122	float g0( float a ) {
2123		return w0( a ) + w1( a );
2124	}
2125	float g1( float a ) {
2126		return w2( a ) + w3( a );
2127	}
2128	float h0( float a ) {
2129		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2130	}
2131	float h1( float a ) {
2132		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2133	}
2134	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2135		uv = uv * texelSize.zw + 0.5;
2136		vec2 iuv = floor( uv );
2137		vec2 fuv = fract( uv );
2138		float g0x = g0( fuv.x );
2139		float g1x = g1( fuv.x );
2140		float h0x = h0( fuv.x );
2141		float h1x = h1( fuv.x );
2142		float h0y = h0( fuv.y );
2143		float h1y = h1( fuv.y );
2144		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2145		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2146		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2147		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2148		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2149			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2150	}
2151	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2152		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2153		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2154		vec2 fLodSizeInv = 1.0 / fLodSize;
2155		vec2 cLodSizeInv = 1.0 / cLodSize;
2156		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2157		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2158		return mix( fSample, cSample, fract( lod ) );
2159	}
2160	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2161		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2162		vec3 modelScale;
2163		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2164		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2165		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2166		return normalize( refractionVector ) * thickness * modelScale;
2167	}
2168	float applyIorToRoughness( const in float roughness, const in float ior ) {
2169		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2170	}
2171	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2172		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2173		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2174	}
2175	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2176		if ( isinf( attenuationDistance ) ) {
2177			return vec3( 1.0 );
2178		} else {
2179			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2180			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2181		}
2182	}
2183	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2184		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2185		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
2186		const in vec3 attenuationColor, const in float attenuationDistance ) {
2187		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2188		vec3 refractedRayExit = position + transmissionRay;
2189		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2190		vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2191		refractionCoords += 1.0;
2192		refractionCoords /= 2.0;
2193		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2194		vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2195		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2196		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2197		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2198		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2199	}
2200#endif`,Pg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2201	varying vec2 vUv;
2202#endif
2203#ifdef USE_MAP
2204	varying vec2 vMapUv;
2205#endif
2206#ifdef USE_ALPHAMAP
2207	varying vec2 vAlphaMapUv;
2208#endif
2209#ifdef USE_LIGHTMAP
2210	varying vec2 vLightMapUv;
2211#endif
2212#ifdef USE_AOMAP
2213	varying vec2 vAoMapUv;
2214#endif
2215#ifdef USE_BUMPMAP
2216	varying vec2 vBumpMapUv;
2217#endif
2218#ifdef USE_NORMALMAP
2219	varying vec2 vNormalMapUv;
2220#endif
2221#ifdef USE_EMISSIVEMAP
2222	varying vec2 vEmissiveMapUv;
2223#endif
2224#ifdef USE_METALNESSMAP
2225	varying vec2 vMetalnessMapUv;
2226#endif
2227#ifdef USE_ROUGHNESSMAP
2228	varying vec2 vRoughnessMapUv;
2229#endif
2230#ifdef USE_ANISOTROPYMAP
2231	varying vec2 vAnisotropyMapUv;
2232#endif
2233#ifdef USE_CLEARCOATMAP
2234	varying vec2 vClearcoatMapUv;
2235#endif
2236#ifdef USE_CLEARCOAT_NORMALMAP
2237	varying vec2 vClearcoatNormalMapUv;
2238#endif
2239#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2240	varying vec2 vClearcoatRoughnessMapUv;
2241#endif
2242#ifdef USE_IRIDESCENCEMAP
2243	varying vec2 vIridescenceMapUv;
2244#endif
2245#ifdef USE_IRIDESCENCE_THICKNESSMAP
2246	varying vec2 vIridescenceThicknessMapUv;
2247#endif
2248#ifdef USE_SHEEN_COLORMAP
2249	varying vec2 vSheenColorMapUv;
2250#endif
2251#ifdef USE_SHEEN_ROUGHNESSMAP
2252	varying vec2 vSheenRoughnessMapUv;
2253#endif
2254#ifdef USE_SPECULARMAP
2255	varying vec2 vSpecularMapUv;
2256#endif
2257#ifdef USE_SPECULAR_COLORMAP
2258	varying vec2 vSpecularColorMapUv;
2259#endif
2260#ifdef USE_SPECULAR_INTENSITYMAP
2261	varying vec2 vSpecularIntensityMapUv;
2262#endif
2263#ifdef USE_TRANSMISSIONMAP
2264	uniform mat3 transmissionMapTransform;
2265	varying vec2 vTransmissionMapUv;
2266#endif
2267#ifdef USE_THICKNESSMAP
2268	uniform mat3 thicknessMapTransform;
2269	varying vec2 vThicknessMapUv;
2270#endif`,Lg=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2271	varying vec2 vUv;
2272#endif
2273#ifdef USE_MAP
2274	uniform mat3 mapTransform;
2275	varying vec2 vMapUv;
2276#endif
2277#ifdef USE_ALPHAMAP
2278	uniform mat3 alphaMapTransform;
2279	varying vec2 vAlphaMapUv;
2280#endif
2281#ifdef USE_LIGHTMAP
2282	uniform mat3 lightMapTransform;
2283	varying vec2 vLightMapUv;
2284#endif
2285#ifdef USE_AOMAP
2286	uniform mat3 aoMapTransform;
2287	varying vec2 vAoMapUv;
2288#endif
2289#ifdef USE_BUMPMAP
2290	uniform mat3 bumpMapTransform;
2291	varying vec2 vBumpMapUv;
2292#endif
2293#ifdef USE_NORMALMAP
2294	uniform mat3 normalMapTransform;
2295	varying vec2 vNormalMapUv;
2296#endif
2297#ifdef USE_DISPLACEMENTMAP
2298	uniform mat3 displacementMapTransform;
2299	varying vec2 vDisplacementMapUv;
2300#endif
2301#ifdef USE_EMISSIVEMAP
2302	uniform mat3 emissiveMapTransform;
2303	varying vec2 vEmissiveMapUv;
2304#endif
2305#ifdef USE_METALNESSMAP
2306	uniform mat3 metalnessMapTransform;
2307	varying vec2 vMetalnessMapUv;
2308#endif
2309#ifdef USE_ROUGHNESSMAP
2310	uniform mat3 roughnessMapTransform;
2311	varying vec2 vRoughnessMapUv;
2312#endif
2313#ifdef USE_ANISOTROPYMAP
2314	uniform mat3 anisotropyMapTransform;
2315	varying vec2 vAnisotropyMapUv;
2316#endif
2317#ifdef USE_CLEARCOATMAP
2318	uniform mat3 clearcoatMapTransform;
2319	varying vec2 vClearcoatMapUv;
2320#endif
2321#ifdef USE_CLEARCOAT_NORMALMAP
2322	uniform mat3 clearcoatNormalMapTransform;
2323	varying vec2 vClearcoatNormalMapUv;
2324#endif
2325#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2326	uniform mat3 clearcoatRoughnessMapTransform;
2327	varying vec2 vClearcoatRoughnessMapUv;
2328#endif
2329#ifdef USE_SHEEN_COLORMAP
2330	uniform mat3 sheenColorMapTransform;
2331	varying vec2 vSheenColorMapUv;
2332#endif
2333#ifdef USE_SHEEN_ROUGHNESSMAP
2334	uniform mat3 sheenRoughnessMapTransform;
2335	varying vec2 vSheenRoughnessMapUv;
2336#endif
2337#ifdef USE_IRIDESCENCEMAP
2338	uniform mat3 iridescenceMapTransform;
2339	varying vec2 vIridescenceMapUv;
2340#endif
2341#ifdef USE_IRIDESCENCE_THICKNESSMAP
2342	uniform mat3 iridescenceThicknessMapTransform;
2343	varying vec2 vIridescenceThicknessMapUv;
2344#endif
2345#ifdef USE_SPECULARMAP
2346	uniform mat3 specularMapTransform;
2347	varying vec2 vSpecularMapUv;
2348#endif
2349#ifdef USE_SPECULAR_COLORMAP
2350	uniform mat3 specularColorMapTransform;
2351	varying vec2 vSpecularColorMapUv;
2352#endif
2353#ifdef USE_SPECULAR_INTENSITYMAP
2354	uniform mat3 specularIntensityMapTransform;
2355	varying vec2 vSpecularIntensityMapUv;
2356#endif
2357#ifdef USE_TRANSMISSIONMAP
2358	uniform mat3 transmissionMapTransform;
2359	varying vec2 vTransmissionMapUv;
2360#endif
2361#ifdef USE_THICKNESSMAP
2362	uniform mat3 thicknessMapTransform;
2363	varying vec2 vThicknessMapUv;
2364#endif`,Ig=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2365	vUv = vec3( uv, 1 ).xy;
2366#endif
2367#ifdef USE_MAP
2368	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2369#endif
2370#ifdef USE_ALPHAMAP
2371	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2372#endif
2373#ifdef USE_LIGHTMAP
2374	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2375#endif
2376#ifdef USE_AOMAP
2377	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2378#endif
2379#ifdef USE_BUMPMAP
2380	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2381#endif
2382#ifdef USE_NORMALMAP
2383	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2384#endif
2385#ifdef USE_DISPLACEMENTMAP
2386	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2387#endif
2388#ifdef USE_EMISSIVEMAP
2389	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2390#endif
2391#ifdef USE_METALNESSMAP
2392	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2393#endif
2394#ifdef USE_ROUGHNESSMAP
2395	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2396#endif
2397#ifdef USE_ANISOTROPYMAP
2398	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2399#endif
2400#ifdef USE_CLEARCOATMAP
2401	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2402#endif
2403#ifdef USE_CLEARCOAT_NORMALMAP
2404	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2405#endif
2406#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2407	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2408#endif
2409#ifdef USE_IRIDESCENCEMAP
2410	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2411#endif
2412#ifdef USE_IRIDESCENCE_THICKNESSMAP
2413	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2414#endif
2415#ifdef USE_SHEEN_COLORMAP
2416	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2417#endif
2418#ifdef USE_SHEEN_ROUGHNESSMAP
2419	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2420#endif
2421#ifdef USE_SPECULARMAP
2422	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2423#endif
2424#ifdef USE_SPECULAR_COLORMAP
2425	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2426#endif
2427#ifdef USE_SPECULAR_INTENSITYMAP
2428	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2429#endif
2430#ifdef USE_TRANSMISSIONMAP
2431	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2432#endif
2433#ifdef USE_THICKNESSMAP
2434	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2435#endif`,Ug=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2436	vec4 worldPosition = vec4( transformed, 1.0 );
2437	#ifdef USE_BATCHING
2438		worldPosition = batchingMatrix * worldPosition;
2439	#endif
2440	#ifdef USE_INSTANCING
2441		worldPosition = instanceMatrix * worldPosition;
2442	#endif
2443	worldPosition = modelMatrix * worldPosition;
2444#endif`;const Dg=`varying vec2 vUv;
2445uniform mat3 uvTransform;
2446void main() {
2447	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2448	gl_Position = vec4( position.xy, 1.0, 1.0 );
2449}`,Ng=`uniform sampler2D t2D;
2450uniform float backgroundIntensity;
2451varying vec2 vUv;
2452void main() {
2453	vec4 texColor = texture2D( t2D, vUv );
2454	#ifdef DECODE_VIDEO_TEXTURE
2455		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
2456	#endif
2457	texColor.rgb *= backgroundIntensity;
2458	gl_FragColor = texColor;
2459	#include <tonemapping_fragment>
2460	#include <colorspace_fragment>
2461}`,Og=`varying vec3 vWorldDirection;
2462#include <common>
2463void main() {
2464	vWorldDirection = transformDirection( position, modelMatrix );
2465	#include <begin_vertex>
2466	#include <project_vertex>
2467	gl_Position.z = gl_Position.w;
2468}`,Fg=`#ifdef ENVMAP_TYPE_CUBE
2469	uniform samplerCube envMap;
2470#elif defined( ENVMAP_TYPE_CUBE_UV )
2471	uniform sampler2D envMap;
2472#endif
2473uniform float flipEnvMap;
2474uniform float backgroundBlurriness;
2475uniform float backgroundIntensity;
2476varying vec3 vWorldDirection;
2477#include <cube_uv_reflection_fragment>
2478void main() {
2479	#ifdef ENVMAP_TYPE_CUBE
2480		vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2481	#elif defined( ENVMAP_TYPE_CUBE_UV )
2482		vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
2483	#else
2484		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2485	#endif
2486	texColor.rgb *= backgroundIntensity;
2487	gl_FragColor = texColor;
2488	#include <tonemapping_fragment>
2489	#include <colorspace_fragment>
2490}`,Bg=`varying vec3 vWorldDirection;
2491#include <common>
2492void main() {
2493	vWorldDirection = transformDirection( position, modelMatrix );
2494	#include <begin_vertex>
2495	#include <project_vertex>
2496	gl_Position.z = gl_Position.w;
2497}`,zg=`uniform samplerCube tCube;
2498uniform float tFlip;
2499uniform float opacity;
2500varying vec3 vWorldDirection;
2501void main() {
2502	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2503	gl_FragColor = texColor;
2504	gl_FragColor.a *= opacity;
2505	#include <tonemapping_fragment>
2506	#include <colorspace_fragment>
2507}`,kg=`#include <common>
2508#include <batching_pars_vertex>
2509#include <uv_pars_vertex>
2510#include <displacementmap_pars_vertex>
2511#include <morphtarget_pars_vertex>
2512#include <skinning_pars_vertex>
2513#include <logdepthbuf_pars_vertex>
2514#include <clipping_planes_pars_vertex>
2515varying vec2 vHighPrecisionZW;
2516void main() {
2517	#include <uv_vertex>
2518	#include <batching_vertex>
2519	#include <skinbase_vertex>
2520	#ifdef USE_DISPLACEMENTMAP
2521		#include <beginnormal_vertex>
2522		#include <morphnormal_vertex>
2523		#include <skinnormal_vertex>
2524	#endif
2525	#include <begin_vertex>
2526	#include <morphtarget_vertex>
2527	#include <skinning_vertex>
2528	#include <displacementmap_vertex>
2529	#include <project_vertex>
2530	#include <logdepthbuf_vertex>
2531	#include <clipping_planes_vertex>
2532	vHighPrecisionZW = gl_Position.zw;
2533}`,Vg=`#if DEPTH_PACKING == 3200
2534	uniform float opacity;
2535#endif
2536#include <common>
2537#include <packing>
2538#include <uv_pars_fragment>
2539#include <map_pars_fragment>
2540#include <alphamap_pars_fragment>
2541#include <alphatest_pars_fragment>
2542#include <alphahash_pars_fragment>
2543#include <logdepthbuf_pars_fragment>
2544#include <clipping_planes_pars_fragment>
2545varying vec2 vHighPrecisionZW;
2546void main() {
2547	#include <clipping_planes_fragment>
2548	vec4 diffuseColor = vec4( 1.0 );
2549	#if DEPTH_PACKING == 3200
2550		diffuseColor.a = opacity;
2551	#endif
2552	#include <map_fragment>
2553	#include <alphamap_fragment>
2554	#include <alphatest_fragment>
2555	#include <alphahash_fragment>
2556	#include <logdepthbuf_fragment>
2557	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2558	#if DEPTH_PACKING == 3200
2559		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2560	#elif DEPTH_PACKING == 3201
2561		gl_FragColor = packDepthToRGBA( fragCoordZ );
2562	#endif
2563}`,Hg=`#define DISTANCE
2564varying vec3 vWorldPosition;
2565#include <common>
2566#include <batching_pars_vertex>
2567#include <uv_pars_vertex>
2568#include <displacementmap_pars_vertex>
2569#include <morphtarget_pars_vertex>
2570#include <skinning_pars_vertex>
2571#include <clipping_planes_pars_vertex>
2572void main() {
2573	#include <uv_vertex>
2574	#include <batching_vertex>
2575	#include <skinbase_vertex>
2576	#ifdef USE_DISPLACEMENTMAP
2577		#include <beginnormal_vertex>
2578		#include <morphnormal_vertex>
2579		#include <skinnormal_vertex>
2580	#endif
2581	#include <begin_vertex>
2582	#include <morphtarget_vertex>
2583	#include <skinning_vertex>
2584	#include <displacementmap_vertex>
2585	#include <project_vertex>
2586	#include <worldpos_vertex>
2587	#include <clipping_planes_vertex>
2588	vWorldPosition = worldPosition.xyz;
2589}`,Gg=`#define DISTANCE
2590uniform vec3 referencePosition;
2591uniform float nearDistance;
2592uniform float farDistance;
2593varying vec3 vWorldPosition;
2594#include <common>
2595#include <packing>
2596#include <uv_pars_fragment>
2597#include <map_pars_fragment>
2598#include <alphamap_pars_fragment>
2599#include <alphatest_pars_fragment>
2600#include <alphahash_pars_fragment>
2601#include <clipping_planes_pars_fragment>
2602void main () {
2603	#include <clipping_planes_fragment>
2604	vec4 diffuseColor = vec4( 1.0 );
2605	#include <map_fragment>
2606	#include <alphamap_fragment>
2607	#include <alphatest_fragment>
2608	#include <alphahash_fragment>
2609	float dist = length( vWorldPosition - referencePosition );
2610	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2611	dist = saturate( dist );
2612	gl_FragColor = packDepthToRGBA( dist );
2613}`,Wg=`varying vec3 vWorldDirection;
2614#include <common>
2615void main() {
2616	vWorldDirection = transformDirection( position, modelMatrix );
2617	#include <begin_vertex>
2618	#include <project_vertex>
2619}`,Xg=`uniform sampler2D tEquirect;
2620varying vec3 vWorldDirection;
2621#include <common>
2622void main() {
2623	vec3 direction = normalize( vWorldDirection );
2624	vec2 sampleUV = equirectUv( direction );
2625	gl_FragColor = texture2D( tEquirect, sampleUV );
2626	#include <tonemapping_fragment>
2627	#include <colorspace_fragment>
2628}`,qg=`uniform float scale;
2629attribute float lineDistance;
2630varying float vLineDistance;
2631#include <common>
2632#include <uv_pars_vertex>
2633#include <color_pars_vertex>
2634#include <fog_pars_vertex>
2635#include <morphtarget_pars_vertex>
2636#include <logdepthbuf_pars_vertex>
2637#include <clipping_planes_pars_vertex>
2638void main() {
2639	vLineDistance = scale * lineDistance;
2640	#include <uv_vertex>
2641	#include <color_vertex>
2642	#include <morphcolor_vertex>
2643	#include <begin_vertex>
2644	#include <morphtarget_vertex>
2645	#include <project_vertex>
2646	#include <logdepthbuf_vertex>
2647	#include <clipping_planes_vertex>
2648	#include <fog_vertex>
2649}`,Yg=`uniform vec3 diffuse;
2650uniform float opacity;
2651uniform float dashSize;
2652uniform float totalSize;
2653varying float vLineDistance;
2654#include <common>
2655#include <color_pars_fragment>
2656#include <uv_pars_fragment>
2657#include <map_pars_fragment>
2658#include <fog_pars_fragment>
2659#include <logdepthbuf_pars_fragment>
2660#include <clipping_planes_pars_fragment>
2661void main() {
2662	#include <clipping_planes_fragment>
2663	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2664		discard;
2665	}
2666	vec3 outgoingLight = vec3( 0.0 );
2667	vec4 diffuseColor = vec4( diffuse, opacity );
2668	#include <logdepthbuf_fragment>
2669	#include <map_fragment>
2670	#include <color_fragment>
2671	outgoingLight = diffuseColor.rgb;
2672	#include <opaque_fragment>
2673	#include <tonemapping_fragment>
2674	#include <colorspace_fragment>
2675	#include <fog_fragment>
2676	#include <premultiplied_alpha_fragment>
2677}`,Zg=`#include <common>
2678#include <batching_pars_vertex>
2679#include <uv_pars_vertex>
2680#include <envmap_pars_vertex>
2681#include <color_pars_vertex>
2682#include <fog_pars_vertex>
2683#include <morphtarget_pars_vertex>
2684#include <skinning_pars_vertex>
2685#include <logdepthbuf_pars_vertex>
2686#include <clipping_planes_pars_vertex>
2687void main() {
2688	#include <uv_vertex>
2689	#include <color_vertex>
2690	#include <morphcolor_vertex>
2691	#include <batching_vertex>
2692	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2693		#include <beginnormal_vertex>
2694		#include <morphnormal_vertex>
2695		#include <skinbase_vertex>
2696		#include <skinnormal_vertex>
2697		#include <defaultnormal_vertex>
2698	#endif
2699	#include <begin_vertex>
2700	#include <morphtarget_vertex>
2701	#include <skinning_vertex>
2702	#include <project_vertex>
2703	#include <logdepthbuf_vertex>
2704	#include <clipping_planes_vertex>
2705	#include <worldpos_vertex>
2706	#include <envmap_vertex>
2707	#include <fog_vertex>
2708}`,Jg=`uniform vec3 diffuse;
2709uniform float opacity;
2710#ifndef FLAT_SHADED
2711	varying vec3 vNormal;
2712#endif
2713#include <common>
2714#include <dithering_pars_fragment>
2715#include <color_pars_fragment>
2716#include <uv_pars_fragment>
2717#include <map_pars_fragment>
2718#include <alphamap_pars_fragment>
2719#include <alphatest_pars_fragment>
2720#include <alphahash_pars_fragment>
2721#include <aomap_pars_fragment>
2722#include <lightmap_pars_fragment>
2723#include <envmap_common_pars_fragment>
2724#include <envmap_pars_fragment>
2725#include <fog_pars_fragment>
2726#include <specularmap_pars_fragment>
2727#include <logdepthbuf_pars_fragment>
2728#include <clipping_planes_pars_fragment>
2729void main() {
2730	#include <clipping_planes_fragment>
2731	vec4 diffuseColor = vec4( diffuse, opacity );
2732	#include <logdepthbuf_fragment>
2733	#include <map_fragment>
2734	#include <color_fragment>
2735	#include <alphamap_fragment>
2736	#include <alphatest_fragment>
2737	#include <alphahash_fragment>
2738	#include <specularmap_fragment>
2739	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2740	#ifdef USE_LIGHTMAP
2741		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2742		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2743	#else
2744		reflectedLight.indirectDiffuse += vec3( 1.0 );
2745	#endif
2746	#include <aomap_fragment>
2747	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2748	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2749	#include <envmap_fragment>
2750	#include <opaque_fragment>
2751	#include <tonemapping_fragment>
2752	#include <colorspace_fragment>
2753	#include <fog_fragment>
2754	#include <premultiplied_alpha_fragment>
2755	#include <dithering_fragment>
2756}`,$g=`#define LAMBERT
2757varying vec3 vViewPosition;
2758#include <common>
2759#include <batching_pars_vertex>
2760#include <uv_pars_vertex>
2761#include <displacementmap_pars_vertex>
2762#include <envmap_pars_vertex>
2763#include <color_pars_vertex>
2764#include <fog_pars_vertex>
2765#include <normal_pars_vertex>
2766#include <morphtarget_pars_vertex>
2767#include <skinning_pars_vertex>
2768#include <shadowmap_pars_vertex>
2769#include <logdepthbuf_pars_vertex>
2770#include <clipping_planes_pars_vertex>
2771void main() {
2772	#include <uv_vertex>
2773	#include <color_vertex>
2774	#include <morphcolor_vertex>
2775	#include <batching_vertex>
2776	#include <beginnormal_vertex>
2777	#include <morphnormal_vertex>
2778	#include <skinbase_vertex>
2779	#include <skinnormal_vertex>
2780	#include <defaultnormal_vertex>
2781	#include <normal_vertex>
2782	#include <begin_vertex>
2783	#include <morphtarget_vertex>
2784	#include <skinning_vertex>
2785	#include <displacementmap_vertex>
2786	#include <project_vertex>
2787	#include <logdepthbuf_vertex>
2788	#include <clipping_planes_vertex>
2789	vViewPosition = - mvPosition.xyz;
2790	#include <worldpos_vertex>
2791	#include <envmap_vertex>
2792	#include <shadowmap_vertex>
2793	#include <fog_vertex>
2794}`,Kg=`#define LAMBERT
2795uniform vec3 diffuse;
2796uniform vec3 emissive;
2797uniform float opacity;
2798#include <common>
2799#include <packing>
2800#include <dithering_pars_fragment>
2801#include <color_pars_fragment>
2802#include <uv_pars_fragment>
2803#include <map_pars_fragment>
2804#include <alphamap_pars_fragment>
2805#include <alphatest_pars_fragment>
2806#include <alphahash_pars_fragment>
2807#include <aomap_pars_fragment>
2808#include <lightmap_pars_fragment>
2809#include <emissivemap_pars_fragment>
2810#include <envmap_common_pars_fragment>
2811#include <envmap_pars_fragment>
2812#include <fog_pars_fragment>
2813#include <bsdfs>
2814#include <lights_pars_begin>
2815#include <normal_pars_fragment>
2816#include <lights_lambert_pars_fragment>
2817#include <shadowmap_pars_fragment>
2818#include <bumpmap_pars_fragment>
2819#include <normalmap_pars_fragment>
2820#include <specularmap_pars_fragment>
2821#include <logdepthbuf_pars_fragment>
2822#include <clipping_planes_pars_fragment>
2823void main() {
2824	#include <clipping_planes_fragment>
2825	vec4 diffuseColor = vec4( diffuse, opacity );
2826	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2827	vec3 totalEmissiveRadiance = emissive;
2828	#include <logdepthbuf_fragment>
2829	#include <map_fragment>
2830	#include <color_fragment>
2831	#include <alphamap_fragment>
2832	#include <alphatest_fragment>
2833	#include <alphahash_fragment>
2834	#include <specularmap_fragment>
2835	#include <normal_fragment_begin>
2836	#include <normal_fragment_maps>
2837	#include <emissivemap_fragment>
2838	#include <lights_lambert_fragment>
2839	#include <lights_fragment_begin>
2840	#include <lights_fragment_maps>
2841	#include <lights_fragment_end>
2842	#include <aomap_fragment>
2843	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2844	#include <envmap_fragment>
2845	#include <opaque_fragment>
2846	#include <tonemapping_fragment>
2847	#include <colorspace_fragment>
2848	#include <fog_fragment>
2849	#include <premultiplied_alpha_fragment>
2850	#include <dithering_fragment>
2851}`,Qg=`#define MATCAP
2852varying vec3 vViewPosition;
2853#include <common>
2854#include <batching_pars_vertex>
2855#include <uv_pars_vertex>
2856#include <color_pars_vertex>
2857#include <displacementmap_pars_vertex>
2858#include <fog_pars_vertex>
2859#include <normal_pars_vertex>
2860#include <morphtarget_pars_vertex>
2861#include <skinning_pars_vertex>
2862#include <logdepthbuf_pars_vertex>
2863#include <clipping_planes_pars_vertex>
2864void main() {
2865	#include <uv_vertex>
2866	#include <color_vertex>
2867	#include <morphcolor_vertex>
2868	#include <batching_vertex>
2869	#include <beginnormal_vertex>
2870	#include <morphnormal_vertex>
2871	#include <skinbase_vertex>
2872	#include <skinnormal_vertex>
2873	#include <defaultnormal_vertex>
2874	#include <normal_vertex>
2875	#include <begin_vertex>
2876	#include <morphtarget_vertex>
2877	#include <skinning_vertex>
2878	#include <displacementmap_vertex>
2879	#include <project_vertex>
2880	#include <logdepthbuf_vertex>
2881	#include <clipping_planes_vertex>
2882	#include <fog_vertex>
2883	vViewPosition = - mvPosition.xyz;
2884}`,jg=`#define MATCAP
2885uniform vec3 diffuse;
2886uniform float opacity;
2887uniform sampler2D matcap;
2888varying vec3 vViewPosition;
2889#include <common>
2890#include <dithering_pars_fragment>
2891#include <color_pars_fragment>
2892#include <uv_pars_fragment>
2893#include <map_pars_fragment>
2894#include <alphamap_pars_fragment>
2895#include <alphatest_pars_fragment>
2896#include <alphahash_pars_fragment>
2897#include <fog_pars_fragment>
2898#include <normal_pars_fragment>
2899#include <bumpmap_pars_fragment>
2900#include <normalmap_pars_fragment>
2901#include <logdepthbuf_pars_fragment>
2902#include <clipping_planes_pars_fragment>
2903void main() {
2904	#include <clipping_planes_fragment>
2905	vec4 diffuseColor = vec4( diffuse, opacity );
2906	#include <logdepthbuf_fragment>
2907	#include <map_fragment>
2908	#include <color_fragment>
2909	#include <alphamap_fragment>
2910	#include <alphatest_fragment>
2911	#include <alphahash_fragment>
2912	#include <normal_fragment_begin>
2913	#include <normal_fragment_maps>
2914	vec3 viewDir = normalize( vViewPosition );
2915	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
2916	vec3 y = cross( viewDir, 
2916x );
2917	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
2918	#ifdef USE_MATCAP
2919		vec4 matcapColor = texture2D( matcap, uv );
2920	#else
2921		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
2922	#endif
2923	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
2924	#include <opaque_fragment>
2925	#include <tonemapping_fragment>
2926	#include <colorspace_fragment>
2927	#include <fog_fragment>
2928	#include <premultiplied_alpha_fragment>
2929	#include <dithering_fragment>
2930}`,e_=`#define NORMAL
2931#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
2932	varying vec3 vViewPosition;
2933#endif
2934#include <common>
2935#include <batching_pars_vertex>
2936#include <uv_pars_vertex>
2937#include <displacementmap_pars_vertex>
2938#include <normal_pars_vertex>
2939#include <morphtarget_pars_vertex>
2940#include <skinning_pars_vertex>
2941#include <logdepthbuf_pars_vertex>
2942#include <clipping_planes_pars_vertex>
2943void main() {
2944	#include <uv_vertex>
2945	#include <batching_vertex>
2946	#include <beginnormal_vertex>
2947	#include <morphnormal_vertex>
2948	#include <skinbase_vertex>
2949	#include <skinnormal_vertex>
2950	#include <defaultnormal_vertex>
2951	#include <normal_vertex>
2952	#include <begin_vertex>
2953	#include <morphtarget_vertex>
2954	#include <skinning_vertex>
2955	#include <displacementmap_vertex>
2956	#include <project_vertex>
2957	#include <logdepthbuf_vertex>
2958	#include <clipping_planes_vertex>
2959#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
2960	vViewPosition = - mvPosition.xyz;
2961#endif
2962}`,t_=`#define NORMAL
2963uniform float opacity;
2964#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
2965	varying vec3 vViewPosition;
2966#endif
2967#include <packing>
2968#include <uv_pars_fragment>
2969#include <normal_pars_fragment>
2970#include <bumpmap_pars_fragment>
2971#include <normalmap_pars_fragment>
2972#include <logdepthbuf_pars_fragment>
2973#include <clipping_planes_pars_fragment>
2974void main() {
2975	#include <clipping_planes_fragment>
2976	#include <logdepthbuf_fragment>
2977	#include <normal_fragment_begin>
2978	#include <normal_fragment_maps>
2979	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
2980	#ifdef OPAQUE
2981		gl_FragColor.a = 1.0;
2982	#endif
2983}`,n_=`#define PHONG
2984varying vec3 vViewPosition;
2985#include <common>
2986#include <batching_pars_vertex>
2987#include <uv_pars_vertex>
2988#include <displacementmap_pars_vertex>
2989#include <envmap_pars_vertex>
2990#include <color_pars_vertex>
2991#include <fog_pars_vertex>
2992#include <normal_pars_vertex>
2993#include <morphtarget_pars_vertex>
2994#include <skinning_pars_vertex>
2995#include <shadowmap_pars_vertex>
2996#include <logdepthbuf_pars_vertex>
2997#include <clipping_planes_pars_vertex>
2998void main() {
2999	#include <uv_vertex>
3000	#include <color_vertex>
3001	#include <morphcolor_vertex>
3002	#include <batching_vertex>
3003	#include <beginnormal_vertex>
3004	#include <morphnormal_vertex>
3005	#include <skinbase_vertex>
3006	#include <skinnormal_vertex>
3007	#include <defaultnormal_vertex>
3008	#include <normal_vertex>
3009	#include <begin_vertex>
3010	#include <morphtarget_vertex>
3011	#include <skinning_vertex>
3012	#include <displacementmap_vertex>
3013	#include <project_vertex>
3014	#include <logdepthbuf_vertex>
3015	#include <clipping_planes_vertex>
3016	vViewPosition = - mvPosition.xyz;
3017	#include <worldpos_vertex>
3018	#include <envmap_vertex>
3019	#include <shadowmap_vertex>
3020	#include <fog_vertex>
3021}`,i_=`#define PHONG
3022uniform vec3 diffuse;
3023uniform vec3 emissive;
3024uniform vec3 specular;
3025uniform float shininess;
3026uniform float opacity;
3027#include <common>
3028#include <packing>
3029#include <dithering_pars_fragment>
3030#include <color_pars_fragment>
3031#include <uv_pars_fragment>
3032#include <map_pars_fragment>
3033#include <alphamap_pars_fragment>
3034#include <alphatest_pars_fragment>
3035#include <alphahash_pars_fragment>
3036#include <aomap_pars_fragment>
3037#include <lightmap_pars_fragment>
3038#include <emissivemap_pars_fragment>
3039#include <envmap_common_pars_fragment>
3040#include <envmap_pars_fragment>
3041#include <fog_pars_fragment>
3042#include <bsdfs>
3043#include <lights_pars_begin>
3044#include <normal_pars_fragment>
3045#include <lights_phong_pars_fragment>
3046#include <shadowmap_pars_fragment>
3047#include <bumpmap_pars_fragment>
3048#include <normalmap_pars_fragment>
3049#include <specularmap_pars_fragment>
3050#include <logdepthbuf_pars_fragment>
3051#include <clipping_planes_pars_fragment>
3052void main() {
3053	#include <clipping_planes_fragment>
3054	vec4 diffuseColor = vec4( diffuse, opacity );
3055	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3056	vec3 totalEmissiveRadiance = emissive;
3057	#include <logdepthbuf_fragment>
3058	#include <map_fragment>
3059	#include <color_fragment>
3060	#include <alphamap_fragment>
3061	#include <alphatest_fragment>
3062	#include <alphahash_fragment>
3063	#include <specularmap_fragment>
3064	#include <normal_fragment_begin>
3065	#include <normal_fragment_maps>
3066	#include <emissivemap_fragment>
3067	#include <lights_phong_fragment>
3068	#include <lights_fragment_begin>
3069	#include <lights_fragment_maps>
3070	#include <lights_fragment_end>
3071	#include <aomap_fragment>
3072	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3073	#include <envmap_fragment>
3074	#include <opaque_fragment>
3075	#include <tonemapping_fragment>
3076	#include <colorspace_fragment>
3077	#include <fog_fragment>
3078	#include <premultiplied_alpha_fragment>
3079	#include <dithering_fragment>
3080}`,s_=`#define STANDARD
3081varying vec3 vViewPosition;
3082#ifdef USE_TRANSMISSION
3083	varying vec3 vWorldPosition;
3084#endif
3085#include <common>
3086#include <batching_pars_vertex>
3087#include <uv_pars_vertex>
3088#include <displacementmap_pars_vertex>
3089#include <color_pars_vertex>
3090#include <fog_pars_vertex>
3091#include <normal_pars_vertex>
3092#include <morphtarget_pars_vertex>
3093#include <skinning_pars_vertex>
3094#include <shadowmap_pars_vertex>
3095#include <logdepthbuf_pars_vertex>
3096#include <clipping_planes_pars_vertex>
3097void main() {
3098	#include <uv_vertex>
3099	#include <color_vertex>
3100	#include <morphcolor_vertex>
3101	#include <batching_vertex>
3102	#include <beginnormal_vertex>
3103	#include <morphnormal_vertex>
3104	#include <skinbase_vertex>
3105	#include <skinnormal_vertex>
3106	#include <defaultnormal_vertex>
3107	#include <normal_vertex>
3108	#include <begin_vertex>
3109	#include <morphtarget_vertex>
3110	#include <skinning_vertex>
3111	#include <displacementmap_vertex>
3112	#include <project_vertex>
3113	#include <logdepthbuf_vertex>
3114	#include <clipping_planes_vertex>
3115	vViewPosition = - mvPosition.xyz;
3116	#include <worldpos_vertex>
3117	#include <shadowmap_vertex>
3118	#include <fog_vertex>
3119#ifdef USE_TRANSMISSION
3120	vWorldPosition = worldPosition.xyz;
3121#endif
3122}`,r_=`#define STANDARD
3123#ifdef PHYSICAL
3124	#define IOR
3125	#define USE_SPECULAR
3126#endif
3127uniform vec3 diffuse;
3128uniform vec3 emissive;
3129uniform float roughness;
3130uniform float metalness;
3131uniform float opacity;
3132#ifdef IOR
3133	uniform float ior;
3134#endif
3135#ifdef USE_SPECULAR
3136	uniform float specularIntensity;
3137	uniform vec3 specularColor;
3138	#ifdef USE_SPECULAR_COLORMAP
3139		uniform sampler2D specularColorMap;
3140	#endif
3141	#ifdef USE_SPECULAR_INTENSITYMAP
3142		uniform sampler2D specularIntensityMap;
3143	#endif
3144#endif
3145#ifdef USE_CLEARCOAT
3146	uniform float clearcoat;
3147	uniform float clearcoatRoughness;
3148#endif
3149#ifdef USE_IRIDESCENCE
3150	uniform float iridescence;
3151	uniform float iridescenceIOR;
3152	uniform float iridescenceThicknessMinimum;
3153	uniform float iridescenceThicknessMaximum;
3154#endif
3155#ifdef USE_SHEEN
3156	uniform vec3 sheenColor;
3157	uniform float sheenRoughness;
3158	#ifdef USE_SHEEN_COLORMAP
3159		uniform sampler2D sheenColorMap;
3160	#endif
3161	#ifdef USE_SHEEN_ROUGHNESSMAP
3162		uniform sampler2D sheenRoughnessMap;
3163	#endif
3164#endif
3165#ifdef USE_ANISOTROPY
3166	uniform vec2 anisotropyVector;
3167	#ifdef USE_ANISOTROPYMAP
3168		uniform sampler2D anisotropyMap;
3169	#endif
3170#endif
3171varying vec3 vViewPosition;
3172#include <common>
3173#include <packing>
3174#include <dithering_pars_fragment>
3175#include <color_pars_fragment>
3176#include <uv_pars_fragment>
3177#include <map_pars_fragment>
3178#include <alphamap_pars_fragment>
3179#include <alphatest_pars_fragment>
3180#include <alphahash_pars_fragment>
3181#include <aomap_pars_fragment>
3182#include <lightmap_pars_fragment>
3183#include <emissivemap_pars_fragment>
3184#include <iridescence_fragment>
3185#include <cube_uv_reflection_fragment>
3186#include <envmap_common_pars_fragment>
3187#include <envmap_physical_pars_fragment>
3188#include <fog_pars_fragment>
3189#include <lights_pars_begin>
3190#include <normal_pars_fragment>
3191#include <lights_physical_pars_fragment>
3192#include <transmission_pars_fragment>
3193#include <shadowmap_pars_fragment>
3194#include <bumpmap_pars_fragment>
3195#include <normalmap_pars_fragment>
3196#include <clearcoat_pars_fragment>
3197#include <iridescence_pars_fragment>
3198#include <roughnessmap_pars_fragment>
3199#include <metalnessmap_pars_fragment>
3200#include <logdepthbuf_pars_fragment>
3201#include <clipping_planes_pars_fragment>
3202void main() {
3203	#include <clipping_planes_fragment>
3204	vec4 diffuseColor = vec4( diffuse, opacity );
3205	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3206	vec3 totalEmissiveRadiance = emissive;
3207	#include <logdepthbuf_fragment>
3208	#include <map_fragment>
3209	#include <color_fragment>
3210	#include <alphamap_fragment>
3211	#include <alphatest_fragment>
3212	#include <alphahash_fragment>
3213	#include <roughnessmap_fragment>
3214	#include <metalnessmap_fragment>
3215	#include <normal_fragment_begin>
3216	#include <normal_fragment_maps>
3217	#include <clearcoat_normal_fragment_begin>
3218	#include <clearcoat_normal_fragment_maps>
3219	#include <emissivemap_fragment>
3220	#include <lights_physical_fragment>
3221	#include <lights_fragment_begin>
3222	#include <lights_fragment_maps>
3223	#include <lights_fragment_end>
3224	#include <aomap_fragment>
3225	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3226	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3227	#include <transmission_fragment>
3228	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3229	#ifdef USE_SHEEN
3230		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3231		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3232	#endif
3233	#ifdef USE_CLEARCOAT
3234		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3235		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3236		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3237	#endif
3238	#include <opaque_fragment>
3239	#include <tonemapping_fragment>
3240	#include <colorspace_fragment>
3241	#include <fog_fragment>
3242	#include <premultiplied_alpha_fragment>
3243	#include <dithering_fragment>
3244}`,a_=`#define TOON
3245varying vec3 vViewPosition;
3246#include <common>
3247#include <batching_pars_vertex>
3248#include <uv_pars_vertex>
3249#include <displacementmap_pars_vertex>
3250#include <color_pars_vertex>
3251#include <fog_pars_vertex>
3252#include <normal_pars_vertex>
3253#include <morphtarget_pars_vertex>
3254#include <skinning_pars_vertex>
3255#include <shadowmap_pars_vertex>
3256#include <logdepthbuf_pars_vertex>
3257#include <clipping_planes_pars_vertex>
3258void main() {
3259	#include <uv_vertex>
3260	#include <color_vertex>
3261	#include <morphcolor_vertex>
3262	#include <batching_vertex>
3263	#include <beginnormal_vertex>
3264	#include <morphnormal_vertex>
3265	#include <skinbase_vertex>
3266	#include <skinnormal_vertex>
3267	#include <defaultnormal_vertex>
3268	#include <normal_vertex>
3269	#include <begin_vertex>
3270	#include <morphtarget_vertex>
3271	#include <skinning_vertex>
3272	#include <displacementmap_vertex>
3273	#include <project_vertex>
3274	#include <logdepthbuf_vertex>
3275	#include <clipping_planes_vertex>
3276	vViewPosition = - mvPosition.xyz;
3277	#include <worldpos_vertex>
3278	#include <shadowmap_vertex>
3279	#include <fog_vertex>
3280}`,o_=`#define TOON
3281uniform vec3 diffuse;
3282uniform vec3 emissive;
3283uniform float opacity;
3284#include <common>
3285#include <packing>
3286#include <dithering_pars_fragment>
3287#include <color_pars_fragment>
3288#include <uv_pars_fragment>
3289#include <map_pars_fragment>
3290#include <alphamap_pars_fragment>
3291#include <alphatest_pars_fragment>
3292#include <alphahash_pars_fragment>
3293#include <aomap_pars_fragment>
3294#include <lightmap_pars_fragment>
3295#include <emissivemap_pars_fragment>
3296#include <gradientmap_pars_fragment>
3297#include <fog_pars_fragment>
3298#include <bsdfs>
3299#include <lights_pars_begin>
3300#include <normal_pars_fragment>
3301#include <lights_toon_pars_fragment>
3302#include <shadowmap_pars_fragment>
3303#include <bumpmap_pars_fragment>
3304#include <normalmap_pars_fragment>
3305#include <logdepthbuf_pars_fragment>
3306#include <clipping_planes_pars_fragment>
3307void main() {
3308	#include <clipping_planes_fragment>
3309	vec4 diffuseColor = vec4( diffuse, opacity );
3310	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3311	vec3 totalEmissiveRadiance = emissive;
3312	#include <logdepthbuf_fragment>
3313	#include <map_fragment>
3314	#include <color_fragment>
3315	#include <alphamap_fragment>
3316	#include <alphatest_fragment>
3317	#include <alphahash_fragment>
3318	#include <normal_fragment_begin>
3319	#include <normal_fragment_maps>
3320	#include <emissivemap_fragment>
3321	#include <lights_toon_fragment>
3322	#include <lights_fragment_begin>
3323	#include <lights_fragment_maps>
3324	#include <lights_fragment_end>
3325	#include <aomap_fragment>
3326	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3327	#include <opaque_fragment>
3328	#include <tonemapping_fragment>
3329	#include <colorspace_fragment>
3330	#include <fog_fragment>
3331	#include <premultiplied_alpha_fragment>
3332	#include <dithering_fragment>
3333}`,l_=`uniform float size;
3334uniform float scale;
3335#include <common>
3336#include <color_pars_vertex>
3337#include <fog_pars_vertex>
3338#include <morphtarget_pars_vertex>
3339#include <logdepthbuf_pars_vertex>
3340#include <clipping_planes_pars_vertex>
3341#ifdef USE_POINTS_UV
3342	varying vec2 vUv;
3343	uniform mat3 uvTransform;
3344#endif
3345void main() {
3346	#ifdef USE_POINTS_UV
3347		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3348	#endif
3349	#include <color_vertex>
3350	#include <morphcolor_vertex>
3351	#include <begin_vertex>
3352	#include <morphtarget_vertex>
3353	#include <project_vertex>
3354	gl_PointSize = size;
3355	#ifdef USE_SIZEATTENUATION
3356		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3357		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3358	#endif
3359	#include <logdepthbuf_vertex>
3360	#include <clipping_planes_vertex>
3361	#include <worldpos_vertex>
3362	#include <fog_vertex>
3363}`,c_=`uniform vec3 diffuse;
3364uniform float opacity;
3365#include <common>
3366#include <color_pars_fragment>
3367#include <map_particle_pars_fragment>
3368#include <alphatest_pars_fragment>
3369#include <alphahash_pars_fragment>
3370#include <fog_pars_fragment>
3371#include <logdepthbuf_pars_fragment>
3372#include <clipping_planes_pars_fragment>
3373void main() {
3374	#include <clipping_planes_fragment>
3375	vec3 outgoingLight = vec3( 0.0 );
3376	vec4 diffuseColor = vec4( diffuse, opacity );
3377	#include <logdepthbuf_fragment>
3378	#include <map_particle_fragment>
3379	#include <color_fragment>
3380	#include <alphatest_fragment>
3381	#include <alphahash_fragment>
3382	outgoingLight = diffuseColor.rgb;
3383	#include <opaque_fragment>
3384	#include <tonemapping_fragment>
3385	#include <colorspace_fragment>
3386	#include <fog_fragment>
3387	#include <premultiplied_alpha_fragment>
3388}`,h_=`#include <common>
3389#include <batching_pars_vertex>
3390#include <fog_pars_vertex>
3391#include <morphtarget_pars_vertex>
3392#include <skinning_pars_vertex>
3393#include <logdepthbuf_pars_vertex>
3394#include <shadowmap_pars_vertex>
3395void main() {
3396	#include <batching_vertex>
3397	#include <beginnormal_vertex>
3398	#include <morphnormal_vertex>
3399	#include <skinbase_vertex>
3400	#include <skinnormal_vertex>
3401	#include <defaultnormal_vertex>
3402	#include <begin_vertex>
3403	#include <morphtarget_vertex>
3404	#include <skinning_vertex>
3405	#include <project_vertex>
3406	#include <logdepthbuf_vertex>
3407	#include <worldpos_vertex>
3408	#include <shadowmap_vertex>
3409	#include <fog_vertex>
3410}`,u_=`uniform vec3 color;
3411uniform float opacity;
3412#include <common>
3413#include <packing>
3414#include <fog_pars_fragment>
3415#include <bsdfs>
3416#include <lights_pars_begin>
3417#include <logdepthbuf_pars_fragment>
3418#include <shadowmap_pars_fragment>
3419#include <shadowmask_pars_fragment>
3420void main() {
3421	#include <logdepthbuf_fragment>
3422	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3423	#include <tonemapping_fragment>
3424	#include <colorspace_fragment>
3425	#include <fog_fragment>
3426}`,d_=`uniform float rotation;
3427uniform vec2 center;
3428#include <common>
3429#include <uv_pars_vertex>
3430#include <fog_pars_vertex>
3431#include <logdepthbuf_pars_vertex>
3432#include <clipping_planes_pars_vertex>
3433void main() {
3434	#include <uv_vertex>
3435	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
3436	vec2 scale;
3437	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
3438	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
3439	#ifndef USE_SIZEATTENUATION
3440		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3441		if ( isPerspective ) scale *= - mvPosition.z;
3442	#endif
3443	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3444	vec2 rotatedPosition;
3445	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3446	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3447	mvPosition.xy += rotatedPosition;
3448	gl_Position = projectionMatrix * mvPosition;
3449	#include <logdepthbuf_vertex>
3450	#include <clipping_planes_vertex>
3451	#include <fog_vertex>
3452}`,f_=`uniform vec3 diffuse;
3453uniform float opacity;
3454#include <common>
3455#include <uv_pars_fragment>
3456#include <map_pars_fragment>
3457#include <alphamap_pars_fragment>
3458#include <alphatest_pars_fragment>
3459#include <alphahash_pars_fragment>
3460#include <fog_pars_fragment>
3461#include <logdepthbuf_pars_fragment>
3462#include <clipping_planes_pars_fragment>
3463void main() {
3464	#include <clipping_planes_fragment>
3465	vec3 outgoingLight = vec3( 0.0 );
3466	vec4 diffuseColor = vec4( diffuse, opacity );
3467	#include <logdepthbuf_fragment>
3468	#include <map_fragment>
3469	#include <alphamap_fragment>
3470	#include <alphatest_fragment>
3471	#include <alphahash_fragment>
3472	outgoingLight = diffuseColor.rgb;
3473	#include <opaque_fragment>
3474	#include <tonemapping_fragment>
3475	#include <colorspace_fragment>
3476	#include <fog_fragment>
3477}`,ze={alphahash_fragment:Np,alphahash_pars_fragment:Op,alphamap_fragment:Fp,alph
vendor: 7,236 bytes, line 3477
3477amap_pars_fragment:Bp,alphatest_fragment:zp,alphatest_pars_fragment:kp,aomap_fragment:Vp,aomap_pars_fragment:Hp,batching_pars_vertex:Gp,batching_vertex:Wp,begin_vertex:Xp,beginnormal_vertex:qp,bsdfs:Yp,iridescence_fragment:Zp,bumpmap_pars_fragment:Jp,clipping_planes_fragment:$p,clipping_planes_pars_fragment:Kp,clipping_planes_pars_vertex:Qp,clipping_planes_vertex:jp,color_fragment:em,color_pars_fragment:tm,color_pars_vertex:nm,color_vertex:im,common:sm,cube_uv_reflection_fragment:rm,defaultnormal_vertex:am,displacementmap_pars_vertex:om,displacementmap_vertex:lm,emissivemap_fragment:cm,emissivemap_pars_fragment:hm,colorspace_fragment:um,colorspace_pars_fragment:dm,envmap_fragment:fm,envmap_common_pars_fragment:pm,envmap_pars_fragment:mm,envmap_pars_vertex:gm,envmap_physical_pars_fragment:Cm,envmap_vertex:_m,fog_vertex:xm,fog_pars_vertex:vm,fog_fragment:ym,fog_pars_fragment:Mm,gradientmap_pars_fragment:Sm,lightmap_fragment:bm,lightmap_pars_fragment:Em,lights_lambert_fragment:Am,lights_lambert_pars_fragment:Tm,lights_pars_begin:wm,lights_toon_fragment:Rm,lights_toon_pars_fragment:Pm,lights_phong_fragment:Lm,lights_phong_pars_fragment:Im,lights_physical_fragment:Um,lights_physical_pars_fragment:Dm,lights_fragment_begin:Nm,lights_fragment_maps:Om,lights_fragment_end:Fm,logdepthbuf_fragment:Bm,logdepthbuf_pars_fragment:zm,logdepthbuf_pars_vertex:km,logdepthbuf_vertex:Vm,map_fragment:Hm,map_pars_fragment:Gm,map_particle_fragment:Wm,map_particle_pars_fragment:Xm,metalnessmap_fragment:qm,metalnessmap_pars_fragment:Ym,morphcolor_vertex:Zm,morphnormal_vertex:Jm,morphtarget_pars_vertex:$m,morphtarget_vertex:Km,normal_fragment_begin:Qm,normal_fragment_maps:jm,normal_pars_fragment:eg,normal_pars_vertex:tg,normal_vertex:ng,normalmap_pars_fragment:ig,clearcoat_normal_fragment_begin:sg,clearcoat_normal_fragment_maps:rg,clearcoat_pars_fragment:ag,iridescence_pars_fragment:og,opaque_fragment:lg,packing:cg,premultiplied_alpha_fragment:hg,project_vertex:ug,dithering_fragment:dg,dithering_pars_fragment:fg,roughnessmap_fragment:pg,roughnessmap_pars_fragment:mg,shadowmap_pars_fragment:gg,shadowmap_pars_vertex:_g,shadowmap_vertex:xg,shadowmask_pars_fragment:vg,skinbase_vertex:yg,skinning_pars_vertex:Mg,skinning_vertex:Sg,skinnormal_vertex:bg,specularmap_fragment:Eg,specularmap_pars_fragment:Ag,tonemapping_fragment:Tg,tonemapping_pars_fragment:wg,transmission_fragment:Cg,transmission_pars_fragment:Rg,uv_pars_fragment:Pg,uv_pars_vertex:Lg,uv_vertex:Ig,worldpos_vertex:Ug,background_vert:Dg,background_frag:Ng,backgroundCube_vert:Og,backgroundCube_frag:Fg,cube_vert:Bg,cube_frag:zg,depth_vert:kg,depth_frag:Vg,distanceRGBA_vert:Hg,distanceRGBA_frag:Gg,equirect_vert:Wg,equirect_frag:Xg,linedashed_vert:qg,linedashed_frag:Yg,meshbasic_vert:Zg,meshbasic_frag:Jg,meshlambert_vert:$g,meshlambert_frag:Kg,meshmatcap_vert:Qg,meshmatcap_frag:jg,meshnormal_vert:e_,meshnormal_frag:t_,meshphong_vert:n_,meshphong_frag:i_,meshphysical_vert:s_,meshphysical_frag:r_,meshtoon_vert:a_,meshtoon_frag:o_,points_vert:l_,points_frag:c_,shadow_vert:h_,shadow_frag:u_,sprite_vert:d_,sprite_frag:f_},ae={common:{diffuse:{value:new pe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new He},alphaMap:{value:null},alphaMapTransform:{value:new He},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new He}},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 He}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new He}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new He},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new He},normalScale:{value:new Z(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new He},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new He}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new He}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new He}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new pe(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 pe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new He},alphaTest:{value:0},uvTransform:{value:new He}},sprite:{diffuse:{value:new pe(16777215)},opacity:{value:1},center:{value:new Z(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new He},alphaMap:{value:null},alphaMapTransform:{value:new He},alphaTest:{value:0}}},tn={basic:{uniforms:Nt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.fog]),vertexShader:ze.meshbasic_vert,fragmentShader:ze.meshbasic_frag},lambert:{uniforms:Nt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new pe(0)}}]),vertexShader:ze.meshlambert_vert,fragmentShader:ze.meshlambert_frag},phong:{uniforms:Nt([ae.common,ae.specularmap,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,ae.lights,{emissive:{value:new pe(0)},specular:{value:new pe(1118481)},shininess:{value:30}}]),vertexShader:ze.meshphong_vert,fragmentShader:ze.meshphong_frag},standard:{uniforms:Nt([ae.common,ae.envmap,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.roughnessmap,ae.metalnessmap,ae.fog,ae.lights,{emissive:{value:new pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag},toon:{uniforms:Nt([ae.common,ae.aomap,ae.lightmap,ae.emissivemap,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.gradientmap,ae.fog,ae.lights,{emissive:{value:new pe(0)}}]),vertexShader:ze.meshtoon_vert,fragmentShader:ze.meshtoon_frag},matcap:{uniforms:Nt([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,ae.fog,{matc
vendor: 4,818 bytes, line 3477
3477ap:{value:null}}]),vertexShader:ze.meshmatcap_vert,fragmentShader:ze.meshmatcap_frag},points:{uniforms:Nt([ae.points,ae.fog]),vertexShader:ze.points_vert,fragmentShader:ze.points_frag},dashed:{uniforms:Nt([ae.common,ae.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ze.linedashed_vert,fragmentShader:ze.linedashed_frag},depth:{uniforms:Nt([ae.common,ae.displacementmap]),vertexShader:ze.depth_vert,fragmentShader:ze.depth_frag},normal:{uniforms:Nt([ae.common,ae.bumpmap,ae.normalmap,ae.displacementmap,{opacity:{value:1}}]),vertexShader:ze.meshnormal_vert,fragmentShader:ze.meshnormal_frag},sprite:{uniforms:Nt([ae.sprite,ae.fog]),vertexShader:ze.sprite_vert,fragmentShader:ze.sprite_frag},background:{uniforms:{uvTransform:{value:new He},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ze.background_vert,fragmentShader:ze.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ze.backgroundCube_vert,fragmentShader:ze.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ze.cube_vert,fragmentShader:ze.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ze.equirect_vert,fragmentShader:ze.equirect_frag},distanceRGBA:{uniforms:Nt([ae.common,ae.displacementmap,{referencePosition:{value:new w},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ze.distanceRGBA_vert,fragmentShader:ze.distanceRGBA_frag},shadow:{uniforms:Nt([ae.lights,ae.fog,{color:{value:new pe(0)},opacity:{value:1}}]),vertexShader:ze.shadow_vert,fragmentShader:ze.shadow_frag}};tn.physical={uniforms:Nt([tn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new He},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new He},clearcoatNormalScale:{value:new Z(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new He},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new He},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new He},sheen:{value:0},sheenColor:{value:new pe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new He},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new He},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new He},transmissionSamplerSize:{value:new Z},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new He},attenuationDistance:{value:0},attenuationColor:{value:new pe(0)},specularColor:{value:new pe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new He},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new He},anisotropyVector:{value:new Z},anisotropyMap:{value:null},anisotropyMapTransform:{value:new He}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag};const Tr={r:0,b:0,g:0};function p_(r,e,t,n,i,s,a){const o=new pe(0);let l=s===!0?0:1,c,h,u=null,d=0,f=null;function m(g,p){let v=!1,x=p.isScene===!0?p.background:null;x&&x.isTexture&&(x=(p.backgroundBlurriness>0?t:e).get(x)),x===null?_(o,l):x&&x.isColor&&(_(x,1),v=!0);const y=r.xr.getEnvironmentBlendMode();y==="additive"?n.buffers.color.setClear(0,0,0,1,a):y==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||v)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),x&&(x.isCubeTexture||x.mapping===ss)?(h===void 0&&(h=new xt(new bi(1,1,1),new fn({name:"BackgroundCubeMaterial",uniforms:ns(tn.backgroundCube.uniforms),vertexShader:tn.backgroundCube.vertexShader,fragmentShader:tn.backgroundCube.fragmentShader,side:Ot,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(R,T,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),h.material.uniforms.envMap.value=x,h.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,h.material.toneMapped=Qe.getTransfer(x.colorSpace)!==st,(u!==x||d!==x.version||f!==r.toneMapping)&&(h.material.needsUpdate=!0,u=x,d=x.version,f=r.toneMapping),h.layers.enableAll(),g.unshift(h,h.geometry,h.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new xt(new js(2,2),new fn({name:"Backgroun
3477dMaterial",uniforms:ns(tn.background.uniforms),vertexShader:tn.background.vertexShader,fragmentShader:tn.background.fragmentShader,side:Cn,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=x,c.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,c.material.toneMapped=Qe.getTransfer(x.colorSpace)!==st,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(u!==x||d!==x.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,u=x,d=x.version,f=r.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null))}function _(g,p){g.getRGB(Tr,Xu(r)),n.buffers.color.setClear(Tr.r,Tr.g,Tr.b,p,a)}return{getClearColor:function(){return o},setClearColor:function(g,p=1){o.set(g),l=p,_(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,_(o,l)},render:m}}function m_(r,e,t,n){const i=r.getParameter(r.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||s!==null,o={},l=g(null);let c=l,h=!1;function u(I,F,V,J,Y){let W=!1;if(a){const ee=_(J,V,F);c!==ee&&(c=ee,f(c.object)),W=p(I,J,V,Y),W&&v(I,J,V,Y)}else{const ee=F.wireframe===!0;(c.geometry!==J.id||c.program!==V.id||c.wireframe!==ee)&&(c.geometry=J.id,c.program=V.id,c.wireframe=ee,W=!0)}Y!==null&&t.update(Y,r.ELEMENT_ARRAY_BUFFER),(W||h)&&(h=!1,U(I,F,V,J),Y!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(Y).buffer))}function d(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function f(I){return n.isWebGL2?r.bindVertexArray(I):s.bindVertexArrayOES(I)}function m(I){return n.isWebGL2?r.deleteVertexArray(I):s.deleteVertexArrayOES(I)}function _(I,F,V){const J=V.wireframe===!0;let Y=o[I.id];Y===void 0&&(Y={},o[I.id]=Y);let W=Y[F.id];W===void 0&&(W={},Y[F.id]=W);let ee=W[J];return ee===void 0&&(ee=g(d()),W[J]=ee),ee}function g(I){const F=[],V=[],J=[];for(let Y=0;Y<i;Y++)F[Y]=0,V[Y]=0,J[Y]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:V,attributeDivisors:J,object:I,attributes:{},index:null}}function p(I,F,V,J){const Y=c.attributes,W=F.attributes;let ee=0;const te=V.getAttributes();for(const ue in te)if(te[ue].location>=0){const K=Y[ue];let de=W[ue];if(de===void 0&&(ue==="instanceMatrix"&&I.instanceMatrix&&(de=I.instanceMatrix),ue==="instanceColor"&&I.instanceColor&&(de=I.instanceColor)),K===void 0||K.attribute!==de||de&&K.data!==de.data)return!0;ee++}return c.attributesNum!==ee||c.index!==J}function v(I,F,V,J){const Y={},W=F.attributes;let ee=0;const te=V.getAttributes();for(const ue in te)if(te[ue].location>=0){let K=W[ue];K===void 0&&(ue==="instanceMatrix"&&I.instanceMatrix&&(K=I.instanceMatrix),ue==="instanceColor"&&I.instanceColor&&(K=I.instanceColor));const de={};de.attribute=K,K&&K.data&&(de.data=K.data),Y[ue]=de,ee++}c.attributes=Y,c.attributesNum=ee,c.index=J}function x(){const I=c.newAttributes;for(let F=0,V=I.length;F<V;F++)I[F]=0}function y(I){R(I,0)}function R(I,F){const V=c.newAttributes,J=c.enabledAttributes,Y=c.attributeDivisors;V[I]=1,J[I]===0&&(r.enableVertexAttribArray(I),J[I]=1),Y[I]!==F&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](I,F),Y[I]=F)}function T(){const I=c.newAttributes,F=c.enabledAttributes;for(let V=0,J=F.length;V<J;V++)F[V]!==I[V]&&(r.disableVertexAttribArray(V),F[V]=0)}function C(I,F,V,J,Y,W,ee){ee===!0?r.vertexAttribIPointer(I,F,V,Y,W):r.vertexAttribPointer(I,F,V,J,Y,W)}function U(I,F,V,J){if(n.isWebGL2===!1&&(I.isInstancedMesh||J.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;x();const Y=J.attributes,W=V.getAttributes(),ee=F.defaultAttributeValues;for(const te in W){const ue=W[te];if(ue.location>=0){let H=Y[te];if(H===void 0&&(te==="instanceMatrix"&&I.instanceMatrix&&(H=I.instanceMatrix),te==="instanceColor"&&I.instanceColor&&(H=I.instanceColor)),H!==void 0){const K=H.normalized,de=H.itemSize,Me=t.get(H);if(Me===void 0)continue;
vendor: 16,334 bytes, lines 3477-3552
3477const ge=Me.buffer,Pe=Me.type,Ne=Me.bytesPerElement,Se=n.isWebGL2===!0&&(Pe===r.INT||Pe===r.UNSIGNED_INT||H.gpuType===yl);if(H.isInterleavedBufferAttribute){const Ue=H.data,P=Ue.stride,re=H.offset;if(Ue.isInstancedInterleavedBuffer){for(let q=0;q<ue.locationSize;q++)R(ue.location+q,Ue.meshPerAttribute);I.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=Ue.meshPerAttribute*Ue.count)}else for(let q=0;q<ue.locationSize;q++)y(ue.location+q);r.bindBuffer(r.ARRAY_BUFFER,ge);for(let q=0;q<ue.locationSize;q++)C(ue.location+q,de/ue.locationSize,Pe,K,P*Ne,(re+de/ue.locationSize*q)*Ne,Se)}else{if(H.isInstancedBufferAttribute){for(let Ue=0;Ue<ue.locationSize;Ue++)R(ue.location+Ue,H.meshPerAttribute);I.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=H.meshPerAttribute*H.count)}else for(let Ue=0;Ue<ue.locationSize;Ue++)y(ue.location+Ue);r.bindBuffer(r.ARRAY_BUFFER,ge);for(let Ue=0;Ue<ue.locationSize;Ue++)C(ue.location+Ue,de/ue.locationSize,Pe,K,de*Ne,de/ue.locationSize*Ue*Ne,Se)}}else if(ee!==void 0){const K=ee[te];if(K!==void 0)switch(K.length){case 2:r.vertexAttrib2fv(ue.location,K);break;case 3:r.vertexAttrib3fv(ue.location,K);break;case 4:r.vertexAttrib4fv(ue.location,K);break;default:r.vertexAttrib1fv(ue.location,K)}}}}T()}function S(){G();for(const I in o){const F=o[I];for(const V in F){const J=F[V];for(const Y in J)m(J[Y].object),delete J[Y];delete F[V]}delete o[I]}}function E(I){if(o[I.id]===void 0)return;const F=o[I.id];for(const V in F){const J=F[V];for(const Y in J)m(J[Y].object),delete J[Y];delete F[V]}delete o[I.id]}function N(I){for(const F in o){const V=o[F];if(V[I.id]===void 0)continue;const J=V[I.id];for(const Y in J)m(J[Y].object),delete J[Y];delete V[I.id]}}function G(){ie(),h=!0,c!==l&&(c=l,f(c.object))}function ie(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:u,reset:G,resetDefaultState:ie,dispose:S,releaseStatesOfGeometry:E,releaseStatesOfProgram:N,initAttributes:x,enableAttribute:y,disableUnusedAttributes:T}}function g_(r,e,t,n){const i=n.isWebGL2;let s;function a(h){s=h}function o(h,u){r.drawArrays(s,h,u),t.update(u,s,1)}function l(h,u,d){if(d===0)return;let f,m;if(i)f=r,m="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),m="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[m](s,h,u,d),t.update(u,s,d)}function c(h,u,d){if(d===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let m=0;m<d;m++)this.render(h[m],u[m]);else{f.multiDrawArraysWEBGL(s,h,0,u,0,d);let m=0;for(let _=0;_<d;_++)m+=u[_];t.update(m,s,1)}}this.setMode=a,this.render=o,this.renderInstances=l,this.renderMultiDraw=c}function __(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(C){if(C==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext";let o=t.precision!==void 0?t.precision:"highp";const l=s(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=a||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,u=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),d=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),f=r.getParameter(r.MAX_TEXTURE_SIZE),m=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),_=r.getParameter(r.MAX_VERTEX_ATTRIBS),g=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),p=r.getParameter(r.MAX_VARYING_VECTORS),v=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),x=d>0,y=a||e.has("OES_texture_float"),R=x&&y,T=a?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:d,maxTextureSize:f,maxCubemapSize:m,maxAttributes:_,maxVertexUniforms:g,maxVaryings:p,maxFragmentUniforms:v,vertexTextures:x,floatFragmentTextures:y,floatVertexTextures:R,maxSamples:T}}function x_(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new zn,o=new He,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,f){const m=u.clippingPlanes,_=u.clipIntersection,g=u.clipShadows,p=r.get(u);if(!i||m===null||m.length===0||s&&!g)s?h(null):c();else{const v=s?0:n,x=v*4;let y=p.clippingState||null;l.value=y,y=h(m,d,x,f);for(let R=0;R!==x;++R)y[R]=t[R];p.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,m){const _=u!==null?u.length:0;let g=null;if(_!==0){if(g=l.value,m!==!0||g===null){const p=f+_*4,v=d.matrixWorldInverse;o.getNormalMatrix(v),(g===null||g.length<p)&&(g=new Float32Array(p));for(let x=0,y=f;x!==_;++x,y+=4)a.copy(u[x]).applyMatrix4(v,o),a.normal.toArray(g,y),g[y+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,g}}function v_(r){let e=new WeakMap;function t(a,o){return o===Cs?a.mapping=Rn:o===Rs&&(a.mapping=Wn),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Cs||o===Rs)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new Zu(l.height/2);return c.fromEquirectangularTexture(r,a),e.set(a,c),a.addEventListener("dispose",i),t(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class va extends xa{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(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 Zi=4,wc=[.125,.215,.35,.446,.526,.582],ui=20,lo=new va,Cc=new pe;let co=null,ho=0,uo=0;const hi=(1+Math.sqrt(5))/2,ki=1/hi,Rc=[new w(1,1,1),new w(-1,1,1),new w(1,1,-1),new w(-1,1,-1),new w(0,hi,ki),new w(0,hi,-ki),new w(ki,0,hi),new w(-ki,0,hi),new w(hi,ki,0),new w(-hi,ki,0)];class hl{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){co=this._renderer.getRenderTarget(),ho=this._renderer.getActiveCubeFace(),uo=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=Ic(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Lc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(co,ho,uo),e.scissorTest=!1,wr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Rn||e.mapping===Wn?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),co=this._renderer.getRenderTarget(),ho=this._renderer.getActiveCubeFace(),uo=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:pt,minFilter:pt,generateMipmaps:!1,type:ji,format:Vt,colorSpace:dn,depthBuffer:!1},i=Pc(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Pc(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=y_(s)),this._blurMaterial=M_(s,e,t)}return i}_compileMaterial(e){const t=new xt(this._lodPlanes[0],e);this._renderer.compile(t,lo)}_sceneToCubeUV(e,t,n,i){const o=new Et(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,u=h.autoClear,d=h.toneMapping;h.getClearColor(Cc),h.toneMapping=Tn,h.autoClear=!1;const f=new Zn({name:"PMREM.Background",side:Ot,depthWrite:!1,depthTest:!1}),m=new xt(new bi,f);let _=!1;const g=e.background;g?g.isColor&&(f.color.copy(g),e.background=null,_=!0):(f.color.copy(Cc),_=!0);for(let p=0;p<6;p++){const v=p%3;v===0?(o.up.set(0,l[p],0),o.lookAt(c[p],0,0)):v===1?(o.up.set(0,0,l[p]),o.lookAt(0,c[p],0)):(o.up.set(0,l[p],0),o.lookAt(0,0,c[p]));const x=this._cubeSize;wr(i,v*x,p>2?x:0,x,x),h.setRenderTarget(i),_&&h.render(m,o),h.render(e,o)}m.geometry.dispose(),m.material.dispose(),h.toneMapping=d,h.autoClear=u,e.background=g}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Rn||e.mapping===Wn;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ic()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Lc());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new xt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;wr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,lo)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const s=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),a=Rc[(i-1)%Rc.length];this._blur(e,i-1,i,s,a)}t.autoClear=n}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new xt(this._lodPlanes[i],c),d=c.uniforms,f=this._sizeLods[n]-1,m=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*ui-1),_=s/m,g=isFinite(s)?1+Math.floor(h*_):ui;g>ui&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${ui}`);const p=[];let v=0;for(let C=0;C<ui;++C){const U=C/_,S=Math.exp(-U*U/2);p.push(S),C===0?v+=S:C<g&&(v+=2*S)}for(let C=0;C<p.length;C++)p[C]=p[C]/v;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:x}=this;d.dTheta.value=m,d.mipInt.value=x-n;const y=this._sizeLods[i],R=3*y*(i>x-Zi?i-x+Zi:0),T=4*(this._cubeSize-y);wr(t,R,T,3*y,2*y),l.setRenderTarget(t),l.render(u,lo)}}function y_(r){const e=[],t=[],n=[];let i=r;const s=r-Zi+1+wc.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);t.push(o);let l=1/o;a>r-Zi?l=wc[a-r+Zi-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,m=6,_=3,g=2,p=1,v=new Float32Array(_*m*f),x=new Float32Array(g*m*f),y=new Float32Array(p*m*f);for(let T=0;T<f;T++){const C=T%3*2/3-1,U=T>2?0:-1,S=[C,U,0,C+2/3,U,0,C+2/3,U+1,0,C,U,0,C+2/3,U+1,0,C,U+1,0];v.set(S,_*m*T),x.set(d,g*m*T);const E=[T,T,T,T,T,T];y.set(E,p*m*T)}const R=new Ge;R.setAttribute("position",new et(v,_)),R.setAttribute("uv",new et(x,g)),R.setAttribute("faceIndex",new et(y,p)),e.push(R),i>Zi&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Pc(r,e,t){const n=new rn(r,e,t);return n.texture.mapping=ss,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function wr(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function M_(r,e,t){const n=new Float32Array(ui),i=new w(0,1,0);return new fn({name:"SphericalGaussianBlur",defines:{n:ui,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:Nl(),fragmentShader:`
3478
3479			precision mediump float;
3480			precision mediump int;
3481
3482			varying vec3 vOutputDirection;
3483
3484			uniform sampler2D envMap;
3485			uniform int samples;
3486			uniform float weights[ n ];
3487			uniform bool latitudinal;
3488			uniform float dTheta;
3489			uniform float mipInt;
3490			uniform vec3 poleAxis;
3491
3492			#define ENVMAP_TYPE_CUBE_UV
3493			#include <cube_uv_reflection_fragment>
3494
3495			vec3 getSample( float theta, vec3 axis ) {
3496
3497				float cosTheta = cos( theta );
3498				// Rodrigues' axis-angle rotation
3499				vec3 sampleDirection = vOutputDirection * cosTheta
3500					+ cross( axis, vOutputDirection ) * sin( theta )
3501					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3502
3503				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3504
3505			}
3506
3507			void main() {
3508
3509				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3510
3511				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3512
3513					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3514
3515				}
3516
3517				axis = normalize( axis );
3518
3519				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3520				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3521
3522				for ( int i = 1; i < n; i++ ) {
3523
3524					if ( i >= samples ) {
3525
3526						break;
3527
3528					}
3529
3530					float theta = dTheta * float( i );
3531					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3532					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3533
3534				}
3535
3536			}
3537		`,blending:An,depthTest:!1,depthWrite:!1})}function Lc(){return new fn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Nl(),fragmentShader:`
3538
3539			precision mediump float;
3540			precision mediump int;
3541
3542			varying vec3 vOutputDirection;
3543
3544			uniform sampler2D envMap;
3545
3546			#include <common>
3547
3548			void main() {
3549
3550				vec3 outputDirection = normalize( vOutputDirection );
3551				vec2 uv = equirectUv( outputDirection );
3552
3553				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3554
3555			}
3556		`,blending:An,depthTest:!1,depthWrite:!1})}function Ic(){return new fn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Nl(),fragmentShader:`
3557
3558			precision mediump float;
3559			precision mediump int;
3560
3561			uniform float flipEnvMap;
3562
3563			varying vec3 vOutputDirection;
3564
3565			uniform samplerCube envMap;
3566
3567			void main() {
3568
3569				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3570
3571			}
3572		`,blending:An,depthTest:!1,depthWrite:!1})}function Nl(){return`
3573
3574		precision mediump float;
3575		precision mediump int;
3576
3577		attribute float faceIndex;
3578
3579		varying vec3 vOutputDirection;
3580
3581		// RH coordinate system; PMREM face-indexing convention
3582		vec3 getDirection( vec2 uv, float face ) {
3583
3584			uv = 2.0 * uv - 1.0;
3585
3586			vec3 direction = vec3( uv, 1.0 );
3587
3588			if ( face == 0.0 ) {
3589
3590				direction = direction.zyx; // ( 1, v, u ) pos x
3591
3592			} else if ( face == 1.0 ) {
3593
3594				direction = direction.xzy;
3595				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3596
3597			} else if ( face == 2.0 ) {
3598
3599				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3600
3601			} else if ( face == 3.0 ) {
3602
3603				direction = direction.zyx;
3604				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3605
3606			} else if ( face == 4.0 ) {
3607
3608				direction = direction.xzy;
3609				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3610
3611			} else if ( face == 5.0 ) {
3612
3613				direction.z *= -1.0; // ( u, v, -1 ) neg z
3614
3615			}
3616
3617			return direction;
3618
3619		}
3620
3621		void main() {
3622
3623			vOutputDirection = getDirection( uv, faceIndex );
3624			gl_Position = vec4( position, 1.0 );
3625
3626		}
3627	`}function S_(r){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Cs||l===Rs,h=l===Rn||l===Wn;if(c||h)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let u=e.get(o);return t===null&&(t=new hl(r)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),e.set(o,u),u.texture}else{if(e.has(o))return e.get(o).texture;{const u=o.image;if(c&&u&&u.height>0||h&&u&&i(u)){t===null&&(t=new hl(r));const d=c?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,d),o.addEventListener("dispose",s),d.texture}else return null}}}return o}function i(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function b_(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function E_(r,e,t,n){const i={},s=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const m in d.attributes)e.remove(d.attributes[m]);for(const m in d.morphAttributes){const _=d.morphAttributes[m];for(let g=0,p=_.length;g<p;g++)e.remove(_[g])}d.removeEventListener("dispose",a),delete i[d.id];const f=s.get(d);
vendor: 5,247 bytes, line 3627
3627f&&(e.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function l(u){const d=u.attributes;for(const m in d)e.update(d[m],r.ARRAY_BUFFER);const f=u.morphAttributes;for(const m in f){const _=f[m];for(let g=0,p=_.length;g<p;g++)e.update(_[g],r.ARRAY_BUFFER)}}function c(u){const d=[],f=u.index,m=u.attributes.position;let _=0;if(f!==null){const v=f.array;_=f.version;for(let x=0,y=v.length;x<y;x+=3){const R=v[x+0],T=v[x+1],C=v[x+2];d.push(R,T,T,C,C,R)}}else if(m!==void 0){const v=m.array;_=m.version;for(let x=0,y=v.length/3-1;x<y;x+=3){const R=x+0,T=x+1,C=x+2;d.push(R,T,T,C,C,R)}}else return;const g=new(Vu(d)?Dl:Ul)(d,1);g.version=_;const p=s.get(u);p&&e.remove(p),s.set(u,g)}function h(u){const d=s.get(u);if(d){const f=u.index;f!==null&&d.version<f.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function A_(r,e,t,n){const i=n.isWebGL2;let s;function a(f){s=f}let o,l;function c(f){o=f.type,l=f.bytesPerElement}function h(f,m){r.drawElements(s,m,o,f*l),t.update(m,s,1)}function u(f,m,_){if(_===0)return;let g,p;if(i)g=r,p="drawElementsInstanced";else if(g=e.get("ANGLE_instanced_arrays"),p="drawElementsInstancedANGLE",g===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}g[p](s,m,o,f*l,_),t.update(m,s,_)}function d(f,m,_){if(_===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let p=0;p<_;p++)this.render(f[p]/l,m[p]);else{g.multiDrawElementsWEBGL(s,m,0,o,f,0,_);let p=0;for(let v=0;v<_;v++)p+=m[v];t.update(p,s,1)}}this.setMode=a,this.setIndex=c,this.render=h,this.renderInstances=u,this.renderMultiDraw=d}function T_(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function w_(r,e){return r[0]-e[0]}function C_(r,e){return Math.abs(e[1])-Math.abs(r[1])}function R_(r,e,t){const n={},i=new Float32Array(8),s=new WeakMap,a=new je,o=[];for(let c=0;c<8;c++)o[c]=[c,0];function l(c,h,u){const d=c.morphTargetInfluences;if(e.isWebGL2===!0){const f=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,m=f!==void 0?f.length:0;let _=s.get(h);if(_===void 0||_.count!==m){let I=function(){G.dispose(),s.delete(h),h.removeEventListener("dispose",I)};_!==void 0&&_.texture.dispose();const v=h.morphAttributes.position!==void 0,x=h.morphAttributes.normal!==void 0,y=h.morphAttributes.color!==void 0,R=h.morphAttributes.position||[],T=h.morphAttributes.normal||[],C=h.morphAttributes.color||[];let U=0;v===!0&&(U=1),x===!0&&(U=2),y===!0&&(U=3);let S=h.attributes.position.count*U,E=1;S>e.maxTextureSize&&(E=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const N=new Float32Array(S*E*4*m),G=new ga(N,S,E,m);G.type=nn,G.needsUpdate=!0;const ie=U*4;for(let F=0;F<m;F++){const V=R[F],J=T[F],Y=C[F],W=S*E*4*F;for(let ee=0;ee<V.count;ee++){const te=ee*ie;v===!0&&(a.fromBufferAttribute(V,ee),N[W+te+0]=a.x,N[W+te+1]=a.y,N[W+te+2]=a.z,N[W+te+3]=0),x===!0&&(a.fromBufferAttribute(J,ee),N[W+te+4]=a.x,N[W+te+5]=a.y,N[W+te+6]=a.z,N[W+te+7]=0),y===!0&&(a.fromBufferAttribute(Y,ee),N[W+te+8]=a.x,N[W+te+9]=a.y,N[W+te+10]=a.z,N[W+te+11]=Y.itemSize===4?a.w:1)}}_={count:m,texture:G,size:new Z(S,E)},s.set(h,_),h.addEventListener("dispose",I)}let g=0;for(let v=0;v<d.length;v++)g+=d[v];const p=h.morphTargetsRelative?1:1-g;u.getUniforms().setValue(r,"morphTargetBaseInfluence",p),u.getUniforms().setValue(r,"morphTargetInfluences",d),u.getUniforms().setValue(r,"morphTargetsTexture",_.texture,t),u.getUniforms().setValue(r,"morphTargetsTextureSize",_.size)}else{const f=d===void 0?0:d.length;let m=n[h.id];if(m===void 0||m.length!==f){m=[];for(let x=0;x<f;x++)m[x]=[x,0];n[h.id]=m}for(let x=0;x<f;x++){const y=m[x];y[0]=x,y[1]=d[x]}m.sort(C_);for(let x=0;x<8;x++)x<f&&m[x][1]?(o[x][0]=m[x][0],o[x][1]=m[x][1]):(o[x][0]=Number.MAX_SAFE_INTEGER,o[x][1]=0);o.sort(w_);const _=h.morphAttributes.position,g=h.morphAttributes.normal;let p=0;for(let x=0;x<8;x++){const y=o[x],R=y[0],T=y[1];R!==Number.MAX_SAFE_INTEGER&&T?(_&&h.getAttribute("morphTarget"+x)!==_[R]&&h.setAttribute("morphTarget"+x,_[R]),g&&h.getAttribute("morphNormal"+x)!==g[R]&&h.setAttribute("morphNormal"+x,g[R]),i[x]=T,p+=T):(_&&h.hasAttribute("morphTarget"+x)===!0&&h.deleteAttribute("morphTarget"+x),g&&h.hasAttribute("morphNormal"+x)===!0&&h.deleteAttribute("morphNormal"+x),i[x]=0)}const v=h.morphTargetsRelative?1:1-p;u.getUniforms().setValue(r,"morphTargetBaseInfluence",v),u.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:l}}function P_(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=e.get(l,h);
vendor: 16,298 bytes, lines 3627-3645
3627if(i.get(u)!==c&&(e.update(u),i.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;i.get(d)!==c&&(d.update(),i.set(d,c))}return u}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}class Ol extends mt{constructor(e,t,n,i,s,a,o,l,c,h){if(h=h!==void 0?h:Hn,h!==Hn&&h!==yi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===Hn&&(n=bn),n===void 0&&h===yi&&(n=Vn),super(null,i,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:ft,this.minFilter=l!==void 0?l:ft,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const $u=new mt,Ku=new Ol(1,1);Ku.compareFunction=Rl;const Qu=new ga,ju=new Il,ed=new Ks,Uc=[],Dc=[],Nc=new Float32Array(16),Oc=new Float32Array(9),Fc=new Float32Array(4);function as(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=Uc[i];if(s===void 0&&(s=new Float32Array(i),Uc[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function vt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function yt(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function ya(r,e){let t=Dc[e];t===void 0&&(t=new Int32Array(e),Dc[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function L_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function I_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(vt(t,e))return;r.uniform2fv(this.addr,e),yt(t,e)}}function U_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(vt(t,e))return;r.uniform3fv(this.addr,e),yt(t,e)}}function D_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(vt(t,e))return;r.uniform4fv(this.addr,e),yt(t,e)}}function N_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(vt(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),yt(t,e)}else{if(vt(t,n))return;Fc.set(n),r.uniformMatrix2fv(this.addr,!1,Fc),yt(t,n)}}function O_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(vt(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),yt(t,e)}else{if(vt(t,n))return;Oc.set(n),r.uniformMatrix3fv(this.addr,!1,Oc),yt(t,n)}}function F_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(vt(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),yt(t,e)}else{if(vt(t,n))return;Nc.set(n),r.uniformMatrix4fv(this.addr,!1,Nc),yt(t,n)}}function B_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function z_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(vt(t,e))return;r.uniform2iv(this.addr,e),yt(t,e)}}function k_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(vt(t,e))return;r.uniform3iv(this.addr,e),yt(t,e)}}function V_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(vt(t,e))return;r.uniform4iv(this.addr,e),yt(t,e)}}function H_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function G_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(vt(t,e))return;r.uniform2uiv(this.addr,e),yt(t,e)}}function W_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(vt(t,e))return;r.uniform3uiv(this.addr,e),yt(t,e)}}function X_(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(vt(t,e))return;r.uniform4uiv(this.addr,e),yt(t,e)}}function q_(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);const s=this.type===r.SAMPLER_2D_SHADOW?Ku:$u;t.setTexture2D(e||s,i)}function Y_(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||ju,i)}function Z_(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||ed,i)}function J_(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Qu,i)}function $_(r){switch(r){case 5126:return L_;case 35664:return I_;case 35665:return U_;case 35666:return D_;case 35674:return N_;case 35675:return O_;case 35676:return F_;case 5124:case 35670:return B_;case 35667:case 35671:return z_;case 35668:case 35672:return k_;case 35669:case 35673:return V_;case 5125:return H_;case 36294:return G_;case 36295:return W_;case 36296:return X_;case 35678:case 36198:case 36298:case 36306:case 35682:return q_;case 35679:case 36299:case 36307:return Y_;case 35680:case 36300:case 36308:case 36293:return Z_;case 36289:case 36303:case 36311:case 36292:return J_}}function K_(r,e){r.uniform1fv(this.addr,e)}function Q_(r,e){const t=as(e,this.size,2);r.uniform2fv(this.addr,t)}function j_(r,e){const t=as(e,this.size,3);r.uniform3fv(this.addr,t)}function e0(r,e){const t=as(e,this.size,4);r.uniform4fv(this.addr,t)}function t0(r,e){const t=as(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function n0(r,e){const t=as(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function i0(r,e){const t=as(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function s0(r,e){r.uniform1iv(this.addr,e)}function r0(r,e){r.uniform2iv(this.addr,e)}function a0(r,e){r.uniform3iv(this.addr,e)}function o0(r,e){r.uniform4iv(this.addr,e)}function l0(r,e){r.uniform1uiv(this.addr,e)}function c0(r,e){r.uniform2uiv(this.addr,e)}function h0(r,e){r.uniform3uiv(this.addr,e)}function u0(r,e){r.uniform4uiv(this.addr,e)}function d0(r,e,t){const n=this.cache,i=e.length,s=ya(t,i);vt(n,s)||(r.uniform1iv(this.addr,s),yt(n,s));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||$u,s[a])}function f0(r,e,t){const n=this.cache,i=e.length,s=ya(t,i);vt(n,s)||(r.uniform1iv(this.addr,s),yt(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||ju,s[a])}function p0(r,e,t){const n=this.cache,i=e.length,s=ya(t,i);vt(n,s)||(r.uniform1iv(this.addr,s),yt(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||ed,s[a])}function m0(r,e,t){const n=this.cache,i=e.length,s=ya(t,i);vt(n,s)||(r.uniform1iv(this.addr,s),yt(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Qu,s[a])}function g0(r){switch(r){case 5126:return K_;case 35664:return Q_;case 35665:return j_;case 35666:return e0;case 35674:return t0;case 35675:return n0;case 35676:return i0;case 5124:case 35670:return s0;case 35667:case 35671:return r0;case 35668:case 35672:return a0;case 35669:case 35673:return o0;case 5125:return l0;case 36294:return c0;case 36295:return h0;case 36296:return u0;case 35678:case 36198:case 36298:case 36306:case 35682:return d0;case 35679:case 36299:case 36307:return f0;case 35680:case 36300:case 36308:case 36293:return p0;case 36289:case 36303:case 36311:case 36292:return m0}}class _0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=$_(t.type)}}class x0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=g0(t.type)}}class v0{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const fo=/(\w+)(\])?(\[|\.)?/g;function Bc(r,e){r.seq.push(e),r.map[e.id]=e}function y0(r,e,t){const n=r.name,i=n.length;for(fo.lastIndex=0;;){const s=fo.exec(n),a=fo.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){Bc(t,c===void 0?new _0(o,r,e):new x0(o,r,e));break}else{let u=t.map[o];u===void 0&&(u=new v0(o),Bc(t,u)),t=u}}}class sa{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),a=e.getUniformLocation(t,s.name);y0(s,a,this)}}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function zc(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const M0=37297;let S0=0;function b0(r,e){const t=r.split(`
3628`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
3629`)}function E0(r){const e=Qe.getPrimaries(Qe.workingColorSpace),t=Qe.getPrimaries(r);let n;switch(e===t?n="":e===Fs&&t===Os?n="LinearDisplayP3ToLinearSRGB":e===Os&&t===Fs&&(n="LinearSRGBToLinearDisplayP3"),r){case dn:case Js:return[n,"LinearTransferOETF"];case _t:case ma:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function kc(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
3630
3631`+i+`
3632
3633`+b0(r.getShaderSource(e),a)}else return i}function A0(r,e){const t=E0(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function T0(r,e){let t;switch(e){case fu:t="Linear";break;case pu:t="Reinhard";break;case mu:t="OptimizedCineon";break;case gu:t="ACESFilmic";break;case xu:t="AgX";break;case _u:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function w0(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(Ji).join(`
3634`)}function C0(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":""].filter(Ji).join(`
3635`)}function R0(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3636`)}function P0(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function Ji(r){return r!==""}function Vc(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Hc(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const L0=/^[ \t]*#include +<([\w\d./]+)>/gm;function ul(r){return r.replace(L0,U0)}const I0=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function U0(r,e){let t=ze[e];if(t===void 0){const n=I0.get(e);if(n!==void 0)t=ze[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 ul(t)}const D0=/#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 Gc(r){return r.replace(D0,N0)}function N0(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Wc(r){let e="precision "+r.precision+` float;
3637precision `+r.precision+" int;";return r.precision==="highp"?e+=`
3638#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
3639#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
3640#define LOW_PRECISION`),e}function O0(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===xl?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===Vh?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===cn&&(e="SHADOWMAP_TYPE_VSM"),e}function F0(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Rn:case Wn:e="ENVMAP_TYPE_CUBE";break;case ss:e="ENVMAP_TYPE_CUBE_UV";break}return e}function B0(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Wn:e="ENVMAP_MODE_REFRACTION";break}return e}function z0(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case Zs:e="ENVMAP_BLENDING_MULTIPLY";break;case uu:e="ENVMAP_BLENDING_MIX";break;case du:e="ENVMAP_BLENDING_ADD";break}return e}function k0(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function V0(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=O0(t),c=F0(t),h=B0(t),u=z0(t),d=k0(t),f=t.isWebGL2?"":w0(t),m=C0(t),_=R0(s),g=i.createProgram();let p,v,x=t.glslVersion?"#version "+t.glslVersion+`
3641`:"";t.isRawShaderMaterial?(p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Ji).join(`
3642`),p.length>0&&(p+=`
3643`),v=[f,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Ji).join(`
3644`),v.length>0&&(v+=`
3645`)):(p=[Wc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",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_IR
3645IDESCENCEMAP":"",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",`
3646`].filter(Ji).join(`
3647`),v=[f,Wc(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 "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.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_IR
3647IDESCENCE":"",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!==Tn?"#define TONE_MAPPING":"",t.toneMapping!==Tn?ze.tonemapping_pars_fragment:"",t.toneMapping!==Tn?T0("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ze.colorspace_pars_fragment,A0("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3648`].filter(Ji).join(`
3649`)),a=ul(a),a=Vc(a,t),a=Hc(a,t),o=ul(o),o=Vc(o,t),o=Hc(o,t),a=Gc(a),o=Gc(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(x=`#version 300 es
3650`,p=[m,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
3651`)+`
3652`+p,v=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===ll?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ll?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3653`)+`
3654`+v);const y=x+p+a,R=x+v+o,T=zc(i,i.VERTEX_SHADER,y),C=zc(i,i.FRAGMENT_SHADER,R);i.attachShader(g,T),i.attachShader(g,C),t.index0AttributeName!==void 0?i.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(g,0,"position"),i.linkProgram(g);function U(G){if(r.debug.checkShaderErrors){const ie=i.getProgramInfoLog(g).trim(),I=i.getShaderInfoLog(T).trim(),F=i.getShaderInfoLog(C).trim();let V=!0,J=!0;if(i.getProgramParameter(g,i.LINK_STATUS)===!1)if(V=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,g,T,C);else{const Y=kc(i,T,"vertex"),W=kc(i,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(g,i.VALIDATE_STATUS)+`
3655
3656Program Info Log: `+ie+`
3657`+Y+`
3658`+W)}else ie!==""?console.warn("THREE.WebGLProgram: Program Info Log:",ie):(I===""||F==="")&&(J=!1);J&&(G.diagnostics={runnable:V,programLog:ie,vertexShader:{log:I,prefix:p},fragmentShader:{log:F,prefix:v}})}i.deleteShader(T),i.deleteShader(C),S=new sa(i,g),E=P0(i,g)}let S;this.getUniforms=function(){return S===void 0&&U(this),S};let E;this.getAttributes=function(){return E===void 0&&U(this),E};let N=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return N===!1&&(N=i.getProgramParameter(g,M0)),N},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=S0++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=T,this.fragmentShader=C,this}let H0=0;class G0{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new W0(e),t.set(e,n)),n}}class W0{constructor(e){this.id=H0++,this.code=e,this.usedTimes=0}}function X0(r,e,t,n,i,s,a){const o=new _a,l=new G0,c=[],h=i.isWebG
vendor: 6,237 bytes, line 3658
3658L2,u=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(S){return S===0?"uv":`uv${S}`}function g(S,E,N,G,ie){const I=G.fog,F=ie.geometry,V=S.isMeshStandardMaterial?G.environment:null,J=(S.isMeshStandardMaterial?t:e).get(S.envMap||V),Y=J&&J.mapping===ss?J.image.height:null,W=m[S.type];S.precision!==null&&(f=i.getMaxPrecision(S.precision),f!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",f,"instead."));const ee=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,te=ee!==void 0?ee.length:0;let ue=0;F.morphAttributes.position!==void 0&&(ue=1),F.morphAttributes.normal!==void 0&&(ue=2),F.morphAttributes.color!==void 0&&(ue=3);let H,K,de,Me;if(W){const It=tn[W];H=It.vertexShader,K=It.fragmentShader}else H=S.vertexShader,K=S.fragmentShader,l.update(S),de=l.getVertexShaderID(S),Me=l.getFragmentShaderID(S);const ge=r.getRenderTarget(),Pe=ie.isInstancedMesh===!0,Ne=ie.isBatchedMesh===!0,Se=!!S.map,Ue=!!S.matcap,P=!!J,re=!!S.aoMap,q=!!S.lightMap,se=!!S.bumpMap,X=!!S.normalMap,Ee=!!S.displacementMap,fe=!!S.emissiveMap,b=!!S.metalnessMap,M=!!S.roughnessMap,O=S.anisotropy>0,ne=S.clearcoat>0,Q=S.iridescence>0,$=S.sheen>0,ye=S.transmission>0,le=O&&!!S.anisotropyMap,_e=ne&&!!S.clearcoatMap,Te=ne&&!!S.clearcoatNormalMap,Fe=ne&&!!S.clearcoatRoughnessMap,j=Q&&!!S.iridescenceMap,$e=Q&&!!S.iridescenceThicknessMap,Ye=$&&!!S.sheenColorMap,De=$&&!!S.sheenRoughnessMap,Ae=!!S.specularMap,xe=!!S.specularColorMap,Ve=!!S.specularIntensityMap,Ke=ye&&!!S.transmissionMap,ot=ye&&!!S.thicknessMap,Xe=!!S.gradientMap,oe=!!S.alphaMap,L=S.alphaTest>0,ce=!!S.alphaHash,he=!!S.extensions,Le=!!F.attributes.uv1,we=!!F.attributes.uv2,tt=!!F.attributes.uv3;let nt=Tn;return S.toneMapped&&(ge===null||ge.isXRRenderTarget===!0)&&(nt=r.toneMapping),{isWebGL2:h,shaderID:W,shaderType:S.type,shaderName:S.name,vertexShader:H,fragmentShader:K,defines:S.defines,customVertexShaderID:de,customFragmentShaderID:Me,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:f,batching:Ne,instancing:Pe,instancingColor:Pe&&ie.instanceColor!==null,supportsVertexTextures:d,outputColorSpace:ge===null?r.outputColorSpace:ge.isXRRenderTarget===!0?ge.texture.colorSpace:dn,map:Se,matcap:Ue,envMap:P,envMapMode:P&&J.mapping,envMapCubeUVHeight:Y,aoMap:re,lightMap:q,bumpMap:se,normalMap:X,displacementMap:d&&Ee,emissiveMap:fe,normalMapObjectSpace:X&&S.normalMapType===Uu,normalMapTangentSpace:X&&S.normalMapType===Yn,metalnessMap:b,roughnessMap:M,anisotropy:O,anisotropyMap:le,clearcoat:ne,clearcoatMap:_e,clearcoatNormalMap:Te,clearcoatRoughnessMap:Fe,iridescence:Q,iridescenceMap:j,iridescenceThicknessMap:$e,sheen:$,sheenColorMap:Ye,sheenRoughnessMap:De,specularMap:Ae,specularColorMap:xe,specularIntensityMap:Ve,transmission:ye,transmissionMap:Ke,thicknessMap:ot,gradientMap:Xe,opaque:S.transparent===!1&&S.blending===gi,alphaMap:oe,alphaTest:L,alphaHash:ce,combine:S.combine,mapUv:Se&&_(S.map.channel),aoMapUv:re&&_(S.aoMap.channel),lightMapUv:q&&_(S.lightMap.channel),bumpMapUv:se&&_(S.bumpMap.channel),normalMapUv:X&&_(S.normalMap.channel),displacementMapUv:Ee&&_(S.displacementMap.channel),emissiveMapUv:fe&&_(S.emissiveMap.channel),metalnessMapUv:b&&_(S.metalnessMap.channel),roughnessMapUv:M&&_(S.roughnessMap.channel),anisotropyMapUv:le&&_(S.anisotropyMap.channel),clearcoatMapUv:_e&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Fe&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:j&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:$e&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:Ye&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:De&&_(S.sheenRoughnessMap.channel),specularMapUv:Ae&&_(S.specularMap.channel),specularColorMapUv:xe&&_(S.specularColorMap.channel),specularIntensityMapUv:Ve&&_(S.specularIntensityMap.channel),transmissionMapUv:Ke&&_(S.transmissionMap.channel),thicknessMapUv:ot&&_(S.thicknessMap.channel),alphaMapUv:oe&&_(S.alphaMap.channel),vertexTangents:!!F.attributes.tangent&&(X||O),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,vertexUv1s:Le,vertexUv2s:we,vertexUv3s:tt,pointsUvs:ie.isPoints===!0&&!!F.attributes.uv&&(Se||oe),fog:!!I,useFog:S.fog===!0,fogExp2:I&&I.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:ie.isSkinnedMesh===!0,morphTargets:F.morphAttributes.position!==void 0,morphNormals:F.morphAttributes.normal!==void 0,morphColors:F.morphAttributes.color!==void 0,morphTargetsCount:te,morphTextureStride:ue,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:r.shadowMap.enabled&&N.length>0,shadowMapType:r.shadowMap.type,toneMapping:nt,useLegacyLights:r._useLegacyLights,decodeVideoTexture:Se&&S.map.isVideoTexture===!0&&Qe.getTransfer(S.map.colorSpace)===st,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===hn,flipSided:S.side===Ot,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionDerivatives:he&&S.extensions.derivatives===!0,extensionFragDepth:he&&S.extensions.fragDepth===!0,extensionDrawBuffers:he&&S.extensions.drawBuffers===!0,extensionShaderTextureLOD:he&&S.extensions.shaderTextureLOD===!0,extensionCl
vendor: 5,093 bytes, line 3658
3658ipCullDistance:he&&S.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:h||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()}}function p(S){const E=[];if(S.shaderID?E.push(S.shaderID):(E.push(S.customVertexShaderID),E.push(S.customFragmentShaderID)),S.defines!==void 0)for(const N in S.defines)E.push(N),E.push(S.defines[N]);return S.isRawShaderMaterial===!1&&(v(E,S),x(E,S),E.push(r.outputColorSpace)),E.push(S.customProgramCacheKey),E.join()}function v(S,E){S.push(E.precision),S.push(E.outputColorSpace),S.push(E.envMapMode),S.push(E.envMapCubeUVHeight),S.push(E.mapUv),S.push(E.alphaMapUv),S.push(E.lightMapUv),S.push(E.aoMapUv),S.push(E.bumpMapUv),S.push(E.normalMapUv),S.push(E.displacementMapUv),S.push(E.emissiveMapUv),S.push(E.metalnessMapUv),S.push(E.roughnessMapUv),S.push(E.anisotropyMapUv),S.push(E.clearcoatMapUv),S.push(E.clearcoatNormalMapUv),S.push(E.clearcoatRoughnessMapUv),S.push(E.iridescenceMapUv),S.push(E.iridescenceThicknessMapUv),S.push(E.sheenColorMapUv),S.push(E.sheenRoughnessMapUv),S.push(E.specularMapUv),S.push(E.specularColorMapUv),S.push(E.specularIntensityMapUv),S.push(E.transmissionMapUv),S.push(E.thicknessMapUv),S.push(E.combine),S.push(E.fogExp2),S.push(E.sizeAttenuation),S.push(E.morphTargetsCount),S.push(E.morphAttributeCount),S.push(E.numDirLights),S.push(E.numPointLights),S.push(E.numSpotLights),S.push(E.numSpotLightMaps),S.push(E.numHemiLights),S.push(E.numRectAreaLights),S.push(E.numDirLightShadows),S.push(E.numPointLightShadows),S.push(E.numSpotLightShadows),S.push(E.numSpotLightShadowsWithMaps),S.push(E.numLightProbes),S.push(E.shadowMapType),S.push(E.toneMapping),S.push(E.numClippingPlanes),S.push(E.numClipIntersection),S.push(E.depthPacking)}function x(S,E){o.disableAll(),E.isWebGL2&&o.enable(0),E.supportsVertexTextures&&o.enable(1),E.instancing&&o.enable(2),E.instancingColor&&o.enable(3),E.matcap&&o.enable(4),E.envMap&&o.enable(5),E.normalMapObjectSpace&&o.enable(6),E.normalMapTangentSpace&&o.enable(7),E.clearcoat&&o.enable(8),E.iridescence&&o.enable(9),E.alphaTest&&o.enable(10),E.vertexColors&&o.enable(11),E.vertexAlphas&&o.enable(12),E.vertexUv1s&&o.enable(13),E.vertexUv2s&&o.enable(14),E.vertexUv3s&&o.enable(15),E.vertexTangents&&o.enable(16),E.anisotropy&&o.enable(17),E.alphaHash&&o.enable(18),E.batching&&o.enable(19),S.push(o.mask),o.disableAll(),E.fog&&o.enable(0),E.useFog&&o.enable(1),E.flatShading&&o.enable(2),E.logarithmicDepthBuffer&&o.enable(3),E.skinning&&o.enable(4),E.morphTargets&&o.enable(5),E.morphNormals&&o.enable(6),E.morphColors&&o.enable(7),E.premultipliedAlpha&&o.enable(8),E.shadowMapEnabled&&o.enable(9),E.useLegacyLights&&o.enable(10),E.doubleSided&&o.enable(11),E.flipSided&&o.enable(12),E.useDepthPacking&&o.enable(13),E.dithering&&o.enable(14),E.transmission&&o.enable(15),E.sheen&&o.enable(16),E.opaque&&o.enable(17),E.pointsUvs&&o.enable(18),E.decodeVideoTexture&&o.enable(19),S.push(o.mask)}function y(S){const E=m[S.type];let N;if(E){const G=tn[E];N=qu.clone(G.uniforms)}else N=S.uniforms;return N}function R(S,E){let N;for(let G=0,ie=c.length;G<ie;G++){const I=c[G];if(I.cacheKey===E){N=I,++N.usedTimes;break}}return N===void 0&&(N=new V0(r,E,S,s),c.push(N)),N}function T(S){if(--S.usedTimes===0){const E=c.indexOf(S);c[E]=c[c.length-1],c.pop(),S.destroy()}}function C(S){l.remove(S)}function U(){l.dispose()}return{getParameters:g,getProgramCacheKey:p,getUniforms:y,acquireProgram:R,releaseProgram:T,releaseShaderCache:C,programs:c,dispose:U}}function q0(){let r=new WeakMap;function e(s){let a=r.get(s);return a===void 0&&(a={},r.set(s,a)),a}function t(s){r.delete(s)}function n(s,a,o){r.get(s)[a]=o}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function Y0(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function Xc(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function qc(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(u,d,f,m,_,g){let p=r[e];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:m,renderOrder:u.renderOrder,z:_,group:g},r[e]=p):(p.id=u.id,p.object=u,p.geometry=d,p.material=f,p.groupOrder=m,p.renderOrder=u.renderOrder,p.z=_,p.group=g),e++,p}function o(u,d,f,m,_,g){const p=a(u,d,f,m,_,g);f.transmission>0?n.push(p):f.transparent===!0?i.push(p):t.push(p)}function l(u,d,f,m,_,g){const p=a(u,d,f,m,_,g);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):t.unshift(p)}function c(u,d){t.length>1&&t.sort(u||Y0),n.length>1&&n.sort(d||Xc),i.length>1&&i.sort(d||Xc)}function h(){for(let u=e,d=r.length;u<d;u++){const f=r[u];
vendor: 4,449 bytes, line 3658
3658if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:o,unshift:l,finish:h,sort:c}}function Z0(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new qc,r.set(n,[a])):i>=s.length?(a=new qc,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function J0(){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 w,color:new pe};break;case"SpotLight":t={position:new w,direction:new w,color:new pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new w,color:new pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new w,skyColor:new pe,groundColor:new pe};break;case"RectAreaLight":t={color:new pe,position:new w,halfWidth:new w,halfHeight:new w};break}return r[e.id]=t,t}}}function $0(){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 Z};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Z,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let K0=0;function Q0(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function j0(r,e){const t=new J0,n=$0(),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 h=0;h<9;h++)i.probe.push(new w);const s=new w,a=new Re,o=new Re;function l(h,u){let d=0,f=0,m=0;for(let G=0;G<9;G++)i.probe[G].set(0,0,0);let _=0,g=0,p=0,v=0,x=0,y=0,R=0,T=0,C=0,U=0,S=0;h.sort(Q0);const E=u===!0?Math.PI:1;for(let G=0,ie=h.length;G<ie;G++){const I=h[G],F=I.color,V=I.intensity,J=I.distance,Y=I.shadow&&I.shadow.map?I.shadow.map.texture:null;if(I.isAmbientLight)d+=F.r*V*E,f+=F.g*V*E,m+=F.b*V*E;else if(I.isLightProbe){for(let W=0;W<9;W++)i.probe[W].addScaledVector(I.sh.coefficients[W],V);S++}else if(I.isDirectionalLight){const W=t.get(I);if(W.color.copy(I.color).multiplyScalar(I.intensity*E),I.castShadow){const ee=I.shadow,te=n.get(I);te.shadowBias=ee.bias,te.shadowNormalBias=ee.normalBias,te.shadowRadius=ee.radius,te.shadowMapSize=ee.mapSize,i.directionalShadow[_]=te,i.directionalShadowMap[_]=Y,i.directionalShadowMatrix[_]=I.shadow.matrix,y++}i.directional[_]=W,_++}else if(I.isSpotLight){const W=t.get(I);W.position.setFromMatrixPosition(I.matrixWorld),W.color.copy(F).multiplyScalar(V*E),W.distance=J,W.coneCos=Math.cos(I.angle),W.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),W.decay=I.decay,i.spot[p]=W;const ee=I.shadow;if(I.map&&(i.spotLightMap[C]=I.map,C++,ee.updateMatrices(I),I.castShadow&&U++),i.spotLightMatrix[p]=ee.matrix,I.castShadow){const te=n.get(I);te.shadowBias=ee.bias,te.shadowNormalBias=ee.normalBias,te.shadowRadius=ee.radius,te.shadowMapSize=ee.mapSize,i.spotShadow[p]=te,i.spotShadowMap[p]=Y,T++}p++}else if(I.isRectAreaLight){const W=t.get(I);W.color.copy(F).multiplyScalar(V),W.halfWidth.set(I.width*.5,0,0),W.halfHeight.set(0,I.height*.5,0),i.rectArea[v]=W,v++}else if(I.isPointLight){const W=t.get(I);if(W.color.copy(I.color).multiplyScalar(I.intensity*E),W.distance=I.distance,W.decay=I.decay,I.castShadow){const ee=I.shadow,te=n.get(I);te.shadowBias=ee.bias,te.shadowNormalBias=ee.normalBias,te.shadowRadius=ee.radius,te.shadowMapSize=ee.mapSize,te.shadowCameraNear=ee.camera.near,te.shadowCameraFar=ee.camera.far,i.pointShadow[g]=te,i.pointShadowMap[g]=Y,i.pointShadowMatrix[g]=I.shadow.matrix,R++}i.point[g]=W,g++}else if(I.isHemisphereLight){const W=t.get(I);W.skyColor.copy(I.color).multiplyScalar(V*E),W.groundColor.copy(I.groundColor).multiplyScalar(V*E),i.hemi[x]=W,x++}}v>0&&(e.isWebGL2?r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ae.LTC_FLOAT_1,i.rectAreaLTC2=ae.LTC_FLOAT_2):(i.rectAreaLTC1=ae.LTC_HA
vendor: 1,993 bytes, line 3658
3658LF_1,i.rectAreaLTC2=ae.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ae.LTC_FLOAT_1,i.rectAreaLTC2=ae.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=ae.LTC_HALF_1,i.rectAreaLTC2=ae.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=d,i.ambient[1]=f,i.ambient[2]=m;const N=i.hash;(N.directionalLength!==_||N.pointLength!==g||N.spotLength!==p||N.rectAreaLength!==v||N.hemiLength!==x||N.numDirectionalShadows!==y||N.numPointShadows!==R||N.numSpotShadows!==T||N.numSpotMaps!==C||N.numLightProbes!==S)&&(i.directional.length=_,i.spot.length=p,i.rectArea.length=v,i.point.length=g,i.hemi.length=x,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=R,i.pointShadowMap.length=R,i.spotShadow.length=T,i.spotShadowMap.length=T,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=R,i.spotLightMatrix.length=T+C-U,i.spotLightMap.length=C,i.numSpotLightShadowsWithMaps=U,i.numLightProbes=S,N.directionalLength=_,N.pointLength=g,N.spotLength=p,N.rectAreaLength=v,N.hemiLength=x,N.numDirectionalShadows=y,N.numPointShadows=R,N.numSpotShadows=T,N.numSpotMaps=C,N.numLightProbes=S,i.version=K0++)}function c(h,u){let d=0,f=0,m=0,_=0,g=0;const p=u.matrixWorldInverse;for(let v=0,x=h.length;v<x;v++){const y=h[v];if(y.isDirectionalLight){const R=i.directional[d];R.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),R.direction.sub(s),R.direction.transformDirection(p),d++}else if(y.isSpotLight){const R=i.spot[m];R.position.setFromMatrixPosition(y.matrixWorld),R.position.applyMatrix4(p),R.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),R.direction.sub(s),R.direction.transformDirection(p),m++}else if(y.isRectAreaLight){const R=i.rectArea[_];R.position.setFromMatrixPosition(y.matrixWorld),R.position.applyMatrix4(p),o.identity(),a.copy(y.matrixWorld),a.premultiply(
vendor: 10,648 bytes, lines 3658-3686
3658p),o.extractRotation(a),R.halfWidth.set(y.width*.5,0,0),R.halfHeight.set(0,y.height*.5,0),R.halfWidth.applyMatrix4(o),R.halfHeight.applyMatrix4(o),_++}else if(y.isPointLight){const R=i.point[f];R.position.setFromMatrixPosition(y.matrixWorld),R.position.applyMatrix4(p),f++}else if(y.isHemisphereLight){const R=i.hemi[g];R.direction.setFromMatrixPosition(y.matrixWorld),R.direction.transformDirection(p),g++}}}return{setup:l,setupView:c,state:i}}function Yc(r,e){const t=new j0(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function a(u){n.push(u)}function o(u){i.push(u)}function l(u){t.setup(n,u)}function c(u){t.setupView(n,u)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:c,pushLight:a,pushShadow:o}}function ex(r,e){let t=new WeakMap;function n(s,a=0){const o=t.get(s);let l;return o===void 0?(l=new Yc(r,e),t.set(s,[l])):a>=o.length?(l=new Yc(r,e),o.push(l)):l=o[a],l}function i(){t=new WeakMap}return{get:n,dispose:i}}class Fl extends Lt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Lu,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 Bl extends Lt{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 tx=`void main() {
3659	gl_Position = vec4( position, 1.0 );
3660}`,nx=`uniform sampler2D shadow_pass;
3661uniform vec2 resolution;
3662uniform float radius;
3663#include <packing>
3664void main() {
3665	const float samples = float( VSM_SAMPLES );
3666	float mean = 0.0;
3667	float squared_mean = 0.0;
3668	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3669	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3670	for ( float i = 0.0; i < samples; i ++ ) {
3671		float uvOffset = uvStart + i * uvStride;
3672		#ifdef HORIZONTAL_PASS
3673			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3674			mean += distribution.x;
3675			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3676		#else
3677			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3678			mean += depth;
3679			squared_mean += depth * depth;
3680		#endif
3681	}
3682	mean = mean / samples;
3683	squared_mean = squared_mean / samples;
3684	float std_dev = sqrt( squared_mean - mean * mean );
3685	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3686}`;function ix(r,e,t){let n=new Qs;const i=new Z,s=new Z,a=new je,o=new Fl({depthPacking:Iu}),l=new Bl,c={},h=t.maxTextureSize,u={[Cn]:Ot,[Ot]:Cn,[hn]:hn},d=new fn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Z},radius:{value:4}},vertexShader:tx,fragmentShader:nx}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new Ge;m.setAttribute("position",new et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new xt(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=xl;let p=this.type;this.render=function(T,C,U){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;const S=r.getRenderTarget(),E=r.getActiveCubeFace(),N=r.getActiveMipmapLevel(),G=r.state;G.setBlending(An),G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const ie=p!==cn&&this.type===cn,I=p===cn&&this.type!==cn;for(let F=0,V=T.length;F<V;F++){const J=T[F],Y=J.shadow;if(Y===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;i.copy(Y.mapSize);const W=Y.getFrameExtents();if(i.multiply(W),s.copy(Y.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/W.x),i.x=s.x*W.x,Y.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/W.y),i.y=s.y*W.y,Y.mapSize.y=s.y)),Y.map===null||ie===!0||I===!0){const te=this.type!==cn?{minFilter:ft,magFilter:ft}:{};Y.map!==null&&Y.map.dispose(),Y.map=new rn(i.x,i.y,te),Y.map.texture.name=J.name+".shadowMap",Y.camera.updateProjectionMatrix()}r.setRenderTarget(Y.map),r.clear();const ee=Y.getViewportCount();for(let te=0;te<ee;te++){const ue=Y.getViewport(te);a.set(s.x*ue.x,s.y*ue.y,s.x*ue.z,s.y*ue.w),G.viewport(a),Y.updateMatrices(J,te),n=Y.getFrustum(),y(C,U,Y.camera,J,this.type)}Y.isPointLightShadow!==!0&&this.type===cn&&v(Y,U),Y.needsUpdate=!1}p=this.type,g.needsUpdate=!1,r.setRenderTarget(S,E,N)};function v(T,C){const U=e.update(_);d.defines.VSM_SAMPLES!==T.blurSamples&&(d.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new rn(i.x,i.y)),d.uniforms.shadow_pass.value=T.map.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,r.setRenderTarget(T.mapPass),r.clear(),r.renderBufferDirect(C,null,U,d,_,null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,r.setRenderTarget(T.map),r.clear(),r.renderBufferDirect(C,null,U,f,_,null)}function x(T,C,U,S){let E=null;const N=U.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(N!==void 0)E=N;else if(E=U.isPointLight===!0?l:o,r.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0){const G=E.uuid,ie=C.uuid;let I=c[G];I===void 0&&(I={},c[G]=I);let F=I[ie];F===void 0&&(F=E.clone(),I[ie]=F,C.addEventListener("dispose",R)),E=F}if(E.visible=C.visible,E.wireframe=C.wireframe,S===cn?E.side=C.shadowSide!==null?C.shadowSide:C.side:E.side=C.shadowSide!==null?C.shadowSide:u[C.side],E.alphaMap=C.alphaMap,E.alphaTest=C.alphaTest,E.map=C.map,E.clipShadows=C.clipShadows,E.clippingPlanes=C.clippingPlanes,E.clipIntersection=C.clipIntersection,E.displacementMap=C.displacementMap,E.displacementScale=C.displacementScale,E.displacementBias=C.displacementBias,E.wireframeLinewidth=C.wireframeLinewidth,E.linewidth=C.linewidth,U.isPointLight===!0&&E.isMeshDistanceMaterial===!0){const G=r.properties.get(E);G.light=U}return E}function y(T,C,U,S,E){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&E===cn)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,T.matrixWorld);const ie=e.update(T),I=T.material;if(Array.isArray(I)){const F=ie.groups;for(let V=0,J=F.length;V<J;V++){const Y=F[V],W=I[Y.materialIndex];if(W&&W.visible){const ee=x(T,W,S,E);T.onBeforeShadow(r,T,C,U,ie,ee,Y),r.renderBufferDirect(U,null,ie,ee,T,Y),T.onAfterShadow(r,T,C,U,ie,ee,Y)}}}else if(I.visible){const F=x(T,I,S,E);T.onBeforeShadow(r,T,C,U,ie,F,null),r.renderBufferDirect(U,null,ie,F,T,null),T.onAfterShadow(r,T,C,U,ie,F,null)}}const G=T.children;for(let ie=0,I=G.length;ie<I;ie++)y(G[ie],C,U,S,E)}function R(T){T.target.removeEventListener("dispose",R);for(const U in c){const S=c[U],E=T.target.uuid;E in S&&(S[E].dispose(),delete S[E])}}}function sx(r,e,t){const n=t.isWebGL2;function i(){let L=!1;const ce=new je;let he=null;const Le=new je(0,0,0,0);return{setMask:function(we){he!==we&&!L&&(r.colorMask(we,we,we,we),he=we)},setLocked:function(we){L=we},setClear:function(we,tt,nt,Mt,It){It===!0&&(we*=Mt,tt*=Mt,nt*=Mt),ce.set(we,tt,nt,Mt),Le.equals(ce)===!1&&(r.clearColor(we,tt,nt,Mt),Le.copy(ce))},reset:function(){L=!1,he=null,Le.set(-1,0,0,0)}}}function s(){let L=!1,ce=null,he=null,Le=null;return{setTest:function(we){we?Ne(r.DEPTH_TEST):Se(r.DEPTH_TEST)},setMask:function(we){ce!==we&&!L&&(r.depthMask(we),ce=we)},setFunc:function(we){if(he!==we){switch(we){case su:r.depthFunc(r.NEVER);break;case ru:r.depthFunc(r.ALWAYS);break;case au:r.depthFunc(r.LESS);break;case ws:r.depthFunc(r.LEQUAL);break;case ou:r.depthFunc(r.EQUAL);break;case lu:r.depthFunc(r.GEQUAL);break;case cu:r.depthFunc(r.GREATER);break;case hu:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}he=we}},setLocked:function(we){L=we},setClear:function(we){Le!==we&&(r.clearDepth(we),Le=we)},reset:function(){L=!1,ce=null,he=null,Le=null}}}function a(){let L=!1,ce=null,he=null,Le=null,we=null,tt=null,nt=null,Mt=null,It=null;return{setTest:function(it){L||(it?Ne(r.STENCIL_TEST):Se(r.STENCIL_TEST))},setMask:function(it){ce!==it&&!L&&(r.stencilMask(it),ce=it)},setFunc:function(it,Ut,ln){(he!==it||Le!==Ut||we!==ln)&&(r.stencilFunc(it,Ut,ln),he=it,Le=Ut,we=ln)},setOp:function(it,Ut,ln){(tt!==it||nt!==Ut||Mt!==ln)&&(r.stencilOp(it,Ut,ln),tt=it,nt=Ut,Mt=ln)},setLocked:function(it){L=it},setClear:function(it){It!==it&&(r.clearStencil(it),It=it)},reset:function(){L=!1,ce=null,he=null,Le=null,we=null,tt=null,nt=null,Mt=null,It=null}}}const o=new i,l=new s,c=new a,h=new WeakMap,u=new WeakMap;let d={},f={},m=new WeakMap,_=[],g=null,p=!1,v=null,x=null,y=null,R=null,T=null,C=null,U=null,S=new pe(0,0,0),E=0,N=!1,G=null,ie=null,I=null,F=null,V=null;const J=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Y=!1,W=0;const ee=r.getParameter(r.VERSION);ee.indexOf("WebGL")!==-1?(W=parseFloat(/^WebGL (\d)/.exec(ee)[1]),Y=W>=1):ee.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(ee)[1]),Y=W>=2);let te=null,ue={};const H=r.getParameter(r.SCISSOR_BOX),K=r.getParameter(r.VIEWPORT),de=new je().fromArray(H),Me=new je().fromArray(K);function ge(L,ce,he,Le){const we=new Uint8Array(4),tt=r.createTexture();r.bindTexture(L,tt),r.texParameteri(L,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(L,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let nt=0;nt<he;nt++)n&&(L===r.TEXTURE_3D||L===r.TEXTURE_2D_ARRAY)?r.texImage3D(ce,0,r.RGBA,1,1,Le,0,r.RGBA,r.UNSIGNED_BYTE,we):r.texImage2D(ce+nt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,we);return tt}const Pe={};Pe[r.TEXTURE_2D]=ge(r.TEXTURE_2D,r.TEXTURE_2D,1),Pe[r.TEXTURE_CUBE_MAP]=ge(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(Pe[r.TEXTURE_2D_ARRAY]=ge(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Pe[r.TEXTURE_3D]=ge(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),o.setClear(0,0,0,1),l.setClear(1),c.setClear(0),Ne(r.DEPTH_TEST),l.setFu
vendor: 6,049 bytes, line 3686
3686nc(ws),fe(!1),b(Ro),Ne(r.CULL_FACE),X(An);function Ne(L){d[L]!==!0&&(r.enable(L),d[L]=!0)}function Se(L){d[L]!==!1&&(r.disable(L),d[L]=!1)}function Ue(L,ce){return f[L]!==ce?(r.bindFramebuffer(L,ce),f[L]=ce,n&&(L===r.DRAW_FRAMEBUFFER&&(f[r.FRAMEBUFFER]=ce),L===r.FRAMEBUFFER&&(f[r.DRAW_FRAMEBUFFER]=ce)),!0):!1}function P(L,ce){let he=_,Le=!1;if(L)if(he=m.get(ce),he===void 0&&(he=[],m.set(ce,he)),L.isWebGLMultipleRenderTargets){const we=L.texture;if(he.length!==we.length||he[0]!==r.COLOR_ATTACHMENT0){for(let tt=0,nt=we.length;tt<nt;tt++)he[tt]=r.COLOR_ATTACHMENT0+tt;he.length=we.length,Le=!0}}else he[0]!==r.COLOR_ATTACHMENT0&&(he[0]=r.COLOR_ATTACHMENT0,Le=!0);else he[0]!==r.BACK&&(he[0]=r.BACK,Le=!0);Le&&(t.isWebGL2?r.drawBuffers(he):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(he))}function re(L){return g!==L?(r.useProgram(L),g=L,!0):!1}const q={[kn]:r.FUNC_ADD,[Gh]:r.FUNC_SUBTRACT,[Wh]:r.FUNC_REVERSE_SUBTRACT};if(n)q[Uo]=r.MIN,q[Do]=r.MAX;else{const L=e.get("EXT_blend_minmax");L!==null&&(q[Uo]=L.MIN_EXT,q[Do]=L.MAX_EXT)}const se={[Xh]:r.ZERO,[qh]:r.ONE,[Yh]:r.SRC_COLOR,[ra]:r.SRC_ALPHA,[jh]:r.SRC_ALPHA_SATURATE,[Kh]:r.DST_COLOR,[Jh]:r.DST_ALPHA,[Zh]:r.ONE_MINUS_SRC_COLOR,[aa]:r.ONE_MINUS_SRC_ALPHA,[Qh]:r.ONE_MINUS_DST_COLOR,[$h]:r.ONE_MINUS_DST_ALPHA,[eu]:r.CONSTANT_COLOR,[tu]:r.ONE_MINUS_CONSTANT_COLOR,[nu]:r.CONSTANT_ALPHA,[iu]:r.ONE_MINUS_CONSTANT_ALPHA};function X(L,ce,he,Le,we,tt,nt,Mt,It,it){if(L===An){p===!0&&(Se(r.BLEND),p=!1);return}if(p===!1&&(Ne(r.BLEND),p=!0),L!==Hh){if(L!==v||it!==N){if((x!==kn||T!==kn)&&(r.blendEquation(r.FUNC_ADD),x=kn,T=kn),it)switch(L){case gi:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Po:r.blendFunc(r.ONE,r.ONE);break;case Lo:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Io:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",L);break}else switch(L){case gi:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Po:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case Lo:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Io:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",L);break}y=null,R=null,C=null,U=null,S.set(0,0,0),E=0,v=L,N=it}return}we=we||ce,tt=tt||he,nt=nt||Le,(ce!==x||we!==T)&&(r.blendEquationSeparate(q[ce],q[we]),x=ce,T=we),(he!==y||Le!==R||tt!==C||nt!==U)&&(r.blendFuncSeparate(se[he],se[Le],se[tt],se[nt]),y=he,R=Le,C=tt,U=nt),(Mt.equals(S)===!1||It!==E)&&(r.blendColor(Mt.r,Mt.g,Mt.b,It),S.copy(Mt),E=It),v=L,N=!1}function Ee(L,ce){L.side===hn?Se(r.CULL_FACE):Ne(r.CULL_FACE);let he=L.side===Ot;ce&&(he=!he),fe(he),L.blending===gi&&L.transparent===!1?X(An):X(L.blending,L.blendEquation,L.blendSrc,L.blendDst,L.blendEquationAlpha,L.blendSrcAlpha,L.blendDstAlpha,L.blendColor,L.blendAlpha,L.premultipliedAlpha),l.setFunc(L.depthFunc),l.setTest(L.depthTest),l.setMask(L.depthWrite),o.setMask(L.colorWrite);const Le=L.stencilWrite;c.setTest(Le),Le&&(c.setMask(L.stencilWriteMask),c.setFunc(L.stencilFunc,L.stencilRef,L.stencilFuncMask),c.setOp(L.stencilFail,L.stencilZFail,L.stencilZPass)),O(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),L.alphaToCoverage===!0?Ne(r.SAMPLE_ALPHA_TO_COVERAGE):Se(r.SAMPLE_ALPHA_TO_COVERAGE)}function fe(L){G!==L&&(L?r.frontFace(r.CW):r.frontFace(r.CCW),G=L)}function b(L){L!==zh?(Ne(r.CULL_FACE),L!==ie&&(L===Ro?r.cullFace(r.BACK):L===kh?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Se(r.CULL_FACE),ie=L}function M(L){L!==I&&(Y&&r.lineWidth(L),I=L)}function O(L,ce,he){L?(Ne(r.POLYGON_OFFSET_FILL),(F!==ce||V!==he)&&(r.polygonOffset(ce,he),F=ce,V=he)):Se(r.POLYGON_OFFSET_FILL)}function ne(L){L?Ne(r.SCISSOR_TEST):Se(r.SCISSOR_TEST)}function Q(L){L===void 0&&(L=r.TEXTURE0+J-1),te!==L&&(r.activeTexture(L),te=L)}function $(L,ce,he){he===void 0&&(te===null?he=r.TEXTURE0+J-1:he=te);let Le=ue[he];Le===void 0&&(Le={type:void 0,texture:void 0},ue[he]=Le),(Le.type!==L||Le.texture!==ce)&&(te!==he&&(r.activeTexture(he),te=he),r.bindTexture(L,ce||Pe[L]),Le.type=L,Le.texture=ce)}function ye(){const L=ue[te];L!==void 0&&L.type!==void 0&&(r.bindTexture(L.type,null),L.type=void 0,L.texture=void 0)}function le(){try{r.compressedTexImage2D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function _e(){try{r.compressedTexImage3D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Te(){try{r.texSubImage2D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Fe(){try{r.texSubImage3D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function j(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function $e(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Ye(){try{r.texStorage2D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function De(){try{r.texStorage3D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Ae(){try{r.texImage2D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function xe(){try{r.texImage3D.apply(r,arguments)}catch(L){console.error("THREE.WebGLState:",L)}}function Ve(L){de.equals(L)===!1&&(r.scissor(L.x,L.y,L.z,L.w),de.copy(L))}function Ke(L){Me.equals(L)===!1&&(r.viewport(L.x,L.y,L.z,L.w),Me.copy(L))}function ot(L,ce){let he=u.get(ce);he===void 0&&(he=new WeakMap,u.set(ce,he));let Le=he.get(L);Le===void 0&&(Le=r.getUniformBlockIndex(ce,L.name),he.set(L,Le))}function Xe(L,ce){const Le=u.get(ce).get(L);h.get(ce)!==Le&&(r.uniformBlockBinding(ce,Le,L.__bindingPointIndex),h.set(ce,Le))}function oe(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor
vendor: 9,937 bytes, line 3686
3686(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),n===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),d={},te=null,ue={},f={},m=new WeakMap,_=[],g=null,p=!1,v=null,x=null,y=null,R=null,T=null,C=null,U=null,S=new pe(0,0,0),E=0,N=!1,G=null,ie=null,I=null,F=null,V=null,de.set(0,0,r.canvas.width,r.canvas.height),Me.set(0,0,r.canvas.width,r.canvas.height),o.reset(),l.reset(),c.reset()}return{buffers:{color:o,depth:l,stencil:c},enable:Ne,disable:Se,bindFramebuffer:Ue,drawBuffers:P,useProgram:re,setBlending:X,setMaterial:Ee,setFlipSided:fe,setCullFace:b,setLineWidth:M,setPolygonOffset:O,setScissorTest:ne,activeTexture:Q,bindTexture:$,unbindTexture:ye,compressedTexImage2D:le,compressedTexImage3D:_e,texImage2D:Ae,texImage3D:xe,updateUBOMapping:ot,uniformBlockBinding:Xe,texStorage2D:Ye,texStorage3D:De,texSubImage2D:Te,texSubImage3D:Fe,compressedTexSubImage2D:j,compressedTexSubImage3D:$e,scissor:Ve,viewport:Ke,reset:oe}}function rx(r,e,t,n,i,s,a){const o=i.isWebGL2,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new WeakMap;let u;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(b,M){return f?new OffscreenCanvas(b,M):zs("canvas")}function _(b,M,O,ne){let Q=1;if((b.width>ne||b.height>ne)&&(Q=ne/Math.max(b.width,b.height)),Q<1||M===!0)if(typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&b instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&b instanceof ImageBitmap){const $=M?ca:Math.floor,ye=$(Q*b.width),le=$(Q*b.height);u===void 0&&(u=m(ye,le));const _e=O?m(ye,le):u;return _e.width=ye,_e.height=le,_e.getContext("2d").drawImage(b,0,0,ye,le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+b.width+"x"+b.height+") to ("+ye+"x"+le+")."),_e}else return"data"in b&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+b.width+"x"+b.height+")."),b;return b}function g(b){return cl(b.width)&&cl(b.height)}function p(b){return o?!1:b.wrapS!==Rt||b.wrapT!==Rt||b.minFilter!==ft&&b.minFilter!==pt}function v(b,M){return b.generateMipmaps&&M&&b.minFilter!==ft&&b.minFilter!==pt}function x(b){r.generateMipmap(b)}function y(b,M,O,ne,Q=!1){if(o===!1)return M;if(b!==null){if(r[b]!==void 0)return r[b];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+b+"'")}let $=M;if(M===r.RED&&(O===r.FLOAT&&($=r.R32F),O===r.HALF_FLOAT&&($=r.R16F),O===r.UNSIGNED_BYTE&&($=r.R8)),M===r.RED_INTEGER&&(O===r.UNSIGNED_BYTE&&($=r.R8UI),O===r.UNSIGNED_SHORT&&($=r.R16UI),O===r.UNSIGNED_INT&&($=r.R32UI),O===r.BYTE&&($=r.R8I),O===r.SHORT&&($=r.R16I),O===r.INT&&($=r.R32I)),M===r.RG&&(O===r.FLOAT&&($=r.RG32F),O===r.HALF_FLOAT&&($=r.RG16F),O===r.UNSIGNED_BYTE&&($=r.RG8)),M===r.RGBA){const ye=Q?Ns:Qe.getTransfer(ne);O===r.FLOAT&&($=r.RGBA32F),O===r.HALF_FLOAT&&($=r.RGBA16F),O===r.UNSIGNED_BYTE&&($=ye===st?r.SRGB8_ALPHA8:r.RGBA8),O===r.UNSIGNED_SHORT_4_4_4_4&&($=r.RGBA4),O===r.UNSIGNED_SHORT_5_5_5_1&&($=r.RGB5_A1)}return($===r.R16F||$===r.R32F||$===r.RG16F||$===r.RG32F||$===r.RGBA16F||$===r.RGBA32F)&&e.get("EXT_color_buffer_float"),$}function R(b,M,O){return v(b,O)===!0||b.isFramebufferTexture&&b.minFilter!==ft&&b.minFilter!==pt?Math.log2(Math.max(M.width,M.height))+1:b.mipmaps!==void 0&&b.mipmaps.length>0?b.mipmaps.length:b.isCompressedTexture&&Array.isArray(b.image)?M.mipmaps.length:1}function T(b){return b===ft||b===oa||b===Ss?r.NEAREST:r.LINEAR}function C(b){const M=b.target;M.removeEventListener("dispose",C),S(M),M.isVideoTexture&&h.delete(M)}function U(b){const M=b.target;M.removeEventListener("dispose",U),N(M)}function S(b){const M=n.get(b);if(M.__webglInit===void 0)return;const O=b.source,ne=d.get(O);if(ne){const Q=ne[M.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&E(b),Object.keys(ne).length===0&&d.delete(O)}n.remove(b)}function E(b){const M=n.get(b);r.deleteTexture(M.__webglTexture);const O=b.source,ne=d.get(O);delete ne[M.__cacheKey],a.memory.textures--}function N(b){const M=b.texture,O=n.get(b),ne=n.get(M);if(ne.__webglTexture!==void 0&&(r.deleteTexture(ne.__webglTexture),a.memory.textures--),b.depthTexture&&b.depthTexture.dispose(),b.isWebGLCubeRenderTarget)for(let Q=0;Q<6;Q++){if(Array.isArray(O.__webglFramebuffer[Q]))for(let $=0;$<O.__webglFramebuffer[Q].length;$++)r.deleteFramebuffer(O.__webglFramebuffer[Q][$]);else r.deleteFramebuffer(O.__webglFramebuffer[Q]);O.__webglDepthbuffer&&r.deleteRenderbuffer(O.__webglDepthbuffer[Q])}else{if(Array.isArray(O.__webglFramebuffer))for(let Q=0;Q<O.__webglFramebuffer.length;Q++)r.deleteFramebuffer(O.__webglFramebuffer[Q]);else r.deleteFramebuffer(O.__webglFramebuffer);if(O.__webglDepthbuffer&&r.deleteRenderbuffer(O.__webglDepthbuffer),O.__webglMultisampledFramebuffer&&r.deleteFramebuffer(O.__webglMultisampledFramebuffer),O.__webglColorRenderbuffer)for(let Q=0;Q<O.__webglColorRenderbuffer.length;Q++)O.__webglColorRenderbuffer[Q]&&r.deleteRenderbuffer(O.__webglColorRenderbuffer[Q]);O.__webglDepthRenderbuffer&&r.deleteRenderbuffer(O.__webglDepthRenderbuffer)}if(b.isWebGLMultipleRenderTargets)for(let Q=0,$=M.length;Q<$;Q++){const ye=n.get(M[Q]);ye.__webglTexture&&(r.deleteTexture(ye.__webglTexture),a.memory.textures--),n.remove(M[Q])}n.remove(M),n.remove(b)}let G=0;function ie(){G=0}function I(){const b=G;return b>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+b+" texture units while this GPU supports only "+i.maxTextures),G+=1,b}function F(b){const M=[];return M.push(b.wrapS),M.push(b.wrapT),M.push(b.wrapR||0),M.push(b.magFilter),M.push(b.minFilter),M.push(b.anisotropy),M.push(b.internalFormat),M.push(b.format),M.push(b.type),M.push(b.generateMipmaps),M.push(b.premultiplyAlpha),M.push(b.flipY),M.push(b.unpackAlignment),M.push(b.colorSpace),M.join()}function V(b,M){const O=n.get(b);if(b.isVideoTexture&&Ee(b),b.isRenderTargetTexture===!1&&b.version>0&&O.__version!==b.version){const ne=b.image;if(ne===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ne.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{de(O,b,M);return}}t.bindTexture(r.TEXTURE_2D,O.__webglTexture,r.TEXTURE0+M)}function J(b,M){const O=n.get(b);if(b.version>0&&O.__version!==b.version){de(O,b,M);return}t.bindTexture(r.TEXTURE_2D_ARRAY,O.__webglTexture,r.TEXTURE0+M)}function Y(b,M){const O=n.get(b);if(b.version>0&&O.__version!==b.version){de(O,b,M);return}t.bindTexture(r.TEXTURE_3D,O.__webglTexture,r.TEXTURE0+M)}function W(b,M){const O=n.get(b);if(b.version>0&&O.__version!==b.version){Me(O,b,M);return}t.bindTexture(r.TEXTURE_CUBE_MAP,O.__webglTexture,r.TEXTURE0+M)}const ee={[Ps]:r.REPEAT,[Rt]:r.CLAMP_TO_EDGE,[Ls]:r.MIRRORED_REPEAT},te={[ft]:r.NEAREST,[oa]:r.NEAREST_MIPMAP_NEAREST,[Ss]:r.NEAREST_MIPMAP_LINEAR,[pt]:r.LINEAR,[vl]:r.LINEAR_MIPMAP_NEAREST,[Xn]:r.LINEAR_MIPMAP_LINEAR},ue={[Du]:r.NEVER,[ku]:r.ALWAYS,[Nu]:r.LESS,[Rl]:r.LEQUAL,[Ou]:r.EQUAL,[zu]:r.GEQUAL,[Fu]:r.GREATER,[Bu]:r.NOTEQUAL};function H(b,M,O){if(O?(r.texParameteri(b,r.TEXTURE_WRAP_S,ee[M.wrapS]),r.texParameteri(b,r.TEXTURE_WRAP_T,ee[M.wrapT]),(b===r.TEXTURE_3D||b===r.TEXTURE_2D_ARRAY)&&r.texParameteri(b,r.TEXTURE_WRAP_R,ee[M.wrapR]),r.texParameteri(b,r.TEXTURE_MAG_FILTER,te[M.magFilter]),r.texParameteri(b,r.TEXTURE_MIN_FILTER,te[M.minFilter])):(r.texParameteri(b,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(b,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(b===r.TEXTURE_3D||b===r.TEXTURE_2D_ARRAY)&&r.texParameteri(b,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(M.wrapS!==Rt||M.wrapT!==Rt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(b,r.TEXTURE_MAG_FILTER,T(M.magFilter)),r.texParameteri(b,r.TEXTURE_MIN_FILTER,T(M.minFilter)),M.minFilter!==ft&&M.minFilter!==pt&&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(b,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(b,r.TEXTURE_COMPARE_FUNC,ue[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ne=e.get("EXT_texture_filter_anisotropic");if(M.magFilter===ft||M.minFilter!==Ss&&M.minFilter!==Xn||M.type===nn&&e.has("OES_texture_float_linear")===!1||o===!1&&M.type===ji&&e.has("OES_texture_half_float_linear")===!1)return;(M.anisotropy>1||n.get(M).__currentAnisotropy)&&(r.texParameterf(b,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,i.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy)}}function K(b,M){let O=!1;b.__webglInit===void 0&&(b.__webglInit=!0,M.addEventListener("dispose",C));const ne=M.source;let Q=d.get(ne);Q===void 0&&(Q={},d.set(ne,Q));const $=F(M);if($!==b.__cacheKey){Q[$]===void 0&&(Q[$]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,O=!0),Q[$].usedTimes++;const ye=Q[b.__cacheKey];ye!==void 0&&(Q[b.__cacheKey].usedTimes--,ye.usedTimes===0&&E(M)),b.__cacheKey=$,b.__webglTexture=Q[$].texture}return O}function de(b,M,O){let ne=r.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(ne=r.TEXTURE_2D_ARRAY),M.isData3DTexture&&(ne=r.TEXTURE_3D);const Q=K(b,M),$=M.source;t.bindTexture(ne,b.__webglTexture,r.TEXTURE0+O);const ye=n.get($);if($.version!==ye.__version||Q===!0){t.activeTexture(r.TEXTURE0+O);
3686const le=Qe.getPrimaries(Qe.workingColorSpace),_e=M.colorSpace===Zt?null:Qe.getPrimaries(M.colorSpace),Te=M.colorSpace===Zt||le===_e?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,Te);const Fe=p(M)&&g(M.image)===!1;let j=_(M.image,Fe,!1,i.maxTextureSize);j=fe(M,j);const $e=g(j)||o,Ye=s.convert(M.format,M.colorSpace);let De=s.convert(M.type),Ae=y(M.internalFormat,Ye,De,M.colorSpace,M.isVideoTexture);H(ne,M,$e);let xe;const Ve=M.mipmaps,Ke=o&&M.isVideoTexture!==!0&&Ae!==Tl,ot=ye.__version===void 0||Q===!0,Xe=R(M,j,$e);if(M.isDepthTexture)Ae=r.DEPTH_COMPONENT,o?M.type===nn?Ae=r.DEPTH_COMPONENT32F:M.type===bn?Ae=r.DEPTH_COMPONENT24:M.type===Vn?Ae=r.DEPTH24_STENCIL8:Ae=r.DEPTH_COMPONENT16:M.type===nn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),M.format===Hn&&Ae===r.DEPTH_COMPONENT&&M.type!==fa&&M.type!==bn&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),M.type=bn,De=s.convert(M.type)),M.format===yi&&Ae===r.DEPTH_COMPONENT&&(Ae=r.DEPTH_STENCIL,M.type!==Vn&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),M.type=Vn,De=s.convert(M.type))),ot&&(Ke?t.texStorage2D(r.TEXTURE_2D,1,Ae,j.width,j.height):t.texImage2D(r.TEXTURE_2D,0,Ae,j.width,j.height,0,Ye,De,null));else if(M.isDataTexture)if(Ve.length>0&&$e){Ke&&ot&&t.texStorage2D(r.TEXTURE_2D,Xe,Ae,Ve[0].width,Ve[0].height);for(let oe=0,L=Ve.length;oe<L;oe++)xe=Ve[oe],Ke?t.texSubImage2D(r.TEXTURE_2D,oe,0,0,xe.width,xe.height,Ye,De,xe.data):t.texImage2D(r.TEXTURE_2D,oe,Ae,xe.width,xe.height,0,Ye,De,xe.data);M.generateMipmaps=!1}else Ke?(ot&&t.texStorage2D(r.TEXTURE_2D,Xe,Ae,j.width,j.height),t.texSubImage2D(r.TEXTURE_2D,0,0,0,j.width,j.height,Ye,De,j.data)):t.texImage2D(r.TEXTURE_2D,0,Ae,j.width,j.height,0,Ye,De,j.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){Ke&&ot&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Xe,Ae,Ve[0].width,Ve[0].height,j.depth);for(let oe=0,L=Ve.length;oe<L;oe++)xe=Ve[oe],M.format!==Vt?Ye!==null?Ke?t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,oe,0,0,0,xe.width,xe.height,j.depth,Ye,xe.data,0,0):t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,oe,Ae,xe.width,xe.height,j.depth,0,xe.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ke?t.texSubImage3D(r.TEXTURE_2D_ARRAY,oe,0,0,0,xe.width,xe.height,j.depth,Ye,De,xe.data):t.texImage3D(r.TEXTURE_2D_ARRAY,oe,Ae,xe.width,xe.height,j.depth,0,Ye,De,xe.data)}else{Ke&&ot&&t.texStorage2D(r.TEXTURE_2D,Xe,Ae,Ve[0].width,Ve[0].height);for(let oe=0,L=Ve.length;oe<L;oe++)xe=Ve[oe],M.format!==Vt?Ye!==null?Ke?t.compressedTexSubImage2D(r.TEXTURE_2D,oe,0,0,xe.width,xe.height,Ye,xe.data):t.compressedTexImage2D(r.TEXTURE_2D,oe,Ae,xe.width,xe.height,0,xe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ke?t.texSubImage2D(r.TEXTURE_2D,oe,0,0,xe.width,xe.height,Ye,De,xe.data):t.texImage2D(r.TEXTURE_2D,oe,Ae,xe.width,xe.height,0,Ye,De,xe.data)}else if(M.isDataArrayTexture)Ke?(ot&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Xe,Ae,j.width,j.height,j.depth),t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,j.width,j.height,j.depth,Ye,De,j.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,Ae,j.width,j.height,j.depth,0,Ye,De,j.data);else if(M.isData3DTexture)Ke?(ot&&t.texStorage3D(r.TEXTURE_3D,Xe,Ae,j.width,j.height,j.depth),t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,j.width,j.height,j.depth,Ye,De,j.data)):t.texImage3D(r.TEXTURE_3D,0,Ae,j.width,j.height,j.depth,0,Ye,De,j.data);else if(M.isFramebufferTexture){if(ot)if(Ke)t.texStorage2D(r.TEXTURE_2D,Xe,Ae,j.width,j.height);else{let oe=j.width,L=j.height;for(let ce=0;ce<Xe;ce++)t.texImage2D(r.TEXTURE_2D,ce,Ae,oe,L,0,Ye,De,null),oe>>=1,L>>=1}}else if(Ve.length>0&&$e){Ke&&ot&&t.texStorage2D(r.TEXTURE_2D,Xe,Ae,Ve[0].width,Ve[0].height);for(let oe=0,L=Ve.length;oe<L;oe++)xe=Ve[oe],Ke?t.texSubImage2D(r.TEXTURE_2D,oe,0,0,Ye,De,xe):t.texImage2D(r.TEXTURE_2D,oe,Ae,Ye,De,xe);M.generateMipmaps=!1}else Ke?(ot&&t.texStorage2D(r.TEXTURE_2D,Xe,Ae,j.width,j.height),t.texSubImage2D(r.TEXTURE_2D,0,0,0,Ye,De,j
3686)):t.texImage2D(r.TEXTURE_2D,0,Ae,Ye,De,j);v(M,$e)&&x(ne),ye.__version=$.version,M.onUpdate&&M.onUpdate(M)}b.__version=M.version}function Me(b,M,O){if(M.image.length!==6)return;const ne=K(b,M),Q=M.source;t.bindTexture(r.TEXTURE_CUBE_MAP,b.__webglTexture,r.TEXTURE0+O);const $=n.get(Q);if(Q.version!==$.__version||ne===!0){t.activeTexture(r.TEXTURE0+O);const ye=Qe.getPrimaries(Qe.workingColorSpace),le=M.colorSpace===Zt?null:Qe.getPrimaries(M.colorSpace),_e=M.colorSpace===Zt||ye===le?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,_e);const Te=M.isCompressedTexture||M.image[0].isCompressedTexture,Fe=M.image[0]&&M.image[0].isDataTexture,j=[];for(let oe=0;oe<6;oe++)!Te&&!Fe?j[oe]=_(M.image[oe],!1,!0,i.maxCubemapSize):j[oe]=Fe?M.image[oe].image:M.image[oe],j[oe]=fe(M,j[oe]);const $e=j[0],Ye=g($e)||o,De=s.convert(M.format,M.colorSpace),Ae=s.convert(M.type),xe=y(M.internalFormat,De,Ae,M.colorSpace),Ve=o&&M.isVideoTexture!==!0,Ke=$.__version===void 0||ne===!0;let ot=R(M,$e,Ye);H(r.TEXTURE_CUBE_MAP,M,Ye);let Xe;if(Te){Ve&&Ke&&t.texStorage2D(r.TEXTURE_CUBE_MAP,ot,xe,$e.width,$e.height);for(let oe=0;oe<6;oe++){Xe=j[oe].mipmaps;for(let L=0;L<Xe.length;L++){const ce=Xe[L];M.format!==Vt?De!==null?Ve?t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,L,0,0,ce.width,ce.height,De,ce.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,L,xe,ce.width,ce.height,0,ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ve?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,L,0,0,ce.width,ce.height,De,Ae,ce.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,L,xe,ce.width,ce.height,0,De,Ae,ce.data)}}}else{Xe=M.mipmaps,Ve&&Ke&&(Xe.length>0&&ot++,t.texStorage2D(r.TEXTURE_CUBE_MAP,ot,xe,j[0].width,j[0].height));for(let oe=0;oe<6;oe++)if(Fe){Ve?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,j[oe].width,j[oe].height,De,Ae,j[oe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,xe,j[oe].width,j[oe].height,0,De,Ae,j[oe].data);for(let L=0;L<Xe.length;L++){const he=Xe[L].image[oe].image;Ve?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,L+1,0,0,he.width,he.height,De,Ae,he.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,L+1,xe,he.width,he.height,0,De,Ae,he.data)}}else{Ve?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,0,0,De,Ae,j[oe]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,xe,De,Ae,j[oe]);for(let L=0;L<Xe.length;L++){const ce=Xe[L];Ve?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,L+1,0,0,De,Ae,ce.image[oe]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+oe,L+1,xe,De,Ae,ce.image[oe])}}}v(M,Ye)&&x(r.TEXTURE_CUBE_MAP),$.__version=Q.version,M.onUpdate&&M.onUpdate(M)}b.__version=M.version}function ge(b,M,O,ne,Q,$){const ye=s.convert(O.format,O.colorSpace),le=s.convert(O.type),_e=y(O.internalFormat,ye,le,O.colorSpace);if(!n.get(M).__hasExternalTextures){const Fe=Math.max(1,M.width>>$),j=Math.max(1,M.height>>$);Q===r.TEXTURE_3D||Q===r.TEXTURE_2D_ARRAY?t.texImage3D(Q,$,_e,Fe,j,M.depth,0,ye,le,null):t.texImage2D(Q,$,_e,Fe,j,0,ye,le,null)}t.bindFramebuffer(r.FRAMEBUFFER,b),X(M)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ne,Q,n.get(O).__webglTexture,0,se(M)):(Q===r.TEXTURE_2D||Q>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&Q<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,ne,Q,n.get(O).__webglTexture,$),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Pe(b,M,O){if(r.bindRenderbuffer(r.RENDERBUFFER,b),M.depthBuffer&&!M.stencilBuffer){let ne=o===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(O||X(M)){const Q=M.depthTexture;Q&&Q.isDepthTexture&&(Q.type===nn?ne=r.DEPTH_COMPONENT32F:Q.type===bn&&(ne=r.DEPTH_COMPONENT24));const $=se(M);X(M)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,$,ne,M.width,M.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,$,ne,M.width,M.height)}else r.renderbufferStorage(r.RENDERBUFFER,ne,M.width,M.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,b)}
vendor: 4,149 bytes, line 3686
3686else if(M.depthBuffer&&M.stencilBuffer){const ne=se(M);O&&X(M)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,ne,r.DEPTH24_STENCIL8,M.width,M.height):X(M)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,ne,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,b)}else{const ne=M.isWebGLMultipleRenderTargets===!0?M.texture:[M.texture];for(let Q=0;Q<ne.length;Q++){const $=ne[Q],ye=s.convert($.format,$.colorSpace),le=s.convert($.type),_e=y($.internalFormat,ye,le,$.colorSpace),Te=se(M);O&&X(M)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Te,_e,M.width,M.height):X(M)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Te,_e,M.width,M.height):r.renderbufferStorage(r.RENDERBUFFER,_e,M.width,M.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ne(b,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,b),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(M.depthTexture).__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),V(M.depthTexture,0);const ne=n.get(M.depthTexture).__webglTexture,Q=se(M);if(M.depthTexture.format===Hn)X(M)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,ne,0,Q):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,ne,0);else if(M.depthTexture.format===yi)X(M)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,ne,0,Q):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,ne,0);else throw new Error("Unknown depthTexture format")}function Se(b){const M=n.get(b),O=b.isWebGLCubeRenderTarget===!0;if(b.depthTexture&&!M.__autoAllocateDepthBuffer){if(O)throw new Error("target.depthTexture not supported in Cube render targets");Ne(M.__webglFramebuffer,b)}else if(O){M.__webglDepthbuffer=[];for(let ne=0;ne<6;ne++)t.bindFramebuffer(r.FRAMEBUFFER,M.__webglFramebuffer[ne]),M.__webglDepthbuffer[ne]=r.createRenderbuffer(),Pe(M.__webglDepthbuffer[ne],b,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer=r.createRenderbuffer(),Pe(M.__webglDepthbuffer,b,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function Ue(b,M,O){const ne=n.get(b);M!==void 0&&ge(ne.__webglFramebuffer,b,b.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),O!==void 0&&Se(b)}function P(b){const M=b.texture,O=n.get(b),ne=n.get(M);b.addEventListener("dispose",U),b.isWebGLMultipleRenderTargets!==!0&&(ne.__webglTexture===void 0&&(ne.__webglTexture=r.createTexture()),ne.__version=M.version,a.memory.textures++);const Q=b.isWebGLCubeRenderTarget===!0,$=b.isWebGLMultipleRenderTargets===!0,ye=g(b)||o;if(Q){O.__webglFramebuffer=[];for(let le=0;le<6;le++)if(o&&M.mipmaps&&M.mipmaps.length>0){O.__webglFramebuffer[le]=[];for(let _e=0;_e<M.mipmaps.length;_e++)O.__webglFramebuffer[le][_e]=r.createFramebuffer()}else O.__webglFramebuffer[le]=r.createFramebuffer()}else{if(o&&M.mipmaps&&M.mipmaps.length>0){O.__webglFramebuffer=[];for(let le=0;le<M.mipmaps.length;le++)O.__webglFramebuffer[le]=r.createFramebuffer()}else O.__webglFramebuffer=r.createFramebuffer();if($)if(i.drawBuffers){const le=b.texture;for(let _e=0,Te=le.length;_e<Te;_e++){const Fe=n.get(le[_e]);Fe.__webglTexture===void 0&&(Fe.__webglTexture=r.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&b.samples>0&&X(b)===!1){const le=$?M:[M];O.__webglMultisampledFramebuffer=r.createFramebuffer(),O.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let _e=0;_e<le.length;_e++){const Te=le[_e];O.__webglColorRenderbuffer[_e]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,O.__webglColorRen
3686derbuffer[_e]);const Fe=s.convert(Te.format,Te.colorSpace),j=s.convert(Te.type),$e=y(Te.internalFormat,Fe,j,Te.colorSpace,b.isXRRenderTarget===!0),Ye=se(b);r.renderbufferStorageMultisample(r.RENDERBUFFER,Ye,$e,b.width,b.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+_e,r.RENDERBUFFER,O.__webglColorRenderbuffer[_e])}r.bindRenderbuffer(r.RENDERBUFFER,null),b.depthBuffer&&(O.__webglDepthRenderbuffer=r.createRenderbuffer(),Pe(O.__webglDepthRenderbuffer,b,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(Q){t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture),H(r.TEXTURE_CUBE_MAP,M,ye);for(let le=0;le<6;le++)if(o&&M.mipmaps&&M.mipmaps.length>0)for(let _e=0;_e<M.mipmaps.length;_e++)ge(O.__webglFramebuffer[le][_e],b,M,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+le,_e);else ge(O.__webglFramebuffer[le],b,M,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+le,0);v(M,ye)&&x(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if($){const le=b.texture;for(let _e=0,Te=le.length;_e<Te;_e++){const Fe=le[_e],j=n.get(Fe);t.bindTexture(r.TEXTURE_2D,j.__webglTexture),H(r.TEXTURE_2D,Fe,ye),ge(O.__webglFramebuffer,b,Fe,r.COLOR_ATTACHMENT0+_e,r.TEXTURE_2D,0),v(Fe,ye)&&x(r.TEXTURE_2D)}t.unbindTexture()}else{let le=r.TEXTURE_2D;if((b.isWebGL3DRenderTarget||b.isWebGLArrayRenderTarget)&&(o?le=b.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(le,ne.__webglTexture),H(le,M,ye),o&&M.mipmaps&&M.mipmaps.length>0)for(let _e=0;_e<M.mipmaps.length;_e++)ge(O.__webglFramebuffer[_e],b,M,r.COLOR_ATTACHMENT0,le,_e);else ge(O.__webglFramebuffer,b,M,r.COLOR_ATTACHMENT0,le,0);v(M,ye)&&x(le),t.unbindTexture()}b.depthBuffer&&Se(b)}function re(b){const M=g(b)||o,O=b.isWebGLMultipleRenderTargets===!0?b.texture:[b.texture];for(let ne=0,Q=O.length;ne<Q;ne++){const $=O[ne];if(v($,M)){const ye=b.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,le=n.get($).__webglTexture;t.bindTexture(ye,le),x(ye),t.unbindTexture()}}}function q(b){if(o&&b.samples>0&&X(b)===!1){const M=b.isWebGLMultipleRenderTargets?b.texture:[b.texture],O=b.width,ne=b.height;let Q=r.COLOR_BUFFER_BIT;const $=[],ye=b.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,le=n.get(b),_e=b.isWebGLMultipleRenderTargets===!0;if(_e)for(let Te=0;Te<M.length;Te++)t.bindFramebuffer(r.FRAMEBUFFER,le.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Te,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,le.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Te,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,le.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,le.__webglFramebuffer);for(let Te=0;Te<M.length;Te++){$.push(r.COLOR_ATTACHMENT0+Te),b.depthBuffer&&$.push(ye);const Fe=le.__ignoreDepthValues!==void 0?le.__ignoreDepthValues:!1;if(Fe===!1&&(b.depthBuffer&&(Q|=r.DEPTH_BUFFER_BIT),b.stencilBuffer&&(Q|=r.STENCIL_BUFFER_BIT)),_e&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,le.__webglColorRenderbuffer[Te]),Fe===!0&&(r.invali
3686dateFramebuffer(r.READ_FRAMEBUFFER,[ye]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[ye])),_e){const j=n.get(M[Te]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,j,0)}r.blitFramebuffer(0,0,O,ne,0,0,O,ne,Q,r.NEAREST),c&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,$)}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),_e)for(let Te=0;Te<M.length;Te++){t.bindFramebuffer(r.FRAMEBUFFER,le.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Te,r.RENDERBUFFER,le.__webglColorRenderbuffer[Te]);const Fe=n.get(M[Te]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,le.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Te,r.TEXTURE_2D,Fe,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,le.__webglMultisampledFramebuffer)}}function se(b){return Math.min(i.maxSamples,b.samples)}function X(b){const M=n.get(b);return o&&b.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Ee(b){const M=a.render.frame;h.get(b)!==M&&(h.set(b,M),b.update())}function fe(b,M){const O=b.colorSpace,ne=b.format,Q=b.type;return b.isCompressedTexture===!0||b.isVideoTexture===!0||b.format===la||O!==dn&&O!==Zt&&(Qe.getTransfer(O)===st?o===!1?e.has("EXT_sRGB")===!0&&ne===Vt?(b.format=la,b.minFilter=pt,b.generateMipmaps=!1):M=Ll.sRGBToLinear(M):(ne!==Vt||Q!==wn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",O)),M}this.allocateTextureUnit=I,this.resetTextureUnits=ie,this.setTexture2D=V,this.setTexture2DArray=J,this.setTexture3D=Y,this.setTextureCube=W,this.rebindTextures=Ue,this.setupRenderTarget=P,this.updateRenderTargetMipmap=re,this.updateMultisampleRenderTarget=q,this.setupDepthRenderbuffer=Se,this.setupFrameBufferTexture=ge,this.useMultisampledRTT=X}function td(r,e,t){const n=t.isWebGL2;function i(s,a=Zt){let o;const l=Qe.getTransfer(a);if(s===wn)return r.UNSIGNED_BYTE;if(s===Ml)return r.UNSIGNED_SHORT_4_4_4_4;if(s===Sl)return r.UNSIGNED_SHORT_5_5_5_1;if(s===yu)return r.BYTE;if(s===Mu)return r.SHORT;if(s===fa)return r.UNSIGNED_SHORT;if(s===yl)return r.INT;if(s===bn)return r.UNSIGNED_INT;if(s===nn)return r.FLOAT;if(s===ji)return n?r.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===Su)return r.ALPHA;if(s===Vt)return r.RGBA;if(s===bu)return r.LUMINANCE;if(s===Eu)return r.LUMINANCE_ALPHA;if(s===Hn)return r.DEPTH_COMPONENT;if(s===yi)return r.DEPTH_STENCIL;if(s===la)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===Au)return r.RED;if(s===bl)return r.RED_INTEGER;if(s===Tu)return r.RG;if(s===El)return r.RG_INTEGER;if(s===Al)return r.RGBA_INTEGER;if(s===Qr||s===jr||s===ea||s===ta)if(l===st)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===Qr)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===jr)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===ea)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===ta)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===Qr)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===jr)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ea)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===ta)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Oo||s===Fo||s===Bo||s===zo)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===Oo)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Fo)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Bo)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===zo)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Tl)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===ko||s===Vo)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===ko)return l===st?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===Vo)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Ho||s===Go||s===Wo||s===Xo||s===qo||s===Yo||s===Zo||s===Jo||s===$o||s===Ko||s===Qo||s===jo||s===el||s===tl)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===Ho)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Go)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Wo)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Xo)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===qo)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Yo)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Zo)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Jo)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===$o)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Ko)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Qo)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===jo)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===el)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===tl)return l===st?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===na||s===nl||s===il)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===na)return l===st?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===nl)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===il)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===wu||s===sl||s===rl||s===al)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(s===na)return o.COMPRESSED_RED_RGT
vendor: 22,791 bytes, line 3686
3686C1_EXT;if(s===sl)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===rl)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===al)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Vn?n?r.UNSIGNED_INT_24_8:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class nd extends Et{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class $i extends Je{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ax={type:"move"};class po{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new $i,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 $i,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new w,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new w),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new $i,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new w,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new w),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const g=t.getJointPose(_,n),p=this._getHandJoint(c,_);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,m=.005;c.inputState.pinching&&d>f+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(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));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(ax)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new $i;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class ox extends Ln{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,f=null,m=null;const _=t.getContextAttributes();let g=null,p=null;const v=[],x=[],y=new Z;let R=null;const T=new Et;T.layers.enable(1),T.viewport=new je;const C=new Et;C.layers.enable(2),C.viewport=new je;const U=[T,C],S=new nd;S.layers.enable(1),S.layers.enable(2);let E=null,N=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(H){let K=v[H];return K===void 0&&(K=new po,v[H]=K),K.getTargetRaySpace()},this.getControllerGrip=function(H){let K=v[H];return K===void 0&&(K=new po,v[H]=K),K.getGripSpace()},this.getHand=function(H){let K=v[H];return K===void 0&&(K=new po,v[H]=K),K.getHandSpace()};function G(H){const K=x.indexOf(H.inputSource);if(K===-1)return;const de=v[K];de!==void 0&&(de.update(H.inputSource,H.frame,c||a),de.dispatchEvent({type:H.type,data:H.inputSource}))}function ie(){i.removeEventListener("select",G),i.removeEventListener("selectstart",G),i.removeEventListener("selectend",G),i.removeEventListener("squeeze",G),i.removeEventListener("squeezestart",G),i.removeEventListener("squeezeend",G),i.removeEventListener("end",ie),i.removeEventListener("inputsourceschange",I);for(let H=0;H<v.length;H++){const K=x[H];K!==null&&(x[H]=null,v[H].disconnect(K))}E=null,N=null,e.setRenderTarget(g),f=null,d=null,u=null,i=null,p=null,ue.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(y.width,y.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(H){s=H,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(H){o=H,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(H){c=H},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(H){if(i=H,i!==null){if(g=e.getRenderTarget(),i.addEventListener("select",G),i.addEventListener("selectstart",G),i.addEventListener("selectend",G),i.addEventListener("squeeze",G),i.addEventListener("squeezestart",G),i.addEventListener("squeezeend",G),i.addEventListener("end",ie),i.addEventListener("inputsourceschange",I),_.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(y),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const K={antialias:i.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,K),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),p=new rn(f.framebufferWidth,f.framebufferHeight,{format:Vt,type:wn,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil})}else{let K=null,de=null,Me=null;_.depth&&(Me=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,K=_.stencil?yi:Hn,de=_.stencil?Vn:bn);const ge={colorFormat:t.RGBA8,depthFormat:Me,scaleFactor:s};u=new XRWebGLBinding(i,t),d=u.createProjectionLayer(ge),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),p=new rn(d.textureWidth,d.textureHeight,{format:Vt,type:wn,depthTexture:new Ol(d.textureWidth,d.textureHeight,de,void 0,void 0,void 0,void 0,void 0,void 0,K),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0});const Pe=e.properties.get(p);Pe.__ignoreDepthValues=d.ignoreDepthValues}p.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),ue.setContext(i),ue.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function I(H){for(let K=0;K<H.removed.length;K++){const de=H.removed[K],Me=x.indexOf(de);Me>=0&&(x[Me]=null,v[Me].disconnect(de))}for(let K=0;K<H.added.length;K++){const de=H.added[K];let Me=x.indexOf(de);if(Me===-1){for(let Pe=0;Pe<v.length;Pe++)if(Pe>=x.length){x.push(de),Me=Pe;break}else if(x[Pe]===null){x[Pe]=de,Me=Pe;break}if(Me===-1)break}const ge=v[Me];ge&&ge.connect(de)}}const F=new w,V=new w;function J(H,K,de){F.setFromMatrixPosition(K.matrixWorld),V.setFromMatrixPosition(de.matrixWorld);const Me=F.distanceTo(V),ge=K.projectionMatrix.elements,Pe=de.projectionMatrix.elements,Ne=ge[14]/(ge[10]-1),Se=ge[14]/(ge[10]+1),Ue=(ge[9]+1)/ge[5],P=(ge[9]-1)/ge[5],re=(ge[8]-1)/ge[0],q=(Pe[8]+1)/Pe[0],se=Ne*re,X=Ne*q,Ee=Me/(-re+q),fe=Ee*-re;K.matrixWorld.decompose(H.position,H.quaternion,H.scale),H.translateX(fe),H.translateZ(Ee),H.matrixWorld.compose(H.position,H.quaternion,H.scale),H.matrixWorldInverse.copy(H.matrixWorld).invert();const b=Ne+Ee,M=Se+Ee,O=se-fe,ne=X+(Me-fe),Q=Ue*Se/M*b,$=P*Se/M*b;H.projectionMatrix.makePerspective(O,ne,Q,$,b,M),H.projectionMatrixInverse.copy(H.projectionMatrix).invert()}function Y(H,K){K===null?H.matrixWorld.copy(H.matrix):H.matrixWorld.multiplyMatrices(K.matrixWorld,H.matrix),H.matrixWorldInverse.copy(H.matrixWorld).invert()}this.updateCamera=function(H){if(i===null)return;S.near=C.near=T.near=H.near,S.far=C.far=T.far=H.far,(E!==S.near||N!==S.far)&&(i.updateRenderState({depthNear:S.near,depthFar:S.far}),E=S.near,N=S.far);const K=H.parent,de=S.cameras;Y(S,K);for(let Me=0;Me<de.length;Me++)Y(de[Me],K);de.length===2?J(S,T,C):S.projectionMatrix.copy(T.projectionMatrix),W(H,S,K)};function W(H,K,de){de===null?H.matrix.copy(K.matrixWorld):(H.matrix.copy(de.matrixWorld),H.matrix.invert(),H.matrix.multiply(K.matrixWorld)),H.matrix.decompose(H.position,H.quaternion,H.scale),H.updateMatrixWorld(!0),H.projectionMatrix.copy(K.projectionMatrix),H.projectionMatrixInverse.copy(K.projectionMatrixInverse),H.isPerspectiveCamera&&(H.fov=ts*2*Math.atan(1/H.projectionMatrix.elements[5]),H.zoom=1)}this.getCamera=function(){return S},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(H){l=H,d!==null&&(d.fixedFoveation=H),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=H)};let ee=null;function te(H,K){if(h=K.getViewerPose(c||a),m=K,h!==null){const de=h.views;f!==null&&(e.setRenderTargetFramebuffer(p,f.framebuffer),e.setRenderTarget(p));let Me=!1;de.length!==S.cameras.length&&(S.cameras.length=0,Me=!0);for(let ge=0;ge<de.length;ge++){const Pe=de[ge];let Ne=null;if(f!==null)Ne=f.getViewport(Pe);else{const Ue=u.getViewSubImage(d,Pe);Ne=Ue.viewport,ge===0&&(e.setRenderTargetTextures(p,Ue.colorTexture,d.ignoreDepthValues?void 0:Ue.depthStencilTexture),e.setRenderTarget(p))}let Se=U[ge];Se===void 0&&(Se=new Et,Se.layers.enable(ge),Se.viewport=new je,U[ge]=Se),Se.matrix.fromArray(Pe.transform.matrix),Se.matrix.decompose(Se.position,Se.quaternion,Se.scale),Se.projectionMatrix.fromArray(Pe.projectionMatrix),Se.projectionMatrixInverse.copy(Se.projectionMatrix).invert(),Se.viewport.set(Ne.x,Ne.y,Ne.width,Ne.height),ge===0&&(S.matrix.copy(Se.matrix),S.matrix.decompose(S.position,S.quaternion,S.scale)),Me===!0&&S.cameras.push(Se)}}for(let de=0;de<v.length;de++){const Me=x[de],ge=v[de];Me!==null&&ge!==void 0&&ge.update(Me,K,c||a)}ee&&ee(H,K),K.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:K}),m=null}const ue=new Ju;ue.setAnimationLoop(te),this.setAnimationLoop=function(H){ee=H},this.dispose=function(){}}}function lx(r,e){function t(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function n(g,p){p.color.getRGB(g.fogColor.value,Xu(r)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function i(g,p,v,x,y){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(g,p):p.isMeshToonMaterial?(s(g,p),u(g,p)):p.isMeshPhongMaterial?(s(g,p),h(g,p)):p.isMeshStandardMaterial?(s(g,p),d(g,p),p.isMeshPhysicalMaterial&&f(g,p,y)):p.isMeshMatcapMaterial?(s(g,p),m(g,p)):p.isMeshDepthMaterial?s(g,p):p.isMeshDistanceMaterial?(s(g,p),_(g,p)):p.isMeshNormalMaterial?s(g,p):p.isLineBasicMaterial?(a(g,p),p.isLineDashedMaterial&&o(g,p)):p.isPointsMaterial?l(g,p,v,x):p.isSpriteMaterial?c(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,t(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===Ot&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,t(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===Ot&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,t(p.displacementMap,g.displacementMapTransform),g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,t(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const v=e.get(p).envMap;if(v&&(g.envMap.value=v,g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap){g.lightMap.value=p.lightMap;const x=r._useLegacyLights===!0?Math.PI:1;g.lightMapIntensity.value=p.lightMapIntensity*x,t(p.lightMap,g.lightMapTransform)}p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,v,x){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*v,g.scale.value=x*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),e.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,v){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Ot&&g.clearcoatNormalScale.value.negate())),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const v=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function cx(r,e,t,n){let i={},s={},a=[];const o=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(v,x){const y=x.program;n.uniformBlockBinding(v,y)}function c(v,x){let y=i[v.id];y===void 0&&(m(v),y=h(v),i[v.id]=y,v.addEventListener("dispose",g));const R=x.program;n.updateUBOMapping(v,R);const T=e.render.frame;s[v.id]!==T&&(d(v),s[v.id]=T)}function h(v){const x=u();v.__bindingPointIndex=x;const y=r.createBuffer(),R=v.__size,T=v.usage;return r.bindBuffer(r.UNIFORM_BUFFER,y),r.bufferData(r.UNIFORM_BUFFER,R,T),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,x,y),y}function u(){for(let v=0;v<o;v++)if(a.indexOf(v)===-1)return a.push(v),v;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(v){const x=i[v.id],y=v.uniforms,R=v.__cache;r.bindBuffer(r.UNIFORM_BUFFER,x);for(let T=0,C=y.length;T<C;T++){const U=Array.isArray(y[T])?y[T]:[y[T]];for(let S=0,E=U.length;S<E;S++){const N=U[S];if(f(N,T,S,R)===!0){const G=N.__offset,ie=Array.isArray(N.value)?N.value:[N.value];let I=0;for(let F=0;F<ie.length;F++){const V=ie[F],J=_(V);typeof V=="number"||typeof V=="boolean"?(N.__data[0]=V,r.bufferSubData(r.UNIFORM_BUFFER,G+I,N.__data)):V.isMatrix3?(N.__data[0]=V.elements[0],N.__data[1]=V.elements[1],N.__data[2]=V.elements[2],N.__data[3]=0,N.__data[4]=V.elements[3],N.__data[5]=V.elements[4],N.__data[6]=V.elements[5],N.__data[7]=0,N.__data[8]=V.elements[6],N.__data[9]=V.elements[7],N.__data[10]=V.elements[8],N.__data[11]=0):(V.toArray(N.__data,I),I+=J.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,G,N.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(v,x,y,R){const T=v.value,C=x+"_"+y;if(R[C]===void 0)return typeof T=="number"||typeof T=="boolean"?R[C]=T:R[C]=T.clone(),!0;{const U=R[C];if(typeof T=="number"||typeof T=="boolean"){if(U!==T)return R[C]=T,!0}else if(U.equals(T)===!1)return U.copy(T),!0}return!1}function m(v){const x=v.uniforms;let y=0;const R=16;for(let C=0,U=x.length;C<U;C++){const S=Array.isArray(x[C])?x[C]:[x[C]];for(let E=0,N=S.length;E<N;E++){const G=S[E],ie=Array.isArray(G.value)?G.value:[G.value];for(let I=0,F=ie.length;I<F;I++){const V=ie[I],J=_(V),Y=y%R;Y!==0&&R-Y<J.boundary&&(y+=R-Y),G.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=y,y+=J.storage}}}const T=y%R;return T>0&&(y+=R-T),v.__size=y,v.__cache={},this}function _(v){const x={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(x.boundary=4,x.storage=4):v.isVector2?(x.boundary=8,x.storage=8):v.isVector3||v.isColor?(x.boundary=16,x.storage=12):v.isVector4?(x.boundary=16,x.storage=16):v.isMatrix3?(x.boundary=48,x.storage=48):v.isMatrix4?(x.boundary=64,x.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),x}function g(v){const x=v.target;x.removeEventListener("dispose",g);const y=a.indexOf(x.__bindingPointIndex);a.splice(y,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function p(){for(const v in i)r.deleteBuffer(i[v]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}class id{constructor(e={}){const{canvas:t=Hu(),context:n=null,depth:i=!0,stencil:s=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let d;n!==null?d=n.getContextAttributes().alpha:d=a;const f=new Uint32Array(4),m=new Int32Array(4);let _=null,g=null;const p=[],v=[];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=_t,this._useLegacyLights=!1,this.toneMapping=Tn,this.toneMappingExposure=1;const x=this;let y=!1,R=0,T=0,C=null,U=-1,S=null;const E=new je,N=new je;let G=null;const ie=new pe(0);let I=0,F=t.width,V=t.height,J=1,Y=null,W=null;const ee=new je(0,0,F,V),te=new je(0,0,F,V);let ue=!1;const H=new Qs;let K=!1,de=!1,Me=null;const ge=new Re,Pe=new Z,Ne=new w,Se={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ue(){return C===null?J:1}let P=n;function re(A,D){for(let z=0;z<A.length;z++){const k=A[z],B=t.getContext(k,D);if(B!==null)return B}return null}try{const A={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ua}`),t.addEventListener("webglcontextlost",oe,!1),t.addEventListener("webglcontextrestored",L,!1),t.addEventListener("webglcontextcreationerror",ce,!1),P===null){const D=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&D.shift(),P=re(D,A),P===null)throw re(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&P instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated 
3686in r153 and will be removed in r163."),P.getShaderPrecisionFormat===void 0&&(P.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(A){throw console.error("THREE.WebGLRenderer: "+A.message),A}let q,se,X,Ee,fe,b,M,O,ne,Q,$,ye,le,_e,Te,Fe,j,$e,Ye,De,Ae,xe,Ve,Ke;function ot(){q=new b_(P),se=new __(P,q,e),q.init(se),xe=new td(P,q,se),X=new sx(P,q,se),Ee=new T_(P),fe=new q0,b=new rx(P,q,X,fe,se,xe,Ee),M=new v_(x),O=new S_(x),ne=new Dp(P,se),Ve=new m_(P,q,ne,se),Q=new E_(P,ne,Ee,Ve),$=new P_(P,Q,ne,Ee),Ye=new R_(P,se,b),Fe=new x_(fe),ye=new X0(x,M,O,q,se,Ve,Fe),le=new lx(x,fe),_e=new Z0,Te=new ex(q,se),$e=new p_(x,M,O,X,$,d,l),j=new ix(x,$,se),Ke=new cx(P,Ee,se,X),De=new g_(P,q,Ee,se),Ae=new A_(P,q,Ee,se),Ee.programs=ye.programs,x.capabilities=se,x.extensions=q,x.properties=fe,x.renderLists=_e,x.shadowMap=j,x.state=X,x.info=Ee}ot();const Xe=new ox(x,P);this.xr=Xe,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const A=q.get("WEBGL_lose_context");A&&A.loseContext()},this.forceContextRestore=function(){const A=q.get("WEBGL_lose_context");A&&A.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(A){A!==void 0&&(J=A,this.setSize(F,V,!1))},this.getSize=function(A){return A.set(F,V)},this.setSize=function(A,D,z=!0){if(Xe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}F=A,V=D,t.width=Math.floor(A*J),t.height=Math.floor(D*J),z===!0&&(t.style.width=A+"px",t.style.height=D+"px"),this.setViewport(0,0,A,D)},this.getDrawingBufferSize=function(A){return A.set(F*J,V*J).floor()},this.setDrawingBufferSize=function(A,D,z){F=A,V=D,J=z,t.width=Math.floor(A*z),t.height=Math.floor(D*z),this.setViewport(0,0,A,D)},this.getCurrentViewport=function(A){return A.copy(E)},this.getViewport=function(A){return A.copy(ee)},this.setViewport=function(A,D,z,k){A.isVector4?ee.set(A.x,A.y,A.z,A.w):ee.set(A,D,z,k),X.viewport(E.copy(ee).multiplyScalar(J).floor())},this.getScissor=function(A){return A.copy(te)},this.setScissor=function(A,D,z,k){A.isVector4?te.set(A.x,A.y,A.z,A.w):te.set(A,D,z,k),X.scissor(N.copy(te).multiplyScalar(J).floor())},this.getScissorTest=function(){return ue},this.setScissorTest=function(A){X.setScissorTest(ue=A)},this.setOpaqueSort=function(A){Y=A},this.setTransparentSort=function(A){W=A},this.getClearColor=function(A){return A.copy($e.getClearColor())},this.setClearColor=function(){$e.setClearColor.apply($e,arguments)},this.getClearAlpha=function(){return $e.getClearAlpha()},this.setClearAlpha=function(){$e.setClearAlpha.apply($e,arguments)},this.clear=function(A=!0,D=!0,z=!0){let k=0;if(A){let B=!1;if(C!==null){const me=C.texture.format;B=me===Al||me===El||me===bl}if(B){const me=C.texture.type,be=me===wn||me===bn||me===fa||me===Vn||me===Ml||me===Sl,Ce=$e.getClearColor(),Ie=$e.getClearAlpha(),We=Ce.r,Oe=Ce.g,Be=Ce.b;be?(f[0]=We,f[1]=Oe,f[2]=Be,f[3]=Ie,P.clearBufferuiv(P.COLOR,0,f)):(m[0]=We,m[1]=Oe,m[2]=Be,m[3]=Ie,P.clearBufferiv(P.COLOR,0,m))}else k|=P.COLOR_BUFFER_BIT}D&&(k|=P.DEPTH_BUFFER_BIT),z&&(k|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(k)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",oe,!1),t.removeEventListener("webglcontextrestored",L,!1),t.removeEventListener("webglcontextcreationerror",ce,!1),_e.dispose(),Te.dispose(),fe.dispose(),M.dispose(),O.dispose(),$.dispose(),Ve.dispose(),Ke.dispose(),ye.dispose(),Xe.dis
vendor: 1,699 bytes, line 3686
3686pose(),Xe.removeEventListener("sessionstart",It),Xe.removeEventListener("sessionend",it),Me&&(Me.dispose(),Me=null),Ut.stop()};function oe(A){A.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function L(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const A=Ee.autoReset,D=j.enabled,z=j.autoUpdate,k=j.needsUpdate,B=j.type;ot(),Ee.autoReset=A,j.enabled=D,j.autoUpdate=z,j.needsUpdate=k,j.type=B}function ce(A){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",A.statusMessage)}function he(A){const D=A.target;D.removeEventListener("dispose",he),Le(D)}function Le(A){we(A),fe.remove(A)}function we(A){const D=fe.get(A).programs;D!==void 0&&(D.forEach(function(z){ye.releaseProgram(z)}),A.isShaderMaterial&&ye.releaseShaderCache(A))}this.renderBufferDirect=function(A,D,z,k,B,me){D===null&&(D=Se);const be=B.isMesh&&B.matrixWorld.determinant()<0,Ce=tf(A,D,z,k,B);X.setMaterial(k,be);let Ie=z.index,We=1;if(k.wireframe===!0){if(Ie=Q.getWireframeAttribute(z),Ie===void 0)return;We=2}const Oe=z.drawRange,Be=z.attributes.position;let ut=Oe.start*We,Xt=(Oe.start+Oe.count)*We;me!==null&&(ut=Math.max(ut,me.start*We),Xt=Math.min(Xt,(me.start+me.count)*We)),Ie!==null?(ut=Math.max(ut,0),Xt=Math.min(Xt,Ie.count)):Be!=null&&(ut=Math.max(ut,0),Xt=Math.min(Xt,Be.count));const St=Xt-ut;if(St<0||St===1/0)return;Ve.setup(B,k,Ce,z,Ie);let mn,rt=De;if(Ie!==null&&(mn=ne.get(Ie),rt=Ae,rt.setIndex(mn)),B.isMesh)k.wireframe===!0?(X.setLineWidth(k.wireframeLinewidth*Ue()),rt.setMode(P.LINES)):rt.setMode(P.TRIANGLES);else if(B.isLine){let qe=k.linewidth;qe===void 0&&(qe=1),X.setLineWidth(qe*Ue()),B.isLineSegments?rt.setMode(P.LINES):B.isLine
vendor: 64,979 bytes, line 3686
3686Loop?rt.setMode(P.LINE_LOOP):rt.setMode(P.LINE_STRIP)}else B.isPoints?rt.setMode(P.POINTS):B.isSprite&&rt.setMode(P.TRIANGLES);if(B.isBatchedMesh)rt.renderMultiDraw(B._multiDrawStarts,B._multiDrawCounts,B._multiDrawCount);else if(B.isInstancedMesh)rt.renderInstances(ut,St,B.count);else if(z.isInstancedBufferGeometry){const qe=z._maxInstanceCount!==void 0?z._maxInstanceCount:1/0,Va=Math.min(z.instanceCount,qe);rt.renderInstances(ut,St,Va)}else rt.render(ut,St)};function tt(A,D,z){A.transparent===!0&&A.side===hn&&A.forceSinglePass===!1?(A.side=Ot,A.needsUpdate=!0,rr(A,D,z),A.side=Cn,A.needsUpdate=!0,rr(A,D,z),A.side=hn):rr(A,D,z)}this.compile=function(A,D,z=null){z===null&&(z=A),g=Te.get(z),g.init(),v.push(g),z.traverseVisible(function(B){B.isLight&&B.layers.test(D.layers)&&(g.pushLight(B),B.castShadow&&g.pushShadow(B))}),A!==z&&A.traverseVisible(function(B){B.isLight&&B.layers.test(D.layers)&&(g.pushLight(B),B.castShadow&&g.pushShadow(B))}),g.setupLights(x._useLegacyLights);const k=new Set;return A.traverse(function(B){const me=B.material;if(me)if(Array.isArray(me))for(let be=0;be<me.length;be++){const Ce=me[be];tt(Ce,z,B),k.add(Ce)}else tt(me,z,B),k.add(me)}),v.pop(),g=null,k},this.compileAsync=function(A,D,z=null){const k=this.compile(A,D,z);return new Promise(B=>{function me(){if(k.forEach(function(be){fe.get(be).currentProgram.isReady()&&k.delete(be)}),k.size===0){B(A);return}setTimeout(me,10)}q.get("KHR_parallel_shader_compile")!==null?me():setTimeout(me,10)})};let nt=null;function Mt(A){nt&&nt(A)}function It(){Ut.stop()}function it(){Ut.start()}const Ut=new Ju;Ut.setAnimationLoop(Mt),typeof self<"u"&&Ut.setContext(self),this.setAnimationLoop=function(A){nt=A,Xe.setAnimationLoop(A),A===null?Ut.stop():Ut.start()},Xe.addEventListener("sessionstart",It),Xe.addEventListener("sessionend",it),this.render=function(A,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;A.matrixWorldAutoUpdate===!0&&A.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Xe.enabled===!0&&Xe.isPresenting===!0&&(Xe.cameraAutoUpdate===!0&&Xe.updateCamera(D),D=Xe.getCamera()),A.isScene===!0&&A.onBeforeRender(x,A,D,C),g=Te.get(A,v.length),g.init(),v.push(g),ge.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),H.setFromProjectionMatrix(ge),de=this.localClippingEnabled,K=Fe.init(this.clippingPlanes,de),_=_e.get(A,p.length),_.init(),p.push(_),ln(A,D,0,x.sortObjects),_.finish(),x.sortObjects===!0&&_.sort(Y,W),this.info.render.frame++,K===!0&&Fe.beginShadows();const z=g.state.shadowsArray;if(j.render(z,A,D),K===!0&&Fe.endShadows(),this.info.autoReset===!0&&this.info.reset(),$e.render(_,A),g.setupLights(x._useLegacyLights),D.isArrayCamera){const k=D.cameras;for(let B=0,me=k.length;B<me;B++){const be=k[B];sc(_,A,be,be.viewport)}}else sc(_,A,D);C!==null&&(b.updateMultisampleRenderTarget(C),b.updateRenderTargetMipmap(C)),A.isScene===!0&&A.onAfterRender(x,A,D),Ve.resetDefaultState(),U=-1,S=null,v.pop(),v.length>0?g=v[v.length-1]:g=null,p.pop(),p.length>0?_=p[p.length-1]:_=null};function ln(A,D,z,k){if(A.visible===!1)return;if(A.layers.test(D.layers)){if(A.isGroup)z=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(D);else if(A.isLight)g.pushLight(A),A.castShadow&&g.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||H.intersectsSprite(A)){k&&Ne.setFromMatrixPosition(A.matrixWorld).applyMatrix4(ge);const be=$.update(A),Ce=A.material;Ce.visible&&_.push(A,be,Ce,z,Ne.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(!A.frustumCulled||H.intersectsObject(A))){const be=$.update(A),Ce=A.material;if(k&&(A.boundingSphere!==void 0?(A.boundingSphere===null&&A.computeBoundingSphere(),Ne.copy(A.boundingSphere.center)):(be.boundingSphere===null&&be.computeBoundingSphere(),Ne.copy(be.boundingSphere.center)),Ne.applyMatrix4(A.matrixWorld).applyMatrix4(ge)),Array.isArray(Ce)){const Ie=be.groups;for(let We=0,Oe=Ie.length;We<Oe;We++){const Be=Ie[We],ut=Ce[Be.materialIndex];ut&&ut.visible&&_.push(A,be,ut,z,Ne.z,Be)}}else Ce.visible&&_.push(A,be,Ce,z,Ne.z,null)}}const me=A.children;for(let be=0,Ce=me.length;be<Ce;be++)ln(me[be],D,z,k)}function sc(A,D,z,k){const B=A.opaque,me=A.transmissive,be=A.transparent;g.setupLightsView(z),K===!0&&Fe.setGlobalState(x.clippingPlanes,z),me.length>0&&ef(B,me,D,z),k&&X.viewport(E.copy(k)),B.length>0&&sr(B,D,z),me.length>0&&sr(me,D,z),be.length>0&&sr(be,D,z),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function ef(A,D,z,k){if((z.isScene===!0?z.overrideMaterial:null)!==null)return;const me=se.isWebGL2;Me===null&&(Me=new rn(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?ji:wn,minFilter:Xn,samples:me?4:0})),x.getDrawingBufferSize(Pe),me?Me.setSize(Pe.x,Pe.y):Me.setSize(ca(Pe.x),ca(Pe.y));const be=x.getRenderTarget();x.setRenderTarget(Me),x.getClearColor(ie),I=x.getClearAlpha(),I<1&&x.setClearColor(16777215,.5),x.clear();const Ce=x.toneMapping;x.toneMapping=Tn,sr(A,z,k),b.updateMultisampleRenderTarget(Me),b.updateRenderTargetMipmap(Me);let Ie=!1;for(let We=0,Oe=D.length;We<Oe;We++){const Be=D[We],ut=Be.object,Xt=Be.geometry,St=Be.material,mn=Be.group;if(St.side===hn&&ut.layers.test(k.layers)){const rt=St.side;St.side=Ot,St.needsUpdate=!0,rc(ut,z,k,Xt,St,mn),St.side=rt,St.needsUpdate=!0,Ie=!0}}Ie===!0&&(b.updateMultisampleRenderTarget(Me),b.updateRenderTargetMipmap(Me)),x.setRenderTarget(be),x.setClearColor(ie,I),x.toneMapping=Ce}function sr(A,D,z){const k=D.isScene===!0?D.overrideMaterial:null;for(let B=0,me=A.length;B<me;B++){const be=A[B],Ce=be.object,Ie=be.geometry,We=k===null?be.material:k,Oe=be.group;Ce.layers.test(z.layers)&&rc(Ce,D,z,Ie,We,Oe)}}function rc(A,D,z,k,B,me){A.onBeforeRender(x,D,z,k,B,me),A.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,A.matrixWorld),A.normalMatrix.getNormalMatrix(A.modelViewMatrix),B.onBeforeRender(x,D,z,k,A,me),B.transparent===!0&&B.side===hn&&B.forceSinglePass===!1?(B.side=Ot,B.needsUpdate=!0,x.renderBufferDirect(z,D,k,B,A,me),B.side=Cn,B.needsUpdate=!0,x.renderBufferDirect(z,D,k,B,A,me),B.side=hn):x.renderBufferDirect(z,D,k,B,A,me),A.onAfterRender(x,D,z,k,B,me)}function rr(A,D,z){D.isScene!==!0&&(D=Se);const k=fe.get(A),B=g.state.lights,me=g.state.shadowsArray,be=B.state.version,Ce=ye.getParameters(A,B.state,me,D,z),Ie=ye.getProgramCacheKey(Ce);let We=k.programs;k.environment=A.isMeshStandardMaterial?D.environment:null,k.fog=D.fog,k.envMap=(A.isMeshStandardMaterial?O:M).get(A.envMap||k.environment),We===void 0&&(A.addEventListener("dispose",he),We=new Map,k.programs=We);let Oe=We.get(Ie);if(Oe!==void 0){if(k.currentProgram===Oe&&k.lightsStateVersion===be)return oc(A,Ce),Oe}else Ce.uniforms=ye.getUniforms(A),A.onBuild(z,Ce,x),A.onBeforeCompile(Ce,x),Oe=ye.acquireProgram(Ce,Ie),We.set(Ie,Oe),k.uniforms=Ce.uniforms;const Be=k.uniforms;return(!A.isShaderMaterial&&!A.isRawShaderMaterial||A.clipping===!0)&&(Be.clippingPlanes=Fe.uniform),oc(A,Ce),k.needsLights=sf(A),k.lightsStateVersion=be,k.needsLights&&(Be.ambientLightColor.value=B.state.ambient,Be.lightProbe.value=B.state.probe,Be.directionalLights.value=B.state.directional,Be.directionalLightShadows.value=B.state.directionalShadow,Be.spotLights.value=B.state.spot,Be.spotLightShadows.value=B.state.spotShadow,Be.rectAreaLights.value=B.state.rectArea,Be.ltc_1.value=B.state.rectAreaLTC1,Be.ltc_2.value=B.state.rectAreaLTC2,Be.pointLights.value=B.state.point,Be.pointLightShadows.value=B.state.pointShadow,Be.hemisphereLights.value=B.state.hemi,Be.directionalShadowMap.value=B.state.directionalShadowMap,Be.directionalShadowMatrix.value=B.state.directionalShadowMatrix,Be.spotShadowMap.value=B.state.spotShadowMap,Be.spotLightMatrix.value=B.state.spotLightMatrix,Be.spotLightMap.value=B.state.spotLightMap,Be.pointShadowMap.value=B.state.pointShadowMap,Be.pointShadowMatrix.value=B.state.pointShadowMatrix),k.currentProgram=Oe,k.uniformsList=null,Oe}function ac(A){if(A.uniformsList===null){const D=A.currentProgram.getUniforms();A.uniformsList=sa.seqWithValue(D.seq,A.uniforms)}return A.uniformsList}function oc(A,D){const z=fe.get(A);z.outputColorSpace=D.outputColorSpace,z.batching=D.batching,z.instancing=D.instancing,z.instancingColor=D.instancingColor,z.skinning=D.skinning,z.morphTargets=D.morphTargets,z.morphNormals=D.morphNormals,z.morphColors=D.morphColors,z.morphTargetsCount=D.morphTargetsCount,z.numClippingPlanes=D.numClippingPlanes,z.numIntersection=D.numClipIntersection,z.vertexAlphas=D.vertexAlphas,z.vertexTangents=D.vertexTangents,z.toneMapping=D.toneMapping}function tf(A,D,z,k,B){D.isScene!==!0&&(D=Se),b.resetTextureUnits();const me=D.fog,be=k.isMeshStandardMaterial?D.environment:null,Ce=C===null?x.outputColorSpace:C.isXRRenderTarget===!0?C.texture.colorSpace:dn,Ie=(k.isMeshStandardMaterial?O:M).get(k.envMap||be),We=k.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,Oe=!!z.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Be=!!z.morphAttributes.position,ut=!!z.morphAttributes.normal,Xt=!!z.morphAttributes.color;let St=Tn;k.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(St=x.toneMapping);const mn=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,rt=mn!==void 0?mn.length:0,qe=fe.get(k),Va=g.state.lights;if(K===!0&&(de===!0||A!==S)){const $t=A===S&&k.id===U;Fe.setState(k,A,$t)}let lt=!1;k.version===qe.__version?(qe.needsLights&&qe.lightsStateVersion!==Va.state.version||qe.outputColorSpace!==Ce||B.isBatchedMesh&&qe.batching===!1||!B.isBatchedMesh&&qe.batching===!0||B.isInstancedMesh&&qe.instancing===!1||!B.isInstancedMesh&&qe.instancing===!0||B.isSkinnedMesh&&qe.skinning===!1||!B.isSkinnedMesh&&qe.skinning===!0||B.isInstancedMesh&&qe.instancingColor===!0&&B.instanceColor===null||B.isInstancedMesh&&qe.instancingColor===!1&&B.instanceColor!==null||qe.envMap!==Ie||k.fog===!0&&qe.fog!==me||qe.numClippingPlanes!==void 0&&(qe.numClippingPlanes!==Fe.numPlanes||qe.numIntersection!==Fe.numIntersection)||qe.vertexAlphas!==We||qe.vertexTangents!==Oe||qe.morphTargets!==Be||qe.morphNormals!==ut||qe.morphColors!==Xt||qe.toneMapping!==St||se.isWebGL2===!0&&qe.morphTargetsCount!==rt)&&(lt=!0):(lt=!0,qe.__version=k.version);let Kn=qe.currentProgram;lt===!0&&(Kn=rr(k,D,B));let lc=!1,cs=!1,Ha=!1;const At=Kn.getUniforms(),Qn=qe.uniforms;if(X.useProgram(Kn.program)&&(lc=!0,cs=!0,Ha=!0),k.id!==U&&(U=k.id,cs=!0),lc||S!==A){At.setValue(P,"projectionMatrix",A.projectionMatrix),At.setValue(P,"viewMatrix",A.matrixWorldInverse);const $t=At.map.cameraPosition;$t!==void 0&&$t.setValue(P,Ne.setFromMatrixPosition(A.matrixWorld)),se.logarithmicDepthBuffer&&At.setValue(P,"logDepthBufFC",2/(Math.log(A.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&At.setValue(P,"isOrthographic",A.isOrthographicCamera===!0),S!==A&&(S=A,cs=!0,Ha=!0)}if(B.isSkinnedMesh){At.setOptional(P,B,"bindMatrix"),At.setOptional(P,B,"bindMatrixInverse");const $t=B.skeleton;$t&&(se.floatVertexTextures?($t.boneTexture===null&&$t.computeBoneTexture(),At.setValue(P,"boneTexture",$t.boneTexture,b)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}B.isBatchedMesh&&(At.setOptional(P,B,"batchingTexture"),At.setValue(P,"batchingTexture",B._matricesTexture,b));const Ga=z.morphAttributes;if((Ga.position!==void 0||Ga.normal!==void 0||Ga.color!==void 0&&se.isWebGL2===!0)&&Ye.update(B,z,Kn),(cs||qe.receiveShadow!==B.receiveShadow)&&(qe.receiveShadow=B.receiveShadow,At.setValue(P,"receiveShadow",B.receiveShadow)),k.isMeshGouraudMaterial&&k.envMap!==null&&(Qn.envMap.value=Ie,Qn.flipEnvMap.value=Ie.isCubeTexture&&Ie.isRenderTargetTexture===!1?-1:1),cs&&(At.setValue(P,"toneMappingExposure",x.toneMappingExposure),qe.needsLights&&nf(Qn,Ha),me&&k.fog===!0&&le.refreshFogUniforms(Qn,me),le.refreshMaterialUniforms(Qn,k,J,V,Me),sa.upload(P,ac(qe),Qn,b)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(sa.upload(P,ac(qe),Qn,b),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&At.setValue(P,"center",B.center),At.setValue(P,"modelViewMatrix",B.modelViewMatrix),At.setValue(P,"normalMatrix",B.normalMatrix),At.setValue(P,"modelMatrix",B.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const $t=k.uniformsGroups;for(let Wa=0,rf=$t.length;Wa<rf;Wa++)if(se.isWebGL2){const cc=$t[Wa];Ke.update(cc,Kn),Ke.bind(cc,Kn)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Kn}function nf(A,D){A.ambientLightColor.needsUpdate=D,A.lightProbe.needsUpdate=D,A.directionalLights.needsUpdate=D,A.directionalLightShadows.needsUpdate=D,A.pointLights.needsUpdate=D,A.pointLightShadows.needsUpdate=D,A.spotLights.needsUpdate=D,A.spotLightShadows.needsUpdate=D,A.rectAreaLights.needsUpdate=D,A.hemisphereLights.needsUpdate=D}function sf(A){return A.isMeshLambertMaterial||A.isMeshToonMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isShadowMaterial||A.isShaderMaterial&&A.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(A,D,z){fe.get(A.texture).__webglTexture=D,fe.get(A.depthTexture).__webglTexture=z;const k=fe.get(A);k.__hasExternalTextures=!0,k.__hasExternalTextures&&(k.__autoAllocateDepthBuffer=z===void 0,k.__autoAllocateDepthBuffer||q.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),k.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(A,D){const z=fe.get(A);z.__webglFramebuffer=D,z.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(A,D=0,z=0){C=A,R=D,T=z;let k=!0,B=null,me=!1,be=!1;if(A){const Ie=fe.get(A);Ie.__useDefaultFramebuffer!==void 0?(X.bindFramebuffer(P.FRAMEBUFFER,null),k=!1):Ie.__webglFramebuffer===void 0?b.setupRenderTarget(A):Ie.__hasExternalTextures&&b.rebindTextures(A,fe.get(A.texture).__webglTexture,fe.get(A.depthTexture).__webglTexture);const We=A.texture;(We.isData3DTexture||We.isDataArrayTexture||We.isCompressedArrayTexture)&&(be=!0);const Oe=fe.get(A).__webglFramebuffer;A.isWebGLCubeRenderTarget?(Array.isArray(Oe[D])?B=Oe[D][z]:B=Oe[D],me=!0):se.isWebGL2&&A.samples>0&&b.useMultisampledRTT(A)===!1?B=fe.get(A).__webglMultisampledFramebuffer:Array.isArray(Oe)?B=Oe[z]:B=Oe,E.copy(A.viewport),N.copy(A.scissor),G=A.scissorTest}else E.copy(ee).multiplyScalar(J).floor(),N.copy(te).multiplyScalar(J).floor(),G=ue;if(X.bindFramebuffer(P.FRAMEBUFFER,B)&&se.drawBuffers&&k&&X.drawBuffers(A,B),X.viewport(E),X.scissor(N),X.setScissorTest(G),me){const Ie=fe.get(A.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+D,Ie.__webglTexture,z)}else if(be){const Ie=fe.get(A.texture),We=D||0;P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,Ie.__webglTexture,z||0,We)}U=-1},this.readRenderTargetPixels=function(A,D,z,k,B,me,be){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ce=fe.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&be!==void 0&&(Ce=Ce[be]),Ce){X.bindFramebuffer(P.FRAMEBUFFER,Ce);try{const Ie=A.texture,We=Ie.format,Oe=Ie.type;if(We!==Vt&&xe.convert(We)!==P.getParameter(P.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Be=Oe===ji&&(q.has("EXT_color_buffer_half_float")||se.isWebGL2&&q.has("EXT_color_buffer_float"));if(Oe!==wn&&xe.convert(Oe)!==P.getParameter(P.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Oe===nn&&(se.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float")))&&!Be){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=A.width-k&&z>=0&&z<=A.height-B&&P.readPixels(D,z,k,B,xe.convert(We),xe.convert(Oe),me)}finally{const Ie=C!==null?fe.get(C).__webglFramebuffer:null;X.bindFramebuffer(P.FRAMEBUFFER,Ie)}}},this.copyFramebufferToTexture=function(A,D,z=0){const k=Math.pow(2,-z),B=Math.floor(D.image.width*k),me=Math.floor(D.image.height*k);b.setTexture2D(D,0),P.copyTexSubImage2D(P.TEXTURE_2D,z,0,0,A.x,A.y,B,me),X.unbindTexture()},this.copyTextureToTexture=function(A,D,z,k=0){const B=D.image.width,me=D.image.height,be=xe.convert(z.format),Ce=xe.convert(z.type);b.setTexture2D(z,0),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,z.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,z.unpackAlignment),D.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,k,A.x,A.y,B,me,be,Ce,D.image.data):D.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,k,A.x,A.y,D.mipmaps[0].width,D.mipmaps[0].height,be,D.mipmaps[0].data):P.texSubImage2D(P.TEXTURE_2D,k,A.x,A.y,be,Ce,D.image),k===0&&z.generateMipmaps&&P.generateMipmap(P.TEXTURE_2D),X.unbindTexture()},this.copyTextureToTexture3D=function(A,D,z,k,B=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const me=A.max.x-A.min.x+1,be=A.max.y-A.min.y+1,Ce=A.max.z-A.min.z+1,Ie=xe.convert(k.format),We=xe.convert(k.type);let Oe;if(k.isData3DTexture)b.setTexture3D(k,0),Oe=P.TEXTURE_3D;else if(k.isDataArrayTexture||k.isCompressedArrayTexture)b.setTexture2DArray(k,0),Oe=P.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,k.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,k.unpackAlignment);const Be=P.getParameter(P.UNPACK_ROW_LENGTH),ut=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Xt=P.getParameter(P.UNPACK_SKIP_PIXELS),St=P.getParameter(P.UNPACK_SKIP_ROWS),mn=P.getParameter(P.UNPACK_SKIP_IMAGES),rt=z.isCompressedTexture?z.mipmaps[B]:z.image;P.pixelStorei(P.UNPACK_ROW_LENGTH,rt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,rt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,A.min.x),P.pixelStorei(P.UNPACK_SKIP_ROWS,A.min.y),P.pixelStorei(P.UNPACK_SKIP_IMAGES,A.min.z),z.isDataTexture||z.isData3DTexture?P.texSubImage3D(Oe,B,D.x,D.y,D.z,me,be,Ce,Ie,We,rt.data):z.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),P.compressedTexSubImage3D(Oe,B,D.x,D.y,D.z,me,be,Ce,Ie,rt.data)):P.texSubImage3D(Oe,B,D.x,D.y,D.z,me,be,Ce,Ie,We,rt),P.pixelStorei(P.UNPACK_ROW_LENGTH,Be),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,ut),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Xt),P.pixelStorei(P.UNPACK_SKIP_ROWS,St),P.pixelStorei(P.UNPACK_SKIP_IMAGES,mn),B===0&&k.generateMipmaps&&P.generateMipmap(Oe),X.unbindTexture()},this.initTexture=function(A){A.isCubeTexture?b.setTextureCube(A,0):A.isData3DTexture?b.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?b.setTexture2DArray(A,0):b.setTexture2D(A,0),X.unbindTexture()},this.resetState=function(){R=0,T=0,C=null,X.reset(),Ve.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return sn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===ma?"display-p3":"srgb",t.unpackColorSpace=Qe.workingColorSpace===Js?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===_t?Gn:Cl}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Gn?_t:dn}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 sd extends id{}sd.prototype.isWebGL1Renderer=!0;class Ma{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new pe(e),this.density=t}clone(){return new Ma(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Sa{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new pe(e),this.near=t,this.far=n}clone(){return new Sa(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class rd extends Je{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 ba{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Bs,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Jt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Jt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Jt()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Dt=new w;class Mi{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Dt.fromBufferAttribute(this,t),Dt.applyMatrix4(e),this.setXYZ(t,Dt.x,Dt.y,Dt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Dt.fromBufferAttribute(this,t),Dt.applyNormalMatrix(e),this.setXYZ(t,Dt.x,Dt.y,Dt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Dt.fromBufferAttribute(this,t),Dt.transformDirection(e),this.setXYZ(t,Dt.x,Dt.y,Dt.z);return this}setX(e,t){return this.normalized&&(t=ke(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ke(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ke(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ke(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Ht(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Ht(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Ht(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Ht(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=ke(t,this.array),n=ke(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=ke(t,this.array),n=ke(n,this.array),i=ke(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=ke(t,this.array),n=ke(n,this.array),i=ke(i,this.array),s=ke(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new et(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Mi(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class zl extends Lt{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new pe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Vi;const ps=new w,Hi=new w,Gi=new w,Wi=new Z,ms=new Z,ad=new Re,Cr=new w,gs=new w,Rr=new w,Zc=new Z,mo=new Z,Jc=new Z;class od extends Je{constructor(e=new zl){if(super(),this.isSprite=!0,this.type="Sprite",Vi===void 0){Vi=new Ge;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new ba(t,5);Vi.setIndex([0,1,2,0,2,3]),Vi.setAttribute("position",new Mi(n,3,0,!1)),Vi.setAttribute("uv",new Mi(n,2,3,!1))}this.geometry=Vi,this.material=e,this.center=new Z(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Hi.setFromMatrixScale(this.matrixWorld),ad.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Gi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Hi.multiplyScalar(-Gi.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;Pr(Cr.set(-.5,-.5,0),Gi,a,Hi,i,s),Pr(gs.set(.5,-.5,0),Gi,a,Hi,i,s),Pr(Rr.set(.5,.5,0),Gi,a,Hi,i,s),Zc.set(0,0),mo.set(1,0),Jc.set(1,1);let o=e.ray.intersectTriangle(Cr,gs,Rr,!1,ps);if(o===null&&(Pr(gs.set(-.5,.5,0),Gi,a,Hi,i,s),mo.set(0,1),o=e.ray.intersectTriangle(Cr,Rr,gs,!1,ps),o===null))return;const l=e.ray.origin.distanceTo(ps);l<e.near||l>e.far||t.push({distance:l,point:ps.clone(),uv:kt.getInterpolation(ps,Cr,gs,Rr,Zc,mo,Jc,new Z),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Pr(r,e,t,n,i,s){Wi.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(ms.x=s*Wi.x-i*Wi.y,ms.y=i*Wi.x+s*Wi.y):ms.copy(Wi),r.copy(e),r.x+=ms.x,r.y+=ms.y,r.applyMatrix4(ad)}const Lr=new w,$c=new w;class ld extends Je{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Lr.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Lr);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Lr.setFromMatrixPosition(e.matrixWorld),$c.setFromMatrixPosition(this.matrixWorld);const n=Lr.distanceTo($c)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let a=t[i].distance;if(t[i].object.visible&&(a-=a*t[i].hysteresis),n>=a)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const Kc=new w,Qc=new je,jc=new je,hx=new w,eh=new Re,Ir=new w,go=new Pt,th=new Re,_o=new rs;class cd extends xt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=No,this.bindMatrix=new Re,this.bindMatrixInverse=new Re,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ft),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ir),this.boundingBox.expandByPoint(Ir)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Pt),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ir),this.boundingSphere.expandByPoint(Ir)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),go.copy(this.boundingSphere),go.applyMatrix4(i),e.ray.intersectsSphere(go)!==!1&&(th.copy(i).invert(),_o.copy(e.ray).applyMatrix4(th),!(this.boundingBox!==null&&_o.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,_o)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new je,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===No?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===vu?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Qc.fromBufferAttribute(i.attributes.skinIndex,e),jc.fromBufferAttribute(i.attributes.skinWeight,e),Kc.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=jc.getComponent(s);if(a!==0){const o=Qc.getComponent(s);eh.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(hx.copy(Kc).applyMatrix4(eh),a)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}class kl extends Je{constructor(){super(),this.isBone=!0,this.type="Bone"}}class xi extends mt{constructor(e=null,t=1,n=1,i,s,a,o,l,c=ft,h=ft,u,d){super(null,a,o,l,c,h,i,s,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const nh=new Re,ux=new Re;class Ea{constructor(e=[],t=[]){this.uuid=Jt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Re)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Re;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:ux;nh.multiplyMatrices(o,t[s]),nh.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Ea(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new xi(t,e,e,Vt,nn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new kl),this.bones.push(a),this.boneInverses.push(new Re().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class is extends et{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Xi=new Re,ih=new Re,Ur=[],sh=new Ft,dx=new Re,_s=new xt,xs=new Pt;class hd extends xt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new is(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,dx)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ft),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Xi),sh.copy(e.boundingBox).applyMatrix4(Xi),this.boundingBox.union(sh)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Pt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Xi),xs.copy(e.boundingSphere).applyMatrix4(Xi),this.boundingSphere.union(xs)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(_s.geometry=this.geometry,_s.material=this.material,_s.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),xs.copy(this.boundingSphere),xs.applyMatrix4(n),e.ray.intersectsSphere(xs)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Xi),ih.multiplyMatrices(n,Xi),_s.matrixWorld=ih,_s.raycast(e,Ur);for(let a=0,o=Ur.length;a<o;a++){const l=Ur[a];l.instanceId=s,l.object=this,t.push(l)}Ur.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new is(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}function fx(r,e){return r.z-e.z}function px(r,e){return e.z-r.z}class mx{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t){const n=this.pool,i=this.list;this.index>=n.length&&n.push({start:-1,count:-1,z:-1});const s=n[this.index];i.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=t}reset(){this.list.length=0,this.index=0}}const qi="batchId",Fn=new Re,rh=new Re,gx=new Re,ah=new Re,xo=new Qs,Dr=new Ft,ii=new Pt,vs=new w,vo=new mx,Ct=new xt,Nr=[];function _x(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let a=0;a<n;a++)e.setComponent(s+t,a,r.getComponent(s,a))}else e.array.set(r.array,t*n);e.needsUpdate=!0}class ud extends xt{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,t,n=t*2,i){super(new Ge,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxGeometryCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new xi(t,e,e,Vt,nn);this._matricesTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxGeometryCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(const o in e.attributes){const l=e.getAttribute(o),{array:c,itemSize:h,normalized:u}=l,d=new c.constructor(n*h),f=new l.constructor(d,h,u);f.setUsage(l.usage),t.setAttribute(o,f)}if(e.getIndex()!==null){const o=n>65536?new Uint32Array(s):new Uint16Array(s);t.setIndex(new et(o,1))}const a=i>65536?new Uint32Array(n):new Uint16Array(n);t.setAttribute(qi,new et(a,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(qi))throw new Error(`BatchedMesh: Geometry cannot use attribute "${qi}"`);const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(n===qi)continue;if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ft);const e=this._geometryCount,t=this.boundingBox,n=this._active;t.makeEmpty();for(let i=0;i<e;i++)n[i]!==!1&&(this.getMatrixAt(i,Fn),this.getBoundingBoxAt(i,Dr).applyMatrix4(Fn),t.union(Dr))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Pt);const e=this._geometryCount,t=this.boundingSphere,n=this._active;t.makeEmpty();for(let i=0;i<e;i++)n[i]!==!1&&(this.getMatrixAt(i,Fn),this.getBoundingSphereAt(i,ii).applyMatrix4(Fn),t.union(ii))}addGeometry(e,t=-1,n=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const a=this._reservedRanges,o=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=a[a.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),h=c!==null;if(h&&(n===-1?i.indexCount=c.count:i.indexCount=n,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const u=this._visibility,d=this._active,f=this._matricesTexture,m=this._matricesTexture.image.data;u.push(!0),d.push(!0);const _=this._geometryCount;this._geometryCount++,gx.toArray(m,_*16),f.needsUpdate=!0,a.push(i),o.push({start:h?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Ft,sphereInitialized:!1,sphere:new Pt});const g=this.geometry.getAttribute(qi);for(let p=0;p<i.vertexCount;p++)g.setX(i.vertexStart+p,_);return g.needsUpdate=!0,this.setGeometryAt(_,e),_}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),o=this._reservedRanges[e];if(i&&a.count>o.indexCount||t.attributes.position.count>o.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.vertexCount;for(const f in n.attributes){if(f===qi)continue;const m=t.getAttribute(f),_=n.getAttribute(f);_x(m,_,l);const g=m.itemSize;for(let p=m.count,v=c;p<v;p++){const x=l+p;for(let y=0;y<g;y++)_.setComponent(x,y,0)}_.needsUpdate=!0}if(i){const f=o.indexStart;for(let m=0;m<a.count;m++)s.setX(f+m,l+a.getX(m));for(let m=a.count,_=o.indexCount;m<_;m++)s.setX(f+m,l);s.needsUpdate=!0}const h=this._bounds[e];t.boundingBox!==null?(h.box.copy(t.boundingBox),h.boxInitialized=!0):h.boxInitialized=!1,t.boundingSphere!==null?(h.sphere.copy(t.boundingSphere),h.sphereInitialized=!0):h.sphereInitialized=!1;const u=this._drawRanges[e],d=t.getAttribute("position");return u.count=i?a.count:d.count,this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._active;return e>=t.length||t[e]===!1?this:(t[e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(this._active[e]===!1)return this;const i=this._bounds[e],s=i.box,a=this.geometry;if(i.boxInitialized===!1){s.makeEmpty();const o=a.index,l=a.attributes.position,c=this._drawRanges[e];for(let h=c.start,u=c.start+c.count;h<u;h++){let d=h;o&&(d=o.getX(d)),s.expandByPoint(vs.fromBufferAttribute(l,d))}i.boxInitialized=!0}return t.copy(s),t}getBoundingSphereAt(e,t){if(this._active[e]===!1)return this;const i=this._bounds[e],s=i.sphere,a=this.geometry;if(i.sphereInitialized===!1){s.makeEmpty(),this.getBoundingBoxAt(e,Dr),Dr.getCenter(s.center);const o=a.index,l=a.attributes.position,c=this._drawRanges[e];let h=0;for(let u=c.start,d=c.start+c.count;u<d;u++){let f=u;o&&(f=o.getX(f)),vs.fromBufferAttribute(l,f),h=Math.max(h,s.center.distanceToSquared(vs))}s.radius=Math.sqrt(h),i.sphereInitialized=!0}return t.copy(s),t}setMatrixAt(e,t){const n=this._active,i=this._matricesTexture,s=this._matricesTexture.image.data,a=this._geometryCount;return e>=a||n[e]===!1?this:(t.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._active,i=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||n[e]===!1?null:t.fromArray(i,e*16)}setVisibleAt(e,t){const n=this._visibility,i=this._active,s=this._geometryCount;return e>=s||i[e]===!1||n[e]===t?this:(n[e]=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._visibility,n=this._active,i=this._geometryCount;return e>=i||n[e]===!1?!1:t[e]}raycast(e,t){const n=this._visibility,i=this._active,s=this._drawRanges,a=this._geometryCount,o=this.matrixWorld,l=this.geometry;Ct.material=this.material,Ct.geometry.index=l.index,Ct.geometry.attributes=l.attributes,Ct.geometry.boundingBox===null&&(Ct.geometry.boundingBox=new Ft),Ct.geometry.boundingSphere===null&&(Ct.geometry.boundingSphere=new Pt);for(let c=0;c<a;c++){if(!n[c]||!i[c])continue;const h=s[c];Ct.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(c,Ct.matrixWorld).premultiply(o),this.getBoundingBoxAt(c,Ct.geometry.boundingBox),this.getBoundingSphereAt(c,Ct.geometry.boundingSphere),Ct.raycast(e,Nr);for(let u=0,d=Nr.length;u<d;u++){const f=Nr[u];f.object=this,f.batchId=c,t.push(f)}Nr.length=0}Ct.material=null,Ct.geometry.index=null,Ct.geometry.attributes={},Ct.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._visibility,c=this._multiDrawStarts,h=this._multiDrawCounts,u=this._drawRanges,d=this.perObjectFrustumCulled;d&&(ah.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),xo.setFromProjectionMatrix(ah,e.isWebGPURenderer?es:sn));let f=0;if(this.sortObjects){rh.copy(this.matrixWorld).invert(),vs.setFromMatrixPosition(n.matrixWorld).applyMatrix4(rh);for(let g=0,p=l.length;g<p;g++)if(l[g]){this.getMatrixAt(g,Fn),this.getBoundingSphereAt(g,ii).applyMatrix4(Fn);let v=!1;if(d&&(v=!xo.intersectsSphere(ii)),!v){const x=vs.distanceTo(ii.center);vo.push(u[g],x)}}const m=vo.list,_=this.customSort;_===null?m.sort(s.transparent?px:fx):_.call(this,m,n);for(let g=0,p=m.length;g<p;g++){const v=m[g];c[f]=v.start*o,h[f]=v.count,f++}vo.reset()}else for(let m=0,_=l.length;m<_;m++)if(l[m]){let g=!1;if(d&&(this.getMatrixAt(m,Fn),this.getBoundingSphereAt(m,ii).applyMatrix4(Fn),g=!xo.intersectsSphere(ii)),!g){const p=u[m];c[f]=p.start*o,h[f]=p.count,f++}}this._multiDrawCount=f,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class Bt extends Lt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new pe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const oh=new w,lh=new w,ch=new Re,yo=new rs,Or=new Pt;class qn extends Je{constructor(e=new Ge,t=new Bt){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)oh.fromBufferAttribute(t,i-1),lh.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=oh.distanceTo(lh);e.setAttribute("lineDistance",new ve(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Or.copy(n.boundingSphere),Or.applyMatrix4(i),Or.radius+=s,e.ray.intersectsSphere(Or)===!1)return;ch.copy(i).invert(),yo.copy(e.ray).applyMatrix4(ch);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new w,h=new w,u=new w,d=new w,f=this.isLineSegments?2:1,m=n.index,g=n.attributes.position;if(m!==null){const p=Math.max(0,a.start),v=Math.min(m.count,a.start+a.count);for(let x=p,y=v-1;x<y;x+=f){const R=m.getX(x),T=m.getX(x+1);if(c.fromBufferAttribute(g,R),h.fromBufferAttribute(g,T),yo.distanceSqToSegment(c,h,d,u)>l)continue;d.applyMatrix4(this.matrixWorld);const U=e.ray.origin.distanceTo(d);U<e.near||U>e.far||t.push({distance:U,point:u.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const p=Math.max(0,a.start),v=Math.min(g.count,a.start+a.count);for(let x=p,y=v-1;x<y;x+=f){if(c.fromBufferAttribute(g,x),h.fromBufferAttribute(g,x+1),yo.distanceSqToSegment(c,h,d,u)>l)continue;d.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(d);T<e.near||T>e.far||t.push({distance:T,point:u.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}const hh=new w,uh=new w;class pn extends qn{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)hh.fromBufferAttribute(t,i),uh.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+hh.distanceTo(uh);e.setAttribute("lineDistance",new ve(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class dd extends qn{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Vl extends Lt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new pe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const dh=new Re,dl=new rs,Fr=new Pt,Br=new w;class fd extends Je{constructor(e=new Ge,t=new Vl){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Fr.copy(n.boundingSphere),Fr.applyMatrix4(i),Fr.radius+=s,e.ray.intersectsSphere(Fr)===!1)return;dh.copy(i).invert(),dl.copy(e.ray).applyMatrix4(dh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let m=d,_=f;m<_;m++){const g=c.getX(m);Br.fromBufferAttribute(u,g),fh(Br,g,l,i,e,t,this)}}else{const d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let m=d,_=f;m<_;m++)Br.fromBufferAttribute(u,m),fh(Br,m,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function fh(r,e,t,n,i,s,a){const o=dl.distanceSqToPoint(r);if(o<t){const l=new w;dl.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class xx extends mt{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:pt,this.magFilter=s!==void 0?s:pt,this.generateMipmaps=!1;const h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class vx extends mt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=ft,this.minFilter=ft,this.generateMipmaps=!1,this.needsUpdate=!0}}class Aa extends mt{constructor(e,t,n,i,s,a,o,l,c,h,u,d){super(null,a,o,l,c,h,i,s,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class yx extends Aa{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Rt}}class Mx extends Aa{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Rn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Sx extends mt{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class an{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(s-1);const h=n[i],d=n[i+1]-h,f=(a-h)/d;return(i+f)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=t||(a.isVector2?new Z:new w);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new w,i=[],s=[],a=[],o=new w,l=new Re;for(let f=0;f<=e;f++){const m=f/e;i[f]=this.getTangentAt(m,new w)}s[0]=new w,a[0]=new w;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const m=Math.acos(ht(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,m))}a[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos(ht(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],f*m)),a[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Ta extends an{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t){const n=t||new Z,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=l-this.aX,f=c-this.aY;l=d*h-f*u+this.aX,c=d*u+f*h+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class pd extends Ta{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function Hl(){let r=0,e=0,t=0,n=0;function i(s,a,o,l){r=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){i(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,u){let d=(a-s)/c-(o-s)/(c+h)+(o-a)/h,f=(o-a)/h-(l-a)/(h+u)+(l-o)/u;d*=h,f*=h,i(a,o,d,f)},calc:function(s){const a=s*s,o=a*s;return r+e*s+t*a+n*o}}}const zr=new w,Mo=new Hl,So=new Hl,bo=new Hl;class md extends an{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new w){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%s]:(zr.subVectors(i[0],i[1]).add(i[0]),c=zr);const u=i[o%s],d=i[(o+1)%s];if(this.closed||o+2<s?h=i[(o+2)%s]:(zr.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=zr),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(u),f),_=Math.pow(u.distanceToSquared(d),f),g=Math.pow(d.distanceToSquared(h),f);_<1e-4&&(_=1),m<1e-4&&(m=_),g<1e-4&&(g=_),Mo.initNonuniformCatmullRom(c.x,u.x,d.x,h.x,m,_,g),So.initNonuniformCatmullRom(c.y,u.y,d.y,h.y,m,_,g),bo.initNonuniformCatmullRom(c.z,u.z,d.z,h.z,m,_,g)}else this.curveType==="catmullrom"&&(Mo.initCatmullRom(c.x,u.x,d.x,h.x,this.tension),So.initCatmullRom(c.y,u.y,d.y,h.y,this.tension),bo.initCatmullRom(c.z,u.z,d.z,h.z,this.tension));return n.set(Mo.calc(l),So.calc(l),bo.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new w().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function ph(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,o=r*r,l=r*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*r+t}function bx(r,e){const t=1-r;return t*t*e}function Ex(r,e){return 2*(1-r)*r*e}function Ax(r,e){return r*r*e}function As(r,e,t,n){return bx(r,e)+Ex(r,t)+Ax(r,n)}function Tx(r,e){const t=1-r;return t*t*t*e}function wx(r,e){const t=1-r;return 3*t*t*r*e}function Cx(r,e){return 3*(1-r)*r*r*e}function Rx(r,e){return r*r*r*e}function Ts(r,e,t,n,i){return Tx(r,e)+wx(r,t)+Cx(r,n)+Rx(r,i)}class Gl extends an{constructor(e=new Z,t=new Z,n=new Z,i=new Z){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Z){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Ts(e,i.x,s.x,a.x,o.x),Ts(e,i.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class gd extends an{constructor(e=new w,t=new w,n=new w,i=new w){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new w){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Ts(e,i.x,s.x,a.x,o.x),Ts(e,i.y,s.y,a.y,o.y),Ts(e,i.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Wl extends an{constructor(e=new Z,t=new Z){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Z){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 4,407 bytes, line 3686
3686getTangent(e,t=new Z){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class _d extends an{constructor(e=new w,t=new w){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new w){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new w){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Xl extends an{constructor(e=new Z,t=new Z,n=new Z){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Z){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(As(e,i.x,s.x,a.x),As(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ql extends an{constructor(e=new w,t=new w,n=new w){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new w){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(As(e,i.x,s.x,a.x),As(e,i.y,s.y,a.y),As(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Yl extends an{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Z){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),o=s-a,l=i[a===0?a:a-1],c=i[a],h=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(ph(o,l.x,c.x,h.x,u.x),ph(o,l.y,c.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new Z().fromArray(i))}return this}}var ha=Object.freeze({__proto__:null,ArcCurve:pd,CatmullRomCurve3:md,CubicBezierCurve:Gl,CubicBezierCurve3:gd,EllipseCurve:Ta,LineCurve:Wl,LineCurve3:_d,QuadraticBezierCurve:Xl,QuadraticBezierCurve3:ql,SplineCurve:Yl});class xd extends an{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new ha[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isS
vendor: 6,551 bytes, line 3686
3686plineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const h=l[c];n&&n.equals(h)||(t.push(h),n=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new ha[i.type]().fromJSON(i))}return this}}class ks extends xd{constructor(e){super(),this.type="Path",this.currentPoint=new Z,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Wl(this.currentPoint.clone(),new Z(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Xl(this.currentPoint.clone(),new Z(e,t),new Z(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const o=new Gl(this.currentPoint.clone(),new Z(e,t),new Z(n,i),new Z(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Yl(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,n,i,s,a,o,l),this}absellipse(e,t,n,i,s,a,o,l){const c=new Ta(e,t,n,i,s,a,o,l);if(this.curves.length>0){const u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class er extends Ge{constructor(e=[new Z(0,-.5),new Z(.5,0),new Z(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=ht(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],h=1/t,u=new w,d=new Z,f=new w,m=new w,_=new w;let g=0,p=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:g=e[v+1].x-e[v].x,p=e[v+1].y-e[v].y,f.x=p*1,f.y=-g,f.z=p*0,_.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:g=e[v+1].x-e[v].x,p=e[v+1].y-e[v].y,f.x=p*1,f.y=-g,f.z=p*0,m.copy(f),f.x+=_.x,f.y+=_.y,f.z+=_.z,f.normalize(),l.push(f.x,f.y,f.z),_.copy(m)}for(let v=0;v<=t;v++){const x=n+v*h*i,y=Math.sin(x),R=Math.cos(x);for(let T=0;T<=e.length-1;T++){u.x=e[T].x*y,u.y=e[T].y,u.z=e[T].x*R,a.push(u.x,u.y,u.z),d.x=v/t,d.y=T/(e.length-1),o.push(d.x,d.y);const C=l[3*T+0]*y,U=l[3*T+1],S=l[3*T+0]*R;c.push(C,U,S)}}for(let v=0;v<t;v++)for(let x=0;x<e.length-1;x++){const y=x+v*e.length,R=y,T=y+e.length,C=y+e.length+1,U=y+1;s.push(R,T,U),s.push(C,U,T)}this.setIndex(s),this.setAttribute("position",new ve(a,3)),this.setAttribute("uv",new ve(o,2)),this.setAttribute("normal",new ve(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new er(e.points,e.segments,e.phiStart,e.phiLength)}}class wa extends er{constructor(e=1,t=1,n=4,i=8){const s=new ks;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new wa(e.radius,e.length,e.capSegments,e.radialSegments)}}class Ca extends Ge{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new w,h=new Z;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let u=0,d=3;u<=t;u++,d+=3){const f=n+u/t*i;c.x=e*Math.cos(f),c.y=e*Math.sin(f),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[d]/e+1)/2,h.y=(a[d+1]/e+1)/2,l.push(h.x,h.y)}for(let u=1;u<=t;u++)s.push(u,u+1,0);this.setIndex(s),this.setAttribute("position",new ve(a,3)),this.setAttribute("normal",new ve(o,3)),this.setAttribute("uv",new ve(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ca(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class os extends Ge{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const h=[],u=[],d=[],f=[];let m=0;const _=[],g=n/2;let p=0;v(),a===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(h),this.setAttribute("position",new ve(u,3)),this.setAttribute("normal",new ve(d,3)),this.setAttribute("uv",new ve(f,2));function v(){const y=new w,R=new w;let T=0;const C=(t-e)/n;for(let U=0;U<=s;U++){const S=[],E=U/s,N=E*(t-e)+e;for(let G=0;G<=i;G++){const ie=G/i,I=ie*l+o,F=Math.sin(I),V=Math.cos(I);R.x=N*F,R.y=-E*n+g,R.z=N*V,u.push(R.x,R.y,R.z),y.set(F,C,V).normalize(),d.push(y.x,y.y,y.z),f.push(ie,1-E),S.push(m++)}_.push(S)}for(let U=0;U<i;U++)for(let S=0;S<s;S++){const E=_[S][U],N=_[S+1][U],G=_[S+1][U+1],ie=_[S][U+1];h.push(E,N,ie),h.push(N,G,ie),T+=6}c.addGroup(p,T,0),p+=T}function x(y){const R=m,T=new Z,C=new w;let U=0;const S=y===!0?e:t,E=y===!0?1:-1;for(let G=1;G<=i;G++)u.push(0,g*E,0),d.push(0,E,0),f.push(.5,.5),m++;const N=m;for(let G=0;G<=i;G++){const I=G/i*l+o,F=Math.cos(I),V=Math.sin(I);C.x=S*V,C.y=g*E,C.z=S*F,u.push(C.x,C.y,C.z),d.push(0,E,0),T.x=F*.5+.5,T.y=V*.5*E+.5,f.push(T.x,T.y),m++}for(let G=0;G<i;G++){const ie=R+G,I=N+G;y===!0?h.push(I,I+1,ie):h.push(I+1,I,ie),U+=3}c.addGroup(p,U,y===!0?1:2),p+=U}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new os(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ra extends os{constructor(e=1,t=1,n=32,i=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,n,i,s,a,o),this.type="C
3686oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new Ra(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Jn extends Ge{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],a=[];o(i),c(n),h(),this.setAttribute("position",new ve(s,3)),this.setAttribute("normal",new ve(s.slice(),3)),this.setAttribute("uv",new ve(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(v){const x=new w,y=new w,R=new w;for(let T=0;T<t.length;T+=3)f(t[T+0],x),f(t[T+1],y),f(t[T+2],R),l(x,y,R,v)}function l(v,x,y,R){const T=R+1,C=[];for(let U=0;U<=T;U++){C[U]=[];const S=v.clone().lerp(y,U/T),E=x.clone().lerp(y,U/T),N=T-U;for(let G=0;G<=N;G++)G===0&&U===T?C[U][G]=S:C[U][G]=S.clone().lerp(E,G/N)}for(let U=0;U<T;U++)for(let S=0;S<2*(T-U)-1;S++){const E=Math.floor(S/2);S%2===0?(d(C[U][E+1]),d(C[U+1][E]),d(C[U][E])):(d(C[U][E+1]),d(C[U+1][E+1]),d(C[U+1][E]))}}function c(v){const x=new w;for(let y=0;y<s.length;y+=3)x.x=s[y+0],x.y=s[y+1],x.z=s[y+2],x.normalize().multiplyScalar(v),s[y+0]=x.x,s[y+1]=x.y,s[y+2]=x.z}function h(){const v=new w;for(let x=0;x<s.length;x+=3){v.x=s[x+0],v.y=s[x+1],v.z=s[x+2];const y=g(v)/2/Math.PI+.5,R=p(v)/Math.PI+.5;a.push(y,1-R)}m(),u()}function u(){for(let v=0;v<a.length;v+=6){const x=a[v+0],y=a[v+2],R=a[v+4],T=Math.max(x,y,R),C=Math.min(x,y,R);T>.9&&C<.1&&(x<.2&&(a[v+0]+=1),y<.2&&(a[v+2]+=1),R<.2&&(a[v+4]+=1))}}function d(v){s.push(v.x,v.y,v.z)}function f(v,x){const y=v*3;x.x=e[y+0],x.y=e[y+1],x.z=e[y+2]}function m(){const v=new w,x=new w,y=new w,R=new w,T=new Z,C=new Z,U=new Z;for(let S=0,E=0;S<s.length;S+=9,E+=6){v.set(s[S+0],s[S+1],s[S+2]),x.set(s[S+3],s[S+4],s[S+5]),y.set(s[S+6],s[S+7],s[S+8]),T.set(a[E+0],a[E+1]
vendor: 127,540 bytes, line 3686
3686),C.set(a[E+2],a[E+3]),U.set(a[E+4],a[E+5]),R.copy(v).add(x).add(y).divideScalar(3);const N=g(R);_(T,E+0,v,N),_(C,E+2,x,N),_(U,E+4,y,N)}}function _(v,x,y,R){R<0&&v.x===1&&(a[x]=v.x-1),y.x===0&&y.z===0&&(a[x]=R/2/Math.PI+.5)}function g(v){return Math.atan2(v.z,-v.x)}function p(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Jn(e.vertices,e.indices,e.radius,e.details)}}class Pa extends Jn{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Pa(e.radius,e.detail)}}const kr=new w,Vr=new w,Eo=new w,Hr=new kt;class vd extends Ge{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(_i*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],u=new Array(3),d={},f=[];for(let m=0;m<l;m+=3){a?(c[0]=a.getX(m),c[1]=a.getX(m+1),c[2]=a.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:_,b:g,c:p}=Hr;if(_.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),p.fromBufferAttribute(o,c[2]),Hr.getNormal(Eo),u[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,u[1]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,u[2]=`${Math.round(p.x*i)},${Math.round(p.y*i)},${Math.round(p.z*i)}`,!(u[0]===u[1]||u[1]===u[2]||u[2]===u[0]))for(let v=0;v<3;v++){const x=(v+1)%3,y=u[v],R=u[x],T=Hr[h[v]],C=Hr[h[x]],U=`${y}_${R}`,S=`${R}_${y}`;S in d&&d[S]?(Eo.dot(d[S].normal)<=s&&(f.push(T.x,T.y,T.z),f.push(C.x,C.y,C.z)),d[S]=null):U in d||(d[U]={index0:c[v],index1:c[x],normal:Eo.clone()})}}for(const m in d)if(d[m]){const{index0:_,index1:g}=d[m];kr.fromBufferAttribute(o,_),Vr.fromBufferAttribute(o,g),f.push(kr.x,kr.y,kr.z),f.push(Vr.x,Vr.y,Vr.z)}this.setAttribute("position",new ve(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class vi extends ks{constructor(e){super(e),this.uuid=Jt(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new ks().fromJSON(i))}return this}}const Px={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=yd(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c,h,u,d,f;if(n&&(s=Nx(r,e,s,t)),r.length>80*t){o=c=r[0],l=h=r[1];for(let m=t;m<i;m+=t)u=r[m],d=r[m+1],u<o&&(o=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);f=Math.max(c-o,h-l),f=f!==0?32767/f:0}return Vs(s,a,t,o,l,f,0),a}};function yd(r,e,t,n,i){let s,a;if(i===qx(r,e,t,n)>0)for(s=e;s<t;s+=n)a=mh(s,r[s],r[s+1],a);else for(s=t-n;s>=e;s-=n)a=mh(s,r[s],r[s+1],a);return a&&La(a,a.next)&&(Gs(a),a=a.next),a}function Si(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(La(t,t.next)||at(t.prev,t,t.next)===0)){if(Gs(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Vs(r,e,t,n,i,s,a){if(!r)return;!a&&s&&kx(r,n,i,s);let o=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?Ix(r,n,i,s):Lx(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),Gs(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=Ux(Si(r),e,t),Vs(r,e,t,n,i,s,2)):a===2&&Dx(r,e,t,n,i,s):Vs(Si(r),e,t,n,i,s,1);break}}}function Lx(r){const e=r.prev,t=r,n=r.next;if(at(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,o=e.y,l=t.y,c=n.y,h=i<s?i<a?i:a:s<a?s:a,u=o<l?o<c?o:c:l<c?l:c,d=i>s?i>a?i:a:s>a?s:a,f=o>l?o>c?o:c:l>c?l:c;let m=n.next;for(;m!==e;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&Ki(i,o,s,l,a,c,m.x,m.y)&&at(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Ix(r,e,t,n){const i=r.prev,s=r,a=r.next;if(at(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,h=i.y,u=s.y,d=a.y,f=o<l?o<c?o:c:l<c?l:c,m=h<u?h<d?h:d:u<d?u:d,_=o>l?o>c?o:c:l>c?l:c,g=h>u?h>d?h:d:u>d?u:d,p=fl(f,m,e,t,n),v=fl(_,g,e,t,n);let x=r.prevZ,y=r.nextZ;for(;x&&x.z>=p&&y&&y.z<=v;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Ki(o,h,l,u,c,d,x.x,x.y)&&at(x.prev,x,x.next)>=0||(x=x.prevZ,y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==i&&y!==a&&Ki(o,h,l,u,c,d,y.x,y.y)&&at(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;x&&x.z>=p;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Ki(o,h,l,u,c,d,x.x,x.y)&&at(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;y&&y.z<=v;){if(y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==i&&y!==a&&Ki(o,h,l,u,c,d,y.x,y.y)&&at(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Ux(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!La(i,s)&&Md(i,n,n.next,s)&&Hs(i,s)&&Hs(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),Gs(n),Gs(n.next),n=r=s),n=n.next}while(n!==r);return Si(n)}function Dx(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Gx(a,o)){let l=Sd(a,o);a=Si(a,a.next),l=Si(l,l.next),Vs(a,e,t,n,i,s,0),Vs(l,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function Nx(r,e,t,n){const i=[];let s,a,o,l,c;for(s=0,a=e.length;s<a;s++)o=e[s]*n,l=s<a-1?e[s+1]*n:r.length,c=yd(r,o,l,n,!1),c===c.next&&(c.steiner=!0),i.push(Hx(c));for(i.sort(Ox),s=0;s<i.length;s++)t=Fx(i[s],t);return t}function Ox(r,e){return r.x-e.x}function Fx(r,e){const t=Bx(r,e);if(!t)return e;const n=Sd(t,r);return Si(n,n.next),Si(t,t.next)}function Bx(r,e){let t=e,n=-1/0,i;const s=r.x,a=r.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){const d=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=s&&d>n&&(n=d,i=t.x<t.next.x?t:t.next,d===s))return i}t=t.next}while(t!==e);if(!i)return null;const o=i,l=i.x,c=i.y;let h=1/0,u;t=i;do s>=t.x&&t.x>=l&&s!==t.x&&Ki(a<c?s:n,a,l,c,a<c?n:s,a,t.x,t.y)&&(u=Math.abs(a-t.y)/(s-t.x),Hs(t,r)&&(u<h||u===h&&(t.x>i.x||t.x===i.x&&zx(i,t)))&&(i=t,h=u)),t=t.next;while(t!==o);return i}function zx(r,e){return at(r.prev,r,e.prev)<0&&at(e.next,r,r.next)<0}function kx(r,e,t,n){let i=r;do i.z===0&&(i.z=fl(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Vx(i)}function Vx(r){let e,t,n,i,s,a,o,l,c=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,o=0,e=0;e<c&&(o++,n=n.nextZ,!!n);e++);for(l=c;o>0||l>0&&n;)o!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(a>1);return r}function fl(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function Hx(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Ki(r,e,t,n,i,s,a,o){return(i-a)*(e-o)>=(r-a)*(s-o)&&(r-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(i-a)*(n-o)}function Gx(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Wx(r,e)&&(Hs(r,e)&&Hs(e,r)&&Xx(r,e)&&(at(r.prev,r,e.prev)||at(r,e.prev,e))||La(r,e)&&at(r.prev,r,r.next)>0&&at(e.prev,e,e.next)>0)}function at(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function La(r,e){return r.x===e.x&&r.y===e.y}function Md(r,e,t,n){const i=Wr(at(r,e,t)),s=Wr(at(r,e,n)),a=Wr(at(t,n,r)),o=Wr(at(t,n,e));return!!(i!==s&&a!==o||i===0&&Gr(r,t,e)||s===0&&Gr(r,n,e)||a===0&&Gr(t,r,n)||o===0&&Gr(t,e,n))}function Gr(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wr(r){return r>0?1:r<0?-1:0}function Wx(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Md(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Hs(r,e){return at(r.prev,r,r.next)<0?at(r,e,r.next)>=0&&at(r,r.prev,e)>=0:at(r,e,r.prev)<0||at(r,r.next,e)<0}function Xx(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Sd(r,e){const t=new pl(r.i,r.x,r.y),n=new pl(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function mh(r,e,t,n){const i=new pl(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Gs(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function pl(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qx(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class un{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return un.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];gh(e),_h(n,e);let a=e.length;t.forEach(gh);for(let l=0;l<t.length;l++)i.push(a),a+=t[l].length,_h(n,t[l]);const o=Px.triangulate(n,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function gh(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function _h(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Ia extends Ge{constructor(e=new vi([new Z(.5,.5),new Z(-.5,.5),new Z(-.5,-.5),new Z(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new ve(i,3)),this.setAttribute("uv",new ve(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:f-.1,_=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3;const p=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:Yx;let x,y=!1,R,T,C,U;p&&(x=p.getSpacedPoints(h),y=!0,d=!1,R=p.computeFrenetFrames(h,!1),T=new w,C=new w,U=new w),d||(g=0,f=0,m=0,_=0);const S=o.extractPoints(c);let E=S.shape;const N=S.holes;if(!un.isClockWise(E)){E=E.reverse();for(let P=0,re=N.length;P<re;P++){const q=N[P];un.isClockWise(q)&&(N[P]=q.reverse())}}const ie=un.triangulateShape(E,N),I=E;for(let P=0,re=N.length;P<re;P++){const q=N[P];E=E.concat(q)}function F(P,re,q){return re||console.error("THREE.ExtrudeGeometry: vec does not exist"),P.clone().addScaledVector(re,q)}const V=E.length,J=ie.length;function Y(P,re,q){let se,X,Ee;const fe=P.x-re.x,b=P.y-re.y,M=q.x-P.x,O=q.y-P.y,ne=fe*fe+b*b,Q=fe*O-b*M;if(Math.abs(Q)>Number.EPSILON){const $=Math.sqrt(ne),ye=Math.sqrt(M*M+O*O),le=re.x-b/$,_e=re.y+fe/$,Te=q.x-O/ye,Fe=q.y+M/ye,j=((Te-le)*O-(Fe-_e)*M)/(fe*O-b*M);se=le+fe*j-P.x,X=_e+b*j-P.y;const $e=se*se+X*X;if($e<=2)return new Z(se,X);Ee=Math.sqrt($e/2)}else{let $=!1;fe>Number.EPSILON?M>Number.EPSILON&&($=!0):fe<-Number.EPSILON?M<-Number.EPSILON&&($=!0):Math.sign(b)===Math.sign(O)&&($=!0),$?(se=-b,X=fe,Ee=Math.sqrt(ne)):(se=fe,X=b,Ee=Math.sqrt(ne/2))}return new Z(se/Ee,X/Ee)}const W=[];for(let P=0,re=I.length,q=re-1,se=P+1;P<re;P++,q++,se++)q===re&&(q=0),se===re&&(se=0),W[P]=Y(I[P],I[q],I[se]);const ee=[];let te,ue=W.concat();for(let P=0,re=N.length;P<re;P++){const q=N[P];te=[];for(let se=0,X=q.length,Ee=X-1,fe=se+1;se<X;se++,Ee++,fe++)Ee===X&&(Ee=0),fe===X&&(fe=0),te[se]=Y(q[se],q[Ee],q[fe]);ee.push(te),ue=ue.concat(te)}for(let P=0;P<g;P++){const re=P/g,q=f*Math.cos(re*Math.PI/2),se=m*Math.sin(re*Math.PI/2)+_;for(let X=0,Ee=I.length;X<Ee;X++){const fe=F(I[X],W[X],se);ge(fe.x,fe.y,-q)}for(let X=0,Ee=N.length;X<Ee;X++){const fe=N[X];te=ee[X];for(let b=0,M=fe.length;b<M;b++){const O=F(fe[b],te[b],se);ge(O.x,O.y,-q)}}}const H=m+_;for(let P=0;P<V;P++){const re=d?F(E[P],ue[P],H):E[P];y?(C.copy(R.normals[0]).multiplyScalar(re.x),T.copy(R.binormals[0]).multiplyScalar(re.y),U.copy(x[0]).add(C).add(T),ge(U.x,U.y,U.z)):ge(re.x,re.y,0)}for(let P=1;P<=h;P++)for(let re=0;re<V;re++){const q=d?F(E[re],ue[re],H):E[re];y?(C.copy(R.normals[P]).multiplyScalar(q.x),T.copy(R.binormals[P]).multiplyScalar(q.y),U.copy(x[P]).add(C).add(T),ge(U.x,U.y,U.z)):ge(q.x,q.y,u/h*P)}for(let P=g-1;P>=0;P--){const re=P/g,q=f*Math.cos(re*Math.PI/2),se=m*Math.sin(re*Math.PI/2)+_;for(let X=0,Ee=I.length;X<Ee;X++){const fe=F(I[X],W[X],se);ge(fe.x,fe.y,u+q)}for(let X=0,Ee=N.length;X<Ee;X++){const fe=N[X];te=ee[X];for(let b=0,M=fe.length;b<M;b++){const O=F(fe[b],te[b],se);y?ge(O.x,O.y+x[h-1].y,x[h-1].x+q):ge(O.x,O.y,u+q)}}}K(),de();function K(){const P=i.length/3;if(d){let re=0,q=V*re;for(let se=0;se<J;se++){const X=ie[se];Pe(X[2]+q,X[1]+q,X[0]+q)}re=h+g*2,q=V*re;for(let se=0;se<J;se++){const X=ie[se];Pe(X[0]+q,X[1]+q,X[2]+q)}}else{for(let re=0;re<J;re++){const q=ie[re];Pe(q[2],q[1],q[0])}for(let re=0;re<J;re++){const q=ie[re];Pe(q[0]+V*h,q[1]+V*h,q[2]+V*h)}}n.addGroup(P,i.length/3-P,0)}function de(){const P=i.length/3;let re=0;Me(I,re),re+=I.length;for(let q=0,se=N.length;q<se;q++){const X=N[q];Me(X,re),re+=X.length}n.addGroup(P,i.length/3-P,1)}function Me(P,re){let q=P.length;for(;--q>=0;){const se=q;let X=q-1;X<0&&(X=P.length-1);for(let Ee=0,fe=h+g*2;Ee<fe;Ee++){const b=V*Ee,M=V*(Ee+1),O=re+se+b,ne=re+X+b,Q=re+X+M,$=re+se+M;Ne(O,ne,Q,$)}}}function ge(P,re,q){l.push(P),l.push(re),l.push(q)}function Pe(P,re,q){Se(P),Se(re),Se(q);const se=i.length/3,X=v.generateTopUV(n,i,se-3,se-2,se-1);Ue(X[0]),Ue(X[1]),Ue(X[2])}function Ne(P,re,q,se){Se(P),Se(re),Se(se),Se(re),Se(q),Se(se);const X=i.length/3,Ee=v.generateSideWallUV(n,i,X-6,X-3,X-2,X-1);Ue(Ee[0]),Ue(Ee[1]),Ue(Ee[3]),Ue(Ee[1]),Ue(Ee[2]),Ue(Ee[3])}function Se(P){i.push(l[P*3+0]),i.push(l[P*3+1]),i.push(l[P*3+2])}function Ue(P){s.push(P.x),s.push(P.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Zx(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];n.push(o)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new ha[i.type]().fromJSON(i)),new Ia(n,e.options)}}const Yx={generateTopUV:function(r,e,t,n,i){const s=e[t*3],a=e[t*3+1],o=e[n*3],l=e[n*3+1],c=e[i*3],h=e[i*3+1];return[new Z(s,a),new Z(o,l),new Z(c,h)]},generateSideWallUV:function(r,e,t,n,i,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[n*3],h=e[n*3+1],u=e[n*3+2],d=e[i*3],f=e[i*3+1],m=e[i*3+2],_=e[s*3],g=e[s*3+1],p=e[s*3+2];return Math.abs(o-h)<Math.abs(a-c)?[new Z(a,1-l),new Z(c,1-u),new Z(d,1-m),new Z(_,1-p)]:[new Z(o,1-l),new Z(h,1-u),new Z(f,1-m),new Z(g,1-p)]}};function Zx(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Ua extends Jn{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ua(e.radius,e.detail)}}class tr extends Jn{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new tr(e.radius,e.detail)}}class Da extends Ge{constructor(e=.5,t=1,n=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const o=[],l=[],c=[],h=[];let u=e;const d=(t-e)/i,f=new w,m=new Z;for(let _=0;_<=i;_++){for(let g=0;g<=n;g++){const p=s+g/n*a;f.x=u*Math.cos(p),f.y=u*Math.sin(p),l.push(f.x,f.y,f.z),c.push(0,0,1),m.x=(f.x/t+1)/2,m.y=(f.y/t+1)/2,h.push(m.x,m.y)}u+=d}for(let _=0;_<i;_++){const g=_*(n+1);for(let p=0;p<n;p++){const v=p+g,x=v,y=v+n+1,R=v+n+2,T=v+1;o.push(x,y,T),o.push(y,R,T)}}this.setIndex(o),this.setAttribute("position",new ve(l,3)),this.setAttribute("normal",new ve(c,3)),this.setAttribute("uv",new ve(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Da(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Na extends Ge{constructor(e=new vi([new Z(0,.5),new Z(-.5,-.5),new Z(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new ve(i,3)),this.setAttribute("normal",new ve(s,3)),this.setAttribute("uv",new ve(a,2));function c(h){const u=i.length/3,d=h.extractPoints(t);let f=d.shape;const m=d.holes;un.isClockWise(f)===!1&&(f=f.reverse());for(let g=0,p=m.length;g<p;g++){const v=m[g];un.isClockWise(v)===!0&&(m[g]=v.reverse())}const _=un.triangulateShape(f,m);for(let g=0,p=m.length;g<p;g++){const v=m[g];f=f.concat(v)}for(let g=0,p=f.length;g<p;g++){const v=f[g];i.push(v.x,v.y,0),s.push(0,0,1),a.push(v.x,v.y)}for(let g=0,p=_.length;g<p;g++){const v=_[g],x=v[0]+u,y=v[1]+u,R=v[2]+u;n.push(x,y,R),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return Jx(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new Na(n,e.curveSegments)}}function Jx(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class nr extends Ge{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const h=[],u=new w,d=new w,f=[],m=[],_=[],g=[];for(let p=0;p<=n;p++){const v=[],x=p/n;let y=0;p===0&&a===0?y=.5/t:p===n&&l===Math.PI&&(y=-.5/t);for(let R=0;R<=t;R++){const T=R/t;u.x=-e*Math.cos(i+T*s)*Math.sin(a+x*o),u.y=e*Math.cos(a+x*o),u.z=e*Math.sin(i+T*s)*Math.sin(a+x*o),m.push(u.x,u.y,u.z),d.copy(u).normalize(),_.push(d.x,d.y,d.z),g.push(T+y,1-x),v.push(c++)}h.push(v)}for(let p=0;p<n;p++)for(let v=0;v<t;v++){const x=h[p][v+1],y=h[p][v],R=h[p+1][v],T=h[p+1][v+1];(p!==0||a>0)&&f.push(x,y,T),(p!==n-1||l<Math.PI)&&f.push(y,R,T)}this.setIndex(f),this.setAttribute("position",new ve(m,3)),this.setAttribute("normal",new ve(_,3)),this.setAttribute("uv",new ve(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nr(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Oa extends Jn{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Oa(e.radius,e.detail)}}class Fa extends Ge{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],l=[],c=[],h=new w,u=new w,d=new w;for(let f=0;f<=n;f++)for(let m=0;m<=i;m++){const _=m/i*s,g=f/n*Math.PI*2;u.x=(e+t*Math.cos(g))*Math.cos(_),u.y=(e+t*Math.cos(g))*Math.sin(_),u.z=t*Math.sin(g),o.push(u.x,u.y,u.z),h.x=e*Math.cos(_),h.y=e*Math.sin(_),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(m/i),c.push(f/n)}for(let f=1;f<=n;f++)for(let m=1;m<=i;m++){const _=(i+1)*f+m-1,g=(i+1)*(f-1)+m-1,p=(i+1)*(f-1)+m,v=(i+1)*f+m;a.push(_,g,v),a.push(g,p,v)}this.setIndex(a),this.setAttribute("position",new ve(o,3)),this.setAttribute("normal",new ve(l,3)),this.setAttribute("uv",new ve(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fa(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Ba extends Ge{constructor(e=1,t=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const o=[],l=[],c=[],h=[],u=new w,d=new w,f=new w,m=new w,_=new w,g=new w,p=new w;for(let x=0;x<=n;++x){const y=x/n*s*Math.PI*2;v(y,s,a,e,f),v(y+.01,s,a,e,m),g.subVectors(m,f),p.addVectors(m,f),_.crossVectors(g,p),p.crossVectors(_,g),_.normalize(),p.normalize();for(let R=0;R<=i;++R){const T=R/i*Math.PI*2,C=-t*Math.cos(T),U=t*Math.sin(T);u.x=f.x+(C*p.x+U*_.x),u.y=f.y+(C*p.y+U*_.y),u.z=f.z+(C*p.z+U*_.z),l.push(u.x,u.y,u.z),d.subVectors(u,f).normalize(),c.push(d.x,d.y,d.z),h.push(x/n),h.push(R/i)}}for(let x=1;x<=n;x++)for(let y=1;y<=i;y++){const R=(i+1)*(x-1)+(y-1),T=(i+1)*x+(y-1),C=(i+1)*x+y,U=(i+1)*(x-1)+y;o.push(R,T,U),o.push(T,C,U)}this.setIndex(o),this.setAttribute("position",new ve(l,3)),this.setAttribute("normal",new ve(c,3)),this.setAttribute("uv",new ve(h,2));function v(x,y,R,T,C){const U=Math.cos(x),S=Math.sin(x),E=R/y*x,N=Math.cos(E);C.x=T*(2+N)*.5*U,C.y=T*(2+N)*S*.5,C.z=T*Math.sin(E)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ba(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class za extends Ge{constructor(e=new ql(new w(-1,-1,0),new w(-1,1,0),new w(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new w,l=new w,c=new Z;let h=new w;const u=[],d=[],f=[],m=[];_(),this.setIndex(m),this.setAttribute("position",new ve(u,3)),this.setAttribute("normal",new ve(d,3)),this.setAttribute("uv",new ve(f,2));function _(){for(let x=0;x<t;x++)g(x);g(s===!1?t:0),v(),p()}function g(x){h=e.getPointAt(x/t,h);const y=a.normals[x],R=a.binormals[x];for(let T=0;T<=i;T++){const C=T/i*Math.PI*2,U=Math.sin(C),S=-Math.cos(C);l.x=S*y.x+U*R.x,l.y=S*y.y+U*R.y,l.z=S*y.z+U*R.z,l.normalize(),d.push(l.x,l.y,l.z),o.x=h.x+n*l.x,o.y=h.y+n*l.y,o.z=h.z+n*l.z,u.push(o.x,o.y,o.z)}}function p(){for(let x=1;x<=t;x++)for(let y=1;y<=i;y++){const R=(i+1)*(x-1)+(y-1),T=(i+1)*x+(y-1),C=(i+1)*x+y,U=(i+1)*(x-1)+y;m.push(R,T,U),m.push(T,C,U)}}function v(){for(let x=0;x<=t;x++)for(let y=0;y<=i;y++)c.x=x/t,c.y=y/i,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new za(new ha[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class bd extends Ge{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new w,s=new w;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,h=l.length;c<h;++c){const u=l[c],d=u.start,f=u.count;for(let m=d,_=d+f;m<_;m+=3)for(let g=0;g<3;g++){const p=o.getX(m+g),v=o.getX(m+(g+1)%3);i.fromBufferAttribute(a,p),s.fromBufferAttribute(a,v),xh(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const h=3*o+c,u=3*o+(c+1)%3;i.fromBufferAttribute(a,h),s.fromBufferAttribute(a,u),xh(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new ve(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function xh(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var vh=Object.freeze({__proto__:null,BoxGeometry:bi,CapsuleGeometry:wa,CircleGeometry:Ca,ConeGeometry:Ra,CylinderGeometry:os,DodecahedronGeometry:Pa,EdgesGeometry:vd,ExtrudeGeometry:Ia,IcosahedronGeometry:Ua,LatheGeometry:er,OctahedronGeometry:tr,PlaneGeometry:js,PolyhedronGeometry:Jn,RingGeometry:Da,ShapeGeometry:Na,SphereGeometry:nr,TetrahedronGeometry:Oa,TorusGeometry:Fa,TorusKnotGeometry:Ba,TubeGeometry:za,WireframeGeometry:bd});class Ed extends Lt{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new pe(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Ad extends fn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Zl extends Lt{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new pe(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 pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yn,this.normalScale=new Z(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 Td extends Zl{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 Z(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ht(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 pe(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 pe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new pe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class wd extends Lt{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new pe(16777215),this.specular=new pe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yn,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Zs,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Cd extends Lt{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yn,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Rd extends Lt{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yn,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Pd extends Lt{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yn,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Zs,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ld extends Lt{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yn,this.normalScale=new Z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Id extends Bt{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function mi(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 Ud(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Dd(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 ml(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)i[a++]=r[o+l]}return i}function Jl(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}function $x(r,e,t,n,i=30){const s=r.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],h=c.getValueSize(),u=[],d=[];for(let f=0;f<c.times.length;++f){const m=c.times[f]*i;if(!(m<t||m>=n)){u.push(c.times[f]);for(let _=0;_<h;++_)d.push(c.values[f*h+_])}}u.length!==0&&(c.times=mi(u,c.times.constructor),c.values=mi(d,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function Kx(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let a=0;a<i;++a){const o=t.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(p){return p.name===o.name&&p.ValueTypeName===l});if(c===void 0)continue;let h=0;const u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);const m=o.times.length-1;let _;if(s<=o.times[0]){const p=h,v=u-h;_=o.values.slice(p,v)}else if(s>=o.times[m]){const p=m*u+h,v=p+u-h;_=o.values.slice(p,v)}else{const p=o.createInterpolant(),v=h,x=u-h;p.evaluate(s),_=p.resultBuffer.slice(v,x)}l==="quaternion"&&new Gt().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let p=0;p<g;++p){const v=p*f+d;if(l==="quaternion")Gt.multiplyQuaternionsFlat(c.values,v,_,0,c.values,v);else{const x=f-d*2;for(let y=0;y<x;++y)c.values[v+y]-=_[y]}}}return r.blendMode=wl,r}const Qx={convertArray:mi,isTypedArray:Ud,getKeyframeOrder:Dd,sortedArray:ml,flattenJSON:Jl,subclip:$x,makeClipAdditive:Kx};class ir{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Nd extends ir{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:di,endingEnd:di}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case fi:s=e,o=2*t-n;break;case Ds:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case fi:a=e,l=2*n-t;break;case Ds:a=1,l=n+i[1]-i[0];break;default:a=e-1,l=t}const c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,m=(n-t)/(i-t),_=m*m,g=_*m,p=-d*g+2*d*_-d*m,v=(1+d)*g+(-1.5-2*d)*_+(-.5+d)*m+1,x=(-1-f)*g+(1.5+f)*_+.5*m,y=f*g-f*_;for(let R=0;R!==o;++R)s[R]=p*a[h+R]+v*a[c+R]+x*a[l+R]+y*a[u+R];return s}}class $l extends ir{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==o;++d)s[d]=a[c+d]*u+a[l+d]*h;return s}}class Od extends ir{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class on{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=mi(t,this.TimeBufferType),this.values=mi(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:mi(e.times,Array),values:mi(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Od(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new $l(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Nd(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Is:t=this.InterpolantFactoryMethodDiscrete;break;case Us:t=this.InterpolantFactoryMethodLinear;break;case ia:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Is;case this.InterpolantFactoryMethodLinear:return Us;case this.InterpolantFactoryMethodSmooth:return ia}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&Ud(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===ia,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(i)l=!0;else{const u=o*n,d=u-n,f=u+n;for(let m=0;m!==n;++m){const _=t[u+m];if(_!==t[d+m]||_!==t[f+m]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const u=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[u+f]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}on.prototype.TimeBufferType=Float32Array;on.prototype.ValueBufferType=Float32Array;on.prototype.DefaultInterpolation=Us;class Ei extends on{}Ei.prototype.ValueTypeName="bool";Ei.prototype.ValueBufferType=Array;Ei.prototype.DefaultInterpolation=Is;Ei.prototype.InterpolantFactoryMethodLinear=void 0;Ei.prototype.InterpolantFactoryMethodSmooth=void 0;class Kl extends on{}Kl.prototype.ValueTypeName="color";class Ws extends on{}Ws.prototype.ValueTypeName="number";class Fd extends ir{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let h=c+o;c!==h;c+=4)Gt.slerpFlat(s,0,a,c-o,a,c,l);return s}}class ls extends on{InterpolantFactoryMethodLinear(e){return new Fd(this.times,this.values,this.getValueSize(),e)}}ls.prototype.ValueTypeName="quaternion";ls.prototype.DefaultInterpolation=Us;ls.prototype.InterpolantFactoryMethodSmooth=void 0;class Ai extends on{}Ai.prototype.ValueTypeName="string";Ai.prototype.ValueBufferType=Array;Ai.prototype.DefaultInterpolation=Is;Ai.prototype.InterpolantFactoryMethodLinear=void 0;Ai.prototype.InterpolantFactoryMethodSmooth=void 0;class Xs extends on{}Xs.prototype.ValueTypeName="vector";class qs{constructor(e,t=-1,n,i=pa){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Jt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(ev(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(on.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const h=Dd(l);l=ml(l,1,h),c=ml(c,1,h),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new Ws(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],h=c.name.match(s);if(h&&h.length>1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,m,_){if(f.length!==0){const g=[],p=[];Jl(f,g,p,m),g.length!==0&&_.push(new u(d,g,p))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u<c.length;u++){const d=c[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let _=0;_<d[m].morphTargets.length;_++)f[d[m].morphTargets[_]]=-1;for(const _ in f){const g=[],p=[];for(let v=0;v!==d[m].morphTargets.length;++v){const x=d[m];g.push(x.time),p.push(x.morphTarget===_?1:0)}i.push(new Ws(".morphTargetInfluence["+_+"]",g,p))}l=f.length*a}else{const f=".bones["+t[u].name+"]";n(Xs,f+".position",d,"pos",i),n(ls,f+".quaternion",d,"rot",i),n(Xs,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function jx(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ws;case"vector":case"vector2":case"vector3":case"vector4":return Xs;case"color":return Kl;case"quaternion":return ls;case"bool":case"boolean":return Ei;case"string":return Ai}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function ev(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=jx(r.type);if(r.times===void 0){const t=[],n=[];Jl(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const En={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Ql{constructor(e,t,n){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(h){o++,s===!1&&i.onStart!==void 0&&i.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const f=c[u],m=c[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return m}return null}}}const Bd=new Ql;class Wt{constructor(e){this.manager=e!==void 0?e:Bd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Wt.DEFAULT_MATERIAL_NAME="__DEFAULT";const Mn={};class tv extends Error{constructor(e,t){super(e),this.response=t}}class Pn extends Wt{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=En.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Mn[e]!==void 0){Mn[e].push({onLoad:t,onProgress:n,onError:i});return}Mn[e]=[],Mn[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).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 h=Mn[e],u=c.body.getReader(),d=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),f=d?parseInt(d):0,m=f!==0;let _=0;const g=new ReadableStream({start(p){v();function v(){u.read().then(({done:x,value:y})=>{if(x)p.close();else{_+=y.byteLength;const R=new ProgressEvent("progress",{lengthComputable:m,loaded:_,total:f});for(let T=0,C=h.length;T<C;T++){const U=h[T];U.onProgress&&U.onProgress(R)}p.enqueue(y),v()}})}}});return new Response(g)}else throw new tv(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(m=>f.decode(m))}}}).then(c=>{En.add(e,c);const h=Mn[e];delete Mn[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(c)}}).catch(c=>{const h=Mn[e];if(h===void 0)throw this.manager.itemError(e),c;delete Mn[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class nv extends Wt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Pn(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=qs.parse(e[n]);t.push(i)}return t}}class iv extends Wt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=[],o=new Aa,l=new Pn(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function h(u){l.load(e[u],function(d){const f=s.parse(d,!0);a[u]={width:f.width,height:f.height,format:f.format,mipmaps:f.mipmaps},c+=1,c===6&&(f.mipmapCount===1&&(o.minFilter=pt),o.image=a,o.format=f.format,o.needsUpdate=!0,t&&t(o))},n,i)}if(Array.isArray(e))for(let u=0,d=e.length;u<d;++u)h(u);else l.load(e,function(u){const d=s.parse(u,!0);if(d.isCubemap){const f=d.mipmaps.length/d.mipmapCount;for(let m=0;m<f;m++){a[m]={mipmaps:[]};for(let _=0;_<d.mipmapCount;_++)a[m].mipmaps.push(d.mipmaps[m*d.mipmapCount+_]),a[m].format=d.format,a[m].width=d.width,a[m].height=d.height}o.image=a}else o.image.width=d.width,o.image.height=d.height,o.mipmaps=d.mipmaps;d.mipmapCount===1&&(o.minFilter=pt),o.format=d.format,o.needsUpdate=!0,t&&t(o)},n,i);return o}}class Ys extends Wt{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=En.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=zs("img");function l(){h(),En.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){h(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class sv extends Wt{constructor(e){super(e)}load(e,t,n,i){const s=new Ks;s.colorSpace=_t;const a=new Ys(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(h){s.images[c]=h,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class rv extends Wt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new xi,o=new Pn(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(h){if(i!==void 0)i(h);else{console.error(h);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Rt,a.wrapT=c.wrapT!==void 0?c.wrapT:Rt,a.magFilter=c.magFilter!==void 0?c.magFilter:pt,a.minFilter=c.minFilter!==void 0?c.minFilter:pt,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0?a.colorSpace=c.colorSpace:c.encoding!==void 0&&(a.encoding=c.encoding),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Xn),c.mipmapCount===1&&(a.minFilter=pt),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,i),a}}class av extends Wt{constructor(e){super(e)}load(e,t,n,i){const s=new mt,a=new Ys(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class $n extends Je{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new pe(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class zd extends $n{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Je.DEFAULT_UP),this.updateMatrix(),this.groundColor=new pe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Ao=new Re,yh=new w,Mh=new w;class jl{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Z(512,512),this.map=null,this.mapPass=null,this.matrix=new Re,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Qs,this._frameExtents=new Z(1,1),this._viewportCount=1,this._viewports=[new je(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;yh.setFromMatrixPosition(e.matrixWorld),t.position.copy(yh),Mh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Mh),t.updateMatrixWorld(),Ao.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ao),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ao)}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 ov extends jl{constructor(){super(new Et(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ts*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 kd extends $n{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Je.DEFAULT_UP),this.updateMatrix(),this.target=new Je,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new ov}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 Sh=new Re,ys=new w,To=new w;class lv extends jl{constructor(){super(new Et(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Z(4,2),this._viewportCount=6,this._viewports=[new je(2,1,1,1),new je(0,1,1,1),new je(3,1,1,1),new je(1,1,1,1),new je(3,0,1,1),new je(1,0,1,1)],this._cubeDirections=[new w(1,0,0),new w(-1,0,0),new w(0,0,1),new w(0,0,-1),new w(0,1,0),new w(0,-1,0)],this._cubeUps=[new w(0,1,0),new w(0,1,0),new w(0,1,0),new w(0,1,0),new w(0,0,1),new w(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()),ys.setFromMatrixPosition(e.matrixWorld),n.position.copy(ys),To.copy(n.position),To.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(To),n.updateMatrixWorld(),i.makeTranslation(-ys.x,-ys.y,-ys.z),Sh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Sh)}}class Vd extends $n{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 lv}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 cv extends jl{constructor(){super(new va(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Hd extends $n{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Je.DEFAULT_UP),this.updateMatrix(),this.target=new Je,this.shadow=new cv}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Gd extends $n{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Wd extends $n{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Xd{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new w)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class qd extends $n{constructor(e=new Xd,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class ka extends Wt{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,a=new Pn(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=ka.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new pe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new pe().setHex(a.value);break;case"v2":i.uniforms[s].value=new Z().fromArray(a.value);break;case"v3":i.uniforms[s].value=new w().fromArray(a.value);break;case"v4":i.uniforms[s].value=new je().fromArray(a.value);break;case"m3":i.uniforms[s].value=new He().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Re().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Z().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Z().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:Ed,SpriteMaterial:zl,RawShaderMaterial:Ad,ShaderMaterial:fn,PointsMaterial:Vl,MeshPhysicalMaterial:Td,MeshStandardMaterial:Zl,MeshPhongMaterial:wd,MeshToonMaterial:Cd,MeshNormalMaterial:Rd,MeshLambertMaterial:Pd,MeshDepthMaterial:Fl,MeshDistanceMaterial:Bl,MeshBasicMaterial:Zn,MeshMatcapMaterial:Ld,LineDashedMaterial:Id,LineBasicMaterial:Bt,Material:Lt};return new t[e]}}class gl{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Yd extends Ge{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Zd extends Wt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Pn(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(f,m){if(t[m]!==void 0)return t[m];const g=f.interleavedBuffers[m],p=s(f,g.buffer),v=Yi(g.type,p),x=new ba(v,g.stride);return x.uuid=g.uuid,t[m]=x,x}function s(f,m){if(n[m]!==void 0)return n[m];const g=f.arrayBuffers[m],p=new Uint32Array(g).buffer;return n[m]=p,p}const a=e.isInstancedBufferGeometry?new Yd:new Ge,o=e.data.index;if(o!==void 0){const f=Yi(o.type,o.array);a.setIndex(new et(f,1))}const l=e.data.attributes;for(const f in l){const m=l[f];let _;if(m.isInterleavedBufferAttribute){const g=i(e.data,m.data);_=new Mi(g,m.itemSize,m.offset,m.normalized)}else{const g=Yi(m.type,m.array),p=m.isInstancedBufferAttribute?is:et;_=new p(g,m.itemSize,m.normalized)}m.name!==void 0&&(_.name=m.name),m.usage!==void 0&&_.setUsage(m.usage),a.setAttribute(f,_)}const c=e.data.morphAttributes;if(c)for(const f in c){const m=c[f],_=[];for(let g=0,p=m.length;g<p;g++){const v=m[g];let x;if(v.isInterleavedBufferAttribute){const y=i(e.data,v.data);x=new Mi(y,v.itemSize,v.offset,v.normalized)}else{const y=Yi(v.type,v.array);x=new et(y,v.itemSize,v.normalized)}v.name!==void 0&&(x.name=v.name),_.push(x)}a.morphAttributes[f]=_}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const u=e.data.groups||e.data.drawcalls||e.data.offsets;if(u!==void 0)for(let f=0,m=u.length;f!==m;++f){const _=u[f];a.addGroup(_.start,_.count,_.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const f=new w;d.center!==void 0&&f.fromArray(d.center),a.boundingSphere=new Pt(f,d.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class hv extends Wt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?gl.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new Pn(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(u){i!==void 0&&i(u),console.error("THREE:ObjectLoader: Can't parse "+e+".",u.message);return}const h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?gl.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Pn(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(o)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){t!==void 0&&t(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,n),h=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,h),t!==void 0){let u=!1;for(const d in a)if(a[d].data instanceof HTMLImageElement){u=!0;break}u===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,i,o,a,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new vi().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new Ea().fromJSON(e[s],i);n[o.uuid]=o}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Zd;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in vh?o=vh[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),n[l.uuid]=o}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new ka;s.setTextures(t);for(let a=0,o=e.length;a<o;a++){const l=e[a];n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=qs.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function a(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return a(h)}else return l.data?{data:Yi(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Ql(t);s=new Ys(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=e.length;c<h;c++){const u=e[c],d=u.url;if(Array.isArray(d)){const f=[];for(let m=0,_=d.length;m<_;m++){const g=d[m],p=o(g);p!==null&&(p instanceof HTMLImageElement?f.push(p):f.push(new xi(p.data,p.width,p.height)))}i[u.uuid]=new pi(f)}else{const f=o(u.url);i[u.uuid]=new pi(f)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:t.resourcePath+o;return await i.loadAsync(l)}else return a.data?{data:Yi(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new Ys(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u],m=await s(f);m!==null&&(m instanceof HTMLImageElement?h.push(m):h.push(new xi(m.data,m.width,m.height)))}n[l.uuid]=new pi(h)}else{const h=await s(l.url);n[l.uuid]=new pi(h)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let h;Array.isArray(c)?(h=new Ks,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new xi:h=new mt,c&&(h.needsUpdate=!0)),h.source=l,h.uuid=o.uuid,o.name!==void 0&&(h.name=o.name),o.mapping!==void 0&&(h.mapping=n(o.mapping,uv)),o.channel!==void 0&&(h.channel=o.channel),o.offset!==void 0&&h.offset.fromArray(o.offset),o.repeat!==void 0&&h.repeat.fromArray(o.repeat),o.center!==void 0&&h.center.fromArray(o.center),o.rotation!==void 0&&(h.rotation=o.rotation),o.wrap!==void 0&&(h.wrapS=n(o.wrap[0],bh),h.wrapT=n(o.wrap[1],bh)),o.format!==void 0&&(h.format=o.format),o.internalFormat!==void 0&&(h.internalFormat=o.internalFormat),o.type!==void 0&&(h.type=o.type),o.colorSpace!==void 0&&(h.colorSpace=o.colorSpace),o.encoding!==void 0&&(h.encoding=o.encoding),o.minFilter!==void 0&&(h.minFilter=n(o.minFilter,Eh)),o.magFilter!==void 0&&(h.magFilter=n(o.magFilter,Eh)),o.anisotropy!==void 0&&(h.anisotropy=o.anisotropy),o.flipY!==void 0&&(h.flipY=o.flipY),o.generateMipmaps!==void 0&&(h.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(h.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(h.compareFunction=o.compareFunction),o.userData!==void 0&&(h.userData=o.userData),i[o.uuid]=h}return i}parseObject(e,t,n,i,s){let a;function o(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){const f=[];for(let m=0,_=d.length;m<_;m++){const g=d[m];n[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),f.push(n[g])}return f}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function c(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let h,u;switch(e.type){case"Scene":a=new rd,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new pe(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new Sa(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Ma(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":a=new Et(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new va(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new Gd(e.color,e.intensity);break;case"DirectionalLight":a=new Hd(e.color,e.intensity);break;case"PointLight":a=new Vd(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new Wd(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new kd(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new zd(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new qd().fromJSON(e);break;case"SkinnedMesh":h=o(e.geometry),u=l(e.material),a=new cd(h,u),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":h=o(e.geometry),u=l(e.material),a=new xt(h,u);break;case"InstancedMesh":h=o(e.geometry),u=l(e.material);const d=e.count,f=e.instanceMatrix,m=e.instanceColor;a=new hd(h,u,d),a.instanceMatrix=new is(new Float32Array(f.array),16),m!==void 0&&(a.instanceColor=new is(new Float32Array(m.array),m.itemSize));break;case"BatchedMesh":h=o(e.geometry),u=l(e.material),a=new ud(e.maxGeometryCount,e.maxVertexCount,e.maxIndexCount,u),a.geometry=h,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._visibility=e.visibility,a._active=e.active,a._bounds=e.bounds.map(_=>{const g=new Ft;g.min.fromArray(_.boxMin),g.max.fromArray(_.boxMax);const p=new Pt;return p.radius=_.sphereRadius,p.center.fromArray(_.sphereCenter),{boxInitialized:_.boxInitialized,box:g,sphereInitialized:_.sphereInitialized,sphere:p}}),a._maxGeometryCount=e.maxGeometryCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._geometryCount=e.geometryCount,a._matricesTexture=c(e.matricesTexture.uuid);break;case"LOD":a=new ld;break;case"Line":a=new qn(o(e.geometry),l(e.material));break;case"LineLoop":a=new dd(o(e.geometry),l(e.material));break;case"LineSegments":a=new pn(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new fd(o(e.geometry),l(e.material));break;case"Sprite":a=new od(l(e.material));break;case"Group":a=new $i;break;case"Bone":a=new kl;break;default:a=new Je}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let f=0;f<d.length;f++)a.add(this.parseObject(d[f],t,n,i,s))}if(e.animations!==void 0){const d=e.animations;for(let f=0;f<d.length;f++){const m=d[f];a.animations.push(s[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const d=e.levels;for(let f=0;f<d.length;f++){const m=d[f],_=a.getObjectByProperty("uuid",m.object);_!==void 0&&a.addLevel(_,m.distance,m.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}}const uv={UVMapping:da,CubeReflectionMapping:Rn,CubeRefractionMapping:Wn,EquirectangularReflectionMapping:Cs,EquirectangularRefractionMapping:Rs,CubeUVReflectionMapping:ss},bh={RepeatWrapping:Ps,ClampToEdgeWrapping:Rt,MirroredRepeatWrapping:Ls},Eh={NearestFilter:ft,NearestMipmapNearestFilter:oa,NearestMipmapLinearFilter:Ss,LinearFilter:pt,LinearMipmapNearestFilter:vl,LinearMipmapLinearFilter:Xn};class dv extends Wt{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=En.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return En.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),En.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});En.add(e,l),s.manager.itemStart(e)}}let Xr;class ec{static getContext(){return Xr===void 0&&(Xr=new(window.AudioContext||window.webkitAudioContext)),Xr}static setContext(e){Xr=e}}class fv extends Wt{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Pn(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);ec.getContext().decodeAudioData(c,function(u){t(u)}).catch(o)}catch(c){o(c)}},n,i);function o(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const Ah=new Re,Th=new Re,si=new Re;class pv{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Et,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Et,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,si.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(_i*t.fov*.5)/t.zoom;let o,l;Th.elements[12]=-i,Ah.elements[12]=i,o=-a*t.aspect+s,l=a*t.aspect+s,si.elements[0]=2*t.near/(l-o),si.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(si),o=-a*t.aspect-s,l=a*t.aspect-s,si.elements[0]=2*t.near/(l-o),si.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(si)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Th),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ah)}}class Jd{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=wh(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=wh();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function wh(){return(typeof performance>"u"?Date:performance).now()}const ri=new w,Ch=new Gt,mv=new w,ai=new w;class gv extends Je{constructor(){super(),this.type="AudioListener",this.context=ec.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Jd}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ri,Ch,mv),ai.set(0,0,-1).applyQuaternion(Ch),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ri.x,i),t.positionY.linearRampToValueAtTime(ri.y,i),t.positionZ.linearRampToValueAtTime(ri.z,i),t.forwardX.linearRampToValueAtTime(ai.x,i),t.forwardY.linearRampToValueAtTime(ai.y,i),t.forwardZ.linearRampToValueAtTime(ai.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(ri.x,ri.y,ri.z),t.setOrientation(ai.x,ai.y,ai.z,n.x,n.y,n.z)}}class $d extends Je{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const oi=new w,Rh=new Gt,_v=new w,li=new w;class xv extends $d{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(oi,Rh,_v),li.set(0,0,1).applyQuaternion(Rh);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(oi.x,n),t.positionY.linearRampToValueAtTime(oi.y,n),t.positionZ.linearRampToValueAtTime(oi.z,n),t.orientationX.linearRampToValueAtTime(li.x,n),t.orientationY.linearRampToValueAtTime(li.y,n),t.orientationZ.linearRampToValueAtTime(li.z,n)}else t.setPosition(oi.x,oi.y,oi.z),t.setOrientation(li.x,li.y,li.z)}}class vv{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Kd{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){Gt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;Gt.multiplyQuaternionsFlat(e,a,e,t,e,n),Gt.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const tc="\\[\\]\\.:\\/",yv=new RegExp("["+tc+"]","g"),nc="[^"+tc+"]",Mv="[^"+tc.replace("\\.","")+"]",Sv=/((?:WC+[\/:])*)/.source.replace("WC",nc),bv=/(WCOD+)?/.source.replace("WCOD",Mv),Ev=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nc),Av=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nc),Tv=new RegExp("^"+Sv+bv+Ev+Av+"$"),wv=["material","materials","bones","map"];class Cv{constructor(e,t,n){const i=n||Ze.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 Ze{constructor(e,t,n){this.path=t,this.parsedPath=n||Ze.parseTrackName(t),this.node=Ze.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 Ze.Composite(e,t,n):new Ze(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(yv,"")}static parseTrackName(e){const t=Tv.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);wv.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=Ze.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[i];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ze.Composite=Cv;Ze.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ze.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ze.prototype.GetterByBindingType=[Ze.prototype._getValue_direct,Ze.prototype._getValue_array,Ze.prototype._getValue_arrayElement,Ze.prototype._getValue_toArray];Ze.prototype.SetterByBindingTypeAndVersioning=[[Ze.prototype._setValue_direct,Ze.prototype._setValue_direct_setNeedsUpdate,Ze.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ze.prototype._setValue_array,Ze.prototype._setValue_array_setNeedsUpdate,Ze.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ze.prototype._setValue_arrayElement,Ze.prototype._setValue_arrayElement_setNeedsUpdate,Ze.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ze.prototype._setValue_fromArray,Ze.prototype._setValue_fromArray_setNeedsUpdate,Ze.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Rv{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Jt(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const d=arguments[h],f=d.uuid;let m=t[f];if(m===void 0){m=l++,t[f]=m,e.push(d);for(let _=0,g=a;_!==g;++_)s[_].push(new Ze(d,n[_],i[_]))}else if(m<c){o=e[m];const _=--c,g=e[_];t[g.uuid]=m,e[m]=g,t[f]=_,e[_]=d;for(let p=0,v=a;p!==v;++p){const x=s[p],y=x[_];let R=x[m];x[m]=y,R===void 0&&(R=new Ze(d,n[p],i[p])),x[_]=R}}else e[m]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,h=t[c];if(h!==void 0&&h>=s){const u=s++,d=e[u];t[d.uuid]=h,e[h]=d,t[c]=u,e[u]=l;for(let f=0,m=i;f!==m;++f){const _=n[f],g=_[u],p=_[h];_[h]=g,_[u]=p}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],h=c.uuid,u=t[h];if(u!==void 0)if(delete t[h],u<s){const d=--s,f=e[d],m=--a,_=e[m];t[f.uuid]=u,e[u]=f,t[_.uuid]=d,e[d]=_,e.pop();for(let g=0,p=i;g!==p;++g){const v=n[g],x=v[d],y=v[m];v[u]=x,v[d]=y,v.pop()}}else{const d=--a,f=e[d];d>0&&(t[f.uuid]=u),e[u]=f,e.pop();for(let m=0,_=i;m!==_;++m){const g=n[m];g[u]=g[d],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,u=new Array(c);i=s.length,n[e]=i,a.push(e),o.push(t),s.push(u);for(let d=h,f=l.length;d!==f;++d){const m=l[d];u[d]=new Ze(m,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=n,a[n]=l,a.pop(),s[n]=s[o],s.pop(),i[n]=i[o],i.pop()}}}class Qd{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:di,endingEnd:di};for(let c=0;c!==a;++c){const h=s[c].createInterpolant(null);o[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ru,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case wl:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case pa:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===Pu;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===Cu){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=fi,i.endingEnd=fi):(e?i.endingStart=this.zeroSlopeAtStart?fi:di:i.endingStart=Ds,t?i.endingEnd=this.zeroSlopeAtEnd?fi:di:i.endingEnd=Ds)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=n,this}}const Pv=new Float32Array(1);class Lv extends Ln{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){const d=i[u],f=d.name;let m=h[f];if(m!==void 0)++m.referenceCount,a[u]=m;else{if(m=a[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,f));continue}const _=t&&t._propertyBindings[u].binding.parsedPath;m=new Kd(Ze.create(n,f,_),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,f),a[u]=m}o[u].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),e._byClipCacheIndex=null;const u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new $l(new Float32Array(2),new Float32Array(2),1,Pv),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?qs.findByName(i,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=pa),l!==void 0){const u=l.actionByRoot[s];if(u!==void 0&&u.blendMode===n)return u;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const h=new Qd(this,a,t,n);return this._bindAction(h,c),this._addInactiveAction(h,o,s),h}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?qs.findByName(n,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const h=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,l=o[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class ic{constructor(e){this.value=e}clone(){return new ic(this.value.clone===void 0?this.value:this.value.clone())}}let Iv=0;class Uv extends Ln{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Iv++}),this.name="",this.usage=Bs,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class Dv extends ba{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class Nv{constructor(e,t,n,i,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class Ov{constructor(e,t,n=0,i=1/0){this.ray=new rs(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new _a,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: 
3686Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return _l(e,this,n,t),n.sort(Ph),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)_l(e[i],this,n,t);return n.sort(Ph),n}}function Ph(r,e){return r.distance-e.distance}function _l(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,a=i.length;s<a;s++)_l(i[s],e,t,!0)}}class Fv{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ht(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Bv{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const Lh=new Z;class zv{constructor(e=new Z(1/0,1/0),t=new Z(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Lh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Lh).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Ih=new w,qr=new w;class kv{constructor(e=new w,t=new w){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Ih.subVectors(e,this.start),qr.subVectors(this.end,this.start);const n=qr.dot(qr);let s=qr.dot(Ih)/n;return t&&(s=ht(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Uh=new w;class Vv extends Je{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";
vendor: 17,452 bytes, line 3686
3686const n=new Ge,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,h=o/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}n.setAttribute("position",new ve(i,3));const s=new Bt({fog:!1,toneMapped:!1});this.cone=new pn(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Uh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Uh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Bn=new w,Yr=new Re,wo=new Re;class Hv extends pn{constructor(e){const t=jd(e),n=new Ge,i=[],s=[],a=new pe(0,0,1),o=new pe(0,1,0);for(let c=0;c<t.length;c++){const h=t[c];h.parent&&h.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(a.r,a.g,a.b),s.push(o.r,o.g,o.b))}n.setAttribute("position",new ve(i,3)),n.setAttribute("color",new ve(s,3));const l=new Bt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");wo.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(Yr.multiplyMatrices(wo,o.matrixWorld),Bn.setFromMatrixPosition(Yr),i.setXYZ(a,Bn.x,Bn.y,Bn.z),Yr.multiplyMatrices(wo,o.parent.matrixWorld),Bn.setFromMatrixPosition(Yr),i.setXYZ(a+1,Bn.x,Bn.y,Bn.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function jd(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,jd(r.children[t]));return e}class Gv extends xt{constructor(e,t,n){const i=new nr(t,4,2),s=new Zn({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Wv=new w,Dh=new pe,Nh=new pe;class Xv extends Je{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new tr(t);i.rotateY(Math.PI*.5),this.material=new Zn({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new et(a,3)),this.add(new xt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Dh.copy(this.light.color),Nh.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?Dh:Nh;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Wv.setFromMatrixPosition(this.light.matrixWorld).negate())}}class qv extends pn{constructor(e=10,t=10,n=4473924,i=8947848){n=new pe(n),i=new pe(i);const s=t/2,a=e/t,o=e/2,l=[],c=[];for(let d=0,f=0,m=-o;d<=t;d++,m+=a){l.push(-o,0,m,o,0,m),l.push(m,0,-o,m,0,o);const _=d===s?n:i;_.toArray(c,f),f+=3,_.toArray(c,f),f+=3,_.toArray(c,f),f+=3,_.toArray(c,f),f+=3}const h=new Ge;h.setAttribute("position",new ve(l,3)),h.setAttribute("color",new ve(c,3));const u=new Bt({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Yv extends pn{constructor(e=10,t=16,n=8,i=64,s=4473924,a=8947848){s=new pe(s),a=new pe(a);const o=[],l=[];if(t>1)for(let u=0;u<t;u++){const d=u/t*(Math.PI*2),f=Math.sin(d)*e,m=Math.cos(d)*e;o.push(0,0,0),o.push(f,0,m);const _=u&1?s:a;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let u=0;u<n;u++){const d=u&1?s:a,f=e-e/n*u;for(let m=0;m<i;m++){let _=m/i*(Math.PI*2),g=Math.sin(_)*f,p=Math.cos(_)*f;o.push(g,0,p),l.push(d.r,d.g,d.b),_=(m+1)/i*(Math.PI*2),g=Math.sin(_)*f,p=Math.cos(_)*f,o.push(g,0,p),l.push(d.r,d.g,d.b)}}const c=new Ge;c.setAttribute("position",new ve(o,3)),c.setAttribute("color",new ve(l,3));const h=new Bt({vertexColors:!0,toneMapped:!1});super(c,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Oh=new w,Zr=new w,Fh=new w;class Zv extends Je{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new Ge;i.setAttribute("position",new ve([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Bt({fog:!1,toneMapped:!1});this.lightPlane=new qn(i,s),this.add(this.lightPlane),i=new Ge,i.setAttribute("position",new ve([0,0,0,0,0,1],3)),this.targetLine=new qn(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Oh.setFromMatrixPosition(this.light.matrixWorld),Zr.setFromMatrixPosition(this.light.target.matrixWorld),Fh.subVectors(Zr,Oh),this.lightPlane.lookAt(Zr),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Zr),this.targetLine.scale.z=Fh.length()}}const Jr=new w,ct=new xa;class Jv extends pn{constructor(e){const t=new Ge,n=new Bt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(m,_){l(m),l(_)}function l(m){i.push(0,0,0),s.push(0,0,0),a[m]===void 0&&(a[m]=[]),a[m].push(i.length/3-1)}t.setAttribute("position",new ve(i,3)),t.setAttribute("color",new ve(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new pe(16755200),h=new pe(16711680),u=new pe(43775),d=new pe(16777215),f=new pe(3355443);this.setColors(c,h,u,d,f)}setColors(e,t,n,i,s){const o=this.geometry.getAttribute("color");o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,i.r,i.g,i.b),o.setXYZ(39,i.r,i.g,i.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;ct.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),dt("c",t,e,ct,0,0,-1),dt("t",t,e,ct,0,0,1),dt("n1",t,e,ct,-n,-i,-1),dt("n2",t,e,ct,n,-i,-1),dt("n3",t,e,ct,-n,i,-1),dt("n4",t,e,ct,n,i,-1),dt("f1",t,e,ct,-n,-i,1),dt("f2",t,e,ct,n,-i,1),dt("f3",t,e,ct,-n,i,1),dt("f4",t,e,ct,n,i,1),dt("u1",t,e,ct,n*.7,i*1.1,-1),dt("u2",t,e,ct,-n*.7,i*1.1,-1),dt("u3",t,e,ct,0,i*2,-1),dt("cf1",t,e,ct,-n,0,1),dt("cf2",t,e,ct,n,0,1),dt("cf3",t,e,ct,0,-i,1),dt("cf4",t,e,ct,0,i,1),dt("cn1",t,e,ct,-n,0,-1),dt("cn2",t,e,ct,n,0,-1),dt("cn3",t,e,ct,0,-i,-1),dt("cn4",t,e,ct,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function dt(r,e,t,n,i,s,a){Jr.set(i,s,a).unproject(n);const o=e[r];if(o!==void 0){const l=t.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Jr.x,Jr.y,Jr.z)}}const $r=new Ft;class $v extends pn{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new Ge;s.setIndex(new et(n,1)),s.setAttribute("position",new et(i,3)),super(s,new Bt({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&$r.setFromObject(this.object),$r.isEmpty())return;const t=$r.min,n=$r.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Kv extends pn{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ge;s.setIndex(new et(n,1)),s.setAttribute("position",new ve(i,3)),super(s,new Bt({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class Qv extends qn{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Ge;a.setAttribute("position",new ve(s,3)),a.computeBoundingSphere(),super(a,new Bt({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Ge;l.setAttribute("position",new ve(o,3)),l.computeBoundingSphere(),this.add(new xt(l,new Zn({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Bh=new w;let Kr,Co;class jv extends Je{constructor(e=new w(0,0,1),t=new w(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",Kr===void 0&&(Kr=new Ge,Kr.setAttribute("position",new ve([0,0,0,0,1,0],3)),Co=new os(0,.5,1,5,1),Co.translate(0,-.5,0)),this.position.copy(t),this.line=new qn(Kr,new Bt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new xt(Co,new Zn({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Bh.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Bh,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class ey extends pn{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Ge;i.setAttribute("position",new ve(t,3)),i.setAttribute("color",new ve(n,3));const s=new Bt({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new pe,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ty{constructor(){this.type="ShapePath",this.color=new pe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new ks,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,a){return this.currentPath.bezierCurveTo(e,t,n,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(p){const v=[];for(let x=0,y=p.length;x<y;x++){const R=p[x],T=new vi;T.curves=R.curves,v.push(T)}return v}function n(p,v){const x=v.length;let y=!1;for(let R=x-1,T=0;T<x;R=T++){let C=v[R],U=v[T],S=U.x-C.x,E=U.y-C.y;if(Math.abs(E)>Number.EPSILON){if(E<0&&(C=v[T],S=-S,U=v[R],E=-E),p.y<C.y||p.y>U.y)continue;if(p.y===C.y){if(p.x===C.x)return!0}else{const N=E*(p.x-C.x)-S*(p.y-C.y);if(N===0)return!0;if(N<0)continue;y=!y}}else{if(p.y!==C.y)continue;if(U.x<=p.x&&p.x<=C.x||C.x<=p.x&&p.x<=U.x)return!0}}return y}const i=un.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new vi,l.curves=o.curves,c.push(l),c;let h=!i(s[0].getPoints());h=e?!h:h;const u=[],d=[];let f=[],m=0,_;d[m]=void 0,f[m]=[];for(let p=0,v=s.length;p<v;p++)o=s[p],_=o.getPoints(),a=i(_),a=e?!a:a,a?(!h&&d[m]&&m++,d[m]={s:new vi,p:_},d[m].s.curves=o.curves,h&&m++,f[m]=[]):f[m].push({h:o,p:_[0]});if(!d[0])return t(s);if(d.length>1){let p=!1,v=0;for(let x=0,y=d.length;x<y;x++)u[x]=[];for(let x=0,y=d.length;x<y;x++){const R=f[x];for(let T=0;T<R.length;T++){const C=R[T];let U=!0;for(let S=0;S<d.length;S++)n(C.p,d[S].p)&&(x!==S&&v++,U?(U=!1,u[S].push(C)):p=!0);U&&u[x].push(C)}}v>0&&p===!1&&(f=u)}let g;for(let p=0,v=d.length;p<v;p++){l=d[p].s,c.push(l),g=f[p];for(let x=0,y=g.length;x<y;x++)l.holes.push(g[x].h)}return c}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ua}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ua);const ny=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:gu,AddEquation:kn,AddOperation:du,AdditiveAnimationBlendMode:wl,AdditiveBlending:Po,AgXToneMapping:xu,AlphaFormat:Su,AlwaysCompare:ku,AlwaysDepth:ru,AlwaysStencilFunc:ol,AmbientLight:Gd,AnimationAction:Qd,AnimationClip:qs,AnimationLoader:nv,AnimationMixer:Lv,AnimationObjectGroup:Rv,AnimationUtils:Qx,ArcCurve:pd,ArrayCamera:nd,ArrowHelper:jv,AttachedBindMode:No,Audio:$d,AudioAnalyser:vv,AudioContext:ec,AudioListener:gv,AudioLoader:fv,AxesHelper:ey,BackSide:Ot,BasicDepthPacking:Lu,BasicShadowMap:cf,BatchedMesh:ud,Bone:kl,BooleanKeyframeTrack:Ei,Box2:zv,Box3:Ft,Box3Helper:Kv,BoxGeometry:bi,BoxHelper:$v,BufferAttribute:et,BufferGeometry:Ge,BufferGeometryLoader:Zd,ByteType:yu,Cache:En,Camera:xa,CameraHelper:Jv,CanvasTexture:Sx,CapsuleGeometry:wa,CatmullRomCurve3:md,CineonToneMapping:mu,CircleGeometry:Ca,ClampToEdgeWrapping:Rt,Clock:Jd,Color:pe,ColorKeyframeTrack:Kl,ColorManagement:Qe,CompressedArrayTexture:yx,CompressedCubeTexture:Mx,CompressedTexture:Aa,CompressedTextureLoader:iv,ConeGeometry:Ra,ConstantAlphaFactor:nu,ConstantColorFactor:eu,CubeCamera:Yu,CubeReflectionMapping:Rn,CubeRefractionMapping:Wn,CubeTexture:Ks,CubeTextureLoader:sv,CubeUVReflectionMapping:ss,CubicBezierCurve:Gl,CubicBezierCurve3:gd,CubicInterpolant:Nd,CullFaceBack:Ro,CullFaceFront:kh,CullFaceFrontBack:lf,CullFaceNone:zh,Curve:an,CurvePath:xd,CustomBlending:Hh,CustomToneMapping:_u,CylinderGeometry:os,Cylindrical:Bv,Data3DTexture:Il,DataArrayTexture:ga,DataTexture:xi,DataTextureLoader:rv,DataUtils:vp,DecrementStencilOp:Mf,DecrementWrapStencilOp:bf,DefaultLoadingManager:Bd,DepthFormat:Hn,DepthStencilFormat:yi,DepthTexture:Ol,DetachedBindMode:vu,DirectionalLight:Hd,DirectionalLightHelper:Zv,DiscreteInterpolant:Od,DisplayP3ColorSpace:ma,DodecahedronGeometry:Pa,DoubleSide:hn,DstAlphaFactor:Jh,DstColorFactor:Kh,DynamicCopyUsage:Bf,DynamicDrawUsage:
3686If,DynamicReadUsage:Nf,EdgesGeometry:vd,EllipseCurve:Ta,EqualCompare:Ou,EqualDepth:ou,EqualStencilFunc:wf,EquirectangularReflectionMapping:Cs,EquirectangularRefractionMapping:Rs,Euler:$s,EventDispatcher:Ln,ExtrudeGeometry:Ia,FileLoader:Pn,Float16BufferAttribute:Ap,Float32BufferAttribute:ve,Float64BufferAttribute:Tp,FloatType:nn,Fog:Sa,FogExp2:Ma,FramebufferTexture:vx,FrontSide:Cn,Frustum:Qs,GLBufferAttribute:Nv,GLSL1:kf,GLSL3:ll,GreaterCompare:Fu,GreaterDepth:cu,GreaterEqualCompare:zu,GreaterEqualDepth:lu,GreaterEqualStencilFunc:Lf,GreaterStencilFunc:Rf,GridHelper:qv,Group:$i,HalfFloatType:ji,HemisphereLight:zd,HemisphereLightHelper:Xv,IcosahedronGeometry:Ua,ImageBitmapLoader:dv,ImageLoader:Ys,ImageUtils:Ll,IncrementStencilOp:yf,IncrementWrapStencilOp:Sf,InstancedBufferAttribute:is,InstancedBufferGeometry:Yd,InstancedInterleavedBuffer:Dv,InstancedMesh:hd,Int16BufferAttribute:bp,Int32BufferAttribute:Ep,Int8BufferAttribute:yp,IntType:yl,InterleavedBuffer:ba,InterleavedBufferAttribute:Mi,Interpolant:ir,InterpolateDiscrete:Is,InterpolateLinear:Us,InterpolateSmooth:ia,InvertStencilOp:Ef,KeepStencilOp:ci,KeyframeTrack:on,LOD:ld,LatheGeometry:er,Layers:_a,LessCompare:Nu,LessDepth:au,LessEqualCompare:Rl,LessEqualDepth:ws,LessEqualStencilFunc:Cf,LessStencilFunc:Tf,Light:$n,LightProbe:qd,Line:qn,Line3:kv,LineBasicMaterial:Bt,LineCurve:Wl,LineCurve3:_d,LineDashedMaterial:Id,LineLoop:dd,LineSegments:pn,LinearDisplayP3ColorSpace:Js,LinearEncoding:Cl,LinearFilter:pt,LinearInterpolant:$l,LinearMipMapLinearFilter:pf,LinearMipMapNearestFilter:ff,LinearMipmapLinearFilter:Xn,LinearMipmapNearestFilter:vl,LinearSRGBColorSpace:dn,LinearToneMapping:fu,LinearTransfer:Ns,Loader:Wt,LoaderUtils:gl,LoadingManager:Ql,LoopOnce:Cu,LoopPingPong:Pu,LoopRepeat:Ru,LuminanceAlphaFormat:Eu,LuminanceFormat:bu,MOUSE:af,Material:Lt,MaterialLoader:ka,MathUtils:tp,Matrix3:He,Matrix4:Re,MaxEquation:Do,Mesh:xt,MeshBasicMaterial:Zn,MeshDepthMaterial:Fl,MeshDistanceMaterial:Bl,MeshLambertMaterial:Pd,MeshMatcapMaterial:Ld,MeshNormalMaterial:Rd,MeshPhongMaterial:wd,MeshPhysicalMaterial:Td,MeshStandardMaterial:Zl,MeshToonMaterial:Cd,MinEquation:Uo,MirroredRepeatWrapping:Ls,MixOperation:uu,MultiplyBlending:Io,MultiplyOperation:Zs,NearestFilter:ft,NearestMipMapLinearFilter:df,NearestMipMapNearestFilter:uf,NearestMipmapLinearFilter:Ss,NearestMipmapNearestFilter:oa,NeverCompare:Du,NeverDepth:su,NeverStencilFunc:Af,NoBlending:An,NoColorSpace:Zt,NoToneMapping:Tn,NormalAnimationBlendMode:pa,NormalBlending:gi,NotEqualCompare:Bu,NotEqualDepth:hu,NotEqualStencilFunc:Pf,NumberKeyframeTrack:Ws,Object3D:Je,ObjectLoader:hv,ObjectSpaceNormalMap:Uu,OctahedronGeometry:tr,OneFactor:qh,OneMinusConstantAlphaFactor:iu,OneMinusConstantColorFactor:tu,OneMinusDstAlphaFactor:$h,OneMinusDstColorFactor:Qh,OneMinusSrcAlphaFactor:aa,OneMinusSrcColorFactor:Zh,OrthographicCamera:va,P3Primaries:Fs,PCFShadowMap:xl,PCFSoftShadowMap:Vh,PMREMGenerator:hl,Path:ks,PerspectiveCamera:Et,Plane:zn,PlaneGeometry:js,PlaneHelper:Qv,PointLight:Vd,PointLightHelper:Gv,Points:fd,PointsMaterial:Vl,PolarGridHelper:Yv,PolyhedronGeometry:Jn,PositionalAudio:xv,PropertyBinding:Ze,PropertyMixer:Kd,QuadraticBezierCurve:Xl,QuadraticBezierCurve3:ql,Quaternion:Gt,QuaternionKeyframeTrack:ls,QuaternionLinearInterpolant:Fd,RED_GREEN_RGTC2_Format:rl,RED_RGTC1_Format:wu,REVISION:ua,RGBADepthPacking:Iu,RGBAFormat:Vt,RGBAIntegerFormat:Al,RGBA_ASTC_10x10_Format:jo,RGBA_ASTC_10x5_Format:$o,RGBA_ASTC_10x6_Format:Ko,RGBA_ASTC_10x8_Format:Qo,RGBA_ASTC_12x10_Format:el,RGBA_ASTC_12x12_Format:tl,RGBA_ASTC_4x4_Format:Ho,RGBA_ASTC_5x4_Format:Go,RGBA_ASTC_5x5_Format:Wo,RGBA_ASTC_6x5_Format:Xo,RGBA_ASTC_6x6_Format:qo,RGBA_ASTC_8x5_Format:Yo,RGBA_ASTC_8x6_Format:Zo,RGBA_ASTC_8x8_Format:Jo,RGBA_BPTC_Format:na,RGBA_ETC2_EAC_Format:Vo,RGBA_PVRTC_2BPPV1_Format:zo,RGBA_PVRTC_4BPPV1_Format:Bo,RGBA_S3TC_DXT1_Format:jr,RGBA_S3TC_DXT3_Format:ea,RGBA_S3TC_DXT5_Format:ta,RGB_BPTC_SIGNED_Format:nl,RGB_BPTC_UNSIGNED_Format:il,RGB_ETC1_Format:Tl,RGB_ETC2_Format:ko,RGB_PVRTC_2BPPV1_Format:Fo,RGB_PVRTC_4BPPV1_Format:Oo,RGB_S3TC_DXT1_Format:Qr,RGFormat:Tu,RGIntegerFormat:El,RawS
3686haderMaterial:Ad,Ray:rs,Raycaster:Ov,Rec709Primaries:Os,RectAreaLight:Wd,RedFormat:Au,RedIntegerFormat:bl,ReinhardToneMapping:pu,RenderTarget:Gu,RepeatWrapping:Ps,ReplaceStencilOp:vf,ReverseSubtractEquation:Wh,RingGeometry:Da,SIGNED_RED_GREEN_RGTC2_Format:al,SIGNED_RED_RGTC1_Format:sl,SRGBColorSpace:_t,SRGBTransfer:st,Scene:rd,ShaderChunk:ze,ShaderLib:tn,ShaderMaterial:fn,ShadowMaterial:Ed,Shape:vi,ShapeGeometry:Na,ShapePath:ty,ShapeUtils:un,ShortType:Mu,Skeleton:Ea,SkeletonHelper:Hv,SkinnedMesh:cd,Source:pi,Sphere:Pt,SphereGeometry:nr,Spherical:Fv,SphericalHarmonics3:Xd,SplineCurve:Yl,SpotLight:kd,SpotLightHelper:Vv,Sprite:od,SpriteMaterial:zl,SrcAlphaFactor:ra,SrcAlphaSaturateFactor:jh,SrcColorFactor:Yh,StaticCopyUsage:Ff,StaticDrawUsage:Bs,StaticReadUsage:Df,StereoCamera:pv,StreamCopyUsage:zf,StreamDrawUsage:Uf,StreamReadUsage:Of,StringKeyframeTrack:Ai,SubtractEquation:Gh,SubtractiveBlending:Lo,TOUCH:of,TangentSpaceNormalMap:Yn,TetrahedronGeometry:Oa,Texture:mt,TextureLoader:av,TorusGeometry:Fa,TorusKnotGeometry:Ba,Triangle:kt,TriangleFanDrawMode:_f,TriangleStripDrawMode:gf,TrianglesDrawMode:mf,TubeGeometry:za,TwoPassDoubleSide:hf,UVMapping:da,Uint16BufferAttribute:Ul,Uint32BufferAttribute:Dl,Uint8BufferAttribute:Mp,Uint8ClampedBufferAttribute:Sp,Uniform:ic,UniformsGroup:Uv,UniformsLib:ae,UniformsUtils:qu,UnsignedByteType:wn,UnsignedInt248Type:Vn,UnsignedIntType:bn,UnsignedShort4444Type:Ml,UnsignedShort5551Type:Sl,UnsignedShortType:fa,VSMShadowMap:cn,Vector2:Z,Vector3:w,Vector4:je,VectorKeyframeTrack:Xs,VideoTexture:xx,WebGL1Renderer:sd,WebGL3DRenderTarget:op,WebGLArrayRenderTarget:ap,WebGLCoordinateSystem:sn,WebGLCubeRenderTarget:Zu,WebGLMultipleRenderTargets:lp,WebGLRenderTarget:rn,WebGLRenderer:id,WebGLUtils:td,WebGPUCoordinateSystem:es,WireframeGeometry:bd,WrapAroundEnding:Ds,ZeroCurvatureEnding:di,ZeroFactor:Xh,ZeroSlopeEnding:fi,ZeroStencilOp:xf,_SRGBAFormat:la,createCanvasElement:Hu,sRGBEncoding:Gn},Symbol.toStringTag,{value:"Module"}));export{tp as $,Ze as A,Ft as B,pe as C,Hd as D,Ge as E,Pn as F,cd as G,xt as H,hd as I,pn as J,qn as K,pt as L,Td as M,Ss as N,Je as O,Vd as P,Gt as Q,Vt as R,_t as S,mf as T,wn as U,w as V,rn as W,dd as X,fd as Y,$i as Z,Et as _,_f as a,va as a0,Ea as a1,qs as a2,kl as a3,Is as a4,Us as a5,Mi as a6,mt as a7,Xs as a8,Ws as a9,ls as aa,Qe as ab,Cn as ac,ir as ad,Pt as ae,Ov as af,id as ag,Zt as ah,rd as ai,xa as aj,xx as ak,Vh as al,cn as am,xl as an,cf as ao,Tn as ap,gu as aq,Jd as ar,_a as as,ny as at,js as au,gf as b,Wt as c,gl as d,Z as e,dn as f,kd as g,Re as h,is as i,av as j,dv as k,et as l,ba as m,Xn as n,vl as o,oa as p,ft as q,Ps as r,Ls as s,Rt as t,Vl as u,Lt as v,Bt as w,Zl as x,hn as y,Zn as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.