PageSourceSearch

https://sambhavg.github.io/medal/_app/immutable/nodes/2.CIYjYCeZ.js

js sambhavg.github.io collected 2026-10-03 09:54:44 UTC 547,742 bytes, 4,212 lines download raw bytes

1import{s as Sl,n as Jr,o as _c,r as vc,y as xc,f as Sc}from"../chunks/scheduler.ERGujBjV.js";import{S as Ml,i as yl,e as he,s as He,m as Ja,c as de,a as Ne,d as ae,f as Ge,o as te,g as Dn,y as Wi,h as Zt,z as Qa,A as ps,B as Mc,t as hr,b as dr,C as yc,u as Ec,v as Tc,w as bc,k as Ac,l as wc,x as Rc}from"../chunks/index.BDnUNMXz.js";import{d as Cc,r as Yi,b as El}from"../chunks/paths.C4ZAgji_.js";function to(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}const Pc=!1,h_=Object.freeze(Object.defineProperty({__proto__:null,ssr:Pc},Symbol.toStringTag,{value:"Module"}));/**
2 * @license
3 * Copyright 2010-2024 Three.js Authors
4 * SPDX-License-Identifier: MIT
5 */const Ia="167",ri={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},si={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Lc=0,eo=1,Dc=2,Tl=1,Uc=2,mn=3,On=0,Pe=1,gn=2,In=0,wi=1,no=2,io=3,ro=4,Ic=5,Yn=100,Nc=101,Oc=102,Fc=103,Bc=104,zc=200,Hc=201,Gc=202,Vc=203,Zs=204,js=205,kc=206,Wc=207,Xc=208,qc=209,Yc=210,Kc=211,Zc=212,jc=213,$c=214,Jc=0,Qc=1,tu=2,Qr=3,eu=4,nu=5,iu=6,ru=7,bl=0,su=1,au=2,Nn=0,ou=1,lu=2,cu=3,uu=4,hu=5,du=6,fu=7,Al=300,Di=301,Ui=302,$s=303,Js=304,as=306,Qs=1e3,Zn=1001,ta=1002,Ve=1003,pu=1004,fr=1005,Ze=1006,ms=1007,jn=1008,xn=1009,wl=1010,Rl=1011,Ji=1012,Na=1013,Jn=1014,_n=1015,rr=1016,Oa=1017,Fa=1018,Ii=1020,Cl=35902,Pl=1021,Ll=1022,$e=1023,Dl=1024,Ul=1025,Ri=1026,Ni=1027,Il=1028,Ba=1029,Nl=1030,za=1031,Ha=1033,Xr=33776,qr=33777,Yr=33778,Kr=33779,ea=35840,na=35841,ia=35842,ra=35843,sa=36196,aa=37492,oa=37496,la=37808,ca=37809,ua=37810,ha=37811,da=37812,fa=37813,pa=37814,ma=37815,ga=37816,_a=37817,va=37818,xa=37819,Sa=37820,Ma=37821,Zr=36492,ya=36494,Ea=36495,Ol=36283,Ta=36284,ba=36285,Aa=36286,mu=3200,gu=3201,_u=0,vu=1,Ln="",en="srgb",Fn="srgb-linear",Ga="display-p3",os="display-p3-linear",ts="linear",Jt="srgb",es="rec709",ns="p3",ai=7680,so=519,xu=512,Su=513,Mu=514,Fl=515,yu=516,Eu=517,Tu=518,bu=519,wa=35044,ao="300 es",vn=2e3,is=2001;class ni{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(r!==void 0){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,t);t.target=null}}}const Te=["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 oo=1234567;const Ki=Math.PI/180,Qi=180/Math.PI;function sn(){const i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Te[i&255]+Te[i>>8&255]+Te[i>>16&255]+Te[i>>24&255]+"-"+Te[t&255]+Te[t>>8&255]+"-"+Te[t>>16&15|64]+Te[t>>24&255]+"-"+Te[e&63|128]+Te[e>>8&255]+"-"+Te[e>>16&255]+Te[e>>24&255]+Te[n&255]+Te[n>>8&255]+Te[n>>16&255]+Te[n>>24&255]).toLowerCase()}function me(i,t,e){return Math.max(t,Math.min(e,i))}function Va(i,t){return(i%t+t)%t}function Au(i,t,e,n,r){return n+(i-t)*(r-n)/(e-t)}
vendor: 39,023 bytes, line 5
5function wu(i,t,e){return i!==t?(e-i)/(t-i):0}function Zi(i,t,e){return(1-e)*i+e*t}function Ru(i,t,e,n){return Zi(i,t,1-Math.exp(-e*n))}function Cu(i,t=1){return t-Math.abs(Va(i,t*2)-t)}function Pu(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function Lu(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Du(i,t){return i+Math.floor(Math.random()*(t-i+1))}function Uu(i,t){return i+Math.random()*(t-i)}function Iu(i){return i*(.5-Math.random())}function Nu(i){i!==void 0&&(oo=i);let t=oo+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Ou(i){return i*Ki}function Fu(i){return i*Qi}function Bu(i){return(i&i-1)===0&&i!==0}function zu(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Hu(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Gu(i,t,e,n,r){const s=Math.cos,o=Math.sin,a=s(e/2),l=o(e/2),c=s((t+n)/2),u=o((t+n)/2),h=s((t-n)/2),d=o((t-n)/2),p=s((n-t)/2),g=o((n-t)/2);switch(r){case"XYX":i.set(a*u,l*h,l*d,a*c);break;case"YZY":i.set(l*d,a*u,l*h,a*c);break;case"ZXZ":i.set(l*h,l*d,a*u,a*c);break;case"XZX":i.set(a*u,l*g,l*p,a*c);break;case"YXY":i.set(l*p,a*u,l*g,a*c);break;case"ZYZ":i.set(l*g,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function je(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function jt(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Bl={DEG2RAD:Ki,RAD2DEG:Qi,generateUUID:sn,clamp:me,euclideanModulo:Va,mapLinear:Au,inverseLerp:wu,lerp:Zi,damp:Ru,pingpong:Cu,smoothstep:Pu,smootherstep:Lu,randInt:Du,randFloat:Uu,randFloatSpread:Iu,seededRandom:Nu,degToRad:Ou,radToDeg:Fu,isPowerOfTwo:Bu,ceilPowerOfTwo:zu,floorPowerOfTwo:Hu,setQuaternionFromProperEuler:Gu,normalize:jt,denormalize:je};class ct{constructor(t=0,e=0){ct.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(me(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),s=this.x-t.x,o=this.y-t.y;return this.x=s*n-o*r+t.x,this.y=s*r+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Vt{constructor(t,e,n,r,s,o,a,l,c){Vt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,o,a,l,c)}set(t,e,n,r,s,o,a,l,c){const u=this.elements;return u[0]=t,u[1]=r,u[2]=a,u[3]=e,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],d=n[2],p=n[5],g=n[8],v=r[0],m=r[3],f=r[6],A=r[1],x=r[4],T=r[7],O=r[2],C=r[5],R=r[8];return s[0]=o*v+a*A+l*O,s[3]=o*m+a*x+l*C,s[6]=o*f+a*T+l*R,s[1]=c*v+u*A+h*O,s[4]=c*m+u*x+h*C,s[7]=c*f+u*T+h*R,s[2]=d*v+p*A+g*O,s[5]=d*m+p*x+g*C,s[8]=d*f+p*T+g*R,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e*o*u-e*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*o-a*c,d=a*l-u*s,p=c*s-o*l,g=e*h+n*d+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/g;return t[0]=h*v,t[1]=(r*c-u*n)*v,t[2]=(a*n-r*o)*v,t[3]=d*v,t[4]=(u*e-r*l)*v,t[5]=(r*s-a*e)*v,t[6]=p*v,t[7]=(n*l-c*e)*v,t[8]=(o*e-n*s)*v,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+t,-r*c,r*l,-r*(-c*o+l*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(gs.makeScale(t,e)),this}rotate(t){return this.premultiply(gs.makeRotation(-t)),this}translate(t,e){return this.premultiply(gs.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const gs=new Vt;function zl(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function tr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Vu(){const i=tr("canvas");return i.style.display="block",i}const lo={};function Ci(i){i in lo||(lo[i]=!0,console.warn(i))}function ku(i,t,e){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(t,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,e);break;default:n()}}setTimeout(s,e)})}const co=new Vt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),uo=new Vt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),zi={[Fn]:{transfer:ts,primaries:es,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i,fromReference:i=>i},[en]:{transfer:Jt,primaries:es,luminanceCoefficients:[.2126,.7152,.0722],toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[os]:{transfer:ts,primaries:ns,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.applyMatrix3(uo),fromReference:i=>i.applyMatrix3(co)},[Ga]:{transfer:Jt,primaries:ns,luminanceCoefficients:[.2289,.6917,.0793],toReference:i=>i.convertSRGBToLinear().applyMatrix3(uo),fromReference:i=>i.applyMatrix3(co).convertLinearToSRGB()}},Wu=new Set([Fn,os]),Kt={enabled:!0,_workingColorSpace:Fn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!Wu.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,t,e){if(this.enabled===!1||t===e||!t||!e)return i;const n=zi[t].toReference,r=zi[e].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,t){return this.convert(i,this._workingColorSpace,t)},toWorkingColorSpace:function(i,t){return this.convert(i,t,this._workingColorSpace)},getPrimaries:function(i){return zi[i].primaries},getTransfer:function(i){return i===Ln?ts:zi[i].transfer},getLuminanceCoefficients:function(i,t=this._workingColorSpace){return i.fromArray(zi[t].luminanceCoefficients)}};function Pi(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function _s(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let oi;class Xu{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{oi===void 0&&(oi=tr("canvas")),oi.width=t.width,oi.height=t.height;const n=oi.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=oi}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=tr("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const r=n.getImageData(0,0,t.width,t.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Pi(s[o]/255)*255;return n.putImageData(r,0,0),e}else if(t.data){const e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(Pi(e[n]/255)*255):e[n]=Pi(e[n]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let qu=0;class Hl{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:qu++}),this.uuid=sn(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(vs(r[o].image)):s.push(vs(r[o]))}else s=vs(r);n.url=s}return e||(t.images[this.uuid]=n),n}}function vs(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Xu.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Yu=0;class Re extends ni{constructor(t=Re.DEFAULT_IMAGE,e=Re.DEFAULT_MAPPING,n=Zn,r=Zn,s=Ze,o=jn,a=$e,l=xn,c=Re.DEFAULT_ANISOTROPY,u=Ln){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Yu++}),this.uuid=sn(),this.name="",this.source=new Hl(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new ct(0,0),this.repeat=new ct(1,1),this.center=new ct(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Vt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Al)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Qs:t.x=t.x-Math.floor(t.x);break;case Zn:t.x=t.x<0?0:1;break;case ta:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Qs:t.y=t.y-Math.floor(t.y);break;case Zn:t.y=t.y<0?0:1;break;case ta:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}Re.DEFAULT_IMAGE=null;Re.DEFAULT_MAPPING=Al;Re.DEFAULT_ANISOTROPY=1;class ee{constructor(t=0,e=0,n=0,r=1){ee.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,s=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*s,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,s;const l=t.elements,c=l[0],u=l[4],h=l[8],d=l[1],p=l[5],g=l[9],v=l[2],m=l[6],f=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-v)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+v)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const x=(c+1)/2,T=(p+1)/2,O=(f+1)/2,C=(u+d)/4,R=(h+v)/4,U=(g+m)/4;return x>T&&x>O?x<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(x),r=C/n,s=R/n):T>O?T<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(T),n=C/r,s=U/r):O<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(O),n=R/s,r=U/s),this.set(n,r,s,e),this}let A=Math.sqrt((m-g)*(m-g)+(h-v)*(h-v)+(d-u)*(d-u));return Math.abs(A)<.001&&(A=1),this.x=(m-g)/A,this.y=(h-v)/A,this.z=(d-u)/A,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Ku extends ni{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new ee(0,0,t,e),this.scissorTest=!1,this.viewport=new ee(0,0,t,e);const r={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ze,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new Re(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;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(t){this.textures[0]=t}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=t,this.textures[r].image.height=e,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let n=0,r=t.textures.length;n<r;n++)this.textures[n]=t.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new Hl(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Qn extends Ku{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class Gl extends Re{constructor(t=null,e=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=Ve,this.minFilter=Ve,this.wrapR=Zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Zu extends Re{constructor(t=null,e=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=Ve,this.minFilter=Ve,this.wrapR=Zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ti{constructor(t=0,e=0,n=0,r=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=r}static slerpFlat(t,e,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],h=n[r+3];const d=s[o+0],p=s[o+1],g=s[o+2],v=s[o+3];if(a===0){t[e+0]=l,t[e+1]=c,t[e+2]=u,t[e+3]=h;return}if(a===1){t[e+0]=d,t[e+1]=p,t[e+2]=g,t[e+3]=v;return}if(h!==v||l!==d||c!==p||u!==g){let m=1-a;const f=l*d+c*p+u*g+h*v,A=f>=0?1:-1,x=1-f*f;if(x>Number.EPSILON){const O=Math.sqrt(x),C=Math.atan2(O,f*A);m=Math.sin(m*C)/O,a=Math.sin(a*C)/O}const T=a*A;if(l=l*m+d*T,c=c*m+p*T,u=u*m+g*T,h=h*m+v*T,m===1-a){const O=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=O,c*=O,u*=O,h*=O}}t[e]=l,t[e+1]=c,t[e+2]=u,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,r,s,o){const a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],h=s[o],d=s[o+1],p=s[o+2],g=s[o+3];return t[e]=a*g+u*h+l*p-c*d,t[e+1]=l*g+u*d+c*h-a*p,t[e+2]=c*g+u*p+a*d-l*h,t[e+3]=u*g-a*h-l*d-c*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,r=t._y,s=t._z,o=t._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),h=a(s/2),d=l(n/2),p=l(r/2),g=l(s/2);switch(o){case"XYZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"YXZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"ZXY":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"ZYX":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"YZX":this._x=d*u*h+c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h-d*p*g;break;case"XZY":this._x=d*u*h-c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h+d*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],s=e[8],o=e[1],a=e[5],l=e[9],c=e[2],u=e[6],h=e[10],d=n+a+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-r)*p}else if(n>a&&n>h){const p=2*Math.sqrt(1+n-a-h);this._w=(u-l)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+c)/p}else if(a>h){const p=2*Math.sqrt(1+a-n-h);this._w=(s-c)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-n-a);this._w=(o-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(me(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,s=t._z,o=t._w,a=e._x,l=e._y,c=e._z,u=e._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,r=this._y,s=this._z,o=this._w;let a=o*t._w+n*t._x+r*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-e;return this._w=p*o+e*this._w,this._x=p*n+e*this._x,this._y=p*r+e*this._y,this._z=p*s+e*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;return this._w=o*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class L{constructor(t=0,e=0,n=0){L.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ho.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ho.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*r,this.y=s[1]*e+s[4]*n+s[7]*r,this.z=s[2]*e+s[5]*n+s[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,s=t.elements,o=1/(s[3]*e+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*e+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*e+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,s=t.x,o=t.y,a=t.z,l=t.w,c=2*(o*r-a*n),u=2*(a*e-s*r),h=2*(s*n-o*e);return this.x=e+l*c+o*h-a*u,this.y=n+l*u+a*c-s*h,this.z=r+l*h+s*u-o*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r,this.y=s[1]*e+s[5]*n+s[9]*r,this.z=s[2]*e+s[6]*n+s[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,s=t.z,o=e.x,a=e.y,l=e.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return xs.copy(this).projectOnVector(t),this.sub(xs)}reflect(t){return this.sub(xs.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(me(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const xs=new L,ho=new ti;class Bn{constructor(t=new L(1/0,1/0,1/0),e=new L(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(qe.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(qe.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=qe.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(n!==void 0){const s=n.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)t.isMesh===!0?t.getVertexPosition(o,qe):qe.fromBufferAttribute(s,o),qe.a
vendor: 4,642 bytes, line 5
5pplyMatrix4(t.matrixWorld),this.expandByPoint(qe);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),pr.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),pr.copy(n.boundingBox)),pr.applyMatrix4(t.matrixWorld),this.union(pr)}const r=t.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,qe),qe.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Hi),mr.subVectors(this.max,Hi),li.subVectors(t.a,Hi),ci.subVectors(t.b,Hi),ui.subVectors(t.c,Hi),Tn.subVectors(ci,li),bn.subVectors(ui,ci),Hn.subVectors(li,ui);let e=[0,-Tn.z,Tn.y,0,-bn.z,bn.y,0,-Hn.z,Hn.y,Tn.z,0,-Tn.x,bn.z,0,-bn.x,Hn.z,0,-Hn.x,-Tn.y,Tn.x,0,-bn.y,bn.x,0,-Hn.y,Hn.x,0];return!Ss(e,li,ci,ui,mr)||(e=[1,0,0,0,1,0,0,0,1],!Ss(e,li,ci,ui,mr))?!1:(gr.crossVectors(Tn,bn),e=[gr.x,gr.y,gr.z],Ss(e,li,ci,ui,mr))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,qe).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(qe).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(cn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),cn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),cn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),cn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),cn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),cn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),cn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),cn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(cn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const cn=[new L,new L,new L,new L,new L,new L,new L,new L],qe=new L,pr=new Bn,li=new L,ci=new L,ui=new L,Tn=new L,bn=new L,Hn=new L,Hi=new L,mr=new L,gr=new L,Gn=new L;function Ss(i,t,e,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){Gn.fromArray(i,s);const a=r.x*Math.abs(Gn.x)+r.y*Math.abs(Gn.y)+r.z*Math.abs(Gn.z),l=t.dot(Gn),c=e.dot(Gn),u=n.dot(Gn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const ju=new Bn,Gi=new L,Ms=new L;class sr{constructor(t=new L,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;e!==void 0?n.copy(e):ju.setFromPoints(t).getCenter(n);let r=0;for(let s=0,o=t.length;s<o;s++)r=Math.max(r,n.distanceToSquared(t[s]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}
vendor: 16,728 bytes, line 5
5applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Gi.subVectors(t,this.center);const e=Gi.lengthSq();if(e>this.radius*this.radius){const n=Math.sqrt(e),r=(n-this.radius)*.5;this.center.addScaledVector(Gi,r/n),this.radius+=r}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Ms.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Gi.copy(t.center).add(Ms)),this.expandByPoint(Gi.copy(t.center).sub(Ms))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const un=new L,ys=new L,_r=new L,An=new L,Es=new L,vr=new L,Ts=new L;class Vl{constructor(t=new L,e=new L(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,un)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=un.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(un.copy(this.origin).addScaledVector(this.direction,e),un.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){ys.copy(t).add(e).multiplyScalar(.5),_r.copy(e).sub(t).normalize(),An.copy(this.origin).sub(ys);const s=t.distanceTo(e)*.5,o=-this.direction.dot(_r),a=An.dot(this.direction),l=-An.dot(_r),c=An.lengthSq(),u=Math.abs(1-o*o);let h,d,p,g;if(u>0)if(h=o*l-a,d=o*a-l,g=s*u,h>=0)if(d>=-g)if(d<=g){const v=1/u;h*=v,d*=v,p=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=s,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d<=-g?(h=Math.max(0,-(-o*s+a)),d=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+d*(d+2*l)+c):d<=g?(h=0,d=Math.min(Math.max(-s,-l),s),p=d*(d+2*l)+c):(h=Math.max(0,-(o*s+a)),d=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+d*(d+2*l)+c);else d=o>0?-s:s,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(ys).addScaledVector(_r,d),p}intersectSphere(t,e){un.subVectors(t.center,this.origin);const n=un.dot(this.direction),r=un.dot(un)-n*n,s=t.radius*t.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(n=(t.min.x-d.x)*c,r=(t.max.x-d.x)*c):(n=(t.max.x-d.x)*c,r=(t.min.x-d.x)*c),u>=0?(s=(t.min.y-d.y)*u,o=(t.max.y-d.y)*u):(s=(t.max.y-d.y)*u,o=(t.min.y-d.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),h>=0?(a=(t.min.z-d.z)*h,l=(t.max.z-d.z)*h):(a=(t.max.z-d.z)*h,l=(t.min.z-d.z)*h),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,e)}intersectsBox(t){return this.intersectBox(t,un)!==null}intersectTriangle(t,e,n,r,s){Es.subVectors(e,t),vr.subVectors(n,t),Ts.crossVectors(Es,vr);let o=this.direction.dot(Ts),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;An.subVectors(this.origin,t);const l=a*this.direction.dot(vr.crossVectors(An,vr));if(l<0)return null;const c=a*this.direction.dot(Es.cross(An));if(c<0||l+c>o)return null;const u=-a*An.dot(Ts);return u<0?null:this.at(u/o,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class oe{constructor(t,e,n,r,s,o,a,l,c,u,h,d,p,g,v,m){oe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,o,a,l,c,u,h,d,p,g,v,m)}set(t,e,n,r,s,o,a,l,c,u,h,d,p,g,v,m){const f=this.elements;return f[0]=t,f[4]=e,f[8]=n,f[12]=r,f[1]=s,f[5]=o,f[9]=a,f[13]=l,f[2]=c,f[6]=u,f[10]=h,f[14]=d,f[3]=p,f[7]=g,f[11]=v,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 oe().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/hi.setFromMatrixColumn(t,0).length(),s=1/hi.setFromMatrixColumn(t,1).length(),o=1/hi.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,r=t.y,s=t.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(t.order==="XYZ"){const d=o*u,p=o*h,g=a*u,v=a*h;e[0]=l*u,e[4]=-l*h,e[8]=c,e[1]=p+g*c,e[5]=d-v*c,e[9]=-a*l,e[2]=v-d*c,e[6]=g+p*c,e[10]=o*l}else if(t.order==="YXZ"){const d=l*u,p=l*h,g=c*u,v=c*h;e[0]=d+v*a,e[4]=g*a-p,e[8]=o*c,e[1]=o*h,e[5]=o*u,e[9]=-a,e[2]=p*a-g,e[6]=v+d*a,e[10]=o*l}else if(t.order==="ZXY"){const d=l*u,p=l*h,g=c*u,v=c*h;e[0]=d-v*a,e[4]=-o*h,e[8]=g+p*a,e[1]=p+g*a,e[5]=o*u,e[9]=v-d*a,e[2]=-o*c,e[6]=a,e[10]=o*l}else if(t.order==="ZYX"){const d=o*u,p=o*h,g=a*u,v=a*h;e[0]=l*u,e[4]=g*c-p,e[8]=d*c+v,e[1]=l*h,e[5]=v*c+d,e[9]=p*c-g,e[2]=-c,e[6]=a*l,e[10]=o*l}else if(t.order==="YZX"){const d=o*l,p=o*c,g=a*l,v=a*c;e[0]=l*u,e[4]=v-d*h,e[8]=g*h+p,e[1]=h,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=p*h+g,e[10]=d-v*h}else if(t.order==="XZY"){const d=o*l,p=o*c,g=a*l,v=a*c;e[0]=l*u,e[4]=-h,e[8]=c*u,e[1]=d*h+v,e[5]=o*u,e[9]=p*h-g,e[2]=g*h-p,e[6]=a*u,e[10]=v*h+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose($u,t,Ju)}lookAt(t,e,n){const r=this.elements;return Ue.subVectors(t,e),Ue.lengthSq()===0&&(Ue.z=1),Ue.normalize(),wn.crossVectors(n,Ue),wn.lengthSq()===0&&(Math.abs(n.z)===1?Ue.x+=1e-4:Ue.z+=1e-4,Ue.normalize(),wn.crossVectors(n,Ue)),wn.normalize(),xr.crossVectors(Ue,wn),r[0]=wn.x,r[4]=xr.x,r[8]=Ue.x,r[1]=wn.y,r[5]=xr.y,r[9]=Ue.y,r[2]=wn.z,r[6]=xr.z,r[10]=Ue.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],d=n[9],p=n[13],g=n[2],v=n[6],m=n[10],f=n[14],A=n[3],x=n[7],T=n[11],O=n[15],C=r[0],R=r[4],U=r[8],b=r[12],M=r[1],P=r[5],Y=r[9],G=r[13],N=r[2],K=r[6],k=r[10],J=r[14],W=r[3],ot=r[7],et=r[11],mt=r[15];return s[0]=o*C+a*M+l*N+c*W,s[4]=o*R+a*P+l*K+c*ot,s[8]=o*U+a*Y+l*k+c*et,s[12]=o*b+a*G+l*J+c*mt,s[1]=u*C+h*M+d*N+p*W,s[5]=u*R+h*P+d*K+p*ot,s[9]=u*U+h*Y+d*k+p*et,s[13]=u*b+h*G+d*J+p*mt,s[2]=g*C+v*M+m*N+f*W,s[6]=g*R+v*P+m*K+f*ot,s[10]=g*U+v*Y+m*k+f*et,s[14]=g*b+v*G+m*J+f*mt,s[3]=A*C+x*M+T*N+O*W,s[7]=A*R+x*P+T*K+O*ot,s[11]=A*U+x*Y+T*k+O*et,s[15]=A*b+x*G+T*J+O*mt,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],s=t[12],o=t[1],a=t[5],l=t[9],c=t[13],u=t[2],h=t[6],d=t[10],p=t[14],g=t[3],v=t[7],m=t[11],f=t[15];return g*(+s*l*h-r*c*h-s*a*d+n*c*d+r*a*p-n*l*p)+v*(+e*l*p-e*c*d+s*o*d-r*o*p+r*c*u-s*l*u)+m*(+e*c*h-e*a*p-s*o*h+n*o*p+s*a*u-n*c*u)+f*(-r*a*u-e*l*h+e*a*d+r*o*h-n*o*d+n*l*u)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],g=t[12],v=t[13],m=t[14],f=t[15],A=h*m*c-v*d*c+v*l*p-a*m*p-h*l*f+a*d*f,x=g*d*c-u*m*c-g*l*p+o*m*p+u*l*f-o*d*f,T=u*v*c-g*h*c+g*a*p-o*v*p-u*a*f+o*h*f,O=g*h*l-u*v*l-g*a*d+o*v*d+u*a*m-o*h*m,C=e*A+n*x+r*T+s*O;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/C;return t[0]=A*R,t[1]=(v*d*s-h*m*s-v*r*p+n*m*p+h*r*f-n*d*f)*R,t[2]=(a*m*s-v*l*s+v*r*c-n*m*c-a*r*f+n*l*f)*R,t[3]=(h*l*s-a*d*s-h*r*c+n*d*c+a*r*p-n*l*p)*R,t[4]=x*R,t[5]=(u*m*s-g*d*s+g*r*p-e*m*p-u*r*f+e*d*f)*R,t[6]=(g*l*s-o*m*s-g*r*c+e*m*c+o*r*f-e*l*f)*R,t[7]=(o*d*s-u*l*s+u*r*c-e*d*c-o*r*p+e*l*p)*R,t[8]=T*R,t[9]=(g*h*s-u*v*s-g*n*p+e*v*p+u*n*f-e*h*f)*R,t[10]=(o*v*s-g*a*s+g*n*c-e*v*c-o*n*f+e*a*f)*R,t[11]=(u*a*s-o*h*s-u*n*c+e*h*c+o*n*p-e*a*p)*R,t[12]=O*R,t[13]=(u*v*r-g*h*r+g*n*d-e*v*d-u*n*m+e*h*m)*R,t[14]=(g*a*r-o*v*r-g*n*l+e*v*l+o*n*m-e*a*m)*R,t[15]=(o*h*r-u*a*r+u*n*l-e*h*l-o*n*d+e*a*d)*R,this}scale(t){const e=this.elements,n=t.x,r=t.y,s=t.z;return e[0]*=n,e[4]*=r,e[8]*=s,e[1]*=n,e[5]*=r,e[9]*=s,e[2]*=n,e[6]*=r,e[10]*=s,e[3]*=n,e[7]*=r,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),s=1-n,o=t.x,a=t.y,l=t.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,r,s,o){return this.set(1,n,s,0,t,1,o,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,s=e._x,o=e._y,a=e._z,l=e._w,c=s+s,u=o+o,h=a+a,d=s*c,p=s*u,g=s*h,v=o*u,m=o*h,f=a*h,A=l*c,x=l*u,T=l*h,O=n.x,C=n.y,R=n.z;return r[0]=(1-(v+f))*O,r[1]=(p+T)*O,r[2]=(g-x)*O,r[3]=0,r[4]=(p-T)*C,r[5]=(1-(d+f))*C,r[6]=(m+A)*C,r[7]=0,r[8]=(g+x)*R,r[9]=(m-A)*R,r[10]=(1-(d+v))*R,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let s=hi.set(r[0],r[1],r[2]).length();const o=hi.set(r[4],r[5],r[6]).length(),a=hi.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],Ye.copy(this);const c=1/s,u=1/o,h=1/a;return Ye.elements[0]*=c,Ye.elements[1]*=c,Ye.elements[2]*=c,Ye.elements[4]*=u,Ye.elements[5]*=u,Ye.elements[6]*=u,Ye.elements[8]*=h,Ye.elements[9]*=h,Ye.elements[10]*=h,e.setFromRotationMatrix(Ye),n.x=s,n.y=o,n.z=a,this}makePerspective(t,e,n,r,s,o,a=vn){const l=this.elements,c=2*s/(e-t),u=2*s/(n-r),h=(e+t)/(e-t),d=(n+r)/(n-r);let p,g;if(a===vn)p=-(o+s)/(o-s),g=-2*o*s/(o-s);else if(a===is)p=-o/(o-s),g=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,r,s,o,a=vn){const l=this.elements,c=1/(e-t),u=1/(n-r),h=1/(o-s),d=(e+t)*c,p=(n+r)*u;let g,v;if(a===vn)g=(o+s)*h,v=-2*h;else if(a===is)g=s*h,v=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=v,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const hi=new L,Ye=new oe,$u=new L(0,0,0),Ju=new L(1,1,1),wn=new L,xr=new L,Ue=new L,fo=new oe,po=new ti;class Sn{constructor(t=0,e=0,n=0,r=Sn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const r=t.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],p=r[10];switch(e){case"XYZ":this._y=Math.asin(me(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-me(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(me(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-me(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(me(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-me(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return fo.makeRotationFromQuaternion(t),this.setFromRotationMatrix(fo,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return po.setFromEuler(this),this.setFromQuaternion(po,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Sn.DEFAULT_ORDER="XYZ";class kl{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let Qu=0;const mo=new L,di=new ti,hn=new oe,Sr=new L,Vi=new L,th=new L,eh=new ti,go=new L(1,0,0),_o=new L(0,1,0),vo=new L(0,0,1),xo={type:"added"},nh={type:"removed"},fi={type:"childadded",child:null},bs={type:"childremoved",child:null};class Oe extends ni{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Qu++}),this.uuid=sn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Oe.DEFAULT_UP.clone();
vendor: 5,073 bytes, line 5
5const t=new L,e=new Sn,n=new ti,r=new L(1,1,1);function s(){n.setFromEuler(e,!1)}function o(){e.setFromQuaternion(n,void 0,!1)}e._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new oe},normalMatrix:{value:new Vt}}),this.matrix=new oe,this.matrixWorld=new oe,this.matrixAutoUpdate=Oe.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Oe.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new kl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return di.setFromAxisAngle(t,e),this.quaternion.multiply(di),this}rotateOnWorldAxis(t,e){return di.setFromAxisAngle(t,e),this.quaternion.premultiply(di),this}rotateX(t){return this.rotateOnAxis(go,t)}rotateY(t){return this.rotateOnAxis(_o,t)}rotateZ(t){return this.rotateOnAxis(vo,t)}translateOnAxis(t,e){return mo.copy(t).applyQuaternion(this.quaternion),this.position.add(mo.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(go,t)}translateY(t){return this.translateOnAxis(_o,t)}translateZ(t){return this.translateOnAxis(vo,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(hn.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Sr.copy(t):Sr.set(t,e,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Vi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?hn.lookAt(Vi,Sr,this.up):hn.lookAt(Sr,Vi,this.up),this.quaternion.setFromRotationMatrix(hn),r&&(hn.extractRotation(r.matrixWorld),di.setFromRotationMatrix(hn),this.quaternion.premultiply(di.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(xo),fi.child=t,this.dispatchEvent(fi),fi.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(nh),bs.child=t,this.dispatchEvent(bs),bs.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),hn.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),hn.multiply(t.parent.matrixWorld)),t.applyMatrix4(hn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(xo),fi.child=t,this.dispatchEvent(fi),fi.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,r=this.children.length;n<r;n++){const o=this.children[n].getObjectByProperty(t,e);if(o!==void 0)return o}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Vi,t,th),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Vi,eh,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 17,707 bytes, line 5
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(t){const e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(t.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(t.shapes,h)}else s(t.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(t.materials,this.material[l]));r.material=a}else r.material=s(t.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(t.animations,l))}}if(e){const a=o(t.geometries),l=o(t.materials),c=o(t.textures),u=o(t.images),h=o(t.shapes),d=o(t.skeletons),p=o(t.animations),g=o(t.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}return n.object=r,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){const r=t.children[n];this.add(r.clone())}return this}}Oe.DEFAULT_UP=new L(0,1,0);Oe.DEFAULT_MATRIX_AUTO_UPDATE=!0;Oe.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ke=new L,dn=new L,As=new L,fn=new L,pi=new L,mi=new L,So=new L,ws=new L,Rs=new L,Cs=new L;class nn{constructor(t=new L,e=new L,n=new L){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){r.subVectors(n,e),Ke.subVectors(t,e),r.cross(Ke);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(t,e,n,r,s){Ke.subVectors(r,e),dn.subVectors(n,e),As.subVectors(t,e);const o=Ke.dot(Ke),a=Ke.dot(dn),l=Ke.dot(As),c=dn.dot(dn),u=dn.dot(As),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;const d=1/h,p=(c*l-a*u)*d,g=(o*u-a*l)*d;return s.set(1-p-g,g,p)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,fn)===null?!1:fn.x>=0&&fn.y>=0&&fn.x+fn.y<=1}static getInterpolation(t,e,n,r,s,o,a,l){return this.getBarycoord(t,e,n,r,fn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,fn.x),l.addScaledVector(o,fn.y),l.addScaledVector(a,fn.z),l)}static isFrontFacing(t,e,n,r){return Ke.subVectors(n,e),dn.subVectors(t,e),Ke.cross(dn).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ke.subVectors(this.c,this.b),dn.subVectors(this.a,this.b),Ke.cross(dn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return nn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return nn.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,r,s){return nn.getInterpolation(t,this.a,this.b,this.c,e,n,r,s)}containsPoint(t){return nn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return nn.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,r=this.b,s=this.c;let o,a;pi.subVectors(r,n),mi.subVectors(s,n),ws.subVectors(t,n);const l=pi.dot(ws),c=mi.dot(ws);if(l<=0&&c<=0)return e.copy(n);Rs.subVectors(t,r);const u=pi.dot(Rs),h=mi.dot(Rs);if(u>=0&&h<=u)return e.copy(r);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),e.copy(n).addScaledVector(pi,o);Cs.subVectors(t,s);const p=pi.dot(Cs),g=mi.dot(Cs);if(g>=0&&p<=g)return e.copy(s);const v=p*c-l*g;if(v<=0&&c>=0&&g<=0)return a=c/(c-g),e.copy(n).addScaledVector(mi,a);const m=u*g-p*h;if(m<=0&&h-u>=0&&p-g>=0)return So.subVectors(s,r),a=(h-u)/(h-u+(p-g)),e.copy(r).addScaledVector(So,a);const f=1/(m+v+d);return o=v*f,a=d*f,e.copy(n).addScaledVector(pi,o).addScaledVector(mi,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Wl={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},Rn={h:0,s:0,l:0},Mr={h:0,s:0,l:0};function Ps(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}class $t{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){const r=t;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=en){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Kt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,r=Kt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Kt.toWorkingColorSpace(this,r),this}setHSL(t,e,n,r=Kt.workingColorSpace){if(t=Va(t,1),e=me(e,0,1),n=me(n,0,1),e===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+e):n+e-n*e,o=2*n-s;this.r=Ps(o,s,t+1/3),this.g=Ps(o,s,t),this.b=Ps(o,s,t-1/3)}return Kt.toWorkingColorSpace(this,r),this}setStyle(t,e=en){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(o===6)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=en){const n=Wl[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Pi(t.r),this.g=Pi(t.g),this.b=Pi(t.b),this}copyLinearToSRGB(t){return this.r=_s(t.r),this.g=_s(t.g),this.b=_s(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=en){return Kt.fromWorkingColorSpace(be.copy(this),t),Math.round(me(be.r*255,0,255))*65536+Math.round(me(be.g*255,0,255))*256+Math.round(me(be.b*255,0,255))}getHexString(t=en){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Kt.workingColorSpace){Kt.fromWorkingColorSpace(be.copy(this),e);const n=be.r,r=be.g,s=be.b,o=Math.max(n,r,s),a=Math.min(n,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case n:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-n)/h+2;break;case s:l=(n-r)/h+4;break}l/=6}return t.h=l,t.s=c,t.l=u,t}getRGB(t,e=Kt.workingColorSpace){return Kt.fromWorkingColorSpace(be.copy(this),e),t.r=be.r,t.g=be.g,t.b=be.b,t}getStyle(t=en){Kt.fromWorkingColorSpace(be.copy(this),t);const e=be.r,n=be.g,r=be.b;return t!==en?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(t,e,n){return this.getHSL(Rn),this.setHSL(Rn.h+t,Rn.s+e,Rn.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Rn),t.getHSL(Mr);const n=Zi(Rn.h,Mr.h,e),r=Zi(Rn.s,Mr.s,e),s=Zi(Rn.l,Mr.l,e);return this.setHSL(n,r,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,r=this.b,s=t.elements;return this.r=s[0]*e+s[3]*n+s[6]*r,this.g=s[1]*e+s[4]*n+s[7]*r,this.b=s[2]*e+s[5]*n+s[8]*r,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const be=new $t;$t.NAMES=Wl;let ih=0;class ls extends ni{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ih++}),this.uuid=sn(),this.name="",this.type="Material",this.blending=wi,this.side=On,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Zs,this.blendDst=js,this.blendEquation=Yn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new $t(0,0,0),this.blendAlpha=0,this.depthFunc=Qr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=so,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ai,this.stencilZFail=ai,this.stencilZPass=ai,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const r=this[e];if(r===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 48,940 bytes, lines 5-103
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(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).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(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).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(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).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(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).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!==wi&&(n.blending=this.blending),this.side!==On&&(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!==Zs&&(n.blendSrc=this.blendSrc),this.blendDst!==js&&(n.blendDst=this.blendDst),this.blendEquation!==Yn&&(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!==Qr&&(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!==so&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ai&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ai&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ai&&(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 r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(e){const s=r(t.textures),o=r(t.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const r=e.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=e[s].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class rs extends ls{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new $t(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 Sn,this.combine=bl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const ue=new L,yr=new ct;class Je{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=wa,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=_n,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return Ci("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[t+r]=e.array[n+r];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)yr.fromBufferAttribute(this,e),yr.applyMatrix3(t),this.setXY(e,yr.x,yr.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)ue.fromBufferAttribute(this,e),ue.applyMatrix3(t),this.setXYZ(e,ue.x,ue.y,ue.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)ue.fromBufferAttribute(this,e),ue.applyMatrix4(t),this.setXYZ(e,ue.x,ue.y,ue.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ue.fromBufferAttribute(this,e),ue.applyNormalMatrix(t),this.setXYZ(e,ue.x,ue.y,ue.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ue.fromBufferAttribute(this,e),ue.transformDirection(t),this.setXYZ(e,ue.x,ue.y,ue.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=je(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=jt(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=je(e,this.array)),e}setX(t,e){return this.normalized&&(e=jt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=je(e,this.array)),e}setY(t,e){return this.normalized&&(e=jt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=je(e,this.array)),e}setZ(t,e){return this.normalized&&(e=jt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=je(e,this.array)),e}setW(t,e){return this.normalized&&(e=jt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=jt(e,this.array),n=jt(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,r){return t*=this.itemSize,this.normalized&&(e=jt(e,this.array),n=jt(n,this.array),r=jt(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}setXYZW(t,e,n,r,s){return t*=this.itemSize,this.normalized&&(e=jt(e,this.array),n=jt(n,this.array),r=jt(r,this.array),s=jt(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==wa&&(t.usage=this.usage),t}}class Xl extends Je{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class ql extends Je{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class We extends Je{constructor(t,e,n){super(new Float32Array(t),e,n)}}let rh=0;const Be=new oe,Ls=new Oe,gi=new L,Ie=new Bn,ki=new Bn,ve=new L;class an extends ni{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:rh++}),this.uuid=sn(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(zl(t)?ql:Xl)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Vt().getNormalMatrix(t);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(t),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Be.makeRotationFromQuaternion(t),this.applyMatrix4(Be),this}rotateX(t){return Be.makeRotationX(t),this.applyMatrix4(Be),this}rotateY(t){return Be.makeRotationY(t),this.applyMatrix4(Be),this}rotateZ(t){return Be.makeRotationZ(t),this.applyMatrix4(Be),this}translate(t,e,n){return Be.makeTranslation(t,e,n),this.applyMatrix4(Be),this}scale(t,e,n){return Be.makeScale(t,e,n),this.applyMatrix4(Be),this}lookAt(t){return Ls.lookAt(t),Ls.updateMatrix(),this.applyMatrix4(Ls.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(gi).negate(),this.translate(gi.x,gi.y,gi.z),this}setFromPoints(t){const e=[];for(let n=0,r=t.length;n<r;n++){const s=t[n];e.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new We(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Bn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new L(-1/0,-1/0,-1/0),new L(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,r=e.length;n<r;n++){const s=e[n];Ie.setFromBufferAttribute(s),this.morphTargetsRelative?(ve.addVectors(this.boundingBox.min,Ie.min),this.boundingBox.expandByPoint(ve),ve.addVectors(this.boundingBox.max,Ie.max),this.boundingBox.expandByPoint(ve)):(this.boundingBox.expandByPoint(Ie.min),this.boundingBox.expandByPoint(Ie.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 sr);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new L,1/0);return}if(t){const n=this.boundingSphere.center;if(Ie.setFromBufferAttribute(t),e)for(let s=0,o=e.length;s<o;s++){const a=e[s];ki.setFromBufferAttribute(a),this.morphTargetsRelative?(ve.addVectors(Ie.min,ki.min),Ie.expandByPoint(ve),ve.addVectors(Ie.max,ki.max),Ie.expandByPoint(ve)):(Ie.expandByPoint(ki.min),Ie.expandByPoint(ki.max))}Ie.getCenter(n);let r=0;for(let s=0,o=t.count;s<o;s++)ve.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(ve));if(e)for(let s=0,o=e.length;s<o;s++){const a=e[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)ve.fromBufferAttribute(a,c),l&&(gi.fromBufferAttribute(t,c),ve.add(gi)),r=Math.max(r,n.distanceToSquared(ve))}this.boundingSphere.radius=Math.sqrt(r),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 t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.position,r=e.normal,s=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Je(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let U=0;U<n.count;U++)a[U]=new L,l[U]=new L;const c=new L,u=new L,h=new L,d=new ct,p=new ct,g=new ct,v=new L,m=new L;function f(U,b,M){c.fromBufferAttribute(n,U),u.fromBufferAttribute(n,b),h.fromBufferAttribute(n,M),d.fromBufferAttribute(s,U),p.fromBufferAttribute(s,b),g.fromBufferAttribute(s,M),u.sub(c),h.sub(c),p.sub(d),g.sub(d);const P=1/(p.x*g.y-g.x*p.y);isFinite(P)&&(v.copy(u).multiplyScalar(g.y).addScaledVector(h,-p.y).multiplyScalar(P),m.copy(h).multiplyScalar(p.x).addScaledVector(u,-g.x).multiplyScalar(P),a[U].add(v),a[b].add(v),a[M].add(v),l[U].add(m),l[b].add(m),l[M].add(m))}let A=this.groups;A.length===0&&(A=[{start:0,count:t.count}]);for(let U=0,b=A.length;U<b;++U){const M=A[U],P=M.start,Y=M.count;for(let G=P,N=P+Y;G<N;G+=3)f(t.getX(G+0),t.getX(G+1),t.getX(G+2))}const x=new L,T=new L,O=new L,C=new L;function R(U){O.fromBufferAttribute(r,U),C.copy(O);const b=a[U];x.copy(b),x.sub(O.multiplyScalar(O.dot(b))).normalize(),T.crossVectors(C,b);const P=T.dot(l[U])<0?-1:1;o.setXYZW(U,x.x,x.y,x.z,P)}for(let U=0,b=A.length;U<b;++U){const M=A[U],P=M.start,Y=M.count;for(let G=P,N=P+Y;G<N;G+=3)R(t.getX(G+0)),R(t.getX(G+1)),R(t.getX(G+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Je(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let d=0,p=n.count;d<p;d++)n.setXYZ(d,0,0,0);const r=new L,s=new L,o=new L,a=new L,l=new L,c=new L,u=new L,h=new L;if(t)for(let d=0,p=t.count;d<p;d+=3){const g=t.getX(d+0),v=t.getX(d+1),m=t.getX(d+2);r.fromBufferAttribute(e,g),s.fromBufferAttribute(e,v),o.fromBufferAttribute(e,m),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),a.fromBufferAttribute(n,g),l.fromBufferAttribute(n,v),c.fromBufferAttribute(n,m),a.add(u),l.add(u),c.add(u),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let d=0,p=e.count;d<p;d+=3)r.fromBufferAttribute(e,d+0),s.fromBufferAttribute(e,d+1),o.fromBufferAttribute(e,d+2),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)ve.fromBufferAttribute(t,e),ve.normalize(),t.setXYZ(e,ve.x,ve.y,ve.z)}toNonIndexed(){function t(a,l){const c=a.array,u=a.itemSize,h=a.normalized,d=new c.constructor(l.length*u);let p=0,g=0;for(let v=0,m=l.length;v<m;v++){a.isInterleavedBufferAttribute?p=l[v]*a.data.stride+a.offset:p=l[v]*u;for(let f=0;f<u;f++)d[g++]=c[p++]}return new Je(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new an,n=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=t(l,n);e.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){const d=c[u],p=t(d,n);l.push(p)}e.morphAttributes[a]=l}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const l in n){const c=n[l];t.data.attributes[l]=c.toJSON(t.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){const p=c[h];u.push(p.toJSON(t.data))}u.length>0&&(r[l]=u,s=!0)}s&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone(e));const r=t.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(e))}const s=t.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,p=h.length;d<p;d++)u.push(h[d].clone(e));this.morphAttributes[c]=u}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Mo=new oe,Vn=new Vl,Er=new sr,yo=new L,_i=new L,vi=new L,xi=new L,Ds=new L,Tr=new L,br=new ct,Ar=new ct,wr=new ct,Eo=new L,To=new L,bo=new L,Rr=new L,Cr=new L;class ke extends Oe{constructor(t=new an,e=new rs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){const r=e[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(t,e){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;e.fromBufferAttribute(r,t);const a=this.morphTargetInfluences;if(s&&a){Tr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],h=s[l];u!==0&&(Ds.fromBufferAttribute(h,t),o?Tr.addScaledVector(Ds,u):Tr.addScaledVector(Ds.sub(e),u))}e.add(Tr)}return e}raycast(t,e){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Er.copy(n.boundingSphere),Er.applyMatrix4(s),Vn.copy(t.ray).recast(t.near),!(Er.containsPoint(Vn.origin)===!1&&(Vn.intersectSphere(Er,yo)===null||Vn.origin.distanceToSquared(yo)>(t.far-t.near)**2))&&(Mo.copy(s).invert(),Vn.copy(t.ray).applyMatrix4(Mo),!(n.boundingBox!==null&&Vn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,Vn)))}_computeIntersections(t,e,n){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,v=d.length;g<v;g++){const m=d[g],f=o[m.materialIndex],A=Math.max(m.start,p.start),x=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let T=A,O=x;T<O;T+=3){const C=a.getX(T),R=a.getX(T+1),U=a.getX(T+2);r=Pr(this,f,t,n,c,u,h,C,R,U),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=m.materialIndex,e.push(r))}}else{const g=Math.max(0,p.start),v=Math.min(a.count,p.start+p.count);for(let m=g,f=v;m<f;m+=3){const A=a.getX(m),x=a.getX(m+1),T=a.getX(m+2);r=Pr(this,o,t,n,c,u,h,A,x,T),r&&(r.faceIndex=Math.floor(m/3),e.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let g=0,v=d.length;g<v;g++){const m=d[g],f=o[m.materialIndex],A=Math.max(m.start,p.start),x=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let T=A,O=x;T<O;T+=3){const C=T,R=T+1,U=T+2;r=Pr(this,f,t,n,c,u,h,C,R,U),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=m.materialIndex,e.push(r))}}else{const g=Math.max(0,p.start),v=Math.min(l.count,p.start+p.count);for(let m=g,f=v;m<f;m+=3){const A=m,x=m+1,T=m+2;r=Pr(this,o,t,n,c,u,h,A,x,T),r&&(r.faceIndex=Math.floor(m/3),e.push(r))}}}}function sh(i,t,e,n,r,s,o,a){let l;if(t.side===Pe?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,t.side===On,a),l===null)return null;Cr.copy(a),Cr.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(Cr);return c<e.near||c>e.far?null:{distance:c,point:Cr.clone(),object:i}}function Pr(i,t,e,n,r,s,o,a,l,c){i.getVertexPosition(a,_i),i.getVertexPosition(l,vi),i.getVertexPosition(c,xi);const u=sh(i,t,e,n,_i,vi,xi,Rr);if(u){r&&(br.fromBufferAttribute(r,a),Ar.fromBufferAttribute(r,l),wr.fromBufferAttribute(r,c),u.uv=nn.getInterpolation(Rr,_i,vi,xi,br,Ar,wr,new ct)),s&&(br.fromBufferAttribute(s,a),Ar.fromBufferAttribute(s,l),wr.fromBufferAttribute(s,c),u.uv1=nn.getInterpolation(Rr,_i,vi,xi,br,Ar,wr,new ct)),o&&(Eo.fromBufferAttribute(o,a),To.fromBufferAttribute(o,l),bo.fromBufferAttribute(o,c),u.normal=nn.getInterpolation(Rr,_i,vi,xi,Eo,To,bo,new L),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new L,materialIndex:0};nn.getNormal(_i,vi,xi,h.normal),u.face=h}return u}class ar extends an{constructor(t=1,e=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let d=0,p=0;g("z","y","x",-1,-1,n,e,t,o,s,0),g("z","y","x",1,-1,n,e,-t,o,s,1),g("x","z","y",1,1,t,n,e,r,o,2),g("x","z","y",1,-1,t,n,-e,r,o,3),g("x","y","z",1,-1,t,e,n,r,s,4),g("x","y","z",-1,-1,t,e,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new We(c,3)),this.setAttribute("normal",new We(u,3)),this.setAttribute("uv",new We(h,2));function g(v,m,f,A,x,T,O,C,R,U,b){const M=T/R,P=O/U,Y=T/2,G=O/2,N=C/2,K=R+1,k=U+1;let J=0,W=0;const ot=new L;for(let et=0;et<k;et++){const mt=et*P-G;for(let At=0;At<K;At++){const Pt=At*M-Y;ot[v]=Pt*A,ot[m]=mt*x,ot[f]=N,c.push(ot.x,ot.y,ot.z),ot[v]=0,ot[m]=0,ot[f]=C>0?1:-1,u.push(ot.x,ot.y,ot.z),h.push(At/R),h.push(1-et/U),J+=1}}for(let et=0;et<U;et++)for(let mt=0;mt<R;mt++){const At=d+mt+K*et,Pt=d+mt+K*(et+1),q=d+(mt+1)+K*(et+1),nt=d+(mt+1)+K*et;l.push(At,Pt,nt),l.push(Pt,q,nt),W+=6}a.addGroup(p,W,b),p+=W,d+=J}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ar(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Oi(i){const t={};for(const e in i){t[e]={};for(const n in i[e]){const r=i[e][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=r.clone():Array.isArray(r)?t[e][n]=r.slice():t[e][n]=r}}return t}function we(i){const t={};for(let e=0;e<i.length;e++){const n=Oi(i[e]);for(const r in n)t[r]=n[r]}return t}function ah(i){const t=[];for(let e=0;e<i.length;e++)t.push(i[e].clone());return t}function Yl(i){const t=i.getRenderTarget();return t===null?i.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Kt.workingColorSpace}const ka={clone:Oi,merge:we};var oh=`void main() {
6	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7}`,lh=`void main() {
8	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9}`;class Mn extends ls{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=oh,this.fragmentShader=lh,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,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Oi(t.uniforms),this.uniformsGroups=ah(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?e.uniforms[r]={type:"t",value:o.toJSON(t).uuid}:o&&o.isColor?e.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?e.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?e.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?e.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?e.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?e.uniforms[r]={type:"m4",value:o.toArray()}:e.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class Kl extends Oe{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new oe,this.projectionMatrix=new oe,this.projectionMatrixInverse=new oe,this.coordinateSystem=vn}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Cn=new L,Ao=new ct,wo=new ct;class ze extends Kl{constructor(t=50,e=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=Qi*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(Ki*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return Qi*2*Math.atan(Math.tan(Ki*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Cn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Cn.x,Cn.y).multiplyScalar(-t/Cn.z),Cn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Cn.x,Cn.y).multiplyScalar(-t/Cn.z)}getViewSize(t,e){return this.getViewBounds(t,Ao,wo),e.subVectors(wo,Ao)}setViewOffset(t,e,n,r,s,o){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(Ki*.5*this.fov)/this.zoom,n=2*e,r=this.aspect*n,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,e-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Si=-90,Mi=1;class ch extends Oe{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new ze(Si,Mi,t,e);r.layers=this.layers,this.add(r);const s=new ze(Si,Mi,t,e);s.layers=this.layers,this.add(s);const o=new ze(Si,Mi,t,e);o.layers=this.layers,this.add(o);const a=new ze(Si,Mi,t,e);a.layers=this.layers,this.add(a);const l=new ze(Si,Mi,t,e);l.layers=this.layers,this.add(l);const c=new ze(Si,Mi,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,r,s,o,a,l]=e;for(const c of e)this.remove(c);if(t===vn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(t===is)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,h=t.getRenderTarget(),d=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),g=t.xr.enabled;t.xr.enabled=!1;const v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,r),t.render(e,s),t.setRenderTarget(n,1,r),t.render(e,o),t.setRenderTarget(n,2,r),t.render(e,a),t.setRenderTarget(n,3,r),t.render(e,l),t.setRenderTarget(n,4,r),t.render(e,c),n.texture.generateMipmaps=v,t.setRenderTarget(n,5,r),t.render(e,u),t.setRenderTarget(h,d,p),t.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class Zl extends Re{constructor(t,e,n,r,s,o,a,l,c,u){t=t!==void 0?t:[],e=e!==void 0?e:Di,super(t,e,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class uh extends Qn{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},r=[n,n,n,n,n,n];this.texture=new Zl(r,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:Ze}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;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			`},r=new ar(5,5,5),s=new Mn({name:"CubemapFromEquirect",uniforms:Oi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Pe,blending:In});s.uniforms.tEquirect.value=e;const o=new ke(r,s),a=e.minFilter;return e.minFilter===jn&&(e.minFilter=Ze),new ch(1,10,this).update(t,o),e.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,n,r){const s=t.getRenderTarget();for(let o=0;o<6;o++)t.setRenderTarget(this,o),t.clear(e,n,r);t.setRenderTarget(s)}}const Us=new L,hh=new L,dh=new Vt;class Pn{constructor(t=new L(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const r=Us.subVectors(n,e).cross(hh.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Us),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;const s=-(t.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:e.copy(t.start).addScaledVector(n,s)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||dh.getNormalMatrix(t),r=this.coplanarPoint(Us).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const kn=new sr,Lr=new L;class jl{constructor(t=new Pn,e=new Pn,n=new Pn,r=new Pn,s=new Pn,o=new Pn){this.planes=[t,e,n,r,s,o]}set(t,e,n,r,s,o){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=vn){const n=this.planes,r=t.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],h=r[6],d=r[7],p=r[8],g=r[9],v=r[10],m=r[11],f=r[12],A=r[13],x=r[14],T=r[15];if(n[0].setComponents(l-s,d-c,m-p,T-f).normalize(),n[1].setComponents(l+s,d+c,m+p,T+f).normalize(),n[2].setComponents(l+o,d+u,m+g,T+A).normalize(),n[3].setComponents(l-o,d-u,m-g,T-A).normalize(),n[4].setComponents(l-a,d-h,m-v,T-x).normalize(),e===vn)n[5].setComponents(l+a,d+h,m+v,T+x).normalize();else if(e===is)n[5].setComponents(a,h,v,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),kn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),kn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(kn)}intersectsSprite(t){return kn.center.set(0,0,0),kn.radius=.7071067811865476,kn.applyMatrix4(t.matrixWorld),this.intersectsSphere(kn)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let s=0;s<6;s++)if(e[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const r=e[n];if(Lr.x=r.normal.x>0?t.max.x:t.min.x,Lr.y=r.normal.y>0?t.max.y:t.min.y,Lr.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Lr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function $l(){let i=null,t=!1,e=null,n=null;function r(s,o){e(s,o),n=i.requestAnimationFrame(r)}return{start:function(){t!==!0&&e!==null&&(n=i.requestAnimationFrame(r),t=!0)},stop:function(){i.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(s){e=s},setContext:function(s){i=s}}}function fh(i){const t=new WeakMap;function e(a,l){const c=a.array,u=a.usage,h=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=i.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=i.HALF_FLOAT:p=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=i.SHORT;else if(c instanceof Uint32Array)p=i.UNSIGNED_INT;else if(c instanceof Int32Array)p=i.INT;else if(c instanceof Int8Array)p=i.BYTE;else if(c instanceof Uint8Array)p=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:h}}function n(a,l,c){const u=l.array,h=l._updateRange,d=l.updateRanges;if(i.bindBuffer(c,a),h.count===-1&&d.length===0&&i.bufferSubData(c,0,u),d.length!==0){for(let p=0,g=d.length;p<g;p++){const v=d[p];i.bufferSubData(c,v.start*u.BYTES_PER_ELEMENT,u,v.start,v.count)}l.clearUpdateRanges()}h.count!==-1&&(i.bufferSubData(c,h.offset*u.BYTES_PER_ELEMENT,u,h.offset,h.count),h.count=-1),l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),t.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=t.get(a);l&&(i.deleteBuffer(l.buffer),t.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=t.get(a);(!u||u.version<a.version)&&t.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=t.get(a);if(c===void 0)t.set(a,e(a,l));else if(c.version<a.version){if(c.size!==a.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(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}class or extends an{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};const s=t/2,o=e/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,h=t/a,d=e/l,p=[],g=[],v=[],m=[];for(let f=0;f<u;f++){const A=f*d-o;for(let x=0;x<c;x++){const T=x*h-s;g.push(T,-A,0),v.push(0,0,1),m.push(x/a),m.push(1-f/l)}}for(let f=0;f<l;f++)for(let A=0;A<a;A++){const x=A+c*f,T=A+c*(f+1),O=A+1+c*(f+1),C=A+1+c*f;p.push(x,T,C),p.push(T,O,C)}this.setIndex(p),this.setAttribute("position",new We(g,3)),this.setAttribute("normal",new We(v,3)),this.setAttribute("uv",new We(m,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new or(t.width,t.height,t.widthSegments,t.heightSegments)}}var ph=`#ifdef USE_ALPHAHASH
45	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
46#endif`,mh=`#ifdef USE_ALPHAHASH
47	const float ALPHA_HASH_SCALE = 0.05;
48	float hash2D( vec2 value ) {
49		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
50	}
51	float hash3D( vec3 value ) {
52		return hash2D( vec2( hash2D( value.xy ), value.z ) );
53	}
54	float getAlphaHashThreshold( vec3 position ) {
55		float maxDeriv = max(
56			length( dFdx( position.xyz ) ),
57			length( dFdy( position.xyz ) )
58		);
59		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
60		vec2 pixScales = vec2(
61			exp2( floor( log2( pixScale ) ) ),
62			exp2( ceil( log2( pixScale ) ) )
63		);
64		vec2 alpha = vec2(
65			hash3D( floor( pixScales.x * position.xyz ) ),
66			hash3D( floor( pixScales.y * position.xyz ) )
67		);
68		float lerpFactor = fract( log2( pixScale ) );
69		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
70		float a = min( lerpFactor, 1.0 - lerpFactor );
71		vec3 cases = vec3(
72			x * x / ( 2.0 * a * ( 1.0 - a ) ),
73			( x - 0.5 * a ) / ( 1.0 - a ),
74			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
75		);
76		float threshold = ( x < ( 1.0 - a ) )
77			? ( ( x < a ) ? cases.x : cases.y )
78			: cases.z;
79		return clamp( threshold , 1.0e-6, 1.0 );
80	}
81#endif`,gh=`#ifdef USE_ALPHAMAP
82	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
83#endif`,_h=`#ifdef USE_ALPHAMAP
84	uniform sampler2D alphaMap;
85#endif`,vh=`#ifdef USE_ALPHATEST
86	#ifdef ALPHA_TO_COVERAGE
87	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
88	if ( diffuseColor.a == 0.0 ) discard;
89	#else
90	if ( diffuseColor.a < alphaTest ) discard;
91	#endif
92#endif`,xh=`#ifdef USE_ALPHATEST
93	uniform float alphaTest;
94#endif`,Sh=`#ifdef USE_AOMAP
95	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
96	reflectedLight.indirectDiffuse *= ambientOcclusion;
97	#if defined( USE_CLEARCOAT ) 
98		clearcoatSpecularIndirect *= ambientOcclusion;
99	#endif
100	#if defined( USE_SHEEN ) 
101		sheenSpecularIndirect *= ambientOcclusion;
102	#endif
103	#if defined( USE_ENVMAP ) && defined( STANDARD )
104		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
105		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
106	#endif
107#endif`,Mh=`#ifdef USE_AOMAP
108	uniform sampler2D aoMap;
109	uniform float aoMapIntensity;
110#endif`,yh=`#ifdef USE_BATCHING
111	#if ! defined( GL_ANGLE_multi_draw )
112	#define gl_DrawID _gl_DrawID
113	uniform int _gl_DrawID;
114	#endif
115	uniform highp sampler2D batchingTexture;
116	uniform highp usampler2D batchingIdTexture;
117	mat4 getBatchingMatrix( const in float i ) {
118		int size = textureSize( batchingTexture, 0 ).x;
119		int j = int( i ) * 4;
120		int x = j % size;
121		int y = j / size;
122		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
123		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
124		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
125		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
126		return mat4( v1, v2, v3, v4 );
127	}
128	float getIndirectIndex( const in int i ) {
129		int size = textureSize( batchingIdTexture, 0 ).x;
130		int x = i % size;
131		int y = i / size;
132		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
133	}
134#endif
135#ifdef USE_BATCHING_COLOR
136	uniform sampler2D batchingColorTexture;
137	vec3 getBatchingColor( const in float i ) {
138		int size = textureSize( batchingColorTexture, 0 ).x;
139		int j = int( i );
140		int x = j % size;
141		int y = j / size;
142		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
143	}
144#endif`,Eh=`#ifdef USE_BATCHING
145	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
146#endif`,Th=`vec3 transformed = vec3( position );
147#ifdef USE_ALPHAHASH
148	vPosition = vec3( position );
149#endif`,bh=`vec3 objectNormal = vec3( normal );
150#ifdef USE_TANGENT
151	vec3 objectTangent = vec3( tangent.xyz );
152#endif`,Ah=`float G_BlinnPhong_Implicit( ) {
153	return 0.25;
154}
155float D_BlinnPhong( const in float shininess, const in float dotNH ) {
156	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
157}
158vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
159	vec3 halfDir = normalize( lightDir + viewDir );
160	float dotNH = saturate( dot( normal, halfDir ) );
161	float dotVH = saturate( dot( viewDir, halfDir ) );
162	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
163	float G = G_BlinnPhong_Implicit( );
164	float D = D_BlinnPhong( shininess, dotNH );
165	return F * ( G * D );
166} // validated`,wh=`#ifdef USE_IRIDESCENCE
167	const mat3 XYZ_TO_REC709 = mat3(
168		 3.2404542, -0.9692660,  0.0556434,
169		-1.5371385,  1.8760108, -0.2040259,
170		-0.4985314,  0.0415560,  1.0572252
171	);
172	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
173		vec3 sqrtF0 = sqrt( fresnel0 );
174		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
175	}
176	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
177		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
178	}
179	float IorToFresnel0( float transmittedIor, float incidentIor ) {
180		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
181	}
182	vec3 evalSensitivity( float OPD, vec3 shift ) {
183		float phase = 2.0 * PI * OPD * 1.0e-9;
184		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
185		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
186		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
187		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
188		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 ) );
189		xyz /= 1.0685e-7;
190		vec3 rgb = XYZ_TO_REC709 * xyz;
191		return rgb;
192	}
193	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
194		vec3 I;
195		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
196		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
197		float cosTheta2Sq = 1.0 - sinTheta2Sq;
198		if ( cosTheta2Sq < 0.0 ) {
199			return vec3( 1.0 );
200		}
201		float cosTheta2 = sqrt( cosTheta2Sq );
202		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
203		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
204		float T121 = 1.0 - R12;
205		float phi12 = 0.0;
206		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
207		float phi21 = PI - phi12;
208		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
209		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
210		vec3 phi23 = vec3( 0.0 );
211		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
212		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
213		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
214		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
215		vec3 phi = vec3( phi21 ) + phi23;
216		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
217		vec3 r123 = sqrt( R123 );
218		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
219		vec3 C0 = R12 + Rs;
220		I = C0;
221		vec3 Cm = Rs - T121;
222		for ( int m = 1; m <= 2; ++ m ) {
223			Cm *= r123;
224			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
225			I += Cm * Sm;
226		}
227		return max( I, vec3( 0.0 ) );
228	}
229#endif`,Rh=`#ifdef USE_BUMPMAP
230	uniform sampler2D bumpMap;
231	uniform float bumpScale;
232	vec2 dHdxy_fwd() {
233		vec2 dSTdx = dFdx( vBumpMapUv );
234		vec2 dSTdy = dFdy( vBumpMapUv );
235		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
236		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
237		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
238		return vec2( dBx, dBy );
239	}
240	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
241		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
242		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
243		vec3 vN = surf_norm;
244		vec3 R1 = cross( vSigmaY, vN );
245		vec3 R2 = cross( vN, vSigmaX );
246		float fDet = dot( vSigmaX, R1 ) * faceDirection;
247		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
248		return normalize( abs( fDet ) * surf_norm - vGrad );
249	}
250#endif`,Ch=`#if NUM_CLIPPING_PLANES > 0
251	vec4 plane;
252	#ifdef ALPHA_TO_COVERAGE
253		float distanceToPlane, distanceGradient;
254		float clipOpacity = 1.0;
255		#pragma unroll_loop_start
256		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
257			plane = clippingPlanes[ i ];
258			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
259			distanceGradient = fwidth( distanceToPlane ) / 2.0;
260			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
261			if ( clipOpacity == 0.0 ) discard;
262		}
263		#pragma unroll_loop_end
264		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
265			float unionClipOpacity = 1.0;
266			#pragma unroll_loop_start
267			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
268				plane = clippingPlanes[ i ];
269				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
270				distanceGradient = fwidth( distanceToPlane ) / 2.0;
271				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
272			}
273			#pragma unroll_loop_end
274			clipOpacity *= 1.0 - unionClipOpacity;
275		#endif
276		diffuseColor.a *= clipOpacity;
277		if ( diffuseColor.a == 0.0 ) discard;
278	#else
279		#pragma unroll_loop_start
280		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
281			plane = clippingPlanes[ i ];
282			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
283		}
284		#pragma unroll_loop_end
285		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
286			bool clipped = true;
287			#pragma unroll_loop_start
288			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
289				plane = clippingPlanes[ i ];
290				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
291			}
292			#pragma unroll_loop_end
293			if ( clipped ) discard;
294		#endif
295	#endif
296#endif`,Ph=`#if NUM_CLIPPING_PLANES > 0
297	varying vec3 vClipPosition;
298	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
299#endif`,Lh=`#if NUM_CLIPPING_PLANES > 0
300	varying vec3 vClipPosition;
301#endif`,Dh=`#if NUM_CLIPPING_PLANES > 0
302	vClipPosition = - mvPosition.xyz;
303#endif`,Uh=`#if defined( USE_COLOR_ALPHA )
304	diffuseColor *= vColor;
305#elif defined( USE_COLOR )
306	diffuseColor.rgb *= vColor;
307#endif`,Ih=`#if defined( USE_COLOR_ALPHA )
308	varying vec4 vColor;
309#elif defined( USE_COLOR )
310	varying vec3 vColor;
311#endif`,Nh=`#if defined( USE_COLOR_ALPHA )
312	varying vec4 vColor;
313#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
314	varying vec3 vColor;
315#endif`,Oh=`#if defined( USE_COLOR_ALPHA )
316	vColor = vec4( 1.0 );
317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
318	vColor = vec3( 1.0 );
319#endif
320#ifdef USE_COLOR
321	vColor *= color;
322#endif
323#ifdef USE_INSTANCING_COLOR
324	vColor.xyz *= instanceColor.xyz;
325#endif
326#ifdef USE_BATCHING_COLOR
327	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
328	vColor.xyz *= batchingColor.xyz;
329#endif`,Fh=`#define PI 3.141592653589793
330#define PI2 6.283185307179586
331#define PI_HALF 1.5707963267948966
332#define RECIPROCAL_PI 0.3183098861837907
333#define RECIPROCAL_PI2 0.15915494309189535
334#define EPSILON 1e-6
335#ifndef saturate
336#define saturate( a ) clamp( a, 0.0, 1.0 )
337#endif
338#define whiteComplement( a ) ( 1.0 - saturate( a ) )
339float pow2( const in float x ) { return x*x; }
340vec3 pow2( const in vec3 x ) { return x*x; }
341float pow3( const in float x ) { return x*x*x; }
342float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
343float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
344float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
345highp float rand( const in vec2 uv ) {
346	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
347	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
348	return fract( sin( sn ) * c );
349}
350#ifdef HIGH_PRECISION
351	float precisionSafeLength( vec3 v ) { return length( v ); }
352#else
353	float precisionSafeLength( vec3 v ) {
354		float maxComponent = max3( abs( v ) );
355		return length( v / maxComponent ) * maxComponent;
356	}
357#endif
358struct IncidentLight {
359	vec3 color;
360	vec3 direction;
361	bool visible;
362};
363struct ReflectedLight {
364	vec3 directDiffuse;
365	vec3 directSpecular;
366	vec3 indirectDiffuse;
367	vec3 indirectSpecular;
368};
369#ifdef USE_ALPHAHASH
370	varying vec3 vPosition;
371#endif
372vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
373	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
374}
375vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
376	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
377}
378mat3 transposeMat3( const in mat3 m ) {
379	mat3 tmp;
380	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
381	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
382	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
383	return tmp;
384}
385bool isPerspectiveMatrix( mat4 m ) {
386	return m[ 2 ][ 3 ] == - 1.0;
387}
388vec2 equirectUv( in vec3 dir ) {
389	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
390	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
391	return vec2( u, v );
392}
393vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
394	return RECIPROCAL_PI * diffuseColor;
395}
396vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
397	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
398	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
399}
400float F_Schlick( const in float 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} // validated`,Bh=`#ifdef ENVMAP_TYPE_CUBE_UV
404	#define cubeUV_minMipLevel 4.0
405	#define cubeUV_minTileSize 16.0
406	float getFace( vec3 direction ) {
407		vec3 absDirection = abs( direction );
408		float face = - 1.0;
409		if ( absDirection.x > absDirection.z ) {
410			if ( absDirection.x > absDirection.y )
411				face = direction.x > 0.0 ? 0.0 : 3.0;
412			else
413				face = direction.y > 0.0 ? 1.0 : 4.0;
414		} else {
415			if ( absDirection.z > absDirection.y )
416				face = direction.z > 0.0 ? 2.0 : 5.0;
417			else
418				face = direction.y > 0.0 ? 1.0 : 4.0;
419		}
420		return face;
421	}
422	vec2 getUV( vec3 direction, float face ) {
423		vec2 uv;
424		if ( face == 0.0 ) {
425			uv = vec2( direction.z, direction.y ) / abs( direction.x );
426		} else if ( face == 1.0 ) {
427			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
428		} else if ( face == 2.0 ) {
429			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
430		} else if ( face == 3.0 ) {
431			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
432		} else if ( face == 4.0 ) {
433			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
434		} else {
435			uv = vec2( direction.x, direction.y ) / abs( direction.z );
436		}
437		return 0.5 * ( uv + 1.0 );
438	}
439	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
440		float face = getFace( direction );
441		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
442		mipInt = max( mipInt, cubeUV_minMipLevel );
443		float faceSize = exp2( mipInt );
444		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
445		if ( face > 2.0 ) {
446			uv.y += faceSize;
447			face -= 3.0;
448		}
449		uv.x += face * faceSize;
450		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
451		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
452		uv.x *= CUBEUV_TEXEL_WIDTH;
453		uv.y *= CUBEUV_TEXEL_HEIGHT;
454		#ifdef texture2DGradEXT
455			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
456		#else
457			return texture2D( envMap, uv ).rgb;
458		#endif
459	}
460	#define cubeUV_r0 1.0
461	#define cubeUV_m0 - 2.0
462	#define cubeUV_r1 0.8
463	#define cubeUV_m1 - 1.0
464	#define cubeUV_r4 0.4
465	#define cubeUV_m4 2.0
466	#define cubeUV_r5 0.305
467	#define cubeUV_m5 3.0
468	#define cubeUV_r6 0.21
469	#define cubeUV_m6 4.0
470	float roughnessToMip( float roughness ) {
471		float mip = 0.0;
472		if ( roughness >= cubeUV_r1 ) {
473			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
474		} else if ( roughness >= cubeUV_r4 ) {
475			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
476		} else if ( roughness >= cubeUV_r5 ) {
477			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
478		} else if ( roughness >= cubeUV_r6 ) {
479			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
480		} else {
481			mip = - 2.0 * log2( 1.16 * roughness );		}
482		return mip;
483	}
484	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
485		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
486		float mipF = fract( mip );
487		float mipInt = floor( mip );
488		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
489		if ( mipF == 0.0 ) {
490			return vec4( color0, 1.0 );
491		} else {
492			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
493			return vec4( mix( color0, color1, mipF ), 1.0 );
494		}
495	}
496#endif`,zh=`vec3 transformedNormal = objectNormal;
497#ifdef USE_TANGENT
498	vec3 transformedTangent = objectTangent;
499#endif
500#ifdef USE_BATCHING
501	mat3 bm = mat3( batchingMatrix );
502	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
503	transformedNormal = bm * transformedNormal;
504	#ifdef USE_TANGENT
505		transformedTangent = bm * transformedTangent;
506	#endif
507#endif
508#ifdef USE_INSTANCING
509	mat3 im = mat3( instanceMatrix );
510	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
511	transformedNormal = im * transformedNormal;
512	#ifdef USE_TANGENT
513		transformedTangent = im * transformedTangent;
514	#endif
515#endif
516transformedNormal = normalMatrix * transformedNormal;
517#ifdef FLIP_SIDED
518	transformedNormal = - transformedNormal;
519#endif
520#ifdef USE_TANGENT
521	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
522	#ifdef FLIP_SIDED
523		transformedTangent = - transformedTangent;
524	#endif
525#endif`,Hh=`#ifdef USE_DISPLACEMENTMAP
526	uniform sampler2D displacementMap;
527	uniform float displacementScale;
528	uniform float displacementBias;
529#endif`,Gh=`#ifdef USE_DISPLACEMENTMAP
530	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
530placementBias );
531#endif`,Vh=`#ifdef USE_EMISSIVEMAP
532	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
533	totalEmissiveRadiance *= emissiveColor.rgb;
534#endif`,kh=`#ifdef USE_EMISSIVEMAP
535	uniform sampler2D emissiveMap;
536#endif`,Wh="gl_FragColor = linearToOutputTexel( gl_FragColor );",Xh=`
537const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
538	vec3( 0.8224621, 0.177538, 0.0 ),
539	vec3( 0.0331941, 0.9668058, 0.0 ),
540	vec3( 0.0170827, 0.0723974, 0.9105199 )
541);
542const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
543	vec3( 1.2249401, - 0.2249404, 0.0 ),
544	vec3( - 0.0420569, 1.0420571, 0.0 ),
545	vec3( - 0.0196376, - 0.0786361, 1.0982735 )
546);
547vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
548	return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
549}
550vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
551	return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
552}
553vec4 LinearTransferOETF( in vec4 value ) {
554	return value;
555}
556vec4 sRGBTransferOETF( in vec4 value ) {
557	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 );
558}`,qh=`#ifdef USE_ENVMAP
559	#ifdef ENV_WORLDPOS
560		vec3 cameraToFrag;
561		if ( isOrthographic ) {
562			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
563		} else {
564			cameraToFrag = normalize( vWorldPosition - cameraPosition );
565		}
566		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
567		#ifdef ENVMAP_MODE_REFLECTION
568			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
569		#else
570			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
571		#endif
572	#else
573		vec3 reflectVec = vReflect;
574	#endif
575	#ifdef ENVMAP_TYPE_CUBE
576		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
577	#else
578		vec4 envColor = vec4( 0.0 );
579	#endif
580	#ifdef ENVMAP_BLENDING_MULTIPLY
581		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
582	#elif defined( ENVMAP_BLENDING_MIX )
583		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
584	#elif defined( ENVMAP_BLENDING_ADD )
585		outgoingLight += envColor.xyz * specularStrength * reflectivity;
586	#endif
587#endif`,Yh=`#ifdef USE_ENVMAP
588	uniform float envMapIntensity;
589	uniform float flipEnvMap;
590	uniform mat3 envMapRotation;
591	#ifdef ENVMAP_TYPE_CUBE
592		uniform samplerCube envMap;
593	#else
594		uniform sampler2D envMap;
595	#endif
596	
597#endif`,Kh=`#ifdef USE_ENVMAP
598	uniform float reflectivity;
599	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
600		#define ENV_WORLDPOS
601	#endif
602	#ifdef ENV_WORLDPOS
603		varying vec3 vWorldPosition;
604		uniform float refractionRatio;
605	#else
606		varying vec3 vReflect;
607	#endif
608#endif`,Zh=`#ifdef USE_ENVMAP
609	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
610		#define ENV_WORLDPOS
611	#endif
612	#ifdef ENV_WORLDPOS
613		
614		varying vec3 vWorldPosition;
615	#else
616		varying vec3 vReflect;
617		uniform float refractionRatio;
618	#endif
619#endif`,jh=`#ifdef USE_ENVMAP
620	#ifdef ENV_WORLDPOS
621		vWorldPosition = worldPosition.xyz;
622	#else
623		vec3 cameraToVertex;
624		if ( isOrthographic ) {
625			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
626		} else {
627			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
628		}
629		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
630		#ifdef ENVMAP_MODE_REFLECTION
631			vReflect = reflect( cameraToVertex, worldNormal );
632		#else
633			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
634		#endif
635	#endif
636#endif`,$h=`#ifdef USE_FOG
637	vFogDepth = - mvPosition.z;
638#endif`,Jh=`#ifdef USE_FOG
639	varying float vFogDepth;
640#endif`,Qh=`#ifdef USE_FOG
641	#ifdef FOG_EXP2
642		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
643	#else
644		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
645	#endif
646	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
647#endif`,td=`#ifdef USE_FOG
648	uniform vec3 fogColor;
649	varying float vFogDepth;
650	#ifdef FOG_EXP2
651		uniform float fogDensity;
652	#else
653		uniform float fogNear;
654		uniform float fogFar;
655	#endif
656#endif`,ed=`#ifdef USE_GRADIENTMAP
657	uniform sampler2D gradientMap;
658#endif
659vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
660	float dotNL = dot( normal, lightDirection );
661	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
662	#ifdef USE_GRADIENTMAP
663		return vec3( texture2D( gradientMap, coord ).r );
664	#else
665		vec2 fw = fwidth( coord ) * 0.5;
666		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
667	#endif
668}`,nd=`#ifdef USE_LIGHTMAP
669	uniform sampler2D lightMap;
670	uniform float lightMapIntensity;
671#endif`,id=`LambertMaterial material;
672material.diffuseColor = diffuseColor.rgb;
673material.specularStrength = specularStrength;`,rd=`varying vec3 vViewPosition;
674struct LambertMaterial {
675	vec3 diffuseColor;
676	float specularStrength;
677};
678void 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 ) {
679	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
680	vec3 irradiance = dotNL * directLight.color;
681	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
682}
683void 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 ) {
684	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
685}
686#define RE_Direct				RE_Direct_Lambert
687#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,sd=`uniform bool receiveShadow;
688uniform vec3 ambientLightColor;
689#if defined( USE_LIGHT_PROBES )
690	uniform vec3 lightProbe[ 9 ];
691#endif
692vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
693	float x = normal.x, y = normal.y, z = normal.z;
694	vec3 result = shCoefficients[ 0 ] * 0.886227;
695	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
696	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
697	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
698	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
699	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
700	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
701	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
702	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
703	return result;
704}
705vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
706	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
707	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
708	return irradiance;
709}
710vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
711	vec3 irradiance = ambientLightColor;
712	return irradiance;
713}
714float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
715	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
716	if ( cutoffDistance > 0.0 ) {
717		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
718	}
719	return distanceFalloff;
720}
721float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
722	return smoothstep( coneCosine, penumbraCosine, angleCosine );
723}
724#if NUM_DIR_LIGHTS > 0
725	struct DirectionalLight {
726		vec3 direction;
727		vec3 color;
728	};
729	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
730	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
731		light.color = directionalLight.color;
732		light.direction = directionalLight.direction;
733		light.visible = true;
734	}
735#endif
736#if NUM_POINT_LIGHTS > 0
737	struct PointLight {
738		vec3 position;
739		vec3 color;
740		float distance;
741		float decay;
742	};
743	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
744	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
745		vec3 lVector = pointLight.position - geometryPosition;
746		light.direction = normalize( lVector );
747		float lightDistance = length( lVector );
748		light.color = pointLight.color;
749		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
750		light.visible = ( light.color != vec3( 0.0 ) );
751	}
752#endif
753#if NUM_SPOT_LIGHTS > 0
754	struct SpotLight {
755		vec3 position;
756		vec3 direction;
757		vec3 color;
758		float distance;
759		float decay;
760		float coneCos;
761		float penumbraCos;
762	};
763	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
764	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
765		vec3 lVector = spotLight.position - geometryPosition;
766		light.direction = normalize( lVector );
767		float angleCos = dot( light.direction, spotLight.direction );
768		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
769		if ( spotAttenuation > 0.0 ) {
770			float lightDistance = length( lVector );
771			light.color = spotLight.color * spotAttenuation;
772			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
773			light.visible = ( light.color != vec3( 0.0 ) );
774		} else {
775			light.color = vec3( 0.0 );
776			light.visible = false;
777		}
778	}
779#endif
780#if NUM_RECT_AREA_LIGHTS > 0
781	struct RectAreaLight {
782		vec3 color;
783		vec3 position;
784		vec3 halfWidth;
785		vec3 halfHeight;
786	};
787	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
788	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
789#endif
790#if NUM_HEMI_LIGHTS > 0
791	struct HemisphereLight {
792		vec3 direction;
793		vec3 skyColor;
794		vec3 groundColor;
795	};
796	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
797	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
798		float dotNL = dot( normal, hemiLight.direction );
799		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
800		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
801		return irradiance;
802	}
803#endif`,ad=`#ifdef USE_ENVMAP
804	vec3 getIBLIrradiance( const in vec3 normal ) {
805		#ifdef ENVMAP_TYPE_CUBE_UV
806			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
807			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
808			return PI * envMapColor.rgb * envMapIntensity;
809		#else
810			return vec3( 0.0 );
811		#endif
812	}
813	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
814		#ifdef ENVMAP_TYPE_CUBE_UV
815			vec3 reflectVec = reflect( - viewDir, normal );
816			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
817			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
818			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
819			return envMapColor.rgb * envMapIntensity;
820		#else
821			return vec3( 0.0 );
822		#endif
823	}
824	#ifdef USE_ANISOTROPY
825		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
826			#ifdef ENVMAP_TYPE_CUBE_UV
827				vec3 bentNormal = cross( bitangent, viewDir );
828				bentNormal = normalize( cross( bentNormal, bitangent ) );
829				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
830				return getIBLRadiance( viewDir, bentNormal, roughness );
831			#else
832				return vec3( 0.0 );
833			#endif
834		}
835	#endif
836#endif`,od=`ToonMaterial material;
837material.diffuseColor = diffuseColor.rgb;`,ld=`varying vec3 vViewPosition;
838struct ToonMaterial {
839	vec3 diffuseColor;
840};
841void 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 ) {
842	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
843	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
844}
845void 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 ) {
846	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
847}
848#define RE_Direct				RE_Direct_Toon
849#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,cd=`BlinnPhongMaterial material;
850material.diffuseColor = diffuseColor.rgb;
851material.specularColor = specular;
852material.specularShininess = shininess;
853material.specularStrength = specularStrength;`,ud=`varying vec3 vViewPosition;
854struct BlinnPhongMaterial {
855	vec3 diffuseColor;
856	vec3 specularColor;
857	float specularShininess;
858	float specularStrength;
859};
860void 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 ) {
861	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
862	vec3 irradiance = dotNL * directLight.color;
863	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
864	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
865}
866void 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 ) {
867	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
868}
869#define RE_Direct				RE_Direct_BlinnPhong
870#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,hd=`PhysicalMaterial material;
871material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
872vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
873float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
874material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
875material.roughness = min( material.roughness, 1.0 );
876#ifdef IOR
877	material.ior = ior;
878	#ifdef USE_SPECULAR
879		float specularIntensityFactor = specularIntensity;
880		vec3 specularColorFactor = specularColor;
881		#ifdef USE_SPECULAR_COLORMAP
882			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
883		#endif
884		#ifdef USE_SPECULAR_INTENSITYMAP
885			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
886		#endif
887		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
888	#else
889		float specularIntensityFactor = 1.0;
890		vec3 specularColorFactor = vec3( 1.0 );
891		material.specularF90 = 1.0;
892	#endif
893	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
894#else
895	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
896	material.specularF90 = 1.0;
897#endif
898#ifdef USE_CLEARCOAT
899	material.clearcoat = clearcoat;
900	material.clearcoatRoughness = clearcoatRoughness;
901	material.clearcoatF0 = vec3( 0.04 );
902	material.clearcoatF90 = 1.0;
903	#ifdef USE_CLEARCOATMAP
904		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
905	#endif
906	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
907		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
908	#endif
909	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
910	material.clearcoatRoughness += geometryRoughness;
911	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
912#endif
913#ifdef USE_DISPERSION
914	material.dispersion = dispersion;
915#endif
916#ifdef USE_IRIDESCENCE
917	material.iridescence = iridescence;
918	material.iridescenceIOR = iridescenceIOR;
919	#ifdef USE_IRIDESCENCEMAP
920		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
921	#endif
922	#ifdef USE_IRIDESCENCE_THICKNESSMAP
923		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
924	#else
925		material.iridescenceThickness = iridescenceThicknessMaximum;
926	#endif
927#endif
928#ifdef USE_SHEEN
929	material.sheenColor = sheenColor;
930	#ifdef USE_SHEEN_COLORMAP
931		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
932	#endif
933	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
934	#ifdef USE_SHEEN_ROUGHNESSMAP
935		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
936	#endif
937#endif
938#ifdef USE_ANISOTROPY
939	#ifdef USE_ANISOTROPYMAP
940		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
941		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
942		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
943	#else
944		vec2 anisotropyV = anisotropyVector;
945	#endif
946	material.anisotropy = length( anisotropyV );
947	if( material.anisotropy == 0.0 ) {
948		anisotropyV = vec2( 1.0, 0.0 );
949	} else {
950		anisotropyV /= material.anisotropy;
951		material.anisotropy = saturate( material.anisotropy );
952	}
953	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
954	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
955	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
956#endif`,dd
vendor: 14,687 bytes, lines 956-1257
956=`struct PhysicalMaterial {
957	vec3 diffuseColor;
958	float roughness;
959	vec3 specularColor;
960	float specularF90;
961	float dispersion;
962	#ifdef USE_CLEARCOAT
963		float clearcoat;
964		float clearcoatRoughness;
965		vec3 clearcoatF0;
966		float clearcoatF90;
967	#endif
968	#ifdef USE_IRIDESCENCE
969		float iridescence;
970		float iridescenceIOR;
971		float iridescenceThickness;
972		vec3 iridescenceFresnel;
973		vec3 iridescenceF0;
974	#endif
975	#ifdef USE_SHEEN
976		vec3 sheenColor;
977		float sheenRoughness;
978	#endif
979	#ifdef IOR
980		float ior;
981	#endif
982	#ifdef USE_TRANSMISSION
983		float transmission;
984		float transmissionAlpha;
985		float thickness;
986		float attenuationDistance;
987		vec3 attenuationColor;
988	#endif
989	#ifdef USE_ANISOTROPY
990		float anisotropy;
991		float alphaT;
992		vec3 anisotropyT;
993		vec3 anisotropyB;
994	#endif
995};
996vec3 clearcoatSpecularDirect = vec3( 0.0 );
997vec3 clearcoatSpecularIndirect = vec3( 0.0 );
998vec3 sheenSpecularDirect = vec3( 0.0 );
999vec3 sheenSpecularIndirect = vec3(0.0 );
1000vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
1001    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
1002    float x2 = x * x;
1003    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
1004    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
1005}
1006float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1007	float a2 = pow2( alpha );
1008	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1009	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1010	return 0.5 / max( gv + gl, EPSILON );
1011}
1012float D_GGX( const in float alpha, const in float dotNH ) {
1013	float a2 = pow2( alpha );
1014	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1015	return RECIPROCAL_PI * a2 / pow2( denom );
1016}
1017#ifdef USE_ANISOTROPY
1018	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 ) {
1019		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1020		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1021		float v = 0.5 / ( gv + gl );
1022		return saturate(v);
1023	}
1024	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1025		float a2 = alphaT * alphaB;
1026		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1027		highp float v2 = dot( v, v );
1028		float w2 = a2 / v2;
1029		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1030	}
1031#endif
1032#ifdef USE_CLEARCOAT
1033	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1034		vec3 f0 = material.clearcoatF0;
1035		float f90 = material.clearcoatF90;
1036		float roughness = material.clearcoatRoughness;
1037		float alpha = pow2( roughness );
1038		vec3 halfDir = normalize( lightDir + viewDir );
1039		float dotNL = saturate( dot( normal, lightDir ) );
1040		float dotNV = saturate( dot( normal, viewDir ) );
1041		float dotNH = saturate( dot( normal, halfDir ) );
1042		float dotVH = saturate( dot( viewDir, halfDir ) );
1043		vec3 F = F_Schlick( f0, f90, dotVH );
1044		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1045		float D = D_GGX( alpha, dotNH );
1046		return F * ( V * D );
1047	}
1048#endif
1049vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1050	vec3 f0 = material.specularColor;
1051	float f90 = material.specularF90;
1052	float roughness = material.roughness;
1053	float alpha = pow2( roughness );
1054	vec3 halfDir = normalize( lightDir + viewDir );
1055	float dotNL = saturate( dot( normal, lightDir ) );
1056	float dotNV = saturate( dot( normal, viewDir ) );
1057	float dotNH = saturate( dot( normal, halfDir ) );
1058	float dotVH = saturate( dot( viewDir, halfDir ) );
1059	vec3 F = F_Schlick( f0, f90, dotVH );
1060	#ifdef USE_IRIDESCENCE
1061		F = mix( F, material.iridescenceFresnel, material.iridescence );
1062	#endif
1063	#ifdef USE_ANISOTROPY
1064		float dotTL = dot( material.anisotropyT, lightDir );
1065		float dotTV = dot( material.anisotropyT, viewDir );
1066		float dotTH = dot( material.anisotropyT, halfDir );
1067		float dotBL = dot( material.anisotropyB, lightDir );
1068		float dotBV = dot( material.anisotropyB, viewDir );
1069		float dotBH = dot( material.anisotropyB, halfDir );
1070		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1071		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1072	#else
1073		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1074		float D = D_GGX( alpha, dotNH );
1075	#endif
1076	return F * ( V * D );
1077}
1078vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1079	const float LUT_SIZE = 64.0;
1080	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1081	const float LUT_BIAS = 0.5 / LUT_SIZE;
1082	float dotNV = saturate( dot( N, V ) );
1083	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1084	uv = uv * LUT_SCALE + LUT_BIAS;
1085	return uv;
1086}
1087float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1088	float l = length( f );
1089	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1090}
1091vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1092	float x = dot( v1, v2 );
1093	float y = abs( x );
1094	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1095	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1096	float v = a / b;
1097	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1098	return cross( v1, v2 ) * theta_sintheta;
1099}
1100vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1101	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1102	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1103	vec3 lightNormal = cross( v1, v2 );
1104	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1105	vec3 T1, T2;
1106	T1 = normalize( V - N * dot( V, N ) );
1107	T2 = - cross( N, T1 );
1108	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1109	vec3 coords[ 4 ];
1110	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1111	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1112	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1113	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1114	coords[ 0 ] = normalize( coords[ 0 ] );
1115	coords[ 1 ] = normalize( coords[ 1 ] );
1116	coords[ 2 ] = normalize( coords[ 2 ] );
1117	coords[ 3 ] = normalize( coords[ 3 ] );
1118	vec3 vectorFormFactor = vec3( 0.0 );
1119	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1120	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1121	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1122	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1123	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1124	return vec3( result );
1125}
1126#if defined( USE_SHEEN )
1127float D_Charlie( float roughness, float dotNH ) {
1128	float alpha = pow2( roughness );
1129	float invAlpha = 1.0 / alpha;
1130	float cos2h = dotNH * dotNH;
1131	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1132	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1133}
1134float V_Neubelt( float dotNV, float dotNL ) {
1135	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1136}
1137vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1138	vec3 halfDir = normalize( lightDir + viewDir );
1139	float dotNL = saturate( dot( normal, lightDir ) );
1140	float dotNV = saturate( dot( normal, viewDir ) );
1141	float dotNH = saturate( dot( normal, halfDir ) );
1142	float D = D_Charlie( sheenRoughness, dotNH );
1143	float V = V_Neubelt( dotNV, dotNL );
1144	return sheenColor * ( D * V );
1145}
1146#endif
1147float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1148	float dotNV = saturate( dot( normal, viewDir ) );
1149	float r2 = roughness * roughness;
1150	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1151	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1152	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1153	return saturate( DG * RECIPROCAL_PI );
1154}
1155vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1156	float dotNV = saturate( dot( normal, viewDir ) );
1157	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1158	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1159	vec4 r = roughness * c0 + c1;
1160	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1161	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1162	return fab;
1163}
1164vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1165	vec2 fab = DFGApprox( normal, viewDir, roughness );
1166	return specularColor * fab.x + specularF90 * fab.y;
1167}
1168#ifdef USE_IRIDESCENCE
1169void 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 ) {
1170#else
1171void 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 ) {
1172#endif
1173	vec2 fab = DFGApprox( normal, viewDir, roughness );
1174	#ifdef USE_IRIDESCENCE
1175		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1176	#else
1177		vec3 Fr = specularColor;
1178	#endif
1179	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1180	float Ess = fab.x + fab.y;
1181	float Ems = 1.0 - Ess;
1182	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1183	singleScatter += FssEss;
1184	multiScatter += Fms * Ems;
1185}
1186#if NUM_RECT_AREA_LIGHTS > 0
1187	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 ) {
1188		vec3 normal = geometryNormal;
1189		vec3 viewDir = geometryViewDir;
1190		vec3 position = geometryPosition;
1191		vec3 lightPos = rectAreaLight.position;
1192		vec3 halfWidth = rectAreaLight.halfWidth;
1193		vec3 halfHeight = rectAreaLight.halfHeight;
1194		vec3 lightColor = rectAreaLight.color;
1195		float roughness = material.roughness;
1196		vec3 rectCoords[ 4 ];
1197		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1198		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1199		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1200		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1201		vec4 t1 = texture2D( ltc_1, uv );
1202		vec4 t2 = texture2D( ltc_2, uv );
1203		mat3 mInv = mat3(
1204			vec3( t1.x, 0, t1.y ),
1205			vec3(    0, 1,    0 ),
1206			vec3( t1.z, 0, t1.w )
1207		);
1208		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1209		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1210		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1211	}
1212#endif
1213void 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 ) {
1214	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1215	vec3 irradiance = dotNL * directLight.color;
1216	#ifdef USE_CLEARCOAT
1217		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1218		vec3 ccIrradiance = dotNLcc * directLight.color;
1219		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1220	#endif
1221	#ifdef USE_SHEEN
1222		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1223	#endif
1224	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1225	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1226}
1227void 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 ) {
1228	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1229}
1230void 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) {
1231	#ifdef USE_CLEARCOAT
1232		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1233	#endif
1234	#ifdef USE_SHEEN
1235		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1236	#endif
1237	vec3 singleScattering = vec3( 0.0 );
1238	vec3 multiScattering = vec3( 0.0 );
1239	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1240	#ifdef USE_IRIDESCENCE
1241		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1242	#else
1243		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1244	#endif
1245	vec3 totalScattering = singleScattering + multiScattering;
1246	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1247	reflectedLight.indirectSpecular += radiance * singleScattering;
1248	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1249	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1250}
1251#define RE_Direct				RE_Direct_Physical
1252#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1253#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1254#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1255float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1256	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1257}`,
1257fd=`
1258vec3 geometryPosition = - vViewPosition;
1259vec3 geometryNormal = normal;
1260vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1261vec3 geometryClearcoatNormal = vec3( 0.0 );
1262#ifdef USE_CLEARCOAT
1263	geometryClearcoatNormal = clearcoatNormal;
1264#endif
1265#ifdef USE_IRIDESCENCE
1266	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1267	if ( material.iridescenceThickness == 0.0 ) {
1268		material.iridescence = 0.0;
1269	} else {
1270		material.iridescence = saturate( material.iridescence );
1271	}
1272	if ( material.iridescence > 0.0 ) {
1273		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1274		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1275	}
1276#endif
1277IncidentLight directLight;
1278#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1279	PointLight pointLight;
1280	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1281	PointLightShadow pointLightShadow;
1282	#endif
1283	#pragma unroll_loop_start
1284	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1285		pointLight = pointLights[ i ];
1286		getPointLightInfo( pointLight, geometryPosition, directLight );
1287		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1288		pointLightShadow = pointLightShadows[ i ];
1289		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1290		#endif
1291		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1292	}
1293	#pragma unroll_loop_end
1294#endif
1295#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1296	SpotLight spotLight;
1297	vec4 spotColor;
1298	vec3 spotLightCoord;
1299	bool inSpotLightMap;
1300	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1301	SpotLightShadow spotLightShadow;
1302	#endif
1303	#pragma unroll_loop_start
1304	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1305		spotLight = spotLights[ i ];
1306		getSpotLightInfo( spotLight, geometryPosition, directLight );
1307		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1308		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1309		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1310		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1311		#else
1312		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1313		#endif
1314		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1315			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1316			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1317			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1318			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1319		#endif
1320		#undef SPOT_LIGHT_MAP_INDEX
1321		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1322		spotLightShadow = spotLightShadows[ i ];
1323		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1324		#endif
1325		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1326	}
1327	#pragma unroll_loop_end
1328#endif
1329#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1330	DirectionalLight directionalLight;
1331	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1332	DirectionalLightShadow directionalLightShadow;
1333	#endif
1334	#pragma unroll_loop_start
1335	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1336		directionalLight = directionalLights[ i ];
1337		getDirectionalLightInfo( directionalLight, directLight );
1338		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1339		directionalLightShadow = directionalLightShadows[ i ];
1340		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1341		#endif
1342		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1343	}
1344	#pragma unroll_loop_end
1345#endif
1346#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1347	RectAreaLight rectAreaLight;
1348	#pragma unroll_loop_start
1349	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1350		rectAreaLight = rectAreaLights[ i ];
1351		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1352	}
1353	#pragma unroll_loop_end
1354#endif
1355#if defined( RE_IndirectDiffuse )
1356	vec3 iblIrradiance = vec3( 0.0 );
1357	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1358	#if defined( USE_LIGHT_PROBES )
1359		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1360	#endif
1361	#if ( NUM_HEMI_LIGHTS > 0 )
1362		#pragma unroll_loop_start
1363		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1364			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1365		}
1366		#pragma unroll_loop_end
1367	#endif
1368#endif
1369#if defined( RE_IndirectSpecular )
1370	vec3 radiance = vec3( 0.0 );
1371	vec3 clearcoatRadiance = vec3( 0.0 );
1372#endif`,pd=`#if defined( RE_IndirectDiffuse )
1373	#ifdef USE_LIGHTMAP
1374		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1375		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1376		irradiance += lightMapIrradiance;
1377	#endif
1378	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1379		iblIrradiance += getIBLIrradiance( geometryNormal );
1380	#endif
1381#endif
1382#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1383	#ifdef USE_ANISOTROPY
1384		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1385	#else
1386		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1387	#endif
1388	#ifdef USE_CLEARCOAT
1389		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1390	#endif
1391#endif`,md=`#if defined( RE_IndirectDiffuse )
1392	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1393#endif
1394#if defined( RE_IndirectSpecular )
1395	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1396#endif`,gd=`#if defined( USE_LOGDEPTHBUF )
1397	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1398#endif`,_d=`#if defined( USE_LOGDEPTHBUF )
1399	uniform float logDepthBufFC;
1400	varying float vFragDepth;
1401	varying float vIsPerspective;
1402#endif`,vd=`#ifdef USE_LOGDEPTHBUF
1403	varying float vFragDepth;
1404	varying float vIsPerspective;
1405#endif`,xd=`#ifdef USE_LOGDEPTHBUF
1406	vFragDepth = 1.0 + gl_Position.w;
1407	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1408#endif`,Sd=`#ifdef USE_MAP
1409	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1410	#ifdef DECODE_VIDEO_TEXTURE
1411		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
1412	
1413	#endif
1414	diffuseColor *= sampledDiffuseColor;
1415#endif`,Md=`#ifdef USE_MAP
1416	uniform sampler2D map;
1417#endif`,yd=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1418	#if defined( USE_POINTS_UV )
1419		vec2 uv = vUv;
1420	#else
1421		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1422	#endif
1423#endif
1424#ifdef USE_MAP
1425	diffuseColor *= texture2D( map, uv );
1426#endif
1427#ifdef USE_ALPHAMAP
1428	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1429#endif`,Ed=`#if defined( USE_POINTS_UV )
1430	varying vec2 vUv;
1431#else
1432	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1433		uniform mat3 uvTransform;
1434	#endif
1435#endif
1436#ifdef USE_MAP
1437	uniform sampler2D map;
1438#endif
1439#ifdef USE_ALPHAMAP
1440	uniform sampler2D alphaMap;
1441#endif`,Td=`float metalnessFactor = metalness;
1442#ifdef USE_METALNESSMAP
1443	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1444	metalnessFactor *= texelMetalness.b;
1445#endif`,bd=`#ifdef USE_METALNESSMAP
1446	uniform sampler2D metalnessMap;
1447#endif`,Ad=`#ifdef USE_INSTANCING_MORPH
1448	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1449	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1450	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1451		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1452	}
1453#endif`,wd=`#if defined( USE_MORPHCOLORS )
1454	vColor *= morphTargetBaseInfluence;
1455	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1456		#if defined( USE_COLOR_ALPHA )
1457			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1458		#elif defined( USE_COLOR )
1459			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1460		#endif
1461	}
1462#endif`,Rd=`#ifdef USE_MORPHNORMALS
1463	objectNormal *= morphTargetBaseInfluence;
1464	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1465		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1466	}
1467#endif`,Cd=`#ifdef USE_MORPHTARGETS
1468	#ifndef USE_INSTANCING_MORPH
1469		uniform float morphTargetBaseInfluence;
1470		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1471	#endif
1472	uniform sampler2DArray morphTargetsTexture;
1473	uniform ivec2 morphTargetsTextureSize;
1474	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1475		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1476		int y = texelIndex / morphTargetsTextureSize.x;
1477		int x = texelIndex - y * morphTargetsTextureSize.x;
1478		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1479		return texelFetch( morphTargetsTexture, morphUV, 0 );
1480	}
1481#endif`,Pd=`#ifdef USE_MORPHTARGETS
1482	transformed *= morphTargetBaseInfluence;
1483	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1484		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1485	}
1486#endif`,Ld=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1487#ifdef FLAT_SHADED
1488	vec3 fdx = dFdx( vViewPosition );
1489	vec3 fdy = dFdy( vViewPosition );
1490	vec3 normal = normalize( cross( fdx, fdy ) );
1491#else
1492	vec3 normal = normalize( vNormal );
1493	#ifdef DOUBLE_SIDED
1494		normal *= faceDirection;
1495	#endif
1496#endif
1497#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1498	#ifdef USE_TANGENT
1499		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1500	#else
1501		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1502		#if defined( USE_NORMALMAP )
1503			vNormalMapUv
1504		#elif defined( USE_CLEARCOAT_NORMALMAP )
1505			vClearcoatNormalMapUv
1506		#else
1507			vUv
1508		#endif
1509		);
1510	#endif
1511	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1512		tbn[0] *= faceDirection;
1513		tbn[1] *= faceDirection;
1514	#endif
1515#endif
1516#ifdef USE_CLEARCOAT_NORMALMAP
1517	#ifdef USE_TANGENT
1518		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1519	#else
1520		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1521	#endif
1522	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1523		tbn2[0] *= faceDirection;
1524		tbn2[1] *= faceDirection;
1525	#endif
1526#endif
1527vec3 nonPerturbedNormal = normal;`,Dd=`#ifdef USE_NORMALMAP_OBJECTSPACE
1528	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1529	#ifdef FLIP_SIDED
1530		normal = - normal;
1531	#endif
1532	#ifdef DOUBLE_SIDED
1533		normal = normal * faceDirection;
1534	#endif
1535	normal = normalize( normalMatrix * normal );
1536#elif defined( USE_NORMALMAP_TANGENTSPACE )
1537	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1538	mapN.xy *= normalScale;
1539	normal = normalize( tbn * mapN );
1540#elif defined( USE_BUMPMAP )
1541	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1542#endif`,Ud=`#ifndef FLAT_SHADED
1543	varying vec3 vNormal;
1544	#ifdef USE_TANGENT
1545		varying vec3 vTangent;
1546		varying vec3 vBitangent;
1547	#endif
1548#endif`,Id=`#ifndef FLAT_SHADED
1549	varying vec3 vNormal;
1550	#ifdef USE_TANGENT
1551		varying vec3 vTangent;
1552		varying vec3 vBitangent;
1553	#endif
1554#endif`,Nd=`#ifndef FLAT_SHADED
1555	vNormal = normalize( transformedNormal );
1556	#ifdef USE_TANGENT
1557		vTangent = normalize( transformedTangent );
1558		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1559	#endif
1560#endif`,Od=`#ifdef USE_NORMALMAP
1561	uniform sampler2D normalMap;
1562	uniform vec2 normalScale;
1563#endif
1564#ifdef USE_NORMALMAP_OBJECTSPACE
1565	uniform mat3 normalMatrix;
1566#endif
1567#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1568	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1569		vec3 q0 = dFdx( eye_pos.xyz );
1570		vec3 q1 = dFdy( eye_pos.xyz );
1571		vec2 st0 = dFdx( uv.st );
1572		vec2 st1 = dFdy( uv.st );
1573		vec3 N = surf_norm;
1574		vec3 q1perp = cross( q1, N );
1575		vec3 q0perp = cross( N, q0 );
1576		vec3 T = q1perp * st0.x + q0perp * st1.x;
1577		vec3 B = q1perp * st0.y + q0perp * st1.y;
1578		float det = max( dot( T, T ), dot( B, B ) );
1579		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1580		return mat3( T * scale, B * scale, N );
1581	}
1582#endif`,Fd=`#ifdef USE_CLEARCOAT
1583	vec3 clearcoatNormal = nonPerturbedNormal;
1584#endif`,Bd=`#ifdef USE_CLEARCOAT_NORMALMAP
1585	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1586	clearcoatMapN.xy *= clearcoatNormalScale;
1587	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1588#endif`,zd=`#ifdef USE_CLEARCOATMAP
1589	uniform sampler2D clearcoatMap;
1590#endif
1591#ifdef USE_CLEARCOAT_NORMALMAP
1592	uniform sampler2D clearcoatNormalMap;
1593	uniform vec2 clearcoatNormalScale;
1594#endif
1595#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1596	uniform sampler2D clearcoatRoughnessMap;
1597#endif`,Hd=`#ifdef USE_IRIDESCENCEMAP
1598	uniform sampler2D iridescenceMap;
1599#endif
1600#ifdef USE_IRIDESCENCE_THICKNESSMAP
1601	uniform sampler2D iridescenceThicknessMap;
1602#endif`,Gd=`#ifdef OPAQUE
1603diffuseColor.a = 1.0;
1604#endif
1605#ifdef USE_TRANSMISSION
1606diffuseColor.a *= material.transmissionAlpha;
1607#endif
1608gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Vd=`vec3 packNormalToRGB( const in vec3 normal ) {
1609	return normalize( normal ) * 0.5 + 0.5;
1610}
1611vec3 unpackRGBToNormal( const in vec3 rgb ) {
1612	return 2.0 * rgb.xyz - 1.0;
1613}
1614const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1615const float Inv255 = 1. / 255.;
1616const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1617const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1618const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1619const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1620vec4 packDepthToRGBA( const in float v ) {
1621	if( v <= 0.0 )
1622		return vec4( 0., 0., 0., 0. );
1623	if( v >= 1.0 )
1624		return vec4( 1., 1., 1., 1. );
1625	float vuf;
1626	float af = modf( v * PackFactors.a, vuf );
1627	float bf = modf( vuf * ShiftRight8, vuf );
1628	float gf = modf( vuf * ShiftRight8, vuf );
1629	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1630}
1631vec3 packDepthToRGB( const in float v ) {
1632	if( v <= 0.0 )
1633		return vec3( 0., 0., 0. );
1634	if( v >= 1.0 )
1635		return vec3( 1., 1., 1. );
1636	float vuf;
1637	float bf = modf( v * PackFactors.b, vuf );
1638	float gf = modf( vuf * ShiftRight8, vuf );
1639	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1640}
1641vec2 packDepthToRG( const in float v ) {
1642	if( v <= 0.0 )
1643		return vec2( 0., 0. );
1644	if( v >= 1.0 )
1645		return vec2( 1., 1. );
1646	float vuf;
1647	float gf = modf( v * 256., vuf );
1648	return vec2( vuf * Inv255, gf );
1649}
1650float unpackRGBAToDepth( const in vec4 v ) {
1651	return dot( v, UnpackFactors4 );
1652}
1653float unpackRGBToDepth( const in vec3 v ) {
1654	return dot( v, UnpackFactors3 );
1655}
1656float unpackRGToDepth( const in vec2 v ) {
1657	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1658}
1659vec4 pack2HalfToRGBA( const in vec2 v ) {
1660	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1661	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1662}
1663vec2 unpackRGBATo2Half( const in vec4 v ) {
1664	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1665}
1666float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1667	return ( viewZ + near ) / ( near - far );
1668}
1669float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1670	return depth * ( near - far ) - near;
1671}
1672float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1673	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1674}
1675float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1676	return ( near * far ) / ( ( far - near ) * depth - far );
1677}`,kd=`#ifdef PREMULTIPLIED_ALPHA
1678	gl_FragColor.rgb *= gl_FragColor.a;
1679#endif`,Wd=`vec4 mvPosition = vec4( transformed, 1.0 );
1680#ifdef USE_BATCHING
1681	mvPosition = batchingMatrix * mvPosition;
1682#endif
1683#ifdef USE_INSTANCING
1684	mvPosition = instanceMatrix * mvPosition;
1685#endif
1686mvPosition = modelViewMatrix * mvPosition;
1687gl_Position = projectionMatrix * mvPosition;`,Xd=`#ifdef DITHERING
1688	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1689#endif`,qd=`#ifdef DITHERING
1690	vec3 dithering( vec3 color ) {
1691		float grid_position = rand( gl_FragCoord.xy );
1692		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1693		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1694		return color + dither_shift_RGB;
1695	}
1696#endif`,Yd=`float roughnessFactor = roughness;
1697#ifdef USE_ROUGHNESSMAP
1698	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1699	roughnessFactor *= texelRoughness.g;
1700#endif`,Kd=`#ifdef USE_ROUGHNESSMAP
1701	uniform sampler2D roughnessMap;
1702#endif`,Zd=
vendor: 8,887 bytes, lines 1702-1888
1702`#if NUM_SPOT_LIGHT_COORDS > 0
1703	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1704#endif
1705#if NUM_SPOT_LIGHT_MAPS > 0
1706	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1707#endif
1708#ifdef USE_SHADOWMAP
1709	#if NUM_DIR_LIGHT_SHADOWS > 0
1710		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1711		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1712		struct DirectionalLightShadow {
1713			float shadowIntensity;
1714			float shadowBias;
1715			float shadowNormalBias;
1716			float shadowRadius;
1717			vec2 shadowMapSize;
1718		};
1719		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1720	#endif
1721	#if NUM_SPOT_LIGHT_SHADOWS > 0
1722		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1723		struct SpotLightShadow {
1724			float shadowIntensity;
1725			float shadowBias;
1726			float shadowNormalBias;
1727			float shadowRadius;
1728			vec2 shadowMapSize;
1729		};
1730		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1731	#endif
1732	#if NUM_POINT_LIGHT_SHADOWS > 0
1733		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1734		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1735		struct PointLightShadow {
1736			float shadowIntensity;
1737			float shadowBias;
1738			float shadowNormalBias;
1739			float shadowRadius;
1740			vec2 shadowMapSize;
1741			float shadowCameraNear;
1742			float shadowCameraFar;
1743		};
1744		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1745	#endif
1746	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1747		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1748	}
1749	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1750		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1751	}
1752	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1753		float occlusion = 1.0;
1754		vec2 distribution = texture2DDistribution( shadow, uv );
1755		float hard_shadow = step( compare , distribution.x );
1756		if (hard_shadow != 1.0 ) {
1757			float distance = compare - distribution.x ;
1758			float variance = max( 0.00000, distribution.y * distribution.y );
1759			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 );
1760		}
1761		return occlusion;
1762	}
1763	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1764		float shadow = 1.0;
1765		shadowCoord.xyz /= shadowCoord.w;
1766		shadowCoord.z += shadowBias;
1767		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1768		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1769		if ( frustumTest ) {
1770		#if defined( SHADOWMAP_TYPE_PCF )
1771			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1772			float dx0 = - texelSize.x * shadowRadius;
1773			float dy0 = - texelSize.y * shadowRadius;
1774			float dx1 = + texelSize.x * shadowRadius;
1775			float dy1 = + texelSize.y * shadowRadius;
1776			float dx2 = dx0 / 2.0;
1777			float dy2 = dy0 / 2.0;
1778			float dx3 = dx1 / 2.0;
1779			float dy3 = dy1 / 2.0;
1780			shadow = (
1781				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1782				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1783				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1784				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1785				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1786				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1787				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1788				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1789				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1790				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1791				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1792				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1793				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1794				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1795				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1796				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1797				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1798			) * ( 1.0 / 17.0 );
1799		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1800			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1801			float dx = texelSize.x;
1802			float dy = texelSize.y;
1803			vec2 uv = shadowCoord.xy;
1804			vec2 f = fract( uv * shadowMapSize + 0.5 );
1805			uv -= f * texelSize;
1806			shadow = (
1807				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1808				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1809				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1810				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1811				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1812					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1813					 f.x ) +
1814				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1815					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1816					 f.x ) +
1817				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1818					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1819					 f.y ) +
1820				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1821					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1822					 f.y ) +
1823				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1824						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1825						  f.x ),
1826					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1827						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1828						  f.x ),
1829					 f.y )
1830			) * ( 1.0 / 9.0 );
1831		#elif defined( SHADOWMAP_TYPE_VSM )
1832			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1833		#else
1834			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1835		#endif
1836		}
1837		return mix( 1.0, shadow, shadowIntensity );
1838	}
1839	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1840		vec3 absV = abs( v );
1841		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1842		absV *= scaleToCube;
1843		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1844		vec2 planar = v.xy;
1845		float almostATexel = 1.5 * texelSizeY;
1846		float almostOne = 1.0 - almostATexel;
1847		if ( absV.z >= almostOne ) {
1848			if ( v.z > 0.0 )
1849				planar.x = 4.0 - v.x;
1850		} else if ( absV.x >= almostOne ) {
1851			float signX = sign( v.x );
1852			planar.x = v.z * signX + 2.0 * signX;
1853		} else if ( absV.y >= almostOne ) {
1854			float signY = sign( v.y );
1855			planar.x = v.x + 2.0 * signY + 2.0;
1856			planar.y = v.z * signY - 2.0;
1857		}
1858		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1859	}
1860	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1861		float shadow = 1.0;
1862		vec3 lightToPosition = shadowCoord.xyz;
1863		
1864		float lightToPositionLength = length( lightToPosition );
1865		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
1866			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
1867			vec3 bd3D = normalize( lightToPosition );
1868			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1869			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1870				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1871				shadow = (
1872					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1873					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1874					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1875					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1876					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1877					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1878					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1879					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1880					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1881				) * ( 1.0 / 9.0 );
1882			#else
1883				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1884			#endif
1885		}
1886		return mix( 1.0, shadow, shadowIntensity );
1887	}
1888#endif`,
1888jd=`#if NUM_SPOT_LIGHT_COORDS > 0
1889	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1890	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1891#endif
1892#ifdef USE_SHADOWMAP
1893	#if NUM_DIR_LIGHT_SHADOWS > 0
1894		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1895		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1896		struct DirectionalLightShadow {
1897			float shadowIntensity;
1898			float shadowBias;
1899			float shadowNormalBias;
1900			float shadowRadius;
1901			vec2 shadowMapSize;
1902		};
1903		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1904	#endif
1905	#if NUM_SPOT_LIGHT_SHADOWS > 0
1906		struct SpotLightShadow {
1907			float shadowIntensity;
1908			float shadowBias;
1909			float shadowNormalBias;
1910			float shadowRadius;
1911			vec2 shadowMapSize;
1912		};
1913		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1914	#endif
1915	#if NUM_POINT_LIGHT_SHADOWS > 0
1916		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1917		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1918		struct PointLightShadow {
1919			float shadowIntensity;
1920			float shadowBias;
1921			float shadowNormalBias;
1922			float shadowRadius;
1923			vec2 shadowMapSize;
1924			float shadowCameraNear;
1925			float shadowCameraFar;
1926		};
1927		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1928	#endif
1929#endif`,$d=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1930	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1931	vec4 shadowWorldPosition;
1932#endif
1933#if defined( USE_SHADOWMAP )
1934	#if NUM_DIR_LIGHT_SHADOWS > 0
1935		#pragma unroll_loop_start
1936		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1937			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1938			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1939		}
1940		#pragma unroll_loop_end
1941	#endif
1942	#if NUM_POINT_LIGHT_SHADOWS > 0
1943		#pragma unroll_loop_start
1944		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1945			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1946			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1947		}
1948		#pragma unroll_loop_end
1949	#endif
1950#endif
1951#if NUM_SPOT_LIGHT_COORDS > 0
1952	#pragma unroll_loop_start
1953	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1954		shadowWorldPosition = worldPosition;
1955		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1956			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1957		#endif
1958		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1959	}
1960	#pragma unroll_loop_end
1961#endif`,Jd=`float getShadowMask() {
1962	float shadow = 1.0;
1963	#ifdef USE_SHADOWMAP
1964	#if NUM_DIR_LIGHT_SHADOWS > 0
1965	DirectionalLightShadow directionalLight;
1966	#pragma unroll_loop_start
1967	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1968		directionalLight = directionalLightShadows[ i ];
1969		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1970	}
1971	#pragma unroll_loop_end
1972	#endif
1973	#if NUM_SPOT_LIGHT_SHADOWS > 0
1974	SpotLightShadow spotLight;
1975	#pragma unroll_loop_start
1976	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1977		spotLight = spotLightShadows[ i ];
1978		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1979	}
1980	#pragma unroll_loop_end
1981	#endif
1982	#if NUM_POINT_LIGHT_SHADOWS > 0
1983	PointLightShadow pointLight;
1984	#pragma unroll_loop_start
1985	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1986		pointLight = pointLightShadows[ i ];
1987		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1988	}
1989	#pragma unroll_loop_end
1990	#endif
1991	#endif
1992	return shadow;
1993}`,Qd=`#ifdef USE_SKINNING
1994	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1995	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1996	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1997	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1998#endif`,tf=`#ifdef USE_SKINNING
1999	uniform mat4 bindMatrix;
2000	uniform mat4 bindMatrixInverse;
2001	uniform highp sampler2D boneTexture;
2002	mat4 getBoneMatrix( const in float i ) {
2003		int size = textureSize( boneTexture, 0 ).x;
2004		int j = int( i ) * 4;
2005		int x = j % size;
2006		int y = j / size;
2007		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2008		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2009		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2010		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2011		return mat4( v1, v2, v3, v4 );
2012	}
2013#endif`,ef=`#ifdef USE_SKINNING
2014	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2015	vec4 skinned = vec4( 0.0 );
2016	skinned += boneMatX * skinVertex * skinWeight.x;
2017	skinned += boneMatY * skinVertex * skinWeight.y;
2018	skinned += boneMatZ * skinVertex * skinWeight.z;
2019	skinned += boneMatW * skinVertex * skinWeight.w;
2020	transformed = ( bindMatrixInverse * skinned ).xyz;
2021#endif`,nf=`#ifdef USE_SKINNING
2022	mat4 skinMatrix = mat4( 0.0 );
2023	skinMatrix += skinWeight.x * boneMatX;
2024	skinMatrix += skinWeight.y * boneMatY;
2025	skinMatrix += skinWeight.z * boneMatZ;
2026	skinMatrix += skinWeight.w * boneMatW;
2027	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2028	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2029	#ifdef USE_TANGENT
2030		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2031	#endif
2032#endif`,rf=`float specularStrength;
2033#ifdef USE_SPECULARMAP
2034	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2035	specularStrength = texelSpecular.r;
2036#else
2037	specularStrength = 1.0;
2038#endif`,sf=`#ifdef USE_SPECULARMAP
2039	uniform sampler2D specularMap;
2040#endif`,af=`#if defined( TONE_MAPPING )
2041	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2042#endif`,of=`#ifndef saturate
2043#define saturate( a ) clamp( a, 0.0, 1.0 )
2044#endif
2045uniform float toneMappingExposure;
2046vec3 LinearToneMapping( vec3 color ) {
2047	return saturate( toneMappingExposure * color );
2048}
2049vec3 ReinhardToneMapping( vec3 color ) {
2050	color *= toneMappingExposure;
2051	return saturate( color / ( vec3( 1.0 ) + color ) );
2052}
2053vec3 OptimizedCineonToneMapping( vec3 color ) {
2054	color *= toneMappingExposure;
2055	color = max( vec3( 0.0 ), color - 0.004 );
2056	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2057}
2058vec3 RRTAndODTFit( vec3 v ) {
2059	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2060	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2061	return a / b;
2062}
2063vec3 ACESFilmicToneMapping( vec3 color ) {
2064	const mat3 ACESInputMat = mat3(
2065		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2066		vec3( 0.04823, 0.01566, 0.83777 )
2067	);
2068	const mat3 ACESOutputMat = mat3(
2069		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2070		vec3( -0.07367, -0.00605,  1.07602 )
2071	);
2072	color *= toneMappingExposure / 0.6;
2073	color = ACESInputMat * color;
2074	color = RRTAndODTFit( color );
2075	color = ACESOutputMat * color;
2076	return saturate( color );
2077}
2078const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2079	vec3( 1.6605, - 0.1246, - 0.0182 ),
2080	vec3( - 0.5876, 1.1329, - 0.1006 ),
2081	vec3( - 0.0728, - 0.0083, 1.1187 )
2082);
2083const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2084	vec3( 0.6274, 0.0691, 0.0164 ),
2085	vec3( 0.3293, 0.9195, 0.0880 ),
2086	vec3( 0.0433, 0.0113, 0.8956 )
2087);
2088vec3 agxDefaultContrastApprox( vec3 x ) {
2089	vec3 x2 = x * x;
2090	vec3 x4 = x2 * x2;
2091	return + 15.5 * x4 * x2
2092		- 40.14 * x4 * x
2093		+ 31.96 * x4
2094		- 6.868 * x2 * x
2095		+ 0.4298 * x2
2096		+ 0.1191 * x
2097		- 0.00232;
2098}
2099vec3 AgXToneMapping( vec3 color ) {
2100	const mat3 AgXInsetMatrix = mat3(
2101		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2102		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2103		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2104	);
2105	const mat3 AgXOutsetMatrix = mat3(
2106		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2107		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2108		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2109	);
2110	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2111	color *= toneMappingExposure;
2112	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2113	color = AgXInsetMatrix * color;
2114	color = max( color, 1e-10 );	color = log2( color );
2115	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2116	color = clamp( color, 0.0, 1.0 );
2117	color = agxDefaultContrastApprox( color );
2118	color = AgXOutsetMatrix * color;
2119	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2120	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2121	color = clamp( color, 0.0, 1.0 );
2122	return color;
2123}
2124vec3 NeutralToneMapping( vec3 color ) {
2125	const float StartCompression = 0.8 - 0.04;
2126	const float Desaturation = 0.15;
2127	color *= toneMappingExposure;
2128	float x = min( color.r, min( color.g, color.b ) );
2129	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2130	color -= offset;
2131	float peak = max( color.r, max( color.g, color.b ) );
2132	if ( peak < StartCompression ) return color;
2133	float d = 1. - StartCompression;
2134	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2135	color *= newPeak / peak;
2136	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2137	return mix( color, vec3( newPeak ), g );
2138}
2139vec3 CustomToneMapping( vec3 color ) { return color; }`,lf=`#ifdef USE_TRANSMISSION
2140	material.transmission = transmission;
2141	material.transmissionAlpha = 1.0;
2142	material.thickness = thickness;
2143	material.attenuationDistance = attenuationDistance;
2144	material.attenuationColor = attenuationColor;
2145	#ifdef USE_TRANSMISSIONMAP
2146		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2147	#endif
2148	#ifdef USE_THICKNESSMAP
2149		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2150	#endif
2151	vec3 pos = vWorldPosition;
2152	vec3 v = normalize( cameraPosition - pos );
2153	vec3 n = inverseTransformDirection( normal, viewMatrix );
2154	vec4 transmitted = getIBLVolumeRefraction(
2155		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2156		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2157		material.attenuationColor, material.attenuationDistance );
2158	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2159	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2160#endif`,cf=`#ifdef USE_TRANSMISSION
2161	uniform float transmission;
2162	uniform float thickness;
2163	uniform float attenuationDistance;
2164	uniform vec3 attenuationColor;
2165	#ifdef USE_TRANSMISSIONMAP
2166		uniform sampler2D transmissionMap;
2167	#endif
2168	#ifdef USE_THICKNESSMAP
2169		uniform sampler2D thicknessMap;
2170	#endif
2171	uniform vec2 transmissionSamplerSize;
2172	uniform sampler2D transmissionSamplerMap;
2173	uniform mat4 modelMatrix;
2174	uniform mat4 projectionMatrix;
2175	varying vec3 vWorldPosition;
2176	float w0( float a ) {
2177		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2178	}
2179	float w1( float a ) {
2180		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2181	}
2182	float w2( float a ){
2183		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2184	}
2185	float w3( float a ) {
2186		return ( 1.0 / 6.0 ) * ( a * a * a );
2187	}
2188	float g0( float a ) {
2189		return w0( a ) + w1( a );
2190	}
2191	float g1( float a ) {
2192		return w2( a ) + w3( a );
2193	}
2194	float h0( float a ) {
2195		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2196	}
2197	float h1( float a ) {
2198		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2199	}
2200	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2201		uv = uv * texelSize.zw + 0.5;
2202		vec2 iuv = floor( uv );
2203		vec2 fuv = fract( uv );
2204		float g0x = g0( fuv.x );
2205		float g1x = g1( fuv.x );
2206		float h0x = h0( fuv.x );
2207		float h1x = h1( fuv.x );
2208		float h0y = h0( fuv.y );
2209		float h1y = h1( fuv.y );
2210		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2211		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2212		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2213		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2214		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2215			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2216	}
2217	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2218		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2219		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2220		vec2 fLodSizeInv = 1.0 / fLodSize;
2221		vec2 cLodSizeInv = 1.0 / cLodSize;
2222		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2223		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2224		return mix( fSample, cSample, fract( lod ) );
2225	}
2226	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2227		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2228		vec3 modelScale;
2229		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2230		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2231		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2232		return normalize( refractionVector ) * thickness * modelScale;
2233	}
2234	float applyIorToRoughness( const in float roughness, const in float ior ) {
2235		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2236	}
2237	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2238		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2239		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2240	}
2241	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2242		if ( isinf( attenuationDistance ) ) {
2243			return vec3( 1.0 );
2244		} else {
2245			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2246			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2247		}
2248	}
2249	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2250		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2251		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2252		const in vec3 attenuationColor, const in float attenuationDistance ) {
2253		vec4 transmittedLight;
2254		vec3 transmittance;
2255		#ifdef USE_DISPERSION
2256			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2257			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2258			for ( int i = 0; i < 3; i ++ ) {
2259				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2260				vec3 refractedRayExit = position + transmissionRay;
2261		
2262				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2263				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2264				refractionCoords += 1.0;
2265				refractionCoords /= 2.0;
2266		
2267				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2268				transmittedLight[ i ] = transmissionSample[ i ];
2269				transmittedLight.a += transmissionSample.a;
2270				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2271			}
2272			transmittedLight.a /= 3.0;
2273		
2274		#else
2275		
2276			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2277			vec3 refractedRayExit = position + transmissionRay;
2278			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2279			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2280			refractionCoords += 1.0;
2281			refractionCoords /= 2.0;
2282			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2283			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2284		
2285		#endif
2286		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2287		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2288		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2289		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2290	}
2291#endif`,uf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2292	varying vec2 vUv;
2293#endif
2294#ifdef USE_MAP
2295	varying vec2 vMapUv;
2296#endif
2297#ifdef USE_ALPHAMAP
2298	varying vec2 vAlphaMapUv;
2299#endif
2300#ifdef USE_LIGHTMAP
2301	varying vec2 vLightMapUv;
2302#endif
2303#ifdef USE_AOMAP
2304	varying vec2 vAoMapUv;
2305#endif
2306#ifdef USE_BUMPMAP
2307	varying vec2 vBumpMapUv;
2308#endif
2309#ifdef USE_NORMALMAP
2310	varying vec2 vNormalMapUv;
2311#endif
2312#ifdef USE_EMISSIVEMAP
2313	varying vec2 vEmissiveMapUv;
2314#endif
2315#ifdef USE_METALNESSMAP
2316	varying vec2 vMetalnessMapUv;
2317#endif
2318#ifdef USE_ROUGHNESSMAP
2319	varying vec2 vRoughnessMapUv;
2320#endif
2321#ifdef USE_ANISOTROPYMAP
2322	varying vec2 vAnisotropyMapUv;
2323#endif
2324#ifdef USE_CLEARCOATMAP
2325	varying vec2 vClearcoatMapUv;
2326#endif
2327#ifdef USE_CLEARCOAT_NORMALMAP
2328	varying vec2 vClearcoatNormalMapUv;
2329#endif
2330#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2331	varying vec2 vClearcoatRoughnessMapUv;
2332#endif
2333#ifdef USE_IRIDESCENCEMAP
2334	varying vec2 vIridescenceMapUv;
2335#endif
2336#ifdef USE_IRIDESCENCE_THICKNESSMAP
2337	varying vec2 vIridescenceThicknessMapUv;
2338#endif
2339#ifdef USE_SHEEN_COLORMAP
2340	varying vec2 vSheenColorMapUv;
2341#endif
2342#ifdef USE_SHEEN_ROUGHNESSMAP
2343	varying vec2 vSheenRoughnessMapUv;
2344#endif
2345#ifdef USE_SPECULARMAP
2346	varying vec2 vSpecularMapUv;
2347#endif
2348#ifdef USE_SPECULAR_COLORMAP
2349	varying vec2 vSpecularColorMapUv;
2350#endif
2351#ifdef USE_SPECULAR_INTENSITYMAP
2352	varying vec2 vSpecularIntensityMapUv;
2353#endif
2354#ifdef USE_TRANSMISSIONMAP
2355	uniform mat3 transmissionMapTransform;
2356	varying vec2 vTransmissionMapUv;
2357#endif
2358#ifdef USE_THICKNESSMAP
2359	uniform mat3 thicknessMapTransform;
2360	varying vec2 vThicknessMapUv;
2361#endif`,hf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2362	varying vec2 vUv;
2363#endif
2364#ifdef USE_MAP
2365	uniform mat3 mapTransform;
2366	varying vec2 vMapUv;
2367#endif
2368#ifdef USE_ALPHAMAP
2369	uniform mat3 alphaMapTransform;
2370	varying vec2 vAlphaMapUv;
2371#endif
2372#ifdef USE_LIGHTMAP
2373	uniform mat3 lightMapTransform;
2374	varying vec2 vLightMapUv;
2375#endif
2376#ifdef USE_AOMAP
2377	uniform mat3 aoMapTransform;
2378	varying vec2 vAoMapUv;
2379#endif
2380#ifdef USE_BUMPMAP
2381	uniform mat3 bumpMapTransform;
2382	varying vec2 vBumpMapUv;
2383#endif
2384#ifdef USE_NORMALMAP
2385	uniform mat3 normalMapTransform;
2386	varying vec2 vNormalMapUv;
2387#endif
2388#ifdef USE_DISPLACEMENTMAP
2389	uniform mat3 displacementMapTransform;
2390	varying vec2 vDisplacementMapUv;
2391#endif
2392#ifdef USE_EMISSIVEMAP
2393	uniform mat3 emissiveMapTransform;
2394	varying vec2 vEmissiveMapUv;
2395#endif
2396#ifdef USE_METALNESSMAP
2397	uniform mat3 metalnessMapTransform;
2398	varying vec2 vMetalnessMapUv;
2399#endif
2400#ifdef USE_ROUGHNESSMAP
2401	uniform mat3 roughnessMapTransform;
2402	varying vec2 vRoughnessMapUv;
2403#endif
2404#ifdef USE_ANISOTROPYMAP
2405	uniform mat3 anisotropyMapTransform;
2406	varying vec2 vAnisotropyMapUv;
2407#endif
2408#ifdef USE_CLEARCOATMAP
2409	uniform mat3 clearcoatMapTransform;
2410	varying vec2 vClearcoatMapUv;
2411#endif
2412#ifdef USE_CLEARCOAT_NORMALMAP
2413	uniform mat3 clearcoatNormalMapTransform;
2414	varying vec2 vClearcoatNormalMapUv;
2415#endif
2416#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2417	uniform mat3 clearcoatRoughnessMapTransform;
2418	varying vec2 vClearcoatRoughnessMapUv;
2419#endif
2420#ifdef USE_SHEEN_COLORMAP
2421	uniform mat3 sheenColorMapTransform;
2422	varying vec2 vSheenColorMapUv;
2423#endif
2424#ifdef USE_SHEEN_ROUGHNESSMAP
2425	uniform mat3 sheenRoughnessMapTransform;
2426	varying vec2 vSheenRoughnessMapUv;
2427#endif
2428#ifdef USE_IRIDESCENCEMAP
2429	uniform mat3 iridescenceMapTransform;
2430	varying vec2 vIridescenceMapUv;
2431#endif
2432#ifdef USE_IRIDESCENCE_THICKNESSMAP
2433	uniform mat3 iridescenceThicknessMapTransform;
2434	varying vec2 vIridescenceThicknessMapUv;
2435#endif
2436#ifdef USE_SPECULARMAP
2437	uniform mat3 specularMapTransform;
2438	varying vec2 vSpecularMapUv;
2439#endif
2440#ifdef USE_SPECULAR_COLORMAP
2441	uniform mat3 specularColorMapTransform;
2442	varying vec2 vSpecularColorMapUv;
2443#endif
2444#ifdef USE_SPECULAR_INTENSITYMAP
2445	uniform mat3 specularIntensityMapTransform;
2446	varying vec2 vSpecularIntensityMapUv;
2447#endif
2448#ifdef USE_TRANSMISSIONMAP
2449	uniform mat3 transmissionMapTransform;
2450	varying vec2 vTransmissionMapUv;
2451#endif
2452#ifdef USE_THICKNESSMAP
2453	uniform mat3 thicknessMapTransform;
2454	varying vec2 vThicknessMapUv;
2455#endif`,df=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2456	vUv = vec3( uv, 1 ).xy;
2457#endif
2458#ifdef USE_MAP
2459	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2460#endif
2461#ifdef USE_ALPHAMAP
2462	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2463#endif
2464#ifdef USE_LIGHTMAP
2465	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2466#endif
2467#ifdef USE_AOMAP
2468	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2469#endif
2470#ifdef USE_BUMPMAP
2471	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2472#endif
2473#ifdef USE_NORMALMAP
2474	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2475#endif
2476#ifdef USE_DISPLACEMENTMAP
2477	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2478#endif
2479#ifdef USE_EMISSIVEMAP
2480	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2481#endif
2482#ifdef USE_METALNESSMAP
2483	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2484#endif
2485#ifdef USE_ROUGHNESSMAP
2486	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2487#endif
2488#ifdef USE_ANISOTROPYMAP
2489	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2490#endif
2491#ifdef USE_CLEARCOATMAP
2492	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2493#endif
2494#ifdef USE_CLEARCOAT_NORMALMAP
2495	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2496#endif
2497#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2498	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2499#endif
2500#ifdef USE_IRIDESCENCEMAP
2501	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2502#endif
2503#ifdef USE_IRIDESCENCE_THICKNESSMAP
2504	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2505#endif
2506#ifdef USE_SHEEN_COLORMAP
2507	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2508#endif
2509#ifdef USE_SHEEN_ROUGHNESSMAP
2510	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2511#endif
2512#ifdef USE_SPECULARMAP
2513	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2514#endif
2515#ifdef USE_SPECULAR_COLORMAP
2516	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2517#endif
2518#ifdef USE_SPECULAR_INTENSITYMAP
2519	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2520#endif
2521#ifdef USE_TRANSMISSIONMAP
2522	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2523#endif
2524#ifdef USE_THICKNESSMAP
2525	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2526#endif`,ff=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2527	vec4 worldPosition = vec4( transformed, 1.0 );
2528	#ifdef USE_BATCHING
2529		worldPosition = batchingMatrix * worldPosition;
2530	#endif
2531	#ifdef USE_INSTANCING
2532		worldPosition = instanceMatrix * worldPosition;
2533	#endif
2534	worldPosition = modelMatrix * worldPosition;
2535#endif`;const pf=`varying vec2 vUv;
2536uniform mat3 uvTransform;
2537void main() {
2538	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2539	gl_Position = vec4( position.xy, 1.0, 1.0 );
2540}`,mf=`uniform sampler2D t2D;
2541uniform float backgroundIntensity;
2542varying vec2 vUv;
2543void main() {
2544	vec4 texColor = texture2D( t2D, vUv );
2545	#ifdef DECODE_VIDEO_TEXTURE
2546		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 );
2547	#endif
2548	texColor.rgb *= backgroundIntensity;
2549	gl_FragColor = texColor;
2550	#include <tonemapping_fragment>
2551	#include <colorspace_fragment>
2552}`,gf=`varying vec3 vWorldDirection;
2553#include <common>
2554void main() {
2555	vWorldDirection = transformDirection( position, modelMatrix );
2556	#include <begin_vertex>
2557	#include <project_vertex>
2558	gl_Position.z = gl_Position.w;
2559}`,_f=`#ifdef ENVMAP_TYPE_CUBE
2560	uniform samplerCube envMap;
2561#elif defined( ENVMAP_TYPE_CUBE_UV )
2562	uniform sampler2D envMap;
2563#endif
2564uniform float flipEnvMap;
2565uniform float backgroundBlurriness;
2566uniform float backgroundIntensity;
2567uniform mat3 backgroundRotation;
2568varying vec3 vWorldDirection;
2569#include <cube_uv_reflection_fragment>
2570void main() {
2571	#ifdef ENVMAP_TYPE_CUBE
2572		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2573	#elif defined( ENVMAP_TYPE_CUBE_UV )
2574		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2575	#else
2576		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2577	#endif
2578	texColor.rgb *= backgroundIntensity;
2579	gl_FragColor = texColor;
2580	#include <tonemapping_fragment>
2581	#include <colorspace_fragment>
2582}`,vf=`varying vec3 vWorldDirection;
2583#include <common>
2584void main() {
2585	vWorldDirection = transformDirection( position, modelMatrix );
2586	#include <begin_vertex>
2587	#include <project_vertex>
2588	gl_Position.z = gl_Position.w;
2589}`,xf=`uniform samplerCube tCube;
2590uniform float tFlip;
2591uniform float opacity;
2592varying vec3 vWorldDirection;
2593void main() {
2594	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2595	gl_FragColor = texColor;
2596	gl_FragColor.a *= opacity;
2597	#include <tonemapping_fragment>
2598	#include <colorspace_fragment>
2599}`,Sf=`#include <common>
2600#include <batching_pars_vertex>
2601#include <uv_pars_vertex>
2602#include <displacementmap_pars_vertex>
2603#include <morphtarget_pars_vertex>
2604#include <skinning_pars_vertex>
2605#include <logdepthbuf_pars_vertex>
2606#include <clipping_planes_pars_vertex>
2607varying vec2 vHighPrecisionZW;
2608void main() {
2609	#include <uv_vertex>
2610	#include <batching_vertex>
2611	#include <skinbase_vertex>
2612	#include <morphinstance_vertex>
2613	#ifdef USE_DISPLACEMENTMAP
2614		#include <beginnormal_vertex>
2615		#include <morphnormal_vertex>
2616		#include <skinnormal_vertex>
2617	#endif
2618	#include <begin_vertex>
2619	#include <morphtarget_vertex>
2620	#include <skinning_vertex>
2621	#include <displacementmap_vertex>
2622	#include <project_vertex>
2623	#include <logdepthbuf_vertex>
2624	#include <clipping_planes_vertex>
2625	vHighPrecisionZW = gl_Position.zw;
2626}`,Mf=`#if DEPTH_PACKING == 3200
2627	uniform float opacity;
2628#endif
2629#include <common>
2630#include <packing>
2631#include <uv_pars_fragment>
2632#include <map_pars_fragment>
2633#include <alphamap_pars_fragment>
2634#include <alphatest_pars_fragment>
2635#include <alphahash_pars_fragment>
2636#include <logdepthbuf_pars_fragment>
2637#include <clipping_planes_pars_fragment>
2638varying vec2 vHighPrecisionZW;
2639void main() {
2640	vec4 diffuseColor = vec4( 1.0 );
2641	#include <clipping_planes_fragment>
2642	#if DEPTH_PACKING == 3200
2643		diffuseColor.a = opacity;
2644	#endif
2645	#include <map_fragment>
2646	#include <alphamap_fragment>
2647	#include <alphatest_fragment>
2648	#include <alphahash_fragment>
2649	#include <logdepthbuf_fragment>
2650	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2651	#if DEPTH_PACKING == 3200
2652		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2653	#elif DEPTH_PACKING == 3201
2654		gl_FragColor = packDepthToRGBA( fragCoordZ );
2655	#elif DEPTH_PACKING == 3202
2656		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2657	#elif DEPTH_PACKING == 3203
2658		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2659	#endif
2660}`,yf=`#define DISTANCE
2661varying vec3 vWorldPosition;
2662#include <common>
2663#include <batching_pars_vertex>
2664#include <uv_pars_vertex>
2665#include <displacementmap_pars_vertex>
2666#include <morphtarget_pars_vertex>
2667#include <skinning_pars_vertex>
2668#include <clipping_planes_pars_vertex>
2669void main() {
2670	#include <uv_vertex>
2671	#include <batching_vertex>
2672	#include <skinbase_vertex>
2673	#include <morphinstance_vertex>
2674	#ifdef USE_DISPLACEMENTMAP
2675		#include <beginnormal_vertex>
2676		#include <morphnormal_vertex>
2677		#include <skinnormal_vertex>
2678	#endif
2679	#include <begin_vertex>
2680	#include <morphtarget_vertex>
2681	#include <skinning_vertex>
2682	#include <displacementmap_vertex>
2683	#include <project_vertex>
2684	#include <worldpos_vertex>
2685	#include <clipping_planes_vertex>
2686	vWorldPosition = worldPosition.xyz;
2687}`,Ef=`#define DISTANCE
2688uniform vec3 referencePosition;
2689uniform float nearDistance;
2690uniform float farDistance;
2691varying vec3 vWorldPosition;
2692#include <common>
2693#include <packing>
2694#include <uv_pars_fragment>
2695#include <map_pars_fragment>
2696#include <alphamap_pars_fragment>
2697#include <alphatest_pars_fragment>
2698#include <alphahash_pars_fragment>
2699#include <clipping_planes_pars_fragment>
2700void main () {
2701	vec4 diffuseColor = vec4( 1.0 );
2702	#include <clipping_planes_fragment>
2703	#include <map_fragment>
2704	#include <alphamap_fragment>
2705	#include <alphatest_fragment>
2706	#include <alphahash_fragment>
2707	float dist = length( vWorldPosition - referencePosition );
2708	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2709	dist = saturate( dist );
2710	gl_FragColor = packDepthToRGBA( dist );
2711}`,Tf=`varying vec3 vWorldDirection;
2712#include <common>
2713void main() {
2714	vWorldDirection = transformDirection( position, modelMatrix );
2715	#include <begin_vertex>
2716	#include <project_vertex>
2717}`,bf=`uniform sampler2D tEquirect;
2718varying vec3 vWorldDirection;
2719#include <common>
2720void main() {
2721	vec3 direction = normalize( vWorldDirection );
2722	vec2 sampleUV = equirectUv( direction );
2723	gl_FragColor = texture2D( tEquirect, sampleUV );
2724	#include <tonemapping_fragment>
2725	#include <colorspace_fragment>
2726}`,Af=`uniform float scale;
2727attribute float lineDistance;
2728varying float vLineDistance;
2729#include <common>
2730#include <uv_pars_vertex>
2731#include <color_pars_vertex>
2732#include <fog_pars_vertex>
2733#include <morphtarget_pars_vertex>
2734#include <logdepthbuf_pars_vertex>
2735#include <clipping_planes_pars_vertex>
2736void main() {
2737	vLineDistance = scale * lineDistance;
2738	#include <uv_vertex>
2739	#include <color_vertex>
2740	#include <morphinstance_vertex>
2741	#include <morphcolor_vertex>
2742	#include <begin_vertex>
2743	#include <morphtarget_vertex>
2744	#include <project_vertex>
2745	#include <logdepthbuf_vertex>
2746	#include <clipping_planes_vertex>
2747	#include <fog_vertex>
2748}`,wf=`uniform vec3 diffuse;
2749uniform float opacity;
2750uniform float dashSize;
2751uniform float totalSize;
2752varying float vLineDistance;
2753#include <common>
2754#include <color_pars_fragment>
2755#include <uv_pars_fragment>
2756#include <map_pars_fragment>
2757#include <fog_pars_fragment>
2758#include <logdepthbuf_pars_fragment>
2759#include <clipping_planes_pars_fragment>
2760void main() {
2761	vec4 diffuseColor = vec4( diffuse, opacity );
2762	#include <clipping_planes_fragment>
2763	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2764		discard;
2765	}
2766	vec3 outgoingLight = vec3( 0.0 );
2767	#include <logdepthbuf_fragment>
2768	#include <map_fragment>
2769	#include <color_fragment>
2770	outgoingLight = diffuseColor.rgb;
2771	#include <opaque_fragment>
2772	#include <tonemapping_fragment>
2773	#include <colorspace_fragment>
2774	#include <fog_fragment>
2775	#include <premultiplied_alpha_fragment>
2776}`,Rf=`#include <common>
2777#include <batching_pars_vertex>
2778#include <uv_pars_vertex>
2779#include <envmap_pars_vertex>
2780#include <color_pars_vertex>
2781#include <fog_pars_vertex>
2782#include <morphtarget_pars_vertex>
2783#include <skinning_pars_vertex>
2784#include <logdepthbuf_pars_vertex>
2785#include <clipping_planes_pars_vertex>
2786void main() {
2787	#include <uv_vertex>
2788	#include <color_vertex>
2789	#include <morphinstance_vertex>
2790	#include <morphcolor_vertex>
2791	#include <batching_vertex>
2792	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2793		#include <beginnormal_vertex>
2794		#include <morphnormal_vertex>
2795		#include <skinbase_vertex>
2796		#include <skinnormal_vertex>
2797		#include <defaultnormal_vertex>
2798	#endif
2799	#include <begin_vertex>
2800	#include <morphtarget_vertex>
2801	#include <skinning_vertex>
2802	#include <project_vertex>
2803	#include <logdepthbuf_vertex>
2804	#include <clipping_planes_vertex>
2805	#include <worldpos_vertex>
2806	#include <envmap_vertex>
2807	#include <fog_vertex>
2808}`,Cf=`uniform vec3 diffuse;
2809uniform float opacity;
2810#ifndef FLAT_SHADED
2811	varying vec3 vNormal;
2812#endif
2813#include <common>
2814#include <dithering_pars_fragment>
2815#include <color_pars_fragment>
2816#include <uv_pars_fragment>
2817#include <map_pars_fragment>
2818#include <alphamap_pars_fragment>
2819#include <alphatest_pars_fragment>
2820#include <alphahash_pars_fragment>
2821#include <aomap_pars_fragment>
2822#include <lightmap_pars_fragment>
2823#include <envmap_common_pars_fragment>
2824#include <envmap_pars_fragment>
2825#include <fog_pars_fragment>
2826#include <specularmap_pars_fragment>
2827#include <logdepthbuf_pars_fragment>
2828#include <clipping_planes_pars_fragment>
2829void main() {
2830	vec4 diffuseColor = vec4( diffuse, opacity );
2831	#include <clipping_planes_fragment>
2832	#include <logdepthbuf_fragment>
2833	#include <map_fragment>
2834	#include <color_fragment>
2835	#include <alphamap_fragment>
2836	#include <alphatest_fragment>
2837	#include <alphahash_fragment>
2838	#include <specularmap_fragment>
2839	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2840	#ifdef USE_LIGHTMAP
2841		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2842		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2843	#else
2844		reflectedLight.indirectDiffuse += vec3( 1.0 );
2845	#endif
2846	#include <aomap_fragment>
2847	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2848	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2849	#include <envmap_fragment>
2850	#include <opaque_fragment>
2851	#include <tonemapping_fragment>
2852	#include <colorspace_fragment>
2853	#include <fog_fragment>
2854	#include <premultiplied_alpha_fragment>
2855	#include <dithering_fragment>
2856}`,Pf=`#define LAMBERT
2857varying vec3 vViewPosition;
2858#include <common>
2859#include <batching_pars_vertex>
2860#include <uv_pars_vertex>
2861#include <displacementmap_pars_vertex>
2862#include <envmap_pars_vertex>
2863#include <color_pars_vertex>
2864#include <fog_pars_vertex>
2865#include <normal_pars_vertex>
2866#include <morphtarget_pars_vertex>
2867#include <skinning_pars_vertex>
2868#include <shadowmap_pars_vertex>
2869#include <logdepthbuf_pars_vertex>
2870#include <clipping_planes_pars_vertex>
2871void main() {
2872	#include <uv_vertex>
2873	#include <color_vertex>
2874	#include <morphinstance_vertex>
2875	#include <morphcolor_vertex>
2876	#include <batching_vertex>
2877	#include <beginnormal_vertex>
2878	#include <morphnormal_vertex>
2879	#include <skinbase_vertex>
2880	#include <skinnormal_vertex>
2881	#include <defaultnormal_vertex>
2882	#include <normal_vertex>
2883	#include <begin_vertex>
2884	#include <morphtarget_vertex>
2885	#include <skinning_vertex>
2886	#include <displacementmap_vertex>
2887	#include <project_vertex>
2888	#include <logdepthbuf_vertex>
2889	#include <clipping_planes_vertex>
2890	vViewPosition = - mvPosition.xyz;
2891	#include <worldpos_vertex>
2892	#include <envmap_vertex>
2893	#include <shadowmap_vertex>
2894	#include <fog_vertex>
2895}`,Lf=`#define LAMBERT
2896uniform vec3 diffuse;
2897uniform vec3 emissive;
2898uniform float opacity;
2899#include <common>
2900#include <packing>
2901#include <dithering_pars_fragment>
2902#include <color_pars_fragment>
2903#include <uv_pars_fragment>
2904#include <map_pars_fragment>
2905#include <alphamap_pars_fragment>
2906#include <alphatest_pars_fragment>
2907#include <alphahash_pars_fragment>
2908#include <aomap_pars_fragment>
2909#include <lightmap_pars_fragment>
2910#include <emissivemap_pars_fragment>
2911#include <envmap_common_pars_fragment>
2912#include <envmap_pars_fragment>
2913#include <fog_pars_fragment>
2914#include <bsdfs>
2915#include <lights_pars_begin>
2916#include <normal_pars_fragment>
2917#include <lights_lambert_pars_fragment>
2918#include <shadowmap_pars_fragment>
2919#include <bumpmap_pars_fragment>
2920#include <normalmap_pars_fragment>
2921#include <specularmap_pars_fragment>
2922#include <logdepthbuf_pars_fragment>
2923#include <clipping_planes_pars_fragment>
2924void main() {
2925	vec4 diffuseColor = vec4( diffuse, opacity );
2926	#include <clipping_planes_fragment>
2927	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2928	vec3 totalEmissiveRadiance = emissive;
2929	#include <logdepthbuf_fragment>
2930	#include <map_fragment>
2931	#include <color_fragment>
2932	#include <alphamap_fragment>
2933	#include <alphatest_fragment>
2934	#include <alphahash_fragment>
2935	#include <specularmap_fragment>
2936	#include <normal_fragment_begin>
2937	#include <normal_fragment_maps>
2938	#include <emissivemap_fragment>
2939	#include <lights_lambert_fragment>
2940	#include <lights_fragment_begin>
2941	#include <lights_fragment_maps>
2942	#include <lights_fragment_end>
2943	#include <aomap_fragment>
2944	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2945	#include <envmap_fragment>
2946	#include <opaque_fragment>
2947	#include <tonemapping_fragment>
2948	#include <colorspace_fragment>
2949	#include <fog_fragment>
2950	#include <premultiplied_alpha_fragment>
2951	#include <dithering_fragment>
2952}`,Df=`#define MATCAP
2953varying vec3 vViewPosition;
2954#include <common>
2955#include <batching_pars_vertex>
2956#include <uv_pars_vertex>
2957#include <color_pars_vertex>
2958#include <displacementmap_pars_vertex>
2959#include <fog_pars_vertex>
2960#include <normal_pars_vertex>
2961#include <morphtarget_pars_vertex>
2962#include <skinning_pars_vertex>
2963#include <logdepthbuf_pars_vertex>
2964#include <clipping_planes_pars_vertex>
2965void main() {
2966	#include <uv_vertex>
2967	#include <color_vertex>
2968	#include <morphinstance_vertex>
2969	#include <morphcolor_vertex>
2970	#include <batching_vertex>
2971	#include <beginnormal_vertex>
2972	#include <morphnormal_vertex>
2973	#include <skinbase_vertex>
2974	#include <skinnormal_vertex>
2975	#include <defaultnormal_vertex>
2976	#include <normal_vertex>
2977	#include <begin_vertex>
2978	#include <morphtarget_vertex>
2979	#include <skinning_vertex>
2980	#include <displacementmap_vertex>
2981	#include <project_vertex>
2982	#include <logdepthbuf_vertex>
2983	#include <clipping_planes_vertex>
2984	#include <fog_vertex>
2985	vViewPosition = - mvPosition.xyz;
2986}`,Uf=`#define MATCAP
2987uniform vec3 diffuse;
2988uniform float opacity;
2989uniform sampler2D matcap;
2990varying vec3 vViewPosition;
2991#include <common>
2992#include <dithering_pars_fragment>
2993#include <color_pars_fragment>
2994#include <uv_pars_fragment>
2995#include <map_pars_fragment>
2996#include <alphamap_pars_fragment>
2997#include <alphatest_pars_fragment>
2998#include <alphahash_pars_fragment>
2999#include <fog_pars_fragment>
3000#include <normal_pars_fragment>
3001#include <bumpmap_pars_fragment>
3002#include <normalmap_pars_fragment>
3003#include <logdepthbuf_pars_fragment>
3004#include <clipping_planes_pars_fragment>
3005void main() {
3006	ve
3006c4 diffuseColor = vec4( diffuse, opacity );
3007	#include <clipping_planes_fragment>
3008	#include <logdepthbuf_fragment>
3009	#include <map_fragment>
3010	#include <color_fragment>
3011	#include <alphamap_fragment>
3012	#include <alphatest_fragment>
3013	#include <alphahash_fragment>
3014	#include <normal_fragment_begin>
3015	#include <normal_fragment_maps>
3016	vec3 viewDir = normalize( vViewPosition );
3017	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3018	vec3 y = cross( viewDir, x );
3019	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3020	#ifdef USE_MATCAP
3021		vec4 matcapColor = texture2D( matcap, uv );
3022	#else
3023		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3024	#endif
3025	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3026	#include <opaque_fragment>
3027	#include <tonemapping_fragment>
3028	#include <colorspace_fragment>
3029	#include <fog_fragment>
3030	#include <premultiplied_alpha_fragment>
3031	#include <dithering_fragment>
3032}`,If=`#define NORMAL
3033#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3034	varying vec3 vViewPosition;
3035#endif
3036#include <common>
3037#include <batching_pars_vertex>
3038#include <uv_pars_vertex>
3039#include <displacementmap_pars_vertex>
3040#include <normal_pars_vertex>
3041#include <morphtarget_pars_vertex>
3042#include <skinning_pars_vertex>
3043#include <logdepthbuf_pars_vertex>
3044#include <clipping_planes_pars_vertex>
3045void main() {
3046	#include <uv_vertex>
3047	#include <batching_vertex>
3048	#include <beginnormal_vertex>
3049	#include <morphinstance_vertex>
3050	#include <morphnormal_vertex>
3051	#include <skinbase_vertex>
3052	#include <skinnormal_vertex>
3053	#include <defaultnormal_vertex>
3054	#include <normal_vertex>
3055	#include <begin_vertex>
3056	#include <morphtarget_vertex>
3057	#include <skinning_vertex>
3058	#include <displacementmap_vertex>
3059	#include <project_vertex>
3060	#include <logdepthbuf_vertex>
3061	#include <clipping_planes_vertex>
3062#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3063	vViewPosition = - mvPosition.xyz;
3064#endif
3065}`,Nf=`#define NORMAL
3066uniform float opacity;
3067#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3068	varying vec3 vViewPosition;
3069#endif
3070#include <packing>
3071#include <uv_pars_fragment>
3072#include <normal_pars_fragment>
3073#include <bumpmap_pars_fragment>
3074#include <normalmap_pars_fragment>
3075#include <logdepthbuf_pars_fragment>
3076#include <clipping_planes_pars_fragment>
3077void main() {
3078	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3079	#include <clipping_planes_fragment>
3080	#include <logdepthbuf_fragment>
3081	#include <normal_fragment_begin>
3082	#include <normal_fragment_maps>
3083	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3084	#ifdef OPAQUE
3085		gl_FragColor.a = 1.0;
3086	#endif
3087}`,Of=`#define PHONG
3088varying vec3 vViewPosition;
3089#include <common>
3090#include <batching_pars_vertex>
3091#include <uv_pars_vertex>
3092#include <displacementmap_pars_vertex>
3093#include <envmap_pars_vertex>
3094#include <color_pars_vertex>
3095#include <fog_pars_vertex>
3096#include <normal_pars_vertex>
3097#include <morphtarget_pars_vertex>
3098#include <skinning_pars_vertex>
3099#include <shadowmap_pars_vertex>
3100#include <logdepthbuf_pars_vertex>
3101#include <clipping_planes_pars_vertex>
3102void main() {
3103	#include <uv_vertex>
3104	#include <color_vertex>
3105	#include <morphcolor_vertex>
3106	#include <batching_vertex>
3107	#include <beginnormal_vertex>
3108	#include <morphinstance_vertex>
3109	#include <morphnormal_vertex>
3110	#include <skinbase_vertex>
3111	#include <skinnormal_vertex>
3112	#include <defaultnormal_vertex>
3113	#include <normal_vertex>
3114	#include <begin_vertex>
3115	#include <morphtarget_vertex>
3116	#include <skinning_vertex>
3117	#include <displacementmap_vertex>
3118	#include <project_vertex>
3119	#include <logdepthbuf_vertex>
3120	#include <clipping_planes_vertex>
3121	vViewPosition = - mvPosition.xyz;
3122	#include <worldpos_vertex>
3123	#include <envmap_vertex>
3124	#include <shadowmap_vertex>
3125	#include <fog_vertex>
3126}`,Ff=`#define PHONG
3127uniform vec3 diffuse;
3128uniform vec3 emissive;
3129uniform vec3 specular;
3130uniform float shininess;
3131uniform float opacity;
3132#include <common>
3133#include <packing>
3134#include <dithering_pars_fragment>
3135#include <color_pars_fragment>
3136#include <uv_pars_fragment>
3137#include <map_pars_fragment>
3138#include <alphamap_pars_fragment>
3139#include <alphatest_pars_fragment>
3140#include <alphahash_pars_fragment>
3141#include <aomap_pars_fragment>
3142#include <lightmap_pars_fragment>
3143#include <emissivemap_pars_fragment>
3144#include <envmap_common_pars_fragment>
3145#include <envmap_pars_fragment>
3146#include <fog_pars_fragment>
3147#include <bsdfs>
3148#include <lights_pars_begin>
3149#include <normal_pars_fragment>
3150#include <lights_phong_pars_fragment>
3151#include <shadowmap_pars_fragment>
3152#include <bumpmap_pars_fragment>
3153#include <normalmap_pars_fragment>
3154#include <specularmap_pars_fragment>
3155#include <logdepthbuf_pars_fragment>
3156#include <clipping_planes_pars_fragment>
3157void main() {
3158	vec4 diffuseColor = vec4( diffuse, opacity );
3159	#include <clipping_planes_fragment>
3160	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3161	vec3 totalEmissiveRadiance = emissive;
3162	#include <logdepthbuf_fragment>
3163	#include <map_fragment>
3164	#include <color_fragment>
3165	#include <alphamap_fragment>
3166	#include <alphatest_fragment>
3167	#include <alphahash_fragment>
3168	#include <specularmap_fragment>
3169	#include <normal_fragment_begin>
3170	#include <normal_fragment_maps>
3171	#include <emissivemap_fragment>
3172	#include <lights_phong_fragment>
3173	#include <lights_fragment_begin>
3174	#include <lights_fragment_maps>
3175	#include <lights_fragment_end>
3176	#include <aomap_fragment>
3177	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3178	#include <envmap_fragment>
3179	#include <opaque_fragment>
3180	#include <tonemapping_fragment>
3181	#include <colorspace_fragment>
3182	#include <fog_fragment>
3183	#include <premultiplied_alpha_fragment>
3184	#include <dithering_fragment>
3185}`,Bf=`#define STANDARD
3186varying vec3 vViewPosition;
3187#ifdef USE_TRANSMISSION
3188	varying vec3 vWorldPosition;
3189#endif
3190#include <common>
3191#include <batching_pars_vertex>
3192#include <uv_pars_vertex>
3193#include <displacementmap_pars_vertex>
3194#include <color_pars_vertex>
3195#include <fog_pars_vertex>
3196#include <normal_pars_vertex>
3197#include <morphtarget_pars_vertex>
3198#include <skinning_pars_vertex>
3199#include <shadowmap_pars_vertex>
3200#include <logdepthbuf_pars_vertex>
3201#include <clipping_planes_pars_vertex>
3202void main() {
3203	#include <uv_vertex>
3204	#include <color_vertex>
3205	#include <morphinstance_vertex>
3206	#include <morphcolor_vertex>
3207	#include <batching_vertex>
3208	#include <beginnormal_vertex>
3209	#include <morphnormal_vertex>
3210	#include <skinbase_vertex>
3211	#include <skinnormal_vertex>
3212	#include <defaultnormal_vertex>
3213	#include <normal_vertex>
3214	#include <begin_vertex>
3215	#include <morphtarget_vertex>
3216	#include <skinning_vertex>
3217	#include <displacementmap_vertex>
3218	#include <project_vertex>
3219	#include <logdepthbuf_vertex>
3220	#include <clipping_planes_vertex>
3221	vViewPosition = - mvPosition.xyz;
3222	#include <worldpos_vertex>
3223	#include <shadowmap_vertex>
3224	#include <fog_vertex>
3225#ifdef USE_TRANSMISSION
3226	vWorldPosition = worldPosition.xyz;
3227#endif
3228}`,zf=`#define STANDARD
3229#ifdef PHYSICAL
3230	#define IOR
3231	#define USE_SPECULAR
3232#endif
3233uniform vec3 diffuse;
3234uniform vec3 emissive;
3235uniform float roughness;
3236uniform float metalness;
3237uniform float opacity;
3238#ifdef IOR
3239	uniform float ior;
3240#endif
3241#ifdef USE_SPECULAR
3242	uniform float specularIntensity;
3243	uniform vec3 specularColor;
3244	#ifdef USE_SPECULAR_COLORMAP
3245		uniform sampler2D specularColorMap;
3246	#endif
3247	#ifdef USE_SPECULAR_INTENSITYMAP
3248		uniform sampler2D specularIntensityMap;
3249	#endif
3250#endif
3251#ifdef USE_CLEARCOAT
3252	uniform float clearcoat;
3253	uniform float clearcoatRoughness;
3254#endif
3255#ifdef USE_DISPERSION
3256	uniform float dispersion;
3257#endif
3258#ifdef USE_IRIDESCENCE
3259	uniform float iridescence;
3260	uniform float iridescenceIOR;
3261	uniform float iridescenceThicknessMinimum;
3262	uniform float iridescenceThicknessMaximum;
3263#endif
3264#ifdef USE_SHEEN
3265	uniform vec3 sheenColor;
3266	uniform float sheenRoughness;
3267	#ifdef USE_SHEEN_COLORMAP
3268		uniform sampler2D sheenColorMap;
3269	#endif
3270	#ifdef USE_SHEEN_ROUGHNESSMAP
3271		uniform sampler2D sheenRoughnessMap;
3272	#endif
3273#endif
3274#ifdef USE_ANISOTROPY
3275	uniform vec2 anisotropyVector;
3276	#ifdef USE_ANISOTROPYMAP
3277		uniform sampler2D anisotropyMap;
3278	#endif
3279#endif
3280varying vec3 vViewPosition;
3281#include <common>
3282#include <packing>
3283#include <dithering_pars_fragment>
3284#include <color_pars_fragment>
3285#include <uv_pars_fragment>
3286#include <map_pars_fragment>
3287#include <alphamap_pars_fragment>
3288#include <alphatest_pars_fragment>
3289#include <alphahash_pars_fragment>
3290#include <aomap_pars_fragment>
3291#include <lightmap_pars_fragment>
3292#include <emissivemap_pars_fragment>
3293#include <iridescence_fragment>
3294#include <cube_uv_reflection_fragment>
3295#include <envmap_common_pars_fragment>
3296#include <envmap_physical_pars_fragment>
3297#include <fog_pars_fragment>
3298#include <lights_pars_begin>
3299#include <normal_pars_fragment>
3300#include <lights_physical_pars_fragment>
3301#include <transmission_pars_fragment>
3302#include <shadowmap_pars_fragment>
3303#include <bumpmap_pars_fragment>
3304#include <normalmap_pars_fragment>
3305#include <clearcoat_pars_fragment>
3306#include <iridescence_pars_fragment>
3307#include <roughnessmap_pars_fragment>
3308#include <metalnessmap_pars_fragment>
3309#include <logdepthbuf_pars_fragment>
3310#include <clipping_planes_pars_fragment>
3311void main() {
3312	vec4 diffuseColor = vec4( diffuse, opacity );
3313	#include <clipping_planes_fragment>
3314	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3315	vec3 totalEmissiveRadiance = emissive;
3316	#include <logdepthbuf_fragment>
3317	#include <map_fragment>
3318	#include <color_fragment>
3319	#include <alphamap_fragment>
3320	#include <alphatest_fragment>
3321	#include <alphahash_fragment>
3322	#include <roughnessmap_fragment>
3323	#include <metalnessmap_fragment>
3324	#include <normal_fragment_begin>
3325	#include <normal_fragment_maps>
3326	#include <clearcoat_normal_fragment_begin>
3327	#include <clearcoat_normal_fragment_maps>
3328	#include <emissivemap_fragment>
3329	#include <lights_physical_fragment>
3330	#include <lights_fragment_begin>
3331	#include <lights_fragment_maps>
3332	#include <lights_fragment_end>
3333	#include <aomap_fragment>
3334	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3335	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3336	#include <transmission_fragment>
3337	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3338	#ifdef USE_SHEEN
3339		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3340		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3341	#endif
3342	#ifdef USE_CLEARCOAT
3343		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3344		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3345		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3346	#endif
3347	#include <opaque_fragment>
3348	#include <tonemapping_fragment>
3349	#include <colorspace_fragment>
3350	#include <fog_fragment>
3351	#include <premultiplied_alpha_fragment>
3352	#include <dithering_fragment>
3353}`,Hf=`#define TOON
3354varying vec3 vViewPosition;
3355#include <common>
3356#include <batching_pars_vertex>
3357#include <uv_pars_vertex>
3358#include <displacementmap_pars_vertex>
3359#include <color_pars_vertex>
3360#include <fog_pars_vertex>
3361#include <normal_pars_vertex>
3362#include <morphtarget_pars_vertex>
3363#include <skinning_pars_vertex>
3364#include <shadowmap_pars_vertex>
3365#include <logdepthbuf_pars_vertex>
3366#include <clipping_planes_pars_vertex>
3367void main() {
3368	#include <uv_vertex>
3369	#include <color_vertex>
3370	#include <morphinstance_vertex>
3371	#include <morphcolor_vertex>
3372	#include <batching_vertex>
3373	#include <beginnormal_vertex>
3374	#include <morphnormal_vertex>
3375	#include <skinbase_vertex>
3376	#include <skinnormal_vertex>
3377	#include <defaultnormal_vertex>
3378	#include <normal_vertex>
3379	#include <begin_vertex>
3380	#include <morphtarget_vertex>
3381	#include <skinning_vertex>
3382	#include <displacementmap_vertex>
3383	#include <project_vertex>
3384	#include <logdepthbuf_vertex>
3385	#include <clipping_planes_vertex>
3386	vViewPosition = - mvPosition.xyz;
3387	#include <worldpos_vertex>
3388	#include <shadowmap_vertex>
3389	#include <fog_vertex>
3390}`,Gf=`#define TOON
3391uniform vec3 diffuse;
3392uniform vec3 emissive;
3393uniform float opacity;
3394#include <common>
3395#include <packing>
3396#include <dithering_pars_fragment>
3397#include <color_pars_fragment>
3398#include <uv_pars_fragment>
3399#include <map_pars_fragment>
3400#include <alphamap_pars_fragment>
3401#include <alphatest_pars_fragment>
3402#include <alphahash_pars_fragment>
3403#include <aomap_pars_fragment>
3404#include <lightmap_pars_fragment>
3405#include <emissivemap_pars_fragment>
3406#include <gradientmap_pars_fragment>
3407#include <fog_pars_fragment>
3408#include <bsdfs>
3409#include <lights_pars_begin>
3410#include <normal_pars_fragment>
3411#include <lights_toon_pars_fragment>
3412#include <shadowmap_pars_fragment>
3413#include <bumpmap_pars_fragment>
3414#include <normalmap_pars_fragment>
3415#include <logdepthbuf_pars_fragment>
3416#include <clipping_planes_pars_fragment>
3417void main() {
3418	vec4 diffuseColor = vec4( diffuse, opacity );
3419	#include <clipping_planes_fragment>
3420	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3421	vec3 totalEmissiveRadiance = emissive;
3422	#include <logdepthbuf_fragment>
3423	#include <map_fragment>
3424	#include <color_fragment>
3425	#include <alphamap_fragment>
3426	#include <alphatest_fragment>
3427	#include <alphahash_fragment>
3428	#include <normal_fragment_begin>
3429	#include <normal_fragment_maps>
3430	#include <emissivemap_fragment>
3431	#include <lights_toon_fragment>
3432	#include <lights_fragment_begin>
3433	#include <lights_fragment_maps>
3434	#include <lights_fragment_end>
3435	#include <aomap_fragment>
3436	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3437	#include <opaque_fragment>
3438	#include <tonemapping_fragment>
3439	#include <colorspace_fragment>
3440	#include <fog_fragment>
3441	#include <premultiplied_alpha_fragment>
3442	#include <dithering_fragment>
3443}`,Vf=`uniform float size;
3444uniform float scale;
3445#include <common>
3446#include <color_pars_vertex>
3447#include <fog_pars_vertex>
3448#include <morphtarget_pars_vertex>
3449#include <logdepthbuf_pars_vertex>
3450#include <clipping_planes_pars_vertex>
3451#ifdef USE_POINTS_UV
3452	varying vec2 vUv;
3453	uniform mat3 uvTransform;
3454#endif
3455void main() {
3456	#ifdef USE_POINTS_UV
3457		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3458	#endif
3459	#include <color_vertex>
3460	#include <morphinstance_vertex>
3461	#include <morphcolor_vertex>
3462	#include <begin_vertex>
3463	#include <morphtarget_vertex>
3464	#include <project_vertex>
3465	gl_PointSize = size;
3466	#ifdef USE_SIZEATTENUATION
3467		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3468		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3469	#endif
3470	#include <logdepthbuf_vertex>
3471	#include <clipping_planes_vertex>
3472	#include <worldpos_vertex>
3473	#include <fog_vertex>
3474}`,kf=`uniform vec3 diffuse;
3475uniform float opacity;
3476#include <common>
3477#include <color_pars_fragment>
3478#include <map_particle_pars_fragment>
3479#include <alphatest_pars_fragment>
3480#include <alphahash_pars_fragment>
3481#include <fog_pars_fragment>
3482#include <logdepthbuf_pars_fragment>
3483#include <clipping_planes_pars_fragment>
3484void main() {
3485	vec4 diffuseColor = vec4( diffuse, opacity );
3486	#include <clipping_planes_fragment>
3487	vec3 outgoingLight = vec3( 0.0 );
3488	#include <logdepthbuf_fragment>
3489	#include <map_particle_fragment>
3490	#include <color_fragment>
3491	#include <alphatest_fragment>
3492	#include <alphahash_fragment>
3493	outgoingLight = diffuseColor.rgb;
3494	#include <opaque_fragment>
3495	#include <tonemapping_fragment>
3496	#include <colorspace_fragment>
3497	#include <fog_fragment>
3498	#include <premultiplied_alpha_fragment>
3499}`,Wf=`#include <common>
3500#include <batching_pars_vertex>
3501#include <fog_pars_vertex>
3502#include <morphtarget_pars_vertex>
3503#include <skinning_pars_vertex>
3504#include <logdepthbuf_pars_vertex>
3505#include <shadowmap_pars_vertex>
3506void main() {
3507	#include <batching_vertex>
3508	#include <beginnormal_vertex>
3509	#include <morphinstance_vertex>
3510	#include <morphnormal_vertex>
3511	#include <skinbase_vertex>
3512	#include <skinnormal_vertex>
3513	#include <defaultnormal_vertex>
3514	#include <begin_vertex>
3515	#include <morphtarget_vertex>
3516	#include <skinning_vertex>
3517	#include <project_vertex>
3518	#include <logdepthbuf_vertex>
3519	#include <worldpos_vertex>
3520	#include <shadowmap_vertex>
3521	#include <fog_vertex>
3522}`,Xf=`uniform vec3 color;
3523uniform float opacity;
3524#include <common>
3525#include <packing>
3526#include <fog_pars_fragment>
3527#include <bsdfs>
3528#include <lights_pars_begin>
3529#include <logdepthbuf_pars_fragment>
3530#include <shadowmap_pars_fragment>
3531#include <shadowmask_pars_fragment>
3532void main() {
3533	#include <logdepthbuf_fragment>
3534	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3535	#include <tonemapping_fragment>
3536	#include <colorspace_fragment>
3537	#include <fog_fragment>
3538}`,qf=`uniform float rotation;
3539uniform vec2 center;
3540#include <common>
3541#include <uv_pars_vertex>
3542#include <fog_pars_vertex>
3543#include <logdepthbuf_pars_vertex>
3544#include <clipping_planes_pars_vertex>
3545void main() {
3546	#include <uv_vertex>
3547	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
3548	vec2 scale;
3549	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
3550	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
3551	#ifndef USE_SIZEATTENUATION
3552		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3553		if ( isPerspective ) scale *= - mvPosition.z;
3554	#endif
3555	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3556	vec2 rotatedPosition;
3557	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3558	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3559	mvPosition.xy += rotatedPosition;
3560	gl_Position = projectionMatrix * mvPosition;
3561	#include <logdepthbuf_vertex>
3562	#include <clipping_planes_vertex>
3563	#include <fog_vertex>
3564}`,Yf=`uniform vec3 diffuse;
3565uniform float opacity;
3566#include <common>
3567#include <uv_pars_fragment>
3568#include <map_pars_fragment>
3569#include <alphamap_pars_fragment>
3570#include <alphatest_pars_fragment>
3571#include <alphahash_pars_fragment>
3572#include <fog_pars_fragment>
3573#include <logdepthbuf_pars_fragment>
3574#include <clipping_planes_pars_fragment>
3575void main() {
3576	vec4 diffuseColor = vec4( diffuse, opacity );
3577	#include <clipping_planes_fragment>
3578	vec3 outgoingLight = vec3( 0.0 );
3579	#include <logdepthbuf_fragment>
3580	#include <map_fragment>
3581	#include <alphamap_fragment>
3582	#include <alphatest_fragment>
3583	#include <alphahash_fragment>
3584	outgoingLight = diffuseColor.rgb;
3585	#include <opaque_fragment>
3586	#include <tonemapping_fragment>
3587	#include <colorspace_fragment>
3588	#include <fog_fragment>
3589}
3589`,Gt={alphahash_fragment:ph,alphahash_pars_fragment:mh,alphamap_fragment:gh,alphamap_pars_fragment:_h,alphatest_fragment:vh,alphatest_pars_fragment:xh,aomap_fragment:Sh,aomap_pars_fragment:Mh,batching_pars_vertex:yh,batching_vertex:Eh,begin_vertex:Th,beginnormal_vertex:bh,bsdfs:Ah,iridescence_fragment:wh,bumpmap_pars_fragment:Rh,clipping_planes_fragment:Ch,clipping_planes_pars_fragment:Ph,clipping_planes_pars_vertex:Lh,clipping_planes_vertex:Dh,color_fragment:Uh,color_pars_fragment:Ih,color_pars_vertex:Nh,color_vertex:Oh,common:Fh,cube_uv_reflection_fragment:Bh,defaultnormal_vertex:zh,displacementmap_pars_vertex:Hh,displacementmap_vertex:Gh,emissivemap_fragment:Vh,emissivemap_pars_fragment:kh,colorspace_fragment:Wh,colorspace_pars_fragment:Xh,envmap_fragment:qh,envmap_common_pars_fragment:Yh,envmap_pars_fragment:Kh,envmap_pars_vertex:Zh,envmap_physical_pars_fragment:ad,envmap_vertex:jh,fog_vertex:$h,fog_pars_vertex:Jh,fog_fragment:Qh,fog_pars_fragment:td,gradientmap_pars_fragment:ed,lightmap_pars_fragment:nd,lights_lambert_fragment:id,lights_lambert_pars_fragment:rd,lights_pars_begin:sd,lights_toon_fragment:od,lights_toon_pars_fragment:ld,lights_phong_fragment:cd,lights_phong_pars_fragment:ud,lights_physical_fragment:hd,lights_physical_pars_fragment:dd,lights_fragment_begin:fd,lights_fragment_maps:pd,lights_fragment_end:md,logdepthbuf_fragment:gd,logdepthbuf_pars_fragment:_d,logdepthbuf_pars_vertex:vd,logdepthbuf_vertex:xd,map_fragment:Sd,map_pars_fragment:Md,map_particle_fragment:yd,map_particle_pars_fragment:Ed,metalnessmap_fragment:Td,metalnessmap_pars_fragment:bd,morphinstance_vertex:Ad,morphcolor_vertex:wd,morphnormal_vertex:Rd,morphtarget_pars_vertex:Cd,morphtarget_vertex:Pd,normal_fragment_begin:Ld,normal_fragment_maps:Dd,normal_pars_fragment:Ud,normal_pars_vertex:Id,normal_vertex:Nd,normalmap_pars_fragment:Od,clearcoat_normal_fragment_begin:Fd,clearcoat_normal_fragment_maps:Bd,clearcoat_pars_fragment:zd,iridescence_pars_fragment:Hd,opaque_fragment:Gd,packing:Vd,premultiplied_alpha_fragment:kd,project_vertex:Wd,dithering_fragment:Xd,dithering_pars_fragment:qd,roughnessmap_fragment:Yd,roughnessmap_pars_fragment:Kd,shadowmap_pars_fragment:Zd,shadowmap_pars_vertex:jd,shadowmap_vertex:$d,shadowmask_pars_fragment:Jd,skinbase_vertex:Qd,skinning_pars_vertex:tf,skinning_vertex:ef,skinnormal_vertex:nf,specularmap_fragment:rf,specularmap_pars_fragment:sf,tonemapping_fragment:af,tonemapping_pars_fragment:of,transmission_fragment:lf,transmission_pars_fragment:cf,uv_pars_fragment:uf,uv_pars_vertex:hf,uv_vertex:df,worldpos_vertex:ff,background_vert:pf,background_frag:mf,backgroundCube_vert:gf,backgroundCube_frag:_f,cube_vert:vf,cube_frag:xf,depth_vert:Sf,depth_frag:Mf,distanceRGBA_vert:yf,distanceRGBA_frag:Ef,equirect_vert:Tf,equirect_frag:bf,linedashed_vert:Af,linedashed_frag:wf,meshbasic_vert:Rf,meshbasic_frag:Cf,meshlambert_vert:Pf,meshlambert_frag:Lf,meshmatcap_vert:Df,meshmatcap_frag:Uf,meshnormal_vert:If,meshnormal_frag:Nf,meshphong_vert:Of,meshphong_frag:Ff,meshphysical_vert:Bf,meshphysical_frag:zf,meshtoon_vert:Hf,meshtoon_frag:Gf,points_vert:Vf,points_frag:kf,shadow_vert:Wf,shadow_frag:Xf,sprite_vert:qf,sprite_frag:Yf},ht={common:{diffuse:{value:new $t(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Vt},alphaMap:{value:null},alphaMapTransform:{value:new Vt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Vt}},envmap:{envMap:{value:null},envMapRotation:{value:new Vt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Vt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Vt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Vt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Vt},normalScale:{value:new ct(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Vt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Vt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Vt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Vt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new $t(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 $t(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Vt},alphaTest:{value:0},uvTransform:{value:new Vt}},sprite:{diffuse:{value:new $t(16777215)},opacity:{value:1},center:{value:new ct(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Vt},alphaMap:{value:null},alphaMapTransform:{value:new Vt},alphaTest:{value:0}}},Ce={basic:{uniforms:we([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:Gt.meshbasic_vert,fragmentShader:Gt.meshbasic_frag},lambert:{uniforms:we([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new $t(0)}}]),vertexShader:Gt.meshlambert_vert,fragmentShader:Gt.meshlambert_frag},phong:{uniforms:we([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new $t(0)},specular:{value:new $t(1118481)},shininess:{value:30}}]),vertexShader:Gt.meshphong_vert,fragmentShader:Gt.meshphong_frag},standard:{uniforms:we([ht.common,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.roughnessmap,ht.metalnessmap,ht.fog,ht.lights,{emissive:{value:new $t(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Gt.meshphysical_vert,fragmentShader:Gt.meshphysical_frag},toon:{uniforms:we([ht.common,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.gradientmap,ht.fog,ht.lights,{emissive:{value:new $t(0)}}]),vertexShader:Gt.meshtoon_vert,fragmentShader:Gt.meshtoon_frag},matcap:{uniforms:we([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matc
vendor: 5,263 bytes, line 3589
3589ap:{value:null}}]),vertexShader:Gt.meshmatcap_vert,fragmentShader:Gt.meshmatcap_frag},points:{uniforms:we([ht.points,ht.fog]),vertexShader:Gt.points_vert,fragmentShader:Gt.points_frag},dashed:{uniforms:we([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Gt.linedashed_vert,fragmentShader:Gt.linedashed_frag},depth:{uniforms:we([ht.common,ht.displacementmap]),vertexShader:Gt.depth_vert,fragmentShader:Gt.depth_frag},normal:{uniforms:we([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:Gt.meshnormal_vert,fragmentShader:Gt.meshnormal_frag},sprite:{uniforms:we([ht.sprite,ht.fog]),vertexShader:Gt.sprite_vert,fragmentShader:Gt.sprite_frag},background:{uniforms:{uvTransform:{value:new Vt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Gt.background_vert,fragmentShader:Gt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Vt}},vertexShader:Gt.backgroundCube_vert,fragmentShader:Gt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Gt.cube_vert,fragmentShader:Gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Gt.equirect_vert,fragmentShader:Gt.equirect_frag},distanceRGBA:{uniforms:we([ht.common,ht.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Gt.distanceRGBA_vert,fragmentShader:Gt.distanceRGBA_frag},shadow:{uniforms:we([ht.lights,ht.fog,{color:{value:new $t(0)},opacity:{value:1}}]),vertexShader:Gt.shadow_vert,fragmentShader:Gt.shadow_frag}};Ce.physical={uniforms:we([Ce.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Vt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Vt},clearcoatNormalScale:{value:new ct(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Vt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Vt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Vt},sheen:{value:0},sheenColor:{value:new $t(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Vt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Vt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Vt},transmissionSamplerSize:{value:new ct},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Vt},attenuationDistance:{value:0},attenuationColor:{value:new $t(0)},specularColor:{value:new $t(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Vt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Vt},anisotropyVector:{value:new ct},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Vt}}]),vertexShader:Gt.meshphysical_vert,fragmentShader:Gt.meshphysical_frag};const Dr={r:0,b:0,g:0},Wn=new Sn,Kf=new oe;function Zf(i,t,e,n,r,s,o){const a=new $t(0);let l=s===!0?0:1,c,u,h=null,d=0,p=null;function g(A){let x=A.isScene===!0?A.background:null;return x&&x.isTexture&&(x=(A.backgroundBlurriness>0?e:t).get(x)),x}function v(A){let x=!1;const T=g(A);T===null?f(a,l):T&&T.isColor&&(f(T,1),x=!0);const O=i.xr.getEnvironmentBlendMode();O==="additive"?n.buffers.color.setClear(0,0,0,1,o):O==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(i.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function m(A,x){const T=g(x);T&&(T.isCubeTexture||T.mapping===as)?(u===void 0&&(u=new ke(new ar(1,1,1),new Mn({name:"BackgroundCubeMaterial",uniforms:Oi(Ce.backgroundCube.uniforms),vertexShader:Ce.backgroundCube.vertexShader,fragmentShader:Ce.backgroundCube.fragmentShader,side:Pe,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(O,C,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Wn.copy(x.backgroundRotation),Wn.x*=-1,Wn.y*=-1,Wn.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Wn.y*=-1,Wn.z*=-1),u.material.uniforms.envMap.value=T,u.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Kf.makeRotationFromEuler(Wn)),u.material.toneMapped=Kt.getTransfer(T.colorSpace)!==Jt,(h!==T||d!==T.version||p!==i.toneMapping)&&(u.material.needsUpdate=!0,h=T,d=T.version,p=i.toneMapping),u.layers.enableAll(),A.unshift(u,u.geometry,u.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new ke(new or(2,2),new Mn({name:"Backgroun
3589dMaterial",uniforms:Oi(Ce.background.uniforms),vertexShader:Ce.background.vertexShader,fragmentShader:Ce.background.fragmentShader,side:On,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=Kt.getTransfer(T.colorSpace)!==Jt,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(h!==T||d!==T.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,h=T,d=T.version,p=i.toneMapping),c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null))}function f(A,x){A.getRGB(Dr,Yl(i)),n.buffers.color.setClear(Dr.r,Dr.g,Dr.b,x,o)}return{getClearColor:function(){return a},setClearColor:function(A,x=1){a.set(A),l=x,f(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,f(a,l)},render:v,addToRenderList:m}}function jf(i,t){const e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null);let s=r,o=!1;function a(M,P,Y,G,N){let K=!1;const k=h(G,Y,P);s!==k&&(s=k,c(s.object)),K=p(M,G,Y,N),K&&g(M,G,Y,N),N!==null&&t.update(N,i.ELEMENT_ARRAY_BUFFER),(K||o)&&(o=!1,T(M,P,Y,G),N!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(N).buffer))}function l(){return i.createVertexArray()}function c(M){return i.bindVertexArray(M)}function u(M){return i.deleteVertexArray(M)}function h(M,P,Y){const G=Y.wireframe===!0;let N=n[M.id];N===void 0&&(N={},n[M.id]=N);let K=N[P.id];K===void 0&&(K={},N[P.id]=K);let k=K[G];return k===void 0&&(k=d(l()),K[G]=k),k}function d(M){const P=[],Y=[],G=[];for(let N=0;N<e;N++)P[N]=0,Y[N]=0,G[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:P,enabledAttributes:Y,attributeDivisors:G,object:M,attributes:{},index:null}}function p(M,P,Y,G){const N=s.attributes,K=P.attributes;let k=0;const J=Y.getAttributes();for(const W in J)if(J[W].location>=0){const et=N[W];let mt=K[W];if(mt===void 0&&(W==="instanceMatrix"&&M.instanceMatrix&&(mt=M.instanceMatrix),W==="instanceColor"&&M.instanceColor&&(mt=M.instanceColor)),et===void 0||et.attribute!==mt||mt&&et.data!==mt.data)return!0;k++}return s.attributesNum!==k||s.index!==G}function g(M,P,Y,G){const N={},K=P.attributes;let k=0;const J=Y.getAttributes();for(const W in J)if(J[W].location>=0){let et=K[W];et===void 0&&(W==="instanceMatrix"&&M.instanceMatrix&&(et=M.instanceMatrix),W==="instanceColor"&&M.instanceColor&&(et=M.instanceColor));const mt={};mt.attribute=et,et&&et.data&&(mt.data=et.data),N[W]=mt,k++}s.attributes=N,s.attributesNum=k,s.index=G}function v(){const M=s.newAttributes;for(let P=0,Y=M.length;P<Y;P++)M[P]=0}function m(M){f(M,0)}function f(M,P){const Y=s.newAttributes,G=s.enabledAttributes,N=s.attributeDivisors;Y[M]=1,G[M]===0&&(i.enableVertexAttribArray(M),G[M]=1),N[M]!==P&&(i.vertexAttribDivisor(M,P),N[M]=P)}function A(){const M=s.newAttributes,P=s.enabledAttributes;for(let Y=0,G=P.length;Y<G;Y++)P[Y]!==M[Y]&&(i.disableVertexAttribArray(Y),P[Y]=0)}function x(M,P,Y,G,N,K,k){k===!0?i.vertexAttribIPointer(M,P,Y,N,K):i.vertexAttribPointer(M,P,Y,G,N,K)}function T(M,P,Y,G){v();const N=G.attributes,K=Y.getAttributes(),k=P.defaultAttributeValues;for(const J in K){const W=K[J];if(W.location>=0){let ot=N[J];if(ot===void 0&&(J==="instanceMatrix"&&M.instanceMatrix&&(ot=M.instanceMatrix),J==="instanceColor"&&M.instanceColor&&(ot=M.instanceColor)),ot!==void 0){const et=ot.normalized,mt=ot.itemSize,At=t.get(ot);if(At===void 0)continue;const Pt=At.buffer,q=At.type,nt=At.bytesPerElement,ft=q===i.INT||q===i.UNSIGNED_INT||ot.gpuType===Na;if(ot.isInterleavedBufferAttribute){const ut=ot.data,Rt=ut.stride,Ut=ot.offset;if(ut.isInstancedInterleavedBuffer){for(let Lt=0;Lt<W.locationSize;Lt++)f(W.location+Lt,ut.meshPerAttribute);M.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=ut.meshPerAttribute*ut.count)}else for(let Lt=0;Lt<W.locationSize;Lt++)m(W.location+Lt);i.bindBuffer(i.ARRAY_BUFFER,Pt);for(let Lt=0;Lt<W.locationSize;Lt++)x(W.location+Lt,mt/W.locationSize,q,et,Rt*nt,(Ut+mt/W.locationSize*Lt)*nt,ft)}else{if(ot.isInstancedBufferAttribute){for(let ut=0;ut<W.locationSize;ut++)f(W.location+ut,ot.meshPerAttribute);M.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=ot.meshPerAttribute*ot.count)}else for(let ut=0;ut<W.locationSize;ut++)m(W.location+ut);i.bindBuffer(i.ARRAY_BUFFER,Pt);for(let ut=0;ut<W.locationSize;ut++)x(W.location+ut,mt/W.locationSize,q,et,mt*nt,mt/W.locationSize*ut*nt,ft)}}else if(k!==void 0){const et=k[J];if(et!==void 0)switch(et.length){case 2:i.vertexAttrib2fv(W.location,et);break;case 3:i.vertexAttrib3fv(W.location,et);break;case 4:i.vertexAttrib4fv(W.location,et);break;default:i.vertexAttrib1fv(W.location,et)}}}}A()}function O(){U();for(const M in n){const P=n[M];for(const Y in P){const G=P[Y];for(const N in G)u(G[N].object),delete G[N];delete P[Y]}delete n[M]}}
vendor: 15,118 bytes, lines 3589-3664
3589function C(M){if(n[M.id]===void 0)return;const P=n[M.id];for(const Y in P){const G=P[Y];for(const N in G)u(G[N].object),delete G[N];delete P[Y]}delete n[M.id]}function R(M){for(const P in n){const Y=n[P];if(Y[M.id]===void 0)continue;const G=Y[M.id];for(const N in G)u(G[N].object),delete G[N];delete Y[M.id]}}function U(){b(),o=!0,s!==r&&(s=r,c(s.object))}function b(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:U,resetDefaultState:b,dispose:O,releaseStatesOfGeometry:C,releaseStatesOfProgram:R,initAttributes:v,enableAttribute:m,disableUnusedAttributes:A}}function $f(i,t,e){let n;function r(c){n=c}function s(c,u){i.drawArrays(n,c,u),e.update(u,n,1)}function o(c,u,h){h!==0&&(i.drawArraysInstanced(n,c,u,h),e.update(u,n,h))}function a(c,u,h){if(h===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,u,0,h);let p=0;for(let g=0;g<h;g++)p+=u[g];e.update(p,n,1)}function l(c,u,h,d){if(h===0)return;const p=t.get("WEBGL_multi_draw");if(p===null)for(let g=0;g<c.length;g++)o(c[g],u[g],d[g]);else{p.multiDrawArraysInstancedWEBGL(n,c,0,u,0,d,0,h);let g=0;for(let v=0;v<h;v++)g+=u[v];for(let v=0;v<d.length;v++)e.update(g,n,d[v])}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function Jf(i,t,e,n){let r;function s(){if(r!==void 0)return r;if(t.has("EXT_texture_filter_anisotropic")===!0){const C=t.get("EXT_texture_filter_anisotropic");r=i.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(C){return!(C!==$e&&n.convert(C)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(C){const R=C===rr&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(C!==xn&&n.convert(C)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==_n&&!R)}function l(C){if(C==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=e.logarithmicDepthBuffer===!0,d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),p=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_TEXTURE_SIZE),v=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),m=i.getParameter(i.MAX_VERTEX_ATTRIBS),f=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),A=i.getParameter(i.MAX_VARYING_VECTORS),x=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),T=p>0,O=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:v,maxAttributes:m,maxVertexUniforms:f,maxVaryings:A,maxFragmentUniforms:x,vertexTextures:T,maxSamples:O}}function Qf(i){const t=this;let e=null,n=0,r=!1,s=!1;const o=new Pn,a=new Vt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const p=h.length!==0||d||n!==0||r;return r=d,n=h.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){e=u(h,d,0)},this.setState=function(h,d,p){const g=h.clippingPlanes,v=h.clipIntersection,m=h.clipShadows,f=i.get(h);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const A=s?0:n,x=A*4;let T=f.clippingState||null;l.value=T,T=u(g,d,x,p);for(let O=0;O!==x;++O)T[O]=e[O];f.clippingState=T,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=A}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function u(h,d,p,g){const v=h!==null?h.length:0;let m=null;if(v!==0){if(m=l.value,g!==!0||m===null){const f=p+v*4,A=d.matrixWorldInverse;a.getNormalMatrix(A),(m===null||m.length<f)&&(m=new Float32Array(f));for(let x=0,T=p;x!==v;++x,T+=4)o.copy(h[x]).applyMatrix4(A,a),o.normal.toArray(m,T),m[T+3]=o.constant}l.value=m,l.needsUpdate=!0}return t.numPlanes=v,t.numIntersection=0,m}}function tp(i){let t=new WeakMap;function e(o,a){return a===$s?o.mapping=Di:a===Js&&(o.mapping=Ui),o}function n(o){if(o&&o.isTexture){const a=o.mapping;if(a===$s||a===Js)if(t.has(o)){const l=t.get(o).texture;return e(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new uh(l.height);return c.fromEquirectangularTexture(i,o),t.set(o,c),o.addEventListener("dispose",r),e(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=t.get(a);l!==void 0&&(t.delete(a),l.dispose())}function s(){t=new WeakMap}return{get:n,dispose:s}}class ep extends Kl{constructor(t=-1,e=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-t,o=n+t,a=r+e,l=r-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}const Ti=4,Ro=[.125,.215,.35,.446,.526,.582],Kn=20,Is=new ep,Co=new $t;let Ns=null,Os=0,Fs=0,Bs=!1;const qn=(1+Math.sqrt(5))/2,yi=1/qn,Po=[new L(-qn,yi,0),new L(qn,yi,0),new L(-yi,0,qn),new L(yi,0,qn),new L(0,qn,-yi),new L(0,qn,yi),new L(-1,1,-1),new L(1,1,-1),new L(-1,1,1),new L(1,1,1)];class Lo{constructor(t){this._renderer=t,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(t,e=0,n=.1,r=100){Ns=this._renderer.getRenderTarget(),Os=this._renderer.getActiveCubeFace(),Fs=this._renderer.getActiveMipmapLevel(),Bs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(t,n,r,s),e>0&&this._blur(s,0,0,e),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Io(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Uo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Ns,Os,Fs),this._renderer.xr.enabled=Bs,t.scissorTest=!1,Ur(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Di||t.mapping===Ui?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Ns=this._renderer.getRenderTarget(),Os=this._renderer.getActiveCubeFace(),Fs=this._renderer.getActiveMipmapLevel(),Bs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Ze,minFilter:Ze,generateMipmaps:!1,type:rr,format:$e,colorSpace:Fn,depthBuffer:!1},r=Do(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Do(t,e,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=np(s)),this._blurMaterial=ip(s,t,e)}return r}_compileMaterial(t){const e=new ke(this._lodPlanes[0],t);this._renderer.compile(e,Is)}_sceneToCubeUV(t,e,n,r){const a=new ze(90,1,e,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,d=u.toneMapping;u.getClearColor(Co),u.toneMapping=Nn,u.autoClear=!1;const p=new rs({name:"PMREM.Background",side:Pe,depthWrite:!1,depthTest:!1}),g=new ke(new ar,p);let v=!1;const m=t.background;m?m.isColor&&(p.color.copy(m),t.background=null,v=!0):(p.color.copy(Co),v=!0);for(let f=0;f<6;f++){const A=f%3;A===0?(a.up.set(0,l[f],0),a.lookAt(c[f],0,0)):A===1?(a.up.set(0,0,l[f]),a.lookAt(0,c[f],0)):(a.up.set(0,l[f],0),a.lookAt(0,0,c[f]));const x=this._cubeSize;Ur(r,A*x,f>2?x:0,x,x),u.setRenderTarget(r),v&&u.render(g,a),u.render(t,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=d,u.autoClear=h,t.background=m}_textureToCubeUV(t,e){const n=this._renderer,r=t.mapping===Di||t.mapping===Ui;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Io()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Uo());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new ke(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=t;const l=this._cubeSize;Ur(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(o,Is)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=Po[(r-s-1)%Po.length];this._blur(t,s-1,s,o,a)}e.autoClear=n}_blur(t,e,n,r,s){const o=this._pingPongRenderTarget;this._halfBlur(t,o,e,n,r,"latitudinal",s),this._halfBlur(o,t,n,n,r,"longitudinal",s)}_halfBlur(t,e,n,r,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new ke(this._lodPlanes[r],c),d=c.uniforms,p=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Kn-1),v=s/g,m=isFinite(s)?1+Math.floor(u*v):Kn;m>Kn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Kn}`);const f=[];let A=0;for(let R=0;R<Kn;++R){const U=R/v,b=Math.exp(-U*U/2);f.push(b),R===0?A+=b:R<m&&(A+=2*b)}for(let R=0;R<f.length;R++)f[R]=f[R]/A;d.envMap.value=t.texture,d.samples.value=m,d.weights.value=f,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);const{_lodMax:x}=this;d.dTheta.value=g,d.mipInt.value=x-n;const T=this._sizeLods[r],O=3*T*(r>x-Ti?r-x+Ti:0),C=4*(this._cubeSize-T);Ur(e,O,C,3*T,2*T),l.setRenderTarget(e),l.render(h,Is)}}function np(i){const t=[],e=[],n=[];let r=i;const s=i-Ti+1+Ro.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Ti?l=Ro[o-i+Ti-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,g=6,v=3,m=2,f=1,A=new Float32Array(v*g*p),x=new Float32Array(m*g*p),T=new Float32Array(f*g*p);for(let C=0;C<p;C++){const R=C%3*2/3-1,U=C>2?0:-1,b=[R,U,0,R+2/3,U,0,R+2/3,U+1,0,R,U,0,R+2/3,U+1,0,R,U+1,0];A.set(b,v*g*C),x.set(d,m*g*C);const M=[C,C,C,C,C,C];T.set(M,f*g*C)}const O=new an;O.setAttribute("position",new Je(A,v)),O.setAttribute("uv",new Je(x,m)),O.setAttribute("faceIndex",new Je(T,f)),t.push(O),r>Ti&&r--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function Do(i,t,e){const n=new Qn(i,t,e);return n.texture.mapping=as,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ur(i,t,e,n,r){i.viewport.set(t,e,n,r),i.scissor.set(t,e,n,r)}function ip(i,t,e){const n=new Float32Array(Kn),r=new L(0,1,0);return new Mn({name:"SphericalGaussianBlur",defines:{n:Kn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Wa(),fragmentShader:`
3590
3591			precision mediump float;
3592			precision mediump int;
3593
3594			varying vec3 vOutputDirection;
3595
3596			uniform sampler2D envMap;
3597			uniform int samples;
3598			uniform float weights[ n ];
3599			uniform bool latitudinal;
3600			uniform float dTheta;
3601			uniform float mipInt;
3602			uniform vec3 poleAxis;
3603
3604			#define ENVMAP_TYPE_CUBE_UV
3605			#include <cube_uv_reflection_fragment>
3606
3607			vec3 getSample( float theta, vec3 axis ) {
3608
3609				float cosTheta = cos( theta );
3610				// Rodrigues' axis-angle rotation
3611				vec3 sampleDirection = vOutputDirection * cosTheta
3612					+ cross( axis, vOutputDirection ) * sin( theta )
3613					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3614
3615				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3616
3617			}
3618
3619			void main() {
3620
3621				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3622
3623				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3624
3625					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3626
3627				}
3628
3629				axis = normalize( axis );
3630
3631				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3632				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3633
3634				for ( int i = 1; i < n; i++ ) {
3635
3636					if ( i >= samples ) {
3637
3638						break;
3639
3640					}
3641
3642					float theta = dTheta * float( i );
3643					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3644					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3645
3646				}
3647
3648			}
3649		`,blending:In,depthTest:!1,depthWrite:!1})}function Uo(){return new Mn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Wa(),fragmentShader:`
3650
3651			precision mediump float;
3652			precision mediump int;
3653
3654			varying vec3 vOutputDirection;
3655
3656			uniform sampler2D envMap;
3657
3658			#include <common>
3659
3660			void main() {
3661
3662				vec3 outputDirection = normalize( vOutputDirection );
3663				vec2 uv = equirectUv( outputDirection );
3664
3665				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3666
3667			}
3668		`,blending:In,depthTest:!1,depthWrite:!1})}function Io(){return new Mn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Wa(),fragmentShader:`
3669
3670			precision mediump float;
3671			precision mediump int;
3672
3673			uniform float flipEnvMap;
3674
3675			varying vec3 vOutputDirection;
3676
3677			uniform samplerCube envMap;
3678
3679			void main() {
3680
3681				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3682
3683			}
3684		`,blending:In,depthTest:!1,depthWrite:!1})}function Wa(){return`
3685
3686		precision mediump float;
3687		precision mediump int;
3688
3689		attribute float faceIndex;
3690
3691		varying vec3 vOutputDirection;
3692
3693		// RH coordinate system; PMREM face-indexing convention
3694		vec3 getDirection( vec2 uv, float face ) {
3695
3696			uv = 2.0 * uv - 1.0;
3697
3698			vec3 direction = vec3( uv, 1.0 );
3699
3700			if ( face == 0.0 ) {
3701
3702				direction = direction.zyx; // ( 1, v, u ) pos x
3703
3704			} else if ( face == 1.0 ) {
3705
3706				direction = direction.xzy;
3707				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3708
3709			} else if ( face == 2.0 ) {
3710
3711				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3712
3713			} else if ( face == 3.0 ) {
3714
3715				direction = direction.zyx;
3716				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3717
3718			} else if ( face == 4.0 ) {
3719
3720				direction = direction.xzy;
3721				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3722
3723			} else if ( face == 5.0 ) {
3724
3725				direction.z *= -1.0; // ( u, v, -1 ) neg z
3726
3727			}
3728
3729			return direction;
3730
3731		}
3732
3733		void main() {
3734
3735			vOutputDirection = getDirection( uv, faceIndex );
3736			gl_Position = vec4( position, 1.0 );
3737
3738		}
3739	`}function rp(i){let t=new WeakMap,e=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===$s||l===Js,u=l===Di||l===Ui;if(c||u){let h=t.get(a);const d=h!==void 0?h.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==d)return e===null&&(e=new Lo(i)),h=c?e.fromEquirectangular(a,h):e.fromCubemap(a,h),h.texture.pmremVersion=a.pmremVersion,t.set(a,h),h.texture;if(h!==void 0)return h.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&r(p)?(e===null&&(e=new Lo(i)),h=c?e.fromEquirectangular(a):e.fromCubemap(a),h.texture.pmremVersion=a.pmremVersion,t.set(a,h),a.addEventListener("dispose",s),h.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=t.get(l);c!==void 0&&(t.delete(l),c.dispose())}function o(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:n,dispose:o}}function sp(i){const t={};function e(n){if(t[n]!==void 0)return t[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return t[n]=r,r}return{has:function(n){return e(n)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(n){const r=e(n);return r===null&&Ci("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function ap(i,t,e,n){const r={},s=new WeakMap;function o(h){const d=h.target;d.index!==null&&t.remove(d.index);for(const g in d.attributes)t.remove(d.attributes[g]);for(const g in d.morphAttributes){const v=d.morphAttributes[g];for(let m=0,f=v.length;m<f;m++)t.remove(v[m])}d.removeEventListener("dispose",o),delete r[d.id];const p=s.get(d);
vendor: 10,960 bytes, line 3739
3739p&&(t.remove(p),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,e.memory.geometries--}function a(h,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,e.memory.geometries++),d}function l(h){const d=h.attributes;for(const g in d)t.update(d[g],i.ARRAY_BUFFER);const p=h.morphAttributes;for(const g in p){const v=p[g];for(let m=0,f=v.length;m<f;m++)t.update(v[m],i.ARRAY_BUFFER)}}function c(h){const d=[],p=h.index,g=h.attributes.position;let v=0;if(p!==null){const A=p.array;v=p.version;for(let x=0,T=A.length;x<T;x+=3){const O=A[x+0],C=A[x+1],R=A[x+2];d.push(O,C,C,R,R,O)}}else if(g!==void 0){const A=g.array;v=g.version;for(let x=0,T=A.length/3-1;x<T;x+=3){const O=x+0,C=x+1,R=x+2;d.push(O,C,C,R,R,O)}}else return;const m=new(zl(d)?ql:Xl)(d,1);m.version=v;const f=s.get(h);f&&t.remove(f),s.set(h,m)}function u(h){const d=s.get(h);if(d){const p=h.index;p!==null&&d.version<p.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function op(i,t,e){let n;function r(d){n=d}let s,o;function a(d){s=d.type,o=d.bytesPerElement}function l(d,p){i.drawElements(n,p,s,d*o),e.update(p,n,1)}function c(d,p,g){g!==0&&(i.drawElementsInstanced(n,p,s,d*o,g),e.update(p,n,g))}function u(d,p,g){if(g===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,s,d,0,g);let m=0;for(let f=0;f<g;f++)m+=p[f];e.update(m,n,1)}function h(d,p,g,v){if(g===0)return;const m=t.get("WEBGL_multi_draw");if(m===null)for(let f=0;f<d.length;f++)c(d[f]/o,p[f],v[f]);else{m.multiDrawElementsInstancedWEBGL(n,p,0,s,d,0,v,0,g);let f=0;for(let A=0;A<g;A++)f+=p[A];for(let A=0;A<v.length;A++)e.update(f,n,v[A])}}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function lp(i){const t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(e.calls++,o){case i.TRIANGLES:e.triangles+=a*(s/3);break;case i.LINES:e.lines+=a*(s/2);break;case i.LINE_STRIP:e.lines+=a*(s-1);break;case i.LINE_LOOP:e.lines+=a*s;break;case i.POINTS:e.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:r,update:n}}function cp(i,t,e){const n=new WeakMap,r=new ee;function s(o,a,l){const c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0;let d=n.get(a);if(d===void 0||d.count!==h){let b=function(){R.dispose(),n.delete(a),a.removeEventListener("dispose",b)};d!==void 0&&d.texture.dispose();const p=a.morphAttributes.position!==void 0,g=a.morphAttributes.normal!==void 0,v=a.morphAttributes.color!==void 0,m=a.morphAttributes.position||[],f=a.morphAttributes.normal||[],A=a.morphAttributes.color||[];let x=0;p===!0&&(x=1),g===!0&&(x=2),v===!0&&(x=3);let T=a.attributes.position.count*x,O=1;T>t.maxTextureSize&&(O=Math.ceil(T/t.maxTextureSize),T=t.maxTextureSize);const C=new Float32Array(T*O*4*h),R=new Gl(C,T,O,h);R.type=_n,R.needsUpdate=!0;const U=x*4;for(let M=0;M<h;M++){const P=m[M],Y=f[M],G=A[M],N=T*O*4*M;for(let K=0;K<P.count;K++){const k=K*U;p===!0&&(r.fromBufferAttribute(P,K),C[N+k+0]=r.x,C[N+k+1]=r.y,C[N+k+2]=r.z,C[N+k+3]=0),g===!0&&(r.fromBufferAttribute(Y,K),C[N+k+4]=r.x,C[N+k+5]=r.y,C[N+k+6]=r.z,C[N+k+7]=0),v===!0&&(r.fromBufferAttribute(G,K),C[N+k+8]=r.x,C[N+k+9]=r.y,C[N+k+10]=r.z,C[N+k+11]=G.itemSize===4?r.w:1)}}d={count:h,texture:R,size:new ct(T,O)},n.set(a,d),a.addEventListener("dispose",b)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,e);else{let p=0;for(let v=0;v<c.length;v++)p+=c[v];const g=a.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,e),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function up(i,t,e,n){let r=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,h=t.get(l,u);if(r.get(h)!==c&&(t.update(h),r.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==c&&(e.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&e.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;r.get(d)!==c&&(d.update(),r.set(d,c))}return h}function o(){r=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),e.remove(c.instanceMatrix),c.instanceColor!==null&&e.remove(c.instanceColor)}return{update:s,dispose:o}}class Jl extends Re{constructor(t,e,n,r,s,o,a,l,c,u=Ri){if(u!==Ri&&u!==Ni)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Ri&&(n=Jn),n===void 0&&u===Ni&&(n=Ii),super(null,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=a!==void 0?a:Ve,this.minFilter=l!==void 0?l:Ve,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}const Ql=new Re,No=new Jl(1,1),tc=new Gl,ec=new Zu,nc=new Zl,Oo=[],Fo=[],Bo=new Float32Array(16),zo=new Float32Array(9),Ho=new Float32Array(4);function Fi(i,t,e){const n=i[0];if(n<=0||n>0)return i;const r=t*e;let s=Oo[r];if(s===void 0&&(s=new Float32Array(r),Oo[r]=s),t!==0){n.toArray(s,0);for(let o=1,a=0;o!==t;++o)a+=e,i[o].toArray(s,a)}return s}function ge(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e<n;e++)if(i[e]!==t[e])return!1;return!0}function _e(i,t){for(let e=0,n=t.length;e<n;e++)i[e]=t[e]}function cs(i,t){let e=Fo[t];e===void 0&&(e=new Int32Array(t),Fo[t]=e);for(let n=0;n!==t;++n)e[n]=i.allocateTextureUnit();return e}function hp(i,t){const e=this.cache;e[0]!==t&&(i.uniform1f(this.addr,t),e[0]=t)}function dp(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(ge(e,t))return;i.uniform2fv(this.addr,t),_e(e,t)}}function fp(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(i.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(ge(e,t))return;i.uniform3fv(this.addr,t),_e(e,t)}}function pp(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(ge(e,t))return;i.uniform4fv(this.addr,t),_e(e,t)}}function mp(i,t){const e=this.cache,n=t.elements;if(n===void 0){if(ge(e,t))return;i.uniformMatrix2fv(this.addr,!1,t),_e(e,t)}else{if(ge(e,n))return;Ho.set(n),i.uniformMatrix2fv(this.addr,!1,Ho),_e(e,n)}}function gp(i,t){const e=this.cache,n=t.elements;if(n===void 0){if(ge(e,t))return;i.uniformMatrix3fv(this.addr,!1,t),_e(e,t)}else{if(ge(e,n))return;zo.set(n),i.uniformMatrix3fv(this.addr,!1,zo),_e(e,n)}}function _p(i,t){const e=this.cache,n=t.elements;if(n===void 0){if(ge(e,t))return;i.uniformMatrix4fv(this.addr,!1,t),_e(e,t)}else{if(ge(e,n))return;Bo.set(n),i.uniformMatrix4fv(this.addr,!1,Bo),_e(e,n)}}function vp(i,t){const e=this.cache;e[0]!==t&&(i.uniform1i(this.addr,t),e[0]=t)}function xp(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(ge(e,t))return;i.uniform2iv(this.addr,t),_e(e,t)}}function Sp(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(ge(e,t))return;i.uniform3iv(this.addr,t),_e(e,t)}}function Mp(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(ge(e,t))return;i.uniform4iv(this.addr,t),_e(e,t)}}function yp(i,t){const e=this.cache;e[0]!==t&&(i.uniform1ui(this.addr,t),e[0]=t)}function Ep(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(ge(e,t))return;i.uniform2uiv(this.addr,t),_e(e,t)}}function Tp(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(ge(e,t))return;i.uniform3uiv(this.addr,t),_e(e,t)}}function bp(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(ge(e,t))return;i.uniform4uiv(this.addr,t),_e(e,t)}}function Ap(i,t,e){const n=this.cache,r=e.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(No.compareFunction=Fl,s=No):s=Ql,e.setTexture2D(t||s,r)}function wp(i,t,e){const n=this.cache,r=e.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),e.setTexture3D(t||ec,r)}function Rp(i,t,e){const n=this.cache,r=e.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),e.setTextureCube(t||nc,r)}function Cp(i,t,e){const n=this.cache,r=e.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),e.setTexture2DArray(t||tc,r)}function Pp(i){switch(i){case 5126:return hp;case 35664:return dp;case 35665:return fp;case 35666:return pp;case 35674:return mp;case 35675:return gp;case 35676:return _p;case 5124:case 35670:return vp;case 35667:case 35671:return xp;case 35668:case 35672:return Sp;case 35669:case 35673:return Mp;case 5125:return yp;case 36294:return Ep;case 36295:return Tp;case 36296:return bp;case 35678:case 36198:case 36298:case 36306:case 35682:return Ap;case 35679:case 36299:case 36307:return wp;case 35680:case 36300:case 36308:case 36293:return Rp;case 36289:case 36303:case 36311:case 36292:return Cp}}function Lp(i,t){i.uniform1fv(this.addr,t)}function Dp(i,t){const e=Fi(t,this.size,2);i.uniform2fv(this.addr,e)}function Up(i,t){const e=Fi(t,this.size,3);i.uniform3fv(this.addr,e)}function Ip(i,t){const e=Fi(t,this.size,4);i.uniform4fv(this.addr,e)}function Np(i,t){const e=Fi(t,this.size,4);i.uniformMatrix2fv(this.addr,!1,e)}function Op(i,t){const e=Fi(t,this.size,9);i.uniformMatrix3fv(this.addr,!1,e)}function Fp(i,t){const e=Fi(t,this.size,16);i.uniformMatrix4fv(this.addr,!1,e)}function Bp(i,t){i.uniform1iv(this.addr,t)}function zp(i,t){i.uniform2iv(this.addr,t)}function Hp(i,t){i.uniform3iv(this.addr,t)}function Gp(i,t){i.uniform4iv(this.addr,t)}function Vp(i,t){i.uniform1uiv(this.addr,t)}function kp(i,t){i.uniform2uiv(this.addr,t)}function Wp(i,t){i.uniform3uiv(this.addr,t)}function Xp(i,t){i.uniform4uiv(this.addr,t)}function qp(i,t,e){const n=this.cache,r=t.length,s=cs(e,r);
vendor: 4,206 bytes, lines 3739-3746
3739ge(n,s)||(i.uniform1iv(this.addr,s),_e(n,s));for(let o=0;o!==r;++o)e.setTexture2D(t[o]||Ql,s[o])}function Yp(i,t,e){const n=this.cache,r=t.length,s=cs(e,r);ge(n,s)||(i.uniform1iv(this.addr,s),_e(n,s));for(let o=0;o!==r;++o)e.setTexture3D(t[o]||ec,s[o])}function Kp(i,t,e){const n=this.cache,r=t.length,s=cs(e,r);ge(n,s)||(i.uniform1iv(this.addr,s),_e(n,s));for(let o=0;o!==r;++o)e.setTextureCube(t[o]||nc,s[o])}function Zp(i,t,e){const n=this.cache,r=t.length,s=cs(e,r);ge(n,s)||(i.uniform1iv(this.addr,s),_e(n,s));for(let o=0;o!==r;++o)e.setTexture2DArray(t[o]||tc,s[o])}function jp(i){switch(i){case 5126:return Lp;case 35664:return Dp;case 35665:return Up;case 35666:return Ip;case 35674:return Np;case 35675:return Op;case 35676:return Fp;case 5124:case 35670:return Bp;case 35667:case 35671:return zp;case 35668:case 35672:return Hp;case 35669:case 35673:return Gp;case 5125:return Vp;case 36294:return kp;case 36295:return Wp;case 36296:return Xp;case 35678:case 36198:case 36298:case 36306:case 35682:return qp;case 35679:case 36299:case 36307:return Yp;case 35680:case 36300:case 36308:case 36293:return Kp;case 36289:case 36303:case 36311:case 36292:return Zp}}class $p{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=Pp(e.type)}}class Jp{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=jp(e.type)}}class Qp{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(t,e[a.id],n)}}}const zs=/(\w+)(\])?(\[|\.)?/g;function Go(i,t){i.seq.push(t),i.map[t.id]=t}function tm(i,t,e){const n=i.name,r=n.length;for(zs.lastIndex=0;;){const s=zs.exec(n),o=zs.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){Go(e,c===void 0?new $p(a,i,t):new Jp(a,i,t));break}else{let h=e.map[a];h===void 0&&(h=new Qp(a),Go(e,h)),e=h}}}class jr{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=t.getActiveUniform(e,r),o=t.getUniformLocation(e,s.name);tm(s,o,this)}}setValue(t,e,n,r){const s=this.map[e];s!==void 0&&s.setValue(t,n,r)}setOptional(t,e,n){const r=e[n];r!==void 0&&this.setValue(t,n,r)}static upload(t,e,n,r){for(let s=0,o=e.length;s!==o;++s){const a=e[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(t,l.value,r)}}static seqWithValue(t,e){const n=[];for(let r=0,s=t.length;r!==s;++r){const o=t[r];o.id in e&&n.push(o)}return n}}function Vo(i,t,e){const n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}const em=37297;let nm=0;function im(i,t){const e=i.split(`
3740`),n=[],r=Math.max(t-6,0),s=Math.min(t+6,e.length);for(let o=r;o<s;o++){const a=o+1;n.push(`${a===t?">":" "} ${a}: ${e[o]}`)}return n.join(`
3741`)}function rm(i){const t=Kt.getPrimaries(Kt.workingColorSpace),e=Kt.getPrimaries(i);let n;switch(t===e?n="":t===ns&&e===es?n="LinearDisplayP3ToLinearSRGB":t===es&&e===ns&&(n="LinearSRGBToLinearDisplayP3"),i){case Fn:case os:return[n,"LinearTransferOETF"];case en:case Ga:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function ko(i,t,e){const n=i.getShaderParameter(t,i.COMPILE_STATUS),r=i.getShaderInfoLog(t).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return e.toUpperCase()+`
3742
3743`+r+`
3744
3745`+im(i.getShaderSource(t),o)}else return r}function sm(i,t){const e=rm(t);return`vec4 ${i}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function am(i,t){let e;switch(t){case ou:e="Linear";break;case lu:e="Reinhard";break;case cu:e="OptimizedCineon";break;case uu:e="ACESFilmic";break;case du:e="AgX";break;case fu:e="Neutral";break;case hu:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}const Ir=new L;function om(){Kt.getLuminanceCoefficients(Ir);const i=Ir.x.toFixed(4),t=Ir.y.toFixed(4),e=Ir.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${i}, ${t}, ${e} );`,"	return dot( weights, rgb );","}"].join(`
3746`)}
vendor: 4,480 bytes, lines 3746-3773
3746function lm(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Xi).join(`
3747`)}function cm(i){const t=[];for(const e in i){const n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(`
3748`)}function um(i,t){const e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(t,r),o=s.name;let a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),e[o]={type:s.type,location:i.getAttribLocation(t,o),locationSize:a}}return e}function Xi(i){return i!==""}function Wo(i,t){const e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Xo(i,t){return i.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const hm=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ra(i){return i.replace(hm,fm)}const dm=new Map;function fm(i,t){let e=Gt[t];if(e===void 0){const n=dm.get(t);if(n!==void 0)e=Gt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return Ra(e)}const pm=/#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 qo(i){return i.replace(pm,mm)}function mm(i,t,e,n){let r="";for(let s=parseInt(t);s<parseInt(e);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Yo(i){let t=`precision ${i.precision} float;
3749	precision ${i.precision} int;
3750	precision ${i.precision} sampler2D;
3751	precision ${i.precision} samplerCube;
3752	precision ${i.precision} sampler3D;
3753	precision ${i.precision} sampler2DArray;
3754	precision ${i.precision} sampler2DShadow;
3755	precision ${i.precision} samplerCubeShadow;
3756	precision ${i.precision} sampler2DArrayShadow;
3757	precision ${i.precision} isampler2D;
3758	precision ${i.precision} isampler3D;
3759	precision ${i.precision} isamplerCube;
3760	precision ${i.precision} isampler2DArray;
3761	precision ${i.precision} usampler2D;
3762	precision ${i.precision} usampler3D;
3763	precision ${i.precision} usamplerCube;
3764	precision ${i.precision} usampler2DArray;
3765	`;return i.precision==="highp"?t+=`
3766#define HIGH_PRECISION`:i.precision==="mediump"?t+=`
3767#define MEDIUM_PRECISION`:i.precision==="lowp"&&(t+=`
3768#define LOW_PRECISION`),t}function gm(i){let t="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Tl?t="SHADOWMAP_TYPE_PCF":i.shadowMapType===Uc?t="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===mn&&(t="SHADOWMAP_TYPE_VSM"),t}function _m(i){let t="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Di:case Ui:t="ENVMAP_TYPE_CUBE";break;case as:t="ENVMAP_TYPE_CUBE_UV";break}return t}function vm(i){let t="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Ui:t="ENVMAP_MODE_REFRACTION";break}return t}function xm(i){let t="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case bl:t="ENVMAP_BLENDING_MULTIPLY";break;case su:t="ENVMAP_BLENDING_MIX";break;case au:t="ENVMAP_BLENDING_ADD";break}return t}function Sm(i){const t=i.envMapCubeUVHeight;if(t===null)return null;const e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:n,maxMip:e}}function Mm(i,t,e,n){const r=i.getContext(),s=e.defines;let o=e.vertexShader,a=e.fragmentShader;const l=gm(e),c=_m(e),u=vm(e),h=xm(e),d=Sm(e),p=lm(e),g=cm(s),v=r.createProgram();let m,f,A=e.glslVersion?"#version "+e.glslVersion+`
3769`:"";e.isRawShaderMaterial?(m=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(Xi).join(`
3770`),m.length>0&&(m+=`
3771`),f=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(Xi).join(`
3772`),f.length>0&&(f+=`
3773`)):(m=[Yo(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.extensionCl
vendor: 6,400 bytes, lines 3773-3775
3773ipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+u:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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",`
3774`].filter(Xi).join(`
3775`),f=[Yo(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+u:"",e.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IR
3775IDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Nn?"#define TONE_MAPPING":"",e.toneMapping!==Nn?Gt.tonemapping_pars_fragment:"",e.toneMapping!==Nn?am("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Gt.colorspace_pars_fragment,sm("linearToOutputTexel",e.outputColorSpace),om(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
3776`].filter(Xi).join(`
3777`)),o=Ra(o),o=Wo(o,e),o=Xo(o,e),a=Ra(a),a=Wo(a,e),a=Xo(a,e),o=qo(o),a=qo(a),e.isRawShaderMaterial!==!0&&(A=`#version 300 es
3778`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3779`)+`
3780`+m,f=["#define varying in",e.glslVersion===ao?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===ao?"":"#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(`
3781`)+`
3782`+f);const x=A+m+o,T=A+f+a,O=Vo(r,r.VERTEX_SHADER,x),C=Vo(r,r.FRAGMENT_SHADER,T);r.attachShader(v,O),r.attachShader(v,C),e.index0AttributeName!==void 0?r.bindAttribLocation(v,0,e.index0AttributeName):e.morphTargets===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v);function R(P){if(i.debug.checkShaderErrors){const Y=r.getProgramInfoLog(v).trim(),G=r.getShaderInfoLog(O).trim(),N=r.getShaderInfoLog(C).trim();let K=!0,k=!0;if(r.getProgramParameter(v,r.LINK_STATUS)===!1)if(K=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,v,O,C);else{const J=ko(r,O,"vertex"),W=ko(r,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+`
3783
3784Material Name: `+P.name+`
3785Material Type: `+P.type+`
3786
3787Program Info Log: `+Y+`
3788`+J+`
3789`+W)}else Y!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Y):(G===""||N==="")&&(k=!1);k&&(P.diagnostics={runnable:K,programLog:Y,vertexShader:{log:G,prefix:m},fragmentShader:{log:N,prefix:f}})}r.deleteShader(O),r.deleteShader(C),U=new jr(r,v),b=um(r,v)}let U;this.getUniforms=function(){return U===void 0&&R(this),U};let b;this.getAttributes=function(){return b===void 0&&R(this),b};let M=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(v,em)),M},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=nm++,this.cacheKey=t,this.usedTimes=1,this.program=v,this.vertexShader=O,this.fragmentShader=C,this}let ym=0;class Em{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,r=this._getShaderStage(e),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(t);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return n===void 0&&(n=new Tm(t),e.set(t,n)),n}}class Tm{constructor(t){this.id=ym++,this.code=t,this.usedTimes=0}}function bm(i,t,e,n,r,s,o){const a=new kl,l=new Em,c=new Set,u=[],h=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.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 v(b){return c.add(b),b===0?"uv":`uv${b}`}function m(b,M,P,Y,G){const N=Y.fog,K=G.geometry,k=b.isMeshStandardMaterial?Y.environment:null,J=(b.isMeshStandardMaterial?e:t).get(b.envMap||k),W=J&&J.mapping===as?J.image.height:null,ot=g[b.type];b.precision!==null&&(p=r.getMaxPrecision(b.precision),p!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",p,"instead."));const et=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,mt=et!==void 0?et.length:0;let At=0;K.morphAttributes.position!==void 0&&(At=1),K.morphAttributes.normal!==void 0&&(At=2),K.morphAttributes.color!==void 0&&(At=3);let Pt,q,nt,ft;if(ot){const Wt=Ce[ot];Pt=Wt.vertexShader,q=Wt.fragmentShader}else Pt=b.vertexShader,q=b.fragmentShader,l.update(b),nt=l.getVertexShaderID(b),ft=l.getFragmentShaderID(b);const ut=i.getRenderTarget(),Rt=G.isInstancedMesh===!0,Ut=G.isBatchedMesh===!0,Lt=!!b.map,Mt=!!b.matcap,y=!!J,rt=!!b.aoMap,Q=!!b.lightMap,at=!!b.bumpMap,Z=!!b.normalMap,Ct=!!b.displacementMap,pt=!!b.emissiveMap,xt=!!b.metalnessMap,w=!!b.roughnessMap,S=b.anisotropy>0,z=b.clearcoat>0,tt=b.dispersion>0,$=b.iridescence>0,j=b.sheen>0,Tt=b.transmission>0,dt=S&&!!b.anisotropyMap,_t=z&&!!b.clearcoatMap,zt=z&&!!b.clearcoatNormalMap,st=z&&!!b.clearcoatRoughnessMap,gt=$&&!!b.iridescenceMap,kt=$&&!!b.iridescenceThicknessMap,It=j&&!!b.sheenColorMap,St=j&&!!b.sheenRoughnessMap,Ot=!!b.specularMap,Ht=!!b.specularColorMap,Qt=!!b.specularIntensityMap,_=Tt&&!!b.transmissionMap,F=Tt&&!!b.thicknessMap,B=!!b.gradientMap,X=!!b.alphaMap,it=b.alphaTest>0,bt=!!b.alphaHash,Ft=!!b.extensions;let se=Nn;b.toneMapped&&(ut===null||ut.isXRRenderTarget===!0)&&(se=i.toneMapping);const fe={shaderID:ot,shaderType:b.type,shaderName:b.name,vertexShader:Pt,fragmentShader:q,defines:b.defines,customVertexShaderID:nt,customFragmentShaderID:ft,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:p,batching:Ut,batchingColor:Ut&&G._colorsTexture!==null,instancing:Rt,instancingColor:Rt&&G.instanceColor!==null,instancingMorph:Rt&&G.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:ut===null?i.outputColorSpace:ut.isXRRenderTarget===!0?ut.texture.colorSpace:Fn,alphaToCoverage:!!b.alphaToCoverage,map:Lt,matcap:Mt,envMap:y,envMapMode:y&&J.mapping,envMapCubeUVHeight:W,aoMap:rt,lightMap:Q,bumpMap:at,normalMap:Z,displacementMap:d&&Ct,emissiveMap:pt,normalMapObjectSpace:Z&&b.normalMapType===vu,normalMapTangentSpace:Z&&b.normalMapType===_u,metalnessMap:xt,roughnessMap:w,anisotropy:S,anisotropyMap:dt,clearcoat:z,clearcoatMap:_t,clearcoatNormalMap:zt,clearcoatRoughnessMap:st,dispersion:tt,iridescence:$,iridescenceMap:gt,iridescenceThicknessMap:kt,sheen:j,sheenColorMap:It,sheenRoughnessMap:St,
vendor: 16,357 bytes, lines 3789-3795
3789specularMap:Ot,specularColorMap:Ht,specularIntensityMap:Qt,transmission:Tt,transmissionMap:_,thicknessMap:F,gradientMap:B,opaque:b.transparent===!1&&b.blending===wi&&b.alphaToCoverage===!1,alphaMap:X,alphaTest:it,alphaHash:bt,combine:b.combine,mapUv:Lt&&v(b.map.channel),aoMapUv:rt&&v(b.aoMap.channel),lightMapUv:Q&&v(b.lightMap.channel),bumpMapUv:at&&v(b.bumpMap.channel),normalMapUv:Z&&v(b.normalMap.channel),displacementMapUv:Ct&&v(b.displacementMap.channel),emissiveMapUv:pt&&v(b.emissiveMap.channel),metalnessMapUv:xt&&v(b.metalnessMap.channel),roughnessMapUv:w&&v(b.roughnessMap.channel),anisotropyMapUv:dt&&v(b.anisotropyMap.channel),clearcoatMapUv:_t&&v(b.clearcoatMap.channel),clearcoatNormalMapUv:zt&&v(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:st&&v(b.clearcoatRoughnessMap.channel),iridescenceMapUv:gt&&v(b.iridescenceMap.channel),iridescenceThicknessMapUv:kt&&v(b.iridescenceThicknessMap.channel),sheenColorMapUv:It&&v(b.sheenColorMap.channel),sheenRoughnessMapUv:St&&v(b.sheenRoughnessMap.channel),specularMapUv:Ot&&v(b.specularMap.channel),specularColorMapUv:Ht&&v(b.specularColorMap.channel),specularIntensityMapUv:Qt&&v(b.specularIntensityMap.channel),transmissionMapUv:_&&v(b.transmissionMap.channel),thicknessMapUv:F&&v(b.thicknessMap.channel),alphaMapUv:X&&v(b.alphaMap.channel),vertexTangents:!!K.attributes.tangent&&(Z||S),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!K.attributes.color&&K.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!K.attributes.uv&&(Lt||X),fog:!!N,useFog:b.fog===!0,fogExp2:!!N&&N.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:G.isSkinnedMesh===!0,morphTargets:K.morphAttributes.position!==void 0,morphNormals:K.morphAttributes.normal!==void 0,morphColors:K.morphAttributes.color!==void 0,morphTargetsCount:mt,morphTextureStride:At,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:i.shadowMap.enabled&&P.length>0,shadowMapType:i.shadowMap.type,toneMapping:se,decodeVideoTexture:Lt&&b.map.isVideoTexture===!0&&Kt.getTransfer(b.map.colorSpace)===Jt,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===gn,flipSided:b.side===Pe,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Ft&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ft&&b.extensions.multiDraw===!0||Ut)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return fe.vertexUv1s=c.has(1),fe.vertexUv2s=c.has(2),fe.vertexUv3s=c.has(3),c.clear(),fe}function f(b){const M=[];if(b.shaderID?M.push(b.shaderID):(M.push(b.customVertexShaderID),M.push(b.customFragmentShaderID)),b.defines!==void 0)for(const P in b.defines)M.push(P),M.push(b.defines[P]);return b.isRawShaderMaterial===!1&&(A(M,b),x(M,b),M.push(i.outputColorSpace)),M.push(b.customProgramCacheKey),M.join()}function A(b,M){b.push(M.precision),b.push(M.outputColorSpace),b.push(M.envMapMode),b.push(M.envMapCubeUVHeight),b.push(M.mapUv),b.push(M.alphaMapUv),b.push(M.lightMapUv),b.push(M.aoMapUv),b.push(M.bumpMapUv),b.push(M.normalMapUv),b.push(M.displacementMapUv),b.push(M.emissiveMapUv),b.push(M.metalnessMapUv),b.push(M.roughnessMapUv),b.push(M.anisotropyMapUv),b.push(M.clearcoatMapUv),b.push(M.clearcoatNormalMapUv),b.push(M.clearcoatRoughnessMapUv),b.push(M.iridescenceMapUv),b.push(M.iridescenceThicknessMapUv),b.push(M.sheenColorMapUv),b.push(M.sheenRoughnessMapUv),b.push(M.specularMapUv),b.push(M.specularColorMapUv),b.push(M.specularIntensityMapUv),b.push(M.transmissionMapUv),b.push(M.thicknessMapUv),b.push(M.combine),b.push(M.fogExp2),b.push(M.sizeAttenuation),b.push(M.morphTargetsCount),b.push(M.morphAttributeCount),b.push(M.numDirLights),b.push(M.numPointLights),b.push(M.numSpotLights),b.push(M.numSpotLightMaps),b.push(M.numHemiLights),b.push(M.numRectAreaLights),b.push(M.numDirLightShadows),b.push(M.numPointLightShadows),b.push(M.numSpotLightShadows),b.push(M.numSpotLightShadowsWithMaps),b.push(M.numLightProbes),b.push(M.shadowMapType),b.push(M.toneMapping),b.push(M.numClippingPlanes),b.push(M.numClipIntersection),b.push(M.depthPacking)}function x(b,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),b.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.skinning&&a.enable(4),M.morphTargets&&a.enable(5),M.morphNormals&&a.enable(6),M.morphColors&&a.enable(7),M.premultipliedAlpha&&a.enable(8),M.shadowMapEnabled&&a.enable(9),M.doubleSided&&a.enable(10),M.flipSided&&a.enable(11),M.useDepthPacking&&a.enable(12),M.dithering&&a.enable(13),M.transmission&&a.enable(14),M.sheen&&a.enable(15),M.opaque&&a.enable(16),M.pointsUvs&&a.enable(17),M.decodeVideoTexture&&a.enable(18),M.alphaToCoverage&&a.enable(19),b.push(a.mask)}function T(b){const M=g[b.type];let P;if(M){const Y=Ce[M];P=ka.clone(Y.uniforms)}else P=b.uniforms;return P}function O(b,M){let P;for(let Y=0,G=u.length;Y<G;Y++){const N=u[Y];if(N.cacheKey===M){P=N,++P.usedTimes;break}}return P===void 0&&(P=new Mm(i,M,b,s),u.push(P)),P}function C(b){if(--b.usedTimes===0){const M=u.indexOf(b);u[M]=u[u.length-1],u.pop(),b.destroy()}}function R(b){l.remove(b)}function U(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:T,acquireProgram:O,releaseProgram:C,releaseShaderCache:R,programs:u,dispose:U}}function Am(){let i=new WeakMap;function t(s){let o=i.get(s);return o===void 0&&(o={},i.set(s,o)),o}function e(s){i.delete(s)}function n(s,o,a){i.get(s)[o]=a}function r(){i=new WeakMap}return{get:t,remove:e,update:n,dispose:r}}function wm(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.material.id!==t.material.id?i.material.id-t.material.id:i.z!==t.z?i.z-t.z:i.id-t.id}function Ko(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.z!==t.z?t.z-i.z:i.id-t.id}function Zo(){const i=[];let t=0;const e=[],n=[],r=[];function s(){t=0,e.length=0,n.length=0,r.length=0}function o(h,d,p,g,v,m){let f=i[t];return f===void 0?(f={id:h.id,object:h,geometry:d,material:p,groupOrder:g,renderOrder:h.renderOrder,z:v,group:m},i[t]=f):(f.id=h.id,f.object=h,f.geometry=d,f.material=p,f.groupOrder=g,f.renderOrder=h.renderOrder,f.z=v,f.group=m),t++,f}function a(h,d,p,g,v,m){const f=o(h,d,p,g,v,m);p.transmission>0?n.push(f):p.transparent===!0?r.push(f):e.push(f)}function l(h,d,p,g,v,m){const f=o(h,d,p,g,v,m);p.transmission>0?n.unshift(f):p.transparent===!0?r.unshift(f):e.unshift(f)}function c(h,d){e.length>1&&e.sort(h||wm),n.length>1&&n.sort(d||Ko),r.length>1&&r.sort(d||Ko)}function u(){for(let h=t,d=i.length;h<d;h++){const p=i[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:e,transmissive:n,transparent:r,init:s,push:a,unshift:l,finish:u,sort:c}}function Rm(){let i=new WeakMap;function t(n,r){const s=i.get(n);let o;return s===void 0?(o=new Zo,i.set(n,[o])):r>=s.length?(o=new Zo,s.push(o)):o=s[r],o}function e(){i=new WeakMap}return{get:t,dispose:e}}function Cm(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new L,color:new $t};break;case"SpotLight":e={position:new L,direction:new L,color:new $t,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new L,color:new $t,distance:0,decay:0};break;case"HemisphereLight":e={direction:new L,skyColor:new $t,groundColor:new $t};break;case"RectAreaLight":e={color:new $t,position:new L,halfWidth:new L,halfHeight:new L};break}return i[t.id]=e,e}}}function Pm(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ct};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ct};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ct,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}let Lm=0;function Dm(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function Um(i){const t=new Cm,e=Pm(),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 c=0;c<9;c++)n.probe.push(new L);const r=new L,s=new oe,o=new oe;function a(c){let u=0,h=0,d=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let p=0,g=0,v=0,m=0,f=0,A=0,x=0,T=0,O=0,C=0,R=0;c.sort(Dm);for(let b=0,M=c.length;b<M;b++){const P=c[b],Y=P.color,G=P.intensity,N=P.distance,K=P.shadow&&P.shadow.map?P.shadow.map.texture:null;if(P.isAmbientLight)u+=Y.r*G,h+=Y.g*G,d+=Y.b*G;else if(P.isLightProbe){for(let k=0;k<9;k++)n.probe[k].addScaledVector(P.sh.coefficients[k],G);R++}else if(P.isDirectionalLight){const k=t.get(P);if(k.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){const J=P.shadow,W=e.get(P);W.shadowIntensity=J.intensity,W.shadowBias=J.bias,W.shadowNormalBias=J.normalBias,W.shadowRadius=J.radius,W.shadowMapSize=J.mapSize,n.directionalShadow[p]=W,n.directionalShadowMap[p]=K,n.directionalShadowMatrix[p]=P.shadow.matrix,A++}n.directional[p]=k,p++}else if(P.isSpotLight){const k=t.get(P);k.position.setFromMatrixPosition(P.matrixWorld),k.color.copy(Y).multiplyScalar(G),k.distance=N,k.coneCos=Math.cos(P.angle),k.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),k.decay=P.decay,n.spot[v]=k;const J=P.shadow;if(P.map&&(n.spotLightMap[O]=P.map,O++,J.updateMatrices(P),P.castShadow&&C++),n.spotLightMatrix[v]=J.matrix,P.castShadow){const W=e.get(P);W.shadowIntensity=J.intensity,W.shadowBias=J.bias,W.shadowNormalBias=J.normalBias,W.shadowRadius=J.radius,W.shadowMapSize=J.mapSize,n.spotShadow[v]=W,n.spotShadowMap[v]=K,T++}v++}else if(P.isRectAreaLight){const k=t.get(P);k.color.copy(Y).multiplyScalar(G),k.halfWidth.set(P.width*.5,0,0),k.halfHeight.set(0,P.height*.5,0),n.rectArea[m]=k,m++}else if(P.isPointLight){const k=t.get(P);if(k.color.copy(P.color).multiplyScalar(P.intensity),k.distance=P.distance,k.decay=P.decay,P.castShadow){const J=P.shadow,W=e.get(P);W.shadowIntensity=J.intensity,W.shadowBias=J.bias,W.shadowNormalBias=J.normalBias,W.shadowRadius=J.radius,W.shadowMapSize=J.mapSize,W.shadowCameraNear=J.camera.near,W.shadowCameraFar=J.camera.far,n.pointShadow[g]=W,n.pointShadowMap[g]=K,n.pointShadowMatrix[g]=P.shadow.matrix,x++}n.point[g]=k,g++}else if(P.isHemisphereLight){const k=t.get(P);k.skyColor.copy(P.color).multiplyScalar(G),k.groundColor.copy(P.groundColor).multiplyScalar(G),n.hemi[f]=k,f++}}m>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ht.LTC_FLOAT_1,n.rectAreaLTC2=ht.LTC_FLOAT_2):(n.rectAreaLTC1=ht.LTC_HALF_1,n.rectAreaLTC2=ht.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;const U=n.hash;(U.directionalLength!==p||U.pointLength!==g||U.spotLength!==v||U.rectAreaLength!==m||U.hemiLength!==f||U.numDirectionalShadows!==A||U.numPointShadows!==x||U.numSpotShadows!==T||U.numSpotMaps!==O||U.numLightProbes!==R)&&(n.directional.length=p,n.spot.length=v,n.rectArea.length=m,n.point.length=g,n.hemi.length=f,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.pointShadow.length=x,n.pointShadowMap.length=x,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=A,n.pointShadowMatrix.length=x,n.spotLightMatrix.length=T+O-C,n.spotLightMap.length=O,n.numSpotLightShadowsWithMaps=C,n.numLightProbes=R,U.directionalLength=p,U.pointLength=g,U.spotLength=v,U.rectAreaLength=m,U.hemiLength=f,U.numDirectionalShadows=A,U.numPointShadows=x,U.numSpotShadows=T,U.numSpotMaps=O,U.numLightProbes=R,n.version=Lm++)}function l(c,u){let h=0,d=0,p=0,g=0,v=0;const m=u.matrixWorldInverse;for(let f=0,A=c.length;f<A;f++){const x=c[f];if(x.isDirectionalLight){const T=n.directional[h];T.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),T.direction.sub(r),T.direction.transformDirection(m),h++}else if(x.isSpotLight){const T=n.spot[p];T.position.setFromMatrixPosition(x.matrixWorld),T.position.applyMatrix4(m),T.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),T.direction.sub(r),T.direction.transformDirection(m),p++}else if(x.isRectAreaLight){const T=n.rectArea[g];T.position.setFromMatrixPosition(x.matrixWorld),T.position.applyMatrix4(m),o.identity(),s.copy(x.matrixWorld),s.premultiply(m),o.extractRotation(s),T.halfWidth.set(x.width*.5,0,0),T.halfHeight.set(0,x.height*.5,0),T.halfWidth.applyMatrix4(o),T.halfHeight.applyMatrix4(o),g++}else if(x.isPointLight){const T=n.point[d];T.position.setFromMatrixPosition(x.matrixWorld),T.position.applyMatrix4(m),d++}else if(x.isHemisphereLight){const T=n.hemi[v];T.direction.setFromMatrixPosition(x.matrixWorld),T.direction.transformDirection(m),v++}}}return{setup:a,setupView:l,state:n}}function jo(i){const t=new Um(i),e=[],n=[];function r(u){c.camera=u,e.length=0,n.length=0}function s(u){e.push(u)}function o(u){n.push(u)}function a(){t.setup(e)}function l(u){t.setupView(e,u)}const c={lightsArray:e,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function Im(i){let t=new WeakMap;function e(r,s=0){const o=t.get(r);let a;return o===void 0?(a=new jo(i),t.set(r,[a])):s>=o.length?(a=new jo(i),o.push(a)):a=o[s],a}function n(){t=new WeakMap}return{get:e,dispose:n}}class Nm extends ls{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mu,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class Om extends ls{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const Fm=`void main() {
3790	gl_Position = vec4( position, 1.0 );
3791}`,Bm=`uniform sampler2D shadow_pass;
3792uniform vec2 resolution;
3793uniform float radius;
3794#include <packing>
3795void main() {
3796	const float samples = float( VSM_SAMPLES );
3797	float mean = 0.0;
3798	float squared_mean = 0.0;
3799	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3800	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3801	for ( float i = 0.0; i < samples; i ++ ) {
3802		float uvOffset = uvStart + i * uvStride;
3803		#ifdef HORIZONTAL_PASS
3804			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3805			mean += distribution.x;
3806			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3807		#else
3808			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3809			mean += depth;
3810			squared_mean += depth * depth;
3811		#endif
3812	}
3813	mean = mean / samples;
3814	squared_mean = squared_mean / samples;
3815	float std_dev = sqrt( squared_mean - mean * mean );
3816	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3817}`;function zm(i,t,e){let n=new jl;const r=new ct,s=new ct,o=new ee,a=new Nm({depthPacking:gu}),l=new Om,c={},u=e.maxTextureSize,h={[On]:Pe,[Pe]:On,[gn]:gn},d=new Mn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ct},radius:{value:4}},vertexShader:Fm,fragmentShader:Bm}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const g=new an;g.setAttribute("position",new Je(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new ke(g,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Tl;let f=this.type;this.render=function(C,R,U){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||C.length===0)return;const b=i.getRenderTarget(),M=i.getActiveCubeFace(),P=i.getActiveMipmapLevel(),Y=i.state;Y.setBlending(In),Y.buffers.color.setClear(1,1,1,1),Y.buffers.depth.setTest(!0),Y.setScissorTest(!1);const G=f!==mn&&this.type===mn,N=f===mn&&this.type!==mn;for(let K=0,k=C.length;K<k;K++){const J=C[K],W=J.shadow;if(W===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(W.autoUpdate===!1&&W.needsUpdate===!1)continue;r.copy(W.mapSize);const ot=W.getFrameExtents();if(r.multiply(ot),s.copy(W.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/ot.x),r.x=s.x*ot.x,W.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/ot.y),r.y=s.y*ot.y,W.mapSize.y=s.y)),W.map===null||G===!0||N===!0){const mt=this.type!==mn?{minFilter:Ve,magFilter:Ve}:{};W.map!==null&&W.map.dispose(),W.map=new Qn(r.x,r.y,mt),W.map.texture.name=J.name+".shadowMap",W.camera.updateProjectionMatrix()}i.setRenderTarget(W.map),i.clear();const et=W.getViewportCount();for(let mt=0;mt<et;mt++){const At=W.getViewport(mt);o.set(s.x*At.x,s.y*At.y,s.x*At.z,s.y*At.w),Y.viewport(o),W.updateMatrices(J,mt),n=W.getFrustum(),T(R,U,W.camera,J,this.type)}W.isPointLightShadow!==!0&&this.type===mn&&A(W,U),W.needsUpdate=!1}f=this.type,m.needsUpdate=!1,i.setRenderTarget(b,M,P)};function A(C,R){const U=t.update(v);d.defines.VSM_SAMPLES!==C.blurSamples&&(d.defines.VSM_SAMPLES=C.blurSamples,p.defines.VSM_SAMPLES=C.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new Qn(r.x,r.y)),d.uniforms.shadow_pass.value=C.map.texture,d.uniforms.resolution.value=C.mapSize,d.uniforms.radius.value=C.radius,i.setRenderTarget(C.mapPass),i.clear(),i.renderBufferDirect(R,null,U,d,v,null),p.uniforms.shadow_pass.value=C.mapPass.texture,p.uniforms.resolution.value=C.mapSize,p.uniforms.radius.value=C.radius,i.setRenderTarget(C.map),i.clear(),i.renderBufferDirect(R,null,U,p,v,null)}function x(C,R,U,b){let M=null;const P=U.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(P!==void 0)M=P;else if(M=U.isPointLight===!0?l:a,i.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0){const Y=M.uuid,G=R.uuid;let N=c[Y];N===void 0&&(N={},c[Y]=N);let K=N[G];K===void 0&&(K=M.clone(),N[G]=K,R.addEventListener("dispose",O)),M=K}if(M.visible=R.visible,M.wireframe=R.wireframe,b===mn?M.side=R.shadowSide!==null?R.shadowSide:R.side:M.side=R.shadowSide!==null?R.shadowSide:h[R.side],M.alphaMap=R.alphaMap,M.alphaTest=R.alph
vendor: 9,929 bytes, line 3817
3817aTest,M.map=R.map,M.clipShadows=R.clipShadows,M.clippingPlanes=R.clippingPlanes,M.clipIntersection=R.clipIntersection,M.displacementMap=R.displacementMap,M.displacementScale=R.displacementScale,M.displacementBias=R.displacementBias,M.wireframeLinewidth=R.wireframeLinewidth,M.linewidth=R.linewidth,U.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const Y=i.properties.get(M);Y.light=U}return M}function T(C,R,U,b,M){if(C.visible===!1)return;if(C.layers.test(R.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&M===mn)&&(!C.frustumCulled||n.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,C.matrixWorld);const G=t.update(C),N=C.material;if(Array.isArray(N)){const K=G.groups;for(let k=0,J=K.length;k<J;k++){const W=K[k],ot=N[W.materialIndex];if(ot&&ot.visible){const et=x(C,ot,b,M);C.onBeforeShadow(i,C,R,U,G,et,W),i.renderBufferDirect(U,null,G,et,C,W),C.onAfterShadow(i,C,R,U,G,et,W)}}}else if(N.visible){const K=x(C,N,b,M);C.onBeforeShadow(i,C,R,U,G,K,null),i.renderBufferDirect(U,null,G,K,C,null),C.onAfterShadow(i,C,R,U,G,K,null)}}const Y=C.children;for(let G=0,N=Y.length;G<N;G++)T(Y[G],R,U,b,M)}function O(C){C.target.removeEventListener("dispose",O);for(const U in c){const b=c[U],M=C.target.uuid;M in b&&(b[M].dispose(),delete b[M])}}}function Hm(i){function t(){let _=!1;const F=new ee;let B=null;const X=new ee(0,0,0,0);return{setMask:function(it){B!==it&&!_&&(i.colorMask(it,it,it,it),B=it)},setLocked:function(it){_=it},setClear:function(it,bt,Ft,se,fe){fe===!0&&(it*=se,bt*=se,Ft*=se),F.set(it,bt,Ft,se),X.equals(F)===!1&&(i.clearColor(it,bt,Ft,se),X.copy(F))},reset:function(){_=!1,B=null,X.set(-1,0,0,0)}}}function e(){let _=!1,F=null,B=null,X=null;return{setTest:function(it){it?ft(i.DEPTH_TEST):ut(i.DEPTH_TEST)},setMask:function(it){F!==it&&!_&&(i.depthMask(it),F=it)},setFunc:function(it){if(B!==it){switch(it){case Jc:i.depthFunc(i.NEVER);break;case Qc:i.depthFunc(i.ALWAYS);break;case tu:i.depthFunc(i.LESS);break;case Qr:i.depthFunc(i.LEQUAL);break;case eu:i.depthFunc(i.EQUAL);break;case nu:i.depthFunc(i.GEQUAL);break;case iu:i.depthFunc(i.GREATER);break;case ru:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}B=it}},setLocked:function(it){_=it},setClear:function(it){X!==it&&(i.clearDepth(it),X=it)},reset:function(){_=!1,F=null,B=null,X=null}}}function n(){let _=!1,F=null,B=null,X=null,it=null,bt=null,Ft=null,se=null,fe=null;return{setTest:function(Wt){_||(Wt?ft(i.STENCIL_TEST):ut(i.STENCIL_TEST))},setMask:function(Wt){F!==Wt&&!_&&(i.stencilMask(Wt),F=Wt)},setFunc:function(Wt,pe,le){(B!==Wt||X!==pe||it!==le)&&(i.stencilFunc(Wt,pe,le),B=Wt,X=pe,it=le)},setOp:function(Wt,pe,le){(bt!==Wt||Ft!==pe||se!==le)&&(i.stencilOp(Wt,pe,le),bt=Wt,Ft=pe,se=le)},setLocked:function(Wt){_=Wt},setClear:function(Wt){fe!==Wt&&(i.clearStencil(Wt),fe=Wt)},reset:function(){_=!1,F=null,B=null,X=null,it=null,bt=null,Ft=null,se=null,fe=null}}}const r=new t,s=new e,o=new n,a=new WeakMap,l=new WeakMap;let c={},u={},h=new WeakMap,d=[],p=null,g=!1,v=null,m=null,f=null,A=null,x=null,T=null,O=null,C=new $t(0,0,0),R=0,U=!1,b=null,M=null,P=null,Y=null,G=null;const N=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let K=!1,k=0;const J=i.getParameter(i.VERSION);J.indexOf("WebGL")!==-1?(k=parseFloat(/^WebGL (\d)/.exec(J)[1]),K=k>=1):J.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),K=k>=2);let W=null,ot={};const et=i.getParameter(i.SCISSOR_BOX),mt=i.getParameter(i.VIEWPORT),At=new ee().fromArray(et),Pt=new ee().fromArray(mt);function q(_,F,B,X){const it=new Uint8Array(4),bt=i.createTexture();i.bindTexture(_,bt),i.texParameteri(_,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(_,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ft=0;Ft<B;Ft++)_===i.TEXTURE_3D||_===i.TEXTURE_2D_ARRAY?i.texImage3D(F,0,i.RGBA,1,1,X,0,i.RGBA,i.UNSIGNED_BYTE,it):i.texImage2D(F+Ft,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,it);return bt}const nt={};nt[i.TEXTURE_2D]=q(i.TEXTURE_2D,i.TEXTURE_2D,1),nt[i.TEXTURE_CUBE_MAP]=q(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),nt[i.TEXTURE_2D_ARRAY]=q(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),nt[i.TEXTURE_3D]=q(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),ft(i.DEPTH_TEST),s.setFunc(Qr),at(!1),Z(eo),ft(i.CULL_FACE),rt(In);function ft(_){c[_]!==!0&&(i.enable(_),c[_]=!0)}function ut(_){c[_]!==!1&&(i.disable(_),c[_]=!1)}function Rt(_,F){return u[_]!==F?(i.bindFramebuffer(_,F),u[_]=F,_===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=F),_===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=F),!0):!1}function Ut(_,F){let B=d,X=!1;if(_){B=h.get(F),B===void 0&&(B=[],h.set(F,B));const it=_.textures;if(B.length!==it.length||B[0]!==i.COLOR_ATTACHMENT0){for(let bt=0,Ft=it.length;bt<Ft;bt++)B[bt]=i.COLOR_ATTACHMENT0+bt;B.length=it.length,X=!0}}else B[0]!==i.BACK&&(B[0]=i.BACK,X=!0);X&&i.drawBuffers(B)}function Lt(_){return p!==_?(i.useProgram(_),p=_,!0):!1}const Mt={[Yn]:i.FUNC_ADD,[Nc]:i.FUNC_SUBTRACT,[Oc]:i.FUNC_REVERSE_SUBTRACT};Mt[Fc]=i.MIN,Mt[Bc]=i.MAX;const y={[zc]:i.ZERO,[Hc]:i.ONE,[Gc]:i.SRC_COLOR,[Zs]:i.SRC_ALPHA,[Yc]:i.SRC_ALPHA_SATURATE,[Xc]:i.DST_COLOR,[kc]:i.DST_ALPHA,[Vc]:i.ONE_MINUS_SRC_COLOR,[js]:i.ONE_MINUS_SRC_ALPHA,[qc]:i.ONE_MINUS_DST_COLOR,[Wc]:i.ONE_MINUS_DST_ALPHA,[Kc]:i.CONSTANT_COLOR,[Zc]:i.ONE_MINUS_CONSTANT_COLOR,[jc]:i.CONSTANT_ALPHA,[$c]:i.ONE_MINUS_CONSTANT_ALPHA};function rt(_,F,B,X,it,bt,Ft,se,fe,Wt){if(_===In){g===!0&&(ut(i.BLEND),g=!1);return}if(g===!1&&(ft(i.BLEND),g=!0),_!==Ic){if(_!==v||Wt!==U){if((m!==Yn||x!==Yn)&&(i.blendEquation(i.FUNC_ADD),m=Yn,x=Yn),Wt)switch(_){case wi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case no:i.blendFunc(i.ONE,i.ONE);break;case io:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ro:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",_);break}else switch(_){case wi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case no:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case io:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ro:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",_);break}f=null,A=null,T=null,O=null,C.set(0,0,0),R=0,v=_,U=Wt}return}it=it||F,bt=bt||B,Ft=Ft||X,(F!==m||it!==x)&&(i.blendEquationSeparate(Mt[F],Mt[it]),m=F,x=it),(B!==f||X!==A||bt!==T||Ft!==O)&&(i.blendFuncSeparate(y[B],y[X],y[bt],y[Ft]),f=B,A=X,T=bt,O=Ft),(se.equals(C)===!1||fe!==R)&&(i.blendColor(se.r,se.g,se.b,fe),C.copy(se),R=fe),v=_,U=!1}function Q(_,F){_.side===gn?ut(i.CULL_FACE):ft(i.CULL_FACE);let B=_.side===Pe;F&&(B=!B),at(B),_.blending===wi&&_.transparent===!1?rt(In):rt(_.blending,_.blendEquation,_.blendSrc,_.blendDst,_.blendEquationAlpha,_.blendSrcAlpha,_.blendDstAlpha,_.blendColor,_.blendAlpha,_.premultipliedAlpha),s.setFunc(_.depthFunc),s.setTest(_.depthTest),s.setMask(_.depthWrite),r.setMask(_.colorWrite);const X=_.stencilWrite;o.setTest(X),X&&(o.setMask(_.stencilWriteMask),o.setFunc(_.stencilFunc,_.stencilRef,_.stencilFuncMask),o.setOp(_.stencilFail,_.stencilZFail,_.stencilZPass)),pt(_.polygonOffset,_.polygonOffsetFactor,_.polygonOffsetUnits),_.alphaToCoverage===!0?ft(i.SAMPLE_ALPHA_TO_COVERAGE):ut(i.SAMPLE_ALPHA_TO_COVERAGE)}function at(_){b!==_&&(_?i.frontFace(i.CW):i.frontFace(i.CCW),b=_)}function Z(_){_!==Lc?(ft(i.CULL_FACE),_!==M&&(_===eo?i.cullFace(i.BACK):_===Dc?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ut(i.CULL_FACE),M=_}function Ct(_){_!==P&&(K&&i.lineWidth(_),P=_)}function pt(_,F,B){_?(ft(i.POLYGON_OFFSET_FILL),(Y!==F||G!==B)&&(i.polygonOffset(F,B),Y=F,G=B)):ut(i.POLYGON_OFFSET_FILL)}function xt(_){_?ft(i.SCISSOR_TEST):ut(i.SCISSOR_TEST)}function w(_){_===void 0&&(_=i.TEXTURE0+N-1),W!==_&&(i.activeTexture(_),W=_)}function S(_,F,B){B===void 0&&(W===null?B=i.TEXTURE0+N-1:B=W);let X=ot[B];X===void 0&&(X={type:void 0,texture:void 0},ot[B]=X),(X.type!==_||X.texture!==F)&&(W!==B&&(i.activeTexture(B),W=B),i.bindTexture(_,F||nt[_]),X.type=_,X.texture=F)}function z(){const _=ot[W];_!==void 0&&_.type!==void 0&&(i.bindTexture(_.type,null),_.type=void 0,_.texture=void 0)}function tt(){try{i.compressedTexImage2D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function $(){try{i.compressedTexImage3D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function j(){try{i.texSubImage2D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function Tt(){try{i.texSubImage3D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function dt(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function _t(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function zt(){try{i.texStorage2D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function st(){try{i.texStorage3D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function gt(){try{i.texImage2D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function kt(){try{i.texImage3D.apply(i,arguments)}catch(_){console.error("THREE.WebGLState:",_)}}function It(_){At.equals(_)===!1&&(i.scissor(_.x,_.y,_.z,_.w),At.copy(_))}function St(_){Pt.equals(_)===!1&&(i.viewport(_.x,_.y,_.z,_.w),Pt.copy(_))}function Ot(_,F){let B=l.get(F);B===void 0&&(B=new WeakMap,l.set(F,B));let X=B.get(_);X===void 0&&(X=i.getUniformBlockIndex(F,_.name),B.set(_,X))}function Ht(_,F){const X=l.get(F).get(_);a.get(F)!==X&&(i.uniformBlockBinding(F,X,_.__bindingPointIndex),a.set(F,X))}function Qt(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor
vendor: 6,932 bytes, line 3817
3817(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),c={},W=null,ot={},u={},h=new WeakMap,d=[],p=null,g=!1,v=null,m=null,f=null,A=null,x=null,T=null,O=null,C=new $t(0,0,0),R=0,U=!1,b=null,M=null,P=null,Y=null,G=null,At.set(0,0,i.canvas.width,i.canvas.height),Pt.set(0,0,i.canvas.width,i.canvas.height),r.reset(),s.reset(),o.reset()}return{buffers:{color:r,depth:s,stencil:o},enable:ft,disable:ut,bindFramebuffer:Rt,drawBuffers:Ut,useProgram:Lt,setBlending:rt,setMaterial:Q,setFlipSided:at,setCullFace:Z,setLineWidth:Ct,setPolygonOffset:pt,setScissorTest:xt,activeTexture:w,bindTexture:S,unbindTexture:z,compressedTexImage2D:tt,compressedTexImage3D:$,texImage2D:gt,texImage3D:kt,updateUBOMapping:Ot,uniformBlockBinding:Ht,texStorage2D:zt,texStorage3D:st,texSubImage2D:j,texSubImage3D:Tt,compressedTexSubImage2D:dt,compressedTexSubImage3D:_t,scissor:It,viewport:St,reset:Qt}}function $o(i,t,e,n){const r=Gm(n);switch(e){case Pl:return i*t;case Dl:return i*t;case Ul:return i*t*2;case Il:return i*t/r.components*r.byteLength;case Ba:return i*t/r.components*r.byteLength;case Nl:return i*t*2/r.components*r.byteLength;case za:return i*t*2/r.components*r.byteLength;case Ll:return i*t*3/r.components*r.byteLength;case $e:return i*t*4/r.components*r.byteLength;case Ha:return i*t*4/r.components*r.byteLength;case Xr:case qr:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case Yr:case Kr:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case na:case ra:return Math.max(i,16)*Math.max(t,8)/4;case ea:case ia:return Math.max(i,8)*Math.max(t,8)/2;case sa:case aa:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case oa:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case la:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case ca:return Math.floor((i+4)/5)*Math.floor((t+3)/4)*16;case ua:return Math.floor((i+4)/5)*Math.floor((t+4)/5)*16;case ha:return Math.floor((i+5)/6)*Math.floor((t+4)/5)*16;case da:return Math.floor((i+5)/6)*Math.floor((t+5)/6)*16;case fa:return Math.floor((i+7)/8)*Math.floor((t+4)/5)*16;case pa:return Math.floor((i+7)/8)*Math.floor((t+5)/6)*16;case ma:return Math.floor((i+7)/8)*Math.floor((t+7)/8)*16;case ga:return Math.floor((i+9)/10)*Math.floor((t+4)/5)*16;case _a:return Math.floor((i+9)/10)*Math.floor((t+5)/6)*16;case va:return Math.floor((i+9)/10)*Math.floor((t+7)/8)*16;case xa:return Math.floor((i+9)/10)*Math.floor((t+9)/10)*16;case Sa:return Math.floor((i+11)/12)*Math.floor((t+9)/10)*16;case Ma:return Math.floor((i+11)/12)*Math.floor((t+11)/12)*16;case Zr:case ya:case Ea:return Math.ceil(i/4)*Math.ceil(t/4)*16;case Ol:case Ta:return Math.ceil(i/4)*Math.ceil(t/4)*8;case ba:case Aa:return Math.ceil(i/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function Gm(i){switch(i){case xn:case wl:return{byteLength:1,components:1};case Ji:case Rl:case rr:return{byteLength:2,components:1};case Oa:case Fa:return{byteLength:2,components:4};case Jn:case Na:case _n:return{byteLength:4,components:1};case Cl:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}function Vm(i,t,e,n,r,s,o){const a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new ct,u=new WeakMap;let h;const d=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(w,S){return p?new OffscreenCanvas(w,S):tr("canvas")}function v(w,S,z){let tt=1;const $=xt(w);if(($.width>z||$.height>z)&&(tt=z/Math.max($.width,$.height)),tt<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){const j=Math.floor(tt*$.width),Tt=Math.floor(tt*$.height);h===void 0&&(h=g(j,Tt));const dt=S?g(j,Tt):h;return dt.width=j,dt.height=Tt,dt.getContext("2d").drawImage(w,0,0,j,Tt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+j+"x"+Tt+")."),dt}else return"data"in w&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),w;return w}function m(w){return w.generateMipmaps&&w.minFilter!==Ve&&w.minFilter!==Ze}function f(w){i.generateMipmap(w)}function A(w,S,z,tt,$=!1){if(w!==null){if(i[w]!==void 0)return i[w];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let j=S;if(S===i.RED&&(z===i.FLOAT&&(j=i.R32F),z===i.HALF_FLOAT&&(j=i.R16F),z===i.UNSIGNED_BYTE&&(j=i.R8)),S===i.RED_INTEGER&&(z===i.UNSIGNED_BYTE&&(j=i.R8UI),z===i.UNSIGNED_SHORT&&(j=i.R16UI),z===i.UNSIGNED_INT&&(j=i.R32UI),z===i.BYTE&&(j=i.R8I),z===i.SHORT&&(j=i.R16I),z===i.INT&&(j=i.R32I)),S===i.RG&&(z===i.FLOAT&&(j=i.RG32F),z===i.HALF_FLOAT&&(j=i.RG16F),z===i.UNSIGNED_BYTE&&(j=i.RG8)),S===i.RG_INTEGER&&(z===i.UNSIGNED_BYTE&&(j=i.RG8UI),z===i.UNSIGNED_SHORT&&(j=i.RG16UI),z===i.UNSIGNED_INT&&(j=i.RG32UI),z===i.BYTE&&(j=i.RG8I),z===i.SHORT&&(j=i.RG16I),z===i.INT&&(j=i.RG32I)),S===i.RGB&&z===i.UNSIGNED_INT_5_9_9_9_REV&&(j=i.RGB9_E5),S===i.RGBA){const Tt=$?ts:Kt.getTransfer(tt);z===i.FLOAT&&(j=i.RGBA32F),z===i.HALF_FLOAT&&(j=i.RGBA16F),z===i.UNSIGNED_BYTE&&(j=Tt===Jt?i.SRGB8_ALPHA8:i.RGBA8),z===i.UNSIGNED_SHORT_4_4_4_4&&(j=i.RGBA4),z===i.UNSIGNED_SHORT_5_5_5_1&&(j=i.RGB5_A1)}return(j===i.R16F||j===i.R32F||j===i.RG16F||j===i.RG32F||j===i.RGBA16F||j===i.RGBA32F)&&t.get("EXT_color_buffer_float"),j}function x(w,S){let z;return w?S===null||S===Jn||S===Ii?z=i.DEPTH24_STENCIL8:S===_n?z=i.DEPTH32F_STENCIL8:S===Ji&&(z=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===Jn||S===Ii?z=i.DEPTH_COMPONENT24:S===_n?z=i.DEPTH_COMPONENT32F:S===Ji&&(z=i.DEPTH_COMPONENT16),z}function T(w,S){return m(w)===!0||w.isFramebufferTexture&&w.minFilter!==Ve&&w.minFilter!==Ze?Math.log2(Math.max(S.width,S.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?S.mipmaps.length:1}function O(w){const S=w.target;S.removeEventListener("dispose",O),R(S),S.isVideoTexture&&u.delete(S)}function C(w){const S=w.target;S.removeEventListener("dispose",C),b(S)}function R(w){const S=n.get(w);if(S.__webglInit===void 0)return;const z=w.source,tt=d.get(z);if(tt){const $=tt[S.__cacheKey];
vendor: 5,105 bytes, line 3817
3817$.usedTimes--,$.usedTimes===0&&U(w),Object.keys(tt).length===0&&d.delete(z)}n.remove(w)}function U(w){const S=n.get(w);i.deleteTexture(S.__webglTexture);const z=w.source,tt=d.get(z);delete tt[S.__cacheKey],o.memory.textures--}function b(w){const S=n.get(w);if(w.depthTexture&&w.depthTexture.dispose(),w.isWebGLCubeRenderTarget)for(let tt=0;tt<6;tt++){if(Array.isArray(S.__webglFramebuffer[tt]))for(let $=0;$<S.__webglFramebuffer[tt].length;$++)i.deleteFramebuffer(S.__webglFramebuffer[tt][$]);else i.deleteFramebuffer(S.__webglFramebuffer[tt]);S.__webglDepthbuffer&&i.deleteRenderbuffer(S.__webglDepthbuffer[tt])}else{if(Array.isArray(S.__webglFramebuffer))for(let tt=0;tt<S.__webglFramebuffer.length;tt++)i.deleteFramebuffer(S.__webglFramebuffer[tt]);else i.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&i.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&i.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let tt=0;tt<S.__webglColorRenderbuffer.length;tt++)S.__webglColorRenderbuffer[tt]&&i.deleteRenderbuffer(S.__webglColorRenderbuffer[tt]);S.__webglDepthRenderbuffer&&i.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const z=w.textures;for(let tt=0,$=z.length;tt<$;tt++){const j=n.get(z[tt]);j.__webglTexture&&(i.deleteTexture(j.__webglTexture),o.memory.textures--),n.remove(z[tt])}n.remove(w)}let M=0;function P(){M=0}function Y(){const w=M;return w>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+r.maxTextures),M+=1,w}function G(w){const S=[];return S.push(w.wrapS),S.push(w.wrapT),S.push(w.wrapR||0),S.push(w.magFilter),S.push(w.minFilter),S.push(w.anisotropy),S.push(w.internalFormat),S.push(w.format),S.push(w.type),S.push(w.generateMipmaps),S.push(w.premultiplyAlpha),S.push(w.flipY),S.push(w.unpackAlignment),S.push(w.colorSpace),S.join()}function N(w,S){const z=n.get(w);if(w.isVideoTexture&&Ct(w),w.isRenderTargetTexture===!1&&w.version>0&&z.__version!==w.version){const tt=w.image;if(tt===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(tt.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Pt(z,w,S);return}}e.bindTexture(i.TEXTURE_2D,z.__webglTexture,i.TEXTURE0+S)}function K(w,S){const z=n.get(w);if(w.version>0&&z.__version!==w.version){Pt(z,w,S);return}e.bindTexture(i.TEXTURE_2D_ARRAY,z.__webglTexture,i.TEXTURE0+S)}function k(w,S){const z=n.get(w);if(w.version>0&&z.__version!==w.version){Pt(z,w,S);return}e.bindTexture(i.TEXTURE_3D,z.__webglTexture,i.TEXTURE0+S)}function J(w,S){const z=n.get(w);if(w.version>0&&z.__version!==w.version){q(z,w,S);return}e.bindTexture(i.TEXTURE_CUBE_MAP,z.__webglTexture,i.TEXTURE0+S)}const W={[Qs]:i.REPEAT,[Zn]:i.CLAMP_TO_EDGE,[ta]:i.MIRRORED_REPEAT},ot={[Ve]:i.NEAREST,[pu]:i.NEAREST_MIPMAP_NEAREST,[fr]:i.NEAREST_MIPMAP_LINEAR,[Ze]:i.LINEAR,[ms]:i.LINEAR_MIPMAP_NEAREST,[jn]:i.LINEAR_MIPMAP_LINEAR},et={[xu]:i.NEVER,[bu]:i.ALWAYS,[Su]:i.LESS,[Fl]:i.LEQUAL,[Mu]:i.EQUAL,[Tu]:i.GEQUAL,[yu]:i.GREATER,[Eu]:i.NOTEQUAL};function mt(w,S){if(S.type===_n&&t.has("OES_texture_float_linear")===!1&&(S.magFilter===Ze||S.magFilter===ms||S.magFilter===fr||S.magFilter===jn||S.minFilter===Ze||S.minFilter===ms||S.minFilter===fr||S.minFilter===jn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(w,i.TEXTURE_WRAP_S,W[S.wrapS]),i.texParameteri(w,i.TEXTURE_WRAP_T,W[S.wrapT]),(w===i.TEXTURE_3D||w===i.TEXTURE_2D_ARRAY)&&i.texParameteri(w,i.TEXTURE_WRAP_R,W[S.wrapR]),i.texParameteri(w,i.TEXTURE_MAG_FILTER,ot[S.magFilter]),i.texParameteri(w,i.TEXTURE_MIN_FILTER,ot[S.minFilter]),S.compareFunction&&(i.texParameteri(w,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(w,i.TEXTURE_COMPARE_FUNC,et[S.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===Ve||S.minFilter!==fr&&S.minFilter!==jn||S.type===_n&&t.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const z=t.get("EXT_texture_filter_anisotropic");i.texParameterf(w,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,r.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function At(w,S){let z=!1;w.__webglInit===void 0&&(w.__webglInit=!0,S.addEventListener("dispose",O));const tt=S.source;let $=d.get(tt);$===void 0&&($={},d.set(tt,$));const j=G(S);if(j!==w.__cacheKey){$[j]===void 0&&($[j]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,z=!0),$[j].usedTimes++;const Tt=$[w.__cacheKey];Tt!==void 0&&($[w.__cacheKey].usedTimes--,Tt.usedTimes===0&&U(S)),w.__cacheKey=j,w.__webglTexture=$[j].texture}return z}function Pt(w,S,z){let tt=i.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(tt=i.TEXTURE_2D_ARRAY),S.isData3DTexture&&(tt=i.TEXTURE_3D);const $=At(w,S),j=S.source;e.bindTexture(tt,w.__webglTexture,i.TEXTURE0+z);const Tt=n.get(j);if(j.version!==Tt.__version||$===!0){e.activeTexture(i.TEXTURE0+z);
vendor: 4,423 bytes, line 3817
3817const dt=Kt.getPrimaries(Kt.workingColorSpace),_t=S.colorSpace===Ln?null:Kt.getPrimaries(S.colorSpace),zt=S.colorSpace===Ln||dt===_t?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,S.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,S.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,zt);let st=v(S.image,!1,r.maxTextureSize);st=pt(S,st);const gt=s.convert(S.format,S.colorSpace),kt=s.convert(S.type);let It=A(S.internalFormat,gt,kt,S.colorSpace,S.isVideoTexture);mt(tt,S);let St;const Ot=S.mipmaps,Ht=S.isVideoTexture!==!0,Qt=Tt.__version===void 0||$===!0,_=j.dataReady,F=T(S,st);if(S.isDepthTexture)It=x(S.format===Ni,S.type),Qt&&(Ht?e.texStorage2D(i.TEXTURE_2D,1,It,st.width,st.height):e.texImage2D(i.TEXTURE_2D,0,It,st.width,st.height,0,gt,kt,null));else if(S.isDataTexture)if(Ot.length>0){Ht&&Qt&&e.texStorage2D(i.TEXTURE_2D,F,It,Ot[0].width,Ot[0].height);for(let B=0,X=Ot.length;B<X;B++)St=Ot[B],Ht?_&&e.texSubImage2D(i.TEXTURE_2D,B,0,0,St.width,St.height,gt,kt,St.data):e.texImage2D(i.TEXTURE_2D,B,It,St.width,St.height,0,gt,kt,St.data);S.generateMipmaps=!1}else Ht?(Qt&&e.texStorage2D(i.TEXTURE_2D,F,It,st.width,st.height),_&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,st.width,st.height,gt,kt,st.data)):e.texImage2D(i.TEXTURE_2D,0,It,st.width,st.height,0,gt,kt,st.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){Ht&&Qt&&e.texStorage3D(i.TEXTURE_2D_ARRAY,F,It,Ot[0].width,Ot[0].height,st.depth);for(let B=0,X=Ot.length;B<X;B++)if(St=Ot[B],S.format!==$e)if(gt!==null)if(Ht){if(_)if(S.layerUpdates.size>0){const it=$o(St.width,St.height,S.format,S.type);for(const bt of S.layerUpdates){const Ft=St.data.subarray(bt*it/St.data.BYTES_PER_ELEMENT,(bt+1)*it/St.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,B,0,0,bt,St.width,St.height,1,gt,Ft,0,0)}S.clearLayerUpdates()}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,B,0,0,0,St.width,St.height,st.depth,gt,St.data,0,0)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,B,It,St.width,St.height,st.depth,0,St.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ht?_&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,B,0,0,0,St.width,St.height,st.depth,gt,kt,St.data):e.texImage3D(i.TEXTURE_2D_ARRAY,B,It,St.width,St.height,st.depth,0,gt,kt,St.data)}else{Ht&&Qt&&e.texStorage2D(i.TEXTURE_2D,F,It,Ot[0].width,Ot[0].height);for(let B=0,X=Ot.length;B<X;B++)St=Ot[B],S.format!==$e?gt!==null?Ht?_&&e.compressedTexSubImage2D(i.TEXTURE_2D,B,0,0,St.width,St.height,gt,St.data):e.compressedTexImage2D(i.TEXTURE_2D,B,It,St.width,St.height,0,St.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ht?_&&e.texSubImage2D(i.TEXTURE_2D,B,0,0,St.width,St.height,gt,kt,St.data):e.texImage2D(i.TEXTURE_2D,B,It,St.width,St.height,0,gt,kt,St.data)}else if(S.isDataArrayTexture)if(Ht){if(Qt&&e.texStorage3D(i.TEXTURE_2D_ARRAY,F,It,st.width,st.height,st.depth),_)if(S.layerUpdates.size>0){const B=$o(st.width,st.height,S.format,S.type);for(const X of S.layerUpdates){const it=st.data.subarray(X*B/st.data.BYTES_PER_ELEMENT,(X+1)*B/st.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,X,st.width,st.height,1,gt,kt,it)}S.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,st.width,st.height,st.depth,gt,kt,st.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,It,st.width,st.height,st.depth,0,gt,kt,st.data);else if(S.isData3DTexture)Ht?(Qt&&e.texStorage3D(i.TEXTURE_3D,F,It,st.width,st.height,st.depth),_&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,st.width,st.height,st.depth,gt,kt,st.data)):e.texImage3D(i.TEXTURE_3D,0,It,st.width,st.height,st.depth,0,gt,kt,st.data);else if(S.isFramebufferTexture){if(Qt)if(Ht)e.texStorage2D(i.TEXTURE_2D,F,It,st.width,st.height);else{let B=st.width,X=st.height;for(let it=0;it<F;it++)e.texImage2D(i.TEXTURE_2D,it,It,B,X,0,gt,kt,null),B>>=1,X>>=1}}else if(Ot.length>0){if(Ht&&Qt){const B=xt(Ot[0]);e.texStorage2D(i.TEXTURE_2D,F,It,B.width,B.height)}for(let B=0,X=Ot.length;B<X;B++)St=Ot[B],Ht?_&&e.texSubImage2D(i.TEXTURE_2D,B,0,0,gt,kt,St):e.texImage2D(i.TEXTURE_2D,B,It,gt,kt,St);S.generateMipmaps=!1}else if(Ht){if(Qt){const B=xt(st);e.texStorage2D(i.TEXTURE_2D,F,It,B.width,B.height)}_&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,gt,kt,st)}else e.texImage2D(i.TEXTURE_2D,0,It,gt,kt,st);
vendor: 8,453 bytes, line 3817
3817m(S)&&f(tt),Tt.__version=j.version,S.onUpdate&&S.onUpdate(S)}w.__version=S.version}function q(w,S,z){if(S.image.length!==6)return;const tt=At(w,S),$=S.source;e.bindTexture(i.TEXTURE_CUBE_MAP,w.__webglTexture,i.TEXTURE0+z);const j=n.get($);if($.version!==j.__version||tt===!0){e.activeTexture(i.TEXTURE0+z);const Tt=Kt.getPrimaries(Kt.workingColorSpace),dt=S.colorSpace===Ln?null:Kt.getPrimaries(S.colorSpace),_t=S.colorSpace===Ln||Tt===dt?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,S.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,S.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,_t);const zt=S.isCompressedTexture||S.image[0].isCompressedTexture,st=S.image[0]&&S.image[0].isDataTexture,gt=[];for(let X=0;X<6;X++)!zt&&!st?gt[X]=v(S.image[X],!0,r.maxCubemapSize):gt[X]=st?S.image[X].image:S.image[X],gt[X]=pt(S,gt[X]);const kt=gt[0],It=s.convert(S.format,S.colorSpace),St=s.convert(S.type),Ot=A(S.internalFormat,It,St,S.colorSpace),Ht=S.isVideoTexture!==!0,Qt=j.__version===void 0||tt===!0,_=$.dataReady;let F=T(S,kt);mt(i.TEXTURE_CUBE_MAP,S);let B;if(zt){Ht&&Qt&&e.texStorage2D(i.TEXTURE_CUBE_MAP,F,Ot,kt.width,kt.height);for(let X=0;X<6;X++){B=gt[X].mipmaps;for(let it=0;it<B.length;it++){const bt=B[it];S.format!==$e?It!==null?Ht?_&&e.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,it,0,0,bt.width,bt.height,It,bt.data):e.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,it,Ot,bt.width,bt.height,0,bt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ht?_&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,it,0,0,bt.width,bt.height,It,St,bt.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,it,Ot,bt.width,bt.height,0,It,St,bt.data)}}}else{if(B=S.mipmaps,Ht&&Qt){B.length>0&&F++;const X=xt(gt[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,F,Ot,X.width,X.height)}for(let X=0;X<6;X++)if(st){Ht?_&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,gt[X].width,gt[X].height,It,St,gt[X].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,Ot,gt[X].width,gt[X].height,0,It,St,gt[X].data);for(let it=0;it<B.length;it++){const Ft=B[it].image[X].image;Ht?_&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,it+1,0,0,Ft.width,Ft.height,It,St,Ft.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,it+1,Ot,Ft.width,Ft.height,0,It,St,Ft.data)}}else{Ht?_&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,It,St,gt[X]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,Ot,It,St,gt[X]);for(let it=0;it<B.length;it++){const bt=B[it];Ht?_&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,it+1,0,0,It,St,bt.image[X]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+X,it+1,Ot,It,St,bt.image[X])}}}m(S)&&f(i.TEXTURE_CUBE_MAP),j.__version=$.version,S.onUpdate&&S.onUpdate(S)}w.__version=S.version}function nt(w,S,z,tt,$,j){const Tt=s.convert(z.format,z.colorSpace),dt=s.convert(z.type),_t=A(z.internalFormat,Tt,dt,z.colorSpace);if(!n.get(S).__hasExternalTextures){const st=Math.max(1,S.width>>j),gt=Math.max(1,S.height>>j);$===i.TEXTURE_3D||$===i.TEXTURE_2D_ARRAY?e.texImage3D($,j,_t,st,gt,S.depth,0,Tt,dt,null):e.texImage2D($,j,_t,st,gt,0,Tt,dt,null)}e.bindFramebuffer(i.FRAMEBUFFER,w),Z(S)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,tt,$,n.get(z).__webglTexture,0,at(S)):($===i.TEXTURE_2D||$>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,tt,$,n.get(z).__webglTexture,j),e.bindFramebuffer(i.FRAMEBUFFER,null)}function ft(w,S,z){if(i.bindRenderbuffer(i.RENDERBUFFER,w),S.depthBuffer){const tt=S.depthTexture,$=tt&&tt.isDepthTexture?tt.type:null,j=x(S.stencilBuffer,$),Tt=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,dt=at(S);Z(S)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,dt,j,S.width,S.height):z?i.renderbufferStorageMultisample(i.RENDERBUFFER,dt,j,S.width,S.height):i.renderbufferStorage(i.RENDERBUFFER,j,S.width,S.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Tt,i.RENDERBUFFER,w)}else{const tt=S.textures;for(let $=0;$<tt.length;$++){const j=tt[$],Tt=s.convert(j.format,j.colorSpace),dt=s.convert(j.type),_t=A(j.internalFormat,Tt,dt,j.colorSpace),zt=at(S);z&&Z(S)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,zt,_t,S.width,S.height):Z(S)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,zt,_t,S.width,S.height):i.renderbufferStorage(i.RENDERBUFFER,_t,S.width,S.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ut(w,S){if(S&&S.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(i.FRAMEBUFFER,w),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(S.depthTexture).__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),N(S.depthTexture,0);const tt=n.get(S.depthTexture).__webglTexture,$=at(S);if(S.depthTexture.format===Ri)Z(S)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,tt,0,$):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,tt,0);else if(S.depthTexture.format===Ni)Z(S)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,tt,0,$):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,tt,0);else throw new Error("Unknown depthTexture format")}function Rt(w){const S=n.get(w),z=w.isWebGLCubeRenderTarget===!0;if(w.depthTexture&&!S.__autoAllocateDepthBuffer){if(z)throw new Error("target.depthTexture not supported in Cube render targets");ut(S.__webglFramebuffer,w)}else if(z){S.__webglDepthbuffer=[];for(let tt=0;tt<6;tt++)e.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer[tt]),S.__webglDepthbuffer[tt]=i.createRenderbuffer(),ft(S.__webglDepthbuffer[tt],w,!1)}else e.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer=i.createRenderbuffer(),ft(S.__webglDepthbuffer,w,!1);e.bindFramebuffer(i.FRAMEBUFFER,null)}function Ut(w,S,z){const tt=n.get(w);S!==void 0&&nt(tt.__webglFramebuffer,w,w.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),z!==void 0&&Rt(w)}function Lt(w){const S=w.texture,z=n.get(w),tt=n.get(S);w.addEventListener("dispose",C);const $=w.textures,j=w.isWebGLCubeRenderTarget===!0,Tt=$.length>1;if(Tt||(tt.__webglTexture===void 0&&(tt.__webglTexture=i.createTexture()),tt.__version=S.version,o.memory.textures++),j){z.__webglFramebuffer=[];for(let dt=0;dt<6;dt++)if(S.mipmaps&&S.mipmaps.length>0){z.__webglFramebuffer[dt]=[];for(let _t=0;_t<S.mipmaps.length;_t++)z.__webglFramebuffer[dt][_t]=i.createFramebuffer()}else z.__webglFramebuffer[dt]=i.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){z.__webglFramebuffer=[];for(let dt=0;dt<S.mipmaps.length;dt++)z.__webglFramebuffer[dt]=i.createFramebuffer()}else z.__webglFramebuffer=i.createFramebuffer();if(Tt)for(let dt=0,_t=$.length;dt<_t;dt++){const zt=n.get($[dt]);zt.__webglTexture===void 0&&(zt.__webglTexture=i.createTexture(),o.memory.textures++)}if(w.samples>0&&Z(w)===!1){z.__webglMultisampledFramebuffer=i.createFramebuffer(),z.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let dt=0;dt<$.length;dt++){const _t=$[dt];z.__webglColorRenderbuffer[dt]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,z.__webglColorRenderbuffer[dt]);const zt=s.convert(_t.format,_t.colorSpace),st=s.convert(_t.type),gt=A(_t.internalFormat,zt,st,_t.colorSpace,w.isXRRenderTarget===!0),kt=at(w);i.renderbufferStorageMultisample(i.RENDERBUFFER,kt,gt,w.width,w.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+dt,i.RENDERBUFFER,z.__webglColorRenderbuffer[dt])}i.bindRenderbuffer(i.RENDERBUFFER,null),w.depthBuffer&&(z.__webglDepthRenderbuffer=i.createRenderbuffer(),ft(z.__webglDepthRenderbuffer,w,!0)),e.bindFramebuffer(i.FRAMEBUFFER,null)}}if(j){e.bindTexture(i.TEXTURE_CUBE_MAP,tt.__webglTexture),mt(i.TEXTURE_CUBE_MAP,S);for(let dt=0;dt<6;dt++)if(S.mipmaps&&S.mipmaps.length>0)for(let _t=0;_t<S.mipmaps.length;_t++)nt(z.__webglFramebuffer[dt][_t],w,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+dt,_t);else nt(z.__webglFramebuffer[dt],w,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+dt,0);m(S)&&f(i.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(Tt){for(let dt=0,_t=$.length;dt<_t;
vendor: 8,080 bytes, line 3817
3817dt++){const zt=$[dt],st=n.get(zt);e.bindTexture(i.TEXTURE_2D,st.__webglTexture),mt(i.TEXTURE_2D,zt),nt(z.__webglFramebuffer,w,zt,i.COLOR_ATTACHMENT0+dt,i.TEXTURE_2D,0),m(zt)&&f(i.TEXTURE_2D)}e.unbindTexture()}else{let dt=i.TEXTURE_2D;if((w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(dt=w.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(dt,tt.__webglTexture),mt(dt,S),S.mipmaps&&S.mipmaps.length>0)for(let _t=0;_t<S.mipmaps.length;_t++)nt(z.__webglFramebuffer[_t],w,S,i.COLOR_ATTACHMENT0,dt,_t);else nt(z.__webglFramebuffer,w,S,i.COLOR_ATTACHMENT0,dt,0);m(S)&&f(dt),e.unbindTexture()}w.depthBuffer&&Rt(w)}function Mt(w){const S=w.textures;for(let z=0,tt=S.length;z<tt;z++){const $=S[z];if(m($)){const j=w.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,Tt=n.get($).__webglTexture;e.bindTexture(j,Tt),f(j),e.unbindTexture()}}}const y=[],rt=[];function Q(w){if(w.samples>0){if(Z(w)===!1){const S=w.textures,z=w.width,tt=w.height;let $=i.COLOR_BUFFER_BIT;const j=w.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Tt=n.get(w),dt=S.length>1;if(dt)for(let _t=0;_t<S.length;_t++)e.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+_t,i.RENDERBUFFER,null),e.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+_t,i.TEXTURE_2D,null,0);e.bindFramebuffer(i.READ_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer);for(let _t=0;_t<S.length;_t++){if(w.resolveDepthBuffer&&(w.depthBuffer&&($|=i.DEPTH_BUFFER_BIT),w.stencilBuffer&&w.resolveStencilBuffer&&($|=i.STENCIL_BUFFER_BIT)),dt){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[_t]);const zt=n.get(S[_t]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,zt,0)}i.blitFramebuffer(0,0,z,tt,0,0,z,tt,$,i.NEAREST),l===!0&&(y.length=0,rt.length=0,y.push(i.COLOR_ATTACHMENT0+_t),w.depthBuffer&&w.resolveDepthBuffer===!1&&(y.push(j),rt.push(j),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,rt)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,y))}if(e.bindFramebuffer(i.READ_FRAMEBUFFER,null),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),dt)for(let _t=0;_t<S.length;_t++){e.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+_t,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[_t]);const zt=n.get(S[_t]).__webglTexture;e.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+_t,i.TEXTURE_2D,zt,0)}e.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer)}else if(w.depthBuffer&&w.resolveDepthBuffer===!1&&l){const S=w.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[S])}}}function at(w){return Math.min(r.maxSamples,w.samples)}function Z(w){const S=n.get(w);return w.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function Ct(w){const S=o.render.frame;u.get(w)!==S&&(u.set(w,S),w.update())}function pt(w,S){const z=w.colorSpace,tt=w.format,$=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||z!==Fn&&z!==Ln&&(Kt.getTransfer(z)===Jt?(tt!==$e||$!==xn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),S}function xt(w){return typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement?(c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height):typeof VideoFrame<"u"&&w instanceof VideoFrame?(c.width=w.displayWidth,c.height=w.displayHeight):(c.width=w.width,c.height=w.height),c}this.allocateTextureUnit=Y,this.resetTextureUnits=P,this.setTexture2D=N,this.setTexture2DArray=K,this.setTexture3D=k,this.setTextureCube=J,this.rebindTextures=Ut,this.setupRenderTarget=Lt,this.updateRenderTargetMipmap=Mt,this.updateMultisampleRenderTarget=Q,this.setupDepthRenderbuffer=Rt,this.setupFrameBufferTexture=nt,this.useMultisampledRTT=Z}function km(i,t){function e(n,r=Ln){let s;const o=Kt.getTransfer(r);if(n===xn)return i.UNSIGNED_BYTE;if(n===Oa)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Fa)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Cl)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===wl)return i.BYTE;if(n===Rl)return i.SHORT;if(n===Ji)return i.UNSIGNED_SHORT;if(n===Na)return i.INT;if(n===Jn)return i.UNSIGNED_INT;if(n===_n)return i.FLOAT;if(n===rr)return i.HALF_FLOAT;if(n===Pl)return i.ALPHA;if(n===Ll)return i.RGB;if(n===$e)return i.RGBA;if(n===Dl)return i.LUMINANCE;if(n===Ul)return i.LUMINANCE_ALPHA;if(n===Ri)return i.DEPTH_COMPONENT;if(n===Ni)return i.DEPTH_STENCIL;if(n===Il)return i.RED;if(n===Ba)return i.RED_INTEGER;if(n===Nl)return i.RG;if(n===za)return i.RG_INTEGER;if(n===Ha)return i.RGBA_INTEGER;if(n===Xr||n===qr||n===Yr||n===Kr)if(o===Jt)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Xr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===qr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Yr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Kr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Xr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===qr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Yr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Kr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ea||n===na||n===ia||n===ra)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ea)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===na)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ia)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ra)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===sa||n===aa||n===oa)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(n===sa||n===aa)return o===Jt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===oa)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===la||n===ca||n===ua||n===ha||n===da||n===fa||n===pa||n===ma||n===ga||n===_a||n===va||n===xa||n===Sa||n===Ma)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(n===la)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ca)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ua)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ha)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===da)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===fa)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===pa)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ma)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ga)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===_a)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===va)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===xa)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Sa)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ma)return o===Jt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Zr||n===ya||n===Ea)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(n===Zr)return o===Jt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ya)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ea)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ol||n===Ta||n===ba||n===Aa)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(n===Zr)return s.COMPRESSED_RED_RGT
vendor: 10,251 bytes, lines 3817-3841
3817C1_EXT;if(n===Ta)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ba)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Aa)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ii?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}class Wm extends ze{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class Nr extends Oe{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Xm={type:"move"};class Hs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Nr,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 Nr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Nr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){o=!0;for(const v of t.hand.values()){const m=e.getJointPose(v,n),f=this._getHandJoint(c,v);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 u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),p=.02,g=.005;c.inputState.pinching&&d>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&d<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=e.getPose(t.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Xm)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const n=new Nr;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}const qm=`
3818void main() {
3819
3820	gl_Position = vec4( position, 1.0 );
3821
3822}`,Ym=`
3823uniform sampler2DArray depthColor;
3824uniform float depthWidth;
3825uniform float depthHeight;
3826
3827void main() {
3828
3829	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
3830
3831	if ( coord.x >= 1.0 ) {
3832
3833		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
3834
3835	} else {
3836
3837		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
3838
3839	}
3840
3841}`;class Km{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){const r=new Re,s=t.properties.get(r);s.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new Mn({vertexShader:qm,fragmentShader:Ym,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ke(new or(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Zm extends ni{constructor(t,e){super();const n=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,d=null,p=null,g=null;const v=new Km,m=e.getContextAttributes();let f=null,A=null;const x=[],T=[],O=new ct;let C=null;const R=new ze;R.layers.enable(1),R.viewport=new ee;const U=new ze;U.layers.enable(2),U.viewport=new ee;const b=[R,U],M=new Wm;M.layers.enable(1),M.layers.enable(2);let P=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let nt=x[q];return nt===void 0&&(nt=new Hs,x[q]=nt),nt.getTargetRaySpace()},this.getControllerGrip=function(q){let nt=x[q];return nt===void 0&&(nt=new Hs,x[q]=nt),nt.getGripSpace()},this.getHand=function(q){let nt=x[q];return nt===void 0&&(nt=new Hs,x[q]=nt),nt.getHandSpace()};function G(q){const nt=T.indexOf(q.inputSource);if(nt===-1)return;const ft=x[nt];ft!==void 0&&(ft.update(q.inputSource,q.frame,c||o),ft.dispatchEvent({type:q.type,data:q.inputSource}))}function N(){r.removeEventListener("select",G),r.removeEventListener("selectstart",G),r.removeEventListener("selectend",G),r.removeEventListener("squeeze",G),r.removeEventListener("squeezestart",G),r.removeEventListener("squeezeend",G),r.removeEventListener("end",N),r.removeEventListener("inputsourceschange",K);for(let q=0;q<x.length;q++){const nt=T[q];nt!==null&&(T[q]=null,x[q].disconnect(nt))}P=null,Y=null,v.reset(),t.setRenderTarget(f),p=null,d=null,h=null,r=null,A=null,Pt.stop(),n.isPresenting=!1,t.setPixelRatio(C),t.setSize(O.width,O.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){a=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(q){c=q},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(q){if(r=q,r!==null){if(f=t.getRenderTarget(),r.addEventListener("select",G),r.addEventListener("selectstart",G),r.addEventListener("selectend",G),r.addEventListener("squeeze",G),r.addEventListener("squeezestart",G),r.addEventListener("squeezeend",G),r.addEventListener("end",N),r.addEventListener("inputsourceschange",K),m.xrCompatible!==!0&&await e.makeXRCompatible(),C=t.getPixelRatio(),t.getSize(O),r.renderState.layers===void 0){const nt={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,e,nt),r.updateRenderState({baseLayer:p}),t.setPixelRatio(1),t.setSize(p.framebufferWidth,p.framebufferHeight,!1),A=new Qn(p.framebufferWidth,p.framebufferHeight,{format:$e,type:xn,colorSpace:t.outputColorSpace,stencilBuffer:m.stencil})}else{let nt=null,ft=null,ut=null;m.depth&&(ut=m.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,nt=m.stencil?Ni:Ri,ft=m.stencil?Ii:Jn);const Rt={colorFormat:e.RGBA8,depthFormat:ut,scaleFactor:s};h=new XRWebGLBinding(r,e),d=h.createProjectionLayer(Rt),r.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),A=new Qn(d.textureWidth,d.textureHeight,{format:$e,type:xn,depthTexture:new Jl(d.textureWidth,d.textureHeight,ft,void 0,void 0,void 0,void 0,void 0,void 0,nt),stencilBuffer:m.stencil,colorSpace:t.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}A.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),Pt.setContext(r),Pt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return v.getDepthTexture()};function K(q){for(let nt=0;nt<q.removed.length;nt++){const ft=q.removed[nt],ut=T.indexOf(ft);ut>=0&&(T[ut]=null,x[ut].disconnect(ft))}for(let nt=0;nt<q.added.length;nt++){const ft=q.added[nt];let ut=T.indexOf(ft);if(ut===-1){for(let Ut=0;Ut<x.length;Ut++)if(Ut>=T.length){T.push(ft),ut=Ut;break}else if(T[Ut]===null){T[Ut]=ft,ut=Ut;break}if(ut===-1)break}const Rt=x[ut];Rt&&Rt.connect(ft)}}const k=new L,J=new L;function W(q,nt,ft){k.setFromMatrixPosition(nt.matrixWorld),J.setFromMatrixPosition(ft.matrixWorld);const ut=k.distanceTo(J),Rt=nt.projectionMatrix.elements,Ut=ft.projectionMatrix.elements,Lt=Rt[14]/(Rt[10]-1),Mt=Rt[14]/(Rt[10]+1),y=(Rt[9]+1)/Rt[5],rt=(Rt[9]-1)/Rt[5],Q=(Rt[8]-1)/Rt[0],at=(Ut[8]+1)/Ut[0],Z=Lt*Q,Ct=Lt*at,pt=ut/(-Q+at),xt=pt*-Q;nt.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(xt),q.translateZ(pt),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert();const w=Lt+pt,S=Mt+pt,z=Z-xt,tt=Ct+(ut-xt),$=y*Mt/S*w,j=rt*Mt/S*w;q.projectionMatrix.makePerspective(z,tt,$,j,w,S),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}function ot(q,nt){nt===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(nt.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(r===null)return;v.texture!==null&&(q.near=v.depthNear,q.far=v.depthFar),M.near=U.near=R.near=q.near,M.far=U.far=R.far=q.far,(P!==M.near||Y!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}
vendor: 15,268 bytes, line 3841
3841),P=M.near,Y=M.far,R.near=P,R.far=Y,U.near=P,U.far=Y,R.updateProjectionMatrix(),U.updateProjectionMatrix(),q.updateProjectionMatrix());const nt=q.parent,ft=M.cameras;ot(M,nt);for(let ut=0;ut<ft.length;ut++)ot(ft[ut],nt);ft.length===2?W(M,R,U):M.projectionMatrix.copy(R.projectionMatrix),et(q,M,nt)};function et(q,nt,ft){ft===null?q.matrix.copy(nt.matrixWorld):(q.matrix.copy(ft.matrixWorld),q.matrix.invert(),q.matrix.multiply(nt.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(nt.projectionMatrix),q.projectionMatrixInverse.copy(nt.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=Qi*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return l},this.setFoveation=function(q){l=q,d!==null&&(d.fixedFoveation=q),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=q)},this.hasDepthSensing=function(){return v.texture!==null},this.getDepthSensingMesh=function(){return v.getMesh(M)};let mt=null;function At(q,nt){if(u=nt.getViewerPose(c||o),g=nt,u!==null){const ft=u.views;p!==null&&(t.setRenderTargetFramebuffer(A,p.framebuffer),t.setRenderTarget(A));let ut=!1;ft.length!==M.cameras.length&&(M.cameras.length=0,ut=!0);for(let Ut=0;Ut<ft.length;Ut++){const Lt=ft[Ut];let Mt=null;if(p!==null)Mt=p.getViewport(Lt);else{const rt=h.getViewSubImage(d,Lt);Mt=rt.viewport,Ut===0&&(t.setRenderTargetTextures(A,rt.colorTexture,d.ignoreDepthValues?void 0:rt.depthStencilTexture),t.setRenderTarget(A))}let y=b[Ut];y===void 0&&(y=new ze,y.layers.enable(Ut),y.viewport=new ee,b[Ut]=y),y.matrix.fromArray(Lt.transform.matrix),y.matrix.decompose(y.position,y.quaternion,y.scale),y.projectionMatrix.fromArray(Lt.projectionMatrix),y.projectionMatrixInverse.copy(y.projectionMatrix).invert(),y.viewport.set(Mt.x,Mt.y,Mt.width,Mt.height),Ut===0&&(M.matrix.copy(y.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ut===!0&&M.cameras.push(y)}const Rt=r.enabledFeatures;if(Rt&&Rt.includes("depth-sensing")){const Ut=h.getDepthInformation(ft[0]);Ut&&Ut.isValid&&Ut.texture&&v.init(t,Ut,r.renderState)}}for(let ft=0;ft<x.length;ft++){const ut=T[ft],Rt=x[ft];ut!==null&&Rt!==void 0&&Rt.update(ut,nt,c||o)}mt&&mt(q,nt),nt.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:nt}),g=null}const Pt=new $l;Pt.setAnimationLoop(At),this.setAnimationLoop=function(q){mt=q},this.dispose=function(){}}}const Xn=new Sn,jm=new oe;function $m(i,t){function e(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,Yl(i)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function r(m,f,A,x,T){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(m,f):f.isMeshToonMaterial?(s(m,f),h(m,f)):f.isMeshPhongMaterial?(s(m,f),u(m,f)):f.isMeshStandardMaterial?(s(m,f),d(m,f),f.isMeshPhysicalMaterial&&p(m,f,T)):f.isMeshMatcapMaterial?(s(m,f),g(m,f)):f.isMeshDepthMaterial?s(m,f):f.isMeshDistanceMaterial?(s(m,f),v(m,f)):f.isMeshNormalMaterial?s(m,f):f.isLineBasicMaterial?(o(m,f),f.isLineDashedMaterial&&a(m,f)):f.isPointsMaterial?l(m,f,A,x):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(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,e(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,e(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===Pe&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,e(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===Pe&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,e(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,e(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,e(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const A=t.get(f),x=A.envMap,T=A.envMapRotation;x&&(m.envMap.value=x,Xn.copy(T),Xn.x*=-1,Xn.y*=-1,Xn.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Xn.y*=-1,Xn.z*=-1),m.envMapRotation.value.setFromMatrix4(jm.makeRotationFromEuler(Xn)),m.flipEnvMap.value=x.isCubeTexture&&x.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,e(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,e(f.aoMap,m.aoMapTransform))}function o(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,e(f.map,m.mapTransform))}function a(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,A,x){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*A,m.scale.value=x*.5,f.map&&(m.map.value=f.map,e(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(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,e(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function u(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function h(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,e(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,e(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,A){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,e(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,e(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,e(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,e(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,e(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Pe&&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.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,e(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,e(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=A.texture,m.transmissionSamplerSize.value.set(A.width,A.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,e(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,e(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,e(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,e(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,e(f.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,f){f.matcap&&(m.matcap.value=f.matcap)}function v(m,f){const A=t.get(f).light;m.referencePosition.value.setFromMatrixPosition(A.matrixWorld),m.nearDistance.value=A.shadow.camera.near,m.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Jm(i,t,e,n){let r={},s={},o=[];const a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(A,x){const T=x.program;n.uniformBlockBinding(A,T)}function c(A,x){let T=r[A.id];T===void 0&&(g(A),T=u(A),r[A.id]=T,A.addEventListener("dispose",m));const O=x.program;n.updateUBOMapping(A,O);const C=t.render.frame;s[A.id]!==C&&(d(A),s[A.id]=C)}function u(A){const x=h();A.__bindingPointIndex=x;const T=i.createBuffer(),O=A.__size,C=A.usage;return i.bindBuffer(i.UNIFORM_BUFFER,T),i.bufferData(i.UNIFORM_BUFFER,O,C),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,T),T}function h(){for(let A=0;A<a;A++)if(o.indexOf(A)===-1)return o.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(A){const x=r[A.id],T=A.uniforms,O=A.__cache;i.bindBuffer(i.UNIFORM_BUFFER,x);for(let C=0,R=T.length;C<R;C++){const U=Array.isArray(T[C])?T[C]:[T[C]];for(let b=0,M=U.length;b<M;b++){const P=U[b];if(p(P,C,b,O)===!0){const Y=P.__offset,G=Array.isArray(P.value)?P.value:[P.value];let N=0;for(let K=0;K<G.length;K++){const k=G[K],J=v(k);typeof k=="number"||typeof k=="boolean"?(P.__data[0]=k,i.bufferSubData(i.UNIFORM_BUFFER,Y+N,P.__data)):k.isMatrix3?(P.__data[0]=k.elements[0],P.__data[1]=k.elements[1],P.__data[2]=k.elements[2],P.__data[3]=0,P.__data[4]=k.elements[3],P.__data[5]=k.elements[4],P.__data[6]=k.elements[5],P.__data[7]=0,P.__data[8]=k.elements[6],P.__data[9]=k.elements[7],P.__data[10]=k.elements[8],P.__data[11]=0):(k.toArray(P.__data,N),N+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,Y,P.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(A,x,T,O){const C=A.value,R=x+"_"+T;if(O[R]===void 0)return typeof C=="number"||typeof C=="boolean"?O[R]=C:O[R]=C.clone(),!0;{const U=O[R];if(typeof C=="number"||typeof C=="boolean"){if(U!==C)return O[R]=C,!0}else if(U.equals(C)===!1)return U.copy(C),!0}return!1}function g(A){const x=A.uniforms;let T=0;const O=16;for(let R=0,U=x.length;R<U;R++){const b=Array.isArray(x[R])?x[R]:[x[R]];for(let M=0,P=b.length;M<P;M++){const Y=b[M],G=Array.isArray(Y.value)?Y.value:[Y.value];for(let N=0,K=G.length;N<K;N++){const k=G[N],J=v(k),W=T%O,ot=W%J.boundary,et=W+ot;T+=ot,et!==0&&O-et<J.storage&&(T+=O-et),Y.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=T,T+=J.storage}}}const C=T%O;return C>0&&(T+=O-C),A.__size=T,A.__cache={},this}function v(A){const x={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(x.boundary=4,x.storage=4):A.isVector2?(x.boundary=8,x.storage=8):A.isVector3||A.isColor?(x.boundary=16,x.storage=12):A.isVector4?(x.boundary=16,x.storage=16):A.isMatrix3?(x.boundary=48,x.storage=48):A.isMatrix4?(x.boundary=64,x.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),x}function m(A){const x=A.target;x.removeEventListener("dispose",m);const T=o.indexOf(x.__bindingPointIndex);o.splice(T,1),i.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function f(){for(const A in r)i.deleteBuffer(r[A]);o=[],r={},s={}}return{bind:l,update:c,dispose:f}}class Qm{constructor(t={}){const{canvas:e=Vu(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=t;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=o;const p=new Uint32Array(4),g=new Int32Array(4);let v=null,m=null;const f=[],A=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=en,this.toneMapping=Nn,this.toneMappingExposure=1;const x=this;let T=!1,O=0,C=0,R=null,U=-1,b=null;const M=new ee,P=new ee;let Y=null;const G=new $t(0);let N=0,K=e.width,k=e.height,J=1,W=null,ot=null;const et=new ee(0,0,K,k),mt=new ee(0,0,K,k);let At=!1;const Pt=new jl;let q=!1,nt=!1;const ft=new oe,ut=new L,Rt=new ee,Ut={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Lt=!1;function Mt(){return R===null?J:1}let y=n;function rt(E,D){return e.getContext(E,D)}try{const E={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Ia}`),e.addEventListener("webglcontextlost",B,!1),e.addEventListener("webglcontextrestored",X,!1),e.addEventListener("webglcontextcreationerror",it,!1),y===null){const D="webgl2";if(y=rt(D,E),y===null)throw rt(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let Q,at,Z,Ct,pt,xt,w,S,z,tt,$,j,Tt,dt,_t,zt,st,gt,kt,It,St,Ot,Ht,Qt;function _(){Q=new sp(y),Q.init(),Ot=new km(y,Q),at=new Jf(y,Q,t,Ot),Z=new Hm(y),Ct=new lp(y),pt=new Am,xt=new Vm(y,Q,Z,pt,at,Ot,Ct),w=new tp(x),S=new rp(x),z=new fh(y),Ht=new jf(y,z),tt=new ap(y,z,Ct,Ht),$=new up(y,tt,z,Ct),kt=new cp(y,at,xt),zt=new Qf(pt),j=new bm(x,w,S,Q,at,Ht,zt),Tt=new $m(x,pt),dt=new Rm,_t=new Im(Q),gt=new Zf(x,w,S,Z,$,d,l),st=new zm(x,$,at),Qt=new Jm(y,Ct,at,Z),It=new $f(y,Q,Ct),St=new op(y,Q,Ct),Ct.programs=j.programs,x.capabilities=at,x.extensions=Q,x.properties=pt,x.renderLists=dt,x.shadowMap=st,x.state=Z,x.info=Ct}_();const F=new Zm(x,y);this.xr=F,this.getContext=function(){return y},this.getContextAttributes=function(){return y.getContextAttributes()},this.forceContextLoss=function(){const E=Q.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=Q.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(E){E!==void 0&&(J=E,this.setSize(K,k,!1))}
vendor: 4,053 bytes, line 3841
3841,this.getSize=function(E){return E.set(K,k)},this.setSize=function(E,D,H=!0){if(F.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}K=E,k=D,e.width=Math.floor(E*J),e.height=Math.floor(D*J),H===!0&&(e.style.width=E+"px",e.style.height=D+"px"),this.setViewport(0,0,E,D)},this.getDrawingBufferSize=function(E){return E.set(K*J,k*J).floor()},this.setDrawingBufferSize=function(E,D,H){K=E,k=D,J=H,e.width=Math.floor(E*H),e.height=Math.floor(D*H),this.setViewport(0,0,E,D)},this.getCurrentViewport=function(E){return E.copy(M)},this.getViewport=function(E){return E.copy(et)},this.setViewport=function(E,D,H,V){E.isVector4?et.set(E.x,E.y,E.z,E.w):et.set(E,D,H,V),Z.viewport(M.copy(et).multiplyScalar(J).round())},this.getScissor=function(E){return E.copy(mt)},this.setScissor=function(E,D,H,V){E.isVector4?mt.set(E.x,E.y,E.z,E.w):mt.set(E,D,H,V),Z.scissor(P.copy(mt).multiplyScalar(J).round())},this.getScissorTest=function(){return At},this.setScissorTest=function(E){Z.setScissorTest(At=E)},this.setOpaqueSort=function(E){W=E},this.setTransparentSort=function(E){ot=E},this.getClearColor=function(E){return E.copy(gt.getClearColor())},this.setClearColor=function(){gt.setClearColor.apply(gt,arguments)},this.getClearAlpha=function(){return gt.getClearAlpha()},this.setClearAlpha=function(){gt.setClearAlpha.apply(gt,arguments)},this.clear=function(E=!0,D=!0,H=!0){let V=0;if(E){let I=!1;if(R!==null){const lt=R.texture.format;I=lt===Ha||lt===za||lt===Ba}if(I){const lt=R.texture.type,vt=lt===xn||lt===Jn||lt===Ji||lt===Ii||lt===Oa||lt===Fa,yt=gt.getClearColor(),Et=gt.getClearAlpha(),Nt=yt.r,Bt=yt.g,Dt=yt.b;vt?(p[0]=Nt,p[1]=Bt,p[2]=Dt,p[3]=Et,y.clearBufferuiv(y.COLOR,0,p)):(g[0]=Nt,g[1]=Bt,g[2]=Dt,g[3]=Et,y.clearBufferiv(y.COLOR,0,g))}else V|=y.COLOR_BUFFER_BIT}D&&(V|=y.DEPTH_BUFFER_BIT),H&&(V|=y.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),y.clear(V)},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(){e.removeEventListener("webglcontextlost",B,!1),e.removeEventListener("webglcontextrestored",X,!1),e.removeEventListener("webglcontextcreationerror",it,!1),dt.dispose(),_t.dispose(),pt.dispose(),w.dispose(),S.dispose(),$.dispose(),Ht.dispose(),Qt.dispose(),j.dispose(),F.dispose(),F.removeEventListener("sessionstart",le),F.removeEventListener("sessionend",yn),xe.stop()};function B(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function X(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const E=Ct.autoReset,D=st.enabled,H=st.autoUpdate,V=st.needsUpdate,I=st.type;_(),Ct.autoReset=E,st.enabled=D,st.autoUpdate=H,st.needsUpdate=V,st.type=I}function it(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function bt(E){const D=E.target;D.removeEventListener("dispose",bt),Ft(D)}function Ft(E){se(E),pt.remove(E)}function se(E){const D=pt.get(E).programs;D!==void 0&&(D.forEach(function(H){j.releaseProgram(H)}),E.isShaderMaterial&&j.releaseShaderCache(E))}this.renderBufferDirect=function(E,D,H,V,I,lt){D===null&&(D=Ut);const vt=I.isMesh&&I.matrixWorld.determinant()<0,yt=fc(E,D,H,V,I);Z.setMaterial(V,vt);let Et=H.index,Nt=1;if(V.wireframe===!0){if(Et=tt.getWireframeAttribute(H),Et===void 0)return;Nt=2}const Bt=H.drawRange,Dt=H.attributes.position;let Xt=Bt.start*Nt,ie=(Bt.start+Bt.count)*Nt;lt!==null&&(Xt=Math.max(Xt,lt.start*Nt),ie=Math.min(ie,(lt.start+lt.count)*Nt)),Et!==null?(Xt=Math.max(Xt,0),ie=Math.min(ie,Et.count)):Dt!=null&&(Xt=Math.max(Xt,0),ie=Math.min(ie,Dt.count));const re=ie-Xt;if(re<0||re===1/0)return;Ht.setup(I,V,yt,H,Et);let Le,qt=It;if(Et!==null&&(Le=z.get(Et),qt=St,qt.setIndex(Le)),I.isMesh)V.wireframe===!0?(Z.setLineWidth(V.wireframeLinewidth*Mt()),qt.setMode(y.LINES)):qt.setMode(y.TRIANGLES);else if(I.isLine){let wt=V.linewidth;wt===void 0&&(wt=1),Z.setLineWidth(wt*Mt()),I.isLineSegments?qt.setMode(y.LINES):I.isLine
vendor: 7,499 bytes, line 3841
3841Loop?qt.setMode(y.LINE_LOOP):qt.setMode(y.LINE_STRIP)}else I.isPoints?qt.setMode(y.POINTS):I.isSprite&&qt.setMode(y.TRIANGLES);if(I.isBatchedMesh)if(I._multiDrawInstances!==null)qt.renderMultiDrawInstances(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount,I._multiDrawInstances);else if(Q.get("WEBGL_multi_draw"))qt.renderMultiDraw(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount);else{const wt=I._multiDrawStarts,Se=I._multiDrawCounts,Yt=I._multiDrawCount,Xe=Et?z.get(Et).bytesPerElement:1,ii=pt.get(V).currentProgram.getUniforms();for(let De=0;De<Yt;De++)ii.setValue(y,"_gl_DrawID",De),qt.render(wt[De]/Xe,Se[De])}else if(I.isInstancedMesh)qt.renderInstances(Xt,re,I.count);else if(H.isInstancedBufferGeometry){const wt=H._maxInstanceCount!==void 0?H._maxInstanceCount:1/0,Se=Math.min(H.instanceCount,wt);qt.renderInstances(Xt,re,Se)}else qt.render(Xt,re)};function fe(E,D,H){E.transparent===!0&&E.side===gn&&E.forceSinglePass===!1?(E.side=Pe,E.needsUpdate=!0,ur(E,D,H),E.side=On,E.needsUpdate=!0,ur(E,D,H),E.side=gn):ur(E,D,H)}this.compile=function(E,D,H=null){H===null&&(H=E),m=_t.get(H),m.init(D),A.push(m),H.traverseVisible(function(I){I.isLight&&I.layers.test(D.layers)&&(m.pushLight(I),I.castShadow&&m.pushShadow(I))}),E!==H&&E.traverseVisible(function(I){I.isLight&&I.layers.test(D.layers)&&(m.pushLight(I),I.castShadow&&m.pushShadow(I))}),m.setupLights();const V=new Set;return E.traverse(function(I){const lt=I.material;if(lt)if(Array.isArray(lt))for(let vt=0;vt<lt.length;vt++){const yt=lt[vt];fe(yt,H,I),V.add(yt)}else fe(lt,H,I),V.add(lt)}),A.pop(),m=null,V},this.compileAsync=function(E,D,H=null){const V=this.compile(E,D,H);return new Promise(I=>{function lt(){if(V.forEach(function(vt){pt.get(vt).currentProgram.isReady()&&V.delete(vt)}),V.size===0){I(E);return}setTimeout(lt,10)}Q.get("KHR_parallel_shader_compile")!==null?lt():setTimeout(lt,10)})};let Wt=null;function pe(E){Wt&&Wt(E)}function le(){xe.stop()}function yn(){xe.start()}const xe=new $l;xe.setAnimationLoop(pe),typeof self<"u"&&xe.setContext(self),this.setAnimationLoop=function(E){Wt=E,F.setAnimationLoop(E),E===null?xe.stop():xe.start()},F.addEventListener("sessionstart",le),F.addEventListener("sessionend",yn),this.render=function(E,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),F.enabled===!0&&F.isPresenting===!0&&(F.cameraAutoUpdate===!0&&F.updateCamera(D),D=F.getCamera()),E.isScene===!0&&E.onBeforeRender(x,E,D,R),m=_t.get(E,A.length),m.init(D),A.push(m),ft.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Pt.setFromProjectionMatrix(ft),nt=this.localClippingEnabled,q=zt.init(this.clippingPlanes,nt),v=dt.get(E,f.length),v.init(),f.push(v),F.enabled===!0&&F.isPresenting===!0){const lt=x.xr.getDepthSensingMesh();lt!==null&&ln(lt,D,-1/0,x.sortObjects)}ln(E,D,0,x.sortObjects),v.finish(),x.sortObjects===!0&&v.sort(W,ot),Lt=F.enabled===!1||F.isPresenting===!1||F.hasDepthSensing()===!1,Lt&&gt.addToRenderList(v,E),this.info.render.frame++,q===!0&&zt.beginShadows();const H=m.state.shadowsArray;st.render(H,E,D),q===!0&&zt.endShadows(),this.info.autoReset===!0&&this.info.reset();const V=v.opaque,I=v.transmissive;if(m.setupLights(),D.isArrayCamera){const lt=D.cameras;if(I.length>0)for(let vt=0,yt=lt.length;vt<yt;vt++){const Et=lt[vt];Bi(V,I,E,Et)}Lt&&gt.render(E);for(let vt=0,yt=lt.length;vt<yt;vt++){const Et=lt[vt];zn(v,E,Et,Et.viewport)}}else I.length>0&&Bi(V,I,E,D),Lt&&gt.render(E),zn(v,E,D);R!==null&&(xt.updateMultisampleRenderTarget(R),xt.updateRenderTargetMipmap(R)),E.isScene===!0&&E.onAfterRender(x,E,D),Ht.resetDefaultState(),U=-1,b=null,A.pop(),A.length>0?(m=A[A.length-1],q===!0&&zt.setGlobalState(x.clippingPlanes,m.state.camera)):m=null,f.pop(),f.length>0?v=f[f.length-1]:v=null};function ln(E,D,H,V){if(E.visible===!1)return;if(E.layers.test(D.layers)){if(E.isGroup)H=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(D);else if(E.isLight)m.pushLight(E),E.castShadow&&m.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||Pt.intersectsSprite(E)){V&&Rt.setFromMatrixPosition(E.matrixWorld).applyMatrix4(ft);const vt=$.update(E),yt=E.material;yt.visible&&v.push(E,vt,yt,H,Rt.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||Pt.intersectsObject(E))){const vt=$.update(E),yt=E.material;if(V&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Rt.copy(E.boundingSphere.center)):(vt.boundingSphere===null&&vt.computeBoundingSphere(),Rt.copy(vt.boundingSphere.center)),Rt.applyMatrix4(E.matrixWorld).applyMatrix4(ft)),Array.isArray(yt)){const Et=vt.groups;for(let Nt=0,Bt=Et.length;Nt<Bt;Nt++){const Dt=Et[Nt],Xt=yt[Dt.materialIndex];Xt&&Xt.visible&&v.push(E,vt,Xt,H,Rt.z,Dt)}}else yt.visible&&v.push(E,vt,yt,H,Rt.z,null)}}const lt=E.children;for(let vt=0,yt=lt.length;vt<yt;vt++)ln(lt[vt],D,H,V)}function zn(E,D,H,V){const I=E.opaque,lt=E.transmissive,vt=E.transparent;m.setupLightsView(H),q===!0&&zt.setGlobalState(x.clippingPlanes,H),V&&Z.viewport(M.copy(V)),I.length>0&&cr(I,D,H),lt.length>0&&cr(lt,D,H),vt.length>0&&cr(vt,D,H),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Bi(E,D,H,V){if((H.isScene===!0?H.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[V.id]===void 0&&(m.state.transmissionRenderTarget[V.id]=new Qn(1,1,{generateMipmaps:!0,type:Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float")?rr:xn,minFilter:jn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace}));const lt=m.state.transmissionRenderTarget[V.id],vt=V.viewport||M;lt.setSize(vt.z,vt.w);const yt=x.getRenderTarget();x.setRenderTarget(lt),x.getClearColor(G),N=x.getClearAlpha(),N<1&&x.setClearColor(16777215,.5),x.clear(),Lt&&gt.render(H);const Et=x.toneMapping;x.toneMapping=Nn;const Nt=V.viewport;if(V.viewport!==void 0&&(V.viewport=void 0),m.setupLightsView(V),q===!0&&zt.setGlobalState(x.clippingPlanes,V),cr(E,H,V),xt.updateMultisampleRenderTarget(lt),xt.updateRenderTargetMipmap(lt),Q.has("WEBGL_multisampled_render_to_texture")===!1){let Bt=!1;for(let Dt=0,Xt=D.length;Dt<Xt;Dt++){const ie=D[Dt],re=ie.object,Le=ie.geometry,qt=ie.material,wt=ie.group;if(qt.side===gn&&re.layers.test(V.layers)){const Se=qt.side;qt.side=Pe,qt.needsUpdate=!0,Ka(re,H,V,Le,qt,wt),qt.side=Se,qt.needsUpdate=!0,Bt=!0}}Bt===!0&&(xt.updateMultisampleRenderTarget(lt),xt.updateRenderTargetMipmap(lt))}x.setRenderTarget(yt),x.setClearColor(G,N),Nt!==void 0&&(V.viewport=Nt),x.toneMapping=Et}function cr(E,D,H){const V=D.isScene===!0?D.overrideMaterial:null;for(let I=0,lt=E.length;I<lt;I++){const vt=E[I],yt=vt.object,Et=vt.geometry,Nt=V===null?vt.material:V,Bt=vt.group;yt.layers.test(H.layers)&&Ka(yt,D,H,Et,Nt,Bt)}}function Ka(E,D,H,V,I,lt){E.onBeforeRender(x,D,H,V,I,lt),E.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),I.transparent===!0&&I.side===gn&&I.forceSinglePass===!1?(I.side=Pe,I.needsUpdate=!0,x.renderBufferDirect(H,D,V,I,E,lt),I.side=On,I.needsUpdate=!0,x.renderBufferDirect(H,D,V,I,E,lt),I.side=gn):x.renderBufferDirect(H,D,V,I,E,lt),E.onAfterRender(x,D,H,V,I,lt)}function ur(E,D,H){D.isScene!==!0&&(D=Ut);const V=pt.get(E),I=m.state.lights,lt=m.state.shadowsArray,vt=I.state.ver
vendor: 8,428 bytes, line 3841
3841sion,yt=j.getParameters(E,I.state,lt,D,H),Et=j.getProgramCacheKey(yt);let Nt=V.programs;V.environment=E.isMeshStandardMaterial?D.environment:null,V.fog=D.fog,V.envMap=(E.isMeshStandardMaterial?S:w).get(E.envMap||V.environment),V.envMapRotation=V.environment!==null&&E.envMap===null?D.environmentRotation:E.envMapRotation,Nt===void 0&&(E.addEventListener("dispose",bt),Nt=new Map,V.programs=Nt);let Bt=Nt.get(Et);if(Bt!==void 0){if(V.currentProgram===Bt&&V.lightsStateVersion===vt)return ja(E,yt),Bt}else yt.uniforms=j.getUniforms(E),E.onBeforeCompile(yt,x),Bt=j.acquireProgram(yt,Et),Nt.set(Et,Bt),V.uniforms=yt.uniforms;const Dt=V.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Dt.clippingPlanes=zt.uniform),ja(E,yt),V.needsLights=mc(E),V.lightsStateVersion=vt,V.needsLights&&(Dt.ambientLightColor.value=I.state.ambient,Dt.lightProbe.value=I.state.probe,Dt.directionalLights.value=I.state.directional,Dt.directionalLightShadows.value=I.state.directionalShadow,Dt.spotLights.value=I.state.spot,Dt.spotLightShadows.value=I.state.spotShadow,Dt.rectAreaLights.value=I.state.rectArea,Dt.ltc_1.value=I.state.rectAreaLTC1,Dt.ltc_2.value=I.state.rectAreaLTC2,Dt.pointLights.value=I.state.point,Dt.pointLightShadows.value=I.state.pointShadow,Dt.hemisphereLights.value=I.state.hemi,Dt.directionalShadowMap.value=I.state.directionalShadowMap,Dt.directionalShadowMatrix.value=I.state.directionalShadowMatrix,Dt.spotShadowMap.value=I.state.spotShadowMap,Dt.spotLightMatrix.value=I.state.spotLightMatrix,Dt.spotLightMap.value=I.state.spotLightMap,Dt.pointShadowMap.value=I.state.pointShadowMap,Dt.pointShadowMatrix.value=I.state.pointShadowMatrix),V.currentProgram=Bt,V.uniformsList=null,Bt}function Za(E){if(E.uniformsList===null){const D=E.currentProgram.getUniforms();E.uniformsList=jr.seqWithValue(D.seq,E.uniforms)}return E.uniformsList}function ja(E,D){const H=pt.get(E);H.outputColorSpace=D.outputColorSpace,H.batching=D.batching,H.batchingColor=D.batchingColor,H.instancing=D.instancing,H.instancingColor=D.instancingColor,H.instancingMorph=D.instancingMorph,H.skinning=D.skinning,H.morphTargets=D.morphTargets,H.morphNormals=D.morphNormals,H.morphColors=D.morphColors,H.morphTargetsCount=D.morphTargetsCount,H.numClippingPlanes=D.numClippingPlanes,H.numIntersection=D.numClipIntersection,H.vertexAlphas=D.vertexAlphas,H.vertexTangents=D.vertexTangents,H.toneMapping=D.toneMapping}function fc(E,D,H,V,I){D.isScene!==!0&&(D=Ut),xt.resetTextureUnits();const lt=D.fog,vt=V.isMeshStandardMaterial?D.environment:null,yt=R===null?x.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:Fn,Et=(V.isMeshStandardMaterial?S:w).get(V.envMap||vt),Nt=V.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,Bt=!!H.attributes.tangent&&(!!V.normalMap||V.anisotropy>0),Dt=!!H.morphAttributes.position,Xt=!!H.morphAttributes.normal,ie=!!H.morphAttributes.color;let re=Nn;V.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(re=x.toneMapping);const Le=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,qt=Le!==void 0?Le.length:0,wt=pt.get(V),Se=m.state.lights;if(q===!0&&(nt===!0||E!==b)){const Fe=E===b&&V.id===U;zt.setState(V,E,Fe)}let Yt=!1;V.version===wt.__version?(wt.needsLights&&wt.lightsStateVersion!==Se.state.version||wt.outputColorSpace!==yt||I.isBatchedMesh&&wt.batching===!1||!I.isBatchedMesh&&wt.batching===!0||I.isBatchedMesh&&wt.batchingColor===!0&&I.colorTexture===null||I.isBatchedMesh&&wt.batchingColor===!1&&I.colorTexture!==null||I.isInstancedMesh&&wt.instancing===!1||!I.isInstancedMesh&&wt.instancing===!0||I.isSkinnedMesh&&wt.skinning===!1||!I.isSkinnedMesh&&wt.skinning===!0||I.isInstancedMesh&&wt.instancingColor===!0&&I.instanceColor===null||I.isInstancedMesh&&wt.instancingColor===!1&&I.instanceColor!==null||I.isInstancedMesh&&wt.instancingMorph===!0&&I.morphTexture===null||I.isInstancedMesh&&wt.instancingMorph===!1&&I.morphTexture!==null||wt.envMap!==Et||V.fog===!0&&wt.fog!==lt||wt.numClippingPlanes!==void 0&&(wt.numClippingPlanes!==zt.numPlanes||wt.numIntersection!==zt.numIntersection)||wt.vertexAlphas!==Nt||wt.vertexTangents!==Bt||wt.morphTargets!==Dt||wt.morphNormals!==Xt||wt.morphColors!==ie||wt.toneMapping!==re||wt.morphTargetsCount!==qt)&&(Yt=!0):(Yt=!0,wt.__version=V.version);let Xe=wt.currentProgram;Yt===!0&&(Xe=ur(V,D,I));let ii=!1,De=!1,hs=!1;const ce=Xe.getUniforms(),En=wt.uniforms;if(Z.useProgram(Xe.program)&&(ii=!0,De=!0,hs=!0),V.id!==U&&(U=V.id,De=!0),ii||b!==E){ce.setValue(y,"projectionMatrix",E.projectionMatrix),ce.setValue(y,"viewMatrix",E.matrixWorldInverse);const Fe=ce.map.cameraPosition;Fe!==void 0&&Fe.setValue(y,ut.setFromMatrixPosition(E.matrixWorld)),at.logarithmicDepthBuffer&&ce.setValue(y,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshLambertMaterial||V.isMeshBasicMaterial||V.isMeshStandardMaterial||V.isShaderMaterial)&&ce.setValue(y,"isOrthographic",E.isOrthographicCamera===!0),b!==E&&(b=E,De=!0,hs=!0)}if(I.isSkinnedMesh){ce.setOptional(y,I,"bindMatrix"),ce.setOptional(y,I,"bindMatrixInverse");const Fe=I.skeleton;Fe&&(Fe.boneTexture===null&&Fe.computeBoneTexture(),ce.setValue(y,"boneTexture",Fe.boneTexture,xt))}I.isBatchedMesh&&(ce.setOptional(y,I,"batchingTexture"),ce.setValue(y,"batchingTexture",I._matricesTexture,xt),ce.setOptional(y,I,"batchingIdTexture"),ce.setValue(y,"batchingIdTexture",I._indirectTexture,xt),ce.setOptional(y,I,"batchingColorTexture"),I._colorsTexture!==null&&ce.setValue(y,"batchingColorTexture",I._colorsTexture,xt));const ds=H.morphAttributes;if((ds.position!==void 0||ds.normal!==void 0||ds.color!==void 0)&&kt.update(I,H,Xe),(De||wt.receiveShadow!==I.receiveShadow)&&(wt.receiveShadow=I.receiveShadow,ce.setValue(y,"receiveShadow",I.receiveShadow)),V.isMeshGouraudMaterial&&V.envMap!==null&&(En.envMap.value=Et,En.flipEnvMap.value=Et.isCubeTexture&&Et.isRenderTargetTexture===!1?-1:1),V.isMeshStandardMaterial&&V.envMap===null&&D.environment!==null&&(En.envMapIntensity.value=D.environmentIntensity),De&&(ce.setValue(y,"toneMappingExposure",x.toneMappingExposure),wt.needsLights&&pc(En,hs),lt&&V.fog===!0&&Tt.refreshFogUniforms(En,lt),Tt.refreshMaterialUniforms(En,V,J,k,m.state.transmissionRenderTarget[E.id]),jr.upload(y,Za(wt),En,xt)),V.isShaderMaterial&&V.uniformsNeedUpdate===!0&&(jr.upload(y,Za(wt),En,xt),V.uniformsNeedUpdate=!1),V.isSpriteMaterial&&ce.setValue(y,"center",I.center),ce.setValue(y,"modelViewMatrix",I.modelViewMatrix),ce.setValue(y,"normalMatrix",I.normalMatrix),ce.setValue(y,"modelMatrix",I.matrixWorld),V.isShaderMaterial||V.isRawShaderMaterial){const Fe=V.uniformsGroups;for(let fs=0,gc=Fe.length;fs<gc;fs++){const $a=Fe[fs];Qt.update($a,Xe),Qt.bind($a,Xe)}}return Xe}function pc(E,D){E.ambientLightColor.needsUpdate=D,E.lightProbe.needsUpdate=D,E.directionalLights.needsUpdate=D,E.directionalLightShadows.needsUpdate=D,E.pointLights.needsUpdate=D,E.pointLightShadows.needsUpdate=D,E.spotLights.needsUpdate=D,E.spotLightShadows.needsUpdate=D,E.rectAreaLights.needsUpdate=D,E.hemisphereLights.needsUpdate=D}function mc(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return O},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return R},this.setRenderTargetTextures=function(E,D,H){pt.get(E.texture).__webglTexture=D,pt.get(E.depthTexture).__webglTexture=H;const V=pt.get(E);V.__hasExternalTextures=!0,V.__autoAllocateDepthBuffer=H===void 0,V.__autoAllocateDepthBuffer||Q.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),V.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(E,D){const H=pt.get(E);H.__webglFramebuffer=D,H.__useDefaultFramebuffer=D===void 0},this.setRenderTarget=function(E,D=0,H=0){R=E,O=D,C=H;let V=!0,I=null,lt=!1,vt=!1;if(E){const Et=pt.get(E);Et.__useDefaultFramebuffer!==void 0?(Z.bindFramebuffer(y.FRAMEBUFFER,null),V=!1):Et.__webglFramebuffer===void 0?xt.setupRenderTarget(E):Et.__hasExternalTextures&&xt.rebindTextures(E,pt.get(E.texture).__webglTexture,pt.get(E.depthTexture).__webglTexture);const Nt=E.texture;(Nt.isData3DTexture||Nt.isDataArrayTexture||Nt.isCompressedArrayTexture)&&(vt=!0);const Bt=pt.get(E).__webglFramebuffer;
vendor: 1,865 bytes, line 3841
3841E.isWebGLCubeRenderTarget?(Array.isArray(Bt[D])?I=Bt[D][H]:I=Bt[D],lt=!0):E.samples>0&&xt.useMultisampledRTT(E)===!1?I=pt.get(E).__webglMultisampledFramebuffer:Array.isArray(Bt)?I=Bt[H]:I=Bt,M.copy(E.viewport),P.copy(E.scissor),Y=E.scissorTest}else M.copy(et).multiplyScalar(J).floor(),P.copy(mt).multiplyScalar(J).floor(),Y=At;if(Z.bindFramebuffer(y.FRAMEBUFFER,I)&&V&&Z.drawBuffers(E,I),Z.viewport(M),Z.scissor(P),Z.setScissorTest(Y),lt){const Et=pt.get(E.texture);y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_CUBE_MAP_POSITIVE_X+D,Et.__webglTexture,H)}else if(vt){const Et=pt.get(E.texture),Nt=D||0;y.framebufferTextureLayer(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,Et.__webglTexture,H||0,Nt)}U=-1},this.readRenderTargetPixels=function(E,D,H,V,I,lt,vt){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let yt=pt.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&vt!==void 0&&(yt=yt[vt]),yt){Z.bindFramebuffer(y.FRAMEBUFFER,yt);try{const Et=E.texture,Nt=Et.format,Bt=Et.type;if(!at.textureFormatReadable(Nt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!at.textureTypeReadable(Bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=E.width-V&&H>=0&&H<=E.height-I&&y.readPixels(D,H,V,I,Ot.convert(Nt),Ot.convert(Bt),lt)}finally{const Et=R!==null?pt.get(R).__webglFramebuffer:null;Z.bindFramebuffer(y.FRAMEBUFFER,Et)}}},this.readRenderTargetPixelsAsync=async function(E,D,H,V,I,lt,vt){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let yt=pt.get(E).__webglFramebuffer;
3841if(E.isWebGLCubeRenderTarget&&vt!==void 0&&(yt=yt[vt]),yt){Z.bindFramebuffer(y.FRAMEBUFFER,yt);try{const Et=E.texture,Nt=Et.format,Bt=Et.type;if(!at.textureFormatReadable(Nt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!at.textureTypeReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(D>=0&&D<=E.width-V&&H>=0&&H<=E.height-I){const Dt=y.createBuffer();y.bindBuffer(y.PIXEL_PACK_BUFFER,Dt),y.bufferData(y.PIXEL_PACK_BUFFER,lt.byteLength,y.STREAM_READ),y.readPixels(D,H,V,I,Ot.convert(Nt),Ot.convert(Bt),0),y.flush();const Xt=y.fenceSync(y.SYNC_GPU_COMMANDS_COMPLETE,0);await ku(y,Xt,4);try{y.bindBuffer(y.PIXEL_PACK_BUFFER,Dt),y.getBufferSubData(y.PIXEL_PACK_BUFFER,0,lt)}finally{y.deleteBuffer(Dt),y.deleteSync(Xt)}return lt}}finally{const Et=R!==null?pt.get(R).__webglFramebuffer:null;Z.bindFramebuffer(y.FRAMEBUFFER,Et)}}},this.copyFramebufferToTexture=function(E,D=null,H=0){E.isTexture!==!0&&(Ci("WebGLRenderer: copyFramebufferToTexture function signature has changed."),D=arguments[0]||null,E=arguments[1]);const V=Math.pow(2,-H),I=Math.floor(E.image.width*V),lt=Math.floor(E.image.height*V),vt=D!==null?D.x:0,yt=D!==null?D.y:0;xt.setTexture2D(E,0),y.copyTexSubImage2D(y.TEXTURE_2D,H,0,0,vt,yt,I,lt),Z.unbindTexture()},this.copyTextureToTexture=function(E,D,H=null,V=null,I=0){E.isTexture!==!0&&(Ci("WebGLRenderer: copyTextureToTexture function signature has changed."),V=arguments[0]||null,E=arguments[1],D=arguments[2],I=arguments[3]||0,H=null);let lt,vt,yt,Et,Nt,Bt;H!==null?(lt=H.max.x-H.min.x,vt=H.max.y-H.min.y,yt=H.min.x,Et=H.min.y):(lt=E.image.width,vt=E.image.height,yt=0,Et=0),V!==null?(Nt=V.x,Bt=V.y):(Nt=0,Bt=0);const Dt=Ot.convert(D.format),Xt=Ot.convert(D.type);xt.setTexture2D(D,0),y.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,D.flipY),y.pixelStorei(y.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),y.pixelStorei(y.UNPACK_ALIGNMENT,D.unpackAlignment);const ie=y.getParameter(y.UNPACK_ROW_LENGTH),re=y.getParameter(y.UNPACK_IMAGE_HEIGHT),Le=y.getParameter(y.UNPACK_SKIP_PIXELS),qt=y.getParameter(y.UNPACK_SKIP_ROWS),wt=y.getParameter(y.UNPACK_SKIP_IMAGES),Se=E.isCompressedTexture?E.mipmaps[I]:E.image;y.pixelStorei(y.UNPACK_ROW_LENGTH,Se.width),y.pixelStorei(y.UNPACK_IMAGE_HEIGHT,Se.height),y.pixelStorei(y.UNPACK_SKIP_PIXELS,yt),y.pixelStorei(y.UNPACK_SKIP_ROWS,Et),E.isDataTexture?y.texSubImage2D(y.TEXTURE_2D,I,Nt,Bt,lt,vt,Dt,Xt,Se.data):E.isCompressedTexture?y.compressedTexSubImage2D(y.TEXTURE_2D,I,Nt,Bt,Se.width,Se.height,Dt,Se.data):y.texSubImage2D(y.TEXTURE_2D,I,Nt,Bt,lt,vt,Dt,Xt,Se),y.pixelStorei(y.UNPACK_ROW_LENGTH,ie),y.pixelStorei(y.UNPACK_IMAGE_HEIGHT,re),y.pixelStorei(y.UNPACK_SKIP_PIXELS,Le),y.pixelStorei(y.UNPACK_SKIP_ROWS,qt),y.pixelStorei(y.UNPACK_SKIP_IMAGES,wt),I===0&&D.generateMipmaps&&y.generateMipmap(y.TEXTURE_2D),Z.unbindTexture()},this.copyTextureToTexture3D=function(E,D,H=null,V=null,I=0){E.isTexture!==!0&&(Ci("WebGLRenderer: copyTextureToTexture3D function signature has changed."),H=arguments[0]||null,V=arguments[1]||null,E=arguments[2],D=arguments[3],I=arguments[4]||0);let lt,vt,yt,Et,Nt,Bt,Dt,Xt,ie;const re=E.isCompressedTexture?E.mipmaps[I]:E.image;H!==null?(lt=H.max.x-H.min.x,vt=H.max.y-H.min.y,yt=H.max.z-H.min.z,Et=H.min.x,Nt=H.min.y,Bt=H.min.z):(lt=re.width,vt=re.height,yt=re.depth,Et=0,Nt=0,Bt=0),V!==null?(Dt=V.x,Xt=V.y,ie=V.z):(Dt=0,Xt=0,ie=0);const Le=Ot.convert(D.format),qt=Ot.convert(D.type);let wt;if(D.isData3DTexture)xt.setTexture3D(D,0),wt=y.TEXTURE_3D;else if(D.isDataArrayTexture||D.isCompressedArrayTexture)xt.setTexture2DArray(D,0),wt=y.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}y.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,D.flipY),y.pixelStorei(y.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),y.pixelStorei(y.UNPACK_ALIGNMENT,D.unpackAlignment);const Se=y.getParameter(y.UNPACK_ROW_LENGTH),Yt=y.getParameter(y.UNPACK_IMAGE_HEIGHT),Xe=y.getParameter(y.UNPACK_SKIP_PIXELS),ii=y.getParameter(y.UNPACK_SKIP_ROWS),De=y.getParameter(y.UNPACK_SKIP_IMAGES);y.pixelStorei(y.UNPACK_ROW_LENGTH,re.width),y.pixelStorei(y.UNPACK_IMAGE_HEIGHT,re.height),y.pixelStorei(y.UNPACK_SKIP_PIXELS,Et),y.pixelStorei(y.UNPACK_SKIP_ROWS,Nt),y.pixelStorei(y.UNPACK_SKIP_IMAGES,Bt),E.isDataTexture||E.isData3DTexture?y.texSubImage3D(wt,I,Dt,Xt,ie,lt,vt,yt,Le,qt,re.data):D.isCompressedArrayTexture?y.compressedTexSubImage3D(wt,I,Dt,Xt,ie,lt,vt,yt,Le,re.data):y.texSubImage3D(wt,I,Dt,Xt,ie,lt,vt,yt,Le,qt,re),y.pixelStorei(y.UNPACK_ROW_LENGTH,Se),y.pixelStorei(y.UNPACK_IMAGE_HEIGHT,Yt),y.pixelStorei(y.UNPACK_SKIP_PIXELS,Xe),y.pixelStorei(y.UNPACK_SKIP_ROWS,ii),y.pixelStorei(y.UNPACK_SKIP_IMAGES,De),I===0&&D.generateMipmaps&&y.generateMipmap(wt),Z.unbindTexture()},this.initRenderTarget=function(E){pt.get(E).__webglFramebuffer===void 0&&xt.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?xt.setTextureCube(E,
vendor: 14,399 bytes, line 3841
38410):E.isData3DTexture?xt.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?xt.setTexture2DArray(E,0):xt.setTexture2D(E,0),Z.unbindTexture()},this.resetState=function(){O=0,C=0,R=null,Z.reset(),Ht.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===Ga?"display-p3":"srgb",e.unpackColorSpace=Kt.workingColorSpace===os?"display-p3":"srgb"}}class tg extends Oe{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 Sn,this.environmentIntensity=1,this.environmentRotation=new Sn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class eg{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=wa,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=sn()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return Ci("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,s=this.stride;r<s;r++)this.array[t+r]=e.array[n+r];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=sn()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=sn()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.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 Ae=new L;class Un{constructor(t,e,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Ae.fromBufferAttribute(this,e),Ae.applyMatrix4(t),this.setXYZ(e,Ae.x,Ae.y,Ae.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ae.fromBufferAttribute(this,e),Ae.applyNormalMatrix(t),this.setXYZ(e,Ae.x,Ae.y,Ae.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ae.fromBufferAttribute(this,e),Ae.transformDirection(t),this.setXYZ(e,Ae.x,Ae.y,Ae.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=je(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=jt(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=jt(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=jt(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=jt(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=jt(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=je(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=je(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=je(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=je(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=jt(e,this.array),n=jt(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=jt(e,this.array),n=jt(n,this.array),r=jt(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this}setXYZW(t,e,n,r,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=jt(e,this.array),n=jt(n,this.array),r=jt(r,this.array),s=jt(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=s,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[r+s])}return new Je(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Un(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class on{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),s+=n.distanceTo(r),e.push(s),r=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const s=n.length;let o;e?o=e:o=t*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);const u=n[r],d=n[r+1]-u,p=(o-u)/d;return(r+p)/(s-1)}getTangent(t,e){let r=t-1e-4,s=t+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=e||(o.isVector2?new ct:new L);return l.copy(a).sub(o).normalize(),l}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new L,r=[],s=[],o=[],a=new L,l=new oe;for(let p=0;p<=t;p++){const g=p/t;r[p]=this.getTangentAt(g,new L)}s[0]=new L,o[0]=new L;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let p=1;p<=t;p++){if(s[p]=s[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(r[p-1],r[p]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(me(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(a,g))}o[p].crossVectors(r[p],s[p])}if(e===!0){let p=Math.acos(me(s[0].dot(s[t]),-1,1));p/=t,r[0].dot(a.crossVectors(s[0],s[t]))>0&&(p=-p);for(let g=1;g<=t;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],p*g)),o[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Xa extends on{constructor(t=0,e=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(t,e=new ct){const n=e,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+t*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=l-this.aX,p=c-this.aY;l=d*u-p*h+this.aX,c=d*h+p*u+this.aY}return n.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class ng extends Xa{constructor(t,e,n,r,s,o){super(t,e,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function qa(){let i=0,t=0,e=0,n=0;function r(s,o,a,l){i=s,t=a,e=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,p=(a-o)/u-(l-o)/(u+h)+(l-a)/h;d*=u,p*=u,r(o,a,d,p)},calc:function(s){const o=s*s,a=o*s;return i+t*s+e*o+n*a}}}const Or=new L,Gs=new qa,Vs=new qa,ks=new qa;class ig extends on{constructor(t=[],e=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=r}getPoint(t,e=new L){const n=e,r=this.points,s=r.length,o=(s-(this.closed?0:1))*t;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(Or.subVectors(r[0],r[1]).add(r[0]),c=Or);const h=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(Or.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=Or),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let g=Math.pow(c.distanceToSquared(h),p),v=Math.pow(h.distanceToSquared(d),p),m=Math.pow(d.distanceToSquared(u),p);v<1e-4&&(v=1),g<1e-4&&(g=v),m<1e-4&&(m=v),Gs.initNonuniformCatmullRom(c.x,h.x,d.x,u.x,g,v,m),Vs.initNonuniformCatmullRom(c.y,h.y,d.y,u.y,g,v,m),ks.initNonuniformCatmullRom(c.z,h.z,d.z,u.z,g,v,m)}else this.curveType==="catmullrom"&&(Gs.initCatmullRom(c.x,h.x,d.x,u.x,this.tension),Vs.initCatmullRom(c.y,h.y,d.y,u.y,this.tension),ks.initCatmullRom(c.z,h.z,d.z,u.z,this.tension));return n.set(Gs.calc(l),Vs.calc(l),ks.calc(l)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const r=t.points[e];this.points.push(r.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const r=this.points[e];t.points.push(r.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const r=t.points[e];this.points.push(new L().fromArray(r))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Jo(i,t,e,n,r){const s=(n-t)*.5,o=(r-e)*.5,a=i*i,l=i*a;return(2*e-2*n+s+o)*l+(-3*e+3*n-2*s-o)*a+s*i+e}function rg(i,t){const e=1-i;return e*e*t}function sg(i,t){return 2*(1-i)*i*t}function ag(i,t){return i*i*t}function ji(i,t,e,n){return rg(i,t)+sg(i,e)+ag(i,n)}function og(i,t){const e=1-i;return e*e*e*t}function lg(i,t){const e=1-i;return 3*e*e*i*t}function cg(i,t){return 3*(1-i)*i*i*t}function ug(i,t){return i*i*i*t}function $i(i,t,e,n,r){return og(i,t)+lg(i,e)+cg(i,n)+ug(i,r)}
vendor: 6,094 bytes, line 3841
3841class ic extends on{constructor(t=new ct,e=new ct,n=new ct,r=new ct){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new ct){const n=e,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set($i(t,r.x,s.x,o.x,a.x),$i(t,r.y,s.y,o.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class hg extends on{constructor(t=new L,e=new L,n=new L,r=new L){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new L){const n=e,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set($i(t,r.x,s.x,o.x,a.x),$i(t,r.y,s.y,o.y,a.y),$i(t,r.z,s.z,o.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class rc extends on{constructor(t=new ct,e=new ct){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new ct){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new ct){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class dg extends on{constructor(t=new L,e=new L){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new L){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new L){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class sc extends on{constructor(t=new ct,e=new ct,n=new ct){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new ct){const n=e,r=this.v0,s=this.v1,o=this.v2;return n.set(ji(t,r.x,s.x,o.x),ji(t,r.y,s.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class fg extends on{constructor(t=new L,e=new L,n=new L){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new L){const n=e,r=this.v0,s=this.v1,o=this.v2;return n.set(ji(t,r.x,s.x,o.x),ji(t,r.y,s.y,o.y),ji(t,r.z,s.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ac extends on{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new ct){const n=e,r=this.points,s=(r.length-1)*t,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return n.set(Jo(a,l.x,c.x,u.x,h.x),Jo(a,l.y,c.y,u.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const r=t.points[e];this.points.push(r.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const r=this.points[e];t.points.push(r.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const r=t.points[e];this.points.push(new ct().fromArray(r))}return this}}var Ca=Object.freeze({__proto__:null,ArcCurve:ng,CatmullRomCurve3:ig,CubicBezierCurve:ic,CubicBezierCurve3:hg,EllipseCurve:Xa,LineCurve:rc,LineCurve3:dg,QuadraticBezierCurve:sc,QuadraticBezierCurve3:fg,SplineCurve:ac});class pg extends on{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Ca[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?t*2:o.isLineCurve||o.isLineCurve3?1:o.isS
vendor: 23,385 bytes, line 3841
3841plineCurve?t*o.points.length:t,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];n&&n.equals(u)||(e.push(u),n=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const r=t.curves[e];this.curves.push(r.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const r=this.curves[e];t.curves.push(r.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const r=t.curves[e];this.curves.push(new Ca[r.type]().fromJSON(r))}return this}}class Pa extends pg{constructor(t){super(),this.type="Path",this.currentPoint=new ct,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new rc(this.currentPoint.clone(),new ct(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){const s=new sc(this.currentPoint.clone(),new ct(t,e),new ct(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(t,e,n,r,s,o){const a=new ic(this.currentPoint.clone(),new ct(t,e),new ct(n,r),new ct(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new ac(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(t+a,e+l,n,r,s,o),this}absarc(t,e,n,r,s,o){return this.absellipse(t,e,n,n,r,s,o),this}ellipse(t,e,n,r,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(t+c,e+u,n,r,s,o,a,l),this}absellipse(t,e,n,r,s,o,a,l){const c=new Xa(t,e,n,r,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class $r extends Pa{constructor(t){super(t),this.uuid=sn(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const r=t.holes[e];this.holes.push(r.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const r=this.holes[e];t.holes.push(r.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const r=t.holes[e];this.holes.push(new Pa().fromJSON(r))}return this}}const mg={triangulate:function(i,t,e=2){const n=t&&t.length,r=n?t[0]*e:i.length;let s=oc(i,0,r,e,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,d,p;if(n&&(s=Sg(i,t,s,e)),i.length>80*e){a=c=i[0],l=u=i[1];for(let g=e;g<r;g+=e)h=i[g],d=i[g+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);p=Math.max(c-a,u-l),p=p!==0?32767/p:0}return er(s,o,e,a,l,p,0),o}};function oc(i,t,e,n,r){let s,o;if(r===Lg(i,t,e,n)>0)for(s=t;s<e;s+=n)o=Qo(s,i[s],i[s+1],o);else for(s=e-n;s>=t;s-=n)o=Qo(s,i[s],i[s+1],o);return o&&us(o,o.next)&&(ir(o),o=o.next),o}function ei(i,t){if(!i)return i;t||(t=i);let e=i,n;do if(n=!1,!e.steiner&&(us(e,e.next)||ne(e.prev,e,e.next)===0)){if(ir(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function er(i,t,e,n,r,s,o){if(!i)return;!o&&s&&bg(i,n,r,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?_g(i,n,r,s):gg(i)){t.push(l.i/e|0),t.push(i.i/e|0),t.push(c.i/e|0),ir(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=vg(ei(i),t,e),er(i,t,e,n,r,s,2)):o===2&&xg(i,t,e,n,r,s):er(ei(i),t,e,n,r,s,1);break}}}function gg(i){const t=i.prev,e=i,n=i.next;if(ne(t,e,n)>=0)return!1;const r=t.x,s=e.x,o=n.x,a=t.y,l=e.y,c=n.y,u=r<s?r<o?r:o:s<o?s:o,h=a<l?a<c?a:c:l<c?l:c,d=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let g=n.next;for(;g!==t;){if(g.x>=u&&g.x<=d&&g.y>=h&&g.y<=p&&bi(r,a,s,l,o,c,g.x,g.y)&&ne(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function _g(i,t,e,n){const r=i.prev,s=i,o=i.next;if(ne(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,d=o.y,p=a<l?a<c?a:c:l<c?l:c,g=u<h?u<d?u:d:h<d?h:d,v=a>l?a>c?a:c:l>c?l:c,m=u>h?u>d?u:d:h>d?h:d,f=La(p,g,t,e,n),A=La(v,m,t,e,n);let x=i.prevZ,T=i.nextZ;for(;x&&x.z>=f&&T&&T.z<=A;){if(x.x>=p&&x.x<=v&&x.y>=g&&x.y<=m&&x!==r&&x!==o&&bi(a,u,l,h,c,d,x.x,x.y)&&ne(x.prev,x,x.next)>=0||(x=x.prevZ,T.x>=p&&T.x<=v&&T.y>=g&&T.y<=m&&T!==r&&T!==o&&bi(a,u,l,h,c,d,T.x,T.y)&&ne(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;x&&x.z>=f;){if(x.x>=p&&x.x<=v&&x.y>=g&&x.y<=m&&x!==r&&x!==o&&bi(a,u,l,h,c,d,x.x,x.y)&&ne(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;T&&T.z<=A;){if(T.x>=p&&T.x<=v&&T.y>=g&&T.y<=m&&T!==r&&T!==o&&bi(a,u,l,h,c,d,T.x,T.y)&&ne(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function vg(i,t,e){let n=i;do{const r=n.prev,s=n.next.next;!us(r,s)&&lc(r,n,n.next,s)&&nr(r,s)&&nr(s,r)&&(t.push(r.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),ir(n),ir(n.next),n=i=s),n=n.next}while(n!==i);return ei(n)}function xg(i,t,e,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Rg(o,a)){let l=cc(o,a);o=ei(o,o.next),l=ei(l,l.next),er(o,t,e,n,r,s,0),er(l,t,e,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Sg(i,t,e,n){const r=[];let s,o,a,l,c;for(s=0,o=t.length;s<o;s++)a=t[s]*n,l=s<o-1?t[s+1]*n:i.length,c=oc(i,a,l,n,!1),c===c.next&&(c.steiner=!0),r.push(wg(c));for(r.sort(Mg),s=0;s<r.length;s++)e=yg(r[s],e);return e}function Mg(i,t){return i.x-t.x}function yg(i,t){const e=Eg(i,t);if(!e)return t;const n=cc(e,i);return ei(n,n.next),ei(e,e.next)}function Eg(i,t){let e=t,n=-1/0,r;const s=i.x,o=i.y;do{if(o<=e.y&&o>=e.next.y&&e.next.y!==e.y){const d=e.x+(o-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=s&&d>n&&(n=d,r=e.x<e.next.x?e:e.next,d===s))return r}e=e.next}while(e!==t);if(!r)return null;const a=r,l=r.x,c=r.y;let u=1/0,h;e=r;do s>=e.x&&e.x>=l&&s!==e.x&&bi(o<c?s:n,o,l,c,o<c?n:s,o,e.x,e.y)&&(h=Math.abs(o-e.y)/(s-e.x),nr(e,i)&&(h<u||h===u&&(e.x>r.x||e.x===r.x&&Tg(r,e)))&&(r=e,u=h)),e=e.next;while(e!==a);return r}function Tg(i,t){return ne(i.prev,i,t.prev)<0&&ne(t.next,i,i.next)<0}function bg(i,t,e,n){let r=i;do r.z===0&&(r.z=La(r.x,r.y,t,e,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,Ag(r)}function Ag(i){let t,e,n,r,s,o,a,l,c=1;do{for(e=i,i=null,s=null,o=0;e;){for(o++,n=e,a=0,t=0;t<c&&(a++,n=n.nextZ,!!n);t++);for(l=c;a>0||l>0&&n;)a!==0&&(l===0||!n||e.z<=n.z)?(r=e,e=e.nextZ,a--):(r=n,n=n.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;e=n}s.nextZ=null,c*=2}while(o>1);return i}function La(i,t,e,n,r){return i=(i-e)*r|0,t=(t-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function wg(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function bi(i,t,e,n,r,s,o,a){return(r-o)*(t-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(r-o)*(n-a)}function Rg(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!Cg(i,t)&&(nr(i,t)&&nr(t,i)&&Pg(i,t)&&(ne(i.prev,i,t.prev)||ne(i,t.prev,t))||us(i,t)&&ne(i.prev,i,i.next)>0&&ne(t.prev,t,t.next)>0)}function ne(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function us(i,t){return i.x===t.x&&i.y===t.y}function lc(i,t,e,n){const r=Br(ne(i,t,e)),s=Br(ne(i,t,n)),o=Br(ne(e,n,i)),a=Br(ne(e,n,t));return!!(r!==s&&o!==a||r===0&&Fr(i,e,t)||s===0&&Fr(i,n,t)||o===0&&Fr(e,i,n)||a===0&&Fr(e,t,n))}function Fr(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Br(i){return i>0?1:i<0?-1:0}function Cg(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&lc(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function nr(i,t){return ne(i.prev,i,i.next)<0?ne(i,t,i.next)>=0&&ne(i,i.prev,t)>=0:ne(i,t,i.prev)<0||ne(i,i.next,t)<0}function Pg(i,t){let e=i,n=!1;const r=(i.x+t.x)/2,s=(i.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&r<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==i);return n}function cc(i,t){const e=new Da(i.i,i.x,i.y),n=new Da(t.i,t.x,t.y),r=i.next,s=t.prev;return i.next=t,t.prev=i,e.next=r,r.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function Qo(i,t,e,n){const r=new Da(i,t,e);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function ir(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Da(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Lg(i,t,e,n){let r=0;for(let s=t,o=e-n;s<e;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}class Li{static area(t){const e=t.length;let n=0;for(let r=e-1,s=0;s<e;r=s++)n+=t[r].x*t[s].y-t[s].x*t[r].y;return n*.5}static isClockWise(t){return Li.area(t)<0}static triangulateShape(t,e){const n=[],r=[],s=[];tl(t),el(n,t);let o=t.length;e.forEach(tl);for(let l=0;l<e.length;l++)r.push(o),o+=e[l].length,el(n,e[l]);const a=mg.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function tl(i){const t=i.length;t>2&&i[t-1].equals(i[0])&&i.pop()}function el(i,t){for(let e=0;e<t.length;e++)i.push(t[e].x),i.push(t[e].y)}class Ya extends an{constructor(t=new $r([new ct(.5,.5),new ct(-.5,.5),new ct(-.5,-.5),new ct(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,r=[],s=[];for(let a=0,l=t.length;a<l;a++){const c=t[a];o(c)}this.setAttribute("position",new We(r,3)),this.setAttribute("uv",new We(s,2)),this.computeVertexNormals();function o(a){const l=[],c=e.curveSegments!==void 0?e.curveSegments:12,u=e.steps!==void 0?e.steps:1,h=e.depth!==void 0?e.depth:1;let d=e.bevelEnabled!==void 0?e.bevelEnabled:!0,p=e.bevelThickness!==void 0?e.bevelThickness:.2,g=e.bevelSize!==void 0?e.bevelSize:p-.1,v=e.bevelOffset!==void 0?e.bevelOffset:0,m=e.bevelSegments!==void 0?e.bevelSegments:3;const f=e.extrudePath,A=e.UVGenerator!==void 0?e.UVGenerator:Dg;let x,T=!1,O,C,R,U;f&&(x=f.getSpacedPoints(u),T=!0,d=!1,O=f.computeFrenetFrames(u,!1),C=new L,R=new L,U=new L),d||(m=0,p=0,g=0,v=0);const b=a.extractPoints(c);let M=b.shape;const P=b.holes;if(!Li.isClockWise(M)){M=M.reverse();for(let y=0,rt=P.length;y<rt;y++){const Q=P[y];Li.isClockWise(Q)&&(P[y]=Q.reverse())}}const G=Li.triangulateShape(M,P),N=M;for(let y=0,rt=P.length;y<rt;y++){const Q=P[y];M=M.concat(Q)}function K(y,rt,Q){return rt||console.error("THREE.ExtrudeGeometry: vec does not exist"),y.clone().addScaledVector(rt,Q)}const k=M.length,J=G.length;function W(y,rt,Q){let at,Z,Ct;const pt=y.x-rt.x,xt=y.y-rt.y,w=Q.x-y.x,S=Q.y-y.y,z=pt*pt+xt*xt,tt=pt*S-xt*w;if(Math.abs(tt)>Number.EPSILON){const $=Math.sqrt(z),j=Math.sqrt(w*w+S*S),Tt=rt.x-xt/$,dt=rt.y+pt/$,_t=Q.x-S/j,zt=Q.y+w/j,st=((_t-Tt)*S-(zt-dt)*w)/(pt*S-xt*w);at=Tt+pt*st-y.x,Z=dt+xt*st-y.y;const gt=at*at+Z*Z;if(gt<=2)return new ct(at,Z);Ct=Math.sqrt(gt/2)}else{let $=!1;pt>Number.EPSILON?w>Number.EPSILON&&($=!0):pt<-Number.EPSILON?w<-Number.EPSILON&&($=!0):Math.sign(xt)===Math.sign(S)&&($=!0),$?(at=-xt,Z=pt,Ct=Math.sqrt(z)):(at=pt,Z=xt,Ct=Math.sqrt(z/2))}return new ct(at/Ct,Z/Ct)}const ot=[];for(let y=0,rt=N.length,Q=rt-1,at=y+1;y<rt;y++,Q++,at++)Q===rt&&(Q=0),at===rt&&(at=0),ot[y]=W(N[y],N[Q],N[at]);const et=[];let mt,At=ot.concat();for(let y=0,rt=P.length;y<rt;y++){const Q=P[y];mt=[];for(let at=0,Z=Q.length,Ct=Z-1,pt=at+1;at<Z;at++,Ct++,pt++)Ct===Z&&(Ct=0),pt===Z&&(pt=0),mt[at]=W(Q[at],Q[Ct],Q[pt]);et.push(mt),At=At.concat(mt)}for(let y=0;y<m;y++){const rt=y/m,Q=p*Math.cos(rt*Math.PI/2),at=g*Math.sin(rt*Math.PI/2)+v;for(let Z=0,Ct=N.length;Z<Ct;Z++){const pt=K(N[Z],ot[Z],at);ut(pt.x,pt.y,-Q)}for(let Z=0,Ct=P.length;Z<Ct;Z++){const pt=P[Z];mt=et[Z];for(let xt=0,w=pt.length;xt<w;xt++){const S=K(pt[xt],mt[xt],at);ut(S.x,S.y,-Q)}}}const Pt=g+v;for(let y=0;y<k;y++){const rt=d?K(M[y],At[y],Pt):M[y];T?(R.copy(O.normals[0]).multiplyScalar(rt.x),C.copy(O.binormals[0]).multiplyScalar(rt.y),U.copy(x[0]).add(R).add(C),ut(U.x,U.y,U.z)):ut(rt.x,rt.y,0)}for(let y=1;y<=u;y++)for(let rt=0;rt<k;rt++){const Q=d?K(M[rt],At[rt],Pt):M[rt];T?(R.copy(O.normals[y]).multiplyScalar(Q.x),C.copy(O.binormals[y]).multiplyScalar(Q.y),U.copy(x[y]).add(R).add(C),ut(U.x,U.y,U.z)):ut(Q.x,Q.y,h/u*y)}for(let y=m-1;y>=0;y--){const rt=y/m,Q=p*Math.cos(rt*Math.PI/2),at=g*Math.sin(rt*Math.PI/2)+v;for(let Z=0,Ct=N.length;Z<Ct;Z++){const pt=K(N[Z],ot[Z],at);ut(pt.x,pt.y,h+Q)}for(let Z=0,Ct=P.length;Z<Ct;Z++){const pt=P[Z];mt=et[Z];for(let xt=0,w=pt.length;xt<w;xt++){const S=K(pt[xt],mt[xt],at);T?ut(S.x,S.y+x[u-1].y,x[u-1].x+Q):ut(S.x,S.y,h+Q)}}}q(),nt();function q(){const y=r.length/3;if(d){let rt=0,Q=k*rt;for(let at=0;at<J;at++){const Z=G[at];Rt(Z[2]+Q,Z[1]+Q,Z[0]+Q)}rt=u+m*2,Q=k*rt;for(let at=0;at<J;at++){const Z=G[at];Rt(Z[0]+Q,Z[1]+Q,Z[2]+Q)}}else{for(let rt=0;rt<J;rt++){const Q=G[rt];Rt(Q[2],Q[1],Q[0])}for(let rt=0;rt<J;rt++){const Q=G[rt];Rt(Q[0]+k*u,Q[1]+k*u,Q[2]+k*u)}}n.addGroup(y,r.length/3-y,0)}function nt(){const y=r.length/3;let rt=0;ft(N,rt),rt+=N.length;for(let Q=0,at=P.length;Q<at;Q++){const Z=P[Q];ft(Z,rt),rt+=Z.length}n.addGroup(y,r.length/3-y,1)}function ft(y,rt){let Q=y.length;for(;--Q>=0;){const at=Q;let Z=Q-1;Z<0&&(Z=y.length-1);for(let Ct=0,pt=u+m*2;Ct<pt;Ct++){const xt=k*Ct,w=k*(Ct+1),S=rt+at+xt,z=rt+Z+xt,tt=rt+Z+w,$=rt+at+w;Ut(S,z,tt,$)}}}function ut(y,rt,Q){l.push(y),l.push(rt),l.push(Q)}function Rt(y,rt,Q){Lt(y),Lt(rt),Lt(Q);const at=r.length/3,Z=A.generateTopUV(n,r,at-3,at-2,at-1);Mt(Z[0]),Mt(Z[1]),Mt(Z[2])}function Ut(y,rt,Q,at){Lt(y),Lt(rt),Lt(at),Lt(rt),Lt(Q),Lt(at);const Z=r.length/3,Ct=A.generateSideWallUV(n,r,Z-6,Z-3,Z-2,Z-1);Mt(Ct[0]),Mt(Ct[1]),Mt(Ct[3]),Mt(Ct[1]),Mt(Ct[2]),Mt(Ct[3])}function Lt(y){r.push(l[y*3+0]),r.push(l[y*3+1]),r.push(l[y*3+2])}function Mt(y){s.push(y.x),s.push(y.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return Ug(e,n,t)}static fromJSON(t,e){const n=[];for(let s=0,o=t.shapes.length;s<o;s++){const a=e[t.shapes[s]];n.push(a)}const r=t.options.extrudePath;return r!==void 0&&(t.options.extrudePath=new Ca[r.type]().fromJSON(r)),new Ya(n,t.options)}}const Dg={generateTopUV:function(i,t,e,n,r){const s=t[e*3],o=t[e*3+1],a=t[n*3],l=t[n*3+1],c=t[r*3],u=t[r*3+1];return[new ct(s,o),new ct(a,l),new ct(c,u)]},generateSideWallUV:function(i,t,e,n,r,s){const o=t[e*3],a=t[e*3+1],l=t[e*3+2],c=t[n*3],u=t[n*3+1],h=t[n*3+2],d=t[r*3],p=t[r*3+1],g=t[r*3+2],v=t[s*3],m=t[s*3+1],f=t[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new ct(o,1-l),new ct(c,1-h),new ct(d,1-g),new ct(v,1-f)]:[new ct(a,1-l),new ct(u,1-h),new ct(p,1-g),new ct(m,1-f)]}};function Ug(i,t,e){if(e.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){const s=i[n];e.shapes.push(s.uuid)}else e.shapes.push(i.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}class Ig extends an{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){const e=[],n=new Set,r=new L,s=new L;if(t.index!==null){const o=t.attributes.position,a=t.index;let l=t.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],d=h.start,p=h.count;for(let g=d,v=d+p;g<v;g+=3)for(let m=0;m<3;m++){const f=a.getX(g+m),A=a.getX(g+(m+1)%3);r.fromBufferAttribute(o,f),s.fromBufferAttribute(o,A),nl(r,s,n)===!0&&(e.push(r.x,r.y,r.z),e.push(s.x,s.y,s.z))}}}else{const o=t.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,h=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),nl(r,s,n)===!0&&(e.push(r.x,r.y,r.z),e.push(s.x,s.y,s.z))}}this.setAttribute("position",new We(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function nl(i,t,e){const n=`${i.x},${i.y},${i.z}-${t.x},${t.y},${t.z}`,r=`${t.x},${t.y},${t.z}-${i.x},${i.y},${i.z}`;return e.has(n)===!0||e.has(r)===!0?!1:(e.add(n),e.add(r),!0)}const ss={enabled:!1,files:{},add:function(i,t){this.enabled!==!1&&(this.files[i]=t)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class Ng{constructor(t,e,n){const r=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){const p=c[h],g=c[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return g}return null}}}const Og=new Ng;class lr{constructor(t){this.manager=t!==void 0?t:Og,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise(function(r,s){n.load(t,r,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}lr.DEFAULT_MATERIAL_NAME="__DEFAULT";const pn={};class Fg extends Error{constructor(t,e){super(t),this.response=e}}class Bg extends lr{constructor(t){super(t)}load(t,e,n,r){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=ss.get(t);if(s!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(s),this.manager.itemEnd(t)},0),s;if(pn[t]!==void 0){pn[t].push({onLoad:e,onProgress:n,onError:r});return}pn[t]=[],pn[t].push({onLoad:e,onProgress:n,onError:r});const o=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=pn[t],h=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=d?parseInt(d):0,g=p!==0;let v=0;const m=new ReadableStream({start(f){A();function A(){h.read().then(({done:x,value:T})=>{if(x)f.close();else{v+=T.byteLength;const O=new ProgressEvent("progress",{lengthComputable:g,loaded:v,total:p});for(let C=0,R=u.length;C<R;C++){const U=u[C];U.onProgress&&U.onProgress(O)}f.enqueue(T),A()}},x=>{f.error(x)})}}});return new Response(m)}else throw new Fg(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{ss.add(t,c);const u=pn[t];delete pn[t];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onLoad&&p.onLoad(c)}}).catch(c=>{const u=pn[t];if(u===void 0)throw this.manager.itemError(t),c;delete pn[t];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onError&&p.onError(c)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class zg extends lr{constructor(t){super(t)}load(t,e,n,r){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,o=ss.get(t);if(o!==void 0)return s.manager.itemStart(t),setTimeout(function(){e&&e(o),s.manager.itemEnd(t)},0),o;const a=tr("img");function l(){u(),ss.add(t,this),e&&e(this),s.manager.itemEnd(t)}function c(h){u(),r&&r(h),s.manager.itemError(t),s.manager.itemEnd(t)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(t),a.src=t,a}}class Hg extends lr{constructor(t){super(t)}load(t,e,n,r){const s=new Re,o=new zg(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(a){s.image=a,s.needsUpdate=!0,e!==void 0&&e(s)},n,r),s}}class Gg extends an{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class Ua extends eg{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class il{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(me(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const rl=new L,zr=new L;class Vg{constructor(t=new L,e=new L){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){rl.subVectors(t,this.start),zr.subVectors(this.end,this.start);const n=zr.dot(zr);let s=zr.dot(rl)/n;return e&&(s=me(s,0,1)),s}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(r).add(this.start)}
3841applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class kg{constructor(){this.type="ShapePath",this.color=new $t,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Pa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}bezierCurveTo(t,e,n,r,s,o){return this.currentPath.bezierCurveTo(t,e,n,r,s,o),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(f){const A=[];for(let x=0,T=f.length;x<T;x++){const O=f[x],C=new $r;C.curves=O.curves,A.push(C)}return A}function n(f,A){const x=A.length;let T=!1;for(let O=x-1,C=0;C<x;O=C++){let R=A[O],U=A[C],b=U.x-R.x,M=U.y-R.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(R=A[C],b=-b,U=A[O],M=-M),f.y<R.y||f.y>U.y)continue;if(f.y===R.y){if(f.x===R.x)return!0}else{const P=M*(f.x-R.x)-b*(f.y-R.y);if(P===0)return!0;if(P<0)continue;T=!T}}else{if(f.y!==R.y)continue;if(U.x<=f.x&&f.x<=R.x||R.x<=f.x&&f.x<=U.x)return!0}}return T}const r=Li.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new $r,l.curves=a.curves,c.push(l),c;let u=!r(s[0].getPoints());u=t?!u:u;const h=[],d=[];let p=[],g=0,v;d[g]=void 0,p[g]=[];for(let f=0,A=s.length;f<A;f++)a=s[f],v=a.getPoints(),o=r(v),o=t?!o:o,o?(!u&&d[g]&&g++,d[g]={s:new $r,p:v},d[g].s.curves=a.curves,u&&g++,p[g]=[]):p[g].push({h:a,p:v[0]});if(!d[0])return e(s);if(d.length>1){let f=!1,A=0;for(let x=0,T=d.length;x<T;x++)h[x]=[];for(let x=0,T=d.length;x<T;x++){const O=p[x];for(let C=0;C<O.length;C++){const R=O[C];let U=!0;for(let b=0;b<d.length;b++)n(R.p,d[b].p)&&(x!==b&&A++,U?(U=!1,h[b].push(R)):f=!0);U&&h[x].push(R)}}A>0&&f===!1&&(p=h)}let m;for(let f=0,A=d.length;f<A;f++){l=d[f].s,c.push(l),m=p[f];for(let x=0,T=m.length;x<T;x++)l.holes.push(m[x].h)}return c}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ia}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ia);const sl={type:"change"},Ws={type:"start"},al={type:"end"},Hr=new Vl,ol=new Pn,Wg=Math.cos(70*Bl.DEG2RAD);class Xg extends ni{constructor(t,e){super(),this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new L,this.cursor=new L,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.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:ri.ROTATE,MIDDLE:ri.DOLLY,RIGHT:ri.PAN},this.touches={ONE:si.ROTATE,TWO:si.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(_){_.addEventListener("keydown",_t),this._domElementKeyEvents=_},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",_t),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(sl),n.update(),s=r.NONE},this.update=function(){const _=new L,F=new ti().setFromUnitVectors(t.up,new L(0,1,0)),B=F.clone().invert(),X=new L,it=new ti,bt=new L,Ft=2*Math.PI;return function(fe=null){const Wt=n.object.position;_.copy(Wt).sub(n.target),_.applyQuaternion(F),a.setFromVector3(_),n.autoRotate&&s===r.NONE&&Y(M(fe)),n.enableDamping?(a.theta+=l.theta*n.dampingFactor,a.phi+=l.phi*n.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let pe=n.minAzimuthAngle,le=n.maxAzimuthAngle;isFinite(pe)&&isFinite(le)&&(pe<-Math.PI?pe+=Ft:pe>
3841Math.PI&&(pe-=Ft),le<-Math.PI?le+=Ft:le>Math.PI&&(le-=Ft),pe<=le?a.theta=Math.max(pe,Math.min(le,a.theta)):a.theta=a.theta>(pe+le)/2?Math.max(pe,a.theta):Math.min(le,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let yn=!1;if(n.zoomToCursor&&C||n.object.isOrthographicCamera)a.radius=et(a.radius);else{const xe=a.radius;a.radius=et(a.radius*c),yn=xe!=a.radius}if(_.setFromSpherical(a),_.applyQuaternion(B),Wt.copy(n.target).add(_),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),u.set(0,0,0)),n.zoomToCursor&&C){let xe=null;if(n.object.isPerspectiveCamera){const ln=_.length();xe=et(ln*c);const zn=ln-xe;n.object.position.addScaledVector(T,zn),n.object.updateMatrixWorld(),yn=!!zn}else if(n.object.isOrthographicCamera){const ln=new L(O.x,O.y,0);ln.unproject(n.object);const zn=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),n.object.updateProjectionMatrix(),yn=zn!==n.object.zoom;const Bi=new L(O.x,O.y,0);Bi.unproject(n.object),n.object.position.sub(Bi).add(ln),n.object.updateMatrixWorld(),xe=_.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;xe!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(xe).add(n.object.position):(Hr.origin.copy(n.object.position),Hr.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Hr.direction))<Wg?t.lookAt(n.target):(ol.setFromNormalAndCoplanarPoint(n.object.up,n.target),Hr.intersectPlane(ol,n.target))))}else if(n.object.isOrthographicCamera){const xe=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),xe!==n.object.zoom&&(n.object.updateProjectionMatrix(),yn=!0)}return c=1,C=!1,yn||X.distanceToSquared(n.object.position)>o||8*(1-it.dot(n.object.quaternion))>o||bt.distanceToSquared(n.target)>o?(n.dispatchEvent(sl),X.copy(n.object.position),it.copy(n.object.quaternion),bt.copy(n.target),!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",gt),n.domElement.removeEventListener("pointerdown",xt),n.domElement.removeEventListener("pointercancel",S),n.domElement.removeEventListener("wheel",$),n.domElement.removeEventListener("pointermove",w),n.domElement.removeEventListener("pointerup",S),n.domElement.getRootNode().removeEventListener("keydown",Tt,{capture:!0}),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",_t),n._domElementKeyEvents=null)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const o=1e-6,a=new il,l=new il;let c=1;const u=new L,h=new ct,d=new ct,p=new ct,g=new ct,v=new ct,m=new ct,f=new ct,A=new ct,x=new ct,T=new L,O=new ct;let C=!1;const R=[],U={};let b=!1;function M(_){return _!==null?2*Math.PI/60*n.autoRotateSpeed*_:2*Math.PI/60/60*n.autoRotateSpeed}function P(_){const F=Math.abs(_*.01);return Math.pow(.95,n.zoomSpeed*F)}function Y(_){l.theta-=_}function G(_){l.phi-=_}const N=function(){const _=new L;return function(B,X){_.setFromMatrixColumn(X,0),_.multiplyScalar(-B),u.add(_)}}(),K=function(){const _=new L;return function(B,X){n.screenSpacePanning===!0?_.setFromMatrixColumn(X,1):(_.setFromMatrixColumn(X,0),_.crossVectors(n.object.up,_)),_.multiplyScalar(B),u.add(_)}}(),k=function(){const _=new L;return function(B,X){const it=n.domElement;if(n.object.isPerspectiveCamera){const bt=n.object.position;_.copy(bt).sub(n.target);let Ft=_.length();Ft*=Math.tan(n.object.fov/2*Math.PI/180),N(2*B*Ft/it.clientHeight,n.object.matrix),K(2*X*Ft/it.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(N(B*(n.object.right-n.object.left)/n.object.zoom/it.clientWidth,n.object.matrix),K(X*(n.object.top-n.object.bottom)/n.object.zoom/it.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function J(_){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=_:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function W(_){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=_:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ot(_,F){if(!n.zoomToCursor)return;C=!0;const B=n.domElement.getBoundingClientRect(),X=_-B.left,it=F-B.top,bt=B.width,Ft=B.height;O.x=X/bt*2-1,O.y=-(it/Ft)*2+1,T.set(O.x,O.y,1).unproject(n.object).sub(n.object.position).normalize()}function et(_){return Math.max(n.minDistance,Math.min(n.maxDistance,_))}function mt(_){h.set(_.clientX,_.clientY)}function At(_){ot(_.clientX,_.clientX),f.set(_.clientX,_.clientY)}function Pt(_){g.set(_.clientX,_.clientY)}function q(_){d.set(_.clientX,_.clientY),p.subVectors(d,h).multiplyScalar(n.rotateSpeed);const F=n.domElement;Y(2*Math.PI*p.x/F.clientHeight),G(2*Math.PI*p.y/F.clientHeight),h.copy(d),n.update()}function nt(_){A.set(_.clientX,_.clientY),x.subVectors(A,f),x.y>0?J(P(x.y)):x.y<0&&W(P(x.y)),f.copy(A),n.update()}function ft(_){v.set(_.clientX,_.clientY),m.subVectors(v,g).multiplyScalar(n.panSpeed),k(m.x,m.y),g.copy(v),n.update()}function ut(_){ot(_.clientX,_.clientY),_.deltaY<0?W(P(_.deltaY)):_.deltaY>0&&J(P(_.deltaY)),n.update()}function Rt(_){let F=!1;switch(_.code){case n.keys.UP:_.ctrlKey||_.metaKey||_.shiftKey?G(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):k(0,n.keyPanSpeed),F=!0;break;case n.keys.BOTTOM:_.ctrlKey||_.metaKey||_.shiftKey?G(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):k(0,-n.keyPanSpeed),F=!0;break;case n.keys.LEFT:_.ctrlKey||_.metaKey||_.shiftKey?Y(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):k(n.keyPanSpeed,0),F=!0;break;case n.keys.RIGHT:_.ctrlKey||_.metaKey||_.shiftKey?Y(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):k(-n.keyPanSpeed,0),F=!0;break}F&&(_.preventDefault(),n.update())}function Ut(_){if(R.length===1)h.set(_.pageX,_.pageY);else{const F=Ht(_),B=.5*(_.pageX+F.x),X=.5*(_.pageY+F.y);h.set(B,X)}}function Lt(_){if(R.length===1)g.set(_.pageX,_.pageY);else{const F=Ht(_),B=.5*(_.pageX+F.x),X=.5*(_.pageY+F.y);g.set(B,X)}}function Mt(_){const F=Ht(_),B=_.pageX-F.x,X=_.pageY-F.y,it=Math.sqrt(B*B+X*X);f.set(0,it)}function y(_){n.enableZoom&&Mt(_),n.enablePan&&Lt(_)}function rt(_){n.enableZoom&&Mt(_),n.enableRotate&&Ut(_)}function Q(_){if(R.length==1)d.set(_.pageX,_.pageY);else{const B=Ht(_),X=.5*(_.pageX+B.x),it=.5*(_.pageY+B.y);d.set(X,it)}p.subVectors(d,h).multiplyScalar(n.rotateSpeed);const F=n.domElement;Y(2*Math.PI*p.x/F.clientHeight),G(2*Math.PI*p.y/F.clientHeight),h.copy(d)}function at(_){if(R.length===1)v.set(_.pageX,_.pageY);else{const F=Ht(_),B=.5*(_.pageX+F.x),X=.5*(_.pageY+F.y);v.set(B,X)}m.subVectors(v,g).multiplyScalar(n.panSpeed),k(m.x,m.y),g.copy(v)}function Z(_){const F=Ht(_),B=_.pageX-F.x,X=_.pageY-F.y,it=Math.sqrt(B*B+X*X);A.set(0,it),x.set(0,Math.pow(A.y/f.y,n.zoomSpeed)),J(x.y),f.copy(A);
3841const bt=(_.pageX+F.x)*.5,Ft=(_.pageY+F.y)*.5;ot(bt,Ft)}function Ct(_){n.enableZoom&&Z(_),n.enablePan&&at(_)}function pt(_){n.enableZoom&&Z(_),n.enableRotate&&Q(_)}function xt(_){n.enabled!==!1&&(R.length===0&&(n.domElement.setPointerCapture(_.pointerId),n.domElement.addEventListener("pointermove",w),n.domElement.addEventListener("pointerup",S)),!St(_)&&(kt(_),_.pointerType==="touch"?zt(_):z(_)))}function w(_){n.enabled!==!1&&(_.pointerType==="touch"?st(_):tt(_))}function S(_){switch(It(_),R.length){case 0:n.domElement.releasePointerCapture(_.pointerId),n.domElement.removeEventListener("pointermove",w),n.domElement.removeEventListener("pointerup",S),n.dispatchEvent(al),s=r.NONE;break;case 1:const F=R[0],B=U[F];zt({pointerId:F,pageX:B.x,pageY:B.y});break}}function z(_){let F;switch(_.button){case 0:F=n.mouseButtons.LEFT;break;case 1:F=n.mouseButtons.MIDDLE;break;case 2:F=n.mouseButtons.RIGHT;break;default:F=-1}switch(F){case ri.DOLLY:if(n.enableZoom===!1)return;At(_),s=r.DOLLY;break;case ri.ROTATE:if(_.ctrlKey||_.metaKey||_.shiftKey){if(n.enablePan===!1)return;Pt(_),s=r.PAN}else{if(n.enableRotate===!1)return;mt(_),s=r.ROTATE}break;case ri.PAN:if(_.ctrlKey||_.metaKey||_.shiftKey){if(n.enableRotate===!1)return;mt(_),s=r.ROTATE}else{if(n.enablePan===!1)return;Pt(_),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ws)}function tt(_){switch(s){case r.ROTATE:if(n.enableRotate===!1)return;q(_);break;case r.DOLLY:if(n.enableZoom===!1)return;nt(_);break;case r.PAN:if(n.enablePan===!1)return;ft(_);break}}function $(_){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(_.preventDefault(),n.dispatchEvent(Ws),ut(j(_)),n.dispatchEvent(al))}function j(_){const F=_.deltaMode,B={clientX:_.clientX,clientY:_.clientY,deltaY:_.deltaY};switch(F){case 1:B.deltaY*=16;break;case 2:B.deltaY*=100;break}return _.ctrlKey&&!b&&(B.deltaY*=10),B}function Tt(_){_.key==="Control"&&(b=!0,n.domElement.getRootNode().addEventListener("keyup",dt,{passive:!0,capture:!0}))}function dt(_){_.key==="Control"&&(b=!1,n.domElement.getRootNode().removeEventListener("keyup",dt,{passive:!0,capture:!0}))}function _t(_){n.enabled===!1||n.enablePan===!1||Rt(_)}function zt(_){switch(Ot(_),R.length){case 1:switch(n.touches.ONE){case si.ROTATE:if(n.enableRotate===!1)return;Ut(_),s=r.TOUCH_ROTATE;break;case si.PAN:if(n.enablePan===!1)return;Lt(_),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case si.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;y(_),s=r.TOUCH_DOLLY_PAN;break;case si.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;rt(_),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ws)}function st(_){switch(Ot(_),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Q(_),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;at(_),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ct(_),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;pt(_),n.update();break;default:s=r.NONE}}function gt(_){n.enabled!==!1&&_.preventDefault()}function kt(_){R.push(_.pointerId)}function It(_){delete U[_.pointerId];for(let F=0;F<R.length;F++)if(R[F]==_.pointerId){R.splice(F,1);return}}function St(_){for(let F=0;F<R.length;F++)if(R[F]==_.pointerId)return!0;return!1}function Ot(_){let F=U[_.pointerId];F===void 0&&(F=new ct,U[_.pointerId]=F),F.set(_.pageX,_.pageY)}function Ht(_){const F=_.pointerId===R[0]?R[1]:R[0];return U[F]}n.domElement.addEventListener("contextmenu",gt),n.domElement.addEventListener("pointerdown",xt),n.domElement.addEventListener("pointercancel",S),n.domElement.addEventListener("wheel",$,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",Tt,{passive:!0,capture:!0}),this.update()}}const ll=new Bn,Gr=new L;class uc extends Gg{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const t=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new We(t,3)),this.setAttribute("uv",new We(e,2))}applyMatrix4(t){const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;
3841return e!==void 0&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new Ua(e,6,1);return this.setAttribute("instanceStart",new Un(n,3,0)),this.setAttribute("instanceEnd",new Un(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new Ua(e,6,1);return this.setAttribute("instanceColorStart",new Un(n,3,0)),this.setAttribute("instanceColorEnd",new Un(n,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new Ig(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Bn);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;t!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(t),ll.setFromBufferAttribute(e),this.boundingBox.union(ll))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new sr),this.boundingBox===null&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(t!==void 0&&e!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=t.count;s<o;s++)Gr.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(Gr)),Gr.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Gr));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}ht.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ct(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Ce.line={uniforms:ka.merge([ht.common,ht.fog,ht
vendor: 7,975 bytes, lines 3841-4211
3841.line]),vertexShader:`
3842		#include <common>
3843		#include <color_pars_vertex>
3844		#include <fog_pars_vertex>
3845		#include <logdepthbuf_pars_vertex>
3846		#include <clipping_planes_pars_vertex>
3847
3848		uniform float linewidth;
3849		uniform vec2 resolution;
3850
3851		attribute vec3 instanceStart;
3852		attribute vec3 instanceEnd;
3853
3854		attribute vec3 instanceColorStart;
3855		attribute vec3 instanceColorEnd;
3856
3857		#ifdef WORLD_UNITS
3858
3859			varying vec4 worldPos;
3860			varying vec3 worldStart;
3861			varying vec3 worldEnd;
3862
3863			#ifdef USE_DASH
3864
3865				varying vec2 vUv;
3866
3867			#endif
3868
3869		#else
3870
3871			varying vec2 vUv;
3872
3873		#endif
3874
3875		#ifdef USE_DASH
3876
3877			uniform float dashScale;
3878			attribute float instanceDistanceStart;
3879			attribute float instanceDistanceEnd;
3880			varying float vLineDistance;
3881
3882		#endif
3883
3884		void trimSegment( const in vec4 start, inout vec4 end ) {
3885
3886			// trim end segment so it terminates between the camera plane and the near plane
3887
3888			// conservative estimate of the near plane
3889			float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
3890			float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
3891			float nearEstimate = - 0.5 * b / a;
3892
3893			float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
3894
3895			end.xyz = mix( start.xyz, end.xyz, alpha );
3896
3897		}
3898
3899		void main() {
3900
3901			#ifdef USE_COLOR
3902
3903				vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
3904
3905			#endif
3906
3907			#ifdef USE_DASH
3908
3909				vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
3910				vUv = uv;
3911
3912			#endif
3913
3914			float aspect = resolution.x / resolution.y;
3915
3916			// camera space
3917			vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
3918			vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
3919
3920			#ifdef WORLD_UNITS
3921
3922				worldStart = start.xyz;
3923				worldEnd = end.xyz;
3924
3925			#else
3926
3927				vUv = uv;
3928
3929			#endif
3930
3931			// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
3932			// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
3933			// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
3934			// perhaps there is a more elegant solution -- WestLangley
3935
3936			bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
3937
3938			if ( perspective ) {
3939
3940				if ( start.z < 0.0 && end.z >= 0.0 ) {
3941
3942					trimSegment( start, end );
3943
3944				} else if ( end.z < 0.0 && start.z >= 0.0 ) {
3945
3946					trimSegment( end, start );
3947
3948				}
3949
3950			}
3951
3952			// clip space
3953			vec4 clipStart = projectionMatrix * start;
3954			vec4 clipEnd = projectionMatrix * end;
3955
3956			// ndc space
3957			vec3 ndcStart = clipStart.xyz / clipStart.w;
3958			vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
3959
3960			// direction
3961			vec2 dir = ndcEnd.xy - ndcStart.xy;
3962
3963			// account for clip-space aspect ratio
3964			dir.x *= aspect;
3965			dir = normalize( dir );
3966
3967			#ifdef WORLD_UNITS
3968
3969				vec3 worldDir = normalize( end.xyz - start.xyz );
3970				vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
3971				vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
3972				vec3 worldFwd = cross( worldDir, worldUp );
3973				worldPos = position.y < 0.5 ? start: end;
3974
3975				// height offset
3976				float hw = linewidth * 0.5;
3977				worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
3978
3979				// don't extend the line if we're rendering dashes because we
3980				// won't be rendering the endcaps
3981				#ifndef USE_DASH
3982
3983					// cap extension
3984					worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
3985
3986					// add width to the box
3987					worldPos.xyz += worldFwd * hw;
3988
3989					// endcaps
3990					if ( position.y > 1.0 || position.y < 0.0 ) {
3991
3992						worldPos.xyz -= worldFwd * 2.0 * hw;
3993
3994					}
3995
3996				#endif
3997
3998				// project the worldpos
3999				vec4 clip = projectionMatrix * worldPos;
4000
4001				// shift the depth of the projected points so the line
4002				// segments overlap neatly
4003				vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
4004				clip.z = clipPose.z * clip.w;
4005
4006			#else
4007
4008				vec2 offset = vec2( dir.y, - dir.x );
4009				// undo aspect ratio adjustment
4010				dir.x /= aspect;
4011				offset.x /= aspect;
4012
4013				// sign flip
4014				if ( position.x < 0.0 ) offset *= - 1.0;
4015
4016				// endcaps
4017				if ( position.y < 0.0 ) {
4018
4019					offset += - dir;
4020
4021				} else if ( position.y > 1.0 ) {
4022
4023					offset += dir;
4024
4025				}
4026
4027				// adjust for linewidth
4028				offset *= linewidth;
4029
4030				// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
4031				offset /= resolution.y;
4032
4033				// select end
4034				vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
4035
4036				// back to clip space
4037				offset *= clip.w;
4038
4039				clip.xy += offset;
4040
4041			#endif
4042
4043			gl_Position = clip;
4044
4045			vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
4046
4047			#include <logdepthbuf_vertex>
4048			#include <clipping_planes_vertex>
4049			#include <fog_vertex>
4050
4051		}
4052		`,fragmentShader:`
4053		uniform vec3 diffuse;
4054		uniform float opacity;
4055		uniform float linewidth;
4056
4057		#ifdef USE_DASH
4058
4059			uniform float dashOffset;
4060			uniform float dashSize;
4061			uniform float gapSize;
4062
4063		#endif
4064
4065		varying float vLineDistance;
4066
4067		#ifdef WORLD_UNITS
4068
4069			varying vec4 worldPos;
4070			varying vec3 worldStart;
4071			varying vec3 worldEnd;
4072
4073			#ifdef USE_DASH
4074
4075				varying vec2 vUv;
4076
4077			#endif
4078
4079		#else
4080
4081			varying vec2 vUv;
4082
4083		#endif
4084
4085		#include <common>
4086		#include <color_pars_fragment>
4087		#include <fog_pars_fragment>
4088		#include <logdepthbuf_pars_fragment>
4089		#include <clipping_planes_pars_fragment>
4090
4091		vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
4092
4093			float mua;
4094			float mub;
4095
4096			vec3 p13 = p1 - p3;
4097			vec3 p43 = p4 - p3;
4098
4099			vec3 p21 = p2 - p1;
4100
4101			float d1343 = dot( p13, p43 );
4102			float d4321 = dot( p43, p21 );
4103			float d1321 = dot( p13, p21 );
4104			float d4343 = dot( p43, p43 );
4105			float d2121 = dot( p21, p21 );
4106
4107			float denom = d2121 * d4343 - d4321 * d4321;
4108
4109			float numer = d1343 * d4321 - d1321 * d4343;
4110
4111			mua = numer / denom;
4112			mua = clamp( mua, 0.0, 1.0 );
4113			mub = ( d1343 + d4321 * ( mua ) ) / d4343;
4114			mub = clamp( mub, 0.0, 1.0 );
4115
4116			return vec2( mua, mub );
4117
4118		}
4119
4120		void main() {
4121
4122			#include <clipping_planes_fragment>
4123
4124			#ifdef USE_DASH
4125
4126				if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
4127
4128				if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
4129
4130			#endif
4131
4132			float alpha = opacity;
4133
4134			#ifdef WORLD_UNITS
4135
4136				// Find the closest points on the view ray and the line segment
4137				vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
4138				vec3 lineDir = worldEnd - worldStart;
4139				vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
4140
4141				vec3 p1 = worldStart + lineDir * params.x;
4142				vec3 p2 = rayEnd * params.y;
4143				vec3 delta = p1 - p2;
4144				float len = length( delta );
4145				float norm = len / linewidth;
4146
4147				#ifndef USE_DASH
4148
4149					#ifdef USE_ALPHA_TO_COVERAGE
4150
4151						float dnorm = fwidth( norm );
4152						alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
4153
4154					#else
4155
4156						if ( norm > 0.5 ) {
4157
4158							discard;
4159
4160						}
4161
4162					#endif
4163
4164				#endif
4165
4166			#else
4167
4168				#ifdef USE_ALPHA_TO_COVERAGE
4169
4170					// artifacts appear on some hardware if a derivative is taken within a conditional
4171					float a = vUv.x;
4172					float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4173					float len2 = a * a + b * b;
4174					float dlen = fwidth( len2 );
4175
4176					if ( abs( vUv.y ) > 1.0 ) {
4177
4178						alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
4179
4180					}
4181
4182				#else
4183
4184					if ( abs( vUv.y ) > 1.0 ) {
4185
4186						float a = vUv.x;
4187						float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4188						float len2 = a * a + b * b;
4189
4190						if ( len2 > 1.0 ) discard;
4191
4192					}
4193
4194				#endif
4195
4196			#endif
4197
4198			vec4 diffuseColor = vec4( diffuse, alpha );
4199
4200			#include <logdepthbuf_fragment>
4201			#include <color_fragment>
4202
4203			gl_FragColor = vec4( diffuseColor.rgb, alpha );
4204
4205			#include <tonemapping_fragment>
4206			#include <colorspace_fragment>
4207			#include <fog_fragment>
4208			#include <premultiplied_alpha_fragment>
4209
4210		}
4211		`};
4211class Ai extends Mn{constructor(t){super({type:"LineMaterial",uniforms:ka.clone(Ce.line.uniforms),vertexShader:Ce.line.vertexShader,fragmentShader:Ce.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(t)}get color(){return this.uniforms.diffuse.value}set color(t){this.uniforms.diffuse.value=t}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(t){this.uniforms.linewidth&&(this.uniforms.linewidth.value=t)}get dashed(){return"USE_DASH"in this.defines}set dashed(t){t===!0!==this.dashed&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(t){this.uniforms.dashScale.value=t}get dashSize(){return this.uniforms.dashSize.value}set dashSize(t){this.uniforms.dashSize.value=t}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(t){this.uniforms.dashOffset.value=t}get gapSize(){return this.uniforms.gapSize.value}set gapSize(t){this.uniforms.gapSize.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get resolution(){return this.uniforms.resolution.value}set resolution(t){this.uniforms.resolution.value.copy(t)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(t){this.defines&&(t===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),t===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const Xs=new ee,cl=new L,ul=new L,Me=new ee,ye=new ee,Qe=new ee,qs=new L,Ys=new oe,Ee=new Vg,hl=new L,Vr=new Bn,kr=new sr,tn=new ee;let rn,$n;function dl(i,t,e){return tn.set(0,0,-t,1).applyMatrix4(i.projectionMatrix),tn.multiplyScalar(1/tn.w),tn.x=$n/e.width,tn.y=$n/e.height,tn.applyMatrix4(i.projectionMatrixInverse),tn.multiplyScalar(1/tn.w),Math.abs(Math.max(tn.x,tn.y))}function qg(i,t){const e=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){Ee.start.fromBufferAttribute(r,a),Ee.end.fromBufferAttribute(s,a),Ee.applyMatrix4(e);const c=new L,u=new L;rn.distanceSqToSegment(Ee.start,Ee.end,u,c),u.distanceTo(c)<$n*.5&&t.push({point:u,pointOnLine:c,distance:rn.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function Yg(i,t,e){const n=t.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),h=-t.near;rn.at(1,Qe),Qe.w=1,Qe.applyMatrix4(t.matrixWorldInverse),Qe.applyMatrix4(n),Qe.multiplyScalar(1/Qe.w),Qe.x*=s.x/2,Qe.y*=s.y/2,Qe.z=0,qs.copy(Qe),Ys.multiplyMatrices(t.matrixWorldInverse,o);for(let d=0,p=u;d<p;d++){if(Me.fromBufferAttribute(l,d),ye.fromBufferAttribute(c,d),Me.w=1,ye.w=1,Me.applyMatrix4(Ys),ye.applyM
4211atrix4(Ys),Me.z>h&&ye.z>h)continue;if(Me.z>h){const x=Me.z-ye.z,T=(Me.z-h)/x;Me.lerp(ye,T)}else if(ye.z>h){const x=ye.z-Me.z,T=(ye.z-h)/x;ye.lerp(Me,T)}Me.applyMatrix4(n),ye.applyMatrix4(n),Me.multiplyScalar(1/Me.w),ye.multiplyScalar(1/ye.w),Me.x*=s.x/2,Me.y*=s.y/2,ye.x*=s.x/2,ye.y*=s.y/2,Ee.start.copy(Me),Ee.start.z=0,Ee.end.copy(ye),Ee.end.z=0;const v=Ee.closestPointToPointParameter(qs,!0);Ee.at(v,hl);const m=Bl.lerp(Me.z,ye.z,v),f=m>=-1&&m<=1,A=qs.distanceTo(hl)<$n*.5;if(f&&A){Ee.start.fromBufferAttribute(l,d),Ee.end.fromBufferAttribute(c,d),Ee.start.applyMatrix4(o),Ee.end.applyMatrix4(o);const x=new L,T=new L;rn.distanceSqToSegment(Ee.start,Ee.end,T,x),e.push({point:T,pointOnLine:x,distance:rn.origin.distanceTo(T),object:i,face:null,faceIndex:d,uv:null,uv1:null})}}}class hc extends ke{constructor(t=new uc,e=new Ai({color:Math.random()*16777215})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,r=new Float32Array(2*e.count);for(let o=0,a=0,l=e.count;o<l;o++,a+=2)cl.fromBufferAttribute(e,o),ul.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+cl.distanceTo(ul);const s=new Ua(r,2,1);return t.setAttribute("instanceDistanceStart",new Un(s,1,0)),t.setAttribute("instanceDistanceEnd",new Un(s,1,1)),this}raycast(t,e){const n=this.material.worldUnits,r=t.camera;r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=t.params.Line2!==void 0&&t.params.Line2.threshold||0;rn=t.ray;const o=this.matrixWorld,a=this.geometry,l=this.material;$n=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),kr.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=$n*.5;else{const h=Math.max(r.near,kr.distanceToPoint(rn.origin));c=dl(r,h,l.resolution)}if(kr.radius+=c,rn.intersectsSphere(kr)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),Vr.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=$n*.5;else{const h=Math.max(r.near,Vr.distanceToPoint(rn.origin));u=dl(r,h,l.resolution)}Vr.expandByScalar(u),rn.intersectsBox(Vr)!==!1&&(n?qg(this,e):Yg(this,r,e))}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(Xs),this.material.uniforms.resolution.value.set(Xs.z,Xs.w))}}class qi extends uc{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(t){const e=t.length-3,n=new Float32Array(2*e);for(let r=0;r<e;r+=3)n[2*r]=t[r],n[2*r+1]=t[r+1],n[2*r+2]=t[r+2],n[2*r+3]=t[r+3],n[2*r+4]=t[r+4],n[2*r+5]=t[r+5];return super.setPositions(n),this}setColors(t){const e=t.length-3,n=new Float32Array(2*e);for(let r=0;r<e;r+=3)n[2*r]=t[r],n[2*r+1]=t[r+1],n[2*r+2]=t[r+2],n[2*r+3]=t[r+3],n[2*r+4]=t[r+4],n[2*r+5]=t[r+5];return super.setColors(n),this}fromLine(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}}class Ks extends hc{constructor(t=new qi,e=new Ai({color:Math.random()*16777215})){super(t,e),this.isLine2=!0,this.type="Line2"}}function Kg(i){return Object.keys(i).reduce((t,e)=>i[e]===void 0?t:t+`${e}:${i[e]};`,"")}Kg({position:"absolute",opacity:0,"pointer-events":"none",margin:0,transform:"translateX(-100%)"});function fl(i){function t(e){return e(i),()=>{}}return{subscribe:t}}const Wr=i=>new Proxy(i,{get(t,e,n){return Reflect.get(t,e,n)},ownKeys(t){return Reflect.ownKeys(t).filter(e=>e!=="action")}}),pl=i=>typeof i=="function";Zg("empty");function Zg(i,t){const{stores:e,action:n,returned:r}={},s=(()=>
4211{if(e&&r)return Cc(e,a=>{const l=r(a);if(pl(l)){const c=(...u)=>Wr({...l(...u),[`data-melt-${i}`]:"",action:n??Ei});return c.action=n??Ei,c}return Wr({...l,[`data-melt-${i}`]:"",action:n??Ei})});{const a=r,l=a==null?void 0:a();if(pl(l)){const c=(...u)=>Wr({...l(...u),[`data-melt-${i}`]:"",action:n??Ei});return c.action=n??Ei,fl(c)}return fl(Wr({...l,[`data-melt-${i}`]:"",action:n??Ei}))}})(),o=n??(()=>{});return o.subscribe=s.subscribe,o}function Ei(){}function dc(i,t,e,n){const r=Array.isArray(t)?t:[t];return r.forEach(s=>i.addEventListener(s,e,n)),()=>{r.forEach(s=>i.removeEventListener(s,e,n))}}function jg(i,...t){const e={};for(const n of Object.keys(i))t.includes(n)||(e[n]=i[n]);return e}const $g={ALT:"Alt",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",BACKSPACE:"Backspace",CAPS_LOCK:"CapsLock",CONTROL:"Control",DELETE:"Delete",END:"End",ENTER:"Enter",ESCAPE:"Escape",F1:"F1",F10:"F10",F11:"F11",F12:"F12",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",HOME:"Home",META:"Meta",PAGE_DOWN:"PageDown",PAGE_UP:"PageUp",SHIFT:"Shift",SPACE:" ",TAB:"Tab",CTRL:"Control",ASTERISK:"*",A:"a",P:"p"};Yi(void 0,i=>{function t(n){i(n),i(void 0)}return dc(document,"pointerup",t,{passive:!1,capture:!0})});Yi(void 0,i=>{function t(n){n&&n.key===$g.ESCAPE&&i(n),i(void 0)}return dc(document,"keydown",t,{passive:!1})});Yi(!1),Yi(!1),Yi(void 0);const Jg={isDateDisabled:void 0,isDateUnavailable:void 0,value:void 0,preventDeselect:!1,numberOfMonths:1,pagedNavigation:!1,weekStartsOn:0,fixedWeeks:!1,calendarLabel:"Event Date",locale:"en",minValue:void 0,maxValue:void 0,disabled:!1,readonly:!1,weekdayFormat:"narrow"};({...jg(Jg,"isDateDisabled","isDateUnavailable","value","locale","disabled","readonly","minValue","maxValue","weekdayFormat")});class Qg extends Ya{constructor(t,e={}){const n=e.font;if(n===void 0)super();else{const r=n.generateShapes(t,e.size);e.depth===void 0&&e.height!==void 0&&console.warn("THREE.TextGeometry: .height is now depreciated. Please use .depth instead"),e.depth=e.depth!==void 0?e.depth:e.height!==void 0?e.height:50,e.bevelThickness===void 0&&(e.bevelThickness=10),e.bevelSize===void 0&&(e.bevelSize=8),e.bevelEnabled===void 0&&(e.bevelEnabled=!1),super(r,e)}this.type="TextGeometry"}}class t_ extends lr{constructor(t){super(t)}load(t,e,n,r){const s=this,o=new Bg(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(a){const l=s.parse(JSON.parse(a));e&&e(l)},n,r)}parse(t){return new e_(t)}}class e_{constructor(t){this.isFont=!0,this.type="Font",this.data=t}generateShapes(t,e=100){const n=[],r=n_(t,e,this.data);for(let s=0,o=r.length;s<o;s++)n.push(...r[s].toShapes());return n}}function n_(i,t,e){const n=Array.from(i),r=t/e.resolution,s=(e.boundingBox.yMax-e.boundingBox.yMin+e.underlineThickness)*r,o=[];let a=0,l=0;for(let c=0;c<n.length;c++){const u=n[c];if(u===`
4212`)a=0,l-=s;else{const h=i_(u,r,a,l,e);a+=h.offsetX,o.push(h.path)}}return o}function i_(i,t,e,n,r){const s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}const o=new kg;let a,l,c,u,h,d,p,g;if(s.o){const v=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let m=0,f=v.length;m<f;
4212)switch(v[m++]){case"m":a=v[m++]*t+e,l=v[m++]*t+n,o.moveTo(a,l);break;case"l":a=v[m++]*t+e,l=v[m++]*t+n,o.lineTo(a,l);break;case"q":c=v[m++]*t+e,u=v[m++]*t+n,h=v[m++]*t+e,d=v[m++]*t+n,o.quadraticCurveTo(h,d,c,u);break;case"b":c=v[m++]*t+e,u=v[m++]*t+n,h=v[m++]*t+e,d=v[m++]*t+n,p=v[m++]*t+e,g=v[m++]*t+n,o.bezierCurveTo(h,d,p,g,c,u);break}}return{offsetX:s.ha*t,path:o}}function ml(i,t,e){const n=i.slice();return n[9]=t[e][0],n[10]=t[e][1],n}function gl(i){let t,e,n="Olympic Medal Standings",r,s,o="Drag and zoom to move",a,l,c="Falloff curve puts 4-2-1 point system in the center",u,h,d,p="Separation",g,v,m,f;return{c(){t=he("div"),e=he("h1"),e.textContent=n,r=He(),s=he("p"),s.textContent=o,a=He(),l=he("p"),l.textContent=c,u=He(),h=he("div"),d=he("p"),d.textContent=p,g=He(),v=he("input"),this.h()},l(A){t=de(A,"DIV",{class:!0});var x=Ne(t);e=de(x,"H1",{class:!0,"data-svelte-h":!0}),Wi(e)!=="svelte-i8pump"&&(e.textContent=n),r=Ge(x),s=de(x,"P",{class:!0,"data-svelte-h":!0}),Wi(s)!=="svelte-j783c0"&&(s.textContent=o),a=Ge(x),l=de(x,"P",{class:!0,"data-svelte-h":!0}),Wi(l)!=="svelte-p1yaa6"&&(l.textContent=c),u=Ge(x),h=de(x,"DIV",{class:!0});var T=Ne(h);d=de(T,"P",{class:!0,"data-svelte-h":!0}),Wi(d)!=="svelte-1lrmbkw"&&(d.textContent=p),g=Ge(T),v=de(T,"INPUT",{type:!0,step:!0,min:!0,max:!0}),T.forEach(ae),x.forEach(ae),this.h()},h(){te(e,"class","text-4xl text-center"),te(s,"class","text-center"),te(l,"class","text-center"),te(d,"class","text-center"),te(v,"type","range"),te(v,"step",".1"),te(v,"min",".1"),te(v,"max","4"),te(h,"class","p-4 flex flex-col justify-normal"),te(t,"class","absolute top-10 left-10 mx-auto text-white")},m(A,x){Dn(A,t,x),Zt(t,e),Zt(t,r),Zt(t,s),Zt(t,a),Zt(t,l),Zt(t,u),Zt(t,h),Zt(h,d),Zt(h,g),Zt(h,v),Qa(v,i[1]),m||(f=[ps(v,"change",i[6]),ps(v,"input",i[6]),ps(v,"input",i[7])],m=!0)},p(A,x){x&2&&Qa(v,A[1])},d(A){A&&ae(t),m=!1,vc(f)}}}function _l(i){let t,e,n,r='<tr class="svelte-pa2gld"><th class="px-4 py-2 svelte-pa2gld"></th> <th class="px-4 py-2 text-yellow-400 svelte-pa2gld">G</th> <th class="px-4 py-2 text-gray-300 svelte-pa2gld">S</th> <th class="px-4 py-2 text-orange-400 svelte-pa2gld">B</th> <th class="px-4 py-2 svelte-pa2gld">T</th></tr>',s,o,a=to(Object.entries(i[3])),l=[];for(let c=0;c<a.length;c+=1)l[c]=vl(ml(i,a,c));return{c(){t=he("div"),e=he("table"),n=he("thead"),n.innerHTML=r,s=He(),o=he("tbody");for(let c=0;c<l.length;c+=1)l[c].c();this.h()},l(c){t=de(c,"DIV",{class:!0});var u=Ne(t);e=de(u,"TABLE",{class:!0});var h=Ne(e);n=de(h,"THEAD",{"data-svelte-h":!0}),Wi(n)!=="svelte-1jahqmi"&&(n.innerHTML=r),s=Ge(h),o=de(h,"TBODY",{});var d=Ne(o);for(let p=0;p<l.length;p+=1)l[p].l(d);d.forEach(ae),h.forEach(ae),u.forEach(ae),this.h()},h(){te(e,"class","table-auto svelte-pa2gld"),te(t,"class","absolute bottom-10 right-10 bg-black bg-opacity-50 text-white p-4 rounded-lg")},m(c,u){Dn(c,t,u),Zt(t,e),Zt(e,n),Zt(e,s),Zt(e,o);for(let h=0;h<l.length;h+=1)l[h]&&l[h].m(o,null)},p(c,u){if(u&8){a=to(Object.entries(c[3]));let h;for(h=0;h<a.length;h+=1){const d=ml(c,a,h);l[h]?l[h].p(d,u):(l[h]=vl(d),l[h].c(),l[h].m(o,null))}for(;h<l.length;h+=1)l[h].d(1);l.length=a.length}},d(c){c&&ae(t),Mc(l,c)}}}function vl(i){let t,e,n,r,s,o,a=i[10].gold+"",l,c,u,h=i[10].silver+"",d,p,g,v=i[10].bronze+"",m,f,A,x=i[10].gold+i[10].silver+i[10].bronze+"",T,O;return{c(){t=he("tr"),e=he("td"),n=he("img"),s=He(),o=he("td"),l=hr(a),c=He(),u=he("td"),d=hr(h),p=He(),g=he("td"),m=hr(v),f=He(),A=he("td"),T=hr(x),O=He(),this.h()},l(C){t=de(C,"TR",{class:!0});var R=Ne(t);e=de(R,"TD",{class:!0});var U=Ne(e);n=de(U,"IMG",{src:!0,alt:!0,class:!0}),U.forEach(ae),s=Ge(R),o=de(R,"TD",{class:!0});var b=Ne(o);l=dr(b,a),b.forEach(ae),c=Ge(R),u=de(R,"TD",{class:!0});var M=Ne(u);d=dr(M,h),M.forEach(ae),p=Ge(R),g=de(R,"TD",{class:!0});var P=Ne(g);m=dr(P,v),P.forEach(ae),f=Ge(R),A=de(R,"TD",{class:!0});var Y=Ne(A);T=dr(Y,x),Y.forEach(ae),O=Ge(R),R.forEach(ae),this.h()},h(){xc(n.src,r=El+"/flags/"+i[9]+".png")||te(n,"src",r),te(n,"alt",i[10].name+" flag"),te(n,"class","w-8 h-4 object-cover"),te(e,"class","px-4 py-2 svelte-pa2gld"),te(o,"class","px-4 py-2 text-yellow-400 svelte-pa2gld"),te(u,"class","px-4 py-2 text-gray-300 svelte-pa2gld"),te(g,"class","px-4 py-2 text-orange-400 svelte-pa2gld"),te(A,"class","px-4 py-2 svelte-pa2gld"),te(t,"class","svelte-pa2gld")},m(C,R){Dn(C,t,R),Zt(t,e),Zt(e,n),Zt(t,s),Zt(t,o),Zt(o,l),Zt(t,c),Zt(t,u),Zt(u,d),Zt(t,p),Zt(t,g),Zt(g,m),Zt(t,f),Zt(t,A),Zt(A,T),Zt(t,O)},p:Jr,d(C){C&&ae(t)}}}function r_(i){let t,e,n,r,s=i[2]&&gl(i),o=i[3]&&i[2]&&_l(i);return{c(){t=he("canvas"),e=He(),s&&s.c(),n=He(),o&&o.c(),r=Ja(),this.h()},l(a){t=de(a,"CANVAS",{class:!0}),Ne(t).forEach(ae),e=Ge(a),s&&s.l(a),n=Ge(a),o&&o.l(a),r=Ja(),this.h()},h(){te(t,"class","absolute inset-0")},m(a,l){Dn(a,t,l),i[5](t),Dn(a,e,l),s&&s.m(a,l),Dn(a,n,l),o&&o.m(a,l),Dn(a,r,l)},p(a,[l]){a[2]?s?s.p(a,l):(s=gl(a),s.c(),s.m(n.parentNode,n)):s&&(s.d(1),s=null),a[3]&&a[2]?o?o.p(a,l):(o=_l(a),o.c(),o.m(r.parentNode,r)):o&&(o.d(1),o=null)},i:Jr,o:Jr,d(a){a&&(ae(t),ae(e),ae(n),ae(r)),i[5](null),s&&s.d(a),o&&o.d(a)}}}let xl=1200;function s_(i,t,e){let n,r={USA:{gold:40,silver:44,bronze:42,name:"United States",borderColor:335171},CHN:{gold:40,silver:27,bronze:24,name:"China",borderColor:16641536},JPN:{gold:20,silver:12,bronze:13,name:"Japan",borderColor:15086377},AUS:{gold:18,silver:19,bronze:16,name:"Australia",borderColor:867493},FRA:{gold:16,silver:26,bronze:22,name:"France",borderColor:13242669},NED:{gold:15,silver:7,bronze:12,name:"Netherlands",borderColor:867493},GBR:{gold:14,silver:22,bronze:29,name:"Great Britain",borderColor:16777215},KOR:{gold:13,silver:9,bronze:10,name:"South Korea",borderColor:16777215},ITA:{gold:12,silver:13,bronze:15,name:"Italy",borderColor:3638603},GER:{gold:12,silver:13,bronze:8,name:"Germany",borderColor:15846144}},s=2,o=window.innerWidth>xl;_c(()=>{n&&l()});function a(d,p,g,v,m,f){const A=new Qg(p,{font:d,size:1*g,depth:.01*g,curveSegments:10,bevelThickness:.01*g,bevelSize:.1*g,bevelOffset:0,bevelSegments:2});A.translate(m[0],m[1],m[2]),A.rotateZ(f);const x=new rs({color:v});return new ke(A,x)}function l(){const d=new tg,p=new ze(75,window.innerWidth/window.innerHeight,.1,1e3),g=new Qm({canvas:n});g.setSize(window.innerWidth,window.innerHeight);const v=new Xg(p,g.domElement);v.enableDamping=!0,v.dampingFactor=.25,v.enableZoom=!0,v.enableRotate=!0,p.position.x=3,p.position.y=3,p.position.z=0,p.rotation.x=3*Math.PI/4,p.rotation.y=Math.PI/4,p.rotation.z=0,d.add(p);let m=Object.keys(r),f=40,A={};m.forEach(N=>{A[N]=Array.from({length:f},()=>Array.from({length:f},()=>0))});for(let N=0;N<f;N++)for(let K=0;K<f;K++){let k=N/f,J=K/f,W=1-k,ot=1-J;N===f-1&&(W=1e-5),K===f-1&&(ot=1e-5);let et=JSON.parse(JSON.stringify(r));for(let At in et){let Pt=et[At],q=Pt.gold,nt=Pt.silver,ft=Pt.bronze,ut=q,Rt=nt*W,Ut=ft*W*ot;A[At][N][K]=ut+Rt+Ut}let mt=m.map(At=>[At,A[At][N][K]]);mt.sort((At,Pt)=>At[1]===Pt[1]?At[0]<Pt[0]?-1:1:Pt[1]-At[1]),mt.forEach((At,Pt)=>{A[At[0]][N][K]=Pt+1})}m.forEach((N,K)=>{let k=A[N],J=Array.from({length:f},()=>Array.from({length:f},()=>0)),W=Math.ceil(f/2);for(let Mt=0;Mt<f;Mt++)for(let y=0;y<f;y++){let rt=0,Q=0;for(let at=Mt-W;at<=Mt+W;at++)for(let Z=y-W;Z<=y+W;Z++)at>=0&&at<f&&Z>=0&&Z<f&&(rt+=k[at][Z]*(1/(Math.abs(at-Mt)+Math.abs(Z-y)+1)**3),Q+=1/(Math.abs(at-Mt)+Math.abs(Z-y)+1)**3);J[Mt][y]=rt/Q}k=J;let ot=new or(2,2,f-1,f-1),et=ot.attributes.position.array;for(let Mt=0;Mt<f;Mt++)for(let y=0;y<f;y++){let rt=(Mt*f+y)*3,Q=k[Mt][y]/m.length*2-1;et[rt+2]=-Q*s}ot.attributes.position.needsUpdate=!0,ot.computeVertexNormals();
4212let mt=new rs({map:new Hg().load(`${El}/flags/${N}.png`),wireframe:!0,transparent:!0,opacity:.5}),At=new ke(ot,mt);d.add(At);let Pt=[];for(let Mt=0;Mt<f;Mt++){let y=(0*f+Mt)*3;Pt.push(et[y],et[y+1],et[y+2]),Pt.push(et[y],et[y+1],et[y+2])}Pt=Pt.slice(3,Pt.length-3);let q=[];for(let Mt=0;Mt<f;Mt++){let y=(Mt*f+f-1)*3;q.push(et[y],et[y+1],et[y+2]),q.push(et[y],et[y+1],et[y+2])}q=q.slice(3,q.length-3);let nt=[];for(let Mt=f-1;Mt>=0;Mt--){let y=((f-1)*f+Mt)*3;nt.push(et[y],et[y+1],et[y+2]),nt.push(et[y],et[y+1],et[y+2])}nt=nt.slice(3,nt.length-3);let ft=[];for(let Mt=f-1;Mt>=0;Mt--){let y=(Mt*f+0)*3;ft.push(et[y],et[y+1],et[y+2]),ft.push(et[y],et[y+1],et[y+2])}ft=ft.slice(3,ft.length-3);let ut=[...Pt,...q,...nt,...ft],Rt=new qi;Rt.setPositions(ut);let Ut=new Ai({color:r[N].borderColor,wireframe:!1,linewidth:15});Ut.resolution.set(window.innerWidth,window.innerHeight);let Lt=new hc(Rt,Ut);d.add(Lt)});let x=-(1/m.length*2-1)*s,T=-(1*2-1)*s,O=new Ai({color:16766720,linewidth:10}),C=new Ai({color:12632256,linewidth:10}),R=new Ai({color:13467442,linewidth:10}),U=[[-1.1,1.1],[1.1,1.1],[-1.1,-1.1],[1.1,-1.1]],b=[[-1.15,1.15],[1.15,1.15]],M=[[-1.2,1.2]];U.forEach(N=>{let K=new Ks(new qi().setPositions([N[0],N[1],x,N[0],N[1],T]),O).computeLineDistances();d.add(K)}),b.forEach(N=>{let K=new Ks(new qi().setPositions([N[0],N[1],x,N[0],N[1],T]),C).computeLineDistances();d.add(K)}),M.forEach(N=>{let K=new Ks(new qi().setPositions([N[0],N[1],x,N[0],N[1],T]),R).computeLineDistances();d.add(K)}),new t_().load("Inter_Regular.json",function(N){[a(N,"Increasing Silver Value →",.12,12632256,[-.9,1.2,T],Math.PI/2),a(N,"Increasing Silver Value →",.12,12632256,[-.9,-1.3,T],Math.PI/2),a(N,"← Increasing Bronze Value",.12,13467442,[-1.1,1.2,T],0),a(N,"← Increasing Bronze Value",.12,13467442,[-1.1,-1.4,T],0),a(N,"Only Gold",.06,16766720,[-.2,-1.2,T],0),a(N,"All Count",.06,16766720,[-.2,1.8,T],Math.PI/4),a(N,"Gold and Silver",.06,16766720,[-.3,1.7,T],-Math.PI/4)].forEach(k=>{d.add(k)})});function Y(){requestAnimationFrame(Y),v.update(),g.render(d,p)}Y();const G=()=>{g.setSize(window.innerWidth,window.innerHeight),p.aspect=window.innerWidth/window.innerHeight,p.updateProjectionMatrix(),window.innerWidth<xl?e(2,o=!1):e(2,o=!0)};window.addEventListener("resize",G)}function c(d){Sc[d?"unshift":"push"](()=>{n=d,e(0,n)})}function u(){s=yc(this.value),e(1,s)}return[n,s,o,r,l,c,u,()=>{l()}]}class a_ extends Ml{constructor(t){super(),yl(this,t,s_,r_,Sl,{})}}function o_(i){let t,e,n;return e=new a_({}),{c(){t=he("div"),Ec(e.$$.fragment),this.h()},l(r){t=de(r,"DIV",{class:!0});var s=Ne(t);Tc(e.$$.fragment,s),s.forEach(ae),this.h()},h(){te(t,"class","h-screen bg-background")},m(r,s){Dn(r,t,s),bc(e,t,null),n=!0},p:Jr,i(r){n||(Ac(e.$$.fragment,r),n=!0)},o(r){wc(e.$$.fragment,r),n=!1},d(r){r&&ae(t),Rc(e)}}}class d_ extends Ml{constructor(t){super(),yl(this,t,null,o_,Sl,{})}}export{d_ as component,h_ as universal};

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.