PageSourceSearch

https://vc.ru/assets/Scene.vue_vue_type_style_index_0_lang-Bp082L0t.js

js vc.ru collected 2026-09-24 07:40:29 UTC 601,258 bytes, 3,845 lines download raw bytes

1import{dQ as mo,z as Vs,aq as Vl,o as Gl,Z as Wl,dR as go,bH as us,r as _o,v as Gc,d as Xl,aN as Yl,df as ql,a as lr,b as hr,S as jl,f as ds,$ as Kl,s as xo}from"./index-DcSVvNrM.js";/**
2 * @license
3 * Copyright 2010-2025 Three.js Authors
4 * SPDX-License-Identifier: MIT
5 */const Ba="175",yi={ROTATE:0,DOLLY:1,PAN:2},Mi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Zl=0,vo=1,$l=2,Wc=1,Xc=2,xn=3,bn=0,Ut=1,nn=2,On=0,Ei=1,Mo=2,So=3,yo=4,Jl=5,Zn=100,Ql=101,eh=102,th=103,nh=104,ih=200,sh=201,rh=202,ah=203,jr=204,Kr=205,oh=206,ch=207,lh=208,hh=209,uh=210,dh=211,fh=212,ph=213,mh=214,Zr=0,$r=1,Jr=2,Ai=3,Qr=4,ea=5,ta=6,na=7,Yc=0,gh=1,_h=2,Bn=0,xh=1,vh=2,Mh=3,qc=4,Sh=5,yh=6,Eh=7,Eo="attached",Th="detached",jc=300,wi=301,Ri=302,$s=303,ia=304,ir=306,Ci=1e3,sn=1001,Js=1002,Rt=1003,Kc=1004,ji=1005,ft=1006,Gs=1007,rn=1008,bh=1008,An=1009,Zc=1010,$c=1011,Qi=1012,za=1013,ei=1014,Dt=1015,Sn=1016,ka=1017,Ha=1018,es=1020,Jc=35902,Qc=1021,el=1022,Gt=1023,tl=1024,nl=1025,ts=1026,ns=1027,Va=1028,Ga=1029,il=1030,Wa=1031,Xa=1033,Ws=33776,Xs=33777,Ys=33778,qs=33779,sa=35840,ra=35841,aa=35842,oa=35843,ca=36196,la=37492,ha=37496,ua=37808,da=37809,fa=37810,pa=37811,ma=37812,ga=37813,_a=37814,xa=37815,va=37816,Ma=37817,Sa=37818,ya=37819,Ea=37820,Ta=37821,js=36492,ba=36494,Aa=36495,sl=36283,wa=36284,Ra=36285,Ca=36286,is=2300,ss=2301,ur=2302,To=2400,bo=2401,Ao=2402,Ah=2500,wh=0,rl=1,Pa=2,Rh=3200,Ch=3201,al=0,Ph=1,Nn="",xt="srgb",Et="srgb-linear",Qs="linear",et="srgb",ri=7680,wo=519,Lh=512,Dh=513,Ih=514,ol=515,Uh=516,Nh=517,Fh=518,Oh=519,La=35044,Ro="300 es",yn=2e3,er=2001;class ni{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){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}}const St=["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 Co=1234567;const Zi=Math.PI/180,Pi=180/Math.PI;function $t(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(St[s&255]+St[s>>8&255]+St[s>>16&255]+St[s>>24&255]+"-"+St[e&255]+St[e>>8&255]+"-"+St[e>>16&15|64]+St[e>>24&255]+"-"+St[t&63|128]+St[t>>8&255]+"-"+St[t>>16&255]+St[t>>24&255]+St[n&255]+St[n>>8&255]+St[n>>16&255]+St[n>>24&255]).toLowerCase()}function Fe(s,e,t){return Math.max(e,Math.min(t,s))}function Ya(s,e){return(s%e+e)%e}function Bh(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function zh(s,e,t){return s!==e?(t-s)/(e-s):0}function $i(s,e,t){return(1-t)*s+t*e}function kh(s,e,t,n){return $i(s,e,1-Math.exp(-t*n))}function Hh(s,e=1){return e-Math.abs(Ya(s,e*2)-e)}function Vh(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function Gh(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function Wh(s,e){return s+Math.floor(Math.random()*(e-s+1))}function Xh(s,e){return s+Math.random()*(e-s)}function Yh(s){return s*(.5-Math.random())}function qh(s){s!==void 0&&(Co=s);let e=Co+=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 jh(s){return s*Zi}function Kh(s){return s*Pi}function Zh(s){return(s&s-1)===0&&s!==0}function $h(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Jh(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Qh(s,e,t,n,i){const r=Math.cos,a=Math.sin,o=r(t/2),c=a(t/2),l=r((e+n)/2),h=a((e+n)/2),u=r((e-n)/2),d=a((e-n)/2),p=r((n-e)/2),g=a((n-e)/2);switch(i){case"XYX":s.set(o*h,c*u,c*d,o*l);break;case"YZY":s.set(c*d,o*h,c*u,o*l);break;case"ZXZ":s.set(c*u,c*d,o*h,o*l);break;case"XZX":s.set(o*h,c*g,c*p,o*l);break;case"YXY":s.set(c*p,o*h,c*g,o*l);break;case"ZYZ":s.set(c*g,c*p,o*h,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Kt(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function Je(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const cl={DEG2RAD:Zi,RAD2DEG:Pi,generateUUID:$t,clamp:Fe,euclideanModulo:Ya,mapLinear:Bh,inverseLerp:zh,lerp:$i,damp:kh,pingpong:Hh,smoothstep:Vh,smootherstep:Gh,randInt:Wh,randFloat:Xh,randFloatSpread:Yh,seededRandom:qh,degToRad:jh,radToDeg:Kh,isPowerOfTwo:Zh,ceilPowerOfTwo:$h,floorPowerOfTwo:Jh,setQuaternionFromProperEuler:Qh,normalize:Je,denormalize:Kt};class Ce{constructor(e=0,t=0){Ce.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: 6,545 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=Fe(this.x,e.x,t.x),this.y=Fe(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Fe(this.x,e,t),this.y=Fe(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Fe(n,e,t))}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(Fe(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),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*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 De{constructor(e,t,n,i,r,a,o,c,l){De.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,c,l)}set(e,t,n,i,r,a,o,c,l){const h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=r,h[5]=c,h[6]=n,h[7]=a,h[8]=l,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,r=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],h=n[4],u=n[7],d=n[2],p=n[5],g=n[8],_=i[0],m=i[3],f=i[6],b=i[1],T=i[4],y=i[7],L=i[2],P=i[5],A=i[8];return r[0]=a*_+o*b+c*L,r[3]=a*m+o*T+c*P,r[6]=a*f+o*y+c*A,r[1]=l*_+h*b+u*L,r[4]=l*m+h*T+u*P,r[7]=l*f+h*y+u*A,r[2]=d*_+p*b+g*L,r[5]=d*m+p*T+g*P,r[8]=d*f+p*y+g*A,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],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t*a*h-t*o*l-n*r*h+n*o*c+i*r*l-i*a*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=h*a-o*l,d=o*c-h*r,p=l*r-a*c,g=t*u+n*d+i*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=u*_,e[1]=(i*l-h*n)*_,e[2]=(o*n-i*a)*_,e[3]=d*_,e[4]=(h*t-i*c)*_,e[5]=(i*r-o*t)*_,e[6]=p*_,e[7]=(n*c-l*t)*_,e[8]=(a*t-n*r)*_,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,r,a,o){const c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-i*l,i*c,-i*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(dr.makeScale(e,t)),this}rotate(e){return this.premultiply(dr.makeRotation(-e)),this}translate(e,t){return this.premultiply(dr.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 dr=new De;function ll(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}function rs(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function eu(){const s=rs("canvas");return s.style.display="block",s}const Po={};function Ks(s){s in Po||(Po[s]=!0,console.warn(s))}function tu(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}function nu(s){const e=s.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function iu(s){const e=s.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Lo=new De().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Do=new De().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.20397
vendor: 1,030 bytes, line 5
57,1.0569715);function su(){const s={enabled:!0,workingColorSpace:Et,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===et&&(i.r=En(i.r),i.g=En(i.g),i.b=En(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===et&&(i.r=Ti(i.r),i.g=Ti(i.g),i.b=Ti(i.b))),i},fromWorkingColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},toWorkingColorSpace:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Nn?Qs:this.spaces[i].transfer},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.space
5s[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[Et]:{primaries:e,whitePoint:n,transfer:Qs,toXYZ:Lo,fromXYZ:Do,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:xt},outputColorSpaceConfig:{drawingBufferColorSpace:xt}},[xt]:{primaries:e,whitePoint:n,transfer:et,toXYZ:Lo,fromXYZ:Do,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:xt}}}),s}const Ve=su();function En(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Ti(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let ai;class ru{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ai===void 0&&(ai=rs("canvas")),ai.width=e.width,ai.height=e.height;const i=ai.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=ai}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=rs("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),r=i.data;for(let a=0;a<r.length;a++)r[a]=En(r[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(En(t[n]/255)*255):t[n]=En(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 au=0;class qa{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:au++}),this.uuid=$t(),this.data=e,this.dataReady=!0,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 r;if(Array.isArray(i)){r=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(fr(i[a].image)):r.push(fr(i[a]))}else r=fr(i);n.url=r}return t||(e.images[this.uuid]=n),n}}function fr(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?ru.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let ou=0;class pt extends ni{constructor(e=pt.DEFAULT_IMAGE,t=pt.DEFAULT_MAPPING,n=sn,i=sn,r=ft,a=rn,o=Gt,c=An,l=pt.DEFAULT_ANISOTROPY,h=Nn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ou++}),this.uuid=$t(),this.name="",this.source=new qa(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new Ce(0,0),this.repeat=new Ce(1,1),this.center=new Ce(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new De,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(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
vendor: 4,630 bytes, line 5
5=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,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!==jc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ci:e.x=e.x-Math.floor(e.x);break;case sn:e.x=e.x<0?0:1;break;case Js: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 Ci:e.y=e.y-Math.floor(e.y);break;case sn:e.y=e.y<0?0:1;break;case Js: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)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}pt.DEFAULT_IMAGE=null;pt.DEFAULT_MAPPING=jc;pt.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,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,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,r;const c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],p=c[5],g=c[9],_=c[2],m=c[6],f=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(g+m)<.1&&Math.abs(l+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(l+1)/2,y=(p+1)/2,L=(f+1)/2,P=(h+d)/4,A=(u+_)/4,w=(g+m)/4;return T>y&&T>L?T<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(T),i=P/n,r=A/n):y>L?y<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(y),n=P/i,r=w/i):L<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(L),n=A/r,i=w/r),this.set(n,i,r,t),this}let b=Math.sqrt((m-g)*(m-g)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(b)<.001&&(b=1),this.x=(m-g)/b,this.y=(u-_)/b,this.z=(d-h
vendor: 4,875 bytes, line 5
5)/b,this.w=Math.acos((l+p+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],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=Fe(this.x,e.x,t.x),this.y=Fe(this.y,e.y,t.y),this.z=Fe(this.z,e.z,t.z),this.w=Fe(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Fe(this.x,e,t),this.y=Fe(this.y,e,t),this.z=Fe(this.z,e,t),this.w=Fe(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Fe(n,e,t))}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 cu extends ni{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=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ft,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new pt(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}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,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].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.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new qa(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ti extends cu{constructor(e=1,t=1,n={}
vendor: 8,409 bytes, line 5
5){super(e,t,n),this.isWebGLRenderTarget=!0}}class hl extends pt{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=Rt,this.minFilter=Rt,this.wrapR=sn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class lu extends pt{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=Rt,this.minFilter=Rt,this.wrapR=sn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class on{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,o){let c=n[i+0],l=n[i+1],h=n[i+2],u=n[i+3];const d=r[a+0],p=r[a+1],g=r[a+2],_=r[a+3];if(o===0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=p,e[t+2]=g,e[t+3]=_;return}if(u!==_||c!==d||l!==p||h!==g){let m=1-o;const f=c*d+l*p+h*g+u*_,b=f>=0?1:-1,T=1-f*f;if(T>Number.EPSILON){const L=Math.sqrt(T),P=Math.atan2(L,f*b);m=Math.sin(m*P)/L,o=Math.sin(o*P)/L}const y=o*b;if(c=c*m+d*y,l=l*m+p*y,h=h*m+g*y,u=u*m+_*y,m===1-o){const L=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=L,l*=L,h*=L,u*=L}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,a){const o=n[i],c=n[i+1],l=n[i+2],h=n[i+3],u=r[a],d=r[a+1],p=r[a+2],g=r[a+3];return e[t]=o*g+h*u+c*p-l*d,e[t+1]=c*g+h*d+l*u-o*p,e[t+2]=l*g+h*p+o*d-c*u,e[t+3]=h*g-o*u-c*d-l*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(i/2),u=o(r/2),d=c(n/2),p=c(i/2),g=c(r/2);switch(a){case"XYZ":this._x=d*h*u+l*p*g,this._y=l*p*u-d*h*g,this._z=l*h*g+d*p*u,this._w=l*h*u-d*p*g;break;case"YXZ":this._x=d*h*u+l*p*g,this._y=l*p*u-d*h*g,this._z=l*h*g-d*p*u,this._w=l*h*u+d*p*g;break;case"ZXY":this._x=d*h*u-l*p*g,this._y=l*p*u+d*h*g,this._z=l*h*g+d*p*u,this._w=l*h*u-d*p*g;break;case"ZYX":this._x=d*h*u-l*p*g,this._y=l*p*u+d*h*g,this._z=l*h*g-d*p*u,this._w=l*h*u+d*p*g;break;case"YZX":this._x=d*h*u+l*p*g,this._y=l*p*u+d*h*g,this._z=l*h*g-d*p*u,this._w=l*h*u-d*p*g;break;case"XZY":this._x=d*h*u-l*p*g,this._y=l*p*u-d*h*g,this._z=l*h*g+d*p*u,this._w=l*h*u+d*p*g;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],r=t[8],a=t[1],o=t[5],c=t[9],l=t[2],h=t[6],u=t[10],d=n+o+u;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(h-c)*p,this._y=(r-l)*p,this._z=(a-i)*p}else if(n>o&&n>u){const p=2*Math.sqrt(1+n-o-u);this._w=(h-c)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(r+l)/p}else if(o>u){const p=2*Math.sqrt(1+o-n-u);this._w=(r-l)/p,this._x=(i+a)/p,this._y=.25*p,this._z=(c+h)/p}else{const p=2*Math.sqrt(1+u-n-o);this._w=(a-i)/p,this._x=(r+l)/p,this._y=(c+h)/p,this._z=.25*p}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(Fe(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,r=e._z,a=e._w,o=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+a*o+i*l-r*c,this._y=i*h+a*c+r*o-n*l,this._z=r*h+a*l+n*c-i*o,this._w=a*h-n*o-i*c-r*l,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,r=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+r*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=r,this;const c=1-o*o;if(c<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*r+t*this._z,this.normalize(),this}const l=Math.sqrt(c),h=Math.atan2(l,o),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}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 D{constructor(e=0,t=0,n=0){D.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Io.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Io.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}
vendor: 4,472 bytes, line 5
5applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*i-o*n),h=2*(o*t-r*i),u=2*(r*n-a*t);return this.x=t+c*l+a*u-o*h,this.y=n+c*h+o*l-r*u,this.z=i+c*u+r*h-a*l,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,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[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=Fe(this.x,e.x,t.x),this.y=Fe(this.y,e.y,t.y),this.z=Fe(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Fe(this.x,e,t),this.y=Fe(this.y,e,t),this.z=Fe(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Fe(n,e,t))}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,r=e.z,a=t.x,o=t.y,c=t.z;return this.x=i*c-r*o,this.y=r*a-n*c,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 pr.copy(this).projectOnVector(e),this.sub(pr)}reflect(e){return this.sub(pr.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(Fe(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()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}
vendor: 1,671 bytes, line 5
5const pr=new D,Io=new on;class ln{constructor(e=new D(1/0,1/0,1/0),t=new D(-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(Yt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Yt.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=Yt.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 r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Yt):Yt.fromBufferAttribute(r,a),Yt.applyM
vendor: 4,637 bytes, line 5
5atrix4(e.matrixWorld),this.expandByPoint(Yt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),fs.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),fs.copy(n.boundingBox)),fs.applyMatrix4(e.matrixWorld),this.union(fs)}const i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[r],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,Yt),Yt.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(zi),ps.subVectors(this.max,zi),oi.subVectors(e.a,zi),ci.subVectors(e.b,zi),li.subVectors(e.c,zi),wn.subVectors(ci,oi),Rn.subVectors(li,ci),Vn.subVectors(oi,li);let t=[0,-wn.z,wn.y,0,-Rn.z,Rn.y,0,-Vn.z,Vn.y,wn.z,0,-wn.x,Rn.z,0,-Rn.x,Vn.z,0,-Vn.x,-wn.y,wn.x,0,-Rn.y,Rn.x,0,-Vn.y,Vn.x,0];return!mr(t,oi,ci,li,ps)||(t=[1,0,0,0,1,0,0,0,1],!mr(t,oi,ci,li,ps))?!1:(ms.crossVectors(wn,Rn),t=[ms.x,ms.y,ms.z],mr(t,oi,ci,li,ps))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Yt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Yt).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:(dn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),dn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),dn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),dn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),dn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),dn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),dn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),dn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(dn),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 dn=[new D,new D,new D,new D,new D,new D,new D,new D],Yt=new D,fs=new ln,oi=new D,ci=new D,li=new D,wn=new D,Rn=new D,Vn=new D,zi=new D,ps=new D,ms=new D,Gn=new D;function mr(s,e,t,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){Gn.fromArray(s,r);const o=i.x*Math.abs(Gn.x)+i.y*Math.abs(Gn.y)+i.z*Math.abs(Gn.z),c=e.dot(Gn),l=t.dot(Gn),h=n.dot(Gn);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const hu=new ln,ki=new D,gr=new D;class hn{constructor(e=new D,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):hu.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));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)}
5applyMatrix4(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;ki.subVectors(e,this.center);const t=ki.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ki,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):(gr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ki.copy(e.center).add(gr)),this.expandByPoint(ki.copy(e.center).sub(gr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const fn=new D,_r=new D,gs=new D,Cn=new D,xr=new D,_s=new D,vr=new D;class as{constructor(e=new D,t=new D(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,fn)),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=fn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(fn.copy(this.origin).addScaledVector(this.direction,t),fn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){_r.copy(e).add(t).multiplyScalar(.5),gs.copy(t).sub(e).normalize(),Cn.copy(this.origin).sub(_r);const r=e.distanceTo(t)*.5,a=-this.direction.dot(gs),o=Cn.dot(this.direction),c=-Cn.dot(gs),l=Cn.lengthSq(),h=Math.abs(1-a*a);let u,d,p,g;if(h>0)if(u=a*c-o,d=a*o-c,g=r*h,u>=0)if(d>=-g)if(d<=g){const _=1/h;u*=_,d*=_,p=u*(u+a*d+2*o)+d*(a*u+d+2*c)+l}else d=r,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*c)+l;else d=-r,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*c)+l;else d<=-g?(u=Math.max(0,-(-a*r+o)),d=u>0?-r:Math.min(Math.max(-r,-c),r),p=-u*u+d*(d+2*c)+l):d<=g?(u=0,d=Math.min(Math.max(-r,-c),r),p=d*(d+2*c)+l):(u=Math.max(0,-(a*r+o)),d=u>0?r:Math.min(Math.max(-r,-c),r),p=-u*u+d*(d+2*c)+l);else d=a>0?-r:r,u=Math.max(0,-(a*d+o)),p=-u*u+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(_r).addScaledVector(gs,d),p}intersectSphere(e,t){fn.subVectors(e.center,this.origin);const n=fn.dot(this.direction),i=fn.dot(fn)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,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,r,a,o,c;const l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),h>=0?(r=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(r=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-d.z)*u,c=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,c=(e.min.z-d.z)*u),n>c||o>i)||((o>n||n!==n)&&(n=o),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,fn)!==null}intersectTriangle(e,t,n,i,r){xr.subVectors(t,e),_s.subVectors(n,e),vr.crossVectors(xr,_s);let a=this.direction.dot(vr),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Cn.subVectors(this.origin,e);const c=o*this.direction.dot(_s.crossVectors(Cn,_s));if(c<0)return null;const l=o*this.direction.dot(xr.cross(Cn));if(l<0||c+l>a)return null;const h=-o*Cn.dot(vr);return h<0?null:this.at(h/a,r)}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 Ie{constructor(e,t,n,i,r,a,o,c,l,h,u,d,p,g,_,m){Ie.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,r,a,o,c,l,h,u,d,p,g,_,m)}set(e,t,n,i,r,a,o,c,l,h,u,d,p,g,_,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=i,f[1]=r,f[5]=a,f[9]=o,f[13]=c,f[2]=l,f[6]=h,f[10]=u,f[14]=d,f[3]=p,f[7]=g,f[11]=_,f[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ie().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/hi.setFromMatrixColumn(e,0).length(),r=1/hi.setFromMatrixColumn(e,1).length(),a=1/hi.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]*r,t[5]=n[5]*r,t[6]=n[6]*r,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,r=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const d=a*h,p=a*u,g=o*h,_=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=p+g*l,t[5]=d-_*l,t[9]=-o*c,t[2]=_-d*l,t[6]=g+p*l,t[10]=a*c}else if(e.order==="YXZ"){const d=c*h,p=c*u,g=l*h,_=l*u;t[0]=d+_*o,t[4]=g*o-p,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=p*
vendor: 6,056 bytes, line 5
5o-g,t[6]=_+d*o,t[10]=a*c}else if(e.order==="ZXY"){const d=c*h,p=c*u,g=l*h,_=l*u;t[0]=d-_*o,t[4]=-a*u,t[8]=g+p*o,t[1]=p+g*o,t[5]=a*h,t[9]=_-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const d=a*h,p=a*u,g=o*h,_=o*u;t[0]=c*h,t[4]=g*l-p,t[8]=d*l+_,t[1]=c*u,t[5]=_*l+d,t[9]=p*l-g,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const d=a*c,p=a*l,g=o*c,_=o*l;t[0]=c*h,t[4]=_-d*u,t[8]=g*u+p,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=p*u+g,t[10]=d-_*u}else if(e.order==="XZY"){const d=a*c,p=a*l,g=o*c,_=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+_,t[5]=a*h,t[9]=p*u-g,t[2]=g*u-p,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(uu,e,du)}lookAt(e,t,n){const i=this.elements;return Ft.subVectors(e,t),Ft.lengthSq()===0&&(Ft.z=1),Ft.normalize(),Pn.crossVectors(n,Ft),Pn.lengthSq()===0&&(Math.abs(n.z)===1?Ft.x+=1e-4:Ft.z+=1e-4,Ft.normalize(),Pn.crossVectors(n,Ft)),Pn.normalize(),xs.crossVectors(Ft,Pn),i[0]=Pn.x,i[4]=xs.x,i[8]=Ft.x,i[1]=Pn.y,i[5]=xs.y,i[9]=Ft.y,i[2]=Pn.z,i[6]=xs.z,i[10]=Ft.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,r=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],h=n[1],u=n[5],d=n[9],p=n[13],g=n[2],_=n[6],m=n[10],f=n[14],b=n[3],T=n[7],y=n[11],L=n[15],P=i[0],A=i[4],w=i[8],S=i[12],v=i[1],R=i[5],V=i[9],F=i[13],O=i[2],X=i[6],z=i[10],$=i[14],G=i[3],te=i[7],ie=i[11],_e=i[15];return r[0]=a*P+o*v+c*O+l*G,r[4]=a*A+o*R+c*X+l*te,r[8]=a*w+o*V+c*z+l*ie,r[12]=a*S+o*F+c*$+l*_e,r[1]=h*P+u*v+d*O+p*G,r[5]=h*A+u*R+d*X+p*te,r[9]=h*w+u*V+d*z+p*ie,r[13]=h*S+u*F+d*$+p*_e,r[2]=g*P+_*v+m*O+f*G,r[6]=g*A+_*R+m*X+f*te,r[10]=g*w+_*V+m*z+f*ie,r[14]=g*S+_*F+m*$+f*_e,r[3]=b*P+T*v+y*O+L*G,r[7]=b*A+T*R+y*X+L*te,r[11]=b*w+T*V+y*z+L*ie,r[15]=b*S+T*F+y*$+L*_e,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],r=e[12],a=e[1],o=e[5],c=e[9],l=e[13],h=e[2],u=e[6],d=e[10],p=e[14],g=e[3],_=e[7],m=e[11],f=e[15];return g*(+r*c*u-i*l*u-r*o*d+n*l*d+i*o*p-n*c*p)+_*(+t*c*p-t*l*d+r*a*d-i*a*p+i*l*h-r*c*h)+m*(+t*l*u-t*o*p-r*a*u+n*a*p+r*o*h-n*l*h)+f*(-i*o*h-t*c*u+t*o*d+i*a*u-n*a*d+n*c*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],r=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],p=e[11],g=e[12],_=e[13],m=e[14],f=e[15],b=u*m*l-_*d*l+_*c*p-o*m*p-u*c*f+o*d*f,T=g*d*l-h*m*l-g*c*p+a*m*p+h*c*f-a*d*f,y=h*_*l-g*u*l+g*o*p-a*_*p-h*o*f+a*u*f,L=g*u*c-h*_*c-g*o*d+a*_*d+h*o*m-a*u*m,P=t*b+n*T+i*y+r*L;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/P;return e[0]=b*A,e[1]=(_*d*r-u*m*r-_*i*p+n*m*p+u*i*f-n*d*f)*A,e[2]=(o*m*r-_*c*r+_*i*l-n*m*l-o*i*f+n*c*f)*A,e[3]=(u*c*r-o*d*r-u*i*l+n*d*l+o*i*p-n*c*p)*A,e[4]=T*A,e[5]=(h*m*r-g*d*r+g*i*p-t*m*p-h*i*f+t*d*f)*A,e[6]=(g*c*r-a*m*r-g*i*l+t*m*l+a*i*f-t*c*f)*A,e[7]=(a*d*r-h*c*r+h*i*l-t*d*l-a*i*p+t*c*p)*A,e[8]=y*A,e[9]=(g*u*r-h*_*r-g*n*p+t*_*p+h*n*f-t*u*f)*A,e[10]=(a*_*r-g*o*r+g*n*l-t*_*l-a*n*f+t*o*f)*A,e[11]=(h*o*r-a*u*r-h*n*l+t*u*l+a*n*p-t*o*p)*A,e[12]=L*A,e[13]=(h*_*i-g*u*i+g*n*d-t*_*d-h*n*m+t*u*m)*A,e[14]=(g*o*i-a*_*i-g*n*c+t*_*c+a*n*m-t*o*m)*A,e[15]=(a*u*i-h*o*i+h*n*c-t*u*c-a*n*d+t*o*d)*A,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,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),r=1-n,a=e.x,o=e.y,c=e.z,l=r*a,h=r*o;return this.set(l*a+n,l*o-i*c,l*c+i*o,0,l*o+i*c,h*o+n,h*c-i*a,0,l*c-i*o,h*c+i*a,r*c*c+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,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,o=t._z,c=t._w,l=r+r,h=a+a,u=o+o,d=r*l,p=r*h,g=r*u,_=a*h,m=a*u,f=o*u,b=c*l,T=c*h,y=c*u,L=n.x,P=n.y,A=n.z;return i[0]=(1-(_+f))*L,i[1]=(p+y)*L,i[2]=(g-T)*L,i[3]=0,i[4]=(p-y)*P,i[5]=(1-(d+f))*P,i[6]=(m+b)*P,i[7]=0,i[8]=(g+T)*A,i[9]=(m-b)*A,i[10]=(1-(d+_))*A,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 r=hi.set(i[0],i[1],i[2]).length();const a=hi.set(i[4],i[5],i[6]).length(),o=hi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],qt.copy(this);const l=1/r,h=1/a,u=1/o;return qt.elements[0]*=l,qt.elements[1]*=l,qt.elements[2]*=l,qt.elements[4]*=h,qt.elements[5]*=h,qt.elements[6]*=h,qt.elements[8]*=u,qt.elements[9]*=u,qt.elements[10]*=u,t.setFromRotationMatrix(qt),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,r,a,o=yn){const c=this.elements,l=2*r/(t-e),h=2*r/(n-i),u=(t+e)/(t-e),d=(n+i)/(n-i);let p,g;if(o===yn)p=-(a+r)/(a-r),g=-2*a*r/(a-r);else if(o===er)p=-a/(a-r),g=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=g,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}
5makeOrthographic(e,t,n,i,r,a,o=yn){const c=this.elements,l=1/(t-e),h=1/(n-i),u=1/(a-r),d=(t+e)*l,p=(n+i)*h;let g,_;if(o===yn)g=(a+r)*u,_=-2*u;else if(o===er)g=r*u,_=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*h,c[9]=0,c[13]=-p,c[2]=0,c[6]=0,c[10]=_,c[14]=-g,c[3]=0,c[7]=0,c[11]=0,c[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 hi=new D,qt=new Ie,uu=new D(0,0,0),du=new D(1,1,1),Pn=new D,xs=new D,Ft=new D,Uo=new Ie,No=new on;class cn{constructor(e=0,t=0,n=0,i=cn.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,r=i[0],a=i[4],o=i[8],c=i[1],l=i[5],h=i[9],u=i[2],d=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(Fe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Fe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Fe(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-Fe(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Fe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Fe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Uo.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Uo,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return No.setFromEuler(this),this.setFromQuaternion(No,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}}cn.DEFAULT_ORDER="XYZ";class ul{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 fu=0;const Fo=new D,ui=new on,pn=new Ie,vs=new D,Hi=new D,pu=new D,mu=new on,Oo=new D(1,0,0),Bo=new D(0,1,0),zo=new D(0,0,1),ko={type:"added"},gu={type:"removed"},di={type:"childadded",child:null},Mr={type:"childremoved",child:null};class at extends ni{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:fu++}),this.uuid=$t(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=at.DEFAULT_UP.clone();const e=new D,t=new cn,n=new on,i=new D(1,1,1);function r(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),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 Ie},normalMatrix:{value:new De}}),this.matrix=new Ie,this.matrixWorld=new Ie,this.matrixAutoUpdate=at.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ul,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,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)}
5setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ui.setFromAxisAngle(e,t),this.quaternion.multiply(ui),this}rotateOnWorldAxis(e,t){return ui.setFromAxisAngle(e,t),this.quaternion.premultiply(ui),this}rotateX(e){return this.rotateOnAxis(Oo,e)}rotateY(e){return this.rotateOnAxis(Bo,e)}rotateZ(e){return this.rotateOnAxis(zo,e)}translateOnAxis(e,t){return Fo.copy(e).applyQuaternion(this.quaternion),this.position.add(Fo.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Oo,e)}translateY(e){return this.translateOnAxis(Bo,e)}translateZ(e){return this.translateOnAxis(zo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(pn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?vs.copy(e):vs.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Hi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?pn.lookAt(Hi,vs,this.up):pn.lookAt(vs,Hi,this.up),this.quaternion.setFromRotationMatrix(pn),i&&(pn.extractRotation(i.matrixWorld),ui.setFromRotationMatrix(pn),this.quaternion.premultiply(ui.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.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ko),di.child=e,this.dispatchEvent(di),di.child=null):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(gu),Mr.child=e,this.dispatchEvent(Mr),Mr.child=null),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),pn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),pn.multiply(e.parent.matrixWorld)),e.applyMatrix4(pn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ko),di.child=e,this.dispatchEvent(di),di.child=null,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 r=0,a=i.length;r<a;r++)i[r].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(Hi,e,pu),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hi,mu,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.matrixWorldAutoUpdate===!0&&(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++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].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.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.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 r(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.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=r(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(e.materials,this.material[c]));i.material=o}else i.material=r(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 c=this.animations[o];i.animations.push(r(e.animations,c))}}if(t){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),p=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}return n.object=i,n;function a(o){const c=[];for(const l in o){const h=o[l];delete h.metadata,c.push(h)}return c}}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}}at.DEFAULT_UP=new D(0,1,0);at.DEFAULT_MATRIX_AUTO_UPDATE=!0;at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const jt=new D,mn=new D,Sr=new D,gn=new D,fi=new D,pi=new D,Ho=new D,yr=new D,Er=new D,Tr=new D,br=new je,Ar=new je,wr=new je;class Zt{constructor(e=new D,t=new D,n=new D){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),jt.subVectors(e,t),i.cross(jt);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){jt.subVectors(i,t),mn.subVectors(n,t),Sr.subVectors(e,t);const a=jt.dot(jt),o=jt.dot(mn),c=jt.dot(Sr),l=mn.dot(mn),h=mn.dot(Sr),u=a*l-o*o;if(u===0)return r.set(0,0,0),null;const d=1/u,p=(l*c-o*h)*d,g=(a*h-o*c)*d;return r.set(1-p-g,g,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,gn)===null?!1:gn.x>=0&&gn.y>=0&&gn.x+gn.y<=1}static getInterpolation(e,t,n,i,r,a,o,c){return this.getBarycoord(e,t,n,i,gn)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,gn.x),c.addScaledVector(a,gn.y),c.addScaledVector(o,gn.z),c)}static getInterpolatedAttribute(e,t,n,i,r,a){return br.setScalar(0),Ar.setScalar(0),wr.setScalar(0),br.fromBufferAttribute(e,t),Ar.fromBufferAttribute(e,n),wr.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(br,r.x),a.addScaledVector(Ar,r.y),a.addScaledVector(wr,r.z),a}static isFrontFacing(e,t,n,i){return jt.subVectors(n,t),mn.subVectors(e,t),jt.cross(mn).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 jt.subVectors(this.c,this.b),mn.subVectors(this.a,this.b),jt.cross(mn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Zt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Zt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Zt.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Zt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Zt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,o;fi.subVectors(i,n),pi.subVectors(r,n),yr.subVectors(e,n);const c=fi.dot(yr),l=pi.dot(yr);if(c<=0&&l<=0)return t.copy(n);Er.subVectors(e,i);const h=fi.dot(Er),u=pi.dot(Er);if(h>=0&&u<=h)return t.copy(i);const d=c*u-h*l;
vendor: 7,497 bytes, line 5
5if(d<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(fi,a);Tr.subVectors(e,r);const p=fi.dot(Tr),g=pi.dot(Tr);if(g>=0&&p<=g)return t.copy(r);const _=p*l-c*g;if(_<=0&&l>=0&&g<=0)return o=l/(l-g),t.copy(n).addScaledVector(pi,o);const m=h*g-p*u;if(m<=0&&u-h>=0&&p-g>=0)return Ho.subVectors(r,i),o=(u-h)/(u-h+(p-g)),t.copy(i).addScaledVector(Ho,o);const f=1/(m+_+d);return a=_*f,o=d*f,t.copy(n).addScaledVector(fi,a).addScaledVector(pi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const dl={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},Ln={h:0,s:0,l:0},Ms={h:0,s:0,l:0};function Rr(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}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=xt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ve.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Ve.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ve.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Ve.workingColorSpace){if(e=Ya(e,1),t=Fe(t,0,1),n=Fe(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=Rr(a,r,e+1/3),this.g=Rr(a,r,e),this.b=Rr(a,r,e-1/3)}return Ve.toWorkingColorSpace(this,i),this}setStyle(e,t=xt){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,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=xt){const n=dl[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=En(e.r),this.g=En(e.g),this.b=En(e.b),this}copyLinearToSRGB(e){return this.r=Ti(e.r),this.g=Ti(e.g),this.b=Ti(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=xt){return Ve.fromWorkingColorSpace(yt.copy(this),e),Math.round(Fe(yt.r*255,0,255))*65536+Math.round(Fe(yt.g*255,0,255))*256+Math.round(Fe(yt.b*255,0,255))}getHexString(e=xt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ve.workingColorSpace){Ve.fromWorkingColorSpace(yt.copy(this),t);const n=yt.r,i=yt.g,r=yt.b,a=Math.max(n,i,r),o=Math.min(n,i,r);let c,l;const h=(o+a)/2;if(o===a)c=0,l=0;else{const u=a-o;switch(l=h<=.5?u/(a+o):u/(2-a-o),a){case n:c=(i-r)/u+(i<r?6:0);break;case i:c=(r-n)/u+2;break;case r:c=(n-i)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=Ve.workingColorSpace){return Ve.fromWorkingColorSpace(yt.copy(this),t),e.r=yt.r,e.g=yt.g,e.b=yt.b,e}getStyle(e=xt){Ve.fromWorkingColorSpace(yt.copy(this),e);const t=yt.r,n=yt.g,i=yt.b;return e!==xt?`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(Ln),this.setHSL(Ln.h+e,Ln.s+t,Ln.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}
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(Ln),e.getHSL(Ms);const n=$i(Ln.h,Ms.h,t),i=$i(Ln.s,Ms.s,t),r=$i(Ln.l,Ms.l,t);return this.setHSL(n,i,r),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,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[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 yt=new Pe;Pe.NAMES=dl;let _u=0;class an extends ni{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:_u++}),this.uuid=$t(),this.name="",this.type="Material",this.blending=Ei,this.side=bn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=jr,this.blendDst=Kr,this.blendEquation=Zn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Pe(0,0,0),this.blendAlpha=0,this.depthFunc=Ai,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=wo,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ri,this.stencilZFail=ri,this.stencilZPass=ri,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.allowOverride=!0,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}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: 8,832 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!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(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.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(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.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(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!==Ei&&(n.blending=this.blending),this.side!==bn&&(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!==jr&&(n.blendSrc=this.blendSrc),this.blendDst!==Kr&&(n.blendDst=this.blendDst),this.blendEquation!==Zn&&(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!==Ai&&(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!==wo&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ri&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ri&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ri&&(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(r){const a=[];for(const o in r){const c=r[o];delete c.metadata,a.push(c)}return a}if(t){const r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),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 r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
5adows,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++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Jn extends an{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.envMapRotation=new cn,this.combine=Yc,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.envMapRotation.copy(e.envMapRotation),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 Mn=xu();function xu(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let c=0;c<256;++c){const l=c-127;l<-27?(n[c]=0,n[c|256]=32768,i[c]=24,i[c|256]=24):l<-14?(n[c]=1024>>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const r=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,h=0;for(;(l&8388608)===0;)l<<=1,h-=8388608;l&=-8388609,h+=947912704,r[c]=l|h}for(let c=1024;c<2048;++c)r[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)a[c]=c<<23;a[31]=1199570944,a[32]=2147483648;for(let c=33;c<63;++c)a[c]=2147483648+(c-32<<23);a[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(o[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:a,offsetTable:o}}function vu(s){Math.abs(s)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),s=Fe(s,-65504,65504),Mn.floatView[0]=s;const e=Mn.uint32View[0],t=e>>23&511;return Mn.baseTable[t]+((e&8388607)>>Mn.shiftTable[t])}function Mu(s){const e=s>>10;return Mn.uint32View[0]=Mn.mantissaTable[Mn.offsetTable[e]+(s&1023)]+Mn.exponentTable[e],Mn.floatView[0]}class Ss{static toHalfFloat(e){return vu(e)}static fromHalfFloat(e){return Mu(e)}}const ut=new D,ys=new Ce;let Su=0;class Ct{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Su++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=La,this.updateRanges=[],this.gpuType=Dt,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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,r=this.itemSize;i<r;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++)ys.fromBufferAttribute(this,t),ys.applyMatrix3(e),this.setXY(t,ys.x,ys.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;
5t++)ut.fromBufferAttribute(this,t),ut.applyMatrix3(e),this.setXYZ(t,ut.x,ut.y,ut.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ut.fromBufferAttribute(this,t),ut.applyMatrix4(e),this.setXYZ(t,ut.x,ut.y,ut.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ut.fromBufferAttribute(this,t),ut.applyNormalMatrix(e),this.setXYZ(t,ut.x,ut.y,ut.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ut.fromBufferAttribute(this,t),ut.transformDirection(e),this.setXYZ(t,ut.x,ut.y,ut.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=Kt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Kt(t,this.array)),t}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Kt(t,this.array)),t}setY(e,t){return this.normalized&&(t=Je(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=Kt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Je(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=Kt(t,this.array)),t}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(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=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array),r=Je(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,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!==La&&(e.usage=this.usage),e}}class fl extends Ct{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class pl extends Ct{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Tn extends Ct{constructor(e,t,n){super(new Float32Array(e),t,n)}}let yu=0;const Ht=new Ie,Cr=new at,mi=new D,Ot=new ln,Vi=new ln,_t=new D;class Jt extends ni{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:yu++}),this.uuid=$t(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(ll(e)?pl:fl)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}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 r=new De().getNormalMatrix(e);n.applyNormalMatrix(r),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 Ht.makeRotationFromQuaternion(e),this.applyMatrix4(Ht),this}rotateX(e){return Ht.makeRotationX(e),this.applyMatrix4(Ht),this}rotateY(e){return Ht.makeRotationY(e),this.applyMatrix4(Ht),this}rotateZ(e){return Ht.makeRotationZ(e),this.applyMatrix4(Ht),this}translate(e,t,n){return Ht.makeTranslation(e,t,n),this.applyMatrix4(Ht),this}scale(e,t,n){return Ht.makeScale(e,t,n),this.applyMatrix4(Ht),this}lookAt(e){return Cr.lookAt(e),Cr.updateMatrix(),this.applyMatrix4(Cr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(mi).negate(),this.translate(mi.x,mi.y,mi.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,r=e.length;i<r;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Tn(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ln);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(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 r=t[n];Ot.setFromBufferAttribute(r),this.morphTargetsRelative?(_t.addVectors(this.boundingBox.min,Ot.min),this.boundingBox.expandByPoint(_t),_t.addVectors(this.boundingBox.max,Ot.max),this.boundingBox.expandByPoint(_t)):(this.boundingBox.expandByPoint(Ot.min),this.boundingBox.expandByPoint(Ot.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 hn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(e){const n=this.boundingSphere.center;if(Ot.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];Vi.setFromBufferAttribute(o),this.morphTargetsRelative?(_t.addVectors(Ot.min,Vi.min),Ot.expandByPoint(_t),_t.addVectors(Ot.max,Vi.max),Ot.expandByPoint(_t)):(Ot.expandByPoint(Vi.min),Ot.expandByPoint(Vi.max))}Ot.getCenter(n);let i=0;for(let r=0,a=e.count;r<a;r++)_t.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(_t));if(t)for(let r=0,a=t.length;r<a;r++){const o=t[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)_t.fromBufferAttribute(o,l),c&&(mi.fromBufferAttribute(e,l),_t.add(mi)),i=Math.max(i,n.distanceToSquared(_t))}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=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ct(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let w=0;w<n.count;w++)o[w]=new D,c[w]=new D;const l=new D,h=new D,u=new D,d=new Ce,p=new Ce,g=new Ce,_=new D,m=new D;function f(w,S,v){l.fromBufferAttribute(n,w),h.fromBufferAttribute(n,S),u.fromBufferAttribute(n,v),d.fromBufferAttribute(r,w),p.fromBufferAttribute(r,S),g.fromBufferAttribute(r,v),h.sub(l),u.sub(l),p.sub(d),g.sub(d);const R=1/(p.x*g.y-g.x*p.y);isFinite(R)&&(_.copy(h).multiplyScalar(g.y).addScaledVector(u,-p.y).multiplyScalar(R),m.copy(u).multiplyScalar(p.x).addScaledVector(h,-g.x).multiplyScalar(R),o[w].add(_),o[S].add(_),o[v].add(_),c[w].add(m),c[S].add(m),c[v].add(m))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let w=0,S=b.length;w<S;++w){const v=b[w],R=v.start,V=v.count;for(let F=R,O=R+V;F<O;F+=3)f(e.getX(F+0),e.getX(F+1),e.getX(F+2))}const T=new D,y=new D,L=new D,P=new D;function A(w){L.fromBufferAttribute(i,w),P.copy(L);const S=o[w];T.copy(S),T.sub(L.multiplyScalar(L.dot(S))).normalize(),y.crossVectors(P,S);const R=y.dot(c[w])<0?-1:1;a.setXYZW(w,T.x,T.y,T.z,R)}for(let w=0,S=b.length;w<S;++w){const v=b[w],R=v.start,V=v.count;for(let F=R,O=R+V;F<O;F+=3)A(e.getX(F+0)),A(e.getX(F+1)),A(e.getX(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 Ct(new Float32Array(t.count*3),3),this.setAttribute("normal",n
5);else for(let d=0,p=n.count;d<p;d++)n.setXYZ(d,0,0,0);const i=new D,r=new D,a=new D,o=new D,c=new D,l=new D,h=new D,u=new D;if(e)for(let d=0,p=e.count;d<p;d+=3){const g=e.getX(d+0),_=e.getX(d+1),m=e.getX(d+2);i.fromBufferAttribute(t,g),r.fromBufferAttribute(t,_),a.fromBufferAttribute(t,m),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),o.fromBufferAttribute(n,g),c.fromBufferAttribute(n,_),l.fromBufferAttribute(n,m),o.add(h),c.add(h),l.add(h),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let d=0,p=t.count;d<p;d+=3)i.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,r),u.subVectors(i,r),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++)_t.fromBufferAttribute(e,t),_t.normalize(),e.setXYZ(t,_t.x,_t.y,_t.z)}toNonIndexed(){function e(o,c){const l=o.array,h=o.itemSize,u=o.normalized,d=new l.constructor(c.length*h);let p=0,g=0;for(let _=0,m=c.length;_<m;_++){o.isInterleavedBufferAttribute?p=c[_]*o.data.stride+o.offset:p=c[_]*h;for(let f=0;f<h;f++)d[g++]=l[p++]}return new Ct(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Jt,n=this.index.array,i=this.attributes;for(const o in i){const c=i[o],l=e(c,n);t.setAttribute(o,l)}const r=this.morphAttributes;for(const o in r){const c=[],l=r[o];for(let h=0,u=l.length;h<u;h++){const d=l[h],p=e(d,n);c.push(p)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);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 c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u<d;u++){const p=l[u];h.push(p.toJSON(e.data))}h.length>0&&(i[c]=h,r=!0)}r&&(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());const i=e.attributes;for(const l in i){const h=i[l];this.setAttribute(l,h.clone(t))}const r=e.morphAttributes;for(const l in r){const h=[],u=r[l];for(let d=0,p=u.length;d<p;d++)h.push(u[d].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,h=a.length;l<h;l++){const u=a[l];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Vo=new Ie,Wn=new as,Es=new hn,Go=new D,Ts=new D,bs=new D,As=new D,Pr=new D,ws=new D,Wo=new D,Rs=new D;class It extends at{constructor(e=new Jt,t=new Jn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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 r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){ws.set(0,0,0);for(let c=0,l=r.length;c<l;c++){const h=o[c],u=r[c];h!==0&&(Pr.fromBufferAttribute(u,e),a?ws.addScaledVector(Pr,h):ws.addScaledVector(Pr.sub(t),h))}t.add(ws)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Es.copy(n.boundingSphere),Es.applyMatrix4(r),Wn.copy(e.ray).recast(e.near),!(Es.containsPoint(Wn.origin)===!1&&(Wn.intersectSphere(Es,Go)===null||Wn.origin.distanceToSquared(Go)>(e.far-e.near)**2))&&(Vo.copy(r).invert(),Wn.copy(e.ray).applyMatrix4(Vo),!(n.boundingBox!==null&&Wn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Wn)))}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,o=r.index,c=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,d=r.groups,p=r.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const m=d[g],f=a[m.materialIndex],b=Math.max(m.start,p.start),T=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let y=b,L=T;y<L;y+=3){const P=o.getX(y),A=o.getX(y+1),w=o.getX(y+2);i=Cs(this,f,e,n,l,h,u,P,A,w),i&&(i.faceIndex=Math.floor(y/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const g=Math.max(0,p.start),_=Math.min(o.count,p.start+p.count);for(let m=g,f=_;m<f;m+=3){const b=o.getX(m),T=o.getX(m+1),y=o.getX(m+2);i=Cs(this,a,e,n,l,h,u,b,T,y),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const m=d[g],f=a[m.materialIndex],b=Math.max(m.start,p.start),T=Math.min(c.count,Math.min(m.start+m.count,p.start+p.count));for(let y=b,L=T;y<L;y+=3){const P=y,A=y+1,w=y+2;i=Cs(this,f,e,n,l,h,u,P,A,w),i&&(i.faceIndex=Math.floor(y/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const g=Math.max(0,p.start),_=Math.min(c.count,p.start+p.count);for(let m=g,f=_;m<f;m+=3){const b=m,T=m+1,y=m+2;i=Cs(this,a,e,n,l,h,u,b,T,y),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}}function Eu(s,e,t,n,i,r,a,o){let c;if(e.side===Ut?c=n.intersectTriangle(a,r,i,!0,o):c=n.intersectTriangle(i,r,a,e.side===bn,o),c===null)return null;Rs.copy(o),Rs.applyMatrix4(s.matrixWorld);const l=t.ray.origin.distanceTo(Rs);return l<t.near||l>t.far?null:{distance:l,point:Rs.clone(),object:s}}function Cs(s,e,t,n,i,r,a,o,c,l){s.getVertexPosition(o,Ts),s.getVertexPosition(c,bs),s.getVertexPosition(l,As);const h=Eu(s,e,t,n,Ts,bs,As,Wo);if(h){const u=new D;Zt.getBarycoord(Wo,Ts,bs,As,u),i&&(h.uv=Zt.getInterpolatedAttribute(i,o,c,l,u,new Ce)),r&&(h.uv1=Zt.getInterpolatedAttribute(r,o,c,l,u,new Ce)),a&&(h.normal=Zt.getInterpolatedAttribute(a,o,c,l,u,new D),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:c,c:l,normal:new D,materialIndex:0};Zt.getNormal(Ts,bs,As,d.normal),h.face=d,h.barycoord=u}return h}class os extends Jt{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const c=[],l=[],h=[],u=[];let d=0,p=0;g("z","y","x",-1,-1,n,t,e,a,r,0),g("z","y","x",1,-1,n,t,-e,a,r,1),g("x","z","y",1,1,e,n,t,i,a,2),g("x","z","y",1,-1,e,n,-t,i,a,3),g("x","y","z",1,-1,e,t,n,i,r,4),g("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(c),this.setAttribute("position",new Tn(l,3)),this.setAttribute("normal",new Tn(h,3)),this.setAttribute("uv",new Tn(u,2));function g(_,m,f,b,T,y,L,P,A,w,S){const v=y/A,R=L/w,V=y/2,F=L/2,O=P/2,X=A+1,z=w+1;let $=0,G=0;const te=new D;for(let ie=0;ie<z;ie++){const _e=ie*R-F;for(let Ee=0;Ee<X;Ee++){const Oe=Ee*v-V;te[_]=Oe*b,te[m]=_e*T,te[f]=O,l.push(te.x,te.y,te.z),te[_]=0,te[m]=0,te[f]=P>0?1:-1,h.push(te.x,te.y,te.z),u.push(Ee/A),u.push(1-ie/w),$+=1}}for(let ie=0;ie<w;ie++)for(let _e=0;_e<A;_e++){const Ee=d+_e+X*ie,Oe=d+_e+X*(ie+1),Y=d+(_e+1)+X*(ie+1),ee=d+(_e+1)+X*ie;c.push(Ee,Oe,ee),c.push(Oe,Y,ee),G+=6}o.addGroup(p,G,S),p+=G,d+=$}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new os(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Li(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[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 At(s){const e={};for(let t=0;t<s.length;t++){const n=Li(s[t]);for(const i in n)e[i]=n[i]}return e}function Tu(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function ml(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ve.workingColorSpace}const bu={clone:Li,merge:At};var Au=`void main() {
6	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7}`,wu=`void main() {
8	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9}`;class zn extends an{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Au,this.fragmentShader=wu,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Li(e.uniforms),this.uniformsGroups=Tu(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 gl extends at{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ie,this.projectionMatrix=new Ie,this.projectionMatrixInverse=new Ie,this.coordinateSystem=yn}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)}}const Dn=new D,Xo=new Ce,Yo=new Ce;class wt extends gl{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=Pi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Zi*.5*this.fov);return .5*this.getFilmHeight()/e}
9getEffectiveFOV(){return Pi*2*Math.atan(Math.tan(Zi*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Dn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Dn.x,Dn.y).multiplyScalar(-e/Dn.z),Dn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Dn.x,Dn.y).multiplyScalar(-e/Dn.z)}getViewSize(e,t){return this.getViewBounds(e,Xo,Yo),t.subVectors(Yo,Xo)}setViewOffset(e,t,n,i,r,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=r,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(Zi*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*i/c,t-=a.offsetY*n/l,i*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+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 gi=-90,_i=1;class Ru extends at{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new wt(gi,_i,e,t);i.layers=this.layers,this.add(i);const r=new wt(gi,_i,e,t);r.layers=this.layers,this.add(r);const a=new wt(gi,_i,e,t);a.layers=this.layers,this.add(a);const o=new wt(gi,_i,e,t);o.layers=this.layers,this.add(o);const c=new wt(gi,_i,e,t);c.layers=this.layers,this.add(c);const l=new wt(gi,_i,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,c]=t;for(const l of t)this.remove(l);if(e===yn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===er)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.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[r,a,o,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),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,c),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),e.render(t,h),e.setRenderTarget(u,d,p),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class _l extends pt{constructor(e=[],t=wi,n,i,r,a,o,c,l,h){super(e,t,n,i,r,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Cu extends ti{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];this.texture=new _l(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:ft}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
9=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 os(5,5,5),r=new zn({name:"CubemapFromEquirect",uniforms:Li(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ut,blending:On});r.uniforms.tEquirect.value=t;const a=new It(i,r),o=t.minFilter;return t.minFilter===rn&&(t.minFilter=ft),new Ru(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}class Qn extends at{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Pu={type:"move"};class Lr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Qn,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 Qn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Qn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D),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,r=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,n),f=this._getHandJoint(l,_);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),p=.02,g=.005;l.inputState.pinching&&d>p+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=p-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),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(Pu)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Qn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Lu extends at{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new cn,this.environmentIntensity=1,this.environmentRotation=new cn,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,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),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.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Du{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=La,this.updateRanges=[],this.version=0,this.uuid=$t()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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,r=this.stride;i<r;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=$t()),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=$t()),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 bt=new D;class ja{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;
44t++)bt.fromBufferAttribute(this,t),bt.applyMatrix4(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)bt.fromBufferAttribute(this,t),bt.applyNormalMatrix(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)bt.fromBufferAttribute(this,t),bt.transformDirection(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Kt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Je(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=Kt(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Kt(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Kt(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Kt(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(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=Je(t,this.array),n=Je(n,this.array),i=Je(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,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array),r=Je(r,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]=r,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 r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new Ct(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 ja(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 r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}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}}}const qo=new D,jo=new je,Ko=new je,Iu=new D,Zo=new Ie,Ps=new D,Dr=new hn,$o=new Ie,Ir=new as;class Uu extends It{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Eo,this.bindMatrix=new Ie,this.bindMatrixInverse=new Ie,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new ln),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ps),this.boundingBox.expandByPoint(Ps)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new hn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ps),this.boundingSphere.expandByPoint(Ps)}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(),Dr.copy(this.boundingSphere),Dr.applyMatrix4(i),e.ray.intersectsSphere(Dr)!==!1&&($o.copy(i).invert(),Ir.copy(e.ray).applyMatrix4($o),!(this.boundingBox!==null&&Ir.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Ir)))}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 r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Eo?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Th?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}
44applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;jo.fromBufferAttribute(i.attributes.skinIndex,e),Ko.fromBufferAttribute(i.attributes.skinWeight,e),qo.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const a=Ko.getComponent(r);if(a!==0){const o=jo.getComponent(r);Zo.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Iu.copy(qo).applyMatrix4(Zo),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class xl extends at{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Ka extends pt{constructor(e=null,t=1,n=1,i,r,a,o,c,l=Rt,h=Rt,u,d){super(null,a,o,c,l,h,i,r,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Jo=new Ie,Nu=new Ie;class Za{constructor(e=[],t=[]){this.uuid=$t(),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 Ie)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Ie;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 r=0,a=e.length;r<a;r++){const o=e[r]?e[r].matrixWorld:Nu;Jo.multiplyMatrices(o,t[r]),Jo.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Za(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 Ka(t,e,e,Gt,Dt);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 r=e.bones[n];let a=t[r];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new xl),this.bones.push(a),this.boneInverses.push(new Ie().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,r=t.length;i<r;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class Da extends Ct{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 Ie,Qo=new Ie,Ls=[],ec=new ln,Fu=new Ie,Gi=new It,Wi=new hn;class Ou extends It{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Da(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Fu)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new ln),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,xi),ec.copy(e.boundingBox).applyMatrix4(xi),this.boundingBox.union(ec)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new hn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,xi),Wi.copy(e.boundingSphere).applyMatrix4(xi),this.boundingSphere.union(Wi)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),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)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,a=e*r+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Gi.geometry=this.geometry,Gi.material=this.material,Gi.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Wi.copy(this.boundingSphere),Wi.applyMatrix4(n),e.ray.intersectsSphere(Wi)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,xi),Qo.multiplyMatrices(n,xi),Gi.matrixWorld=Qo,Gi.raycast(e,Ls);for(let a=0,o=Ls.length;a<o;a++){const c=Ls[a];c.instanceId=r,c.object=this,t.push(c)}Ls.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Da(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Ka(new Float32Array(i*this.count),i,this.count,Va,Dt));const r=this.morphTexture.source.data.data;let a=0;for(let l=0;l<n.length;l++)a+=n[l];const o=this.geometry.morphTargetsRelative?1:1-a,c=i*e;r[c]=o,r.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}
44const Ur=new D,Bu=new D,zu=new De;class Un{constructor(e=new D(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=Ur.subVectors(n,t).cross(Bu.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(Ur),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}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||zu.getNormalMatrix(e),i=this.coplanarPoint(Ur).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),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 Xn=new hn,Ds=new D;class $a{constructor(e=new Un,t=new Un,n=new Un,i=new Un,r=new Un,a=new Un){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,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(r),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=yn){const n=this.planes,i=e.elements,r=i[0],a=i[1],o=i[2],c=i[3],l=i[4],h=i[5],u=i[6],d=i[7],p=i[8],g=i[9],_=i[10],m=i[11],f=i[12],b=i[13],T=i[14],y=i[15];if(n[0].setComponents(c-r,d-l,m-p,y-f).normalize(),n[1].setComponents(c+r,d+l,m+p,y+f).normalize(),n[2].setComponents(c+a,d+h,m+g,y+b).normalize(),n[3].setComponents(c-a,d-h,m-g,y-b).normalize(),n[4].setComponents(c-o,d-u,m-_,y-T).normalize(),t===yn)n[5].setComponents(c+o,d+u,m+_,y+T).normalize();else if(t===er)n[5].setComponents(o,u,_,T).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(),Xn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Xn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Xn)}intersectsSprite(e){return Xn.center.set(0,0,0),Xn.radius=.7071067811865476,Xn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xn)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].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(Ds.x=i.normal.x>0?e.max.x:e.min.x,Ds.y=i.normal.y>0?e.max.y:e.min.y,Ds.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ds)<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)}}class vl extends an{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 tr=new D,nr=new D,tc=new Ie,Xi=new as,Is=new hn,Nr=new D,nc=new D;class Ja extends at{constructor(e=new Jt,t=new vl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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,r=t.count;i<r;i++)tr.fromBufferAttribute(t,i-1),nr.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=tr.distanceTo(nr);e.setAttribute("lineDistance",new Tn(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,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Is.copy(n.boundingSphere),Is.applyMatrix4(i),Is.radius+=r,e.ray.intersectsSphere(Is)===!1)return;tc.copy(i).invert(),Xi.copy(e.ray).applyMatrix4(tc);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){const p=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let _=p,m=g-1;_<m;_+=l){const f=h.getX(_),b=h.getX(_+1),T=Us(this,e,Xi,c,f,b,_);T&&t.push(T)}if(this.isLineLoop){const _=h.getX(g-1),m=h.getX(p),f=Us(this,e,Xi,c,_,m,g-1);f&&t.push(f)}}else{const p=Math.max(0,a.start),g=Math.min(d.count,a.start+a.count);for(let _=p,m=g-1;_<m;_+=l){const f=Us(this,e,Xi,c,_,_+1,_);f&&t.push(f)}if(this.isLineLoop){const _=Us(this,e,Xi,c,g-1,p,g-1);_&&t.push(_)}}}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 r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Us(s,e,t,n,i,r,a){const o=s.geometry.attributes.position;if(tr.fromBufferAttribute(o,i),nr.fromBufferAttribute(o,r),t.distanceSqToSegment(tr,nr,Nr,nc)>n)return;
vendor: 16,384 bytes, line 44
44Nr.applyMatrix4(s.matrixWorld);const l=e.ray.origin.distanceTo(Nr);if(!(l<e.near||l>e.far))return{distance:l,point:nc.clone().applyMatrix4(s.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:s}}const ic=new D,sc=new D;class ku extends Ja{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,r=t.count;i<r;i+=2)ic.fromBufferAttribute(t,i),sc.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+ic.distanceTo(sc);e.setAttribute("lineDistance",new Tn(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Hu extends Ja{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Ml extends an{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 rc=new Ie,Ia=new as,Ns=new hn,Fs=new D;class Vu extends at{constructor(e=new Jt,t=new Ml){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,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,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ns.copy(n.boundingSphere),Ns.applyMatrix4(i),Ns.radius+=r,e.ray.intersectsSphere(Ns)===!1)return;rc.copy(i).invert(),Ia.copy(e.ray).applyMatrix4(rc);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,u=n.attributes.position;if(l!==null){const d=Math.max(0,a.start),p=Math.min(l.count,a.start+a.count);for(let g=d,_=p;g<_;g++){const m=l.getX(g);Fs.fromBufferAttribute(u,m),ac(Fs,m,c,i,e,t,this)}}else{const d=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let g=d,_=p;g<_;g++)Fs.fromBufferAttribute(u,g),ac(Fs,g,c,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 r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function ac(s,e,t,n,i,r,a){const o=Ia.distanceSqToPoint(s);if(o<t){const c=new D;Ia.closestPointToPoint(s,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Gu extends pt{constructor(e,t,n,i,r,a,o,c,l){super(e,t,n,i,r,a,o,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Sl extends pt{constructor(e,t,n=ei,i,r,a,o=Rt,c=Rt,l,h=ts){if(h!==ts&&h!==ns)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,i,r,a,o,c,h,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new qa(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class sr extends Jt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,o=Math.floor(n),c=Math.floor(i),l=o+1,h=c+1,u=e/o,d=t/c,p=[],g=[],_=[],m=[];for(let f=0;f<h;f++){const b=f*d-a;for(let T=0;T<l;T++){const y=T*u-r;g.push(y,-b,0),_.push(0,0,1),m.push(T/o),m.push(1-f/c)}}for(let f=0;f<c;f++)for(let b=0;b<o;b++){const T=b+l*f,y=b+l*(f+1),L=b+1+l*(f+1),P=b+1+l*f;p.push(T,y,P),p.push(y,L,P)}this.setIndex(p),this.setAttribute("position",new Tn(g,3)),this.setAttribute("normal",new Tn(_,3)),this.setAttribute("uv",new Tn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sr(e.width,e.height,e.widthSegments,e.heightSegments)}}class rr extends an{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},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=al,this.normalScale=new Ce(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cn,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.envMapRotation.copy(e.envMapRotation),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 Qt extends rr{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 Ce(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Fe(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._dispersion=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 dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=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.dispersion=e.dispersion,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 Wu extends an{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Rh,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 Xu extends an{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}}function Os(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function Yu(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function qu(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function oc(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){const o=t[r]*e;for(let c=0;c!==e;++c)i[a++]=s[o+c]}return i}function yl(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(e.push(r.time),t.push(...a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(e.push(r.time),a.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=s[i++];while(r!==void 0)}class cs{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],r=t[n-1];n:{e:{let a;t:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break e}a=t.length;break t}if(!(e>=r)){const o=t[1];e<o&&(n=2,r=o);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break e}a=n,n=0;break t}break n}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],r=t[n-1],r===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,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let a=0;a!==i;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class ju extends cs{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:To,endingEnd:To}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,o=i[r],c=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case bo:r=e,o=2*t-n;break;case Ao:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case bo:a=e,c=2*n-t;break;case Ao:a=1,c=n+i[1]-i[0];break;default:a=e-1,c=t}const l=(n-t)*.5,h=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(c-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,p=this._weightNext,g=(n-t)/(i-t),_=g*g,m=_*g,f=-d*m+2*d*_-d*g,b=(1+d)*m+(-1.5-2*d)*_+(-.5+d)*g+1,T=(-1-p)*m+(1.5+p)*_+.5*g,y=p*m-p*_;for(let L=0;L!==o;++L)r[L]=f*a[h+L]+b*a[l+L]+T*a[c+L]+y*a[u+L];return r}}class Ku extends cs{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==o;++d)r[d]=a[l+d]*u+a[c+d]*h;return r}}class Zu extends cs{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class en{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=Os(t,this.TimeBufferType),this.values=Os(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:Os(e.times,Array),values:Os(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Zu(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Ku(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ju(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case is:t=this.InterpolantFactoryMethodDiscrete;break;case ss:t=this.InterpolantFactoryMethodLinear;break;case ur: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 ss;case this.InterpolantFactoryMethodSmooth:return ur}}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 r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*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,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){const c=n[o];if(typeof c=="number"&&isNaN(c
44)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(i!==void 0&&Yu(i))for(let o=0,c=i.length;o!==c;++o){const l=i[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===ur,r=e.length-1;let a=1;for(let o=1;o<r;++o){let c=!1;const l=e[o],h=e[o+1];if(l!==h&&(o!==1||l!==e[0]))if(i)c=!0;else{const u=o*n,d=u-n,p=u+n;for(let g=0;g!==n;++g){const _=t[u+g];if(_!==t[d+g]||_!==t[p+g]){c=!0;break}}}if(c){if(o!==a){e[a]=e[o];const u=o*n,d=a*n;for(let p=0;p!==n;++p)t[d+p]=t[u+p]}++a}}if(r>0){e[a]=e[r];for(let o=r*n,c=a*n,l=0;l!==n;++l)t[c+l]=t[o+l];++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}}en.prototype.ValueTypeName="";en.prototype.TimeBufferType=Float32Array;en.prototype.ValueBufferType=Float32Array;en.prototype.DefaultInterpolation=ss;class Ni extends en{constructor(e,t,n){super(e,t,n)}}Ni.prototype.ValueTypeName="bool";Ni.prototype.ValueBufferType=Array;Ni.prototype.DefaultInterpolation=is;Ni.prototype.InterpolantFactoryMethodLinear=void 0;Ni.prototype.InterpolantFactoryMethodSmooth=void 0;class El extends en{constructor(e,t,n,i){super(e,t,n,i)}}El.prototype.ValueTypeName="color";class Di extends en{constructor(e,t,n,i){super(e,t,n,i)}}Di.prototype.ValueTypeName="number";class $u extends cs{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(i-t);let l=e*o;for(let h=l+o;l!==h;l+=4)on.slerpFlat(r,0,a,l-o,a,l,c);return r}}class Ii extends en{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new $u(this.times,this.values,this.getValueSize(),e)}}Ii.prototype.ValueTypeName="quaternion";Ii.prototype.InterpolantFactoryMethodSmooth=void 0;class Fi extends en{constructor(e,t,n){super(e,t,n)}}Fi.prototype.ValueTypeName="string";Fi.prototype.ValueBufferType=Array;Fi.prototype.DefaultInterpolation=is;Fi.prototype.InterpolantFactoryMethodLinear=void 0;Fi.prototype.InterpolantFactoryMethodSmooth=void 0;class Ui extends en{constructor(e,t,n,i){super(e,t,n,i)}}Ui.prototype.ValueTypeName="vector";class Ju{constructor(e="",t=-1,n=[],i=Ah){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=$t(),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(ed(n[a]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}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 r=0,a=n.length;r!==a;++r)t.push(en.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let o=0;o<r;o++){let c=[],l=[];c.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);const h=qu(c);c=oc(c,1,h),l=oc(l,1,h),!i&&c[0]===0&&(c.push(r),l.push(l[0])),a.push(new Di(".morphTargetInfluences["+t[o].name+"]",c,l).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={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){const l=e[o],h=l.name.match(r);if(h&&h.length>1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(l)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,p,g,_){if(p.length!==0){const m=[],f=[];yl(p,m,f,g),m.length!==0&&_.push(new u(d,m,f))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let u=0;u<l.length;u++){const d=l[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const p={};let g;for(g=0;g<d.length;g++)if(d[g].morphTargets)for(let _=0;_<d[g].morphTargets.length;_++)p[d[g].morphTargets[_]]=-1;for(const _ in p){const m=[],f=[];for(let b=0;b!==d[g].morphTargets.length;++b){const T=d[g];m.push(T.time),f.push(T.morphTarget===_?1:0)}i.push(new Di(".morphTargetInfluence["+_+"]",m,f))}c=p.length*a}else{const p=".bones["+t[u].name+"]";n(Ui,p+".position",d,"pos",i),n(Ii,p+".quaternion",d,"rot",i),n(Ui,p+".scale",d,"scl",i)}}return i.length===0?null:new this(r,c,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];
44t=Math.max(t,r.times[r.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 Qu(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Di;case"vector":case"vector2":case"vector3":case"vector4":return Ui;case"color":return El;case"quaternion":return Ii;case"bool":case"boolean":return Ni;case"string":return Fi}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function ed(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Qu(s.type);if(s.times===void 0){const t=[],n=[];yl(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Fn={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class td{constructor(e,t,n){const i=this;let r=!1,a=0,o=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(h){o++,r===!1&&i.onStart!==void 0&&i.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,u){return l.push(h,u),this},this.removeHandler=function(h){const u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=l.length;u<d;u+=2){const p=l[u],g=l[u+1];if(p.global&&(p.lastIndex=0),p.test(h))return g}return null}}}const nd=new td;class ii{constructor(e){this.manager=e!==void 0?e:nd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}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}}ii.DEFAULT_MATERIAL_NAME="__DEFAULT";const _n={};class id extends Error{constructor(e,t){super(e),this.response=t}}class Qa extends ii{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Fn.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(_n[e]!==void 0){_n[e].push({onLoad:t,onProgress:n,onError:i});return}_n[e]=[],_n[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,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const h=_n[e],u=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),p=d?parseInt(d):0,g=p!==0;let _=0;const m=new ReadableStream({start(f){b();function b(){u.read().then(({done:T,value:y})=>{if(T)f.close();else{_+=y.byteLength;const L=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:p});for(let P=0,A=h.length;P<A;P++){const w=h[P];w.onProgress&&w.onProgress(L)}f.enqueue(y),b()}},T=>{f.error(T)})}}});return new Response(m)}else throw new id(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return l.json();default:if(o==="")return l.text();
44{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,p=new TextDecoder(d);return l.arrayBuffer().then(g=>p.decode(g))}}}).then(l=>{Fn.add(e,l);const h=_n[e];delete _n[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];p.onLoad&&p.onLoad(l)}}).catch(l=>{const h=_n[e];if(h===void 0)throw this.manager.itemError(e),l;delete _n[e];for(let u=0,d=h.length;u<d;u++){const p=h[u];p.onError&&p.onError(l)}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 sd extends ii{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Fn.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const o=rs("img");function c(){h(),Fn.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(u){h(),i&&i(u),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}class rd extends ii{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Ka,o=new Qa(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,function(c){let l;try{l=r.parse(c)}catch(h){if(i!==void 0)i(h);else{console.error(h);return}}l.image!==void 0?a.image=l.image:l.data!==void 0&&(a.image.width=l.width,a.image.height=l.height,a.image.data=l.data),a.wrapS=l.wrapS!==void 0?l.wrapS:sn,a.wrapT=l.wrapT!==void 0?l.wrapT:sn,a.magFilter=l.magFilter!==void 0?l.magFilter:ft,a.minFilter=l.minFilter!==void 0?l.minFilter:ft,a.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(a.colorSpace
44=l.colorSpace),l.flipY!==void 0&&(a.flipY=l.flipY),l.format!==void 0&&(a.format=l.format),l.type!==void 0&&(a.type=l.type),l.mipmaps!==void 0&&(a.mipmaps=l.mipmaps,a.minFilter=rn),l.mipmapCount===1&&(a.minFilter=ft),l.generateMipmaps!==void 0&&(a.generateMipmaps=l.generateMipmaps),a.needsUpdate=!0,t&&t(a,l)},n,i),a}}class Tl extends ii{constructor(e){super(e)}load(e,t,n,i){const r=new pt,a=new sd(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){r.image=o,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class eo extends at{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()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const Fr=new Ie,cc=new D,lc=new D;class to{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ce(512,512),this.map=null,this.mapPass=null,this.matrix=new Ie,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new $a,this._frameExtents=new Ce(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;cc.setFromMatrixPosition(e.matrixWorld),t.position.copy(cc),lc.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(lc),t.updateMatrixWorld(),Fr.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Fr),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Fr)}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.intensity=e.intensity,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.intensity!==1&&(e.intensity=this.intensity),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 ad extends to{constructor(){super(new wt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=Pi*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class bl extends eo{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.target=new at,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new ad}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 hc=new Ie,Yi=new D,Or=new D;class od extends to{constructor(){super(new wt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ce(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 D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Yi.setFromMatrixPosition(e.matrixWorld),n.position.copy(Yi),Or.copy(n.position),Or.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Or),n.updateMatrixWorld(),i.makeTranslation(-Yi.x,-Yi.y,-Yi.z),hc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(hc)}}class cd extends eo{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 od}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 no extends gl{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
44phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,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,r,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=r,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 r=n-e,a=n+e,o=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,c,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}}class ld extends to{constructor(){super(new no(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Al extends eo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.target=new at,this.shadow=new ld}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Ji{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 hd extends ii{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 r=this,a=Fn.get(e);if(a!==void 0){if(r.manager.itemStart(e),a.then){a.then(l=>{t&&t(l),r.manager.itemEnd(e)}).catch(l=>{i&&i(l)});return}return setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const c=fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){return Fn.add(e,l),t&&t(l),r.manager.itemEnd(e),l}).catch(function(l){i&&i(l),Fn.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});Fn.add(e,c),r.manager.itemStart(e)}}class ud extends wt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e,this.index=0}}const io="\\[\\]\\.:\\/",dd=new RegExp("["+io+"]","g"),so="[^"+io+"]",fd="[^"+io.replace("\\.","")+"]",pd=/((?:WC+[\/:])*)/.source.replace("WC",so),md=/(WCOD+)?/.source.replace("WCOD",fd),gd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",so),_d=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",so),xd=new RegExp("^"+pd+md+gd+_d+"$"),vd=["material","materials","bones","map"];class Md{constructor(e,t,n){const i=n||Qe.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_,r=n.length;i!==r;++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 Qe{constructor(e,t,n){this.path=t,this.parsedPath=n||Qe.parseTrackName(t),this.node=Qe.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 Qe.Composite(e,t,n):new Qe(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(dd,"")}static parseTrackName(e){const t=xd.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 r=n.nodeName.substring(i+1);vd.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}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(r){for(let a=0;a<r.length;a++){const o=r[a];if(o.name===t||o.uuid===t)return o;const c=n(o.children);if(c)return c}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,r=n.length;i!==r;++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,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}
44_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++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 r=t.propertyIndex;if(e||(e=Qe.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 l=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===l){l=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(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const a=e[i];if(a===void 0){const l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==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[r]!==void 0&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Qe.Composite=Md;Qe.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Qe.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Qe.prototype.GetterByBindingType=[Qe.prototype._getValue_direct,Qe.prototype._getValue_array,Qe.prototype._getValue_arrayElement,Qe.prototype._getValue_toArray];Qe.prototype.SetterByBindingTypeAndVersioning=[[Qe.prototype._setValue_direct,Qe.prototype._setValue_direct_setNeedsUpdate,Qe.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Qe.prototype._setValue_array,Qe.prototype._setValue_array_setNeedsUpdate,Qe.prototype._setValue_array_setMatr
44ixWorldNeedsUpdate],[Qe.prototype._setValue_arrayElement,Qe.prototype._setValue_arrayElement_setNeedsUpdate,Qe.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Qe.prototype._setValue_fromArray,Qe.prototype._setValue_fromArray_setNeedsUpdate,Qe.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Ua{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}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=Fe(this.phi,1e-6,Math.PI-1e-6),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(Fe(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Sd extends ni{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function uc(s,e,t,n){const i=yd(n);switch(t){case Qc:return s*e;case tl:return s*e;case nl:return s*e*2;case Va:return s*e/i.components*i.byteLength;case Ga:return s*e/i.components*i.byteLength;case il:return s*e*2/i.components*i.byteLength;case Wa:return s*e*2/i.components*i.byteLength;case el:return s*e*3/i.components*i.byteLength;case Gt:return s*e*4/i.components*i.byteLength;case Xa:return s*e*4/i.components*i.byteLength;case Ws:case Xs:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Ys:case qs:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case ra:case oa:return Math.max(s,16)*Math.max(e,8)/4;case sa:case aa:return Math.max(s,8)*Math.max(e,8)/2;case ca:case la:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case ha:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case ua:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case da:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case fa:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case pa:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case ma:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case ga:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case _a:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case xa:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case va:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case Ma:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case Sa:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case ya:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case Ea:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case Ta:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case js:case ba:case Aa:return Math.ceil(s/4)*Math.ceil(e/4)*16;case sl:case wa:return Math.ceil(s/4)*Math.ceil(e/4)*8;case Ra:case Ca:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function yd(s){switch(s){case An:case Zc:return{byteLength:1,components:1};case Qi:case $c:case Sn:return{byteLength:2,components:1};case ka:case Ha:return{byteLength:2,components:4};case ei:case za:case Dt:return{byteLength:4,components:1};case Jc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ba}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ba);/**
45 * @license
46 * Copyright 2010-2025 Three.js Authors
47 * SPDX-License-Identifier: MIT
48 */function wl(){let s=null,e=!1,t=null,n=null;function i(r,a){t(r,a),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function Ed(s){const e=new WeakMap;function t(o,c){const l=o.array,h=o.usage,u=l.byteLength,d=s.createBuffer();s.bindBuffer(c,d),s.bufferData(c,l,h),o.onUploadCallback();let p;if(l instanceof Float32Array)p=s.FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?p=s.HALF_FLOAT:p=s.UNSIGNED_SHORT;else if(l instanceof Int16Array)p=s.SHORT;else if(l instanceof Uint32Array)p=s.UNSIGNED_INT;else if(l instanceof Int32Array)p=s.INT;else if(l instanceof Int8Array)p=s.BYTE;else if(l instanceof Uint8Array)p=s.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)p=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:p,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,c,l){const h=c.array,u=c.updateRanges;if(s.bindBuffer(l,o),u.length===0)s.bufferSubData(l,0,h);else{u.sort((p,g)=>p.start-g.start);let d=0;for(let p=1;p<u.length;p++){const g=u[d],_=u[p];_.start<=g.start+g.count+1?g.count=Math.max(g.count,_.start+_.count-g.start):(++d,u[d]=_)}u.length=d+1;for(let p=0,g=u.length;p<g;p++){const _=u[p];s.bufferSubData(l,_.start*h.BYTES_PER_ELEMENT,h,_.start,_.count)}c.clearUpdateRanges()}c.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(s.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.size!==o.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.");n(l.buffer,o,c),l.version=o.version}}return{get:i,remove:r,update:a}}var Td=`#ifdef USE_ALPHAHASH
49	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
50#endif`,bd=`#ifdef USE_ALPHAHASH
51	const float ALPHA_HASH_SCALE = 0.05;
52	float hash2D( vec2 value ) {
53		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
54	}
55	float hash3D( vec3 value ) {
56		return hash2D( vec2( hash2D( value.xy ), value.z ) );
57	}
58	float getAlphaHashThreshold( vec3 position ) {
59		float maxDeriv = max(
60			length( dFdx( position.xyz ) ),
61			length( dFdy( position.xyz ) )
62		);
63		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
64		vec2 pixScales = vec2(
65			exp2( floor( log2( pixScale ) ) ),
66			exp2( ceil( log2( pixScale ) ) )
67		);
68		vec2 alpha = vec2(
69			hash3D( floor( pixScales.x * position.xyz ) ),
70			hash3D( floor( pixScales.y * position.xyz ) )
71		);
72		float lerpFactor = fract( log2( pixScale ) );
73		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
74		float a = min( lerpFactor, 1.0 - lerpFactor );
75		vec3 cases = vec3(
76			x * x / ( 2.0 * a * ( 1.0 - a ) ),
77			( x - 0.5 * a ) / ( 1.0 - a ),
78			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
79		);
80		float threshold = ( x < ( 1.0 - a ) )
81			? ( ( x < a ) ? cases.x : cases.y )
82			: cases.z;
83		return clamp( threshold , 1.0e-6, 1.0 );
84	}
85#endif`,Ad=`#ifdef USE_ALPHAMAP
86	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
87#endif`,wd=`#ifdef USE_ALPHAMAP
88	uniform sampler2D alphaMap;
89#endif`,Rd=`#ifdef USE_ALPHATEST
90	#ifdef ALPHA_TO_COVERAGE
91	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
92	if ( diffuseColor.a == 0.0 ) discard;
93	#else
94	if ( diffuseColor.a < alphaTest ) discard;
95	#endif
96#endif`,Cd=`#ifdef USE_ALPHATEST
97	uniform float alphaTest;
98#endif`,Pd=`#ifdef USE_AOMAP
99	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
100	reflectedLight.indirectDiffuse *= ambientOcclusion;
101	#if defined( USE_CLEARCOAT ) 
102		clearcoatSpecularIndirect *= ambientOcclusion;
103	#endif
104	#if defined( USE_SHEEN ) 
105		sheenSpecularIndirect *= ambientOcclusion;
106	#endif
107	#if defined( USE_ENVMAP ) && defined( STANDARD )
108		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
109		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
110	#endif
111#endif`,Ld=`#ifdef USE_AOMAP
112	uniform sampler2D aoMap;
113	uniform float aoMapIntensity;
114#endif`,Dd=`#ifdef USE_BATCHING
115	#if ! defined( GL_ANGLE_multi_draw )
116	#define gl_DrawID _gl_DrawID
117	uniform int _gl_DrawID;
118	#endif
119	uniform highp sampler2D batchingTexture;
120	uniform highp usampler2D batchingIdTexture;
121	mat4 getBatchingMatrix( const in float i ) {
122		int size = textureSize( batchingTexture, 0 ).x;
123		int j = int( i ) * 4;
124		int x = j % size;
125		int y = j / size;
126		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
127		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
128		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
129		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
130		return mat4( v1, v2, v3, v4 );
131	}
132	float getIndirectIndex( const in int i ) {
133		int size = textureSize( batchingIdTexture, 0 ).x;
134		int x = i % size;
135		int y = i / size;
136		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
137	}
138#endif
139#ifdef USE_BATCHING_COLOR
140	uniform sampler2D batchingColorTexture;
141	vec3 getBatchingColor( const in float i ) {
142		int size = textureSize( batchingColorTexture, 0 ).x;
143		int j = int( i );
144		int x = j % size;
145		int y = j / size;
146		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
147	}
148#endif`,Id=`#ifdef USE_BATCHING
149	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
150#endif`,Ud=`vec3 transformed = vec3( position );
151#ifdef USE_ALPHAHASH
152	vPosition = vec3( position );
153#endif`,Nd=`vec3 objectNormal = vec3( normal );
154#ifdef USE_TANGENT
155	vec3 objectTangent = vec3( tangent.xyz );
156#endif`,Fd=`float G_BlinnPhong_Implicit( ) {
157	return 0.25;
158}
159float D_BlinnPhong( const in float shininess, const in float dotNH ) {
160	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
161}
162vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
163	vec3 halfDir = normalize( lightDir + viewDir );
164	float dotNH = saturate( dot( normal, halfDir ) );
165	float dotVH = saturate( dot( viewDir, halfDir ) );
166	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
167	float G = G_BlinnPhong_Implicit( );
168	float D = D_BlinnPhong( shininess, dotNH );
169	return F * ( G * D );
170} // validated`,Od=`#ifdef USE_IRIDESCENCE
171	const mat3 XYZ_TO_REC709 = mat3(
172		 3.2404542, -0.9692660,  0.0556434,
173		-1.5371385,  1.8760108, -0.2040259,
174		-0.4985314,  0.0415560,  1.0572252
175	);
176	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
177		vec3 sqrtF0 = sqrt( fresnel0 );
178		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
179	}
180	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
181		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
182	}
183	float IorToFresnel0( float transmittedIor, float incidentIor ) {
184		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
185	}
186	vec3 evalSensitivity( float OPD, vec3 shift ) {
187		float phase = 2.0 * PI * OPD * 1.0e-9;
188		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
189		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
190		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
191		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
192		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 ) );
193		xyz /= 1.0685e-7;
194		vec3 rgb = XYZ_TO_REC709 * xyz;
195		return rgb;
196	}
197	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
198		vec3 I;
199		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
200		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
201		float cosTheta2Sq = 1.0 - sinTheta2Sq;
202		if ( cosTheta2Sq < 0.0 ) {
203			return vec3( 1.0 );
204		}
205		float cosTheta2 = sqrt( cosTheta2Sq );
206		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
207		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
208		float T121 = 1.0 - R12;
209		float phi12 = 0.0;
210		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
211		float phi21 = PI - phi12;
212		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
213		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
214		vec3 phi23 = vec3( 0.0 );
215		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
216		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
217		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
218		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
219		vec3 phi = vec3( phi21 ) + phi23;
220		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
221		vec3 r123 = sqrt( R123 );
222		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
223		vec3 C0 = R12 + Rs;
224		I = C0;
225		vec3 Cm = Rs - T121;
226		for ( int m = 1; m <= 2; ++ m ) {
227			Cm *= r123;
228			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
229			I += Cm * Sm;
230		}
231		return max( I, vec3( 0.0 ) );
232	}
233#endif`,Bd=`#ifdef USE_BUMPMAP
234	uniform sampler2D bumpMap;
235	uniform float bumpScale;
236	vec2 dHdxy_fwd() {
237		vec2 dSTdx = dFdx( vBumpMapUv );
238		vec2 dSTdy = dFdy( vBumpMapUv );
239		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
240		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
241		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
242		return vec2( dBx, dBy );
243	}
244	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
245		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
246		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
247		vec3 vN = surf_norm;
248		vec3 R1 = cross( vSigmaY, vN );
249		vec3 R2 = cross( vN, vSigmaX );
250		float fDet = dot( vSigmaX, R1 ) * faceDirection;
251		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
252		return normalize( abs( fDet ) * surf_norm - vGrad );
253	}
254#endif`,zd=`#if NUM_CLIPPING_PLANES > 0
255	vec4 plane;
256	#ifdef ALPHA_TO_COVERAGE
257		float distanceToPlane, distanceGradient;
258		float clipOpacity = 1.0;
259		#pragma unroll_loop_start
260		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
261			plane = clippingPlanes[ i ];
262			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
263			distanceGradient = fwidth( distanceToPlane ) / 2.0;
264			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
265			if ( clipOpacity == 0.0 ) discard;
266		}
267		#pragma unroll_loop_end
268		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
269			float unionClipOpacity = 1.0;
270			#pragma unroll_loop_start
271			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
272				plane = clippingPlanes[ i ];
273				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
274				distanceGradient = fwidth( distanceToPlane ) / 2.0;
275				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
276			}
277			#pragma unroll_loop_end
278			clipOpacity *= 1.0 - unionClipOpacity;
279		#endif
280		diffuseColor.a *= clipOpacity;
281		if ( diffuseColor.a == 0.0 ) discard;
282	#else
283		#pragma unroll_loop_start
284		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
285			plane = clippingPlanes[ i ];
286			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
287		}
288		#pragma unroll_loop_end
289		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
290			bool clipped = true;
291			#pragma unroll_loop_start
292			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
293				plane = clippingPlanes[ i ];
294				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
295			}
296			#pragma unroll_loop_end
297			if ( clipped ) discard;
298		#endif
299	#endif
300#endif`,kd=`#if NUM_CLIPPING_PLANES > 0
301	varying vec3 vClipPosition;
302	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
303#endif`,Hd=`#if NUM_CLIPPING_PLANES > 0
304	varying vec3 vClipPosition;
305#endif`,Vd=`#if NUM_CLIPPING_PLANES > 0
306	vClipPosition = - mvPosition.xyz;
307#endif`,Gd=`#if defined( USE_COLOR_ALPHA )
308	diffuseColor *= vColor;
309#elif defined( USE_COLOR )
310	diffuseColor.rgb *= vColor;
311#endif`,Wd=`#if defined( USE_COLOR_ALPHA )
312	varying vec4 vColor;
313#elif defined( USE_COLOR )
314	varying vec3 vColor;
315#endif`,Xd=`#if defined( USE_COLOR_ALPHA )
316	varying vec4 vColor;
317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
318	varying vec3 vColor;
319#endif`,Yd=`#if defined( USE_COLOR_ALPHA )
320	vColor = vec4( 1.0 );
321#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
322	vColor = vec3( 1.0 );
323#endif
324#ifdef USE_COLOR
325	vColor *= color;
326#endif
327#ifdef USE_INSTANCING_COLOR
328	vColor.xyz *= instanceColor.xyz;
329#endif
330#ifdef USE_BATCHING_COLOR
331	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
332	vColor.xyz *= batchingColor.xyz;
333#endif`,qd=`#define PI 3.141592653589793
334#define PI2 6.283185307179586
335#define PI_HALF 1.5707963267948966
336#define RECIPROCAL_PI 0.3183098861837907
337#define RECIPROCAL_PI2 0.15915494309189535
338#define EPSILON 1e-6
339#ifndef saturate
340#define saturate( a ) clamp( a, 0.0, 1.0 )
341#endif
342#define whiteComplement( a ) ( 1.0 - saturate( a ) )
343float pow2( const in float x ) { return x*x; }
344vec3 pow2( const in vec3 x ) { return x*x; }
345float pow3( const in float x ) { return x*x*x; }
346float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
347float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
348float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
349highp float rand( const in vec2 uv ) {
350	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
351	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
352	return fract( sin( sn ) * c );
353}
354#ifdef HIGH_PRECISION
355	float precisionSafeLength( vec3 v ) { return length( v ); }
356#else
357	float precisionSafeLength( vec3 v ) {
358		float maxComponent = max3( abs( v ) );
359		return length( v / maxComponent ) * maxComponent;
360	}
361#endif
362struct IncidentLight {
363	vec3 color;
364	vec3 direction;
365	bool visible;
366};
367struct ReflectedLight {
368	vec3 directDiffuse;
369	vec3 directSpecular;
370	vec3 indirectDiffuse;
371	vec3 indirectSpecular;
372};
373#ifdef USE_ALPHAHASH
374	varying vec3 vPosition;
375#endif
376vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
377	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
378}
379vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
380	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
381}
382mat3 transposeMat3( const in mat3 m ) {
383	mat3 tmp;
384	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
385	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
386	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
387	return tmp;
388}
389bool isPerspectiveMatrix( mat4 m ) {
390	return m[ 2 ][ 3 ] == - 1.0;
391}
392vec2 equirectUv( in vec3 dir ) {
393	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
394	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
395	return vec2( u, v );
396}
397vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
398	return RECIPROCAL_PI * diffuseColor;
399}
400vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
401	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
402	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
403}
404float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
405	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
406	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
407} // validated`,jd=`#ifdef ENVMAP_TYPE_CUBE_UV
408	#define cubeUV_minMipLevel 4.0
409	#define cubeUV_minTileSize 16.0
410	float getFace( vec3 direction ) {
411		vec3 absDirection = abs( direction );
412		float face = - 1.0;
413		if ( absDirection.x > absDirection.z ) {
414			if ( absDirection.x > absDirection.y )
415				face = direction.x > 0.0 ? 0.0 : 3.0;
416			else
417				face = direction.y > 0.0 ? 1.0 : 4.0;
418		} else {
419			if ( absDirection.z > absDirection.y )
420				face = direction.z > 0.0 ? 2.0 : 5.0;
421			else
422				face = direction.y > 0.0 ? 1.0 : 4.0;
423		}
424		return face;
425	}
426	vec2 getUV( vec3 direction, float face ) {
427		vec2 uv;
428		if ( face == 0.0 ) {
429			uv = vec2( direction.z, direction.y ) / abs( direction.x );
430		} else if ( face == 1.0 ) {
431			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
432		} else if ( face == 2.0 ) {
433			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
434		} else if ( face == 3.0 ) {
435			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
436		} else if ( face == 4.0 ) {
437			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
438		} else {
439			uv = vec2( direction.x, direction.y ) / abs( direction.z );
440		}
441		return 0.5 * ( uv + 1.0 );
442	}
443	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
444		float face = getFace( direction );
445		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
446		mipInt = max( mipInt, cubeUV_minMipLevel );
447		float faceSize = exp2( mipInt );
448		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
449		if ( face > 2.0 ) {
450			uv.y += faceSize;
451			face -= 3.0;
452		}
453		uv.x += face * faceSize;
454		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
455		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
456		uv.x *= CUBEUV_TEXEL_WIDTH;
457		uv.y *= CUBEUV_TEXEL_HEIGHT;
458		#ifdef texture2DGradEXT
459			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
460		#else
461			return texture2D( envMap, uv ).rgb;
462		#endif
463	}
464	#define cubeUV_r0 1.0
465	#define cubeUV_m0 - 2.0
466	#define cubeUV_r1 0.8
467	#define cubeUV_m1 - 1.0
468	#define cubeUV_r4 0.4
469	#define cubeUV_m4 2.0
470	#define cubeUV_r5 0.305
471	#define cubeUV_m5 3.0
472	#define cubeUV_r6 0.21
473	#define cubeUV_m6 4.0
474	float roughnessToMip( float roughness ) {
475		float mip = 0.0;
476		if ( roughness >= cubeUV_r1 ) {
477			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
478		} else if ( roughness >= cubeUV_r4 ) {
479			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
480		} else if ( roughness >= cubeUV_r5 ) {
481			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
482		} else if ( roughness >= cubeUV_r6 ) {
483			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
484		} else {
485			mip = - 2.0 * log2( 1.16 * roughness );		}
486		return mip;
487	}
488	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
489		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
490		float mipF = fract( mip );
491		float mipInt = floor( mip );
492		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
493		if ( mipF == 0.0 ) {
494			return vec4( color0, 1.0 );
495		} else {
496			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
497			return vec4( mix( color0, color1, mipF ), 1.0 );
498		}
499	}
500#endif`,Kd=`vec3 transformedNormal = objectNormal;
501#ifdef USE_TANGENT
502	vec3 transformedTangent = objectTangent;
503#endif
504#ifdef USE_BATCHING
505	mat3 bm = mat3( batchingMatrix );
506	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
507	transformedNormal = bm * transformedNormal;
508	#ifdef USE_TANGENT
509		transformedTangent = bm * transformedTangent;
510	#endif
511#endif
512#ifdef USE_INSTANCING
513	mat3 im = mat3( instanceMatrix );
514	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
515	transformedNormal = im * transformedNormal;
516	#ifdef USE_TANGENT
517		transformedTangent = im * transformedTangent;
518	#endif
519#endif
520transformedNormal = normalMatrix * transformedNormal;
521#ifdef FLIP_SIDED
522	transformedNormal = - transformedNormal;
523#endif
524#ifdef USE_TANGENT
525	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
526	#ifdef FLIP_SIDED
527		transformedTangent = - transformedTangent;
528	#endif
529#endif`,Zd=`#ifdef USE_DISPLACEMENTMAP
530	uniform sampler2D displacementMap;
531	uniform float displacementScale;
532	uniform float displacementBias;
533#endif`,$d=`#ifdef USE_DISPLACEMENTMAP
534	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
534placementBias );
535#endif`,Jd=`#ifdef USE_EMISSIVEMAP
536	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
537	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
538		emissiveColor = sRGBTransferEOTF( emissiveColor );
539	#endif
540	totalEmissiveRadiance *= emissiveColor.rgb;
541#endif`,Qd=`#ifdef USE_EMISSIVEMAP
542	uniform sampler2D emissiveMap;
543#endif`,ef="gl_FragColor = linearToOutputTexel( gl_FragColor );",tf=`vec4 LinearTransferOETF( in vec4 value ) {
544	return value;
545}
546vec4 sRGBTransferEOTF( in vec4 value ) {
547	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
548}
549vec4 sRGBTransferOETF( in vec4 value ) {
550	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 );
551}`,nf=`#ifdef USE_ENVMAP
552	#ifdef ENV_WORLDPOS
553		vec3 cameraToFrag;
554		if ( isOrthographic ) {
555			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
556		} else {
557			cameraToFrag = normalize( vWorldPosition - cameraPosition );
558		}
559		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
560		#ifdef ENVMAP_MODE_REFLECTION
561			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
562		#else
563			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
564		#endif
565	#else
566		vec3 reflectVec = vReflect;
567	#endif
568	#ifdef ENVMAP_TYPE_CUBE
569		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
570	#else
571		vec4 envColor = vec4( 0.0 );
572	#endif
573	#ifdef ENVMAP_BLENDING_MULTIPLY
574		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
575	#elif defined( ENVMAP_BLENDING_MIX )
576		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
577	#elif defined( ENVMAP_BLENDING_ADD )
578		outgoingLight += envColor.xyz * specularStrength * reflectivity;
579	#endif
580#endif`,sf=`#ifdef USE_ENVMAP
581	uniform float envMapIntensity;
582	uniform float flipEnvMap;
583	uniform mat3 envMapRotation;
584	#ifdef ENVMAP_TYPE_CUBE
585		uniform samplerCube envMap;
586	#else
587		uniform sampler2D envMap;
588	#endif
589	
590#endif`,rf=`#ifdef USE_ENVMAP
591	uniform float reflectivity;
592	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
593		#define ENV_WORLDPOS
594	#endif
595	#ifdef ENV_WORLDPOS
596		varying vec3 vWorldPosition;
597		uniform float refractionRatio;
598	#else
599		varying vec3 vReflect;
600	#endif
601#endif`,af=`#ifdef USE_ENVMAP
602	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
603		#define ENV_WORLDPOS
604	#endif
605	#ifdef ENV_WORLDPOS
606		
607		varying vec3 vWorldPosition;
608	#else
609		varying vec3 vReflect;
610		uniform float refractionRatio;
611	#endif
612#endif`,of=`#ifdef USE_ENVMAP
613	#ifdef ENV_WORLDPOS
614		vWorldPosition = worldPosition.xyz;
615	#else
616		vec3 cameraToVertex;
617		if ( isOrthographic ) {
618			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
619		} else {
620			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
621		}
622		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
623		#ifdef ENVMAP_MODE_REFLECTION
624			vReflect = reflect( cameraToVertex, worldNormal );
625		#else
626			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
627		#endif
628	#endif
629#endif`,cf=`#ifdef USE_FOG
630	vFogDepth = - mvPosition.z;
631#endif`,lf=`#ifdef USE_FOG
632	varying float vFogDepth;
633#endif`,hf=`#ifdef USE_FOG
634	#ifdef FOG_EXP2
635		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
636	#else
637		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
638	#endif
639	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
640#endif`,uf=`#ifdef USE_FOG
641	uniform vec3 fogColor;
642	varying float vFogDepth;
643	#ifdef FOG_EXP2
644		uniform float fogDensity;
645	#else
646		uniform float fogNear;
647		uniform float fogFar;
648	#endif
649#endif`,df=`#ifdef USE_GRADIENTMAP
650	uniform sampler2D gradientMap;
651#endif
652vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
653	float dotNL = dot( normal, lightDirection );
654	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
655	#ifdef USE_GRADIENTMAP
656		return vec3( texture2D( gradientMap, coord ).r );
657	#else
658		vec2 fw = fwidth( coord ) * 0.5;
659		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
660	#endif
661}`,ff=`#ifdef USE_LIGHTMAP
662	uniform sampler2D lightMap;
663	uniform float lightMapIntensity;
664#endif`,pf=`LambertMaterial material;
665material.diffuseColor = diffuseColor.rgb;
666material.specularStrength = specularStrength;`,mf=`varying vec3 vViewPosition;
667struct LambertMaterial {
668	vec3 diffuseColor;
669	float specularStrength;
670};
671void 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 ) {
672	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
673	vec3 irradiance = dotNL * directLight.color;
674	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
675}
676void 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 ) {
677	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
678}
679#define RE_Direct				RE_Direct_Lambert
680#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,gf=`uniform bool receiveShadow;
681uniform vec3 ambientLightColor;
682#if defined( USE_LIGHT_PROBES )
683	uniform vec3 lightProbe[ 9 ];
684#endif
685vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
686	float x = normal.x, y = normal.y, z = normal.z;
687	vec3 result = shCoefficients[ 0 ] * 0.886227;
688	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
689	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
690	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
691	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
692	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
693	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
694	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
695	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
696	return result;
697}
698vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
699	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
700	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
701	return irradiance;
702}
703vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
704	vec3 irradiance = ambientLightColor;
705	return irradiance;
706}
707float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
708	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
709	if ( cutoffDistance > 0.0 ) {
710		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
711	}
712	return distanceFalloff;
713}
714float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
715	return smoothstep( coneCosine, penumbraCosine, angleCosine );
716}
717#if NUM_DIR_LIGHTS > 0
718	struct DirectionalLight {
719		vec3 direction;
720		vec3 color;
721	};
722	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
723	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
724		light.color = directionalLight.color;
725		light.direction = directionalLight.direction;
726		light.visible = true;
727	}
728#endif
729#if NUM_POINT_LIGHTS > 0
730	struct PointLight {
731		vec3 position;
732		vec3 color;
733		float distance;
734		float decay;
735	};
736	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
737	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
738		vec3 lVector = pointLight.position - geometryPosition;
739		light.direction = normalize( lVector );
740		float lightDistance = length( lVector );
741		light.color = pointLight.color;
742		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
743		light.visible = ( light.color != vec3( 0.0 ) );
744	}
745#endif
746#if NUM_SPOT_LIGHTS > 0
747	struct SpotLight {
748		vec3 position;
749		vec3 direction;
750		vec3 color;
751		float distance;
752		float decay;
753		float coneCos;
754		float penumbraCos;
755	};
756	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
757	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
758		vec3 lVector = spotLight.position - geometryPosition;
759		light.direction = normalize( lVector );
760		float angleCos = dot( light.direction, spotLight.direction );
761		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
762		if ( spotAttenuation > 0.0 ) {
763			float lightDistance = length( lVector );
764			light.color = spotLight.color * spotAttenuation;
765			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
766			light.visible = ( light.color != vec3( 0.0 ) );
767		} else {
768			light.color = vec3( 0.0 );
769			light.visible = false;
770		}
771	}
772#endif
773#if NUM_RECT_AREA_LIGHTS > 0
774	struct RectAreaLight {
775		vec3 color;
776		vec3 position;
777		vec3 halfWidth;
778		vec3 halfHeight;
779	};
780	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
781	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
782#endif
783#if NUM_HEMI_LIGHTS > 0
784	struct HemisphereLight {
785		vec3 direction;
786		vec3 skyColor;
787		vec3 groundColor;
788	};
789	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
790	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
791		float dotNL = dot( normal, hemiLight.direction );
792		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
793		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
794		return irradiance;
795	}
796#endif`,_f=`#ifdef USE_ENVMAP
797	vec3 getIBLIrradiance( const in vec3 normal ) {
798		#ifdef ENVMAP_TYPE_CUBE_UV
799			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
800			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
801			return PI * envMapColor.rgb * envMapIntensity;
802		#else
803			return vec3( 0.0 );
804		#endif
805	}
806	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
807		#ifdef ENVMAP_TYPE_CUBE_UV
808			vec3 reflectVec = reflect( - viewDir, normal );
809			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
810			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
811			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
812			return envMapColor.rgb * envMapIntensity;
813		#else
814			return vec3( 0.0 );
815		#endif
816	}
817	#ifdef USE_ANISOTROPY
818		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
819			#ifdef ENVMAP_TYPE_CUBE_UV
820				vec3 bentNormal = cross( bitangent, viewDir );
821				bentNormal = normalize( cross( bentNormal, bitangent ) );
822				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
823				return getIBLRadiance( viewDir, bentNormal, roughness );
824			#else
825				return vec3( 0.0 );
826			#endif
827		}
828	#endif
829#endif`,xf=`ToonMaterial material;
830material.diffuseColor = diffuseColor.rgb;`,vf=`varying vec3 vViewPosition;
831struct ToonMaterial {
832	vec3 diffuseColor;
833};
834void 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 ) {
835	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
836	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
837}
838void 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 ) {
839	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
840}
841#define RE_Direct				RE_Direct_Toon
842#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Mf=`BlinnPhongMaterial material;
843material.diffuseColor = diffuseColor.rgb;
844material.specularColor = specular;
845material.specularShininess = shininess;
846material.specularStrength = specularStrength;`,Sf=`varying vec3 vViewPosition;
847struct BlinnPhongMaterial {
848	vec3 diffuseColor;
849	vec3 specularColor;
850	float specularShininess;
851	float specularStrength;
852};
853void 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 ) {
854	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
855	vec3 irradiance = dotNL * directLight.color;
856	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
857	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
858}
859void 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 ) {
860	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
861}
862#define RE_Direct				RE_Direct_BlinnPhong
863#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,yf=`PhysicalMaterial material;
864material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
865vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
866float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
867material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
868material.roughness = min( material.roughness, 1.0 );
869#ifdef IOR
870	material.ior = ior;
871	#ifdef USE_SPECULAR
872		float specularIntensityFactor = specularIntensity;
873		vec3 specularColorFactor = specularColor;
874		#ifdef USE_SPECULAR_COLORMAP
875			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
876		#endif
877		#ifdef USE_SPECULAR_INTENSITYMAP
878			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
879		#endif
880		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
881	#else
882		float specularIntensityFactor = 1.0;
883		vec3 specularColorFactor = vec3( 1.0 );
884		material.specularF90 = 1.0;
885	#endif
886	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
887#else
888	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
889	material.specularF90 = 1.0;
890#endif
891#ifdef USE_CLEARCOAT
892	material.clearcoat = clearcoat;
893	material.clearcoatRoughness = clearcoatRoughness;
894	material.clearcoatF0 = vec3( 0.04 );
895	material.clearcoatF90 = 1.0;
896	#ifdef USE_CLEARCOATMAP
897		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
898	#endif
899	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
900		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
901	#endif
902	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
903	material.clearcoatRoughness += geometryRoughness;
904	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
905#endif
906#ifdef USE_DISPERSION
907	material.dispersion = dispersion;
908#endif
909#ifdef USE_IRIDESCENCE
910	material.iridescence = iridescence;
911	material.iridescenceIOR = iridescenceIOR;
912	#ifdef USE_IRIDESCENCEMAP
913		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
914	#endif
915	#ifdef USE_IRIDESCENCE_THICKNESSMAP
916		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
917	#else
918		material.iridescenceThickness = iridescenceThicknessMaximum;
919	#endif
920#endif
921#ifdef USE_SHEEN
922	material.sheenColor = sheenColor;
923	#ifdef USE_SHEEN_COLORMAP
924		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
925	#endif
926	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
927	#ifdef USE_SHEEN_ROUGHNESSMAP
928		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
929	#endif
930#endif
931#ifdef USE_ANISOTROPY
932	#ifdef USE_ANISOTROPYMAP
933		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
934		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
935		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
936	#else
937		vec2 anisotropyV = anisotropyVector;
938	#endif
939	material.anisotropy = length( anisotropyV );
940	if( material.anisotropy == 0.0 ) {
941		anisotropyV = vec2( 1.0, 0.0 );
942	} else {
943		anisotropyV /= material.anisotropy;
944		material.anisotropy = saturate( material.anisotropy );
945	}
946	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
947	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
948	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
949#endif`,Ef=`struct PhysicalMaterial {
950	vec3 diffuseColor;
951	float roughness;
952	vec3 specularColor;
953	float specularF90;
954	float dispersion;
955	#ifdef USE_CLEARCOAT
956		float clearcoat;
957		float clearcoatRoughness;
958		vec3 clearcoatF0;
959		float clearcoatF90;
960	#endif
961	#ifdef USE_IRIDESCENCE
962		float iridescence;
963		float iridescenceIOR;
964		float iridescenceThickness;
965		vec3 iridescenceFresnel;
966		vec3 iridescenceF0;
967	#endif
968	#ifdef USE_SHEEN
969		vec3 sheenColor;
970		float sheenRoughness;
971	#endif
972	#ifdef IOR
973		float ior;
974	#endif
975	#ifdef USE_TRANSMISSION
976		float transmission;
977		float transmissionAlpha;
978		float thickness;
979		float attenuationDistance;
980		vec3 attenuationColor;
981	#endif
982	#ifdef USE_ANISOTROPY
983		float anisotropy;
984		float alphaT;
985		vec3 anisotropyT;
986		vec3 anisotropyB;
987	#endif
988};
989vec3 clearcoatSpecularDirect = vec3( 0.0 );
990vec3 clearcoatSpecularIndirect = vec3( 0.0 );
991vec3 sheenSpecularDirect = vec3( 0.0 );
992vec3 sheenSpecularIndirect = vec3(0.0 );
993vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
994    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
995    float x2 = x * x;
996    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
997    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
998}
999float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1000	float a2 = pow2( alpha );
1001	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1002	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1003	return 0.5 / max( gv + gl, EPSILON );
1004}
1005float D_GGX( const in float alpha, const in float dotNH ) {
1006	float a2 = pow2( alpha );
1007	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1008	return RECIPROCAL_PI * a2 / pow2( denom );
1009}
1010#ifdef USE_ANISOTROPY
1011	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 ) {
1012		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1013		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1014		float v = 0.5 / ( gv + gl );
1015		return saturate(v);
1016	}
1017	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1018		float a2 = alphaT * alphaB;
1019		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1020		highp float v2 = dot( v, v );
1021		float w2 = a2 / v2;
1022		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1023	}
1024#endif
1025#ifdef USE_CLEARCOAT
1026	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1027		vec3 f0 = material.clearcoatF0;
1028		float f90 = material.clearcoatF90;
1029		float roughness = material.clearcoatRoughness;
1030		float alpha = pow2( roughness );
1031		vec3 halfDir = normalize( lightDir + viewDir );
1032		float dotNL = saturate( dot( normal, lightDir ) );
1033		float dotNV = saturate( dot( normal, viewDir ) );
1034		float dotNH = saturate( dot( normal, halfDir ) );
1035		float dotVH = saturate( dot( viewDir, halfDir ) );
1036		vec3 F = F_Schlick( f0, f90, dotVH );
1037		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1038		float D = D_GGX( alpha, dotNH );
1039		return F * ( V * D );
1040	}
1041#endif
1042vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1043	vec3 f0 = material.specularColor;
1044	float f90 = material.specularF90;
1045	float roughness = material.roughness;
1046	float alpha = pow2( roughness );
1047	vec3 halfDir = normalize( lightDir + viewDir );
1048	float dotNL = saturate( dot( normal, lightDir ) );
1049	float dotNV = saturate( dot( normal, viewDir ) );
1050	float dotNH = saturate( dot( normal, halfDir ) );
1051	float dotVH = saturate( dot( viewDir, halfDir ) );
1052	vec3 F = F_Schlick( f0, f90, dotVH );
1053	#ifdef USE_IRIDESCENCE
1054		F = mix( F, material.iridescenceFresnel, material.iridescence );
1055	#endif
1056	#ifdef USE_ANISOTROPY
1057		float dotTL = dot( material.anisotropyT, lightDir );
1058		float dotTV = dot( material.anisotropyT, viewDir );
1059		float dotTH = dot( material.anisotropyT, halfDir );
1060		float dotBL = dot( material.anisotropyB, lightDir );
1061		float dotBV = dot( material.anisotropyB, viewDir );
1062		float dotBH = dot( material.anisotropyB, halfDir );
1063		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1064		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1065	#else
1066		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1067		float D = D_GGX( alpha, dotNH );
1068	#endif
1069	return F * ( V * D );
1070}
1071vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1072	const float LUT_SIZE = 64.0;
1073	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1074	const float LUT_BIAS = 0.5 / LUT_SIZE;
1075	float dotNV = saturate( dot( N, V ) );
1076	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1077	uv = uv * LUT_SCALE + LUT_BIAS;
1078	return uv;
1079}
1080float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1081	float l = length( f );
1082	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1083}
1084vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1085	float x = dot( v1, v2 );
1086	float y = abs( x );
1087	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1088	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1089	float v = a / b;
1090	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1091	return cross( v1, v2 ) * theta_sintheta;
1092}
1093vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1094	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1095	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1096	vec3 lightNormal = cross( v1, v2 );
1097	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1098	vec3 T1, T2;
1099	T1 = normalize( V - N * dot( V, N ) );
1100	T2 = - cross( N, T1 );
1101	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1102	vec3 coords[ 4 ];
1103	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1104	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1105	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1106	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1107	coords[ 0 ] = normalize( coords[ 0 ] );
1108	coords[ 1 ] = normalize( coords[ 1 ] );
1109	coords[ 2 ] = normalize( coords[ 2 ] );
1110	coords[ 3 ] = normalize( coords[ 3 ] );
1111	vec3 vectorFormFactor = vec3( 0.0 );
1112	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1113	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1114	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1115	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1116	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1117	return vec3( result );
1118}
1119#if defined( USE_SHEEN )
1120float D_Charlie( float roughness, float dotNH ) {
1121	float alpha = pow2( roughness );
1122	float invAlpha = 1.0 / alpha;
1123	float cos2h = dotNH * dotNH;
1124	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1125	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1126}
1127float V_Neubelt( float dotNV, float dotNL ) {
1128	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1129}
1130vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1131	vec3 halfDir = normalize( lightDir + viewDir );
1132	float dotNL = saturate( dot( normal, lightDir ) );
1133	float dotNV = saturate( dot( normal, viewDir ) );
1134	float dotNH = saturate( dot( normal, halfDir ) );
1135	float D = D_Charlie( sheenRoughness, dotNH );
1136	float V = V_Neubelt( dotNV, dotNL );
1137	return sheenColor * ( D * V );
1138}
1139#endif
1140float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1141	float dotNV = saturate( dot( normal, viewDir ) );
1142	float r2 = roughness * roughness;
1143	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1144	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1145	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1146	return saturate( DG * RECIPROCAL_PI );
1147}
1148vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1149	float dotNV = saturate( dot( normal, viewDir ) );
1150	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1151	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1152	vec4 r = roughness * c0 + c1;
1153	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1154	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1155	return fab;
1156}
1157vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1158	vec2 fab = DFGApprox( normal, viewDir, roughness );
1159	return specularColor * fab.x + specularF90 * fab.y;
1160}
1161#ifdef USE_IRIDESCENCE
1162void 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 ) {
1163#else
1164void 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 ) {
1165#endif
1166	vec2 fab = DFGApprox( normal, viewDir, roughness );
1167	#ifdef USE_IRIDESCENCE
1168		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1169	#else
1170		vec3 Fr = specularColor;
1171	#endif
1172	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1173	float Ess = fab.x + fab.y;
1174	float Ems = 1.0 - Ess;
1175	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1176	singleScatter += FssEss;
1177	multiScatter += Fms * Ems;
1178}
1179#if NUM_RECT_AREA_LIGHTS > 0
1180	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 ) {
1181		vec3 normal = geometryNormal;
1182		vec3 viewDir = geometryViewDir;
1183		vec3 position = geometryPosition;
1184		vec3 lightPos = rectAreaLight.position;
1185		vec3 halfWidth = rectAreaLight.halfWidth;
1186		vec3 halfHeight = rectAreaLight.halfHeight;
1187		vec3 lightColor = rectAreaLight.color;
1188		float roughness = material.roughness;
1189		vec3 rectCoords[ 4 ];
1190		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1191		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1192		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1193		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1194		vec4 t1 = texture2D( ltc_1, uv );
1195		vec4 t2 = texture2D( ltc_2, uv );
1196		mat3 mInv = mat3(
1197			vec3( t1.x, 0, t1.y ),
1198			vec3(    0, 1,    0 ),
1199			vec3( t1.z, 0, t1.w )
1200		);
1201		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1202		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1203		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1204	}
1205#endif
1206void 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 ) {
1207	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1208	vec3 irradiance = dotNL * directLight.color;
1209	#ifdef USE_CLEARCOAT
1210		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1211		vec3 ccIrradiance = dotNLcc * directLight.color;
1212		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1213	#endif
1214	#ifdef USE_SHEEN
1215		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1216	#endif
1217	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1218	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1219}
1220void 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 ) {
1221	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1222}
1223void 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) {
1224	#ifdef USE_CLEARCOAT
1225		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1226	#endif
1227	#ifdef USE_SHEEN
1228		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1229	#endif
1230	vec3 singleScattering = vec3( 0.0 );
1231	vec3 multiScattering = vec3( 0.0 );
1232	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1233	#ifdef USE_IRIDESCENCE
1234		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1235	#else
1236		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1237	#endif
1238	vec3 totalScattering = singleScattering + multiScattering;
1239	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1240	reflectedLight.indirectSpecular += radiance * singleScattering;
1241	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1242	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1243}
1244#define RE_Direct				RE_Direct_Physical
1245#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1246#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1247#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1248float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1249	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1250}`,Tf=`
1251vec3 geometryPosition = - vViewPosition;
1252vec3 geometryNormal = normal;
1253vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1254vec3 geometryClearcoatNormal = vec3( 0.0 );
1255#ifdef USE_CLEARCOAT
1256	geometryClearcoatNormal = clearcoatNormal;
1257#endif
1258#ifdef USE_IRIDESCENCE
1259	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1260	if ( material.iridescenceThickness == 0.0 ) {
1261		material.iridescence = 0.0;
1262	} else {
1263		material.iridescence = saturate( material.iridescence );
1264	}
1265	if ( material.iridescence > 0.0 ) {
1266		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1267		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1268	}
1269#endif
1270IncidentLight directLight;
1271#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1272	PointLight pointLight;
1273	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1274	PointLightShadow pointLightShadow;
1275	#endif
1276	#pragma unroll_loop_start
1277	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1278		pointLight = pointLights[ i ];
1279		getPointLightInfo( pointLight, geometryPosition, directLight );
1280		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1281		pointLightShadow = pointLightShadows[ i ];
1282		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 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_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1289	SpotLight spotLight;
1290	vec4 spotColor;
1291	vec3 spotLightCoord;
1292	bool inSpotLightMap;
1293	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1294	SpotLightShadow spotLightShadow;
1295	#endif
1296	#pragma unroll_loop_start
1297	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1298		spotLight = spotLights[ i ];
1299		getSpotLightInfo( spotLight, geometryPosition, directLight );
1300		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1301		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1302		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1303		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1304		#else
1305		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1306		#endif
1307		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1308			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1309			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1310			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1311			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1312		#endif
1313		#undef SPOT_LIGHT_MAP_INDEX
1314		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_L
1314IGHT_SHADOWS )
1315		spotLightShadow = spotLightShadows[ i ];
1316		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1317		#endif
1318		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1319	}
1320	#pragma unroll_loop_end
1321#endif
1322#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1323	DirectionalLight directionalLight;
1324	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1325	DirectionalLightShadow directionalLightShadow;
1326	#endif
1327	#pragma unroll_loop_start
1328	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1329		directionalLight = directionalLights[ i ];
1330		getDirectionalLightInfo( directionalLight, directLight );
1331		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1332		directionalLightShadow = directionalLightShadows[ i ];
1333		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1334		#endif
1335		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1336	}
1337	#pragma unroll_loop_end
1338#endif
1339#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1340	RectAreaLight rectAreaLight;
1341	#pragma unroll_loop_start
1342	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1343		rectAreaLight = rectAreaLights[ i ];
1344		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1345	}
1346	#pragma unroll_loop_end
1347#endif
1348#if defined( RE_IndirectDiffuse )
1349	vec3 iblIrradiance = vec3( 0.0 );
1350	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1351	#if defined( USE_LIGHT_PROBES )
1352		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1353	#endif
1354	#if ( NUM_HEMI_LIGHTS > 0 )
1355		#pragma unroll_loop_start
1356		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1357			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1358		}
1359		#pragma unroll_loop_end
1360	#endif
1361#endif
1362#if defined( RE_IndirectSpecular )
1363	vec3 radiance = vec3( 0.0 );
1364	vec3 clearcoatRadiance = vec3( 0.0 );
1365#endif`,bf=`#if defined( RE_IndirectDiffuse )
1366	#ifdef USE_LIGHTMAP
1367		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1368		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1369		irradiance += lightMapIrradiance;
1370	#endif
1371	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1372		iblIrradiance += getIBLIrradiance( geometryNormal );
1373	#endif
1374#endif
1375#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1376	#ifdef USE_ANISOTROPY
1377		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1378	#else
1379		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1380	#endif
1381	#ifdef USE_CLEARCOAT
1382		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1383	#endif
1384#endif`,Af=`#if defined( RE_IndirectDiffuse )
1385	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1386#endif
1387#if defined( RE_IndirectSpecular )
1388	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1389#endif`,wf=`#if defined( USE_LOGDEPTHBUF )
1390	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1391#endif`,Rf=`#if defined( USE_LOGDEPTHBUF )
1392	uniform float logDepthBufFC;
1393	varying float vFragDepth;
1394	varying float vIsPerspective;
1395#endif`,Cf=`#ifdef USE_LOGDEPTHBUF
1396	varying float vFragDepth;
1397	varying float vIsPerspective;
1398#endif`,Pf=`#ifdef USE_LOGDEPTHBUF
1399	vFragDepth = 1.0 + gl_Position.w;
1400	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1401#endif`,Lf=`#ifdef USE_MAP
1402	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1403	#ifdef DECODE_VIDEO_TEXTURE
1404		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1405	#endif
1406	diffuseColor *= sampledDiffuseColor;
1407#endif`,Df=`#ifdef USE_MAP
1408	uniform sampler2D map;
1409#endif`,If=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1410	#if defined( USE_POINTS_UV )
1411		vec2 uv = vUv;
1412	#else
1413		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1414	#endif
1415#endif
1416#ifdef USE_MAP
1417	diffuseColor *= texture2D( map, uv );
1418#endif
1419#ifdef USE_ALPHAMAP
1420	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1421#endif`,Uf=`#if defined( USE_POINTS_UV )
1422	varying vec2 vUv;
1423#else
1424	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1425		uniform mat3 uvTransform;
1426	#endif
1427#endif
1428#ifdef USE_MAP
1429	uniform sampler2D map;
1430#endif
1431#ifdef USE_ALPHAMAP
1432	uniform sampler2D alphaMap;
1433#endif`,Nf=`float metalnessFactor = metalness;
1434#ifdef USE_METALNESSMAP
1435	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1436	metalnessFactor *= texelMetalness.b;
1437#endif`,Ff=`#ifdef USE_METALNESSMAP
1438	uniform sampler2D metalnessMap;
1439#endif`,Of=`#ifdef USE_INSTANCING_MORPH
1440	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1441	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1442	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1443		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1444	}
1445#endif`,Bf=`#if defined( USE_MORPHCOLORS )
1446	vColor *= morphTargetBaseInfluence;
1447	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1448		#if defined( USE_COLOR_ALPHA )
1449			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1450		#elif defined( USE_COLOR )
1451			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1452		#endif
1453	}
1454#endif`,zf=`#ifdef USE_MORPHNORMALS
1455	objectNormal *= morphTargetBaseInfluence;
1456	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1457		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1458	}
1459#endif`,kf=`#ifdef USE_MORPHTARGETS
1460	#ifndef USE_INSTANCING_MORPH
1461		uniform float morphTargetBaseInfluence;
1462		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1463	#endif
1464	uniform sampler2DArray morphTargetsTexture;
1465	uniform ivec2 morphTargetsTextureSize;
1466	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1467		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1468		int y = texelIndex / morphTargetsTextureSize.x;
1469		int x = texelIndex - y * morphTargetsTextureSize.x;
1470		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1471		return texelFetch( morphTargetsTexture, morphUV, 0 );
1472	}
1473#endif`,Hf=`#ifdef USE_MORPHTARGETS
1474	transformed *= morphTargetBaseInfluence;
1475	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1476		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1477	}
1478#endif`,Vf=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1479#ifdef FLAT_SHADED
1480	vec3 fdx = dFdx( vViewPosition );
1481	vec3 fdy = dFdy( vViewPosition );
1482	vec3 normal = normalize( cross( fdx, fdy ) );
1483#else
1484	vec3 normal = normalize( vNormal );
1485	#ifdef DOUBLE_SIDED
1486		normal *= faceDirection;
1487	#endif
1488#endif
1489#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1490	#ifdef USE_TANGENT
1491		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1492	#else
1493		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1494		#if defined( USE_NORMALMAP )
1495			vNormalMapUv
1496		#elif defined( USE_CLEARCOAT_NORMALMAP )
1497			vClearcoatNormalMapUv
1498		#else
1499			vUv
1500		#endif
1501		);
1502	#endif
1503	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1504		tbn[0] *= faceDirection;
1505		tbn[1] *= faceDirection;
1506	#endif
1507#endif
1508#ifdef USE_CLEARCOAT_NORMALMAP
1509	#ifdef USE_TANGENT
1510		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1511	#else
1512		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1513	#endif
1514	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1515		tbn2[0] *= faceDirection;
1516		tbn2[1] *= faceDirection;
1517	#endif
1518#endif
1519vec3 nonPerturbedNormal = normal;`,Gf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1520	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1521	#ifdef FLIP_SIDED
1522		normal = - normal;
1523	#endif
1524	#ifdef DOUBLE_SIDED
1525		normal = normal * faceDirection;
1526	#endif
1527	normal = normalize( normalMatrix * normal );
1528#elif defined( USE_NORMALMAP_TANGENTSPACE )
1529	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1530	mapN.xy *= normalScale;
1531	normal = normalize( tbn * mapN );
1532#elif defined( USE_BUMPMAP )
1533	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1534#endif`,Wf=`#ifndef FLAT_SHADED
1535	varying vec3 vNormal;
1536	#ifdef USE_TANGENT
1537		varying vec3 vTangent;
1538		varying vec3 vBitangent;
1539	#endif
1540#endif`,Xf=`#ifndef FLAT_SHADED
1541	varying vec3 vNormal;
1542	#ifdef USE_TANGENT
1543		varying vec3 vTangent;
1544		varying vec3 vBitangent;
1545	#endif
1546#endif`,Yf=`#ifndef FLAT_SHADED
1547	vNormal = normalize( transformedNormal );
1548	#ifdef USE_TANGENT
1549		vTangent = normalize( transformedTangent );
1550		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1551	#endif
1552#endif`,qf=`#ifdef USE_NORMALMAP
1553	uniform sampler2D normalMap;
1554	uniform vec2 normalScale;
1555#endif
1556#ifdef USE_NORMALMAP_OBJECTSPACE
1557	uniform mat3 normalMatrix;
1558#endif
1559#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1560	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1561		vec3 q0 = dFdx( eye_pos.xyz );
1562		vec3 q1 = dFdy( eye_pos.xyz );
1563		vec2 st0 = dFdx( uv.st );
1564		vec2 st1 = dFdy( uv.st );
1565		vec3 N = surf_norm;
1566		vec3 q1perp = cross( q1, N );
1567		vec3 q0perp = cross( N, q0 );
1568		vec3 T = q1perp * st0.x + q0perp * st1.x;
1569		vec3 B = q1perp * st0.y + q0perp * st1.y;
1570		float det = max( dot( T, T ), dot( B, B ) );
1571		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1572		return mat3( T * scale, B * scale, N );
1573	}
1574#endif`,jf=`#ifdef USE_CLEARCOAT
1575	vec3 clearcoatNormal = nonPerturbedNormal;
1576#endif`,Kf=`#ifdef USE_CLEARCOAT_NORMALMAP
1577	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1578	clearcoatMapN.xy *= clearcoatNormalScale;
1579	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1580#endif`,Zf=`#ifdef USE_CLEARCOATMAP
1581	uniform sampler2D clearcoatMap;
1582#endif
1583#ifdef USE_CLEARCOAT_NORMALMAP
1584	uniform sampler2D clearcoatNormalMap;
1585	uniform vec2 clearcoatNormalScale;
1586#endif
1587#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1588	uniform sampler2D clearcoatRoughnessMap;
1589#endif`,$f=`#ifdef USE_IRIDESCENCEMAP
1590	uniform sampler2D iridescenceMap;
1591#endif
1592#ifdef USE_IRIDESCENCE_THICKNESSMAP
1593	uniform sampler2D iridescenceThicknessMap;
1594#endif`,Jf=`#ifdef OPAQUE
1595diffuseColor.a = 1.0;
1596#endif
1597#ifdef USE_TRANSMISSION
1598diffuseColor.a *= material.transmissionAlpha;
1599#endif
1600gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Qf=`vec3 packNormalToRGB( const in vec3 normal ) {
1601	return normalize( normal ) * 0.5 + 0.5;
1602}
1603vec3 unpackRGBToNormal( const in vec3 rgb ) {
1604	return 2.0 * rgb.xyz - 1.0;
1605}
1606const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1607const float Inv255 = 1. / 255.;
1608const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1609const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1610const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1611const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1612vec4 packDepthToRGBA( const in float v ) {
1613	if( v <= 0.0 )
1614		return vec4( 0., 0., 0., 0. );
1615	if( v >= 1.0 )
1616		return vec4( 1., 1., 1., 1. );
1617	float vuf;
1618	float af = modf( v * PackFactors.a, vuf );
1619	float bf = modf( vuf * ShiftRight8, vuf );
1620	float gf = modf( vuf * ShiftRight8, vuf );
1621	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1622}
1623vec3 packDepthToRGB( const in float v ) {
1624	if( v <= 0.0 )
1625		return vec3( 0., 0., 0. );
1626	if( v >= 1.0 )
1627		return vec3( 1., 1., 1. );
1628	float vuf;
1629	float bf = modf( v * PackFactors.b, vuf );
1630	float gf = modf( vuf * ShiftRight8, vuf );
1631	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1632}
1633vec2 packDepthToRG( const in float v ) {
1634	if( v <= 0.0 )
1635		return vec2( 0., 0. );
1636	if( v >= 1.0 )
1637		return vec2( 1., 1. );
1638	float vuf;
1639	float gf = modf( v * 256., vuf );
1640	return vec2( vuf * Inv255, gf );
1641}
1642float unpackRGBAToDepth( const in vec4 v ) {
1643	return dot( v, UnpackFactors4 );
1644}
1645float unpackRGBToDepth( const in vec3 v ) {
1646	return dot( v, UnpackFactors3 );
1647}
1648float unpackRGToDepth( const in vec2 v ) {
1649	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1650}
1651vec4 pack2HalfToRGBA( const in vec2 v ) {
1652	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1653	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1654}
1655vec2 unpackRGBATo2Half( const in vec4 v ) {
1656	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1657}
1658float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1659	return ( viewZ + near ) / ( near - far );
1660}
1661float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1662	return depth * ( near - far ) - near;
1663}
1664float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1665	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1666}
1667float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1668	return ( near * far ) / ( ( far - near ) * depth - far );
1669}`,ep=`#ifdef PREMULTIPLIED_ALPHA
1670	gl_FragColor.rgb *= gl_FragColor.a;
1671#endif`,tp=`vec4 mvPosition = vec4( transformed, 1.0 );
1672#ifdef USE_BATCHING
1673	mvPosition = batchingMatrix * mvPosition;
1674#endif
1675#ifdef USE_INSTANCING
1676	mvPosition = instanceMatrix * mvPosition;
1677#endif
1678mvPosition = modelViewMatrix * mvPosition;
1679gl_Position = projectionMatrix * mvPosition;`,np=`#ifdef DITHERING
1680	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1681#endif`,ip=`#ifdef DITHERING
1682	vec3 dithering( vec3 color ) {
1683		float grid_position = rand( gl_FragCoord.xy );
1684		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1685		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1686		return color + dither_shift_RGB;
1687	}
1688#endif`,sp=`float roughnessFactor = roughness;
1689#ifdef USE_ROUGHNESSMAP
1690	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1691	roughnessFactor *= texelRoughness.g;
1692#endif`,rp=`#ifdef USE_ROUGHNESSMAP
1693	uniform sampler2D roughnessMap;
1694#endif`,ap=`#if NUM_SPOT_LIGHT_COORDS > 0
1695	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1696#endif
1697#if NUM_SPOT_LIGHT_MAPS > 0
1698	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1699#endif
1700#ifdef USE_SHADOWMAP
1701	#if NUM_DIR_LIGHT_SHADOWS > 0
1702		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1703		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1704		struct DirectionalLightShadow {
1705			float shadowIntensity;
1706			float shadowBias;
1707			float shadowNormalBias;
1708			float shadowRadius;
1709			vec2 shadowMapSize;
1710		};
1711		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1712	#endif
1713	#if NUM_SPOT_LIGHT_SHADOWS > 0
1714		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1715		struct SpotLightShadow {
1716			float shadowIntensity;
1717			float shadowBias;
1718			float shadowNormalBias;
1719			float shadowRadius;
1720			vec2 shadowMapSize;
1721		};
1722		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1723	#endif
1724	#if NUM_POINT_LIGHT_SHADOWS > 0
1725		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1726		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1727		struct PointLightShadow {
1728			float shadowIntensity;
1729			float shadowBias;
1730			float shadowNormalBias;
1731			float shadowRadius;
1732			vec2 shadowMapSize;
1733			float shadowCameraNear;
1734			float shadowCameraFar;
1735		};
1736		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1737	#endif
1738	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1739		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1740	}
1741	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1742		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1743	}
1744	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1745		float occlusion = 1.0;
1746		vec2 distribution = texture2DDistribution( shadow, uv );
1747		float hard_shadow = step( compare , distribution.x );
1748		if (hard_shadow != 1.0 ) {
1749			float distance = compare - distribution.x ;
1750			float variance = max( 0.00000, distribution.y * distribution.y );
1751			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 );
1752		}
1753		return occlusion;
1754	}
1755	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1756		float shadow = 1.0;
1757		shadowCoord.xyz /= shadowCoord.w;
1758		shadowCoord.z += shadowBias;
1759		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1760		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1761		if ( frustumTest ) {
1762		#if defined( SHADOWMAP_TYPE_PCF )
1763			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1764			float dx0 = - texelSize.x * shadowRadius;
1765			float dy0 = - texelSize.y * shadowRadius;
1766			float dx1 = + texelSize.x * shadowRadius;
1767			float dy1 = + texelSize.y * shadowRadius;
1768			float dx2 = dx0 / 2.0;
1769			float dy2 = dy0 / 2.0;
1770			float dx3 = dx1 / 2.0;
1771			float dy3 = dy1 / 2.0;
1772			shadow = (
1773				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1774				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1775				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1776				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1777				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1778				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1779				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1780				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1781				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1782				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1783				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1784				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1785				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1786				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1787				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1788				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1789				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1790			) * ( 1.0 / 17.0 );
1791		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1792			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1793			float dx = texelSize.x;
1794			float dy = texelSize.y;
1795			vec2 uv = shadowCoord.xy;
1796			vec2 f = fract( uv * shadowMapSize + 0.5 );
1797			uv -= f * texelSize;
1798			shadow = (
1799				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1800				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1801				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1802				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1803				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1804					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1805					 f.x ) +
1806				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1807					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1808					 f.x ) +
1809				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1810					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1811					 f.y ) +
1812				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1813					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1814					 f.y ) +
1815				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1816						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1817						  f.x ),
1818					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1819						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1820						  f.x ),
1821					 f.y )
1822			) * ( 1.0 / 9.0 );
1823		#elif defined( SHADOWMAP_TYPE_VSM )
1824			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1825		#else
1826			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1827		#endif
1828		}
1829		return mix( 1.0, shadow, shadowIntensity );
1830	}
1831	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1832		vec3 absV = abs( v );
1833		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1834		absV *= scaleToCube;
1835		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1836		vec2 planar = v.xy;
1837		float almostATexel = 1.5 * texelSizeY;
1838		float almostOne = 1.0 - almostATexel;
1839		if ( absV.z >= almostOne ) {
1840			if ( v.z > 0.0 )
1841				planar.x = 4.0 - v.x;
1842		} else if ( absV.x >= almostOne ) {
1843			float signX = sign( v.x );
1844			planar.x = v.z * signX + 2.0 * signX;
1845		} else if ( absV.y >= almostOne ) {
1846			float signY = sign( v.y );
1847			planar.x = v.x + 2.0 * signY + 2.0;
1848			planar.y = v.z * signY - 2.0;
1849		}
1850		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1851	}
1852	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1853		float shadow = 1.0;
1854		vec3 lightToPosition = shadowCoord.xyz;
1855		
1856		float lightToPositionLength = length( lightToPosition );
1857		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
1858			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
1859			vec3 bd3D = normalize( lightToPosition );
1860			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1861			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1862				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1863				shadow = (
1864					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1865					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1866					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1867					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1868					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1869					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1870					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1871					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1872					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1873				) * ( 1.0 / 9.0 );
1874			#else
1875				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1876			#endif
1877		}
1878		return mix( 1.0, shadow, shadowIntensity );
1879	}
1880#endif`,op=`#if NUM_SPOT_LIGHT_COORDS > 0
1881	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1882	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1883#endif
1884#ifdef USE_SHADOWMAP
1885	#if NUM_DIR_LIGHT_SHADOWS > 0
1886		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1887		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1888		struct DirectionalLightShadow {
1889			float shadowIntensity;
1890			float shadowBias;
1891			float shadowNormalBias;
1892			float shadowRadius;
1893			vec2 shadowMapSize;
1894		};
1895		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1896	#endif
1897	#if NUM_SPOT_LIGHT_SHADOWS > 0
1898		struct SpotLightShadow {
1899			float shadowIntensity;
1900			float shadowBias;
1901			float shadowNormalBias;
1902			float shadowRadius;
1903			vec2 shadowMapSize;
1904		};
1905		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1906	#endif
1907	#if NUM_POINT_LIGHT_SHADOWS > 0
1908		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1909		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1910		struct PointLightShadow {
1911			float shadowIntensity;
1912			float shadowBias;
1913			float shadowNormalBias;
1914			float shadowRadius;
1915			vec2 shadowMapSize;
1916			float shadowCameraNear;
1917			float shadowCameraFar;
1918		};
1919		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1920	#endif
1921#endif`,cp=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1922	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1923	vec4 shadowWorldPosition;
1924#endif
1925#if defined( USE_SHADOWMAP )
1926	#if NUM_DIR_LIGHT_SHADOWS > 0
1927		#pragma unroll_loop_start
1928		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1929			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1930			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1931		}
1932		#pragma unroll_loop_end
1933	#endif
1934	#if NUM_POINT_LIGHT_SHADOWS > 0
1935		#pragma unroll_loop_start
1936		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1937			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1938			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1939		}
1940		#pragma unroll_loop_end
1941	#endif
1942#endif
1943#if NUM_SPOT_LIGHT_COORDS > 0
1944	#pragma unroll_loop_start
1945	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1946		shadowWorldPosition = worldPosition;
1947		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1948			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1949		#endif
1950		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1951	}
1952	#pragma unroll_loop_end
1953#endif`,lp=`float getShadowMask() {
1954	float shadow = 1.0;
1955	#ifdef USE_SHADOWMAP
1956	#if NUM_DIR_LIGHT_SHADOWS > 0
1957	DirectionalLightShadow directionalLight;
1958	#pragma unroll_loop_start
1959	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1960		directionalLight = directionalLightShadows[ i ];
1961		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1962	}
1963	#pragma unroll_loop_end
1964	#endif
1965	#if NUM_SPOT_LIGHT_SHADOWS > 0
1966	SpotLightShadow spotLight;
1967	#pragma unroll_loop_start
1968	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1969		spotLight = spotLightShadows[ i ];
1970		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1971	}
1972	#pragma unroll_loop_end
1973	#endif
1974	#if NUM_POINT_LIGHT_SHADOWS > 0
1975	PointLightShadow pointLight;
1976	#pragma unroll_loop_start
1977	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1978		pointLight = pointLightShadows[ i ];
1979		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1980	}
1981	#pragma unroll_loop_end
1982	#endif
1983	#endif
1984	return shadow;
1985}`,hp=`#ifdef USE_SKINNING
1986	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1987	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1988	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1989	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1990#endif`,up=`#ifdef USE_SKINNING
1991	uniform mat4 bindMatrix;
1992	uniform mat4 bindMatrixInverse;
1993	uniform highp sampler2D boneTexture;
1994	mat4 getBoneMatrix( const in float i ) {
1995		int size = textureSize( boneTexture, 0 ).x;
1996		int j = int( i ) * 4;
1997		int x = j % size;
1998		int y = j / size;
1999		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2000		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2001		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2002		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2003		return mat4( v1, v2, v3, v4 );
2004	}
2005#endif`,dp=`#ifdef USE_SKINNING
2006	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2007	vec4 skinned = vec4( 0.0 );
2008	skinned += boneMatX * skinVertex * skinWeight.x;
2009	skinned += boneMatY * skinVertex * skinWeight.y;
2010	skinned += boneMatZ * skinVertex * skinWeight.z;
2011	skinned += boneMatW * skinVertex * skinWeight.w;
2012	transformed = ( bindMatrixInverse * skinned ).xyz;
2013#endif`,fp=`#ifdef USE_SKINNING
2014	mat4 skinMatrix = mat4( 0.0 );
2015	skinMatrix += skinWeight.x * boneMatX;
2016	skinMatrix += skinWeight.y * boneMatY;
2017	skinMatrix += skinWeight.z * boneMatZ;
2018	skinMatrix += skinWeight.w * boneMatW;
2019	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2020	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2021	#ifdef USE_TANGENT
2022		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2023	#endif
2024#endif`,pp=`float specularStrength;
2025#ifdef USE_SPECULARMAP
2026	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2027	specularStrength = texelSpecular.r;
2028#else
2029	specularStrength = 1.0;
2030#endif`,mp=`#ifdef USE_SPECULARMAP
2031	uniform sampler2D specularMap;
2032#endif`,gp=`#if defined( TONE_MAPPING )
2033	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2034#endif`,_p=`#ifndef saturate
2035#define saturate( a ) clamp( a, 0.0, 1.0 )
2036#endif
2037uniform float toneMappingExposure;
2038vec3 LinearToneMapping( vec3 color ) {
2039	return saturate( toneMappingExposure * color );
2040}
2041vec3 ReinhardToneMapping( vec3 color ) {
2042	color *= toneMappingExposure;
2043	return saturate( color / ( vec3( 1.0 ) + color ) );
2044}
2045vec3 CineonToneMapping( vec3 color ) {
2046	color *= toneMappingExposure;
2047	color = max( vec3( 0.0 ), color - 0.004 );
2048	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2049}
2050vec3 RRTAndODTFit( vec3 v ) {
2051	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2052	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2053	return a / b;
2054}
2055vec3 ACESFilmicToneMapping( vec3 color ) {
2056	const mat3 ACESInputMat = mat3(
2057		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2058		vec3( 0.04823, 0.01566, 0.83777 )
2059	);
2060	const mat3 ACESOutputMat = mat3(
2061		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2062		vec3( -0.07367, -0.00605,  1.07602 )
2063	);
2064	color *= toneMappingExposure / 0.6;
2065	color = ACESInputMat * color;
2066	color = RRTAndODTFit( color );
2067	color = ACESOutputMat * color;
2068	return saturate( color );
2069}
2070const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2071	vec3( 1.6605, - 0.1246, - 0.0182 ),
2072	vec3( - 0.5876, 1.1329, - 0.1006 ),
2073	vec3( - 0.0728, - 0.0083, 1.1187 )
2074);
2075const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2076	vec3( 0.6274, 0.0691, 0.0164 ),
2077	vec3( 0.3293, 0.9195, 0.0880 ),
2078	vec3( 0.0433, 0.0113, 0.8956 )
2079);
2080vec3 agxDefaultContrastApprox( vec3 x ) {
2081	vec3 x2 = x * x;
2082	vec3 x4 = x2 * x2;
2083	return + 15.5 * x4 * x2
2084		- 40.14 * x4 * x
2085		+ 31.96 * x4
2086		- 6.868 * x2 * x
2087		+ 0.4298 * x2
2088		+ 0.1191 * x
2089		- 0.00232;
2090}
2091vec3 AgXToneMapping( vec3 color ) {
2092	const mat3 AgXInsetMatrix = mat3(
2093		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2094		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2095		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2096	);
2097	const mat3 AgXOutsetMatrix = mat3(
2098		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2099		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2100		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2101	);
2102	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2103	color *= toneMappingExposure;
2104	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2105	color = AgXInsetMatrix * color;
2106	color = max( color, 1e-10 );	color = log2( color );
2107	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2108	color = clamp( color, 0.0, 1.0 );
2109	color = agxDefaultContrastApprox( color );
2110	color = AgXOutsetMatrix * color;
2111	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2112	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2113	color = clamp( color, 0.0, 1.0 );
2114	return color;
2115}
2116vec3 NeutralToneMapping( vec3 color ) {
2117	const float StartCompression = 0.8 - 0.04;
2118	const float Desaturation = 0.15;
2119	color *= toneMappingExposure;
2120	float x = min( color.r, min( color.g, color.b ) );
2121	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2122	color -= offset;
2123	float peak = max( color.r, max( color.g, color.b ) );
2124	if ( peak < StartCompression ) return color;
2125	float d = 1. - StartCompression;
2126	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2127	color *= newPeak / peak;
2128	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2129	return mix( color, vec3( newPeak ), g );
2130}
2131vec3 CustomToneMapping( vec3 color ) { return color; }`,xp=`#ifdef USE_TRANSMISSION
2132	material.transmission = transmission;
2133	material.transmissionAlpha = 1.0;
2134	material.thickness = thickness;
2135	material.attenuationDistance = attenuationDistance;
2136	material.attenuationColor = attenuationColor;
2137	#ifdef USE_TRANSMISSIONMAP
2138		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2139	#endif
2140	#ifdef USE_THICKNESSMAP
2141		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2142	#endif
2143	vec3 pos = vWorldPosition;
2144	vec3 v = normalize( cameraPosition - pos );
2145	vec3 n = inverseTransformDirection( normal, viewMatrix );
2146	vec4 transmitted = getIBLVolumeRefraction(
2147		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2148		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2149		material.attenuationColor, material.attenuationDistance );
2150	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2151	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2152#endif`,vp=`#ifdef USE_TRANSMISSION
2153	uniform float transmission;
2154	uniform float thickness;
2155	uniform float attenuationDistance;
2156	uniform vec3 attenuationColor;
2157	#ifdef USE_TRANSMISSIONMAP
2158		uniform sampler2D transmissionMap;
2159	#endif
2160	#ifdef USE_THICKNESSMAP
2161		uniform sampler2D thicknessMap;
2162	#endif
2163	uniform vec2 transmissionSamplerSize;
2164	uniform sampler2D transmissionSamplerMap;
2165	uniform mat4 modelMatrix;
2166	uniform mat4 projectionMatrix;
2167	varying vec3 vWorldPosition;
2168	float w0( float a ) {
2169		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2170	}
2171	float w1( float a ) {
2172		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2173	}
2174	float w2( float a ){
2175		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2176	}
2177	float w3( float a ) {
2178		return ( 1.0 / 6.0 ) * ( a * a * a );
2179	}
2180	float g0( float a ) {
2181		return w0( a ) + w1( a );
2182	}
2183	float g1( float a ) {
2184		return w2( a ) + w3( a );
2185	}
2186	float h0( float a ) {
2187		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2188	}
2189	float h1( float a ) {
2190		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2191	}
2192	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2193		uv = uv * texelSize.zw + 0.5;
2194		vec2 iuv = floor( uv );
2195		vec2 fuv = fract( uv );
2196		float g0x = g0( fuv.x );
2197		float g1x = g1( fuv.x );
2198		float h0x = h0( fuv.x );
2199		float h1x = h1( fuv.x );
2200		float h0y = h0( fuv.y );
2201		float h1y = h1( fuv.y );
2202		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2203		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2204		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2205		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2206		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2207			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2208	}
2209	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2210		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2211		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2212		vec2 fLodSizeInv = 1.0 / fLodSize;
2213		vec2 cLodSizeInv = 1.0 / cLodSize;
2214		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2215		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2216		return mix( fSample, cSample, fract( lod ) );
2217	}
2218	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2219		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2220		vec3 modelScale;
2221		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2222		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2223		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2224		return normalize( refractionVector ) * thickness * modelScale;
2225	}
2226	float applyIorToRoughness( const in float roughness, const in float ior ) {
2227		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2228	}
2229	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2230		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2231		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2232	}
2233	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2234		if ( isinf( attenuationDistance ) ) {
2235			return vec3( 1.0 );
2236		} else {
2237			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2238			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2239		}
2240	}
2241	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2242		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2243		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2244		const in vec3 attenuationColor, const in float attenuationDistance ) {
2245		vec4 transmittedLight;
2246		vec3 transmittance;
2247		#ifdef USE_DISPERSION
2248			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2249			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2250			for ( int i = 0; i < 3; i ++ ) {
2251				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2252				vec3 refractedRayExit = position + transmissionRay;
2253				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2254				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2255				refractionCoords += 1.0;
2256				refractionCoords /= 2.0;
2257				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2258				transmittedLight[ i ] = transmissionSample[ i ];
2259				transmittedLight.a += transmissionSample.a;
2260				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2261			}
2262			transmittedLight.a /= 3.0;
2263		#else
2264			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2265			vec3 refractedRayExit = position + transmissionRay;
2266			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2267			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2268			refractionCoords += 1.0;
2269			refractionCoords /= 2.0;
2270			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2271			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2272		#endif
2273		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2274		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2275		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2276		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2277	}
2278#endif`,Mp=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2279	varying vec2 vUv;
2280#endif
2281#ifdef USE_MAP
2282	varying vec2 vMapUv;
2283#endif
2284#ifdef USE_ALPHAMAP
2285	varying vec2 vAlphaMapUv;
2286#endif
2287#ifdef USE_LIGHTMAP
2288	varying vec2 vLightMapUv;
2289#endif
2290#ifdef USE_AOMAP
2291	varying vec2 vAoMapUv;
2292#endif
2293#ifdef USE_BUMPMAP
2294	varying vec2 vBumpMapUv;
2295#endif
2296#ifdef USE_NORMALMAP
2297	varying vec2 vNormalMapUv;
2298#endif
2299#ifdef USE_EMISSIVEMAP
2300	varying vec2 vEmissiveMapUv;
2301#endif
2302#ifdef USE_METALNESSMAP
2303	varying vec2 vMetalnessMapUv;
2304#endif
2305#ifdef USE_ROUGHNESSMAP
2306	varying vec2 vRoughnessMapUv;
2307#endif
2308#ifdef USE_ANISOTROPYMAP
2309	varying vec2 vAnisotropyMapUv;
2310#endif
2311#ifdef USE_CLEARCOATMAP
2312	varying vec2 vClearcoatMapUv;
2313#endif
2314#ifdef USE_CLEARCOAT_NORMALMAP
2315	varying vec2 vClearcoatNormalMapUv;
2316#endif
2317#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2318	varying vec2 vClearcoatRoughnessMapUv;
2319#endif
2320#ifdef USE_IRIDESCENCEMAP
2321	varying vec2 vIridescenceMapUv;
2322#endif
2323#ifdef USE_IRIDESCENCE_THICKNESSMAP
2324	varying vec2 vIridescenceThicknessMapUv;
2325#endif
2326#ifdef USE_SHEEN_COLORMAP
2327	varying vec2 vSheenColorMapUv;
2328#endif
2329#ifdef USE_SHEEN_ROUGHNESSMAP
2330	varying vec2 vSheenRoughnessMapUv;
2331#endif
2332#ifdef USE_SPECULARMAP
2333	varying vec2 vSpecularMapUv;
2334#endif
2335#ifdef USE_SPECULAR_COLORMAP
2336	varying vec2 vSpecularColorMapUv;
2337#endif
2338#ifdef USE_SPECULAR_INTENSITYMAP
2339	varying vec2 vSpecularIntensityMapUv;
2340#endif
2341#ifdef USE_TRANSMISSIONMAP
2342	uniform mat3 transmissionMapTransform;
2343	varying vec2 vTransmissionMapUv;
2344#endif
2345#ifdef USE_THICKNESSMAP
2346	uniform mat3 thicknessMapTransform;
2347	varying vec2 vThicknessMapUv;
2348#endif`,Sp=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2349	varying vec2 vUv;
2350#endif
2351#ifdef USE_MAP
2352	uniform mat3 mapTransform;
2353	varying vec2 vMapUv;
2354#endif
2355#ifdef USE_ALPHAMAP
2356	uniform mat3 alphaMapTransform;
2357	varying vec2 vAlphaMapUv;
2358#endif
2359#ifdef USE_LIGHTMAP
2360	uniform mat3 lightMapTransform;
2361	varying vec2 vLightMapUv;
2362#endif
2363#ifdef USE_AOMAP
2364	uniform mat3 aoMapTransform;
2365	varying vec2 vAoMapUv;
2366#endif
2367#ifdef USE_BUMPMAP
2368	uniform mat3 bumpMapTransform;
2369	varying vec2 vBumpMapUv;
2370#endif
2371#ifdef USE_NORMALMAP
2372	uniform mat3 normalMapTransform;
2373	varying vec2 vNormalMapUv;
2374#endif
2375#ifdef USE_DISPLACEMENTMAP
2376	uniform mat3 displacementMapTransform;
2377	varying vec2 vDisplacementMapUv;
2378#endif
2379#ifdef USE_EMISSIVEMAP
2380	uniform mat3 emissiveMapTransform;
2381	varying vec2 vEmissiveMapUv;
2382#endif
2383#ifdef USE_METALNESSMAP
2384	uniform mat3 metalnessMapTransform;
2385	varying vec2 vMetalnessMapUv;
2386#endif
2387#ifdef USE_ROUGHNESSMAP
2388	uniform mat3 roughnessMapTransform;
2389	varying vec2 vRoughnessMapUv;
2390#endif
2391#ifdef USE_ANISOTROPYMAP
2392	uniform mat3 anisotropyMapTransform;
2393	varying vec2 vAnisotropyMapUv;
2394#endif
2395#ifdef USE_CLEARCOATMAP
2396	uniform mat3 clearcoatMapTransform;
2397	varying vec2 vClearcoatMapUv;
2398#endif
2399#ifdef USE_CLEARCOAT_NORMALMAP
2400	uniform mat3 clearcoatNormalMapTransform;
2401	varying vec2 vClearcoatNormalMapUv;
2402#endif
2403#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2404	uniform mat3 clearcoatRoughnessMapTransform;
2405	varying vec2 vClearcoatRoughnessMapUv;
2406#endif
2407#ifdef USE_SHEEN_COLORMAP
2408	uniform mat3 sheenColorMapTransform;
2409	varying vec2 vSheenColorMapUv;
2410#endif
2411#ifdef USE_SHEEN_ROUGHNESSMAP
2412	uniform mat3 sheenRoughnessMapTransform;
2413	varying vec2 vSheenRoughnessMapUv;
2414#endif
2415#ifdef USE_IRIDESCENCEMAP
2416	uniform mat3 iridescenceMapTransform;
2417	varying vec2 vIridescenceMapUv;
2418#endif
2419#ifdef USE_IRIDESCENCE_THICKNESSMAP
2420	uniform mat3 iridescenceThicknessMapTransform;
2421	varying vec2 vIridescenceThicknessMapUv;
2422#endif
2423#ifdef USE_SPECULARMAP
2424	uniform mat3 specularMapTransform;
2425	varying vec2 vSpecularMapUv;
2426#endif
2427#ifdef USE_SPECULAR_COLORMAP
2428	uniform mat3 specularColorMapTransform;
2429	varying vec2 vSpecularColorMapUv;
2430#endif
2431#ifdef USE_SPECULAR_INTENSITYMAP
2432	uniform mat3 specularIntensityMapTransform;
2433	varying vec2 vSpecularIntensityMapUv;
2434#endif
2435#ifdef USE_TRANSMISSIONMAP
2436	uniform mat3 transmissionMapTransform;
2437	varying vec2 vTransmissionMapUv;
2438#endif
2439#ifdef USE_THICKNESSMAP
2440	uniform mat3 thicknessMapTransform;
2441	varying vec2 vThicknessMapUv;
2442#endif`,yp=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2443	vUv = vec3( uv, 1 ).xy;
2444#endif
2445#ifdef USE_MAP
2446	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2447#endif
2448#ifdef USE_ALPHAMAP
2449	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2450#endif
2451#ifdef USE_LIGHTMAP
2452	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2453#endif
2454#ifdef USE_AOMAP
2455	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2456#endif
2457#ifdef USE_BUMPMAP
2458	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2459#endif
2460#ifdef USE_NORMALMAP
2461	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2462#endif
2463#ifdef USE_DISPLACEMENTMAP
2464	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2465#endif
2466#ifdef USE_EMISSIVEMAP
2467	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2468#endif
2469#ifdef USE_METALNESSMAP
2470	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2471#endif
2472#ifdef USE_ROUGHNESSMAP
2473	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2474#endif
2475#ifdef USE_ANISOTROPYMAP
2476	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2477#endif
2478#ifdef USE_CLEARCOATMAP
2479	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2480#endif
2481#ifdef USE_CLEARCOAT_NORMALMAP
2482	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2483#endif
2484#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2485	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2486#endif
2487#ifdef USE_IRIDESCENCEMAP
2488	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2489#endif
2490#ifdef USE_IRIDESCENCE_THICKNESSMAP
2491	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2492#endif
2493#ifdef USE_SHEEN_COLORMAP
2494	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2495#endif
2496#ifdef USE_SHEEN_ROUGHNESSMAP
2497	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2498#endif
2499#ifdef USE_SPECULARMAP
2500	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2501#endif
2502#ifdef USE_SPECULAR_COLORMAP
2503	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2504#endif
2505#ifdef USE_SPECULAR_INTENSITYMAP
2506	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2507#endif
2508#ifdef USE_TRANSMISSIONMAP
2509	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2510#endif
2511#ifdef USE_THICKNESSMAP
2512	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2513#endif`,Ep=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2514	vec4 worldPosition = vec4( transformed, 1.0 );
2515	#ifdef USE_BATCHING
2516		worldPosition = batchingMatrix * worldPosition;
2517	#endif
2518	#ifdef USE_INSTANCING
2519		worldPosition = instanceMatrix * worldPosition;
2520	#endif
2521	worldPosition = modelMatrix * worldPosition;
2522#endif`;const Tp=`varying vec2 vUv;
2523uniform mat3 uvTransform;
2524void main() {
2525	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2526	gl_Position = vec4( position.xy, 1.0, 1.0 );
2527}`,bp=`uniform sampler2D t2D;
2528uniform float backgroundIntensity;
2529varying vec2 vUv;
2530void main() {
2531	vec4 texColor = texture2D( t2D, vUv );
2532	#ifdef DECODE_VIDEO_TEXTURE
2533		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 );
2534	#endif
2535	texColor.rgb *= backgroundIntensity;
2536	gl_FragColor = texColor;
2537	#include <tonemapping_fragment>
2538	#include <colorspace_fragment>
2539}`,Ap=`varying vec3 vWorldDirection;
2540#include <common>
2541void main() {
2542	vWorldDirection = transformDirection( position, modelMatrix );
2543	#include <begin_vertex>
2544	#include <project_vertex>
2545	gl_Position.z = gl_Position.w;
2546}`,wp=`#ifdef ENVMAP_TYPE_CUBE
2547	uniform samplerCube envMap;
2548#elif defined( ENVMAP_TYPE_CUBE_UV )
2549	uniform sampler2D envMap;
2550#endif
2551uniform float flipEnvMap;
2552uniform float backgroundBlurriness;
2553uniform float backgroundIntensity;
2554uniform mat3 backgroundRotation;
2555varying vec3 vWorldDirection;
2556#include <cube_uv_reflection_fragment>
2557void main() {
2558	#ifdef ENVMAP_TYPE_CUBE
2559		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2560	#elif defined( ENVMAP_TYPE_CUBE_UV )
2561		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2562	#else
2563		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2564	#endif
2565	texColor.rgb *= backgroundIntensity;
2566	gl_FragColor = texColor;
2567	#include <tonemapping_fragment>
2568	#include <colorspace_fragment>
2569}`,Rp=`varying vec3 vWorldDirection;
2570#include <common>
2571void main() {
2572	vWorldDirection = transformDirection( position, modelMatrix );
2573	#include <begin_vertex>
2574	#include <project_vertex>
2575	gl_Position.z = gl_Position.w;
2576}`,Cp=`uniform samplerCube tCube;
2577uniform float tFlip;
2578uniform float opacity;
2579varying vec3 vWorldDirection;
2580void main() {
2581	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2582	gl_FragColor = texColor;
2583	gl_FragColor.a *= opacity;
2584	#include <tonemapping_fragment>
2585	#include <colorspace_fragment>
2586}`,Pp=`#include <common>
2587#include <batching_pars_vertex>
2588#include <uv_pars_vertex>
2589#include <displacementmap_pars_vertex>
2590#include <morphtarget_pars_vertex>
2591#include <skinning_pars_vertex>
2592#include <logdepthbuf_pars_vertex>
2593#include <clipping_planes_pars_vertex>
2594varying vec2 vHighPrecisionZW;
2595void main() {
2596	#include <uv_vertex>
2597	#include <batching_vertex>
2598	#include <skinbase_vertex>
2599	#include <morphinstance_vertex>
2600	#ifdef USE_DISPLACEMENTMAP
2601		#include <beginnormal_vertex>
2602		#include <morphnormal_vertex>
2603		#include <skinnormal_vertex>
2604	#endif
2605	#include <begin_vertex>
2606	#include <morphtarget_vertex>
2607	#include <skinning_vertex>
2608	#include <displacementmap_vertex>
2609	#include <project_vertex>
2610	#include <logdepthbuf_vertex>
2611	#include <clipping_planes_vertex>
2612	vHighPrecisionZW = gl_Position.zw;
2613}`,Lp=`#if DEPTH_PACKING == 3200
2614	uniform float opacity;
2615#endif
2616#include <common>
2617#include <packing>
2618#include <uv_pars_fragment>
2619#include <map_pars_fragment>
2620#include <alphamap_pars_fragment>
2621#include <alphatest_pars_fragment>
2622#include <alphahash_pars_fragment>
2623#include <logdepthbuf_pars_fragment>
2624#include <clipping_planes_pars_fragment>
2625varying vec2 vHighPrecisionZW;
2626void main() {
2627	vec4 diffuseColor = vec4( 1.0 );
2628	#include <clipping_planes_fragment>
2629	#if DEPTH_PACKING == 3200
2630		diffuseColor.a = opacity;
2631	#endif
2632	#include <map_fragment>
2633	#include <alphamap_fragment>
2634	#include <alphatest_fragment>
2635	#include <alphahash_fragment>
2636	#include <logdepthbuf_fragment>
2637	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2638	#if DEPTH_PACKING == 3200
2639		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2640	#elif DEPTH_PACKING == 3201
2641		gl_FragColor = packDepthToRGBA( fragCoordZ );
2642	#elif DEPTH_PACKING == 3202
2643		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2644	#elif DEPTH_PACKING == 3203
2645		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2646	#endif
2647}`,Dp=`#define DISTANCE
2648varying vec3 vWorldPosition;
2649#include <common>
2650#include <batching_pars_vertex>
2651#include <uv_pars_vertex>
2652#include <displacementmap_pars_vertex>
2653#include <morphtarget_pars_vertex>
2654#include <skinning_pars_vertex>
2655#include <clipping_planes_pars_vertex>
2656void main() {
2657	#include <uv_vertex>
2658	#include <batching_vertex>
2659	#include <skinbase_vertex>
2660	#include <morphinstance_vertex>
2661	#ifdef USE_DISPLACEMENTMAP
2662		#include <beginnormal_vertex>
2663		#include <morphnormal_vertex>
2664		#include <skinnormal_vertex>
2665	#endif
2666	#include <begin_vertex>
2667	#include <morphtarget_vertex>
2668	#include <skinning_vertex>
2669	#include <displacementmap_vertex>
2670	#include <project_vertex>
2671	#include <worldpos_vertex>
2672	#include <clipping_planes_vertex>
2673	vWorldPosition = worldPosition.xyz;
2674}`,Ip=`#define DISTANCE
2675uniform vec3 referencePosition;
2676uniform float nearDistance;
2677uniform float farDistance;
2678varying vec3 vWorldPosition;
2679#include <common>
2680#include <packing>
2681#include <uv_pars_fragment>
2682#include <map_pars_fragment>
2683#include <alphamap_pars_fragment>
2684#include <alphatest_pars_fragment>
2685#include <alphahash_pars_fragment>
2686#include <clipping_planes_pars_fragment>
2687void main () {
2688	vec4 diffuseColor = vec4( 1.0 );
2689	#include <clipping_planes_fragment>
2690	#include <map_fragment>
2691	#include <alphamap_fragment>
2692	#include <alphatest_fragment>
2693	#include <alphahash_fragment>
2694	float dist = length( vWorldPosition - referencePosition );
2695	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2696	dist = saturate( dist );
2697	gl_FragColor = packDepthToRGBA( dist );
2698}`,Up=`varying vec3 vWorldDirection;
2699#include <common>
2700void main() {
2701	vWorldDirection = transformDirection( position, modelMatrix );
2702	#include <begin_vertex>
2703	#include <project_vertex>
2704}`,Np=`uniform sampler2D tEquirect;
2705varying vec3 vWorldDirection;
2706#include <common>
2707void main() {
2708	vec3 direction = normalize( vWorldDirection );
2709	vec2 sampleUV = equirectUv( direction );
2710	gl_FragColor = texture2D( tEquirect, sampleUV );
2711	#include <tonemapping_fragment>
2712	#include <colorspace_fragment>
2713}`,Fp=`uniform float scale;
2714attribute float lineDistance;
2715varying float vLineDistance;
2716#include <common>
2717#include <uv_pars_vertex>
2718#include <color_pars_vertex>
2719#include <fog_pars_vertex>
2720#include <morphtarget_pars_vertex>
2721#include <logdepthbuf_pars_vertex>
2722#include <clipping_planes_pars_vertex>
2723void main() {
2724	vLineDistance = scale * lineDistance;
2725	#include <uv_vertex>
2726	#include <color_vertex>
2727	#include <morphinstance_vertex>
2728	#include <morphcolor_vertex>
2729	#include <begin_vertex>
2730	#include <morphtarget_vertex>
2731	#include <project_vertex>
2732	#include <logdepthbuf_vertex>
2733	#include <clipping_planes_vertex>
2734	#include <fog_vertex>
2735}`,Op=`uniform vec3 diffuse;
2736uniform float opacity;
2737uniform float dashSize;
2738uniform float totalSize;
2739varying float vLineDistance;
2740#include <common>
2741#include <color_pars_fragment>
2742#include <uv_pars_fragment>
2743#include <map_pars_fragment>
2744#include <fog_pars_fragment>
2745#include <logdepthbuf_pars_fragment>
2746#include <clipping_planes_pars_fragment>
2747void main() {
2748	vec4 diffuseColor = vec4( diffuse, opacity );
2749	#include <clipping_planes_fragment>
2750	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2751		discard;
2752	}
2753	vec3 outgoingLight = vec3( 0.0 );
2754	#include <logdepthbuf_fragment>
2755	#include <map_fragment>
2756	#include <color_fragment>
2757	outgoingLight = diffuseColor.rgb;
2758	#include <opaque_fragment>
2759	#include <tonemapping_fragment>
2760	#include <colorspace_fragment>
2761	#include <fog_fragment>
2762	#include <premultiplied_alpha_fragment>
2763}`,Bp=`#include <common>
2764#include <batching_pars_vertex>
2765#include <uv_pars_vertex>
2766#include <envmap_pars_vertex>
2767#include <color_pars_vertex>
2768#include <fog_pars_vertex>
2769#include <morphtarget_pars_vertex>
2770#include <skinning_pars_vertex>
2771#include <logdepthbuf_pars_vertex>
2772#include <clipping_planes_pars_vertex>
2773void main() {
2774	#include <uv_vertex>
2775	#include <color_vertex>
2776	#include <morphinstance_vertex>
2777	#include <morphcolor_vertex>
2778	#include <batching_vertex>
2779	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2780		#include <beginnormal_vertex>
2781		#include <morphnormal_vertex>
2782		#include <skinbase_vertex>
2783		#include <skinnormal_vertex>
2784		#include <defaultnormal_vertex>
2785	#endif
2786	#include <begin_vertex>
2787	#include <morphtarget_vertex>
2788	#include <skinning_vertex>
2789	#include <project_vertex>
2790	#include <logdepthbuf_vertex>
2791	#include <clipping_planes_vertex>
2792	#include <worldpos_vertex>
2793	#include <envmap_vertex>
2794	#include <fog_vertex>
2795}`,zp=`uniform vec3 diffuse;
2796uniform float opacity;
2797#ifndef FLAT_SHADED
2798	varying vec3 vNormal;
2799#endif
2800#include <common>
2801#include <dithering_pars_fragment>
2802#include <color_pars_fragment>
2803#include <uv_pars_fragment>
2804#include <map_pars_fragment>
2805#include <alphamap_pars_fragment>
2806#include <alphatest_pars_fragment>
2807#include <alphahash_pars_fragment>
2808#include <aomap_pars_fragment>
2809#include <lightmap_pars_fragment>
2810#include <envmap_common_pars_fragment>
2811#include <envmap_pars_fragment>
2812#include <fog_pars_fragment>
2813#include <specularmap_pars_fragment>
2814#include <logdepthbuf_pars_fragment>
2815#include <clipping_planes_pars_fragment>
2816void main() {
2817	vec4 diffuseColor = vec4( diffuse, opacity );
2818	#include <clipping_planes_fragment>
2819	#include <logdepthbuf_fragment>
2820	#include <map_fragment>
2821	#include <color_fragment>
2822	#include <alphamap_fragment>
2823	#include <alphatest_fragment>
2824	#include <alphahash_fragment>
2825	#include <specularmap_fragment>
2826	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2827	#ifdef USE_LIGHTMAP
2828		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2829		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2830	#else
2831		reflectedLight.indirectDiffuse += vec3( 1.0 );
2832	#endif
2833	#include <aomap_fragment>
2834	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2835	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2836	#include <envmap_fragment>
2837	#include <opaque_fragment>
2838	#include <tonemapping_fragment>
2839	#include <colorspace_fragment>
2840	#include <fog_fragment>
2841	#include <premultiplied_alpha_fragment>
2842	#include <dithering_fragment>
2843}`,kp=`#define LAMBERT
2844varying vec3 vViewPosition;
2845#include <common>
2846#include <batching_pars_vertex>
2847#include <uv_pars_vertex>
2848#include <displacementmap_pars_vertex>
2849#include <envmap_pars_vertex>
2850#include <color_pars_vertex>
2851#include <fog_pars_vertex>
2852#include <normal_pars_vertex>
2853#include <morphtarget_pars_vertex>
2854#include <skinning_pars_vertex>
2855#include <shadowmap_pars_vertex>
2856#include <logdepthbuf_pars_vertex>
2857#include <clipping_planes_pars_vertex>
2858void main() {
2859	#include <uv_vertex>
2860	#include <color_vertex>
2861	#include <morphinstance_vertex>
2862	#include <morphcolor_vertex>
2863	#include <batching_vertex>
2864	#include <beginnormal_vertex>
2865	#include <morphnormal_vertex>
2866	#include <skinbase_vertex>
2867	#include <skinnormal_vertex>
2868	#include <defaultnormal_vertex>
2869	#include <normal_vertex>
2870	#include <begin_vertex>
2871	#include <morphtarget_vertex>
2872	#include <skinning_vertex>
2873	#include <displacementmap_vertex>
2874	#include <project_vertex>
2875	#include <logdepthbuf_vertex>
2876	#include <clipping_planes_vertex>
2877	vViewPosition = - mvPosition.xyz;
2878	#include <worldpos_vertex>
2879	#include <envmap_vertex>
2880	#include <shadowmap_vertex>
2881	#include <fog_vertex>
2882}`,Hp=`#define LAMBERT
2883uniform vec3 diffuse;
2884uniform vec3 emissive;
2885uniform float opacity;
2886#include <common>
2887#include <packing>
2888#include <dithering_pars_fragment>
2889#include <color_pars_fragment>
2890#include <uv_pars_fragment>
2891#include <map_pars_fragment>
2892#include <alphamap_pars_fragment>
2893#include <alphatest_pars_fragment>
2894#include <alphahash_pars_fragment>
2895#include <aomap_pars_fragment>
2896#include <lightmap_pars_fragment>
2897#include <emissivemap_pars_fragment>
2898#include <envmap_common_pars_fragment>
2899#include <envmap_pars_fragment>
2900#include <fog_pars_fragment>
2901#include <bsdfs>
2902#include <lights_pars_begin>
2903#include <normal_pars_fragment>
2904#include <lights_lambert_pars_fragment>
2905#include <shadowmap_pars_fragment>
2906#include <bumpmap_pars_fragment>
2907#include <normalmap_pars_fragment>
2908#include <specularmap_pars_fragment>
2909#include <logdepthbuf_pars_fragment>
2910#include <clipping_planes_pars_fragment>
2911void main() {
2912	vec4 diffuseColor = vec4( diffuse, opacity );
2913	#include <clipping_planes_fragment>
2914	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2915	vec3 totalEmissiveRadiance = emissive;
2916	#include <logdepthbuf_fragment>
2917	#include <map_fragment>
2918	#include <color_fragment>
2919	#include <alphamap_fragment>
2920	#include <alphatest_fragment>
2921	#include <alphahash_fragment>
2922	#include <specularmap_fragment>
2923	#include <normal_fragment_begin>
2924	#include <normal_fragment_maps>
2925	#include <emissivemap_fragment>
2926	#include <lights_lambert_fragment>
2927	#include <lights_fragment_begin>
2928	#include <lights_fragment_maps>
2929	#include <lights_fragment_end>
2930	#include <aomap_fragment>
2931	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2932	#include <envmap_fragment>
2933	#include <opaque_fragment>
2934	#include <tonemapping_fragment>
2935	#include <colorspace_fragment>
2936	#include <fog_fragment>
2937	#include <premultiplied_alpha_fragment>
2938	#include <dithering_fragment>
2939}`,Vp=`#define MATCAP
2940varying vec3 vViewPosition;
2941#include <common>
2942#include <batching_pars_vertex>
2943#include <uv_pars_vertex>
2944#include <color_pars_vertex>
2945#include <displacementmap_pars_vertex>
2946#include <fog_pars_vertex>
2947#include <normal_pars_vertex>
2948#include <morphtarget_pars_vertex>
2949#include <skinning_pars_vertex>
2950#include <logdepthbuf_pars_vertex>
2951#include <clipping_planes_pars_vertex>
2952void main() {
2953	#include <uv_vertex>
2954	#include <color_vertex>
2955	#include <morphinstance_vertex>
2956	#include <morphcolor_vertex>
2957	#include <batching_vertex>
2958	#include <beginnormal_vertex>
2959	#include <morphnormal_vertex>
2960	#include <skinbase_vertex>
2961	#include <skinnormal_vertex>
2962	#include <defaultnormal_vertex>
2963	#include <normal_vertex>
2964	#include <begin_vertex>
2965	#include <morphtarget_vertex>
2966	#include <skinning_vertex>
2967	#include <displacementmap_vertex>
2968	#include <project_vertex>
2969	#include <logdepthbuf_vertex>
2970	#include <clipping_planes_vertex>
2971	#include <fog_vertex>
2972	vViewPosition = - mvPosition.xyz;
2973}`,Gp=`#define MATCAP
2974uniform vec3 diffuse;
2975uniform float opacity;
2976uniform sampler2D matcap;
2977varying vec3 vViewPosition;
2978#include <common>
2979#include <dithering_pars_fragment>
2980#include <color_pars_fragment>
2981#include <uv_pars_fragment>
2982#include <map_pars_fragment>
2983#include <alphamap_pars_fragment>
2984#include <alphatest_pars_fragment>
2985#include <alphahash_pars_fragment>
2986#include <fog_pars_fragment>
2987#include <normal_pars_fragment>
2988#include <bumpmap_pars_fragment>
2989#include <normalmap_pars_fragment>
2990#include <logdepthbuf_pars_fragment>
2991#include <clipping_planes_pars_fragment>
2992void main() {
2993	ve
2993c4 diffuseColor = vec4( diffuse, opacity );
2994	#include <clipping_planes_fragment>
2995	#include <logdepthbuf_fragment>
2996	#include <map_fragment>
2997	#include <color_fragment>
2998	#include <alphamap_fragment>
2999	#include <alphatest_fragment>
3000	#include <alphahash_fragment>
3001	#include <normal_fragment_begin>
3002	#include <normal_fragment_maps>
3003	vec3 viewDir = normalize( vViewPosition );
3004	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3005	vec3 y = cross( viewDir, x );
3006	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3007	#ifdef USE_MATCAP
3008		vec4 matcapColor = texture2D( matcap, uv );
3009	#else
3010		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3011	#endif
3012	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3013	#include <opaque_fragment>
3014	#include <tonemapping_fragment>
3015	#include <colorspace_fragment>
3016	#include <fog_fragment>
3017	#include <premultiplied_alpha_fragment>
3018	#include <dithering_fragment>
3019}`,Wp=`#define NORMAL
3020#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3021	varying vec3 vViewPosition;
3022#endif
3023#include <common>
3024#include <batching_pars_vertex>
3025#include <uv_pars_vertex>
3026#include <displacementmap_pars_vertex>
3027#include <normal_pars_vertex>
3028#include <morphtarget_pars_vertex>
3029#include <skinning_pars_vertex>
3030#include <logdepthbuf_pars_vertex>
3031#include <clipping_planes_pars_vertex>
3032void main() {
3033	#include <uv_vertex>
3034	#include <batching_vertex>
3035	#include <beginnormal_vertex>
3036	#include <morphinstance_vertex>
3037	#include <morphnormal_vertex>
3038	#include <skinbase_vertex>
3039	#include <skinnormal_vertex>
3040	#include <defaultnormal_vertex>
3041	#include <normal_vertex>
3042	#include <begin_vertex>
3043	#include <morphtarget_vertex>
3044	#include <skinning_vertex>
3045	#include <displacementmap_vertex>
3046	#include <project_vertex>
3047	#include <logdepthbuf_vertex>
3048	#include <clipping_planes_vertex>
3049#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3050	vViewPosition = - mvPosition.xyz;
3051#endif
3052}`,Xp=`#define NORMAL
3053uniform float opacity;
3054#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3055	varying vec3 vViewPosition;
3056#endif
3057#include <packing>
3058#include <uv_pars_fragment>
3059#include <normal_pars_fragment>
3060#include <bumpmap_pars_fragment>
3061#include <normalmap_pars_fragment>
3062#include <logdepthbuf_pars_fragment>
3063#include <clipping_planes_pars_fragment>
3064void main() {
3065	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3066	#include <clipping_planes_fragment>
3067	#include <logdepthbuf_fragment>
3068	#include <normal_fragment_begin>
3069	#include <normal_fragment_maps>
3070	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3071	#ifdef OPAQUE
3072		gl_FragColor.a = 1.0;
3073	#endif
3074}`,Yp=`#define PHONG
3075varying vec3 vViewPosition;
3076#include <common>
3077#include <batching_pars_vertex>
3078#include <uv_pars_vertex>
3079#include <displacementmap_pars_vertex>
3080#include <envmap_pars_vertex>
3081#include <color_pars_vertex>
3082#include <fog_pars_vertex>
3083#include <normal_pars_vertex>
3084#include <morphtarget_pars_vertex>
3085#include <skinning_pars_vertex>
3086#include <shadowmap_pars_vertex>
3087#include <logdepthbuf_pars_vertex>
3088#include <clipping_planes_pars_vertex>
3089void main() {
3090	#include <uv_vertex>
3091	#include <color_vertex>
3092	#include <morphcolor_vertex>
3093	#include <batching_vertex>
3094	#include <beginnormal_vertex>
3095	#include <morphinstance_vertex>
3096	#include <morphnormal_vertex>
3097	#include <skinbase_vertex>
3098	#include <skinnormal_vertex>
3099	#include <defaultnormal_vertex>
3100	#include <normal_vertex>
3101	#include <begin_vertex>
3102	#include <morphtarget_vertex>
3103	#include <skinning_vertex>
3104	#include <displacementmap_vertex>
3105	#include <project_vertex>
3106	#include <logdepthbuf_vertex>
3107	#include <clipping_planes_vertex>
3108	vViewPosition = - mvPosition.xyz;
3109	#include <worldpos_vertex>
3110	#include <envmap_vertex>
3111	#include <shadowmap_vertex>
3112	#include <fog_vertex>
3113}`,qp=`#define PHONG
3114uniform vec3 diffuse;
3115uniform vec3 emissive;
3116uniform vec3 specular;
3117uniform float shininess;
3118uniform float opacity;
3119#include <common>
3120#include <packing>
3121#include <dithering_pars_fragment>
3122#include <color_pars_fragment>
3123#include <uv_pars_fragment>
3124#include <map_pars_fragment>
3125#include <alphamap_pars_fragment>
3126#include <alphatest_pars_fragment>
3127#include <alphahash_pars_fragment>
3128#include <aomap_pars_fragment>
3129#include <lightmap_pars_fragment>
3130#include <emissivemap_pars_fragment>
3131#include <envmap_common_pars_fragment>
3132#include <envmap_pars_fragment>
3133#include <fog_pars_fragment>
3134#include <bsdfs>
3135#include <lights_pars_begin>
3136#include <normal_pars_fragment>
3137#include <lights_phong_pars_fragment>
3138#include <shadowmap_pars_fragment>
3139#include <bumpmap_pars_fragment>
3140#include <normalmap_pars_fragment>
3141#include <specularmap_pars_fragment>
3142#include <logdepthbuf_pars_fragment>
3143#include <clipping_planes_pars_fragment>
3144void main() {
3145	vec4 diffuseColor = vec4( diffuse, opacity );
3146	#include <clipping_planes_fragment>
3147	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3148	vec3 totalEmissiveRadiance = emissive;
3149	#include <logdepthbuf_fragment>
3150	#include <map_fragment>
3151	#include <color_fragment>
3152	#include <alphamap_fragment>
3153	#include <alphatest_fragment>
3154	#include <alphahash_fragment>
3155	#include <specularmap_fragment>
3156	#include <normal_fragment_begin>
3157	#include <normal_fragment_maps>
3158	#include <emissivemap_fragment>
3159	#include <lights_phong_fragment>
3160	#include <lights_fragment_begin>
3161	#include <lights_fragment_maps>
3162	#include <lights_fragment_end>
3163	#include <aomap_fragment>
3164	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3165	#include <envmap_fragment>
3166	#include <opaque_fragment>
3167	#include <tonemapping_fragment>
3168	#include <colorspace_fragment>
3169	#include <fog_fragment>
3170	#include <premultiplied_alpha_fragment>
3171	#include <dithering_fragment>
3172}`,jp=`#define STANDARD
3173varying vec3 vViewPosition;
3174#ifdef USE_TRANSMISSION
3175	varying vec3 vWorldPosition;
3176#endif
3177#include <common>
3178#include <batching_pars_vertex>
3179#include <uv_pars_vertex>
3180#include <displacementmap_pars_vertex>
3181#include <color_pars_vertex>
3182#include <fog_pars_vertex>
3183#include <normal_pars_vertex>
3184#include <morphtarget_pars_vertex>
3185#include <skinning_pars_vertex>
3186#include <shadowmap_pars_vertex>
3187#include <logdepthbuf_pars_vertex>
3188#include <clipping_planes_pars_vertex>
3189void main() {
3190	#include <uv_vertex>
3191	#include <color_vertex>
3192	#include <morphinstance_vertex>
3193	#include <morphcolor_vertex>
3194	#include <batching_vertex>
3195	#include <beginnormal_vertex>
3196	#include <morphnormal_vertex>
3197	#include <skinbase_vertex>
3198	#include <skinnormal_vertex>
3199	#include <defaultnormal_vertex>
3200	#include <normal_vertex>
3201	#include <begin_vertex>
3202	#include <morphtarget_vertex>
3203	#include <skinning_vertex>
3204	#include <displacementmap_vertex>
3205	#include <project_vertex>
3206	#include <logdepthbuf_vertex>
3207	#include <clipping_planes_vertex>
3208	vViewPosition = - mvPosition.xyz;
3209	#include <worldpos_vertex>
3210	#include <shadowmap_vertex>
3211	#include <fog_vertex>
3212#ifdef USE_TRANSMISSION
3213	vWorldPosition = worldPosition.xyz;
3214#endif
3215}`,Kp=`#define STANDARD
3216#ifdef PHYSICAL
3217	#define IOR
3218	#define USE_SPECULAR
3219#endif
3220uniform vec3 diffuse;
3221uniform vec3 emissive;
3222uniform float roughness;
3223uniform float metalness;
3224uniform float opacity;
3225#ifdef IOR
3226	uniform float ior;
3227#endif
3228#ifdef USE_SPECULAR
3229	uniform float specularIntensity;
3230	uniform vec3 specularColor;
3231	#ifdef USE_SPECULAR_COLORMAP
3232		uniform sampler2D specularColorMap;
3233	#endif
3234	#ifdef USE_SPECULAR_INTENSITYMAP
3235		uniform sampler2D specularIntensityMap;
3236	#endif
3237#endif
3238#ifdef USE_CLEARCOAT
3239	uniform float clearcoat;
3240	uniform float clearcoatRoughness;
3241#endif
3242#ifdef USE_DISPERSION
3243	uniform float dispersion;
3244#endif
3245#ifdef USE_IRIDESCENCE
3246	uniform float iridescence;
3247	uniform float iridescenceIOR;
3248	uniform float iridescenceThicknessMinimum;
3249	uniform float iridescenceThicknessMaximum;
3250#endif
3251#ifdef USE_SHEEN
3252	uniform vec3 sheenColor;
3253	uniform float sheenRoughness;
3254	#ifdef USE_SHEEN_COLORMAP
3255		uniform sampler2D sheenColorMap;
3256	#endif
3257	#ifdef USE_SHEEN_ROUGHNESSMAP
3258		uniform sampler2D sheenRoughnessMap;
3259	#endif
3260#endif
3261#ifdef USE_ANISOTROPY
3262	uniform vec2 anisotropyVector;
3263	#ifdef USE_ANISOTROPYMAP
3264		uniform sampler2D anisotropyMap;
3265	#endif
3266#endif
3267varying vec3 vViewPosition;
3268#include <common>
3269#include <packing>
3270#include <dithering_pars_fragment>
3271#include <color_pars_fragment>
3272#include <uv_pars_fragment>
3273#include <map_pars_fragment>
3274#include <alphamap_pars_fragment>
3275#include <alphatest_pars_fragment>
3276#include <alphahash_pars_fragment>
3277#include <aomap_pars_fragment>
3278#include <lightmap_pars_fragment>
3279#include <emissivemap_pars_fragment>
3280#include <iridescence_fragment>
3281#include <cube_uv_reflection_fragment>
3282#include <envmap_common_pars_fragment>
3283#include <envmap_physical_pars_fragment>
3284#include <fog_pars_fragment>
3285#include <lights_pars_begin>
3286#include <normal_pars_fragment>
3287#include <lights_physical_pars_fragment>
3288#include <transmission_pars_fragment>
3289#include <shadowmap_pars_fragment>
3290#include <bumpmap_pars_fragment>
3291#include <normalmap_pars_fragment>
3292#include <clearcoat_pars_fragment>
3293#include <iridescence_pars_fragment>
3294#include <roughnessmap_pars_fragment>
3295#include <metalnessmap_pars_fragment>
3296#include <logdepthbuf_pars_fragment>
3297#include <clipping_planes_pars_fragment>
3298void main() {
3299	vec4 diffuseColor = vec4( diffuse, opacity );
3300	#include <clipping_planes_fragment>
3301	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3302	vec3 totalEmissiveRadiance = emissive;
3303	#include <logdepthbuf_fragment>
3304	#include <map_fragment>
3305	#include <color_fragment>
3306	#include <alphamap_fragment>
3307	#include <alphatest_fragment>
3308	#include <alphahash_fragment>
3309	#include <roughnessmap_fragment>
3310	#include <metalnessmap_fragment>
3311	#include <normal_fragment_begin>
3312	#include <normal_fragment_maps>
3313	#include <clearcoat_normal_fragment_begin>
3314	#include <clearcoat_normal_fragment_maps>
3315	#include <emissivemap_fragment>
3316	#include <lights_physical_fragment>
3317	#include <lights_fragment_begin>
3318	#include <lights_fragment_maps>
3319	#include <lights_fragment_end>
3320	#include <aomap_fragment>
3321	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3322	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3323	#include <transmission_fragment>
3324	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3325	#ifdef USE_SHEEN
3326		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3327		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3328	#endif
3329	#ifdef USE_CLEARCOAT
3330		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3331		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3332		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3333	#endif
3334	#include <opaque_fragment>
3335	#include <tonemapping_fragment>
3336	#include <colorspace_fragment>
3337	#include <fog_fragment>
3338	#include <premultiplied_alpha_fragment>
3339	#include <dithering_fragment>
3340}`,Zp=`#define TOON
3341varying vec3 vViewPosition;
3342#include <common>
3343#include <batching_pars_vertex>
3344#include <uv_pars_vertex>
3345#include <displacementmap_pars_vertex>
3346#include <color_pars_vertex>
3347#include <fog_pars_vertex>
3348#include <normal_pars_vertex>
3349#include <morphtarget_pars_vertex>
3350#include <skinning_pars_vertex>
3351#include <shadowmap_pars_vertex>
3352#include <logdepthbuf_pars_vertex>
3353#include <clipping_planes_pars_vertex>
3354void main() {
3355	#include <uv_vertex>
3356	#include <color_vertex>
3357	#include <morphinstance_vertex>
3358	#include <morphcolor_vertex>
3359	#include <batching_vertex>
3360	#include <beginnormal_vertex>
3361	#include <morphnormal_vertex>
3362	#include <skinbase_vertex>
3363	#include <skinnormal_vertex>
3364	#include <defaultnormal_vertex>
3365	#include <normal_vertex>
3366	#include <begin_vertex>
3367	#include <morphtarget_vertex>
3368	#include <skinning_vertex>
3369	#include <displacementmap_vertex>
3370	#include <project_vertex>
3371	#include <logdepthbuf_vertex>
3372	#include <clipping_planes_vertex>
3373	vViewPosition = - mvPosition.xyz;
3374	#include <worldpos_vertex>
3375	#include <shadowmap_vertex>
3376	#include <fog_vertex>
3377}`,$p=`#define TOON
3378uniform vec3 diffuse;
3379uniform vec3 emissive;
3380uniform float opacity;
3381#include <common>
3382#include <packing>
3383#include <dithering_pars_fragment>
3384#include <color_pars_fragment>
3385#include <uv_pars_fragment>
3386#include <map_pars_fragment>
3387#include <alphamap_pars_fragment>
3388#include <alphatest_pars_fragment>
3389#include <alphahash_pars_fragment>
3390#include <aomap_pars_fragment>
3391#include <lightmap_pars_fragment>
3392#include <emissivemap_pars_fragment>
3393#include <gradientmap_pars_fragment>
3394#include <fog_pars_fragment>
3395#include <bsdfs>
3396#include <lights_pars_begin>
3397#include <normal_pars_fragment>
3398#include <lights_toon_pars_fragment>
3399#include <shadowmap_pars_fragment>
3400#include <bumpmap_pars_fragment>
3401#include <normalmap_pars_fragment>
3402#include <logdepthbuf_pars_fragment>
3403#include <clipping_planes_pars_fragment>
3404void main() {
3405	vec4 diffuseColor = vec4( diffuse, opacity );
3406	#include <clipping_planes_fragment>
3407	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3408	vec3 totalEmissiveRadiance = emissive;
3409	#include <logdepthbuf_fragment>
3410	#include <map_fragment>
3411	#include <color_fragment>
3412	#include <alphamap_fragment>
3413	#include <alphatest_fragment>
3414	#include <alphahash_fragment>
3415	#include <normal_fragment_begin>
3416	#include <normal_fragment_maps>
3417	#include <emissivemap_fragment>
3418	#include <lights_toon_fragment>
3419	#include <lights_fragment_begin>
3420	#include <lights_fragment_maps>
3421	#include <lights_fragment_end>
3422	#include <aomap_fragment>
3423	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3424	#include <opaque_fragment>
3425	#include <tonemapping_fragment>
3426	#include <colorspace_fragment>
3427	#include <fog_fragment>
3428	#include <premultiplied_alpha_fragment>
3429	#include <dithering_fragment>
3430}`,Jp=`uniform float size;
3431uniform float scale;
3432#include <common>
3433#include <color_pars_vertex>
3434#include <fog_pars_vertex>
3435#include <morphtarget_pars_vertex>
3436#include <logdepthbuf_pars_vertex>
3437#include <clipping_planes_pars_vertex>
3438#ifdef USE_POINTS_UV
3439	varying vec2 vUv;
3440	uniform mat3 uvTransform;
3441#endif
3442void main() {
3443	#ifdef USE_POINTS_UV
3444		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3445	#endif
3446	#include <color_vertex>
3447	#include <morphinstance_vertex>
3448	#include <morphcolor_vertex>
3449	#include <begin_vertex>
3450	#include <morphtarget_vertex>
3451	#include <project_vertex>
3452	gl_PointSize = size;
3453	#ifdef USE_SIZEATTENUATION
3454		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3455		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3456	#endif
3457	#include <logdepthbuf_vertex>
3458	#include <clipping_planes_vertex>
3459	#include <worldpos_vertex>
3460	#include <fog_vertex>
3461}`,Qp=`uniform vec3 diffuse;
3462uniform float opacity;
3463#include <common>
3464#include <color_pars_fragment>
3465#include <map_particle_pars_fragment>
3466#include <alphatest_pars_fragment>
3467#include <alphahash_pars_fragment>
3468#include <fog_pars_fragment>
3469#include <logdepthbuf_pars_fragment>
3470#include <clipping_planes_pars_fragment>
3471void main() {
3472	vec4 diffuseColor = vec4( diffuse, opacity );
3473	#include <clipping_planes_fragment>
3474	vec3 outgoingLight = vec3( 0.0 );
3475	#include <logdepthbuf_fragment>
3476	#include <map_particle_fragment>
3477	#include <color_fragment>
3478	#include <alphatest_fragment>
3479	#include <alphahash_fragment>
3480	outgoingLight = diffuseColor.rgb;
3481	#include <opaque_fragment>
3482	#include <tonemapping_fragment>
3483	#include <colorspace_fragment>
3484	#include <fog_fragment>
3485	#include <premultiplied_alpha_fragment>
3486}`,em=`#include <common>
3487#include <batching_pars_vertex>
3488#include <fog_pars_vertex>
3489#include <morphtarget_pars_vertex>
3490#include <skinning_pars_vertex>
3491#include <logdepthbuf_pars_vertex>
3492#include <shadowmap_pars_vertex>
3493void main() {
3494	#include <batching_vertex>
3495	#include <beginnormal_vertex>
3496	#include <morphinstance_vertex>
3497	#include <morphnormal_vertex>
3498	#include <skinbase_vertex>
3499	#include <skinnormal_vertex>
3500	#include <defaultnormal_vertex>
3501	#include <begin_vertex>
3502	#include <morphtarget_vertex>
3503	#include <skinning_vertex>
3504	#include <project_vertex>
3505	#include <logdepthbuf_vertex>
3506	#include <worldpos_vertex>
3507	#include <shadowmap_vertex>
3508	#include <fog_vertex>
3509}`,tm=`uniform vec3 color;
3510uniform float opacity;
3511#include <common>
3512#include <packing>
3513#include <fog_pars_fragment>
3514#include <bsdfs>
3515#include <lights_pars_begin>
3516#include <logdepthbuf_pars_fragment>
3517#include <shadowmap_pars_fragment>
3518#include <shadowmask_pars_fragment>
3519void main() {
3520	#include <logdepthbuf_fragment>
3521	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3522	#include <tonemapping_fragment>
3523	#include <colorspace_fragment>
3524	#include <fog_fragment>
3525}`,nm=`uniform float rotation;
3526uniform vec2 center;
3527#include <common>
3528#include <uv_pars_vertex>
3529#include <fog_pars_vertex>
3530#include <logdepthbuf_pars_vertex>
3531#include <clipping_planes_pars_vertex>
3532void main() {
3533	#include <uv_vertex>
3534	vec4 mvPosition = modelViewMatrix[ 3 ];
3535	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3536	#ifndef USE_SIZEATTENUATION
3537		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3538		if ( isPerspective ) scale *= - mvPosition.z;
3539	#endif
3540	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3541	vec2 rotatedPosition;
3542	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3543	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3544	mvPosition.xy += rotatedPosition;
3545	gl_Position = projectionMatrix * mvPosition;
3546	#include <logdepthbuf_vertex>
3547	#include <clipping_planes_vertex>
3548	#include <fog_vertex>
3549}`,im=`uniform vec3 diffuse;
3550uniform float opacity;
3551#include <common>
3552#include <uv_pars_fragment>
3553#include <map_pars_fragment>
3554#include <alphamap_pars_fragment>
3555#include <alphatest_pars_fragment>
3556#include <alphahash_pars_fragment>
3557#include <fog_pars_fragment>
3558#include <logdepthbuf_pars_fragment>
3559#include <clipping_planes_pars_fragment>
3560void main() {
3561	vec4 diffuseColor = vec4( diffuse, opacity );
3562	#include <clipping_planes_fragment>
3563	vec3 outgoingLight = vec3( 0.0 );
3564	#include <logdepthbuf_fragment>
3565	#include <map_fragment>
3566	#include <alphamap_fragment>
3567	#include <alphatest_fragment>
3568	#include <alphahash_fragment>
3569	outgoingLight = diffuseColor.rgb;
3570	#include <opaque_fragment>
3571	#include <tonemapping_fragment>
3572	#include <colorspace_fragment>
3573	#include <fog_fragment>
3574}`,Ne={alphahash_fragment:Td,alphahash_pars_fragment:bd,alphamap_fragment:Ad,alphamap_pars_fragment:wd,alphatest_fragment:Rd,alphatest_pars_fragment:Cd,aomap_fragment:Pd,aomap_pars_fragment:Ld,batching_pars_vertex:Dd,batching_vertex:Id,begin_vertex:Ud,beginnormal_vertex:Nd,bsdfs:Fd,iridescence_fragment:Od,bumpmap_pars_fragment:Bd,clipping_planes_fragment:zd,clipping_planes_pars_fragment:kd,clipping_planes_pars_vertex:Hd,clipping_planes_vertex:Vd,color_fragment:Gd,color_pars_fragment:Wd,color_pars_vertex:Xd,color_vertex:Yd,common:qd,cube_uv_reflection_fragment:jd,defaultnormal_vertex:Kd,displacementmap_pars_vertex:Zd,displacementmap_vertex:$d,emissivemap_fragment:Jd,emissivemap_pars_fragment:Qd,colorspace_fragment:ef,colorspace_pars_fragment:tf,envmap_fragment:nf,envmap_common_pars_fragment:sf,envmap_pars_fragment:rf,envmap_pars_vertex:af,envmap_physical_pars_fragment:_f,envmap_vertex:of,fog_vertex:cf,fog_pars_vertex:lf,fog_fragment:hf,fog_pars_fragment:uf,gradientmap_pars_fragment:df,lightmap_pars_fragment:ff,lights_lambert_fragment:pf,lights_lambert_pars_fragment:mf,lights_pars_begin:gf,lights_toon_fragment:xf,lights_toon_pars_fragment:vf,lights_phong_fragment:Mf,lights_phong_pars_fragment:Sf,lights_physical_fragment:yf,lights_physical_pars_fragment:Ef,lights_fragment_begin:Tf,lights_fragment_maps:bf,lights_fragment_end:Af,logdepthbuf_fragment:wf,logdepthbuf_pars_fragment:Rf,logdepthbuf_pars_vertex:Cf,logdepthbuf_vertex:Pf,map_fragment:Lf,map_pars_fragment:Df,map_particle_fragment:If,map_particle_pars_fragment:Uf,metalnessmap_fragment:Nf,metalnessmap_pars_fragment:Ff,morphinstance_vertex:Of,morphcolor_vertex:Bf,morphnormal_vertex:zf,morphtarget_pars_vertex:kf,morphtarget_vertex:Hf,normal_fragment_begin:Vf,normal_fragment_maps:Gf,normal_pars_fragment:Wf,normal_pars_vertex:Xf,normal_vertex:Yf,normalmap_pars_fragment:qf,clearcoat_normal_fragment_begin:jf,clearcoat_normal_fragment_maps:Kf,clearcoat_pars_fragment:Zf,iridescence_pars_fragment:$f,opaque_fragment:Jf,packing:Qf,premultiplied_alpha_fragment:ep,project_vertex:tp,dithering_fragment:np,dithering_pars_fragment:ip,roughnessmap_fragment:sp,roughnessmap_pars_fragment:rp,shadowmap_pars_fragment:ap,shadowmap_pars_vertex:op,shadowmap_vertex:cp,shadowmask_pars_fragment:lp,skinbase_vertex:hp,skinning_pars_vertex:up,skinning_vertex:dp,skinnormal_vertex:fp,specularmap_fragment:pp,specularmap_pars_fragment:mp,tonemapping_fragment:gp,tonemapping_pars_fragment:_p,transmission_fragment:xp,transmission_pars_fragment:vp,uv_pars_fragment:Mp,uv_pars_vertex:Sp,uv_vertex:yp,worldpos_vertex:Ep,background_vert:Tp,background_frag:bp,backgroundCube_vert:Ap,backgroundCube_frag:wp,cube_vert:Rp,cube_frag:Cp,depth_vert:Pp,depth_frag:Lp,distanceRGBA_vert:Dp,distanceRGBA_frag:Ip,equirect_vert:Up,equirect_frag:Np,linedashed_vert:Fp,linedashed_frag:Op,meshbasic_vert:Bp,meshbasic_frag:zp,meshlambert_vert:kp,meshlambert_frag:Hp,meshmatcap_vert:Vp,meshmatcap_frag:Gp,meshnormal_vert:Wp,meshnormal_frag:Xp,meshphong_vert:Yp,meshphong_frag:qp,meshphysical_vert:jp,meshphysical_frag:Kp,meshtoon_vert:Zp,meshtoon_frag:$p,points_vert:Jp,points_frag:Qp,shadow_vert:em,shadow_frag:tm,sprite_vert:nm,sprite_frag:im},ne={common:{diffuse:{value:new Pe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new De}},envmap:{envMap:{value:null},envMapRotation:{value:new De},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new De}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new De}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new De},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new De},normalScale:{value:new Ce(1,1)}}
vendor: 6,779 bytes, line 3574
3574,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new De},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new De}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new De}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new De}},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:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 De},alphaTest:{value:0},uvTransform:{value:new De}},sprite:{diffuse:{value:new Pe(16777215)},opacity:{value:1},center:{value:new Ce(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}}},tn={basic:{uniforms:At([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.fog]),vertexShader:Ne.meshbasic_vert,fragmentShader:Ne.meshbasic_frag},lambert:{uniforms:At([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new Pe(0)}}]),vertexShader:Ne.meshlambert_vert,fragmentShader:Ne.meshlambert_frag},phong:{uniforms:At([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new Pe(0)},specular:{value:new Pe(1118481)},shininess:{value:30}}]),vertexShader:Ne.meshphong_vert,fragmentShader:Ne.meshphong_frag},standard:{uniforms:At([ne.common,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.roughnessmap,ne.metalnessmap,ne.fog,ne.lights,{emissive:{value:new Pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ne.meshphysical_vert,fragmentShader:Ne.meshphysical_frag},toon:{uniforms:At([ne.common,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.gradientmap,ne.fog,ne.lights,{emissive:{value:new Pe(0)}}]),vertexShader:Ne.meshtoon_vert,fragmentShader:Ne.meshtoon_frag},matcap:{uniforms:At([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,{matcap:{value:null}}]),vertexShader:Ne.meshmatcap_vert,fragmentShader:Ne.meshmatcap_frag},points:{uniforms:At([ne.points,ne.fog]),vertexShader:Ne.points_vert,fragmentShader:Ne.points_frag},dashed:{uniforms:At([ne.common,ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ne.linedashed_vert,fragmentShader:Ne.linedashed_frag},depth:{uniforms:At([ne.common,ne.displacementmap]),vertexShader:Ne.depth_vert,fragmentShader:Ne.depth_frag},normal:{uniforms:At([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,{opacity:{value:1}}]),vertexShader:Ne.meshnormal_vert,fragmentShader:Ne.meshnormal_frag},sprite:{uniforms:At([ne.sprite,ne.fog]),vertexShader:Ne.sprite_vert,fragmentShader:Ne.sprite_frag},background:{uniforms:{uvTransform:{value:new De},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ne.background_vert,fragmentShader:Ne.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new De}},vertexShader:Ne.backgroundCube_vert,fragmentShader:Ne.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ne.cube_vert,fragmentShader:Ne.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ne.equirect_vert,fragmentShader:Ne.equirect_frag},distanceRGBA:{uniforms:At([ne.common,ne.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ne.distanceRGBA_vert,fragmentShader:Ne.distanceRGBA_frag},shadow:{uniforms:At([ne.lights,ne.fog,{color:{value:new Pe(0)},opacity:{value:1}}]),vertexShader:Ne.shadow_vert,fragmentShader:Ne.shadow_frag}};tn.physical={uniforms:At([tn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new De},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new De},clearcoatNormalScale:{value:new Ce(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new De},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new De},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new De},sheen:{value:0},sheenColor:{value:new Pe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new De},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new De},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new De},transmissionSamplerSize:{value:new Ce},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new De},attenuationDistance:{value:0},attenuationColor:{value:new Pe(0)},specularColor:{value:new Pe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new De},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new De},anisotropyVector:{value:new Ce},anisotropyMap:{value:null},anisotropyMapTransform:{value:new De}}]),vertexShader:Ne.meshphysical_vert,fragmentShader:Ne.meshphysical_frag};const Bs={r:0,b:0,g:0},Yn=new cn,sm=new Ie;
3574function rm(s,e,t,n,i,r,a){const o=new Pe(0);let c=r===!0?0:1,l,h,u=null,d=0,p=null;function g(T){let y=T.isScene===!0?T.background:null;return y&&y.isTexture&&(y=(T.backgroundBlurriness>0?t:e).get(y)),y}function _(T){let y=!1;const L=g(T);L===null?f(o,c):L&&L.isColor&&(f(L,1),y=!0);const P=s.xr.getEnvironmentBlendMode();P==="additive"?n.buffers.color.setClear(0,0,0,1,a):P==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(s.autoClear||y)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function m(T,y){const L=g(y);L&&(L.isCubeTexture||L.mapping===ir)?(h===void 0&&(h=new It(new os(1,1,1),new zn({name:"BackgroundCubeMaterial",uniforms:Li(tn.backgroundCube.uniforms),vertexShader:tn.backgroundCube.vertexShader,fragmentShader:tn.backgroundCube.fragmentShader,side:Ut,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(P,A,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),Yn.copy(y.backgroundRotation),Yn.x*=-1,Yn.y*=-1,Yn.z*=-1,L.isCubeTexture&&L.isRenderTargetTexture===!1&&(Yn.y*=-1,Yn.z*=-1),h.material.uniforms.envMap.value=L,h.material.uniforms.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(sm.makeRotationFromEuler(Yn)),h.material.toneMapped=Ve.getTransfer(L.colorSpace)!==et,(u!==L||d!==L.version||p!==s.toneMapping)&&(h.material.needsUpdate=!0,u=L,d=L.version,p=s.toneMapping),h.layers.enableAll(),T.unshift(h,h.geometry,h.material,0,0,null)):L&&L.isTexture&&(l===void 0&&(l=new It(new sr(2,2),new zn({name:"BackgroundMaterial",uniforms:Li(tn.background.uniforms),vertexShader:tn.background.vertexShader,fragmentShader:tn.background.fragmentShader,side:bn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=L,l.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,l.material.toneMapped=Ve.getTransfer(L.colorSpace)!==et,L.matrixAutoUpdate===!0&&L.updateMatrix(),l.material.uniforms.uvTransform.value.copy(L.matrix),(u!==L||d!==L.version||p!==s.toneMapping)&&(l.material.needsUpdate=!0,u=L,d=L.version,p=s.toneMapping),l.layers.enableAll(),T.unshift(l,l.geometry,l.material,0,0,null))}function f(T,y){T.getRGB(Bs,ml(s)),n.buffers.color.setClear(Bs.r,Bs.g,Bs.b,y,a)}function b(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(T,y=1){o.set(T),c=y,f(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(T){c=T,f(o,c)},render:_,addToRenderList:m,dispose:b}}function am(s,e){const t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=d(null);let r=i,a=!1;function o(v,R,V,F,O){let X=!1;const z=u(F,V,R);r!==z&&(r=z,l(r.object)),X=p(v,F,V,O),X&&g(v,F,V,O),O!==null&&e.update(O,s.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,y(v,R,V,F),O!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(O).buffer))}function c(){return s.createVertexArray()}function l(v){return s.bindVertexArray(v)}function h(v){return s.deleteVertexArray(v)}function u(v,R,V){const F=V.wireframe===!0;let O=n[v.id];O===void 0&&(O={},n[v.id]=O);let X=O[R.id];X===void 0&&(X={},O[R.id]=X);let z=X[F];return z===void 0&&(z=d(c()),X[F]=z),z}function d(v){const R=[],V=[],F=[];for(let O=0;O<t;O++)R[O]=0,V[O]=0,F[O]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:R,enabledAttributes:V,attributeDivisors:F,object:v,attributes:{},index:null}}function p(v,R,V,F){const O=r.attributes,X=R.attributes;let z=0;const $=V.getAttributes();for(const G in $)if($[G].location>=0){const ie=O[G];let _e=X[G];if(_e===void 0&&(G==="instanceMatrix"&&v.instanceMatrix&&(_e=v.instanceMatrix),G==="instanceColor"&&v.instanceColor&&(_e=v.instanceColor)),ie===void 0||ie.attribute!==_e||_e&&ie.data!==_e.data)return!0;z++}return r.attributesNum!==z||r.index!==F}function g(v,R,V,F){const O={},X=R.attributes;let z=0;const $=V.getAttributes();for(const G in $)if($[G].location>=0){let ie=X[G];ie===void 0&&(G==="instanceMatrix"&&v.instanceMatrix&&(ie=v.instanceMatrix),G==="instanceColor"&&v.instanceColor&&(ie=v.instanceColor));const _e={};_e.attribute=ie,ie&&ie.data&&(_e.data=ie.data),O[G]=_e,z++}r.attributes=O,r.attributesNum=z,r.index=F}function _(){const v=r.newAttributes;for(let R=0,V=v.length;R<V;R++)v[R]=0}function m(v){f(v,0)}
3574function f(v,R){const V=r.newAttributes,F=r.enabledAttributes,O=r.attributeDivisors;V[v]=1,F[v]===0&&(s.enableVertexAttribArray(v),F[v]=1),O[v]!==R&&(s.vertexAttribDivisor(v,R),O[v]=R)}function b(){const v=r.newAttributes,R=r.enabledAttributes;for(let V=0,F=R.length;V<F;V++)R[V]!==v[V]&&(s.disableVertexAttribArray(V),R[V]=0)}function T(v,R,V,F,O,X,z){z===!0?s.vertexAttribIPointer(v,R,V,O,X):s.vertexAttribPointer(v,R,V,F,O,X)}function y(v,R,V,F){_();const O=F.attributes,X=V.getAttributes(),z=R.defaultAttributeValues;for(const $ in X){const G=X[$];if(G.location>=0){let te=O[$];if(te===void 0&&($==="instanceMatrix"&&v.instanceMatrix&&(te=v.instanceMatrix),$==="instanceColor"&&v.instanceColor&&(te=v.instanceColor)),te!==void 0){const ie=te.normalized,_e=te.itemSize,Ee=e.get(te);if(Ee===void 0)continue;const Oe=Ee.buffer,Y=Ee.type,ee=Ee.bytesPerElement,me=Y===s.INT||Y===s.UNSIGNED_INT||te.gpuType===za;if(te.isInterleavedBufferAttribute){const re=te.data,ye=re.stride,qe=te.offset;if(re.isInstancedInterleavedBuffer){for(let be=0;be<G.locationSize;be++)f(G.location+be,re.meshPerAttribute);v.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let be=0;be<G.locationSize;be++)m(G.location+be);s.bindBuffer(s.ARRAY_BUFFER,Oe);for(let be=0;be<G.locationSize;be++)T(G.location+be,_e/G.locationSize,Y,ie,ye*ee,(qe+_e/G.locationSize*be)*ee,me)}else{if(te.isInstancedBufferAttribute){for(let re=0;re<G.locationSize;re++)f(G.location+re,te.meshPerAttribute);v.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let re=0;re<G.locationSize;re++)m(G.location+re);s.bindBuffer(s.ARRAY_BUFFER,Oe);for(let re=0;re<G.locationSize;re++)T(G.location+re,_e/G.locationSize,Y,ie,_e*ee,_e/G.locationSize*re*ee,me)}}else if(z!==void 0){const ie=z[$];if(ie!==void 0)switch(ie.length){case 2:s.vertexAttrib2fv(G.location,ie);break;case 3:s.vertexAttrib3fv(G.location,ie);break;case 4:s.vertexAttrib4fv(G.location,ie);break;default:s.vertexAttrib1fv(G.location,ie)}}}}b()}function L(){w();for(const v in n){const R=n[v];for(const V in R){const F=R[V];for(const O in F)h(F[O].object),delete F[O];delete R[V]}delete n[v]}}function P(v){if(n[v.id]===void 0)return;const R=n[v.id];for(const V in R){const F=R[V];for(const O in F)h(F[O].object),delete F[O];delete R[V]}delete n[v.id]}function A(v){for(const R in n){const V=n[R];if(V[v.id]===void 0)continue;const F=V[v.id];for(const O in F)h(F[O].object),delete F[O];delete V[v.id]}}function w(){S(),a=!0,r!==i&&(r=i,l(r.object))}function S(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:w,resetDefaultState:S,dispose:L,releaseStatesOfGeometry:P,releaseStatesOfProgram:A,initAttributes:_,enableAttribute:m,disableUnusedAttributes:b}}function om(s,e,t){let n;function i(l){n=l}function r(l,h){s.drawArrays(n,l,h),t.update(h,n,1)}function a(l,h,u){u!==0&&(s.drawArraysInstanced(n,l,h,u),t.update(h,n,u))}function o(l,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,h,0,u);let p=0;for(let g=0;g<u;g++)p+=h[g];t.update(p,n,1)}function c(l,h,u,d){if(u===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let g=0;g<l.length;g++)a(l[g],h[g],d[g]);
3574else{p.multiDrawArraysInstancedWEBGL(n,l,0,h,0,d,0,u);let g=0;for(let _=0;_<u;_++)g+=h[_]*d[_];t.update(g,n,1)}}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function cm(s,e,t,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const A=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(A){return!(A!==Gt&&n.convert(A)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(A){const w=A===Sn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(A!==An&&n.convert(A)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==Dt&&!w)}function c(A){if(A==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const h=c(l);h!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const u=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),g=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=s.getParameter(s.MAX_TEXTURE_SIZE),m=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),f=s.getParameter(s.MAX_VERTEX_ATTRIBS),b=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),T=s.getParameter(s.MAX_VARYING_VECTORS),y=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),L=g>0,P=s.getParameter(s.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:u,reverseDepthBuffer:d,maxTextures:p,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:b,maxVaryings:T,maxFragmentUniforms:y,vertexTextures:L,maxSamples:P}}function lm(s){const e=this;let t=null,n=0,i=!1,r=!1;const a=new Un,o=new De,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const p=u.length!==0||d||n!==0||i;return i=d,n=u.length,p},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,p){const g=u.clippingPlanes,_=u.clipIntersection,m=u.clipShadows,f=s.get(u);if(!i||g===null||g.length===0||r&&!m)r?h(null):l();else{const b=r?0:n,T=b*4;let y=f.clippingState||null;c.value=y,y=h(g,d,T,p);for(let L=0;L!==T;++L)y[L]=t[L];f.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=b}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,p,g){const _=u!==null?u.length:0;let m=null;if(_!==0){if(m=c.value,g!==!0||m===null){const f=p+_*4,b=d.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length<f)&&(m=new Float32Array(f));for(let T=0,y=p;T!==_;++T,y+=4)a.copy(u[T]).applyMatrix4(b,o),a.normal.toArray(m,y),m[y+3]=a.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function hm(s){let e=new WeakMap;function t(a,o){return o===$s?a.mapping=wi:o===ia&&(a.mapping=Ri),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===$s||o===ia)if(e.has(a)){const c=e.get(a).texture;return t(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const l=new Cu(c.height);return l.fromEquirectangularTexture(s,a),e.set(a,l),a.addEventListener("dispose",i),t(l.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}const Si=4,dc=[.125,.215,.35,.446,.526,.582],$n=20,Br=new no,fc=new Pe;let zr=null,kr=0,Hr=0,Vr=!1;const Kn=(1+Math.sqrt(5))/2,vi=1/Kn,pc=[new D(-Kn,vi,0),new D(Kn,vi,0),new D(-vi,0,Kn),new D(vi,0,Kn),new D(0,Kn,-vi),new D(0,Kn,vi),new D(-1,1,-1),new D(1,1,-1),new D(-1,1,1),new D(1,1,1)],um=new D;class mc{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,r={}){const{size:a=256,position:o=um}=r;zr=this._renderer.getRenderTarget(),kr=this._renderer.getActiveCubeFace(),Hr=this._renderer.getActiveMipmapLevel(),Vr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,i,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=xc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=_c(),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(zr,kr,Hr),this._renderer.xr.enabled=Vr,e.scissorTest=!1,zs(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===wi||e.mapping===Ri?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),zr=this._renderer.getRenderTarget(),kr=this._renderer.getActiveCubeFace(),Hr=this._renderer.getActiveMipmapLevel(),Vr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;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:ft,minFilter:ft,generateMipmaps:!1,type:Sn,format:Gt,colorSpace:Et,depthBuffer:!1},i=gc(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=gc(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=dm(r)),this._blurMaterial=fm(r,e,t)}return i}_compileMaterial(e){const t=new It(this._lodPlanes[0],e);this._renderer.compile(t,Br)}_sceneToCubeUV(e,t,n,i,r){const c=new wt(90,1,t,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,p=u.toneMapping;u.getClearColor(fc),u.toneMapping=Bn,u.autoClear=!1;
3574const g=new Jn({name:"PMREM.Background",side:Ut,depthWrite:!1,depthTest:!1}),_=new It(new os,g);let m=!1;const f=e.background;f?f.isColor&&(g.color.copy(f),e.background=null,m=!0):(g.color.copy(fc),m=!0);for(let b=0;b<6;b++){const T=b%3;T===0?(c.up.set(0,l[b],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+h[b],r.y,r.z)):T===1?(c.up.set(0,0,l[b]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+h[b],r.z)):(c.up.set(0,l[b],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+h[b]));const y=this._cubeSize;zs(i,T*y,b>2?y:0,y,y),u.setRenderTarget(i),m&&u.render(_,c),u.render(e,c)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=p,u.autoClear=d,e.background=f}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===wi||e.mapping===Ri;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=xc()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=_c());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new It(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=e;const c=this._cubeSize;zs(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Br)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let r=1;r<i;r++){const a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=pc[(i-r-1)%pc.length];this._blur(e,r-1,r,a,o)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new It(this._lodPlanes[i],l),d=l.uniforms,p=this._sizeLods[n]-1,g=isFinite(r)?Math.PI/(2*p):2*Math.PI/(2*$n-1),_=r/g,m=isFinite(r)?1+Math.floor(h*_):$n;m>$n&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${$n}`);const f=[];let b=0;for(let A=0;A<$n;++A){const w=A/_,S=Math.exp(-w*w/2);f.push(S),A===0?b+=S:A<m&&(b+=2*S)}for(let A=0;A<f.length;A++)f[A]=f[A]/b;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=f,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:T}=this;d.dTheta.value=g,d.mipInt.value=T-n;const y=this._sizeLods[i],L=3*y*(i>T-Si?i-T+Si:0),P=4*(this._cubeSize-y);zs(t,L,P,3*y,2*y),c.setRenderTarget(t),c.render(u,Br)}}function dm(s){const e=[],t=[],n=[];let i=s;const r=s-Si+1+dc.length;for(let a=0;a<r;a++){const o=Math.pow(2,i);t.push(o);let c=1/o;a>s-Si?c=dc[a-s+Si-1]:a===0&&(c=0),n.push(c);const l=1/(o-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],p=6,g=6,_=3,m=2,f=1,b=new Float32Array(_*g*p),T=new Float32Array(m*g*p),y=new Float32Array(f*g*p);for(let P=0;P<p;P++){const A=P%3*2/3-1,w=P>2?0:-1,S=[A,w,0,A+2/3,w,0,A+2/3,w+1,0,A,w,0,A+2/3,w+1,0,A,w+1,0];b.set(S,_*g*P),T.set(d,m*g*P);const v=[P,P,P,P,P,P];y.set(v,f*g*P)}const L=new Jt;L.setAttribute("position",new Ct(b,_)),L.setAttribute("uv",new Ct(T,m)),L.setAttribute("faceIndex",new Ct(y,f)),e.push(L),i>Si&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function gc(s,e,t){const n=new ti(s,e,t);return n.texture.mapping=ir,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function zs(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function fm(s,e,t){const n=new Float32Array($n),i=new D(0,1,0);return new zn({name:"SphericalGaussianBlur",defines:{n:$n,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:ro(),fragmentShader:`
3575
3576			precision mediump float;
3577			precision mediump int;
3578
3579			varying vec3 vOutputDirection;
3580
3581			uniform sampler2D envMap;
3582			uniform int samples;
3583			uniform float weights[ n ];
3584			uniform bool latitudinal;
3585			uniform float dTheta;
3586			uniform float mipInt;
3587			uniform vec3 poleAxis;
3588
3589			#define ENVMAP_TYPE_CUBE_UV
3590			#include <cube_uv_reflection_fragment>
3591
3592			vec3 getSample( float theta, vec3 axis ) {
3593
3594				float cosTheta = cos( theta );
3595				// Rodrigues' axis-angle rotation
3596				vec3 sampleDirection = vOutputDirection * cosTheta
3597					+ cross( axis, vOutputDirection ) * sin( theta )
3598					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3599
3600				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3601
3602			}
3603
3604			void main() {
3605
3606				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3607
3608				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3609
3610					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3611
3612				}
3613
3614				axis = normalize( axis );
3615
3616				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3617				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3618
3619				for ( int i = 1; i < n; i++ ) {
3620
3621					if ( i >= samples ) {
3622
3623						break;
3624
3625					}
3626
3627					float theta = dTheta * float( i );
3628					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3629					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3630
3631				}
3632
3633			}
3634		`,blending:On,depthTest:!1,depthWrite:!1})}function _c(){return new zn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ro(),fragmentShader:`
3635
3636			precision mediump float;
3637			precision mediump int;
3638
3639			varying vec3 vOutputDirection;
3640
3641			uniform sampler2D envMap;
3642
3643			#include <common>
3644
3645			void main() {
3646
3647				vec3 outputDirection = normalize( vOutputDirection );
3648				vec2 uv = equirectUv( outputDirection );
3649
3650				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3651
3652			}
3653		`,blending:On,depthTest:!1,depthWrite:!1})}function xc(){return new zn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ro(),fragmentShader:`
3654
3655			precision mediump float;
3656			precision mediump int;
3657
3658			uniform float flipEnvMap;
3659
3660			varying vec3 vOutputDirection;
3661
3662			uniform samplerCube envMap;
3663
3664			void main() {
3665
3666				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3667
3668			}
3669		`,blending:On,depthTest:!1,depthWrite:!1})}function ro(){return`
3670
3671		precision mediump float;
3672		precision mediump int;
3673
3674		attribute float faceIndex;
3675
3676		varying vec3 vOutputDirection;
3677
3678		// RH coordinate system; PMREM face-indexing convention
3679		vec3 getDirection( vec2 uv, float face ) {
3680
3681			uv = 2.0 * uv - 1.0;
3682
3683			vec3 direction = vec3( uv, 1.0 );
3684
3685			if ( face == 0.0 ) {
3686
3687				direction = direction.zyx; // ( 1, v, u ) pos x
3688
3689			} else if ( face == 1.0 ) {
3690
3691				direction = direction.xzy;
3692				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3693
3694			} else if ( face == 2.0 ) {
3695
3696				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3697
3698			} else if ( face == 3.0 ) {
3699
3700				direction = direction.zyx;
3701				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3702
3703			} else if ( face == 4.0 ) {
3704
3705				direction = direction.xzy;
3706				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3707
3708			} else if ( face == 5.0 ) {
3709
3710				direction.z *= -1.0; // ( u, v, -1 ) neg z
3711
3712			}
3713
3714			return direction;
3715
3716		}
3717
3718		void main() {
3719
3720			vOutputDirection = getDirection( uv, faceIndex );
3721			gl_Position = vec4( position, 1.0 );
3722
3723		}
3724	`}function pm(s){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const c=o.mapping,l=c===$s||c===ia,h=c===wi||c===Ri;if(l||h){let u=e.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return t===null&&(t=new mc(s)),u=l?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const p=o.image;return l&&p&&p.height>0||h&&p&&i(p)?(t===null&&(t=new mc(s)),u=l?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",r),u.texture):null}}}return o}function i(o){let c=0;const l=6;for(let h=0;h<l;h++)o[h]!==void 0&&c++;return c===l}function r(o){const c=o.target;c.removeEventListener("dispose",r);const l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function mm(s){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=s.getExtension("WEBGL_depth_texture")||s.getExtension("MOZ_WEBGL_depth_texture")||s.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=s.getExtension("WEBGL_compressed_texture_s3tc")||s.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=s.getExtension("WEBGL_compressed_texture_pvrtc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=s.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&Ks("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function gm(s,e,t,n){const i={},r=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const g in d.attributes)e.remove(d.attributes[g]);d.removeEventListener("dispose",a),delete i[d.id];const p=r.get(d);p&&(e.remove(p),r.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 c(u){const d=u.attributes;for(const p in d)e.update(d[p],s.ARRAY_BUFFER)}function l(u){const d=[],p=u.index,g=u.attributes.position;let _=0;if(p!==null){const b=p.array;_=p.version;for(let T=0,y=b.length;T<y;T+=3){const L=b[T+0],P=b[T+1],A=b[T+2];d.push(L,P,P,A,A,L)}}else if(g!==void 0){const b=g.array;_=g.version;for(let T=0,y=b.length/3-1;T<y;T+=3){const L=T+0,P=T+1,A=T+2;d.push(L,P,P,A,A,L)}}else return;const m=new(ll(d)?pl:fl)(d,1);m.version=_;const f=r.get(u);f&&e.remove(f),r.set(u,m)}function h(u){const d=r.get(u);if(d){const p=u.index;p!==null&&d.version<p.version&&l(u)}else l(u);return r.get(u)}return{get:o,update:c,getWireframeAttribute:h}}function _m(s,e,t){let n;function i(d){n=d}let r,a;function o(d){r=d.type,a=d.bytesPerElement}function c(d,p){s.drawElements(n,p,r,d*a),t.update(p,n,1)}function l(d,p,g){g!==0&&(s.drawElementsInstanced(n,p,r,d*a,g),t.update(p,n,g))}function h(d,p,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,r,d,0,g);let m=0;for(let f=0;f<g;f++)m+=p[f];t.update(m,n,1)}function u(d,p,g,_){if(g===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let f=0;f<d.length;f++)l(d[f]/a,p[f],_[f]);
3724else{m.multiDrawElementsInstancedWEBGL(n,p,0,r,d,0,_,0,g);let f=0;for(let b=0;b<g;b++)f+=p[b]*_[b];t.update(f,n,1)}}this.setMode=i,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function xm(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(t.calls++,a){case s.TRIANGLES:t.triangles+=o*(r/3);break;case s.LINES:t.lines+=o*(r/2);break;case s.LINE_STRIP:t.lines+=o*(r-1);break;case s.LINE_LOOP:t.lines+=o*r;break;case s.POINTS:t.points+=o*r;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 vm(s,e,t){const n=new WeakMap,i=new je;function r(a,o,c){const l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==u){let S=function(){A.dispose(),n.delete(o),o.removeEventListener("dispose",S)};d!==void 0&&d.texture.dispose();const p=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let T=0;p===!0&&(T=1),g===!0&&(T=2),_===!0&&(T=3);let y=o.attributes.position.count*T,L=1;y>e.maxTextureSize&&(L=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const P=new Float32Array(y*L*4*u),A=new hl(P,y,L,u);A.type=Dt,A.needsUpdate=!0;const w=T*4;for(let v=0;v<u;v++){const R=m[v],V=f[v],F=b[v],O=y*L*4*v;for(let X=0;X<R.count;X++){const z=X*w;p===!0&&(i.fromBufferAttribute(R,X),P[O+z+0]=i.x,P[O+z+1]=i.y,P[O+z+2]=i.z,P[O+z+3]=0),g===!0&&(i.fromBufferAttribute(V,X),P[O+z+4]=i.x,P[O+z+5]=i.y,P[O+z+6]=i.z,P[O+z+7]=0),_===!0&&(i.fromBufferAttribute(F,X),P[O+z+8]=i.x,P[O+z+9]=i.y,P[O+z+10]=i.z,P[O+z+11]=F.itemSize===4?i.w:1)}}d={count:u,texture:A,size:new Ce(y,L)},n.set(o,d),o.addEventListener("dispose",S)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(s,"morphTexture",a.morphTexture,t);else{let p=0;for(let _=0;_<l.length;_++)p+=l[_];const g=o.morphTargetsRelative?1:1-p;c.getUniforms().setValue(s,"morphTargetBaseInfluence",g),c.getUniforms().setValue(s,"morphTargetInfluences",l)}c.getUniforms().setValue(s,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(s,"morphTargetsTextureSize",d.size)}return{update:r}}function Mm(s,e,t,n){let i=new WeakMap;function r(c){const l=n.render.frame,h=c.geometry,u=e.get(c,h);if(i.get(u)!==l&&(e.update(u),i.set(u,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),i.get(c)!==l&&(t.update(c.instanceMatrix,s.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,s.ARRAY_BUFFER),i.set(c,l))),c.isSkinnedMesh){const d=c.skeleton;i.get(d)!==l&&(d.update(),i.set(d,l))}return u}function a(){i=new WeakMap}function o(c){const l=c.target;l.removeEventListener("dispose",o),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:r,dispose:a}}const Rl=new pt,vc=new Sl(1,1),Cl=new hl,Pl=new lu,Ll=new _l,Mc=[],Sc=[],yc=new Float32Array(16),Ec=new Float32Array(9),Tc=new Float32Array(4);function Oi(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let r=Mc[i];if(r===void 0&&(r=new Float32Array(i),Mc[i]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,s[a].toArray(r,o)}return r}function mt(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function gt(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function ar(s,e){let t=Sc[e];t===void 0&&(t=new Int32Array(e),Sc[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function Sm(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function ym(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(mt(t,e))return;s.uniform2fv(this.addr,e),gt(t,e)}}function Em(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(mt(t,e))return;s.uniform3fv(this.addr,e),gt(t,e)}}function Tm(s,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)&&(s.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(mt(t,e))return;s.uniform4fv(this.addr,e),gt(t,e)}}function bm(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(mt(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),gt(t,e)}else{if(mt(t,n))return;Tc.set(n),s.uniformMatrix2fv(this.addr,!1,Tc),gt(t,n)}}function Am(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(mt(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),gt(t,e)}else{if(mt(t,n))return;Ec.set(n),s.uniformMatrix3fv(this.addr,!1,Ec),gt(t,n)}}function wm(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(mt(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),gt(t,e)}else{if(mt(t,n))return;yc.set(n),s.uniformMatrix4fv(this.addr,!1,yc),gt(t,n)}}function Rm(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function Cm(s,e){const t=this.cache;
vendor: 4,120 bytes, line 3724
3724if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(mt(t,e))return;s.uniform2iv(this.addr,e),gt(t,e)}}function Pm(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(mt(t,e))return;s.uniform3iv(this.addr,e),gt(t,e)}}function Lm(s,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)&&(s.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(mt(t,e))return;s.uniform4iv(this.addr,e),gt(t,e)}}function Dm(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function Im(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(mt(t,e))return;s.uniform2uiv(this.addr,e),gt(t,e)}}function Um(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(mt(t,e))return;s.uniform3uiv(this.addr,e),gt(t,e)}}function Nm(s,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)&&(s.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(mt(t,e))return;s.uniform4uiv(this.addr,e),gt(t,e)}}function Fm(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let r;this.type===s.SAMPLER_2D_SHADOW?(vc.compareFunction=ol,r=vc):r=Rl,t.setTexture2D(e||r,i)}function Om(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Pl,i)}function Bm(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Ll,i)}function zm(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Cl,i)}function km(s){switch(s){case 5126:return Sm;case 35664:return ym;case 35665:return Em;case 35666:return Tm;case 35674:return bm;case 35675:return Am;case 35676:return wm;case 5124:case 35670:return Rm;case 35667:case 35671:return Cm;case 35668:case 35672:return Pm;case 35669:case 35673:return Lm;case 5125:return Dm;case 36294:return Im;case 36295:return Um;case 36296:return Nm;case 35678:case 36198:case 36298:case 36306:case 35682:return Fm;case 35679:case 36299:case 36307:return Om;case 35680:case 36300:case 36308:case 36293:return Bm;case 36289:case 36303:case 36311:case 36292:return zm}}function Hm(s,e){s.uniform1fv(this.addr,e)}function Vm(s,e){const t=Oi(e,this.size,2);s.uniform2fv(this.addr,t)}function Gm(s,e){const t=Oi(e,this.size,3);s.uniform3fv(this.addr,t)}function Wm(s,e){const t=Oi(e,this.size,4);s.uniform4fv(this.addr,t)}function Xm(s,e){const t=Oi(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function Ym(s,e){const t=Oi(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function qm(s,e){const t=Oi(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function jm(s,e){s.uniform1iv(this.addr,e)}function Km(s,e){s.uniform2iv(this.addr,e)}function Zm(s,e){s.uniform3iv(this.addr,e)}function $m(s,e){s.uniform4iv(this.addr,e)}function Jm(s,e){s.uniform1uiv(this.addr,e)}function Qm(s,e){s.uniform2uiv(this.addr,e)}function eg(s,e){s.uniform3uiv(this.addr,e)}function tg(s,e){s.uniform4uiv(this.addr,e)}function ng(s,e,t){const n=this.cache,i=e.length,r=ar(t,i);mt(n,r)||(s.uniform1iv(this.addr,r),gt(n,r));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||Rl,r[a])}function ig(s,e,t){const n=this.cache,i=e.length,r=ar(t,i);mt(n,r)||(s.uniform1iv(this.addr,r),gt(n,r));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Pl,r[a])}function sg(s,e,t){const n=this.cache,i=e.length,r=ar(t,i);mt(n,r)||(s.uniform1iv(this.addr,r),gt(n,r));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Ll,r[a])}function rg(s,e,t){const n=this.cache,i=e.length,r=ar(t,i);mt(n,r)||(s.uniform1iv(this.addr,r),gt(n,r));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Cl,r[a])}function ag(s){switch(s){case 5126:return Hm;case 35664:return Vm;case 35665:return Gm;case 35666:return Wm;case 35674:return Xm;
3724case 35675:return Ym;case 35676:return qm;case 5124:case 35670:return jm;case 35667:case 35671:return Km;case 35668:case 35672:return Zm;case 35669:case 35673:return $m;case 5125:return Jm;case 36294:return Qm;case 36295:return eg;case 36296:return tg;case 35678:case 36198:case 36298:case 36306:case 35682:return ng;case 35679:case 36299:case 36307:return ig;case 35680:case 36300:case 36308:case 36293:return sg;case 36289:case 36303:case 36311:case 36292:return rg}}class og{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=km(t.type)}}class cg{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=ag(t.type)}}class lg{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const o=i[r];o.setValue(e,t[o.id],n)}}}const Gr=/(\w+)(\])?(\[|\.)?/g;function bc(s,e){s.seq.push(e),s.map[e.id]=e}function hg(s,e,t){const n=s.name,i=n.length;for(Gr.lastIndex=0;;){const r=Gr.exec(n),a=Gr.lastIndex;let o=r[1];const c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===i){bc(t,l===void 0?new og(o,s,e):new cg(o,s,e));break}else{let u=t.map[o];u===void 0&&(u=new lg(o),bc(t,u)),t=u}}}class Zs{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const r=e.getActiveUniform(t,i),a=e.getUniformLocation(t,r.name);hg(r,a,this)}}setValue(e,t,n,i){const r=this.map[t];r!==void 0&&r.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 r=0,a=t.length;r!==a;++r){const o=t[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function Ac(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const ug=37297;let dg=0;function fg(s,e){const t=s.split(`
3725`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=i;a<r;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
3726`)}const wc=new De;function pg(s){Ve._getMatrix(wc,Ve.workingColorSpace,s);const e=`mat3( ${wc.elements.map(t=>t.toFixed(4))} )`;switch(Ve.getTransfer(s)){case Qs:return[e,"LinearTransferOETF"];case et:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function Rc(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),i=s.getShaderInfoLog(e).trim();if(n&&i==="")return"";const r=/ERROR: 0:(\d+)/.exec(i);if(r){const a=parseInt(r[1]);return t.toUpperCase()+`
3727
3728`+i+`
3729
3730`+fg(s.getShaderSource(e),a)}else return i}function mg(s,e){const t=pg(e);return[`vec4 ${s}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3731`)}function gg(s,e){let t;switch(e){case xh:t="Linear";break;case vh:t="Reinhard";break;case Mh:t="Cineon";break;case qc:t="ACESFilmic";break;case yh:t="AgX";break;case Eh:t="Neutral";break;case Sh:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const ks=new D;function _g(){Ve.getLuminanceCoefficients(ks);const s=ks.x.toFixed(4),e=ks.y.toFixed(4),t=ks.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${s}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
3732`)}function xg(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ki).join(`
3733`)}function vg(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3734`)}function Mg(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const r=s.getActiveAttrib(e,i),a=r.name;let o=1;r.type===s.FLOAT_MAT2&&(o=2),r.type===s.FLOAT_MAT3&&(o=3),r.type===s.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:s.getAttribLocation(e,a),locationSize:o}}return t}function Ki(s){return s!==""}function Cc(s,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_L
3734IGHTS/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 Pc(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Sg=/^[ \t]*#include +<([\w\d./]+)>/gm;function Na(s){return s.replace(Sg,Eg)}const yg=new Map;function Eg(s,e){let t=Ne[e];if(t===void 0){const n=yg.get(e);if(n!==void 0)t=Ne[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 Na(t)}const Tg=/#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 Lc(s){return s.replace(Tg,bg)}function bg(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function Dc(s){let e=`precision ${s.precision} float;
3735	precision ${s.precision} int;
3736	precision ${s.precision} sampler2D;
3737	precision ${s.precision} samplerCube;
3738	precision ${s.precision} sampler3D;
3739	precision ${s.precision} sampler2DArray;
3740	precision ${s.precision} sampler2DShadow;
3741	precision ${s.precision} samplerCubeShadow;
3742	precision ${s.precision} sampler2DArrayShadow;
3743	precision ${s.precision} isampler2D;
3744	precision ${s.precision} isampler3D;
3745	precision ${s.precision} isamplerCube;
3746	precision ${s.precision} isampler2DArray;
3747	precision ${s.precision} usampler2D;
3748	precision ${s.precision} usampler3D;
3749	precision ${s.precision} usamplerCube;
3750	precision ${s.precision} usampler2DArray;
3751	`;return s.precision==="highp"?e+=`
3752#define HIGH_PRECISION`:s.precision==="mediump"?e+=`
3753#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`
3754#define LOW_PRECISION`),e}function Ag(s){let e="SHADOWMAP_TYPE_BASIC";return s.shadowMapType===Wc?e="SHADOWMAP_TYPE_PCF":s.shadowMapType===Xc?e="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===xn&&(e="SHADOWMAP_TYPE_VSM"),e}function wg(s){let e="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case wi:case Ri:e="ENVMAP_TYPE_CUBE";break;case ir:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Rg(s){let e="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case Ri:e="ENVMAP_MODE_REFRACTION";break}return e}function Cg(s){let e="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case Yc:e="ENVMAP_BLENDING_MULTIPLY";break;case gh:e="ENVMAP_BLENDING_MIX";break;case _h:e="ENVMAP_BLENDING_ADD";break}return e}function Pg(s){const e=s.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),112)),texelHeight:n,maxMip:t}}function Lg(s,e,t,n){const i=s.getContext(),r=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=Ag(t),l=wg(t),h=Rg(t),u=Cg(t),d=Pg(t),p=xg(t),g=vg(r),_=i.createProgram();let m,f,b=t.glslVersion?"#version "+t.glslVersion+`
3755`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ki).join(`
3756`),m.length>0&&(m+=`
3757`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ki).join(`
3758`),f.length>0&&(f+=`
3759`)):(m=[Dc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",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
3759IDESCENCEMAP":"",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?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
3760`].filter(Ki).join(`
3761`),f=[Dc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",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.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3761IDESCENCE":"",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||t.batchingColor?"#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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Bn?"#define TONE_MAPPING":"",t.toneMapping!==Bn?Ne.tonemapping_pars_fragment:"",t.toneMapping!==Bn?gg("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ne.colorspace_pars_fragment,mg("linearToOutputTexel",t.outputColorSpace),_g(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3762`].filter(Ki).join(`
3763`)),a=Na(a),a=Cc(a,t),a=Pc(a,t),o=Na(o),o=Cc(o,t),o=Pc(o,t),a=Lc(a),o=Lc(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es
3764`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3765`)+`
3766`+m,f=["#define varying in",t.glslVersion===Ro?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Ro?"":"#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(`
3767`)+`
3768`+f);const T=b+m+a,y=b+f+o,L=Ac(i,i.VERTEX_SHADER,T),P=Ac(i,i.FRAGMENT_SHADER,y);i.attachShader(_,L),i.attachShader(_,P),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function A(R){if(s.debug.checkShaderErrors){const V=i.getProgramInfoLog(_).trim(),F=i.getShaderInfoLog(L).trim(),O=i.getShaderInfoLog(P).trim();let X=!0,z=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(X=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,_,L,P);else{const $=Rc(i,L,"vertex"),G=Rc(i,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
3769
3770Material Name: `+R.name+`
3771Material Type: `+R.type+`
3772
3773Program Info Log: `+V+`
3774`+$+`
3775`+G)}else V!==""?console.warn("THREE.WebGLProgram: Program Info Log:",V):(F===""||O==="")&&(z=!1);z&&(R.diagnostics={runnable:X,programLog:V,vertexShader:{log:F,prefix:m},fragmentShader:{log:O,prefix:f}})}i.deleteShader(L),i.deleteShader(P),w=new Zs(i,_),S=Mg(i,_)}let w;this.getUniforms=function(){return w===void 0&&A(this),w};let S;this.getAttributes=function(){return S===void 0&&A(this),S};let v=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return v===!1&&(v=i.getProgramParameter(_,ug)),v},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=dg++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=L,this.fragmentShader=P,this}let Dg=0;class Ig{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.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 Ug(e),t.set(e,n)),n}}class Ug{constructor(e){this.id=Dg++,this.code=e,this.usedTimes=0}}function Ng(s,e,t,n,i,r,a){const o=new ul,c=new Ig,l=new Set,h=[],u=i.logarithmicDepthBuffer,d=i.vertexTextures;let p=i.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(S){return l.add(S),S===0?"uv":`uv${S}`}function m(S,v,R,V,F){const O=V.fog,X=F.geometry,z=S.isMeshStandardMaterial?V.environment:null,$=(S.isMeshStandardMaterial?t:e).get(S.envMap||z),G=$&&$.mapping===ir?$.image.height:null,te=g[S.type];S.precision!==null&&(p=i.getMaxPrecision(S.precision),p!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",p,"instead."));const ie=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,_e=ie!==void 0?ie.length:0;let Ee=0;X.morphAttributes.position!==void 0&&(Ee=1),X.morphAttributes.normal!==void 0&&(Ee=2),X.morphAttributes.color!==void 0&&(Ee=3);let Oe,Y,ee,me;if(te){const $e=tn[te];Oe=$e.vertexShader,Y=$e.fragmentShader}else Oe=S.vertexShader,Y=S.fragmentShader,c.update(S),ee=c.getVertexShaderID(S),me=c.getFragmentShaderID(S);const re=s.getRenderTarget(),ye=s.state.buffers.depth.getReversed(),qe=F.isInstancedMesh===!0,be=F.isBatchedMesh===!0,lt=!!S.map,rt=!!S.matcap,ze=!!$,C=!!S.aoMap,Bt=!!S.lightMap,Ge=!!S.bumpMap,ke=!!S.normalMap,ve=!!S.displacementMap,it=!!S.emissiveMap,xe=!!S.metalnessMap,E=!!S.roughnessMap,x=S.anisotropy>0,B=S.clearcoat>0,j=S.dispersion>0,Z=S.iridescence>0,q=S.sheen>0,ge=S.transmission>0,ae=x&&!!S.anisotropyMap,ue=B&&!!S.clearcoatMap,We=B&&!!S.clearcoatNormalMap,Q=B&&!!S.
vendor: 13,789 bytes, line 3775
3775clearcoatRoughnessMap,de=Z&&!!S.iridescenceMap,Te=Z&&!!S.iridescenceThicknessMap,we=q&&!!S.sheenColorMap,fe=q&&!!S.sheenRoughnessMap,He=!!S.specularMap,Ue=!!S.specularColorMap,nt=!!S.specularIntensityMap,I=ge&&!!S.transmissionMap,oe=ge&&!!S.thicknessMap,W=!!S.gradientMap,K=!!S.alphaMap,le=S.alphaTest>0,ce=!!S.alphaHash,Le=!!S.extensions;let ot=Bn;S.toneMapped&&(re===null||re.isXRRenderTarget===!0)&&(ot=s.toneMapping);const Mt={shaderID:te,shaderType:S.type,shaderName:S.name,vertexShader:Oe,fragmentShader:Y,defines:S.defines,customVertexShaderID:ee,customFragmentShaderID:me,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:p,batching:be,batchingColor:be&&F._colorsTexture!==null,instancing:qe,instancingColor:qe&&F.instanceColor!==null,instancingMorph:qe&&F.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:re===null?s.outputColorSpace:re.isXRRenderTarget===!0?re.texture.colorSpace:Et,alphaToCoverage:!!S.alphaToCoverage,map:lt,matcap:rt,envMap:ze,envMapMode:ze&&$.mapping,envMapCubeUVHeight:G,aoMap:C,lightMap:Bt,bumpMap:Ge,normalMap:ke,displacementMap:d&&ve,emissiveMap:it,normalMapObjectSpace:ke&&S.normalMapType===Ph,normalMapTangentSpace:ke&&S.normalMapType===al,metalnessMap:xe,roughnessMap:E,anisotropy:x,anisotropyMap:ae,clearcoat:B,clearcoatMap:ue,clearcoatNormalMap:We,clearcoatRoughnessMap:Q,dispersion:j,iridescence:Z,iridescenceMap:de,iridescenceThicknessMap:Te,sheen:q,sheenColorMap:we,sheenRoughnessMap:fe,specularMap:He,specularColorMap:Ue,specularIntensityMap:nt,transmission:ge,transmissionMap:I,thicknessMap:oe,gradientMap:W,opaque:S.transparent===!1&&S.blending===Ei&&S.alphaToCoverage===!1,alphaMap:K,alphaTest:le,alphaHash:ce,combine:S.combine,mapUv:lt&&_(S.map.channel),aoMapUv:C&&_(S.aoMap.channel),lightMapUv:Bt&&_(S.lightMap.channel),bumpMapUv:Ge&&_(S.bumpMap.channel),normalMapUv:ke&&_(S.normalMap.channel),displacementMapUv:ve&&_(S.displacementMap.channel),emissiveMapUv:it&&_(S.emissiveMap.channel),metalnessMapUv:xe&&_(S.metalnessMap.channel),roughnessMapUv:E&&_(S.roughnessMap.channel),anisotropyMapUv:ae&&_(S.anisotropyMap.channel),clearcoatMapUv:ue&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:We&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:de&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:Te&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:we&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:fe&&_(S.sheenRoughnessMap.channel),specularMapUv:He&&_(S.specularMap.channel),specularColorMapUv:Ue&&_(S.specularColorMap.channel),specularIntensityMapUv:nt&&_(S.specularIntensityMap.channel),transmissionMapUv:I&&_(S.transmissionMap.channel),thicknessMapUv:oe&&_(S.thicknessMap.channel),alphaMapUv:K&&_(S.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(ke||x),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!X.attributes.uv&&(lt||K),fog:!!O,useFog:S.fog===!0,fogExp2:!!O&&O.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:ye,skinning:F.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:Ee,numDirLights:v.directional.length,numPointLights:v.point.length,numSpotLights:v.spot.length,numSpotLightMaps:v.spotLightMap.length,numRectAreaLights:v.rectArea.length,numHemiLights:v.hemi.length,numDirLightShadows:v.directionalShadowMap.length,numPointLightShadows:v.pointShadowMap.length,numSpotLightShadows:v.spotShadowMap.length,numSpotLightShadowsWithMaps:v.numSpotLightShadowsWithMaps,numLightProbes:v.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:s.shadowMap.enabled&&R.length>0,shadowMapType:s.shadowMap.type,toneMapping:ot,decodeVideoTexture:lt&&S.map.isVideoTexture===!0&&Ve.getTransfer(S.map.colorSpace)===et,decodeVideoTextureEmissive:it&&S.emissiveMap.isVideoTexture===!0&&Ve.getTransfer(S.emissiveMap.colorSpace)===et,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===nn,flipSided:S.side===Ut,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:Le&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Le&&S.extensions.multiDraw===!0||be)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return Mt.vertexUv1s=l.has(1),Mt.vertexUv2s=l.has(2),Mt.vertexUv3s=l.has(3),l.clear(),Mt}function f(S){const v=[];if(S.shaderID?v.push(S.shaderID):(v.push(S.customVertexShaderID),v.push(S.customFragmentShaderID)),S.defines!==void 0)for(const R in S.defines)v.push(R),v.push(S.defines[R]);return S.isRawShaderMaterial===!1&&(b(v,S),T(v,S),v.push(s.outputColorSpace)),v.push(S.customProgramCacheKey),v.join()}function b(S,v){S.push(v.precision),S.push(v.outputColorSpace),S.push(v.envMapMode),S.push(v.envMapCubeUVHeight),S.push(v.mapUv),S.push(v.alphaMapUv),S.push(v.lightMapUv),S.push(v.aoMapUv),S.push(v.bumpMapUv),S.push(v.normalMapUv),S.push(v.displacementMapUv),S.push(v.emissiveMapUv),S.push(v.metalnessMapUv),S.push(v.roughnessMapUv),S.push(v.anisotropyMapUv),S.push(v.clearcoatMapUv),S.push(v.clearcoatNormalMapUv),S.push(v.clearcoatRoughnessMapUv),S.push(v.iridescenceMapUv),S.push(v.iridescenceThicknessMapUv),S.push(v.sheenColorMapUv),S.push(v.sheenRoughnessMapUv),S.push(v.specularMapUv),S.push(v.specularColorMapUv),S.push(v.specularIntensityMapUv),S.push(v.transmissionMapUv),S.push(v.thicknessMapUv),S.push(v.combine),S.push(v.fogExp2),S.push(v.sizeAttenuation),S.push(v.morphTargetsCount),S.push(v.morphAttributeCount),S.push(v.numDirLights),S.push(v.numPointLights),S.push(v.numSpotLights),S.push(v.numSpotLightMaps),S.push(v.numHemiLights),S.push(v.numRectAreaLights),S.push(v.numDirLightShadows),S.push(v.numPointLightShadows),S.push(v.numSpotLightShadows),S.push(v.numSpotLightShadowsWithMaps),S.push(v.numLightProbes),S.push(v.shadowMapType),S.push(v.toneMapping),S.push(v.numClippingPlanes),S.push(v.numClipIntersection),S.push(v.depthPacking)}function T(S,v){o.disableAll(),v.supportsVertexTextures&&o.enable(0),v.instancing&&o.enable(1),v.instancingColor&&o.enable(2),v.instancingMorph&&o.enable(3),v.matcap&&o.enable(4),v.envMap&&o.enable(5),v.normalMapObjectSpace&&o.enable(6),v.normalMapTangentSpace&&o.enable(7),v.clearcoat&&o.enable(8),v.iridescence&&o.enable(9),v.alphaTest&&o.enable(10),v.vertexColors&&o.enable(11),v.vertexAlphas&&o.enable(12),v.vertexUv1s&&o.enable(13),v.vertexUv2s&&o.enable(14),v.vertexUv3s&&o.enable(15),v.vertexTangents&&o.enable(16),v.anisotropy&&o.enable(17),v.alphaHash&&o.enable(18),v.batching&&o.enable(19),v.dispersion&&o.enable(20),v.batchingColor&&o.enable(21),S.push(o.mask),o.disableAll(),v.fog&&o.enable(0),v.useFog&&o.enable(1),v.flatShading&&o.enable(2),v.logarithmicDepthBuffer&&o.enable(3),v.reverseDepthBuffer&&o.enable(4),v.skinning&&o.enable(5),v.morphTargets&&o.enable(6),v.morphNormals&&o.enable(7),v.morphColors&&o.enable(8),v.premultipliedAlpha&&o.enable(9),v.shadowMapEnabled&&o.enable(10),v.doubleSided&&o.enable(11),v.flipSided&&o.enable(12),v.useDepthPacking&&o.enable(13),v.dithering&&o.enable(14),v.transmission&&o.enable(15),v.sheen&&o.enable(16),v.opaque&&o.enable(17),v.pointsUvs&&o.enable(18),v.decodeVideoTexture&&o.enable(19),v.decodeVideoTextureEmissive&&o.enable(20),v.alphaToCoverage&&o.enable(21),S.push(o.mask)}function y(S){const v=g[S.type];let R;if(v){const V=tn[v];R=bu.clone(V.uniforms)}else R=S.uniforms;return R}function L(S,v){let R;for(let V=0,F=h.length;V<F;V++){const O=h[V];if(O.cacheKey===v){R=O,++R.usedTimes;break}}return R===void 0&&(R=new Lg(s,v,S,r),h.push(R)),R}function P(S){if(--S.usedTimes===0){const v=h.indexOf(S);h[v]=h[h.length-1],h.pop(),S.destroy()}}function A(S){c.remove(S)}function w(){c.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:y,acquireProgram:L,releaseProgram:P,releaseShaderCache:A,programs:h,dispose:w}}function Fg(){let s=new WeakMap;function e(a){return s.has(a)}function t(a){let o=s.get(a);return o===void 0&&(o={},s.set(a,o)),o}function n(a){s.delete(a)}function i(a,o,c){s.get(a)[o]=c}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function Og(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function Ic(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function Uc(){const s=[];let e=0;const t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function a(u,d,p,g,_,m){let f=s[e];return f===void 0?(f={id:u.id,object:u,geometry:d,material:p,groupOrder:g,renderOrder:u.renderOrder,z:_,group:m},s[e]=f):(f.id=u.id,f.object=u,f.geometry=d,f.material=p,f.groupOrder=g,f.renderOrder=u.renderOrder,f.z=_,f.group=m),e++,f}function o(u,d,p,g,_,m){const f=a(u,d,p,g,_,m);p.transmission>0?n.push(f):p.transparent===!0?i.push(f):t.push(f)}function c(u,d,p,g,_,m){const f=a(u,d,p,g,_,m);p.transmission>0?n.unshift(f):p.transparent===!0?i.unshift(f):t.unshift(f)}function l(u,d){t.length>1&&t.sort(u||Og),n.length>1&&n.sort(d||Ic),i.length>1&&i.sort(d||Ic)}function h(){for(let u=e,d=s.length;u<d;u++){const p=s[u];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:o,unshift:c,finish:h,sort:l}}function Bg(){let s=new WeakMap;function e(n,i){const r=s.get(n);let a;return r===void 0?(a=new Uc,s.set(n,[a])):i>=r.length?(a=new Uc,r.push(a)):a=r[i],a}function t(){s=new WeakMap}return{get:e,dispose:t}}function zg(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new D,color:new Pe};break;case"SpotLight":t={position:new D,direction:new D,color:new Pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new D,color:new Pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new D,skyColor:new Pe,groundColor:new Pe};break;case"RectAreaLight":t={color:new Pe,position:new D,halfWidth:new D,halfHeight:new D};break}return s[e.id]=t,t}}}function kg(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let Hg=0;function Vg(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function Gg(s){const e=new zg,t=kg(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new D);const i=new D,r=new Ie,a=new Ie;function o(l){let h=0,u=0,d=0;for(let S=0;S<9;S++)n.probe[S].set(0,0,0);let p=0,g=0,_=0,m=0,f=0,b=0,T=0,y=0,L=0,P=0,A=0;l.sort(Vg);for(let S=0,v=l.length;S<v;S++){const R=l[S],V=R.color,F=R.intensity,O=R.distance,X=R.shadow&&R.shadow.map?R.shadow.map.texture:null;if(R.isAmbientLight)h+=V.r*F,u+=V.g*F,d+=V.b*F;else if(R.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(R.sh.coefficients[z],F);A++}else if(R.isDirectionalLight){const z=e.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){const $=R.shadow,G=t.get(R);G.shadowIntensity=$.intensity,G.shadowBias=$.bias,G.shadowNormalBias=$.normalBias,G.shadowRadius=$.radius,G.shadowMapSize=$.mapSize,n.directionalShadow[p]=G,n.directionalShadowMap[p]=X,n.directionalShadowMatrix[p]=R.shadow.matrix,b++}n.directional[p]=z,p++}else if(R.isSpotLight){const z=e.get(R);z.position.setFromMatrixPosition(R.matrixWorld),z.color.copy(V).multiplyScalar(F),z.distance=O,z.coneCos=Math.cos(R.angle),z.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),z.decay=R.decay,n.spot[_]=z;const $=R.shadow;if(R.map&&(n.spotLightMap[L]=R.map,L++,$.updateMatrices(R),R.castShadow&&P++),n.spotLightMatrix[_]=$.matrix,R.castShadow){const G=t.get(R);G.shadowIntensity=$.intensity,G.shadowBias=$.bias,G.shadowNormalBias=$.normalBias,G.shadowRadius=$.radius,G.shadowMapSize=$.mapSize,n.spotShadow[_]=G,n.spotShadowMap[_]=X,y++}_++}else if(R.isRectAreaLight){const z=e.get(R);z.color.copy(V).multiplyScalar(F),z.halfWidth.set(R.width*.5,0,0),z.halfHeight.set(0,R.height*.5,0),n.rectArea[m]=z,m++}else if(R.isPointLight){const z=e.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),z.distance=R.distance,z.decay=R.decay,R.castShadow){const $=R.shadow,G=t.get(R);G.shadowIntensity=$.intensity,G.shadowBias=$.bias,G.shadowNormalBias=$.normalBias,G.shadowRadius=$.radius,G.shadowMapSize=$.mapSize,G.shadowCameraNear=$.camera.near,G.shadowCameraFar=$.camera.far,n.pointShadow[g]=G,
3775n.pointShadowMap[g]=X,n.pointShadowMatrix[g]=R.shadow.matrix,T++}n.point[g]=z,g++}else if(R.isHemisphereLight){const z=e.get(R);z.skyColor.copy(R.color).multiplyScalar(F),z.groundColor.copy(R.groundColor).multiplyScalar(F),n.hemi[f]=z,f++}}m>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ne.LTC_FLOAT_1,n.rectAreaLTC2=ne.LTC_FLOAT_2):(n.rectAreaLTC1=ne.LTC_HALF_1,n.rectAreaLTC2=ne.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const w=n.hash;(w.directionalLength!==p||w.pointLength!==g||w.spotLength!==_||w.rectAreaLength!==m||w.hemiLength!==f||w.numDirectionalShadows!==b||w.numPointShadows!==T||w.numSpotShadows!==y||w.numSpotMaps!==L||w.numLightProbes!==A)&&(n.directional.length=p,n.spot.length=_,n.rectArea.length=m,n.point.length=g,n.hemi.length=f,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=y+L-P,n.spotLightMap.length=L,n.numSpotLightShadowsWithMaps=P,n.numLightProbes=A,w.directionalLength=p,w.pointLength=g,w.spotLength=_,w.rectAreaLength=m,w.hemiLength=f,w.numDirectionalShadows=b,w.numPointShadows=T,w.numSpotShadows=y,w.numSpotMaps=L,w.numLightProbes=A,n.version=Hg++)}function c(l,h){let u=0,d=0,p=0,g=0,_=0;const m=h.matrixWorldInverse;for(let f=0,b=l.length;f<b;f++){const T=l[f];if(T.isDirectionalLight){const y=n.directional[u];y.direction.setFromMatrixPosition(T.matrixWorld),i.setFromMatrixPosition(T.target.matrixWorld),y.direction.sub(i),y.direction.transformDirection(m),u++}else if(T.isSpotLight){const y=n.spot[p];y.position.setFromMatrixPosition(T.matrixWorld),y.position.applyMatrix4(m),y.direction.setFromMatrixPosition(T.matrixWorld),i.setFromMatrixPosition(T.target.matrixWorld),y.direction.sub(i),y.direction.transformDirection(m),p++}else if(T.isRectAreaLight){const y=n.rectArea[g];y.position.setFromMatrixPosition(T.matrixWorld),y.position.applyMatrix4(m),a.identity(),r.copy(T.matrixWorld),r.premultiply(m),a.extractRotation(r),y.halfWidth.set(T.width*.5,0,0),y.halfHeight.set(0,T.height*.5,0),y.halfWidth.applyMatrix4(a),y.halfHeight.applyMatrix4(a),g++}else if(T.isPointLight){const y=n.point[d];y.position.setFromMatrixPosition(T.matrixWorld),y.position.applyMatrix4(m),d++}else if(T.isHemisphereLight){const y=n.hemi[_];y.direction.setFromMatrixPosition(T.matrixWorld),y.direction.transformDirection(m),_++}}}return{setup:o,setupView:c,state:n}}function Nc(s){const e=new Gg(s),t=[],n=[];function i(h){l.camera=h,t.length=0,n.length=0}function r(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function c(h){e.setupView(t,h)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:l,setupLights:o,setupLightsView:c,pushLight:r,pushShadow:a}}function Wg(s){let e=new WeakMap;function t(i,r=0){const a=e.get(i);let o;return a===void 0?(o=new Nc(s),e.set(i,[o])):r>=a.length?(o=new Nc(s),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Xg=`void main() {
3776	gl_Position = vec4( position, 1.0 );
3777}`,Yg=`uniform sampler2D shadow_pass;
3778uniform vec2 resolution;
3779uniform float radius;
3780#include <packing>
3781void main() {
3782	const float samples = float( VSM_SAMPLES );
3783	float mean = 0.0;
3784	float squared_mean = 0.0;
3785	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3786	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3787	for ( float i = 0.0; i < samples; i ++ ) {
3788		float uvOffset = uvStart + i * uvStride;
3789		#ifdef HORIZONTAL_PASS
3790			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3791			mean += distribution.x;
3792			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3793		#else
3794			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3795			mean += depth;
3796			squared_mean += depth * depth;
3797		#endif
3798	}
3799	mean = mean / samples;
3800	squared_mean = squared_mean / samples;
3801	float std_dev = sqrt( squared_mean - mean * mean );
3802	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3803}`;function qg(s,e,t){let n=new $a;const i=new Ce,r=new Ce,a=new je,o=new Wu({depthPacking:Ch}),c=new Xu,l={},h=t.maxTextureSize,u={[bn]:Ut,[Ut]:bn,[nn]:nn}
3803,d=new zn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ce},radius:{value:4}},vertexShader:Xg,fragmentShader:Yg}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const g=new Jt;g.setAttribute("position",new Ct(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new It(g,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Wc;let f=this.type;this.render=function(P,A,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||P.length===0)return;const S=s.getRenderTarget(),v=s.getActiveCubeFace(),R=s.getActiveMipmapLevel(),V=s.state;V.setBlending(On),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const F=f!==xn&&this.type===xn,O=f===xn&&this.type!==xn;for(let X=0,z=P.length;X<z;X++){const $=P[X],G=$.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",$,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;i.copy(G.mapSize);const te=G.getFrameExtents();if(i.multiply(te),r.copy(G.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/te.x),i.x=r.x*te.x,G.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/te.y),i.y=r.y*te.y,G.mapSize.y=r.y)),G.map===null||F===!0||O===!0){const _e=this.type!==xn?{minFilter:Rt,magFilter:Rt}:{};G.map!==null&&G.map.dispose(),G.map=new ti(i.x,i.y,_e),G.map.texture.name=$.name+".shadowMap",G.camera.updateProjectionMatrix()}s.setRenderTarget(G.map),s.clear();const ie=G.getViewportCount();for(let _e=0;_e<ie;_e++){const Ee=G.getViewport(_e);a.set(r.x*Ee.x,r.y*Ee.y,r.x*Ee.z,r.y*Ee.w),V.viewport(a),G.updateMatrices($,_e),n=G.getFrustum(),y(A,w,G.camera,$,this.type)}G.isPointLightShadow!==!0&&this.type===xn&&b(G,w),G.needsUpdate=!1}f=this.type,m.needsUpdate=!1,s.setRenderTarget(S,v,R)};function b(P,A){const w=e.update(_);d.defines.VSM_SAMPLES!==P.blurSamples&&(d.defines.VSM_SAMPLES=P.blurSamples,p.defines.VSM_SAMPLES=P.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new ti(i.x,i.y)),d.uniforms.shadow_pass.value=P.map.texture,d.uniforms.resolution.value=P.mapSize,d.uniforms.radius.value=P.radius,s.setRenderTarget(P.mapPass),s.clear(),s.renderBufferDirect(A,null,w,d,_,null),p.uniforms.shadow_pass.value=P.mapPass.texture,p.uniforms.resolution.value=P.mapSize,p.uniforms.radius.value=P.radius,s.setRenderTarget(P.map),s.clear(),s.renderBufferDirect(A,null,w,p,_,null)}function T(P,A,w,S){let v=null;const R=w.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(R!==void 0)v=R;else if(v=w.isPointLight===!0?c:o,s.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0){const V=v.uuid,F=A.uuid;let O=l[V];O===void 0&&(O={},l[V]=O);let X=O[F];X===void 0&&(X=v.clone(),O[F]=X,A.addEventListener("dispose",L)),v=X}if(v.visible=A.visible,v.wireframe=A.wireframe,S===xn?v.side=A.shadowSide!==null?A.shadowSide:A.side:v.side=A.shadowSide!==null?A.shadowSide:u[A.side],v.alphaMap=A.alphaMap,v.alphaTest=A.alphaTest,v.map=A.map,v.clipShadows=A.clipShadows,v.clippingPlanes=A.clippingPlanes,v.clipIntersection=A.clipIntersection,v.displacementMap=A.displacementMap,v.displacementScale=A.displacementScale,v.displacementBias=A.displacementBias,v.wireframeLinewidth=A.wireframeLinewidth,v.linewidth=A.linewidth,w.isPointLight===!0&&v.isMeshDistanceMaterial===!0){const V=s.properties.get(v);V.light=w}return v}function y(P,A,w,S,v){if(P.visible===!1)return;if(P.layers.test(A.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&v===xn)&&(!P.frustumCulled||n.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,P.matrixWorld);const F=e.update(P),O=P.material;if(Array.isArray(O)){const X=F.groups;for(let z=0,$=X.length;z<$;z++){const G=X[z],te=O[G.materialIndex];if(te&&te.visible){const ie=T(P,te,S,v);P.onBeforeShadow(s,P,A,w,F,ie,G),s.renderBufferDirect(w,null,F,ie,P,G),P.onAfterShadow(s,P,A,w,F,ie,G)}}}else if(O.visible){const X=T(P,O,S,v);P.onBeforeShadow(s,P,A,w,F,X,null),s.renderBufferDirect(w,null,F,X,P,null),P.onAfterShadow(s,P,A,w,F,X,null)}}const V=P.children;for(let F=0,O=V.length;F<O;F++)y(V[F],A,w,S,v)}function L(P){P.target.removeEventListener("dispose",L);for(const w in l){const S=l[w],v=P.target.uuid;v in S&&(S[v].dispose(),delete S[v])}}}const jg={[Zr]:$r,[Jr]:ta,[Qr]:na,[Ai]:ea,[$r]:Zr,[ta]:Jr,[na]:Qr,[ea]:Ai};function Kg(s,e){function t(){let I=!1;const oe=new je;let W=null;const K=new je(0,0,0,0);return{setMask:function(le){W!==le&&!I&&(s.colorMask(le,le,le,le),W=le)},setLocked:function(le){I=le},setClear:function(le,ce,Le,ot,Mt){Mt===!0&&(le*=ot,ce*=ot,Le*=ot),oe.set(le,ce,Le,ot),K.equals(oe)===!1&&(s.clearColor(le,ce,Le,ot),K.copy(oe))},reset:function(){I=!1,W=null,K.set(-1,0,0,0)}}}function n(){let I=!1,oe=!1,W=null,K=null,le=null;return{setReversed:function(ce){if(oe!==ce){const Le=e.get("EXT_clip_control");ce?Le.clipControlEXT(Le.LOWER_LEFT_EXT,Le.ZERO_TO_ONE_EXT):Le.clipControlEXT(Le.LOWER_LEFT_EXT,Le.NEGATIVE_ONE_TO_ONE_EXT),oe=ce;const ot=le;le=null,this.setClear(ot)}},getReversed:function(){return oe},setTest:function(ce){ce?re(s.DEPTH_TEST):ye(s.DEPTH_TEST)},setMask:function(ce){W!==ce&&!I&&(s.depthMask(ce),W=ce)},setFunc:function(ce){if(oe&&(ce=jg[ce]),K!==ce){switch(ce){case Zr:s.depthFunc(s.NEVER);break;case $r:s.depthFunc(s.ALWAYS);break;case Jr:s.depthFunc(s.LESS);break;case Ai:s.depthFunc(s.LEQUAL);break;case Qr:s.depthFunc(s.EQUAL);break;case ea:s.depthFunc(s.GEQUAL);break;case ta:s.depthFunc(s.GREATER);break;case na:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}K=ce}},setLocked:function(ce){I=ce},setClear:function(ce){le!==ce&&(oe&&(ce=1-ce),s.clearDepth(ce),le=ce)},reset:function(){I=!1,W=null,K=null,le=null,oe=!1}}}function i(){let I=!1,oe=null,W=null,K=null,le=null,ce=null,Le=null,ot=null,Mt=null;return{setTest:function($e){I||($e?re(s.STENCIL_TEST):ye(s.STENCIL_TEST))},setMask:function($e){oe!==$e&&!I&&(s.stencilMask($e),oe=$e)},setFunc:function($e,Wt,un){(W!==$e||K!==Wt||le!==un)&&(s.stencilFunc($e,Wt,un),W=$e,K=Wt,le=un)},setOp:function($e,Wt,un){(ce!==$e||Le!==Wt||ot!==un)&&(s.stencilOp($e,Wt,un),ce=$e,Le=Wt,ot=un)},setLocked:function($e){I=$e},setClear:function($e){Mt!==$e&&(s.clearStencil($e),Mt=$e)},reset:function(){I=!1,oe=null,W=null,K=null,le=null,ce=null,Le=null,ot=null,Mt=null}}}const r=new t,a=new n,o=new i,c=new WeakMap,l=new WeakMap;let h={},u={},d=new WeakMap,p=[],g=null,_=!1,m=null,f=null,b=null,T=null,y=null,L=null,P=null,A=new Pe(0,0,0),w=0,S=!1,v=null,R=null,V=null,F=null,O=null;const X=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let z=!1,$=0;const G=s.getParameter(s.VERSION);G.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(G)[1]),z=$>=1):G.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),z=$>=2);let te=null,ie={};const _e=s.getParameter(s.SCISSOR_BOX),Ee=s.getParameter(s.VIEWPORT),Oe=new je().fromArray(_e),Y=new je().fromArray(Ee);function ee(I,oe,W,K){const le=new Uint8Array(4),ce=s.createTexture();s.bindTexture(I,ce),s.texParameteri(I,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(I,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let Le=0;Le<W;Le++)I===s.TEXTURE_3D||I===s.TEXTURE_2D_ARRAY?s.texImage3D(oe,0,s.RGBA,1,1,K,0,s.RGBA,s.UNSIGNED_BYTE,le):s.texImage2D(oe+Le,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,le);return ce}const me={};me[s.TEXTURE_2D]=ee(s.TEXTURE_2D,s.TEXTURE_2D,1),me[s.TEXTURE_CUBE_MAP]=ee(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),me[s.TEXTURE_2D_ARRAY]=ee(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),me[s.TEXTURE_3D]=ee(s.TEXTURE_3D,s.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),re(s.DEPTH_TEST),a.setFunc(Ai),Ge(!1),ke(vo),re(s.CULL_FACE),C(On);function re(I){h[I]!==!0&&(s.enable(I),h[I]=!0)}function ye(I){h[I]!==!1&&(s.disable(I),h[I]=!1)}function qe(I,oe){return u[I]!==oe?(s.bindFramebuffer(I,oe),u[I]=oe,I===s.DRAW_FRAMEBUFFER&&(u[s.FRAMEBUFFER]=oe),I===s.FRAMEBUFFER&&(u[s.DRAW_FRAMEBUFFER]=oe),!0):!1}function be(I,oe){let W=p,K=!1;if(I){W=d.get(oe),W===void 0&&(W=[],d.set(oe,W));const le=I.textures;if(W.length!==le.length||W[0]!==s.COLOR_ATTACHMENT0){for(let ce=0,Le=le.length;ce<Le;ce++)W[ce]=s.COLOR_ATTACHMENT0+ce;W.length=le.length,K=!0}}else W[0]!==s.BACK&&(W[0]=s.BACK,K=!0);K&&s.drawBuffers(W)}function lt(I){return g!==I?(s.useProgram(I),g=I,!0):!1}const rt={[Zn]:s.FUNC_ADD,[Ql]:s.FUNC_SUBTRACT,[eh]:s.FUNC_REVERSE_SUBTRACT};rt[th]=s.MIN,rt[nh]=s.MAX;const ze={[ih]:s.ZERO,[sh]:s.ONE,[rh]:s.SRC_COLOR,[jr]:s.SRC_ALPHA,[uh]:s.SRC_ALPHA_SATURATE,[lh]:s.DST_COLOR,[oh]:s.DST_ALPHA,[ah]:s.ONE_MINUS_SRC_COLOR,[Kr]:s.ONE_MINUS_SRC_ALPHA,[hh]:s.ONE_MINUS_DST_COLOR,[ch]:s.ONE_MINUS_DST_ALPHA,[dh]:s.CONSTANT_COLOR,[fh]:s.ONE_MINUS_CONSTANT_COLOR,[ph]:s.CONSTANT_ALPHA,[mh]:s.ONE_MINUS_CONSTANT_ALPHA};function C(I,oe,W,K,le,ce,Le,ot,Mt,$e){if(I===On){_===!0&&(ye(s.BLEND),_=!1);return}if(_===!1&&(re(s.BLEND),_=!0),I!==Jl){if(I!==m||$e!==S){if((f!==Zn||y!==
vendor: 7,116 bytes, line 3803
3803Zn)&&(s.blendEquation(s.FUNC_ADD),f=Zn,y=Zn),$e)switch(I){case Ei:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Mo:s.blendFunc(s.ONE,s.ONE);break;case So:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case yo:s.blendFuncSeparate(s.ZERO,s.SRC_COLOR,s.ZERO,s.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}else switch(I){case Ei:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Mo:s.blendFunc(s.SRC_ALPHA,s.ONE);break;case So:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case yo:s.blendFunc(s.ZERO,s.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}b=null,T=null,L=null,P=null,A.set(0,0,0),w=0,m=I,S=$e}return}le=le||oe,ce=ce||W,Le=Le||K,(oe!==f||le!==y)&&(s.blendEquationSeparate(rt[oe],rt[le]),f=oe,y=le),(W!==b||K!==T||ce!==L||Le!==P)&&(s.blendFuncSeparate(ze[W],ze[K],ze[ce],ze[Le]),b=W,T=K,L=ce,P=Le),(ot.equals(A)===!1||Mt!==w)&&(s.blendColor(ot.r,ot.g,ot.b,Mt),A.copy(ot),w=Mt),m=I,S=!1}function Bt(I,oe){I.side===nn?ye(s.CULL_FACE):re(s.CULL_FACE);let W=I.side===Ut;oe&&(W=!W),Ge(W),I.blending===Ei&&I.transparent===!1?C(On):C(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.blendColor,I.blendAlpha,I.premultipliedAlpha),a.setFunc(I.depthFunc),a.setTest(I.depthTest),a.setMask(I.depthWrite),r.setMask(I.colorWrite);const K=I.stencilWrite;o.setTest(K),K&&(o.setMask(I.stencilWriteMask),o.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),o.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass)),it(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),I.alphaToCoverage===!0?re(s.SAMPLE_ALPHA_TO_COVERAGE):ye(s.SAMPLE_ALPHA_TO_COVERAGE)}function Ge(I){v!==I&&(I?s.frontFace(s.CW):s.frontFace(s.CCW),v=I)}function ke(I){I!==Zl?(re(s.CULL_FACE),I!==R&&(I===vo?s.cullFace(s.BACK):I===$l?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):ye(s.CULL_FACE),R=I}function ve(I){I!==V&&(z&&s.lineWidth(I),V=I)}function it(I,oe,W){I?(re(s.POLYGON_OFFSET_FILL),(F!==oe||O!==W)&&(s.polygonOffset(oe,W),F=oe,O=W)):ye(s.POLYGON_OFFSET_FILL)}function xe(I){I?re(s.SCISSOR_TEST):ye(s.SCISSOR_TEST)}function E(I){I===void 0&&(I=s.TEXTURE0+X-1),te!==I&&(s.activeTexture(I),te=I)}function x(I,oe,W){W===void 0&&(te===null?W=s.TEXTURE0+X-1:W=te);let K=ie[W];K===void 0&&(K={type:void 0,texture:void 0},ie[W]=K),(K.type!==I||K.texture!==oe)&&(te!==W&&(s.activeTexture(W),te=W),s.bindTexture(I,oe||me[I]),K.type=I,K.texture=oe)}function B(){const I=ie[te];I!==void 0&&I.type!==void 0&&(s.bindTexture(I.type,null),I.type=void 0,I.texture=void 0)}function j(){try{s.compressedTexImage2D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Z(){try{s.compressedTexImage3D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function q(){try{s.texSubImage2D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function ge(){try{s.texSubImage3D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function ae(){try{s.compressedTexSubImage2D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function ue(){try{s.compressedTexSubImage3D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function We(){try{s.texStorage2D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Q(){try{s.texStorage3D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function de(){try{s.texImage2D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Te(){try{s.texImage3D(...arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function we(I){Oe.equals(I)===!1&&(s.scissor(I.x,I.y,I.z,I.w),Oe.copy(I))}function fe(I){Y.equals(I)===!1&&(s.viewport(I.x,I.y,I.z,I.w),Y.copy(I))}function He(I,oe){let W=l.get(oe);W===void 0&&(W=new WeakMap,l.set(oe,W));let K=W.get(I);K===void 0&&(K=s.getUniformBlockIndex(oe,I.name),W.set(I,K))}function Ue(I,oe){const K=l.get(oe).get(I);c.get(oe)!==K&&(s.uniformBlockBinding(oe,K,I.__bindingPointIndex),c.set(oe,K))}function nt(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),a.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),h={},te=null,ie={},u={},d=new WeakMap,p=[],g=null,_=!1,m=null,f=null,b=null,T=null,y=null,L=null,P=null,A=new Pe(0,0,0),w=0,S=!1,v=null,R=null,V=null,F=null,O=null,Oe.set(0,0,s.canvas.width,s.canvas.height),Y.set(0,0,s.canvas.width,s.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:re,disable:ye,bindFramebuffer:qe,drawBuffers:be,useProgram:lt,setBlending:C,setMaterial:Bt,setFlipSided:Ge,setCullFace:ke,setLineWidth:ve,setPolygonOffset:it,setScissorTest:xe,activeTexture:E,bindTexture:x,unbindTexture:B,compressedTexImage2D:j,compressedTexImage3D:Z,texImage2D:de,texImage3D:Te,updateUBOMapping:He,uniformBlockBinding:Ue,texStorage2D:We,texStorage3D:Q,texSubImage2D:q,texSubImage3D:ge,compressedTexSubImage2D:ae,compressedTexSubImage3D:ue,scissor:we,viewport:fe,reset:nt}}function Zg(s,e,t,n,i,r,a){const o=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),l=new Ce,h=new WeakMap;let u;const d=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(E,x){return p?new OffscreenCanvas(E,x):rs("canvas")}function _(E,x,B){let j=1;const Z=xe(E);if((Z.width>B||Z.height>B)&&(j=B/Math.max(Z.width,Z.height)),j<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){const q=Math.floor(j*Z.width),ge=Math.floor(j*Z.height);u===void 0&&(u=g(q,ge));const ae=x?g(q,ge):u;return ae.width=q,ae.height=ge,ae.getContext("2d").drawImage(E,0,0,q,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+q+"x"+ge+")."),ae}else return"data"in E&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),E;return E}function m(E){return E.generateMipmaps}function f(E){s.generateMipmap(E)}function b(E){return E.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:E.isWebG
3803L3DRenderTarget?s.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function T(E,x,B,j,Z=!1){if(E!==null){if(s[E]!==void 0)return s[E];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let q=x;if(x===s.RED&&(B===s.FLOAT&&(q=s.R32F),B===s.HALF_FLOAT&&(q=s.R16F),B===s.UNSIGNED_BYTE&&(q=s.R8)),x===s.RED_INTEGER&&(B===s.UNSIGNED_BYTE&&(q=s.R8UI),B===s.UNSIGNED_SHORT&&(q=s.R16UI),B===s.UNSIGNED_INT&&(q=s.R32UI),B===s.BYTE&&(q=s.R8I),B===s.SHORT&&(q=s.R16I),B===s.INT&&(q=s.R32I)),x===s.RG&&(B===s.FLOAT&&(q=s.RG32F),B===s.HALF_FLOAT&&(q=s.RG16F),B===s.UNSIGNED_BYTE&&(q=s.RG8)),x===s.RG_INTEGER&&(B===s.UNSIGNED_BYTE&&(q=s.RG8UI),B===s.UNSIGNED_SHORT&&(q=s.RG16UI),B===s.UNSIGNED_INT&&(q=s.RG32UI),B===s.BYTE&&(q=s.RG8I),B===s.SHORT&&(q=s.RG16I),B===s.INT&&(q=s.RG32I)),x===s.RGB_INTEGER&&(B===s.UNSIGNED_BYTE&&(q=s.RGB8UI),B===s.UNSIGNED_SHORT&&(q=s.RGB16UI),B===s.UNSIGNED_INT&&(q=s.RGB32UI),B===s.BYTE&&(q=s.RGB8I),B===s.SHORT&&(q=s.RGB16I),B===s.INT&&(q=s.RGB32I)),x===s.RGBA_INTEGER&&(B===s.UNSIGNED_BYTE&&(q=s.RGBA8UI),B===s.UNSIGNED_SHORT&&(q=s.RGBA16UI),B===s.UNSIGNED_INT&&(q=s.RGBA32UI),B===s.BYTE&&(q=s.RGBA8I),B===s.SHORT&&(q=s.RGBA16I),B===s.INT&&(q=s.RGBA32I)),x===s.RGB&&B===s.UNSIGNED_INT_5_9_9_9_REV&&(q=s.RGB9_E5),x===s.RGBA){const ge=Z?Qs:Ve.getTransfer(j);B===s.FLOAT&&(q=s.RGBA32F),B===s.HALF_FLOAT&&(q=s.RGBA16F),B===s.UNSIGNED_BYTE&&(q=ge===et?s.SRGB8_ALPHA8:s.RGBA8),B===s.UNSIGNED_SHORT_4_4_4_4&&(q=s.RGBA4),B===s.UNSIGNED_SHORT_5_5_5_1&&(q=s.RGB5_A1)}return(q===s.R16F||q===s.R32F||q===s.RG16F||q===s.RG32F||q===s.RGBA16F||q===s.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function y(E,x){let B;return E?x===null||x===ei||x===es?B=s.DEPTH24_STENCIL8:x===Dt?B=s.DEPTH32F_STENCIL8:x===Qi&&(B=s.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):x===null||x===ei||x===es?B=s.DEPTH_COMPONENT24:x===Dt?B=s.DEPTH_COMPONENT32F:x===Qi&&(B=s.DEPTH_COMPONENT16),B}function L(E,x){return m(E)===!0||E.isFramebufferTexture&&E.minFilter!==Rt&&E.minFilter!==ft?Math.log2(Math.max(x.width,x.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?x.mipmaps.length:1}function P(E){const x=E.target;x.removeEventListener("dispose",P),w(x),x.isVideoTexture&&h.delete(x)}function A(E){const x=E.target;x.removeEventListener("dispose",A),v(x)}function w(E){const x=n.get(E);if(x.__webglInit===void 0)return;const B=E.source,j=d.get(B);if(j){const Z=j[x.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&S(E),Object.keys(j).length===0&&d.delete(B)}n.remove(E)}function S(E){const x=n.get(E);s.deleteTexture(x.__webglTexture);const B=E.source,j=d.get(B);delete j[x.__cacheKey],a.memory.textures--}function v(E){const x=n.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),n.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let j=0;j<6;j++){if(Array.isArray(x.__webglFramebuffer[j]))for(let Z=0;Z<x.__webglFramebuffer[j].length;Z++)s.deleteFramebuffer(x.__webglFramebuffer[j][Z]);else s.deleteFramebuffer(x.__webglFramebuffer[j]);x.__webglDepthbuffer&&s.deleteRenderbuffer(x.__webglDepthbuffer[j])}else{if(Array.isArray(x.__webglFramebuffer))for(let j=0;j<x.__webglFramebuffer.length;j++)s.deleteFramebuffer(x.__webglFramebuffer[j]);else s.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer&&s.deleteRenderbuffer(x.__webglDepthbuffer),x.__webglMultisampledFramebuffer&&s.deleteFramebuffer(x.__webglMultisampledFramebuffer),x.__webglColorRenderbuffer)for(let j=0;j<x.__webglColorRenderbuffer.length;j++)x.__webglColorRenderbuffer[j]&&s.deleteRenderbuffer(x.__webglColorRenderbuffer[j]);x.__webglDepthRenderbuffer&&s.deleteRenderbuffer(x.__webglDepthRenderbuffer)}const B=E.textures;for(let j=0,Z=B.length;j<Z;j++){const q=n.get(B[j]);q.__webglTexture&&(s.deleteTexture(q.__webglTexture),a.memory.textures--),n.remove(B[j])}n.remove(E)}let R=0;function V(){R=0}function F(){const E=R;return E>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+i.maxTextures),R+=1,E}function O(E){const x=[];return x.push(E.wrapS),x.push(E.wrapT),x.push(E.wrapR||0),x.push(E.magFilter),x.push(E.minFilter),x.push(E.anisotropy),x.push(E.internalFormat),x.push(E.format),x.push(E.t
3803ype),x.push(E.generateMipmaps),x.push(E.premultiplyAlpha),x.push(E.flipY),x.push(E.unpackAlignment),x.push(E.colorSpace),x.join()}function X(E,x){const B=n.get(E);if(E.isVideoTexture&&ve(E),E.isRenderTargetTexture===!1&&E.version>0&&B.__version!==E.version){const j=E.image;if(j===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(j.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Y(B,E,x);return}}t.bindTexture(s.TEXTURE_2D,B.__webglTexture,s.TEXTURE0+x)}function z(E,x){const B=n.get(E);if(E.version>0&&B.__version!==E.version){Y(B,E,x);return}t.bindTexture(s.TEXTURE_2D_ARRAY,B.__webglTexture,s.TEXTURE0+x)}function $(E,x){const B=n.get(E);if(E.version>0&&B.__version!==E.version){Y(B,E,x);return}t.bindTexture(s.TEXTURE_3D,B.__webglTexture,s.TEXTURE0+x)}function G(E,x){const B=n.get(E);if(E.version>0&&B.__version!==E.version){ee(B,E,x);return}t.bindTexture(s.TEXTURE_CUBE_MAP,B.__webglTexture,s.TEXTURE0+x)}const te={[Ci]:s.REPEAT,[sn]:s.CLAMP_TO_EDGE,[Js]:s.MIRRORED_REPEAT},ie={[Rt]:s.NEAREST,[Kc]:s.NEAREST_MIPMAP_NEAREST,[ji]:s.NEAREST_MIPMAP_LINEAR,[ft]:s.LINEAR,[Gs]:s.LINEAR_MIPMAP_NEAREST,[rn]:s.LINEAR_MIPMAP_LINEAR},_e={[Lh]:s.NEVER,[Oh]:s.ALWAYS,[Dh]:s.LESS,[ol]:s.LEQUAL,[Ih]:s.EQUAL,[Fh]:s.GEQUAL,[Uh]:s.GREATER,[Nh]:s.NOTEQUAL};function Ee(E,x){if(x.type===Dt&&e.has("OES_texture_float_linear")===!1&&(x.magFilter===ft||x.magFilter===Gs||x.magFilter===ji||x.magFilter===rn||x.minFilter===ft||x.minFilter===Gs||x.minFilter===ji||x.minFilter===rn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(E,s.TEXTURE_WRAP_S,te[x.wrapS]),s.texParameteri(E,s.TEXTURE_WRAP_T,te[x.wrapT]),(E===s.TEXTURE_3D||E===s.TEXTURE_2D_ARRAY)&&s.texParameteri(E,s.TEXTURE_WRAP_R,te[x.wrapR]),s.texParameteri(E,s.TEXTURE_MAG_FILTER,ie[x.magFilter]),s.texParameteri(E,s.TEXTURE_MIN_FILTER,ie[x.minFilter]),x.compareFunction&&(s.texParameteri(E,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(E,s.TEXTURE_COMPARE_FUNC,_e[x.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===Rt||x.minFilter!==ji&&x.minFilter!==rn||x.type===Dt&&e.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||n.get(x).__currentAnisotropy){const B=e.get("EXT_texture_filter_anisotropic");s.texParameterf(E,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,i.getMaxAnisotropy())),n.get(x).__currentAnisotropy=x.anisotropy}}}function Oe(E,x){let B=!1;E.__webglInit===void 0&&(E.__webglInit=!0,x.addEventListener("dispose",P));const j=x.source;let Z=d.get(j);Z===void 0&&(Z={},d.set(j,Z));const q=O(x);if(q!==E.__cacheKey){Z[q]===void 0&&(Z[q]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,B=!0),Z[q].usedTimes++;const ge=Z[E.__cacheKey];ge!==void 0&&(Z[E.__cacheKey].usedTimes--,ge.usedTimes===0&&S(x)),E.__cacheKey=q,E.__webglTexture=Z[q].texture}return B}function Y(E,x,B){let j=s.TEXTURE_2D;(x.isDataArrayTexture||x.isCompressedArrayTexture)&&(j=s.TEXTURE_2D_ARRAY),x.isData3DTexture&&(j=s.TEXTURE_3D);const Z=Oe(E,x),q=x.source;t.bindTexture(j,E.__webglTexture,s.TEXTURE0+B);const ge=n.get(q);if(q.version!==ge.__version||Z===!0){t.activeTexture(s.TEXTURE0+B);
vendor: 4,672 bytes, line 3803
3803const ae=Ve.getPrimaries(Ve.workingColorSpace),ue=x.colorSpace===Nn?null:Ve.getPrimaries(x.colorSpace),We=x.colorSpace===Nn||ae===ue?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,x.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,x.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,We);let Q=_(x.image,!1,i.maxTextureSize);Q=it(x,Q);const de=r.convert(x.format,x.colorSpace),Te=r.convert(x.type);let we=T(x.internalFormat,de,Te,x.colorSpace,x.isVideoTexture);Ee(j,x);let fe;const He=x.mipmaps,Ue=x.isVideoTexture!==!0,nt=ge.__version===void 0||Z===!0,I=q.dataReady,oe=L(x,Q);if(x.isDepthTexture)we=y(x.format===ns,x.type),nt&&(Ue?t.texStorage2D(s.TEXTURE_2D,1,we,Q.width,Q.height):t.texImage2D(s.TEXTURE_2D,0,we,Q.width,Q.height,0,de,Te,null));else if(x.isDataTexture)if(He.length>0){Ue&&nt&&t.texStorage2D(s.TEXTURE_2D,oe,we,He[0].width,He[0].height);for(let W=0,K=He.length;W<K;W++)fe=He[W],Ue?I&&t.texSubImage2D(s.TEXTURE_2D,W,0,0,fe.width,fe.height,de,Te,fe.data):t.texImage2D(s.TEXTURE_2D,W,we,fe.width,fe.height,0,de,Te,fe.data);x.generateMipmaps=!1}else Ue?(nt&&t.texStorage2D(s.TEXTURE_2D,oe,we,Q.width,Q.height),I&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,Q.width,Q.height,de,Te,Q.data)):t.texImage2D(s.TEXTURE_2D,0,we,Q.width,Q.height,0,de,Te,Q.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){Ue&&nt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,oe,we,He[0].width,He[0].height,Q.depth);for(let W=0,K=He.length;W<K;W++)if(fe=He[W],x.format!==Gt)if(de!==null)if(Ue){if(I)if(x.layerUpdates.size>0){const le=uc(fe.width,fe.height,x.format,x.type);for(const ce of x.layerUpdates){const Le=fe.data.subarray(ce*le/fe.data.BYTES_PER_ELEMENT,(ce+1)*le/fe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,W,0,0,ce,fe.width,fe.height,1,de,Le)}x.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,W,0,0,0,fe.width,fe.height,Q.depth,de,fe.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,W,we,fe.width,fe.height,Q.depth,0,fe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ue?I&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,W,0,0,0,fe.width,fe.height,Q.depth,de,Te,fe.data):t.texImage3D(s.TEXTURE_2D_ARRAY,W,we,fe.width,fe.height,Q.depth,0,de,Te,fe.data)}else{Ue&&nt&&t.texStorage2D(s.TEXTURE_2D,oe,we,He[0].width,He[0].height);for(let W=0,K=He.length;W<K;W++)fe=He[W],x.format!==Gt?de!==null?Ue?I&&t.compressedTexSubImage2D(s.TEXTURE_2D,W,0,0,fe.width,fe.height,de,fe.data):t.compressedTexImage2D(s.TEXTURE_2D,W,we,fe.width,fe.height,0,fe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ue?I&&t.texSubImage2D(s.TEXTURE_2D,W,0,0,fe.width,fe.height,de,Te,fe.data):t.texImage2D(s.TEXTURE_2D,W,we,fe.width,fe.height,0,de,Te,fe.data)}else if(x.isDataArrayTexture)if(Ue){if(nt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,oe,we,Q.width,Q.height,Q.depth),I)if(x.layerUpdates.size>0){const W=uc(Q.width,Q.height,x.format,x.type);for(const K of x.layerUpdates){const le=Q.data.subarray(K*W/Q.data.BYTES_PER_ELEMENT,(K+1)*W/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,K,Q.width,Q.height,1,de,Te,le)}x.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,de,Te,Q.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,we,Q.width,Q.height,Q.depth,0,de,Te,Q.data);else if(x.isData3DTexture)Ue?(nt&&t.texStorage3D(s.TEXTURE_3D,oe,we,Q.width,Q.height,Q.depth),I&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,de,Te,Q.data)):t.texImage3D(s.TEXTURE_3D,0,we,Q.width,Q.height,Q.depth,0,de,Te,Q.data);else if(x.isFramebufferTexture){if(nt)if(Ue)t.texStorage2D(s.TEXTURE_2D,oe,we,Q.width,Q.height);else{let W=Q.width,K=Q.height;for(let le=0;le<oe;le++)t.texImage2D(s.TEXTURE_2D,le,we,W,K,0,de,Te,null),W>>=1,K>>=1}}else if(He.length>0){if(Ue&&nt){const W=xe(He[0]);t.texStorage2D(s.TEXTURE_2D,oe,we,W.width,W.height)}for(let W=0,K=He.length;W<K;W++)fe=He[W],Ue?I&&t.texSubImage2D(s.TEXTURE_2D,W,0,0,de,Te,fe):t.texImage2D(s.TEXTURE_2D,W,we,de,Te,fe);x.generateMipmaps=!1}else if(Ue){if(nt){const W=xe(Q);t.texStorage2D(s.TEXTURE_2D,oe,we,W.width,W.height)}I&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,de,Te,Q)}else t.texImage2D(s.TEXTURE_2D,0,we,de,Te,Q);m(x)&&f(j),ge.__version=q.version,x.onUpdate&&x.onUpdate(x)}E.__version=x.version}function ee(E,x,B){if(x.image.length!==6)return;const j=Oe(E,x),Z=x.source;t.bindTexture(s.TEXTURE_CUBE_MAP,E.__webglTexture,s.TEXTURE0+B);const q=n.get(Z);if(Z.version!==q.__version||j===!0){t.activeTexture(s.TEXTURE0+B);
3803const ge=Ve.getPrimaries(Ve.workingColorSpace),ae=x.colorSpace===Nn?null:Ve.getPrimaries(x.colorSpace),ue=x.colorSpace===Nn||ge===ae?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,x.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,x.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,ue);const We=x.isCompressedTexture||x.image[0].isCompressedTexture,Q=x.image[0]&&x.image[0].isDataTexture,de=[];for(let K=0;K<6;K++)!We&&!Q?de[K]=_(x.image[K],!0,i.maxCubemapSize):de[K]=Q?x.image[K].image:x.image[K],de[K]=it(x,de[K]);const Te=de[0],we=r.convert(x.format,x.colorSpace),fe=r.convert(x.type),He=T(x.internalFormat,we,fe,x.colorSpace),Ue=x.isVideoTexture!==!0,nt=q.__version===void 0||j===!0,I=Z.dataReady;let oe=L(x,Te);Ee(s.TEXTURE_CUBE_MAP,x);let W;if(We){Ue&&nt&&t.texStorage2D(s.TEXTURE_CUBE_MAP,oe,He,Te.width,Te.height);for(let K=0;K<6;K++){W=de[K].mipmaps;for(let le=0;le<W.length;le++){const ce=W[le];x.format!==Gt?we!==null?Ue?I&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,le,0,0,ce.width,ce.height,we,ce.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,le,He,ce.width,ce.height,0,ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ue?I&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,le,0,0,ce.width,ce.height,we,fe,ce.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,le,He,ce.width,ce.height,0,we,fe,ce.data)}}}else{if(W=x.mipmaps,Ue&&nt){W.length>0&&oe++;const K=xe(de[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,oe,He,K.width,K.height)}for(let K=0;K<6;K++)if(Q){Ue?I&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,de[K].width,de[K].height,we,fe,de[K].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,He,de[K].width,de[K].height,0,we,fe,de[K].data);for(let le=0;le<W.length;le++){const Le=W[le].image[K].image;Ue?I&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,le+1,0,0,Le.width,Le.height,we,fe,Le.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,le+1,He,Le.width,Le.height,0,we,fe,Le.data)}}else{Ue?I&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,we,fe,de[K]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,He,we,fe,de[K]);for(let le=0;le<W.length;le++){const ce=W[le];Ue?I&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,le+1,0,0,we,fe,ce.image[K]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+K,le+1,He,we,fe,ce.image[K])}}}m(x)&&f(s.TEXTURE_CUBE_MAP),q.__version=Z.version,x.onUpdate&&x.onUpdate(x)}E.__version=x.version}function me(E,x,B,j,Z,q){const ge=r.convert(B.format,B.colorSpace),ae=r.convert(B.type),ue=T(B.internalFormat,ge,ae,B.colorSpace),We=n.get(x),Q=n.get(B);if(Q.__renderTarget=x,!We.__hasExternalTextures){const de=Math.max(1,x.width>>q),Te=Math.max(1,x.height>>q);Z===s.TEXTURE_3D||Z===s.TEXTURE_2D_ARRAY?t.texImage3D(Z,q,ue,de,Te,x.depth,0,ge,ae,null):t.texImage2D(Z,q,ue,de,Te,0,ge,ae,null)}t.bindFramebuffer(s.FRAMEBUFFER,E),ke(x)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,j,Z,Q.__webglTexture,0,Ge(x)):(Z===s.TEXTURE_2D||Z>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,j,Z,Q.__webglTexture,q),t.bindFramebuffer(s.FRAMEBUFFER,null)}function re(E,x,B){if(s.bindRenderbuffer(s.RENDERBUFFER,E),x.depthBuffer){const j=x.depthTexture,Z=j&&j.isDepthTexture?j.type:null,q=y(x.stencilBuffer,Z),ge=x.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ae=Ge(x);ke(x)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,ae,q,x.width,x.height):B?s.renderbufferStorageMultisample(s.RENDERBUFFER,ae,q,x.width,x.height):s.renderbufferStorage(s.RENDERBUFFER,q,x.width,x.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,ge,s.RENDERBUFFER,E)}else{const j=x.textures;for(let Z=0;Z<j.length;Z++){const q=j[Z],ge=r.convert(q.format,q.colorSpace),ae=r.convert(q.type),ue=T(q.internalFormat,ge,ae,q.colorSpace),We=Ge(x);B&&ke(x)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,We,ue,x.width,x.height):ke(x)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,We,ue,x.width,x.height):s.renderbufferStorage(s.RENDERBUFFER,ue,x.width,x.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}
3803function ye(E,x){if(x&&x.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(s.FRAMEBUFFER,E),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const j=n.get(x.depthTexture);j.__renderTarget=x,(!j.__webglTexture||x.depthTexture.image.width!==x.width||x.depthTexture.image.height!==x.height)&&(x.depthTexture.image.width=x.width,x.depthTexture.image.height=x.height,x.depthTexture.needsUpdate=!0),X(x.depthTexture,0);const Z=j.__webglTexture,q=Ge(x);if(x.depthTexture.format===ts)ke(x)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,Z,0,q):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,Z,0);else if(x.depthTexture.format===ns)ke(x)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,Z,0,q):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,Z,0);else throw new Error("Unknown depthTexture format")}function qe(E){const x=n.get(E),B=E.isWebGLCubeRenderTarget===!0;if(x.__boundDepthTexture!==E.depthTexture){const j=E.depthTexture;if(x.__depthDisposeCallback&&x.__depthDisposeCallback(),j){const Z=()=>{delete x.__boundDepthTexture,delete x.__depthDisposeCallback,j.removeEventListener("dispose",Z)};j.addEventListener("dispose",Z),x.__depthDisposeCallback=Z}x.__boundDepthTexture=j}if(E.depthTexture&&!x.__autoAllocateDepthBuffer){if(B)throw new Error("target.depthTexture not supported in Cube render targets");ye(x.__webglFramebuffer,E)}else if(B){x.__webglDepthbuffer=[];for(let j=0;j<6;j++)if(t.bindFramebuffer(s.FRAMEBUFFER,x.__webglFramebuffer[j]),x.__webglDepthbuffer[j]===void 0)x.__webglDepthbuffer[j]=s.createRenderbuffer(),re(x.__webglDepthbuffer[j],E,!1);else{const Z=E.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,q=x.__webglDepthbuffer[j];s.bindRenderbuffer(s.RENDERBUFFER,q),s.framebufferRenderbuffer(s.FRAMEBUFFER,Z,s.RENDERBUFFER,q)}}else if(t.bindFramebuffer(s.FRAMEBUFFER,x.__webglFramebuffer),x.__webglDepthbuffer===void 0)x.__webglDepthbuffer=s.createRenderbuffer(),re(x.__webglDepthbuffer,E,!1);else{const j=E.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Z=x.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,Z),s.framebufferRenderbuffer(s.FRAMEBUFFER,j,s.RENDERBUFFER,Z)}t.bindFramebuffer(s.FRAMEBUFFER,null)}function be(E,x,B){const j=n.get(E);x!==void 0&&me(j.__webglFramebuffer,E,E.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),B!==void 0&&qe(E)}function lt(E){const x=E.texture,B=n.get(E),j=n.get(x);E.addEventListener("dispose",A);const Z=E.textures,q=E.isWebGLCubeRenderTarget===!0,ge=Z.length>1;if(ge||(j.__webglTexture===void 0&&(j.__webglTexture=s.createTexture()),j.__version=x.version,a.memory.textures++),q){B.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(x.mipmaps&&x.mipmaps.length>0){B.__webglFramebuffer[ae]=[];for(let ue=0;ue<x.mipmaps.length;ue++)B.__webglFramebuffer[ae][ue]=s.createFramebuffer()}else B.__webglFramebuffer[ae]=s.createFramebuffer()}else{if(x.mipmaps&&x.mipmaps.length>0){B.__webglFramebuffer=[];for(let ae=0;ae<x.mipmaps.length;ae++)B.__webglFramebuffer[ae]=s.createFramebuffer()}else B.__webglFramebuffer=s.createFramebuffer();if(ge)for(let ae=0,ue=Z.length;ae<ue;ae++){const We=n.get(Z[ae]);We.__webglTexture===void 0&&(We.__webglTexture=s.createTexture(),a.memory.textures++)}if(E.samples>0&&ke(E)===!1){B.__webglMultisampledFramebuffer=s.createFramebuffer(),B.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let ae=0;ae<Z.length;ae++){const ue=Z[ae];B.__webglColorRenderbuffer[ae]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,B.__webglColorRenderbuffer[ae]);const We=r.convert(ue.format,ue.colorSpace),Q=r.convert(ue.type),de=T(ue.internalFormat,We,Q,ue.colorSpace,E.isXRRenderTarget===!0),Te=Ge(E);s.renderbufferStorageMultisample(s.RENDERBUFFER,Te,de,E.width,E.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+ae,s.RENDERBUFFER,B.__webglColorRen
vendor: 8,671 bytes, line 3803
3803derbuffer[ae])}s.bindRenderbuffer(s.RENDERBUFFER,null),E.depthBuffer&&(B.__webglDepthRenderbuffer=s.createRenderbuffer(),re(B.__webglDepthRenderbuffer,E,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(q){t.bindTexture(s.TEXTURE_CUBE_MAP,j.__webglTexture),Ee(s.TEXTURE_CUBE_MAP,x);for(let ae=0;ae<6;ae++)if(x.mipmaps&&x.mipmaps.length>0)for(let ue=0;ue<x.mipmaps.length;ue++)me(B.__webglFramebuffer[ae][ue],E,x,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ae,ue);else me(B.__webglFramebuffer[ae],E,x,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);m(x)&&f(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ge){for(let ae=0,ue=Z.length;ae<ue;ae++){const We=Z[ae],Q=n.get(We);t.bindTexture(s.TEXTURE_2D,Q.__webglTexture),Ee(s.TEXTURE_2D,We),me(B.__webglFramebuffer,E,We,s.COLOR_ATTACHMENT0+ae,s.TEXTURE_2D,0),m(We)&&f(s.TEXTURE_2D)}t.unbindTexture()}else{let ae=s.TEXTURE_2D;if((E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(ae=E.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(ae,j.__webglTexture),Ee(ae,x),x.mipmaps&&x.mipmaps.length>0)for(let ue=0;ue<x.mipmaps.length;ue++)me(B.__webglFramebuffer[ue],E,x,s.COLOR_ATTACHMENT0,ae,ue);else me(B.__webglFramebuffer,E,x,s.COLOR_ATTACHMENT0,ae,0);m(x)&&f(ae),t.unbindTexture()}E.depthBuffer&&qe(E)}function rt(E){const x=E.textures;for(let B=0,j=x.length;B<j;B++){const Z=x[B];if(m(Z)){const q=b(E),ge=n.get(Z).__webglTexture;t.bindTexture(q,ge),f(q),t.unbindTexture()}}}const ze=[],C=[];function Bt(E){if(E.samples>0){if(ke(E)===!1){const x=E.textures,B=E.width,j=E.height;let Z=s.COLOR_BUFFER_BIT;const q=E.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ge=n.get(E),ae=x.length>1;if(ae)for(let ue=0;ue<x.length;ue++)t.bindFramebuffer(s.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+ue,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,ge.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+ue,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,ge.__webglMultisampledFramebuffer),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let ue=0;ue<x.length;ue++){if(E.resolveDepthBuffer&&(E.depthBuffer&&(Z|=s.DEPTH_BUFFER_BIT),E.stencilBuffer&&E.resolveStencilBuffer&&(Z|=s.STENCIL_BUFFER_BIT)),ae){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,ge.__webglColorRenderbuffer[ue]);const We=n.get(x[ue]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,We,0)}s.blitFramebuffer(0,0,B,j,0,0,B,j,Z,s.NEAREST),c===!0&&(ze.length=0,C.length=0,ze.push(s.COLOR_ATTACHMENT0+ue),E.depthBuffer&&E.resolveDepthBuffer===!1&&(ze.push(q),C.push(q),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,C)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,ze))}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),ae)for(let ue=0;ue<x.length;ue++){t.bindFramebuffer(s.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+ue,s.RENDERBUFFER,ge.__webglColorRenderbuffer[ue]);const We=n.get(x[ue]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,ge.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+ue,s.TEXTURE_2D,We,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ge.__webglMultisampledFramebuffer)}else if(E.depthBuffer&&E.resolveDepthBuffer===!1&&c){const x=E.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[x])}}}function Ge(E){return Math.min(i.maxSamples,E.samples)}function ke(E){const x=n.get(E);return E.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function ve(E){const x=a.render.frame;h.get(E)!==x&&(h.set(E,x),E.update())}function it(E,x){const B=E.colorSpace,j=E.format,Z=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||B!==Et&&B!==Nn&&(Ve.getTransfer(B)===et?(j!==Gt||Z!==An)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),x}function xe(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(l.width=E.naturalWidth||E.width,l.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(l.width=E.displayWidth,l.height=E.displayHeight):(l.width=E.width,l.height=E.height),l}this.allocateTextureUnit=F,this.resetTextureUnits=V,this.setTexture2D=X,this.setTexture2DArray=z,this.setTexture3D=$,this.setTextureCube=G,this.rebindTextures=be,this.setupRenderTarget=lt,this.updateRenderTargetMipmap=rt,this.updateMultisampleRenderTarget=Bt,this.setupDepthRenderbuffer=qe,this.setupFrameBufferTexture=me,this.useMultisampledRTT=ke}function $g(s,e){function t(n,i=Nn){let r;const a=Ve.getTransfer(i);if(n===An)return s.UNSIGNED_BYTE;if(n===ka)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Ha)return s.UNSIGNED_SHORT_5_5_5_1;if(n===Jc)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===Zc)return s.BYTE;if(n===$c)return s.SHORT;if(n===Qi)return s.UNSIGNED_SHORT;if(n===za)return s.INT;if(n===ei)return s.UNSIGNED_INT;if(n===Dt)return s.FLOAT;if(n===Sn)return s.HALF_FLOAT;if(n===Qc)return s.ALPHA;if(n===el)return s.RGB;if(n===Gt)return s.RGBA;if(n===tl)return s.LUMINANCE;if(n===nl)return s.LUMINANCE_ALPHA;if(n===ts)return s.DEPTH_COMPONENT;if(n===ns)return s.DEPTH_STENCIL;if(n===Va)return s.RED;if(n===Ga)return s.RED_INTEGER;if(n===il)return s.RG;if(n===Wa)return s.RG_INTEGER;if(n===Xa)return s.RGBA_INTEGER;if(n===Ws||n===Xs||n===Ys||n===qs)if(a===et)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Ws)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xs)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ys)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===qs)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Ws)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xs)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ys)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===qs)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===sa||n===ra||n===aa||n===oa)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===sa)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ra)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===aa)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===oa)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ca||n===la||n===ha)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===ca||n===la)return a===et?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ha)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===ua||n===da||n===fa||n===pa||n===ma||n===ga||n===_a||n===xa||n===va||n===Ma||n===Sa||n===ya||n===Ea||n===Ta)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===ua)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===da)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===fa)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===pa)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ma)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ga)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===_a)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===xa)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===va)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ma)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Sa)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ya)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ea)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ta)return a===et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===js||n===ba||n===Aa)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===js)return a===et?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ba)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Aa)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===sl||n===wa||n===Ra||n===Ca)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===js)return r.COMPRESSED_RED_RGT
3803C1_EXT;if(n===wa)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ra)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ca)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===es?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}const Jg=`
3804void main() {
3805
3806	gl_Position = vec4( position, 1.0 );
3807
3808}`,Qg=`
3809uniform sampler2DArray depthColor;
3810uniform float depthWidth;
3811uniform float depthHeight;
3812
3813void main() {
3814
3815	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
3816
3817	if ( coord.x >= 1.0 ) {
3818
3819		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
3820
3821	} else {
3822
3823		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
3824
3825	}
3826
3827}`;class e_{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new pt,r=e.properties.get(i);r.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new zn({vertexShader:Jg,fragmentShader:Qg,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new It(new sr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class t_ extends ni{constructor(e,t){super();const n=this;let i=null,r=1,a=null,o="local-floor",c=1,l=null,h=null,u=null,d=null,p=null,g=null;const _=new e_,m=t.getContextAttributes();let f=null,b=null;const T=[],y=[],L=new Ce;let P=null;const A=new wt;A.viewport=new je;const w=new wt;w.viewport=new je;const S=[A,w],v=new ud;let R=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let ee=T[Y];return ee===void 0&&(ee=new Lr,T[Y]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(Y){let ee=T[Y];return ee===void 0&&(ee=new Lr,T[Y]=ee),ee.getGripSpace()},this.getHand=function(Y){let ee=T[Y];return ee===void 0&&(ee=new Lr,T[Y]=ee),ee.getHandSpace()};function F(Y){const ee=y.indexOf(Y.inputSource);if(ee===-1)return;const me=T[ee];me!==void 0&&(me.update(Y.inputSource,Y.frame,l||a),me.dispatchEvent({type:Y.type,data:Y.inputSource}))}function O(){i.removeEventListener("select",F),i.removeEventListener("selectstart",F),i.removeEventListener("selectend",F),i.removeEventListener("squeeze",F),i.removeEventListener("squeezestart",F),i.removeEventListener("squeezeend",F),i.removeEventListener("end",O),i.removeEventListener("inputsourceschange",X);for(let Y=0;Y<T.length;Y++){const ee=y[Y];ee!==null&&(y[Y]=null,T[Y].disconnect(ee))}R=null,V=null,_.reset(),e.setRenderTarget(f),p=null,d=null,u=null,i=null,b=null,Oe.stop(),n.isPresenting=!1,e.setPixelRatio(P),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){r=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(Y){l=Y},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return u},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(f=e.getRenderTarget(),i.addEventListener("select",F),i.addEventListener("selectstart",F),i.addEventListener("selectend",F),i.addEventListener("squeeze",F),i.addEventListener("squeezestart",F),i.addEventListener("squeezeend",F),i.addEventListener("end",O),i.addEventListener("inputsourceschange",X),m.xrCompatible!==!0&&await t.makeXRCompatible(),P=e.getPixelRatio(),e.getSize(L),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let me=null,re=null,ye=null;m.depth&&(ye=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,me=m.stencil?ns:ts,re=m.stencil?es:ei);const qe={colorFormat:t.RGBA8,depthFormat:ye,scaleFactor:r};u=new XRWebGLBinding(i,t),d=u.createProjectionLayer(qe),i.updateRenderState({layers:[d]}
3827),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),b=new ti(d.textureWidth,d.textureHeight,{format:Gt,type:An,depthTexture:new Sl(d.textureWidth,d.textureHeight,re,void 0,void 0,void 0,void 0,void 0,void 0,me),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const me={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(i,t,me),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),b=new ti(p.framebufferWidth,p.framebufferHeight,{format:Gt,type:An,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await i.requestReferenceSpace(o),Oe.setContext(i),Oe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function X(Y){for(let ee=0;ee<Y.removed.length;ee++){const me=Y.removed[ee],re=y.indexOf(me);re>=0&&(y[re]=null,T[re].disconnect(me))}for(let ee=0;ee<Y.added.length;ee++){const me=Y.added[ee];let re=y.indexOf(me);if(re===-1){for(let qe=0;qe<T.length;qe++)if(qe>=y.length){y.push(me),re=qe;break}else if(y[qe]===null){y[qe]=me,re=qe;break}if(re===-1)break}const ye=T[re];ye&&ye.connect(me)}}const z=new D,$=new D;function G(Y,ee,me){z.setFromMatrixPosition(ee.matrixWorld),$.setFromMatrixPosition(me.matrixWorld);const re=z.distanceTo($),ye=ee.projectionMatrix.elements,qe=me.projectionMatrix.elements,be=ye[14]/(ye[10]-1),lt=ye[14]/(ye[10]+1),rt=(ye[9]+1)/ye[5],ze=(ye[9]-1)/ye[5],C=(ye[8]-1)/ye[0],Bt=(qe[8]+1)/qe[0],Ge=be*C,ke=be*Bt,ve=re/(-C+Bt),it=ve*-C;if(ee.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(it),Y.translateZ(ve),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),ye[10]===-1)Y.projectionMatrix.copy(ee.projectionMatrix),Y.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{const xe=be+ve,E=lt+ve,x=Ge-it,B=ke+(re-it),j=rt*lt/E*xe,Z=ze*lt/E*xe;Y.projectionMatrix.makePerspective(x,B,j,Z,xe,E),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function te(Y,ee){ee===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(ee.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;let ee=Y.near,me=Y.far;_.texture!==null&&(_.depthNear>0&&(ee=_.depthNear),_.depthFar>0&&(me=_.depthFar)),v.near=w.near=A.near=ee,v.far=w.far=A.far=me,(R!==v.near||V!==v.far)&&(i.updateRenderState({depthNear:v.near,depthFar:v.far}),R=v.near,V=v.far),A.layers.mask=Y.layers.mask|2,w.layers.mask=Y.layers.mask|4,v.layers.mask=A.layers.mask|w.layers.mask;const re=Y.parent,ye=v.cameras;te(v,re);for(let qe=0;qe<ye.length;qe++)te(ye[qe],re);ye.length===2?G(v,A,w):v.projectionMatrix.copy(A.projectionMatrix),ie(Y,v,re)};function ie(Y,ee,me){me===null?Y.matrix.copy(ee.matrixWorld):(Y.matrix.copy(me.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(ee.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(ee.projectionMatrix),Y.projectionMatrixInverse.copy(ee.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=Pi*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return v},this.getFoveation=function(){if(!(d===null&&p===null))return c},this.setFoveation=function(Y){c=Y,d!==null&&(d.fixedFoveation=Y),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=Y)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(v)};let _e=null;function Ee(Y,ee){if(h=ee.getViewerPose(l||a),g=ee,h!==null){const me=h.views;p!==null&&(e.setRenderTargetFramebuffer(b,p.framebuffer),e.setRenderTarget(b));let re=!1;me.length!==v.cameras.length&&(v.cameras.length=0,re=!0);for(let be=0;be<me.length;be++){const lt=me[be];let rt=null;if(p!==null)rt=p.getViewport(lt);else{const C=u.getViewSubImage(d,lt);rt=C.viewport,be===0&&(e.setRenderTargetTextures(b,C.colorTexture,C.depthStencilTexture),e.setRenderTarget(b))}let ze=S[be];ze===void 0&&(ze=new wt,ze.layers.enable(be),ze.viewport=new je,S[be]=ze),ze.matrix.fromArray(lt.transform.matrix),ze.matrix.decompose(ze.position,ze.quaternion,ze.scale),ze.projectionMatrix.fromArray(lt.projectionMatrix),ze.projectionMatrixInverse.copy(ze.projectionMatrix).invert(),ze.viewport.set(rt.x,rt.y,rt.width,rt.height),be===0&&(v.matrix.copy(ze.matrix),v.matrix.decompose(v.position,v.quaternion,v.scale)),re===!0&&v.cameras.push(ze)}const ye=i.enabledFeatures;if(ye&&ye.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&u){const be=u.getDepthInformation(me[0]);be&&be.isValid&&be.texture&&_.init(e,be,i.renderState)}}for(let me=0;me<T.length;me++){const re=y[me],ye=T[me];re!==null&&ye!==void 0&&ye.update(re,ee,l||a)}_e&&_e(Y,ee),ee.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ee}),g=null}const Oe=new wl;
vendor: 4,985 bytes, line 3827
3827Oe.setAnimationLoop(Ee),this.setAnimationLoop=function(Y){_e=Y},this.dispose=function(){}}}const qn=new cn,n_=new Ie;function i_(s,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,ml(s)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function i(m,f,b,T,y){f.isMeshBasicMaterial||f.isMeshLambertMaterial?r(m,f):f.isMeshToonMaterial?(r(m,f),u(m,f)):f.isMeshPhongMaterial?(r(m,f),h(m,f)):f.isMeshStandardMaterial?(r(m,f),d(m,f),f.isMeshPhysicalMaterial&&p(m,f,y)):f.isMeshMatcapMaterial?(r(m,f),g(m,f)):f.isMeshDepthMaterial?r(m,f):f.isMeshDistanceMaterial?(r(m,f),_(m,f)):f.isMeshNormalMaterial?r(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?c(m,f,b,T):f.isSpriteMaterial?l(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function r(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===Ut&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===Ut&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const b=e.get(f),T=b.envMap,y=b.envMapRotation;T&&(m.envMap.value=T,qn.copy(y),qn.x*=-1,qn.y*=-1,qn.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(qn.y*=-1,qn.z*=-1),m.envMapRotation.value.setFromMatrix4(n_.makeRotationFromEuler(qn)),m.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function c(m,f,b,T){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*b,m.scale.value=T*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function l(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function u(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function d(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,b){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ut&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.
3827iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,f){f.matcap&&(m.matcap.value=f.matcap)}function _(m,f){const b=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function s_(s,e,t,n){let i={},r={},a=[];const o=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function c(b,T){const y=T.program;n.uniformBlockBinding(b,y)}function l(b,T){let y=i[b.id];y===void 0&&(g(b),y=h(b),i[b.id]=y,b.addEventListener("dispose",m));const L=T.program;n.updateUBOMapping(b,L);const P=e.render.frame;r[b.id]!==P&&(d(b),r[b.id]=P)}function h(b){const T=u();b.__bindingPointIndex=T;const y=s.createBuffer(),L=b.__size,P=b.usage;return s.bindBuffer(s.UNIFORM_BUFFER,y),s.bufferData(s.UNIFORM_BUFFER,L,P),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,T,y),y}function u(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(b){const T=i[b.id],y=b.uniforms,L=b.__cache;s.bindBuffer(s.UNIFORM_BUFFER,T);for(let P=0,A=y.length;P<A;P++){const w=Array.isArray(y[P])?y[P]:[y[P]];for(let S=0,v=w.length;S<v;S++){const R=w[S];if(p(R,P,S,L)===!0){const V=R.__offset,F=Array.isArray(R.value)?R.value:[R.value];let O=0;for(let X=0;X<F.length;X++){const z=F[X],$=_(z);typeof z=="number"||typeof z=="boolean"?(R.__data[0]=z,s.bufferSubData(s.UNIFORM_BUFFER,V+O,R.__data)):z.isMatrix3?(R.__data[0]=z.elements[0],R.__data[1]=z.elements[1],R.__data[2]=z.elements[2],R.__data[3]=0,R.__data[4]=z.elements[3],R.__data[5]=z.elements[4],R.__data[6]=z.elements[5],R.__data[7]=0,R.__data[8]=z.elements[6],R.__data[9]=z.elements[7],R.__data[10]=z.elements[8],R.__data[11]=0):(z.toArray(R.__data,O),O+=$.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,V,R.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function p(b,T,y,L){const P=b.value,A=T+"_"+y;if(L[A]===void 0)return typeof P=="number"||typeof P=="boolean"?L[A]=P:L[A]=P.clone(),!0;{const w=L[A];if(typeof P=="number"||typeof P=="boolean"){if(w!==P)return L[A]=P,!0}else if(w.equals(P)===!1)return w.copy(P),!0}return!1}function g(b){const T=b.uniforms;let y=0;const L=16;for(let A=0,w=T.length;A<w;A++){const S=Array.isArray(T[A])?T[A]:[T[A]];for(let v=0,R=S.length;v<R;v++){const V=S[v],F=Array.isArray(V.value)?V.value:[V.value];for(let O=0,X=F.length;O<X;O++){const z=F[O],$=_(z),G=y%L,te=G%$.boundary,ie=G+te;y+=te,ie!==0&&L-ie<$.storage&&(y+=L-ie),V.__data=new Float32Array($.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=y,y+=$.storage}}}const P=y%L;return P>0&&(y+=L-P),b.__size=y,b.__cache={},this}function _(b){const T={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(T.boundary=4,T.storage=4):b.isVector2?(T.boundary=8,T.storage=8):b.isVector3||b.isColor?(T.boundary=16,T.storage=12):b.isVector4?(T.boundary=16,T.storage=16):b.isMatrix3?(T.boundary=48,T.storage=48):b.isMatrix4?(T.boundary=64,T.storage=64):b.isTexture?c
3827onsole.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),T}function m(b){const T=b.target;T.removeEventListener("dispose",m);const y=a.indexOf(T.__bindingPointIndex);a.splice(y,1),s.deleteBuffer(i[T.id]),delete i[T.id],delete r[T.id]}function f(){for(const b in i)s.deleteBuffer(i[b]);a=[],i={},r={}}return{bind:c,update:l,dispose:f}}class r_{constructor(e={}){const{canvas:t=eu(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const g=new Uint32Array(4),_=new Int32Array(4);let m=null,f=null;const b=[],T=[];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.toneMapping=Bn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let L=!1;this._outputColorSpace=xt;let P=0,A=0,w=null,S=-1,v=null;const R=new je,V=new je;let F=null;const O=new Pe(0);let X=0,z=t.width,$=t.height,G=1,te=null,ie=null;const _e=new je(0,0,z,$),Ee=new je(0,0,z,$);let Oe=!1;const Y=new $a;let ee=!1,me=!1;const re=new Ie,ye=new Ie,qe=new D,be=new je,lt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let rt=!1;function ze(){return w===null?G:1}let C=n;function Bt(M,U){return t.getContext(M,U)}try{const M={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ba}`),t.addEventListener("webglcontextlost",K,!1),t.addEventListener("webglcontextrestored",le,!1),t.addEventListener("webglcontextcreationerror",ce,!1),C===null){const U="webgl2";if(C=Bt(U,M),C===null)throw Bt(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let Ge,ke,ve,it,xe,E,x,B,j,Z,q,ge,ae,ue,We,Q,de,Te,we,fe,He,Ue,nt,I;function oe(){Ge=new mm(C),Ge.init(),Ue=new $g(C,Ge),ke=new cm(C,Ge,e,Ue),ve=new Kg(C,Ge),ke.reverseDepthBuffer&&d&&ve.buffers.depth.setReversed(!0),it=new xm(C),xe=new Fg,E=new Zg(C,Ge,ve,xe,ke,Ue,it),x=new hm(y),B=new pm(y),j=new Ed(C),nt=new am(C,j),Z=new gm(C,j,it,nt),q=new Mm(C,Z,j,it),we=new vm(C,ke,E),Q=new lm(xe),ge=new Ng(y,x,B,Ge,ke,nt,Q),ae=new i_(y,xe),ue=new Bg,We=new Wg(Ge),Te=new rm(y,x,B,ve,q,p,c),de=new qg(y,q,ke),I=new s_(C,it,ke,ve),fe=new om(C,Ge,it),He=new _m(C,Ge,it),it.programs=ge.programs,y.capabilities=ke,y.extensions=Ge,y.properties=xe,y.renderLists=ue,y.shadowMap=de,y.state=ve,y.info=it}oe();const W=new t_(y,C);this.xr=W,this.getContext=function(){return C},this.getContextAttributes=function(){return C.getContextAttributes()},this.forceContextLoss=function(){const M=Ge.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=Ge.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(M){M!==void 0&&(G=M,this.setSize(z,$,!1))},this.getSize=function(M){return M.set(z,$)},this.setSize=function(M,U,k=!0){if(W.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}z=M,$=U,t.width=Math.floor(M*G),t.height=Math.floor(U*G),k===!0&&(t.style.width=M+"px",t.style.height=U+"px"),this.setViewport(0,0,M,U)},this.getDrawingBufferSize=function(M){return M.set(z*G,$*G).floor()},this.setDrawingBufferSize=function(M,U,k){z=M,$=U,G=k,t.width=Math.floor(M*k),t.height=Math.floor(U*k),this.setViewport(0,0,M,U)},this.getCurrentViewport=function(M){return M.copy(R)},this.getViewport=function(M){return M.copy(_e)},this.setViewport=function(M,U,k,H){M.isVector4?_e.set(M.x,M.y,M.z,M.w):_e.set(M,U,k,H),ve.viewport(R.copy(_e).multiplyScalar(G).round())}
3827,this.getScissor=function(M){return M.copy(Ee)},this.setScissor=function(M,U,k,H){M.isVector4?Ee.set(M.x,M.y,M.z,M.w):Ee.set(M,U,k,H),ve.scissor(V.copy(Ee).multiplyScalar(G).round())},this.getScissorTest=function(){return Oe},this.setScissorTest=function(M){ve.setScissorTest(Oe=M)},this.setOpaqueSort=function(M){te=M},this.setTransparentSort=function(M){ie=M},this.getClearColor=function(M){return M.copy(Te.getClearColor())},this.setClearColor=function(){Te.setClearColor(...arguments)},this.getClearAlpha=function(){return Te.getClearAlpha()},this.setClearAlpha=function(){Te.setClearAlpha(...arguments)},this.clear=function(M=!0,U=!0,k=!0){let H=0;if(M){let N=!1;if(w!==null){const J=w.texture.format;N=J===Xa||J===Wa||J===Ga}if(N){const J=w.texture.type,se=J===An||J===ei||J===Qi||J===es||J===ka||J===Ha,he=Te.getClearColor(),pe=Te.getClearAlpha(),Re=he.r,Ae=he.g,Me=he.b;se?(g[0]=Re,g[1]=Ae,g[2]=Me,g[3]=pe,C.clearBufferuiv(C.COLOR,0,g)):(_[0]=Re,_[1]=Ae,_[2]=Me,_[3]=pe,C.clearBufferiv(C.COLOR,0,_))}else H|=C.COLOR_BUFFER_BIT}U&&(H|=C.DEPTH_BUFFER_BIT),k&&(H|=C.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),C.clear(H)},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",K,!1),t.removeEventListener("webglcontextrestored",le,!1),t.removeEventListener("webglcontextcreationerror",ce,!1),Te.dispose(),ue.dispose(),We.dispose(),xe.dispose(),x.dispose(),B.dispose(),q.dispose(),nt.dispose(),I.dispose(),ge.dispose(),W.dispose(),W.removeEventListener("sessionstart",oo),W.removeEventListener("sessionend",co),kn.stop()};function K(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;const M=it.autoReset,U=de.enabled,k=de.autoUpdate,H=de.needsUpdate,N=de.type;oe(),it.autoReset=M,de.enabled=U,de.autoUpdate=k,de.needsUpdate=H,de.type=N}function ce(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function Le(M){const U=M.target;U.removeEventListener("dispose",Le),ot(U)}function ot(M){Mt(M),xe.remove(M)}function Mt(M){const U=xe.get(M).programs;U!==void 0&&(U.forEach(function(k){ge.releaseProgram(k)}),M.isShaderMaterial&&ge.releaseShaderCache(M))}this.renderBufferDirect=function(M,U,k,H,N,J){U===null&&(U=lt);const se=N.isMesh&&N.matrixWorld.determinant()<0,he=Fl(M,U,k,H,N);ve.setMaterial(H,se);let pe=k.index,Re=1;if(H.wireframe===!0){if(pe=Z.getWireframeAttribute(k),pe===void 0)return;Re=2}const Ae=k.drawRange,Me=k.attributes.position;let Xe=Ae.start*Re,Ke=(Ae.start+Ae.count)*Re;J!==null&&(Xe=Math.max(Xe,J.start*Re),Ke=Math.min(Ke,(J.start+J.count)*Re)),pe!==null?(Xe=Math.max(Xe,0),Ke=Math.min(Ke,pe.count)):Me!=null&&(Xe=Math.max(Xe,0),Ke=Math.min(Ke,Me.count));const ht=Ke-Xe;if(ht<0||ht===1/0)return;nt.setup(N,H,he,k,pe);let ct,Ye=fe;if(pe!==null&&(ct=j.get(pe),Ye=He,Ye.setIndex(ct)),N.isMesh)H.wireframe===!0?(ve.setLineWidth(H.wireframeLinewidth*ze()),Ye.setMode(C.LINES)):Ye.setMode(C.TRIANGLES);else if(N.isLine){let Se=H.linewidth;Se===void 0&&(Se=1),ve.setLineWidth(Se*ze()),N.isLineSegments?Ye.setMode(C.LINES):N.isLineLoop?Ye.setMode(C.LINE_LOOP):Ye.setMode(C.LINE_STRIP)}else N.isPoints?Ye.setMode(C.POINTS):N.isSprite&&Ye.setMode(C.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)Ks("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Ye.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if(Ge.get("WEBGL_multi_draw"))Ye.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const Se=N._multiDrawStarts,vt=N._multiDrawCounts,Ze=N._multiDrawCount,Xt=pe?j.get(pe).bytesPerElement:1,si=xe.get(H).currentProgram.getUniforms();for(let Nt=0;Nt<Ze;Nt++)si.setValue(C,"_gl_DrawID",Nt),Ye.render(Se[Nt]/Xt,vt[Nt])}else if(N.isInstancedMesh)Ye.renderInstances(Xe,ht,N.count);else if(k.isInstancedBufferGeometry){const Se=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,vt=Math.min(k.instanceCount,Se);Ye.renderInstances(Xe,ht,vt)}else Ye.render(Xe,ht)};function $e(M,U,k){M.transparent===!0&&M.side===nn&&M.forceSinglePass===!1?(M.side=Ut,M.needsUpdate=!0,hs(M,U,k),M.side=bn,M.needsUpdate=!0,hs(M,U,k),M.side=nn):hs(M,U,k)}this.compile=function(M,U,k=null){k===null&&(k=M),f=We.get(k),f.init(U),T.push(f),k.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(f.pushLight(N),N.castShadow&&f.pushShadow(N))}),M!==k&&M.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(f.pushLight(N),N.castShadow&&f.pushShadow(N))}),f.setupLights();const H=new Set;return M.traverse(function(N){if(!(N.isMesh||N.isPoints||N.isLine||N.isS
3827prite))return;const J=N.material;if(J)if(Array.isArray(J))for(let se=0;se<J.length;se++){const he=J[se];$e(he,k,N),H.add(he)}else $e(J,k,N),H.add(J)}),f=T.pop(),H},this.compileAsync=function(M,U,k=null){const H=this.compile(M,U,k);return new Promise(N=>{function J(){if(H.forEach(function(se){xe.get(se).currentProgram.isReady()&&H.delete(se)}),H.size===0){N(M);return}setTimeout(J,10)}Ge.get("KHR_parallel_shader_compile")!==null?J():setTimeout(J,10)})};let Wt=null;function un(M){Wt&&Wt(M)}function oo(){kn.stop()}function co(){kn.start()}const kn=new wl;kn.setAnimationLoop(un),typeof self<"u"&&kn.setContext(self),this.setAnimationLoop=function(M){Wt=M,W.setAnimationLoop(M),M===null?kn.stop():kn.start()},W.addEventListener("sessionstart",oo),W.addEventListener("sessionend",co),this.render=function(M,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),W.enabled===!0&&W.isPresenting===!0&&(W.cameraAutoUpdate===!0&&W.updateCamera(U),U=W.getCamera()),M.isScene===!0&&M.onBeforeRender(y,M,U,w),f=We.get(M,T.length),f.init(U),T.push(f),ye.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),Y.setFromProjectionMatrix(ye),me=this.localClippingEnabled,ee=Q.init(this.clippingPlanes,me),m=ue.get(M,b.length),m.init(),b.push(m),W.enabled===!0&&W.isPresenting===!0){const J=y.xr.getDepthSensingMesh();J!==null&&or(J,U,-1/0,y.sortObjects)}or(M,U,0,y.sortObjects),m.finish(),y.sortObjects===!0&&m.sort(te,ie),rt=W.enabled===!1||W.isPresenting===!1||W.hasDepthSensing()===!1,rt&&Te.addToRenderList(m,M),this.info.render.frame++,ee===!0&&Q.beginShadows();const k=f.state.shadowsArray;de.render(k,M,U),ee===!0&&Q.endShadows(),this.info.autoReset===!0&&this.info.reset();const H=m.opaque,N=m.transmissive;if(f.setupLights(),U.isArrayCamera){const J=U.cameras;if(N.length>0)for(let se=0,he=J.length;se<he;se++){const pe=J[se];ho(H,N,M,pe)}rt&&Te.render(M);for(let se=0,he=J.length;se<he;se++){const pe=J[se];lo(m,M,pe,pe.viewport)}}else N.length>0&&ho(H,N,M,U),rt&&Te.render(M),lo(m,M,U);w!==null&&A===0&&(E.updateMultisampleRenderTarget(w),E.updateRenderTargetMipmap(w)),M.isScene===!0&&M.onAfterRender(y,M,U),nt.resetDefaultState(),S=-1,v=null,T.pop(),T.length>0?(f=T[T.length-1],ee===!0&&Q.setGlobalState(y.clippingPlanes,f.state.camera)):f=null,b.pop(),b.length>0?m=b[b.length-1]:m=null};function or(M,U,k,H){if(M.visible===!1)return;if(M.layers.test(U.layers)){if(M.isGroup)k=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(U);else if(M.isLight)f.pushLight(M),M.castShadow&&f.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Y.intersectsSprite(M)){H&&be.setFromMatrixPosition(M.matrixWorld).applyMatrix4(ye);const se=q.update(M),he=M.material;he.visible&&m.push(M,se,he,k,be.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Y.intersectsObject(M))){const se=q.update(M),he=M.material;if(H&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),be.copy(M.boundingSphere.center)):(se.boundingSphere===null&&se.computeBoundingSphere(),be.copy(se.boundingSphere.center)),be.applyMatrix4(M.matrixWorld).applyMatrix4(ye)),Array.isArray(he)){const pe=se.groups;for(let Re=0,Ae=pe.length;Re<Ae;Re++){const Me=pe[Re],Xe=he[Me.materialIndex];Xe&&Xe.visible&&m.push(M,se,Xe,k,be.z,Me)}}else he.visible&&m.push(M,se,he,k,be.z,null)}}const J=M.children;for(let se=0,he=J.length;se<he;se++)or(J[se],U,k,H)}function lo(M,U,k,H){const N=M.opaque,J=M.transmissive,se=M.transparent;f.setupLightsView(k),ee===!0&&Q.setGlobalState(y.clippingPlanes,k),H&&ve.viewport(R.copy(H)),N.length>0&&ls(N,U,k),J.length>0&&ls(J,U,k),se.length>0&&ls(se,U,k),ve.buffers.depth.setTest(!0),ve.buffers.depth.setMask(!0),ve.buffers.color.setMask(!0),ve.setPolygonOffset(!1)}function ho(M,U,k,H){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;f.state.transmissionRenderTarget[H.id]===void 0&&(f.state.transmissionRenderTarget[H.id]=new ti(1,1,{generateMipmaps:!0,type:Ge.has("EXT_color_buffer_half_float")||Ge.has("EXT_color_buffer_float")?Sn:An,minFilter:rn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ve.workingColorSpace}));const J=f.state.transmissionRenderTarget[H.id],se=H.viewport||R;J.setSize(se.z*y.transmissionResolutionScale,se.w*y.transmissionResolutionScale);const he=y.getRenderTarget();y.setRenderTarget(J),y.getClearColor(O),X=y.getClearAlpha(),X<1&&y.setClearColor(16777215,.5),y.clear(),rt&&Te.render(k);const pe=y.toneMapping;y.toneMapping=Bn;const Re=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),f.setupLightsView(H),ee===!0&&Q.setGlobalState(y.clippingPlanes,H),ls(M,k,H),E.updateMultisampleRenderTarget(J),E.updateRenderTargetMipmap(J),Ge.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let Me=0,Xe=U.length;Me<Xe;Me++){const Ke=U[Me],ht=Ke.object,ct=Ke.geometry,Ye=Ke.material,Se=Ke.group;if(Ye.side===nn&&ht.layers.test(H.layers)){const vt=Ye.side;Ye.side=Ut,Ye.needsUpdate=!0,uo(ht,k,H,ct,Ye,Se),Ye.side=vt,Ye.needsUpdate=!0,Ae=!0}}Ae===!0&&(E.updateMultisampleRenderTarget(J),E.updateRenderTargetMipmap(J))}y.setRenderTarget(he),y.setClearColor(O,X),Re!==void 0&&(H.viewport=Re),y.toneMapping=pe}function ls(M,U,k){const H=U.isScene===!0?U.overrideMaterial:null;for(let N=0,J=M.length;N<J;N++){const se=M[N],he=se.object,pe=se.geometry,Re=se.group;let Ae=se.material;Ae.allowOverride===!0&&H!==null&&(Ae=H),he.layers.test(k.layers)&&uo(he,U,k,pe,Ae,Re)}}function uo(M,U,k,H,N,J){M.onBeforeRender(y,U,k,H,N,J),M.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),N.onBeforeRender(y,U,k,H,M,J),N.transparent===!0&&N.side===nn&&N.forceSinglePass===!1?(N.side=Ut,N.needsUpdate=!0,y.renderBufferDirect(k,U,H,N,M,J),N.side=bn,N.needsUpdate=!0,y.renderBufferDirect(k,U,H,N,M,J),N.side=nn):y.renderBufferDirect(k,U,H,N,M,J),M.onAfterRender(y,U,k,H,N,J)}function hs(M,U,k){U.isScene!==!0&&(U=lt);const H=xe.get(M),N=f.state.lights,J=f.state.shadowsArray,se=N.state.ver
3827sion,he=ge.getParameters(M,N.state,J,U,k),pe=ge.getProgramCacheKey(he);let Re=H.programs;H.environment=M.isMeshStandardMaterial?U.environment:null,H.fog=U.fog,H.envMap=(M.isMeshStandardMaterial?B:x).get(M.envMap||H.environment),H.envMapRotation=H.environment!==null&&M.envMap===null?U.environmentRotation:M.envMapRotation,Re===void 0&&(M.addEventListener("dispose",Le),Re=new Map,H.programs=Re);let Ae=Re.get(pe);if(Ae!==void 0){if(H.currentProgram===Ae&&H.lightsStateVersion===se)return po(M,he),Ae}else he.uniforms=ge.getUniforms(M),M.onBeforeCompile(he,y),Ae=ge.acquireProgram(he,pe),Re.set(pe,Ae),H.uniforms=he.uniforms;const Me=H.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Me.clippingPlanes=Q.uniform),po(M,he),H.needsLights=Bl(M),H.lightsStateVersion=se,H.needsLights&&(Me.ambientLightColor.value=N.state.ambient,Me.lightProbe.value=N.state.probe,Me.directionalLights.value=N.state.directional,Me.directionalLightShadows.value=N.state.directionalShadow,Me.spotLights.value=N.state.spot,Me.spotLightShadows.value=N.state.spotShadow,Me.rectAreaLights.value=N.state.rectArea,Me.ltc_1.value=N.state.rectAreaLTC1,Me.ltc_2.value=N.state.rectAreaLTC2,Me.pointLights.value=N.state.point,Me.pointLightShadows.value=N.state.pointShadow,Me.hemisphereLights.value=N.state.hemi,Me.directionalShadowMap.value=N.state.directionalShadowMap,Me.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Me.spotShadowMap.value=N.state.spotShadowMap,Me.spotLightMatrix.value=N.state.spotLightMatrix,Me.spotLightMap.value=N.state.spotLightMap,Me.pointShadowMap.value=N.state.pointShadowMap,Me.pointShadowMatrix.value=N.state.pointShadowMatrix),H.currentProgram=Ae,H.uniformsList=null,Ae}function fo(M){if(M.uniformsList===null){const U=M.currentProgram.getUniforms();M.uniformsList=Zs.seqWithValue(U.seq,M.uniforms)}return M.uniformsList}function po(M,U){const k=xe.get(M);k.outputColorSpace=U.outputColorSpace,k.batching=U.batching,k.batchingColor=U.batchingColor,k.instancing=U.instancing,k.instancingColor=U.instancingColor,k.instancingMorph=U.instancingMorph,k.skinning=U.skinning,k.morphTargets=U.morphTargets,k.morphNormals=U.morphNormals,k.morphColors=U.morphColors,k.morphTargetsCount=U.morphTargetsCount,k.numClippingPlanes=U.numClippingPlanes,k.numIntersection=U.numClipIntersection,k.vertexAlphas=U.vertexAlphas,k.vertexTangents=U.vertexTangents,k.toneMapping=U.toneMapping}function Fl(M,U,k,H,N){U.isScene!==!0&&(U=lt),E.resetTextureUnits();const J=U.fog,se=H.isMeshStandardMaterial?U.environment:null,he=w===null?y.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:Et,pe=(H.isMeshStandardMaterial?B:x).get(H.envMap||se),Re=H.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,Ae=!!k.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),Me=!!k.morphAttributes.position,Xe=!!k.morphAttributes.normal,Ke=!!k.morphAttributes.color;let ht=Bn;H.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(ht=y.toneMapping);const ct=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,Ye=ct!==void 0?ct.length:0,Se=xe.get(H),vt=f.state.lights;if(ee===!0&&(me===!0||M!==v)){const Tt=M===v&&H.id===S;Q.setState(H,M,Tt)}let Ze=!1;H.version===Se.__version?(Se.needsLights&&Se.lightsStateVersion!==vt.state.version||Se.outputColorSpace!==he||N.isBatchedMesh&&Se.batching===!1||!N.isBatchedMesh&&Se.batching===!0||N.isBatchedMesh&&Se.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&Se.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&Se.instancing===!1||!N.isInstancedMesh&&Se.instancing===!0||N.isSkinnedMesh&&Se.skinning===!1||!N.isSkinnedMesh&&Se.skinning===!0||N.isInstancedMesh&&Se.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Se.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&Se.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&Se.instancingMorph===!1&&N.morphTexture!==null||Se.envMap!==pe||H.fog===!0&&Se.fog!==J||Se.numClippingPlanes!==void 0&&(Se.numClippingPlanes!==Q.numPlanes||Se.numIntersection!==Q.numIntersection)||Se.vertexAlphas!==Re||Se.vertexTangents!==Ae||Se.morphTargets!==Me||Se.morphNormals!==Xe||Se.morphColors!==Ke||Se.toneMapping!==ht||Se.morphTargetsCount!==Ye)&&(Ze=!0):(Ze=!0,Se.__version=H.version);let Xt=Se.currentProgram;Ze===!0&&(Xt=hs(H,U,N));let si=!1,Nt=!1,Bi=!1;const st=Xt.getUniforms(),zt=Se.uniforms;if(ve.useProgram(Xt.program)&&(si=!0,Nt=!0,Bi=!0),H.id!==S&&(S=H.id,Nt=!0),si||v!==M){ve.buffers.depth.getReversed()?(re.copy(M.projectionMatrix),nu(re),iu(re),st.setValue(C,"projectionMatrix",re)):st.setValue(C,"projectionMatrix",M.projectionMatrix),st.setValue(C,"viewMatrix",M.matrixWorldInverse);const Pt=st.map.cameraPosition;Pt!==void 0&&Pt.setValue(C,qe.setFromMatrixPosition(M.matrixWorld)),ke.logarithmicDepthBuffer&&st.setValue(C,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&st.setValue(C,"isOrthographic",M.isOrthographicCamera===!0),v!==M&&(v=M,Nt=!0,Bi=!0)}if(N.isSkinnedMesh){st.setOptional(C,N,"bindMatrix"),st.setOptional(C,N,"bindMatrixInverse");const Tt=N.skeleton;Tt&&(Tt.boneTexture===null&&Tt.computeBoneTexture(),st.setValue(C,"boneTexture",Tt.boneTexture,E))}N.isBatchedMesh&&(st.setOptional(C,N,"batchingTexture"),st.setValue(C,"batchingTexture",N._matricesTexture,E),st.setOptional(C,N,"batchingIdTexture"),st.setValue(C,"batchingIdTexture",N._indirectTexture,E),st.setOptional(C,N,"batchingColorTexture"),N._colorsTexture!==null&&st.setValue(C,"batchingColorTexture",N._colorsTexture,E));const kt=k.morphAttributes;if((kt.position!==void 0||kt.normal!==void 0||kt.color!==void 0)&&we.update(N,k,Xt),(Nt||Se.receiveShadow!==N.receiveShadow)&&(Se.receiveShadow=N.receiveShadow,st.setValue(C,"receiveShadow",N.receiveShadow)),H.isMeshGouraudMaterial&&H.envMap!==null&&(zt.envMap.value=pe,zt.flipEnvMap.value=pe.isCubeTexture&&pe.isRenderTargetTexture===!1?-1:1),H.isMeshStandardMaterial&&H.envMap===null&&U.environment!==null&&(zt.envMapIntensity.value=U.environmentIntensity),Nt&&(st.setValue(C,"toneMappingExposure",y.toneMappingExposure),Se.needsLights&&Ol(zt,Bi),J&&H.fog===!0&&ae.refreshFogUniforms(zt,J),ae.refreshMaterialUniforms(zt,H,G,$,f.state.transmissionRenderTarget[M.id]),Zs.upload(C,fo(Se),zt,E)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(Zs.upload(C,fo(Se),zt,E),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&st.setValue(C,"center",N.center),st.setValue(C,"modelViewMatrix",N.modelViewMatrix),st.setValue(C,"normalMatrix",N.normalMatrix),st.setValue(C,"modelMatrix",N.matrixWorld),H.isShaderMaterial||H.isRawShaderMaterial){const Tt=H.uniformsGroups;for(let Pt=0,cr=Tt.length;Pt<cr;Pt++){const Hn=Tt[Pt];I.update(Hn,Xt),I.bind(Hn,Xt)}}return Xt}function Ol(M,U){M.ambientLightColor.needsUpdate=U,M.lightProbe.needsUpdate=U,M.directionalLights.needsUpdate=U,M.directionalLightShadows.needsUpdate=U,M.pointLights.needsUpdate=U,M.pointLightShadows.needsUpdate=U,M.spotLights.needsUpdate=U,M.spotLightShadows.needsUpdate=U,M.rectAreaLights.needsUpdate=U,M.hemisphereLights.needsUpdate=U}function Bl(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return A},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(M,U,k){const H=xe.get(M);H.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,H.__autoAllocateDepthBuffer===!1&&(H.__useRenderToTexture=!1),xe.get(M.texture).__webglTexture=U,xe.get(M.depthTexture).__webglTexture=H.__autoAllocateDepthBuffer?void 0:k,H.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,U){const k=xe.get(M);k.__webglFramebuffer=U,k.__useDefaultFramebuffer=U===void 0};const zl=C.createFramebuffer();this.setRenderTarget=function(M,U=0,k=0){w=M,P=U,A=k;let H=!0,N=null,J=!1,se=!1;
3827if(M){const pe=xe.get(M);if(pe.__useDefaultFramebuffer!==void 0)ve.bindFramebuffer(C.FRAMEBUFFER,null),H=!1;else if(pe.__webglFramebuffer===void 0)E.setupRenderTarget(M);else if(pe.__hasExternalTextures)E.rebindTextures(M,xe.get(M.texture).__webglTexture,xe.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Me=M.depthTexture;if(pe.__boundDepthTexture!==Me){if(Me!==null&&xe.has(Me)&&(M.width!==Me.image.width||M.height!==Me.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");E.setupDepthRenderbuffer(M)}}const Re=M.texture;(Re.isData3DTexture||Re.isDataArrayTexture||Re.isCompressedArrayTexture)&&(se=!0);const Ae=xe.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(Ae[U])?N=Ae[U][k]:N=Ae[U],J=!0):M.samples>0&&E.useMultisampledRTT(M)===!1?N=xe.get(M).__webglMultisampledFramebuffer:Array.isArray(Ae)?N=Ae[k]:N=Ae,R.copy(M.viewport),V.copy(M.scissor),F=M.scissorTest}else R.copy(_e).multiplyScalar(G).floor(),V.copy(Ee).multiplyScalar(G).floor(),F=Oe;if(k!==0&&(N=zl),ve.bindFramebuffer(C.FRAMEBUFFER,N)&&H&&ve.drawBuffers(M,N),ve.viewport(R),ve.scissor(V),ve.setScissorTest(F),J){const pe=xe.get(M.texture);C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+U,pe.__webglTexture,k)}else if(se){const pe=xe.get(M.texture),Re=U;C.framebufferTextureLayer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,pe.__webglTexture,k,Re)}else if(M!==null&&k!==0){const pe=xe.get(M.texture);C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,pe.__webglTexture,k)}S=-1},this.readRenderTargetPixels=function(M,U,k,H,N,J,se){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let he=xe.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&se!==void 0&&(he=he[se]),he){ve.bindFramebuffer(C.FRAMEBUFFER,he);try{const pe=M.texture,Re=pe.format,Ae=pe.type;if(!ke.textureFormatReadable(Re)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ke.textureTypeReadable(Ae)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=M.width-H&&k>=0&&k<=M.height-N&&C.readPixels(U,k,H,N,Ue.convert(Re),Ue.convert(Ae),J)}finally{const pe=w!==null?xe.get(w).__webglFramebuffer:null;ve.bindFramebuffer(C.FRAMEBUFFER,pe)}}},this.readRenderTargetPixelsAsync=async function(M,U,k,H,N,J,se){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let he=xe.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&se!==void 0&&(he=he[se]),he)if(U>=0&&U<=M.width-H&&k>=0&&k<=M.height-N){ve.bindFramebuffer(C.FRAMEBUFFER,he);const pe=M.texture,Re=pe.format,Ae=pe.type;if(!ke.textureFormatReadable(Re))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ke.textureTypeReadable(Ae))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Me=C.createBuffer();C.bindBuffer(C.PIXEL_PACK_BUFFER,Me),C.bufferData(C.PIXEL_PACK_BUFFER,J.byteLength,C.STREAM_READ),C.readPixels(U,k,H,N,Ue.convert(Re),Ue.convert(Ae),0);const Xe=w!==null?xe.get(w).__webglFramebuffer:null;ve.bindFramebuffer(C.FRAMEBUFFER,Xe);const Ke=C.fenceSync(C.SYNC_GPU_COMMANDS_COMPLETE,0);return C.flush(),await tu(C,Ke,4),C.bindBuffer(C.PIXEL_PACK_BUFFER,Me),C.getBufferSubData(C.PIXEL_PACK_BUFFER,0,J),C.deleteBuffer(Me),C.deleteSync(Ke),J}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,U=null,k=0){const H=Math.pow(2,-k),N=Math.floor(M.image.width*H),J=Math.floor(M.image.height*H),se=U!==null?U.x:0,he=U!==null?U.y:0;E.setTexture2D(M,0),C.copyTexSubImage2D(C.TEXTURE_2D,k,0,0,se,he,N,J),ve.unbindTexture()};const kl=C.createFramebuffer(),Hl=C.createFramebuffer();this.copyTextureToTexture=function(M,U,k=null,H=null,N=0,J=null){J===null&&(N!==0?(Ks("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),J=N,N=0):J=0);let se,he,pe,Re,Ae,Me,Xe,Ke,ht;const ct=M.isCompressedTexture?M.mipmaps[J]:M.image;if(k!==null)se=k.max.x-k.min.x,he=k.max.y-k.min.y,pe=k.isBox3?k.max.z-k.min.z:1,Re=k.min.x,Ae=k.min.y,Me=k.isBox3?k.min.z:0;
vendor: 4,114 bytes, line 3827
3827else{const kt=Math.pow(2,-N);se=Math.floor(ct.width*kt),he=Math.floor(ct.height*kt),M.isDataArrayTexture?pe=ct.depth:M.isData3DTexture?pe=Math.floor(ct.depth*kt):pe=1,Re=0,Ae=0,Me=0}H!==null?(Xe=H.x,Ke=H.y,ht=H.z):(Xe=0,Ke=0,ht=0);const Ye=Ue.convert(U.format),Se=Ue.convert(U.type);let vt;U.isData3DTexture?(E.setTexture3D(U,0),vt=C.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?(E.setTexture2DArray(U,0),vt=C.TEXTURE_2D_ARRAY):(E.setTexture2D(U,0),vt=C.TEXTURE_2D),C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,U.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,U.unpackAlignment);const Ze=C.getParameter(C.UNPACK_ROW_LENGTH),Xt=C.getParameter(C.UNPACK_IMAGE_HEIGHT),si=C.getParameter(C.UNPACK_SKIP_PIXELS),Nt=C.getParameter(C.UNPACK_SKIP_ROWS),Bi=C.getParameter(C.UNPACK_SKIP_IMAGES);C.pixelStorei(C.UNPACK_ROW_LENGTH,ct.width),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,ct.height),C.pixelStorei(C.UNPACK_SKIP_PIXELS,Re),C.pixelStorei(C.UNPACK_SKIP_ROWS,Ae),C.pixelStorei(C.UNPACK_SKIP_IMAGES,Me);const st=M.isDataArrayTexture||M.isData3DTexture,zt=U.isDataArrayTexture||U.isData3DTexture;if(M.isDepthTexture){const kt=xe.get(M),Tt=xe.get(U),Pt=xe.get(kt.__renderTarget),cr=xe.get(Tt.__renderTarget);ve.bindFramebuffer(C.READ_FRAMEBUFFER,Pt.__webglFramebuffer),ve.bindFramebuffer(C.DRAW_FRAMEBUFFER,cr.__webglFramebuffer);for(let Hn=0;Hn<pe;Hn++)st&&(C.framebufferTextureLayer(C.READ_FRAMEBUFFER,C.COLOR_ATTACHMENT0,xe.get(M).__webglTexture,N,Me+Hn),C.framebufferTextureLayer(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0,xe.get(U).__webglTexture,J,ht+Hn)),C.blitFramebuffer(Re,Ae,se,he,Xe,Ke,se,he,C.DEPTH_BUFFER_BIT,C.NEAREST);ve.bindFramebuffer(C.READ_FRAMEBUFFER,null),ve.bindFramebuffer(C.DRAW_FRAMEBUFFER,null)}else if(N!==0||M.isRenderTargetTexture||xe.has(M)){const kt=xe.get(M),Tt=xe.get(U);ve.bindFramebuffer(C.READ_FRAMEBUFFER,kl),ve.bindFramebuffer(C.DRAW_FRAMEBUFFER,Hl);for(let Pt=0;Pt<pe;Pt++)st?C.framebufferTextureLayer(C.READ_FRAMEBUFFER,C.COLOR_ATTACHMENT0,kt.__webglTexture,N,Me+Pt):C.framebufferTexture2D(C.READ_FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,kt.__webglTexture,N),zt?C.framebufferTextureLayer(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0,Tt.__webglTexture,J,ht+Pt):C.framebufferTexture2D(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,Tt.__webglTexture,J),N!==0?C.blitFramebuffer(Re,Ae,se,he,Xe,Ke,se,he,C.COLOR_BUFFER_BIT,C.NEAREST):zt?C.copyTexSubImage3D(vt,J,Xe,Ke,ht+Pt,Re,Ae,se,he):C.copyTexSubImage2D(vt,J,Xe,Ke,Re,Ae,se,he);ve.bindFramebuffer(C.READ_FRAMEBUFFER,null),ve.bindFramebuffer(C.DRAW_FRAMEBUFFER,null)}else zt?M.isDataTexture||M.isData3DTexture?C.texSubImage3D(vt,J,Xe,Ke,ht,se,he,pe,Ye,Se,ct.data):U.isCompressedArrayTexture?C.compressedTexSubImage3D(vt,J,Xe,Ke,ht,se,he,pe,Ye,ct.data):C.texSubImage3D(vt,J,Xe,Ke,ht,se,he,pe,Ye,Se,ct):M.isDataTexture?C.texSubImage2D(C.TEXTURE_2D,J,Xe,Ke,se,he,Ye,Se,ct.data):M.isCompressedTexture?C.compressedTexSubImage2D(C.TEXTURE_2D,J,Xe,Ke,ct.width,ct.height,Ye,ct.data):C.texSubImage2D(C.TEXTURE_2D,J,Xe,Ke,se,he,Ye,Se,ct);C.pixelStorei(C.UNPACK_ROW_LENGTH,Ze),C.pixelStorei(C.UNPACK_IMAGE_HEIGHT,Xt),C.pixelStorei(C.UNPACK_SKIP_PIXELS,si),C.pixelStorei(C.UNPACK_SKIP_ROWS,Nt),C.pixelStorei(C.UNPACK_SKIP_IMAGES,Bi),J===0&&U.generateMipmaps&&C.generateMipmap(vt),ve.unbindTexture()},this.copyTextureToTexture3D=function(M,U,k=null,H=null,N=0){return Ks('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(M,U,k,H,N)},this.initRenderTarget=function(M){xe.get(M).__webglFramebuffer===void 0&&E.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?E.setTextureCube(M,0):M.isData3DTexture?E.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?E.setTexture2DArray(M,0):E.setTexture2D(M,0),ve.unbindTexture()},this.resetState=function(){P=0,A=0,w=null,ve.reset(),nt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return yn}get outputColorSpace(){return this._outputColorSpace}
3827set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Ve._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ve._getUnpackColorSpace()}}function a_({position:s,color:e=16777215,intensity:t=1,distance:n=0,penumbra:i=0,castShadow:r=!1,shadowBias:a=0}){const o=new bl(e,t,n,Math.PI/5,i);return o.position.set(...s),r&&(o.castShadow=r,o.shadow.bias=a??0,o.shadow.mapSize.set(2048,2048)),o}function o_({position:s,color:e=16777215,intensity:t=1,castShadow:n=!1}){const i=new Al(e,t);return i.position.set(...s),n&&(i.castShadow=n,i.shadow.mapSize.width=4096,i.shadow.mapSize.height=4096,i.shadow.camera.near=.1,i.shadow.camera.far=10,i.shadow.camera.left=-1,i.shadow.camera.right=1,i.shadow.camera.top=1,i.shadow.camera.bottom=-1,i.shadow.bias=-2e-4,i.shadow.normalBias=7e-4),i}function c_({scene:s,shadows:e,directional:t,spot:n}){const i=new Set;return t==null||t.forEach(r=>{const a=o_({castShadow:r.castShadow,...r});s.add(a),i.add(a)}),n==null||n.forEach(r=>{const a=a_({castShadow:r.castShadow,...r});s.add(a),i.add(a)}),{lights:i}}const Fc={type:"change"},ao={type:"start"},Dl={type:"end"},Hs=new as,Oc=new Un,l_=Math.cos(70*cl.DEG2RAD),dt=new D,Lt=2*Math.PI,tt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Wr=1e-6;class h_ extends Sd{constructor(e,t=null){super(e,t),this.state=tt.NONE,this.target=new D,this.cursor=new D,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:yi.ROTATE,MIDDLE:yi.DOLLY,RIGHT:yi.PAN},this.touches={ONE:Mi.ROTATE,TWO:Mi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new D,this._lastQuaternion=new on,this._lastTargetPosition=new D,this._quat=new on().setFromUnitVectors(e.up,new D(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Ua,this._sphericalDelta=new Ua,this._scale=1,this._panOffset=new D,this._rotateStart=new Ce,this._rotateEnd=new Ce,this._rotateDelta=new Ce,this._panStart=new Ce,this._panEnd=new Ce,this._panDelta=new Ce,this._dollyStart=new Ce,this._dollyEnd=new Ce,this._dollyDelta=new Ce,this._dollyDirection=new D,this._mouse=new Ce,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=d_.bind(this),this._onPointerDown=u_.bind(this),this._onPointerUp=f_.bind(this),this._onContextMenu=M_.bind(this),this._onMouseWheel=g_.bind(this),this._onKeyDown=__.bind(this),this._onTouchStart=x_.bind(this),this._onTouchMove=v_.bind(this),this._onMouseDown=p_.bind(this),this._onMouseMove=m_.bind(this),this._interceptControlDown=S_.bind(this),this._interceptControlUp=y_.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Fc),this.update(),this.state=tt.NONE}update(e=null){const t=this.object.position;dt.copy(t).sub(this.target),dt.applyQuaternion(this._quat),this._spherical.setFromVector3(dt),this.autoRotate&&this.state===tt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=Lt:n>Math.PI&&(n-=Lt),i<-Math.PI?i+=Lt:i>Math.PI&&(i-=Lt),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radiu
3827s=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(dt.setFromSpherical(this._spherical),dt.applyQuaternion(this._quatInverse),t.copy(this.target).add(dt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=dt.length();a=this._clampDistance(o*this._scale);const c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),r=!!c}else if(this.object.isOrthographicCamera){const o=new D(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=c!==this.object.zoom;const l=new D(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=dt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(Hs.origin.copy(this.object.position),Hs.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Hs.direction))<l_?this.object.lookAt(this.target):(Oc.setFromNormalAndCoplanarPoint(this.object.up,this.target),Hs.intersectPlane(Oc,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>Wr||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Wr||this._lastTargetPosition.distanceToSquared(this.target)>Wr?(this.dispatchEvent(Fc),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Lt/60*this.autoRotateSpeed*e:Lt/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){dt.setFromMatrixColumn(t,0),dt.multiplyScalar(-e),this._panOffset.add(dt)}_panUp(e,t){this.screenSpacePanning===!0?dt.setFromMatrixColumn(t,1):(dt.setFromMatrixColumn(t,0),dt.crossVectors(this.object.up,dt)),dt.multiplyScalar(e),this._panOffset.add(dt)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;dt.copy(i).sub(this.target);let r=dt.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,r=t-n.top,a=n.width,o=n.height;this._mouse.x=i/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Lt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Lt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateEnd.set(i,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Lt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Lt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Ce,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function u_(s){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(s.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(s)&&(this._addPointer(s),s.pointerType==="touch"?this._onTouchStart(s):this._onMouseDown(s))
3827)}function d_(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchMove(s):this._onMouseMove(s))}function f_(s){switch(this._removePointer(s),this._pointers.length){case 0:this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Dl),this.state=tt.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function p_(s){let e;switch(s.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case yi.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(s),this.state=tt.DOLLY;break;case yi.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=tt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=tt.ROTATE}break;case yi.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=tt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=tt.PAN}break;default:this.state=tt.NONE}this.state!==tt.NONE&&this.dispatchEvent(ao)}function m_(s){switch(this.state){case tt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(s);break;case tt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(s);break;case tt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(s);break}}function g_(s){this.enabled===!1||this.enableZoom===!1||this.state!==tt.NONE||(s.preventDefault(),this.dispatchEvent(ao),this._handleMouseWheel(this._customWheelEvent(s)),this.dispatchEvent(Dl))}function __(s){this.enabled!==!1&&this._handleKeyDown(s)}function x_(s){switch(this._trackPointer(s),this._pointers.length){case 1:switch(this.touches.ONE){case Mi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(s),this.state=tt.TOUCH_ROTATE;break;case Mi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(s),this.state=tt.TOUCH_PAN;break;default:this.state=tt.NONE}break;case 2:switch(this.touches.TWO){case Mi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(s),this.state=tt.TOUCH_DOLLY_PAN;break;case Mi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(s),this.state=tt.TOUCH_DOLLY_ROTATE;break;default:this.state=tt.NONE}break;default:this.state=tt.NONE}this.state!==tt.NONE&&this.dispatchEvent(ao)}function v_(s){switch(this._trackPointer(s),this.state){case tt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(s),this.update();break;case tt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(s),this.update();break;case tt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(s),this.update();break;case tt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(s),this.update();break;default:this.state=tt.NONE}}function M_(s){this.enabled!==!1&&s.preventDefault()}function S_(s){s.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function y_(s){s.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Bc(s,e){if(e===wh)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===Pa||e===rl){let t=s.getIndex();if(t===null){const a=[],o=s.getAttribute("position");if(o!==void 0){for(let c=0;c<o.count;c++)a.push(c);s.setIndex(a),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(e===Pa)for(let a=1;a<=n;a++)i.push(t.getX(0)),i.push(t.getX(a)),i.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(t.getX(a)),i.push(t.getX(a+1)),i.push(t.getX(a+2))):(i.push(t.getX(a+2)),i.push(t.getX(a+1)),i.push(t.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=s.clone();return r.setIndex(i),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}class E_ extends ii{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new R_(t)}),this.register(function(t){return new C_(t)}),this.register(function(t){return new B_(t)}),this.register(function(t){return new z_(t)}),this.register(function(t){return new k_(t)}),this.register(function(t){return new L_(t)}),this.register(function(t){return new D_(t)}),this.register(function(t){return new I_(t)}),this.register(function(t){return new U_(t)}),this.register(function(t){return new w_(t)}),this.register(function(t){return new N_(t)}
3827),this.register(function(t){return new P_(t)}),this.register(function(t){return new O_(t)}),this.register(function(t){return new F_(t)}),this.register(function(t){return new b_(t)}),this.register(function(t){return new H_(t)}),this.register(function(t){return new V_(t)})}load(e,t,n,i){const r=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const l=Ji.extractUrlBase(e);a=Ji.resolveURL(l,this.path)}else a=Ji.extractUrlBase(e);this.manager.itemStart(e);const o=function(l){i?i(l):console.error(l),r.manager.itemError(e),r.manager.itemEnd(e)},c=new Qa(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{r.parse(l,a,function(h){t(h),r.manager.itemEnd(e)},o)}catch(h){o(h)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const a={},o={},c=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===Il){try{a[Be.KHR_BINARY_GLTF]=new G_(e)}catch(u){i&&i(u);return}r=JSON.parse(a[Be.KHR_BINARY_GLTF].content)}else r=JSON.parse(c.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new n0(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[u.name]=u,a[u.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){const u=r.extensionsUsed[h],d=r.extensionsRequired||[];switch(u){case Be.KHR_MATERIALS_UNLIT:a[u]=new A_;break;case Be.KHR_DRACO_MESH_COMPRESSION:a[u]=new W_(r,this.dracoLoader);break;case Be.KHR_TEXTURE_TRANSFORM:a[u]=new X_;break;case Be.KHR_MESH_QUANTIZATION:a[u]=new Y_;break;default:d.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function T_(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const Be={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class b_{constructor(e){this.parser=e,this.name=Be.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let l;
3827const h=new Pe(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],Et);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new Al(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new cd(h),l.distance=u;break;case"spot":l=new bl(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),vn(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,r=n.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(c){return n._getNodeRef(t.cache,o,c)})}}class A_{constructor(){this.name=Be.KHR_MATERIALS_UNLIT}getMaterialType(){return Jn}extendParams(e,t,n){const i=[];e.color=new Pe(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const a=r.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Et),e.opacity=a[3]}r.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",r.baseColorTexture,xt))}return Promise.all(i)}}class w_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class R_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Ce(o,o)}return Promise.all(r)}}class C_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return t.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class P_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class L_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new Pe(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],Et)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,xt)),a.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class D_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class I_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new Pe().setRGB(o[0],o[1],o[2],Et),Promise.all(r)}}class U_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];
3827return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class N_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new Pe().setRGB(o[0],o[1],o[2],Et),a.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,xt)),Promise.all(r)}}class F_{constructor(e){this.parser=e,this.name=Be.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class O_{constructor(e){this.parser=e,this.name=Be.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Qt}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class B_{constructor(e){this.parser=e,this.name=Be.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class z_{constructor(e){this.parser=e,this.name=Be.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(e,a.source,c);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class k_{constructor(e){this.parser=e,this.name=Be.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return n.loadTextureImage(e,a.source,c);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdj
3827FDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class H_{constructor(e){this.name=Be.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(o){const c=i.byteOffset||0,l=i.byteLength||0,h=i.count,u=i.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,d,i.mode,i.filter).then(function(p){return p.buffer}):a.ready.then(function(){const p=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(p),h,u,d,i.mode,i.filter),p})})}else return null}}class V_{constructor(e){this.name=Be.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const l of i.primitives)if(l.mode!==Vt.TRIANGLES&&l.mode!==Vt.TRIANGLE_STRIP&&l.mode!==Vt.TRIANGLE_FAN&&l.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],c={};for(const l in a)o.push(this.parser.getDependency("accessor",a[l]).then(h=>(c[l]=h,c[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{const h=l.pop(),u=h.isGroup?h.children:[h],d=l[0].count,p=[];for(const g of u){const _=new Ie,m=new D,f=new on,b=new D(1,1,1),T=new Ou(g.geometry,g.material,d);for(let y=0;y<d;y++)c.TRANSLATION&&m.fromBufferAttribute(c.TRANSLATION,y),c.ROTATION&&f.fromBufferAttribute(c.ROTATION,y),c.SCALE&&b.fromBufferAttribute(c.SCALE,y),T.setMatrixAt(y,_.compose(m,f,b));for(const y in c)if(y==="_COLOR_0"){const L=c[y];T.instanceColor=new Da(L.array,L.itemSize,L.normalized)}else y!=="TRANSLATION"&&y!=="ROTATION"&&y!=="SCALE"&&g.geometry.setAttribute(y,c[y]);at.prototype.copy.call(T,g),this.parser.assignFinalMaterial(T),p.push(T)}return h.isGroup?(h.clear(),h.add(...p),h):p[0]}))}}const Il="glTF",qi=12,zc={JSON:1313821514,BIN:5130562};class G_{constructor(e){this.name=Be.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,qi),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Il)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-qi,r=new DataView(e,qi);let a=0;for(;a<i;){const o=r.getUint32(a,!0);a+=4;const c=r.getUint32(a,!0);if(a+=4,c===zc.JSON){const l=new Uint8Array(e,qi+a,o);this.content=n.decode(l)}else if(c===zc.BIN){const l=qi+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class W_{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Be.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},c={},l={};for(const h in a){const u=Fa[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=Fa[h]||h.toLowerCase();if(a[h]!==void 0){const d=n.accessors[e.attributes[h]],p=bi[d.componentType];l[u]=p.name,c[u]=d.normalized===!0}}return t.getDependency("bufferView",r).then(function(h){return new Promise(function(u,d){i.decodeDracoFile(h,function(p){for(const g in p.attributes){const _=p.attributes[g],m=c[g];m!==void 0&&(_.normalized=m)}u(p)},o,l,Et,d)})})}}class X_{constructor(){this.name=Be.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Y_{constructor(){this.name=Be.KHR_MESH_QUANTIZATION}}class Ul extends cs{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[r+a];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=o*2,l=o*3,h=i-t,u=(n-t)/h,d=u*u,p=d*u,g=e*l,_=g-l,m=-2*p+3*d,f=p-d,b=1-m,T=f-d+u;for(let y=0;y!==o;y++){const L=a[_+y+o],P=a[_+y+c]*h,A=a[g+y+o],w=a[g+y]*h;r[y]=b*L+T*P+m*A+f*w}return r}}const q_=new on;class j_ extends Ul{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return q_.fromArray(r).normalize().toArray(r),r}}const Vt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},bi={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},kc={9728:Rt,9729:ft,9984:Kc,9985:Gs,9986:ji,9987:rn},Hc={33071:sn,33648:Js,10497:Ci},Xr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Fa={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},In={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},K_={CUBICSPLINE:void 0,LINEAR:ss,STEP:is},Yr={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Z_(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new rr({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:bn})),s.DefaultMaterial}function jn(s,e,t){for(const n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function vn(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function $_(s,e,t){let n=!1,i=!1,r=!1;for(let l=0,h=e.length;l<h;l++){const u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(r=!0),n&&i&&r)break}if(!n&&!i&&!r)return Promise.resolve(s);const a=[],o=[],c=[];for(let l=0,h=e.length;l<h;l++){const u=e[l];if(n){const d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):s.attributes.position;a.push(d)}if(i){const d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):s.attributes.normal;o.push(d)}if(r){const d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):s.attributes.color;c.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then(function(l){const h=l[0],u=l[1],d=l[2];return n&&(s.morphAttributes.position=h),i&&(s.morphAttributes.normal=u),r&&(s.morphAttributes.color=d
3827),s.morphTargetsRelative=!0,s})}function J_(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Q_(s){let e;const t=s.extensions&&s.extensions[Be.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+qr(t.attributes):e=s.indices+":"+qr(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+qr(s.targets[n]);return e}function qr(s){let e="";const t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function Oa(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function e0(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":s.search(/\.ktx2($|\?)/i)>0||s.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const t0=new Ie;class n0{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new T_,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const c=o.match(/Version\/(\d+)/);i=n&&c?parseInt(c[1],10):-1,r=o.indexOf("Firefox")>-1,a=r?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||r&&a<98?this.textureLoader=new Tl(this.options.manager):this.textureLoader=new hd(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Qa(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return jn(r,o,i),vn(o,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)}
3827)).then(function(){for(const c of o.scenes)c.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){const a=t[i].joints;for(let o=0,c=a.length;o<c;o++)e[a[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){const a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(a,o)=>{const c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(const[l,h]of a.children.entries())r(h,o.children[l])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Be.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(r,a){n.load(Ji.resolveURL(t.uri,i.path),r,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const a=Xr[i.type],o=bi[i.componentType],c=i.normalized===!0,l=new o(i.count*a);return Promise.resolve(new Ct(l,a,c))}const r=[];return i.bufferView!==void 0?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),i.sparse!==void 0&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(a){const o=a[0],c=Xr[i.type],l=bi[i.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,d=i.byteOffset||0,p=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,g=i.normalized===!0;let _,m;if(p&&p!==u){const f=Math.floor(d/p),b="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count;let T=t.cache.get(b);T||(_=new l(o,f*p,i.count*p/h),T=new Du(_,p/h),t.cache.add(b,T)),m=new ja(T,c,d%p/h,g)}else o===null?_=new l(i.count*c):_=new l(o,d,i.count*c),m=new Ct(_,c,g);if(i.sparse!==void 0){const f=Xr.SCALAR,b=bi[i.sparse.indices.componentType],T=i.sparse.indices.byteOffset||0,y=i.sparse.values.byteOffset||0,L=new b(a[1],T,i.sparse.count*f),P=new l(a[2],y,i.sparse.count*c);
3827o!==null&&(m=new Ct(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let A=0,w=L.length;A<w;A++){const S=L[A];if(m.setX(S,P[A*c]),c>=2&&m.setY(S,P[A*c+1]),c>=3&&m.setZ(S,P[A*c+2]),c>=4&&m.setW(S,P[A*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,a=t.images[r];let o=this.textureLoader;if(a.uri){const c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],o=r.images[t],c=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=a.name||o.name||"",h.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(h.name=o.uri);const d=(r.samplers||{})[a.sampler]||{};return h.magFilter=kc[d.magFilter]||ft,h.minFilter=kc[d.minFilter]||rn,h.wrapS=Hc[d.wrapS]||Ci,h.wrapT=Hc[d.wrapT]||Ci,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==Rt&&h.minFilter!==ft,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=i.images[e],o=self.URL||self.webkitURL;let c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(u){l=!0;const d=new Blob([u],{type:a.mimeType});return c=o.createObjectURL(d),c});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(c).then(function(u){return new Promise(function(d,p){let g=d;t.isImageBitmapLoader===!0&&(g=function(_){const m=new pt(_);m.needsUpdate=!0,d(m)}),t.load(Ji.resolveURL(u,r.path),g,void 0,p)})}).then(function(u){return l===!0&&o.revokeObjectURL(c),vn(u,a),u.userData.mimeType=a.mimeType||e0(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),r.extensions[Be.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[Be.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const c=r.associations.get(a);a=r.extensions[Be.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,c)}}
3827return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new Ml,an.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(o,c)),n=c}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new vl,an.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(i||r||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),r&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let c=this.cache.get(o);c||(c=n.clone(),r&&(c.vertexColors=!0),a&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(o,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return rr}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const o={},c=r.extensions||{},l=[];if(c[Be.KHR_MATERIALS_UNLIT]){const u=i[Be.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),l.push(u.extendParams(o,r,t))}else{const u=r.pbrMetallicRoughness||{};if(o.color=new Pe(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],Et),o.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",u.baseColorTexture,xt)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}r.doubleSided===!0&&(o.side=nn);const h=r.alphaMode||Yr.OPAQUE;if(h===Yr.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Yr.MASK&&(o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&a!==Jn&&(l.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Ce(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;o.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&a!==Jn&&(l.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&a!==Jn){const u=r.emissiveFactor;o.emissive=new Pe().setRGB(u[0],u[1],u[2],Et)}return r.emissiveTexture!==void 0&&a!==Jn&&l.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,xt)),Promise.all(l).then(function(){const u=new a(o);return r.name&&(u.name=r.name),vn(u,r),t.associations.set(u,{materials:e}),r.extensions&&jn(i,u,r),u})}createUniqueName(e){const t=Qe.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[Be.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return Vc(c,o,t)})}const a=[];for(let o=0,c=e.length;o<c;o++){const l=e[o],h=Q_(l),u=i[h];if(u)a.push(u.promise);else{let d;l.extensions&&l.extensions[Be.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=Vc(new Jt,l,t),i[h]={primitive:l,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let c=0,l=a.length;c<l;c++){const h=a[c].material===void 0?Z_(this.cache):this.getDependency("material",a[c].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(c){const l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let p=0,g=h.length;p<g;p++){const _=h[p],m=a[p];let f;const b=l[p];if(m.mode===Vt.TRIANGLES||m.mode===Vt.TRIANGLE_STRIP||m.mode===Vt.TRIANGLE_FAN||m.mode===void 0)f=r.isSkinnedMesh===!0?new Uu(_,b):new It(_,b),f.isSkinnedMesh===!0&&f.normalizeSkinWeights(),m.mode===Vt.TRIANGLE_STRIP?f.geometry=Bc(f.geometry,rl):m.mode===Vt.TRIANGLE_FAN&&(f.geometry=Bc(f.geometry,Pa));else if(m.mode===Vt.LINES)f=new ku(_,b);else if(m.mode===Vt.LINE_STRIP)f=new Ja(_,b);else if(m.mode===Vt.LINE_LOOP)f=new Hu(_,b);else if(m.mode===Vt.POINTS)f=new Vu(_,b);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(f.geometry.morphAttributes).length>0&&J_(f,r),f.name=t.createUniqueName(r.name||"mesh_"+e),vn(f,r),m.extensions&&jn(i,f,m),t.assignFinalMaterial(f),u.push(f)}for(let p=0,g=u.length;p<g;p++)t.associations.set(u[p],{meshes:e,primitives:p});if(u.length===1)return r.extensions&&jn(i,u[0],r),u[0];const d=new Qn;r.extensions&&jn(i,d,r),t.associations.set(d,{meshes:e});for(let p=0,g=u.length;p<g;p++)d.add(u[p]);return d})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new wt(cl.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new no(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),vn(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const r=i.pop(),a=i,o=[],c=[];for(let l=0,h=a.length;l<h;l++){const u=a[l];if(u){o.push(u);const d=new Ie;r!==null&&d.fromArray(r.array,l*16),c.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new Za(o,c)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],o=[],c=[],l=[],h=[];for(let u=0,d=i.channels.length;u<d;u++){const p=i.channels[u],g=i.samplers[p.sampler],_=p.target,m=_.node,f=i.parameters!==void 0?i.parameters[g.input]:g.input,b=i.parameters!==void 0?i.parameters[g.output]:g.output;_.node!==void 0&&(a.push(this.getDependency("node",m)),o.push(this.getDependency("accessor",f)),c.push(this.getDependency("accessor",b)),l.push(g),h.push(_))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){const d=u[0],p=u[1],g=u[2],_=u[3],m=u[4],f=[];for(let b=0,T=d.length;b<T;b++){const y=d[b],L=p[b],P=g[b],A=_[b],w=m[b];if(y===void 0)continue;y.updateMatrix&&y.updateMatrix();const S=n._createAnimationTracks(y,L,P,A,w);if(S)for(let v=0;v<S.length;v++)f.push(S[v])}return new Ju(r,void 0,f)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(r){const a=n._getNodeRef(n.meshCache,i.mesh,r);
3827return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let c=0,l=i.weights.length;c<l;c++)o.morphTargetInfluences[c]=i.weights[c]}),a})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),a=[],o=i.children||[];for(let l=0,h=o.length;l<h;l++)a.push(n.getDependency("node",o[l]));const c=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(a),c]).then(function(l){const h=l[0],u=l[1],d=l[2];d!==null&&h.traverse(function(p){p.isSkinnedMesh&&p.bind(d,t0)});for(let p=0,g=u.length;p<g;p++)h.add(u[p]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",o=[],c=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&o.push(c),r.camera!==void 0&&o.push(i.getDependency("camera",r.camera).then(function(l){return i._getNodeRef(i.cameraCache,r.camera,l)})),i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){o.push(l)}),this.nodeCache[e]=Promise.all(o).then(function(l){let h;if(r.isBone===!0?h=new xl:l.length>1?h=new Qn:l.length===1?h=l[0]:h=new at,h!==l[0])for(let u=0,d=l.length;u<d;u++)h.add(l[u]);if(r.name&&(h.userData.name=r.name,h.name=a),vn(h,r),r.extensions&&jn(n,h,r),r.matrix!==void 0){const u=new Ie;u.fromArray(r.matrix),h.applyMatrix4(u)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);return i.associations.has(h)||i.associations.set(h,{}),i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Qn;n.name&&(r.name=i.createUniqueName(n.name)),vn(r,n),n.extensions&&jn(t,r,n);const a=n.nodes||[],o=[];for(let c=0,l=a.length;c<l;c++)o.push(i.getDependency("node",a[c]));return Promise.all(o).then(function(c){for(let h=0,u=c.length;h<u;h++)r.add(c[h]);const l=h=>{const u=new Map;for(const[d,p]of i.associations)(d instanceof an||d instanceof pt)&&u.set(d,p);return h.traverse(d=>{const p=i.associations.get(d);p!=null&&u.set(d,p)}),u};return i.associations=l(r),r})}_createAnimationTracks(e,t,n,i,r){const a=[],o=e.name?e.name:e.uuid,c=[];In[r.path]===In.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(o);let l;switch(In[r.path]){case In.weights:l=Di;break;case In.rotation:l=Ii;break;case In.translation:case In.scale:l=Ui;break;default:switch(n.itemSize){case 1:l=Di;break;case 2:case 3:default:l=Ui;break}break}const h=i.interpolation!==void 0?K_[i.interpolation]:ss,u=this._getArrayFromAccessor(n);for(let d=0,p=c.length;d<p;d++){const g=new l(c[d]+"."+In[r.path],t.array,u,h);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),a.push(g)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Oa(t.constructor),i=new Float32Array(t.length);for(let r=0,a=t.length;r<a;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof Ii?j_:Ul;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function i0(s,e,t){const n=e.attributes,i=new ln;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],c=o.min,l=o.max;if(c!==void 0&&l!==void 0){if(i.set(new D(c[0],c[1],c[2]),new D(l[0],l[1],l[2])),o.normalized){const h=Oa(bi[o.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const o=new D,c=new D;for(let l=0,h=r.length;l<h;l++){const u=r[l];if(u.POSITION!==void 0){const d=t.json.accessors[u.POSITION],p=d.min,g=d.max;if(p!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(g[2]))),d.normalized){const _=Oa(bi[d.componentType]);c.multiplyScalar(_)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}
3827i.expandByVector(o)}s.boundingBox=i;const a=new hn;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=a}function Vc(s,e,t){const n=e.attributes,i=[];function r(a,o){return t.getDependency("accessor",a).then(function(c){s.setAttribute(o,c)})}for(const a in n){const o=Fa[a]||a.toLowerCase();o in s.attributes||i.push(r(n[a],o))}if(e.indices!==void 0&&!s.index){const a=t.getDependency("accessor",e.indices).then(function(o){s.setIndex(o)});i.push(a)}return Ve.workingColorSpace!==Et&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ve.workingColorSpace}" not supported.`),vn(s,e),i0(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?$_(s,e.targets,t):s})}class s0 extends rd{constructor(e){super(e),this.type=Sn}parse(e){const a=function(w,S){switch(w){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(S||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(S||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(S||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(S||""))}},u=function(w,S,v){S=S||1024;let V=w.pos,F=-1,O=0,X="",z=String.fromCharCode.apply(null,new Uint16Array(w.subarray(V,V+128)));for(;0>(F=z.indexOf(`
3828`))&&O<S&&V<w.byteLength;)X+=z,O+=z.length,V+=128,z+=String.fromCharCode.apply(null,new Uint16Array(w.subarray(V,V+128)));return-1<F?(w.pos+=O+F+1,X+z.slice(0,F)):!1},d=function(w){const S=/^#\?(\S+)/,v=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,R=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,V=/^\s*FORMAT=(\S+)\s*$/,F=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,O={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let X,z;for((w.pos>=w.byteLength||!(X=u(w)))&&a(1,"no header found"),(z=X.match(S))||a(3,"bad initial token"),O.valid|=1,O.programtype=z[1],O.string+=X+`
3829`;X=u(w),X!==!1;){if(O.string+=X+`
3830`,X.charAt(0)==="#"){O.comments+=X+`
3831`;continue}if((z=X.match(v))&&(O.gamma=parseFloat(z[1])),(z=X.match(R))&&(O.exposure=parseFloat(z[1])),(z=X.match(V))&&(O.valid|=2,O.format=z[1]),(z=X.match(F))&&
3831(O.valid|=4,O.height=parseInt(z[1],10),O.width=parseInt(z[2],10)),O.valid&2&&O.valid&4)break}return O.valid&2||a(3,"missing format specifier"),O.valid&4||a(3,"missing image size specifier"),O},p=function(w,S,v){const R=S;if(R<8||R>32767||w[0]!==2||w[1]!==2||w[2]&128)return new Uint8Array(w);R!==(w[2]<<8|w[3])&&a(3,"wrong scanline width");const V=new Uint8Array(4*S*v);V.length||a(4,"unable to allocate buffer space");let F=0,O=0;const X=4*R,z=new Uint8Array(4),$=new Uint8Array(X);let G=v;for(;G>0&&O<w.byteLength;){O+4>w.byteLength&&a(1),z[0]=w[O++],z[1]=w[O++],z[2]=w[O++],z[3]=w[O++],(z[0]!=2||z[1]!=2||(z[2]<<8|z[3])!=R)&&a(3,"bad rgbe scanline format");let te=0,ie;for(;te<X&&O<w.byteLength;){ie=w[O++];const Ee=ie>128;if(Ee&&(ie-=128),(ie===0||te+ie>X)&&a(3,"bad scanline data"),Ee){const Oe=w[O++];for(let Y=0;Y<ie;Y++)$[te++]=Oe}else $.set(w.subarray(O,O+ie),te),te+=ie,O+=ie}const _e=R;for(let Ee=0;Ee<_e;Ee++){let Oe=0;V[F]=$[Ee+Oe],Oe+=R,V[F+1]=$[Ee+Oe],Oe+=R,V[F+2]=$[Ee+Oe],Oe+=R,V[F+3]=$[Ee+Oe],F+=4}G--}return V},g=function(w,S,v,R){const V=w[S+3],F=Math.pow(2,V-128)/255;v[R+0]=w[S+0]*F,v[R+1]=w[S+1]*F,v[R+2]=w[S+2]*F,v[R+3]=1},_=function(w,S,v,R){const V=w[S+3],F=Math.pow(2,V-128)/255;v[R+0]=Ss.toHalfFloat(Math.min(w[S+0]*F,65504)),v[R+1]=Ss.toHalfFloat(Math.min(w[S+1]*F,65504)),v[R+2]=Ss.toHalfFloat(Math.min(w[S+2]*F,65504)),v[R+3]=Ss.toHalfFloat(1)},m=new Uint8Array(e);m.pos=0;const f=d(m),b=f.width,T=f.height,y=p(m.subarray(m.pos),b,T);let L,P,A;switch(this.type){case Dt:A=y.length/4;const w=new Float32Array(A*4);for(let v=0;v<A;v++)g(y,v*4,w,v*4);L=w,P=Dt;break;case Sn:A=y.length/4;const S=new Uint16Array(A*4);for(let v=0;v<A;v++)_(y,v*4,S,v*4);L=S,P=Sn;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:b,height:T,data:L,header:f.string,gamma:f.gamma,exposure:f.exposure,type:P}}setDataType(e){return this.type=e,this}load(e,t,n,i){function r(a,o){switch(a.type){case Dt:case Sn:a.colorSpace
3831=Et,a.minFilter=ft,a.magFilter=ft,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,o)}return super.load(e,r,n,i)}}async function r0(s){const e=s.endsWith(".hdr")?new s0:new Tl;return await new Promise((t,n)=>{e.load(s,i=>{i.mapping=$s,t(i)},void 0,()=>{n(new Error("Error while loading texture"))})})}async function a0(s){return await new Promise((e,t)=>{new E_().load(s,n=>{e(n.scene)},void 0,()=>{t(new Error("Error while loading model"))})})}function o0(){const s=new wt;return s.fov=15,s.far=1e3,{camera:s,place({aspectRatio:e,distance:t}){s.aspect=e,s.position.z=t,s.updateProjectionMatrix()}}}const c0="https://static.vc.ru/achievements/scene.hdr";function Nl(s,e){s.traverse(t=>{t instanceof It&&e(t)})}function l0(s,{text:e,minSize:t,maxSize:n,maxWidth:i,color:r,position:a,fontFamily:o,fontWeight:c}){let l=n;for(s.fillStyle=r,s.textAlign="center",s.textBaseline="middle",s.letterSpacing="0.03em";l>t&&(s.font=`${c} ${l}px ${o}`,!(s.measureText(e).width<i));)l-=2;s.fillText(e,a[0],a[1])}function h0(s,{svg:e,color:t,position:n,maxSize:i}){const a=new DOMParser().parseFromString(e,"image/svg+xml"),o=a.querySelector("svg"),c=a.querySelectorAll("path");if(o===null||c.length===0)return;const l=mo(o.getAttribute("width")??""),h=mo(o.getAttribute("height")??""),u=(o.getAttribute("viewBox")??"").split(" ").map(parseFloat),[d=0,p=0,g=l,_=h]=u,m=Math.min(i[0]/g,i[1]/_),f=new DOMMatrix().translate(n[0],n[1]).scale(l/g*m,h/_*m).translate(-d-g/2,-p-_/2);
3831c.forEach(b=>{const T=b.getAttribute("d");if(T===null)return;const y=new Path2D(T),L=new Path2D;L.addPath(y,f),s.fillStyle=t,s.fill(L)})}function u0(s){return s<.5?Math.pow(2*s,2)*((1.90625+1)*2*s-1.90625)/2:(Math.pow(2*s-2,2)*((1.90625+1)*(s*2-2)+1.90625)+2)/2}function d0(s){const e=new h_(s.camera);e.minPolarAngle=Math.PI/2,e.maxPolarAngle=Math.PI/2,e.enableZoom=!1,e.enablePan=!1,e.enableDamping=!0,e.rotateSpeed=(s==null?void 0:s.rotateSpeed)??1,e.dampingFactor=(s==null?void 0:s.dampingFactor)??.05;const t=new D(0,0,0),n=new D,i=new Ua,r=s.spinDuration??1,a=Math.PI*2;let o=!1,c=0,l=0,h=performance.now();function u(p){if(s.spinDuration===void 0||s.spinDuration===0||!o)return;c+=p;const g=Math.min(c/r,1),_=u0(g)*a,m=_-l;l=_,n.copy(s.camera.position).sub(t),i.setFromVector3(n),i.theta+=m,n.setFromSpherical(i),s.camera.position.copy(t).add(n),s.camera.lookAt(t),g>=1&&(o=!1)}function d(){o=!1}return{controls:e,update(){const p=performance.now(),g=(p-h)/1e3;h=p,e.update(),u(g)},connect(p){e.connect(p),e.addEventListener("start",d)},disconnect(){o=!1,e.removeEventListener("start",d),e.dispose(),e.domElement!==null&&e.disconnect()},refreshSpin(){o=!0,c=0,l=0,h=performance.now()}}}function f0({text:s,textX:e,textY:t,textMaxWidth:n,logo:i,logoX:r,logoY:a,contentColor:o,width:c,height:l,renderSizeMultiplier:h=1,anisotropy:u=1}){const d=document.createElement("canvas");d.width=c*h,d.height=l*h;const p=d.getContext("2d");if(p===null)throw new Error("Canvas context is not defined");p.translate(0,d.height),p.scale(h,-h),p.fillStyle="rgba(0, 0, 0, 0)",p.fillRect(0,0,c,l),Vs(s)&&l0(p,{text:s,color:o,minSize:5,maxSize:13,position:[c*e,l*t],maxWidth:c*n,fontFamily:"Roboto",fontWeight:"700"}),h0(p,{svg:i,color:o,position:[c*r,l*a],maxSize:[33,24]});const g=new Gu(d);return g.minFilter=bh,g.magFilter=ft,g.anisotropy=u,g.colorSpace=xt,g.needsUpdate=!0,{texture:g,applyToMaterial(_){_.uniforms.captionMap={value:g},_.vertexShader=_.vertexShader.replace("#include <common>",`
3832          #include <common>
3833          varying vec2 vUv;
3834        `),_.vertexShader=_.vertexShader.replace("#include <uv_vertex>",`
3835          #include <uv_vertex>
3836          vUv = uv;
3837        `),_.fragmentShader=_.fragmentShader.replace("void main() {",`
3838          uniform sampler2D captionMap;
3839          varying vec2 vUv;
3840          void main() {
3841        `),_.fragmentShader=_.fragmentShader.replace("#include <map_fragment>",`
3842          #include <map_fragment>
3843          vec4 captionColor = texture2D(captionMap, vUv);
3844          diffuseColor.rgb = mix(diffuseColor.rgb, captionColor.rgb, smoothstep(0.1, 1.0, captionColor.a));
3845        `)}}}function p0(s,{renderer:e,model:t,lights:n,textures:i}){n==null||n.forEach(a=>{var o,c;(o=a.shadow.map)==null||o.dispose(),(c=a.shadow.map)==null||c.texture.dispose(),a.shadow.dispose(),a.dispose(),n.delete(a),s.remove(a)}),t!==void 0&&(Nl(t,a=>{var o,c,l,h,u,d,p,g,_;a.geometry instanceof Jt&&a.geometry.dispose(),(a.material instanceof rr||a.material instanceof Qt)&&(((o=a.material.map)==null?void 0:o.image)instanceof ImageBitmap&&((c=a.material.map)==null||c.image.close()),(l=a.material.map)==null||l.dispose(),((h=a.material.metalnessMap)==null?void 0:h.image)instanceof ImageBitmap&&((u=a.material.metalnessMap)==null||u.image.close()),(d=a.material.metalnessMap)==null||d.dispose(),((p=a.material.roughnessMap)==null?void 0:p.image)instanceof ImageBitmap&&((g=a.material.roughnessMap)==null||g.image.close()),(_=a.material.roughnessMap)==null||_.dispose()),Array.isArray(a.material)?a.material.forEach(m=>m.dispose()):a.material.dispose()}),s.remove(t),t=void 0),i==null||i.forEach(a=>a.dispose()),s.environment=null,e.renderLists.dispose(),e.dispose(),setTimeout(()=>{const o=e.getContext().getExtension("WEBGL_lose_context");o==null||o.loseContext()},150)}function m0({shadows:s,onRenderLoop:e}){const t=window.devicePixelRatio===1?2:1,n=new r_({antialias:!0,alpha:!0,powerPreference:"high-performance"});n.setPixelRatio(window.devicePixelRatio*t),n.setClearColor(16777215,0),n.toneMapping=qc,n.toneMappingExposure=1,n.shadowMap.enabled=!0,n.shadowMap.type=Xc,n.shadowMap.needsUpdate=!0;function i(){e(n)}return{renderer:n,start(){n.setAnimationLoop(i)},stop(){n.setAnimationLoop(null)}}}function g0(s){var b,T,y,L,P;const e={container:void 0,get width(){var A;return((A=this.container)==null?void 0:A.clientWidth)??0},get height(){var A;return((A=this.container)==null?void 0:A.clientHeight)??0},get aspectRatio(){return this.height>0?this.width/this.height:0}},t=new Lu,{camera:n,place:i}=o0(),{renderer:r,start:a,stop:o}=m0({shadows:s.shadows,onRenderLoop(A){l(),A.render(t,n)}}
3845),{controls:c,update:l,connect:h,disconnect:u,refreshSpin:d}=d0({camera:n,rotateSpeed:(b=s.controls)==null?void 0:b.rotateSpeed,dampingFactor:(T=s.controls)==null?void 0:T.dampingFactor,spinDuration:(y=s.controls)==null?void 0:y.autoSpinDuration}),{lights:p}=c_({scene:t,shadows:s.shadows,directional:(L=s.lights)==null?void 0:L.directional,spot:(P=s.lights)==null?void 0:P.spot});let g,_,m;function f(A,w=1){const S=new ln().setFromObject(A),v=S.getCenter(new D),R=S.getSize(new D);A.position.sub(v);const V=Math.max(R.x,R.y,R.z),F=n.position.distanceTo(c.target),O=n.fov*(Math.PI/180),X=2*Math.tan(O/2)*F,z=w*X*.94/V;A.scale.setScalar(z)}return{attach(A){var w;e.container=A,e.container.appendChild(r.domElement),r.setSize(e.width,e.height),i({aspectRatio:e.aspectRatio,distance:((w=s.camera)==null?void 0:w.distance)??1}),h(e.container),a()},detach(){o(),u(),p0(t,{renderer:r,model:g,lights:p,textures:[m,_].filter(A=>A!==void 0)}),r.domElement.remove()},async append(A,{caption:w,size:S,viewData:v}){g!==void 0&&t.remove(g);const[R,V]=await Promise.all([m===void 0?r0(s.texture??c0):void 0,a0(A)]);m=R,g=V,t.environment=m??null,Vs(w)&&await document.fonts.ready,Nl(g,F=>{const O=F.material;F.castShadow=!0,F.receiveShadow=!0,O.map!==null&&(O.map.anisotropy=r.capabilities.getMaxAnisotropy(),O.map.needsUpdate=!0);const{texture:X,applyToMaterial:z}=f0({...v,text:w==null?void 0:w.toUpperCase(),logo:'<svg viewBox="0 404.142 36 33.608" width="30" height="32" xmlns="http://www.w3.org/2000/svg"><path d="M28.813 419.643c2.65 0 4.645-1.104 6.116-3.026l-1.966-1.5a5.188 5.188 0 0 1-4.15 2.052c-2.876 0-4.96-2.343-4.96-5.218s2.05-5.35 5.042-5.35c1.33 0 2.27.314 3.09.822v2.528h2.474v-3.686l-.474-.373c-1.36-1.07-3.437-1.638-5.173-1.638-4.244 0-7.696 3.452-7.696 7.696 0 4.24 3.45 7.693 7.696 7.693zm5.133 15.18-.088-3.543v-8.646h-5.16v2.475h2.554v5.866c0 2.527-1.93 4.316-3.877 4.316s-2.963-1.35-2.963-3.876v-8.782h-4.82v2.475h2.214v6.736c0 3.428 1.922 5.79 5.35 5.79 1.97 0 3.47-1.093 4.365-2.778h.04l.353 2.356h3.965v-2.386h-1.93v-.005zm-13.4-30.206h-4.3l-3.74 10.86h-.058l-3.72-10.86H4.146v2.476h2.577l4.435 12.378h2.356v-.003l4.625-12.374h2.405v-2.476zM.122 437.244H2.67v-2.547H.123v2.547zm9.84-11.74h-.028l-.16-2.87H5.226v2.256h2.42v9.934h-2.42v2.387h11.24v-2.34h-6.258v-5.995c.283-2.17 1.91-4.023 4.13-4.023h.04l-.045 2.218h2.474v-4.478h-1.956c-2.24-.006-3.902 1.206-4.89 2.912z"/></svg>',logoX:Vs(w)?v.logoX:v.logoXNoText,logoY:Vs(w)?v.logoY:v.logoYNoText,width:S??e.width,height:S??e.height,renderSizeMultiplier:r.getPixelRatio()*2,anisotropy:r.capabilities.getMaxAnisotropy()});_=X,O.onBeforeCompile=z}),f(g,S!==void 0?S/Math.min(e.width,e.height):1),t.add(g),d()}}}function _0(s,e,t){const n=Gc(()=>us(e)),i=_o(!1),r=_o(!1),a=g0({shadows:!0,camera:{distance:1.1},controls:{rotateSpeed:.8,dampingFactor:.04,autoSpinDuration:2.4},lights:{directional:[{position:[0,.1,.2],intensity:3,castShadow:!0},{position:[0,.2,.2]},{position:[0,-.2,.1]},{position:[0,-.2,-.2]}]}});async function o(c){var l,h;try{i.value=!1,await a.append(c,{caption:us(t.modelCaption),size:us(t.modelSize),viewData:us(t.modelViewData)}),i.value=!0}catch(u){r.value=!0,u instanceof Error?(l=t.onModelError)==null||l.call(t,u.message):(h=t.onModelError)==null||h.call(t,"Unknown error occured while setting the model")}}return Vl(n,c=>{c instanceof HTMLElement?a.attach(c):a.detach()}),Gl(async()=>{await o(s)}),Wl(()=>{a.detach()}),{isReady:go(i),isError:go(r)}}const x0={key:0,class:"scene__skeleton"},v0={key:1,class:"scene__font-skeleton"},S0=Xl({__name:"Scene",props:{canvasSize:{},modelSize:{},modelUrl:{},modelViewData:{},modelCaption:{}},emits:["modelError"],setup(s,{emit:e}){Yl(c=>({fb4bb2ba:o.value}));const t=s,n=e,i=ql("container"),{isReady:r,isError:a}=_0(t.modelUrl,i,{modelCaption:t.modelCaption,modelSize:t.modelSize,modelViewData:t.modelViewData,onModelError(c){n("modelError",c)}}),o=Gc(()=>`${t.canvasSize}px`);return(c,l)=>(lr(),hr("div",{ref_key:"container",ref:i,class:jl(["scene",ds(r)&&"scene--ready",ds(a)&&"scene--error"])},[ds(r)?xo("",!0):(lr(),hr("div",x0,[Kl(c.$slots,"default")])),ds(r)?xo("",!0):(lr(),hr("div",v0," Loading... "))],2))}});
3845export{S0 as _};

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.