PageSourceSearch

https://www.supliichain.io/assets/three-CWrCzQay.js

js supliichain.io collected 2026-10-08 22:53:21 UTC 858,816 bytes, 4,286 lines download raw bytes

vendor: 6,105 bytes, lines 1-21
1import{r as jx}from"./radix-CZPgPwSx.js";import{r as Ce,g as Jx}from"./icons-FOYoml-d.js";import{j as Ti}from"./markdown-B-XC8faE.js";var Kx,Pg=jx;Kx=Pg.createRoot,Pg.hydrateRoot;const Qx="modulepreload",$x=function(r){return"/"+r},Ig={},bR=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(t.map(u=>{if(u=$x(u),u in Ig)return;Ig[u]=!0;const h=u.endsWith(".css"),f=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=h?"stylesheet":Qx,h||(p.as="script"),p.crossOrigin="",p.href=u,c&&p.setAttribute("nonce",c),document.head.appendChild(p),h)return new Promise((m,g)=>{p.addEventListener("load",m),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return i.then(a=>{for(const c of a||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};var Uv={exports:{}},Nv={},Ov={exports:{}},Fv={};/**
2 * @license React
3 * use-sync-external-store-shim.production.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Io=Ce;function eS(r,e){return r===e&&(r!==0||1/r===1/e)||r!==r&&e!==e}var tS=typeof Object.is=="function"?Object.is:eS,nS=Io.useState,iS=Io.useEffect,rS=Io.useLayoutEffect,sS=Io.useDebugValue;function oS(r,e){var t=e(),n=nS({inst:{value:t,getSnapshot:e}}),i=n[0].inst,s=n[1];return rS(function(){i.value=t,i.getSnapshot=e,Bf(i)&&s({inst:i})},[r,t,e]),iS(function(){return Bf(i)&&s({inst:i}),r(function(){Bf(i)&&s({inst:i})})},[r]),sS(t),t}function Bf(r){var e=r.getSnapshot;r=r.value;try{var t=e();return!tS(r,t)}catch{return!0}}function aS(r,e){return e()}var lS=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?aS:oS;Fv.useSyncExternalStore=Io.useSyncExternalStore!==void 0?Io.useSyncExternalStore:lS;Ov.exports=Fv;var cS=Ov.exports;/**
10 * @license React
11 * use-sync-external-store-shim/with-selector.production.js
12 *
13 * Copyright (c) Meta Platforms, Inc. and affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var $u=Ce,uS=cS;function hS(r,e){return r===e&&(r!==0||1/r===1/e)||r!==r&&e!==e}var fS=typeof Object.is=="function"?Object.is:hS,dS=uS.useSyncExternalStore,pS=$u.useRef,mS=$u.useEffect,gS=$u.useMemo,vS=$u.useDebugValue;Nv.useSyncExternalStoreWithSelector=function(r,e,t,n,i){var s=pS(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=gS(function(){function u(g){if(!h){if(h=!0,f=g,g=n(g),i!==void 0&&a.hasValue){var y=a.value;if(i(y,g))return p=y}return p=g}if(y=p,fS(f,g))return y;var M=n(g);return i!==void 0&&i(y,M)?(f=g,y):(f=g,p=M)}var h=!1,f,p,m=t===void 0?null:t;return[function(){return u(e())},m===null?void 0:function(){return u(m())}]},[e,t,n,i]);var c=dS(r,s[0],s[1]);return mS(function(){a.hasValue=!0,a.value=c},[c]),vS(c),c};Uv.exports=Nv;var AR=Uv.exports;/**
18 * @license
19 * Copyright 2010-2024 Three.js Authors
20 * SPDX-License-Identifier: MIT
21 */const Qa="170",gs={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},vs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Bv=0,Bd=1,zv=2,_S=3,kv=0,eh=1,Ta=2,wi=3,vr=0,Hn=1,Gi=2,mr=0,Ts=1,zd=2,kd=3,Vd=4,Vv=5,zr=100,Hv=101,Gv=102,Wv=103,Xv=104,Yv=200,qv=201,Zv=202,jv=203,hu=204,fu=205,Jv=206,Kv=207,Qv=208,$v=209,e_=210,t_=211,n_=212,i_=213,r_=214,du=0,pu=1,mu=2,Is=3,gu=4,vu=5,_u=6,yu=7,$a=0,s_=1,o_=2,qi=0,a_=1,l_=2,c_=3,rp=4,u_=5,h_=6,f_=7,Hd="attached",d_="detached",th=300,_r=301,Vr=302,Na=303,Oa=304,Bo=306,Fa=1e3,vi=1001,Ba=1002,wn=1003,sp=1004,yS=1004,wo=1005,xS=1005,cn=1006,ba=1007,SS=1007,Xi=1008,MS=1008,Ai=1009,op=1010,ap=1011,Lo=1012,nh=1013,yr=1014,Kn=1015,zo=1016,ih=1017,rh=1018,Ls=1020,lp=35902,cp=1021,up=1022,Dn=1023,hp=1024,fp=1025,bs=1026,Ds=1027,sh=1028,el=1029,dp=1030,oh=1031,ES=1032,ah=1033,Aa=33776,Ca=33777,Ra=33778,Pa=33779,xu=35840,Su=35841,Mu=35842,Eu=35843,wu=36196,Tu=37492,bu=37496,Au=37808,Cu=37809,Ru=37810,Pu=37811,Iu=37812,Lu=37813,Du=37814,Uu=37815,Nu=37816,Ou=37817,Fu=37818,Bu=37819,zu=37820,ku=37821,Ia=36492,Vu=36494,Hu=36495,pp=36283,Gu=36284,Wu=36285,Xu=36286,p_=2200,m_=2201,g_=2202,za=2300,Yu=2301,lu=2302,Ss=2400,Ms=2401,ka=2402,lh=2500,mp=2501,wS=0,TS=1,bS=2,v_=3200,__=3201,AS=3202,CS=3203,Gr=0,y_=1,fr="",jn="srgb",Ns="srgb-linear",tl="linear",Ft="srgb",RS=0,_s=7680,PS=7681,IS=7682,LS=7683,DS=34055,US=34056,NS=5386,OS=512,FS=513,BS=514,zS=515,kS=516,VS=517,HS=518,Gd=519,x_=512,S_=513,M_=514,gp=515,E_=516,w_=517,T_=518,b_=519,Va=35044,GS=35048,WS=35040,XS=35045,YS=35049,qS=35041,ZS=35046,jS=35050,JS=35042,KS="100",Wd="300 es",Yi=2e3,Ha=2001;let Ji=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}};const Pn=["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","5
215","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 Lg=1234567;const As=Math.PI/180,Do=180/Math.PI;function oi(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Pn[r&255]+Pn[r>>8&255]+Pn[r>>16&255]+Pn[r>>24&255]+"-"+Pn[e&255]+Pn[e>>8&255]+"-"+Pn[e>>16&15|64]+Pn[e>>24&255]+"-"+Pn[t&63|128]+Pn[t>>8&255]+"-"+Pn[t>>16&255]+Pn[t>>24&255]+Pn[n&255]+Pn[n>>8&255]+Pn[n>>16&255]+Pn[n>>24&255]).toLowerCase()}function Jt(r,e,t){return Math.max(e,Math.min(t,r))}function vp(r,e){return(r%e+e)%e}function QS(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function $S(r,e,t){return r!==e?(t-r)/(e-r):0}function La(r,e,t){return(1-t)*r+t*e}function eM(r,e,t,n){return La(r,e,1-Math.exp(-t*n))}function tM(r,e=1){return e-Math.abs(vp(r,e*2)-e)}function nM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function iM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function rM(r,e){return r+Math.floor(Math.random()*(e-r+1))}function sM(r,e){return r+Math.random()*(e-r)}function oM(r){return r*(.5-Math.random())}function aM(r){r!==void 0&&(Lg=r);let e=Lg+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function lM(r){return r*As}function cM(r){return r*Do}function uM(r){return(r&r-1)===0&&r!==0}function hM(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function fM(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function dM(r,e,t,n,i){const s=Math.cos,a=Math.sin,c=s(t/2),u=a(t/2),h=s((e+n)/2),f=a((e+n)/2),p=s((e-n)/2),m=a((e-n)/2),g=s((n-e)/2),y=a((n-e)/2);switch(i){case"XYX":r.set(c*f,u*p,u*m,c*h);break;case"YZY":r.set(u*m,c*f,u*p,c*h);break;case"ZXZ":r.set(u*p,u*m,c*f,c*h);break;case"XZX":r.set(c*f,u*y,u*g,c*h);break;case"YXY":r.set(u*g,c*f,u*y,c*h);break;case"ZYZ":r.set(u*y,u*g,c*f,c*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Vn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function vt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const A_={DEG2RAD:As,RAD2DEG:Do,generateUUID:oi,clamp:Jt,euclideanModulo:vp,mapLinear:QS,inverseLerp:$S,lerp:La,damp:eM,pingpong:tM,smoothstep:nM,smootherstep:iM,randInt:rM,randFloat:sM,randFloatSpread:oM,seededRandom:aM,degToRad:lM,radToDeg:cM,isPowerOfTwo:uM,ceilPowerOfTwo:hM,floorPowerOfTwo:fM,setQuaternionFromProperEuler:dM,normalize:vt,denormalize:Vn};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 6,874 bytes, line 21
21sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class gt{constructor(e,t,n,i,s,a,c,u,h){gt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,c,u,h)}set(e,t,n,i,s,a,c,u,h){const f=this.elements;return f[0]=e,f[1]=i,f[2]=c,f[3]=t,f[4]=s,f[5]=u,f[6]=n,f[7]=a,f[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],c=n[3],u=n[6],h=n[1],f=n[4],p=n[7],m=n[2],g=n[5],y=n[8],M=i[0],x=i[3],_=i[6],w=i[1],E=i[4],T=i[7],U=i[2],R=i[5],L=i[8];return s[0]=a*M+c*w+u*U,s[3]=a*x+c*E+u*R,s[6]=a*_+c*T+u*L,s[1]=h*M+f*w+p*U,s[4]=h*x+f*E+p*R,s[7]=h*_+f*T+p*L,s[2]=m*M+g*w+y*U,s[5]=m*x+g*E+y*R,s[8]=m*_+g*T+y*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],f=e[8];return t*a*f-t*c*h-n*s*f+n*c*u+i*s*h-i*a*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],f=e[8],p=f*a-c*h,m=c*u-f*s,g=h*s-a*u,y=t*p+n*m+i*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const M=1/y;return e[0]=p*M,e[1]=(i*h-f*n)*M,e[2]=(c*n-i*a)*M,e[3]=m*M,e[4]=(f*t-i*u)*M,e[5]=(i*s-c*t)*M,e[6]=g*M,e[7]=(n*u-h*t)*M,e[8]=(a*t-n*s)*M,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,c){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*a+h*c)+a+e,-i*h,i*u,-i*(-h*a+u*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(zf.makeScale(e,t)),this}rotate(e){return this.premultiply(zf.makeRotation(-e)),this}translate(e,t){return this.premultiply(zf.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const zf=new gt;function C_(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const pM={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function To(r,e){return new pM[r](e)}function Ga(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function R_(){const r=Ga("canvas");return r.style.display="block",r}const Dg={};function Ma(r){r in Dg||(Dg[r]=!0,console.warn(r))}function mM(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function gM(r){const e=r.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function vM(r){const e=r.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Pt={enabled:!0,workingColorSpace:Ns,spaces:{},convert:function(r,e,t){return this.enabled===!1||e===t||!e||!t||(this.spaces[e].transfer===Ft&&(r.r=gr(r.r),r.g=gr(r.g),r.b=gr(r.b)),this.spaces[e].primaries!==this.spaces[t].primaries&&(r.applyMatrix3(this.spaces[e].toXYZ),r.applyM
vendor: 4,567 bytes, line 21
21atrix3(this.spaces[t].fromXYZ)),this.spaces[t].transfer===Ft&&(r.r=Po(r.r),r.g=Po(r.g),r.b=Po(r.b))),r},fromWorkingColorSpace:function(r,e){return this.convert(r,this.workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===fr?tl:this.spaces[r].transfer},getLuminanceCoefficients:function(r,e=this.workingColorSpace){return r.fromArray(this.spaces[e].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,e,t){return r.copy(this.spaces[e].toXYZ).multiply(this.spaces[t].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}};function gr(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Po(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}const Ug=[.64,.33,.3,.6,.15,.06],Ng=[.2126,.7152,.0722],Og=[.3127,.329],Fg=new gt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Bg=new gt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Pt.define({[Ns]:{primaries:Ug,whitePoint:Og,transfer:tl,toXYZ:Fg,fromXYZ:Bg,luminanceCoefficients:Ng,workingColorSpaceConfig:{unpackColorSpace:jn},outputColorSpaceConfig:{drawingBufferColorSpace:jn}},[jn]:{primaries:Ug,whitePoint:Og,transfer:Ft,toXYZ:Fg,fromXYZ:Bg,luminanceCoefficients:Ng,outputColorSpaceConfig:{drawingBufferColorSpace:jn}}});let to;class P_{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{to===void 0&&(to=Ga("canvas")),to.width=e.width,to.height=e.height;const n=to.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=to}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Ga("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=gr(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(gr(t[n]/255)*255):t[n]=gr(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let _M=0;class Es{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:_M++}),this.uuid=oi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,c=i.length;a<c;a++)i[a].isDataTexture?s.push(kf(i[a].image)):s.push(kf(i[a]))}else s=kf(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function kf(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?P_.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let yM=0;class Kt extends Ji{constructor(e=Kt.DEFAULT_IMAGE,t=Kt.DEFAULT_MAPPING,n=vi,i=vi,s=cn,a=Xi,c=Dn,u=Ai,h=Kt.DEFAULT_ANISOTROPY,f=fr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:yM++}),this.uuid=oi(),this.name="",this.source=new Es(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=h,this.format=c,this.internalFormat=null,this.type=u,this.offset=new ue(0,0),this.repeat=new ue(1,1),this.center=new ue(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new gt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace
vendor: 21,271 bytes, line 21
21=f,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==th)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Fa:e.x=e.x-Math.floor(e.x);break;case vi:e.x=e.x<0?0:1;break;case Ba:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Fa:e.y=e.y-Math.floor(e.y);break;case vi:e.y=e.y<0?0:1;break;case Ba:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Kt.DEFAULT_IMAGE=null;Kt.DEFAULT_MAPPING=th;Kt.DEFAULT_ANISOTROPY=1;class bt{constructor(e=0,t=0,n=0,i=1){bt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const u=e.elements,h=u[0],f=u[4],p=u[8],m=u[1],g=u[5],y=u[9],M=u[2],x=u[6],_=u[10];if(Math.abs(f-m)<.01&&Math.abs(p-M)<.01&&Math.abs(y-x)<.01){if(Math.abs(f+m)<.1&&Math.abs(p+M)<.1&&Math.abs(y+x)<.1&&Math.abs(h+g+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(h+1)/2,T=(g+1)/2,U=(_+1)/2,R=(f+m)/4,L=(p+M)/4,F=(y+x)/4;return E>T&&E>U?E<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(E),i=R/n,s=L/n):T>U?T<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(T),n=R/i,s=F/i):U<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(U),n=L/s,i=F/s),this.set(n,i,s,t),this}let w=Math.sqrt((x-y)*(x-y)+(p-M)*(p-M)+(m-f)*(m-f));return Math.abs(w)<.001&&(w=1),this.x=(x-y)/w,this.y=(p-M)/w,this.z=(m-f)/w,this.w=Math.acos((h+g+_-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class I_ extends Ji{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new bt(0,0,e,t),this.scissorTest=!1,this.viewport=new bt(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:cn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new Kt(i,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 a=n.count;for(let c=0;c<a;c++)this.textures[c]=s.clone(),this.textures[c].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(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Es(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ci extends I_{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ch extends Kt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=wn,this.minFilter=wn,this.wrapR=vi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class xM extends Ci{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new ch(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class _p extends Kt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=wn,this.minFilter=wn,this.wrapR=vi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class SM extends Ci{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new _p(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Un{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,c){let u=n[i+0],h=n[i+1],f=n[i+2],p=n[i+3];const m=s[a+0],g=s[a+1],y=s[a+2],M=s[a+3];if(c===0){e[t+0]=u,e[t+1]=h,e[t+2]=f,e[t+3]=p;return}if(c===1){e[t+0]=m,e[t+1]=g,e[t+2]=y,e[t+3]=M;return}if(p!==M||u!==m||h!==g||f!==y){let x=1-c;const _=u*m+h*g+f*y+p*M,w=_>=0?1:-1,E=1-_*_;if(E>Number.EPSILON){const U=Math.sqrt(E),R=Math.atan2(U,_*w);x=Math.sin(x*R)/U,c=Math.sin(c*R)/U}const T=c*w;if(u=u*x+m*T,h=h*x+g*T,f=f*x+y*T,p=p*x+M*T,x===1-c){const U=1/Math.sqrt(u*u+h*h+f*f+p*p);u*=U,h*=U,f*=U,p*=U}}e[t]=u,e[t+1]=h,e[t+2]=f,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,i,s,a){const c=n[i],u=n[i+1],h=n[i+2],f=n[i+3],p=s[a],m=s[a+1],g=s[a+2],y=s[a+3];return e[t]=c*y+f*p+u*g-h*m,e[t+1]=u*y+f*m+h*p-c*g,e[t+2]=h*y+f*g+c*m-u*p,e[t+3]=f*y-c*p-u*m-h*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,c=Math.cos,u=Math.sin,h=c(n/2),f=c(i/2),p=c(s/2),m=u(n/2),g=u(i/2),y=u(s/2);switch(a){case"XYZ":this._x=m*f*p+h*g*y,this._y=h*g*p-m*f*y,this._z=h*f*y+m*g*p,this._w=h*f*p-m*g*y;break;case"YXZ":this._x=m*f*p+h*g*y,this._y=h*g*p-m*f*y,this._z=h*f*y-m*g*p,this._w=h*f*p+m*g*y;break;case"ZXY":this._x=m*f*p-h*g*y,this._y=h*g*p+m*f*y,this._z=h*f*y+m*g*p,this._w=h*f*p-m*g*y;break;case"ZYX":this._x=m*f*p-h*g*y,this._y=h*g*p+m*f*y,this._z=h*f*y-m*g*p,this._w=h*f*p+m*g*y;break;case"YZX":this._x=m*f*p+h*g*y,this._y=h*g*p+m*f*y,this._z=h*f*y-m*g*p,this._w=h*f*p-m*g*y;break;case"XZY":this._x=m*f*p-h*g*y,this._y=h*g*p-m*f*y,this._z=h*f*y+m*g*p,this._w=h*f*p+m*g*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],c=t[5],u=t[9],h=t[2],f=t[6],p=t[10],m=n+c+p;if(m>0){const g=.5/Math.sqrt(m+1);this._w=.25/g,this._x=(f-u)*g,this._y=(s-h)*g,this._z=(a-i)*g}else if(n>c&&n>p){const g=2*Math.sqrt(1+n-c-p);this._w=(f-u)/g,this._x=.25*g,this._y=(i+a)/g,this._z=(s+h)/g}else if(c>p){const g=2*Math.sqrt(1+c-n-p);this._w=(s-h)/g,this._x=(i+a)/g,this._y=.25*g,this._z=(u+f)/g}else{const g=2*Math.sqrt(1+p-n-c);this._w=(a-i)/g,this._x=(s+h)/g,this._y=(u+f)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Jt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,c=t._x,u=t._y,h=t._z,f=t._w;return this._x=n*f+a*c+i*h-s*u,this._y=i*f+a*u+s*c-n*h,this._z=s*f+a*h+n*u-i*c,this._w=a*f-n*c-i*u-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,a=this._w;let c=a*e._w+n*e._x+i*e._y+s*e._z;if(c<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,c=-c):this.copy(e),c>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const u=1-c*c;if(u<=Number.EPSILON){const g=1-t;return this._w=g*a+t*this._w,this._x=g*n+t*this._x,this._y=g*i+t*this._y,this._z=g*s+t*this._z,this.normalize(),this}const h=Math.sqrt(u),f=Math.atan2(h,c),p=Math.sin((1-t)*f)/h,m=Math.sin(t*f)/h;return this._w=a*p+this._w*m,this._x=n*p+this._x*m,this._y=i*p+this._y*m,this._z=s*p+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class D{constructor(e=0,t=0,n=0){D.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(zg.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(zg.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,c=e.z,u=e.w,h=2*(a*i-c*n),f=2*(c*t-s*i),p=2*(s*n-a*t);return this.x=t+u*h+a*p-c*f,this.y=n+u*f+c*h-s*p,this.z=i+u*p+s*f-a*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}
vendor: 5,101 bytes, line 21
21lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,c=t.y,u=t.z;return this.x=i*u-s*c,this.y=s*a-n*u,this.z=n*c-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Vf.copy(this).projectOnVector(e),this.sub(Vf)}reflect(e){return this.sub(Vf.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Vf=new D,zg=new Un;class _n{constructor(e=new D(1/0,1/0,1/0),t=new D(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Si.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Si.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Si.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,c=s.count;a<c;a++)e.isMesh===!0?e.getVertexPosition(a,Si):Si.fromBufferAttribute(s,a),Si.applyMatrix4(e.matrixWorld),this.expandByPoint(Si);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),hc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),hc.copy(n.boundingBox)),hc.applyMatrix4(e.matrixWorld),this.union(hc)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Si),Si.distanceToSquared(e.center)<=e.radius*e.radiu
vendor: 6,355 bytes, line 21
21s}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(la),fc.subVectors(this.max,la),no.subVectors(e.a,la),io.subVectors(e.b,la),ro.subVectors(e.c,la),Lr.subVectors(io,no),Dr.subVectors(ro,io),is.subVectors(no,ro);let t=[0,-Lr.z,Lr.y,0,-Dr.z,Dr.y,0,-is.z,is.y,Lr.z,0,-Lr.x,Dr.z,0,-Dr.x,is.z,0,-is.x,-Lr.y,Lr.x,0,-Dr.y,Dr.x,0,-is.y,is.x,0];return!Hf(t,no,io,ro,fc)||(t=[1,0,0,0,1,0,0,0,1],!Hf(t,no,io,ro,fc))?!1:(dc.crossVectors(Lr,Dr),t=[dc.x,dc.y,dc.z],Hf(t,no,io,ro,fc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Si).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Si).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(rr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),rr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),rr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),rr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),rr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),rr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),rr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),rr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(rr),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const rr=[new D,new D,new D,new D,new D,new D,new D,new D],Si=new D,hc=new _n,no=new D,io=new D,ro=new D,Lr=new D,Dr=new D,is=new D,la=new D,fc=new D,dc=new D,rs=new D;function Hf(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){rs.fromArray(r,s);const c=i.x*Math.abs(rs.x)+i.y*Math.abs(rs.y)+i.z*Math.abs(rs.z),u=e.dot(rs),h=t.dot(rs),f=n.dot(rs);if(Math.max(-Math.max(u,h,f),Math.min(u,h,f))>c)return!1}return!0}const MM=new _n,ca=new D,Gf=new D;let yn=class{constructor(e=new D,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):MM.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ca.subVectors(e,this.center);const t=ca.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ca,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Gf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ca.copy(e.center).add(Gf)),this.expandByPoint(ca.copy(e.center).sub(Gf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const sr=new D,Wf=new D,pc=new D,Ur=new D,Xf=new D,mc=new D,Yf=new D;class Os{constructor(e=new D,t=new D(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,sr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=sr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(sr.copy(this.origin).addScaledVector(this.direction,t),sr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Wf.copy(e).add(t).multiplyScalar(.5),pc.copy(t).sub(e).normalize(),Ur.copy(this.origin).sub(Wf);const s=e.distanceTo(t)*.5,a=-this.direction.dot(pc),c=Ur.dot(this.direction),u=-Ur.dot(pc),h=Ur.lengthSq(),f=Math.abs(1-a*a);let p,m,g,y;if(f>0)if(p=a*u-c,m=a*c-u,y=s*f,p>=0)if(m>=-y)if(m<=y){const M=1/f;p*=M,m*=M,g=p*(p+a*m+2*c)+m*(a*p+m+2*u)+h}else m=s,p=Math.max(0,-(a*m+c)),g=-p*p+m*(m+2*u)+h;else m=-s,p=Math.max(0,-(a*m+c)),g=-p*p+m*(m+2*u)+h;else m<=-y?(p=Math.max(0,-(-a*s+c)),m=p>0?-s:Math.min(Math.max(-s,-u),s),g=-p*p+m*(m+2*u)+h):m<=y?(p=0,m=Math.min(Math.max(-s,-u),s),g=m*(m+2*u)+h):(p=Math.max(0,-(a*s+c)),m=p>0?s:Math.min(Math.max(-s,-u),s),g=-p*p+m*(m+2*u)+h);else m=a>0?-s:s,p=Math.max(0,-(a*m+c)),g=-p*p+m*(m+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,p),i&&i.copy(Wf).addScaledVector(pc,m),g}intersectSphere(e,t){sr.subVectors(e.center,this.origin);const n=sr.dot(this.direction),i=sr.dot(sr)-n*n,s=e.radius*e.radiu
vendor: 15,190 bytes, line 21
21s;if(i>s)return null;const a=Math.sqrt(s-i),c=n-a,u=n+a;return u<0?null:c<0?this.at(u,t):this.at(c,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,c,u;const h=1/this.direction.x,f=1/this.direction.y,p=1/this.direction.z,m=this.origin;return h>=0?(n=(e.min.x-m.x)*h,i=(e.max.x-m.x)*h):(n=(e.max.x-m.x)*h,i=(e.min.x-m.x)*h),f>=0?(s=(e.min.y-m.y)*f,a=(e.max.y-m.y)*f):(s=(e.max.y-m.y)*f,a=(e.min.y-m.y)*f),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),p>=0?(c=(e.min.z-m.z)*p,u=(e.max.z-m.z)*p):(c=(e.max.z-m.z)*p,u=(e.min.z-m.z)*p),n>u||c>i)||((c>n||n!==n)&&(n=c),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,sr)!==null}intersectTriangle(e,t,n,i,s){Xf.subVectors(t,e),mc.subVectors(n,e),Yf.crossVectors(Xf,mc);let a=this.direction.dot(Yf),c;if(a>0){if(i)return null;c=1}else if(a<0)c=-1,a=-a;else return null;Ur.subVectors(this.origin,e);const u=c*this.direction.dot(mc.crossVectors(Ur,mc));if(u<0)return null;const h=c*this.direction.dot(Xf.cross(Ur));if(h<0||u+h>a)return null;const f=-c*Ur.dot(Yf);return f<0?null:this.at(f/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ut{constructor(e,t,n,i,s,a,c,u,h,f,p,m,g,y,M,x){ut.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,c,u,h,f,p,m,g,y,M,x)}set(e,t,n,i,s,a,c,u,h,f,p,m,g,y,M,x){const _=this.elements;return _[0]=e,_[4]=t,_[8]=n,_[12]=i,_[1]=s,_[5]=a,_[9]=c,_[13]=u,_[2]=h,_[6]=f,_[10]=p,_[14]=m,_[3]=g,_[7]=y,_[11]=M,_[15]=x,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 ut().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/so.setFromMatrixColumn(e,0).length(),s=1/so.setFromMatrixColumn(e,1).length(),a=1/so.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i),f=Math.cos(s),p=Math.sin(s);if(e.order==="XYZ"){const m=a*f,g=a*p,y=c*f,M=c*p;t[0]=u*f,t[4]=-u*p,t[8]=h,t[1]=g+y*h,t[5]=m-M*h,t[9]=-c*u,t[2]=M-m*h,t[6]=y+g*h,t[10]=a*u}else if(e.order==="YXZ"){const m=u*f,g=u*p,y=h*f,M=h*p;t[0]=m+M*c,t[4]=y*c-g,t[8]=a*h,t[1]=a*p,t[5]=a*f,t[9]=-c,t[2]=g*c-y,t[6]=M+m*c,t[10]=a*u}else if(e.order==="ZXY"){const m=u*f,g=u*p,y=h*f,M=h*p;t[0]=m-M*c,t[4]=-a*p,t[8]=y+g*c,t[1]=g+y*c,t[5]=a*f,t[9]=M-m*c,t[2]=-a*h,t[6]=c,t[10]=a*u}else if(e.order==="ZYX"){const m=a*f,g=a*p,y=c*f,M=c*p;t[0]=u*f,t[4]=y*h-g,t[8]=m*h+M,t[1]=u*p,t[5]=M*h+m,t[9]=g*h-y,t[2]=-h,t[6]=c*u,t[10]=a*u}else if(e.order==="YZX"){const m=a*u,g=a*h,y=c*u,M=c*h;t[0]=u*f,t[4]=M-m*p,t[8]=y*p+g,t[1]=p,t[5]=a*f,t[9]=-c*f,t[2]=-h*f,t[6]=g*p+y,t[10]=m-M*p}else if(e.order==="XZY"){const m=a*u,g=a*h,y=c*u,M=c*h;t[0]=u*f,t[4]=-p,t[8]=h*f,t[1]=m*p+M,t[5]=a*f,t[9]=g*p-y,t[2]=y*p-g,t[6]=c*f,t[10]=M*p+m}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(EM,e,wM)}lookAt(e,t,n){const i=this.elements;return ii.subVectors(e,t),ii.lengthSq()===0&&(ii.z=1),ii.normalize(),Nr.crossVectors(n,ii),Nr.lengthSq()===0&&(Math.abs(n.z)===1?ii.x+=1e-4:ii.z+=1e-4,ii.normalize(),Nr.crossVectors(n,ii)),Nr.normalize(),gc.crossVectors(ii,Nr),i[0]=Nr.x,i[4]=gc.x,i[8]=ii.x,i[1]=Nr.y,i[5]=gc.y,i[9]=ii.y,i[2]=Nr.z,i[6]=gc.z,i[10]=ii.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],c=n[4],u=n[8],h=n[12],f=n[1],p=n[5],m=n[9],g=n[13],y=n[2],M=n[6],x=n[10],_=n[14],w=n[3],E=n[7],T=n[11],U=n[15],R=i[0],L=i[4],F=i[8],C=i[12],A=i[1],N=i[5],Z=i[9],q=i[13],K=i[2],ce=i[6],Q=i[10],ve=i[14],V=i[3],re=i[7],ie=i[11],de=i[15];return s[0]=a*R+c*A+u*K+h*V,s[4]=a*L+c*N+u*ce+h*re,s[8]=a*F+c*Z+u*Q+h*ie,s[12]=a*C+c*q+u*ve+h*de,s[1]=f*R+p*A+m*K+g*V,s[5]=f*L+p*N+m*ce+g*re,s[9]=f*F+p*Z+m*Q+g*ie,s[13]=f*C+p*q+m*ve+g*de,s[2]=y*R+M*A+x*K+_*V,s[6]=y*L+M*N+x*ce+_*re,s[10]=y*F+M*Z+x*Q+_*ie,s[14]=y*C+M*q+x*ve+_*de,s[3]=w*R+E*A+T*K+U*V,s[7]=w*L+E*N+T*ce+U*re,s[11]=w*F+E*Z+T*Q+U*ie,s[15]=w*C+E*q+T*ve+U*de,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],c=e[5],u=e[9],h=e[13],f=e[2],p=e[6],m=e[10],g=e[14],y=e[3],M=e[7],x=e[11],_=e[15];return y*(+s*u*p-i*h*p-s*c*m+n*h*m+i*c*g-n*u*g)+M*(+t*u*g-t*h*m+s*a*m-i*a*g+i*h*f-s*u*f)+x*(+t*h*p-t*c*g-s*a*p+n*a*g+s*c*f-n*h*f)+_*(-i*c*f-t*u*p+t*c*m+i*a*p-n*a*m+n*u*f)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],f=e[8],p=e[9],m=e[10],g=e[11],y=e[12],M=e[13],x=e[14],_=e[15],w=p*x*h-M*m*h+M*u*g-c*x*g-p*u*_+c*m*_,E=y*m*h-f*x*h-y*u*g+a*x*g+f*u*_-a*m*_,T=f*M*h-y*p*h+y*c*g-a*M*g-f*c*_+a*p*_,U=y*p*u-f*M*u-y*c*m+a*M*m+f*c*x-a*p*x,R=t*w+n*E+i*T+s*U;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/R;return e[0]=w*L,e[1]=(M*m*s-p*x*s-M*i*g+n*x*g+p*i*_-n*m*_)*L,e[2]=(c*x*s-M*u*s+M*i*h-n*x*h-c*i*_+n*u*_)*L,e[3]=(p*u*s-c*m*s-p*i*h+n*m*h+c*i*g-n*u*g)*L,e[4]=E*L,e[5]=(f*x*s-y*m*s+y*i*g-t*x*g-f*i*_+t*m*_)*L,e[6]=(y*u*s-a*x*s-y*i*h+t*x*h+a*i*_-t*u*_)*L,e[7]=(a*m*s-f*u*s+f*i*h-t*m*h-a*i*g+t*u*g)*L,e[8]=T*L,e[9]=(y*p*s-f*M*s-y*n*g+t*M*g+f*n*_-t*p*_)*L,e[10]=(a*M*s-y*c*s+y*n*h-t*M*h-a*n*_+t*c*_)*L,e[11]=(f*c*s-a*p*s-f*n*h+t*p*h+a*n*g-t*c*g)*L,e[12]=U*L,e[13]=(f*M*i-y*p*i+y*n*m-t*M*m-f*n*x+t*p*x)*L,e[14]=(y*c*i-a*M*i-y*n*u+t*M*u+a*n*x-t*c*x)*L,e[15]=(a*p*i-f*c*i+f*n*u-t*p*u-a*n*m+t*c*m)*L,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,c=e.y,u=e.z,h=s*a,f=s*c;return this.set(h*a+n,h*c-i*u,h*u+i*c,0,h*c+i*u,f*c+n,f*u-i*a,0,h*u-i*c,f*u+i*a,s*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,c=t._z,u=t._w,h=s+s,f=a+a,p=c+c,m=s*h,g=s*f,y=s*p,M=a*f,x=a*p,_=c*p,w=u*h,E=u*f,T=u*p,U=n.x,R=n.y,L=n.z;return i[0]=(1-(M+_))*U,i[1]=(g+T)*U,i[2]=(y-E)*U,i[3]=0,i[4]=(g-T)*R,i[5]=(1-(m+_))*R,i[6]=(x+w)*R,i[7]=0,i[8]=(y+E)*L,i[9]=(x-w)*L,i[10]=(1-(m+M))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=so.set(i[0],i[1],i[2]).length();const a=so.set(i[4],i[5],i[6]).length(),c=so.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Mi.copy(this);const h=1/s,f=1/a,p=1/c;return Mi.elements[0]*=h,Mi.elements[1]*=h,Mi.elements[2]*=h,Mi.elements[4]*=f,Mi.elements[5]*=f,Mi.elements[6]*=f,Mi.elements[8]*=p,Mi.elements[9]*=p,Mi.elements[10]*=p,t.setFromRotationMatrix(Mi),n.x=s,n.y=a,n.z=c,this}makePerspective(e,t,n,i,s,a,c=Yi){const u=this.elements,h=2*s/(t-e),f=2*s/(n-i),p=(t+e)/(t-e),m=(n+i)/(n-i);let g,y;if(c===Yi)g=-(a+s)/(a-s),y=-2*a*s/(a-s);else if(c===Ha)g=-a/(a-s),y=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return u[0]=h,u[4]=0,u[8]=p,u[12]=0,u[1]=0,u[5]=f,u[9]=m,u[13]=0,u[2]=0,u[6]=0,u[10]=g,u[14]=y,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,i,s,a,c=Yi){const u=this.elements,h=1/(t-e),f=1/(n-i),p=1/(a-s),m=(t+e)*h,g=(n+i)*f;let y,M;if(c===Yi)y=(a+s)*p,M=-2*p;else if(c===Ha)y=s*p,M=-1*p;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return u[0]=2*h,u[4]=0,u[8]=0,u[12]=-m,u[1]=0,u[5]=2*f,u[9]=0,u[13]=-g,u[2]=0,u[6]=0,u[10]=M,u[14]=-y,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const so=new D,Mi=new ut,EM=new D(0,0,0),wM=new D(1,1,1),Nr=new D,gc=new D,ii=new D,kg=new ut,Vg=new Un;class ai{constructor(e=0,t=0,n=0,i=ai.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],c=i[8],u=i[1],h=i[5],f=i[9],p=i[2],m=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(Jt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,g),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Jt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(c,g),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-p,s),this._z=0);break;case"ZXY":this._x=Math.asin(Jt(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-p,g),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-Jt(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(m,g),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(Jt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-f,h),this._y=Math.atan2(-p,s)):(this._x=0,this._y=Math.atan2(c,g));break;case"XZY":this._z=Math.asin(-Jt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(c,s)):(this._x=Math.atan2(-f,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return kg.makeRotationFromQuaternion(e),this.setFromRotationMatrix(kg,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Vg.setFromEuler(this),this.setFromQuaternion(Vg,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ai.DEFAULT_ORDER="XYZ";class Cs{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let TM=0;const Hg=new D,oo=new Un,or=new ut,vc=new D,ua=new D,bM=new D,AM=new Un,Gg=new D(1,0,0),Wg=new D(0,1,0),Xg=new D(0,0,1),Yg={type:"added"},CM={type:"removed"},ao={type:"childadded",child:null},qf={type:"childremoved",child:null};class Dt extends Ji{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:TM++}),this.uuid=oi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Dt.DEFAULT_UP.clone();const e=new D,t=new ai,n=new Un,i=new D(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ut},normalMatrix:{value:new gt}}),this.matrix=new ut,this.matrixWorld=new ut,this.matrixAutoUpdate=Dt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Cs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 4,289 bytes, line 21
21setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return oo.setFromAxisAngle(e,t),this.quaternion.multiply(oo),this}rotateOnWorldAxis(e,t){return oo.setFromAxisAngle(e,t),this.quaternion.premultiply(oo),this}rotateX(e){return this.rotateOnAxis(Gg,e)}rotateY(e){return this.rotateOnAxis(Wg,e)}rotateZ(e){return this.rotateOnAxis(Xg,e)}translateOnAxis(e,t){return Hg.copy(e).applyQuaternion(this.quaternion),this.position.add(Hg.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Gg,e)}translateY(e){return this.translateOnAxis(Wg,e)}translateZ(e){return this.translateOnAxis(Xg,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(or.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?vc.copy(e):vc.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),ua.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?or.lookAt(ua,vc,this.up):or.lookAt(vc,ua,this.up),this.quaternion.setFromRotationMatrix(or),i&&(or.extractRotation(i.matrixWorld),oo.setFromRotationMatrix(or),this.quaternion.premultiply(oo.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Yg),ao.child=e,this.dispatchEvent(ao),ao.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(CM),qf.child=e,this.dispatchEvent(qf),qf.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),or.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),or.multiply(e.parent.matrixWorld)),e.applyMatrix4(or),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Yg),ao.child=e,this.dispatchEvent(ao),ao.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ua,e,bM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ua,AM,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 5,732 bytes, line 21
21):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(c=>({boxInitialized:c.boxInitialized,boxMin:c.box.min.toArray(),boxMax:c.box.max.toArray(),sphereInitialized:c.sphereInitialized,sphereRadius:c.sphere.radius,sphereCenter:c.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const u=c.shapes;if(Array.isArray(u))for(let h=0,f=u.length;h<f;h++){const p=u[h];s(e.shapes,p)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let u=0,h=this.material.length;u<h;u++)c.push(s(e.materials,this.material[u]));i.material=c}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let c=0;c<this.children.length;c++)i.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let c=0;c<this.animations.length;c++){const u=this.animations[c];i.animations.push(s(e.animations,u))}}if(t){const c=a(e.geometries),u=a(e.materials),h=a(e.textures),f=a(e.images),p=a(e.shapes),m=a(e.skeletons),g=a(e.animations),y=a(e.nodes);c.length>0&&(n.geometries=c),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),f.length>0&&(n.images=f),p.length>0&&(n.shapes=p),m.length>0&&(n.skeletons=m),g.length>0&&(n.animations=g),y.length>0&&(n.nodes=y)}return n.object=i,n;function a(c){const u=[];for(const h in c){const f=c[h];delete f.metadata,u.push(f)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Dt.DEFAULT_UP=new D(0,1,0);Dt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ei=new D,ar=new D,Zf=new D,lr=new D,lo=new D,co=new D,qg=new D,jf=new D,Jf=new D,Kf=new D,Qf=new bt,$f=new bt,ed=new bt;class Jn{constructor(e=new D,t=new D,n=new D){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Ei.subVectors(e,t),i.cross(Ei);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Ei.subVectors(i,t),ar.subVectors(n,t),Zf.subVectors(e,t);const a=Ei.dot(Ei),c=Ei.dot(ar),u=Ei.dot(Zf),h=ar.dot(ar),f=ar.dot(Zf),p=a*h-c*c;if(p===0)return s.set(0,0,0),null;const m=1/p,g=(h*u-c*f)*m,y=(a*f-c*u)*m;return s.set(1-g-y,y,g)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,lr)===null?!1:lr.x>=0&&lr.y>=0&&lr.x+lr.y<=1}static getInterpolation(e,t,n,i,s,a,c,u){return this.getBarycoord(e,t,n,i,lr)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,lr.x),u.addScaledVector(a,lr.
vendor: 11,959 bytes, line 21
21y),u.addScaledVector(c,lr.z),u)}static getInterpolatedAttribute(e,t,n,i,s,a){return Qf.setScalar(0),$f.setScalar(0),ed.setScalar(0),Qf.fromBufferAttribute(e,t),$f.fromBufferAttribute(e,n),ed.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(Qf,s.x),a.addScaledVector($f,s.y),a.addScaledVector(ed,s.z),a}static isFrontFacing(e,t,n,i){return Ei.subVectors(n,t),ar.subVectors(e,t),Ei.cross(ar).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ei.subVectors(this.c,this.b),ar.subVectors(this.a,this.b),Ei.cross(ar).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Jn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Jn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Jn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Jn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Jn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,c;lo.subVectors(i,n),co.subVectors(s,n),jf.subVectors(e,n);const u=lo.dot(jf),h=co.dot(jf);if(u<=0&&h<=0)return t.copy(n);Jf.subVectors(e,i);const f=lo.dot(Jf),p=co.dot(Jf);if(f>=0&&p<=f)return t.copy(i);const m=u*p-f*h;if(m<=0&&u>=0&&f<=0)return a=u/(u-f),t.copy(n).addScaledVector(lo,a);Kf.subVectors(e,s);const g=lo.dot(Kf),y=co.dot(Kf);if(y>=0&&g<=y)return t.copy(s);const M=g*h-u*y;if(M<=0&&h>=0&&y<=0)return c=h/(h-y),t.copy(n).addScaledVector(co,c);const x=f*y-g*p;if(x<=0&&p-f>=0&&g-y>=0)return qg.subVectors(s,i),c=(p-f)/(p-f+(g-y)),t.copy(i).addScaledVector(qg,c);const _=1/(x+M+m);return a=M*_,c=m*_,t.copy(n).addScaledVector(lo,a).addScaledVector(co,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const L_={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},Or={h:0,s:0,l:0},_c={h:0,s:0,l:0};function td(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Ve{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=jn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Pt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Pt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Pt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Pt.workingColorSpace){if(e=vp(e,1),t=Jt(t,0,1),n=Jt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=td(a,s,e+1/3),this.g=td(a,s,e),this.b=td(a,s,e-1/3)}return Pt.toWorkingColorSpace(this,i),this}setStyle(e,t=jn){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],c=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=jn){const n=L_[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=gr(e.r),this.g=gr(e.g),this.b=gr(e.b),this}copyLinearToSRGB(e){return this.r=Po(e.r),this.g=Po(e.g),this.b=Po(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=jn){return Pt.fromWorkingColorSpace(In.copy(this),e),Math.round(Jt(In.r*255,0,255))*65536+Math.round(Jt(In.g*255,0,255))*256+Math.round(Jt(In.b*255,0,255))}getHexString(e=jn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Pt.workingColorSpace){Pt.fromWorkingColorSpace(In.copy(this),t);const n=In.r,i=In.g,s=In.b,a=Math.max(n,i,s),c=Math.min(n,i,s);let u,h;const f=(c+a)/2;if(c===a)u=0,h=0;else{const p=a-c;switch(h=f<=.5?p/(a+c):p/(2-a-c),a){case n:u=(i-s)/p+(i<s?6:0);break;case i:u=(s-n)/p+2;break;case s:u=(n-i)/p+4;break}u/=6}return e.h=u,e.s=h,e.l=f,e}getRGB(e,t=Pt.workingColorSpace){return Pt.fromWorkingColorSpace(In.copy(this),t),e.r=In.r,e.g=In.g,e.b=In.b,e}getStyle(e=jn){Pt.fromWorkingColorSpace(In.copy(this),e);const t=In.r,n=In.g,i=In.b;return e!==jn?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Or),this.setHSL(Or.h+e,Or.s+t,Or.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Or),e.getHSL(_c);const n=La(Or.h,_c.h,t),i=La(Or.s,_c.s,t),s=La(Or.l,_c.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const In=new Ve;Ve.NAMES=L_;let RM=0;class Nn extends Ji{static get type(){return"Material"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:RM++}),this.uuid=oi(),this.name="",this.blending=Ts,this.side=vr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=hu,this.blendDst=fu,this.blendEquation=zr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ve(0,0,0),this.blendAlpha=0,this.depthFunc=Is,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Gd,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=_s,this.stencilZFail=_s,this.stencilZPass=_s,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 8,832 bytes, line 21
21n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ts&&(n.blending=this.blending),this.side!==vr&&(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!==hu&&(n.blendSrc=this.blendSrc),this.blendDst!==fu&&(n.blendDst=this.blendDst),this.blendEquation!==zr&&(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!==Is&&(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!==Gd&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==_s&&(n.stencilFail=this.stencilFail),this.stencilZFail!==_s&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==_s&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const c in s){const u=s[c];delete u.metadata,a.push(u)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 6,332 bytes, line 21
21adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Wr extends Nn{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new Ve(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 ai,this.combine=$a,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const dr=PM();function PM(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,i[u]=24,i[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,i[u]=-h-1,i[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,i[u]=13,i[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,i[u]=24,i[u|256]=24):(n[u]=31744,n[u|256]=64512,i[u]=13,i[u|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),c=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,f=0;for(;!(h&8388608);)h<<=1,f-=8388608;h&=-8388609,f+=947912704,s[u]=h|f}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)a[u]=u<<23;a[31]=1199570944,a[32]=2147483648;for(let u=33;u<63;++u)a[u]=2147483648+(u-32<<23);a[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(c[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:c}}function Zn(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Jt(r,-65504,65504),dr.floatView[0]=r;const e=dr.uint32View[0],t=e>>23&511;return dr.baseTable[t]+((e&8388607)>>dr.shiftTable[t])}function Ea(r){const e=r>>10;return dr.uint32View[0]=dr.mantissaTable[dr.offsetTable[e]+(r&1023)]+dr.exponentTable[e],dr.floatView[0]}const IM={toHalfFloat:Zn,fromHalfFloat:Ea},an=new D,yc=new ue;class zt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Va,this.updateRanges=[],this.gpuType=Kn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)yc.fromBufferAttribute(this,t),yc.applyMatrix3(e),this.setXY(t,yc.x,yc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyMatrix3(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Vn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=vt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Vn(t,this.array)),t}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Vn(t,this.array)),t}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Vn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Vn(t,this.array)),t}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array),s=vt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}
vendor: 14,546 bytes, line 21
21onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Va&&(e.usage=this.usage),e}}class LM extends zt{constructor(e,t,n){super(new Int8Array(e),t,n)}}class DM extends zt{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class UM extends zt{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class NM extends zt{constructor(e,t,n){super(new Int16Array(e),t,n)}}class yp extends zt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class OM extends zt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class xp extends zt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class FM extends zt{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Ea(this.array[e*this.itemSize]);return this.normalized&&(t=Vn(t,this.array)),t}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize]=Zn(t),this}getY(e){let t=Ea(this.array[e*this.itemSize+1]);return this.normalized&&(t=Vn(t,this.array)),t}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+1]=Zn(t),this}getZ(e){let t=Ea(this.array[e*this.itemSize+2]);return this.normalized&&(t=Vn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+2]=Zn(t),this}getW(e){let t=Ea(this.array[e*this.itemSize+3]);return this.normalized&&(t=Vn(t,this.array)),t}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+3]=Zn(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.array[e+0]=Zn(t),this.array[e+1]=Zn(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array)),this.array[e+0]=Zn(t),this.array[e+1]=Zn(n),this.array[e+2]=Zn(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array),s=vt(s,this.array)),this.array[e+0]=Zn(t),this.array[e+1]=Zn(n),this.array[e+2]=Zn(i),this.array[e+3]=Zn(s),this}}class Ze extends zt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let BM=0;const gi=new ut,nd=new Dt,uo=new D,ri=new _n,ha=new _n,vn=new D;class xt extends Ji{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:BM++}),this.uuid=oi(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(C_(e)?xp:yp)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new gt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return gi.makeRotationFromQuaternion(e),this.applyMatrix4(gi),this}rotateX(e){return gi.makeRotationX(e),this.applyMatrix4(gi),this}rotateY(e){return gi.makeRotationY(e),this.applyMatrix4(gi),this}rotateZ(e){return gi.makeRotationZ(e),this.applyMatrix4(gi),this}translate(e,t,n){return gi.makeTranslation(e,t,n),this.applyMatrix4(gi),this}scale(e,t,n){return gi.makeScale(e,t,n),this.applyMatrix4(gi),this}lookAt(e){return nd.lookAt(e),nd.updateMatrix(),this.applyMatrix4(nd.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(uo).negate(),this.translate(uo.x,uo.y,uo.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Ze(n,3))}else{for(let n=0,i=t.count;n<i;n++){const s=e[n];t.setXYZ(n,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _n);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];ri.setFromBufferAttribute(s),this.morphTargetsRelative?(vn.addVectors(this.boundingBox.min,ri.min),this.boundingBox.expandByPoint(vn),vn.addVectors(this.boundingBox.max,ri.max),this.boundingBox.expandByPoint(vn)):(this.boundingBox.expandByPoint(ri.min),this.boundingBox.expandByPoint(ri.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 yn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(e){const n=this.boundingSphere.center;if(ri.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const c=t[s];ha.setFromBufferAttribute(c),this.morphTargetsRelative?(vn.addVectors(ri.min,ha.min),ri.expandByPoint(vn),vn.addVectors(ri.max,ha.max),ri.expandByPoint(vn)):(ri.expandByPoint(ha.min),ri.expandByPoint(ha.max))}ri.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)vn.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(vn));if(t)for(let s=0,a=t.length;s<a;s++){const c=t[s],u=this.morphTargetsRelative;for(let h=0,f=c.count;h<f;h++)vn.fromBufferAttribute(c,h),u&&(uo.fromBufferAttribute(e,h),vn.add(uo)),i=Math.max(i,n.distanceToSquared(vn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new zt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),c=[],u=[];for(let F=0;F<n.count;F++)c[F]=new D,u[F]=new D;const h=new D,f=new D,p=new D,m=new ue,g=new ue,y=new ue,M=new D,x=new D;function _(F,C,A){h.fromBufferAttribute(n,F),f.fromBufferAttribute(n,C),p.fromBufferAttribute(n,A),m.fromBufferAttribute(s,F),g.fromBufferAttribute(s,C),y.fromBufferAttribute(s,A),f.sub(h),p.sub(h),g.sub(m),y.sub(m);const N=1/(g.x*y.y-y.x*g.y);isFinite(N)&&(M.copy(f).multiplyScalar(y.y).addScaledVector(p,-g.y).multiplyScalar(N),x.copy(p).multiplyScalar(g.x).addScaledVector(f,-y.x).multiplyScalar(N),c[F].add(M),c[C].add(M),c[A].add(M),u[F].add(x),u[C].add(x),u[A].add(x))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let F=0,C=w.length;F<C;++F){const A=w[F],N=A.start,Z=A.count;for(let q=N,K=N+Z;q<K;q+=3)_(e.getX(q+0),e.getX(q+1),e.getX(q+2))}const E=new D,T=new D,U=new D,R=new D;function L(F){U.fromBufferAttribute(i,F),R.copy(U);const C=c[F];E.copy(C),E.sub(U.multiplyScalar(U.dot(C))).normalize(),T.crossVectors(R,C);const N=T.dot(u[F])<0?-1:1;a.setXYZW(F,E.x,E.y,E.z,N)}for(let F=0,C=w.length;F<C;++F){const A=w[F],N=A.start,Z=A.count;for(let q=N,K=N+Z;q<K;q+=3)L(e.getX(q+0)),L(e.getX(q+1)),L(e.getX(q+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new zt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let m=0,g=n.count;m<g;m++)n.setXYZ(m,0,0,0);const i=new D,s=new D,a=new D,c=new D,u=new D,h=new D,f=new D,p=new D;if(e)for(let m=0,g=e.count;m<g;m+=3){const y=e.getX(m+0),M=e.getX(m+1),x=e.getX(m+2);i.fromBufferAttribute(t,y),s.fromBufferAttribute(t,M),a.fromBufferAttribute(t,x),f.subVectors(a,s),p.subVectors(i,s),f.cross(p),c.fromBufferAttribute(n,y),u.fromBufferAttribute(n,M),h.fromBufferAttribute(n,x),c.add(f),u.add(f),h.add(f),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(M,u.x,u.y,u.z),n.setXYZ(x,h.x,h.y,h.z)}else for(let m=0,g=t.count;m<g;m+=3)i.fromBufferAttribute(t,m+0),s.fromBufferAttribute(t,m+1),a.fromBufferAttribute(t,m+2),f.subVectors(a,s),p.subVectors(i,s),f.cross(p),n.setXYZ(m+0,f.x,f.y,f.z),n.setXYZ(m+1,f.x,f.y,f.z),n.setXYZ(m+2,f.x,f.y,f.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)vn.fromBufferAttribute(e,t),vn.normalize(),e.setXYZ(t,vn.x,vn.y,vn.z)}toNonIndexed(){function e(c,u){const h=c.array,f=c.itemSize,p=c.normalized,m=new h.constructor(u.length*f);let g=0,y=0;for(let M=0,x=u.length;M<x;M++){c.isInterleavedBufferAttribute?g=u[M]*c.data.stride+c.offset:g=u[M]*f;for(let _=0;_<f;_++)m[y++]=h[g++]}return new zt(m,f,p)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new xt,n=this.index.array,i=this.attributes;for(const c in i){const u=i[c],h=e(u,n);t.setAttribute(c,h)}const s=this.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,p=h.length;f<p;f++){const m=h[f],g=e(m,n);u.push(g)}t.morphAttributes[c]=u}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const i={};let s=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],f=[];for(let p=0,m=h.length;p<m;p++){const g=h[p];f.push(g.toJSON(e.data))}f.length>0&&(i[u]=f,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const h in i){const f=i[h];this.setAttribute(h,f.clone(t))}const s=e.morphAttributes;for(const h in s){const f=[],p=s[h];for(let m=0,g=p.length;m<g;m++)f.push(p[m].clone(t));this.morphAttributes[h]=f}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let h=0,f=a.length;h<f;h++){const p=a[h];this.addGroup(p.start,p.count,p.materialIndex)}const c=e.boundingBox;c!==null&&(this.boundingBox=c.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Zg=new ut,ss=new Os,xc=new yn,jg=new D,Sc=new D,Mc=new D,Ec=new D,id=new D,wc=new D,Jg=new D,Tc=new D;class nn extends Dt{constructor(e=new xt,t=new Wr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const c=this.morphTargetInfluences;if(s&&c){wc.set(0,0,0);for(let u=0,h=s.length;u<h;u++){const f=c[u],p=s[u];f!==0&&(id.fromBufferAttribute(p,e),a?wc.addScaledVector(id,f):wc.addScaledVector(id.sub(t),f))}t.add(wc)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),xc.copy(n.boundingSphere),xc.applyMatrix4(s),ss.copy(e.ray).recast(e.near),!(xc.containsPoint(ss.origin)===!1&&(ss.intersectSphere(xc,jg)===null||ss.origin.distanceToSquared(jg)>(e.far-e.near)**2))&&(Zg.copy(s).invert(),ss.copy(e.ray).applyMatrix4(Zg),!(n.boundingBox!==null&&ss.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ss)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,c=s.index,u=s.attributes.position,h=s.attributes.uv,f
vendor: 7,697 bytes, lines 21-25
21=s.attributes.uv1,p=s.attributes.normal,m=s.groups,g=s.drawRange;if(c!==null)if(Array.isArray(a))for(let y=0,M=m.length;y<M;y++){const x=m[y],_=a[x.materialIndex],w=Math.max(x.start,g.start),E=Math.min(c.count,Math.min(x.start+x.count,g.start+g.count));for(let T=w,U=E;T<U;T+=3){const R=c.getX(T),L=c.getX(T+1),F=c.getX(T+2);i=bc(this,_,e,n,h,f,p,R,L,F),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=x.materialIndex,t.push(i))}}else{const y=Math.max(0,g.start),M=Math.min(c.count,g.start+g.count);for(let x=y,_=M;x<_;x+=3){const w=c.getX(x),E=c.getX(x+1),T=c.getX(x+2);i=bc(this,a,e,n,h,f,p,w,E,T),i&&(i.faceIndex=Math.floor(x/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(a))for(let y=0,M=m.length;y<M;y++){const x=m[y],_=a[x.materialIndex],w=Math.max(x.start,g.start),E=Math.min(u.count,Math.min(x.start+x.count,g.start+g.count));for(let T=w,U=E;T<U;T+=3){const R=T,L=T+1,F=T+2;i=bc(this,_,e,n,h,f,p,R,L,F),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=x.materialIndex,t.push(i))}}else{const y=Math.max(0,g.start),M=Math.min(u.count,g.start+g.count);for(let x=y,_=M;x<_;x+=3){const w=x,E=x+1,T=x+2;i=bc(this,a,e,n,h,f,p,w,E,T),i&&(i.faceIndex=Math.floor(x/3),t.push(i))}}}}function zM(r,e,t,n,i,s,a,c){let u;if(e.side===Hn?u=n.intersectTriangle(a,s,i,!0,c):u=n.intersectTriangle(i,s,a,e.side===vr,c),u===null)return null;Tc.copy(c),Tc.applyMatrix4(r.matrixWorld);const h=t.ray.origin.distanceTo(Tc);return h<t.near||h>t.far?null:{distance:h,point:Tc.clone(),object:r}}function bc(r,e,t,n,i,s,a,c,u,h){r.getVertexPosition(c,Sc),r.getVertexPosition(u,Mc),r.getVertexPosition(h,Ec);const f=zM(r,e,t,n,Sc,Mc,Ec,Jg);if(f){const p=new D;Jn.getBarycoord(Jg,Sc,Mc,Ec,p),i&&(f.uv=Jn.getInterpolatedAttribute(i,c,u,h,p,new ue)),s&&(f.uv1=Jn.getInterpolatedAttribute(s,c,u,h,p,new ue)),a&&(f.normal=Jn.getInterpolatedAttribute(a,c,u,h,p,new D),f.normal.dot(n.direction)>0&&f.normal.multiplyScalar(-1));const m={a:c,b:u,c:h,normal:new D,materialIndex:0};Jn.getNormal(Sc,Mc,Ec,m.normal),f.face=m,f.barycoord=p}return f}class Fs extends xt{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const c=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const u=[],h=[],f=[],p=[];let m=0,g=0;y("z","y","x",-1,-1,n,t,e,a,s,0),y("z","y","x",1,-1,n,t,-e,a,s,1),y("x","z","y",1,1,e,n,t,i,a,2),y("x","z","y",1,-1,e,n,-t,i,a,3),y("x","y","z",1,-1,e,t,n,i,s,4),y("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(u),this.setAttribute("position",new Ze(h,3)),this.setAttribute("normal",new Ze(f,3)),this.setAttribute("uv",new Ze(p,2));function y(M,x,_,w,E,T,U,R,L,F,C){const A=T/L,N=U/F,Z=T/2,q=U/2,K=R/2,ce=L+1,Q=F+1;let ve=0,V=0;const re=new D;for(let ie=0;ie<Q;ie++){const de=ie*N-q;for(let Re=0;Re<ce;Re++){const Xe=Re*A-Z;re[M]=Xe*w,re[x]=de*E,re[_]=K,h.push(re.x,re.y,re.z),re[M]=0,re[x]=0,re[_]=R>0?1:-1,f.push(re.x,re.y,re.z),p.push(Re/L),p.push(1-ie/F),ve+=1}}for(let ie=0;ie<F;ie++)for(let de=0;de<L;de++){const Re=m+de+ce*ie,Xe=m+de+ce*(ie+1),se=m+(de+1)+ce*(ie+1),_e=m+(de+1)+ce*ie;u.push(Re,Xe,_e),u.push(Xe,se,_e),V+=6}c.addGroup(g,V,C),g+=V,m+=ve}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Uo(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function kn(r){const e={};for(let t=0;t<r.length;t++){const n=Uo(r[t]);for(const i in n)e[i]=n[i]}return e}function kM(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function D_(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Pt.workingColorSpace}const qu={clone:Uo,merge:kn};var VM=`void main() {
22	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
23}`,HM=`void main() {
24	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
25}`;class _i extends Nn{static get type(){return"ShaderMaterial"}constructor(e){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=VM,this.fragmentShader=HM,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Uo(e.uniforms),this.uniformsGroups=kM(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class nl extends Dt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ut,this.projectionMatrix=new ut,this.projectionMatrixInverse=new ut,this.coordinateSystem=Yi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Fr=new D,Kg=new ue,Qg=new ue;class tn extends nl{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Do*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(As*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,387 bytes, line 25
25getEffectiveFOV(){return Do*2*Math.atan(Math.tan(As*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Fr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Fr.x,Fr.y).multiplyScalar(-e/Fr.z),Fr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Fr.x,Fr.y).multiplyScalar(-e/Fr.z)}getViewSize(e,t){return this.getViewBounds(e,Kg,Qg),t.subVectors(Qg,Kg)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(As*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const u=a.fullWidth,h=a.fullHeight;s+=a.offsetX*i/u,t-=a.offsetY*n/h,i*=a.width/u,n*=a.height/h}const c=this.filmOffset;c!==0&&(s+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ho=-90,fo=1;class U_ extends Dt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new tn(ho,fo,e,t);i.layers=this.layers,this.add(i);const s=new tn(ho,fo,e,t);s.layers=this.layers,this.add(s);const a=new tn(ho,fo,e,t);a.layers=this.layers,this.add(a);const c=new tn(ho,fo,e,t);c.layers=this.layers,this.add(c);const u=new tn(ho,fo,e,t);u.layers=this.layers,this.add(u);const h=new tn(ho,fo,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,c,u]=t;for(const h of t)this.remove(h);if(e===Yi)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===Ha)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,c,u,h,f]=this.children,p=e.getRenderTarget(),m=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const M=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,c),e.setRenderTarget(n,3,i),e.render(t,u),e.setRenderTarget(n,4,i),e.render(t,h),n.texture.generateMipmaps=M,e.setRenderTarget(n,5,i),e.render(t,f),e.setRenderTarget(p,m,g),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}}class il extends Kt{constructor(e,t,n,i,s,a,c,u,h,f){e=e!==void 0?e:[],t=t!==void 0?t:_r,super(e,t,n,i,s,a,c,u,h,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class N_ extends Ci{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new il(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:cn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 10,258 bytes, lines 25-119
25=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
26
27				varying vec3 vWorldDirection;
28
29				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
30
31					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
32
33				}
34
35				void main() {
36
37					vWorldDirection = transformDirection( position, modelMatrix );
38
39					#include <begin_vertex>
40					#include <project_vertex>
41
42				}
43			`,fragmentShader:`
44
45				uniform sampler2D tEquirect;
46
47				varying vec3 vWorldDirection;
48
49				#include <common>
50
51				void main() {
52
53					vec3 direction = normalize( vWorldDirection );
54
55					vec2 sampleUV = equirectUv( direction );
56
57					gl_FragColor = texture2D( tEquirect, sampleUV );
58
59				}
60			`},i=new Fs(5,5,5),s=new _i({name:"CubemapFromEquirect",uniforms:Uo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Hn,blending:mr});s.uniforms.tEquirect.value=t;const a=new nn(i,s),c=t.minFilter;return t.minFilter===Xi&&(t.minFilter=cn),new U_(1,10,this).update(e,a),t.minFilter=c,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}const rd=new D,GM=new D,WM=new gt;class hr{constructor(e=new D(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=rd.subVectors(n,t).cross(GM.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(rd),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||WM.getNormalMatrix(e),i=this.coplanarPoint(rd).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const os=new yn,Ac=new D;class rl{constructor(e=new hr,t=new hr,n=new hr,i=new hr,s=new hr,a=new hr){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(s),c[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Yi){const n=this.planes,i=e.elements,s=i[0],a=i[1],c=i[2],u=i[3],h=i[4],f=i[5],p=i[6],m=i[7],g=i[8],y=i[9],M=i[10],x=i[11],_=i[12],w=i[13],E=i[14],T=i[15];if(n[0].setComponents(u-s,m-h,x-g,T-_).normalize(),n[1].setComponents(u+s,m+h,x+g,T+_).normalize(),n[2].setComponents(u+a,m+f,x+y,T+w).normalize(),n[3].setComponents(u-a,m-f,x-y,T-w).normalize(),n[4].setComponents(u-c,m-p,x-M,T-E).normalize(),t===Yi)n[5].setComponents(u+c,m+p,x+M,T+E).normalize();else if(t===Ha)n[5].setComponents(c,p,M,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),os.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),os.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(os)}intersectsSprite(e){return os.center.set(0,0,0),os.radius=.7071067811865476,os.applyMatrix4(e.matrixWorld),this.intersectsSphere(os)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Ac.x=i.normal.x>0?e.max.x:e.min.x,Ac.y=i.normal.y>0?e.max.y:e.min.y,Ac.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ac)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function O_(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function XM(r){const e=new WeakMap;function t(c,u){const h=c.array,f=c.usage,p=h.byteLength,m=r.createBuffer();r.bindBuffer(u,m),r.bufferData(u,h,f),c.onUploadCallback();let g;if(h instanceof Float32Array)g=r.FLOAT;else if(h instanceof Uint16Array)c.isFloat16BufferAttribute?g=r.HALF_FLOAT:g=r.UNSIGNED_SHORT;else if(h instanceof Int16Array)g=r.SHORT;else if(h instanceof Uint32Array)g=r.UNSIGNED_INT;else if(h instanceof Int32Array)g=r.INT;else if(h instanceof Int8Array)g=r.BYTE;else if(h instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version,size:p}}function n(c,u,h){const f=u.array,p=u.updateRanges;if(r.bindBuffer(h,c),p.length===0)r.bufferSubData(h,0,f);else{p.sort((g,y)=>g.start-y.start);let m=0;for(let g=1;g<p.length;g++){const y=p[m],M=p[g];M.start<=y.start+y.count+1?y.count=Math.max(y.count,M.start+M.count-y.start):(++m,p[m]=M)}p.length=m+1;for(let g=0,y=p.length;g<y;g++){const M=p[g];r.bufferSubData(h,M.start*f.BYTES_PER_ELEMENT,f,M.start,M.count)}u.clearUpdateRanges()}u.onUploadCallback()}function i(c){return c.isInterleavedBufferAttribute&&(c=c.data),e.get(c)}function s(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=e.get(c);u&&(r.deleteBuffer(u.buffer),e.delete(c))}function a(c,u){if(c.isInterleavedBufferAttribute&&(c=c.data),c.isGLBufferAttribute){const f=e.get(c);(!f||f.version<c.version)&&e.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}const h=e.get(c);if(h===void 0)e.set(c,t(c,u));else if(h.version<c.version){if(h.size!==c.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(h.buffer,c,u),h.version=c.version}}return{get:i,remove:s,update:a}}class ko extends xt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,c=Math.floor(n),u=Math.floor(i),h=c+1,f=u+1,p=e/c,m=t/u,g=[],y=[],M=[],x=[];for(let _=0;_<f;_++){const w=_*m-a;for(let E=0;E<h;E++){const T=E*p-s;y.push(T,-w,0),M.push(0,0,1),x.push(E/c),x.push(1-_/u)}}for(let _=0;_<u;_++)for(let w=0;w<c;w++){const E=w+h*_,T=w+h*(_+1),U=w+1+h*(_+1),R=w+1+h*_;g.push(E,T,R),g.push(T,U,R)}this.setIndex(g),this.setAttribute("position",new Ze(y,3)),this.setAttribute("normal",new Ze(M,3)),this.setAttribute("uv",new Ze(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ko(e.width,e.height,e.widthSegments,e.heightSegments)}}var YM=`#ifdef USE_ALPHAHASH
61	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
62#endif`,qM=`#ifdef USE_ALPHAHASH
63	const float ALPHA_HASH_SCALE = 0.05;
64	float hash2D( vec2 value ) {
65		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
66	}
67	float hash3D( vec3 value ) {
68		return hash2D( vec2( hash2D( value.xy ), value.z ) );
69	}
70	float getAlphaHashThreshold( vec3 position ) {
71		float maxDeriv = max(
72			length( dFdx( position.xyz ) ),
73			length( dFdy( position.xyz ) )
74		);
75		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
76		vec2 pixScales = vec2(
77			exp2( floor( log2( pixScale ) ) ),
78			exp2( ceil( log2( pixScale ) ) )
79		);
80		vec2 alpha = vec2(
81			hash3D( floor( pixScales.x * position.xyz ) ),
82			hash3D( floor( pixScales.y * position.xyz ) )
83		);
84		float lerpFactor = fract( log2( pixScale ) );
85		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
86		float a = min( lerpFactor, 1.0 - lerpFactor );
87		vec3 cases = vec3(
88			x * x / ( 2.0 * a * ( 1.0 - a ) ),
89			( x - 0.5 * a ) / ( 1.0 - a ),
90			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
91		);
92		float threshold = ( x < ( 1.0 - a ) )
93			? ( ( x < a ) ? cases.x : cases.y )
94			: cases.z;
95		return clamp( threshold , 1.0e-6, 1.0 );
96	}
97#endif`,ZM=`#ifdef USE_ALPHAMAP
98	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
99#endif`,jM=`#ifdef USE_ALPHAMAP
100	uniform sampler2D alphaMap;
101#endif`,JM=`#ifdef USE_ALPHATEST
102	#ifdef ALPHA_TO_COVERAGE
103	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
104	if ( diffuseColor.a == 0.0 ) discard;
105	#else
106	if ( diffuseColor.a < alphaTest ) discard;
107	#endif
108#endif`,KM=`#ifdef USE_ALPHATEST
109	uniform float alphaTest;
110#endif`,QM=`#ifdef USE_AOMAP
111	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
112	reflectedLight.indirectDiffuse *= ambientOcclusion;
113	#if defined( USE_CLEARCOAT ) 
114		clearcoatSpecularIndirect *= ambientOcclusion;
115	#endif
116	#if defined( USE_SHEEN ) 
117		sheenSpecularIndirect *= ambientOcclusion;
118	#endif
119	#if defined( USE_ENVMAP ) && defined( STANDARD )
120		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
121		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
122	#endif
123#endif`,$M=`#ifdef USE_AOMAP
124	uniform sampler2D aoMap;
125	uniform float aoMapIntensity;
126#endif`,e1=`#ifdef USE_BATCHING
127	#if ! defined( GL_ANGLE_multi_draw )
128	#define gl_DrawID _gl_DrawID
129	uniform int _gl_DrawID;
130	#endif
131	uniform highp sampler2D batchingTexture;
132	uniform highp usampler2D batchingIdTexture;
133	mat4 getBatchingMatrix( const in float i ) {
134		int size = textureSize( batchingTexture, 0 ).x;
135		int j = int( i ) * 4;
136		int x = j % size;
137		int y = j / size;
138		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
139		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
140		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
141		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
142		return mat4( v1, v2, v3, v4 );
143	}
144	float getIndirectIndex( const in int i ) {
145		int size = textureSize( batchingIdTexture, 0 ).x;
146		int x = i % size;
147		int y = i / size;
148		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
149	}
150#endif
151#ifdef USE_BATCHING_COLOR
152	uniform sampler2D batchingColorTexture;
153	vec3 getBatchingColor( const in float i ) {
154		int size = textureSize( batchingColorTexture, 0 ).x;
155		int j = int( i );
156		int x = j % size;
157		int y = j / size;
158		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
159	}
160#endif`,t1=`#ifdef USE_BATCHING
161	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
162#endif`,n1=`vec3 transformed = vec3( position );
163#ifdef USE_ALPHAHASH
164	vPosition = vec3( position );
165#endif`,i1=`vec3 objectNormal = vec3( normal );
166#ifdef USE_TANGENT
167	vec3 objectTangent = vec3( tangent.xyz );
168#endif`,r1=`float G_BlinnPhong_Implicit( ) {
169	return 0.25;
170}
171float D_BlinnPhong( const in float shininess, const in float dotNH ) {
172	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
173}
174vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
175	vec3 halfDir = normalize( lightDir + viewDir );
176	float dotNH = saturate( dot( normal, halfDir ) );
177	float dotVH = saturate( dot( viewDir, halfDir ) );
178	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
179	float G = G_BlinnPhong_Implicit( );
180	float D = D_BlinnPhong( shininess, dotNH );
181	return F * ( G * D );
182} // validated`,s1=`#ifdef USE_IRIDESCENCE
183	const mat3 XYZ_TO_REC709 = mat3(
184		 3.2404542, -0.9692660,  0.0556434,
185		-1.5371385,  1.8760108, -0.2040259,
186		-0.4985314,  0.0415560,  1.0572252
187	);
188	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
189		vec3 sqrtF0 = sqrt( fresnel0 );
190		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
191	}
192	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
193		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
194	}
195	float IorToFresnel0( float transmittedIor, float incidentIor ) {
196		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
197	}
198	vec3 evalSensitivity( float OPD, vec3 shift ) {
199		float phase = 2.0 * PI * OPD * 1.0e-9;
200		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
201		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
202		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
203		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
204		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 ) );
205		xyz /= 1.0685e-7;
206		vec3 rgb = XYZ_TO_REC709 * xyz;
207		return rgb;
208	}
209	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
210		vec3 I;
211		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
212		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
213		float cosTheta2Sq = 1.0 - sinTheta2Sq;
214		if ( cosTheta2Sq < 0.0 ) {
215			return vec3( 1.0 );
216		}
217		float cosTheta2 = sqrt( cosTheta2Sq );
218		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
219		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
220		float T121 = 1.0 - R12;
221		float phi12 = 0.0;
222		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
223		float phi21 = PI - phi12;
224		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
225		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
226		vec3 phi23 = vec3( 0.0 );
227		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
228		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
229		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
230		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
231		vec3 phi = vec3( phi21 ) + phi23;
232		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
233		vec3 r123 = sqrt( R123 );
234		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
235		vec3 C0 = R12 + Rs;
236		I = C0;
237		vec3 Cm = Rs - T121;
238		for ( int m = 1; m <= 2; ++ m ) {
239			Cm *= r123;
240			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
241			I += Cm * Sm;
242		}
243		return max( I, vec3( 0.0 ) );
244	}
245#endif`,o1=`#ifdef USE_BUMPMAP
246	uniform sampler2D bumpMap;
247	uniform float bumpScale;
248	vec2 dHdxy_fwd() {
249		vec2 dSTdx = dFdx( vBumpMapUv );
250		vec2 dSTdy = dFdy( vBumpMapUv );
251		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
252		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
253		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
254		return vec2( dBx, dBy );
255	}
256	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
257		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
258		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
259		vec3 vN = surf_norm;
260		vec3 R1 = cross( vSigmaY, vN );
261		vec3 R2 = cross( vN, vSigmaX );
262		float fDet = dot( vSigmaX, R1 ) * faceDirection;
263		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
264		return normalize( abs( fDet ) * surf_norm - vGrad );
265	}
266#endif`,a1=`#if NUM_CLIPPING_PLANES > 0
267	vec4 plane;
268	#ifdef ALPHA_TO_COVERAGE
269		float distanceToPlane, distanceGradient;
270		float clipOpacity = 1.0;
271		#pragma unroll_loop_start
272		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
273			plane = clippingPlanes[ i ];
274			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
275			distanceGradient = fwidth( distanceToPlane ) / 2.0;
276			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
277			if ( clipOpacity == 0.0 ) discard;
278		}
279		#pragma unroll_loop_end
280		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
281			float unionClipOpacity = 1.0;
282			#pragma unroll_loop_start
283			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
284				plane = clippingPlanes[ i ];
285				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
286				distanceGradient = fwidth( distanceToPlane ) / 2.0;
287				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
288			}
289			#pragma unroll_loop_end
290			clipOpacity *= 1.0 - unionClipOpacity;
291		#endif
292		diffuseColor.a *= clipOpacity;
293		if ( diffuseColor.a == 0.0 ) discard;
294	#else
295		#pragma unroll_loop_start
296		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
297			plane = clippingPlanes[ i ];
298			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
299		}
300		#pragma unroll_loop_end
301		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
302			bool clipped = true;
303			#pragma unroll_loop_start
304			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
305				plane = clippingPlanes[ i ];
306				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
307			}
308			#pragma unroll_loop_end
309			if ( clipped ) discard;
310		#endif
311	#endif
312#endif`,l1=`#if NUM_CLIPPING_PLANES > 0
313	varying vec3 vClipPosition;
314	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
315#endif`,c1=`#if NUM_CLIPPING_PLANES > 0
316	varying vec3 vClipPosition;
317#endif`,u1=`#if NUM_CLIPPING_PLANES > 0
318	vClipPosition = - mvPosition.xyz;
319#endif`,h1=`#if defined( USE_COLOR_ALPHA )
320	diffuseColor *= vColor;
321#elif defined( USE_COLOR )
322	diffuseColor.rgb *= vColor;
323#endif`,f1=`#if defined( USE_COLOR_ALPHA )
324	varying vec4 vColor;
325#elif defined( USE_COLOR )
326	varying vec3 vColor;
327#endif`,d1=`#if defined( USE_COLOR_ALPHA )
328	varying vec4 vColor;
329#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
330	varying vec3 vColor;
331#endif`,p1=`#if defined( USE_COLOR_ALPHA )
332	vColor = vec4( 1.0 );
333#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
334	vColor = vec3( 1.0 );
335#endif
336#ifdef USE_COLOR
337	vColor *= color;
338#endif
339#ifdef USE_INSTANCING_COLOR
340	vColor.xyz *= instanceColor.xyz;
341#endif
342#ifdef USE_BATCHING_COLOR
343	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
344	vColor.xyz *= batchingColor.xyz;
345#endif`,m1=`#define PI 3.141592653589793
346#define PI2 6.283185307179586
347#define PI_HALF 1.5707963267948966
348#define RECIPROCAL_PI 0.3183098861837907
349#define RECIPROCAL_PI2 0.15915494309189535
350#define EPSILON 1e-6
351#ifndef saturate
352#define saturate( a ) clamp( a, 0.0, 1.0 )
353#endif
354#define whiteComplement( a ) ( 1.0 - saturate( a ) )
355float pow2( const in float x ) { return x*x; }
356vec3 pow2( const in vec3 x ) { return x*x; }
357float pow3( const in float x ) { return x*x*x; }
358float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
359float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
360float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
361highp float rand( const in vec2 uv ) {
362	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
363	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
364	return fract( sin( sn ) * c );
365}
366#ifdef HIGH_PRECISION
367	float precisionSafeLength( vec3 v ) { return length( v ); }
368#else
369	float precisionSafeLength( vec3 v ) {
370		float maxComponent = max3( abs( v ) );
371		return length( v / maxComponent ) * maxComponent;
372	}
373#endif
374struct IncidentLight {
375	vec3 color;
376	vec3 direction;
377	bool visible;
378};
379struct ReflectedLight {
380	vec3 directDiffuse;
381	vec3 directSpecular;
382	vec3 indirectDiffuse;
383	vec3 indirectSpecular;
384};
385#ifdef USE_ALPHAHASH
386	varying vec3 vPosition;
387#endif
388vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
389	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
390}
391vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
392	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
393}
394mat3 transposeMat3( const in mat3 m ) {
395	mat3 tmp;
396	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
397	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
398	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
399	return tmp;
400}
401bool isPerspectiveMatrix( mat4 m ) {
402	return m[ 2 ][ 3 ] == - 1.0;
403}
404vec2 equirectUv( in vec3 dir ) {
405	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
406	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
407	return vec2( u, v );
408}
409vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
410	return RECIPROCAL_PI * diffuseColor;
411}
412vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
413	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
414	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
415}
416float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
417	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
418	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
419} // validated`,g1=`#ifdef ENVMAP_TYPE_CUBE_UV
420	#define cubeUV_minMipLevel 4.0
421	#define cubeUV_minTileSize 16.0
422	float getFace( vec3 direction ) {
423		vec3 absDirection = abs( direction );
424		float face = - 1.0;
425		if ( absDirection.x > absDirection.z ) {
426			if ( absDirection.x > absDirection.y )
427				face = direction.x > 0.0 ? 0.0 : 3.0;
428			else
429				face = direction.y > 0.0 ? 1.0 : 4.0;
430		} else {
431			if ( absDirection.z > absDirection.y )
432				face = direction.z > 0.0 ? 2.0 : 5.0;
433			else
434				face = direction.y > 0.0 ? 1.0 : 4.0;
435		}
436		return face;
437	}
438	vec2 getUV( vec3 direction, float face ) {
439		vec2 uv;
440		if ( face == 0.0 ) {
441			uv = vec2( direction.z, direction.y ) / abs( direction.x );
442		} else if ( face == 1.0 ) {
443			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
444		} else if ( face == 2.0 ) {
445			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
446		} else if ( face == 3.0 ) {
447			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
448		} else if ( face == 4.0 ) {
449			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
450		} else {
451			uv = vec2( direction.x, direction.y ) / abs( direction.z );
452		}
453		return 0.5 * ( uv + 1.0 );
454	}
455	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
456		float face = getFace( direction );
457		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
458		mipInt = max( mipInt, cubeUV_minMipLevel );
459		float faceSize = exp2( mipInt );
460		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
461		if ( face > 2.0 ) {
462			uv.y += faceSize;
463			face -= 3.0;
464		}
465		uv.x += face * faceSize;
466		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
467		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
468		uv.x *= CUBEUV_TEXEL_WIDTH;
469		uv.y *= CUBEUV_TEXEL_HEIGHT;
470		#ifdef texture2DGradEXT
471			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
472		#else
473			return texture2D( envMap, uv ).rgb;
474		#endif
475	}
476	#define cubeUV_r0 1.0
477	#define cubeUV_m0 - 2.0
478	#define cubeUV_r1 0.8
479	#define cubeUV_m1 - 1.0
480	#define cubeUV_r4 0.4
481	#define cubeUV_m4 2.0
482	#define cubeUV_r5 0.305
483	#define cubeUV_m5 3.0
484	#define cubeUV_r6 0.21
485	#define cubeUV_m6 4.0
486	float roughnessToMip( float roughness ) {
487		float mip = 0.0;
488		if ( roughness >= cubeUV_r1 ) {
489			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
490		} else if ( roughness >= cubeUV_r4 ) {
491			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
492		} else if ( roughness >= cubeUV_r5 ) {
493			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
494		} else if ( roughness >= cubeUV_r6 ) {
495			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
496		} else {
497			mip = - 2.0 * log2( 1.16 * roughness );		}
498		return mip;
499	}
500	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
501		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
502		float mipF = fract( mip );
503		float mipInt = floor( mip );
504		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
505		if ( mipF == 0.0 ) {
506			return vec4( color0, 1.0 );
507		} else {
508			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
509			return vec4( mix( color0, color1, mipF ), 1.0 );
510		}
511	}
512#endif`,v1=`vec3 transformedNormal = objectNormal;
513#ifdef USE_TANGENT
514	vec3 transformedTangent = objectTangent;
515#endif
516#ifdef USE_BATCHING
517	mat3 bm = mat3( batchingMatrix );
518	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
519	transformedNormal = bm * transformedNormal;
520	#ifdef USE_TANGENT
521		transformedTangent = bm * transformedTangent;
522	#endif
523#endif
524#ifdef USE_INSTANCING
525	mat3 im = mat3( instanceMatrix );
526	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
527	transformedNormal = im * transformedNormal;
528	#ifdef USE_TANGENT
529		transformedTangent = im * transformedTangent;
530	#endif
531#endif
532transformedNormal = normalMatrix * transformedNormal;
533#ifdef FLIP_SIDED
534	transformedNormal = - transformedNormal;
535#endif
536#ifdef USE_TANGENT
537	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
538	#ifdef FLIP_SIDED
539		transformedTangent = - transformedTangent;
540	#endif
541#endif`,_1=`#ifdef USE_DISPLACEMENTMAP
542	uniform sampler2D displacementMap;
543	uniform float displacementScale;
544	uniform float displacementBias;
545#endif`,y1=`#ifdef USE_DISPLACEMENTMAP
546	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
546placementBias );
547#endif`,x1=`#ifdef USE_EMISSIVEMAP
548	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
549	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
550		emissiveColor = sRGBTransferEOTF( emissiveColor );
551	#endif
552	totalEmissiveRadiance *= emissiveColor.rgb;
553#endif`,S1=`#ifdef USE_EMISSIVEMAP
554	uniform sampler2D emissiveMap;
555#endif`,M1="gl_FragColor = linearToOutputTexel( gl_FragColor );",E1=`vec4 LinearTransferOETF( in vec4 value ) {
556	return value;
557}
558vec4 sRGBTransferEOTF( in vec4 value ) {
559	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
560}
561vec4 sRGBTransferOETF( in vec4 value ) {
562	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 );
563}`,w1=`#ifdef USE_ENVMAP
564	#ifdef ENV_WORLDPOS
565		vec3 cameraToFrag;
566		if ( isOrthographic ) {
567			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
568		} else {
569			cameraToFrag = normalize( vWorldPosition - cameraPosition );
570		}
571		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
572		#ifdef ENVMAP_MODE_REFLECTION
573			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
574		#else
575			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
576		#endif
577	#else
578		vec3 reflectVec = vReflect;
579	#endif
580	#ifdef ENVMAP_TYPE_CUBE
581		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
582	#else
583		vec4 envColor = vec4( 0.0 );
584	#endif
585	#ifdef ENVMAP_BLENDING_MULTIPLY
586		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
587	#elif defined( ENVMAP_BLENDING_MIX )
588		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
589	#elif defined( ENVMAP_BLENDING_ADD )
590		outgoingLight += envColor.xyz * specularStrength * reflectivity;
591	#endif
592#endif`,T1=`#ifdef USE_ENVMAP
593	uniform float envMapIntensity;
594	uniform float flipEnvMap;
595	uniform mat3 envMapRotation;
596	#ifdef ENVMAP_TYPE_CUBE
597		uniform samplerCube envMap;
598	#else
599		uniform sampler2D envMap;
600	#endif
601	
602#endif`,b1=`#ifdef USE_ENVMAP
603	uniform float reflectivity;
604	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
605		#define ENV_WORLDPOS
606	#endif
607	#ifdef ENV_WORLDPOS
608		varying vec3 vWorldPosition;
609		uniform float refractionRatio;
610	#else
611		varying vec3 vReflect;
612	#endif
613#endif`,A1=`#ifdef USE_ENVMAP
614	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
615		#define ENV_WORLDPOS
616	#endif
617	#ifdef ENV_WORLDPOS
618		
619		varying vec3 vWorldPosition;
620	#else
621		varying vec3 vReflect;
622		uniform float refractionRatio;
623	#endif
624#endif`,C1=`#ifdef USE_ENVMAP
625	#ifdef ENV_WORLDPOS
626		vWorldPosition = worldPosition.xyz;
627	#else
628		vec3 cameraToVertex;
629		if ( isOrthographic ) {
630			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
631		} else {
632			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
633		}
634		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
635		#ifdef ENVMAP_MODE_REFLECTION
636			vReflect = reflect( cameraToVertex, worldNormal );
637		#else
638			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
639		#endif
640	#endif
641#endif`,R1=`#ifdef USE_FOG
642	vFogDepth = - mvPosition.z;
643#endif`,P1=`#ifdef USE_FOG
644	varying float vFogDepth;
645#endif`,I1=`#ifdef USE_FOG
646	#ifdef FOG_EXP2
647		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
648	#else
649		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
650	#endif
651	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
652#endif`,L1=`#ifdef USE_FOG
653	uniform vec3 fogColor;
654	varying float vFogDepth;
655	#ifdef FOG_EXP2
656		uniform float fogDensity;
657	#else
658		uniform float fogNear;
659		uniform float fogFar;
660	#endif
661#endif`,D1=`#ifdef USE_GRADIENTMAP
662	uniform sampler2D gradientMap;
663#endif
664vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
665	float dotNL = dot( normal, lightDirection );
666	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
667	#ifdef USE_GRADIENTMAP
668		return vec3( texture2D( gradientMap, coord ).r );
669	#else
670		vec2 fw = fwidth( coord ) * 0.5;
671		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
672	#endif
673}`,U1=`#ifdef USE_LIGHTMAP
674	uniform sampler2D lightMap;
675	uniform float lightMapIntensity;
676#endif`,N1=`LambertMaterial material;
677material.diffuseColor = diffuseColor.rgb;
678material.specularStrength = specularStrength;`,O1=`varying vec3 vViewPosition;
679struct LambertMaterial {
680	vec3 diffuseColor;
681	float specularStrength;
682};
683void 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 ) {
684	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
685	vec3 irradiance = dotNL * directLight.color;
686	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
687}
688void 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 ) {
689	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
690}
691#define RE_Direct				RE_Direct_Lambert
692#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,F1=`uniform bool receiveShadow;
693uniform vec3 ambientLightColor;
694#if defined( USE_LIGHT_PROBES )
695	uniform vec3 lightProbe[ 9 ];
696#endif
697vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
698	float x = normal.x, y = normal.y, z = normal.z;
699	vec3 result = shCoefficients[ 0 ] * 0.886227;
700	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
701	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
702	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
703	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
704	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
705	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
706	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
707	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
708	return result;
709}
710vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
711	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
712	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
713	return irradiance;
714}
715vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
716	vec3 irradiance = ambientLightColor;
717	return irradiance;
718}
719float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
720	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
721	if ( cutoffDistance > 0.0 ) {
722		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
723	}
724	return distanceFalloff;
725}
726float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
727	return smoothstep( coneCosine, penumbraCosine, angleCosine );
728}
729#if NUM_DIR_LIGHTS > 0
730	struct DirectionalLight {
731		vec3 direction;
732		vec3 color;
733	};
734	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
735	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
736		light.color = directionalLight.color;
737		light.direction = directionalLight.direction;
738		light.visible = true;
739	}
740#endif
741#if NUM_POINT_LIGHTS > 0
742	struct PointLight {
743		vec3 position;
744		vec3 color;
745		float distance;
746		float decay;
747	};
748	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
749	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
750		vec3 lVector = pointLight.position - geometryPosition;
751		light.direction = normalize( lVector );
752		float lightDistance = length( lVector );
753		light.color = pointLight.color;
754		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
755		light.visible = ( light.color != vec3( 0.0 ) );
756	}
757#endif
758#if NUM_SPOT_LIGHTS > 0
759	struct SpotLight {
760		vec3 position;
761		vec3 direction;
762		vec3 color;
763		float distance;
764		float decay;
765		float coneCos;
766		float penumbraCos;
767	};
768	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
769	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
770		vec3 lVector = spotLight.position - geometryPosition;
771		light.direction = normalize( lVector );
772		float angleCos = dot( light.direction, spotLight.direction );
773		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
774		if ( spotAttenuation > 0.0 ) {
775			float lightDistance = length( lVector );
776			light.color = spotLight.color * spotAttenuation;
777			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
778			light.visible = ( light.color != vec3( 0.0 ) );
779		} else {
780			light.color = vec3( 0.0 );
781			light.visible = false;
782		}
783	}
784#endif
785#if NUM_RECT_AREA_LIGHTS > 0
786	struct RectAreaLight {
787		vec3 color;
788		vec3 position;
789		vec3 halfWidth;
790		vec3 halfHeight;
791	};
792	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
793	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
794#endif
795#if NUM_HEMI_LIGHTS > 0
796	struct HemisphereLight {
797		vec3 direction;
798		vec3 skyColor;
799		vec3 groundColor;
800	};
801	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
802	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
803		float dotNL = dot( normal, hemiLight.direction );
804		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
805		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
806		return irradiance;
807	}
808#endif`,B1=`#ifdef USE_ENVMAP
809	vec3 getIBLIrradiance( const in vec3 normal ) {
810		#ifdef ENVMAP_TYPE_CUBE_UV
811			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
812			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
813			return PI * envMapColor.rgb * envMapIntensity;
814		#else
815			return vec3( 0.0 );
816		#endif
817	}
818	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
819		#ifdef ENVMAP_TYPE_CUBE_UV
820			vec3 reflectVec = reflect( - viewDir, normal );
821			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
822			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
823			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
824			return envMapColor.rgb * envMapIntensity;
825		#else
826			return vec3( 0.0 );
827		#endif
828	}
829	#ifdef USE_ANISOTROPY
830		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
831			#ifdef ENVMAP_TYPE_CUBE_UV
832				vec3 bentNormal = cross( bitangent, viewDir );
833				bentNormal = normalize( cross( bentNormal, bitangent ) );
834				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
835				return getIBLRadiance( viewDir, bentNormal, roughness );
836			#else
837				return vec3( 0.0 );
838			#endif
839		}
840	#endif
841#endif`,z1=`ToonMaterial material;
842material.diffuseColor = diffuseColor.rgb;`,k1=`varying vec3 vViewPosition;
843struct ToonMaterial {
844	vec3 diffuseColor;
845};
846void 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 ) {
847	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
848	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
849}
850void 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 ) {
851	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
852}
853#define RE_Direct				RE_Direct_Toon
854#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,V1=`BlinnPhongMaterial material;
855material.diffuseColor = diffuseColor.rgb;
856material.specularColor = specular;
857material.specularShininess = shininess;
858material.specularStrength = specularStrength;`,H1=`varying vec3 vViewPosition;
859struct BlinnPhongMaterial {
860	vec3 diffuseColor;
861	vec3 specularColor;
862	float specularShininess;
863	float specularStrength;
864};
865void 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 ) {
866	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
867	vec3 irradiance = dotNL * directLight.color;
868	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
869	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
870}
871void 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 ) {
872	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
873}
874#define RE_Direct				RE_Direct_BlinnPhong
875#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,G1=`PhysicalMaterial material;
876material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
877vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
878float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
879material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
880material.roughness = min( material.roughness, 1.0 );
881#ifdef IOR
882	material.ior = ior;
883	#ifdef USE_SPECULAR
884		float specularIntensityFactor = specularIntensity;
885		vec3 specularColorFactor = specularColor;
886		#ifdef USE_SPECULAR_COLORMAP
887			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
888		#endif
889		#ifdef USE_SPECULAR_INTENSITYMAP
890			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
891		#endif
892		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
893	#else
894		float specularIntensityFactor = 1.0;
895		vec3 specularColorFactor = vec3( 1.0 );
896		material.specularF90 = 1.0;
897	#endif
898	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
899#else
900	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
901	material.specularF90 = 1.0;
902#endif
903#ifdef USE_CLEARCOAT
904	material.clearcoat = clearcoat;
905	material.clearcoatRoughness = clearcoatRoughness;
906	material.clearcoatF0 = vec3( 0.04 );
907	material.clearcoatF90 = 1.0;
908	#ifdef USE_CLEARCOATMAP
909		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
910	#endif
911	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
912		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
913	#endif
914	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
915	material.clearcoatRoughness += geometryRoughness;
916	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
917#endif
918#ifdef USE_DISPERSION
919	material.dispersion = dispersion;
920#endif
921#ifdef USE_IRIDESCENCE
922	material.iridescence = iridescence;
923	material.iridescenceIOR = iridescenceIOR;
924	#ifdef USE_IRIDESCENCEMAP
925		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
926	#endif
927	#ifdef USE_IRIDESCENCE_THICKNESSMAP
928		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
929	#else
930		material.iridescenceThickness = iridescenceThicknessMaximum;
931	#endif
932#endif
933#ifdef USE_SHEEN
934	material.sheenColor = sheenColor;
935	#ifdef USE_SHEEN_COLORMAP
936		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
937	#endif
938	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
939	#ifdef USE_SHEEN_ROUGHNESSMAP
940		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
941	#endif
942#endif
943#ifdef USE_ANISOTROPY
944	#ifdef USE_ANISOTROPYMAP
945		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
946		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
947		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
948	#else
949		vec2 anisotropyV = anisotropyVector;
950	#endif
951	material.anisotropy = length( anisotropyV );
952	if( material.anisotropy == 0.0 ) {
953		anisotropyV = vec2( 1.0, 0.0 );
954	} else {
955		anisotropyV /= material.anisotropy;
956		material.anisotropy = saturate( material.anisotropy );
957	}
958	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
959	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
960	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
961#endif`,W1
vendor: 14,687 bytes, lines 961-1262
961=`struct PhysicalMaterial {
962	vec3 diffuseColor;
963	float roughness;
964	vec3 specularColor;
965	float specularF90;
966	float dispersion;
967	#ifdef USE_CLEARCOAT
968		float clearcoat;
969		float clearcoatRoughness;
970		vec3 clearcoatF0;
971		float clearcoatF90;
972	#endif
973	#ifdef USE_IRIDESCENCE
974		float iridescence;
975		float iridescenceIOR;
976		float iridescenceThickness;
977		vec3 iridescenceFresnel;
978		vec3 iridescenceF0;
979	#endif
980	#ifdef USE_SHEEN
981		vec3 sheenColor;
982		float sheenRoughness;
983	#endif
984	#ifdef IOR
985		float ior;
986	#endif
987	#ifdef USE_TRANSMISSION
988		float transmission;
989		float transmissionAlpha;
990		float thickness;
991		float attenuationDistance;
992		vec3 attenuationColor;
993	#endif
994	#ifdef USE_ANISOTROPY
995		float anisotropy;
996		float alphaT;
997		vec3 anisotropyT;
998		vec3 anisotropyB;
999	#endif
1000};
1001vec3 clearcoatSpecularDirect = vec3( 0.0 );
1002vec3 clearcoatSpecularIndirect = vec3( 0.0 );
1003vec3 sheenSpecularDirect = vec3( 0.0 );
1004vec3 sheenSpecularIndirect = vec3(0.0 );
1005vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
1006    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
1007    float x2 = x * x;
1008    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
1009    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
1010}
1011float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1012	float a2 = pow2( alpha );
1013	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1014	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1015	return 0.5 / max( gv + gl, EPSILON );
1016}
1017float D_GGX( const in float alpha, const in float dotNH ) {
1018	float a2 = pow2( alpha );
1019	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1020	return RECIPROCAL_PI * a2 / pow2( denom );
1021}
1022#ifdef USE_ANISOTROPY
1023	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 ) {
1024		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1025		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1026		float v = 0.5 / ( gv + gl );
1027		return saturate(v);
1028	}
1029	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1030		float a2 = alphaT * alphaB;
1031		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1032		highp float v2 = dot( v, v );
1033		float w2 = a2 / v2;
1034		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1035	}
1036#endif
1037#ifdef USE_CLEARCOAT
1038	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1039		vec3 f0 = material.clearcoatF0;
1040		float f90 = material.clearcoatF90;
1041		float roughness = material.clearcoatRoughness;
1042		float alpha = pow2( roughness );
1043		vec3 halfDir = normalize( lightDir + viewDir );
1044		float dotNL = saturate( dot( normal, lightDir ) );
1045		float dotNV = saturate( dot( normal, viewDir ) );
1046		float dotNH = saturate( dot( normal, halfDir ) );
1047		float dotVH = saturate( dot( viewDir, halfDir ) );
1048		vec3 F = F_Schlick( f0, f90, dotVH );
1049		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1050		float D = D_GGX( alpha, dotNH );
1051		return F * ( V * D );
1052	}
1053#endif
1054vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1055	vec3 f0 = material.specularColor;
1056	float f90 = material.specularF90;
1057	float roughness = material.roughness;
1058	float alpha = pow2( roughness );
1059	vec3 halfDir = normalize( lightDir + viewDir );
1060	float dotNL = saturate( dot( normal, lightDir ) );
1061	float dotNV = saturate( dot( normal, viewDir ) );
1062	float dotNH = saturate( dot( normal, halfDir ) );
1063	float dotVH = saturate( dot( viewDir, halfDir ) );
1064	vec3 F = F_Schlick( f0, f90, dotVH );
1065	#ifdef USE_IRIDESCENCE
1066		F = mix( F, material.iridescenceFresnel, material.iridescence );
1067	#endif
1068	#ifdef USE_ANISOTROPY
1069		float dotTL = dot( material.anisotropyT, lightDir );
1070		float dotTV = dot( material.anisotropyT, viewDir );
1071		float dotTH = dot( material.anisotropyT, halfDir );
1072		float dotBL = dot( material.anisotropyB, lightDir );
1073		float dotBV = dot( material.anisotropyB, viewDir );
1074		float dotBH = dot( material.anisotropyB, halfDir );
1075		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1076		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1077	#else
1078		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1079		float D = D_GGX( alpha, dotNH );
1080	#endif
1081	return F * ( V * D );
1082}
1083vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1084	const float LUT_SIZE = 64.0;
1085	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1086	const float LUT_BIAS = 0.5 / LUT_SIZE;
1087	float dotNV = saturate( dot( N, V ) );
1088	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1089	uv = uv * LUT_SCALE + LUT_BIAS;
1090	return uv;
1091}
1092float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1093	float l = length( f );
1094	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1095}
1096vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1097	float x = dot( v1, v2 );
1098	float y = abs( x );
1099	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1100	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1101	float v = a / b;
1102	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1103	return cross( v1, v2 ) * theta_sintheta;
1104}
1105vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1106	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1107	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1108	vec3 lightNormal = cross( v1, v2 );
1109	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1110	vec3 T1, T2;
1111	T1 = normalize( V - N * dot( V, N ) );
1112	T2 = - cross( N, T1 );
1113	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1114	vec3 coords[ 4 ];
1115	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1116	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1117	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1118	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1119	coords[ 0 ] = normalize( coords[ 0 ] );
1120	coords[ 1 ] = normalize( coords[ 1 ] );
1121	coords[ 2 ] = normalize( coords[ 2 ] );
1122	coords[ 3 ] = normalize( coords[ 3 ] );
1123	vec3 vectorFormFactor = vec3( 0.0 );
1124	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1125	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1126	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1127	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1128	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1129	return vec3( result );
1130}
1131#if defined( USE_SHEEN )
1132float D_Charlie( float roughness, float dotNH ) {
1133	float alpha = pow2( roughness );
1134	float invAlpha = 1.0 / alpha;
1135	float cos2h = dotNH * dotNH;
1136	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1137	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1138}
1139float V_Neubelt( float dotNV, float dotNL ) {
1140	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1141}
1142vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1143	vec3 halfDir = normalize( lightDir + viewDir );
1144	float dotNL = saturate( dot( normal, lightDir ) );
1145	float dotNV = saturate( dot( normal, viewDir ) );
1146	float dotNH = saturate( dot( normal, halfDir ) );
1147	float D = D_Charlie( sheenRoughness, dotNH );
1148	float V = V_Neubelt( dotNV, dotNL );
1149	return sheenColor * ( D * V );
1150}
1151#endif
1152float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1153	float dotNV = saturate( dot( normal, viewDir ) );
1154	float r2 = roughness * roughness;
1155	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1156	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1157	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1158	return saturate( DG * RECIPROCAL_PI );
1159}
1160vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1161	float dotNV = saturate( dot( normal, viewDir ) );
1162	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1163	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1164	vec4 r = roughness * c0 + c1;
1165	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1166	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1167	return fab;
1168}
1169vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1170	vec2 fab = DFGApprox( normal, viewDir, roughness );
1171	return specularColor * fab.x + specularF90 * fab.y;
1172}
1173#ifdef USE_IRIDESCENCE
1174void 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 ) {
1175#else
1176void 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 ) {
1177#endif
1178	vec2 fab = DFGApprox( normal, viewDir, roughness );
1179	#ifdef USE_IRIDESCENCE
1180		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1181	#else
1182		vec3 Fr = specularColor;
1183	#endif
1184	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1185	float Ess = fab.x + fab.y;
1186	float Ems = 1.0 - Ess;
1187	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1188	singleScatter += FssEss;
1189	multiScatter += Fms * Ems;
1190}
1191#if NUM_RECT_AREA_LIGHTS > 0
1192	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 ) {
1193		vec3 normal = geometryNormal;
1194		vec3 viewDir = geometryViewDir;
1195		vec3 position = geometryPosition;
1196		vec3 lightPos = rectAreaLight.position;
1197		vec3 halfWidth = rectAreaLight.halfWidth;
1198		vec3 halfHeight = rectAreaLight.halfHeight;
1199		vec3 lightColor = rectAreaLight.color;
1200		float roughness = material.roughness;
1201		vec3 rectCoords[ 4 ];
1202		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1203		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1204		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1205		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1206		vec4 t1 = texture2D( ltc_1, uv );
1207		vec4 t2 = texture2D( ltc_2, uv );
1208		mat3 mInv = mat3(
1209			vec3( t1.x, 0, t1.y ),
1210			vec3(    0, 1,    0 ),
1211			vec3( t1.z, 0, t1.w )
1212		);
1213		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1214		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1215		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1216	}
1217#endif
1218void 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 ) {
1219	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1220	vec3 irradiance = dotNL * directLight.color;
1221	#ifdef USE_CLEARCOAT
1222		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1223		vec3 ccIrradiance = dotNLcc * directLight.color;
1224		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1225	#endif
1226	#ifdef USE_SHEEN
1227		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1228	#endif
1229	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1230	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1231}
1232void 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 ) {
1233	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1234}
1235void 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) {
1236	#ifdef USE_CLEARCOAT
1237		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1238	#endif
1239	#ifdef USE_SHEEN
1240		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1241	#endif
1242	vec3 singleScattering = vec3( 0.0 );
1243	vec3 multiScattering = vec3( 0.0 );
1244	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1245	#ifdef USE_IRIDESCENCE
1246		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1247	#else
1248		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1249	#endif
1250	vec3 totalScattering = singleScattering + multiScattering;
1251	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1252	reflectedLight.indirectSpecular += radiance * singleScattering;
1253	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1254	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1255}
1256#define RE_Direct				RE_Direct_Physical
1257#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1258#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1259#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1260float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1261	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1262}`,
1262X1=`
1263vec3 geometryPosition = - vViewPosition;
1264vec3 geometryNormal = normal;
1265vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1266vec3 geometryClearcoatNormal = vec3( 0.0 );
1267#ifdef USE_CLEARCOAT
1268	geometryClearcoatNormal = clearcoatNormal;
1269#endif
1270#ifdef USE_IRIDESCENCE
1271	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1272	if ( material.iridescenceThickness == 0.0 ) {
1273		material.iridescence = 0.0;
1274	} else {
1275		material.iridescence = saturate( material.iridescence );
1276	}
1277	if ( material.iridescence > 0.0 ) {
1278		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1279		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1280	}
1281#endif
1282IncidentLight directLight;
1283#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1284	PointLight pointLight;
1285	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1286	PointLightShadow pointLightShadow;
1287	#endif
1288	#pragma unroll_loop_start
1289	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1290		pointLight = pointLights[ i ];
1291		getPointLightInfo( pointLight, geometryPosition, directLight );
1292		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1293		pointLightShadow = pointLightShadows[ i ];
1294		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1295		#endif
1296		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1297	}
1298	#pragma unroll_loop_end
1299#endif
1300#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1301	SpotLight spotLight;
1302	vec4 spotColor;
1303	vec3 spotLightCoord;
1304	bool inSpotLightMap;
1305	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1306	SpotLightShadow spotLightShadow;
1307	#endif
1308	#pragma unroll_loop_start
1309	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1310		spotLight = spotLights[ i ];
1311		getSpotLightInfo( spotLight, geometryPosition, directLight );
1312		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1313		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1314		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1315		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1316		#else
1317		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1318		#endif
1319		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1320			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1321			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1322			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1323			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1324		#endif
1325		#undef SPOT_LIGHT_MAP_INDEX
1326		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1327		spotLightShadow = spotLightShadows[ i ];
1328		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1329		#endif
1330		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1331	}
1332	#pragma unroll_loop_end
1333#endif
1334#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1335	DirectionalLight directionalLight;
1336	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1337	DirectionalLightShadow directionalLightShadow;
1338	#endif
1339	#pragma unroll_loop_start
1340	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1341		directionalLight = directionalLights[ i ];
1342		getDirectionalLightInfo( directionalLight, directLight );
1343		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1344		directionalLightShadow = directionalLightShadows[ i ];
1345		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1346		#endif
1347		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1348	}
1349	#pragma unroll_loop_end
1350#endif
1351#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1352	RectAreaLight rectAreaLight;
1353	#pragma unroll_loop_start
1354	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1355		rectAreaLight = rectAreaLights[ i ];
1356		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1357	}
1358	#pragma unroll_loop_end
1359#endif
1360#if defined( RE_IndirectDiffuse )
1361	vec3 iblIrradiance = vec3( 0.0 );
1362	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1363	#if defined( USE_LIGHT_PROBES )
1364		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1365	#endif
1366	#if ( NUM_HEMI_LIGHTS > 0 )
1367		#pragma unroll_loop_start
1368		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1369			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1370		}
1371		#pragma unroll_loop_end
1372	#endif
1373#endif
1374#if defined( RE_IndirectSpecular )
1375	vec3 radiance = vec3( 0.0 );
1376	vec3 clearcoatRadiance = vec3( 0.0 );
1377#endif`,Y1=`#if defined( RE_IndirectDiffuse )
1378	#ifdef USE_LIGHTMAP
1379		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1380		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1381		irradiance += lightMapIrradiance;
1382	#endif
1383	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1384		iblIrradiance += getIBLIrradiance( geometryNormal );
1385	#endif
1386#endif
1387#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1388	#ifdef USE_ANISOTROPY
1389		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1390	#else
1391		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1392	#endif
1393	#ifdef USE_CLEARCOAT
1394		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1395	#endif
1396#endif`,q1=`#if defined( RE_IndirectDiffuse )
1397	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1398#endif
1399#if defined( RE_IndirectSpecular )
1400	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1401#endif`,Z1=`#if defined( USE_LOGDEPTHBUF )
1402	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1403#endif`,j1=`#if defined( USE_LOGDEPTHBUF )
1404	uniform float logDepthBufFC;
1405	varying float vFragDepth;
1406	varying float vIsPerspective;
1407#endif`,J1=`#ifdef USE_LOGDEPTHBUF
1408	varying float vFragDepth;
1409	varying float vIsPerspective;
1410#endif`,K1=`#ifdef USE_LOGDEPTHBUF
1411	vFragDepth = 1.0 + gl_Position.w;
1412	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1413#endif`,Q1=`#ifdef USE_MAP
1414	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1415	#ifdef DECODE_VIDEO_TEXTURE
1416		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1417	#endif
1418	diffuseColor *= sampledDiffuseColor;
1419#endif`,$1=`#ifdef USE_MAP
1420	uniform sampler2D map;
1421#endif`,eE=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1422	#if defined( USE_POINTS_UV )
1423		vec2 uv = vUv;
1424	#else
1425		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1426	#endif
1427#endif
1428#ifdef USE_MAP
1429	diffuseColor *= texture2D( map, uv );
1430#endif
1431#ifdef USE_ALPHAMAP
1432	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1433#endif`,tE=`#if defined( USE_POINTS_UV )
1434	varying vec2 vUv;
1435#else
1436	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1437		uniform mat3 uvTransform;
1438	#endif
1439#endif
1440#ifdef USE_MAP
1441	uniform sampler2D map;
1442#endif
1443#ifdef USE_ALPHAMAP
1444	uniform sampler2D alphaMap;
1445#endif`,nE=`float metalnessFactor = metalness;
1446#ifdef USE_METALNESSMAP
1447	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1448	metalnessFactor *= texelMetalness.b;
1449#endif`,iE=`#ifdef USE_METALNESSMAP
1450	uniform sampler2D metalnessMap;
1451#endif`,rE=`#ifdef USE_INSTANCING_MORPH
1452	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1453	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1454	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1455		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1456	}
1457#endif`,sE=`#if defined( USE_MORPHCOLORS )
1458	vColor *= morphTargetBaseInfluence;
1459	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1460		#if defined( USE_COLOR_ALPHA )
1461			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1462		#elif defined( USE_COLOR )
1463			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1464		#endif
1465	}
1466#endif`,oE=`#ifdef USE_MORPHNORMALS
1467	objectNormal *= morphTargetBaseInfluence;
1468	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1469		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1470	}
1471#endif`,aE=`#ifdef USE_MORPHTARGETS
1472	#ifndef USE_INSTANCING_MORPH
1473		uniform float morphTargetBaseInfluence;
1474		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1475	#endif
1476	uniform sampler2DArray morphTargetsTexture;
1477	uniform ivec2 morphTargetsTextureSize;
1478	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1479		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1480		int y = texelIndex / morphTargetsTextureSize.x;
1481		int x = texelIndex - y * morphTargetsTextureSize.x;
1482		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1483		return texelFetch( morphTargetsTexture, morphUV, 0 );
1484	}
1485#endif`,lE=`#ifdef USE_MORPHTARGETS
1486	transformed *= morphTargetBaseInfluence;
1487	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1488		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1489	}
1490#endif`,cE=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1491#ifdef FLAT_SHADED
1492	vec3 fdx = dFdx( vViewPosition );
1493	vec3 fdy = dFdy( vViewPosition );
1494	vec3 normal = normalize( cross( fdx, fdy ) );
1495#else
1496	vec3 normal = normalize( vNormal );
1497	#ifdef DOUBLE_SIDED
1498		normal *= faceDirection;
1499	#endif
1500#endif
1501#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1502	#ifdef USE_TANGENT
1503		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1504	#else
1505		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1506		#if defined( USE_NORMALMAP )
1507			vNormalMapUv
1508		#elif defined( USE_CLEARCOAT_NORMALMAP )
1509			vClearcoatNormalMapUv
1510		#else
1511			vUv
1512		#endif
1513		);
1514	#endif
1515	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1516		tbn[0] *= faceDirection;
1517		tbn[1] *= faceDirection;
1518	#endif
1519#endif
1520#ifdef USE_CLEARCOAT_NORMALMAP
1521	#ifdef USE_TANGENT
1522		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1523	#else
1524		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1525	#endif
1526	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1527		tbn2[0] *= faceDirection;
1528		tbn2[1] *= faceDirection;
1529	#endif
1530#endif
1531vec3 nonPerturbedNormal = normal;`,uE=`#ifdef USE_NORMALMAP_OBJECTSPACE
1532	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1533	#ifdef FLIP_SIDED
1534		normal = - normal;
1535	#endif
1536	#ifdef DOUBLE_SIDED
1537		normal = normal * faceDirection;
1538	#endif
1539	normal = normalize( normalMatrix * normal );
1540#elif defined( USE_NORMALMAP_TANGENTSPACE )
1541	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1542	mapN.xy *= normalScale;
1543	normal = normalize( tbn * mapN );
1544#elif defined( USE_BUMPMAP )
1545	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1546#endif`,hE=`#ifndef FLAT_SHADED
1547	varying vec3 vNormal;
1548	#ifdef USE_TANGENT
1549		varying vec3 vTangent;
1550		varying vec3 vBitangent;
1551	#endif
1552#endif`,fE=`#ifndef FLAT_SHADED
1553	varying vec3 vNormal;
1554	#ifdef USE_TANGENT
1555		varying vec3 vTangent;
1556		varying vec3 vBitangent;
1557	#endif
1558#endif`,dE=`#ifndef FLAT_SHADED
1559	vNormal = normalize( transformedNormal );
1560	#ifdef USE_TANGENT
1561		vTangent = normalize( transformedTangent );
1562		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1563	#endif
1564#endif`,pE=`#ifdef USE_NORMALMAP
1565	uniform sampler2D normalMap;
1566	uniform vec2 normalScale;
1567#endif
1568#ifdef USE_NORMALMAP_OBJECTSPACE
1569	uniform mat3 normalMatrix;
1570#endif
1571#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1572	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1573		vec3 q0 = dFdx( eye_pos.xyz );
1574		vec3 q1 = dFdy( eye_pos.xyz );
1575		vec2 st0 = dFdx( uv.st );
1576		vec2 st1 = dFdy( uv.st );
1577		vec3 N = surf_norm;
1578		vec3 q1perp = cross( q1, N );
1579		vec3 q0perp = cross( N, q0 );
1580		vec3 T = q1perp * st0.x + q0perp * st1.x;
1581		vec3 B = q1perp * st0.y + q0perp * st1.y;
1582		float det = max( dot( T, T ), dot( B, B ) );
1583		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1584		return mat3( T * scale, B * scale, N );
1585	}
1586#endif`,mE=`#ifdef USE_CLEARCOAT
1587	vec3 clearcoatNormal = nonPerturbedNormal;
1588#endif`,gE=`#ifdef USE_CLEARCOAT_NORMALMAP
1589	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1590	clearcoatMapN.xy *= clearcoatNormalScale;
1591	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1592#endif`,vE=`#ifdef USE_CLEARCOATMAP
1593	uniform sampler2D clearcoatMap;
1594#endif
1595#ifdef USE_CLEARCOAT_NORMALMAP
1596	uniform sampler2D clearcoatNormalMap;
1597	uniform vec2 clearcoatNormalScale;
1598#endif
1599#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1600	uniform sampler2D clearcoatRoughnessMap;
1601#endif`,_E=`#ifdef USE_IRIDESCENCEMAP
1602	uniform sampler2D iridescenceMap;
1603#endif
1604#ifdef USE_IRIDESCENCE_THICKNESSMAP
1605	uniform sampler2D iridescenceThicknessMap;
1606#endif`,yE=`#ifdef OPAQUE
1607diffuseColor.a = 1.0;
1608#endif
1609#ifdef USE_TRANSMISSION
1610diffuseColor.a *= material.transmissionAlpha;
1611#endif
1612gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,xE=`vec3 packNormalToRGB( const in vec3 normal ) {
1613	return normalize( normal ) * 0.5 + 0.5;
1614}
1615vec3 unpackRGBToNormal( const in vec3 rgb ) {
1616	return 2.0 * rgb.xyz - 1.0;
1617}
1618const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1619const float Inv255 = 1. / 255.;
1620const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1621const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1622const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1623const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1624vec4 packDepthToRGBA( const in float v ) {
1625	if( v <= 0.0 )
1626		return vec4( 0., 0., 0., 0. );
1627	if( v >= 1.0 )
1628		return vec4( 1., 1., 1., 1. );
1629	float vuf;
1630	float af = modf( v * PackFactors.a, vuf );
1631	float bf = modf( vuf * ShiftRight8, vuf );
1632	float gf = modf( vuf * ShiftRight8, vuf );
1633	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1634}
1635vec3 packDepthToRGB( const in float v ) {
1636	if( v <= 0.0 )
1637		return vec3( 0., 0., 0. );
1638	if( v >= 1.0 )
1639		return vec3( 1., 1., 1. );
1640	float vuf;
1641	float bf = modf( v * PackFactors.b, vuf );
1642	float gf = modf( vuf * ShiftRight8, vuf );
1643	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1644}
1645vec2 packDepthToRG( const in float v ) {
1646	if( v <= 0.0 )
1647		return vec2( 0., 0. );
1648	if( v >= 1.0 )
1649		return vec2( 1., 1. );
1650	float vuf;
1651	float gf = modf( v * 256., vuf );
1652	return vec2( vuf * Inv255, gf );
1653}
1654float unpackRGBAToDepth( const in vec4 v ) {
1655	return dot( v, UnpackFactors4 );
1656}
1657float unpackRGBToDepth( const in vec3 v ) {
1658	return dot( v, UnpackFactors3 );
1659}
1660float unpackRGToDepth( const in vec2 v ) {
1661	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1662}
1663vec4 pack2HalfToRGBA( const in vec2 v ) {
1664	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1665	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1666}
1667vec2 unpackRGBATo2Half( const in vec4 v ) {
1668	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1669}
1670float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1671	return ( viewZ + near ) / ( near - far );
1672}
1673float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1674	return depth * ( near - far ) - near;
1675}
1676float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1677	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1678}
1679float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1680	return ( near * far ) / ( ( far - near ) * depth - far );
1681}`,SE=`#ifdef PREMULTIPLIED_ALPHA
1682	gl_FragColor.rgb *= gl_FragColor.a;
1683#endif`,ME=`vec4 mvPosition = vec4( transformed, 1.0 );
1684#ifdef USE_BATCHING
1685	mvPosition = batchingMatrix * mvPosition;
1686#endif
1687#ifdef USE_INSTANCING
1688	mvPosition = instanceMatrix * mvPosition;
1689#endif
1690mvPosition = modelViewMatrix * mvPosition;
1691gl_Position = projectionMatrix * mvPosition;`,EE=`#ifdef DITHERING
1692	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1693#endif`,wE=`#ifdef DITHERING
1694	vec3 dithering( vec3 color ) {
1695		float grid_position = rand( gl_FragCoord.xy );
1696		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1697		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1698		return color + dither_shift_RGB;
1699	}
1700#endif`,TE=`float roughnessFactor = roughness;
1701#ifdef USE_ROUGHNESSMAP
1702	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1703	roughnessFactor *= texelRoughness.g;
1704#endif`,bE=`#ifdef USE_ROUGHNESSMAP
1705	uniform sampler2D roughnessMap;
1706#endif`,AE=
vendor: 8,887 bytes, lines 1706-1892
1706`#if NUM_SPOT_LIGHT_COORDS > 0
1707	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1708#endif
1709#if NUM_SPOT_LIGHT_MAPS > 0
1710	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1711#endif
1712#ifdef USE_SHADOWMAP
1713	#if NUM_DIR_LIGHT_SHADOWS > 0
1714		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1715		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1716		struct DirectionalLightShadow {
1717			float shadowIntensity;
1718			float shadowBias;
1719			float shadowNormalBias;
1720			float shadowRadius;
1721			vec2 shadowMapSize;
1722		};
1723		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1724	#endif
1725	#if NUM_SPOT_LIGHT_SHADOWS > 0
1726		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1727		struct SpotLightShadow {
1728			float shadowIntensity;
1729			float shadowBias;
1730			float shadowNormalBias;
1731			float shadowRadius;
1732			vec2 shadowMapSize;
1733		};
1734		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1735	#endif
1736	#if NUM_POINT_LIGHT_SHADOWS > 0
1737		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1738		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1739		struct PointLightShadow {
1740			float shadowIntensity;
1741			float shadowBias;
1742			float shadowNormalBias;
1743			float shadowRadius;
1744			vec2 shadowMapSize;
1745			float shadowCameraNear;
1746			float shadowCameraFar;
1747		};
1748		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1749	#endif
1750	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1751		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1752	}
1753	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1754		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1755	}
1756	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1757		float occlusion = 1.0;
1758		vec2 distribution = texture2DDistribution( shadow, uv );
1759		float hard_shadow = step( compare , distribution.x );
1760		if (hard_shadow != 1.0 ) {
1761			float distance = compare - distribution.x ;
1762			float variance = max( 0.00000, distribution.y * distribution.y );
1763			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 );
1764		}
1765		return occlusion;
1766	}
1767	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1768		float shadow = 1.0;
1769		shadowCoord.xyz /= shadowCoord.w;
1770		shadowCoord.z += shadowBias;
1771		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1772		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1773		if ( frustumTest ) {
1774		#if defined( SHADOWMAP_TYPE_PCF )
1775			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1776			float dx0 = - texelSize.x * shadowRadius;
1777			float dy0 = - texelSize.y * shadowRadius;
1778			float dx1 = + texelSize.x * shadowRadius;
1779			float dy1 = + texelSize.y * shadowRadius;
1780			float dx2 = dx0 / 2.0;
1781			float dy2 = dy0 / 2.0;
1782			float dx3 = dx1 / 2.0;
1783			float dy3 = dy1 / 2.0;
1784			shadow = (
1785				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1786				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1787				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1788				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1789				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1790				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1791				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1792				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1793				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1794				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1795				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1796				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1797				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1798				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1799				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1800				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1801				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1802			) * ( 1.0 / 17.0 );
1803		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1804			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1805			float dx = texelSize.x;
1806			float dy = texelSize.y;
1807			vec2 uv = shadowCoord.xy;
1808			vec2 f = fract( uv * shadowMapSize + 0.5 );
1809			uv -= f * texelSize;
1810			shadow = (
1811				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1812				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1813				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1814				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1815				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1816					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1817					 f.x ) +
1818				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1819					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1820					 f.x ) +
1821				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1822					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1823					 f.y ) +
1824				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1825					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1826					 f.y ) +
1827				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1828						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1829						  f.x ),
1830					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1831						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1832						  f.x ),
1833					 f.y )
1834			) * ( 1.0 / 9.0 );
1835		#elif defined( SHADOWMAP_TYPE_VSM )
1836			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1837		#else
1838			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1839		#endif
1840		}
1841		return mix( 1.0, shadow, shadowIntensity );
1842	}
1843	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1844		vec3 absV = abs( v );
1845		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1846		absV *= scaleToCube;
1847		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1848		vec2 planar = v.xy;
1849		float almostATexel = 1.5 * texelSizeY;
1850		float almostOne = 1.0 - almostATexel;
1851		if ( absV.z >= almostOne ) {
1852			if ( v.z > 0.0 )
1853				planar.x = 4.0 - v.x;
1854		} else if ( absV.x >= almostOne ) {
1855			float signX = sign( v.x );
1856			planar.x = v.z * signX + 2.0 * signX;
1857		} else if ( absV.y >= almostOne ) {
1858			float signY = sign( v.y );
1859			planar.x = v.x + 2.0 * signY + 2.0;
1860			planar.y = v.z * signY - 2.0;
1861		}
1862		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1863	}
1864	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1865		float shadow = 1.0;
1866		vec3 lightToPosition = shadowCoord.xyz;
1867		
1868		float lightToPositionLength = length( lightToPosition );
1869		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
1870			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
1871			vec3 bd3D = normalize( lightToPosition );
1872			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1873			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1874				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1875				shadow = (
1876					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1877					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1878					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1879					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1880					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1881					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1882					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1883					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1884					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1885				) * ( 1.0 / 9.0 );
1886			#else
1887				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1888			#endif
1889		}
1890		return mix( 1.0, shadow, shadowIntensity );
1891	}
1892#endif`,
1892CE=`#if NUM_SPOT_LIGHT_COORDS > 0
1893	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1894	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1895#endif
1896#ifdef USE_SHADOWMAP
1897	#if NUM_DIR_LIGHT_SHADOWS > 0
1898		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1899		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1900		struct DirectionalLightShadow {
1901			float shadowIntensity;
1902			float shadowBias;
1903			float shadowNormalBias;
1904			float shadowRadius;
1905			vec2 shadowMapSize;
1906		};
1907		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1908	#endif
1909	#if NUM_SPOT_LIGHT_SHADOWS > 0
1910		struct SpotLightShadow {
1911			float shadowIntensity;
1912			float shadowBias;
1913			float shadowNormalBias;
1914			float shadowRadius;
1915			vec2 shadowMapSize;
1916		};
1917		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1918	#endif
1919	#if NUM_POINT_LIGHT_SHADOWS > 0
1920		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1921		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1922		struct PointLightShadow {
1923			float shadowIntensity;
1924			float shadowBias;
1925			float shadowNormalBias;
1926			float shadowRadius;
1927			vec2 shadowMapSize;
1928			float shadowCameraNear;
1929			float shadowCameraFar;
1930		};
1931		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1932	#endif
1933#endif`,RE=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1934	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1935	vec4 shadowWorldPosition;
1936#endif
1937#if defined( USE_SHADOWMAP )
1938	#if NUM_DIR_LIGHT_SHADOWS > 0
1939		#pragma unroll_loop_start
1940		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1941			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1942			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1943		}
1944		#pragma unroll_loop_end
1945	#endif
1946	#if NUM_POINT_LIGHT_SHADOWS > 0
1947		#pragma unroll_loop_start
1948		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1949			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1950			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1951		}
1952		#pragma unroll_loop_end
1953	#endif
1954#endif
1955#if NUM_SPOT_LIGHT_COORDS > 0
1956	#pragma unroll_loop_start
1957	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1958		shadowWorldPosition = worldPosition;
1959		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1960			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1961		#endif
1962		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1963	}
1964	#pragma unroll_loop_end
1965#endif`,PE=`float getShadowMask() {
1966	float shadow = 1.0;
1967	#ifdef USE_SHADOWMAP
1968	#if NUM_DIR_LIGHT_SHADOWS > 0
1969	DirectionalLightShadow directionalLight;
1970	#pragma unroll_loop_start
1971	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1972		directionalLight = directionalLightShadows[ i ];
1973		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1974	}
1975	#pragma unroll_loop_end
1976	#endif
1977	#if NUM_SPOT_LIGHT_SHADOWS > 0
1978	SpotLightShadow spotLight;
1979	#pragma unroll_loop_start
1980	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1981		spotLight = spotLightShadows[ i ];
1982		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1983	}
1984	#pragma unroll_loop_end
1985	#endif
1986	#if NUM_POINT_LIGHT_SHADOWS > 0
1987	PointLightShadow pointLight;
1988	#pragma unroll_loop_start
1989	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1990		pointLight = pointLightShadows[ i ];
1991		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1992	}
1993	#pragma unroll_loop_end
1994	#endif
1995	#endif
1996	return shadow;
1997}`,IE=`#ifdef USE_SKINNING
1998	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1999	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2000	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2001	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2002#endif`,LE=`#ifdef USE_SKINNING
2003	uniform mat4 bindMatrix;
2004	uniform mat4 bindMatrixInverse;
2005	uniform highp sampler2D boneTexture;
2006	mat4 getBoneMatrix( const in float i ) {
2007		int size = textureSize( boneTexture, 0 ).x;
2008		int j = int( i ) * 4;
2009		int x = j % size;
2010		int y = j / size;
2011		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2012		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2013		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2014		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2015		return mat4( v1, v2, v3, v4 );
2016	}
2017#endif`,DE=`#ifdef USE_SKINNING
2018	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2019	vec4 skinned = vec4( 0.0 );
2020	skinned += boneMatX * skinVertex * skinWeight.x;
2021	skinned += boneMatY * skinVertex * skinWeight.y;
2022	skinned += boneMatZ * skinVertex * skinWeight.z;
2023	skinned += boneMatW * skinVertex * skinWeight.w;
2024	transformed = ( bindMatrixInverse * skinned ).xyz;
2025#endif`,UE=`#ifdef USE_SKINNING
2026	mat4 skinMatrix = mat4( 0.0 );
2027	skinMatrix += skinWeight.x * boneMatX;
2028	skinMatrix += skinWeight.y * boneMatY;
2029	skinMatrix += skinWeight.z * boneMatZ;
2030	skinMatrix += skinWeight.w * boneMatW;
2031	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2032	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2033	#ifdef USE_TANGENT
2034		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2035	#endif
2036#endif`,NE=`float specularStrength;
2037#ifdef USE_SPECULARMAP
2038	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2039	specularStrength = texelSpecular.r;
2040#else
2041	specularStrength = 1.0;
2042#endif`,OE=`#ifdef USE_SPECULARMAP
2043	uniform sampler2D specularMap;
2044#endif`,FE=`#if defined( TONE_MAPPING )
2045	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2046#endif`,BE=`#ifndef saturate
2047#define saturate( a ) clamp( a, 0.0, 1.0 )
2048#endif
2049uniform float toneMappingExposure;
2050vec3 LinearToneMapping( vec3 color ) {
2051	return saturate( toneMappingExposure * color );
2052}
2053vec3 ReinhardToneMapping( vec3 color ) {
2054	color *= toneMappingExposure;
2055	return saturate( color / ( vec3( 1.0 ) + color ) );
2056}
2057vec3 CineonToneMapping( vec3 color ) {
2058	color *= toneMappingExposure;
2059	color = max( vec3( 0.0 ), color - 0.004 );
2060	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2061}
2062vec3 RRTAndODTFit( vec3 v ) {
2063	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2064	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2065	return a / b;
2066}
2067vec3 ACESFilmicToneMapping( vec3 color ) {
2068	const mat3 ACESInputMat = mat3(
2069		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2070		vec3( 0.04823, 0.01566, 0.83777 )
2071	);
2072	const mat3 ACESOutputMat = mat3(
2073		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2074		vec3( -0.07367, -0.00605,  1.07602 )
2075	);
2076	color *= toneMappingExposure / 0.6;
2077	color = ACESInputMat * color;
2078	color = RRTAndODTFit( color );
2079	color = ACESOutputMat * color;
2080	return saturate( color );
2081}
2082const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2083	vec3( 1.6605, - 0.1246, - 0.0182 ),
2084	vec3( - 0.5876, 1.1329, - 0.1006 ),
2085	vec3( - 0.0728, - 0.0083, 1.1187 )
2086);
2087const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2088	vec3( 0.6274, 0.0691, 0.0164 ),
2089	vec3( 0.3293, 0.9195, 0.0880 ),
2090	vec3( 0.0433, 0.0113, 0.8956 )
2091);
2092vec3 agxDefaultContrastApprox( vec3 x ) {
2093	vec3 x2 = x * x;
2094	vec3 x4 = x2 * x2;
2095	return + 15.5 * x4 * x2
2096		- 40.14 * x4 * x
2097		+ 31.96 * x4
2098		- 6.868 * x2 * x
2099		+ 0.4298 * x2
2100		+ 0.1191 * x
2101		- 0.00232;
2102}
2103vec3 AgXToneMapping( vec3 color ) {
2104	const mat3 AgXInsetMatrix = mat3(
2105		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2106		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2107		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2108	);
2109	const mat3 AgXOutsetMatrix = mat3(
2110		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2111		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2112		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2113	);
2114	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2115	color *= toneMappingExposure;
2116	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2117	color = AgXInsetMatrix * color;
2118	color = max( color, 1e-10 );	color = log2( color );
2119	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2120	color = clamp( color, 0.0, 1.0 );
2121	color = agxDefaultContrastApprox( color );
2122	color = AgXOutsetMatrix * color;
2123	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2124	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2125	color = clamp( color, 0.0, 1.0 );
2126	return color;
2127}
2128vec3 NeutralToneMapping( vec3 color ) {
2129	const float StartCompression = 0.8 - 0.04;
2130	const float Desaturation = 0.15;
2131	color *= toneMappingExposure;
2132	float x = min( color.r, min( color.g, color.b ) );
2133	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2134	color -= offset;
2135	float peak = max( color.r, max( color.g, color.b ) );
2136	if ( peak < StartCompression ) return color;
2137	float d = 1. - StartCompression;
2138	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2139	color *= newPeak / peak;
2140	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2141	return mix( color, vec3( newPeak ), g );
2142}
2143vec3 CustomToneMapping( vec3 color ) { return color; }`,zE=`#ifdef USE_TRANSMISSION
2144	material.transmission = transmission;
2145	material.transmissionAlpha = 1.0;
2146	material.thickness = thickness;
2147	material.attenuationDistance = attenuationDistance;
2148	material.attenuationColor = attenuationColor;
2149	#ifdef USE_TRANSMISSIONMAP
2150		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2151	#endif
2152	#ifdef USE_THICKNESSMAP
2153		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2154	#endif
2155	vec3 pos = vWorldPosition;
2156	vec3 v = normalize( cameraPosition - pos );
2157	vec3 n = inverseTransformDirection( normal, viewMatrix );
2158	vec4 transmitted = getIBLVolumeRefraction(
2159		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2160		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2161		material.attenuationColor, material.attenuationDistance );
2162	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2163	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2164#endif`,kE=`#ifdef USE_TRANSMISSION
2165	uniform float transmission;
2166	uniform float thickness;
2167	uniform float attenuationDistance;
2168	uniform vec3 attenuationColor;
2169	#ifdef USE_TRANSMISSIONMAP
2170		uniform sampler2D transmissionMap;
2171	#endif
2172	#ifdef USE_THICKNESSMAP
2173		uniform sampler2D thicknessMap;
2174	#endif
2175	uniform vec2 transmissionSamplerSize;
2176	uniform sampler2D transmissionSamplerMap;
2177	uniform mat4 modelMatrix;
2178	uniform mat4 projectionMatrix;
2179	varying vec3 vWorldPosition;
2180	float w0( float a ) {
2181		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2182	}
2183	float w1( float a ) {
2184		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2185	}
2186	float w2( float a ){
2187		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2188	}
2189	float w3( float a ) {
2190		return ( 1.0 / 6.0 ) * ( a * a * a );
2191	}
2192	float g0( float a ) {
2193		return w0( a ) + w1( a );
2194	}
2195	float g1( float a ) {
2196		return w2( a ) + w3( a );
2197	}
2198	float h0( float a ) {
2199		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2200	}
2201	float h1( float a ) {
2202		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2203	}
2204	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2205		uv = uv * texelSize.zw + 0.5;
2206		vec2 iuv = floor( uv );
2207		vec2 fuv = fract( uv );
2208		float g0x = g0( fuv.x );
2209		float g1x = g1( fuv.x );
2210		float h0x = h0( fuv.x );
2211		float h1x = h1( fuv.x );
2212		float h0y = h0( fuv.y );
2213		float h1y = h1( fuv.y );
2214		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2215		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2216		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2217		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2218		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2219			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2220	}
2221	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2222		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2223		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2224		vec2 fLodSizeInv = 1.0 / fLodSize;
2225		vec2 cLodSizeInv = 1.0 / cLodSize;
2226		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2227		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2228		return mix( fSample, cSample, fract( lod ) );
2229	}
2230	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2231		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2232		vec3 modelScale;
2233		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2234		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2235		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2236		return normalize( refractionVector ) * thickness * modelScale;
2237	}
2238	float applyIorToRoughness( const in float roughness, const in float ior ) {
2239		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2240	}
2241	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2242		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2243		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2244	}
2245	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2246		if ( isinf( attenuationDistance ) ) {
2247			return vec3( 1.0 );
2248		} else {
2249			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2250			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2251		}
2252	}
2253	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2254		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2255		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2256		const in vec3 attenuationColor, const in float attenuationDistance ) {
2257		vec4 transmittedLight;
2258		vec3 transmittance;
2259		#ifdef USE_DISPERSION
2260			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2261			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2262			for ( int i = 0; i < 3; i ++ ) {
2263				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2264				vec3 refractedRayExit = position + transmissionRay;
2265		
2266				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2267				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2268				refractionCoords += 1.0;
2269				refractionCoords /= 2.0;
2270		
2271				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2272				transmittedLight[ i ] = transmissionSample[ i ];
2273				transmittedLight.a += transmissionSample.a;
2274				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2275			}
2276			transmittedLight.a /= 3.0;
2277		
2278		#else
2279		
2280			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2281			vec3 refractedRayExit = position + transmissionRay;
2282			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2283			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2284			refractionCoords += 1.0;
2285			refractionCoords /= 2.0;
2286			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2287			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2288		
2289		#endif
2290		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2291		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2292		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2293		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2294	}
2295#endif`,VE=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2296	varying vec2 vUv;
2297#endif
2298#ifdef USE_MAP
2299	varying vec2 vMapUv;
2300#endif
2301#ifdef USE_ALPHAMAP
2302	varying vec2 vAlphaMapUv;
2303#endif
2304#ifdef USE_LIGHTMAP
2305	varying vec2 vLightMapUv;
2306#endif
2307#ifdef USE_AOMAP
2308	varying vec2 vAoMapUv;
2309#endif
2310#ifdef USE_BUMPMAP
2311	varying vec2 vBumpMapUv;
2312#endif
2313#ifdef USE_NORMALMAP
2314	varying vec2 vNormalMapUv;
2315#endif
2316#ifdef USE_EMISSIVEMAP
2317	varying vec2 vEmissiveMapUv;
2318#endif
2319#ifdef USE_METALNESSMAP
2320	varying vec2 vMetalnessMapUv;
2321#endif
2322#ifdef USE_ROUGHNESSMAP
2323	varying vec2 vRoughnessMapUv;
2324#endif
2325#ifdef USE_ANISOTROPYMAP
2326	varying vec2 vAnisotropyMapUv;
2327#endif
2328#ifdef USE_CLEARCOATMAP
2329	varying vec2 vClearcoatMapUv;
2330#endif
2331#ifdef USE_CLEARCOAT_NORMALMAP
2332	varying vec2 vClearcoatNormalMapUv;
2333#endif
2334#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2335	varying vec2 vClearcoatRoughnessMapUv;
2336#endif
2337#ifdef USE_IRIDESCENCEMAP
2338	varying vec2 vIridescenceMapUv;
2339#endif
2340#ifdef USE_IRIDESCENCE_THICKNESSMAP
2341	varying vec2 vIridescenceThicknessMapUv;
2342#endif
2343#ifdef USE_SHEEN_COLORMAP
2344	varying vec2 vSheenColorMapUv;
2345#endif
2346#ifdef USE_SHEEN_ROUGHNESSMAP
2347	varying vec2 vSheenRoughnessMapUv;
2348#endif
2349#ifdef USE_SPECULARMAP
2350	varying vec2 vSpecularMapUv;
2351#endif
2352#ifdef USE_SPECULAR_COLORMAP
2353	varying vec2 vSpecularColorMapUv;
2354#endif
2355#ifdef USE_SPECULAR_INTENSITYMAP
2356	varying vec2 vSpecularIntensityMapUv;
2357#endif
2358#ifdef USE_TRANSMISSIONMAP
2359	uniform mat3 transmissionMapTransform;
2360	varying vec2 vTransmissionMapUv;
2361#endif
2362#ifdef USE_THICKNESSMAP
2363	uniform mat3 thicknessMapTransform;
2364	varying vec2 vThicknessMapUv;
2365#endif`,HE=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2366	varying vec2 vUv;
2367#endif
2368#ifdef USE_MAP
2369	uniform mat3 mapTransform;
2370	varying vec2 vMapUv;
2371#endif
2372#ifdef USE_ALPHAMAP
2373	uniform mat3 alphaMapTransform;
2374	varying vec2 vAlphaMapUv;
2375#endif
2376#ifdef USE_LIGHTMAP
2377	uniform mat3 lightMapTransform;
2378	varying vec2 vLightMapUv;
2379#endif
2380#ifdef USE_AOMAP
2381	uniform mat3 aoMapTransform;
2382	varying vec2 vAoMapUv;
2383#endif
2384#ifdef USE_BUMPMAP
2385	uniform mat3 bumpMapTransform;
2386	varying vec2 vBumpMapUv;
2387#endif
2388#ifdef USE_NORMALMAP
2389	uniform mat3 normalMapTransform;
2390	varying vec2 vNormalMapUv;
2391#endif
2392#ifdef USE_DISPLACEMENTMAP
2393	uniform mat3 displacementMapTransform;
2394	varying vec2 vDisplacementMapUv;
2395#endif
2396#ifdef USE_EMISSIVEMAP
2397	uniform mat3 emissiveMapTransform;
2398	varying vec2 vEmissiveMapUv;
2399#endif
2400#ifdef USE_METALNESSMAP
2401	uniform mat3 metalnessMapTransform;
2402	varying vec2 vMetalnessMapUv;
2403#endif
2404#ifdef USE_ROUGHNESSMAP
2405	uniform mat3 roughnessMapTransform;
2406	varying vec2 vRoughnessMapUv;
2407#endif
2408#ifdef USE_ANISOTROPYMAP
2409	uniform mat3 anisotropyMapTransform;
2410	varying vec2 vAnisotropyMapUv;
2411#endif
2412#ifdef USE_CLEARCOATMAP
2413	uniform mat3 clearcoatMapTransform;
2414	varying vec2 vClearcoatMapUv;
2415#endif
2416#ifdef USE_CLEARCOAT_NORMALMAP
2417	uniform mat3 clearcoatNormalMapTransform;
2418	varying vec2 vClearcoatNormalMapUv;
2419#endif
2420#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2421	uniform mat3 clearcoatRoughnessMapTransform;
2422	varying vec2 vClearcoatRoughnessMapUv;
2423#endif
2424#ifdef USE_SHEEN_COLORMAP
2425	uniform mat3 sheenColorMapTransform;
2426	varying vec2 vSheenColorMapUv;
2427#endif
2428#ifdef USE_SHEEN_ROUGHNESSMAP
2429	uniform mat3 sheenRoughnessMapTransform;
2430	varying vec2 vSheenRoughnessMapUv;
2431#endif
2432#ifdef USE_IRIDESCENCEMAP
2433	uniform mat3 iridescenceMapTransform;
2434	varying vec2 vIridescenceMapUv;
2435#endif
2436#ifdef USE_IRIDESCENCE_THICKNESSMAP
2437	uniform mat3 iridescenceThicknessMapTransform;
2438	varying vec2 vIridescenceThicknessMapUv;
2439#endif
2440#ifdef USE_SPECULARMAP
2441	uniform mat3 specularMapTransform;
2442	varying vec2 vSpecularMapUv;
2443#endif
2444#ifdef USE_SPECULAR_COLORMAP
2445	uniform mat3 specularColorMapTransform;
2446	varying vec2 vSpecularColorMapUv;
2447#endif
2448#ifdef USE_SPECULAR_INTENSITYMAP
2449	uniform mat3 specularIntensityMapTransform;
2450	varying vec2 vSpecularIntensityMapUv;
2451#endif
2452#ifdef USE_TRANSMISSIONMAP
2453	uniform mat3 transmissionMapTransform;
2454	varying vec2 vTransmissionMapUv;
2455#endif
2456#ifdef USE_THICKNESSMAP
2457	uniform mat3 thicknessMapTransform;
2458	varying vec2 vThicknessMapUv;
2459#endif`,GE=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2460	vUv = vec3( uv, 1 ).xy;
2461#endif
2462#ifdef USE_MAP
2463	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2464#endif
2465#ifdef USE_ALPHAMAP
2466	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2467#endif
2468#ifdef USE_LIGHTMAP
2469	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2470#endif
2471#ifdef USE_AOMAP
2472	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2473#endif
2474#ifdef USE_BUMPMAP
2475	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2476#endif
2477#ifdef USE_NORMALMAP
2478	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2479#endif
2480#ifdef USE_DISPLACEMENTMAP
2481	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2482#endif
2483#ifdef USE_EMISSIVEMAP
2484	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2485#endif
2486#ifdef USE_METALNESSMAP
2487	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2488#endif
2489#ifdef USE_ROUGHNESSMAP
2490	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2491#endif
2492#ifdef USE_ANISOTROPYMAP
2493	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2494#endif
2495#ifdef USE_CLEARCOATMAP
2496	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2497#endif
2498#ifdef USE_CLEARCOAT_NORMALMAP
2499	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2500#endif
2501#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2502	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2503#endif
2504#ifdef USE_IRIDESCENCEMAP
2505	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2506#endif
2507#ifdef USE_IRIDESCENCE_THICKNESSMAP
2508	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2509#endif
2510#ifdef USE_SHEEN_COLORMAP
2511	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2512#endif
2513#ifdef USE_SHEEN_ROUGHNESSMAP
2514	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2515#endif
2516#ifdef USE_SPECULARMAP
2517	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2518#endif
2519#ifdef USE_SPECULAR_COLORMAP
2520	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2521#endif
2522#ifdef USE_SPECULAR_INTENSITYMAP
2523	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2524#endif
2525#ifdef USE_TRANSMISSIONMAP
2526	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2527#endif
2528#ifdef USE_THICKNESSMAP
2529	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2530#endif`,WE=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2531	vec4 worldPosition = vec4( transformed, 1.0 );
2532	#ifdef USE_BATCHING
2533		worldPosition = batchingMatrix * worldPosition;
2534	#endif
2535	#ifdef USE_INSTANCING
2536		worldPosition = instanceMatrix * worldPosition;
2537	#endif
2538	worldPosition = modelMatrix * worldPosition;
2539#endif`;const XE=`varying vec2 vUv;
2540uniform mat3 uvTransform;
2541void main() {
2542	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2543	gl_Position = vec4( position.xy, 1.0, 1.0 );
2544}`,YE=`uniform sampler2D t2D;
2545uniform float backgroundIntensity;
2546varying vec2 vUv;
2547void main() {
2548	vec4 texColor = texture2D( t2D, vUv );
2549	#ifdef DECODE_VIDEO_TEXTURE
2550		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 );
2551	#endif
2552	texColor.rgb *= backgroundIntensity;
2553	gl_FragColor = texColor;
2554	#include <tonemapping_fragment>
2555	#include <colorspace_fragment>
2556}`,qE=`varying vec3 vWorldDirection;
2557#include <common>
2558void main() {
2559	vWorldDirection = transformDirection( position, modelMatrix );
2560	#include <begin_vertex>
2561	#include <project_vertex>
2562	gl_Position.z = gl_Position.w;
2563}`,ZE=`#ifdef ENVMAP_TYPE_CUBE
2564	uniform samplerCube envMap;
2565#elif defined( ENVMAP_TYPE_CUBE_UV )
2566	uniform sampler2D envMap;
2567#endif
2568uniform float flipEnvMap;
2569uniform float backgroundBlurriness;
2570uniform float backgroundIntensity;
2571uniform mat3 backgroundRotation;
2572varying vec3 vWorldDirection;
2573#include <cube_uv_reflection_fragment>
2574void main() {
2575	#ifdef ENVMAP_TYPE_CUBE
2576		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2577	#elif defined( ENVMAP_TYPE_CUBE_UV )
2578		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2579	#else
2580		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2581	#endif
2582	texColor.rgb *= backgroundIntensity;
2583	gl_FragColor = texColor;
2584	#include <tonemapping_fragment>
2585	#include <colorspace_fragment>
2586}`,jE=`varying vec3 vWorldDirection;
2587#include <common>
2588void main() {
2589	vWorldDirection = transformDirection( position, modelMatrix );
2590	#include <begin_vertex>
2591	#include <project_vertex>
2592	gl_Position.z = gl_Position.w;
2593}`,JE=`uniform samplerCube tCube;
2594uniform float tFlip;
2595uniform float opacity;
2596varying vec3 vWorldDirection;
2597void main() {
2598	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2599	gl_FragColor = texColor;
2600	gl_FragColor.a *= opacity;
2601	#include <tonemapping_fragment>
2602	#include <colorspace_fragment>
2603}`,KE=`#include <common>
2604#include <batching_pars_vertex>
2605#include <uv_pars_vertex>
2606#include <displacementmap_pars_vertex>
2607#include <morphtarget_pars_vertex>
2608#include <skinning_pars_vertex>
2609#include <logdepthbuf_pars_vertex>
2610#include <clipping_planes_pars_vertex>
2611varying vec2 vHighPrecisionZW;
2612void main() {
2613	#include <uv_vertex>
2614	#include <batching_vertex>
2615	#include <skinbase_vertex>
2616	#include <morphinstance_vertex>
2617	#ifdef USE_DISPLACEMENTMAP
2618		#include <beginnormal_vertex>
2619		#include <morphnormal_vertex>
2620		#include <skinnormal_vertex>
2621	#endif
2622	#include <begin_vertex>
2623	#include <morphtarget_vertex>
2624	#include <skinning_vertex>
2625	#include <displacementmap_vertex>
2626	#include <project_vertex>
2627	#include <logdepthbuf_vertex>
2628	#include <clipping_planes_vertex>
2629	vHighPrecisionZW = gl_Position.zw;
2630}`,QE=`#if DEPTH_PACKING == 3200
2631	uniform float opacity;
2632#endif
2633#include <common>
2634#include <packing>
2635#include <uv_pars_fragment>
2636#include <map_pars_fragment>
2637#include <alphamap_pars_fragment>
2638#include <alphatest_pars_fragment>
2639#include <alphahash_pars_fragment>
2640#include <logdepthbuf_pars_fragment>
2641#include <clipping_planes_pars_fragment>
2642varying vec2 vHighPrecisionZW;
2643void main() {
2644	vec4 diffuseColor = vec4( 1.0 );
2645	#include <clipping_planes_fragment>
2646	#if DEPTH_PACKING == 3200
2647		diffuseColor.a = opacity;
2648	#endif
2649	#include <map_fragment>
2650	#include <alphamap_fragment>
2651	#include <alphatest_fragment>
2652	#include <alphahash_fragment>
2653	#include <logdepthbuf_fragment>
2654	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2655	#if DEPTH_PACKING == 3200
2656		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2657	#elif DEPTH_PACKING == 3201
2658		gl_FragColor = packDepthToRGBA( fragCoordZ );
2659	#elif DEPTH_PACKING == 3202
2660		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2661	#elif DEPTH_PACKING == 3203
2662		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2663	#endif
2664}`,$E=`#define DISTANCE
2665varying vec3 vWorldPosition;
2666#include <common>
2667#include <batching_pars_vertex>
2668#include <uv_pars_vertex>
2669#include <displacementmap_pars_vertex>
2670#include <morphtarget_pars_vertex>
2671#include <skinning_pars_vertex>
2672#include <clipping_planes_pars_vertex>
2673void main() {
2674	#include <uv_vertex>
2675	#include <batching_vertex>
2676	#include <skinbase_vertex>
2677	#include <morphinstance_vertex>
2678	#ifdef USE_DISPLACEMENTMAP
2679		#include <beginnormal_vertex>
2680		#include <morphnormal_vertex>
2681		#include <skinnormal_vertex>
2682	#endif
2683	#include <begin_vertex>
2684	#include <morphtarget_vertex>
2685	#include <skinning_vertex>
2686	#include <displacementmap_vertex>
2687	#include <project_vertex>
2688	#include <worldpos_vertex>
2689	#include <clipping_planes_vertex>
2690	vWorldPosition = worldPosition.xyz;
2691}`,ew=`#define DISTANCE
2692uniform vec3 referencePosition;
2693uniform float nearDistance;
2694uniform float farDistance;
2695varying vec3 vWorldPosition;
2696#include <common>
2697#include <packing>
2698#include <uv_pars_fragment>
2699#include <map_pars_fragment>
2700#include <alphamap_pars_fragment>
2701#include <alphatest_pars_fragment>
2702#include <alphahash_pars_fragment>
2703#include <clipping_planes_pars_fragment>
2704void main () {
2705	vec4 diffuseColor = vec4( 1.0 );
2706	#include <clipping_planes_fragment>
2707	#include <map_fragment>
2708	#include <alphamap_fragment>
2709	#include <alphatest_fragment>
2710	#include <alphahash_fragment>
2711	float dist = length( vWorldPosition - referencePosition );
2712	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2713	dist = saturate( dist );
2714	gl_FragColor = packDepthToRGBA( dist );
2715}`,tw=`varying vec3 vWorldDirection;
2716#include <common>
2717void main() {
2718	vWorldDirection = transformDirection( position, modelMatrix );
2719	#include <begin_vertex>
2720	#include <project_vertex>
2721}`,nw=`uniform sampler2D tEquirect;
2722varying vec3 vWorldDirection;
2723#include <common>
2724void main() {
2725	vec3 direction = normalize( vWorldDirection );
2726	vec2 sampleUV = equirectUv( direction );
2727	gl_FragColor = texture2D( tEquirect, sampleUV );
2728	#include <tonemapping_fragment>
2729	#include <colorspace_fragment>
2730}`,iw=`uniform float scale;
2731attribute float lineDistance;
2732varying float vLineDistance;
2733#include <common>
2734#include <uv_pars_vertex>
2735#include <color_pars_vertex>
2736#include <fog_pars_vertex>
2737#include <morphtarget_pars_vertex>
2738#include <logdepthbuf_pars_vertex>
2739#include <clipping_planes_pars_vertex>
2740void main() {
2741	vLineDistance = scale * lineDistance;
2742	#include <uv_vertex>
2743	#include <color_vertex>
2744	#include <morphinstance_vertex>
2745	#include <morphcolor_vertex>
2746	#include <begin_vertex>
2747	#include <morphtarget_vertex>
2748	#include <project_vertex>
2749	#include <logdepthbuf_vertex>
2750	#include <clipping_planes_vertex>
2751	#include <fog_vertex>
2752}`,rw=`uniform vec3 diffuse;
2753uniform float opacity;
2754uniform float dashSize;
2755uniform float totalSize;
2756varying float vLineDistance;
2757#include <common>
2758#include <color_pars_fragment>
2759#include <uv_pars_fragment>
2760#include <map_pars_fragment>
2761#include <fog_pars_fragment>
2762#include <logdepthbuf_pars_fragment>
2763#include <clipping_planes_pars_fragment>
2764void main() {
2765	vec4 diffuseColor = vec4( diffuse, opacity );
2766	#include <clipping_planes_fragment>
2767	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2768		discard;
2769	}
2770	vec3 outgoingLight = vec3( 0.0 );
2771	#include <logdepthbuf_fragment>
2772	#include <map_fragment>
2773	#include <color_fragment>
2774	outgoingLight = diffuseColor.rgb;
2775	#include <opaque_fragment>
2776	#include <tonemapping_fragment>
2777	#include <colorspace_fragment>
2778	#include <fog_fragment>
2779	#include <premultiplied_alpha_fragment>
2780}`,sw=`#include <common>
2781#include <batching_pars_vertex>
2782#include <uv_pars_vertex>
2783#include <envmap_pars_vertex>
2784#include <color_pars_vertex>
2785#include <fog_pars_vertex>
2786#include <morphtarget_pars_vertex>
2787#include <skinning_pars_vertex>
2788#include <logdepthbuf_pars_vertex>
2789#include <clipping_planes_pars_vertex>
2790void main() {
2791	#include <uv_vertex>
2792	#include <color_vertex>
2793	#include <morphinstance_vertex>
2794	#include <morphcolor_vertex>
2795	#include <batching_vertex>
2796	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2797		#include <beginnormal_vertex>
2798		#include <morphnormal_vertex>
2799		#include <skinbase_vertex>
2800		#include <skinnormal_vertex>
2801		#include <defaultnormal_vertex>
2802	#endif
2803	#include <begin_vertex>
2804	#include <morphtarget_vertex>
2805	#include <skinning_vertex>
2806	#include <project_vertex>
2807	#include <logdepthbuf_vertex>
2808	#include <clipping_planes_vertex>
2809	#include <worldpos_vertex>
2810	#include <envmap_vertex>
2811	#include <fog_vertex>
2812}`,ow=`uniform vec3 diffuse;
2813uniform float opacity;
2814#ifndef FLAT_SHADED
2815	varying vec3 vNormal;
2816#endif
2817#include <common>
2818#include <dithering_pars_fragment>
2819#include <color_pars_fragment>
2820#include <uv_pars_fragment>
2821#include <map_pars_fragment>
2822#include <alphamap_pars_fragment>
2823#include <alphatest_pars_fragment>
2824#include <alphahash_pars_fragment>
2825#include <aomap_pars_fragment>
2826#include <lightmap_pars_fragment>
2827#include <envmap_common_pars_fragment>
2828#include <envmap_pars_fragment>
2829#include <fog_pars_fragment>
2830#include <specularmap_pars_fragment>
2831#include <logdepthbuf_pars_fragment>
2832#include <clipping_planes_pars_fragment>
2833void main() {
2834	vec4 diffuseColor = vec4( diffuse, opacity );
2835	#include <clipping_planes_fragment>
2836	#include <logdepthbuf_fragment>
2837	#include <map_fragment>
2838	#include <color_fragment>
2839	#include <alphamap_fragment>
2840	#include <alphatest_fragment>
2841	#include <alphahash_fragment>
2842	#include <specularmap_fragment>
2843	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2844	#ifdef USE_LIGHTMAP
2845		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2846		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2847	#else
2848		reflectedLight.indirectDiffuse += vec3( 1.0 );
2849	#endif
2850	#include <aomap_fragment>
2851	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2852	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2853	#include <envmap_fragment>
2854	#include <opaque_fragment>
2855	#include <tonemapping_fragment>
2856	#include <colorspace_fragment>
2857	#include <fog_fragment>
2858	#include <premultiplied_alpha_fragment>
2859	#include <dithering_fragment>
2860}`,aw=`#define LAMBERT
2861varying vec3 vViewPosition;
2862#include <common>
2863#include <batching_pars_vertex>
2864#include <uv_pars_vertex>
2865#include <displacementmap_pars_vertex>
2866#include <envmap_pars_vertex>
2867#include <color_pars_vertex>
2868#include <fog_pars_vertex>
2869#include <normal_pars_vertex>
2870#include <morphtarget_pars_vertex>
2871#include <skinning_pars_vertex>
2872#include <shadowmap_pars_vertex>
2873#include <logdepthbuf_pars_vertex>
2874#include <clipping_planes_pars_vertex>
2875void main() {
2876	#include <uv_vertex>
2877	#include <color_vertex>
2878	#include <morphinstance_vertex>
2879	#include <morphcolor_vertex>
2880	#include <batching_vertex>
2881	#include <beginnormal_vertex>
2882	#include <morphnormal_vertex>
2883	#include <skinbase_vertex>
2884	#include <skinnormal_vertex>
2885	#include <defaultnormal_vertex>
2886	#include <normal_vertex>
2887	#include <begin_vertex>
2888	#include <morphtarget_vertex>
2889	#include <skinning_vertex>
2890	#include <displacementmap_vertex>
2891	#include <project_vertex>
2892	#include <logdepthbuf_vertex>
2893	#include <clipping_planes_vertex>
2894	vViewPosition = - mvPosition.xyz;
2895	#include <worldpos_vertex>
2896	#include <envmap_vertex>
2897	#include <shadowmap_vertex>
2898	#include <fog_vertex>
2899}`,lw=`#define LAMBERT
2900uniform vec3 diffuse;
2901uniform vec3 emissive;
2902uniform float opacity;
2903#include <common>
2904#include <packing>
2905#include <dithering_pars_fragment>
2906#include <color_pars_fragment>
2907#include <uv_pars_fragment>
2908#include <map_pars_fragment>
2909#include <alphamap_pars_fragment>
2910#include <alphatest_pars_fragment>
2911#include <alphahash_pars_fragment>
2912#include <aomap_pars_fragment>
2913#include <lightmap_pars_fragment>
2914#include <emissivemap_pars_fragment>
2915#include <envmap_common_pars_fragment>
2916#include <envmap_pars_fragment>
2917#include <fog_pars_fragment>
2918#include <bsdfs>
2919#include <lights_pars_begin>
2920#include <normal_pars_fragment>
2921#include <lights_lambert_pars_fragment>
2922#include <shadowmap_pars_fragment>
2923#include <bumpmap_pars_fragment>
2924#include <normalmap_pars_fragment>
2925#include <specularmap_pars_fragment>
2926#include <logdepthbuf_pars_fragment>
2927#include <clipping_planes_pars_fragment>
2928void main() {
2929	vec4 diffuseColor = vec4( diffuse, opacity );
2930	#include <clipping_planes_fragment>
2931	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2932	vec3 totalEmissiveRadiance = emissive;
2933	#include <logdepthbuf_fragment>
2934	#include <map_fragment>
2935	#include <color_fragment>
2936	#include <alphamap_fragment>
2937	#include <alphatest_fragment>
2938	#include <alphahash_fragment>
2939	#include <specularmap_fragment>
2940	#include <normal_fragment_begin>
2941	#include <normal_fragment_maps>
2942	#include <emissivemap_fragment>
2943	#include <lights_lambert_fragment>
2944	#include <lights_fragment_begin>
2945	#include <lights_fragment_maps>
2946	#include <lights_fragment_end>
2947	#include <aomap_fragment>
2948	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2949	#include <envmap_fragment>
2950	#include <opaque_fragment>
2951	#include <tonemapping_fragment>
2952	#include <colorspace_fragment>
2953	#include <fog_fragment>
2954	#include <premultiplied_alpha_fragment>
2955	#include <dithering_fragment>
2956}`,cw=`#define MATCAP
2957varying vec3 vViewPosition;
2958#include <common>
2959#include <batching_pars_vertex>
2960#include <uv_pars_vertex>
2961#include <color_pars_vertex>
2962#include <displacementmap_pars_vertex>
2963#include <fog_pars_vertex>
2964#include <normal_pars_vertex>
2965#include <morphtarget_pars_vertex>
2966#include <skinning_pars_vertex>
2967#include <logdepthbuf_pars_vertex>
2968#include <clipping_planes_pars_vertex>
2969void main() {
2970	#include <uv_vertex>
2971	#include <color_vertex>
2972	#include <morphinstance_vertex>
2973	#include <morphcolor_vertex>
2974	#include <batching_vertex>
2975	#include <beginnormal_vertex>
2976	#include <morphnormal_vertex>
2977	#include <skinbase_vertex>
2978	#include <skinnormal_vertex>
2979	#include <defaultnormal_vertex>
2980	#include <normal_vertex>
2981	#include <begin_vertex>
2982	#include <morphtarget_vertex>
2983	#include <skinning_vertex>
2984	#include <displacementmap_vertex>
2985	#include <project_vertex>
2986	#include <logdepthbuf_vertex>
2987	#include <clipping_planes_vertex>
2988	#include <fog_vertex>
2989	vViewPosition = - mvPosition.xyz;
2990}`,uw=`#define MATCAP
2991uniform vec3 diffuse;
2992uniform float opacity;
2993uniform sampler2D matcap;
2994varying vec3 vViewPosition;
2995#include <common>
2996#include <dithering_pars_fragment>
2997#include <color_pars_fragment>
2998#include <uv_pars_fragment>
2999#include <map_pars_fragment>
3000#include <alphamap_pars_fragment>
3001#include <alphatest_pars_fragment>
3002#include <alphahash_pars_fragment>
3003#include <fog_pars_fragment>
3004#include <normal_pars_fragment>
3005#include <bumpmap_pars_fragment>
3006#include <normalmap_pars_fragment>
3007#include <logdepthbuf_pars_fragment>
3008#include <clipping_planes_pars_fragment>
3009void main() {
3010	ve
3010c4 diffuseColor = vec4( diffuse, opacity );
3011	#include <clipping_planes_fragment>
3012	#include <logdepthbuf_fragment>
3013	#include <map_fragment>
3014	#include <color_fragment>
3015	#include <alphamap_fragment>
3016	#include <alphatest_fragment>
3017	#include <alphahash_fragment>
3018	#include <normal_fragment_begin>
3019	#include <normal_fragment_maps>
3020	vec3 viewDir = normalize( vViewPosition );
3021	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3022	vec3 y = cross( viewDir, x );
3023	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3024	#ifdef USE_MATCAP
3025		vec4 matcapColor = texture2D( matcap, uv );
3026	#else
3027		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3028	#endif
3029	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3030	#include <opaque_fragment>
3031	#include <tonemapping_fragment>
3032	#include <colorspace_fragment>
3033	#include <fog_fragment>
3034	#include <premultiplied_alpha_fragment>
3035	#include <dithering_fragment>
3036}`,hw=`#define NORMAL
3037#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3038	varying vec3 vViewPosition;
3039#endif
3040#include <common>
3041#include <batching_pars_vertex>
3042#include <uv_pars_vertex>
3043#include <displacementmap_pars_vertex>
3044#include <normal_pars_vertex>
3045#include <morphtarget_pars_vertex>
3046#include <skinning_pars_vertex>
3047#include <logdepthbuf_pars_vertex>
3048#include <clipping_planes_pars_vertex>
3049void main() {
3050	#include <uv_vertex>
3051	#include <batching_vertex>
3052	#include <beginnormal_vertex>
3053	#include <morphinstance_vertex>
3054	#include <morphnormal_vertex>
3055	#include <skinbase_vertex>
3056	#include <skinnormal_vertex>
3057	#include <defaultnormal_vertex>
3058	#include <normal_vertex>
3059	#include <begin_vertex>
3060	#include <morphtarget_vertex>
3061	#include <skinning_vertex>
3062	#include <displacementmap_vertex>
3063	#include <project_vertex>
3064	#include <logdepthbuf_vertex>
3065	#include <clipping_planes_vertex>
3066#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3067	vViewPosition = - mvPosition.xyz;
3068#endif
3069}`,fw=`#define NORMAL
3070uniform float opacity;
3071#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3072	varying vec3 vViewPosition;
3073#endif
3074#include <packing>
3075#include <uv_pars_fragment>
3076#include <normal_pars_fragment>
3077#include <bumpmap_pars_fragment>
3078#include <normalmap_pars_fragment>
3079#include <logdepthbuf_pars_fragment>
3080#include <clipping_planes_pars_fragment>
3081void main() {
3082	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3083	#include <clipping_planes_fragment>
3084	#include <logdepthbuf_fragment>
3085	#include <normal_fragment_begin>
3086	#include <normal_fragment_maps>
3087	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3088	#ifdef OPAQUE
3089		gl_FragColor.a = 1.0;
3090	#endif
3091}`,dw=`#define PHONG
3092varying vec3 vViewPosition;
3093#include <common>
3094#include <batching_pars_vertex>
3095#include <uv_pars_vertex>
3096#include <displacementmap_pars_vertex>
3097#include <envmap_pars_vertex>
3098#include <color_pars_vertex>
3099#include <fog_pars_vertex>
3100#include <normal_pars_vertex>
3101#include <morphtarget_pars_vertex>
3102#include <skinning_pars_vertex>
3103#include <shadowmap_pars_vertex>
3104#include <logdepthbuf_pars_vertex>
3105#include <clipping_planes_pars_vertex>
3106void main() {
3107	#include <uv_vertex>
3108	#include <color_vertex>
3109	#include <morphcolor_vertex>
3110	#include <batching_vertex>
3111	#include <beginnormal_vertex>
3112	#include <morphinstance_vertex>
3113	#include <morphnormal_vertex>
3114	#include <skinbase_vertex>
3115	#include <skinnormal_vertex>
3116	#include <defaultnormal_vertex>
3117	#include <normal_vertex>
3118	#include <begin_vertex>
3119	#include <morphtarget_vertex>
3120	#include <skinning_vertex>
3121	#include <displacementmap_vertex>
3122	#include <project_vertex>
3123	#include <logdepthbuf_vertex>
3124	#include <clipping_planes_vertex>
3125	vViewPosition = - mvPosition.xyz;
3126	#include <worldpos_vertex>
3127	#include <envmap_vertex>
3128	#include <shadowmap_vertex>
3129	#include <fog_vertex>
3130}`,pw=`#define PHONG
3131uniform vec3 diffuse;
3132uniform vec3 emissive;
3133uniform vec3 specular;
3134uniform float shininess;
3135uniform float opacity;
3136#include <common>
3137#include <packing>
3138#include <dithering_pars_fragment>
3139#include <color_pars_fragment>
3140#include <uv_pars_fragment>
3141#include <map_pars_fragment>
3142#include <alphamap_pars_fragment>
3143#include <alphatest_pars_fragment>
3144#include <alphahash_pars_fragment>
3145#include <aomap_pars_fragment>
3146#include <lightmap_pars_fragment>
3147#include <emissivemap_pars_fragment>
3148#include <envmap_common_pars_fragment>
3149#include <envmap_pars_fragment>
3150#include <fog_pars_fragment>
3151#include <bsdfs>
3152#include <lights_pars_begin>
3153#include <normal_pars_fragment>
3154#include <lights_phong_pars_fragment>
3155#include <shadowmap_pars_fragment>
3156#include <bumpmap_pars_fragment>
3157#include <normalmap_pars_fragment>
3158#include <specularmap_pars_fragment>
3159#include <logdepthbuf_pars_fragment>
3160#include <clipping_planes_pars_fragment>
3161void main() {
3162	vec4 diffuseColor = vec4( diffuse, opacity );
3163	#include <clipping_planes_fragment>
3164	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3165	vec3 totalEmissiveRadiance = emissive;
3166	#include <logdepthbuf_fragment>
3167	#include <map_fragment>
3168	#include <color_fragment>
3169	#include <alphamap_fragment>
3170	#include <alphatest_fragment>
3171	#include <alphahash_fragment>
3172	#include <specularmap_fragment>
3173	#include <normal_fragment_begin>
3174	#include <normal_fragment_maps>
3175	#include <emissivemap_fragment>
3176	#include <lights_phong_fragment>
3177	#include <lights_fragment_begin>
3178	#include <lights_fragment_maps>
3179	#include <lights_fragment_end>
3180	#include <aomap_fragment>
3181	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3182	#include <envmap_fragment>
3183	#include <opaque_fragment>
3184	#include <tonemapping_fragment>
3185	#include <colorspace_fragment>
3186	#include <fog_fragment>
3187	#include <premultiplied_alpha_fragment>
3188	#include <dithering_fragment>
3189}`,mw=`#define STANDARD
3190varying vec3 vViewPosition;
3191#ifdef USE_TRANSMISSION
3192	varying vec3 vWorldPosition;
3193#endif
3194#include <common>
3195#include <batching_pars_vertex>
3196#include <uv_pars_vertex>
3197#include <displacementmap_pars_vertex>
3198#include <color_pars_vertex>
3199#include <fog_pars_vertex>
3200#include <normal_pars_vertex>
3201#include <morphtarget_pars_vertex>
3202#include <skinning_pars_vertex>
3203#include <shadowmap_pars_vertex>
3204#include <logdepthbuf_pars_vertex>
3205#include <clipping_planes_pars_vertex>
3206void main() {
3207	#include <uv_vertex>
3208	#include <color_vertex>
3209	#include <morphinstance_vertex>
3210	#include <morphcolor_vertex>
3211	#include <batching_vertex>
3212	#include <beginnormal_vertex>
3213	#include <morphnormal_vertex>
3214	#include <skinbase_vertex>
3215	#include <skinnormal_vertex>
3216	#include <defaultnormal_vertex>
3217	#include <normal_vertex>
3218	#include <begin_vertex>
3219	#include <morphtarget_vertex>
3220	#include <skinning_vertex>
3221	#include <displacementmap_vertex>
3222	#include <project_vertex>
3223	#include <logdepthbuf_vertex>
3224	#include <clipping_planes_vertex>
3225	vViewPosition = - mvPosition.xyz;
3226	#include <worldpos_vertex>
3227	#include <shadowmap_vertex>
3228	#include <fog_vertex>
3229#ifdef USE_TRANSMISSION
3230	vWorldPosition = worldPosition.xyz;
3231#endif
3232}`,gw=`#define STANDARD
3233#ifdef PHYSICAL
3234	#define IOR
3235	#define USE_SPECULAR
3236#endif
3237uniform vec3 diffuse;
3238uniform vec3 emissive;
3239uniform float roughness;
3240uniform float metalness;
3241uniform float opacity;
3242#ifdef IOR
3243	uniform float ior;
3244#endif
3245#ifdef USE_SPECULAR
3246	uniform float specularIntensity;
3247	uniform vec3 specularColor;
3248	#ifdef USE_SPECULAR_COLORMAP
3249		uniform sampler2D specularColorMap;
3250	#endif
3251	#ifdef USE_SPECULAR_INTENSITYMAP
3252		uniform sampler2D specularIntensityMap;
3253	#endif
3254#endif
3255#ifdef USE_CLEARCOAT
3256	uniform float clearcoat;
3257	uniform float clearcoatRoughness;
3258#endif
3259#ifdef USE_DISPERSION
3260	uniform float dispersion;
3261#endif
3262#ifdef USE_IRIDESCENCE
3263	uniform float iridescence;
3264	uniform float iridescenceIOR;
3265	uniform float iridescenceThicknessMinimum;
3266	uniform float iridescenceThicknessMaximum;
3267#endif
3268#ifdef USE_SHEEN
3269	uniform vec3 sheenColor;
3270	uniform float sheenRoughness;
3271	#ifdef USE_SHEEN_COLORMAP
3272		uniform sampler2D sheenColorMap;
3273	#endif
3274	#ifdef USE_SHEEN_ROUGHNESSMAP
3275		uniform sampler2D sheenRoughnessMap;
3276	#endif
3277#endif
3278#ifdef USE_ANISOTROPY
3279	uniform vec2 anisotropyVector;
3280	#ifdef USE_ANISOTROPYMAP
3281		uniform sampler2D anisotropyMap;
3282	#endif
3283#endif
3284varying vec3 vViewPosition;
3285#include <common>
3286#include <packing>
3287#include <dithering_pars_fragment>
3288#include <color_pars_fragment>
3289#include <uv_pars_fragment>
3290#include <map_pars_fragment>
3291#include <alphamap_pars_fragment>
3292#include <alphatest_pars_fragment>
3293#include <alphahash_pars_fragment>
3294#include <aomap_pars_fragment>
3295#include <lightmap_pars_fragment>
3296#include <emissivemap_pars_fragment>
3297#include <iridescence_fragment>
3298#include <cube_uv_reflection_fragment>
3299#include <envmap_common_pars_fragment>
3300#include <envmap_physical_pars_fragment>
3301#include <fog_pars_fragment>
3302#include <lights_pars_begin>
3303#include <normal_pars_fragment>
3304#include <lights_physical_pars_fragment>
3305#include <transmission_pars_fragment>
3306#include <shadowmap_pars_fragment>
3307#include <bumpmap_pars_fragment>
3308#include <normalmap_pars_fragment>
3309#include <clearcoat_pars_fragment>
3310#include <iridescence_pars_fragment>
3311#include <roughnessmap_pars_fragment>
3312#include <metalnessmap_pars_fragment>
3313#include <logdepthbuf_pars_fragment>
3314#include <clipping_planes_pars_fragment>
3315void main() {
3316	vec4 diffuseColor = vec4( diffuse, opacity );
3317	#include <clipping_planes_fragment>
3318	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3319	vec3 totalEmissiveRadiance = emissive;
3320	#include <logdepthbuf_fragment>
3321	#include <map_fragment>
3322	#include <color_fragment>
3323	#include <alphamap_fragment>
3324	#include <alphatest_fragment>
3325	#include <alphahash_fragment>
3326	#include <roughnessmap_fragment>
3327	#include <metalnessmap_fragment>
3328	#include <normal_fragment_begin>
3329	#include <normal_fragment_maps>
3330	#include <clearcoat_normal_fragment_begin>
3331	#include <clearcoat_normal_fragment_maps>
3332	#include <emissivemap_fragment>
3333	#include <lights_physical_fragment>
3334	#include <lights_fragment_begin>
3335	#include <lights_fragment_maps>
3336	#include <lights_fragment_end>
3337	#include <aomap_fragment>
3338	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3339	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3340	#include <transmission_fragment>
3341	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3342	#ifdef USE_SHEEN
3343		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3344		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3345	#endif
3346	#ifdef USE_CLEARCOAT
3347		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3348		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3349		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3350	#endif
3351	#include <opaque_fragment>
3352	#include <tonemapping_fragment>
3353	#include <colorspace_fragment>
3354	#include <fog_fragment>
3355	#include <premultiplied_alpha_fragment>
3356	#include <dithering_fragment>
3357}`,vw=`#define TOON
3358varying vec3 vViewPosition;
3359#include <common>
3360#include <batching_pars_vertex>
3361#include <uv_pars_vertex>
3362#include <displacementmap_pars_vertex>
3363#include <color_pars_vertex>
3364#include <fog_pars_vertex>
3365#include <normal_pars_vertex>
3366#include <morphtarget_pars_vertex>
3367#include <skinning_pars_vertex>
3368#include <shadowmap_pars_vertex>
3369#include <logdepthbuf_pars_vertex>
3370#include <clipping_planes_pars_vertex>
3371void main() {
3372	#include <uv_vertex>
3373	#include <color_vertex>
3374	#include <morphinstance_vertex>
3375	#include <morphcolor_vertex>
3376	#include <batching_vertex>
3377	#include <beginnormal_vertex>
3378	#include <morphnormal_vertex>
3379	#include <skinbase_vertex>
3380	#include <skinnormal_vertex>
3381	#include <defaultnormal_vertex>
3382	#include <normal_vertex>
3383	#include <begin_vertex>
3384	#include <morphtarget_vertex>
3385	#include <skinning_vertex>
3386	#include <displacementmap_vertex>
3387	#include <project_vertex>
3388	#include <logdepthbuf_vertex>
3389	#include <clipping_planes_vertex>
3390	vViewPosition = - mvPosition.xyz;
3391	#include <worldpos_vertex>
3392	#include <shadowmap_vertex>
3393	#include <fog_vertex>
3394}`,_w=`#define TOON
3395uniform vec3 diffuse;
3396uniform vec3 emissive;
3397uniform float opacity;
3398#include <common>
3399#include <packing>
3400#include <dithering_pars_fragment>
3401#include <color_pars_fragment>
3402#include <uv_pars_fragment>
3403#include <map_pars_fragment>
3404#include <alphamap_pars_fragment>
3405#include <alphatest_pars_fragment>
3406#include <alphahash_pars_fragment>
3407#include <aomap_pars_fragment>
3408#include <lightmap_pars_fragment>
3409#include <emissivemap_pars_fragment>
3410#include <gradientmap_pars_fragment>
3411#include <fog_pars_fragment>
3412#include <bsdfs>
3413#include <lights_pars_begin>
3414#include <normal_pars_fragment>
3415#include <lights_toon_pars_fragment>
3416#include <shadowmap_pars_fragment>
3417#include <bumpmap_pars_fragment>
3418#include <normalmap_pars_fragment>
3419#include <logdepthbuf_pars_fragment>
3420#include <clipping_planes_pars_fragment>
3421void main() {
3422	vec4 diffuseColor = vec4( diffuse, opacity );
3423	#include <clipping_planes_fragment>
3424	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3425	vec3 totalEmissiveRadiance = emissive;
3426	#include <logdepthbuf_fragment>
3427	#include <map_fragment>
3428	#include <color_fragment>
3429	#include <alphamap_fragment>
3430	#include <alphatest_fragment>
3431	#include <alphahash_fragment>
3432	#include <normal_fragment_begin>
3433	#include <normal_fragment_maps>
3434	#include <emissivemap_fragment>
3435	#include <lights_toon_fragment>
3436	#include <lights_fragment_begin>
3437	#include <lights_fragment_maps>
3438	#include <lights_fragment_end>
3439	#include <aomap_fragment>
3440	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3441	#include <opaque_fragment>
3442	#include <tonemapping_fragment>
3443	#include <colorspace_fragment>
3444	#include <fog_fragment>
3445	#include <premultiplied_alpha_fragment>
3446	#include <dithering_fragment>
3447}`,yw=`uniform float size;
3448uniform float scale;
3449#include <common>
3450#include <color_pars_vertex>
3451#include <fog_pars_vertex>
3452#include <morphtarget_pars_vertex>
3453#include <logdepthbuf_pars_vertex>
3454#include <clipping_planes_pars_vertex>
3455#ifdef USE_POINTS_UV
3456	varying vec2 vUv;
3457	uniform mat3 uvTransform;
3458#endif
3459void main() {
3460	#ifdef USE_POINTS_UV
3461		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3462	#endif
3463	#include <color_vertex>
3464	#include <morphinstance_vertex>
3465	#include <morphcolor_vertex>
3466	#include <begin_vertex>
3467	#include <morphtarget_vertex>
3468	#include <project_vertex>
3469	gl_PointSize = size;
3470	#ifdef USE_SIZEATTENUATION
3471		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3472		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3473	#endif
3474	#include <logdepthbuf_vertex>
3475	#include <clipping_planes_vertex>
3476	#include <worldpos_vertex>
3477	#include <fog_vertex>
3478}`,xw=`uniform vec3 diffuse;
3479uniform float opacity;
3480#include <common>
3481#include <color_pars_fragment>
3482#include <map_particle_pars_fragment>
3483#include <alphatest_pars_fragment>
3484#include <alphahash_pars_fragment>
3485#include <fog_pars_fragment>
3486#include <logdepthbuf_pars_fragment>
3487#include <clipping_planes_pars_fragment>
3488void main() {
3489	vec4 diffuseColor = vec4( diffuse, opacity );
3490	#include <clipping_planes_fragment>
3491	vec3 outgoingLight = vec3( 0.0 );
3492	#include <logdepthbuf_fragment>
3493	#include <map_particle_fragment>
3494	#include <color_fragment>
3495	#include <alphatest_fragment>
3496	#include <alphahash_fragment>
3497	outgoingLight = diffuseColor.rgb;
3498	#include <opaque_fragment>
3499	#include <tonemapping_fragment>
3500	#include <colorspace_fragment>
3501	#include <fog_fragment>
3502	#include <premultiplied_alpha_fragment>
3503}`,Sw=`#include <common>
3504#include <batching_pars_vertex>
3505#include <fog_pars_vertex>
3506#include <morphtarget_pars_vertex>
3507#include <skinning_pars_vertex>
3508#include <logdepthbuf_pars_vertex>
3509#include <shadowmap_pars_vertex>
3510void main() {
3511	#include <batching_vertex>
3512	#include <beginnormal_vertex>
3513	#include <morphinstance_vertex>
3514	#include <morphnormal_vertex>
3515	#include <skinbase_vertex>
3516	#include <skinnormal_vertex>
3517	#include <defaultnormal_vertex>
3518	#include <begin_vertex>
3519	#include <morphtarget_vertex>
3520	#include <skinning_vertex>
3521	#include <project_vertex>
3522	#include <logdepthbuf_vertex>
3523	#include <worldpos_vertex>
3524	#include <shadowmap_vertex>
3525	#include <fog_vertex>
3526}`,Mw=`uniform vec3 color;
3527uniform float opacity;
3528#include <common>
3529#include <packing>
3530#include <fog_pars_fragment>
3531#include <bsdfs>
3532#include <lights_pars_begin>
3533#include <logdepthbuf_pars_fragment>
3534#include <shadowmap_pars_fragment>
3535#include <shadowmask_pars_fragment>
3536void main() {
3537	#include <logdepthbuf_fragment>
3538	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3539	#include <tonemapping_fragment>
3540	#include <colorspace_fragment>
3541	#include <fog_fragment>
3542}`,Ew=`uniform float rotation;
3543uniform vec2 center;
3544#include <common>
3545#include <uv_pars_vertex>
3546#include <fog_pars_vertex>
3547#include <logdepthbuf_pars_vertex>
3548#include <clipping_planes_pars_vertex>
3549void main() {
3550	#include <uv_vertex>
3551	vec4 mvPosition = modelViewMatrix[ 3 ];
3552	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3553	#ifndef USE_SIZEATTENUATION
3554		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3555		if ( isPerspective ) scale *= - mvPosition.z;
3556	#endif
3557	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3558	vec2 rotatedPosition;
3559	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3560	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3561	mvPosition.xy += rotatedPosition;
3562	gl_Position = projectionMatrix * mvPosition;
3563	#include <logdepthbuf_vertex>
3564	#include <clipping_planes_vertex>
3565	#include <fog_vertex>
3566}`,ww=`uniform vec3 diffuse;
3567uniform float opacity;
3568#include <common>
3569#include <uv_pars_fragment>
3570#include <map_pars_fragment>
3571#include <alphamap_pars_fragment>
3572#include <alphatest_pars_fragment>
3573#include <alphahash_pars_fragment>
3574#include <fog_pars_fragment>
3575#include <logdepthbuf_pars_fragment>
3576#include <clipping_planes_pars_fragment>
3577void main() {
3578	vec4 diffuseColor = vec4( diffuse, opacity );
3579	#include <clipping_planes_fragment>
3580	vec3 outgoingLight = vec3( 0.0 );
3581	#include <logdepthbuf_fragment>
3582	#include <map_fragment>
3583	#include <alphamap_fragment>
3584	#include <alphatest_fragment>
3585	#include <alphahash_fragment>
3586	outgoingLight = diffuseColor.rgb;
3587	#include <opaque_fragment>
3588	#include <tonemapping_fragment>
3589	#include <colorspace_fragment>
3590	#include <fog_fragment>
3591}`,yt={alphahash_fragment:YM,alphahash_pars_fragment:qM,alphamap_fragment:Z
vendor: 7,331 bytes, line 3591
3591M,alphamap_pars_fragment:jM,alphatest_fragment:JM,alphatest_pars_fragment:KM,aomap_fragment:QM,aomap_pars_fragment:$M,batching_pars_vertex:e1,batching_vertex:t1,begin_vertex:n1,beginnormal_vertex:i1,bsdfs:r1,iridescence_fragment:s1,bumpmap_pars_fragment:o1,clipping_planes_fragment:a1,clipping_planes_pars_fragment:l1,clipping_planes_pars_vertex:c1,clipping_planes_vertex:u1,color_fragment:h1,color_pars_fragment:f1,color_pars_vertex:d1,color_vertex:p1,common:m1,cube_uv_reflection_fragment:g1,defaultnormal_vertex:v1,displacementmap_pars_vertex:_1,displacementmap_vertex:y1,emissivemap_fragment:x1,emissivemap_pars_fragment:S1,colorspace_fragment:M1,colorspace_pars_fragment:E1,envmap_fragment:w1,envmap_common_pars_fragment:T1,envmap_pars_fragment:b1,envmap_pars_vertex:A1,envmap_physical_pars_fragment:B1,envmap_vertex:C1,fog_vertex:R1,fog_pars_vertex:P1,fog_fragment:I1,fog_pars_fragment:L1,gradientmap_pars_fragment:D1,lightmap_pars_fragment:U1,lights_lambert_fragment:N1,lights_lambert_pars_fragment:O1,lights_pars_begin:F1,lights_toon_fragment:z1,lights_toon_pars_fragment:k1,lights_phong_fragment:V1,lights_phong_pars_fragment:H1,lights_physical_fragment:G1,lights_physical_pars_fragment:W1,lights_fragment_begin:X1,lights_fragment_maps:Y1,lights_fragment_end:q1,logdepthbuf_fragment:Z1,logdepthbuf_pars_fragment:j1,logdepthbuf_pars_vertex:J1,logdepthbuf_vertex:K1,map_fragment:Q1,map_pars_fragment:$1,map_particle_fragment:eE,map_particle_pars_fragment:tE,metalnessmap_fragment:nE,metalnessmap_pars_fragment:iE,morphinstance_vertex:rE,morphcolor_vertex:sE,morphnormal_vertex:oE,morphtarget_pars_vertex:aE,morphtarget_vertex:lE,normal_fragment_begin:cE,normal_fragment_maps:uE,normal_pars_fragment:hE,normal_pars_vertex:fE,normal_vertex:dE,normalmap_pars_fragment:pE,clearcoat_normal_fragment_begin:mE,clearcoat_normal_fragment_maps:gE,clearcoat_pars_fragment:vE,iridescence_pars_fragment:_E,opaque_fragment:yE,packing:xE,premultiplied_alpha_fragment:SE,project_vertex:ME,dithering_fragment:EE,dithering_pars_fragment:wE,roughnessmap_fragment:TE,roughnessmap_pars_fragment:bE,shadowmap_pars_fragment:AE,shadowmap_pars_vertex:CE,shadowmap_vertex:RE,shadowmask_pars_fragment:PE,skinbase_vertex:IE,skinning_pars_vertex:LE,skinning_vertex:DE,skinnormal_vertex:UE,specularmap_fragment:NE,specularmap_pars_fragment:OE,tonemapping_fragment:FE,tonemapping_pars_fragment:BE,transmission_fragment:zE,transmission_pars_fragment:kE,uv_pars_fragment:VE,uv_pars_vertex:HE,uv_vertex:GE,worldpos_vertex:WE,background_vert:XE,background_frag:YE,backgroundCube_vert:qE,backgroundCube_frag:ZE,cube_vert:jE,cube_frag:JE,depth_vert:KE,depth_frag:QE,distanceRGBA_vert:$E,distanceRGBA_frag:ew,equirect_vert:tw,equirect_frag:nw,linedashed_vert:iw,linedashed_frag:rw,meshbasic_vert:sw,meshbasic_frag:ow,meshlambert_vert:aw,meshlambert_frag:lw,meshmatcap_vert:cw,meshmatcap_frag:uw,meshnormal_vert:hw,meshnormal_frag:fw,meshphong_vert:dw,meshphong_frag:pw,meshphysical_vert:mw,meshphysical_frag:gw,meshtoon_vert:vw,meshtoon_frag:_w,points_vert:yw,points_frag:xw,shadow_vert:Sw,shadow_frag:Mw,sprite_vert:Ew,sprite_frag:ww},Ae={common:{diffuse:{value:new Ve(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new gt},alphaMap:{value:null},alphaMapTransform:{value:new gt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new gt}},envmap:{envMap:{value:null},envMapRotation:{value:new gt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new gt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new gt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new gt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new gt},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new gt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new gt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new gt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new gt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ve(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 Ve(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new gt},alphaTest:{value:0},uvTransform:{value:new gt}},sprite:{diffuse:{value:new Ve(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new gt},alphaMap:{value:null},alphaMapTransform:{value:new gt},alphaTest:{value:0}}},bi={basic:{uniforms:kn([Ae.common,Ae.specularmap,Ae.envmap,Ae.aomap,Ae.lightmap,Ae.fog]),vertexShader:yt.meshbasic_vert,fragmentShader:yt.meshbasic_frag},lambert:{uniforms:kn([Ae.common,Ae.specularmap,Ae.envmap,Ae.aomap,Ae.lightmap,Ae.emissivemap,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.fog,Ae.lights,{emissive:{value:new Ve(0)}}]),vertexShader:yt.meshlambert_vert,fragmentShader:yt.meshlambert_frag},phong:{uniforms:kn([Ae.common,Ae.specularmap,Ae.envmap,Ae.aomap,Ae.lightmap,Ae.emissivemap,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.fog,Ae.lights,{emissive:{value:new Ve(0)},specular:{value:new Ve(1118481)},shininess:{value:30}}]),vertexShader:yt.meshphong_vert,fragmentShader:yt.meshphong_frag},standard:{uniforms:kn([Ae.common,Ae.envmap,Ae.aomap,Ae.lightmap,Ae.emissivemap,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.roughnessmap,Ae.metalnessmap,Ae.fog,Ae.lights,{emissive:{value:new Ve(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:yt.meshphysical_vert,fragmentShader:yt.meshphysical_frag},toon:{uniforms:kn([Ae.common,Ae.aomap,Ae.lightmap,Ae.emissivemap,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.gradientmap,Ae.fog,Ae.lights,{emissive:{value:new Ve(0)}}]),vertexShader:yt.meshtoon_vert,fragmentShader:yt.meshtoon_frag},matcap:{uniforms:kn([Ae.common,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,Ae.fog,{matc
vendor: 5,263 bytes, line 3591
3591ap:{value:null}}]),vertexShader:yt.meshmatcap_vert,fragmentShader:yt.meshmatcap_frag},points:{uniforms:kn([Ae.points,Ae.fog]),vertexShader:yt.points_vert,fragmentShader:yt.points_frag},dashed:{uniforms:kn([Ae.common,Ae.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:yt.linedashed_vert,fragmentShader:yt.linedashed_frag},depth:{uniforms:kn([Ae.common,Ae.displacementmap]),vertexShader:yt.depth_vert,fragmentShader:yt.depth_frag},normal:{uniforms:kn([Ae.common,Ae.bumpmap,Ae.normalmap,Ae.displacementmap,{opacity:{value:1}}]),vertexShader:yt.meshnormal_vert,fragmentShader:yt.meshnormal_frag},sprite:{uniforms:kn([Ae.sprite,Ae.fog]),vertexShader:yt.sprite_vert,fragmentShader:yt.sprite_frag},background:{uniforms:{uvTransform:{value:new gt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:yt.background_vert,fragmentShader:yt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new gt}},vertexShader:yt.backgroundCube_vert,fragmentShader:yt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:yt.cube_vert,fragmentShader:yt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:yt.equirect_vert,fragmentShader:yt.equirect_frag},distanceRGBA:{uniforms:kn([Ae.common,Ae.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:yt.distanceRGBA_vert,fragmentShader:yt.distanceRGBA_frag},shadow:{uniforms:kn([Ae.lights,Ae.fog,{color:{value:new Ve(0)},opacity:{value:1}}]),vertexShader:yt.shadow_vert,fragmentShader:yt.shadow_frag}};bi.physical={uniforms:kn([bi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new gt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new gt},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new gt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new gt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new gt},sheen:{value:0},sheenColor:{value:new Ve(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new gt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new gt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new gt},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new gt},attenuationDistance:{value:0},attenuationColor:{value:new Ve(0)},specularColor:{value:new Ve(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new gt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new gt},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new gt}}]),vertexShader:yt.meshphysical_vert,fragmentShader:yt.meshphysical_frag};const Cc={r:0,b:0,g:0},as=new ai,Tw=new ut;function bw(r,e,t,n,i,s,a){const c=new Ve(0);let u=s===!0?0:1,h,f,p=null,m=0,g=null;function y(w){let E=w.isScene===!0?w.background:null;return E&&E.isTexture&&(E=(w.backgroundBlurriness>0?t:e).get(E)),E}function M(w){let E=!1;const T=y(w);T===null?_(c,u):T&&T.isColor&&(_(T,1),E=!0);const U=r.xr.getEnvironmentBlendMode();U==="additive"?n.buffers.color.setClear(0,0,0,1,a):U==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||E)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function x(w,E){const T=y(E);T&&(T.isCubeTexture||T.mapping===Bo)?(f===void 0&&(f=new nn(new Fs(1,1,1),new _i({name:"BackgroundCubeMaterial",uniforms:Uo(bi.backgroundCube.uniforms),vertexShader:bi.backgroundCube.vertexShader,fragmentShader:bi.backgroundCube.fragmentShader,side:Hn,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(U,R,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(f)),as.copy(E.backgroundRotation),as.x*=-1,as.y*=-1,as.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(as.y*=-1,as.z*=-1),f.material.uniforms.envMap.value=T,f.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(Tw.makeRotationFromEuler(as)),f.material.toneMapped=Pt.getTransfer(T.colorSpace)!==Ft,(p!==T||m!==T.version||g!==r.toneMapping)&&(f.material.needsUpdate=!0,p=T,m=T.version,g=r.toneMapping),f.layers.enableAll(),w.unshift(f,f.geometry,f.material,0,0,null)):T&&T.isTexture&&(h===void 0&&(h=new nn(new ko(2,2),new _i({name:"Backgroun
3591dMaterial",uniforms:Uo(bi.background.uniforms),vertexShader:bi.background.vertexShader,fragmentShader:bi.background.fragmentShader,side:vr,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(h)),h.material.uniforms.t2D.value=T,h.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,h.material.toneMapped=Pt.getTransfer(T.colorSpace)!==Ft,T.matrixAutoUpdate===!0&&T.updateMatrix(),h.material.uniforms.uvTransform.value.copy(T.matrix),(p!==T||m!==T.version||g!==r.toneMapping)&&(h.material.needsUpdate=!0,p=T,m=T.version,g=r.toneMapping),h.layers.enableAll(),w.unshift(h,h.geometry,h.material,0,0,null))}function _(w,E){w.getRGB(Cc,D_(r)),n.buffers.color.setClear(Cc.r,Cc.g,Cc.b,E,a)}return{getClearColor:function(){return c},setClearColor:function(w,E=1){c.set(w),u=E,_(c,u)},getClearAlpha:function(){return u},setClearAlpha:function(w){u=w,_(c,u)},render:M,addToRenderList:x}}function Aw(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let s=i,a=!1;function c(A,N,Z,q,K){let ce=!1;const Q=p(q,Z,N);s!==Q&&(s=Q,h(s.object)),ce=g(A,q,Z,K),ce&&y(A,q,Z,K),K!==null&&e.update(K,r.ELEMENT_ARRAY_BUFFER),(ce||a)&&(a=!1,T(A,N,Z,q),K!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(K).buffer))}function u(){return r.createVertexArray()}function h(A){return r.bindVertexArray(A)}function f(A){return r.deleteVertexArray(A)}function p(A,N,Z){const q=Z.wireframe===!0;let K=n[A.id];K===void 0&&(K={},n[A.id]=K);let ce=K[N.id];ce===void 0&&(ce={},K[N.id]=ce);let Q=ce[q];return Q===void 0&&(Q=m(u()),ce[q]=Q),Q}function m(A){const N=[],Z=[],q=[];for(let K=0;K<t;K++)N[K]=0,Z[K]=0,q[K]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:Z,attributeDivisors:q,object:A,attributes:{},index:null}}function g(A,N,Z,q){const K=s.attributes,ce=N.attributes;let Q=0;const ve=Z.getAttributes();for(const V in ve)if(ve[V].location>=0){const ie=K[V];let de=ce[V];if(de===void 0&&(V==="instanceMatrix"&&A.instanceMatrix&&(de=A.instanceMatrix),V==="instanceColor"&&A.instanceColor&&(de=A.instanceColor)),ie===void 0||ie.attribute!==de||de&&ie.data!==de.data)return!0;Q++}return s.attributesNum!==Q||s.index!==q}function y(A,N,Z,q){const K={},ce=N.attributes;let Q=0;const ve=Z.getAttributes();for(const V in ve)if(ve[V].location>=0){let ie=ce[V];ie===void 0&&(V==="instanceMatrix"&&A.instanceMatrix&&(ie=A.instanceMatrix),V==="instanceColor"&&A.instanceColor&&(ie=A.instanceColor));const de={};de.attribute=ie,ie&&ie.data&&(de.data=ie.data),K[V]=de,Q++}s.attributes=K,s.attributesNum=Q,s.index=q}function M(){const A=s.newAttributes;for(let N=0,Z=A.length;N<Z;N++)A[N]=0}function x(A){_(A,0)}function _(A,N){const Z=s.newAttributes,q=s.enabledAttributes,K=s.attributeDivisors;Z[A]=1,q[A]===0&&(r.enableVertexAttribArray(A),q[A]=1),K[A]!==N&&(r.vertexAttribDivisor(A,N),K[A]=N)}function w(){const A=s.newAttributes,N=s.enabledAttributes;for(let Z=0,q=N.length;Z<q;Z++)N[Z]!==A[Z]&&(r.disableVertexAttribArray(Z),N[Z]=0)}function E(A,N,Z,q,K,ce,Q){Q===!0?r.vertexAttribIPointer(A,N,Z,K,ce):r.vertexAttribPointer(A,N,Z,q,K,ce)}function T(A,N,Z,q){M();const K=q.attributes,ce=Z.getAttributes(),Q=N.defaultAttributeValues;for(const ve in ce){const V=ce[ve];if(V.location>=0){let re=K[ve];if(re===void 0&&(ve==="instanceMatrix"&&A.instanceMatrix&&(re=A.instanceMatrix),ve==="instanceColor"&&A.instanceColor&&(re=A.instanceColor)),re!==void 0){const ie=re.normalized,de=re.itemSize,Re=e.get(re);if(Re===void 0)continue;const Xe=Re.buffer,se=Re.type,_e=Re.bytesPerElement,Le=se===r.INT||se===r.UNSIGNED_INT||re.gpuType===nh;if(re.isInterleavedBufferAttribute){const Me=re.data,et=Me.stride,lt=re.offset;if(Me.isInstancedInterleavedBuffer){for(let tt=0;tt<V.locationSize;tt++)_(V.location+tt,Me.meshPerAttribute);A.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=Me.meshPerAttribute*Me.count)}else for(let tt=0;tt<V.locationSize;tt++)x(V.location+tt);r.bindBuffer(r.ARRAY_BUFFER,Xe);for(let tt=0;tt<V.locationSize;tt++)E(V.location+tt,de/V.locationSize,se,ie,et*_e,(lt+de/V.locationSize*tt)*_e,Le)}else{if(re.isInstancedBufferAttribute){for(let Me=0;Me<V.locationSize;Me++)_(V.location+Me,re.meshPerAttribute);A.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Me=0;Me<V.locationSize;Me++)x(V.location+Me);r.bindBuffer(r.ARRAY_BUFFER,Xe);for(let Me=0;Me<V.locationSize;Me++)E(V.location+Me,de/V.locationSize,se,ie,de*_e,de/V.locationSize*Me*_e,Le)}}else if(Q!==void 0){const ie=Q[ve];if(ie!==void 0)switch(ie.length){case 2:r.vertexAttrib2fv(V.location,ie);break;case 3:r.vertexAttrib3fv(V.location,ie);break;case 4:r.vertexAttrib4fv(V.location,ie);break;default:r.vertexAttrib1fv(V.location,ie)}}}}w()}function U(){F();for(const A in n){const N=n[A];for(const Z in N){const q=N[Z];for(const K in q)f(q[K].object),delete q[K];delete N[Z]}delete n[A]}}function R(A){if(n[A.id]===void 0)return;const N=n[A.id];for(const Z in N){const q=N[Z];for(const K in q)f(q[K].object),delete q[K];delete N[Z]}delete n[A.id]}function L(A){for(const N in n){const Z=n[N];if(Z[A.id]===void 0)continue;const q=Z[A.id];for(const K in q)f(q[K].object),delete q[K];delete Z[A.id]}}function F(){C(),a=!0,s!==i&&(s=i,h(s.object))}function C(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:c,reset:F,resetDefaultState:C,dispose:U,releaseStatesOfGeometry:R,releaseStatesOfProgram:L,initAttributes:M,enableAttribute:x,disableUnusedAttributes:w}}function Cw(r,e,t){let n;function i(h){n=h}function s(h,f){r.drawArrays(n,h,f),t.update(f,n,1)}function a(h,f,p){p!==0&&(r.drawArraysInstanced(n,h,f,p),t.update(f,n,p))}function c(h,f,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,h,0,f,0,p);let g=0;for(let y=0;y<p;y++)g+=f[y];t.update(g,n,1)}function u(h,f,p,m){if(p===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let y=0;y<h.length;y++)a(h[y],f[y],m[y]);
vendor: 14,146 bytes, lines 3591-3666
3591else{g.multiDrawArraysInstancedWEBGL(n,h,0,f,0,m,0,p);let y=0;for(let M=0;M<p;M++)y+=f[M]*m[M];t.update(y,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=c,this.renderMultiDrawInstances=u}function Rw(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(L){return!(L!==Dn&&n.convert(L)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function c(L){const F=L===zo&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==Ai&&n.convert(L)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Kn&&!F)}function u(L){if(L==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const f=u(h);f!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",f,"instead."),h=f);const p=t.logarithmicDepthBuffer===!0,m=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),g=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),y=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),x=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),_=r.getParameter(r.MAX_VERTEX_ATTRIBS),w=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),E=r.getParameter(r.MAX_VARYING_VECTORS),T=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),U=y>0,R=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:a,textureTypeReadable:c,precision:h,logarithmicDepthBuffer:p,reverseDepthBuffer:m,maxTextures:g,maxVertexTextures:y,maxTextureSize:M,maxCubemapSize:x,maxAttributes:_,maxVertexUniforms:w,maxVaryings:E,maxFragmentUniforms:T,vertexTextures:U,maxSamples:R}}function Pw(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new hr,c=new gt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(p,m){const g=p.length!==0||m||n!==0||i;return i=m,n=p.length,g},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(p,m){t=f(p,m,0)},this.setState=function(p,m,g){const y=p.clippingPlanes,M=p.clipIntersection,x=p.clipShadows,_=r.get(p);if(!i||y===null||y.length===0||s&&!x)s?f(null):h();else{const w=s?0:n,E=w*4;let T=_.clippingState||null;u.value=T,T=f(y,m,E,g);for(let U=0;U!==E;++U)T[U]=t[U];_.clippingState=T,this.numIntersection=M?this.numPlanes:0,this.numPlanes+=w}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function f(p,m,g,y){const M=p!==null?p.length:0;let x=null;if(M!==0){if(x=u.value,y!==!0||x===null){const _=g+M*4,w=m.matrixWorldInverse;c.getNormalMatrix(w),(x===null||x.length<_)&&(x=new Float32Array(_));for(let E=0,T=g;E!==M;++E,T+=4)a.copy(p[E]).applyMatrix4(w,c),a.normal.toArray(x,T),x[T+3]=a.constant}u.value=x,u.needsUpdate=!0}return e.numPlanes=M,e.numIntersection=0,x}}function Iw(r){let e=new WeakMap;function t(a,c){return c===Na?a.mapping=_r:c===Oa&&(a.mapping=Vr),a}function n(a){if(a&&a.isTexture){const c=a.mapping;if(c===Na||c===Oa)if(e.has(a)){const u=e.get(a).texture;return t(u,a.mapping)}else{const u=a.image;if(u&&u.height>0){const h=new N_(u.height);return h.fromEquirectangularTexture(r,a),e.set(a,h),a.addEventListener("dispose",i),t(h.texture,a.mapping)}else return null}}return a}function i(a){const c=a.target;c.removeEventListener("dispose",i);const u=e.get(c);u!==void 0&&(e.delete(c),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class kr extends nl{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,c=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,a=s+h*this.view.width,c-=f*this.view.offsetY,u=c-f*this.view.height}this.projectionMatrix.makeOrthographic(s,a,c,u,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const bo=4,$g=[.125,.215,.35,.446,.526,.582],xs=20,sd=new kr,e0=new Ve;let od=null,ad=0,ld=0,cd=!1;const ys=(1+Math.sqrt(5))/2,po=1/ys,t0=[new D(-ys,po,0),new D(ys,po,0),new D(-po,0,ys),new D(po,0,ys),new D(0,ys,-po),new D(0,ys,po),new D(-1,1,-1),new D(1,1,-1),new D(-1,1,1),new D(1,1,1)];class Xd{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){od=this._renderer.getRenderTarget(),ad=this._renderer.getActiveCubeFace(),ld=this._renderer.getActiveMipmapLevel(),cd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=r0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=i0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(od,ad,ld),this._renderer.xr.enabled=cd,e.scissorTest=!1,Rc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===_r||e.mapping===Vr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),od=this._renderer.getRenderTarget(),ad=this._renderer.getActiveCubeFace(),ld=this._renderer.getActiveMipmapLevel(),cd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:cn,minFilter:cn,generateMipmaps:!1,type:zo,format:Dn,colorSpace:Ns,depthBuffer:!1},i=n0(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=n0(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Lw(s)),this._blurMaterial=Dw(s,e,t)}return i}_compileMaterial(e){const t=new nn(this._lodPlanes[0],e);this._renderer.compile(t,sd)}_sceneToCubeUV(e,t,n,i){const c=new tn(90,1,t,n),u=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],f=this._renderer,p=f.autoClear,m=f.toneMapping;f.getClearColor(e0),f.toneMapping=qi,f.autoClear=!1;const g=new Wr({name:"PMREM.Background",side:Hn,depthWrite:!1,depthTest:!1}),y=new nn(new Fs,g);let M=!1;const x=e.background;x?x.isColor&&(g.color.copy(x),e.background=null,M=!0):(g.color.copy(e0),M=!0);for(let _=0;_<6;_++){const w=_%3;w===0?(c.up.set(0,u[_],0),c.lookAt(h[_],0,0)):w===1?(c.up.set(0,0,u[_]),c.lookAt(0,h[_],0)):(c.up.set(0,u[_],0),c.lookAt(0,0,h[_]));const E=this._cubeSize;Rc(i,w*E,_>2?E:0,E,E),f.setRenderTarget(i),M&&f.render(y,c),f.render(e,c)}y.geometry.dispose(),y.material.dispose(),f.toneMapping=m,f.autoClear=p,e.background=x}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===_r||e.mapping===Vr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=r0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=i0());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new nn(this._lodPlanes[0],s),c=s.uniforms;c.envMap.value=e;const u=this._cubeSize;Rc(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(a,sd)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),c=t0[(i-s-1)%t0.length];this._blur(e,s-1,s,a,c)}t.autoClear=n}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,c){const u=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const f=3,p=new nn(this._lodPlanes[i],h),m=h.uniforms,g=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*xs-1),M=s/y,x=isFinite(s)?1+Math.floor(f*M):xs;x>xs&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${xs}`);const _=[];let w=0;for(let L=0;L<xs;++L){const F=L/M,C=Math.exp(-F*F/2);_.push(C),L===0?w+=C:L<x&&(w+=2*C)}for(let L=0;L<_.length;L++)_[L]=_[L]/w;m.envMap.value=e.texture,m.samples.value=x,m.weights.value=_,m.latitudinal.value=a==="latitudinal",c&&(m.poleAxis.value=c);const{_lodMax:E}=this;m.dTheta.value=y,m.mipInt.value=E-n;const T=this._sizeLods[i],U=3*T*(i>E-bo?i-E+bo:0),R=4*(this._cubeSize-T);Rc(t,U,R,3*T,2*T),u.setRenderTarget(t),u.render(p,sd)}}function Lw(r){const e=[],t=[],n=[];let i=r;const s=r-bo+1+$g.length;for(let a=0;a<s;a++){const c=Math.pow(2,i);t.push(c);let u=1/c;a>r-bo?u=$g[a-r+bo-1]:a===0&&(u=0),n.push(u);const h=1/(c-2),f=-h,p=1+h,m=[f,f,p,f,p,p,f,f,p,p,f,p],g=6,y=6,M=3,x=2,_=1,w=new Float32Array(M*y*g),E=new Float32Array(x*y*g),T=new Float32Array(_*y*g);for(let R=0;R<g;R++){const L=R%3*2/3-1,F=R>2?0:-1,C=[L,F,0,L+2/3,F,0,L+2/3,F+1,0,L,F,0,L+2/3,F+1,0,L,F+1,0];w.set(C,M*y*R),E.set(m,x*y*R);const A=[R,R,R,R,R,R];T.set(A,_*y*R)}const U=new xt;U.setAttribute("position",new zt(w,M)),U.setAttribute("uv",new zt(E,x)),U.setAttribute("faceIndex",new zt(T,_)),e.push(U),i>bo&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function n0(r,e,t){const n=new Ci(r,e,t);return n.texture.mapping=Bo,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Rc(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function Dw(r,e,t){const n=new Float32Array(xs),i=new D(0,1,0);return new _i({name:"SphericalGaussianBlur",defines:{n:xs,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Sp(),fragmentShader:`
3592
3593			precision mediump float;
3594			precision mediump int;
3595
3596			varying vec3 vOutputDirection;
3597
3598			uniform sampler2D envMap;
3599			uniform int samples;
3600			uniform float weights[ n ];
3601			uniform bool latitudinal;
3602			uniform float dTheta;
3603			uniform float mipInt;
3604			uniform vec3 poleAxis;
3605
3606			#define ENVMAP_TYPE_CUBE_UV
3607			#include <cube_uv_reflection_fragment>
3608
3609			vec3 getSample( float theta, vec3 axis ) {
3610
3611				float cosTheta = cos( theta );
3612				// Rodrigues' axis-angle rotation
3613				vec3 sampleDirection = vOutputDirection * cosTheta
3614					+ cross( axis, vOutputDirection ) * sin( theta )
3615					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3616
3617				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3618
3619			}
3620
3621			void main() {
3622
3623				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3624
3625				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3626
3627					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3628
3629				}
3630
3631				axis = normalize( axis );
3632
3633				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3634				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3635
3636				for ( int i = 1; i < n; i++ ) {
3637
3638					if ( i >= samples ) {
3639
3640						break;
3641
3642					}
3643
3644					float theta = dTheta * float( i );
3645					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3646					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3647
3648				}
3649
3650			}
3651		`,blending:mr,depthTest:!1,depthWrite:!1})}function i0(){return new _i({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Sp(),fragmentShader:`
3652
3653			precision mediump float;
3654			precision mediump int;
3655
3656			varying vec3 vOutputDirection;
3657
3658			uniform sampler2D envMap;
3659
3660			#include <common>
3661
3662			void main() {
3663
3664				vec3 outputDirection = normalize( vOutputDirection );
3665				vec2 uv = equirectUv( outputDirection );
3666
3667				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3668
3669			}
3670		`,blending:mr,depthTest:!1,depthWrite:!1})}function r0(){return new _i({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Sp(),fragmentShader:`
3671
3672			precision mediump float;
3673			precision mediump int;
3674
3675			uniform float flipEnvMap;
3676
3677			varying vec3 vOutputDirection;
3678
3679			uniform samplerCube envMap;
3680
3681			void main() {
3682
3683				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3684
3685			}
3686		`,blending:mr,depthTest:!1,depthWrite:!1})}function Sp(){return`
3687
3688		precision mediump float;
3689		precision mediump int;
3690
3691		attribute float faceIndex;
3692
3693		varying vec3 vOutputDirection;
3694
3695		// RH coordinate system; PMREM face-indexing convention
3696		vec3 getDirection( vec2 uv, float face ) {
3697
3698			uv = 2.0 * uv - 1.0;
3699
3700			vec3 direction = vec3( uv, 1.0 );
3701
3702			if ( face == 0.0 ) {
3703
3704				direction = direction.zyx; // ( 1, v, u ) pos x
3705
3706			} else if ( face == 1.0 ) {
3707
3708				direction = direction.xzy;
3709				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3710
3711			} else if ( face == 2.0 ) {
3712
3713				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3714
3715			} else if ( face == 3.0 ) {
3716
3717				direction = direction.zyx;
3718				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3719
3720			} else if ( face == 4.0 ) {
3721
3722				direction = direction.xzy;
3723				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3724
3725			} else if ( face == 5.0 ) {
3726
3727				direction.z *= -1.0; // ( u, v, -1 ) neg z
3728
3729			}
3730
3731			return direction;
3732
3733		}
3734
3735		void main() {
3736
3737			vOutputDirection = getDirection( uv, faceIndex );
3738			gl_Position = vec4( position, 1.0 );
3739
3740		}
3741	`}function Uw(r){let e=new WeakMap,t=null;function n(c){if(c&&c.isTexture){const u=c.mapping,h=u===Na||u===Oa,f=u===_r||u===Vr;if(h||f){let p=e.get(c);const m=p!==void 0?p.texture.pmremVersion:0;if(c.isRenderTargetTexture&&c.pmremVersion!==m)return t===null&&(t=new Xd(r)),p=h?t.fromEquirectangular(c,p):t.fromCubemap(c,p),p.texture.pmremVersion=c.pmremVersion,e.set(c,p),p.texture;if(p!==void 0)return p.texture;{const g=c.image;return h&&g&&g.height>0||f&&g&&i(g)?(t===null&&(t=new Xd(r)),p=h?t.fromEquirectangular(c):t.fromCubemap(c),p.texture.pmremVersion=c.pmremVersion,e.set(c,p),c.addEventListener("dispose",s),p.texture):null}}}return c}function i(c){let u=0;const h=6;for(let f=0;f<h;f++)c[f]!==void 0&&u++;return u===h}function s(c){const u=c.target;u.removeEventListener("dispose",s);const h=e.get(u);h!==void 0&&(e.delete(u),h.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function Nw(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&Ma("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function Ow(r,e,t,n){const i={},s=new WeakMap;function a(p){const m=p.target;m.index!==null&&e.remove(m.index);for(const y in m.attributes)e.remove(m.attributes[y]);for(const y in m.morphAttributes){const M=m.morphAttributes[y];for(let x=0,_=M.length;x<_;x++)e.remove(M[x])}m.removeEventListener("dispose",a),delete i[m.id];const g=s.get(m);g&&(e.remove(g),s.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(p,m){return i[m.id]===!0||(m.addEventListener("dispose",a),i[m.id]=!0,t.memory.geometries++),m}function u(p){const m=p.attributes;for(const y in m)e.update(m[y],r.ARRAY_BUFFER);const g=p.morphAttributes;for(const y in g){const M=g[y];for(let x=0,_=M.length;x<_;x++)e.update(M[x],r.ARRAY_BUFFER)}}function h(p){const m=[],g=p.index,y=p.attributes.position;let M=0;if(g!==null){const w=g.array;
vendor: 19,043 bytes, lines 3741-3776
3741M=g.version;for(let E=0,T=w.length;E<T;E+=3){const U=w[E+0],R=w[E+1],L=w[E+2];m.push(U,R,R,L,L,U)}}else if(y!==void 0){const w=y.array;M=y.version;for(let E=0,T=w.length/3-1;E<T;E+=3){const U=E+0,R=E+1,L=E+2;m.push(U,R,R,L,L,U)}}else return;const x=new(C_(m)?xp:yp)(m,1);x.version=M;const _=s.get(p);_&&e.remove(_),s.set(p,x)}function f(p){const m=s.get(p);if(m){const g=p.index;g!==null&&m.version<g.version&&h(p)}else h(p);return s.get(p)}return{get:c,update:u,getWireframeAttribute:f}}function Fw(r,e,t){let n;function i(m){n=m}let s,a;function c(m){s=m.type,a=m.bytesPerElement}function u(m,g){r.drawElements(n,g,s,m*a),t.update(g,n,1)}function h(m,g,y){y!==0&&(r.drawElementsInstanced(n,g,s,m*a,y),t.update(g,n,y))}function f(m,g,y){if(y===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,g,0,s,m,0,y);let x=0;for(let _=0;_<y;_++)x+=g[_];t.update(x,n,1)}function p(m,g,y,M){if(y===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let _=0;_<m.length;_++)h(m[_]/a,g[_],M[_]);else{x.multiDrawElementsInstancedWEBGL(n,g,0,s,m,0,M,0,y);let _=0;for(let w=0;w<y;w++)_+=g[w]*M[w];t.update(_,n,1)}}this.setMode=i,this.setIndex=c,this.render=u,this.renderInstances=h,this.renderMultiDraw=f,this.renderMultiDrawInstances=p}function Bw(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,c){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=c*(s/3);break;case r.LINES:t.lines+=c*(s/2);break;case r.LINE_STRIP:t.lines+=c*(s-1);break;case r.LINE_LOOP:t.lines+=c*s;break;case r.POINTS:t.points+=c*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function zw(r,e,t){const n=new WeakMap,i=new bt;function s(a,c,u){const h=a.morphTargetInfluences,f=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,p=f!==void 0?f.length:0;let m=n.get(c);if(m===void 0||m.count!==p){let C=function(){L.dispose(),n.delete(c),c.removeEventListener("dispose",C)};m!==void 0&&m.texture.dispose();const g=c.morphAttributes.position!==void 0,y=c.morphAttributes.normal!==void 0,M=c.morphAttributes.color!==void 0,x=c.morphAttributes.position||[],_=c.morphAttributes.normal||[],w=c.morphAttributes.color||[];let E=0;g===!0&&(E=1),y===!0&&(E=2),M===!0&&(E=3);let T=c.attributes.position.count*E,U=1;T>e.maxTextureSize&&(U=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const R=new Float32Array(T*U*4*p),L=new ch(R,T,U,p);L.type=Kn,L.needsUpdate=!0;const F=E*4;for(let A=0;A<p;A++){const N=x[A],Z=_[A],q=w[A],K=T*U*4*A;for(let ce=0;ce<N.count;ce++){const Q=ce*F;g===!0&&(i.fromBufferAttribute(N,ce),R[K+Q+0]=i.x,R[K+Q+1]=i.y,R[K+Q+2]=i.z,R[K+Q+3]=0),y===!0&&(i.fromBufferAttribute(Z,ce),R[K+Q+4]=i.x,R[K+Q+5]=i.y,R[K+Q+6]=i.z,R[K+Q+7]=0),M===!0&&(i.fromBufferAttribute(q,ce),R[K+Q+8]=i.x,R[K+Q+9]=i.y,R[K+Q+10]=i.z,R[K+Q+11]=q.itemSize===4?i.w:1)}}m={count:p,texture:L,size:new ue(T,U)},n.set(c,m),c.addEventListener("dispose",C)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)u.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);else{let g=0;for(let M=0;M<h.length;M++)g+=h[M];const y=c.morphTargetsRelative?1:1-g;u.getUniforms().setValue(r,"morphTargetBaseInfluence",y),u.getUniforms().setValue(r,"morphTargetInfluences",h)}u.getUniforms().setValue(r,"morphTargetsTexture",m.texture,t),u.getUniforms().setValue(r,"morphTargetsTextureSize",m.size)}return{update:s}}function kw(r,e,t,n){let i=new WeakMap;function s(u){const h=n.render.frame,f=u.geometry,p=e.get(u,f);if(i.get(p)!==h&&(e.update(p),i.set(p,h)),u.isInstancedMesh&&(u.hasEventListener("dispose",c)===!1&&u.addEventListener("dispose",c),i.get(u)!==h&&(t.update(u.instanceMatrix,r.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,r.ARRAY_BUFFER),i.set(u,h))),u.isSkinnedMesh){const m=u.skeleton;i.get(m)!==h&&(m.update(),i.set(m,h))}return p}function a(){i=new WeakMap}function c(u){const h=u.target;h.removeEventListener("dispose",c),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:s,dispose:a}}class Mp extends Kt{constructor(e,t,n,i,s,a,c,u,h,f=bs){if(f!==bs&&f!==Ds)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&f===bs&&(n=yr),n===void 0&&f===Ds&&(n=Ls),super(null,i,s,a,c,u,f,n,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=c!==void 0?c:wn,this.minFilter=u!==void 0?u:wn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const F_=new Kt,s0=new Mp(1,1),B_=new ch,z_=new _p,k_=new il,o0=[],a0=[],l0=new Float32Array(16),c0=new Float32Array(9),u0=new Float32Array(4);function Vo(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=o0[i];if(s===void 0&&(s=new Float32Array(i),o0[i]=s),e!==0){n.toArray(s,0);for(let a=1,c=0;a!==e;++a)c+=t,r[a].toArray(s,c)}return s}function un(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function hn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function uh(r,e){let t=a0[e];t===void 0&&(t=new Int32Array(e),a0[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function Vw(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function Hw(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(un(t,e))return;r.uniform2fv(this.addr,e),hn(t,e)}}function Gw(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(un(t,e))return;r.uniform3fv(this.addr,e),hn(t,e)}}function Ww(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(un(t,e))return;r.uniform4fv(this.addr,e),hn(t,e)}}function Xw(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(un(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),hn(t,e)}else{if(un(t,n))return;u0.set(n),r.uniformMatrix2fv(this.addr,!1,u0),hn(t,n)}}function Yw(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(un(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),hn(t,e)}else{if(un(t,n))return;c0.set(n),r.uniformMatrix3fv(this.addr,!1,c0),hn(t,n)}}function qw(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(un(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),hn(t,e)}else{if(un(t,n))return;l0.set(n),r.uniformMatrix4fv(this.addr,!1,l0),hn(t,n)}}function Zw(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function jw(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(un(t,e))return;r.uniform2iv(this.addr,e),hn(t,e)}}function Jw(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(un(t,e))return;r.uniform3iv(this.addr,e),hn(t,e)}}function Kw(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(un(t,e))return;r.uniform4iv(this.addr,e),hn(t,e)}}function Qw(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function $w(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(un(t,e))return;r.uniform2uiv(this.addr,e),hn(t,e)}}function eT(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(un(t,e))return;r.uniform3uiv(this.addr,e),hn(t,e)}}function tT(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(un(t,e))return;r.uniform4uiv(this.addr,e),hn(t,e)}}function nT(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(s0.compareFunction=gp,s=s0):s=F_,t.setTexture2D(e||s,i)}function iT(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||z_,i)}function rT(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||k_,i)}function sT(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||B_,i)}function oT(r){switch(r){case 5126:return Vw;case 35664:return Hw;case 35665:return Gw;case 35666:return Ww;case 35674:return Xw;case 35675:return Yw;case 35676:return qw;case 5124:case 35670:return Zw;case 35667:case 35671:return jw;case 35668:case 35672:return Jw;case 35669:case 35673:return Kw;case 5125:return Qw;case 36294:return $w;case 36295:return eT;case 36296:return tT;case 35678:case 36198:case 36298:case 36306:case 35682:return nT;case 35679:case 36299:case 36307:return iT;case 35680:case 36300:case 36308:case 36293:return rT;case 36289:case 36303:case 36311:case 36292:return sT}}function aT(r,e){r.uniform1fv(this.addr,e)}function lT(r,e){const t=Vo(e,this.size,2);r.uniform2fv(this.addr,t)}function cT(r,e){const t=Vo(e,this.size,3);r.uniform3fv(this.addr,t)}function uT(r,e){const t=Vo(e,this.size,4);r.uniform4fv(this.addr,t)}function hT(r,e){const t=Vo(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function fT(r,e){const t=Vo(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function dT(r,e){const t=Vo(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function pT(r,e){r.uniform1iv(this.addr,e)}function mT(r,e){r.uniform2iv(this.addr,e)}function gT(r,e){r.uniform3iv(this.addr,e)}function vT(r,e){r.uniform4iv(this.addr,e)}function _T(r,e){r.uniform1uiv(this.addr,e)}function yT(r,e){r.uniform2uiv(this.addr,e)}function xT(r,e){r.uniform3uiv(this.addr,e)}function ST(r,e){r.uniform4uiv(this.addr,e)}function MT(r,e,t){const n=this.cache,i=e.length,s=uh(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||F_,s[a])}function ET(r,e,t){const n=this.cache,i=e.length,s=uh(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||z_,s[a])}function wT(r,e,t){const n=this.cache,i=e.length,s=uh(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||k_,s[a])}function TT(r,e,t){const n=this.cache,i=e.length,s=uh(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||B_,s[a])}function bT(r){switch(r){case 5126:return aT;case 35664:return lT;case 35665:return cT;case 35666:return uT;case 35674:return hT;case 35675:return fT;case 35676:return dT;case 5124:case 35670:return pT;case 35667:case 35671:return mT;case 35668:case 35672:return gT;case 35669:case 35673:return vT;case 5125:return _T;case 36294:return yT;case 36295:return xT;case 36296:return ST;case 35678:case 36198:case 36298:case 36306:case 35682:return MT;case 35679:case 36299:case 36307:return ET;case 35680:case 36300:case 36308:case 36293:return wT;case 36289:case 36303:case 36311:case 36292:return TT}}class AT{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=oT(t.type)}}class CT{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=bT(t.type)}}class RT{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const c=i[s];c.setValue(e,t[c.id],n)}}}const ud=/(\w+)(\])?(\[|\.)?/g;function h0(r,e){r.seq.push(e),r.map[e.id]=e}function PT(r,e,t){const n=r.name,i=n.length;for(ud.lastIndex=0;;){const s=ud.exec(n),a=ud.lastIndex;let c=s[1];const u=s[2]==="]",h=s[3];if(u&&(c=c|0),h===void 0||h==="["&&a+2===i){h0(t,h===void 0?new AT(c,r,e):new CT(c,r,e));break}else{let p=t.map[c];p===void 0&&(p=new RT(c),h0(t,p)),t=p}}}class cu{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),a=e.getUniformLocation(t,s.name);PT(s,a,this)}}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const c=t[s],u=n[c.id];u.needsUpdate!==!1&&c.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function f0(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const IT=37297;let LT=0;function DT(r,e){const t=r.split(`
3742`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const c=a+1;n.push(`${c===e?">":" "} ${c}: ${t[a]}`)}return n.join(`
3743`)}const d0=new gt;function UT(r){Pt._getMatrix(d0,Pt.workingColorSpace,r);const e=`mat3( ${d0.elements.map(t=>t.toFixed(4))} )`;switch(Pt.getTransfer(r)){case tl:return[e,"LinearTransferOETF"];case Ft:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function p0(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
3744
3745`+i+`
3746
3747`+DT(r.getShaderSource(e),a)}else return i}function NT(r,e){const t=UT(e);return[`vec4 ${r}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3748`)}function OT(r,e){let t;switch(e){case a_:t="Linear";break;case l_:t="Reinhard";break;case c_:t="Cineon";break;case rp:t="ACESFilmic";break;case h_:t="AgX";break;case f_:t="Neutral";break;case u_:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Pc=new D;function FT(){Pt.getLuminanceCoefficients(Pc);const r=Pc.x.toFixed(4),e=Pc.y.toFixed(4),t=Pc.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${r}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
3749`)}function BT(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(wa).join(`
3750`)}function zT(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3751`)}function kT(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let c=1;s.type===r.FLOAT_MAT2&&(c=2),s.type===r.FLOAT_MAT3&&(c=3),s.type===r.FLOAT_MAT4&&(c=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:c}}return t}function wa(r){return r!==""}function m0(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function g0(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const VT=/^[ \t]*#include +<([\w\d./]+)>/gm;function Yd(r){return r.replace(VT,GT)}const HT=new Map;function GT(r,e){let t=yt[e];if(t===void 0){const n=HT.get(e);if(n!==void 0)t=yt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Yd(t)}const WT=/#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 v0(r){return r.replace(WT,XT)}function XT(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function _0(r){let e=`precision ${r.precision} float;
3752	precision ${r.precision} int;
3753	precision ${r.precision} sampler2D;
3754	precision ${r.precision} samplerCube;
3755	precision ${r.precision} sampler3D;
3756	precision ${r.precision} sampler2DArray;
3757	precision ${r.precision} sampler2DShadow;
3758	precision ${r.precision} samplerCubeShadow;
3759	precision ${r.precision} sampler2DArrayShadow;
3760	precision ${r.precision} isampler2D;
3761	precision ${r.precision} isampler3D;
3762	precision ${r.precision} isamplerCube;
3763	precision ${r.precision} isampler2DArray;
3764	precision ${r.precision} usampler2D;
3765	precision ${r.precision} usampler3D;
3766	precision ${r.precision} usamplerCube;
3767	precision ${r.precision} usampler2DArray;
3768	`;return r.precision==="highp"?e+=`
3769#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
3770#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
3771#define LOW_PRECISION`),e}function YT(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===eh?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===Ta?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===wi&&(e="SHADOWMAP_TYPE_VSM"),e}function qT(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case _r:case Vr:e="ENVMAP_TYPE_CUBE";break;case Bo:e="ENVMAP_TYPE_CUBE_UV";break}return e}function ZT(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Vr:e="ENVMAP_MODE_REFRACTION";break}return e}function jT(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case $a:e="ENVMAP_BLENDING_MULTIPLY";break;case s_:e="ENVMAP_BLENDING_MIX";break;case o_:e="ENVMAP_BLENDING_ADD";break}return e}function JT(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function KT(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,c=t.fragmentShader;const u=YT(t),h=qT(t),f=ZT(t),p=jT(t),m=JT(t),g=BT(t),y=zT(s),M=i.createProgram();let x,_,w=t.glslVersion?"#version "+t.glslVersion+`
3772`:"";t.isRawShaderMaterial?(x=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(wa).join(`
3773`),x.length>0&&(x+=`
3774`),_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(wa).join(`
3775`),_.length>0&&(_+=`
3776`)):(x=[_0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionCl
vendor: 6,454 bytes, lines 3776-3778
3776ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
3777`].filter(wa).join(`
3778`),_=[_0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3778IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==qi?"#define TONE_MAPPING":"",t.toneMapping!==qi?yt.tonemapping_pars_fragment:"",t.toneMapping!==qi?OT("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",yt.colorspace_pars_fragment,NT("linearToOutputTexel",t.outputColorSpace),FT(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3779`].filter(wa).join(`
3780`)),a=Yd(a),a=m0(a,t),a=g0(a,t),c=Yd(c),c=m0(c,t),c=g0(c,t),a=v0(a),c=v0(c),t.isRawShaderMaterial!==!0&&(w=`#version 300 es
3781`,x=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3782`)+`
3783`+x,_=["#define varying in",t.glslVersion===Wd?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Wd?"":"#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(`
3784`)+`
3785`+_);const E=w+x+a,T=w+_+c,U=f0(i,i.VERTEX_SHADER,E),R=f0(i,i.FRAGMENT_SHADER,T);i.attachShader(M,U),i.attachShader(M,R),t.index0AttributeName!==void 0?i.bindAttribLocation(M,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(M,0,"position"),i.linkProgram(M);function L(N){if(r.debug.checkShaderErrors){const Z=i.getProgramInfoLog(M).trim(),q=i.getShaderInfoLog(U).trim(),K=i.getShaderInfoLog(R).trim();let ce=!0,Q=!0;if(i.getProgramParameter(M,i.LINK_STATUS)===!1)if(ce=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,M,U,R);else{const ve=p0(i,U,"vertex"),V=p0(i,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(M,i.VALIDATE_STATUS)+`
3786
3787Material Name: `+N.name+`
3788Material Type: `+N.type+`
3789
3790Program Info Log: `+Z+`
3791`+ve+`
3792`+V)}else Z!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Z):(q===""||K==="")&&(Q=!1);Q&&(N.diagnostics={runnable:ce,programLog:Z,vertexShader:{log:q,prefix:x},fragmentShader:{log:K,prefix:_}})}i.deleteShader(U),i.deleteShader(R),F=new cu(i,M),C=kT(i,M)}let F;this.getUniforms=function(){return F===void 0&&L(this),F};let C;this.getAttributes=function(){return C===void 0&&L(this),C};let A=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return A===!1&&(A=i.getProgramParameter(
vendor: 8,978 bytes, line 3792
3792M,IT)),A},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(M),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=LT++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=U,this.fragmentShader=R,this}let QT=0;class $T{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new eb(e),t.set(e,n)),n}}class eb{constructor(e){this.id=QT++,this.code=e,this.usedTimes=0}}function tb(r,e,t,n,i,s,a){const c=new Cs,u=new $T,h=new Set,f=[],p=i.logarithmicDepthBuffer,m=i.vertexTextures;let g=i.precision;const y={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 M(C){return h.add(C),C===0?"uv":`uv${C}`}function x(C,A,N,Z,q){const K=Z.fog,ce=q.geometry,Q=C.isMeshStandardMaterial?Z.environment:null,ve=(C.isMeshStandardMaterial?t:e).get(C.envMap||Q),V=ve&&ve.mapping===Bo?ve.image.height:null,re=y[C.type];C.precision!==null&&(g=i.getMaxPrecision(C.precision),g!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",g,"instead."));const ie=ce.morphAttributes.position||ce.morphAttributes.normal||ce.morphAttributes.color,de=ie!==void 0?ie.length:0;let Re=0;ce.morphAttributes.position!==void 0&&(Re=1),ce.morphAttributes.normal!==void 0&&(Re=2),ce.morphAttributes.color!==void 0&&(Re=3);let Xe,se,_e,Le;if(re){const At=bi[re];Xe=At.vertexShader,se=At.fragmentShader}else Xe=C.vertexShader,se=C.fragmentShader,u.update(C),_e=u.getVertexShaderID(C),Le=u.getFragmentShaderID(C);const Me=r.getRenderTarget(),et=r.state.buffers.depth.getReversed(),lt=q.isInstancedMesh===!0,tt=q.isBatchedMesh===!0,ft=!!C.map,pe=!!C.matcap,ge=!!ve,z=!!C.aoMap,Ke=!!C.lightMap,ye=!!C.bumpMap,ze=!!C.normalMap,Te=!!C.displacementMap,it=!!C.emissiveMap,De=!!C.metalnessMap,O=!!C.roughnessMap,P=C.anisotropy>0,j=C.clearcoat>0,ae=C.dispersion>0,me=C.iridescence>0,he=C.sheen>0,Ye=C.transmission>0,be=P&&!!C.anisotropyMap,ke=j&&!!C.clearcoatMap,St=j&&!!C.clearcoatNormalMap,xe=j&&!!C.clearcoatRoughnessMap,Ge=me&&!!C.iridescenceMap,rt=me&&!!C.iridescenceThicknessMap,ct=he&&!!C.sheenColorMap,He=he&&!!C.sheenRoughnessMap,H=!!C.specularMap,le=!!C.specularColorMap,Ie=!!C.specularIntensityMap,k=Ye&&!!C.transmissionMap,Se=Ye&&!!C.thicknessMap,te=!!C.gradientMap,fe=!!C.alphaMap,Fe=C.alphaTest>0,Pe=!!C.alphaHash,nt=!!C.extensions;let It=qi;C.toneMapped&&(Me===null||Me.isXRRenderTarget===!0)&&(It=r.toneMapping);const Vt={shaderID:re,shaderType:C.type,shaderName:C.name,vertexShader:Xe,fragmentShader:se,defines:C.defines,customVertexShaderID:_e,customFragmentShaderID:Le,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:g,batching:tt,batchingColor:tt&&q._colorsTexture!==null,instancing:lt,instancingColor:lt&&q.instanceColor!==null,instancingMorph:lt&&q.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Me===null?r.outputColorSpace:Me.isXRRenderTarget===!0?Me.texture.colorSpace:Ns,alphaToCoverage:!!C.alphaToCoverage,map:ft,matcap:pe,envMap:ge,envMapMode:ge&&ve.mapping,envMapCubeUVHeight:V,aoMap:z,lightMap:Ke,bumpMap:ye,normalMap:ze,displacementMap:m&&Te,emissiveMap:it,normalMapObjectSpace:ze&&C.normalMapType===y_,normalMapTangentSpace:ze&&C.normalMapType===Gr,metalnessMap:De,roughnessMap:O,anisotropy:P,anisotropyMap:be,clearcoat:j,clearcoatMap:ke,clearcoatNormalMap:St,clearcoatRoughnessMap:xe,dispersion:ae,iridescence:me,iridescenceMap:Ge,iridescenceThicknessMap:rt,sheen:he,sheenColorMap:ct,sheenRoughnessMap:He,specularMap:H,specularColorMap:le,specularIntensityMap:Ie,transmission:Ye,transmissionMap:k,thicknessMap:Se,gradientMap:te,opaque:C.transparent===!1&&C.blending===Ts&&C.alphaToCoverage===!1,alphaMap:fe,alphaTest:Fe,alphaHash:Pe,combine:C.combine,mapUv:ft&&M(C.map.channel),aoMapUv:z&&M(C.aoMap.channel),lightMapUv:Ke&&M(C.lightMap.channel),bumpMapUv:ye&&M(C.bumpMap.channel),normalMapUv:ze&&M(C.normalMap.channel),displacementMapUv:Te&&M(C.displacementMap.channel),emissiveMapUv:it&&M(C.emissiveMap.channel),metalnessMapUv:De&&M(C.metalnessMap.channel),roughnessMapUv:O&&M(C.roughnessMap.channel),anisotropyMapUv:be&&M(C.anisotropyMap.channel),clearcoatMapUv:ke&&M(C.clearcoatMap.channel),clearcoatNormalMapUv:St&&M(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:xe&&M(C.clearcoatRoughnessMap.channel),iridescenceMapUv:Ge&&M(C.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&M(C.iridescenceThicknessMap.channel),sheenColorMapUv:ct&&M(C.sheenColorMap.channel),sheenRoughnessMapUv:He&&M(C.sheenRoughnessMap.channel),specularMapUv:H&&M(C.specularMap.channel),specularColorMapUv:le&&M(C.specularColorMap.channel),specularIntensityMapUv:Ie&&M(C.specularIntensityMap.channel),transmissionMapUv:k&&M(C.transmissionMap.channel),thicknessMapUv:Se&&M(C.thicknessMap.channel),alphaMapUv:fe&&M(C.alphaMap.channel),vertexTangents:!!ce.attributes.tangent&&(ze||P),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!ce.attributes.color&&ce.attributes.color.itemSize===4,pointsUvs:q.isPoints===!0&&!!ce.attributes.uv&&(ft||fe),fog:!!K,useFog:C.fog===!0,fogExp2:!!K&&K.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:p,reverseDepthBuffer:et,skinning:q.isSkinnedMesh===!0,morphTargets:ce.morphAttributes.position!==void 0,morphNormals:ce.morphAttributes.normal!==void 0,morphColors:ce.morphAttributes.color!==void 0,morphTargetsCount:de,morphTextureStride:Re,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:C.dithering,shadowMapEnabled:r.shadowMap.enabled&&N.length>0,shadowMapType:r.shadowMap.type,toneMapping:It,decodeVideoTexture:ft&&C.map.isVideoTexture===!0&&Pt.getTransfer(C.map.colorSpace)===Ft,decodeVideoTextureEmissive:it&&C.emissiveMap.isVideoTexture===!0&&Pt.getTransfer(C.emissiveMap.colorSpace)===Ft,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===Gi,flipSided:C.side===Hn,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:nt&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(nt&&C.extensions.multiDraw===!0||tt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Vt.vertexUv1s=h.has(1),Vt.vertexUv2s=h.has(2),Vt.vertexUv3s=h.has(3),h.clear(),Vt}function _(C){const A=[];if(C.shaderID?A.push(C.shaderID):(A.push(C.customVertexShaderID),A.push(C.customFragmentShaderID)),C.defines!==void 0)for(const N in C.defines)A.push(N),A.push(C.defines[N]);return C.isRawShaderMaterial===!1&&(w(A,C),E(A,C),A.push(r.outputColorSpace)),A.push(C.customProgramCacheKey),A.join()}function w(C,A){C.push(A.precision),C.push(A.outputColorSpace),C.push(A.envMapMode),C.push(A.envMapCubeUVHeight),C.push(A.mapUv),C.push(A.alphaMapUv),C.push(A.lightMapUv),C.push(A.aoMapUv),C.push(A.bumpMapUv),C.push(A.normalMapUv),C.push(A.displacementMapUv),C.push(A.emissiveMapUv),C.push(A.metalnessMapUv),C.push(A.roughnessMapUv),C.push(A.anisotropyMapUv),C.push(A.clearcoatMapUv),C.push(A.clearcoatNormalMapUv),C.push(A.clearcoatRoughnessMapUv),C.push(A.iridescenceMapUv),C.push(A.iridescenceThicknessMapUv),C.push(A.sheenColorMapUv),C.push(A.sheenRoughnessMapUv),C.push(A.specularMapUv),C.push(A.specularColorMapUv),C.push(A.specularIntensityMapUv),C.push(A.transmissionMapUv),C.push(A.thicknessMapUv),C.push(A.comb
3792ine),C.push(A.fogExp2),C.push(A.sizeAttenuation),C.push(A.morphTargetsCount),C.push(A.morphAttributeCount),C.push(A.numDirLights),C.push(A.numPointLights),C.push(A.numSpotLights),C.push(A.numSpotLightMaps),C.push(A.numHemiLights),C.push(A.numRectAreaLights),C.push(A.numDirLightShadows),C.push(A.numPointLightShadows),C.push(A.numSpotLightShadows),C.push(A.numSpotLightShadowsWithMaps),C.push(A.numLightProbes),C.push(A.shadowMapType),C.push(A.toneMapping),C.push(A.numClippingPlanes),C.push(A.numClipIntersection),C.push(A.depthPacking)}function E(C,A){c.disableAll(),A.supportsVertexTextures&&c.enable(0),A.instancing&&c.enable(1),A.instancingColor&&c.enable(2),A.instancingMorph&&c.enable(3),A.matcap&&c.enable(4),A.envMap&&c.enable(5),A.normalMapObjectSpace&&c.enable(6),A.normalMapTangentSpace&&c.enable(7),A.clearcoat&&c.enable(8),A.iridescence&&c.enable(9),A.alphaTest&&c.enable(10),A.vertexColors&&c.enable(11),A.vertexAlphas&&c.enable(12),A.vertexUv1s&&c.enable(13),A.vertexUv2s&&c.enable(14),A.vertexUv3s&&c.enable(15),A.vertexTangents&&c.enable(16),A.anisotropy&&
vendor: 9,955 bytes, line 3792
3792c.enable(17),A.alphaHash&&c.enable(18),A.batching&&c.enable(19),A.dispersion&&c.enable(20),A.batchingColor&&c.enable(21),C.push(c.mask),c.disableAll(),A.fog&&c.enable(0),A.useFog&&c.enable(1),A.flatShading&&c.enable(2),A.logarithmicDepthBuffer&&c.enable(3),A.reverseDepthBuffer&&c.enable(4),A.skinning&&c.enable(5),A.morphTargets&&c.enable(6),A.morphNormals&&c.enable(7),A.morphColors&&c.enable(8),A.premultipliedAlpha&&c.enable(9),A.shadowMapEnabled&&c.enable(10),A.doubleSided&&c.enable(11),A.flipSided&&c.enable(12),A.useDepthPacking&&c.enable(13),A.dithering&&c.enable(14),A.transmission&&c.enable(15),A.sheen&&c.enable(16),A.opaque&&c.enable(17),A.pointsUvs&&c.enable(18),A.decodeVideoTexture&&c.enable(19),A.decodeVideoTextureEmissive&&c.enable(20),A.alphaToCoverage&&c.enable(21),C.push(c.mask)}function T(C){const A=y[C.type];let N;if(A){const Z=bi[A];N=qu.clone(Z.uniforms)}else N=C.uniforms;return N}function U(C,A){let N;for(let Z=0,q=f.length;Z<q;Z++){const K=f[Z];if(K.cacheKey===A){N=K,++N.usedTimes;break}}return N===void 0&&(N=new KT(r,A,C,s),f.push(N)),N}function R(C){if(--C.usedTimes===0){const A=f.indexOf(C);f[A]=f[f.length-1],f.pop(),C.destroy()}}function L(C){u.remove(C)}function F(){u.dispose()}return{getParameters:x,getProgramCacheKey:_,getUniforms:T,acquireProgram:U,releaseProgram:R,releaseShaderCache:L,programs:f,dispose:F}}function nb(){let r=new WeakMap;function e(a){return r.has(a)}function t(a){let c=r.get(a);return c===void 0&&(c={},r.set(a,c)),c}function n(a){r.delete(a)}function i(a,c,u){r.get(a)[c]=u}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function ib(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function y0(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function x0(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(p,m,g,y,M,x){let _=r[e];return _===void 0?(_={id:p.id,object:p,geometry:m,material:g,groupOrder:y,renderOrder:p.renderOrder,z:M,group:x},r[e]=_):(_.id=p.id,_.object=p,_.geometry=m,_.material=g,_.groupOrder=y,_.renderOrder=p.renderOrder,_.z=M,_.group=x),e++,_}function c(p,m,g,y,M,x){const _=a(p,m,g,y,M,x);g.transmission>0?n.push(_):g.transparent===!0?i.push(_):t.push(_)}function u(p,m,g,y,M,x){const _=a(p,m,g,y,M,x);g.transmission>0?n.unshift(_):g.transparent===!0?i.unshift(_):t.unshift(_)}function h(p,m){t.length>1&&t.sort(p||ib),n.length>1&&n.sort(m||y0),i.length>1&&i.sort(m||y0)}function f(){for(let p=e,m=r.length;p<m;p++){const g=r[p];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:c,unshift:u,finish:f,sort:h}}function rb(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new x0,r.set(n,[a])):i>=s.length?(a=new x0,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function sb(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new D,color:new Ve};break;case"SpotLight":t={position:new D,direction:new D,color:new Ve,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new D,color:new Ve,distance:0,decay:0};break;case"HemisphereLight":t={direction:new D,skyColor:new Ve,groundColor:new Ve};break;case"RectAreaLight":t={color:new Ve,position:new D,halfWidth:new D,halfHeight:new D};break}return r[e.id]=t,t}}}function ob(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let ab=0;function lb(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function cb(r){const e=new sb,t=ob(),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 h=0;h<9;h++)n.probe.push(new D);const i=new D,s=new ut,a=new ut;function c(h){let f=0,p=0,m=0;for(let C=0;C<9;C++)n.probe[C].set(0,0,0);let g=0,y=0,M=0,x=0,_=0,w=0,E=0,T=0,U=0,R=0,L=0;h.sort(lb);for(let C=0,A=h.length;C<A;C++){const N=h[C],Z=N.color,q=N.intensity,K=N.distance,ce=N.shadow&&N.shadow.map?N.shadow.map.texture:null;if(N.isAmbientLight)f+=Z.r*q,p+=Z.g*q,m+=Z.b*q;else if(N.isLightProbe){for(let Q=0;Q<9;Q++)n.probe[Q].addScaledVector(N.sh.coefficients[Q],q);L++}else if(N.isDirectionalLight){const Q=e.get(N);if(Q.color.copy(N.color).multiplyScalar(N.intensity),N.castShadow){const ve=N.shadow,V=t.get(N);V.shadowIntensity=ve.intensity,V.shadowBias=ve.bias,V.shadowNormalBias=ve.normalBias,V.shadowRadius=ve.radius,V.shadowMapSize=ve.mapSize,n.directionalShadow[g]=V,n.directionalShadowMap[g]=ce,n.directionalShadowMatrix[g]=N.shadow.matrix,w++}n.directional[g]=Q,g++}else if(N.isSpotLight){const Q=e.get(N);Q.position.setFromMatrixPosition(N.matrixWorld),Q.color.copy(Z).multiplyScalar(q),Q.distance=K,Q.coneCos=Math.cos(N.angle),Q.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),Q.decay=N.decay,n.spot[M]=Q;const ve=N.shadow;if(N.map&&(n.spotLightMap[U]=N.map,U++,ve.updateMatrices(N),N.castShadow&&R++),n.spotLightMatrix[M]=ve.matrix,N.castShadow){const V=t.get(N);V.shadowIntensity=ve.intensity,V.shadowBias=ve.bias,V.shadowNormalBias=ve.normalBias,V.shadowRadius=ve.radius,V.shadowMapSize=ve.mapSize,n.spotShadow[M]=V,n.spotShadowMap[M]=ce,T++}M++}else if(N.isRectAreaLight){const Q=e.get(N);Q.color.copy(Z).multiplyScalar(q),Q.halfWidth.set(N.width*.5,0,0),Q.halfHeight.set(0,N.height*.5,0),n.rectArea[x]=Q,x++}else if(N.isPointLight){const Q=e.get(N);if(Q.color.copy(N.color).multiplyScalar(N.intensity),Q.distance=N.distance,Q.decay=N.decay,N.castShadow){const ve=N.shadow,V=t.get(N);V.shadowIntensity=ve.intensity,V.shadowBias=ve.bias,V.shadowNormalBias=ve.normalBias,V.shadowRadius=ve.radius,V.shadowMapSize=ve.mapSize,V.shadowCameraNear=ve.camera.near,V.shadowCameraFar=ve.camera.far,n.pointShadow[y]=V,n.pointShadowMap[y]=ce,n.pointShadowMatrix[y]=N.shadow.matrix,E++}n.point[y]=Q,y++}else if(N.isHemisphereLight){const Q=e.get(N);Q.skyColor.copy(N.color).multiplyScalar(q),Q.groundColor.copy(N.groundColor).multiplyScalar(q),n.hemi[_]=Q,_++}}x>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ae.LTC_FLOAT_1,n.rectAreaLTC2=Ae.LTC_FLOAT_2):(n.rectAreaLTC1=Ae.LTC_HALF_1,n.rectAreaLTC2=Ae.LTC_HALF_2)),n.ambient[0]=f,n.ambient[1]=p,n.ambient[2]=m;const F=n.hash;(F.directionalLength!==g||F.pointLength!==y||F.spotLength!==M||F.rectAreaLength!==x||F.hemiLength!==_||F.numDirectionalShadows!==w||F.numPointShadows!==E||F.numSpotShadows!==T||F.numSpotMaps!==U||F.numLightProbes!==L)&&(n.directional.length=g,n.spot.length=M,n.rectArea.length=x,n.point.length=y,n.hemi.length=_,n.directionalShadow.length=w,n.directionalShadowMap.length=w,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=w,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=T+U-R,n.spotLightMap.length=U,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=L,F.directionalLength=g,F.pointLength=y,F.spotLength=M,F.rectAreaLength=x,F.hemiLength=_,F.numDirectionalShadows=w,F.numPointShadows=E,F.numSpotShadows=T,F.numSpotMaps=U,F.numLightProbes=L,n.version=ab++)}function u(h,f){let p=0,m=0,g=0,y=0,M=0;const x=f.matrixWorldInverse;for(let _=0,w=h.length;_<w;_++){const E=h[_];if(E.isDirectionalLight){const T=n.directional[p];T.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),T.direction.sub(i),T.direction.transformDirection(x),p++}else if(E.isSpotLight){const T=n.spot[g];T.position.setFromMatrixPosition(E.matrixWorld),T.position.applyMatrix4(x),T.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),T.direction.sub(i),T.direction.transformDirection(x),g++}else if(E.isRectAreaLight){const T=n.rectArea[y];T.position.setFromMatrixPosition(E.matrixWorld),T.position.applyMatrix4(x),a.identity(),s.copy(E.matrixWorld),s.premultiply(x),a.extractRotation(s),T.halfWidth.set(E.width*.5,0,0),T.halfHeight.set(0,E.height*.5,0),T.halfWidth.applyMatrix4(a),T.halfHeight.applyMatrix4(a),y++}else if(E.isPointLight){const T=n.point[m];T.position.setFromMatrixPosition(E.matrixWorld),T.position.applyMatrix4(x),m++}else if(E.isHemisphereLight){const T=n.hemi[M];T.direction.setFromMatrixPosition(E.matrixWorld),T.direction.transformDirection(x),M++}}}return{setup:c,setupView:u,state:n}}function S0(r){const e=new cb(r),t=[],n=[];function i(f){h.camera=f,t.length=0,n.length=0}function s(f){t.push(f)}function a(f){n.push(f)}function c(){e.setup(t)}function u(f){e.setupView(t,f)}const h={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:h,setupLights:c,setupLightsView:u,pushLight:s,pushShadow:a}}function ub(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let c;return a===void 0?(c=new S0(r),e.set(i,[c])):s>=a.length?(c=new S0(r),a.push(c)):c=a[s],c}
vendor: 4,168 bytes, lines 3792-3820
3792function n(){e=new WeakMap}return{get:t,dispose:n}}class Ep extends Nn{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=v_,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class wp extends Nn{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const hb=`void main() {
3793	gl_Position = vec4( position, 1.0 );
3794}`,fb=`uniform sampler2D shadow_pass;
3795uniform vec2 resolution;
3796uniform float radius;
3797#include <packing>
3798void main() {
3799	const float samples = float( VSM_SAMPLES );
3800	float mean = 0.0;
3801	float squared_mean = 0.0;
3802	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3803	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3804	for ( float i = 0.0; i < samples; i ++ ) {
3805		float uvOffset = uvStart + i * uvStride;
3806		#ifdef HORIZONTAL_PASS
3807			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3808			mean += distribution.x;
3809			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3810		#else
3811			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3812			mean += depth;
3813			squared_mean += depth * depth;
3814		#endif
3815	}
3816	mean = mean / samples;
3817	squared_mean = squared_mean / samples;
3818	float std_dev = sqrt( squared_mean - mean * mean );
3819	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3820}`;function db(r,e,t){let n=new rl;const i=new ue,s=new ue,a=new bt,c=new Ep({depthPacking:__}),u=new wp,h={},f=t.maxTextureSize,p={[vr]:Hn,[Hn]:vr,[Gi]:Gi},m=new _i({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:hb,fragmentShader:fb}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const y=new xt;y.setAttribute("position",new zt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const M=new nn(y,m),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=eh;let _=this.type;this.render=function(R,L,F){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||R.length===0)return;const C=r.getRenderTarget(),A=r.getActiveCubeFace(),N=r.getActiveMipmapLevel(),Z=r.state;Z.setBlending(mr),Z.buffers.color.setClear(1,1,1,1),Z.buffers.depth.setTest(!0),Z.setScissorTest(!1);const q=_!==wi&&this.type===wi,K=_===wi&&this.type!==wi;for(let ce=0,Q=R.length;ce<Q;ce++){const ve=R[ce],V=ve.shadow;if(V===void 0){console.warn("THREE.WebGLShadowMap:",ve,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;i.copy(V.mapSize);const re=V.getFrameExtents();if(i.multiply(re),s.copy(V.mapSize),(i.x>f||i.y>f)&&(i.x>f&&(s.x=Math.floor(f/re.x),i.x=s.x*re.x,V.mapSize.x=s.x),i.y>f&&(s.y=Math.floor(f/re.y),i.y=s.y*re.y,V.mapSize.y=s.y)),V.map===null||q===!0||K===!0){const de=this.type!==wi?{minFilter:wn,magFilter:wn}:{};V.map!==null&&V.map.dispose(),V.map=new Ci(i.x,i.y,de),V.map.texture.name=ve.name+".shadowMap",V.camera.updateProjectionMatrix()}r.setRenderTarget(V.map),r.clear();const ie=V.getViewportCount();for(let de=0;de<ie;de++){const Re=V.getViewport(de);a.set(s.x*Re.x,s.y*Re.y,s.x*Re.z,s.y*Re.w),Z.viewport(a),V.updateMatrices(ve,de),n=V.getFrustum(),T(L,F,V.camera,ve,this.type)}V.isPointLightShadow!==!0&&this.type===wi&&w(V,F),V.needsUpdate=!1}_=this.type,x.needsUpdate=!1,r.setRenderTarget(C,A,N)};function w(R,L){const F=e.update(M);
vendor: 5,251 bytes, line 3820
3820m.defines.VSM_SAMPLES!==R.blurSamples&&(m.defines.VSM_SAMPLES=R.blurSamples,g.defines.VSM_SAMPLES=R.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Ci(i.x,i.y)),m.uniforms.shadow_pass.value=R.map.texture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,r.setRenderTarget(R.mapPass),r.clear(),r.renderBufferDirect(L,null,F,m,M,null),g.uniforms.shadow_pass.value=R.mapPass.texture,g.uniforms.resolution.value=R.mapSize,g.uniforms.radius.value=R.radius,r.setRenderTarget(R.map),r.clear(),r.renderBufferDirect(L,null,F,g,M,null)}function E(R,L,F,C){let A=null;const N=F.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(N!==void 0)A=N;else if(A=F.isPointLight===!0?u:c,r.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0){const Z=A.uuid,q=L.uuid;let K=h[Z];K===void 0&&(K={},h[Z]=K);let ce=K[q];ce===void 0&&(ce=A.clone(),K[q]=ce,L.addEventListener("dispose",U)),A=ce}if(A.visible=L.visible,A.wireframe=L.wireframe,C===wi?A.side=L.shadowSide!==null?L.shadowSide:L.side:A.side=L.shadowSide!==null?L.shadowSide:p[L.side],A.alphaMap=L.alphaMap,A.alphaTest=L.alphaTest,A.map=L.map,A.clipShadows=L.clipShadows,A.clippingPlanes=L.clippingPlanes,A.clipIntersection=L.clipIntersection,A.displacementMap=L.displacementMap,A.displacementScale=L.displacementScale,A.displacementBias=L.displacementBias,A.wireframeLinewidth=L.wireframeLinewidth,A.linewidth=L.linewidth,F.isPointLight===!0&&A.isMeshDistanceMaterial===!0){const Z=r.properties.get(A);Z.light=F}return A}function T(R,L,F,C,A){if(R.visible===!1)return;if(R.layers.test(L.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&A===wi)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,R.matrixWorld);const q=e.update(R),K=R.material;if(Array.isArray(K)){const ce=q.groups;for(let Q=0,ve=ce.length;Q<ve;Q++){const V=ce[Q],re=K[V.materialIndex];if(re&&re.visible){const ie=E(R,re,C,A);R.onBeforeShadow(r,R,L,F,q,ie,V),r.renderBufferDirect(F,null,q,ie,R,V),R.onAfterShadow(r,R,L,F,q,ie,V)}}}else if(K.visible){const ce=E(R,K,C,A);R.onBeforeShadow(r,R,L,F,q,ce,null),r.renderBufferDirect(F,null,q,ce,R,null),R.onAfterShadow(r,R,L,F,q,ce,null)}}const Z=R.children;for(let q=0,K=Z.length;q<K;q++)T(Z[q],L,F,C,A)}function U(R){R.target.removeEventListener("dispose",U);for(const F in h){const C=h[F],A=R.target.uuid;A in C&&(C[A].dispose(),delete C[A])}}}const pb={[du]:pu,[mu]:_u,[gu]:yu,[Is]:vu,[pu]:du,[_u]:mu,[yu]:gu,[vu]:Is};function mb(r,e){function t(){let k=!1;const Se=new bt;let te=null;const fe=new bt(0,0,0,0);return{setMask:function(Fe){te!==Fe&&!k&&(r.colorMask(Fe,Fe,Fe,Fe),te=Fe)},setLocked:function(Fe){k=Fe},setClear:function(Fe,Pe,nt,It,Vt){Vt===!0&&(Fe*=It,Pe*=It,nt*=It),Se.set(Fe,Pe,nt,It),fe.equals(Se)===!1&&(r.clearColor(Fe,Pe,nt,It),fe.copy(Se))},reset:function(){k=!1,te=null,fe.set(-1,0,0,0)}}}function n(){let k=!1,Se=!1,te=null,fe=null,Fe=null;return{setReversed:function(Pe){if(Se!==Pe){const nt=e.get("EXT_clip_control");Se?nt.clipControlEXT(nt.LOWER_LEFT_EXT,nt.ZERO_TO_ONE_EXT):nt.clipControlEXT(nt.LOWER_LEFT_EXT,nt.NEGATIVE_ONE_TO_ONE_EXT);const It=Fe;Fe=null,this.setClear(It)}Se=Pe},getReversed:function(){return Se},setTest:function(Pe){Pe?Me(r.DEPTH_TEST):et(r.DEPTH_TEST)},setMask:function(Pe){te!==Pe&&!k&&(r.depthMask(Pe),te=Pe)},setFunc:function(Pe){if(Se&&(Pe=pb[Pe]),fe!==Pe){switch(Pe){case du:r.depthFunc(r.NEVER);break;case pu:r.depthFunc(r.ALWAYS);break;case mu:r.depthFunc(r.LESS);break;case Is:r.depthFunc(r.LEQUAL);break;case gu:r.depthFunc(r.EQUAL);break;case vu:r.depthFunc(r.GEQUAL);break;case _u:r.depthFunc(r.GREATER);break;case yu:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}fe=Pe}},setLocked:function(Pe){k=Pe},setClear:function(Pe){Fe!==Pe&&(Se&&(Pe=1-Pe),r.clearDepth(Pe),Fe=Pe)},reset:function(){k=!1,te=null,fe=null,Fe=null,Se=!1}}}function i(){let k=!1,Se=null,te=null,fe=null,Fe=null,Pe=null,nt=null,It=null,Vt=null;return{setTest:function(At){k||(At?Me(r.STENCIL_TEST):et(r.STENCIL_TEST))},setMask:function(At){Se!==At&&!k&&(r.stencilMask(At),Se=At)},setFunc:function(At,rn,Tn){(te!==At||fe!==rn||Fe!==Tn)&&(r.stencilFunc(At,rn,Tn),te=At,fe=rn,Fe=Tn)},setOp:function(At,rn,Tn){(Pe!==At||nt!==rn||It!==Tn)&&(r.stencilOp(At,rn,Tn),Pe=At,nt=rn,It=Tn)},setLocked:function(At){k=At},setClear:function(At){Vt!==At&&(r.clearStencil(At),Vt=At)},reset:function(){k=!1,Se=null,te=null,fe=null,Fe=null,Pe=null,nt=null,It=null,Vt=null}}}const s=new t,a=new n,c=new i,u=new WeakMap,h=new WeakMap;let f={},p={},m=new WeakMap,g=[],y=null,M=!1,x=null,_=null,w=null,E=null,T=null,U=null,R=null,L=new Ve(0,0,0),F=0,C=!1,A=null,N=null,Z=null,q=null,K=null;const ce=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Q=!1,ve=0;const V=r.getParameter(r.VERSION);V.indexOf("WebGL")!==-1?(ve=parseFloat(/^WebGL (\d)/.exec(V)[1]),Q=ve>=1):V.indexOf("OpenGL ES")!==-1&&(ve=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),Q=ve>=2);let re=null,ie={};const de=r.getParameter(r.SCISSOR_BOX),Re=r.getParameter(r.VIEWPORT),Xe=new bt().fromArray(de),se=new bt().fromArray(Re);
vendor: 6,523 bytes, line 3820
3820function _e(k,Se,te,fe){const Fe=new Uint8Array(4),Pe=r.createTexture();r.bindTexture(k,Pe),r.texParameteri(k,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(k,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let nt=0;nt<te;nt++)k===r.TEXTURE_3D||k===r.TEXTURE_2D_ARRAY?r.texImage3D(Se,0,r.RGBA,1,1,fe,0,r.RGBA,r.UNSIGNED_BYTE,Fe):r.texImage2D(Se+nt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Fe);return Pe}const Le={};Le[r.TEXTURE_2D]=_e(r.TEXTURE_2D,r.TEXTURE_2D,1),Le[r.TEXTURE_CUBE_MAP]=_e(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),Le[r.TEXTURE_2D_ARRAY]=_e(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Le[r.TEXTURE_3D]=_e(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),c.setClear(0),Me(r.DEPTH_TEST),a.setFunc(Is),ye(!1),ze(Bd),Me(r.CULL_FACE),z(mr);function Me(k){f[k]!==!0&&(r.enable(k),f[k]=!0)}function et(k){f[k]!==!1&&(r.disable(k),f[k]=!1)}function lt(k,Se){return p[k]!==Se?(r.bindFramebuffer(k,Se),p[k]=Se,k===r.DRAW_FRAMEBUFFER&&(p[r.FRAMEBUFFER]=Se),k===r.FRAMEBUFFER&&(p[r.DRAW_FRAMEBUFFER]=Se),!0):!1}function tt(k,Se){let te=g,fe=!1;if(k){te=m.get(Se),te===void 0&&(te=[],m.set(Se,te));const Fe=k.textures;if(te.length!==Fe.length||te[0]!==r.COLOR_ATTACHMENT0){for(let Pe=0,nt=Fe.length;Pe<nt;Pe++)te[Pe]=r.COLOR_ATTACHMENT0+Pe;te.length=Fe.length,fe=!0}}else te[0]!==r.BACK&&(te[0]=r.BACK,fe=!0);fe&&r.drawBuffers(te)}function ft(k){return y!==k?(r.useProgram(k),y=k,!0):!1}const pe={[zr]:r.FUNC_ADD,[Hv]:r.FUNC_SUBTRACT,[Gv]:r.FUNC_REVERSE_SUBTRACT};pe[Wv]=r.MIN,pe[Xv]=r.MAX;const ge={[Yv]:r.ZERO,[qv]:r.ONE,[Zv]:r.SRC_COLOR,[hu]:r.SRC_ALPHA,[e_]:r.SRC_ALPHA_SATURATE,[Qv]:r.DST_COLOR,[Jv]:r.DST_ALPHA,[jv]:r.ONE_MINUS_SRC_COLOR,[fu]:r.ONE_MINUS_SRC_ALPHA,[$v]:r.ONE_MINUS_DST_COLOR,[Kv]:r.ONE_MINUS_DST_ALPHA,[t_]:r.CONSTANT_COLOR,[n_]:r.ONE_MINUS_CONSTANT_COLOR,[i_]:r.CONSTANT_ALPHA,[r_]:r.ONE_MINUS_CONSTANT_ALPHA};function z(k,Se,te,fe,Fe,Pe,nt,It,Vt,At){if(k===mr){M===!0&&(et(r.BLEND),M=!1);return}if(M===!1&&(Me(r.BLEND),M=!0),k!==Vv){if(k!==x||At!==C){if((_!==zr||T!==zr)&&(r.blendEquation(r.FUNC_ADD),_=zr,T=zr),At)switch(k){case Ts:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case zd:r.blendFunc(r.ONE,r.ONE);break;case kd:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Vd:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}else switch(k){case Ts:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case zd:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case kd:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Vd:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}w=null,E=null,U=null,R=null,L.set(0,0,0),F=0,x=k,C=At}return}Fe=Fe||Se,Pe=Pe||te,nt=nt||fe,(Se!==_||Fe!==T)&&(r.blendEquationSeparate(pe[Se],pe[Fe]),_=Se,T=Fe),(te!==w||fe!==E||Pe!==U||nt!==R)&&(r.blendFuncSeparate(ge[te],ge[fe],ge[Pe],ge[nt]),w=te,E=fe,U=Pe,R=nt),(It.equals(L)===!1||Vt!==F)&&(r.blendColor(It.r,It.g,It.b,Vt),L.copy(It),F=Vt),x=k,C=!1}function Ke(k,Se){k.side===Gi?et(r.CULL_FACE):Me(r.CULL_FACE);let te=k.side===Hn;Se&&(te=!te),ye(te),k.blending===Ts&&k.transparent===!1?z(mr):z(k.blending,k.blendEquation,k.blendSrc,k.blendDst,k.blendEquationAlpha,k.blendSrcAlpha,k.blendDstAlpha,k.blendColor,k.blendAlpha,k.premultipliedAlpha),a.setFunc(k.depthFunc),a.setTest(k.depthTest),a.setMask(k.depthWrite),s.setMask(k.colorWrite);const fe=k.stencilWrite;c.setTest(fe),fe&&(c.setMask(k.stencilWriteMask),c.setFunc(k.stencilFunc,k.stencilRef,k.stencilFuncMask),c.setOp(k.stencilFail,k.stencilZFail,k.stencilZPass)),it(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),k.alphaToCoverage===!0?Me(r.SAMPLE_ALPHA_TO_COVERAGE):et(r.SAMPLE_ALPHA_TO_COVERAGE)}function ye(k){A!==k&&(k?r.frontFace(r.CW):r.frontFace(r.CCW),A=k)}function ze(k){k!==Bv?(Me(r.CULL_FACE),k!==N&&(k===Bd?r.cullFace(r.BACK):k===zv?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):et(r.CULL_FACE),N=k}function Te(k){k!==Z&&(Q&&r.lineWidth(k),Z=k)}function it(k,Se,te){k?(Me(r.POLYGON_OFFSET_FILL),(q!==Se||K!==te)&&(r.polygonOffset(Se,te),q=Se,K=te)):et(r.POLYGON_OFFSET_FILL)}function De(k){k?Me(r.SCISSOR_TEST):et(r.SCISSOR_TEST)}function O(k){k===void 0&&(k=r.TEXTURE0+ce-1),re!==k&&(r.activeTexture(k),re=k)}function P(k,Se,te){te===void 0&&(re===null?te=r.TEXTURE0+ce-1:te=re);let fe=ie[te];fe===void 0&&(fe={type:void 0,texture:void 0},ie[te]=fe),(fe.type!==k||fe.texture!==Se)&&(re!==te&&(r.activeTexture(te),re=te),r.bindTexture(k,Se||Le[k]),fe.type=k,fe.texture=Se)}function j(){const k=ie[re];k!==void 0&&k.type!==void 0&&(r.bindTexture(k.type,null),k.type=void 0,k.texture=void 0)}function ae(){try{r.compressedTexImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function me(){try{r.compressedTexImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function he(){try{r.texSubImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Ye(){try{r.texSubImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function be(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ke(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function St(){try{r.texStorage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function xe(){try{r.texStorage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Ge(){try{r.texImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function rt(){try{r.texImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ct(k){Xe.equals(k)===!1&&(r.scissor(k.x,k.y,k.z,k.w),Xe.copy(k))}function He(k){se.equals(k)===!1&&(r.viewport(k.x,k.y,k.z,k.w),se.copy(k))}function H(k,Se){let te=h.get(Se);te===void 0&&(te=new WeakMap,h.set(Se,te));let fe=te.get(k);fe===void 0&&(fe=r.getUniformBlockIndex(Se,k.name),te.set(k,fe))}function le(k,Se){const fe=h.get(Se).get(k);u.get(Se)!==fe&&(r.uniformBlockBinding(Se,fe,k.__bindingPointIndex),u.set(Se,fe))}function Ie(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor
vendor: 4,651 bytes, line 3820
3820(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),f={},re=null,ie={},p={},m=new WeakMap,g=[],y=null,M=!1,x=null,_=null,w=null,E=null,T=null,U=null,R=null,L=new Ve(0,0,0),F=0,C=!1,A=null,N=null,Z=null,q=null,K=null,Xe.set(0,0,r.canvas.width,r.canvas.height),se.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),c.reset()}return{buffers:{color:s,depth:a,stencil:c},enable:Me,disable:et,bindFramebuffer:lt,drawBuffers:tt,useProgram:ft,setBlending:z,setMaterial:Ke,setFlipSided:ye,setCullFace:ze,setLineWidth:Te,setPolygonOffset:it,setScissorTest:De,activeTexture:O,bindTexture:P,unbindTexture:j,compressedTexImage2D:ae,compressedTexImage3D:me,texImage2D:Ge,texImage3D:rt,updateUBOMapping:H,uniformBlockBinding:le,texStorage2D:St,texStorage3D:xe,texSubImage2D:he,texSubImage3D:Ye,compressedTexSubImage2D:be,compressedTexSubImage3D:ke,scissor:ct,viewport:He,reset:Ie}}function gb(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function vb(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function _b(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function qd(r,e,t,n){const i=yb(n);switch(t){case cp:return r*e;case hp:return r*e;case fp:return r*e*2;case sh:return r*e/i.components*i.byteLength;case el:return r*e/i.components*i.byteLength;case dp:return r*e*2/i.components*i.byteLength;case oh:return r*e*2/i.components*i.byteLength;case up:return r*e*3/i.components*i.byteLength;case Dn:return r*e*4/i.components*i.byteLength;case ah:return r*e*4/i.components*i.byteLength;case Aa:case Ca:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Ra:case Pa:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Su:case Eu:return Math.max(r,16)*Math.max(e,8)/4;case xu:case Mu:return Math.max(r,8)*Math.max(e,8)/2;case wu:case Tu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case bu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Au:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Cu:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ru:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Pu:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Iu:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Lu:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Du:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Uu:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Nu:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Ou:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case Fu:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Bu:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case zu:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case ku:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Ia:case Vu:case Hu:return Math.ceil(r/4)*Math.ceil(e/4)*16;case pp:case Gu:return Math.ceil(r/4)*Math.ceil(e/4)*8;case Wu:case Xu:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function yb(r){switch(r){case Ai:case op:return{byteLength:1,components:1};case Lo:case ap:case zo:return{byteLength:2,components:1};case ih:case rh:return{byteLength:2,components:4};case yr:case nh:case Kn:return{byteLength:4,components:1};case lp:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}const xb={contain:gb,cover:vb,fill:_b,getByteLength:qd};function Sb(r,e,t,n,i,s,a){const c=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new ue,f=new WeakMap;let p;const m=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(O,P){return g?new OffscreenCanvas(O,P):Ga("canvas")}function M(O,P,j){let ae=1;const me=De(O);
vendor: 4,530 bytes, line 3820
3820if((me.width>j||me.height>j)&&(ae=j/Math.max(me.width,me.height)),ae<1)if(typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&O instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&O instanceof ImageBitmap||typeof VideoFrame<"u"&&O instanceof VideoFrame){const he=Math.floor(ae*me.width),Ye=Math.floor(ae*me.height);p===void 0&&(p=y(he,Ye));const be=P?y(he,Ye):p;return be.width=he,be.height=Ye,be.getContext("2d").drawImage(O,0,0,he,Ye),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+me.width+"x"+me.height+") to ("+he+"x"+Ye+")."),be}else return"data"in O&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+me.width+"x"+me.height+")."),O;return O}function x(O){return O.generateMipmaps}function _(O){r.generateMipmap(O)}function w(O){return O.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:O.isWebGL3DRenderTarget?r.TEXTURE_3D:O.isWebGLArrayRenderTarget||O.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function E(O,P,j,ae,me=!1){if(O!==null){if(r[O]!==void 0)return r[O];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+O+"'")}let he=P;if(P===r.RED&&(j===r.FLOAT&&(he=r.R32F),j===r.HALF_FLOAT&&(he=r.R16F),j===r.UNSIGNED_BYTE&&(he=r.R8)),P===r.RED_INTEGER&&(j===r.UNSIGNED_BYTE&&(he=r.R8UI),j===r.UNSIGNED_SHORT&&(he=r.R16UI),j===r.UNSIGNED_INT&&(he=r.R32UI),j===r.BYTE&&(he=r.R8I),j===r.SHORT&&(he=r.R16I),j===r.INT&&(he=r.R32I)),P===r.RG&&(j===r.FLOAT&&(he=r.RG32F),j===r.HALF_FLOAT&&(he=r.RG16F),j===r.UNSIGNED_BYTE&&(he=r.RG8)),P===r.RG_INTEGER&&(j===r.UNSIGNED_BYTE&&(he=r.RG8UI),j===r.UNSIGNED_SHORT&&(he=r.RG16UI),j===r.UNSIGNED_INT&&(he=r.RG32UI),j===r.BYTE&&(he=r.RG8I),j===r.SHORT&&(he=r.RG16I),j===r.INT&&(he=r.RG32I)),P===r.RGB_INTEGER&&(j===r.UNSIGNED_BYTE&&(he=r.RGB8UI),j===r.UNSIGNED_SHORT&&(he=r.RGB16UI),j===r.UNSIGNED_INT&&(he=r.RGB32UI),j===r.BYTE&&(he=r.RGB8I),j===r.SHORT&&(he=r.RGB16I),j===r.INT&&(he=r.RGB32I)),P===r.RGBA_INTEGER&&(j===r.UNSIGNED_BYTE&&(he=r.RGBA8UI),j===r.UNSIGNED_SHORT&&(he=r.RGBA16UI),j===r.UNSIGNED_INT&&(he=r.RGBA32UI),j===r.BYTE&&(he=r.RGBA8I),j===r.SHORT&&(he=r.RGBA16I),j===r.INT&&(he=r.RGBA32I)),P===r.RGB&&j===r.UNSIGNED_INT_5_9_9_9_REV&&(he=r.RGB9_E5),P===r.RGBA){const Ye=me?tl:Pt.getTransfer(ae);j===r.FLOAT&&(he=r.RGBA32F),j===r.HALF_FLOAT&&(he=r.RGBA16F),j===r.UNSIGNED_BYTE&&(he=Ye===Ft?r.SRGB8_ALPHA8:r.RGBA8),j===r.UNSIGNED_SHORT_4_4_4_4&&(he=r.RGBA4),j===r.UNSIGNED_SHORT_5_5_5_1&&(he=r.RGB5_A1)}return(he===r.R16F||he===r.R32F||he===r.RG16F||he===r.RG32F||he===r.RGBA16F||he===r.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function T(O,P){let j;return O?P===null||P===yr||P===Ls?j=r.DEPTH24_STENCIL8:P===Kn?j=r.DEPTH32F_STENCIL8:P===Lo&&(j=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):P===null||P===yr||P===Ls?j=r.DEPTH_COMPONENT24:P===Kn?j=r.DEPTH_COMPONENT32F:P===Lo&&(j=r.DEPTH_COMPONENT16),j}function U(O,P){return x(O)===!0||O.isFramebufferTexture&&O.minFilter!==wn&&O.minFilter!==cn?Math.log2(Math.max(P.width,P.height))+1:O.mipmaps!==void 0&&O.mipmaps.length>0?O.mipmaps.length:O.isCompressedTexture&&Array.isArray(O.image)?P.mipmaps.length:1}function R(O){const P=O.target;P.removeEventListener("dispose",R),F(P),P.isVideoTexture&&f.delete(P)}function L(O){const P=O.target;P.removeEventListener("dispose",L),A(P)}function F(O){const P=n.get(O);if(P.__webglInit===void 0)return;const j=O.source,ae=m.get(j);if(ae){const me=ae[P.__cacheKey];me.usedTimes--,me.usedTimes===0&&C(O),Object.keys(ae).length===0&&m.delete(j)}n.remove(O)}function C(O){const P=n.get(O);r.deleteTexture(P.__webglTexture);const j=O.source,ae=m.get(j);delete ae[P.__cacheKey],a.memory.textures--}function A(O){const P=n.get(O);if(O.depthTexture&&(O.depthTexture.dispose(),n.remove(O.depthTexture)),O.isWebGLCubeRenderTarget)for(let ae=0;ae<6;ae++){if(Array.isArray(P.__webglFramebuffer[ae]))for(let me=0;me<P.__webglFramebuffer[ae].length;me++)r.deleteFramebuffer(P.__webglFramebuffer[ae][me]);else r.deleteFramebuffer(P.__webglFramebuffer[ae]);P.__webglDepthbuffer&&r.deleteRenderbuffer(P.__webglDepthbuffer[ae])}else{if(Array.isArray(P.__webglFramebuffer))for(let ae=0;ae<P.__webglFramebuffer.length;ae++)r.deleteFramebuffer(P.__webglFramebuffer[ae]);else r.deleteFramebuffer(P.__webglFramebuffer);if(P.__webglDepthbuffer&&r.deleteRenderbuffer(P.__webglDepthbuffer),P.__webglMultisampledFramebuffer&&r.deleteFramebuffer(P.__webglMultisampledFramebuffer),P.__webglColorRen
vendor: 4,167 bytes, line 3820
3820derbuffer)for(let ae=0;ae<P.__webglColorRenderbuffer.length;ae++)P.__webglColorRenderbuffer[ae]&&r.deleteRenderbuffer(P.__webglColorRenderbuffer[ae]);P.__webglDepthRenderbuffer&&r.deleteRenderbuffer(P.__webglDepthRenderbuffer)}const j=O.textures;for(let ae=0,me=j.length;ae<me;ae++){const he=n.get(j[ae]);he.__webglTexture&&(r.deleteTexture(he.__webglTexture),a.memory.textures--),n.remove(j[ae])}n.remove(O)}let N=0;function Z(){N=0}function q(){const O=N;return O>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+O+" texture units while this GPU supports only "+i.maxTextures),N+=1,O}function K(O){const P=[];return P.push(O.wrapS),P.push(O.wrapT),P.push(O.wrapR||0),P.push(O.magFilter),P.push(O.minFilter),P.push(O.anisotropy),P.push(O.internalFormat),P.push(O.format),P.push(O.type),P.push(O.generateMipmaps),P.push(O.premultiplyAlpha),P.push(O.flipY),P.push(O.unpackAlignment),P.push(O.colorSpace),P.join()}function ce(O,P){const j=n.get(O);if(O.isVideoTexture&&Te(O),O.isRenderTargetTexture===!1&&O.version>0&&j.__version!==O.version){const ae=O.image;if(ae===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ae.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{se(j,O,P);return}}t.bindTexture(r.TEXTURE_2D,j.__webglTexture,r.TEXTURE0+P)}function Q(O,P){const j=n.get(O);if(O.version>0&&j.__version!==O.version){se(j,O,P);return}t.bindTexture(r.TEXTURE_2D_ARRAY,j.__webglTexture,r.TEXTURE0+P)}function ve(O,P){const j=n.get(O);if(O.version>0&&j.__version!==O.version){se(j,O,P);return}t.bindTexture(r.TEXTURE_3D,j.__webglTexture,r.TEXTURE0+P)}function V(O,P){const j=n.get(O);if(O.version>0&&j.__version!==O.version){_e(j,O,P);return}t.bindTexture(r.TEXTURE_CUBE_MAP,j.__webglTexture,r.TEXTURE0+P)}const re={[Fa]:r.REPEAT,[vi]:r.CLAMP_TO_EDGE,[Ba]:r.MIRRORED_REPEAT},ie={[wn]:r.NEAREST,[sp]:r.NEAREST_MIPMAP_NEAREST,[wo]:r.NEAREST_MIPMAP_LINEAR,[cn]:r.LINEAR,[ba]:r.LINEAR_MIPMAP_NEAREST,[Xi]:r.LINEAR_MIPMAP_LINEAR},de={[x_]:r.NEVER,[b_]:r.ALWAYS,[S_]:r.LESS,[gp]:r.LEQUAL,[M_]:r.EQUAL,[T_]:r.GEQUAL,[E_]:r.GREATER,[w_]:r.NOTEQUAL};function Re(O,P){if(P.type===Kn&&e.has("OES_texture_float_linear")===!1&&(P.magFilter===cn||P.magFilter===ba||P.magFilter===wo||P.magFilter===Xi||P.minFilter===cn||P.minFilter===ba||P.minFilter===wo||P.minFilter===Xi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(O,r.TEXTURE_WRAP_S,re[P.wrapS]),r.texParameteri(O,r.TEXTURE_WRAP_T,re[P.wrapT]),(O===r.TEXTURE_3D||O===r.TEXTURE_2D_ARRAY)&&r.texParameteri(O,r.TEXTURE_WRAP_R,re[P.wrapR]),r.texParameteri(O,r.TEXTURE_MAG_FILTER,ie[P.magFilter]),r.texParameteri(O,r.TEXTURE_MIN_FILTER,ie[P.minFilter]),P.compareFunction&&(r.texParameteri(O,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(O,r.TEXTURE_COMPARE_FUNC,de[P.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(P.magFilter===wn||P.minFilter!==wo&&P.minFilter!==Xi||P.type===Kn&&e.has("OES_texture_float_linear")===!1)return;if(P.anisotropy>1||n.get(P).__currentAnisotropy){const j=e.get("EXT_texture_filter_anisotropic");r.texParameterf(O,j.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(P.anisotropy,i.getMaxAnisotropy())),n.get(P).__currentAnisotropy=P.anisotropy}}}function Xe(O,P){let j=!1;O.__webglInit===void 0&&(O.__webglInit=!0,P.addEventListener("dispose",R));const ae=P.source;let me=m.get(ae);me===void 0&&(me={},m.set(ae,me));const he=K(P);if(he!==O.__cacheKey){me[he]===void 0&&(me[he]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,j=!0),me[he].usedTimes++;const Ye=me[O.__cacheKey];Ye!==void 0&&(me[O.__cacheKey].usedTimes--,Ye.usedTimes===0&&C(P)),O.__cacheKey=he,O.__webglTexture=me[he].texture}return j}function se(O,P,j){let ae=r.TEXTURE_2D;(P.isDataArrayTexture||P.isCompressedArrayTexture)&&(ae=r.TEXTURE_2D_ARRAY),P.isData3DTexture&&(ae=r.TEXTURE_3D);const me=Xe(O,P),he=P.source;t.bindTexture(ae,O.__webglTexture,r.TEXTURE0+j);const Ye=n.get(he);if(he.version!==Ye.__version||me===!0){t.activeTexture(r.TEXTURE0+j);
vendor: 21,923 bytes, line 3820
3820const be=Pt.getPrimaries(Pt.workingColorSpace),ke=P.colorSpace===fr?null:Pt.getPrimaries(P.colorSpace),St=P.colorSpace===fr||be===ke?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,St);let xe=M(P.image,!1,i.maxTextureSize);xe=it(P,xe);const Ge=s.convert(P.format,P.colorSpace),rt=s.convert(P.type);let ct=E(P.internalFormat,Ge,rt,P.colorSpace,P.isVideoTexture);Re(ae,P);let He;const H=P.mipmaps,le=P.isVideoTexture!==!0,Ie=Ye.__version===void 0||me===!0,k=he.dataReady,Se=U(P,xe);if(P.isDepthTexture)ct=T(P.format===Ds,P.type),Ie&&(le?t.texStorage2D(r.TEXTURE_2D,1,ct,xe.width,xe.height):t.texImage2D(r.TEXTURE_2D,0,ct,xe.width,xe.height,0,Ge,rt,null));else if(P.isDataTexture)if(H.length>0){le&&Ie&&t.texStorage2D(r.TEXTURE_2D,Se,ct,H[0].width,H[0].height);for(let te=0,fe=H.length;te<fe;te++)He=H[te],le?k&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,He.width,He.height,Ge,rt,He.data):t.texImage2D(r.TEXTURE_2D,te,ct,He.width,He.height,0,Ge,rt,He.data);P.generateMipmaps=!1}else le?(Ie&&t.texStorage2D(r.TEXTURE_2D,Se,ct,xe.width,xe.height),k&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,xe.width,xe.height,Ge,rt,xe.data)):t.texImage2D(r.TEXTURE_2D,0,ct,xe.width,xe.height,0,Ge,rt,xe.data);else if(P.isCompressedTexture)if(P.isCompressedArrayTexture){le&&Ie&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Se,ct,H[0].width,H[0].height,xe.depth);for(let te=0,fe=H.length;te<fe;te++)if(He=H[te],P.format!==Dn)if(Ge!==null)if(le){if(k)if(P.layerUpdates.size>0){const Fe=qd(He.width,He.height,P.format,P.type);for(const Pe of P.layerUpdates){const nt=He.data.subarray(Pe*Fe/He.data.BYTES_PER_ELEMENT,(Pe+1)*Fe/He.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,Pe,He.width,He.height,1,Ge,nt)}P.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,He.width,He.height,xe.depth,Ge,He.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,te,ct,He.width,He.height,xe.depth,0,He.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else le?k&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,He.width,He.height,xe.depth,Ge,rt,He.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,ct,He.width,He.height,xe.depth,0,Ge,rt,He.data)}else{le&&Ie&&t.texStorage2D(r.TEXTURE_2D,Se,ct,H[0].width,H[0].height);for(let te=0,fe=H.length;te<fe;te++)He=H[te],P.format!==Dn?Ge!==null?le?k&&t.compressedTexSubImage2D(r.TEXTURE_2D,te,0,0,He.width,He.height,Ge,He.data):t.compressedTexImage2D(r.TEXTURE_2D,te,ct,He.width,He.height,0,He.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):le?k&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,He.width,He.height,Ge,rt,He.data):t.texImage2D(r.TEXTURE_2D,te,ct,He.width,He.height,0,Ge,rt,He.data)}else if(P.isDataArrayTexture)if(le){if(Ie&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Se,ct,xe.width,xe.height,xe.depth),k)if(P.layerUpdates.size>0){const te=qd(xe.width,xe.height,P.format,P.type);for(const fe of P.layerUpdates){const Fe=xe.data.subarray(fe*te/xe.data.BYTES_PER_ELEMENT,(fe+1)*te/xe.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,fe,xe.width,xe.height,1,Ge,rt,Fe)}P.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,xe.width,xe.height,xe.depth,Ge,rt,xe.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,ct,xe.width,xe.height,xe.depth,0,Ge,rt,xe.data);else if(P.isData3DTexture)le?(Ie&&t.texStorage3D(r.TEXTURE_3D,Se,ct,xe.width,xe.height,xe.depth),k&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,xe.width,xe.height,xe.depth,Ge,rt,xe.data)):t.texImage3D(r.TEXTURE_3D,0,ct,xe.width,xe.height,xe.depth,0,Ge,rt,xe.data);else if(P.isFramebufferTexture){if(Ie)if(le)t.texStorage2D(r.TEXTURE_2D,Se,ct,xe.width,xe.height);else{let te=xe.width,fe=xe.height;for(let Fe=0;Fe<Se;Fe++)t.texImage2D(r.TEXTURE_2D,Fe,ct,te,fe,0,Ge,rt,null),te>>=1,fe>>=1}}else if(H.length>0){if(le&&Ie){const te=De(H[0]);t.texStorage2D(r.TEXTURE_2D,Se,ct,te.width,te.height)}for(let te=0,fe=H.length;te<fe;te++)He=H[te],le?k&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Ge,rt,He):t.texImage2D(r.TEXTURE_2D,te,ct,Ge,rt,He);P.generateMipmaps=!1}else if(le){if(Ie){const te=De(xe);t.texStorage2D(r.TEXTURE_2D,Se,ct,te.width,te.height)}k&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Ge,rt,xe)}else t.texImage2D(r.TEXTURE_2D,0,ct,Ge,rt,xe);x(P)&&_(ae),Ye.__version=he.version,P.onUpdate&&P.onUpdate(P)}O.__version=P.version}function _e(O,P,j){if(P.image.length!==6)return;const ae=Xe(O,P),me=P.source;t.bindTexture(r.TEXTURE_CUBE_MAP,O.__webglTexture,r.TEXTURE0+j);const he=n.get(me);if(me.version!==he.__version||ae===!0){t.activeTexture(r.TEXTURE0+j);const Ye=Pt.getPrimaries(Pt.workingColorSpace),be=P.colorSpace===fr?null:Pt.getPrimaries(P.colorSpace),ke=P.colorSpace===fr||Ye===be?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ke);const St=P.isCompressedTexture||P.image[0].isCompressedTexture,xe=P.image[0]&&P.image[0].isDataTexture,Ge=[];for(let fe=0;fe<6;fe++)!St&&!xe?Ge[fe]=M(P.image[fe],!0,i.maxCubemapSize):Ge[fe]=xe?P.image[fe].image:P.image[fe],Ge[fe]=it(P,Ge[fe]);const rt=Ge[0],ct=s.convert(P.format,P.colorSpace),He=s.convert(P.type),H=E(P.internalFormat,ct,He,P.colorSpace),le=P.isVideoTexture!==!0,Ie=he.__version===void 0||ae===!0,k=me.dataReady;let Se=U(P,rt);Re(r.TEXTURE_CUBE_MAP,P);let te;if(St){le&&Ie&&t.texStorage2D(r.TEXTURE_CUBE_MAP,Se,H,rt.width,rt.height);for(let fe=0;fe<6;fe++){te=Ge[fe].mipmaps;for(let Fe=0;Fe<te.length;Fe++){const Pe=te[Fe];P.format!==Dn?ct!==null?le?k&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Fe,0,0,Pe.width,Pe.height,ct,Pe.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Fe,H,Pe.width,Pe.height,0,Pe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):le?k&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Fe,0,0,Pe.width,Pe.height,ct,He,Pe.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Fe,H,Pe.width,Pe.height,0,ct,He,Pe.data)}}}else{if(te=P.mipmaps,le&&Ie){te.length>0&&Se++;const fe=De(Ge[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Se,H,fe.width,fe.height)}for(let fe=0;fe<6;fe++)if(xe){le?k&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,0,0,Ge[fe].width,Ge[fe].height,ct,He,Ge[fe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,H,Ge[fe].width,Ge[fe].height,0,ct,He,Ge[fe].data);for(let Fe=0;Fe<te.length;Fe++){const nt=te[Fe].image[fe].image;le?k&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Fe+1,0,0,nt.width,nt.height,ct,He,nt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Fe+1,H,nt.width,nt.height,0,ct,He,nt.data)}}else{le?k&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,0,0,ct,He,Ge[fe]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,H,ct,He,Ge[fe]);for(let Fe=0;Fe<te.length;Fe++){const Pe=te[Fe];le?k&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Fe+1,0,0,ct,He,Pe.image[fe]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,Fe+1,H,ct,He,Pe.image[fe])}}}x(P)&&_(r.TEXTURE_CUBE_MAP),he.__version=me.version,P.onUpdate&&P.onUpdate(P)}O.__version=P.version}function Le(O,P,j,ae,me,he){const Ye=s.convert(j.format,j.colorSpace),be=s.convert(j.type),ke=E(j.internalFormat,Ye,be,j.colorSpace),St=n.get(P),xe=n.get(j);if(xe.__renderTarget=P,!St.__hasExternalTextures){const Ge=Math.max(1,P.width>>he),rt=Math.max(1,P.height>>he);me===r.TEXTURE_3D||me===r.TEXTURE_2D_ARRAY?t.texImage3D(me,he,ke,Ge,rt,P.depth,0,Ye,be,null):t.texImage2D(me,he,ke,Ge,rt,0,Ye,be,null)}t.bindFramebuffer(r.FRAMEBUFFER,O),ze(P)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ae,me,xe.__webglTexture,0,ye(P)):(me===r.TEXTURE_2D||me>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&me<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,ae,me,xe.__webglTexture,he),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Me(O,P,j){if(r.bindRenderbuffer(r.RENDERBUFFER,O),P.depthBuffer){const ae=P.depthTexture,me=ae&&ae.isDepthTexture?ae.type:null,he=T(P.stencilBuffer,me),Ye=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,be=ye(P);ze(P)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,be,he,P.width,P.height):j?r.renderbufferStorageMultisample(r.RENDERBUFFER,be,he,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,he,P.width,P.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ye,r.RENDERBUFFER,O)}else{const ae=P.textures;for(let me=0;me<ae.length;me++){const he=ae[me],Ye=s.convert(he.format,he.colorSpace),be=s.convert(he.type),ke=E(he.internalFormat,Ye,be,he.colorSpace),St=ye(P);j&&ze(P)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,St,ke,P.width,P.height):ze(P)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,St,ke,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,ke,P.width,P.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function et(O,P){if(P&&P.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,O),!(P.depthTexture&&P.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ae=n.get(P.depthTexture);ae.__renderTarget=P,(!ae.__webglTexture||P.depthTexture.image.width!==P.width||P.depthTexture.image.height!==P.height)&&(P.depthTexture.image.width=P.width,P.depthTexture.image.height=P.height,P.depthTexture.needsUpdate=!0),ce(P.depthTexture,0);const me=ae.__webglTexture,he=ye(P);if(P.depthTexture.format===bs)ze(P)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,me,0,he):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,me,0);else if(P.depthTexture.format===Ds)ze(P)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,me,0,he):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,me,0);else throw new Error("Unknown depthTexture format")}function lt(O){const P=n.get(O),j=O.isWebGLCubeRenderTarget===!0;if(P.__boundDepthTexture!==O.depthTexture){const ae=O.depthTexture;if(P.__depthDisposeCallback&&P.__depthDisposeCallback(),ae){const me=()=>{delete P.__boundDepthTexture,delete P.__depthDisposeCallback,ae.removeEventListener("dispose",me)};ae.addEventListener("dispose",me),P.__depthDisposeCallback=me}P.__boundDepthTexture=ae}if(O.depthTexture&&!P.__autoAllocateDepthBuffer){if(j)throw new Error("target.depthTexture not supported in Cube render targets");et(P.__webglFramebuffer,O)}else if(j){P.__webglDepthbuffer=[];for(let ae=0;ae<6;ae++)if(t.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer[ae]),P.__webglDepthbuffer[ae]===void 0)P.__webglDepthbuffer[ae]=r.createRenderbuffer(),Me(P.__webglDepthbuffer[ae],O,!1);else{const me=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,he=P.__webglDepthbuffer[ae];r.bindRenderbuffer(r.RENDERBUFFER,he),r.framebufferRenderbuffer(r.FRAMEBUFFER,me,r.RENDERBUFFER,he)}}else if(t.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer),P.__webglDepthbuffer===void 0)P.__webglDepthbuffer=r.createRenderbuffer(),Me(P.__webglDepthbuffer,O,!1);else{const ae=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,me=P.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,me),r.framebufferRenderbuffer(r.FRAMEBUFFER,ae,r.RENDERBUFFER,me)}t.bindFramebuffer(r.FRAMEBUFFER,null)}function tt(O,P,j){const ae=n.get(O);P!==void 0&&Le(ae.__webglFramebuffer,O,O.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),j!==void 0&&lt(O)}function ft(O){const P=O.texture,j=n.get(O),ae=n.get(P);O.addEventListener("dispose",L);const me=O.textures,he=O.isWebGLCubeRenderTarget===!0,Ye=me.length>1;if(Ye||(ae.__webglTexture===void 0&&(ae.__webglTexture=r.createTexture()),ae.__version=P.version,a.memory.textures++),he){j.__webglFramebuffer=[];for(let be=0;be<6;be++)if(P.mipmaps&&P.mipmaps.length>0){j.__webglFramebuffer[be]=[];for(let ke=0;ke<P.mipmaps.length;ke++)j.__webglFramebuffer[be][ke]=r.createFramebuffer()}else j.__webglFramebuffer[be]=r.createFramebuffer()}else{if(P.mipmaps&&P.mipmaps.length>0){j.__webglFramebuffer=[];for(let be=0;be<P.mipmaps.length;be++)j.__webglFramebuffer[be]=r.createFramebuffer()}else j.__webglFramebuffer=r.createFramebuffer();if(Ye)for(let be=0,ke=me.length;be<ke;be++){const St=n.get(me[be]);St.__webglTexture===void 0&&(St.__webglTexture=r.createTexture(),a.memory.textures++)}if(O.samples>0&&ze(O)===!1){j.__webglMultisampledFramebuffer=r.createFramebuffer(),j.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,j.__webglMultisampledFramebuffer);for(let be=0;be<me.length;be++){const ke=me[be];j.__webglColorRenderbuffer[be]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,j.__webglColorRenderbuffer[be]);const St=s.convert(ke.format,ke.colorSpace),xe=s.convert(ke.type),Ge=E(ke.internalFormat,St,xe,ke.colorSpace,O.isXRRenderTarget===!0),rt=ye(O);r.renderbufferStorageMultisample(r.RENDERBUFFER,rt,Ge,O.width,O.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+be,r.RENDERBUFFER,j.__webglColorRenderbuffer[be])}r.bindRenderbuffer(r.RENDERBUFFER,null),O.depthBuffer&&(j.__webglDepthRenderbuffer=r.createRenderbuffer(),Me(j.__webglDepthRenderbuffer,O,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(he){t.bindTexture(r.TEXTURE_CUBE_MAP,ae.__webglTexture),Re(r.TEXTURE_CUBE_MAP,P);for(let be=0;be<6;be++)if(P.mipmaps&&P.mipmaps.length>0)for(let ke=0;ke<P.mipmaps.length;ke++)Le(j.__webglFramebuffer[be][ke],O,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+be,ke);else Le(j.__webglFramebuffer[be],O,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+be,0);x(P)&&_(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ye){for(let be=0,ke=me.length;be<ke;be++){const St=me[be],xe=n.get(St);t.bindTexture(r.TEXTURE_2D,xe.__webglTexture),Re(r.TEXTURE_2D,St),Le(j.__webglFramebuffer,O,St,r.COLOR_ATTACHMENT0+be,r.TEXTURE_2D,0),x(St)&&_(r.TEXTURE_2D)}t.unbindTexture()}else{let be=r.TEXTURE_2D;if((O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(be=O.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(be,ae.__webglTexture),Re(be,P),P.mipmaps&&P.mipmaps.length>0)for(let ke=0;ke<P.mipmaps.length;ke++)Le(j.__webglFramebuffer[ke],O,P,r.COLOR_ATTACHMENT0,be,ke);else Le(j.__webglFramebuffer,O,P,r.COLOR_ATTACHMENT0,be,0);x(P)&&_(be),t.unbindTexture()}O.depthBuffer&&lt(O)}function pe(O){const P=O.textures;for(let j=0,ae=P.length;j<ae;j++){const me=P[j];if(x(me)){const he=w(O),Ye=n.get(me).__webglTexture;t.bindTexture(he,Ye),_(he),t.unbindTexture()}}}const ge=[],z=[];function Ke(O){if(O.samples>0){if(ze(O)===!1){const P=O.textures,j=O.width,ae=O.height;let me=r.COLOR_BUFFER_BIT;const he=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ye=n.get(O),be=P.length>1;if(be)for(let ke=0;ke<P.length;ke++)t.bindFramebuffer(r.FRAMEBUFFER,Ye.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ke,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Ye.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+ke,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Ye.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ye.__webglFramebuffer);for(let ke=0;ke<P.length;ke++){if(O.resolveDepthBuffer&&(O.depthBuffer&&(me|=r.DEPTH_BUFFER_BIT),O.stencilBuffer&&O.resolveStencilBuffer&&(me|=r.STENCIL_BUFFER_BIT)),be){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ye.__webglColorRenderbuffer[ke]);const St=n.get(P[ke]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,St,0)}r.blitFramebuffer(0,0,j,ae,0,0,j,ae,me,r.NEAREST),u===!0&&(ge.length=0,z.length=0,ge.push(r.COLOR_ATTACHMENT0+ke),O.depthBuffer&&O.resolveDepthBuffer===!1&&(ge.push(he),z.push(he),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,z)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,ge))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),be)for(let ke=0;ke<P.length;ke++){t.bindFramebuffer(r.FRAMEBUFFER,Ye.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ke,r.RENDERBUFFER,Ye.__webglColorRenderbuffer[ke]);const St=n.get(P[ke]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Ye.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+ke,r.TEXTURE_2D,St,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ye.__webglMultisampledFramebuffer)}else if(O.depthBuffer&&O.resolveDepthBuffer===!1&&u){const P=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[P])}}}function ye(O){return Math.min(i.maxSamples,O.samples)}function ze(O){const P=n.get(O);return O.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&P.__useRenderToTexture!==!1}function Te(O){const P=a.render.frame;f.get(O)!==P&&(f.set(O,P),O.update())}function it(O,P){const j=O.colorSpace,ae=O.format,me=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||j!==Ns&&j!==fr&&(Pt.getTransfer(j)===Ft?(ae!==Dn||me!==Ai)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",j)),P}function De(O){return typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement?(h.width=O.naturalWidth||O.width,h.height=O.naturalHeight||O.height):typeof VideoFrame<"u"&&O instanceof VideoFrame?(h.width=O.displayWidth,h.height=O.displayHeight):(h.width=O.width,h.height=O.height),h}this.allocateTextureUnit=q,this.resetTextureUnits=Z,this.setTexture2D=ce,this.setTexture2DArray=Q,this.setTexture3D=ve,this.setTextureCube=V,this.rebindTextures=tt,this.setupRenderTarget=ft,this.updateRenderTargetMipmap=pe,this.updateMultisampleRenderTarget=Ke,this.setupDepthRenderbuffer=lt,this.setupFrameBufferTexture=Le,this.useMultisampledRTT=ze}function V_(r,e){function t(n,i=fr){let s;const a=Pt.getTransfer(i);if(n===Ai)return r.UNSIGNED_BYTE;if(n===ih)return r.UNSIGNED_SHORT_4_4_4_4;if(n===rh)return r.UNSIGNED_SHORT_5_5_5_1;if(n===lp)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===op)return r.BYTE;if(n===ap)return r.SHORT;if(n===Lo)return r.UNSIGNED_SHORT;if(n===nh)return r.INT;if(n===yr)return r.UNSIGNED_INT;if(n===Kn)return r.FLOAT;if(n===zo)return r.HALF_FLOAT;if(n===cp)return r.ALPHA;if(n===up)return r.RGB;if(n===Dn)return r.RGBA;if(n===hp)return r.LUMINANCE;if(n===fp)return r.LUMINANCE_ALPHA;if(n===bs)return r.DEPTH_COMPONENT;if(n===Ds)return r.DEPTH_STENCIL;if(n===sh)return r.RED;if(n===el)return r.RED_INTEGER;if(n===dp)return r.RG;if(n===oh)return r.RG_INTEGER;if(n===ah)return r.RGBA_INTEGER;if(n===Aa||n===Ca||n===Ra||n===Pa)if(a===Ft)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Aa)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ca)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ra)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Pa)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Aa)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ca)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ra)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Pa)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===xu||n===Su||n===Mu||n===Eu)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===xu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Su)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Mu)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Eu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===wu||n===Tu||n===bu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===wu||n===Tu)return a===Ft?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===bu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Au||n===Cu||n===Ru||n===Pu||n===Iu||n===Lu||n===Du||n===Uu||n===Nu||n===Ou||n===Fu||n===Bu||n===zu||n===ku)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Au)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Cu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ru)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Pu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Iu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Lu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Du)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Uu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Nu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ou)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Fu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Bu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===zu)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ku)return a===Ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ia||n===Vu||n===Hu)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ia)return a===Ft?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Vu)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Hu)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===pp||n===Gu||n===Wu||n===Xu)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ia)return s.COMPRESSED_RED_RGT
vendor: 4,172 bytes, lines 3820-3844
3820C1_EXT;if(n===Gu)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Wu)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Xu)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ls?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}class H_ extends tn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ao extends Dt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Mb={type:"move"};class hd{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ao,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 Ao,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ao,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const c=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const M of e.hand.values()){const x=t.getJointPose(M,n),_=this._getHandJoint(h,M);x!==null&&(_.matrix.fromArray(x.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=x.radius),_.visible=x!==null}const f=h.joints["index-finger-tip"],p=h.joints["thumb-tip"],m=f.position.distanceTo(p.position),g=.02,y=.005;h.inputState.pinching&&m>g+y?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&m<=g-y&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(Mb)))}return c!==null&&(c.visible=i!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Ao;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Eb=`
3821void main() {
3822
3823	gl_Position = vec4( position, 1.0 );
3824
3825}`,wb=`
3826uniform sampler2DArray depthColor;
3827uniform float depthWidth;
3828uniform float depthHeight;
3829
3830void main() {
3831
3832	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
3833
3834	if ( coord.x >= 1.0 ) {
3835
3836		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
3837
3838	} else {
3839
3840		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
3841
3842	}
3843
3844}`;
vendor: 5,255 bytes, line 3844
3844class Tb{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new Kt,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new _i({vertexShader:Eb,fragmentShader:wb,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new nn(new ko(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class bb extends Ji{constructor(e,t){super();const n=this;let i=null,s=1,a=null,c="local-floor",u=1,h=null,f=null,p=null,m=null,g=null,y=null;const M=new Tb,x=t.getContextAttributes();let _=null,w=null;const E=[],T=[],U=new ue;let R=null;const L=new tn;L.viewport=new bt;const F=new tn;F.viewport=new bt;const C=[L,F],A=new H_;let N=null,Z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(se){let _e=E[se];return _e===void 0&&(_e=new hd,E[se]=_e),_e.getTargetRaySpace()},this.getControllerGrip=function(se){let _e=E[se];return _e===void 0&&(_e=new hd,E[se]=_e),_e.getGripSpace()},this.getHand=function(se){let _e=E[se];return _e===void 0&&(_e=new hd,E[se]=_e),_e.getHandSpace()};function q(se){const _e=T.indexOf(se.inputSource);if(_e===-1)return;const Le=E[_e];Le!==void 0&&(Le.update(se.inputSource,se.frame,h||a),Le.dispatchEvent({type:se.type,data:se.inputSource}))}function K(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",K),i.removeEventListener("inputsourceschange",ce);for(let se=0;se<E.length;se++){const _e=T[se];_e!==null&&(T[se]=null,E[se].disconnect(_e))}N=null,Z=null,M.reset(),e.setRenderTarget(_),g=null,m=null,p=null,i=null,w=null,Xe.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(U.width,U.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(se){s=se,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(se){c=se,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||a},this.setReferenceSpace=function(se){h=se},this.getBaseLayer=function(){return m!==null?m:g},this.getBinding=function(){return p},this.getFrame=function(){return y},this.getSession=function(){return i},this.setSession=async function(se){if(i=se,i!==null){if(_=e.getRenderTarget(),i.addEventListener("select",q),i.addEventListener("selectstart",q),i.addEventListener("selectend",q),i.addEventListener("squeeze",q),i.addEventListener("squeezestart",q),i.addEventListener("squeezeend",q),i.addEventListener("end",K),i.addEventListener("inputsourceschange",ce),x.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(U),i.renderState.layers===void 0){const _e={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(i,t,_e),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),w=new Ci(g.framebufferWidth,g.framebufferHeight,{format:Dn,type:Ai,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil})}else{let _e=null,Le=null,Me=null;x.depth&&(Me=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,_e=x.stencil?Ds:bs,Le=x.stencil?Ls:yr);const et={colorFormat:t.RGBA8,depthFormat:Me,scaleFactor:s};p=new XRWebGLBinding(i,t),m=p.createProjectionLayer(et),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),w=new Ci(m.textureWidth,m.textureHeight,{format:Dn,type:Ai,depthTexture:new Mp(m.textureWidth,m.textureHeight,Le,void 0,void 0,void 0,void 0,void 0,void 0,_e),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(u),h=null,a=await i.requestReferenceSpace(c),Xe.setContext(i),Xe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return M.getDepthTexture()};function ce(se){for(let _e=0;_e<se.removed.length;_e++){const Le=se.removed[_e],Me=T.indexOf(Le);Me>=0&&(T[Me]=null,E[Me].disconnect(Le))}for(let _e=0;_e<se.added.length;_e++){const Le=se.added[_e];let Me=T.indexOf(Le);if(Me===-1){for(let lt=0;lt<E.length;lt++)if(lt>=T.length){T.push(Le),Me=lt;break}else if(T[lt]===null){T[lt]=Le,Me=lt;break}if(Me===-1)break}const et=E[Me];et&&et.connect(Le)}}const Q=new D,ve=new D;function V(se,_e,Le){Q.setFromMatrixPosition(_e.matrixWorld),ve.setFromMatrixPosition(Le.matrixWorld);const Me=Q.distanceTo(ve),et=_e.projectionMatrix.elements,lt=Le.projectionMatrix.elements,tt=et[14]/(et[10]-1),ft=et[14]/(et[10]+1),pe=(et[9]+1)/et[5],ge=(et[9]-1)/et[5],z=(et[8]-1)/et[0],Ke=(lt[8]+1)/lt[0],ye=tt*z,ze=tt*Ke,Te=
vendor: 28,193 bytes, line 3844
3844Me/(-z+Ke),it=Te*-z;if(_e.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(it),se.translateZ(Te),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert(),et[10]===-1)se.projectionMatrix.copy(_e.projectionMatrix),se.projectionMatrixInverse.copy(_e.projectionMatrixInverse);else{const De=tt+Te,O=ft+Te,P=ye-it,j=ze+(Me-it),ae=pe*ft/O*De,me=ge*ft/O*De;se.projectionMatrix.makePerspective(P,j,ae,me,De,O),se.projectionMatrixInverse.copy(se.projectionMatrix).invert()}}function re(se,_e){_e===null?se.matrixWorld.copy(se.matrix):se.matrixWorld.multiplyMatrices(_e.matrixWorld,se.matrix),se.matrixWorldInverse.copy(se.matrixWorld).invert()}this.updateCamera=function(se){if(i===null)return;let _e=se.near,Le=se.far;M.texture!==null&&(M.depthNear>0&&(_e=M.depthNear),M.depthFar>0&&(Le=M.depthFar)),A.near=F.near=L.near=_e,A.far=F.far=L.far=Le,(N!==A.near||Z!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),N=A.near,Z=A.far),L.layers.mask=se.layers.mask|2,F.layers.mask=se.layers.mask|4,A.layers.mask=L.layers.mask|F.layers.mask;const Me=se.parent,et=A.cameras;re(A,Me);for(let lt=0;lt<et.length;lt++)re(et[lt],Me);et.length===2?V(A,L,F):A.projectionMatrix.copy(L.projectionMatrix),ie(se,A,Me)};function ie(se,_e,Le){Le===null?se.matrix.copy(_e.matrixWorld):(se.matrix.copy(Le.matrixWorld),se.matrix.invert(),se.matrix.multiply(_e.matrixWorld)),se.matrix.decompose(se.position,se.quaternion,se.scale),se.updateMatrixWorld(!0),se.projectionMatrix.copy(_e.projectionMatrix),se.projectionMatrixInverse.copy(_e.projectionMatrixInverse),se.isPerspectiveCamera&&(se.fov=Do*2*Math.atan(1/se.projectionMatrix.elements[5]),se.zoom=1)}this.getCamera=function(){return A},this.getFoveation=function(){if(!(m===null&&g===null))return u},this.setFoveation=function(se){u=se,m!==null&&(m.fixedFoveation=se),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=se)},this.hasDepthSensing=function(){return M.texture!==null},this.getDepthSensingMesh=function(){return M.getMesh(A)};let de=null;function Re(se,_e){if(f=_e.getViewerPose(h||a),y=_e,f!==null){const Le=f.views;g!==null&&(e.setRenderTargetFramebuffer(w,g.framebuffer),e.setRenderTarget(w));let Me=!1;Le.length!==A.cameras.length&&(A.cameras.length=0,Me=!0);for(let lt=0;lt<Le.length;lt++){const tt=Le[lt];let ft=null;if(g!==null)ft=g.getViewport(tt);else{const ge=p.getViewSubImage(m,tt);ft=ge.viewport,lt===0&&(e.setRenderTargetTextures(w,ge.colorTexture,m.ignoreDepthValues?void 0:ge.depthStencilTexture),e.setRenderTarget(w))}let pe=C[lt];pe===void 0&&(pe=new tn,pe.layers.enable(lt),pe.viewport=new bt,C[lt]=pe),pe.matrix.fromArray(tt.transform.matrix),pe.matrix.decompose(pe.position,pe.quaternion,pe.scale),pe.projectionMatrix.fromArray(tt.projectionMatrix),pe.projectionMatrixInverse.copy(pe.projectionMatrix).invert(),pe.viewport.set(ft.x,ft.y,ft.width,ft.height),lt===0&&(A.matrix.copy(pe.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),Me===!0&&A.cameras.push(pe)}const et=i.enabledFeatures;if(et&&et.includes("depth-sensing")){const lt=p.getDepthInformation(Le[0]);lt&&lt.isValid&&lt.texture&&M.init(e,lt,i.renderState)}}for(let Le=0;Le<E.length;Le++){const Me=T[Le],et=E[Le];Me!==null&&et!==void 0&&et.update(Me,_e,h||a)}de&&de(se,_e),_e.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:_e}),y=null}const Xe=new O_;Xe.setAnimationLoop(Re),this.setAnimationLoop=function(se){de=se},this.dispose=function(){}}}const ls=new ai,Ab=new ut;function Cb(r,e){function t(x,_){x.matrixAutoUpdate===!0&&x.updateMatrix(),_.value.copy(x.matrix)}function n(x,_){_.color.getRGB(x.fogColor.value,D_(r)),_.isFog?(x.fogNear.value=_.near,x.fogFar.value=_.far):_.isFogExp2&&(x.fogDensity.value=_.density)}function i(x,_,w,E,T){_.isMeshBasicMaterial||_.isMeshLambertMaterial?s(x,_):_.isMeshToonMaterial?(s(x,_),p(x,_)):_.isMeshPhongMaterial?(s(x,_),f(x,_)):_.isMeshStandardMaterial?(s(x,_),m(x,_),_.isMeshPhysicalMaterial&&g(x,_,T)):_.isMeshMatcapMaterial?(s(x,_),y(x,_)):_.isMeshDepthMaterial?s(x,_):_.isMeshDistanceMaterial?(s(x,_),M(x,_)):_.isMeshNormalMaterial?s(x,_):_.isLineBasicMaterial?(a(x,_),_.isLineDashedMaterial&&c(x,_)):_.isPointsMaterial?u(x,_,w,E):_.isSpriteMaterial?h(x,_):_.isShadowMaterial?(x.color.value.copy(_.color),x.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function s(x,_){x.opacity.value=_.opacity,_.color&&x.diffuse.value.copy(_.color),_.emissive&&x.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(x.map.value=_.map,t(_.map,x.mapTransform)),_.alphaMap&&(x.alphaMap.value=_.alphaMap,t(_.alphaMap,x.alphaMapTransform)),_.bumpMap&&(x.bumpMap.value=_.bumpMap,t(_.bumpMap,x.bumpMapTransform),x.bumpScale.value=_.bumpScale,_.side===Hn&&(x.bumpScale.value*=-1)),_.normalMap&&(x.normalMap.value=_.normalMap,t(_.normalMap,x.normalMapTransform),x.normalScale.value.copy(_.normalScale),_.side===Hn&&x.normalScale.value.negate()),_.displacementMap&&(x.displacementMap.value=_.displacementMap,t(_.displacementMap,x.displacementMapTransform),x.displacementScale.value=_.displacementScale,x.displacementBias.value=_.displacementBias),_.emissiveMap&&(x.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,x.emissiveMapTransform)),_.specularMap&&(x.specularMap.value=_.specularMap,t(_.specularMap,x.specularMapTransform)),_.alphaTest>0&&(x.alphaTest.value=_.alphaTest);const w=e.get(_),E=w.envMap,T=w.envMapRotation;E&&(x.envMap.value=E,ls.copy(T),ls.x*=-1,ls.y*=-1,ls.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(ls.y*=-1,ls.z*=-1),x.envMapRotation.value.setFromMatrix4(Ab.makeRotationFromEuler(ls)),x.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=_.reflectivity,x.ior.value=_.ior,x.refractionRatio.value=_.refractionRatio),_.lightMap&&(x.lightMap.value=_.lightMap,x.lightMapIntensity.value=_.lightMapIntensity,t(_.lightMap,x.lightMapTransform)),_.aoMap&&(x.aoMap.value=_.aoMap,x.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,x.aoMapTransform))}function a(x,_){x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,_.map&&(x.map.value=_.map,t(_.map,x.mapTransform))}function c(x,_){x.dashSize.value=_.dashSize,x.totalSize.value=_.dashSize+_.gapSize,x.scale.value=_.scale}function u(x,_,w,E){x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,x.size.value=_.size*w,x.scale.value=E*.5,_.map&&(x.map.value=_.map,t(_.map,x.uvTransform)),_.alphaMap&&(x.alphaMap.value=_.alphaMap,t(_.alphaMap,x.alphaMapTransform)),_.alphaTest>0&&(x.alphaTest.value=_.alphaTest)}function h(x,_){x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,x.rotation.value=_.rotation,_.map&&(x.map.value=_.map,t(_.map,x.mapTransform)),_.alphaMap&&(x.alphaMap.value=_.alphaMap,t(_.alphaMap,x.alphaMapTransform)),_.alphaTest>0&&(x.alphaTest.value=_.alphaTest)}function f(x,_){x.specular.value.copy(_.specular),x.shininess.value=Math.max(_.shininess,1e-4)}function p(x,_){_.gradientMap&&(x.gradientMap.value=_.gradientMap)}function m(x,_){x.metalness.value=_.metalness,_.metalnessMap&&(x.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,x.metalnessMapTransform)),x.roughness.value=_.roughness,_.roughnessMap&&(x.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,x.roughnessMapTransform)),_.envMap&&(x.envMapIntensity.value=_.envMapIntensity)}function g(x,_,w){x.ior.value=_.ior,_.sheen>0&&(x.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),x.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(x.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,x.sheenColorMapTransform)),_.sheenRoughnessMap&&(x.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,x.sheenRoughnessMapTransform))),_.clearcoat>0&&(x.clearcoat.value=_.clearcoat,x.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(x.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,x.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(x.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===Hn&&x.clearcoatNormalScale.value.negate())),_.dispersion>0&&(x.dispersion.value=_.dispersion),_.iridescence>0&&(x.iridescence.value=_.iridescence,x.iridescenceIOR.value=_.iridescenceIOR,x.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(x.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,x.iridescenceMapTransform)),_.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),_.transmission>0&&(x.transmission.value=_.transmission,x.transmissionSamplerMap.value=w.texture,x.transmissionSamplerSize.value.set(w.width,w.height),_.transmissionMap&&(x.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,x.transmissionMapTransform)),x.thickness.value=_.thickness,_.thicknessMap&&(x.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=_.attenuationDistance,x.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(x.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(x.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=_.specularIntensity,x.specularColor.value.copy(_.specularColor),_.specularColorMap&&(x.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,x.specularColorMapTransform)),_.specularIntensityMap&&(x.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,x.specularIntensityMapTransform))}function y(x,_){_.matcap&&(x.matcap.value=_.matcap)}function M(x,_){const w=e.get(_).light;x.referencePosition.value.setFromMatrixPosition(w.matrixWorld),x.nearDistance.value=w.shadow.camera.near,x.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Rb(r,e,t,n){let i={},s={},a=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function u(w,E){const T=E.program;n.uniformBlockBinding(w,T)}function h(w,E){let T=i[w.id];T===void 0&&(y(w),T=f(w),i[w.id]=T,w.addEventListener("dispose",x));const U=E.program;n.updateUBOMapping(w,U);const R=e.render.frame;s[w.id]!==R&&(m(w),s[w.id]=R)}function f(w){const E=p();w.__bindingPointIndex=E;const T=r.createBuffer(),U=w.__size,R=w.usage;return r.bindBuffer(r.UNIFORM_BUFFER,T),r.bufferData(r.UNIFORM_BUFFER,U,R),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,E,T),T}function p(){for(let w=0;w<c;w++)if(a.indexOf(w)===-1)return a.push(w),w;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(w){const E=i[w.id],T=w.uniforms,U=w.__cache;r.bindBuffer(r.UNIFORM_BUFFER,E);for(let R=0,L=T.length;R<L;R++){const F=Array.isArray(T[R])?T[R]:[T[R]];for(let C=0,A=F.length;C<A;C++){const N=F[C];if(g(N,R,C,U)===!0){const Z=N.__offset,q=Array.isArray(N.value)?N.value:[N.value];let K=0;for(let ce=0;ce<q.length;ce++){const Q=q[ce],ve=M(Q);typeof Q=="number"||typeof Q=="boolean"?(N.__data[0]=Q,r.bufferSubData(r.UNIFORM_BUFFER,Z+K,N.__data)):Q.isMatrix3?(N.__data[0]=Q.elements[0],N.__data[1]=Q.elements[1],N.__data[2]=Q.elements[2],N.__data[3]=0,N.__data[4]=Q.elements[3],N.__data[5]=Q.elements[4],N.__data[6]=Q.elements[5],N.__data[7]=0,N.__data[8]=Q.elements[6],N.__data[9]=Q.elements[7],N.__data[10]=Q.elements[8],N.__data[11]=0):(Q.toArray(N.__data,K),K+=ve.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,Z,N.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function g(w,E,T,U){const R=w.value,L=E+"_"+T;if(U[L]===void 0)return typeof R=="number"||typeof R=="boolean"?U[L]=R:U[L]=R.clone(),!0;{const F=U[L];if(typeof R=="number"||typeof R=="boolean"){if(F!==R)return U[L]=R,!0}else if(F.equals(R)===!1)return F.copy(R),!0}return!1}function y(w){const E=w.uniforms;let T=0;const U=16;for(let L=0,F=E.length;L<F;L++){const C=Array.isArray(E[L])?E[L]:[E[L]];for(let A=0,N=C.length;A<N;A++){const Z=C[A],q=Array.isArray(Z.value)?Z.value:[Z.value];for(let K=0,ce=q.length;K<ce;K++){const Q=q[K],ve=M(Q),V=T%U,re=V%ve.boundary,ie=V+re;T+=re,ie!==0&&U-ie<ve.storage&&(T+=U-ie),Z.__data=new Float32Array(ve.storage/Float32Array.BYTES_PER_ELEMENT),Z.__offset=T,T+=ve.storage}}}const R=T%U;return R>0&&(T+=U-R),w.__size=T,w.__cache={},this}function M(w){const E={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(E.boundary=4,E.storage=4):w.isVector2?(E.boundary=8,E.storage=8):w.isVector3||w.isColor?(E.boundary=16,E.storage=12):w.isVector4?(E.boundary=16,E.storage=16):w.isMatrix3?(E.boundary=48,E.storage=48):w.isMatrix4?(E.boundary=64,E.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),E}function x(w){const E=w.target;E.removeEventListener("dispose",x);const T=a.indexOf(E.__bindingPointIndex);a.splice(T,1),r.deleteBuffer(i[E.id]),delete i[E.id],delete s[E.id]}function _(){for(const w in i)r.deleteBuffer(i[w]);a=[],i={},s={}}return{bind:u,update:h,dispose:_}}class G_{constructor(e={}){const{canvas:t=R_(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:p=!1,reverseDepthBuffer:m=!1}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;const y=new Uint32Array(4),M=new Int32Array(4);let x=null,_=null;const w=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=jn,this.toneMapping=qi,this.toneMappingExposure=1;const T=this;let U=!1,R=0,L=0,F=null,C=-1,A=null;const N=new bt,Z=new bt;let q=null;const K=new Ve(0);let ce=0,Q=t.width,ve=t.height,V=1,re=null,ie=null;const de=new bt(0,0,Q,ve),Re=new bt(0,0,Q,ve);let Xe=!1;const se=new rl;let _e=!1,Le=!1;const Me=new ut,et=new ut,lt=new D,tt=new bt,ft={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let pe=!1;function ge(){return F===null?V:1}let z=n;function Ke(I,W){return t.getContext(I,W)}try{const I={alpha:!0,depth:i,stencil:s,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:f,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Qa}`),t.addEventListener("webglcontextlost",fe,!1),t.addEventListener("webglcontextrestored",Fe,!1),t.addEventListener("webglcontextcreationerror",Pe,!1),z===null){const W="webgl2";if(z=Ke(W,I),z===null)throw Ke(W)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(I){throw console.error("THREE.WebGLRenderer: "+I.message),I}let ye,ze,Te,it,De,O,P,j,ae,me,he,Ye,be,ke,St,xe,Ge,rt,ct,He,H,le,Ie,k;function Se(){ye=new Nw(z),ye.init(),le=new V_(z,ye),ze=new Rw(z,ye,e,le),Te=new mb(z,ye),ze.reverseDepthBuffer&&m&&Te.buffers.depth.setReversed(!0),it=new Bw(z),De=new nb,O=new Sb(z,ye,Te,De,ze,le,it),P=new Iw(T),j=new Uw(T),ae=new XM(z),Ie=new Aw(z,ae),me=new Ow(z,ae,it,Ie),he=new kw(z,me,ae,it),ct=new zw(z,ze,O),xe=new Pw(De),Ye=new tb(T,P,j,ye,ze,Ie,xe),be=new Cb(T,De),ke=new rb,St=new ub(ye),rt=new bw(T,P,j,Te,he,g,u),Ge=new db(T,he,ze),k=new Rb(z,it,ze,Te),He=new Cw(z,ye,it),H=new Fw(z,ye,it),it.programs=Ye.programs,T.capabilities=ze,T.extensions=ye,T.properties=De,T.renderLists=ke,T.shadowMap=Ge,T.state=Te,T.info=it}Se();const te=new bb(T,z);this.xr=te,this.getContext=function(){return z},this.getContextAttributes=function(){return z.getContextAttributes()},this.forceContextLoss=function(){const I=ye.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=ye.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(I){I!==void 0&&(V=I,this.setSize(Q,ve,!1))},this.getSize=function(I){return I.set(Q,ve)},this.setSize=function(I,W,$=!0){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Q=I,ve=W,t.width=Math.floor(I*V),t.height=Math.floor(W*V),$===!0&&(t.style.width=I+"px",t.style.height=W+"px"),this.setViewport(0,0,I,W)},this.getDrawingBufferSize=function(I){return I.set(Q*V,ve*V).floor()},this.setDrawingBufferSize=function(I,W,$){Q=I,ve=W,V=$,t.width=Math.floor(I*$),t.height=Math.floor(W*$),this.setViewport(0,0,I,W)},this.getCurrentViewport=function(I){return I.copy(N)},this.getViewport=function(I){return I.copy(de)},this.setViewport=function(I,W,$,ee){I.isVector4?de.set(I.x,I.y,I.z,I.w):de.set(I,W,$,ee),Te.viewport(N.copy(de).multiplyScalar(V).round())},this.getScissor=function(I){return I.copy(Re)},this.setScissor=function(I,W,$,ee){I.isVector4?Re.set(I.x,I.y,I.z,I.w):Re.set(I,W,$,ee),Te.scissor(Z.copy(Re).multiplyScalar(V).round())},this.getScissorTest=function(){return Xe},this.setScissorTest=function(I){Te.setScissorTest(Xe=I)},this.setOpaqueSort=function(I){re=I},this.setTransparentSort=function(I){ie=I},this.getClearColor=function(I){return I.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor.apply(rt,arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha.apply(rt,arguments)},this.clear=function(I=!0,W=!0,$=!0){let ee=0;if(I){let Y=!1;if(F!==null){const we=F.texture.format;Y=we===ah||we===oh||we===el}if(Y){const we=F.texture.type,Ue=we===Ai||we===yr||we===Lo||we===Ls||we===ih||we===rh,qe=rt.getClearColor(),je=rt.getClearAlpha(),ht=qe.r,dt=qe.g,Je=qe.b;Ue?(y[0]=ht,y[1]=dt,y[2]=Je,y[3]=je,z.clearBufferuiv(z.COLOR,0,y)):(M[0]=ht,M[1]=dt,M[2]=Je,M[3]=je,z.clearBufferiv(z.COLOR,0,M))}else ee|=z.COLOR_BUFFER_BIT}W&&(ee|=z.DEPTH_BUFFER_BIT),$&&(ee|=z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),z.clear(ee)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",fe,!1),t.removeEventListener("webglcontextrestored",Fe,!1),t.removeEventListener("webglcontextcreationerror",Pe,!1),ke.dispose(),St.dispose(),De.dispose(),P.dispose(),j.dispose(),he.dispose(),Ie.dispose(),k.dispose(),Ye.dispose(),te.dispose(),te.removeEventListener("sessionstart",hl),te.removeEventListener("sessionend",fl),Ii.stop()};function fe(I){I.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),U=!0}function Fe(){console.log("THREE.WebGLRenderer: Context Restored."),U=!1;const I=it.autoReset,W=Ge.enabled,$=Ge.autoUpdate,ee=Ge.needsUpdate,Y=Ge.type;Se(),it.autoReset=I,Ge.enabled=W,Ge.autoUpdate=$,Ge.needsUpdate=ee,Ge.type=Y}function Pe(I){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function nt(I){const W=I.target;W.removeEventListener("dispose",nt),It(W)}function It(I){Vt(I),De.remove(I)}function Vt(I){const W=De.get(I).programs;W!==void 0&&(W.forEach(function($){Ye.releaseProgram($)}),I.isShaderMaterial&&Ye.releaseShaderCache(I))}this.renderBufferDirect=function(I,W,$,ee,Y,we){W===null&&(W=ft);const Ue=Y.isMesh&&Y.matrixWorld.determinant()<0,qe=Ih(I,W,$,ee,Y);Te.setMaterial(ee,Ue);let je=$.index,ht=1;if(ee.wireframe===!0){if(je=me.getWireframeAttribute($),je===void 0)return;ht=2}const dt=$.drawRange,Je=$.attributes.position;let Et=dt.start*ht,Rt=(dt.start+dt.count)*ht;we!==null&&(Et=Math.max(Et,we.start*ht),Rt=Math.min(Rt,(we.start+we.count)*ht)),je!==null?(Et=Math.max(Et,0),Rt=Math.min(Rt,je.count)):Je!=null&&(Et=Math.max(Et,0),Rt=Math.min(Rt,Je.count));const at=Rt-Et;if(at<0||at===1/0)return;Ie.setup(Y,ee,qe,$,je);let _t,wt=He;if(je!==null&&(_t=ae.get(je),wt=H,wt.setIndex(_t)),Y.isMesh)ee.wireframe===!0?(Te.setLineWidth(ee.wireframeLinewidth*ge()),wt.setMode(z.LINES)):wt.setMode(z.TRIANGLES);else if(Y.isLine){let Oe=ee.linewidth;Oe===void 0&&(Oe=1),Te.setLineWidth(Oe*ge()),Y.isLineSegments?wt.setMode(z.LINES):Y.isLineLoop?wt.setMode(z.LINE_LOOP):wt.setMode(z.LINE_STRIP)}else Y.isPoints?wt.setMode(z.POINTS):Y.isSprite&&wt.setMode(z.TRIANGLES);if(Y.isBatchedMesh)if(Y._multiDrawInstances!==null)wt.renderMultiDrawInstances(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount,Y._multiDrawInstances);else if(ye.get("WEBGL_multi_draw"))wt.renderMultiDraw(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount);else{const Oe=Y._multiDrawStarts,Gt=Y._multiDrawCounts,Ct=Y._multiDrawCount,fn=je?ae.get(je).bytesPerElement:1,Qt=De.get(ee).currentProgram.getUniforms();for(let dn=0;dn<Ct;dn++)Qt.setValue(z,"_gl_DrawID",dn),wt.render(Oe[dn]/fn,Gt[dn])}else if(Y.isInstancedMesh)wt.renderInstances(Et,at,Y.count);else if($.isInstancedBufferGeometry){const Oe=$._maxInstanceCount!==void 0?$._maxInstanceCount:1/0,Gt=Math.min($.instanceCount,Oe);wt.renderInstances(Et,at,Gt)}else wt.render(Et,at)};function At(I,W,$){I.transparent===!0&&I.side===Gi&&I.forceSinglePass===!1?(I.side=Hn,I.needsUpdate=!0,Hs(I,W,$),I.side=vr,I.needsUpdate=!0,Hs(I,W,$),I.side=Gi):Hs(I,W,$)}this.compile=function(I,W,$=null){$===null&&($=I),_=St.get($),_.init(W),E.push(_),$.traverseVisible(function(Y){Y.isLight&&Y.layers.test(W.layers)&&(_.pushLight(Y),Y.castShadow&&_.pushShadow(Y))}),I!==$&&I.traverseVisible(function(Y){Y.isLight&&Y.layers.test(W.layers)&&(_.pushLight(Y),Y.castShadow&&_.pushShadow(Y))}),_.setupLights();const ee=new Set;return I.traverse(function(Y){if(!(Y.isMesh||Y.isPoints||Y.isLine||Y.isSprite))return;const we=Y.material;if(we)if(Array.isArray(we))for(let Ue=0;Ue<we.length;Ue++){const qe=we[Ue];At(qe,$,Y),ee.add(qe)}else At(we,$,Y),ee.add(we)}),E.pop(),_=null,ee},this.compileAsync=function(I,W,$=null){const ee=this.compile(I,W,$);return new Promise(Y=>{function we(){if(ee.forEach(function(Ue){De.get(Ue).currentProgram.isReady()&&ee.delete(Ue)}),ee.size===0){Y(I);return}setTimeout(we,10)}ye.get("KHR_parallel_shader_compile")!==null?we():setTimeout(we,10)})};let rn=null;function Tn(I){rn&&rn(I)}function hl(){Ii.stop()}function fl(){Ii.start()}const Ii=new O_;Ii.setAnimationLoop(Tn),typeof self<"u"&&Ii.setContext(self),this.setAnimationLoop=function(I){rn=I,te.setAnimationLoop(I),I===null?Ii.stop():Ii.start()},te.addEventListener("sessionstart",hl),te.addEventListener("sessionend",fl),this.render=function(I,W){if(W!==void 0&&W.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(U===!0)return;if(I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(W),W=te.getCamera()),I.isScene===!0&&I.onBeforeRender(T,I,W,F),_=St.get(I,E.length),_.init(W),E.push(_),et.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),se.setFromProjectionMatrix(et),Le=this.localClippingEnabled,_e=xe.init(this.clippingPlanes,Le),x=ke.get(I,w.length),x.init(),w.push(x),te.enabled===!0&&te.isPresenting===!0){const we=T.xr.getDepthSensingMesh();we!==null&&qr(we,W,-1/0,T.sortObjects)}qr(I,W,0,T.sortObjects),x.finish(),T.sortObjects===!0&&x.sort(re,ie),pe=te.enabled===!1||te.isPresenting===!1||te.hasDepthSensing()===!1,pe&&rt.addToRenderList(x,I),this.info.render.frame++,_e===!0&&xe.beginShadows();const $=_.state.shadowsArray;Ge.render($,I,W),_e===!0&&xe.endShadows(),this.info.autoReset===!0&&this.info.reset();const ee=x.opaque,Y=x.transmissive;if(_.setupLights(),W.isArrayCamera){const we=W.cameras;if(Y.length>0)for(let Ue=0,qe=we.length;Ue<qe;Ue++){const je=we[Ue];Sr(ee,Y,I,je)}pe&&rt.render(I);for(let Ue=0,qe=we.length;Ue<qe;Ue++){const je=we[Ue];dl(x,I,je,je.viewport)}}else Y.length>0&&Sr(ee,Y,I,W),pe&&rt.render(I),dl(x,I,W);F!==null&&(O.updateMultisampleRenderTarget(F),O.updateRenderTargetMipmap(F)),I.isScene===!0&&I.onAfterRender(T,I,W),Ie.resetDefaultState(),C=-1,A=null,E.pop(),E.length>0?(_=E[E.length-1],_e===!0&&xe.setGlobalState(T.clippingPlanes,_.state.camera)):_=null,w.pop(),w.length>0?x=w[w.length-1]:x=null};function qr(I,W,$,ee){if(I.visible===!1)return;if(I.layers.test(W.layers)){if(I.isGroup)$=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(W);else if(I.isLight)_.pushLight(I),I.castShadow&&_.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||se.intersectsSprite(I)){ee&&tt.setFromMatrixPosition(I.matrixWorld).applyMatrix4(et);const Ue=he.update(I),qe=I.material;qe.visible&&x.push(I,Ue,qe,$,tt.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(!I.frustumCulled||se.intersectsObject(I))){const Ue=he.update(I),qe=I.material;if(ee&&(I.boundingSphere!==void 0?(I.boundingSphere===null&&I.computeBoundingSphere(),tt.copy(I.boundingSphere.center)):(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),tt.copy(Ue.boundingSphere.center)),tt.applyMatrix4(I.matrixWorld).applyMatrix4(et)),Array.isArray(qe)){const je=Ue.groups;for(let ht=0,dt=je.length;ht<dt;ht++){const Je=je[ht],Et=qe[Je.materialIndex];Et&&Et.visible&&x.push(I,Ue,Et,$,tt.z,Je)}}else qe.visible&&x.push(I,Ue,qe,$,tt.z,null)}}const we=I.children;for(let Ue=0,qe=we.length;Ue<qe;Ue++)qr(we[Ue],W,$,ee)}function dl(I,W,$,ee){const Y=I.opaque,we=I.transmissive,Ue=I.transparent;_.setupLightsView($),_e===!0&&xe.setGlobalState(T.clippingPlanes,$),ee&&Te.viewport(N.copy(ee)),Y.length>0&&Vs(Y,W,$),we.length>0&&Vs(we,W,$),Ue.length>0&&Vs(Ue,W,$),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function Sr(I,W,$,ee){if(($.isScene===!0?$.overrideMaterial:null)!==null)return;_.state.transmissionRenderTarget[ee.id]===void 0&&(_.state.transmissionRenderTarget[ee.id]=new Ci(1,1,{generateMipmaps:!0,type:ye.has("EXT_color_buffer_half_float")||ye.has("EXT_color_buffer_float")?zo:Ai,minFilter:Xi,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Pt.workingColorSpace}));const we=_.state.transmissionRenderTarget[ee.id],Ue=ee.viewport||N;we.setSize(Ue.z,Ue.w);const qe=T.getRenderTarget();T.setRenderTarget(we),T.getClearColor(K),ce=T.getClearAlpha(),ce<1&&T.setClearColor(16777215,.5),T.clear(),pe&&rt.render($);const je=T.toneMapping;T.toneMapping=qi;const ht=ee.viewport;if(ee.viewport!==void 0&&(ee.viewport=void 0),_.setupLightsView(ee),_e===!0&&xe.setGlobalState(T.clippingPlanes,ee),Vs(I,$,ee),O.updateMultisampleRenderTarget(we),O.updateRenderTargetMipmap(we),ye.has("WEBGL_multisampled_render_to_texture")===!1){let dt=!1;for(let Je=0,Et=W.length;Je<Et;Je++){const Rt=W[Je],at=Rt.object,_t=Rt.geometry,wt=Rt.material,Oe=Rt.group;if(wt.side===Gi&&at.layers.test(ee.layers)){const Gt=wt.side;wt.side=Hn,wt.needsUpdate=!0,pl(at,$,ee,_t,wt,Oe),wt.side=Gt,wt.needsUpdate=!0,dt=!0}}dt===!0&&(O.updateMultisampleRenderTarget(we),O.updateRenderTargetMipmap(we))}T.setRenderTarget(qe),T.setClearColor(K,ce),ht!==void 0&&(ee.viewport=ht),T.toneMapping=je}function Vs(I,W,$){const ee=W.isScene===!0?W.overrideMaterial:null;for(let Y=0,we=I.length;Y<we;Y++){const Ue=I[Y],qe=Ue.object,je=Ue.geometry,ht=ee===null?Ue.material:ee,dt=Ue.group;qe.layers.test($.layers)&&pl(qe,W,$,je,ht,dt)}}function pl(I,W,$,ee,Y,we){I.onBeforeRender(T,W,$,ee,Y,we),I.modelViewMatrix.multiplyMatrices($.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),Y.onBeforeRender(T,W,$,ee,I,we),Y.transparent===!0&&Y.side===Gi&&Y.forceSinglePass===!1?(Y.side=Hn,Y.needsUpdate=!0,T.renderBufferDirect($,W,ee,Y,I,we),Y.side=vr,Y.needsUpdate=!0,T.renderBufferDirect($,W,ee,Y,I,we),Y.side=Gi):T.renderBufferDirect($,W,ee,Y,I,we),I.onAfterRender(T,W,$,ee,Y,we)}function Hs(I,W,$){W.isScene!==!0&&(W=ft);const ee=De.get(I),Y=_.state.lights,we=_.state.shadowsArray,Ue=Y.state.ver
vendor: 4,502 bytes, line 3844
3844sion,qe=Ye.getParameters(I,Y.state,we,W,$),je=Ye.getProgramCacheKey(qe);let ht=ee.programs;ee.environment=I.isMeshStandardMaterial?W.environment:null,ee.fog=W.fog,ee.envMap=(I.isMeshStandardMaterial?j:P).get(I.envMap||ee.environment),ee.envMapRotation=ee.environment!==null&&I.envMap===null?W.environmentRotation:I.envMapRotation,ht===void 0&&(I.addEventListener("dispose",nt),ht=new Map,ee.programs=ht);let dt=ht.get(je);if(dt!==void 0){if(ee.currentProgram===dt&&ee.lightsStateVersion===Ue)return gl(I,qe),dt}else qe.uniforms=Ye.getUniforms(I),I.onBeforeCompile(qe,T),dt=Ye.acquireProgram(qe,je),ht.set(je,dt),ee.uniforms=qe.uniforms;const Je=ee.uniforms;return(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(Je.clippingPlanes=xe.uniform),gl(I,qe),ee.needsLights=vl(I),ee.lightsStateVersion=Ue,ee.needsLights&&(Je.ambientLightColor.value=Y.state.ambient,Je.lightProbe.value=Y.state.probe,Je.directionalLights.value=Y.state.directional,Je.directionalLightShadows.value=Y.state.directionalShadow,Je.spotLights.value=Y.state.spot,Je.spotLightShadows.value=Y.state.spotShadow,Je.rectAreaLights.value=Y.state.rectArea,Je.ltc_1.value=Y.state.rectAreaLTC1,Je.ltc_2.value=Y.state.rectAreaLTC2,Je.pointLights.value=Y.state.point,Je.pointLightShadows.value=Y.state.pointShadow,Je.hemisphereLights.value=Y.state.hemi,Je.directionalShadowMap.value=Y.state.directionalShadowMap,Je.directionalShadowMatrix.value=Y.state.directionalShadowMatrix,Je.spotShadowMap.value=Y.state.spotShadowMap,Je.spotLightMatrix.value=Y.state.spotLightMatrix,Je.spotLightMap.value=Y.state.spotLightMap,Je.pointShadowMap.value=Y.state.pointShadowMap,Je.pointShadowMatrix.value=Y.state.pointShadowMatrix),ee.currentProgram=dt,ee.uniformsList=null,dt}function ml(I){if(I.uniformsList===null){const W=I.currentProgram.getUniforms();I.uniformsList=cu.seqWithValue(W.seq,I.uniforms)}return I.uniformsList}function gl(I,W){const $=De.get(I);$.outputColorSpace=W.outputColorSpace,$.batching=W.batching,$.batchingColor=W.batchingColor,$.instancing=W.instancing,$.instancingColor=W.instancingColor,$.instancingMorph=W.instancingMorph,$.skinning=W.skinning,$.morphTargets=W.morphTargets,$.morphNormals=W.morphNormals,$.morphColors=W.morphColors,$.morphTargetsCount=W.morphTargetsCount,$.numClippingPlanes=W.numClippingPlanes,$.numIntersection=W.numClipIntersection,$.vertexAlphas=W.vertexAlphas,$.vertexTangents=W.vertexTangents,$.toneMapping=W.toneMapping}function Ih(I,W,$,ee,Y){W.isScene!==!0&&(W=ft),O.resetTextureUnits();const we=W.fog,Ue=ee.isMeshStandardMaterial?W.environment:null,qe=F===null?T.outputColorSpace:F.isXRRenderTarget===!0?F.texture.colorSpace:Ns,je=(ee.isMeshStandardMaterial?j:P).get(ee.envMap||Ue),ht=ee.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,dt=!!$.attributes.tangent&&(!!ee.normalMap||ee.anisotropy>0),Je=!!$.morphAttributes.position,Et=!!$.morphAttributes.normal,Rt=!!$.morphAttributes.color;let at=qi;ee.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(at=T.toneMapping);const _t=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,wt=_t!==void 0?_t.length:0,Oe=De.get(ee),Gt=_.state.lights;if(_e===!0&&(Le===!0||I!==A)){const Wt=I===A&&ee.id===C;xe.setState(ee,I,Wt)}let Ct=!1;ee.version===Oe.__version?(Oe.needsLights&&Oe.lightsStateVersion!==Gt.state.version||Oe.outputColorSpace!==qe||Y.isBatchedMesh&&Oe.batching===!1||!Y.isBatchedMesh&&Oe.batching===!0||Y.isBatchedMesh&&Oe.batchingColor===!0&&Y.colorTexture===null||Y.isBatchedMesh&&Oe.batchingColor===!1&&Y.colorTexture!==null||Y.isInstancedMesh&&Oe.instancing===!1||!Y.isInstancedMesh&&Oe.instancing===!0||Y.isSkinnedMesh&&Oe.skinning===!1||!Y.isSkinnedMesh&&Oe.skinning===!0||Y.isInstancedMesh&&Oe.instancingColor===!0&&Y.instanceColor===null||Y.isInstancedMesh&&Oe.instancingColor===!1&&Y.instanceColor!==null||Y.isInstancedMesh&&Oe.instancingMorph===!0&&Y.morphTexture===null||Y.isInstancedMesh&&Oe.instancingMorph===!1&&Y.morphTexture!==null||Oe.envMap!==je||ee.fog===!0&&Oe.fog!==we||Oe.numClippingPlanes!==void 0&&(Oe.numClippingPlanes!==xe.numPlanes||Oe.numIntersection!==xe.numIntersection)||Oe.vertexAlphas!==ht||Oe.vertexTangents!==dt||Oe.morphTargets!==Je||Oe.morphNormals!==Et||Oe.morphColors!==Rt||Oe.toneMapping!==at||Oe.morphTargetsCount!==wt)&&(Ct=!0):(Ct=!0,Oe.__version=ee.version);let fn=Oe.currentProgram;Ct===!0&&(fn=Hs(ee,W,Y));let Qt=!1,dn=!1,Mr=!1;const Bt=fn.getUniforms(),On=Oe.uniforms;if(Te.useProgram(fn.program)&&(Qt=!0,dn=!0,Mr=!0),ee.id!==C&&(C=ee.i
vendor: 11,345 bytes, line 3844
3844d,dn=!0),Qt||A!==I){Te.buffers.depth.getReversed()?(Me.copy(I.projectionMatrix),gM(Me),vM(Me),Bt.setValue(z,"projectionMatrix",Me)):Bt.setValue(z,"projectionMatrix",I.projectionMatrix),Bt.setValue(z,"viewMatrix",I.matrixWorldInverse);const Li=Bt.map.cameraPosition;Li!==void 0&&Li.setValue(z,lt.setFromMatrixPosition(I.matrixWorld)),ze.logarithmicDepthBuffer&&Bt.setValue(z,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),(ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial)&&Bt.setValue(z,"isOrthographic",I.isOrthographicCamera===!0),A!==I&&(A=I,dn=!0,Mr=!0)}if(Y.isSkinnedMesh){Bt.setOptional(z,Y,"bindMatrix"),Bt.setOptional(z,Y,"bindMatrixInverse");const Wt=Y.skeleton;Wt&&(Wt.boneTexture===null&&Wt.computeBoneTexture(),Bt.setValue(z,"boneTexture",Wt.boneTexture,O))}Y.isBatchedMesh&&(Bt.setOptional(z,Y,"batchingTexture"),Bt.setValue(z,"batchingTexture",Y._matricesTexture,O),Bt.setOptional(z,Y,"batchingIdTexture"),Bt.setValue(z,"batchingIdTexture",Y._indirectTexture,O),Bt.setOptional(z,Y,"batchingColorTexture"),Y._colorsTexture!==null&&Bt.setValue(z,"batchingColorTexture",Y._colorsTexture,O));const Er=$.morphAttributes;if((Er.position!==void 0||Er.normal!==void 0||Er.color!==void 0)&&ct.update(Y,$,fn),(dn||Oe.receiveShadow!==Y.receiveShadow)&&(Oe.receiveShadow=Y.receiveShadow,Bt.setValue(z,"receiveShadow",Y.receiveShadow)),ee.isMeshGouraudMaterial&&ee.envMap!==null&&(On.envMap.value=je,On.flipEnvMap.value=je.isCubeTexture&&je.isRenderTargetTexture===!1?-1:1),ee.isMeshStandardMaterial&&ee.envMap===null&&W.environment!==null&&(On.envMapIntensity.value=W.environmentIntensity),dn&&(Bt.setValue(z,"toneMappingExposure",T.toneMappingExposure),Oe.needsLights&&Lh(On,Mr),we&&ee.fog===!0&&be.refreshFogUniforms(On,we),be.refreshMaterialUniforms(On,ee,V,ve,_.state.transmissionRenderTarget[I.id]),cu.upload(z,ml(Oe),On,O)),ee.isShaderMaterial&&ee.uniformsNeedUpdate===!0&&(cu.upload(z,ml(Oe),On,O),ee.uniformsNeedUpdate=!1),ee.isSpriteMaterial&&Bt.setValue(z,"center",Y.center),Bt.setValue(z,"modelViewMatrix",Y.modelViewMatrix),Bt.setValue(z,"normalMatrix",Y.normalMatrix),Bt.setValue(z,"modelMatrix",Y.matrixWorld),ee.isShaderMaterial||ee.isRawShaderMaterial){const Wt=ee.uniformsGroups;for(let Li=0,Di=Wt.length;Li<Di;Li++){const _l=Wt[Li];k.update(_l,fn),k.bind(_l,fn)}}return fn}function Lh(I,W){I.ambientLightColor.needsUpdate=W,I.lightProbe.needsUpdate=W,I.directionalLights.needsUpdate=W,I.directionalLightShadows.needsUpdate=W,I.pointLights.needsUpdate=W,I.pointLightShadows.needsUpdate=W,I.spotLights.needsUpdate=W,I.spotLightShadows.needsUpdate=W,I.rectAreaLights.needsUpdate=W,I.hemisphereLights.needsUpdate=W}function vl(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return L},this.getRenderTarget=function(){return F},this.setRenderTargetTextures=function(I,W,$){De.get(I.texture).__webglTexture=W,De.get(I.depthTexture).__webglTexture=$;const ee=De.get(I);ee.__hasExternalTextures=!0,ee.__autoAllocateDepthBuffer=$===void 0,ee.__autoAllocateDepthBuffer||ye.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ee.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(I,W){const $=De.get(I);$.__webglFramebuffer=W,$.__useDefaultFramebuffer=W===void 0},this.setRenderTarget=function(I,W=0,$=0){F=I,R=W,L=$;let ee=!0,Y=null,we=!1,Ue=!1;if(I){const je=De.get(I);if(je.__useDefaultFramebuffer!==void 0)Te.bindFramebuffer(z.FRAMEBUFFER,null),ee=!1;else if(je.__webglFramebuffer===void 0)O.setupRenderTarget(I);else if(je.__hasExternalTextures)O.rebindTextures(I,De.get(I.texture).__webglTexture,De.get(I.depthTexture).__webglTexture);else if(I.depthBuffer){const Je=I.depthTexture;if(je.__boundDepthTexture!==Je){if(Je!==null&&De.has(Je)&&(I.width!==Je.image.width||I.height!==Je.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");O.setupDepthRenderbuffer(I)}}const ht=I.texture;(ht.isData3DTexture||ht.isDataArrayTexture||ht.isCompressedArrayTexture)&&(Ue=!0);const dt=De.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(Array.isArray(dt[W])?Y=dt[W][$]:Y=dt[W],we=!0):I.samples>0&&O.useMultisampledRTT(I)===!1?Y=De.get(I).__webglMultisampledFramebuffer:Array.isArray(dt)?Y=dt[$]:Y=dt,N.copy(I.viewport),Z.copy(I.scissor),q=I.scissorTest}else N.copy(de).multiplyScalar(V).floor(),Z.copy(Re).multiplyScalar(V).floor(),q=Xe;if(Te.bindFramebuffer(z.FRAMEBUFFER,Y)&&ee&&Te.drawBuffers(I,Y),Te.viewport(N),Te.scissor(Z),Te.setScissorTest(q),we){const je=De.get(I.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_CUBE_MAP_POSITIVE_X+W,je.__webglTexture,$)}else if(Ue){const je=De.get(I.texture),ht=W||0;z.framebufferTextureLayer(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,je.__webglTexture,$||0,ht)}C=-1},this.readRenderTargetPixels=function(I,W,$,ee,Y,we,Ue){if(!(I&&I.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qe=De.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&Ue!==void 0&&(qe=qe[Ue]),qe){Te.bindFramebuffer(z.FRAMEBUFFER,qe);try{const je=I.texture,ht=je.format,dt=je.type;if(!ze.textureFormatReadable(ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ze.textureTypeReadable(dt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=I.width-ee&&$>=0&&$<=I.height-Y&&z.readPixels(W,$,ee,Y,le.convert(ht),le.convert(dt),we)}finally{const je=F!==null?De.get(F).__webglFramebuffer:null;Te.bindFramebuffer(z.FRAMEBUFFER,je)}}},this.readRenderTargetPixelsAsync=async function(I,W,$,ee,Y,we,Ue){if(!(I&&I.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let qe=De.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&Ue!==void 0&&(qe=qe[Ue]),qe){const je=I.texture,ht=je.format,dt=je.type;if(!ze.textureFormatReadable(ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ze.textureTypeReadable(dt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(W>=0&&W<=I.width-ee&&$>=0&&$<=I.height-Y){Te.bindFramebuffer(z.FRAMEBUFFER,qe);const Je=z.createBuffer();z.bindBuffer(z.PIXEL_PACK_BUFFER,Je),z.bufferData(z.PIXEL_PACK_BUFFER,we.byteLength,z.STREAM_READ),z.readPixels(W,$,ee,Y,le.convert(ht),le.convert(dt),0);const Et=F!==null?De.get(F).__webglFramebuffer:null;Te.bindFramebuffer(z.FRAMEBUFFER,Et);const Rt=z.fenceSync(z.SYNC_GPU_COMMANDS_COMPLETE,0);return z.flush(),await mM(z,Rt,4),z.bindBuffer(z.PIXEL_PACK_BUFFER,Je),z.getBufferSubData(z.PIXEL_PACK_BUFFER,0,we),z.deleteBuffer(Je),z.deleteSync(Rt),we}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(I,W=null,$=0){I.isTexture!==!0&&(Ma("WebGLRenderer: copyFramebufferToTexture function signature has changed."),W=arguments[0]||null,I=arguments[1]);const ee=Math.pow(2,-$),Y=Math.floor(I.image.width*ee),we=Math.floor(I.image.height*ee),Ue=W!==null?W.x:0,qe=W!==null?W.y:0;O.setTexture2D(I,0),z.copyTexSubImage2D(z.TEXTURE_2D,$,0,0,Ue,qe,Y,we),Te.unbindTexture()},this.copyTextureToTexture=function(I,W,$=null,ee=null,Y=0){I.isTexture!==!0&&(Ma("WebGLRenderer: copyTextureToTexture function signature has changed."),ee=arguments[0]||null,I=arguments[1],W=arguments[2],Y=arguments[3]||0,$=null);let we,Ue,qe,je,ht,dt,Je,Et,Rt;const at=I.isCompressedTexture?I.mipmaps[Y]:I.image;$!==null?(we=$.max.x-$.min.x,Ue=$.max.y-$.min.y,qe=$.isBox3?$.max.z-$.min.z:1,je=$.min.x,ht=$.min.y,dt=$.isBox3?$.min.z:0):(we=at.width,Ue=at.height,qe=at.depth||1,je=0,ht=0,dt=0),ee!==null?(Je=ee.x,Et=ee.y,Rt=ee.z):(Je=0,Et=0,Rt=0);const _t=le.convert(W.format),wt=le.convert(W.type);let Oe;W.isData3DTexture?(O.setTexture3D(W,0),Oe=z.TEXTURE_3D):W.isDataArrayTexture||W.isCompressedArrayTexture?(O.setTexture2DArray(W,0),Oe=z.TEXTURE_2D_ARRAY):(O.setTexture2D(W,0),Oe=z.TEXTURE_2D),z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,W.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,W.unpackAlignment);const Gt=z.getParameter(z.UNPACK_ROW_LENGTH),Ct=z.getParameter(z.UNPACK_IMAGE_HEIGHT),fn=z.getParameter(z.UNPACK_SKIP_PIXELS),Qt=z.getParameter(z.UNPACK_SKIP_ROWS),dn=z.getParameter(z.UNPACK_SKIP_IMAGES);z.pixelStorei(z.UNPACK_ROW_LENGTH,at.width),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,at.height),z.pixelStorei(z.UNPACK_SKIP_PIXELS,je),z.pixelStorei(z.UNPACK_SKIP_ROWS,ht),z.pixelStorei(z.UNPACK_SKIP_IMAGES,dt);const Mr=I.isDataArrayTexture||I.isData3DTexture,Bt=W.isDataArrayTexture||W.isData3DTexture;if(I.isRenderTargetTexture||I.isDepthTexture){const On=De.get(I),Er=De.get(W),Wt=De.get(On.__renderTarget),Li=De.get(Er.__renderTarget);Te.bindFramebuffer(z.READ_FRAMEBUFFER,Wt.__webglFramebuffer),Te.bindFramebuffer(z.DRAW_FRAMEBUFFER,Li.__webglFramebuffer);for(let Di=0;Di<qe;Di++)Mr&&z.framebufferTextureLayer(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,De.get(I).__webglTexture,Y,dt+Di),I.isDepthTexture?(Bt&&z.framebufferTextureLayer(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,De.get(W).__webglTexture,Y,Rt+Di),z.blitFramebuffer(je,ht,we,Ue,Je,Et,we,Ue,z.DEPTH_BUFFER_BIT,z.NEAREST)):Bt?z.copyTexSubImage3D(Oe,Y,Je,Et,Rt+Di,je,ht,we,Ue):z.copyTexSubImage2D(Oe,Y,Je,Et,Rt+Di,je,ht,we,Ue);Te.bindFramebuffer(z.READ_FRAMEBUFFER,null),Te.bindFramebuffer(z.DRAW_FRAMEBUFFER,null)}else Bt?I.isDataTexture||I.isData3DTexture?z.texSubImage3D(Oe,Y,Je,Et,Rt,we,Ue,qe,_t,wt,at.data):W.isCompressedArrayTexture?z.compressedTexSubImage3D(Oe,Y,Je,Et,Rt,we,Ue,qe,_t,at.data):z.texSubImage3D(Oe,Y,Je,Et,Rt,we,Ue,qe,_t,wt,at):I.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,Y,Je,Et,we,Ue,_t,wt,at.data):I.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,Y,Je,Et,at.width,at.height,_t,at.data):z.texSubImage2D(z.TEXTURE_2D,Y,Je,Et,we,Ue,_t,wt,at);z.pixelStorei(z.UNPACK_ROW_LENGTH,Gt),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,Ct),z.pixelStorei(z.UNPACK_SKIP_PIXELS,fn),z.pixelStorei(z.UNPACK_SKIP_ROWS,Qt),z.pixelStorei(z.UNPACK_SKIP_IMAGES,dn),Y===0&&W.generateMipmaps&&z.generateMipmap(Oe),Te.unbindTexture()},this.copyTextureToTexture3D=function(I,W,$=null,ee=null,Y=0){return I.isTexture!==!0&&(Ma("WebGLRenderer: copyTextureToTexture3D function signature has changed."),$=arguments[0]||null,ee=arguments[1]||null,I=arguments[2],W=arguments[3],Y=arguments[4]||0),Ma('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(I,W,$,ee,Y)},this.initRenderTarget=function(I){De.get(I).__webglFramebuffer===void 0&&O.setupRenderTarget(I)},this.initTexture=function(I){I.isCubeTexture?O.setTextureCube(I,0):I.isData3DTexture?O.setTexture3D(I,0
vendor: 18,389 bytes, line 3844
3844):I.isDataArrayTexture||I.isCompressedArrayTexture?O.setTexture2DArray(I,0):O.setTexture2D(I,0),Te.unbindTexture()},this.resetState=function(){R=0,L=0,F=null,Te.reset(),Ie.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Yi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=Pt._getDrawingBufferColorSpace(e),t.unpackColorSpace=Pt._getUnpackColorSpace()}}class hh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ve(e),this.density=t}clone(){return new hh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class fh{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ve(e),this.near=t,this.far=n}clone(){return new fh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Tp extends Dt{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 ai,this.environmentIntensity=1,this.environmentRotation=new ai,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class dh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Va,this.updateRanges=[],this.version=0,this.uuid=oi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=oi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=oi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const zn=new D;class si{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)zn.fromBufferAttribute(this,t),zn.applyMatrix4(e),this.setXYZ(t,zn.x,zn.y,zn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)zn.fromBufferAttribute(this,t),zn.applyNormalMatrix(e),this.setXYZ(t,zn.x,zn.y,zn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)zn.fromBufferAttribute(this,t),zn.transformDirection(e),this.setXYZ(t,zn.x,zn.y,zn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Vn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=vt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Vn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Vn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Vn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Vn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array),s=vt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new zt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new si(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class bp extends Nn{static get type(){return"SpriteMaterial"}constructor(e){super(),this.isSpriteMaterial=!0,this.color=new Ve(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let mo;const fa=new D,go=new D,vo=new D,_o=new ue,da=new ue,W_=new ut,Ic=new D,pa=new D,Lc=new D,M0=new ue,fd=new ue,E0=new ue;class X_ extends Dt{constructor(e=new bp){if(super(),this.isSprite=!0,this.type="Sprite",mo===void 0){mo=new xt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new dh(t,5);mo.setIndex([0,1,2,0,2,3]),mo.setAttribute("position",new si(n,3,0,!1)),mo.setAttribute("uv",new si(n,2,3,!1))}this.geometry=mo,this.material=e,this.center=new ue(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),go.setFromMatrixScale(this.matrixWorld),W_.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&go.multiplyScalar(-vo.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;Dc(Ic.set(-.5,-.5,0),vo,a,go,i,s),Dc(pa.set(.5,-.5,0),vo,a,go,i,s),Dc(Lc.set(.5,.5,0),vo,a,go,i,s),M0.set(0,0),fd.set(1,0),E0.set(1,1);let c=e.ray.intersectTriangle(Ic,pa,Lc,!1,fa);if(c===null&&(Dc(pa.set(-.5,.5,0),vo,a,go,i,s),fd.set(0,1),c=e.ray.intersectTriangle(Ic,Lc,pa,!1,fa),c===null))return;const u=e.ray.origin.distanceTo(fa);u<e.near||u>e.far||t.push({distance:u,point:fa.clone(),uv:Jn.getInterpolation(fa,Ic,pa,Lc,M0,fd,E0,new ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Dc(r,e,t,n,i,s){_o.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(da.x=s*_o.x-i*_o.y,da.y=i*_o.x+s*_o.y):da.copy(_o),r.copy(e),r.x+=da.x,r.y+=da.y,r.applyMatrix4(W_)}const Uc=new D,w0=new D;class Y_ extends Dt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Uc.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Uc);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Uc.setFromMatrixPosition(e.matrixWorld),w0.setFromMatrixPosition(this.matrixWorld);const n=Uc.distanceTo(w0)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let a=t[i].distance;if(t[i].object.visible&&(a-=a*t[i].hysteresis),n>=a)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const T0=new D,b0=new bt,A0=new bt,Pb=new D,C0=new ut,Nc=new D,dd=new yn,R0=new ut,pd=new Os;class q_ extends nn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Hd,this.bindMatrix=new ut,this.bindMatrixInverse=new ut,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new _n),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Nc),this.boundingBox.expandByPoint(Nc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new yn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Nc),this.boundingSphere.expandByPoint(Nc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),dd.copy(this.boundingSphere),dd.applyMatrix4(i),e.ray.intersectsSphere(dd)!==!1&&(R0.copy(i).invert(),pd.copy(e.ray).applyMatrix4(R0),!(this.boundingBox!==null&&pd.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,pd)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new bt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Hd?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===d_?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;b0.fromBufferAttribute(i.attributes.skinIndex,e),A0.fromBufferAttribute(i.attributes.skinWeight,e),T0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=A0.getComponent(s);if(a!==0){const c=b0.getComponent(s);C0.multiplyMatrices(n.bones[c].matrixWorld,n.boneInverses[c]),t.addScaledVector(Pb.copy(T0).applyMatrix4(C0),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Ap extends Dt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Zi extends Kt{constructor(e=null,t=1,n=1,i,s,a,c,u,h=wn,f=wn,p,m){super(null,a,c,u,h,f,i,s,p,m),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const P0=new ut,Ib=new ut;class ph{constructor(e=[],t=[]){this.uuid=oi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new ut)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new ut;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const c=e[s]?e[s].matrixWorld:Ib;P0.multiplyMatrices(c,t[s]),P0.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new ph(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Zi(t,e,e,Dn,Kn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new Ap),this.bones.push(a),this.boneInverses.push(new ut().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const c=n[i];e.boneInverses.push(c.toArray())}return e}}class No extends zt{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const yo=new ut,I0=new ut,Oc=[],L0=new _n,Lb=new ut,ma=new nn,ga=new yn;class Z_ extends nn{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new No(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Lb)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new _n),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,yo),L0.copy(e.boundingBox).applyMatrix4(yo),this.boundingBox.union(L0)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new yn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;
3844n++)this.getMatrixAt(n,yo),ga.copy(e.boundingSphere).applyMatrix4(yo),this.boundingSphere.union(ga)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let c=0;c<n.length;c++)n[c]=i[a+c]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(ma.geometry=this.geometry,ma.material=this.material,ma.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ga.copy(this.boundingSphere),ga.applyMatrix4(n),e.ray.intersectsSphere(ga)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,yo),I0.multiplyMatrices(n,yo),ma.matrixWorld=I0,ma.raycast(e,Oc);for(let a=0,c=Oc.length;a<c;a++){const u=Oc[a];u.instanceId=s,u.object=this,t.push(u)}Oc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new No(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Zi(new Float32Array(i*this.count),i,this.count,sh,Kn));const s=this.morphTexture.source.data.data;let a=0;for(let h=0;h<n.length;h++)a+=n[h];const c=this.geometry.morphTargetsRelative?1:1-a,u=i*e;s[u]=c,s.set(n,u+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function md(r,e){return r-e}function Db(r,e){return r.z-e.z}function Ub(r,e){return e.z-r.z}class Nb{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const c=s[this.index];a.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const qn=new ut,Ob=new Ve(1,1,1),gd=new rl,Fc=new _n,cs=new yn,va=new D,D0=new D,Fb=new D,vd=new Nb,Ln=new nn,Bc=[];function Bb(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let a=0;a<n;a++)e.setComponent(s+t,a,r.getComponent(s,a))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function us(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++)e[n]=r[n]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class j_ extends nn{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(e,t,n=t*2,i){super(new xt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Zi(t,e,e,Dn,Kn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Zi(t,e,e,el,yr);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Zi(t,e,e,Dn,Kn);
3844n.colorSpace=Pt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const a=e.getAttribute(s),{array:c,itemSize:u,normalized:h}=a,f=new c.constructor(n*u),p=new zt(f,u,h);t.setAttribute(s,p)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new zt(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _n);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,qn),this.getBoundingBoxAt(s,Fc).applyMatrix4(qn),e.union(Fc)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yn);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,qn),this.getBoundingSphereAt(s,cs).applyMatrix4(qn),e.union(cs)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(md),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;qn.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(Ob.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const a=e.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?a.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");let u;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(md),u=this._availableGeometryIds.shift(),s[u]=i):(u=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(u,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),c=this._geometryInfo[e];if(i&&a.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const u=c.vertexStart,h=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const f in n.attributes){const p=t.getAttribute(f),m=n.getAttribute(f);Bb(p,m,u);const g=p.itemSize;for(let y=p.count,M=h;y<M;y++){const x=u+y;for(let _=0;_<g;_++)m.setComponent(x,_,0)}m.needsUpdate=!0,m.addUpdateRange(u*g,h*g)}if(i){const f=c.indexStart,p=c.reservedIndexCount;c.indexCount=t.getIndex().count;for(let m=0;m<a.count;m++)s.setX(f+m,u+a.getX(m));for(let m=a.count,g=p;m<g;m++)s.setX(f+m,u);s.needsUpdate=!0,s.addUpdateRange(f,c.reservedIndexCount)}return c.start=i?c.indexStart:c.vertexStart,c.count=i?c.indexCount:c.vertexCount,c.boundingBox=null,t.boundingBox!==null&&(c.boundingBox=t.boundingBox.clone()),c.boundingSphere=null,t.boundingSphere!==null&&(c.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){const t=this._instanceInfo;return e>=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((a,c)=>c).sort((a,c)=>n[a].vertexStart-n[c].vertexStart),s=this.geometry;for(let a=0,c=n.length;a<c;a++){const u=i[a],h=n[u];if(h.active!==!1){if(s.index!==null){if(h.indexStart!==t){const{indexStart:f,vertexStart:p,reservedIndexCount:m}=h,g=s.index,y=g.array,M=e-p;for(let x=f;x<f+m;x++)y[x]=y[x]+M;g.array.copyWithin(t,f,f+m),g.addUpdateRange(t,m),h.indexStart=t}t+=h.reservedIndexCount}if(h.vertexStart!==e){const{vertexStart:f,reservedVertexCount:p}=h,m=s.attributes;for(const g in m){const y=m[g],{array:M,itemSize:x}=y;M.copyWithin(e*x,f*x,(f+p)*x),y.addUpdateRange(e*x,p*x)}h.vertexStart=e}e+=h.reservedVertexCount,h.start=s.index?h.indexStart:h.vertexStart,this._nextIndexStart=s.index?h.indexStart+h.reservedIndexCount:0,this._nextVertexStart=h.vertexStart+h.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new _n,a=n.index,c=n.attributes.position;for(let u=i.start,h=i.start+i.count;u<h;u++){let f=u;a&&(f=a.getX(f)),s.expandByPoint(va.fromBufferAttribute(c,f))}i.boundingBox=s}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new yn;this.getBoundingBoxAt(e,Fc),Fc.getCenter(s.center);const a=n.index,c=n.attributes.position;let u=0;for(let h=i.start,f=i.start+i.count;h<f;h++){let p=h;a&&(p=a.getX(p)),va.fromBufferAttribute(c,p),u=Math.max(u,s.center.distanceToSquared(va))}s.radius=Math.sqrt(u),i.boundingSphere=s}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){const n=this._instanceInfo,i=this._matricesTexture,s=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?this:(t.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._instanceInfo,i=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const n=this._colorsTexture,i=this._colorsTexture.image.data,s=this._instanceInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(i,e*4),n.needsUpdate=!0,this)}getColorAt(e,t){const n=this._colorsTexture.image.data,i=this._instanceInfo;return e>=i.length||i[e].active===!1?null:t.fromArray(n,e*4)}setVisibleAt(e,t){const n=this._instanceInfo;return e>=n.length||n[e].active===!1||n[e].visible===t?this:(n[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._instanceInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const n=this._instanceInfo,i=this._geometryInfo;return e>=n.length||n[e].active===!1||t>=i.length||i[t].active===!1?null:(n[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._instanceInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(md);t[t.length-1]===n.length;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);us(this._multiDrawCounts,i),us(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const a=this._indirectTexture,c=this._matricesTexture,u=this._colorsTexture;a.dispose(),this._initIndirectTexture(),us(a.image.data,this._indirectTexture.image.data),c.dispose(),this._initMatricesTexture(),us(c.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),us(u.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(c=>c.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(u=>u.indexStart+u.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new xt,this._initializeGeometry(s));const a=this.geometry;s.index&&us(s.index.array,a.index.array);for(const c in s.attributes)us(s.attributes[c].array,a.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,a=this.geometry;Ln.material=this.material,Ln.geometry.index=a.index,Ln.geometry.attributes=a.attributes,Ln.geometry.boundingBox===null&&(Ln.geometry.boundingBox=new _n),Ln.geometry.boundingSphere===null&&(Ln.geometry.boundingSphere=new yn);for(let c=0,u=n.length;c<u;c++){if(!n[c].visible||!n[c].active)continue;const h=n[c].geometryIndex,f=i[h];Ln.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(c,Ln.matrixWorld).premultiply(s),this.getBoundingBoxAt(h,Ln.geometry.boundingBox),this.getBoundingSphereAt(h,Ln.geometry.boundingSphere),Ln.raycast(e,Bc);for(let p=0,m=Bc.length;p<m;p++){const g=Bc[p];g.object=this,g.batchId=c,t.push(g)}Bc.length=0}Ln.material=null,Ln.geometry.index=null,Ln.geometry.attributes={},Ln.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),c=a===null?1:a.array.BYTES_PER_ELEMENT,u=this._instanceInfo,h=this._multiDrawStarts,f=this._multiDrawCounts,p=this._geometryInfo,m=this.perObjectFrustumCulled,g=this._indirectTexture,y=g.image.data;m&&(qn.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),gd.setFromProjectionMatrix(qn,e.coordinateSystem));let M=0;if(this.sortObjects){qn.copy(this.matrixWorld).invert(),va.setFromMatrixPosition(n.matrixWorld).applyMatrix4(qn),D0.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(qn);for(let w=0,E=u.length;w<E;w++)if(u[w].visible&&u[w].active){const T=u[w].geometryIndex;this.getMatrixAt(w,qn),this.getBoundingSphereAt(T,cs).applyMatrix4(qn);let U=!1;if(m&&(U=!gd.intersectsSphere(cs)),!U){const R=p[T],L=Fb.subVectors(cs.center,va).dot(D0);vd.push(R.start,R.count,L,w)}}const x=vd.list,_=this.customSort;_===null?x.sort(s.transparent?Ub:Db):_.call(this,x,n);for(let w=0,E=x.length;w<E;w++){const T=x[w];h[M]=T.start*c,f[M]=T.count,y[M]=T.index,M++}vd.reset()}else for(let x=0,_=u.length;x<_;x++)if(u[x].visible&&u[x].active){const w=u[x].geometryIndex;let E=!1;
vendor: 5,923 bytes, line 3844
3844if(m&&(this.getMatrixAt(x,qn),this.getBoundingSphereAt(w,cs).applyMatrix4(qn),E=!gd.intersectsSphere(cs)),!E){const T=p[w];h[M]=T.start*c,f[M]=T.count,y[M]=x,M++}}g.needsUpdate=!0,this._multiDrawCount=M,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class Gn extends Nn{static get type(){return"LineBasicMaterial"}constructor(e){super(),this.isLineBasicMaterial=!0,this.color=new Ve(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Zu=new D,ju=new D,U0=new ut,_a=new Os,zc=new yn,_d=new D,N0=new D;let Hr=class extends Dt{constructor(e=new xt,t=new Gn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)Zu.fromBufferAttribute(t,i-1),ju.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Zu.distanceTo(ju);e.setAttribute("lineDistance",new Ze(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),zc.copy(n.boundingSphere),zc.applyMatrix4(i),zc.radius+=s,e.ray.intersectsSphere(zc)===!1)return;U0.copy(i).invert(),_a.copy(e.ray).applyMatrix4(U0);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=this.isLineSegments?2:1,f=n.index,m=n.attributes.position;if(f!==null){const g=Math.max(0,a.start),y=Math.min(f.count,a.start+a.count);for(let M=g,x=y-1;M<x;M+=h){const _=f.getX(M),w=f.getX(M+1),E=kc(this,e,_a,u,_,w);E&&t.push(E)}if(this.isLineLoop){const M=f.getX(y-1),x=f.getX(g),_=kc(this,e,_a,u,M,x);_&&t.push(_)}}else{const g=Math.max(0,a.start),y=Math.min(m.count,a.start+a.count);for(let M=g,x=y-1;M<x;M+=h){const _=kc(this,e,_a,u,M,M+1);_&&t.push(_)}if(this.isLineLoop){const M=kc(this,e,_a,u,y-1,g);M&&t.push(M)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}};function kc(r,e,t,n,i,s){const a=r.geometry.attributes.position;if(Zu.fromBufferAttribute(a,i),ju.fromBufferAttribute(a,s),t.distanceSqToSegment(Zu,ju,_d,N0)>n)return;_d.applyMatrix4(r.matrixWorld);const u=e.ray.origin.distanceTo(_d);if(!(u<e.near||u>e.far))return{distance:u,point:N0.clone().applyMatrix4(r.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:r}}const O0=new D,F0=new D;class Ki extends Hr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)O0.fromBufferAttribute(t,i),F0.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+O0.distanceTo(F0);e.setAttribute("lineDistance",new Ze(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class J_ extends Hr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Cp extends Nn{static get type(){return"PointsMaterial"}constructor(e){super(),this.isPointsMaterial=!0,this.color=new Ve(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const B0=new ut,Zd=new Os,Vc=new yn,Hc=new D;class K_ extends Dt{constructor(e=new xt,t=new Cp){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Vc.copy(n.boundingSphere),Vc.applyMatrix4(i),Vc.radius+=s,e.ray.intersectsSphere(Vc)===!1)return;B0.copy(i).invert(),Zd.copy(e.ray).applyMatrix4(B0);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=n.index,p=n.attributes.position;if(h!==null){const m=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let y=m,M=g;y<M;y++){const x=h.getX(y);Hc.fromBufferAttribute(p,x),z0(Hc,x,u,i,e,t,this)}}else{const m=Math.max(0,a.start),g=Math.min(p.count,a.start+a.count);for(let y=m,M=g;y<M;y++)Hc.fromBufferAttribute(p,y),z0(Hc,y,u,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}}function z0(r,e,t,n,i,s,a){const c=Zd.distanceSqToPoint(r);if(c<t){const u=new D;Zd.closestPointToPoint(r,u),u.applyMatrix4(n);const h=i.ray.origin.distanceTo(u);if(h<i.near||h>i.far)return;s.push({distance:h,distanceToRay:Math.sqrt(c),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class zb extends Kt{constructor(e,t,n,i,s,a,c,u,h){super(e,t,n,i,s,a,c,u,h),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:cn,this.magFilter=s!==void 0?s:cn,this.generateMipmaps=!1;const f=this;
vendor: 9,744 bytes, line 3844
3844function p(){f.needsUpdate=!0,e.requestVideoFrameCallback(p)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(p)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class kb extends Kt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=wn,this.minFilter=wn,this.generateMipmaps=!1,this.needsUpdate=!0}}class mh extends Kt{constructor(e,t,n,i,s,a,c,u,h,f,p,m){super(null,a,c,u,h,f,i,s,p,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Vb extends mh{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=vi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Hb extends mh{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,_r),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Gb extends Kt{constructor(e,t,n,i,s,a,c,u,h){super(e,t,n,i,s,a,c,u,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ri{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let c=0,u=s-1,h;for(;c<=u;)if(i=Math.floor(c+(u-c)/2),h=n[i]-a,h<0)c=i+1;else if(h>0)u=i-1;else{u=i;break}if(i=u,n[i]===a)return i/(s-1);const f=n[i],m=n[i+1]-f,g=(a-f)/m;return(i+g)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),c=this.getPoint(s),u=t||(a.isVector2?new ue:new D);return u.copy(c).sub(a).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new D,i=[],s=[],a=[],c=new D,u=new ut;for(let g=0;g<=e;g++){const y=g/e;i[g]=this.getTangentAt(y,new D)}s[0]=new D,a[0]=new D;let h=Number.MAX_VALUE;const f=Math.abs(i[0].x),p=Math.abs(i[0].y),m=Math.abs(i[0].z);f<=h&&(h=f,n.set(1,0,0)),p<=h&&(h=p,n.set(0,1,0)),m<=h&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],c),a[0].crossVectors(i[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),a[g]=a[g-1].clone(),c.crossVectors(i[g-1],i[g]),c.length()>Number.EPSILON){c.normalize();const y=Math.acos(Jt(i[g-1].dot(i[g]),-1,1));s[g].applyMatrix4(u.makeRotationAxis(c,y))}a[g].crossVectors(i[g],s[g])}if(t===!0){let g=Math.acos(Jt(s[0].dot(s[e]),-1,1));g/=e,i[0].dot(c.crossVectors(s[0],s[e]))>0&&(g=-g);for(let y=1;y<=e;y++)s[y].applyMatrix4(u.makeRotationAxis(i[y],g*y)),a[y].crossVectors(i[y],s[y])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class gh extends Ri{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,c=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=c,this.aRotation=u}getPoint(e,t=new ue){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const c=this.aStartAngle+e*s;let u=this.aX+this.xRadius*Math.cos(c),h=this.aY+this.yRadius*Math.sin(c);if(this.aRotation!==0){const f=Math.cos(this.aRotation),p=Math.sin(this.aRotation),m=u-this.aX,g=h-this.aY;u=m*f-g*p+this.aX,h=m*p+g*f+this.aY}return n.set(u,h)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class Q_ extends gh{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function Rp(){let r=0,e=0,t=0,n=0;function i(s,a,c,u){r=s,e=c,t=-3*s+3*a-2*c-u,n=2*s-2*a+c+u}return{initCatmullRom:function(s,a,c,u,h){i(a,c,h*(c-s),h*(u-a))},initNonuniformCatmullRom:function(s,a,c,u,h,f,p){let m=(a-s)/h-(c-s)/(h+f)+(c-a)/f,g=(c-a)/f-(u-a)/(f+p)+(u-c)/p;m*=f,g*=f,i(a,c,m,g)},calc:function(s){const a=s*s,c=a*s;return r+e*s+t*a+n*c}}}const Gc=new D,yd=new Rp,xd=new Rp,Sd=new Rp;class $_ extends Ri{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new D){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let c=Math.floor(a),u=a-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/s)+1)*s:u===0&&c===s-1&&(c=s-2,u=1);let h,f;this.closed||c>0?h=i[(c-1)%s]:(Gc.subVectors(i[0],i[1]).add(i[0]),h=Gc);const p=i[c%s],m=i[(c+1)%s];if(this.closed||c+2<s?f=i[(c+2)%s]:(Gc.subVectors(i[s-1],i[s-2]).add(i[s-1]),f=Gc),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let y=Math.pow(h.distanceToSquared(p),g),M=Math.pow(p.distanceToSquared(m),g),x=Math.pow(m.distanceToSquared(f),g);M<1e-4&&(M=1),y<1e-4&&(y=M),x<1e-4&&(x=M),yd.initNonuniformCatmullRom(h.x,p.x,m.x,f.x,y,M,x),xd.initNonuniformCatmullRom(h.y,p.y,m.y,f.y,y,M,x),Sd.initNonuniformCatmullRom(h.z,p.z,m.z,f.z,y,M,x)}else this.curveType==="catmullrom"&&(yd.initCatmullRom(h.x,p.x,m.x,f.x,this.tension),xd.initCatmullRom(h.y,p.y,m.y,f.y,this.tension),Sd.initCatmullRom(h.z,p.z,m.z,f.z,this.tension));return n.set(yd.calc(u),xd.calc(u),Sd.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new D().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function k0(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,c=r*r,u=r*c;return(2*t-2*n+s+a)*u+(-3*t+3*n-2*s-a)*c+s*r+t}function Wb(r,e){const t=1-r;return t*t*e}function Xb(r,e){return 2*(1-r)*r*e}function Yb(r,e){return r*r*e}function Da(r,e,t,n){return Wb(r,e)+Xb(r,t)+Yb(r,n)}function qb(r,e){const t=1-r;return t*t*t*e}function Zb(r,e){const t=1-r;return 3*t*t*r*e}function jb(r,e){return 3*(1-r)*r*r*e}function Jb(r,e){return r*r*r*e}function Ua(r,e,t,n,i){return qb(r,e)+Zb(r,t)+jb(r,n)+Jb(r,i)}class Pp extends Ri{constructor(e=new ue,t=new ue,n=new ue,i=new ue){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ue){const n=t,i=this.v0,s=this.v1,a=this.v2,c=this.v3;return n.set(Ua(e,i.x,s.x,a.x,c.x),Ua(e,i.y,s.y,a.y,c.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class ey extends Ri{constructor(e=new D,t=new D,n=new D,i=new D){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new D){const n=t,i=this.v0,s=this.v1,a=this.v2,c=this.v3;return n.set(Ua(e,i.x,s.x,a.x,c.x),Ua(e,i.y,s.y,a.y,c.y),Ua(e,i.z,s.z,a.z,c.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Ip extends Ri{constructor(e=new ue,t=new ue){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ue){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 4,414 bytes, line 3844
3844getTangent(e,t=new ue){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ty extends Ri{constructor(e=new D,t=new D){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new D){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new D){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Lp extends Ri{constructor(e=new ue,t=new ue,n=new ue){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ue){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Da(e,i.x,s.x,a.x),Da(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Dp extends Ri{constructor(e=new D,t=new D,n=new D){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new D){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Da(e,i.x,s.x,a.x),Da(e,i.y,s.y,a.y),Da(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Up extends Ri{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ue){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),c=s-a,u=i[a===0?a:a-1],h=i[a],f=i[a>i.length-2?i.length-1:a+1],p=i[a>i.length-3?i.length-1:a+2];return n.set(k0(c,u.x,h.x,f.x,p.x),k0(c,u.y,h.y,f.y,p.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new ue().fromArray(i))}return this}}var Ju=Object.freeze({__proto__:null,ArcCurve:Q_,CatmullRomCurve3:$_,CubicBezierCurve:Pp,CubicBezierCurve3:ey,EllipseCurve:gh,LineCurve:Ip,LineCurve3:ty,QuadraticBezierCurve:Lp,QuadraticBezierCurve3:Dp,SplineCurve:Up});class ny extends Ri{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Ju[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,c=this.curves[s],u=c.getLength(),h=u===0?0:1-a/u;return c.getPointAt(h,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],c=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isS
vendor: 6,600 bytes, line 3844
3844plineCurve?e*a.points.length:e,u=a.getPoints(c);for(let h=0;h<u.length;h++){const f=u[h];n&&n.equals(f)||(t.push(f),n=f)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Ju[i.type]().fromJSON(i))}return this}}class Wa extends ny{constructor(e){super(),this.type="Path",this.currentPoint=new ue,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Ip(this.currentPoint.clone(),new ue(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Lp(this.currentPoint.clone(),new ue(e,t),new ue(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const c=new Pp(this.currentPoint.clone(),new ue(e,t),new ue(n,i),new ue(s,a));return this.curves.push(c),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Up(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+c,t+u,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,c,u){const h=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+h,t+f,n,i,s,a,c,u),this}absellipse(e,t,n,i,s,a,c,u){const h=new gh(e,t,n,i,s,a,c,u);if(this.curves.length>0){const p=h.getPoint(0);p.equals(this.currentPoint)||this.lineTo(p.x,p.y)}this.curves.push(h);const f=h.getPoint(1);return this.currentPoint.copy(f),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class sl extends xt{constructor(e=[new ue(0,-.5),new ue(.5,0),new ue(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Jt(i,0,Math.PI*2);const s=[],a=[],c=[],u=[],h=[],f=1/t,p=new D,m=new ue,g=new D,y=new D,M=new D;let x=0,_=0;for(let w=0;w<=e.length-1;w++)switch(w){case 0:x=e[w+1].x-e[w].x,_=e[w+1].y-e[w].y,g.x=_*1,g.y=-x,g.z=_*0,M.copy(g),g.normalize(),u.push(g.x,g.y,g.z);break;case e.length-1:u.push(M.x,M.y,M.z);break;default:x=e[w+1].x-e[w].x,_=e[w+1].y-e[w].y,g.x=_*1,g.y=-x,g.z=_*0,y.copy(g),g.x+=M.x,g.y+=M.y,g.z+=M.z,g.normalize(),u.push(g.x,g.y,g.z),M.copy(y)}for(let w=0;w<=t;w++){const E=n+w*f*i,T=Math.sin(E),U=Math.cos(E);for(let R=0;R<=e.length-1;R++){p.x=e[R].x*T,p.y=e[R].y,p.z=e[R].x*U,a.push(p.x,p.y,p.z),m.x=w/t,m.y=R/(e.length-1),c.push(m.x,m.y);const L=u[3*R+0]*T,F=u[3*R+1],C=u[3*R+0]*U;h.push(L,F,C)}}for(let w=0;w<t;w++)for(let E=0;E<e.length-1;E++){const T=E+w*e.length,U=T,R=T+e.length,L=T+e.length+1,F=T+1;s.push(U,R,F),s.push(L,F,R)}this.setIndex(s),this.setAttribute("position",new Ze(a,3)),this.setAttribute("uv",new Ze(c,2)),this.setAttribute("normal",new Ze(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sl(e.points,e.segments,e.phiStart,e.phiLength)}}class vh extends sl{constructor(e=1,t=1,n=4,i=8){const s=new Wa;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new vh(e.radius,e.length,e.capSegments,e.radialSegments)}}class _h extends xt{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],a=[],c=[],u=[],h=new D,f=new ue;a.push(0,0,0),c.push(0,0,1),u.push(.5,.5);for(let p=0,m=3;p<=t;p++,m+=3){const g=n+p/t*i;h.x=e*Math.cos(g),h.y=e*Math.sin(g),a.push(h.x,h.y,h.z),c.push(0,0,1),f.x=(a[m]/e+1)/2,f.y=(a[m+1]/e+1)/2,u.push(f.x,f.y)}for(let p=1;p<=t;p++)s.push(p,p+1,0);this.setIndex(s),this.setAttribute("position",new Ze(a,3)),this.setAttribute("normal",new Ze(c,3)),this.setAttribute("uv",new Ze(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _h(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ho extends xt{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,c=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:c,thetaLength:u};const h=this;i=Math.floor(i),s=Math.floor(s);const f=[],p=[],m=[],g=[];let y=0;const M=[],x=n/2;let _=0;w(),a===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(f),this.setAttribute("position",new Ze(p,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(g,2));function w(){const T=new D,U=new D;let R=0;const L=(t-e)/n;for(let F=0;F<=s;F++){const C=[],A=F/s,N=A*(t-e)+e;for(let Z=0;Z<=i;Z++){const q=Z/i,K=q*u+c,ce=Math.sin(K),Q=Math.cos(K);U.x=N*ce,U.y=-A*n+x,U.z=N*Q,p.push(U.x,U.y,U.z),T.set(ce,L,Q).normalize(),m.push(T.x,T.y,T.z),g.push(q,1-A),C.push(y++)}M.push(C)}for(let F=0;F<i;F++)for(let C=0;C<s;C++){const A=M[C][F],N=M[C+1][F],Z=M[C+1][F+1],q=M[C][F+1];(e>0||C!==0)&&(f.push(A,N,q),R+=3),(t>0||C!==s-1)&&(f.push(N,Z,q),R+=3)}h.addGroup(_,R,0),_+=R}function E(T){const U=y,R=new ue,L=new D;let F=0;const C=T===!0?e:t,A=T===!0?1:-1;for(let Z=1;Z<=i;Z++)p.push(0,x*A,0),m.push(0,A,0),g.push(.5,.5),y++;const N=y;for(let Z=0;Z<=i;Z++){const K=Z/i*u+c,ce=Math.cos(K),Q=Math.sin(K);L.x=C*Q,L.y=x*A,L.z=C*ce,p.push(L.x,L.y,L.z),m.push(0,A,0),R.x=ce*.5+.5,R.y=Q*.5*A+.5,g.push(R.x,R.y),y++}for(let Z=0;Z<i;Z++){const q=U+Z,K=N+Z;T===!0?f.push(K,K+1,q):f.push(K+1,K,q),F+=3}h.addGroup(_,F,T===!0?1:2),_+=F}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ho(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class yh extends Ho{constructor(e=1,t=1,n=32,i=1,s=!1,a=0,c=Math.PI*2){super(0,e,t,n,i,s,a,c),this.type="C
3844oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:c}}static fromJSON(e){return new yh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Xr extends xt{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],a=[];c(i),h(n),f(),this.setAttribute("position",new Ze(s,3)),this.setAttribute("normal",new Ze(s.slice(),3)),this.setAttribute("uv",new Ze(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function c(w){const E=new D,T=new D,U=new D;for(let R=0;R<t.length;R+=3)g(t[R+0],E),g(t[R+1],T),g(t[R+2],U),u(E,T,U,w)}function u(w,E,T,U){const R=U+1,L=[];for(let F=0;F<=R;F++){L[F]=[];const C=w.clone().lerp(T,F/R),A=E.clone().lerp(T,F/R),N=R-F;for(let Z=0;Z<=N;Z++)Z===0&&F===R?L[F][Z]=C:L[F][Z]=C.clone().lerp(A,Z/N)}for(let F=0;F<R;F++)for(let C=0;C<2*(R-F)-1;C++){const A=Math.floor(C/2);C%2===0?(m(L[F][A+1]),m(L[F+1][A]),m(L[F][A])):(m(L[F][A+1]),m(L[F+1][A+1]),m(L[F+1][A]))}}function h(w){const E=new D;for(let T=0;T<s.length;T+=3)E.x=s[T+0],E.y=s[T+1],E.z=s[T+2],E.normalize().multiplyScalar(w),s[T+0]=E.x,s[T+1]=E.y,s[T+2]=E.z}function f(){const w=new D;for(let E=0;E<s.length;E+=3){w.x=s[E+0],w.y=s[E+1],w.z=s[E+2];const T=x(w)/2/Math.PI+.5,U=_(w)/Math.PI+.5;a.push(T,1-U)}y(),p()}function p(){for(let w=0;w<a.length;w+=6){const E=a[w+0],T=a[w+2],U=a[w+4],R=Math.max(E,T,U),L=Math.min(E,T,U);R>.9&&L<.1&&(E<.2&&(a[w+0]+=1),T<.2&&(a[w+2]+=1),U<.2&&(a[w+4]+=1))}}function m(w){s.push(w.x,w.y,w.z)}function g(w,E){const T=w*3;E.x=e[T+0],E.y=e[T+1],E.z=e[T+2]}function y(){const w=new D,E=new D,T=new D,U=new D,R=new ue,L=new ue,F=new ue;for(let C=0,A=0;C<s.length;C+=9,A+=6){w.set(s[C+0],s[C+1],s[C+2]),E.set(s[C+3],s[C+4],s[C+5]),T.set(s[C+6],s[C+7],s[C+8]),R.set(a[A+0],a[A+1]),L.set(a[A+2],a[A+3]),F.set(a[A+4],a[A+5]),U.copy(w).add(E).add(T).divideScalar(3);const N=x(U);
vendor: 129,291 bytes, line 3844
3844M(R,A+0,w,N),M(L,A+2,E,N),M(F,A+4,T,N)}}function M(w,E,T,U){U<0&&w.x===1&&(a[E]=w.x-1),T.x===0&&T.z===0&&(a[E]=U/2/Math.PI+.5)}function x(w){return Math.atan2(w.z,-w.x)}function _(w){return Math.atan2(-w.y,Math.sqrt(w.x*w.x+w.z*w.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xr(e.vertices,e.indices,e.radius,e.details)}}class xh extends Xr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new xh(e.radius,e.detail)}}const Wc=new D,Xc=new D,Md=new D,Yc=new Jn;class iy extends xt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(As*t),a=e.getIndex(),c=e.getAttribute("position"),u=a?a.count:c.count,h=[0,0,0],f=["a","b","c"],p=new Array(3),m={},g=[];for(let y=0;y<u;y+=3){a?(h[0]=a.getX(y),h[1]=a.getX(y+1),h[2]=a.getX(y+2)):(h[0]=y,h[1]=y+1,h[2]=y+2);const{a:M,b:x,c:_}=Yc;if(M.fromBufferAttribute(c,h[0]),x.fromBufferAttribute(c,h[1]),_.fromBufferAttribute(c,h[2]),Yc.getNormal(Md),p[0]=`${Math.round(M.x*i)},${Math.round(M.y*i)},${Math.round(M.z*i)}`,p[1]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,p[2]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,!(p[0]===p[1]||p[1]===p[2]||p[2]===p[0]))for(let w=0;w<3;w++){const E=(w+1)%3,T=p[w],U=p[E],R=Yc[f[w]],L=Yc[f[E]],F=`${T}_${U}`,C=`${U}_${T}`;C in m&&m[C]?(Md.dot(m[C].normal)<=s&&(g.push(R.x,R.y,R.z),g.push(L.x,L.y,L.z)),m[C]=null):F in m||(m[F]={index0:h[w],index1:h[E],normal:Md.clone()})}}for(const y in m)if(m[y]){const{index0:M,index1:x}=m[y];Wc.fromBufferAttribute(c,M),Xc.fromBufferAttribute(c,x),g.push(Wc.x,Wc.y,Wc.z),g.push(Xc.x,Xc.y,Xc.z)}this.setAttribute("position",new Ze(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Rs extends Wa{constructor(e){super(e),this.uuid=oi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Wa().fromJSON(i))}return this}}const Kb={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=ry(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let c,u,h,f,p,m,g;if(n&&(s=nA(r,e,s,t)),r.length>80*t){c=h=r[0],u=f=r[1];for(let y=t;y<i;y+=t)p=r[y],m=r[y+1],p<c&&(c=p),m<u&&(u=m),p>h&&(h=p),m>f&&(f=m);g=Math.max(h-c,f-u),g=g!==0?32767/g:0}return Xa(s,a,t,c,u,g,0),a}};function ry(r,e,t,n,i){let s,a;if(i===dA(r,e,t,n)>0)for(s=e;s<t;s+=n)a=V0(s,r[s],r[s+1],a);else for(s=t-n;s>=e;s-=n)a=V0(s,r[s],r[s+1],a);return a&&Sh(a,a.next)&&(qa(a),a=a.next),a}function Us(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Sh(t,t.next)||qt(t.prev,t,t.next)===0)){if(qa(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Xa(r,e,t,n,i,s,a){if(!r)return;!a&&s&&aA(r,n,i,s);let c=r,u,h;for(;r.prev!==r.next;){if(u=r.prev,h=r.next,s?$b(r,n,i,s):Qb(r)){e.push(u.i/t|0),e.push(r.i/t|0),e.push(h.i/t|0),qa(r),r=h.next,c=h.next;continue}if(r=h,r===c){a?a===1?(r=eA(Us(r),e,t),Xa(r,e,t,n,i,s,2)):a===2&&tA(r,e,t,n,i,s):Xa(Us(r),e,t,n,i,s,1);break}}}function Qb(r){const e=r.prev,t=r,n=r.next;if(qt(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,c=e.y,u=t.y,h=n.y,f=i<s?i<a?i:a:s<a?s:a,p=c<u?c<h?c:h:u<h?u:h,m=i>s?i>a?i:a:s>a?s:a,g=c>u?c>h?c:h:u>h?u:h;let y=n.next;for(;y!==e;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&Co(i,c,s,u,a,h,y.x,y.y)&&qt(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function $b(r,e,t,n){const i=r.prev,s=r,a=r.next;if(qt(i,s,a)>=0)return!1;const c=i.x,u=s.x,h=a.x,f=i.y,p=s.y,m=a.y,g=c<u?c<h?c:h:u<h?u:h,y=f<p?f<m?f:m:p<m?p:m,M=c>u?c>h?c:h:u>h?u:h,x=f>p?f>m?f:m:p>m?p:m,_=jd(g,y,e,t,n),w=jd(M,x,e,t,n);let E=r.prevZ,T=r.nextZ;for(;E&&E.z>=_&&T&&T.z<=w;){if(E.x>=g&&E.x<=M&&E.y>=y&&E.y<=x&&E!==i&&E!==a&&Co(c,f,u,p,h,m,E.x,E.y)&&qt(E.prev,E,E.next)>=0||(E=E.prevZ,T.x>=g&&T.x<=M&&T.y>=y&&T.y<=x&&T!==i&&T!==a&&Co(c,f,u,p,h,m,T.x,T.y)&&qt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;E&&E.z>=_;){if(E.x>=g&&E.x<=M&&E.y>=y&&E.y<=x&&E!==i&&E!==a&&Co(c,f,u,p,h,m,E.x,E.y)&&qt(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;T&&T.z<=w;){if(T.x>=g&&T.x<=M&&T.y>=y&&T.y<=x&&T!==i&&T!==a&&Co(c,f,u,p,h,m,T.x,T.y)&&qt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function eA(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!Sh(i,s)&&sy(i,n,n.next,s)&&Ya(i,s)&&Ya(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),qa(n),qa(n.next),n=r=s),n=n.next}while(n!==r);return Us(n)}function tA(r,e,t,n,i,s){let a=r;do{let c=a.next.next;for(;c!==a.prev;){if(a.i!==c.i&&uA(a,c)){let u=oy(a,c);a=Us(a,a.next),u=Us(u,u.next),Xa(a,e,t,n,i,s,0),Xa(u,e,t,n,i,s,0);return}c=c.next}a=a.next}while(a!==r)}function nA(r,e,t,n){const i=[];let s,a,c,u,h;for(s=0,a=e.length;s<a;s++)c=e[s]*n,u=s<a-1?e[s+1]*n:r.length,h=ry(r,c,u,n,!1),h===h.next&&(h.steiner=!0),i.push(cA(h));for(i.sort(iA),s=0;s<i.length;s++)t=rA(i[s],t);return t}function iA(r,e){return r.x-e.x}function rA(r,e){const t=sA(r,e);if(!t)return e;const n=oy(t,r);return Us(n,n.next),Us(t,t.next)}function sA(r,e){let t=e,n=-1/0,i;const s=r.x,a=r.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){const m=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(m<=s&&m>n&&(n=m,i=t.x<t.next.x?t:t.next,m===s))return i}t=t.next}while(t!==e);if(!i)return null;const c=i,u=i.x,h=i.y;let f=1/0,p;t=i;do s>=t.x&&t.x>=u&&s!==t.x&&Co(a<h?s:n,a,u,h,a<h?n:s,a,t.x,t.y)&&(p=Math.abs(a-t.y)/(s-t.x),Ya(t,r)&&(p<f||p===f&&(t.x>i.x||t.x===i.x&&oA(i,t)))&&(i=t,f=p)),t=t.next;while(t!==c);return i}function oA(r,e){return qt(r.prev,r,e.prev)<0&&qt(e.next,r,r.next)<0}function aA(r,e,t,n){let i=r;do i.z===0&&(i.z=jd(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,lA(i)}function lA(r){let e,t,n,i,s,a,c,u,h=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,c=0,e=0;e<h&&(c++,n=n.nextZ,!!n);e++);for(u=h;c>0||u>0&&n;)c!==0&&(u===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,c--):(i=n,n=n.nextZ,u--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,h*=2}while(a>1);return r}function jd(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function cA(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Co(r,e,t,n,i,s,a,c){return(i-a)*(e-c)>=(r-a)*(s-c)&&(r-a)*(n-c)>=(t-a)*(e-c)&&(t-a)*(s-c)>=(i-a)*(n-c)}function uA(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!hA(r,e)&&(Ya(r,e)&&Ya(e,r)&&fA(r,e)&&(qt(r.prev,r,e.prev)||qt(r,e.prev,e))||Sh(r,e)&&qt(r.prev,r,r.next)>0&&qt(e.prev,e,e.next)>0)}function qt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Sh(r,e){return r.x===e.x&&r.y===e.y}function sy(r,e,t,n){const i=Zc(qt(r,e,t)),s=Zc(qt(r,e,n)),a=Zc(qt(t,n,r)),c=Zc(qt(t,n,e));return!!(i!==s&&a!==c||i===0&&qc(r,t,e)||s===0&&qc(r,n,e)||a===0&&qc(t,r,n)||c===0&&qc(t,e,n))}function qc(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Zc(r){return r>0?1:r<0?-1:0}function hA(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&sy(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ya(r,e){return qt(r.prev,r,r.next)<0?qt(r,e,r.next)>=0&&qt(r,r.prev,e)>=0:qt(r,e,r.prev)<0||qt(r,r.next,e)<0}function fA(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function oy(r,e){const t=new Jd(r.i,r.x,r.y),n=new Jd(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function V0(r,e,t,n){const i=new Jd(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function qa(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Jd(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function dA(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class ji{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return ji.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];H0(e),G0(n,e);let a=e.length;t.forEach(H0);for(let u=0;u<t.length;u++)i.push(a),a+=t[u].length,G0(n,t[u]);const c=Kb.triangulate(n,i);for(let u=0;u<c.length;u+=3)s.push(c.slice(u,u+3));return s}}function H0(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function G0(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Mh extends xt{constructor(e=new Rs([new ue(.5,.5),new ue(-.5,.5),new ue(-.5,-.5),new ue(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let c=0,u=e.length;c<u;c++){const h=e[c];a(h)}this.setAttribute("position",new Ze(i,3)),this.setAttribute("uv",new Ze(s,2)),this.computeVertexNormals();function a(c){const u=[],h=t.curveSegments!==void 0?t.curveSegments:12,f=t.steps!==void 0?t.steps:1,p=t.depth!==void 0?t.depth:1;let m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:g-.1,M=t.bevelOffset!==void 0?t.bevelOffset:0,x=t.bevelSegments!==void 0?t.bevelSegments:3;const _=t.extrudePath,w=t.UVGenerator!==void 0?t.UVGenerator:pA;let E,T=!1,U,R,L,F;_&&(E=_.getSpacedPoints(f),T=!0,m=!1,U=_.computeFrenetFrames(f,!1),R=new D,L=new D,F=new D),m||(x=0,g=0,y=0,M=0);const C=c.extractPoints(h);let A=C.shape;const N=C.holes;if(!ji.isClockWise(A)){A=A.reverse();for(let pe=0,ge=N.length;pe<ge;pe++){const z=N[pe];ji.isClockWise(z)&&(N[pe]=z.reverse())}}const q=ji.triangulateShape(A,N),K=A;for(let pe=0,ge=N.length;pe<ge;pe++){const z=N[pe];A=A.concat(z)}function ce(pe,ge,z){return ge||console.error("THREE.ExtrudeGeometry: vec does not exist"),pe.clone().addScaledVector(ge,z)}const Q=A.length,ve=q.length;function V(pe,ge,z){let Ke,ye,ze;const Te=pe.x-ge.x,it=pe.y-ge.y,De=z.x-pe.x,O=z.y-pe.y,P=Te*Te+it*it,j=Te*O-it*De;if(Math.abs(j)>Number.EPSILON){const ae=Math.sqrt(P),me=Math.sqrt(De*De+O*O),he=ge.x-it/ae,Ye=ge.y+Te/ae,be=z.x-O/me,ke=z.y+De/me,St=((be-he)*O-(ke-Ye)*De)/(Te*O-it*De);Ke=he+Te*St-pe.x,ye=Ye+it*St-pe.y;const xe=Ke*Ke+ye*ye;if(xe<=2)return new ue(Ke,ye);ze=Math.sqrt(xe/2)}else{let ae=!1;Te>Number.EPSILON?De>Number.EPSILON&&(ae=!0):Te<-Number.EPSILON?De<-Number.EPSILON&&(ae=!0):Math.sign(it)===Math.sign(O)&&(ae=!0),ae?(Ke=-it,ye=Te,ze=Math.sqrt(P)):(Ke=Te,ye=it,ze=Math.sqrt(P/2))}return new ue(Ke/ze,ye/ze)}const re=[];for(let pe=0,ge=K.length,z=ge-1,Ke=pe+1;pe<ge;pe++,z++,Ke++)z===ge&&(z=0),Ke===ge&&(Ke=0),re[pe]=V(K[pe],K[z],K[Ke]);const ie=[];let de,Re=re.concat();for(let pe=0,ge=N.length;pe<ge;pe++){const z=N[pe];de=[];for(let Ke=0,ye=z.length,ze=ye-1,Te=Ke+1;Ke<ye;Ke++,ze++,Te++)ze===ye&&(ze=0),Te===ye&&(Te=0),de[Ke]=V(z[Ke],z[ze],z[Te]);ie.push(de),Re=Re.concat(de)}for(let pe=0;pe<x;pe++){const ge=pe/x,z=g*Math.cos(ge*Math.PI/2),Ke=y*Math.sin(ge*Math.PI/2)+M;for(let ye=0,ze=K.length;ye<ze;ye++){const Te=ce(K[ye],re[ye],Ke);Me(Te.x,Te.y,-z)}for(let ye=0,ze=N.length;ye<ze;ye++){const Te=N[ye];de=ie[ye];for(let it=0,De=Te.length;it<De;it++){const O=ce(Te[it],de[it],Ke);Me(O.x,O.y,-z)}}}const Xe=y+M;for(let pe=0;pe<Q;pe++){const ge=m?ce(A[pe],Re[pe],Xe):A[pe];T?(L.copy(U.normals[0]).multiplyScalar(ge.x),R.copy(U.binormals[0]).multiplyScalar(ge.y),F.copy(E[0]).add(L).add(R),Me(F.x,F.y,F.z)):Me(ge.x,ge.y,0)}for(let pe=1;pe<=f;pe++)for(let ge=0;ge<Q;ge++){const z=m?ce(A[ge],Re[ge],Xe):A[ge];T?(L.copy(U.normals[pe]).multiplyScalar(z.x),R.copy(U.binormals[pe]).multiplyScalar(z.y),F.copy(E[pe]).add(L).add(R),Me(F.x,F.y,F.z)):Me(z.x,z.y,p/f*pe)}for(let pe=x-1;pe>=0;pe--){const ge=pe/x,z=g*Math.cos(ge*Math.PI/2),Ke=y*Math.sin(ge*Math.PI/2)+M;for(let ye=0,ze=K.length;ye<ze;ye++){const Te=ce(K[ye],re[ye],Ke);Me(Te.x,Te.y,p+z)}for(let ye=0,ze=N.length;ye<ze;ye++){const Te=N[ye];de=ie[ye];for(let it=0,De=Te.length;it<De;it++){const O=ce(Te[it],de[it],Ke);T?Me(O.x,O.y+E[f-1].y,E[f-1].x+z):Me(O.x,O.y,p+z)}}}se(),_e();function se(){const pe=i.length/3;if(m){let ge=0,z=Q*ge;for(let Ke=0;Ke<ve;Ke++){const ye=q[Ke];et(ye[2]+z,ye[1]+z,ye[0]+z)}ge=f+x*2,z=Q*ge;for(let Ke=0;Ke<ve;Ke++){const ye=q[Ke];et(ye[0]+z,ye[1]+z,ye[2]+z)}}else{for(let ge=0;ge<ve;ge++){const z=q[ge];et(z[2],z[1],z[0])}for(let ge=0;ge<ve;ge++){const z=q[ge];et(z[0]+Q*f,z[1]+Q*f,z[2]+Q*f)}}n.addGroup(pe,i.length/3-pe,0)}function _e(){const pe=i.length/3;let ge=0;Le(K,ge),ge+=K.length;for(let z=0,Ke=N.length;z<Ke;z++){const ye=N[z];Le(ye,ge),ge+=ye.length}n.addGroup(pe,i.length/3-pe,1)}function Le(pe,ge){let z=pe.length;for(;--z>=0;){const Ke=z;let ye=z-1;ye<0&&(ye=pe.length-1);for(let ze=0,Te=f+x*2;ze<Te;ze++){const it=Q*ze,De=Q*(ze+1),O=ge+Ke+it,P=ge+ye+it,j=ge+ye+De,ae=ge+Ke+De;lt(O,P,j,ae)}}}function Me(pe,ge,z){u.push(pe),u.push(ge),u.push(z)}function et(pe,ge,z){tt(pe),tt(ge),tt(z);const Ke=i.length/3,ye=w.generateTopUV(n,i,Ke-3,Ke-2,Ke-1);ft(ye[0]),ft(ye[1]),ft(ye[2])}function lt(pe,ge,z,Ke){tt(pe),tt(ge),tt(Ke),tt(ge),tt(z),tt(Ke);const ye=i.length/3,ze=w.generateSideWallUV(n,i,ye-6,ye-3,ye-2,ye-1);ft(ze[0]),ft(ze[1]),ft(ze[3]),ft(ze[1]),ft(ze[2]),ft(ze[3])}function tt(pe){i.push(u[pe*3+0]),i.push(u[pe*3+1]),i.push(u[pe*3+2])}function ft(pe){s.push(pe.x),s.push(pe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return mA(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const c=t[e.shapes[s]];n.push(c)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Ju[i.type]().fromJSON(i)),new Mh(n,e.options)}}const pA={generateTopUV:function(r,e,t,n,i){const s=e[t*3],a=e[t*3+1],c=e[n*3],u=e[n*3+1],h=e[i*3],f=e[i*3+1];return[new ue(s,a),new ue(c,u),new ue(h,f)]},generateSideWallUV:function(r,e,t,n,i,s){const a=e[t*3],c=e[t*3+1],u=e[t*3+2],h=e[n*3],f=e[n*3+1],p=e[n*3+2],m=e[i*3],g=e[i*3+1],y=e[i*3+2],M=e[s*3],x=e[s*3+1],_=e[s*3+2];return Math.abs(c-f)<Math.abs(a-h)?[new ue(a,1-u),new ue(h,1-p),new ue(m,1-y),new ue(M,1-_)]:[new ue(c,1-u),new ue(f,1-p),new ue(g,1-y),new ue(x,1-_)]}};function mA(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Eh extends Xr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Eh(e.radius,e.detail)}}class ol extends Xr{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ol(e.radius,e.detail)}}class wh extends xt{constructor(e=.5,t=1,n=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const c=[],u=[],h=[],f=[];let p=e;const m=(t-e)/i,g=new D,y=new ue;for(let M=0;M<=i;M++){for(let x=0;x<=n;x++){const _=s+x/n*a;g.x=p*Math.cos(_),g.y=p*Math.sin(_),u.push(g.x,g.y,g.z),h.push(0,0,1),y.x=(g.x/t+1)/2,y.y=(g.y/t+1)/2,f.push(y.x,y.y)}p+=m}for(let M=0;M<i;M++){const x=M*(n+1);for(let _=0;_<n;_++){const w=_+x,E=w,T=w+n+1,U=w+n+2,R=w+1;c.push(E,T,R),c.push(T,U,R)}}this.setIndex(c),this.setAttribute("position",new Ze(u,3)),this.setAttribute("normal",new Ze(h,3)),this.setAttribute("uv",new Ze(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wh(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Th extends xt{constructor(e=new Rs([new ue(0,.5),new ue(-.5,-.5),new ue(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let c=0,u=0;if(Array.isArray(e)===!1)h(e);else for(let f=0;f<e.length;f++)h(e[f]),this.addGroup(c,u,f),c+=u,u=0;this.setIndex(n),this.setAttribute("position",new Ze(i,3)),this.setAttribute("normal",new Ze(s,3)),this.setAttribute("uv",new Ze(a,2));function h(f){const p=i.length/3,m=f.extractPoints(t);let g=m.shape;const y=m.holes;ji.isClockWise(g)===!1&&(g=g.reverse());for(let x=0,_=y.length;x<_;x++){const w=y[x];ji.isClockWise(w)===!0&&(y[x]=w.reverse())}const M=ji.triangulateShape(g,y);for(let x=0,_=y.length;x<_;x++){const w=y[x];g=g.concat(w)}for(let x=0,_=g.length;x<_;x++){const w=g[x];i.push(w.x,w.y,0),s.push(0,0,1),a.push(w.x,w.y)}for(let x=0,_=M.length;x<_;x++){const w=M[x],E=w[0]+p,T=w[1]+p,U=w[2]+p;n.push(E,T,U),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return gA(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new Th(n,e.curveSegments)}}function gA(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class al extends xt{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:c},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(a+c,Math.PI);let h=0;const f=[],p=new D,m=new D,g=[],y=[],M=[],x=[];for(let _=0;_<=n;_++){const w=[],E=_/n;let T=0;_===0&&a===0?T=.5/t:_===n&&u===Math.PI&&(T=-.5/t);for(let U=0;U<=t;U++){const R=U/t;p.x=-e*Math.cos(i+R*s)*Math.sin(a+E*c),p.y=e*Math.cos(a+E*c),p.z=e*Math.sin(i+R*s)*Math.sin(a+E*c),y.push(p.x,p.y,p.z),m.copy(p).normalize(),M.push(m.x,m.y,m.z),x.push(R+T,1-E),w.push(h++)}f.push(w)}for(let _=0;_<n;_++)for(let w=0;w<t;w++){const E=f[_][w+1],T=f[_][w],U=f[_+1][w],R=f[_+1][w+1];(_!==0||a>0)&&g.push(E,T,R),(_!==n-1||u<Math.PI)&&g.push(T,U,R)}this.setIndex(g),this.setAttribute("position",new Ze(y,3)),this.setAttribute("normal",new Ze(M,3)),this.setAttribute("uv",new Ze(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new al(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class bh extends Xr{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new bh(e.radius,e.detail)}}class Ah extends xt{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],u=[],h=[],f=new D,p=new D,m=new D;for(let g=0;g<=n;g++)for(let y=0;y<=i;y++){const M=y/i*s,x=g/n*Math.PI*2;p.x=(e+t*Math.cos(x))*Math.cos(M),p.y=(e+t*Math.cos(x))*Math.sin(M),p.z=t*Math.sin(x),c.push(p.x,p.y,p.z),f.x=e*Math.cos(M),f.y=e*Math.sin(M),m.subVectors(p,f).normalize(),u.push(m.x,m.y,m.z),h.push(y/i),h.push(g/n)}for(let g=1;g<=n;g++)for(let y=1;y<=i;y++){const M=(i+1)*g+y-1,x=(i+1)*(g-1)+y-1,_=(i+1)*(g-1)+y,w=(i+1)*g+y;a.push(M,x,w),a.push(x,_,w)}this.setIndex(a),this.setAttribute("position",new Ze(c,3)),this.setAttribute("normal",new Ze(u,3)),this.setAttribute("uv",new Ze(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ah(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Ch extends xt{constructor(e=1,t=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const c=[],u=[],h=[],f=[],p=new D,m=new D,g=new D,y=new D,M=new D,x=new D,_=new D;for(let E=0;E<=n;++E){const T=E/n*s*Math.PI*2;w(T,s,a,e,g),w(T+.01,s,a,e,y),x.subVectors(y,g),_.addVectors(y,g),M.crossVectors(x,_),_.crossVectors(M,x),M.normalize(),_.normalize();for(let U=0;U<=i;++U){const R=U/i*Math.PI*2,L=-t*Math.cos(R),F=t*Math.sin(R);p.x=g.x+(L*_.x+F*M.x),p.y=g.y+(L*_.y+F*M.y),p.z=g.z+(L*_.z+F*M.z),u.push(p.x,p.y,p.z),m.subVectors(p,g).normalize(),h.push(m.x,m.y,m.z),f.push(E/n),f.push(U/i)}}for(let E=1;E<=n;E++)for(let T=1;T<=i;T++){const U=(i+1)*(E-1)+(T-1),R=(i+1)*E+(T-1),L=(i+1)*E+T,F=(i+1)*(E-1)+T;c.push(U,R,F),c.push(R,L,F)}this.setIndex(c),this.setAttribute("position",new Ze(u,3)),this.setAttribute("normal",new Ze(h,3)),this.setAttribute("uv",new Ze(f,2));function w(E,T,U,R,L){const F=Math.cos(E),C=Math.sin(E),A=U/T*E,N=Math.cos(A);L.x=R*(2+N)*.5*F,L.y=R*(2+N)*C*.5,L.z=R*Math.sin(A)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ch(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Rh extends xt{constructor(e=new Dp(new D(-1,-1,0),new D(-1,1,0),new D(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const c=new D,u=new D,h=new ue;let f=new D;const p=[],m=[],g=[],y=[];M(),this.setIndex(y),this.setAttribute("position",new Ze(p,3)),this.setAttribute("normal",new Ze(m,3)),this.setAttribute("uv",new Ze(g,2));function M(){for(let E=0;E<t;E++)x(E);x(s===!1?t:0),w(),_()}function x(E){f=e.getPointAt(E/t,f);const T=a.normals[E],U=a.binormals[E];for(let R=0;R<=i;R++){const L=R/i*Math.PI*2,F=Math.sin(L),C=-Math.cos(L);u.x=C*T.x+F*U.x,u.y=C*T.y+F*U.y,u.z=C*T.z+F*U.z,u.normalize(),m.push(u.x,u.y,u.z),c.x=f.x+n*u.x,c.y=f.y+n*u.y,c.z=f.z+n*u.z,p.push(c.x,c.y,c.z)}}function _(){for(let E=1;E<=t;E++)for(let T=1;T<=i;T++){const U=(i+1)*(E-1)+(T-1),R=(i+1)*E+(T-1),L=(i+1)*E+T,F=(i+1)*(E-1)+T;y.push(U,R,F),y.push(R,L,F)}}function w(){for(let E=0;E<=t;E++)for(let T=0;T<=i;T++)h.x=E/t,h.y=T/i,g.push(h.x,h.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Rh(new Ju[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Np extends xt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new D,s=new D;if(e.index!==null){const a=e.attributes.position,c=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:c.count,materialIndex:0}]);for(let h=0,f=u.length;h<f;++h){const p=u[h],m=p.start,g=p.count;for(let y=m,M=m+g;y<M;y+=3)for(let x=0;x<3;x++){const _=c.getX(y+x),w=c.getX(y+(x+1)%3);i.fromBufferAttribute(a,_),s.fromBufferAttribute(a,w),W0(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let c=0,u=a.count/3;c<u;c++)for(let h=0;h<3;h++){const f=3*c+h,p=3*c+(h+1)%3;i.fromBufferAttribute(a,f),s.fromBufferAttribute(a,p),W0(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ze(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function W0(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var X0=Object.freeze({__proto__:null,BoxGeometry:Fs,CapsuleGeometry:vh,CircleGeometry:_h,ConeGeometry:yh,CylinderGeometry:Ho,DodecahedronGeometry:xh,EdgesGeometry:iy,ExtrudeGeometry:Mh,IcosahedronGeometry:Eh,LatheGeometry:sl,OctahedronGeometry:ol,PlaneGeometry:ko,PolyhedronGeometry:Xr,RingGeometry:wh,ShapeGeometry:Th,SphereGeometry:al,TetrahedronGeometry:bh,TorusGeometry:Ah,TorusKnotGeometry:Ch,TubeGeometry:Rh,WireframeGeometry:Np});class ay extends Nn{static get type(){return"ShadowMaterial"}constructor(e){super(),this.isShadowMaterial=!0,this.color=new Ve(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class ly extends _i{static get type(){return"RawShaderMaterial"}constructor(e){super(e),this.isRawShaderMaterial=!0}}class Op extends Nn{static get type(){return"MeshStandardMaterial"}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.color=new Ve(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ai,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class cy extends Op{static get type(){return"MeshPhysicalMaterial"}constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ve(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ve(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ve(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class uy extends Nn{static get type(){return"MeshPhongMaterial"}constructor(e){super(),this.isMeshPhongMaterial=!0,this.color=new Ve(16777215),this.specular=new Ve(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ai,this.combine=$a,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hy extends Nn{static get type(){return"MeshToonMaterial"}constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.color=new Ve(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class fy extends Nn{static get type(){return"MeshNormalMaterial"}constructor(e){super(),this.isMeshNormalMaterial=!0,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class dy extends Nn{static get type(){return"MeshLambertMaterial"}constructor(e){super(),this.isMeshLambertMaterial=!0,this.color=new Ve(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ai,this.combine=$a,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class py extends Nn{static get type(){return"MeshMatcapMaterial"}constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.color=new Ve(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Gr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class my extends Gn{static get type(){return"LineDashedMaterial"}constructor(e){super(),this.isLineDashedMaterial=!0,this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function ws(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function gy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function vy(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function Kd(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const c=t[s]*e;for(let u=0;u!==e;++u)i[a++]=r[c+u]}return i}function Fp(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}function vA(r,e,t,n,i=30){const s=r.clone();s.name=e;const a=[];for(let u=0;u<s.tracks.length;++u){const h=s.tracks[u],f=h.getValueSize(),p=[],m=[];for(let g=0;g<h.times.length;++g){const y=h.times[g]*i;if(!(y<t||y>=n)){p.push(h.times[g]);for(let M=0;M<f;++M)m.push(h.values[g*f+M])}}p.length!==0&&(h.times=ws(p,h.times.constructor),h.values=ws(m,h.values.constructor),a.push(h))}s.tracks=a;let c=1/0;for(let u=0;u<s.tracks.length;++u)c>s.tracks[u].times[0]&&(c=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*c);return s.resetDuration(),s}function _A(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let a=0;a<i;++a){const c=t.tracks[a],u=c.ValueTypeName;if(u==="bool"||u==="string")continue;const h=r.tracks.find(function(_){return _.name===c.name&&_.ValueTypeName===u});if(h===void 0)continue;let f=0;const p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=p/3);let m=0;const g=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=g/3);const y=c.times.length-1;let M;if(s<=c.times[0]){const _=f,w=p-f;M=c.values.slice(_,w)}else if(s>=c.times[y]){const _=y*p+f,w=_+p-f;M=c.values.slice(_,w)}else{const _=c.createInterpolant(),w=f,E=p-f;_.evaluate(s),M=_.resultBuffer.slice(w,E)}u==="quaternion"&&new Un().fromArray(M).normalize().conjugate().toArray(M);const x=h.times.length;for(let _=0;_<x;++_){const w=_*g+m;if(u==="quaternion")Un.multiplyQuaternionsFlat(h.values,w,M,0,h.values,w);else{const E=g-m*2;for(let T=0;T<E;++T)h.values[w+T]-=M[T]}}}return r.blendMode=mp,r}const yA={convertArray:ws,isTypedArray:gy,getKeyframeOrder:vy,sortedArray:Kd,flattenJSON:Fp,subclip:vA,makeClipAdditive:_A};class ll{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let c=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const c=t[1];e<c&&(n=2,s=c);for(let u=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const c=n+a>>>1;e<t[c]?a=c:n=c+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class _y extends ll{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ss,endingEnd:Ss}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,c=i[s],u=i[a];if(c===void 0)switch(this.getSettings_().endingStart){case Ms:s=e,c=2*t-n;break;case ka:s=i.length-2,c=t+i[s]-i[s+1];break;default:s=e,c=n}if(u===void 0)switch(this.getSettings_().endingEnd){case Ms:a=e,u=2*n-t;break;case ka:a=1,u=n+i[1]-i[0];break;default:a=e-1,u=t}const h=(n-t)*.5,f=this.valueSize;this._weightPrev=h/(t-c),this._weightNext=h/(u-n),this._offsetPrev=s*f,this._offsetNext=a*f}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,f=this._offsetPrev,p=this._offsetNext,m=this._weightPrev,g=this._weightNext,y=(n-t)/(i-t),M=y*y,x=M*y,_=-m*x+2*m*M-m*y,w=(1+m)*x+(-1.5-2*m)*M+(-.5+m)*y+1,E=(-1-g)*x+(1.5+g)*M+.5*y,T=g*x-g*M;for(let U=0;U!==c;++U)s[U]=_*a[f+U]+w*a[h+U]+E*a[u+U]+T*a[p+U];return s}}class Bp extends ll{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,f=(n-t)/(i-t),p=1-f;for(let m=0;m!==c;++m)s[m]=a[h+m]*p+a[u+m]*f;return s}}class yy extends ll{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Pi{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ws(t,this.TimeBufferType),this.values=ws(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ws(e.times,Array),values:ws(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new yy(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Bp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new _y(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case za:t=this.InterpolantFactoryMethodDiscrete;break;case Yu:t=this.InterpolantFactoryMethodLinear;break;case lu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return za;case this.InterpolantFactoryMethodLinear:return Yu;case this.InterpolantFactoryMethodSmooth:return lu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const c=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*c,a*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let c=0;c!==s;c++){const u=n[c];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,c,u),e=!1;break}if(a!==null&&a>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,c,u,a),e=!1;break}a=u}if(i!==void 0&&gy(i))for(let c=0,u=i.length;c!==u;++c){const h=i[c];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,c,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===lu,s=e.length-1;let a=1;for(let c=1;c<s;++c){let u=!1;const h=e[c],f=e[c+1];if(h!==f&&(c!==1||h!==e[0]))if(i)u=!0;else{const p=c*n,m=p-n,g=p+n;for(let y=0;y!==n;++y){const M=t[p+y];if(M!==t[m+y]||M!==t[g+y]){u=!0;break}}}if(u){if(c!==a){e[a]=e[c];const p=c*n,m=a*n;for(let g=0;g!==n;++g)t[m+g]=t[p+g]}++a}}if(s>0){e[a]=e[s];for(let c=s*n,u=a*n,h=0;h!==n;++h)t[u+h]=t[c+h];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Pi.prototype.TimeBufferType=Float32Array;Pi.prototype.ValueBufferType=Float32Array;Pi.prototype.DefaultInterpolation=Yu;class Bs extends Pi{constructor(e,t,n){super(e,t,n)}}Bs.prototype.ValueTypeName="bool";Bs.prototype.ValueBufferType=Array;Bs.prototype.DefaultInterpolation=za;Bs.prototype.InterpolantFactoryMethodLinear=void 0;Bs.prototype.InterpolantFactoryMethodSmooth=void 0;class zp extends Pi{}zp.prototype.ValueTypeName="color";class Za extends Pi{}Za.prototype.ValueTypeName="number";class xy extends ll{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=(n-t)/(i-t);let h=e*c;for(let f=h+c;h!==f;h+=4)Un.slerpFlat(s,0,a,h-c,a,h,u);return s}}class cl extends Pi{InterpolantFactoryMethodLinear(e){return new xy(this.times,this.values,this.getValueSize(),e)}}cl.prototype.ValueTypeName="quaternion";cl.prototype.InterpolantFactoryMethodSmooth=void 0;class zs extends Pi{constructor(e,t,n){super(e,t,n)}}zs.prototype.ValueTypeName="string";zs.prototype.ValueBufferType=Array;zs.prototype.DefaultInterpolation=za;zs.prototype.InterpolantFactoryMethodLinear=void 0;zs.prototype.InterpolantFactoryMethodSmooth=void 0;class ja extends Pi{}ja.prototype.ValueTypeName="vector";class Ja{constructor(e="",t=-1,n=[],i=lh){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=oi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,c=n.length;a!==c;++a)t.push(SA(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(Pi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let c=0;c<s;c++){let u=[],h=[];u.push((c+s-1)%s,c,(c+1)%s),h.push(0,1,0);const f=vy(u);u=Kd(u,1,f),h=Kd(h,1,f),!i&&u[0]===0&&(u.push(s),h.push(h[0])),a.push(new Za(".morphTargetInfluences["+t[c].name+"]",u,h).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.name.match(s);if(f&&f.length>1){const p=f[1];let m=i[p];m||(i[p]=m=[]),m.push(h)}}const a=[];for(const c in i)a.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(p,m,g,y,M){if(g.length!==0){const x=[],_=[];Fp(g,x,_,y),x.length!==0&&M.push(new p(m,x,_))}},i=[],s=e.name||"default",a=e.fps||30,c=e.blendMode;let u=e.length||-1;const h=e.hierarchy||[];for(let p=0;p<h.length;p++){const m=h[p].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const g={};let y;for(y=0;y<m.length;y++)if(m[y].morphTargets)for(let M=0;M<m[y].morphTargets.length;M++)g[m[y].morphTargets[M]]=-1;for(const M in g){const x=[],_=[];for(let w=0;w!==m[y].morphTargets.length;++w){const E=m[y];x.push(E.time),_.push(E.morphTarget===M?1:0)}i.push(new Za(".morphTargetInfluence["+M+"]",x,_))}u=g.length*a}else{const g=".bones["+t[p].name+"]";n(ja,g+".position",m,"pos",i),n(cl,g+".quaternion",m,"rot",i),n(ja,g+".scale",m,"scl",i)}}return i.length===0?null:new this(s,u,i,c)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function xA(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Za;case"vector":case"vector2":case"vector3":case"vector4":return ja;case"color":return zp;case"quaternion":return cl;case"bool":case"boolean":return Bs;case"string":return zs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function SA(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=xA(r.type);if(r.times===void 0){const t=[],n=[];Fp(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const pr={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class kp{constructor(e,t,n){const i=this;let s=!1,a=0,c=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(f){c++,s===!1&&i.onStart!==void 0&&i.onStart(f,a,c),s=!0},this.itemEnd=function(f){a++,i.onProgress!==void 0&&i.onProgress(f,a,c),a===c&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(f){i.onError!==void 0&&i.onError(f)},this.resolveURL=function(f){return u?u(f):f},this.setURLModifier=function(f){return u=f,this},this.addHandler=function(f,p){return h.push(f,p),this},this.removeHandler=function(f){const p=h.indexOf(f);return p!==-1&&h.splice(p,2),this},this.getHandler=function(f){for(let p=0,m=h.length;p<m;p+=2){const g=h[p],y=h[p+1];if(g.global&&(g.lastIndex=0),g.test(f))return y}return null}}}const Sy=new kp;class Qn{constructor(e){this.manager=e!==void 0?e:Sy,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Qn.DEFAULT_MATERIAL_NAME="__DEFAULT";const cr={};class MA extends Error{constructor(e,t){super(e),this.response=t}}class xr extends Qn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=pr.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(cr[e]!==void 0){cr[e].push({onLoad:t,onProgress:n,onError:i});return}cr[e]=[],cr[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),c=this.mimeType,u=this.responseType;fetch(a).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const f=cr[e],p=h.body.getReader(),m=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),g=m?parseInt(m):0,y=g!==0;let M=0;const x=new ReadableStream({start(_){w();function w(){p.read().then(({done:E,value:T})=>{if(E)_.close();else{M+=T.byteLength;const U=new ProgressEvent("progress",{lengthComputable:y,loaded:M,total:g});for(let R=0,L=f.length;R<L;R++){const F=f[R];F.onProgress&&F.onProgress(U)}_.enqueue(T),w()}},E=>{_.error(E)})}}});return new Response(x)}else throw new MA(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(u){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(f=>new DOMParser().parseFromString(f,c));case"json":return h.json();default:if(c===void 0)return h.text();{const p=/charset="?([^;"\s]*)"?/i.exec(c),m=p&&p[1]?p[1].toLowerCase():void 0,g=new TextDecoder(m);return h.arrayBuffer().then(y=>g.decode(y))}}}).then(h=>{pr.add(e,h);const f=cr[e];delete cr[e];for(let p=0,m=f.length;p<m;p++){const g=f[p];g.onLoad&&g.onLoad(h)}}).catch(h=>{const f=cr[e];if(f===void 0)throw this.manager.itemError(e),h;delete cr[e];for(let p=0,m=f.length;p<m;p++){const g=f[p];g.onError&&g.onError(h)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class EA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new xr(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Ja.parse(e[n]);t.push(i)}return t}}class wA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=[],c=new mh,u=new xr(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(s.withCredentials);let h=0;function f(p){u.load(e[p],function(m){const g=s.parse(m,!0);a[p]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},h+=1,h===6&&(g.mipmapCount===1&&(c.minFilter=cn),c.image=a,c.format=g.format,c.needsUpdate=!0,t&&t(c))},n,i)}if(Array.isArray(e))for(let p=0,m=e.length;p<m;++p)f(p);else u.load(e,function(p){const m=s.parse(p,!0);if(m.isCubemap){const g=m.mipmaps.length/m.mipmapCount;for(let y=0;y<g;y++){a[y]={mipmaps:[]};for(let M=0;M<m.mipmapCount;M++)a[y].mipmaps.push(m.mipmaps[y*m.mipmapCount+M]),a[y].format=m.format,a[y].width=m.width,a[y].height=m.height}c.image=a}else c.image.width=m.width,c.image.height=m.height,c.mipmaps=m.mipmaps;m.mipmapCount===1&&(c.minFilter=cn),c.format=m.format,c.needsUpdate=!0,t&&t(c)},n,i);return c}}class Ka extends Qn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=pr.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const c=Ga("img");function u(){f(),pr.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(p){f(),i&&i(p),s.manager.itemError(e),s.manager.itemEnd(e)}function f(){c.removeEventListener("load",u,!1),c.removeEventListener("error",h,!1)}return c.addEventListener("load",u,!1),c.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(c.crossOrigin=this.crossOrigin),s.manager.itemStart(e),c.src=e,c}}class TA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=new il;s.colorSpace=jn;const a=new Ka(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let c=0;function u(h){a.load(e[h],function(f){s.images[h]=f,c++,c===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let h=0;h<e.length;++h)u(h);return s}}class bA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Zi,c=new xr(this.manager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(s.withCredentials),c.load(e,function(u){let h;try{h=s.parse(u)}catch(f){if(i!==void 0)i(f);else{console.error(f);return}}h.image!==void 0?a.image=h.image:h.data!==void 0&&(a.image.width=h.width,a.image.height=h.height,a.image.data=h.data),a.wrapS=h.wrapS!==void 0?h.wrapS:vi,a.wrapT=h.wrapT!==void 0?h.wrapT:vi,a.magFilter=h.magFilter!==void 0?h.magFilter:cn,a.minFilter=h.minFilter!==void 0?h.minFilter:cn,a.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(a.colorSpace=h.colorSpace),h.flipY!==void 0&&(a.flipY=h.flipY),h.format!==void 0&&(a.format=h.format),h.type!==void 0&&(a.type=h.type),h.mipmaps!==void 0&&(a.mipmaps=h.mipmaps,a.minFilter=Xi),h.mipmapCount===1&&(a.minFilter=cn),h.generateMipmaps!==void 0&&(a.generateMipmaps=h.generateMipmaps),a.needsUpdate=!0,t&&t(a,h)},n,i),a}}class AA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=new Kt,a=new Ka(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(c){s.image=c,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class Yr extends Dt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ve(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class My extends Yr{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Dt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ve(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Ed=new ut,Y0=new D,q0=new D;class Vp{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ue(512,512),this.map=null,this.mapPass=null,this.matrix=new ut,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new rl,this._frameExtents=new ue(1,1),this._viewportCount=1,this._viewports=[new bt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Y0.setFromMatrixPosition(e.matrixWorld),t.position.copy(Y0),q0.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(q0),t.updateMatrixWorld(),Ed.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ed),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ed)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class CA extends Vp{constructor(){super(new tn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=Do*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Ey extends Yr{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Dt.DEFAULT_UP),this.updateMatrix(),this.target=new Dt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new CA}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Z0=new ut,ya=new D,wd=new D;class RA extends Vp{constructor(){super(new tn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ue(4,2),this._viewportCount=6,this._viewports=[new bt(2,1,1,1),new bt(0,1,1,1),new bt(3,1,1,1),new bt(1,1,1,1),new bt(3,0,1,1),new bt(1,0,1,1)],this._cubeDirections=[new D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),ya.setFromMatrixPosition(e.matrixWorld),n.position.copy(ya),wd.copy(n.position),wd.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(wd),n.updateMatrixWorld(),i.makeTranslation(-ya.x,-ya.y,-ya.z),Z0.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Z0)}}class wy extends Yr{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new RA}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class PA extends Vp{constructor(){super(new kr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Ty extends Yr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Dt.DEFAULT_UP),this.updateMatrix(),this.target=new Dt,this.shadow=new PA}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class by extends Yr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ay extends Yr{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Cy{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new D)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class Ry extends Yr{constructor(e=new Cy,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Ph extends Qn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,a=new xr(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new Ve().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new Ve().setHex(a.value);break;case"v2":i.uniforms[s].value=new ue().fromArray(a.value);break;case"v3":i.uniforms[s].value=new D().fromArray(a.value);break;case"v4":i.uniforms[s].value=new bt().fromArray(a.value);break;case"m3":i.uniforms[s].value=new gt().fromArray(a.value);break;case"m4":i.uniforms[s].value=new ut().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new ue().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Ph.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:ay,SpriteMaterial:bp,RawShaderMaterial:ly,ShaderMaterial:_i,PointsMaterial:Cp,MeshPhysicalMaterial:cy,MeshStandardMaterial:Op,MeshPhongMaterial:uy,MeshToonMaterial:hy,MeshNormalMaterial:fy,MeshLambertMaterial:dy,MeshDepthMaterial:Ep,MeshDistanceMaterial:wp,MeshBasicMaterial:Wr,MeshMatcapMaterial:py,LineDashedMaterial:my,LineBasicMaterial:Gn,Material:Nn};return new t[e]}}class Qd{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Hp extends xt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Py extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new xr(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(g,y){if(t[y]!==void 0)return t[y];const x=g.interleavedBuffers[y],_=s(g,x.buffer),w=To(x.type,_),E=new dh(w,x.stride);return E.uuid=x.uuid,t[y]=E,E}function s(g,y){if(n[y]!==void 0)return n[y];const x=g.arrayBuffers[y],_=new Uint32Array(x).buffer;return n[y]=_,_}const a=e.isInstancedBufferGeometry?new Hp:new xt,c=e.data.index;if(c!==void 0){const g=To(c.type,c.array);a.setIndex(new zt(g,1))}const u=e.data.attributes;for(const g in u){const y=u[g];let M;if(y.isInterleavedBufferAttribute){const x=i(e.data,y.data);M=new si(x,y.itemSize,y.offset,y.normalized)}else{const x=To(y.type,y.array),_=y.isInstancedBufferAttribute?No:zt;M=new _(x,y.itemSize,y.normalized)}y.name!==void 0&&(M.name=y.name),y.usage!==void 0&&M.setUsage(y.usage),a.setAttribute(g,M)}const h=e.data.morphAttributes;if(h)for(const g in h){const y=h[g],M=[];for(let x=0,_=y.length;x<_;x++){const w=y[x];let E;if(w.isInterleavedBufferAttribute){const T=i(e.data,w.data);E=new si(T,w.itemSize,w.offset,w.normalized)}else{const T=To(w.type,w.array);E=new zt(T,w.itemSize,w.normalized)}w.name!==void 0&&(E.name=w.name),M.push(E)}a.morphAttributes[g]=M}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const p=e.data.groups||e.data.drawcalls||e.data.offsets;if(p!==void 0)for(let g=0,y=p.length;g!==y;++g){const M=p[g];a.addGroup(M.start,M.count,M.materialIndex)}const m=e.data.boundingSphere;if(m!==void 0){const g=new D;m.center!==void 0&&g.fromArray(m.center),a.boundingSphere=new yn(g,m.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class IA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?Qd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const c=new xr(this.manager);c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(u){let h=null;try{h=JSON.parse(u)}catch(p){i!==void 0&&i(p),console.error("THREE:ObjectLoader: Can't parse "+e+".",p.message);return}const f=h.metadata;if(f===void 0||f.type===void 0||f.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?Qd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new xr(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),c=JSON.parse(a),u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(c)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){t!==void 0&&t(h)}),c=this.parseTextures(e.textures,a),u=this.parseMaterials(e.materials,c),h=this.parseObject(e.object,s,u,c,n),f=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,f),this.bindLightTargets(h),t!==void 0){let p=!1;for(const m in a)if(a[m].data instanceof HTMLImageElement){p=!0;break}p===!1&&t(h)}return h}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),c=this.parseMaterials(e.materials,a),u=this.parseObject(e.object,i,c,a,t),h=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,h),this.bindLightTargets(u),u}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new Rs().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const c=new ph().fromJSON(e[s],i);n[c.uuid]=c}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Py;for(let s=0,a=e.length;s<a;s++){let c;const u=e[s];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":c=i.parse(u);break;default:u.type in X0?c=X0[u.type].fromJSON(u,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${u.type}"`)}c.uuid=u.uuid,u.name!==void 0&&(c.name=u.name),u.userData!==void 0&&(c.userData=u.userData),n[u.uuid]=c}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new Ph;s.setTextures(t);for(let a=0,c=e.length;a<c;a++){const u=e[a];n[u.uuid]===void 0&&(n[u.uuid]=s.parse(u)),i[u.uuid]=n[u.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=Ja.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function a(u){return n.manager.itemStart(u),s.load(u,function(){n.manager.itemEnd(u)},void 0,function(){n.manager.itemError(u),n.manager.itemEnd(u)})}function c(u){if(typeof u=="string"){const h=u,f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return a(f)}else return u.data?{data:To(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new kp(t);s=new Ka(u),s.setCrossOrigin(this.crossOrigin);for(let h=0,f=e.length;h<f;h++){const p=e[h],m=p.url;if(Array.isArray(m)){const g=[];for(let y=0,M=m.length;y<M;y++){const x=m[y],_=c(x);_!==null&&(_ instanceof HTMLImageElement?g.push(_):g.push(new Zi(_.data,_.width,_.height)))}i[p.uuid]=new Es(g)}else{const g=c(p.url);i[p.uuid]=new Es(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(a){if(typeof a=="string"){const c=a,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:t.resourcePath+c;return await i.loadAsync(u)}else return a.data?{data:To(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new Ka(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,c=e.length;a<c;a++){const u=e[a],h=u.url;if(Array.isArray(h)){const f=[];for(let p=0,m=h.length;p<m;p++){const g=h[p],y=await s(g);y!==null&&(y instanceof HTMLImageElement?f.push(y):f.push(new Zi(y.data,y.width,y.height)))}n[u.uuid]=new Es(f)}else{const f=await s(u.url);n[u.uuid]=new Es(f)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const c=e[s];c.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',c.uuid),t[c.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",c.image);const u=t[c.image],h=u.data;let f;Array.isArray(h)?(f=new il,h.length===6&&(f.needsUpdate=!0)):(h&&h.data?f=new Zi:f=new Kt,h&&(f.needsUpdate=!0)),f.source=u,f.uuid=c.uuid,c.name!==void 0&&(f.name=c.name),c.mapping!==void 0&&(f.mapping=n(c.mapping,LA)),c.channel!==void 0&&(f.channel=c.channel),c.offset!==void 0&&f.offset.fromArray(c.offset),c.repeat!==void 0&&f.repeat.fromArray(c.repeat),c.center!==void 0&&f.center.fromArray(c.center),c.rotation!==void 0&&(f.rotation=c.rotation),c.wrap!==void 0&&(f.wrapS=n(c.wrap[0],j0),f.wrapT=n(c.wrap[1],j0)),c.format!==void 0&&(f.format=c.format),c.internalFormat!==void 0&&(f.internalFormat=c.internalFormat),c.type!==void 0&&(f.type=c.type),c.colorSpace!==void 0&&(f.colorSpace=c.colorSpace),c.minFilter!==void 0&&(f.minFilter=n(c.minFilter,J0)),c.magFilter!==void 0&&(f.magFilter=n(c.magFilter,J0)),c.anisotropy!==void 0&&(f.anisotropy=c.anisotropy),c.flipY!==void 0&&(f.flipY=c.flipY),c.generateMipmaps!==void 0&&(f.generateMipmaps=c.generateMipmaps),c.premultiplyAlpha!==void 0&&(f.premultiplyAlpha=c.premultiplyAlpha),c.unpackAlignment!==void 0&&(f.unpackAlignment=c.unpackAlignment),c.compareFunction!==void 0&&(f.compareFunction=c.compareFunction),c.userData!==void 0&&(f.userData=c.userData),i[c.uuid]=f}return i}parseObject(e,t,n,i,s){let a;function c(m){return t[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",m),t[m]}function u(m){if(m!==void 0){if(Array.isArray(m)){const g=[];for(let y=0,M=m.length;y<M;y++){const x=m[y];n[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),g.push(n[x])}return g}return n[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),n[m]}}function h(m){return i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",m),i[m]}let f,p;switch(e.type){case"Scene":a=new Tp,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new Ve(e.background):a.background=h(e.background)),e.environment!==void 0&&(a.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new fh(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new hh(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new tn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new kr(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new by(e.color,e.intensity);break;case"DirectionalLight":a=new Ty(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new wy(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new Ay(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Ey(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new My(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new Ry().fromJSON(e);break;case"SkinnedMesh":f=c(e.geometry),p=u(e.material),a=new q_(f,p),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":f=c(e.geometry),p=u(e.material),a=new nn(f,p);break;case"InstancedMesh":f=c(e.geometry),p=u(e.material);const m=e.count,g=e.instanceMatrix,y=e.instanceColor;a=new Z_(f,p,m),a.instanceMatrix=new No(new Float32Array(g.array),16),y!==void 0&&(a.instanceColor=new No(new Float32Array(y.array),y.itemSize));break;case"BatchedMesh":f=c(e.geometry),p=u(e.material),a=new j_(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,p),a.geometry=f,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._visibility=e.visibility,a._active=e.active,a._bounds=e.bounds.map(M=>{const x=new _n;x.min.fromArray(M.boxMin),x.max.fromArray(M.boxMax);const _=new yn;return _.radius=M.sphereRadius,_.center.fromArray(M.sphereCenter),{boxInitialized:M.boxInitialized,box:x,sphereInitialized:M.sphereInitialized,sphere:_}}),a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._geometryCount=e.geometryCount,a._matricesTexture=h(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=h(e.colorsTexture.uuid));break;case"LOD":a=new Y_;break;case"Line":a=new Hr(c(e.geometry),u(e.material));break;case"LineLoop":a=new J_(c(e.geometry),u(e.material));break;case"LineSegments":a=new Ki(c(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new K_(c(e.geometry),u(e.material));break;case"Sprite":a=new X_(u(e.material));break;case"Group":a=new Ao;break;case"Bone":a=new Ap;break;default:a=new Dt}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let g=0;g<m.length;g++)a.add(this.parseObject(m[g],t,n,i,s))}if(e.animations!==void 0){const m=e.animations;for(let g=0;g<m.length;g++){const y=m[g];a.animations.push(s[y])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const m=e.levels;for(let g=0;g<m.length;g++){const y=m[g],M=a.getObjectByProperty("uuid",y.object);M!==void 0&&a.addLevel(M,y.distance,y.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new Dt}})}}const LA={UVMapping:th,CubeReflectionMapping:_r,CubeRefractionMapping:Vr,EquirectangularReflectionMapping:Na,EquirectangularRefractionMapping:Oa,CubeUVReflectionMapping:Bo},j0={RepeatWrapping:Fa,ClampToEdgeWrapping:vi,MirroredRepeatWrapping:Ba},J0={NearestFilter:wn,NearestMipmapNearestFilter:sp,NearestMipmapLinearFilter:wo,LinearFilter:cn,LinearMipmapNearestFilter:ba,LinearMipmapLinearFilter:Xi};class DA extends Qn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=pr.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(h=>{t&&t(h),s.manager.itemEnd(e)}).catch(h=>{i&&i(h)});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader;const u=fetch(e,c).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return pr.add(e,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){i&&i(h),pr.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});pr.add(e,u),s.manager.itemStart(e)}}let jc;class Gp{static getContext(){return jc===void 0&&(jc=new(window.AudioContext||window.webkitAudioContext)),jc}static setContext(e){jc=e}}class UA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new xr(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(u){try{const h=u.slice(0);Gp.getContext().decodeAudioData(h,function(p){t(p)}).catch(c)}catch(h){c(h)}},n,i);function c(u){i?i(u):console.error(u),s.manager.itemError(e)}}}const K0=new ut,Q0=new ut,hs=new ut;class NA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new tn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new tn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,hs.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(As*t.fov*.5)/t.zoom;let c,u;Q0.elements[12]=-i,K0.elements[12]=i,c=-a*t.aspect+s,u=a*t.aspect+s,hs.elements[0]=2*t.near/(u-c),hs.elements[8]=(u+c)/(u-c),this.cameraL.projectionMatrix.copy(hs),c=-a*t.aspect-s,u=a*t.aspect-s,hs.elements[0]=2*t.near/(u-c),hs.elements[8]=(u+c)/(u-c),this.cameraR.projectionMatrix.copy(hs)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Q0),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(K0)}}class Wp{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=$0(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=$0();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function $0(){return performance.now()}const fs=new D,ev=new Un,OA=new D,ds=new D;class FA extends Dt{constructor(){super(),this.type="AudioListener",this.context=Gp.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Wp}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(fs,ev,OA),ds.set(0,0,-1).applyQuaternion(ev),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(fs.x,i),t.positionY.linearRampToValueAtTime(fs.y,i),t.positionZ.linearRampToValueAtTime(fs.z,i),t.forwardX.linearRampToValueAtTime(ds.x,i),t.forwardY.linearRampToValueAtTime(ds.y,i),t.forwardZ.linearRampToValueAtTime(ds.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(fs.x,fs.y,fs.z),t.setOrientation(ds.x,ds.y,ds.z,n.x,n.y,n.z)}}class Iy extends Dt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const ps=new D,tv=new Un,BA=new D,ms=new D;class zA extends Iy{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(ps,tv,BA),ms.set(0,0,1).applyQuaternion(tv);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ps.x,n),t.positionY.linearRampToValueAtTime(ps.y,n),t.positionZ.linearRampToValueAtTime(ps.z,n),t.orientationX.linearRampToValueAtTime(ms.x,n),t.orientationY.linearRampToValueAtTime(ms.y,n),t.orientationZ.linearRampToValueAtTime(ms.z,n)}else t.setPosition(ps.x,ps.y,ps.z),t.setOrientation(ms.x,ms.y,ms.z)}}class kA{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Ly{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let c=0;c!==i;++c)n[s+c]=n[c];a=t}else{a+=t;const c=t/a;this._mixBufferRegion(n,s,0,c,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let u=t,h=t+t;u!==h;++u)if(n[u]!==n[u+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){Un.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;Un.multiplyQuaternionsFlat(e,a,e,t,e,n),Un.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let c=0;c!==s;++c){const u=t+c;e[u]=e[u]*a+e[n+c]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const c=t+a;e[c]=e[c]+e[n+a]*i}}}const Xp="\\[\\]\\.:\\/",VA=new RegExp("["+Xp+"]","g"),Yp="[^"+Xp+"]",HA="[^"+Xp.replace("\\.","")+"]",GA=/((?:WC+[\/:])*)/.source.replace("WC",Yp),WA=/(WCOD+)?/.source.replace("WCOD",HA),XA=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Yp),YA=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Yp),qA=new RegExp("^"+GA+WA+XA+YA+"$"),ZA=["material","materials","bones","map"];class jA{constructor(e,t,n){const i=n||Lt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Lt{constructor(e,t,n){this.path=t,this.parsedPath=n||Lt.parseTrackName(t),this.node=Lt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Lt.Composite(e,t,n):new Lt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(VA,"")}static parseTrackName(e){const t=qA.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);ZA.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const c=s[a];if(c.name===t||c.uuid===t)return c;const u=n(c.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=Lt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let f=0;f<e.length;f++)if(e[f].name===h){h=f;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const a=e[i];if(a===void 0){const h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?c=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}u=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(u=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Lt.Composite=jA;Lt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Lt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Lt.prototype.GetterByBindingType=[Lt.prototype._getValue_direct,Lt.prototype._getValue_array,Lt.prototype._getValue_arrayElement,Lt.prototype._getValue_toArray];Lt.prototype.SetterByBindingTypeAndVersioning=[[Lt.prototype._setValue_direct,Lt.prototype._setValue_direct_setNeedsUpdate,Lt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Lt.prototype._setValue_array,Lt.prototype._setValue_array_setNeedsUpdate,Lt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Lt.prototype._setValue_arrayElement,Lt.prototype._setValue_arrayElement_setNeedsUpdate,Lt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Lt.prototype._setValue_fromArray,Lt.prototype._setValue_fromArray_setNeedsUpdate,Lt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class JA{constructor(){this.isAnimationObjectGroup=!0,this.uuid=oi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let c,u=e.length,h=this.nCachedObjects_;for(let f=0,p=arguments.length;f!==p;++f){const m=arguments[f],g=m.uuid;let y=t[g];if(y===void 0){y=u++,t[g]=y,e.push(m);for(let M=0,x=a;M!==x;++M)s[M].push(new Lt(m,n[M],i[M]))}else if(y<h){c=e[y];const M=--h,x=e[M];t[x.uuid]=y,e[y]=x,t[g]=M,e[M]=m;for(let _=0,w=a;_!==w;++_){const E=s[_],T=E[M];let U=E[y];E[y]=T,U===void 0&&(U=new Lt(m,n[_],i[_])),E[M]=U}}else e[y]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=h}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let a=0,c=arguments.length;a!==c;++a){const u=arguments[a],h=u.uuid,f=t[h];if(f!==void 0&&f>=s){const p=s++,m=e[p];t[m.uuid]=f,e[f]=m,t[h]=p,e[p]=u;for(let g=0,y=i;g!==y;++g){const M=n[g],x=M[p],_=M[f];M[f]=x,M[p]=_}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=e.length;for(let c=0,u=arguments.length;c!==u;++c){const h=arguments[c],f=h.uuid,p=t[f];if(p!==void 0)if(delete t[f],p<s){const m=--s,g=e[m],y=--a,M=e[y];t[g.uuid]=p,e[p]=g,t[M.uuid]=m,e[m]=M,e.pop();for(let x=0,_=i;x!==_;++x){const w=n[x],E=w[m],T=w[y];w[p]=E,w[m]=T,w.pop()}}else{const m=--a,g=e[m];m>0&&(t[g.uuid]=p),e[p]=g,e.pop();for(let y=0,M=i;y!==M;++y){const x=n[y];x[p]=x[m],x.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,c=this._parsedPaths,u=this._objects,h=u.length,f=this.nCachedObjects_,p=new Array(h);i=s.length,n[e]=i,a.push(e),c.push(t),s.push(p);for(let m=f,g=u.length;m!==g;++m){const y=u[m];p[m]=new Lt(y,e,t)}return p}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,c=a.length-1,u=a[c],h=e[c];t[h]=n,a[n]=u,a.pop(),s[n]=s[c],s.pop(),i[n]=i[c],i.pop()}}}class Dy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,c=new Array(a),u={endingStart:Ss,endingEnd:Ss};for(let h=0;h!==a;++h){const f=s[h].createInterpolant(null);c[h]=f,f.settings=u}this._interpolantSettings=u,this._interpolants=c,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=m_,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,a=s/i,c=i/s;e.warp(1,a,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const u=c.parameterPositions,h=c.sampleValues;return u[0]=s,u[1]=s+n,h[0]=e/a,h[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const u=(e-s)*n;u<0||n===0?t=0:(this._startTime=null,t=n*u)}t*=this._updateTimeScale(e);const a=this._updateTime(t),c=this._updateWeight(e);if(c>0){const u=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case mp:for(let f=0,p=u.length;f!==p;++f)u[f].evaluate(a),h[f].accumulateAdditive(c);break;case lh:default:for(let f=0,p=u.length;f!==p;++f)u[f].evaluate(a),h[f].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===g_;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===p_){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,s+=Math.abs(c);const u=this.repetitions-s;if(u<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(u===1){const h=e<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Ms,i.endingEnd=Ms):(e?i.endingStart=this.zeroSlopeAtStart?Ms:Ss:i.endingStart=ka,t?i.endingEnd=this.zeroSlopeAtEnd?Ms:Ss:i.endingEnd=ka)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const c=a.parameterPositions,u=a.sampleValues;return c[0]=s,u[0]=t,c[1]=s+e,u[1]=n,this}}const KA=new Float32Array(1);class QA extends Ji{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,c=e._interpolants,u=n.uuid,h=this._bindingsByRootAndName;let f=h[u];f===void 0&&(f={},h[u]=f);for(let p=0;p!==s;++p){const m=i[p],g=m.name;let y=f[g];if(y!==void 0)++y.referenceCount,a[p]=y;else{if(y=a[p],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,u,g));continue}const M=t&&t._propertyBindings[p].binding.parsedPath;y=new Ly(Lt.create(n,g,M),m.ValueTypeName,m.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,u,g),a[p]=y}c[p].resultBuffer=y.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const c=a.knownActions;e._byClipCacheIndex=c.length,c.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,c=a[s],u=c.knownActions,h=u[u.length-1],f=e._byClipCacheIndex;h._byClipCacheIndex=f,u[f]=h,u.pop(),e._byClipCacheIndex=null;const p=c.actionByRoot,m=(e._localRoot||this._root).uuid;delete p[m],u.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,c=a[i],u=t[t.length-1],h=e._cacheIndex;u._cacheIndex=h,t[h]=u,t.pop(),delete c[s],Object.keys(c).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Bp(new Float32Array(2),new Float32Array(2),1,KA),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?Ja.findByName(i,e):e;const c=a!==null?a.uuid:e,u=this._actionsByClip[c];let h=null;if(n===void 0&&(a!==null?n=a.blendMode:n=lh),u!==void 0){const p=u.actionByRoot[s];if(p!==void 0&&p.blendMode===n)return p;h=u.knownActions[0],a===null&&(a=h._clip)}if(a===null)return null;const f=new Dy(this,a,t,n);return this._bindAction(f,h),this._addInactiveAction(f,c,s),f}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?Ja.findByName(n,e):e,a=s?s.uuid:e,c=this._actionsByClip[a];return c!==void 0&&c.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,s,a);const c=this._bindings,u=this._nActiveBindings;for(let h=0;h!==u;++h)c[h].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let c=0,u=a.length;c!==u;++c){const h=a[c];this._deactivateAction(h);const f=h._cacheIndex,p=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,p._cacheIndex=f,t[f]=p,t.pop(),this._removeInactiveBindingsForAction(h)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const c=n[a].actionByRoot,u=c[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const c=s[a];c.restoreOriginalState(),this._removeInactiveBinding(c)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class qp{constructor(e){this.value=e}clone(){return new qp(this.value.clone===void 0?this.value:this.value.clone())}}let $A=0;class eC extends Ji{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:$A++}),this.name="",this.usage=Va,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class Ku extends dh{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class tC{constructor(e,t,n,i,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const nv=new ut;class Uy{constructor(e,t,n=0,i=1/0){this.ray=new Os(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Cs,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: 
3844Unsupported camera type: "+t.type)}setFromXRController(e){return nv.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(nv),this}intersectObject(e,t=!0,n=[]){return $d(e,this,n,t),n.sort(iv),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)$d(e[i],this,n,t);return n.sort(iv),n}}function iv(r,e){return r.distance-e.distance}function $d(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let a=0,c=s.length;a<c;a++)$d(s[a],e,t,!0)}}class ep{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Jt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class nC{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Zp{constructor(e,t,n,i){Zp.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}}const rv=new ue;class iC{constructor(e=new ue(1/0,1/0),t=new ue(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=rv.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,rv).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const sv=new D,Jc=new D;class Ny{constructor(e=new D,t=new D){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){sv.subVectors(e,this.start),Jc.subVectors(this.end,this.start);const n=Jc.dot(Jc);let s=Jc.dot(sv)/n;return t&&(s=Jt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
vendor: 19,896 bytes, line 3844
3844applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ov=new D;class rC extends Dt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new xt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,c=1,u=32;a<u;a++,c++){const h=a/u*Math.PI*2,f=c/u*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(f),Math.sin(f),1)}n.setAttribute("position",new Ze(i,3));const s=new Gn({fog:!1,toneMapped:!1});this.cone=new Ki(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),ov.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ov),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Br=new D,Kc=new ut,Td=new ut;class sC extends Ki{constructor(e){const t=Oy(e),n=new xt,i=[],s=[],a=new Ve(0,0,1),c=new Ve(0,1,0);for(let h=0;h<t.length;h++){const f=t[h];f.parent&&f.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(a.r,a.g,a.b),s.push(c.r,c.g,c.b))}n.setAttribute("position",new Ze(i,3)),n.setAttribute("color",new Ze(s,3));const u=new Gn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,u),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Td.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const c=t[s];c.parent&&c.parent.isBone&&(Kc.multiplyMatrices(Td,c.matrixWorld),Br.setFromMatrixPosition(Kc),i.setXYZ(a,Br.x,Br.y,Br.z),Kc.multiplyMatrices(Td,c.parent.matrixWorld),Br.setFromMatrixPosition(Kc),i.setXYZ(a+1,Br.x,Br.y,Br.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Oy(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,Oy(r.children[t]));return e}class oC extends nn{constructor(e,t,n){const i=new al(t,4,2),s=new Wr({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const aC=new D,av=new Ve,lv=new Ve;class lC extends Dt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new ol(t);i.rotateY(Math.PI*.5),this.material=new Wr({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new zt(a,3)),this.add(new nn(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");av.copy(this.light.color),lv.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?av:lv;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(aC.setFromMatrixPosition(this.light.matrixWorld).negate())}}class cC extends Ki{constructor(e=10,t=10,n=4473924,i=8947848){n=new Ve(n),i=new Ve(i);const s=t/2,a=e/t,c=e/2,u=[],h=[];for(let m=0,g=0,y=-c;m<=t;m++,y+=a){u.push(-c,0,y,c,0,y),u.push(y,0,-c,y,0,c);const M=m===s?n:i;M.toArray(h,g),g+=3,M.toArray(h,g),g+=3,M.toArray(h,g),g+=3,M.toArray(h,g),g+=3}const f=new xt;f.setAttribute("position",new Ze(u,3)),f.setAttribute("color",new Ze(h,3));const p=new Gn({vertexColors:!0,toneMapped:!1});super(f,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class uC extends Ki{constructor(e=10,t=16,n=8,i=64,s=4473924,a=8947848){s=new Ve(s),a=new Ve(a);const c=[],u=[];if(t>1)for(let p=0;p<t;p++){const m=p/t*(Math.PI*2),g=Math.sin(m)*e,y=Math.cos(m)*e;c.push(0,0,0),c.push(g,0,y);const M=p&1?s:a;u.push(M.r,M.g,M.b),u.push(M.r,M.g,M.b)}for(let p=0;p<n;p++){const m=p&1?s:a,g=e-e/n*p;for(let y=0;y<i;y++){let M=y/i*(Math.PI*2),x=Math.sin(M)*g,_=Math.cos(M)*g;c.push(x,0,_),u.push(m.r,m.g,m.b),M=(y+1)/i*(Math.PI*2),x=Math.sin(M)*g,_=Math.cos(M)*g,c.push(x,0,_),u.push(m.r,m.g,m.b)}}const h=new xt;h.setAttribute("position",new Ze(c,3)),h.setAttribute("color",new Ze(u,3));const f=new Gn({vertexColors:!0,toneMapped:!1});super(h,f),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const cv=new D,Qc=new D,uv=new D;class hC extends Dt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new xt;i.setAttribute("position",new Ze([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Gn({fog:!1,toneMapped:!1});this.lightPlane=new Hr(i,s),this.add(this.lightPlane),i=new xt,i.setAttribute("position",new Ze([0,0,0,0,0,1],3)),this.targetLine=new Hr(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),cv.setFromMatrixPosition(this.light.matrixWorld),Qc.setFromMatrixPosition(this.light.target.matrixWorld),uv.subVectors(Qc,cv),this.lightPlane.lookAt(Qc),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Qc),this.targetLine.scale.z=uv.length()}}const $c=new D,jt=new nl;class fC extends Ki{constructor(e){const t=new xt,n=new Gn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4");function c(y,M){u(y),u(M)}function u(y){i.push(0,0,0),s.push(0,0,0),a[y]===void 0&&(a[y]=[]),a[y].push(i.length/3-1)}t.setAttribute("position",new Ze(i,3)),t.setAttribute("color",new Ze(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const h=new Ve(16755200),f=new Ve(16711680),p=new Ve(43775),m=new Ve(16777215),g=new Ve(3355443);this.setColors(h,f,p,m,g)}setColors(e,t,n,i,s){const c=this.geometry.getAttribute("color");c.setXYZ(0,e.r,e.g,e.b),c.setXYZ(1,e.r,e.g,e.b),c.setXYZ(2,e.r,e.g,e.b),c.setXYZ(3,e.r,e.g,e.b),c.setXYZ(4,e.r,e.g,e.b),c.setXYZ(5,e.r,e.g,e.b),c.setXYZ(6,e.r,e.g,e.b),c.setXYZ(7,e.r,e.g,e.b),c.setXYZ(8,e.r,e.g,e.b),c.setXYZ(9,e.r,e.g,e.b),c.setXYZ(10,e.r,e.g,e.b),c.setXYZ(11,e.r,e.g,e.b),c.setXYZ(12,e.r,e.g,e.b),c.setXYZ(13,e.r,e.g,e.b),c.setXYZ(14,e.r,e.g,e.b),c.setXYZ(15,e.r,e.g,e.b),c.setXYZ(16,e.r,e.g,e.b),c.setXYZ(17,e.r,e.g,e.b),c.setXYZ(18,e.r,e.g,e.b),c.setXYZ(19,e.r,e.g,e.b),c.setXYZ(20,e.r,e.g,e.b),c.setXYZ(21,e.r,e.g,e.b),c.setXYZ(22,e.r,e.g,e.b),c.setXYZ(23,e.r,e.g,e.b),c.setXYZ(24,t.r,t.g,t.b),c.setXYZ(25,t.r,t.g,t.b),c.setXYZ(26,t.r,t.g,t.b),c.setXYZ(27,t.r,t.g,t.b),c.setXYZ(28,t.r,t.g,t.b),c.setXYZ(29,t.r,t.g,t.b),c.setXYZ(30,t.r,t.g,t.b),c.setXYZ(31,t.r,t.g,t.b),c.setXYZ(32,n.r,n.g,n.b),c.setXYZ(33,n.r,n.g,n.b),c.setXYZ(34,n.r,n.g,n.b),c.setXYZ(35,n.r,n.g,n.b),c.setXYZ(36,n.r,n.g,n.b),c.setXYZ(37,n.r,n.g,n.b),c.setXYZ(38,i.r,i.g,i.b),c.setXYZ(39,i.r,i.g,i.b),c.setXYZ(40,s.r,s.g,s.b),c.setXYZ(41,s.r,s.g,s.b),c.setXYZ(42,s.r,s.g,s.b),c.setXYZ(43,s.r,s.g,s.b),c.setXYZ(44,s.r,s.g,s.b),c.setXYZ(45,s.r,s.g,s.b),c.setXYZ(46,s.r,s.g,s.b),c.setXYZ(47,s.r,s.g,s.b),c.setXYZ(48,s.r,s.g,s.b),c.setXYZ(49,s.r,s.g,s.b),c.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;jt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),en("c",t,e,jt,0,0,-1),en("t",t,e,jt,0,0,1),en("n1",t,e,jt,-n,-i,-1),en("n2",t,e,jt,n,-i,-1),en("n3",t,e,jt,-n,i,-1),en("n4",t,e,jt,n,i,-1),en("f1",t,e,jt,-n,-i,1),en("f2",t,e,jt,n,-i,1),en("f3",t,e,jt,-n,i,1),en("f4",t,e,jt,n,i,1),en("u1",t,e,jt,n*.7,i*1.1,-1),en("u2",t,e,jt,-n*.7,i*1.1,-1),en("u3",t,e,jt,0,i*2,-1),en("cf1",t,e,jt,-n,0,1),en("cf2",t,e,jt,n,0,1),en("cf3",t,e,jt,0,-i,1),en("cf4",t,e,jt,0,i,1),en("cn1",t,e,jt,-n,0,-1),en("cn2",t,e,jt,n,0,-1),en("cn3",t,e,jt,0,-i,-1),en("cn4",t,e,jt,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function en(r,e,t,n,i,s,a){$c.set(i,s,a).unproject(n);const c=e[r];if(c!==void 0){const u=t.getAttribute("position");for(let h=0,f=c.length;h<f;h++)u.setXYZ(c[h],$c.x,$c.y,$c.z)}}const eu=new _n;class dC extends Ki{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new xt;s.setIndex(new zt(n,1)),s.setAttribute("position",new zt(i,3)),super(s,new Gn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&eu.setFromObject(this.object),eu.isEmpty())return;const t=eu.min,n=eu.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class pC extends Ki{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new xt;s.setIndex(new zt(n,1)),s.setAttribute("position",new Ze(i,3)),super(s,new Gn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class mC extends Hr{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new xt;a.setAttribute("position",new Ze(s,3)),a.computeBoundingSphere(),super(a,new Gn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],u=new xt;u.setAttribute("position",new Ze(c,3)),u.computeBoundingSphere(),this.add(new nn(u,new Wr({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const hv=new D;let tu,bd;class gC extends Dt{constructor(e=new D(0,0,1),t=new D(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",tu===void 0&&(tu=new xt,tu.setAttribute("position",new Ze([0,0,0,0,1,0],3)),bd=new Ho(0,.5,1,5,1),bd.translate(0,-.5,0)),this.position.copy(t),this.line=new Hr(tu,new Gn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new nn(bd,new Wr({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{hv.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(hv,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class vC extends Ki{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new xt;i.setAttribute("position",new Ze(t,3)),i.setAttribute("color",new Ze(n,3));const s=new Gn({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new Ve,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class _C{constructor(){this.type="ShapePath",this.color=new Ve,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Wa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,a){return this.currentPath.bezierCurveTo(e,t,n,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(_){const w=[];for(let E=0,T=_.length;E<T;E++){const U=_[E],R=new Rs;R.curves=U.curves,w.push(R)}return w}function n(_,w){const E=w.length;let T=!1;for(let U=E-1,R=0;R<E;U=R++){let L=w[U],F=w[R],C=F.x-L.x,A=F.y-L.y;if(Math.abs(A)>Number.EPSILON){if(A<0&&(L=w[R],C=-C,F=w[U],A=-A),_.y<L.y||_.y>F.y)continue;if(_.y===L.y){if(_.x===L.x)return!0}else{const N=A*(_.x-L.x)-C*(_.y-L.y);if(N===0)return!0;if(N<0)continue;T=!T}}else{if(_.y!==L.y)continue;if(F.x<=_.x&&_.x<=L.x||L.x<=_.x&&_.x<=F.x)return!0}}return T}const i=ji.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,c,u;const h=[];if(s.length===1)return c=s[0],u=new Rs,u.curves=c.curves,h.push(u),h;let f=!i(s[0].getPoints());f=e?!f:f;const p=[],m=[];let g=[],y=0,M;m[y]=void 0,g[y]=[];for(let _=0,w=s.length;_<w;_++)c=s[_],M=c.getPoints(),a=i(M),a=e?!a:a,a?(!f&&m[y]&&y++,m[y]={s:new Rs,p:M},m[y].s.curves=c.curves,f&&y++,g[y]=[]):g[y].push({h:c,p:M[0]});if(!m[0])return t(s);if(m.length>1){let _=!1,w=0;for(let E=0,T=m.length;E<T;E++)p[E]=[];for(let E=0,T=m.length;E<T;E++){const U=g[E];for(let R=0;R<U.length;R++){const L=U[R];let F=!0;for(let C=0;C<m.length;C++)n(L.p,m[C].p)&&(E!==C&&w++,F?(F=!1,p[C].push(L)):_=!0);F&&p[E].push(L)}}w>0&&_===!1&&(g=p)}let x;for(let _=0,w=m.length;_<w;_++){u=m[_].s,h.push(u),x=g[_];for(let E=0,T=x.length;E<T;E++)u.holes.push(x[E].h)}return h}}class yC extends Ji{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class xC extends Ci{constructor(e=1,t=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Qa}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Qa);const SC=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:rp,AddEquation:zr,AddOperation:o_,AdditiveAnimationBlendMode:mp,AdditiveBlending:zd,AgXToneMapping:h_,AlphaFormat:cp,AlwaysCompare:b_,AlwaysDepth:pu,AlwaysStencilFunc:Gd,AmbientLight:by,AnimationAction:Dy,AnimationClip:Ja,AnimationLoader:EA,AnimationMixer:QA,AnimationObjectGroup:JA,AnimationUtils:yA,ArcCurve:Q_,ArrayCamera:H_,ArrowHelper:gC,AttachedBindMode:Hd,Audio:Iy,AudioAnalyser:kA,AudioContext:Gp,AudioListener:FA,AudioLoader:UA,AxesHelper:vC,BackSide:Hn,BasicDepthPacking:v_,BasicShadowMap:kv,BatchedMesh:j_,Bone:Ap,BooleanKeyframeTrack:Bs,Box2:iC,Box3:_n,Box3Helper:pC,BoxGeometry:Fs,BoxHelper:dC,BufferAttribute:zt,BufferGeometry:xt,BufferGeometryLoader:Py,ByteType:op,Cache:pr,Camera:nl,CameraHelper:fC,CanvasTexture:Gb,CapsuleGeometry:vh,CatmullRomCurve3:$_,CineonToneMapping:c_,CircleGeometry:_h,ClampToEdgeWrapping:vi,Clock:Wp,Color:Ve,ColorKeyframeTrack:zp,ColorManagement:Pt,CompressedArrayTexture:Vb,CompressedCubeTexture:Hb,CompressedTexture:mh,CompressedTextureLoader:wA,ConeGeometry:yh,ConstantAlphaFactor:i_,ConstantColorFactor:t_,Controls:yC,CubeCamera:U_,CubeReflectionMapping:_r,CubeRefractionMapping:Vr,CubeTexture:il,CubeTextureLoader:TA,CubeUVReflectionMapping:Bo,CubicBezierCurve:Pp,CubicBezierCurve3:ey,CubicInterpolant:_y,CullFaceBack:Bd,CullFaceFront:zv,CullFaceFrontBack:_S,CullFaceNone:Bv,Curve:Ri,CurvePath:ny,CustomBlending:Vv,CustomToneMapping:u_,CylinderGeometry:Ho,Cylindrical:nC,Data3DTexture:_p,DataArrayTexture:ch,DataTexture:Zi,DataTextureLoader:bA,DataUtils:IM,DecrementStencilOp:LS,DecrementWrapStencilOp:US,DefaultLoadingManager:Sy,DepthFormat:bs,DepthStencilFormat:Ds,DepthTexture:Mp,DetachedBindMode:d_,DirectionalLight:Ty,DirectionalLightHelper:hC,DiscreteInterpolant:yy,DodecahedronGeometry:xh,DoubleSide:Gi,DstAlphaFactor:Jv,DstColorFactor:Qv,DynamicCopyUsage:jS,DynamicDrawUsage:GS,DynamicReadUsage:YS,EdgesGeometry:iy,EllipseCurve:gh,EqualCompare:M_,EqualDepth:gu,EqualStencilFunc:BS,EquirectangularReflectionMapping:Na,EquirectangularRefractionMapping:Oa,Euler:ai,EventDispatcher:Ji,ExtrudeGeometry:Mh,FileLoader:xr,Float16BufferAttribute:FM,Float32BufferAttribute:Ze,FloatType:Kn,Fog:fh,FogExp2:hh,FramebufferTexture:kb,FrontSide:vr,Frustum:rl,GLBufferAttribute:tC,GLSL1:KS,GLSL3:Wd,GreaterCompare:E_,GreaterDepth:_u,GreaterEqualCompare:T_,GreaterEqualDepth:vu,GreaterEqualStencilFunc:HS,GreaterStencilFunc:kS,GridHelper:cC,Group:Ao,HalfFloatType:zo,HemisphereLight:My,HemisphereLightHelper:lC,IcosahedronGeometry:Eh,ImageBitmapLoader:DA,ImageLoader:Ka,ImageUtils:P_,IncrementStencilOp:IS,IncrementWrapStencilOp:DS,InstancedBufferAttribute:No,InstancedBufferGeometry:Hp,InstancedInterleavedBuffer:Ku,InstancedMesh:Z_,Int16BufferAttribute:NM,Int32BufferAttribute:OM,Int8BufferAttribute:LM,IntType:nh,InterleavedBuffer:dh,InterleavedBufferAttribute:si,Interpolant:ll,InterpolateDiscrete:za,InterpolateLinear:Yu,InterpolateSmooth:lu,InvertStencilOp:NS,KeepStencilOp:_s,KeyframeTrack:Pi,LOD:Y_,LatheGeometry:sl,Layers:Cs,LessCompare:S_,LessDepth:mu,LessEqualCompare:gp,LessEqualDepth:Is,LessEqualStencilFunc:zS,LessStencilFunc:FS,Light:Yr,LightProbe:Ry,Line:Hr,Line3:Ny,LineBasicMaterial:Gn,LineCurve:
3844Ip,LineCurve3:ty,LineDashedMaterial:my,LineLoop:J_,LineSegments:Ki,LinearFilter:cn,LinearInterpolant:Bp,LinearMipMapLinearFilter:MS,LinearMipMapNearestFilter:SS,LinearMipmapLinearFilter:Xi,LinearMipmapNearestFilter:ba,LinearSRGBColorSpace:Ns,LinearToneMapping:a_,LinearTransfer:tl,Loader:Qn,LoaderUtils:Qd,LoadingManager:kp,LoopOnce:p_,LoopPingPong:g_,LoopRepeat:m_,LuminanceAlphaFormat:fp,LuminanceFormat:hp,MOUSE:gs,Material:Nn,MaterialLoader:Ph,MathUtils:A_,Matrix2:Zp,Matrix3:gt,Matrix4:ut,MaxEquation:Xv,Mesh:nn,MeshBasicMaterial:Wr,MeshDepthMaterial:Ep,MeshDistanceMaterial:wp,MeshLambertMaterial:dy,MeshMatcapMaterial:py,MeshNormalMaterial:fy,MeshPhongMaterial:uy,MeshPhysicalMaterial:cy,MeshStandardMaterial:Op,MeshToonMaterial:hy,MinEquation:Wv,MirroredRepeatWrapping:Ba,MixOperation:s_,MultiplyBlending:Vd,MultiplyOperation:$a,NearestFilter:wn,NearestMipMapLinearFilter:xS,NearestMipMapNearestFilter:yS,NearestMipmapLinearFilter:wo,NearestMipmapNearestFilter:sp,NeutralToneMapping:f_,NeverCompare:x_,NeverDepth:du,NeverStencilFunc:OS,NoBlending:mr,NoColorSpace:fr,NoToneMapping:qi,NormalAnimationBlendMode:lh,NormalBlending:Ts,NotEqualCompare:w_,NotEqualDepth:yu,NotEqualStencilFunc:VS,NumberKeyframeTrack:Za,Object3D:Dt,ObjectLoader:IA,ObjectSpaceNormalMap:y_,OctahedronGeometry:ol,OneFactor:qv,OneMinusConstantAlphaFactor:r_,OneMinusConstantColorFactor:n_,OneMinusDstAlphaFactor:Kv,OneMinusDstColorFactor:$v,OneMinusSrcAlphaFactor:fu,OneMinusSrcColorFactor:jv,OrthographicCamera:kr,PCFShadowMap:eh,PCFSoftShadowMap:Ta,PMREMGenerator:Xd,Path:Wa,PerspectiveCamera:tn,Plane:hr,PlaneGeometry:ko,PlaneHelper:mC,PointLight:wy,PointLightHelper:oC,Points:K_,PointsMaterial:Cp,PolarGridHelper:uC,PolyhedronGeometry:Xr,PositionalAudio:zA,PropertyBinding:Lt,PropertyMixer:Ly,QuadraticBezierCurve:Lp,QuadraticBezierCurve3:Dp,Quaternion:Un,QuaternionKeyframeTrack:cl,QuaternionLinearInterpolant:xy,RED_GREEN_RGTC2_Format:Wu,RED_RGTC1_Format:pp,REVISION:Qa,RGBADepthPacking:__,RGBAFormat:Dn,RGBAIntegerFormat:ah,RGBA_ASTC_10x10_Format:Bu,RGBA_ASTC_10x5_Format:Nu,RGBA_ASTC_10x6_Format:Ou,RGBA_ASTC_10x8_Format:Fu,RGBA_ASTC_12x10_Format:zu,RGBA_ASTC_12x12_Format:ku,RGBA_ASTC_4x4_Format:Au,RGBA_ASTC_5x4_Format:Cu,RGBA_ASTC_5x5_Format:Ru,RGBA_ASTC_6x5_Format:Pu,RGBA_ASTC_6x6_Format:Iu,RGBA_ASTC_8x5_Format:Lu,RGBA_ASTC_8x6_Format:Du,RGBA_ASTC_8x8_Format:Uu,RGBA_BPTC_Format:Ia,RGBA_ETC2_EAC_Format:bu,RGBA_PVRTC_2BPPV1_Format:Eu,RGBA_PVRTC_4BPPV1_Format:Mu,RGBA_S3TC_DXT1_Format:Ca,RGBA_S3TC_DXT3_Format:Ra,RGBA_S3TC_DXT5_Format:Pa,RGBDepthPacking:AS,RGBFormat:up,RGBIntegerFormat:ES,RGB_BPTC_SIGNED_Format:Vu,RGB_BPTC_UNSIGNED_Format:Hu,RGB_ETC1_Format:wu,RGB_ETC2_Format:Tu,RGB_PVRTC_2BPPV1_Format:Su,RGB_PVRTC_4BPPV1_Format:xu,RGB_S3TC_DXT1_Format:Aa,RGDepthPacking:CS,RGFormat:dp,RGIntegerFormat:oh,RawShaderMaterial:ly,Ray:Os,Raycaster:Uy,RectAreaLight:Ay,RedFormat:sh,RedIntegerFormat:el,ReinhardToneMapping:l_,RenderTarget:I_,RepeatWrapping:Fa,ReplaceStencilOp:PS,ReverseSubtractEquation:Gv,RingGeometry:wh,SIGNED_RED_GREEN_RGTC2_Format:Xu,SIGNED_RED_RGTC1_Format:Gu,SRGBColorSpace:jn,SRGBTransfer:Ft,Scene:Tp,ShaderChunk:yt,ShaderLib:bi,ShaderMaterial:_i,ShadowMaterial:ay,Shape:Rs,ShapeGeometry:Th,ShapePath:_C,ShapeUtils:ji,ShortType:ap,Skeleton:ph,SkeletonHelper:sC,SkinnedMesh:q_,Source:Es,Sphere:yn,SphereGeometry:al,Spherical:ep,SphericalHarmonics3:Cy,SplineCurve:Up,SpotLight:Ey,SpotLightHelper:rC,Sprite:X_,SpriteMaterial:bp,SrcAlphaFactor:hu,SrcAlphaSaturateFactor:e_,SrcColorFactor:Zv,StaticCopyUsage:ZS,StaticDrawUsage:Va,StaticReadUsage:XS,StereoCamera:NA,StreamCopyUsage:JS,StreamDrawUsage:WS,StreamReadUsage:qS,StringKeyframeTrack:zs,SubtractEquation:Hv,SubtractiveBlending:kd,TOUCH:vs,TangentSpaceNormalMap:Gr,TetrahedronGeometry:bh,Texture:Kt,TextureLoader:AA,TextureUtils:xb,TorusGeometry:Ah,TorusKnotGeometry:Ch,Triangle:Jn,TriangleFanDrawMode:bS,TriangleStripDrawMode:TS,TrianglesDrawMode:wS,TubeGeometry:Rh,UVMapping:th,Uint16BufferAttribute:yp,Uint32BufferAttribute:xp,Uint8BufferAttribute:DM,Uint8ClampedBufferAttribute:UM,Uniform:qp,UniformsGroup:eC,UniformsLib:Ae,UniformsUtils:qu,UnsignedByteType:Ai,UnsignedInt248Type:Ls,UnsignedInt5999Type:lp,UnsignedIntType:yr,UnsignedShort4444Type:ih,UnsignedShort5551Type:rh,UnsignedShortType:Lo,VSMShadowMap:wi,Vector2:ue,Vector3:D,Vector4:bt,VectorKeyframeTrack:ja,VideoTexture:zb,WebGL3DRenderTarget:SM,WebGLArrayRenderTarget:xM,WebGLCoordinateSystem:Yi,WebGLCubeRen
vendor: 73,541 bytes, lines 3844-3874
3844derTarget:N_,WebGLMultipleRenderTargets:xC,WebGLRenderTarget:Ci,WebGLRenderer:G_,WebGLUtils:V_,WebGPUCoordinateSystem:Ha,WireframeGeometry:Np,WrapAroundEnding:ka,ZeroCurvatureEnding:Ss,ZeroFactor:Yv,ZeroSlopeEnding:Ms,ZeroStencilOp:RS,createCanvasElement:R_},Symbol.toStringTag,{value:"Module"}));var Fy={exports:{}},ks={};/**
3845 * @license React
3846 * react-reconciler-constants.production.min.js
3847 *
3848 * Copyright (c) Facebook, Inc. and its affiliates.
3849 *
3850 * This source code is licensed under the MIT license found in the
3851 * LICENSE file in the root directory of this source tree.
3852 */ks.ConcurrentRoot=1;ks.ContinuousEventPriority=4;ks.DefaultEventPriority=16;ks.DiscreteEventPriority=1;ks.IdleEventPriority=536870912;ks.LegacyRoot=0;Fy.exports=ks;var Ro=Fy.exports;function MC(r){let e;const t=new Set,n=(h,f)=>{const p=typeof h=="function"?h(e):h;if(p!==e){const m=e;e=f?p:Object.assign({},e,p),t.forEach(g=>g(e,m))}},i=()=>e,s=(h,f=i,p=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=f(e);function g(){const y=f(e);if(!p(m,y)){const M=m;h(m=y,M)}}return t.add(g),()=>t.delete(g)},u={setState:n,getState:i,subscribe:(h,f,p)=>f||p?s(h,f,p):(t.add(h),()=>t.delete(h)),destroy:()=>t.clear()};return e=r(n,i,u),u}const EC=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),fv=EC?Ce.useEffect:Ce.useLayoutEffect;function wC(r){const e=typeof r=="function"?MC(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=Ce.useReducer(x=>x+1,0),a=e.getState(),c=Ce.useRef(a),u=Ce.useRef(n),h=Ce.useRef(i),f=Ce.useRef(!1),p=Ce.useRef();p.current===void 0&&(p.current=n(a));let m,g=!1;(c.current!==a||u.current!==n||h.current!==i||f.current)&&(m=n(a),g=!i(p.current,m)),fv(()=>{g&&(p.current=m),c.current=a,u.current=n,h.current=i,f.current=!1});const y=Ce.useRef(a);fv(()=>{const x=()=>{try{const w=e.getState(),E=u.current(w);h.current(p.current,E)||(c.current=w,p.current=E,s())}catch{f.current=!0,s()}},_=e.subscribe(x);return e.getState()!==y.current&&x(),_},[]);const M=g?m:p.current;return Ce.useDebugValue(M),M};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}var By={exports:{}},zy={exports:{}},ky={};/**
3853 * @license React
3854 * scheduler.production.min.js
3855 *
3856 * Copyright (c) Facebook, Inc. and its affiliates.
3857 *
3858 * This source code is licensed under the MIT license found in the
3859 * LICENSE file in the root directory of this source tree.
3860 */(function(r){function e(V,re){var ie=V.length;V.push(re);e:for(;0<ie;){var de=ie-1>>>1,Re=V[de];if(0<i(Re,re))V[de]=re,V[ie]=Re,ie=de;else break e}}function t(V){return V.length===0?null:V[0]}function n(V){if(V.length===0)return null;var re=V[0],ie=V.pop();if(ie!==re){V[0]=ie;e:for(var de=0,Re=V.length,Xe=Re>>>1;de<Xe;){var se=2*(de+1)-1,_e=V[se],Le=se+1,Me=V[Le];if(0>i(_e,ie))Le<Re&&0>i(Me,_e)?(V[de]=Me,V[Le]=ie,de=Le):(V[de]=_e,V[se]=ie,de=se);else if(Le<Re&&0>i(Me,ie))V[de]=Me,V[Le]=ie,de=Le;else break e}}return re}function i(V,re){var ie=V.sortIndex-re.sortIndex;return ie!==0?ie:V.id-re.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var a=Date,c=a.now();r.unstable_now=function(){return a.now()-c}}var u=[],h=[],f=1,p=null,m=3,g=!1,y=!1,M=!1,x=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(V){for(var re=t(h);re!==null;){if(re.callback===null)n(h);else if(re.startTime<=V)n(h),re.sortIndex=re.expirationTime,e(u,re);else break;re=t(h)}}function T(V){if(M=!1,E(V),!y)if(t(u)!==null)y=!0,Q(U);else{var re=t(h);re!==null&&ve(T,re.startTime-V)}}function U(V,re){y=!1,M&&(M=!1,_(F),F=-1),g=!0;var ie=m;try{for(E(re),p=t(u);p!==null&&(!(p.expirationTime>re)||V&&!N());){var de=p.callback;if(typeof de=="function"){p.callback=null,m=p.priorityLevel;var Re=de(p.expirationTime<=re);re=r.unstable_now(),typeof Re=="function"?p.callback=Re:p===t(u)&&n(u),E(re)}else n(u);p=t(u)}if(p!==null)var Xe=!0;else{var se=t(h);se!==null&&ve(T,se.startTime-re),Xe=!1}return Xe}finally{p=null,m=ie,g=!1}}var R=!1,L=null,F=-1,C=5,A=-1;function N(){return!(r.unstable_now()-A<C)}function Z(){if(L!==null){var V=r.unstable_now();A=V;var re=!0;try{re=L(!0,V)}finally{re?q():(R=!1,L=null)}}else R=!1}var q;if(typeof w=="function")q=function(){w(Z)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ce=K.port2;K.port1.onmessage=Z,q=function(){ce.postMessage(null)}}else q=function(){x(Z,0)};function Q(V){L=V,R||(R=!0,q())}function ve(V,re){F=x(function(){V(r.unstable_now())},re)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(V){V.callback=null},r.unstable_continueExecution=function(){y||g||(y=!0,Q(U))},r.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<V?Math.floor(1e3/V):5},r.unstable_getCurrentPriorityLevel=function(){return m},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(V){switch(m){case 1:case 2:case 3:var re=3;break;default:re=m}var ie=m;m=re;try{return V()}finally{m=ie}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(V,re){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var ie=m;m=V;try{return re()}finally{m=ie}},r.unstable_scheduleCallback=function(V,re,ie){var de=r.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?de+ie:de):ie=de,V){case 1:var Re=-1;break;case 2:Re=250;break;case 5:Re=1073741823;break;case 4:Re=1e4;break;default:Re=5e3}return Re=ie+Re,V={id:f++,callback:re,priorityLevel:V,startTime:ie,expirationTime:Re,sortIndex:-1},ie>de?(V.sortIndex=ie,e(h,V),t(u)===null&&V===t(h)&&(M?(_(F),F=-1):M=!0,ve(T,ie-de))):(V.sortIndex=Re,e(u,V),y||g||(y=!0,Q(U))),V},r.unstable_shouldYield=N,r.unstable_wrapCallback=function(V){var re=m;return function(){var ie=m;m=re;try{return V.apply(this,arguments)}finally{m=ie}}}})(ky);zy.exports=ky;var tp=zy.exports;/**
3861 * @license React
3862 * react-reconciler.production.min.js
3863 *
3864 * Copyright (c) Facebook, Inc. and its affiliates.
3865 *
3866 * This source code is licensed under the MIT license found in the
3867 * LICENSE file in the root directory of this source tree.
3868 */var TC=function(e){var t={},n=Ce,i=tp,s=Object.assign;function a(o){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=Symbol.for("react.element"),h=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),y=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),U=Symbol.iterator;function R(o){return o===null||typeof o!="object"?null:(o=U&&o[U]||o["@@iterator"],typeof o=="function"?o:null)}function L(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case f:return"Fragment";case h:return"Portal";case m:return"Profiler";case p:return"StrictMode";case x:return"Suspense";case _:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case y:return(o.displayName||"Context")+".Consumer";case g:return(o._context.displayName||"Context")+".Provider";case M:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case w:return l=o.displayName||null,l!==null?l:L(o.type)||"Memo";case E:l=o._payload,o=o._init;try{return L(o(l))}catch{}}return null}function F(o){var l=o.type;switch(o.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=l.render,o=o.displayName||o.name||"",l.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return L(l);case 8:return l===p?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function C(o){var l=o,d=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,l.flags&4098&&(d=l.return),o=l.return;while(o)}return l.tag===3?d:null}function A(o){if(C(o)!==o)throw Error(a(188))}function N(o){var l=o.alternate;if(!l){if(l=C(o),l===null)throw Error(a(188));return l!==o?null:o}for(var d=o,v=l;;){var S=d.return;if(S===null)break;var b=S.alternate;if(b===null){if(v=S.return,v!==null){d=v;continue}break}if(S.child===b.child){for(b=S.child;b;){if(b===d)return A(S),o;if(b===v)return A(S),l;b=b.sibling}throw Error(a(188))}if(d.return!==v.return)d=S,v=b;else{for(var B=!1,G=S.child;G;){if(G===d){B=!0,d=S,v=b;break}if(G===v){B=!0,v=S,d=b;break}G=G.sibling}if(!B){for(G=b.child;G;){if(G===d){B=!0,d=b,v=S;break}if(G===v){B=!0,v=b,d=S;break}G=G.sibling}if(!B)throw Error(a(189))}}if(d.alternate!==v)throw Error(a(190))}if(d.tag!==3)throw Error(a(188));return d.stateNode.current===d?o:l}function Z(o){return o=N(o),o!==null?q(o):null}function q(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var l=q(o);if(l!==null)return l;o=o.sibling}return null}function K(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){if(o.tag!==4){var l=K(o);if(l!==null)return l}o=o.sibling}return null}var ce=Array.isArray,Q=e.getPublicInstance,ve=e.getRootHostContext,V=e.getChildHostContext,re=e.prepareForCommit,ie=e.resetAfterCommit,de=e.createInstance,Re=e.appendInitialChild,Xe=e.finalizeInitialChildren,se=e.prepareUpdate,_e=e.shouldSetTextContent,Le=e.createTextInstance,Me=e.scheduleTimeout,et=e.cancelTimeout,lt=e.noTimeout,tt=e.isPrimaryRenderer,ft=e.supportsMutation,pe=e.supportsPersistence,ge=e.supportsHydration,z=e.getInstanceFromNode,Ke=e.preparePortalMount,ye=e.getCurrentEventPriority,ze=e.detachDeletedInstance,Te=e.supportsMicrotasks,it=e.scheduleMicrotask,De=e.supportsTestSelectors,O=e.findFiberRoot,P=e.getBoundingRect,j=e.getTextContent,ae=e.isHiddenSubtree,me=e.matchAccessibilityRole,he=e.setFocusIfFocusable,Ye=e.setupIntersectionObserver,be=e.appendChild,ke=e.appendChildToContainer,St=e.commitTextUpdate,xe=e.commitMount,Ge=e.commitUpdate,rt=e.insertBefore,ct=e.insertInContainerBefore,He=e.removeChild,H=e.removeChildFromContainer,le=e.resetTextContent,Ie=e.hideInstance,k=e.hideTextInstance,Se=e.unhideInstance,te=e.unhideTextInstance,fe=e.clearContainer,Fe=e.cloneInstance,Pe=e.createContainerChildSet,nt=e.appendChildToContainerChildSet,It=e.finalizeContainerChildren,Vt=e.replaceContainerChildren,At=e.cloneHiddenInstance,rn=e.cloneHiddenTextInstance,Tn=e.canHydrateInstance,hl=e.canHydrateTextInstance,fl=e.canHydrateSuspenseInstance,Ii=e.isSuspenseInstancePending,qr=e.isSuspenseInstanceFallback,dl=e.registerSuspenseInstanceRetry,Sr=e.getNextHydratableSibling,Vs=e.getFirstHydratableChild,pl=e.getFirstHydratableChildWithinContainer,Hs=e.getFirstHydratableChildWithinSuspenseInstance,ml=e.hydrateInstance,gl=e.hydrateTextInstance,Ih=e.hydrateSuspenseInstance,Lh=e.getNextHydratableInstanceAfterSuspenseInstance,vl=e.commitHydratedContainer,I=e.commitHydratedSuspenseInstance,W=e.clearSuspenseBoundary,$=e.clearSuspenseBoundaryFromContainer,ee=e.shouldDeleteUnhydratedTailInstances,Y=e.didNotMatchHydratedContainerTextInstance,we=e.didNotMatchHydratedTextInstance,Ue;function qe(o){if(Ue===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);Ue=l&&l[1]||""}return`
3869`+Ue+o}var je=!1;function ht(o,l){if(!o||je)return"";je=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(Ee){var v=Ee}Reflect.construct(o,[],l)}else{try{l.call()}catch(Ee){v=Ee}o.call(l.prototype)}else{try{throw Error()}catch(Ee){v=Ee}o()}}catch(Ee){if(Ee&&v&&typeof Ee.stack=="string"){for(var S=Ee.stack.split(`
3870`),b=v.stack.split(`
3871`),B=S.length-1,G=b.length-1;1<=B&&0<=G&&S[B]!==b[G];)G--;for(;1<=B&&0<=G;B--,G--)if(S[B]!==b[G]){if(B!==1||G!==1)do if(B--,G--,0>G||S[B]!==b[G]){var oe=`
3872`+S[B].replace(" at new "," at ");return o.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",o.displayName)),oe}while(1<=B&&0<=G);break}}}finally{je=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?qe(o):""}var dt=Object.prototype.hasOwnProperty,Je=[],Et=-1;function Rt(o){return{current:o}}function at(o){0>Et||(o.current=Je[Et],Je[Et]=null,Et--)}function _t(o,l){Et++,Je[Et]=o.current,o.current=l}var wt={},Oe=Rt(wt),Gt=Rt(!1),Ct=wt;function fn(o,l){var d=o.type.contextTypes;if(!d)return wt;var v=o.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===l)return v.__reactInternalMemoizedMaskedChildContext;var S={},b;for(b in d)S[b]=l[b];return v&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=l,o.__reactInternalMemoizedMaskedChildContext=S),S}function Qt(o){return o=o.childContextTypes,o!=null}function dn(){at(Gt),at(Oe)}function Mr(o,l,d){if(Oe.current!==wt)throw Error(a(168));_t(Oe,l),_t(Gt,d)}function Bt(o,l,d){var v=o.stateNode;if(l=l.childContextTypes,typeof v.getChildContext!="function")return d;v=v.getChildContext();for(var S in v)if(!(S in l))throw Error(a(108,F(o)||"Unknown",S));return s({},d,v)}function On(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||wt,Ct=Oe.current,_t(Oe,o),_t(Gt,Gt.current),!0}function Er(o,l,d){var v=o.stateNode;if(!v)throw Error(a(169));d?(o=Bt(o,l,Ct),v.__reactInternalMemoizedMergedChildContext=o,at(Gt),at(Oe),_t(Oe,o)):at(Gt),_t(Gt,d)}var Wt=Math.clz32?Math.clz32:_l,Li=Math.log,Di=Math.LN2;function _l(o){return o>>>=0,o===0?32:31-(Li(o)/Di|0)|0}var yl=64,xl=4194304;function Go(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Sl(o,l){var d=o.pendingLanes;if(d===0)return 0;var v=0,S=o.suspendedLanes,b=o.pingedLanes,B=d&268435455;if(B!==0){var G=B&~S;G!==0?v=Go(G):(b&=B,b!==0&&(v=Go(b)))}else B=d&~S,B!==0?v=Go(B):b!==0&&(v=Go(b));if(v===0)return 0;if(l!==0&&l!==v&&!(l&S)&&(S=v&-v,b=l&-l,S>=b||S===16&&(b&4194240)!==0))return l;if(v&4&&(v|=d&16),l=o.entangledLanes,l!==0)for(o=o.entanglements,l&=v;0<l;)d=31-Wt(l),S=1<<d,v|=o[d],l&=~S;return v}function ax(o,l){switch(o){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function lx(o,l){for(var d=o.suspendedLanes,v=o.pingedLanes,S=o.expirationTimes,b=o.pendingLanes;0<b;){var B=31-Wt(b),G=1<<B,oe=S[B];oe===-1?(!(G&d)||G&v)&&(S[B]=ax(G,l)):oe<=l&&(o.expiredLanes|=G),b&=~G}}function Dh(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Uh(o){for(var l=[],d=0;31>d;d++)l.push(o);return l}function Wo(o,l,d){o.pendingLanes|=l,l!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,l=31-Wt(l),o[l]=d}function cx(o,l){var d=o.pendingLanes&~l;o.pendingLanes=l,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=l,o.mutableReadLanes&=l,o.entangledLanes&=l,l=o.entanglements;var v=o.eventTimes;for(o=o.expirationTimes;0<d;){var S=31-Wt(d),b=1<<S;l[S]=0,v[S]=-1,o[S]=-1,d&=~b}}function Nh(o,l){var d=o.entangledLanes|=l;for(o=o.entanglements;d;){var v=31-Wt(d),S=1<<v;S&l|o[v]&l&&(o[v]|=l),d&=~S}}var Ut=0;function $p(o){return o&=-o,1<o?4<o?o&268435455?16:536870912:4:1}var Oh=i.unstable_scheduleCallback,em=i.unstable_cancelCallback,ux=i.unstable_shouldYield,hx=i.unstable_requestPaint,pn=i.unstable_now,Fh=i.unstable_ImmediatePriority,fx=i.unstable_UserBlockingPriority,Bh=i.unstable_NormalPriority,dx=i.unstable_IdlePriority,Ml=null,Ui=null;function px(o){if(Ui&&typeof Ui.onCommitFiberRoot=="function")try{Ui.onCommitFiberRoot(Ml,o,void 0,(o.current.flags&128)===128)}catch{}}function mx(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var Ni=typeof Object.is=="function"?Object.is:mx,Qi=null,El=!1,zh=!1;function tm(o){Qi===null?Qi=[o]:Qi.push(o)}function gx(o){El=!0,tm(o)}function Oi(){if(!zh&&Qi!==null){zh=!0;var o=0,l=Ut;try{var d=Qi;for(Ut=1;o<d.length;o++){var v=d[o];do v=v(!0);while(v!==null)}Qi=null,El=!1}catch(S){throw Qi!==null&&(Qi=Qi.slice(o+1)),Oh(Fh,Oi),S}finally{Ut=l,zh=!1}}return null}var vx=c.ReactCurrentBatchConfig;function wl(o,l){if(Ni(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var d=Object.keys(o),v=Object.keys(l);if(d.length!==v.length)return!1;for(v=0;v<d.length;v++){var S=d[v];if(!dt.call(l,S)||!Ni(o[S],l[S]))return!1}return!0}function _x(o){switch(o.tag){case 5:return qe(o.type);case 16:return qe("Lazy");case 13:return qe("Suspense");case 19:return qe("SuspenseList");case 0:case 2:case 15:return o=ht(o.type,!1),o;case 11:return o=ht(o.type.render,!1),o;case 1:return o=ht(o.type,!0),o;default:return""}}function yi(o,l){if(o&&o.defaultProps){l=s({},l),o=o.defaultProps;for(var d in o)l[d]===void 0&&(l[d]=o[d]);return l}return l}var Tl=Rt(null),bl=null,Gs=null,kh=null;function Vh(){kh=Gs=bl=null}function nm(o,l,d){tt?(_t(Tl,l._currentValue),l._currentValue=d):(_t(Tl,l._currentValue2),l._currentValue2=d)}function Hh(o){var l=Tl.current;at(Tl),tt?o._currentValue=l:o._currentValue2=l}function Gh(o,l,d){for(;o!==null;){var v=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,v!==null&&(v.childLanes|=l)):v!==null&&(v.childLanes&l)!==l&&(v.childLanes|=l),o===d)break;o=o.return}}function Ws(o,l){bl=o,kh=Gs=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&l&&(ti=!0),o.firstContext=null)}function li(o){var l=tt?o._currentValue:o._currentValue2;if(kh!==o)if(o={context:o,memoizedValue:l,next:null},Gs===null){if(bl===null)throw Error(a(308));Gs=o,bl.dependencies={lanes:0,firstContext:o}}else Gs=Gs.next=o;return l}var Fi=null,wr=!1;function Wh(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function im(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function $i(o,l){return{eventTime:o,lane:l,tag:0,payload:null,callback:null,next:null}}function Tr(o,l){var d=o.updateQueue;d!==null&&(d=d.shared,sn!==null&&o.mode&1&&!(Tt&2)?(o=d.interleaved,o===null?(l.next=l,Fi===null?Fi=[d]:Fi.push(d)):(l.next=o.next,o.next=l),d.interleaved=l):(o=d.pending,o===null?l.next=l:(l.next=o.next,o.next=l),d.pending=l))}function Al(o,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194240)!==0)){var v=l.lanes;v&=o.pendingLanes,d|=v,l.lanes=d,Nh(o,d)}}function rm(o,l){var d=o.updateQueue,v=o.alternate;if(v!==null&&(v=v.updateQueue,d===v)){var S=null,b=null;if(d=d.firstBaseUpdate,d!==null){do{var B={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};b===null?S=b=B:b=b.next=B,d=d.next}while(d!==null);b===null?S=b=l:b=b.next=l}else S=b=l;d={baseState:v.baseState,firstBaseUpdate:S,lastBaseUpdate:b,shared:v.shared,effects:v.effects},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=l:o.next=l,d.lastBaseUpdate=l}function Cl(o,l,d,v){var S=o.updateQueue;wr=!1;var b=S.firstBaseUpdate,B=S.lastBaseUpdate,G=S.shared.pending;if(G!==null){S.shared.pending=null;var oe=G,Ee=oe.next;oe.next=null,B===null?b=Ee:B.next=Ee,B=oe;var We=o.alternate;We!==null&&(We=We.updateQueue,G=We.lastBaseUpdate,G!==B&&(G===null?We.firstBaseUpdate=Ee:G.next=Ee,We.lastBaseUpdate=oe))}if(b!==null){var pt=S.baseState;B=0,We=Ee=oe=null,G=b;do{var st=G.lane,kt=G.eventTime;if((v&st)===st){We!==null&&(We=We.next={eventTime:kt,lane:0,tag:G.tag,payload:G.payload,callback:G.callback,next:null});e:{var $e=o,Rn=G;switch(st=l,kt=d,Rn.tag){case 1:if($e=Rn.payload,typeof $e=="function"){pt=$e.call(kt,pt,st);break e}pt=$e;break e;case 3:$e.flags=$e.flags&-65537|128;case 0:if($e=Rn.payload,st=typeof $e=="function"?$e.call(kt,pt,st):$e,st==null)break e;pt=s({},pt,st);break e;case 2:wr=!0}}G.callback!==null&&G.lane!==0&&(o.flags|=64,st=S.effects,st===null?S.effects=[G]:st.push(G))}else kt={eventTime:kt,lane:st,tag:G.tag,payload:G.payload,callback:G.callback,next:null},We===null?(Ee=We=kt,oe=pt):We=We.next=kt,B|=st;if(G=G.next,G===null){if(G=S.shared.pending,G===null)break;st=G,G=st.next,st.next=null,S.lastBaseUpdate=st,S.shared.pending=null}}while(!0);if(We===null&&(oe=pt),S.baseState=oe,S.firstBaseUpdate=Ee,S.lastBaseUpdate=We,l=S.shared.interleaved,l!==null){S=l;do B|=S.lane,S=S.next;while(S!==l)}else b===null&&(S.shared.lanes=0);$s|=B,o.lanes=B,o.memoizedState=pt}}function sm(o,l,d){if(o=l.effects,l.effects=null,o!==null)for(l=0;l<o.length;l++){var v=o[l],S=v.callback;if(S!==null){if(v.callback=null,v=d,typeof S!="function")throw Error(a(191,S));S.call(v)}}}var om=new n.Component().refs;function Xh(o,l,d,v){l=o.memoizedState,d=d(v,l),d=d==null?l:s({},l,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var Rl={isMounted:function(o){return(o=o._reactInternals)?C(o)===o:!1},enqueueSetState:function(o,l,d){o=o._reactInternals;var v=Bn(),S=Cr(o),b=$i(v,S);b.payload=l,d!=null&&(b.callback=d),Tr(o,b),l=di(o,S,v),l!==null&&Al(l,o,S)},enqueueReplaceState:function(o,l,d){o=o._reactInternals;var v=Bn(),S=Cr(o),b=$i(v,S);b.tag=1,b.payload=l,d!=null&&(b.callback=d),Tr(o,b),l=di(o,S,v),l!==null&&Al(l,o,S)},enqueueForceUpdate:function(o,l){o=o._reactInternals;var d=Bn(),v=Cr(o),S=$i(d,v);S.tag=2,l!=null&&(S.callback=l),Tr(o,S),l=di(o,v,d),l!==null&&Al(l,o,v)}};function am(o,l,d,v,S,b,B){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(v,b,B):l.prototype&&l.prototype.isPureReactComponent?!wl(d,v)||!wl(S,b):!0}function lm(o,l,d){var v=!1,S=wt,b=l.contextType;return typeof b=="object"&&b!==null?b=li(b):(S=Qt(l)?Ct:Oe.current,v=l.contextTypes,b=(v=v!=null)?fn(o,S):wt),l=new l(d,b),o.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Rl,o.stateNode=l,l._reactInternals=o,v&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=S,o.__reactInternalMemoizedMaskedChildContext=b),l}function cm(o,l,d,v){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,v),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,v),l.state!==o&&Rl.enqueueReplaceState(l,l.state,null)}function Yh(o,l,d,v){var S=o.stateNode;S.props=d,S.state=o.memoizedState,S.refs=om,Wh(o);var b=l.contextType;typeof b=="object"&&b!==null?S.context=li(b):(b=Qt(l)?Ct:Oe.current,S.context=fn(o,b)),S.state=o.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(Xh(o,l,b,d),S.state=o.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(l=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),l!==S.state&&Rl.enqueueReplaceState(S,S.state,null),Cl(o,d,S,v),S.state=o.memoizedState),typeof S.componentDidMount=="function"&&(o.flags|=4194308)}var Xs=[],Ys=0,Pl=null,Il=0,ci=[],ui=0,Zr=null,er=1,tr="";function jr(o,l){Xs[Ys++]=Il,Xs[Ys++]=Pl,Pl=o,Il=l}function um(o,l,d){ci[ui++]=er,ci[ui++]=tr,ci[ui++]=Zr,Zr=o;var v=er;o=tr;var S=32-Wt(v)-1;v&=~(1<<S),d+=1;var b=32-Wt(l)+S;if(30<b){var B=S-S%5;b=(v&(1<<B)-1).toString(32),v>>=B,S-=B,er=1<<32-Wt(l)+S|d<<S|v,tr=b+o}else er=1<<b|d<<S|v,tr=o}function qh(o){o.return!==null&&(jr(o,1),um(o,1,0))}function Zh(o){for(;o===Pl;)Pl=Xs[--Ys],Xs[Ys]=null,Il=Xs[--Ys],Xs[Ys]=null;for(;o===Zr;)Zr=ci[--ui],ci[ui]=null,tr=ci[--ui],ci[ui]=null,er=ci[--ui],ci[ui]=null}var $n=null,ei=null,Xt=!1,Xo=!1,xi=null;function hm(o,l){var d=pi(5,null,null,0);d.elementType="DELETED",d.stateNode=l,d.return=o,l=o.deletions,l===null?(o.deletions=[d],o.flags|=16):l.push(d)}function fm(o,l){switch(o.tag){case 5:return l=Tn(l,o.type,o.pendingProps),l!==null?(o.stateNode=l,$n=o,ei=Vs(l),!0):!1;case 6:return l=hl(l,o.pendingProps),l!==null?(o.stateNode=l,$n=o,ei=null,!0):!1;case 13:if(l=fl(l),l!==null){var d=Zr!==null?{id:er,overflow:tr}:null;return o.memoizedState={dehydrated:l,treeContext:d,retryLane:1073741824},d=pi(18,null,null,0),d.stateNode=l,d.return=o,o.child=d,$n=o,ei=null,!0}return!1;default:return!1}}function jh(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Jh(o){if(Xt){var l=ei;if(l){var d=l;if(!fm(o,l)){if(jh(o))throw Error(a(418));l=Sr(d);var v=$n;l&&fm(o,l)?hm(v,d):(o.flags=o.flags&-4097|2,Xt=!1,$n=o)}}else{if(jh(o))throw Error(a(418));o.flags=o.flags&-4097|2,Xt=!1,$n=o}}}function dm(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;$n=o}function Yo(o){if(!ge||o!==$n)return!1;if(!Xt)return dm(o),Xt=!0,!1;if(o.tag!==3&&(o.tag!==5||ee(o.type)&&!_e(o.type,o.memoizedProps))){var l=ei;if(l){if(jh(o)){for(o=ei;o;)o=Sr(o);throw Error(a(418))}for(;l;)hm(o,l),l=Sr(l)}}if(dm(o),o.tag===13){if(!ge)throw Error(a(316));if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));ei=Lh(o)}else ei=$n?Sr(o.stateNode):null;return!0}function qs(){ge&&(ei=$n=null,Xo=Xt=!1)}function Kh(o){xi===null?xi=[o]:xi.push(o)}function qo(o,l,d){if(o=d.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(a(309));var v=d.stateNode}if(!v)throw Error(a(147,o));var S=v,b=""+o;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===b?l.ref:(l=function(B){var G=S.refs;G===om&&(G=S.refs={}),B===null?delete G[b]:G[b]=B},l._stringRef=b,l)}if(typeof o!="string")throw Error(a(284));if(!d._owner)throw Error(a(290,o))}return o}function Ll(o,l){throw o=Object.prototype.toString.call(l),Error(a(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o))}function pm(o){var l=o._init;return l(o._payload)}function mm(o){function l(J,X){if(o){var ne=J.deletions;ne===null?(J.deletions=[X],J.flags|=16):ne.push(X)}}function d(J,X){if(!o)return null;for(;X!==null;)l(J,X),X=X.sibling;return null}function v(J,X){for(J=new Map;X!==null;)X.key!==null?J.set(X.key,X):J.set(X.index,X),X=X.sibling;return J}function S(J,X){return J=Pr(J,X),J.index=0,J.sibling=null,J}function b(J,X,ne){return J.index=ne,o?(ne=J.alternate,ne!==null?(ne=ne.index,ne<X?(J.flags|=2,X):ne):(J.flags|=2,X)):(J.flags|=1048576,X)}function B(J){return o&&J.alternate===null&&(J.flags|=2),J}function G(J,X,ne,Be){return X===null||X.tag!==6?(X=Nf(ne,J.mode,Be),X.return=J,X):(X=S(X,ne),X.return=J,X)}function oe(J,X,ne,Be){var Qe=ne.type;return Qe===f?We(J,X,ne.props.children,Be,ne.key):X!==null&&(X.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===E&&pm(Qe)===X.type)?(Be=S(X,ne.props),Be.ref=qo(J,X,ne),Be.return=J,Be):(Be=cc(ne.type,ne.key,ne.props,null,J.mode,Be),Be.ref=qo(J,X,ne),Be.return=J,Be)}function Ee(J,X,ne,Be){return X===null||X.tag!==4||X.stateNode.containerInfo!==ne.containerInfo||X.stateNode.implementation!==ne.implementation?(X=Of(ne,J.mode,Be),X.return=J,X):(X=S(X,ne.children||[]),X.return=J,X)}function We(J,X,ne,Be,Qe){return X===null||X.tag!==7?(X=ns(ne,J.mode,Be,Qe),X.return=J,X):(X=S(X,ne),X.return=J,X)}function pt(J,X,ne){if(typeof X=="string"&&X!==""||typeof X=="number")return X=Nf(""+X,J.mode,ne),X.return=J,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case u:return ne=cc(X.type,X.key,X.props,null,J.mode,ne),ne.ref=qo(J,null,X),ne.return=J,ne;case h:return X=Of(X,J.mode,ne),X.return=J,X;case E:var Be=X._init;return pt(J,Be(X._payload),ne)}if(ce(X)||R(X))return X=ns(X,J.mode,ne,null),X.return=J,X;Ll(J,X)}return null}function st(J,X,ne,Be){var Qe=X!==null?X.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number")return Qe!==null?null:G(J,X,""+ne,Be);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case u:return ne.key===Qe?oe(J,X,ne,Be):null;case h:return ne.key===Qe?Ee(J,X,ne,Be):null;case E:return Qe=ne._init,st(J,X,Qe(ne._payload),Be)}if(ce(ne)||R(ne))return Qe!==null?null:We(J,X,ne,Be,null);Ll(J,ne)}return null}function kt(J,X,ne,Be,Qe){if(typeof Be=="string"&&Be!==""||typeof Be=="number")return J=J.get(ne)||null,G(X,J,""+Be,Qe);if(typeof Be=="object"&&Be!==null){switch(Be.$$typeof){case u:return J=J.get(Be.key===null?ne:Be.key)||null,oe(X,J,Be,Qe);case h:return J=J.get(Be.key===null?ne:Be.key)||null,Ee(X,J,Be,Qe);case E:var Mt=Be._init;return kt(J,X,ne,Mt(Be._payload),Qe)}if(ce(Be)||R(Be))return J=J.get(ne)||null,We(X,J,Be,Qe,null);Ll(X,Be)}return null}function $e(J,X,ne,Be){for(var Qe=null,Mt=null,mt=X,Nt=X=0,gn=null;mt!==null&&Nt<ne.length;Nt++){mt.index>Nt?(gn=mt,mt=null):gn=mt.sibling;var Ot=st(J,mt,ne[Nt],Be);if(Ot===null){mt===null&&(mt=gn);break}o&&mt&&Ot.alternate===null&&l(J,mt),X=b(Ot,X,Nt),Mt===null?Qe=Ot:Mt.sibling=Ot,Mt=Ot,mt=gn}if(Nt===ne.length)return d(J,mt),Xt&&jr(J,Nt),Qe;if(mt===null){for(;Nt<ne.length;Nt++)mt=pt(J,ne[Nt],Be),mt!==null&&(X=b(mt,X,Nt),Mt===null?Qe=mt:Mt.sibling=mt,Mt=mt);return Xt&&jr(J,Nt),Qe}for(mt=v(J,mt);Nt<ne.length;Nt++)gn=kt(mt,J,Nt,ne[Nt],Be),gn!==null&&(o&&gn.alternate!==null&&mt.delete(gn.key===null?Nt:gn.key),X=b(gn,X,Nt),Mt===null?Qe=gn:Mt.sibling=gn,Mt=gn);return o&&mt.forEach(function(Ir){return l(J,Ir)}),Xt&&jr(J,Nt),Qe}function Rn(J,X,ne,Be){var Qe=R(ne);if(typeof Qe!="function")throw Error(a(150));if(ne=Qe.call(ne),ne==null)throw Error(a(151));for(var Mt=Qe=null,mt=X,Nt=X=0,gn=null,Ot=ne.next();mt!==null&&!Ot.done;Nt++,Ot=ne.next()){mt.index>Nt?(gn=mt,mt=null):gn=mt.sibling;var Ir=st(J,mt,Ot.value,Be);if(Ir===null){mt===null&&(mt=gn);break}o&&mt&&Ir.alternate===null&&l(J,mt),X=b(Ir,X,Nt),Mt===null?Qe=Ir:Mt.sibling=Ir,Mt=Ir,mt=gn}if(Ot.done)return d(J,mt),Xt&&jr(J,Nt),Qe;if(mt===null){for(;!Ot.done;Nt++,Ot=ne.next())Ot=pt(J,Ot.value,Be),Ot!==null&&(X=b(Ot,X,Nt),Mt===null?Qe=Ot:Mt.sibling=Ot,Mt=Ot);return Xt&&jr(J,Nt),Qe}for(mt=v(J,mt);!Ot.done;Nt++,Ot=ne.next())Ot=kt(mt,J,Nt,Ot.value,Be),Ot!==null&&(o&&Ot.alternate!==null&&mt.delete(Ot.key===null?Nt:Ot.key),X=b(Ot,X,Nt),Mt===null?Qe=Ot:Mt.sibling=Ot,Mt=Ot);return o&&mt.forEach(function(Zx){return l(J,Zx)}),Xt&&jr(J,Nt),Qe}function mi(J,X,ne,Be){if(typeof ne=="object"&&ne!==null&&ne.type===f&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case u:e:{for(var Qe=ne.key,Mt=X;Mt!==null;){if(Mt.key===Qe){if(Qe=ne.type,Qe===f){if(Mt.tag===7){d(J,Mt.sibling),X=S(Mt,ne.props.children),X.return=J,J=X;break e}}else if(Mt.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===E&&pm(Qe)===Mt.type){d(J,Mt.sibling),X=S(Mt,ne.props),X.ref=qo(J,Mt,ne),X.return=J,J=X;break e}d(J,Mt);break}else l(J,Mt);Mt=Mt.sibling}ne.type===f?(X=ns(ne.props.children,J.mode,Be,ne.key),X.return=J,J=X):(Be=cc(ne.type,ne.key,ne.props,null,J.mode,Be),Be.ref=qo(J,X,ne),Be.return=J,J=Be)}return B(J);case h:e:{for(Mt=ne.key;X!==null;){if(X.key===Mt)if(X.tag===4&&X.stateNode.containerInfo===ne.containerInfo&&X.stateNode.implementation===ne.implementation){d(J,X.sibling),X=S(X,ne.children||[]),X.return=J,J=X;break e}else{d(J,X);break}else l(J,X);X=X.sibling}X=Of(ne,J.mode,Be),X.return=J,J=X}return B(J);case E:return Mt=ne._init,mi(J,X,Mt(ne._payload),Be)}if(ce(ne))return $e(J,X,ne,Be);if(R(ne))return Rn(J,X,ne,Be);Ll(J,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"?(ne=""+ne,X!==null&&X.tag===6?(d(J,X.sibling),X=S(X,ne),X.return=J,J=X):(d(J,X),X=Nf(ne,J.mode,Be),X.return=J,J=X),B(J)):d(J,X)}return mi}var Zs=mm(!0),gm=mm(!1),Zo={},hi=Rt(Zo),jo=Rt(Zo),js=Rt(Zo);function Bi(o){if(o===Zo)throw Error(a(174));return o}function Qh(o,l){_t(js,l),_t(jo,o),_t(hi,Zo),o=ve(l),at(hi),_t(hi,o)}function Js(){at(hi),at(jo),at(js)}function vm(o){var l=Bi(js.current),d=Bi(hi.current);l=V(d,o.type,l),d!==l&&(_t(jo,o),_t(hi,l))}function $h(o){jo.current===o&&(at(hi),at(jo))}var Yt=Rt(0);function Dl(o){for(var l=o;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Ii(d)||qr(d)))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if(l.flags&128)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var ef=[];function tf(){for(var o=0;o<ef.length;o++){var l=ef[o];tt?l._workInProgressVersionPrimary=null:l._workInProgressVersionSecondary=null}ef.length=0}var Ul=c.ReactCurrentDispatcher,fi=c.ReactCurrentBatchConfig,Ks=0,Zt=null,bn=null,mn=null,Nl=!1,Jo=!1,Ko=0,yx=0;function An(){throw Error(a(321))}function nf(o,l){if(l===null)return!1;for(var d=0;d<l.length&&d<o.length;d++)if(!Ni(o[d],l[d]))return!1;return!0}function rf(o,l,d,v,S,b){if(Ks=b,Zt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Ul.current=o===null||o.memoizedState===null?Ex:wx,o=d(v,S),Jo){b=0;do{if(Jo=!1,Ko=0,25<=b)throw Error(a(301));b+=1,mn=bn=null,l.updateQueue=null,Ul.current=Tx,o=d(v,S)}while(Jo)}if(Ul.current=kl,l=bn!==null&&bn.next!==null,Ks=0,mn=bn=Zt=null,Nl=!1,l)throw Error(a(300));return o}function sf(){var o=Ko!==0;return Ko=0,o}function nr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?Zt.memoizedState=mn=o:mn=mn.next=o,mn}function zi(){if(bn===null){var o=Zt.alternate;o=o!==null?o.memoizedState:null}else o=bn.next;var l=mn===null?Zt.memoizedState:mn.next;if(l!==null)mn=l,bn=o;else{if(o===null)throw Error(a(310));bn=o,o={memoizedState:bn.memoizedState,baseState:bn.baseState,baseQueue:bn.baseQueue,queue:bn.queue,next:null},mn===null?Zt.memoizedState=mn=o:mn=mn.next=o}return mn}function Jr(o,l){return typeof l=="function"?l(o):l}function Ol(o){var l=zi(),d=l.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=o;var v=bn,S=v.baseQueue,b=d.pending;if(b!==null){if(S!==null){var B=S.next;S.next=b.next,b.next=B}v.baseQueue=S=b,d.pending=null}if(S!==null){b=S.next,v=v.baseState;var G=B=null,oe=null,Ee=b;do{var We=Ee.lane;if((Ks&We)===We)oe!==null&&(oe=oe.next={lane:0,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null}),v=Ee.hasEagerState?Ee.eagerState:o(v,Ee.action);else{var pt={lane:We,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null};oe===null?(G=oe=pt,B=v):oe=oe.next=pt,Zt.lanes|=We,$s|=We}Ee=Ee.next}while(Ee!==null&&Ee!==b);oe===null?B=v:oe.next=G,Ni(v,l.memoizedState)||(ti=!0),l.memoizedState=v,l.baseState=B,l.baseQueue=oe,d.lastRenderedState=v}if(o=d.interleaved,o!==null){S=o;do b=S.lane,Zt.lanes|=b,$s|=b,S=S.next;while(S!==o)}else S===null&&(d.lanes=0);return[l.memoizedState,d.dispatch]}function Fl(o){var l=zi(),d=l.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=o;var v=d.dispatch,S=d.pending,b=l.memoizedState;if(S!==null){d.pending=null;var B=S=S.next;do b=o(b,B.action),B=B.next;while(B!==S);Ni(b,l.memoizedState)||(ti=!0),l.memoizedState=b,l.baseQueue===null&&(l.baseState=b),d.lastRenderedState=b}return[b,v]}function _m(){}function ym(o,l){var d=Zt,v=zi(),S=l(),b=!Ni(v.memoizedState,S);if(b&&(v.memoizedState=S,ti=!0),v=v.queue,$o(Mm.bind(null,d,v,o),[o]),v.getSnapshot!==l||b||mn!==null&&mn.memoizedState.tag&1){if(d.flags|=2048,Qo(9,Sm.bind(null,d,v,S,l),void 0,null),sn===null)throw Error(a(349));Ks&30||xm(d,l,S)}return S}function xm(o,l,d){o.flags|=16384,o={getSnapshot:l,value:d},l=Zt.updateQueue,l===null?(l={lastEffect:null,stores:null},Zt.updateQueue=l,l.stores=[o]):(d=l.stores,d===null?l.stores=[o]:d.push(o))}function Sm(o,l,d,v){l.value=d,l.getSnapshot=v,Em(l)&&di(o,1,-1)}function Mm(o,l,d){return d(function(){Em(l)&&di(o,1,-1)})}function Em(o){var l=o.getSnapshot;o=o.value;try{var d=l();return!Ni(o,d)}catch{return!0}}function of(o){var l=nr();return typeof o=="function"&&(o=o()),l.memoizedState=l.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Jr,lastRenderedState:o},l.queue=o,o=o.dispatch=Mx.bind(null,Zt,o),[l.memoizedState,o]}function Qo(o,l,d,v){return o={tag:o,create:l,destroy:d,deps:v,next:null},l=Zt.updateQueue,l===null?(l={lastEffect:null,stores:null},Zt.updateQueue=l,l.lastEffect=o.next=o):(d=l.lastEffect,d===null?l.lastEffect=o.next=o:(v=d.next,d.next=o,o.next=v,l.lastEffect=o)),o}function wm(){return zi().memoizedState}function Bl(o,l,d,v){var S=nr();Zt.flags|=o,S.memoizedState=Qo(1|l,d,void 0,v===void 0?null:v)}function zl(o,l,d,v){var S=zi();v=v===void 0?null:v;var b=void 0;if(bn!==null){var B=bn.memoizedState;if(b=B.destroy,v!==null&&nf(v,B.deps)){S.memoizedState=Qo(l,d,b,v);return}}Zt.flags|=o,S.memoizedState=Qo(1|l,d,b,v)}function af(o,l){return Bl(8390656,8,o,l)}function $o(o,l){return zl(2048,8,o,l)}function Tm(o,l){return zl(4,2,o,l)}function bm(o,l){return zl(4,4,o,l)}function Am(o,l){if(typeof l=="function")return o=o(),l(o),function(){l(null)};if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function Cm(o,l,d){return d=d!=null?d.concat([o]):null,zl(4,4,Am.bind(null,l,o),d)}function lf(){}function Rm(o,l){var d=zi();l=l===void 0?null:l;var v=d.memoizedState;return v!==null&&l!==null&&nf(l,v[1])?v[0]:(d.memoizedState=[o,l],o)}function Pm(o,l){var d=zi();l=l===void 0?null:l;var v=d.memoizedState;return v!==null&&l!==null&&nf(l,v[1])?v[0]:(o=o(),d.memoizedState=[o,l],o)}function xx(o,l){var d=Ut;Ut=d!==0&&4>d?d:4,o(!0);var v=fi.transition;fi.transition={};try{o(!1),l()}finally{Ut=d,fi.transition=v}}function Im(){return zi().memoizedState}function Sx(o,l,d){var v=Cr(o);d={lane:v,action:d,hasEagerState:!1,eagerState:null,next:null},Lm(o)?Dm(l,d):(Um(o,l,d),d=Bn(),o=di(o,v,d),o!==null&&Nm(o,l,v))}function Mx(o,l,d){var v=Cr(o),S={lane:v,action:d,hasEagerState:!1,eagerState:null,next:null};if(Lm(o))Dm(l,S);else{Um(o,l,S);var b=o.alternate;if(o.lanes===0&&(b===null||b.lanes===0)&&(b=l.lastRenderedReducer,b!==null))try{var B=l.lastRenderedState,G=b(B,d);if(S.hasEagerState=!0,S.eagerState=G,Ni(G,B))return}catch{}finally{}d=Bn(),o=di(o,v,d),o!==null&&Nm(o,l,v)}}function Lm(o){var l=o.alternate;return o===Zt||l!==null&&l===Zt}function Dm(o,l){Jo=Nl=!0;var d=o.pending;d===null?l.next=l:(l.next=d.next,d.next=l),o.pending=l}function Um(o,l,d){sn!==null&&o.mode&1&&!(Tt&2)?(o=l.interleaved,o===null?(d.next=d,Fi===null?Fi=[l]:Fi.push(l)):(d.next=o.next,o.next=d),l.interleaved=d):(o=l.pending,o===null?d.next=d:(d.next=o.next,o.next=d),l.pending=d)}function Nm(o,l,d){if(d&4194240){var v=l.lanes;v&=o.pendingLanes,d|=v,l.lanes=d,Nh(o,d)}}var kl={readContext:li,useCallback:An,useContext:An,useEffect:An,useImperativeHandle:An,useInsertionEffect:An,useLayoutEffect:An,useMemo:An,useReducer:An,useRef:An,useState:An,useDebugValue:An,useDeferredValue:An,useTransition:An,useMutableSource:An,useSyncExternalStore:An,useId:An,unstable_isNewReconciler:!1},Ex={readContext:li,useCallback:function(o,l){return nr().memoizedState=[o,l===void 0?null:l],o},useContext:li,useEffect:af,useImperativeHandle:function(o,l,d){return d=d!=null?d.concat([o]):null,Bl(4194308,4,Am.bind(null,l,o),d)},useLayoutEffect:function(o,l){return Bl(4194308,4,o,l)},useInsertionEffect:function(o,l){return Bl(4,2,o,l)},useMemo:function(o,l){var d=nr();return l=l===void 0?null:l,o=o(),d.memoizedState=[o,l],o},useReducer:function(o,l,d){var v=nr();return l=d!==void 0?d(l):l,v.memoizedState=v.baseState=l,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:l},v.queue=o,o=o.dispatch=Sx.bind(null,Zt,o),[v.memoizedState,o]},useRef:function(o){var l=nr();return o={current:o},l.memoizedState=o},useState:of,useDebugValue:lf,useDeferredValue:function(o){var l=of(o),d=l[0],v=l[1];return af(function(){var S=fi.transition;fi.transition={};try{v(o)}finally{fi.transition=S}},[o]),d},useTransition:function(){var o=of(!1),l=o[0];return o=xx.bind(null,o[1]),nr().memoizedState=o,[l,o]},useMutableSource:function(){},useSyncExternalStore:function(o,l,d){var v=Zt,S=nr();if(Xt){if(d===void 0)throw Error(a(407));d=d()}else{if(d=l(),sn===null)throw Error(a(349));Ks&30||xm(v,l,d)}S.memoizedState=d;var b={value:d,getSnapshot:l};return S.queue=b,af(Mm.bind(null,v,b,o),[o]),v.flags|=2048,Qo(9,Sm.bind(null,v,b,d,l),void 0,null),d},useId:function(){var o=nr(),l=sn.identifierPrefix;if(Xt){var d=tr,v=er;d=(v&~(1<<32-Wt(v)-1)).toString(32)+d,l=":"+l+"R"+d,d=Ko++,0<d&&(l+="H"+d.toString(32)),l+=":"}else d=yx++,l=":"+l+"r"+d.toString(32)+":";return o.memoizedState=l},unstable_isNewReconciler:!1},wx={readContext:li,useCallback:Rm,useContext:li,useEffect:$o,useImperativeHandle:Cm,useInsertionEffect:Tm,useLayoutEffect:bm,useMemo:Pm,useReducer:Ol,useRef:wm,useState:function(){return Ol(Jr)},useDebugValue:lf,useDeferredValue:function(o){var l=Ol(Jr),d=l[0],v=l[1];return $o(function(){var S=fi.transition;fi.transition={};try{v(o)}finally{fi.transition=S}},[o]),d},useTransition:function(){var o=Ol(Jr)[0],l=zi().memoizedState;return[o,l]},useMutableSource:_m,useSyncExternalStore:ym,useId:Im,unstable_isNewReconciler:!1},Tx={readContext:li,useCallback:Rm,useContext:li,useEffect:$o,useImperativeHandle:Cm,useInsertionEffect:Tm,useLayoutEffect:bm,useMemo:Pm,useReducer:Fl,useRef:wm,useState:function(){return Fl(Jr)},useDebugValue:lf,useDeferredValue:function(o){var l=Fl(Jr),d=l[0],v=l[1];return $o(function(){var S=fi.transition;fi.transition={};try{v(o)}finally{fi.transition=S}},[o]),d},useTransition:function(){var o=Fl(Jr)[0],l=zi().memoizedState;return[o,l]},useMutableSource:_m,useSyncExternalStore:ym,useId:Im,unstable_isNewReconciler:!1};function cf(o,l){try{var d="",v=l;do d+=_x(v),v=v.return;while(v);var S=d}catch(b){S=`
3873Error generating stack: `+b.message+`
3874`+b.stack}return{value:o,source:l,stack:S}}function uf(o,l){try{console.error(l.value)}catch(d){setTimeout(function(){throw d})}}var bx=typeof WeakMap=="function"?WeakMap:Map;function Om(o,l,d){d=$i(-1,d),d.tag=3,d.payload={element:null};var v=l.value;return d.callback=function(){nc||(nc=!0,Cf=v),uf(o,l)},d}function Fm(o,l,d){d=$i(-1,d),d.tag=3;var v=o.type.getDerivedStateFromError;if(typeof v=="function"){var S=l.value;d.payload=function(){return v(S)},d.callback=function(){uf(o,l)}}var b=o.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(d.callback=function(){uf(o,l),typeof v!="function"&&(br===null?br=new Set([this]):br.add(this));var B=l.stack;this.componentDidCatch(l.value,{componentStack:B!==null?B:""})}),d}function Bm(o,l,d){var v=o.pingCache;if(v===null){v=o.pingCache=new bx;var S=new Set;v.set(l,S)}else S=v.get(l),S===void 0&&(S=new Set,v.set(l,S));S.has(d)||(S.add(d),o=kx.bind(null,o,l,d),l.then(o,o))}function zm(o){do{var l;if((l=o.tag===13)&&(l=o.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return o;o=o.return}while(o!==null);return null}function km(o,l,d,v,S){return o.mode&1?(o.flags|=65536,o.lanes=S,o):(o===l?o.flags|=65536:(o.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(l=$i(-1,1),l.tag=2,Tr(d,l))),d.lanes|=1),o)}function ki(o){o.flags|=4}function Vm(o,l){if(o!==null&&o.child===l.child)return!0;if(l.flags&16)return!1;for(o=l.child;o!==null;){if(o.flags&12854||o.subtreeFlags&12854)return!1;o=o.sibling}return!0}var ea,ta,Vl,Hl;if(ft)ea=function(o,l){for(var d=l.child;d!==null;){if(d.tag===5||d.tag===6)Re(o,d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},ta=function(){},Vl=function(o,l,d,v,S){if(o=o.memoizedProps,o!==v){var b=l.stateNode,B=Bi(hi.current);d=se(b,d,o,v,S,B),(l.updateQueue=d)&&ki(l)}},Hl=function(o,l,d,v){d!==v&&ki(l)};else if(pe){ea=function(o,l,d,v){for(var S=l.child;S!==null;){if(S.tag===5){var b=S.stateNode;d&&v&&(b=At(b,S.type,S.memoizedProps,S)),Re(o,b)}else if(S.tag===6)b=S.stateNode,d&&v&&(b=rn(b,S.memoizedProps,S)),Re(o,b);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)b=S.child,b!==null&&(b.return=S),ea(o,S,!0,!0);else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===l)break;for(;S.sibling===null;){if(S.return===null||S.return===l)return;S=S.return}S.sibling.return=S.return,S=S.sibling}};var Hm=function(o,l,d,v){for(var S=l.child;S!==null;){if(S.tag===5){var b=S.stateNode;d&&v&&(b=At(b,S.type,S.memoizedProps,S)),nt(o,b)}else if(S.tag===6)b=S.stateNode,d&&v&&(b=rn(b,S.memoizedProps,S)),nt(o,b);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)b=S.child,b!==null&&(b.return=S),Hm(o,S,!0,!0);else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===l)break;for(;S.sibling===null;){if(S.return===null||S.return===l)return;S=S.return}S.sibling.return=S.return,S=S.sibling}};ta=function(o,l){var d=l.stateNode;if(!Vm(o,l)){o=d.containerInfo;var v=Pe(o);Hm(v,l,!1,!1),d.pendingChildren=v,ki(l),It(o,v)}},Vl=function(o,l,d,v,S){var b=o.stateNode,B=o.memoizedProps;if((o=Vm(o,l))&&B===v)l.stateNode=b;else{var G=l.stateNode,oe=Bi(hi.current),Ee=null;B!==v&&(Ee=se(G,d,B,v,S,oe)),o&&Ee===null?l.stateNode=b:(b=Fe(b,Ee,d,B,v,l,o,G),Xe(b,d,v,S,oe)&&ki(l),l.stateNode=b,o?ki(l):ea(b,l,!1,!1))}},Hl=function(o,l,d,v){d!==v?(o=Bi(js.current),d=Bi(hi.current),l.stateNode=Le(v,o,d,l),ki(l)):l.stateNode=o.stateNode}}else ta=function(){},Vl=function(){},Hl=function(){};function na(o,l){if(!Xt)switch(o.tailMode){case"hidden":l=o.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var v=null;d!==null;)d.alternate!==null&&(v=d),d=d.sibling;v===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:v.sibling=null}}function Cn(o){var l=o.alternate!==null&&o.alternate.child===o.child,d=0,v=0;if(l)for(var S=o.child;S!==null;)d|=S.lanes|S.childLanes,v|=S.subtreeFlags&14680064,v|=S.flags&14680064,S.return=o,S=S.sibling;else for(S=o.child;S!==null;)d|=S.lanes|S.childLanes,v|=S.subtreeFlags,v|=S.flags,S.return=o,S=S.sibling;return o.subtreeFlags|=v,o.childLanes=d,l}function Ax(o,l,d){var v=l.pendingProps;switch(Zh(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Cn(l),null;case 1:return Qt(l.type)&&dn(),Cn(l),null;case 3:return v=l.stateNode,Js(),at(Gt),at(Oe),tf(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(o===null||o.child===null)&&(Yo(l)?ki(l):o===null||o.memoizedState.isDehydrated&&!(l.flags&256)||(l.flags|=1024,xi!==null&&(If(xi),xi=null))),ta(o,l),Cn(l),null;case 5:$h(l),d=Bi(js.current);var S=l.type;if(o!==null&&l.stateNode!=null)Vl(o,l,S,v,d),o.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!v){if(l.stateNode===null)throw Error(a(166));return Cn(l),null}if(o=Bi(hi.current),Yo(l)){if(!ge)throw Error(a(175));o=ml(l.stateNode,l.type,l.memoizedProps,d,o,l,!Xo),l.updateQueue=o,o!==null&&ki(l)}else{var b=de(S,v,d,o,l);ea(b,l,!1,!1),l.stateNode=b,Xe(b,S,v,d,o)&&ki(l)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Cn(l),null;case 6:if(o&&l.stateNode!=null)Hl(o,l,o.memoizedProps,v);else{if(typeof v!="string"&&l.stateNode===null)throw Error(a(166));if(o=Bi(js.current),d=Bi(hi.current),Yo(l)){if(!ge)throw Error(a(176));if(o=l.stateNode,v=l.memoizedProps,(d=gl(o,v,l,!Xo))&&(S=$n,S!==null))switch(b=(S.mode&1)!==0,S.tag){case 3:Y(S.stateNode.containerInfo,o,v,b);break;case 5:we(S.type,S.memoizedProps,S.stateNode,o,v,b)}d&&ki(l)}else l.stateNode=Le(v,o,d,l)}return Cn(l),null;case 13:if(at(Yt),v=l.memoizedState,Xt&&ei!==null&&l.mode&1&&!(l.flags&128)){for(o=ei;o;)o=Sr(o);return qs(),l.flags|=98560,l}if(v!==null&&v.dehydrated!==null){if(v=Yo(l),o===null){if(!v)throw Error(a(318));if(!ge)throw Error(a(344));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));Ih(o,l)}else qs(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;return Cn(l),null}return xi!==null&&(If(xi),xi=null),l.flags&128?(l.lanes=d,l):(v=v!==null,d=!1,o===null?Yo(l):d=o.memoizedState!==null,v&&!d&&(l.child.flags|=8192,l.mode&1&&(o===null||Yt.current&1?ln===0&&(ln=3):Df())),l.updateQueue!==null&&(l.flags|=4),Cn(l),null);case 4:return Js(),ta(o,l),o===null&&Ke(l.stateNode.containerInfo),Cn(l),null;case 10:return Hh(l.type._context),Cn(l),null;case 17:return Qt(l.type)&&dn(),Cn(l),null;case 19:if(at(Yt),S=l.memoizedState,S===null)return Cn(l),null;if(v=(l.flags&128)!==0,b=S.rendering,b===null)if(v)na(S,!1);else{if(ln!==0||o!==null&&o.flags&128)for(o=l.child;o!==null;){if(b=Dl(o),b!==null){for(l.flags|=128,na(S,!1),o=b.updateQueue,o!==null&&(l.updateQueue=o,l.flags|=4),l.subtreeFlags=0,o=d,v=l.child;v!==null;)d=v,S=o,d.flags&=14680066,b=d.alternate,b===null?(d.childLanes=0,d.lanes=S,d.child=null,d.subtreeFlags=0,d.memoizedProps=null,d.memoizedState=null,d.updateQueue=null,d.dependencies=null,d.stateNode=null):(d.childLanes=b.childLanes,d.lanes=b.lanes,d.child=b.child,d.subtreeFlags=0,d.deletions=null,d.memoizedProps=b.memoizedProps,d.memoizedState=b.memoizedState,d.updateQueue=b.updateQueue,d.type=b.type,S=b.dependencies,d.dependencies=S===null?null:{lanes:S.lanes,firstContext:S.firstContext}),v=v.sibling;return _t(Yt,Yt.current&1|2),l.child}o=o.sibling}S.tail!==null&&pn()>Af&&(l.flags|=128,v=!0,na(S,!1),l.lanes=4194304)}else{if(!v)if(o=Dl(b),o!==null){if(l.flags|=128,v=!0,o=o.updateQueue,o!==null&&(l.updateQueue=o,l.flags|=4),na(S,!0),S.tail===null&&S.tailMode==="hidden"&&!b.alternate&&!Xt)return Cn(l),null}else 2*pn()-S.renderingStartTime>Af&&d!==1073741824&&(l.flags|=128,v=!0,na(S,!1),l.lanes=4194304);S.isBackwards?(b.sibling=l.child,l.child=b):(o=S.last,o!==null?o.sibling=b:l.child=b,S.last=b)}return S.tail!==null?(l=S.tail,S.rendering=l,S.tail=l.sibling,S.renderingStartTime=pn(),l.sibling=null,o=Yt.current,_t(Yt,v?o&1|2:o&1),l):(Cn(l),null);case 22:case 23:return Lf(),v=l.memoizedState!==null,o!==null&&o.memoizedState!==null!==v&&(l.flags|=8192),v&&l.mode&1?ni&1073741824&&(Cn(l),ft&&l.subtreeFlags&6&&(l.flags|=8192)):Cn(l),null;case 24:return null;case 25:return null}throw Error(a(156,l.tag))}var Cx=c.ReactCurrentOwner,ti=!1;function Fn(o,l,d,v){l.child=o===null?gm(l,null,d,v):Zs(l,o.child,d,v)}function Gm(o,l,d,v,S){d=d.render;var b=l.ref;return Ws(l,S),v=rf(o,l,d,v,b,S),d=sf(),o!==null&&!ti?(l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~S,ir(o,l,S)):(Xt&&d&&qh(l),l.flags|=1,Fn(o,l,v,S),l.child)}function Wm(o,l,d,v,S){if(o===null){var b=d.type;return typeof b=="function"&&!Uf(b)&&b.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(l.tag=15,l.type=b,Xm(o,l,b,v,S)):(o=cc(d.type,null,v,l,l.mode,S),o.ref=l.ref,o.return=l,l.child=o)}if(b=o.child,!(o.lanes&S)){var B=b.memoizedProps;if(d=d.compare,d=d!==null?d:wl,d(B,v)&&o.ref===l.ref)return ir(o,l,S)}return l.flags|=1,o=Pr(b,v),o.ref=l.ref,o.return=l,l.child=o}function Xm(o,l,d,v,S){if(o!==null&&wl(o.memoizedProps,v)&&o.ref===l.ref)if(ti=!1,(o.lanes&S)!==0)o.flags&131072&&(ti=!0);else return l.lanes=o.lanes,ir(o,l,S);return hf(o,l,d,v,S)}function Ym(o,l,d){var v=l.pendingProps,S=v.children,b=o!==null?o.memoizedState:null;if(v.mode==="hidden")if(!(l.mode&1))l.memoizedState={baseLanes:0,cachePool:null},_t(Qs,ni),ni|=d;else if(d&1073741824)l.memoizedState={baseLanes:0,cachePool:null},v=b!==null?b.baseLanes:d,_t(Qs,ni),ni|=v;else return o=b!==null?b.baseLanes|d:d,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:o,cachePool:null},l.updateQueue=null,_t(Qs,ni),ni|=o,null;else b!==null?(v=b.baseLanes|d,l.memoizedState=null):v=d,_t(Qs,ni),ni|=v;return Fn(o,l,S,d),l.child}function qm(o,l){var d=l.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(l.flags|=512,l.flags|=2097152)}function hf(o,l,d,v,S){var b=Qt(d)?Ct:Oe.current;return b=fn(l,b),Ws(l,S),d=rf(o,l,d,v,b,S),v=sf(),o!==null&&!ti?(l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~S,ir(o,l,S)):(Xt&&v&&qh(l),l.flags|=1,Fn(o,l,d,S),l.child)}function Zm(o,l,d,v,S){if(Qt(d)){var b=!0;On(l)}else b=!1;if(Ws(l,S),l.stateNode===null)o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),lm(l,d,v),Yh(l,d,v,S),v=!0;else if(o===null){var B=l.stateNode,G=l.memoizedProps;B.props=G;var oe=B.context,Ee=d.contextType;typeof Ee=="object"&&Ee!==null?Ee=li(Ee):(Ee=Qt(d)?Ct:Oe.current,Ee=fn(l,Ee));var We=d.getDerivedStateFromProps,pt=typeof We=="function"||typeof B.getSnapshotBeforeUpdate=="function";pt||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(G!==v||oe!==Ee)&&cm(l,B,v,Ee),wr=!1;var st=l.memoizedState;B.state=st,Cl(l,v,B,S),oe=l.memoizedState,G!==v||st!==oe||Gt.current||wr?(typeof We=="function"&&(Xh(l,d,We,v),oe=l.memoizedState),(G=wr||am(l,d,G,v,st,oe,Ee))?(pt||typeof B.UNSAFE_componentWillMount!="function"&&typeof B.componentWillMount!="function"||(typeof B.componentWillMount=="function"&&B.componentWillMount(),typeof B.UNSAFE_componentWillMount=="function"&&B.UNSAFE_componentWillMount()),typeof B.componentDidMount=="function"&&(l.flags|=4194308)):(typeof B.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=v,l.memoizedState=oe),B.props=v,B.state=oe,B.context=Ee,v=G):(typeof B.componentDidMount=="function"&&(l.flags|=4194308),v=!1)}else{B=l.stateNode,im(o,l),G=l.memoizedProps,Ee=l.type===l.elementType?G:yi(l.type,G),B.props=Ee,pt=l.pendingProps,st=B.context,oe=d.contextType,typeof oe=="object"&&oe!==null?oe=li(oe):(oe=Qt(d)?Ct:Oe.current,oe=fn(l,oe));var kt=d.getDerivedStateFromProps;(We=typeof kt=="function"||typeof B.getSnapshotBeforeUpdate=="function")||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(G!==pt||st!==oe)&&cm(l,B,v,oe),wr=!1,st=l.memoizedState,B.state=st,Cl(l,v,B,S);var $e=l.memoizedState;G!==pt||st!==$e||Gt.current||wr?(typeof kt=="function"&&(Xh(l,d,kt,v),$e=l.memoizedState),(Ee=wr||am(l,d,Ee,v,st,$e,oe)||!1)?(We||typeof B.UNSAFE_componentWillUpdate!="function"&&typeof B.componentWillUpdate!="function"||(typeof B.componentWillUpdate=="function"&&B.componentWillUpdate(v,$e,oe),typeof B.UNSAFE_componentWillUpdate=="function"&&B.UNSAFE_componentWillUpdate(v,$e,oe)),typeof B.componentDidUpdate=="function"&&(l.flags|=4),typeof B.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof B.componentDidUpdate!="function"||G===o.memoizedProps&&st===o.memoizedState||(l.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||G===o.memoizedProps&&st===o.memoizedState||(l.flags|=1024),l.memoizedProps=v,l.memoizedState=$e),B.props=v,B.state=$e,B.context=oe,v=Ee):(typeof B.componentDidUpdate!="function"||G===o.memoizedProps&&st===o.memoizedState||(l.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||G===o.memoizedProps&&st===o.memoizedState||(l.flags|=1024),v=!1)}return ff(o,l,d,v,b,S)}function ff(o,l,d,v,S,b){qm(o,l);var B=(l.flags&128)!==0;if(!v&&!B)return S&&Er(l,d,!1),ir(o,l,b);v=l.stateNode,Cx.current=l;var G=B&&typeof d.getDerivedStateFromError!="function"?null:v.render();return l.flags|=1,o!==null&&B?(l.child=Zs(l,o.child,null,b),l.child=Zs(l,null,G,b)):Fn(o,l,G,b),l.memoizedState=v.state,S&&Er(l,d,!0),l.child}function jm(o){var l=o.stateNode;l.pendingContext?Mr(o,l.pendingContext,l.pendingContext!==l.context):l.context&&Mr(o,l.context,!1),Qh(o,l.containerInfo)}function Jm(o,l,d,v,S){return qs(),Kh(S),l.flags|=256,Fn(o,l,d,v),l.child}var Gl={dehydrated:null,treeContext:null,retryLane:0};function Wl(o){return{baseLanes:o,cachePool:null}}function Km(o,l,d){var v=l.pendingProps,S=Yt.current,b=!1,B=(l.flags&128)!==0,G;if((G=B)||(G=o!==null&&o.memoizedState===null?!1:(S&2)!==0),G?(b=!0,l.flags&=-129):(o===null||o.memoizedState!==null)&&(S|=1),_t(Yt,S&1),o===null)return Jh(l),o=l.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?(l.mode&1?qr(o)?l.lanes=8:l.lanes=1073741824:l.lanes=1,null):(S=v.children,o=v.fallback,b?(v=l.mode,b=l.child,S={mode:"hidden",children:S},!(v&1)&&b!==null?(b.childLanes=0,b.pendingProps=S):b=uc(S,v,0,null),o=ns(o,v,d,null),b.return=l,o.return=l,b.sibling=o,l.child=b,l.child.memoizedState=Wl(d),l.memoizedState=Gl,o):df(l,S));if(S=o.memoizedState,S!==null){if(G=S.dehydrated,G!==null){if(B)return l.flags&256?(l.flags&=-257,Xl(o,l,d,Error(a(422)))):l.memoizedState!==null?(l.child=o.child,l.flags|=128,null):(b=v.fallback,S=l.mode,v=uc({mode:"visible",children:v.children},S,0,null),b=ns(b,S,d,null),b.flags|=2,v.return=l,b.return=l,v.sibling=b,l.child=v,l.mode&1&&Zs(l,o.child,null,d),l.child.memoizedState=Wl(d),l.memoizedState=Gl,b);if(!(l.mode&1))l=Xl(o,l,d,null);else if(qr(G))l=Xl(o,l,d,Error(a(419)));else if(v=(d&o.childLanes)!==0,ti||v){if(v=sn,v!==null){switch(d&-d){case 4:b=2;break;case 16:b=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:b=32;break;case 536870912:b=268435456;break;default:b=0}v=b&(v.suspendedLanes|d)?0:b,v!==0&&v!==S.retryLane&&(S.retryLane=v,di(o,v,-1))}Df(),l=Xl(o,l,d,Error(a(421)))}else Ii(G)?(l.flags|=128,l.child=o.child,l=Vx.bind(null,o),dl(G,l),l=null):(d=S.treeContext,ge&&(ei=Hs(G),$n=l,Xt=!0,xi=null,Xo=!1,d!==null&&(ci[ui++]=er,ci[ui++]=tr,ci[ui++]=Zr,er=d.id,tr=d.overflow,Zr=l)),l=df(l,l.pendingProps.children),l.flags|=4096);return l}return b?(v=$m(o,l,v.children,v.fallback,d),b=l.child,S=o.child.memoizedState,b.memoizedState=S===null?Wl(d):{baseLanes:S.baseLanes|d,cachePool:null},b.childLanes=o.childLanes&~d,l.memoizedState=Gl,v):(d=Qm(o,l,v.children,d),l.memoizedState=null,d)}return b?(v=$m(o,l,v.children,v.fallback,d),b=l.child,S=o.child.memoizedState,b.memoizedState=S===null?Wl(d):{baseLanes:S.baseLanes|d,cachePool:null},b.childLanes=o.childLanes&~d,l.memoizedState=Gl,v):(d=Qm(o,l,v.children,d),l.memoizedState=null,d)}function df(o,l){return l=uc({mode:"visible",children:l},o.mode,0,null),l.return=o,o.child=l}function Qm(o,l,d,v){var S=o.child;return o=S.sibling,d=Pr(S,{mode:"visible",children:d}),!(l.mode&1)&&(d.lanes=v),d.return=l,d.sibling=null,o!==null&&(v=l.deletions,v===null?(l.deletions=[o],l.flags|=16):v.push(o)),l.child=d}function $m(o,l,d,v,S){var b=l.mode;o=o.child;var B=o.sibling,G={mode:"hidden",children:d};return!(b&1)&&l.child!==o?(d=l.child,d.childLanes=0,d.pendingProps=G,l.deletions=null):(d=Pr(o,G),d.subtreeFlags=o.subtreeFlags&14680064),B!==null?v=Pr(B,v):(v=ns(v,b,S,null),v.flags|=2),v.return=l,d.return=l,d.sibling=v,l.child=d,v}function Xl(o,l,d,v){return v!==null&&Kh(v),Zs(l,o.child,null,d),o=df(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function eg(o,l,d){o.lanes|=l;var v=o.alternate;v!==null&&(v.lanes|=l),Gh(o.return,l,d)}function pf(o,l,d,v,S){var b=o.memoizedState;b===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:v,tail:d,tailMode:S}:(b.isBackwards=l,b.rendering=null,b.renderingStartTime=0,b.last=v,b.tail=d,b.tailMode=S)}function tg(o,l,d){var v=l.pendingProps,S=v.revealOrder,b=v.tail;if(Fn(o,l,v.children,d),v=Yt.current,v&2)v=v&1|2,l.flags|=128;else{if(o!==null&&o.flags&128)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&eg(o,d,l);else if(o.tag===19)eg(o,d,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}v&=1}if(_t(Yt,v),!(l.mode&1))l.memoizedState=null;else switch(S){case"forwards":for(d=l.child,S=null;d!==null;)o=d.alternate,o!==null&&Dl(o)===null&&(S=d),d=d.sibling;d=S,d===null?(S=l.child,l.child=null):(S=d.sibling,d.sibling=null),pf(l,!1,S,d,b);break;case"backwards":for(d=null,S=l.child,l.child=null;S!==null;){if(o=S.alternate,o!==null&&Dl(o)===null){l.child=S;break}o=S.sibling,S.sibling=d,d=S,S=o}pf(l,!0,d,null,b);break;case"together":pf(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function ir(o,l,d){if(o!==null&&(l.dependencies=o.dependencies),$s|=l.lanes,!(d&l.childLanes))return null;if(o!==null&&l.child!==o.child)throw Error(a(153));if(l.child!==null){for(o=l.child,d=Pr(o,o.pendingProps),l.child=d,d.return=l;o.sibling!==null;)o=o.sibling,d=d.sibling=Pr(o,o.pendingProps),d.return=l;d.sibling=null}return l.child}function Rx(o,l,d){switch(l.tag){case 3:jm(l),qs();break;case 5:vm(l);break;case 1:Qt(l.type)&&On(l);break;case 4:Qh(l,l.stateNode.containerInfo);break;case 10:nm(l,l.type._context,l.memoizedProps.value);break;case 13:var v=l.memoizedState;if(v!==null)return v.dehydrated!==null?(_t(Yt,Yt.current&1),l.flags|=128,null):d&l.child.childLanes?Km(o,l,d):(_t(Yt,Yt.current&1),o=ir(o,l,d),o!==null?o.sibling:null);_t(Yt,Yt.current&1);break;case 19:if(v=(d&l.childLanes)!==0,o.flags&128){if(v)return tg(o,l,d);l.flags|=128}var S=l.memoizedState;if(S!==null&&(S.rendering=null,S.tail=null,S.lastEffect=null),_t(Yt,Yt.current),v)break;return null;case 22:case 23:return l.lanes=0,Ym(o,l,d)}return ir(o,l,d)}function Px(o,l){switch(Zh(l),l.tag){case 1:return Qt(l.type)&&dn(),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return Js(),at(Gt),at(Oe),tf(),o=l.flags,o&65536&&!(o&128)?(l.flags=o&-65537|128,l):null;case 5:return $h(l),null;case 13:if(at(Yt),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(a(340));qs()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return at(Yt),null;case 4:return Js(),null;case 10:return Hh(l.type._context),null;case 22:case 23:return Lf(),null;case 24:return null;default:return null}}var Yl=!1,Kr=!1,Ix=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function ql(o,l){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(v){Yn(o,l,v)}else d.current=null}function mf(o,l,d){try{d()}catch(v){Yn(o,l,v)}}var ng=!1;function Lx(o,l){for(re(o.containerInfo),Ne=l;Ne!==null;)if(o=Ne,l=o.child,(o.subtreeFlags&1028)!==0&&l!==null)l.return=o,Ne=l;else for(;Ne!==null;){o=Ne;try{var d=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var v=d.memoizedProps,S=d.memoizedState,b=o.stateNode,B=b.getSnapshotBeforeUpdate(o.elementType===o.type?v:yi(o.type,v),S);b.__reactInternalSnapshotBeforeUpdate=B}break;case 3:ft&&fe(o.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(G){Yn(o,o.return,G)}if(l=o.sibling,l!==null){l.return=o.return,Ne=l;break}Ne=o.return}return d=ng,ng=!1,d}function Qr(o,l,d){var v=l.updateQueue;if(v=v!==null?v.lastEffect:null,v!==null){var S=v=v.next;do{if((S.tag&o)===o){var b=S.destroy;S.destroy=void 0,b!==void 0&&mf(l,d,b)}S=S.next}while(S!==v)}}function ia(o,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var d=l=l.next;do{if((d.tag&o)===o){var v=d.create;d.destroy=v()}d=d.next}while(d!==l)}}function gf(o){var l=o.ref;if(l!==null){var d=o.stateNode;switch(o.tag){case 5:o=Q(d);break;default:o=d}typeof l=="function"?l(o):l.current=o}}function ig(o,l,d){if(Ui&&typeof Ui.onCommitFiberUnmount=="function")try{Ui.onCommitFiberUnmount(Ml,l)}catch{}switch(l.tag){case 0:case 11:case 14:case 15:if(o=l.updateQueue,o!==null&&(o=o.lastEffect,o!==null)){var v=o=o.next;do{var S=v,b=S.destroy;S=S.tag,b!==void 0&&(S&2||S&4)&&mf(l,d,b),v=v.next}while(v!==o)}break;case 1:if(ql(l,d),o=l.stateNode,typeof o.componentWillUnmount=="function")try{o.props=l.memoizedProps,o.state=l.memoizedState,o.componentWillUnmount()}catch(B){Yn(l,d,B)}break;case 5:ql(l,d);break;case 4:ft?cg(o,l,d):pe&&pe&&(l=l.stateNode.containerInfo,d=Pe(l),Vt(l,d))}}function rg(o,l,d){for(var v=l;;)if(ig(o,v,d),v.child===null||ft&&v.tag===4){if(v===l)break;for(;v.sibling===null;){if(v.return===null||v.return===l)return;v=v.return}v.sibling.return=v.return,v=v.sibling}else v.child.return=v,v=v.child}function sg(o){var l=o.alternate;l!==null&&(o.alternate=null,sg(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&ze(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function og(o){return o.tag===5||o.tag===3||o.tag===4}function ag(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||og(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function lg(o){if(ft){e:{for(var l=o.return;l!==null;){if(og(l))break e;l=l.return}throw Error(a(160))}var d=l;switch(d.tag){case 5:l=d.stateNode,d.flags&32&&(le(l),d.flags&=-33),d=ag(o),_f(o,d,l);break;case 3:case 4:l=d.stateNode.containerInfo,d=ag(o),vf(o,d,l);break;default:throw Error(a(161))}}}function vf(o,l,d){var v=o.tag;if(v===5||v===6)o=o.stateNode,l?ct(d,o,l):ke(d,o);else if(v!==4&&(o=o.child,o!==null))for(vf(o,l,d),o=o.sibling;o!==null;)vf(o,l,d),o=o.sibling}function _f(o,l,d){var v=o.tag;if(v===5||v===6)o=o.stateNode,l?rt(d,o,l):be(d,o);else if(v!==4&&(o=o.child,o!==null))for(_f(o,l,d),o=o.sibling;o!==null;)_f(o,l,d),o=o.sibling}function cg(o,l,d){for(var v=l,S=!1,b,B;;){if(!S){S=v.return;e:for(;;){if(S===null)throw Error(a(160));switch(b=S.stateNode,S.tag){case 5:B=!1;break e;case 3:b=b.containerInfo,B=!0;break e;case 4:b=b.containerInfo,B=!0;break e}S=S.return}S=!0}if(v.tag===5||v.tag===6)rg(o,v,d),B?H(b,v.stateNode):He(b,v.stateNode);else if(v.tag===18)B?$(b,v.stateNode):W(b,v.stateNode);else if(v.tag===4){if(v.child!==null){b=v.stateNode.containerInfo,B=!0,v.child.return=v,v=v.child;continue}}else if(ig(o,v,d),v.child!==null){v.child.return=v,v=v.child;continue}if(v===l)break;for(;v.sibling===null;){if(v.return===null||v.return===l)return;v=v.return,v.tag===4&&(S=!1)}v.sibling.return=v.return,v=v.sibling}}function yf(o,l){if(ft){switch(l.tag){case 0:case 11:case 14:case 15:Qr(3,l,l.return),ia(3,l),Qr(5,l,l.return);return;case 1:return;case 5:var d=l.stateNode;if(d!=null){var v=l.memoizedProps;o=o!==null?o.memoizedProps:v;var S=l.type,b=l.updateQueue;l.updateQueue=null,b!==null&&Ge(d,b,S,o,v,l)}return;case 6:if(l.stateNode===null)throw Error(a(162));d=l.memoizedProps,St(l.stateNode,o!==null?o.memoizedProps:d,d);return;case 3:ge&&o!==null&&o.memoizedState.isDehydrated&&vl(l.stateNode.containerInfo);return;case 12:return;case 13:Zl(l);return;case 19:Zl(l);return;case 17:return}throw Error(a(163))}switch(l.tag){case 0:case 11:case 14:case 15:Qr(3,l,l.return),ia(3,l),Qr(5,l,l.return);return;case 12:return;case 13:Zl(l);return;case 19:Zl(l);return;case 3:ge&&o!==null&&o.memoizedState.isDehydrated&&vl(l.stateNode.containerInfo);break;case 22:case 23:return}e:if(pe){switch(l.tag){case 1:case 5:case 6:break e;case 3:case 4:l=l.stateNode,Vt(l.containerInfo,l.pendingChildren);break e}throw Error(a(163))}}function Zl(o){var l=o.updateQueue;if(l!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new Ix),l.forEach(function(v){var S=Hx.bind(null,o,v);d.has(v)||(d.add(v),v.then(S,S))})}}function Dx(o,l){for(Ne=l;Ne!==null;){l=Ne;var d=l.deletions;if(d!==null)for(var v=0;v<d.length;v++){var S=d[v];try{var b=o;ft?cg(b,S,l):rg(b,S,l);var B=S.alternate;B!==null&&(B.return=null),S.return=null}catch(Qe){Yn(S,l,Qe)}}if(d=l.child,l.subtreeFlags&12854&&d!==null)d.return=l,Ne=d;else for(;Ne!==null;){l=Ne;try{var G=l.flags;if(G&32&&ft&&le(l.stateNode),G&512){var oe=l.alternate;if(oe!==null){var Ee=oe.ref;Ee!==null&&(typeof Ee=="function"?Ee(null):Ee.current=null)}}if(G&8192)switch(l.tag){case 13:if(l.memoizedState!==null){var We=l.alternate;(We===null||We.memoizedState===null)&&(bf=pn())}break;case 22:var pt=l.memoizedState!==null,st=l.alternate,kt=st!==null&&st.memoizedState!==null;if(d=l,ft){e:if(v=d,S=pt,b=null,ft)for(var $e=v;;){if($e.tag===5){if(b===null){b=$e;var Rn=$e.stateNode;S?Ie(Rn):Se($e.stateNode,$e.memoizedProps)}}else if($e.tag===6){if(b===null){var mi=$e.stateNode;S?k(mi):te(mi,$e.memoizedProps)}}else if(($e.tag!==22&&$e.tag!==23||$e.memoizedState===null||$e===v)&&$e.child!==null){$e.child.return=$e,$e=$e.child;continue}if($e===v)break;for(;$e.sibling===null;){if($e.return===null||$e.return===v)break e;b===$e&&(b=null),$e=$e.return}b===$e&&(b=null),$e.sibling.return=$e.return,$e=$e.sibling}}if(pt&&!kt&&d.mode&1){Ne=d;for(var J=d.child;J!==null;){for(d=Ne=J;Ne!==null;){v=Ne;var X=v.child;switch(v.tag){case 0:case 11:case 14:case 15:Qr(4,v,v.return);break;case 1:ql(v,v.return);var ne=v.stateNode;if(typeof ne.componentWillUnmount=="function"){var Be=v.return;try{ne.props=v.memoizedProps,ne.state=v.memoizedState,ne.componentWillUnmount()}catch(Qe){Yn(v,Be,Qe)}}break;case 5:ql(v,v.return);break;case 22:if(v.memoizedState!==null){fg(d);continue}}X!==null?(X.return=v,Ne=X):fg(d)}J=J.sibling}}}switch(G&4102){case 2:lg(l),l.flags&=-3;break;case 6:lg(l),l.flags&=-3,yf(l.alternate,l);break;case 4096:l.flags&=-4097;break;case 4100:l.flags&=-4097,yf(l.alternate,l);break;case 4:yf(l.alternate,l)}}catch(Qe){Yn(l,l.return,Qe)}if(d=l.sibling,d!==null){d.return=l.return,Ne=d;break}Ne=l.return}}}function Ux(o,l,d){Ne=o,ug(o)}function ug(o,l,d){for(var v=(o.mode&1)!==0;Ne!==null;){var S=Ne,b=S.child;if(S.tag===22&&v){var B=S.memoizedState!==null||Yl;if(!B){var G=S.alternate,oe=G!==null&&G.memoizedState!==null||Kr;G=Yl;var Ee=Kr;if(Yl=B,(Kr=oe)&&!Ee)for(Ne=S;Ne!==null;)B=Ne,oe=B.child,B.tag===22&&B.memoizedState!==null?dg(S):oe!==null?(oe.return=B,Ne=oe):dg(S);for(;b!==null;)Ne=b,ug(b),b=b.sibling;Ne=S,Yl=G,Kr=Ee}hg(o)}else S.subtreeFlags&8772&&b!==null?(b.return=S,Ne=b):hg(o)}}function hg(o){for(;Ne!==null;){var l=Ne;if(l.flags&8772){var d=l.alternate;try{if(l.flags&8772)switch(l.tag){case 0:case 11:case 15:Kr||ia(5,l);break;case 1:var v=l.stateNode;if(l.flags&4&&!Kr)if(d===null)v.componentDidMount();else{var S=l.elementType===l.type?d.memoizedProps:yi(l.type,d.memoizedProps);v.componentDidUpdate(S,d.memoizedState,v.__reactInternalSnapshotBeforeUpdate)}var b=l.updateQueue;b!==null&&sm(l,b,v);break;case 3:var B=l.updateQueue;if(B!==null){if(d=null,l.child!==null)switch(l.child.tag){case 5:d=Q(l.child.stateNode);break;case 1:d=l.child.stateNode}sm(l,B,d)}break;case 5:var G=l.stateNode;d===null&&l.flags&4&&xe(G,l.type,l.memoizedProps,l);break;case 6:break;case 4:break;case 12:break;case 13:if(ge&&l.memoizedState===null){var oe=l.alternate;if(oe!==null){var Ee=oe.memoizedState;if(Ee!==null){var We=Ee.dehydrated;We!==null&&I(We)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(a(163))}Kr||l.flags&512&&gf(l)}catch(pt){Yn(l,l.return,pt)}}if(l===o){Ne=null;break}if(d=l.sibling,d!==null){d.return=l.return,Ne=d;break}Ne=l.return}}function fg(o){for(;Ne!==null;){var l=Ne;if(l===o){Ne=null;break}var d=l.sibling;if(d!==null){d.return=l.return,Ne=d;break}Ne=l.return}}function dg(o){for(;Ne!==null;){var l=Ne;try{switch(l.tag){case 0:case 11:case 15:var d=l.return;try{ia(4,l)}catch(oe){Yn(l,d,oe)}break;case 1:var v=l.stateNode;if(typeof v.componentDidMount=="function"){var S=l.return;try{v.componentDidMount()}catch(oe){Yn(l,S,oe)}}var b=l.return;try{gf(l)}catch(oe){Yn(l,b,oe)}break;case 5:var B=l.return;try{gf(l)}catch(oe){Yn(l,B,oe)}}}catch(oe){Yn(l,l.return,oe)}if(l===o){Ne=null;break}var G=l.sibling;if(G!==null){G.return=l.return,Ne=G;break}Ne=l.return}}var jl=0,Jl=1,Kl=2,Ql=3,$l=4;if(typeof Symbol=="function"&&Symbol.for){var ra=Symbol.for;jl=ra("selector.component"),Jl=ra("selector.has_pseudo_class"),Kl=ra("selector.role"),Ql=ra("selector.test_id"),$l=ra("selector.text")}function xf(o){var l=z(o);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(a(364));return l}if(o=O(o),o===null)throw Error(a(362));return o.stateNode.current}function Sf(o,l){switch(l.$$typeof){case jl:if(o.type===l.value)return!0;break;case Jl:e:{l=l.value,o=[o,0];for(var d=0;d<o.length;){var v=o[d++],S=o[d++],b=l[S];if(v.tag!==5||!ae(v)){for(;b!=null&&Sf(v,b);)S++,b=l[S];if(S===l.length){l=!0;break e}else for(v=v.child;v!==null;)o.push(v,S),v=v.sibling}}l=!1}return l;case Kl:if(o.tag===5&&me(o.stateNode,l.value))return!0;break;case $l:if((o.tag===5||o.tag===6)&&(o=j(o),o!==null&&0<=o.indexOf(l.value)))return!0;break;case Ql:if(o.tag===5&&(o=o.memoizedProps["data-testname"],typeof o=="str
3874ing"&&o.toLowerCase()===l.value.toLowerCase()))return!0;break;default:throw Error(a(365))}return!1}function Mf(o){switch(o.$$typeof){case jl:return"<"+(L(o.value)||"Unknown")+">";case Jl:return":has("+(Mf(o)||"")+")";case Kl:return'[role="'+o.value+'"]';case $l:return'"'+o.value+'"';case Ql:return'[data-testname="'+o.value+'"]';default:throw Error(a(365))}}function pg(o,l){var d=[];o=[o,0];for(var v=0;v<o.length;){var S=o[v++],b=o[v++],B=l[b];if(S.tag!==5||!ae(S)){for(;B!=null&&Sf(S,B);)b++,B=l[b];if(b===l.length)d.push(S);else for(S=S.child;S!==null;)o.push(S,b),S=S.sibling}}return d}function Ef(o,l){if(!De)throw Error(a(363));o=xf(o),o=pg(o,l),l=[],o=Array.from(o);for(var d=0;d<o.length;){var v=o[d++];if(v.tag===5)ae(v)||l.push(v.stateNode);else for(v=v.child;v!==null;)o.push(v),v=v.sibling}return l}var Nx=Math.ceil,ec=c.ReactCurrentDispatcher,wf=c.ReactCurrentOwner,$t=c.ReactCurrentBatchConfig,Tt=0,sn=null,on=null,xn=0,ni=0,Qs=Rt(0),ln=0,sa=null,$s=0,tc=0,Tf=0,oa=null,Wn=null,bf=0,Af=1/0;function eo(){Af=pn()+500}var nc=!1,Cf=null,br=null,ic=!1,Ar=null,rc=0,aa=0,Rf=null,sc=-1,oc=0;function Bn(){return Tt&6?pn():sc!==-1?sc:sc=pn()}function Cr(o){return o.mode&1?Tt&2&&xn!==0?xn&-xn:vx.transition!==null?(oc===0&&(o=yl,yl<<=1,!(yl&4194240)&&(yl=64),oc=o),oc):(o=Ut,o!==0?o:ye()):1}function di(o,l,d){if(50<aa)throw aa=0,Rf=null,Error(a(185));var v=ac(o,l);return v===null?null:(Wo(v,l,d),(!(Tt&2)||v!==sn)&&(v===sn&&(!(Tt&2)&&(tc|=l),ln===4&&Rr(v,xn)),Xn(v,d),l===1&&Tt===0&&!(o.mode&1)&&(eo(),El&&Oi())),v)}function ac(o,l){o.lanes|=l;var d=o.alternate;for(d!==null&&(d.lanes|=l),d=o,o=o.return;o!==null;)o.childLanes|=l,d=o.alternate,d!==null&&(d.childLanes|=l),d=o,o=o.return;return d.tag===3?d.stateNode:null}function Xn(o,l){var d=o.callbackNode;lx(o,l);var v=Sl(o,o===sn?xn:0);if(v===0)d!==null&&em(d),o.callbackNode=null,o.callbackPriority=0;else if(l=v&-v,o.callbackPriority!==l){if(d!=null&&em(d),l===1)o.tag===0?gx(gg.bind(null,o)):tm(gg.bind(null,o)),Te?it(function(){Tt===0&&Oi()}):Oh(Fh,Oi),d=null;else{switch($p(v)){case 1:d=Fh;break;case 4:d=fx;break;case 16:d=Bh;break;case 536870912:d=dx;break;default:d=Bh}d=Tg(d,mg.bind(null,o))}o.callbackPriority=l,o.callbackNode=d}}function mg(o,l){if(sc=-1,oc=0,Tt&6)throw Error(a(327));var d=o.callbackNode;if(ts()&&o.callbackNode!==d)return null;var v=Sl(o,o===sn?xn:0);if(v===0)return null;if(v&30||v&o.expiredLanes||l)l=lc(o,v);else{l=v;var S=Tt;Tt|=2;var b=yg();(sn!==o||xn!==l)&&(eo(),$r(o,l));do try{Bx();break}catch(G){_g(o,G)}while(!0);Vh(),ec.current=b,Tt=S,on!==null?l=0:(sn=null,xn=0,l=ln)}if(l!==0){if(l===2&&(S=Dh(o),S!==0&&(v=S,l=Pf(o,S))),l===1)throw d=sa,$r(o,0),Rr(o,v),Xn(o,pn()),d;if(l===6)Rr(o,v);else{if(S=o.current.alternate,!(v&30)&&!Ox(S)&&(l=lc(o,v),l===2&&(b=Dh(o),b!==0&&(v=b,l=Pf(o,b))),l===1))throw d=sa,$r(o,0),Rr(o,v),Xn(o,pn()),d;switch(o.finishedWork=S,o.finishedLanes=v,l){case 0:case 1:throw Error(a(345));case 2:es(o,Wn);break;case 3:if(Rr(o,v),(v&130023424)===v&&(l=bf+500-pn(),10<l)){if(Sl(o,0)!==0)break;if(S=o.suspendedLanes,(S&v)!==v){Bn(),o.pingedLanes|=o.suspendedLanes&S;break}o.timeoutHandle=Me(es.bind(null,o,Wn),l);break}es(o,Wn);break;case 4:if(Rr(o,v),(v&4194240)===v)break;for(l=o.eventTimes,S=-1;0<v;){var B=31-Wt(v);b=1<<B,B=l[B],B>S&&(S=B),v&=~b}if(v=S,v=pn()-v,v=(120>v?120:480>v?480:1080>v?1080:1920>v?1920:3e3>v?3e3:4320>v?4320:1960*Nx(v/1960))-v,10<v){o.timeoutHandle=Me(es.bind(null,o,Wn),v);break}es(o,Wn);break;case 5:es(o,Wn);break;default:throw Error(a(329))}}}return Xn(o,pn()),o.callbackNode===d?mg.bind(null,o):null}function Pf(o,l){var d=oa;return o.current.memoizedState.isDehydrated&&($r(o,l).flags|=256),o=lc(o,l),o!==2&&(l=Wn,Wn=d,l!==null&&If(l)),o}function If(o){Wn===null?Wn=o:Wn.push.apply(Wn,o)}function Ox(o){for(var l=o;;){if(l.flags&16384){var d=l.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var v=0;v<d.length;v++){var S=d[v],b=S.getSnapshot;S=S.value;try{if(!Ni(b(),S))return!1}catch{return!1}}}if(d=l.child,l.subtreeFlags&16384&&d!==null)d.return=l,l=d;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Rr(o,l){for(l&=~Tf,l&=~tc,o.suspendedLanes|=l,o.pingedLanes&=~l,o=o.expirationTimes;0<l;){var d=31-Wt(l),v=1<<d;o[d]=-1,l&=~v}}function gg(o){if(Tt&6)throw Error(a(327));ts();var l=Sl(o,0);if(!(l&1))return Xn(o,pn()),null;var d=lc(o,l);if(o.tag!==0&&d===2){var v=Dh(o);v!==0&&(l=v,d=Pf(o,v))}if(d===1)throw d=sa,$r(o,0),Rr(o,l),Xn(o,pn()),d;if(d===6)throw Error(a(345));return o.finishedWork=o.current.alternate,o.finishedLanes=l,es(o,Wn),Xn(o,pn()),null}function vg(o){Ar!==null&&Ar.tag===0&&!(Tt&6)&&ts();var l=Tt;Tt|=1;var d=$t.transition,v=Ut;try{if($t.transition=null,Ut=1,o)return o()}finally{Ut=v,$t.transition=d,Tt=l,!(Tt&6)&&Oi()}}function Lf(){ni=Qs.current,at(Qs)}function $r(o,l){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==lt&&(o.timeoutHandle=lt,et(d)),on!==null)for(d=on.return;d!==null;){var v=d;switch(Zh(v),v.tag){case 1:v=v.type.childContextTypes,v!=null&&dn();break;case 3:Js(),at(Gt),at(Oe),tf();break;case 5:$h(v);break;case 4:Js();break;case 13:at(Yt);break;case 19:at(Yt);break;
vendor: 53,730 bytes, lines 3874-3878
3874case 10:Hh(v.type._context);break;case 22:case 23:Lf()}d=d.return}if(sn=o,on=o=Pr(o.current,null),xn=ni=l,ln=0,sa=null,Tf=tc=$s=0,Wn=oa=null,Fi!==null){for(l=0;l<Fi.length;l++)if(d=Fi[l],v=d.interleaved,v!==null){d.interleaved=null;var S=v.next,b=d.pending;if(b!==null){var B=b.next;b.next=S,v.next=B}d.pending=v}Fi=null}return o}function _g(o,l){do{var d=on;try{if(Vh(),Ul.current=kl,Nl){for(var v=Zt.memoizedState;v!==null;){var S=v.queue;S!==null&&(S.pending=null),v=v.next}Nl=!1}if(Ks=0,mn=bn=Zt=null,Jo=!1,Ko=0,wf.current=null,d===null||d.return===null){ln=1,sa=l,on=null;break}e:{var b=o,B=d.return,G=d,oe=l;if(l=xn,G.flags|=32768,oe!==null&&typeof oe=="object"&&typeof oe.then=="function"){var Ee=oe,We=G,pt=We.tag;if(!(We.mode&1)&&(pt===0||pt===11||pt===15)){var st=We.alternate;st?(We.updateQueue=st.updateQueue,We.memoizedState=st.memoizedState,We.lanes=st.lanes):(We.updateQueue=null,We.memoizedState=null)}var kt=zm(B);if(kt!==null){kt.flags&=-257,km(kt,B,G,b,l),kt.mode&1&&Bm(b,Ee,l),l=kt,oe=Ee;var $e=l.updateQueue;if($e===null){var Rn=new Set;Rn.add(oe),l.updateQueue=Rn}else $e.add(oe);break e}else{if(!(l&1)){Bm(b,Ee,l),Df();break e}oe=Error(a(426))}}else if(Xt&&G.mode&1){var mi=zm(B);if(mi!==null){!(mi.flags&65536)&&(mi.flags|=256),km(mi,B,G,b,l),Kh(oe);break e}}b=oe,ln!==4&&(ln=2),oa===null?oa=[b]:oa.push(b),oe=cf(oe,G),G=B;do{switch(G.tag){case 3:G.flags|=65536,l&=-l,G.lanes|=l;var J=Om(G,oe,l);rm(G,J);break e;case 1:b=oe;var X=G.type,ne=G.stateNode;if(!(G.flags&128)&&(typeof X.getDerivedStateFromError=="function"||ne!==null&&typeof ne.componentDidCatch=="function"&&(br===null||!br.has(ne)))){G.flags|=65536,l&=-l,G.lanes|=l;var Be=Fm(G,b,l);rm(G,Be);break e}}G=G.return}while(G!==null)}Sg(d)}catch(Qe){l=Qe,on===d&&d!==null&&(on=d=d.return);continue}break}while(!0)}function yg(){var o=ec.current;return ec.current=kl,o===null?kl:o}function Df(){(ln===0||ln===3||ln===2)&&(ln=4),sn===null||!($s&268435455)&&!(tc&268435455)||Rr(sn,xn)}function lc(o,l){var d=Tt;Tt|=2;var v=yg();sn===o&&xn===l||$r(o,l);do try{Fx();break}catch(S){_g(o,S)}while(!0);if(Vh(),Tt=d,ec.current=v,on!==null)throw Error(a(261));return sn=null,xn=0,ln}function Fx(){for(;on!==null;)xg(on)}function Bx(){for(;on!==null&&!ux();)xg(on)}function xg(o){var l=wg(o.alternate,o,ni);o.memoizedProps=o.pendingProps,l===null?Sg(o):on=l,wf.current=null}function Sg(o){var l=o;do{var d=l.alternate;if(o=l.return,l.flags&32768){if(d=Px(d,l),d!==null){d.flags&=32767,on=d;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{ln=6,on=null;return}}else if(d=Ax(d,l,ni),d!==null){on=d;return}if(l=l.sibling,l!==null){on=l;return}on=l=o}while(l!==null);ln===0&&(ln=5)}function es(o,l){var d=Ut,v=$t.transition;try{$t.transition=null,Ut=1,zx(o,l,d)}finally{$t.transition=v,Ut=d}return null}function zx(o,l,d){do ts();while(Ar!==null);if(Tt&6)throw Error(a(327));var v=o.finishedWork,S=o.finishedLanes;if(v===null)return null;if(o.finishedWork=null,o.finishedLanes=0,v===o.current)throw Error(a(177));o.callbackNode=null,o.callbackPriority=0;var b=v.lanes|v.childLanes;if(cx(o,b),o===sn&&(on=sn=null,xn=0),!(v.subtreeFlags&2064)&&!(v.flags&2064)||ic||(ic=!0,Tg(Bh,function(){return ts(),null})),b=(v.flags&15990)!==0,v.subtreeFlags&15990||b){b=$t.transition,$t.transition=null;var B=Ut;Ut=1;var G=Tt;Tt|=4,wf.current=null,Lx(o,v),Dx(o,v),ie(o.containerInfo),o.current=v,Ux(v),hx(),Tt=G,Ut=B,$t.transition=b}else o.current=v;if(ic&&(ic=!1,Ar=o,rc=S),b=o.pendingLanes,b===0&&(br=null),px(v.stateNode),Xn(o,pn()),l!==null)for(d=o.onRecoverableError,v=0;v<l.length;v++)d(l[v]);if(nc)throw nc=!1,o=Cf,Cf=null,o;return rc&1&&o.tag!==0&&ts(),b=o.pendingLanes,b&1?o===Rf?aa++:(aa=0,Rf=o):aa=0,Oi(),null}function ts(){if(Ar!==null){var o=$p(rc),l=$t.transition,d=Ut;try{if($t.transition=null,Ut=16>o?16:o,Ar===null)var v=!1;else{if(o=Ar,Ar=null,rc=0,Tt&6)throw Error(a(331));var S=Tt;for(Tt|=4,Ne=o.current;Ne!==null;){var b=Ne,B=b.child;if(Ne.flags&16){var G=b.deletions;if(G!==null){for(var oe=0;oe<G.length;oe++){var Ee=G[oe];for(Ne=Ee;Ne!==null;){var We=Ne;switch(We.tag){case 0:case 11:case 15:Qr(8,We,b)}var pt=We.child;if(pt!==null)pt.return=We,Ne=pt;else for(;Ne!==null;){We=Ne;var st=We.sibling,kt=We.return;if(sg(We),We===Ee){Ne=null;break}if(st!==null){st.return=kt,Ne=st;break}Ne=kt}}}var $e=b.alternate;if($e!==null){var Rn=$e.child;if(Rn!==null){$e.child=null;do{var mi=Rn.sibling;Rn.sibling=null,Rn=mi}while(Rn!==null)}}Ne=b}}if(b.subtreeFlags&2064&&B!==null)B.return=b,Ne=B;else e:for(;Ne!==null;){if(b=Ne,b.flags&2048)switch(b.tag){case 0:case 11:case 15:Qr(9,b,b.return)}var J=b.sibling;if(J!==null){J.return=b.return,Ne=J;break e}Ne=b.return}}var X=o.current;for(Ne=X;Ne!==null;){B=Ne;var ne=B.child;if(B.subtreeFlags&2064&&ne!==null)ne.return=B,Ne=ne;else e:for(B=X;Ne!==null;){if(G=Ne,G.flags&2048)try{switch(G.tag){case 0:case 11:case 15:ia(9,G)}}catch(Qe){Yn(G,G.return,Qe)}if(G===B){Ne=null;break e}var Be=G.sibling;if(Be!==null){Be.return=G.return,Ne=Be;break e}Ne=G.return}}if(Tt=S,Oi(),Ui&&typeof Ui.onPostCommitFiberRoot=="function")try{Ui.onPostCommitFiberRoot(Ml,o)}catch{}v=!0}return v}finally{Ut=d,$t.transition=l}}return!1}function Mg(o,l,d){l=cf(d,l),l=Om(o,l,1),Tr(o,l),l=Bn(),o=ac(o,1),o!==null&&(Wo(o,1,l),Xn(o,l))}function Yn(o,l,d){if(o.tag===3)Mg(o,o,d);else for(;l!==null;){if(l.tag===3){Mg(l,o,d);break}else if(l.tag===1){var v=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(br===null||!br.has(v))){o=cf(d,o),o=Fm(l,o,1),Tr(l,o),o=Bn(),l=ac(l,1),l!==null&&(Wo(l,1,o),Xn(l,o));break}}l=l.return}}function kx(o,l,d){var v=o.pingCache;v!==null&&v.delete(l),l=Bn(),o.pingedLanes|=o.suspendedLanes&d,sn===o&&(xn&d)===d&&(ln===4||ln===3&&(xn&130023424)===xn&&500>pn()-bf?$r(o,0):Tf|=d),Xn(o,l)}function Eg(o,l){l===0&&(o.mode&1?(l=xl,xl<<=1,!(xl&130023424)&&(xl=4194304)):l=1);var d=Bn();o=ac(o,l),o!==null&&(Wo(o,l,d),Xn(o,d))}function Vx(o){var l=o.memoizedState,d=0;l!==null&&(d=l.retryLane),Eg(o,d)}function Hx(o,l){var d=0;switch(o.tag){case 13:var v=o.stateNode,S=o.memoizedState;S!==null&&(d=S.retryLane);break;case 19:v=o.stateNode;break;default:throw Error(a(314))}v!==null&&v.delete(l),Eg(o,d)}var wg;wg=function(o,l,d){if(o!==null)if(o.memoizedProps!==l.pendingProps||Gt.current)ti=!0;else{if(!(o.lanes&d)&&!(l.flags&128))return ti=!1,Rx(o,l,d);ti=!!(o.flags&131072)}else ti=!1,Xt&&l.flags&1048576&&um(l,Il,l.index);switch(l.lanes=0,l.tag){case 2:var v=l.type;o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),o=l.pendingProps;var S=fn(l,Oe.current);Ws(l,d),S=rf(null,l,v,o,S,d);var b=sf();return l.flags|=1,typeof S=="object"&&S!==null&&typeof S.render=="function"&&S.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,Qt(v)?(b=!0,On(l)):b=!1,l.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,Wh(l),S.updater=Rl,l.stateNode=S,S._reactInternals=l,Yh(l,v,o,d),l=ff(null,l,v,!0,b,d)):(l.tag=0,Xt&&b&&qh(l),Fn(null,l,S,d),l=l.child),l;case 16:v=l.elementType;e:{switch(o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),o=l.pendingProps,S=v._init,v=S(v._payload),l.type=v,S=l.tag=Wx(v),o=yi(v,o),S){case 0:l=hf(null,l,v,o,d);break e;case 1:l=Zm(null,l,v,o,d);break e;case 11:l=Gm(null,l,v,o,d);break e;case 14:l=Wm(null,l,v,yi(v.type,o),d);break e}throw Error(a(306,v,""))}return l;case 0:return v=l.type,S=l.pendingProps,S=l.elementType===v?S:yi(v,S),hf(o,l,v,S,d);case 1:return v=l.type,S=l.pendingProps,S=l.elementType===v?S:yi(v,S),Zm(o,l,v,S,d);case 3:e:{if(jm(l),o===null)throw Error(a(387));v=l.pendingProps,b=l.memoizedState,S=b.element,im(o,l),Cl(l,v,null,d);var B=l.memoizedState;if(v=B.element,ge&&b.isDehydrated)if(b={element:v,isDehydrated:!1,cache:B.cache,transitions:B.transitions},l.updateQueue.baseState=b,l.memoizedState=b,l.flags&256){S=Error(a(423)),l=Jm(o,l,v,d,S);break e}else if(v!==S){S=Error(a(424)),l=Jm(o,l,v,d,S);break e}else for(ge&&(ei=pl(l.stateNode.containerInfo),$n=l,Xt=!0,xi=null,Xo=!1),d=gm(l,null,v,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(qs(),v===S){l=ir(o,l,d);break e}Fn(o,l,v,d)}l=l.child}return l;case 5:return vm(l),o===null&&Jh(l),v=l.type,S=l.pendingProps,b=o!==null?o.memoizedProps:null,B=S.children,_e(v,S)?B=null:b!==null&&_e(v,b)&&(l.flags|=32),qm(o,l),Fn(o,l,B,d),l.child;case 6:return o===null&&Jh(l),null;case 13:return Km(o,l,d);case 4:return Qh(l,l.stateNode.containerInfo),v=l.pendingProps,o===null?l.child=Zs(l,null,v,d):Fn(o,l,v,d),l.child;case 11:return v=l.type,S=l.pendingProps,S=l.elementType===v?S:yi(v,S),Gm(o,l,v,S,d);case 7:return Fn(o,l,l.pendingProps,d),l.child;case 8:return Fn(o,l,l.pendingProps.children,d),l.child;case 12:return Fn(o,l,l.pendingProps.children,d),l.child;case 10:e:{if(v=l.type._context,S=l.pendingProps,b=l.memoizedProps,B=S.value,nm(l,v,B),b!==null)if(Ni(b.value,B)){if(b.children===S.children&&!Gt.current){l=ir(o,l,d);break e}}else for(b=l.child,b!==null&&(b.return=l);b!==null;){var G=b.dependencies;if(G!==null){B=b.child;for(var oe=G.firstContext;oe!==null;){if(oe.context===v){if(b.tag===1){oe=$i(-1,d&-d),oe.tag=2;var Ee=b.updateQueue;if(Ee!==null){Ee=Ee.shared;var We=Ee.pending;We===null?oe.next=oe:(oe.next=We.next,We.next=oe),Ee.pending=oe}}b.lanes|=d,oe=b.alternate,oe!==null&&(oe.lanes|=d),Gh(b.return,d,l),G.lanes|=d;break}oe=oe.next}}else if(b.tag===10)B=b.type===l.type?null:b.child;else if(b.tag===18){if(B=b.return,B===null)throw Error(a(341));B.lanes|=d,G=B.alternate,G!==null&&(G.lanes|=d),Gh(B,d,l),B=b.sibling}else B=b.child;if(B!==null)B.return=b;else for(B=b;B!==null;){if(B===l){B=null;break}if(b=B.sibling,b!==null){b.return=B.return,B=b;break}B=B.return}b=B}Fn(o,l,S.children,d),l=l.child}return l;case 9:return S=l.type,v=l.pendingProps.children,Ws(l,d),S=li(S),v=v(S),l.flags|=1,Fn(o,l,v,d),l.child;case 14:return v=l.type,S=yi(v,l.pendingProps),S=yi(v.type,S),Wm(o,l,v,S,d);case 15:return Xm(o,l,l.type,l.pendingProps,d);case 17:return v=l.type,S=l.pendingProps,S=l.elementType===v?S:yi(v,S),o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),l.tag=1,Qt(v)?(o=!0,On(l)):o=!1,Ws(l,d),lm(l,v,S),Yh(l,v,S,d),ff(null,l,v,!0,o,d);case 19:return tg(o,l,d);case 22:return Ym(o,l,d)}throw Error(a(156,l.tag))};function Tg(o,l){return Oh(o,l)}function Gx(o,l,d,v){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pi(o,l,d,v){return new Gx(o,l,d,v)}function Uf(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Wx(o){if(typeof o=="function")return Uf(o)?1:0;if(o!=null){if(o=o.$$typeof,o===M)return 11;if(o===w)return 14}return 2}function Pr(o,l){var d=o.alternate;return d===null?(d=pi(o.tag,l,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=l,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,l=o.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function cc(o,l,d,v,S,b){var B=2;if(v=o,typeof o=="function")Uf(o)&&(B=1);else if(typeof o=="string")B=5;else e:switch(o){case f:return ns(d.children,S,b,l);case p:B=8,S|=8;break;case m:return o=pi(12,d,l,S|2),o.elementType=m,o.lanes=b,o;case x:return o=pi(13,d,l,S),o.elementType=x,o.lanes=b,o;case _:return o=pi(19,d,l,S),o.elementType=_,o.lanes=b,o;case T:return uc(d,S,b,l);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case g:B=10;break e;case y:B=9;break e;case M:B=11;break e;case w:B=14;break e;case E:B=16,v=null;break e}throw Error(a(130,o==null?o:typeof o,""))}return l=pi(B,d,l,S),l.elementType=o,l.type=v,l.lanes=b,l}function ns(o,l,d,v){return o=pi(7,o,v,l),o.lanes=d,o}function uc(o,l,d,v){return o=pi(22,o,v,l),o.elementType=T,o.lanes=d,o.stateNode={},o}function Nf(o,l,d){return o=pi(6,o,null,l),o.lanes=d,o}function Of(o,l,d){return l=pi(4,o.children!==null?o.children:[],o.key,l),l.lanes=d,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}function Xx(o,l,d,v,S){this.tag=l,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=lt,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uh(0),this.expirationTimes=Uh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uh(0),this.identifierPrefix=v,this.onRecoverableError=S,ge&&(this.mutableSourceEagerHydrationData=null)}function bg(o,l,d,v,S,b,B,G,oe){return o=new Xx(o,l,d,G,oe),l===1?(l=1,b===!0&&(l|=8)):l=0,b=pi(3,null,null,l),o.current=b,b.stateNode=o,b.memoizedState={element:v,isDehydrated:d,cache:null,transitions:null},Wh(b),o}function Ag(o){if(!o)return wt;o=o._reactInternals;e:{if(C(o)!==o||o.tag!==1)throw Error(a(170));var l=o;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(Qt(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(a(171))}if(o.tag===1){var d=o.type;if(Qt(d))return Bt(o,d,l)}return l}function Cg(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(a(188)):(o=Object.keys(o).join(","),Error(a(268,o)));return o=Z(l),o===null?null:o.stateNode}function Rg(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<l?d:l}}function Ff(o,l){Rg(o,l),(o=o.alternate)&&Rg(o,l)}function Yx(o){return o=Z(o),o===null?null:o.stateNode}function qx(){return null}return t.attemptContinuousHydration=function(o){if(o.tag===13){var l=Bn();di(o,134217728,l),Ff(o,134217728)}},t.attemptHydrationAtCurrentPriority=function(o){if(o.tag===13){var l=Bn(),d=Cr(o);di(o,d,l),Ff(o,d)}},t.attemptSynchronousHydration=function(o){switch(o.tag){case 3:var l=o.stateNode;if(l.current.memoizedState.isDehydrated){var d=Go(l.pendingLanes);d!==0&&(Nh(l,d|1),Xn(l,pn()),!(Tt&6)&&(eo(),Oi()))}break;case 13:var v=Bn();vg(function(){return di(o,1,v)}),Ff(o,1)}},t.batchedUpdates=function(o,l){var d=Tt;Tt|=1;try{return o(l)}finally{Tt=d,Tt===0&&(eo(),El&&Oi())}},t.createComponentSelector=function(o){return{$$typeof:jl,value:o}},t.createContainer=function(o,l,d,v,S,b,B){return bg(o,l,!1,null,d,v,S,b,B)},t.createHasPseudoClassSelector=function(o){return{$$typeof:Jl,value:o}},t.createHydrationContainer=function(o,l,d,v,S,b,B,G,oe){return o=bg(d,v,!0,o,S,b,B,G,oe),o.context=Ag(null),d=o.current,v=Bn(),S=Cr(d),b=$i(v,S),b.callback=l??null,Tr(d,b),o.current.lanes=S,Wo(o,S,v),Xn(o,v),o},t.createPortal=function(o,l,d){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:v==null?null:""+v,children:o,containerInfo:l,implementation:d}},t.createRoleSelector=function(o){return{$$typeof:Kl,value:o}},t.createTestNameSelector=function(o){return{$$typeof:Ql,value:o}},t.createTextSelector=function(o){return{$$typeof:$l,value:o}},t.deferredUpdates=function(o){var l=Ut,d=$t.transition;try{return $t.transition=null,Ut=16,o()}finally{Ut=l,$t.transition=d}},t.discreteUpdates=function(o,l,d,v,S){var b=Ut,B=$t.transition;try{return $t.transition=null,Ut=1,o(l,d,v,S)}finally{Ut=b,$t.transition=B,Tt===0&&eo()}},t.findAllNodes=Ef,t.findBoundingRects=function(o,l){if(!De)throw Error(a(363));l=Ef(o,l),o=[];for(var d=0;d<l.length;d++)o.push(P(l[d]));for(l=o.length-1;0<l;l--){d=o[l];for(var v=d.x,S=v+d.width,b=d.y,B=b+d.height,G=l-1;0<=G;G--)if(l!==G){var oe=o[G],Ee=oe.x,We=Ee+oe.width,pt=oe.y,st=pt+oe.height;if(v>=Ee&&b>=pt&&S<=We&&B<=st){o.splice(l,1);break}else if(v!==Ee||d.width!==oe.width||st<b||pt>B){if(!(b!==pt||d.height!==oe.height||We<v||Ee>S)){Ee>v&&(oe.width+=Ee-v,oe.x=v),We<S&&(oe.width=S-Ee),o.splice(l,1);break}}else{pt>b&&(oe.height+=pt-b,oe.y=b),st<B&&(oe.height=B-pt),o.splice(l,1);break}}}return o},t.findHostInstance=Cg,t.findHostInstanceWithNoPortals=function(o){return o=N(o),o=o!==null?K(o):null,o===null?null:o.stateNode},t.findHostInstanceWithWarning=function(o){return Cg(o)},t.flushControlled=function(o){var l=Tt;Tt|=1;var d=$t.transition,v=Ut;try{$t.transition=null,Ut=1,o()}finally{Ut=v,$t.transition=d,Tt=l,Tt===0&&(eo(),Oi())}},t.flushPassiveEffects=ts,t.flushSync=vg,t.focusWithin=function(o,l){if(!De)throw Error(a(363));for(o=xf(o),l=pg(o,l),l=Array.from(l),o=0;o<l.length;){var d=l[o++];if(!ae(d)){if(d.tag===5&&he(d.stateNode))return!0;for(d=d.child;d!==null;)l.push(d),d=d.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Ut},t.getFindAllNodesFailureDescription=function(o,l){if(!De)throw Error(a(363));var d=0,v=[];o=[xf(o),0];for(var S=0;S<o.length;){var b=o[S++],B=o[S++],G=l[B];if((b.tag!==5||!ae(b))&&(Sf(b,G)&&(v.push(Mf(G)),B++,B>d&&(d=B)),B<l.length))for(b=b.child;b!==null;)o.push(b,B),b=b.sibling}if(d<l.length){for(o=[];d<l.length;d++)o.push(Mf(l[d]));return`findAllNodes was able to match part of the selector:
3875  `+(v.join(" > ")+`
3876
3877No matching component was found for:
3878  `)+o.join(" > ")}return null},t.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return Q(o.child.stateNode);default:return o.child.stateNode}},t.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:Yx,findFiberByHostInstance:o.findFiberByHostInstance||qx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)o=!0;else{try{Ml=l.inject(o),Ui=l}catch{}o=!!l.checkDCE}}return o},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(o,l,d,v){if(!De)throw Error(a(363));o=Ef(o,l);var S=Ye(o,d,v).disconnect;return{disconnect:function(){S()}}},t.registerMutableSourceForHydration=function(o,l){var d=l._getVersion;d=d(l._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[l,d]:o.mutableSourceEagerHydrationData.push(l,d)},t.runWithPriority=function(o,l){var d=Ut;try{return Ut=o,l()}finally{Ut=d}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(o,l,d,v){var S=l.current,b=Bn(),B=Cr(S);return d=Ag(d),l.context===null?l.context=d:l.pendingContext=d,l=$i(b,B),l.payload={element:o},v=v===void 0?null:v,v!==null&&(l.callback=v),Tr(S,l),o=di(S,B,b),o!==null&&Al(o,S,B),B},t};By.exports=TC;var bC=By.exports;const AC=Jx(bC),jp={},CC=r=>void Object.assign(jp,r);function RC(r,e){function t(f,{args:p=[],attach:m,...g},y){let M=`${f[0].toUpperCase()}${f.slice(1)}`,x;if(f==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const _=g.object;x=Mo(_,{type:f,root:y,attach:m,primitive:!0})}else{const _=jp[M];if(!_)throw new Error(`R3F: ${M} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(p))throw new Error("R3F: The args prop must be an array!");x=Mo(new _(...p),{type:f,root:y,attach:m,memoizedProps:{args:p}})}return x.__r3f.attach===void 0&&(x.isBufferGeometry?x.__r3f.attach="geometry":x.isMaterial&&(x.__r3f.attach="material")),M!=="inject"&&Rd(x,g),x}function n(f,p){let m=!1;if(p){var g,y;(g=p.__r3f)!=null&&g.attach?Cd(f,p,p.__r3f.attach):p.isObject3D&&f.isObject3D&&(f.add(p),m=!0),m||(y=f.__r3f)==null||y.objects.push(p),p.__r3f||Mo(p,{}),p.__r3f.parent=f,ip(p),Eo(p)}}function i(f,p,m){let g=!1;if(p){var y,M;if((y=p.__r3f)!=null&&y.attach)Cd(f,p,p.__r3f.attach);else if(p.isObject3D&&f.isObject3D){p.parent=f,p.dispatchEvent({type:"added"}),f.dispatchEvent({type:"childadded",child:p});const x=f.children.filter(w=>w!==p),_=x.indexOf(m);f.children=[...x.slice(0,_),p,...x.slice(_)],g=!0}g||(M=f.__r3f)==null||M.objects.push(p),p.__r3f||Mo(p,{}),p.__r3f.parent=f,ip(p),Eo(p)}}function s(f,p,m=!1){f&&[...f].forEach(g=>a(p,g,m))}function a(f,p,m){if(p){var g,y,M;if(p.__r3f&&(p.__r3f.parent=null),(g=f.__r3f)!=null&&g.objects&&(f.__r3f.objects=f.__r3f.objects.filter(T=>T!==p)),(y=p.__r3f)!=null&&y.attach)vv(f,p,p.__r3f.attach);else if(p.isObject3D&&f.isObject3D){var x;f.remove(p),(x=p.__r3f)!=null&&x.root&&FC(uu(p),p)}const w=(M=p.__r3f)==null?void 0:M.primitive,E=!w&&(m===void 0?p.dispose!==null:m);if(!w){var _;s((_=p.__r3f)==null?void 0:_.objects,p,E),s(p.children,p,E)}if(delete p.__r3f,E&&p.dispose&&p.type!=="Scene"){const T=()=>{try{p.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?tp.unstable_scheduleCallback(tp.unstable_IdlePriority,T):T()}Eo(f)}}function c(f,p,m,g){var y;const M=(y=f.__r3f)==null?void 0:y.parent;if(!M)return;const x=t(p,m,f.__r3f.root);if(f.children){for(const _ of f.children)_.__r3f&&n(x,_);f.children=f.children.filter(_=>!_.__r3f)}f.__r3f.objects.forEach(_=>n(x,_)),f.__r3f.objects=[],f.__r3f.autoRemovedBeforeAppend||a(M,f),x.parent&&(x.__r3f.autoRemovedBeforeAppend=!0),n(M,x),x.raycast&&x.__r3f.eventCount&&uu(x).getState().internal.interaction.push(x),[g,g.alternate].forEach(_=>{_!==null&&(_.stateNode=x,_.ref&&(typeof _.ref=="function"?_.ref(x):_.ref.current=x))})}const u=()=>{};return{reconciler:AC({createInstance:t,removeChild:a,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(f,p)=>{if(!p)return;const m=f.getState().scene;m.__r3f&&(m.__r3f.root=f,n(m,p))},removeChildFromContainer:(f,p)=>{p&&a(f.getState().scene,p)},insertInContainerBefore:(f,p,m)=>{if(!p||!m)return;const g=f.getState().scene;g.__r3f&&i(g,p,m)},getRootHostContext:()=>null,getChildHostContext:f=>f,finalizeInitialChildren(f){var p;return!!((p=f==null?void 0:f.__r3f)!=null?p:{}).handlers},prepareUpdate(f,p,m,g){var y;if(((y=f==null?void 0:f.__r3f)!=null?y:{}).primitive&&g.object&&g.object!==f)return[!0];{const{args:x=[],children:_,...w}=g,{args:E=[],children:T,...U}=m;if(!Array.isArray(x))throw new Error("R3F: the args prop must be an array!");if(x.some((L,F)=>L!==E[F]))return[!0];const R=qy(f,w,U,!0);return R.changes.length?[!1,R]:null}},commitUpdate(f,[p,m],g,y,M,x){p?c(f,g,M,x):Rd(f,m)},commitMount(f,p,m,g){var y;const M=(y=f.__r3f)!=null?y:{};f.raycast&&M.handlers&&M.eventCount&&uu(f).getState().internal.interaction.push(f)},getPublicInstance:f=>f,prepareForCommit:()=>null,preparePortalMount:f=>Mo(f.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(f){var p;const{attach:m,parent:g}=(p=f.__r3f)!=null?p:{};m&&g&&vv(g,f,m),f.isObject3D&&(f.visible=!1),Eo(f)},unhideInstance(f,p){var m;const{attach:g,parent:y}=(m=f.__r3f)!=null?m:{};g&&y&&Cd(y,f,g),(f.isObject3D&&p.visible==null||p.visible)&&(f.visible=!0),Eo(f)},createTextInstance:u,hideTextInstance:u,unhideTextInstance:u,getCurrentEventPriority:()=>e?e():Ro.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Ht.fun(performance.now)?performance.now:Ht.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Ht.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Ht.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Rd}}var dv,pv;const Ad=r=>"colorSpace"in r||"outputColorSpace"in r,Vy=()=>{var r;return(r=jp.ColorManagement)!=null?r:null},Hy=r=>r&&r.isOrthographicCamera,PC=r=>r&&r.hasOwnProperty("current"),ul=typeof window<"u"&&((dv=window.document)!=null&&dv.createElement||((pv=window.navigator)==null?void 0:pv.product)==="ReactNative")?Ce.useLayoutEffect:Ce.useEffect;function Gy(r){const e=Ce.useRef(r);return ul(()=>void(e.current=r),[r]),e}function IC({set:r}){return ul(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class Wy extends Ce.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}Wy.getDerivedStateFromError=()=>({error:!0});const Xy="__default",mv=new Map,LC=r=>r&&!!r.memoized&&!!r.changes;function Yy(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}const xa=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()};function uu(r){let e=r.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const Ht={obj:r=>r===Object(r)&&!Ht.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(Ht.str(r)||Ht.num(r)||Ht.boo(r))return r===e;const s=Ht.obj(r);if(s&&n==="reference")return r===e;const a=Ht.arr(r);if(a&&t==="reference")return r===e;if((a||s)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!Ht.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(Ht.und(c)){if(a&&r.length===0&&e.length===0||s&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function DC(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function Mo(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function np(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,a)=>s[a],r),{target:t,key:i}}else return{target:t,key:e}}const gv=/-\d+$/;function Cd(r,e,t){if(Ht.str(t)){if(gv.test(t)){const s=t.replace(gv,""),{target:a,key:c}=np(r,s);Array.isArray(a[c])||(a[c]=[])}const{target:n,key:i}=np(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function vv(r,e,t){var n,i;if(Ht.str(t)){const{target:s,key:a}=np(r,t),c=e.__r3f.previousAttach;c===void 0?delete s[a]:s[a]=c}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function qy(r,{children:e,key:t,ref:n,...i},{children:s,key:a,ref:c,...u}={},h=!1){const f=r.__r3f,p=Object.entries(i),m=[];if(h){const y=Object.keys(u);for(let M=0;M<y.length;M++)i.hasOwnProperty(y[M])||p.unshift([y[M],Xy+"remove"])}p.forEach(([y,M])=>{var x;if((x=r.__r3f)!=null&&x.primitive&&y==="object"||Ht.equ(M,u[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return m.push([y,M,!0,[]]);let _=[];y.includes("-")&&(_=y.split("-")),m.push([y,M,!1,_]);for(const w in i){const E=i[w];w.startsWith(`${y}-`)&&m.push([w,E,!1,w.split("-")])}});const g={...i};return f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.args&&(g.args=f.memoizedProps.args),f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.attach&&(g.attach=f.memoizedProps.attach),{memoized:g,changes:m}}const UC=typeof process<"u"&&!1;function Rd(r,e){var t;const n=r.__r3f,i=n==null?void 0:n.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:a,changes:c}=LC(e)?e:qy(r,e),u=n==null?void 0:n.eventCount;r.__r3f&&(r.__r3f.memoizedProps=a);for(let m=0;m<c.length;m++){let[g,y,M,x]=c[m];if(Ad(r)){const T="srgb",U="srgb-linear";g==="encoding"?(g="colorSpace",y=y===3001?T:U):g==="outputEncoding"&&(g="outputColorSpace",y=y===3001?T:U)}let _=r,w=_[g];if(x.length&&(w=x.reduce((E,T)=>E[T],r),!(w&&w.set))){const[E,...T]=x.reverse();_=T.reverse().reduce((U,R)=>U[R],r),g=E}if(y===Xy+"remove")if(_.constructor){let E=mv.get(_.constructor);E||(E=new _.constructor,mv.set(_.constructor,E)),y=E[g]}else y=0;if(M&&n)y?n.handlers[g]=y:delete n.handlers[g],n.eventCount=Object.keys(n.handlers).length;else if(w&&w.set&&(w.copy||w instanceof Cs)){if(Array.isArray(y))w.fromArray?w.fromArray(y):w.set(...y);else if(w.copy&&y&&y.constructor&&(UC?w.constructor.name===y.constructor.name:w.constructor===y.constructor))w.copy(y);else if(y!==void 0){var h;const E=(h=w)==null?void 0:h.isColor;!E&&w.setScalar?w.setScalar(y):w instanceof Cs&&y instanceof Cs?w.mask=y.mask:w.set(y),!Vy()&&s&&!s.linear&&E&&w.convertSRGBToLinear()}}else{var f;if(_[g]=y,(f=_[g])!=null&&f.isTexture&&_[g].format===Dn&&_[g].type===Ai&&s){const E=_[g];Ad(E)&&Ad(s.gl)?E.colorSpace=s.gl.outputColorSpace:E.encoding=s.gl.outputEncoding}}Eo(r)}if(n&&n.parent&&r.raycast&&u!==n.eventCount){const m=uu(r).getState().internal,g=m.interaction.indexOf(r);g>-1&&m.interaction.splice(g,1),n.eventCount&&m.interaction.push(r)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(t=r.__r3f)!=null&&t.parent&&ip(r),r}function Eo(r){var e,t;const n=(e=r.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function ip(r){r.onUpdate==null||r.onUpdate(r)}function NC(r,e){r.manual||(Hy(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function nu(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function OC(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Ro.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Ro.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Ro.ContinuousEventPriority;default:return Ro.DefaultEventPriority}}function Zy(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function FC(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{Zy(t.capturedMap,e,n,i)})}function BC(r){function e(u){const{internal:h}=r.getState(),f=u.offsetX-h.initialClick[0],p=u.offsetY-h.initialClick[1];return Math.round(Math.sqrt(f*f+p*p))}function t(u){return u.filter(h=>["Move","Over","Enter","Out","Leave"].some(f=>{var p;return(p=h.__r3f)==null?void 0:p.handlers["onPointer"+f]}))}function n(u,h){const f=r.getState(),p=new Set,m=[],g=h?h(f.internal.interaction):f.internal.interaction;for(let _=0;_<g.length;_++){const w=xa(g[_]);w&&(w.raycaster.camera=void 0)}f.previousRoot||f.events.compute==null||f.events.compute(u,f);function y(_){const w=xa(_);if(!w||!w.events.enabled||w.raycaster.camera===null)return[];if(w.raycaster.camera===void 0){var E;w.events.compute==null||w.events.compute(u,w,(E=w.previousRoot)==null?void 0:E.getState()),w.raycaster.camera===void 0&&(w.raycaster.camera=null)}return w.raycaster.camera?w.raycaster.intersectObject(_,!0):[]}let M=g.flatMap(y).sort((_,w)=>{const E=xa(_.object),T=xa(w.object);return!E||!T?_.distance-w.distance:T.events.priority-E.events.priority||_.distance-w.distance}).filter(_=>{const w=nu(_);return p.has(w)?!1:(p.add(w),!0)});f.events.filter&&(M=f.events.filter(M,f));for(const _ of M){let w=_.object;for(;w;){var x;(x=w.__r3f)!=null&&x.eventCount&&m.push({..._,eventObject:w}),w=w.parent}}if("pointerId"in u&&f.internal.capturedMap.has(u.pointerId))for(let _ of f.internal.capturedMap.get(u.pointerId).values())p.has(nu(_.intersection))||m.push(_.intersection);return m}function i(u,h,f,p){const m=r.getState();if(u.length){const g={stopped:!1};for(const y of u){const M=xa(y.object)||m,{raycaster:x,pointer:_,camera:w,internal:E}=M,T=new D(_.x,_.y,0).unproject(w),U=A=>{var N,Z;return(N=(Z=E.capturedMap.get(A))==null?void 0:Z.has(y.eventObject))!=null?N:!1},R=A=>{const N={intersection:y,target:h.target};E.capturedMap.has(A)?E.capturedMap.get(A).set(y.eventObject,N):E.capturedMap.set(A,new Map([[y.eventObject,N]])),h.target.setPointerCapture(A)},L=A=>{const N=E.capturedMap.get(A);N&&Zy(E.capturedMap,y.eventObject,N,A)};let F={};for(let A in h){let N=h[A];typeof N!="function"&&(F[A]=N)}let C={...y,...F,pointer:_,intersections:u,stopped:g.stopped,delta:f,unprojectedPoint:T,ray:x.ray,camera:w,stopPropagation(){const A="pointerId"in h&&E.capturedMap.get(h.pointerId);if((!A||A.has(y.eventObject))&&(C.stopped=g.stopped=!0,E.hovered.size&&Array.from(E.hovered.values()).find(N=>N.eventObject===y.eventObject))){const N=u.slice(0,u.indexOf(y));s([...N,y])}},target:{hasPointerCapture:U,setPointerCapture:R,releasePointerCapture:L},currentTarget:{hasPointerCapture:U,setPointerCapture:R,releasePointerCapture:L},nativeEvent:h};if(p(C),g.stopped===!0)break}}return u}function s(u){const{internal:h}=r.getState();for(const f of h.hovered.values())if(!u.length||!u.find(p=>p.object===f.object&&p.index===f.index&&p.instanceId===f.instanceId)){const m=f.eventObject.__r3f,g=m==null?void 0:m.handlers;if(h.hovered.delete(nu(f)),m!=null&&m.eventCount){const y={...f,intersections:u};g.onPointerOut==null||g.onPointerOut(y),g.onPointerLeave==null||g.onPointerLeave(y)}}}function a(u,h){for(let f=0;f<h.length;f++){const p=h[f].__r3f;p==null||p.handlers.onPointerMissed==null||p.handlers.onPointerMissed(u)}}function c(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return h=>{const{internal:f}=r.getState();"pointerId"in h&&f.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{f.capturedMap.has(h.pointerId)&&(f.capturedMap.delete(h.pointerId),s([]))})}}return function(f){const{onPointerMissed:p,internal:m}=r.getState();m.lastEvent.current=f;const g=u==="onPointerMove",y=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",x=n(f,g?t:void 0),_=y?e(f):0;u==="onPointerDown"&&(m.initialClick=[f.offsetX,f.offsetY],m.initialHits=x.map(E=>E.eventObject)),y&&!x.length&&_<=2&&(a(f,m.interaction),p&&p(f)),g&&s(x);function w(E){const T=E.eventObject,U=T.__r3f,R=U==null?void 0:U.handlers;if(U!=null&&U.eventCount)if(g){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const L=nu(E),F=m.hovered.get(L);F?F.stopped&&E.stopPropagation():(m.hovered.set(L,E),R.onPointerOver==null||R.onPointerOver(E),R.onPointerEnter==null||R.onPointerEnter(E))}R.onPointerMove==null||R.onPointerMove(E)}else{const L=R[u];L?(!y||m.initialHits.includes(T))&&(a(f,m.interaction.filter(F=>!m.initialHits.includes(F))),L(E)):y&&m.initialHits.includes(T)&&a(f,m.interaction.filter(F=>!m.initialHits.includes(F)))}}i(x,f,_,w)}}return{handlePointer:c}}const jy=r=>!!(r!=null&&r.render),Jy=Ce.createContext(null),zC=(r,e)=>{const t=wC((c,u)=>{const h=new D,f=new D,p=new D;function m(_=u().camera,w=f,E=u().size){const{width:T,height:U,top:R,left:L}=E,F=T/U;w.isVector3?p.copy(w):p.set(...w);const C=_.getWorldPosition(h).distanceTo(p);if(Hy(_))return{width:T/_.zoom,height:U/_.zoom,top:R,left:L,factor:1,distance:C,aspect:F};{const A=_.fov*Math.PI/180,N=2*Math.tan(A/2)*C,Z=N*(T/U);return{width:Z,height:N,top:R,left:L,factor:T/Z,distance:C,aspect:F}}}let g;const y=_=>c(w=>({performance:{...w.performance,current:_}})),M=new ue;return{set:c,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(_=1)=>r(u(),_),advance:(_,w)=>e(_,w,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Wp,pointer:M,mouse:M,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const _=u();g&&clearTimeout(g),_.performance.current!==_.performance.min&&y(_.performance.min),g=setTimeout(()=>y(u().performance.max),_.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:_=>c(w=>({...w,events:{...w.events,..._}})),setSize:(_,w,E,T,U)=>{const R=u().camera,L={width:_,height:w,top:T||0,left:U||0,updateStyle:E};c(F=>({size:L,viewport:{...F.viewport,...m(R,f,L)}}))},setDpr:_=>c(w=>{const E=Yy(_);return{viewport:{...w.viewport,dpr:E,initialDpr:w.viewport.initialDpr||E}}}),setFrameloop:(_="always")=>{const w=u().clock;w.stop(),w.elapsedTime=0,_!=="never"&&(w.start(),w.elapsedTime=0),c(()=>({frameloop:_}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:Ce.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(_,w,E)=>{const T=u().internal;return T.priority=T.priority+(w>0?1:0),T.subscribers.push({ref:_,priority:w,store:E}),T.subscribers=T.subscribers.sort((U,R)=>U.priority-R.priority),()=>{const U=u().internal;U!=null&&U.subscribers&&(U.priority=U.priority-(w>0?1:0),U.subscribers=U.subscribers.filter(R=>R.ref!==_))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,a=n.camera;return t.subscribe(()=>{const{camera:c,size:u,viewport:h,gl:f,set:p}=t.getState();if(u.width!==i.width||u.height!==i.height||h.dpr!==s){var m;i=u,s=h.dpr,NC(c,u),f.setPixelRatio(h.dpr);const g=(m=u.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&f.domElement instanceof HTMLCanvasElement;f.setSize(u.width,u.height,g)}c!==a&&(a=c,p(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};let iu,kC=new Set,VC=new Set,HC=new Set;function Pd(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function Sa(r,e){switch(r){case"before":return Pd(kC,e);case"after":return Pd(VC,e);case"tail":return Pd(HC,e)}}let Id,Ld;function Dd(r,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),Id=e.internal.subscribers,iu=0;iu<Id.length;iu++)Ld=Id[iu],Ld.ref.current(Ld.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function GC(r){let e=!1,t=!1,n,i,s;function a(h){i=requestAnimationFrame(a),e=!0,n=0,Sa("before",h),t=!0;for(const p of r.values()){var f;s=p.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((f=s.gl.xr)!=null&&f.isPresenting)&&(n+=Dd(h,s))}if(t=!1,Sa("after",h),n===0)return Sa("tail",h),e=!1,cancelAnimationFrame(i)}function c(h,f=1){var p;if(!h)return r.forEach(m=>c(m.store.getState(),f));(p=h.gl.xr)!=null&&p.isPresenting||!h.internal.active||h.frameloop==="never"||(f>1?h.internal.frames=Math.min(60,h.internal.frames+f):t?h.internal.frames=2:h.internal.frames=1,e||(e=!0,requestAnimationFrame(a)))}function u(h,f=!0,p,m){if(f&&Sa("before",h),p)Dd(h,p,m);else for(const g of r.values())Dd(h,g.store.getState());f&&Sa("after",h)}return{loop:a,invalidate:c,advance:u}}function Ky(){const r=Ce.useContext(Jy);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function ur(r=t=>t,e){return Ky()(r,e)}function WC(r,e=0){const t=Ky(),n=t.getState().internal.subscribe,i=Gy(r);return ul(()=>n(i,e,t),[e,n,t]),null}const Oo=new Map,{invalidate:_v,advance:yv}=GC(Oo),{reconciler:Qu,applyProps:xo}=RC(Oo,OC),So={objects:"shallow",strict:!1},XC=(r,e)=>{const t=typeof r=="function"?r(e):r;return jy(t)?t:new G_({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function YC(r,e){const t=typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement;if(e){const{width:n,height:i,top:s,left:a,updateStyle:c=t}=e;return{width:n,height:i,top:s,left:a,updateStyle:c}}else if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:n,height:i,top:s,left:a}=r.parentElement.getBoundingClientRect();return{width:n,height:i,top:s,left:a,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function qC(r){const e=Oo.get(r),t=e==null?void 0:e.fiber,n=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=n||zC(_v,yv),a=t||Qu.createContainer(s,Ro.ConcurrentRoot,null,!1,null,"",i,null);e||Oo.set(r,{fiber:a,store:s});let c,u=!1,h;return{configure(f={}){let{gl:p,size:m,scene:g,events:y,onCreated:M,shadows:x=!1,linear:_=!1,flat:w=!1,legacy:E=!1,orthographic:T=!1,frameloop:U="always",dpr:R=[1,2],performance:L,raycaster:F,camera:C,onPointerMissed:A}=f,N=s.getState(),Z=N.gl;N.gl||N.set({gl:Z=XC(p,r)});let q=N.raycaster;q||N.set({raycaster:q=new Uy});const{params:K,...ce}=F||{};if(Ht.equ(ce,q,So)||xo(q,{...ce}),Ht.equ(K,q.params,So)||xo(q,{params:{...q.params,...K}}),!N.camera||N.camera===h&&!Ht.equ(h,C,So)){h=C;const ie=C instanceof nl,de=ie?C:T?new kr(0,0,0,0,.1,1e3):new tn(75,0,.1,1e3);ie||(de.position.z=5,C&&(xo(de,C),("aspect"in C||"left"in C||"right"in C||"bottom"in C||"top"in C)&&(de.manual=!0,de.updateProjectionMatrix())),!N.camera&&!(C!=null&&C.rotation)&&de.lookAt(0,0,0)),N.set({camera:de}),q.camera=de}if(!N.scene){let ie;g!=null&&g.isScene?ie=g:(ie=new Tp,g&&xo(ie,g)),N.set({scene:Mo(ie)})}if(!N.xr){var Q;const ie=(Xe,se)=>{const _e=s.getState();_e.frameloop!=="never"&&yv(Xe,!0,_e,se)},de=()=>{const Xe=s.getState();Xe.gl.xr.enabled=Xe.gl.xr.isPresenting,Xe.gl.xr.setAnimationLoop(Xe.gl.xr.isPresenting?ie:null),Xe.gl.xr.isPresenting||_v(Xe)},Re={connect(){const Xe=s.getState().gl;Xe.xr.addEventListener("sessionstart",de),Xe.xr.addEventListener("sessionend",de)},disconnect(){const Xe=s.getState().gl;Xe.xr.removeEventListener("sessionstart",de),Xe.xr.removeEventListener("sessionend",de)}};typeof((Q=Z.xr)==null?void 0:Q.addEventListener)=="function"&&Re.connect(),N.set({xr:Re})}if(Z.shadowMap){const ie=Z.shadowMap.enabled,de=Z.shadowMap.type;if(Z.shadowMap.enabled=!!x,Ht.boo(x))Z.shadowMap.type=Ta;else if(Ht.str(x)){var ve;const Re={basic:kv,percentage:eh,soft:Ta,variance:wi};Z.shadowMap.type=(ve=Re[x])!=null?ve:Ta}else Ht.obj(x)&&Object.assign(Z.shadowMap,x);(ie!==Z.shadowMap.enabled||de!==Z.shadowMap.type)&&(Z.shadowMap.needsUpdate=!0)}const V=Vy();V&&("enabled"in V?V.enabled=!E:"legacyMode"in V&&(V.legacyMode=E)),u||xo(Z,{outputEncoding:_?3e3:3001,toneMapping:w?qi:rp}),N.legacy!==E&&N.set(()=>({legacy:E})),N.linear!==_&&N.set(()=>({linear:_})),N.flat!==w&&N.set(()=>({flat:w})),p&&!Ht.fun(p)&&!jy(p)&&!Ht.equ(p,Z,So)&&xo(Z,p),y&&!N.events.handlers&&N.set({events:y(s)});const re=YC(r,m);return Ht.equ(re,N.size,So)||N.setSize(re.width,re.height,re.updateStyle,re.top,re.left),R&&N.viewport.dpr!==Yy(R)&&N.setDpr(R),N.frameloop!==U&&N.setFrameloop(U),N.onPointerMissed||N.set({onPointerMissed:A}),L&&!Ht.equ(L,N.performance,So)&&N.set(ie=>({performance:{...ie.performance,...L}})),c=M,u=!0,this},render(f){return u||this.configure(),Qu.updateContainer(Ti.jsx(ZC,{store:s,children:f,onCreated:c,rootElement:r}),a,null,()=>{}),s},unmount(){Qy(r)}}}function ZC({store:r,children:e,onCreated:t,rootElement:n}){return ul(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),Ti.jsx(Jy.Provider,{value:r,children:e})}function Qy(r,e){const t=Oo.get(r),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),Qu.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var s,a,c,u;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(u=i.gl)!=null&&u.xr&&i.xr.disconnect(),DC(i),Oo.delete(r)}catch{}},500)})}}Qu.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:Ce.version});const Ud={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function jC(r){const{handlePointer:e}=BC(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Ud).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:s}=r.getState();s.disconnect==null||s.disconnect(),i(a=>({events:{...a.events,connected:t}})),Object.entries((n=s.handlers)!=null?n:[]).forEach(([a,c])=>{const[u,h]=Ud[a];t.addEventListener(u,c,{passive:h})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,a])=>{if(n&&n.connected instanceof HTMLElement){const[c]=Ud[s];n.connected.removeEventListener(c,a)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function xv(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function JC({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=Ce.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=Ce.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),u=r?typeof r=="number"?r:r.scroll:null,h=r?typeof r=="number"?r:r.resize:null,f=Ce.useRef(!1);Ce.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[p,m,g]=Ce.useMemo(()=>{const _=()=>{if(!c.current.element)return;const{left:w,top:E,width:T,height:U,bottom:R,right:L,x:F,y:C}=c.current.element.getBoundingClientRect(),A={left:w,top:E,width:T,height:U,bottom:R,right:L,x:F,y:C};c.current.element instanceof HTMLElement&&n&&(A.height=c.current.element.offsetHeight,A.width=c.current.element.offsetWidth),Object.freeze(A),f.current&&!eR(c.current.lastBounds,A)&&a(c.current.lastBounds=A)};return[_,h?xv(_,h):_,u?xv(_,u):_]},[a,n,u,h]);function y(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function M(){c.current.element&&(c.current.resizeObserver=new i(g),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(_=>_.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const x=_=>{!_||_===c.current.element||(y(),c.current.element=_,c.current.scrollContainers=$y(_),M())};return QC(g,!!e),KC(m),Ce.useEffect(()=>{y(),M()},[e,g,m]),Ce.useEffect(()=>y,[]),[x,s,p]}function KC(r){Ce.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[r])}function QC(r,e){Ce.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[r,e])}function $y(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(s=>s==="auto"||s==="scroll")&&e.push(r),[...e,...$y(r.parentElement)]}const $C=["x","y","top","bottom","left","right","width","height"],eR=(r,e)=>$C.every(t=>r[t]===e[t]);var tR=Object.defineProperty,nR=Object.defineProperties,iR=Object.getOwnPropertyDescriptors,Sv=Object.getOwnPropertySymbols,rR=Object.prototype.hasOwnProperty,sR=Object.prototype.propertyIsEnumerable,Mv=(r,e,t)=>e in r?tR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ev=(r,e)=>{for(var t in e||(e={}))rR.call(e,t)&&Mv(r,t,e[t]);if(Sv)for(var t of Sv(e))sR.call(e,t)&&Mv(r,t,e[t]);return r},oR=(r,e)=>nR(r,iR(e)),wv,Tv;typeof window<"u"&&((wv=window.document)!=null&&wv.createElement||((Tv=window.navigator)==null?void 0:Tv.product)==="ReactNative")?Ce.useLayoutEffect:Ce.useEffect;function ex(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=r.child;for(;n;){const i=ex(n,e,t);if(i)return i;n=n.sibling}}function tx(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const bv=console.error;console.error=function(){const r=[...arguments].join("");if(r!=null&&r.startsWith("Warning:")&&r.includes("useContext")){console.error=bv;return}return bv.apply(this,arguments)};const Jp=tx(Ce.createContext(null));class nx extends Ce.Component{render(){return Ce.createElement(Jp.Provider,{value:this._reactInternals},this.props.children)}}function aR(){const r=Ce.useContext(Jp);if(r===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=Ce.useId();return Ce.useMemo(()=>{for(const n of[r,r==null?void 0:r.alternate]){if(!n)continue;const i=ex(n,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[r,e])}function lR(){const r=aR(),[e]=Ce.useState(()=>new Map);e.clear();let t=r;for(;t;){if(t.type&&typeof t.type=="object"){const i=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;i&&i!==Jp&&!e.has(i)&&e.set(i,Ce.useContext(tx(i)))}t=t.return}return e}function cR(){const r=lR();return Ce.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>Ce.createElement(e,null,Ce.createElement(t.Provider,oR(Ev({},n),{value:r.get(t)}))),e=>Ce.createElement(nx,Ev({},e))),[r])}const uR=Ce.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:a=jC,eventSource:c,eventPrefix:u,shadows:h,linear:f,flat:p,legacy:m,orthographic:g,frameloop:y,dpr:M,performance:x,raycaster:_,camera:w,scene:E,onPointerMissed:T,onCreated:U,...R},L){Ce.useMemo(()=>CC(SC),[]);const F=cR(),[C,A]=JC({scroll:!0,debounce:{scroll:50,resize:0},...n}),N=Ce.useRef(null),Z=Ce.useRef(null);Ce.useImperativeHandle(L,()=>N.current);const q=Gy(T),[K,ce]=Ce.useState(!1),[Q,ve]=Ce.useState(!1);if(K)throw K;if(Q)throw Q;const V=Ce.useRef(null);ul(()=>{const ie=N.current;A.width>0&&A.height>0&&ie&&(V.current||(V.current=qC(ie)),V.current.configure({gl:s,events:a,shadows:h,linear:f,flat:p,legacy:m,orthographic:g,frameloop:y,dpr:M,performance:x,raycaster:_,camera:w,scene:E,size:A,onPointerMissed:(...de)=>q.current==null?void 0:q.current(...de),onCreated:de=>{de.events.connect==null||de.events.connect(c?PC(c)?c.current:c:Z.current),u&&de.setEvents({compute:(Re,Xe)=>{const se=Re[u+"X"],_e=Re[u+"Y"];Xe.pointer.set(se/Xe.size.width*2-1,-(_e/Xe.size.height)*2+1),Xe.raycaster.setFromCamera(Xe.pointer,Xe.camera)}}),U==null||U(de)}}),V.current.render(Ti.jsx(F,{children:Ti.jsx(Wy,{set:ve,children:Ti.jsx(Ce.Suspense,{fallback:Ti.jsx(IC,{set:ce}),children:e??null})})})))}),Ce.useEffect(()=>{const ie=N.current;if(ie)return()=>Qy(ie)},[]);const re=c?"none":"auto";return Ti.jsx("div",{ref:Z,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:re,...i},...R,children:Ti.jsx("div",{ref:C,style:{width:"100%",height:"100%"},children:Ti.jsx("canvas",{ref:N,style:{display:"block"},children:t})})})}),IR=Ce.forwardRef(function(e,t){return Ti.jsx(nx,{children:Ti.jsx(uR,{...e,ref:t})})});function Fo(){return Fo=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Fo.apply(null,arguments)}const ix=parseInt(Qa.replace(/\D+/g,"")),rx=ix>=125?"uv1":"uv2";var hR=Object.defineProperty,fR=(r,e,t)=>e in r?hR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,dR=(r,e,t)=>(fR(r,e+"",t),t);class pR{constructor(){dR(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}var mR=Object.defineProperty,gR=(r,e,t)=>e in r?mR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ot=(r,e,t)=>(gR(r,typeof e!="symbol"?e+"":e,t),t);
3878const ru=new Os,Av=new hr,vR=Math.cos(70*(Math.PI/180)),Cv=(r,e)=>(r%e+e)%e;let _R=class extends pR{constructor(e,t){super(),ot(this,"object"),ot(this,"domElement"),ot(this,"enabled",!0),ot(this,"target",new D),ot(this,"minDistance",0),ot(this,"maxDistance",1/0),ot(this,"minZoom",0),ot(this,"maxZoom",1/0),ot(this,"minPolarAngle",0),ot(this,"maxPolarAngle",Math.PI),ot(this,"minAzimuthAngle",-1/0),ot(this,"maxAzimuthAngle",1/0),ot(this,"enableDamping",!1),ot(this,"dampingFactor",.05),ot(this,"enableZoom",!0),ot(this,"zoomSpeed",1),ot(this,"enableRotate",!0),ot(this,"rotateSpeed",1),ot(this,"enablePan",!0),ot(this,"panSpeed",1),ot(this,"screenSpacePanning",!0),ot(this,"keyPanSpeed",7),ot(this,"zoomToCursor",!1),ot(this,"autoRotate",!1),ot(this,"autoRotateSpeed",2),ot(this,"reverseOrbit",!1),ot(this,"reverseHorizontalOrbit",!1),ot(this,"reverseVerticalOrbit",!1),ot(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ot(this,"mouseButtons",{LEFT:gs.ROTATE,MIDDLE:gs.DOLLY,RIGHT:gs.PAN}),ot(this,"touches",{ONE:vs.ROTATE,TWO:vs.DOLLY_PAN}),ot(this,"target0"),ot(this,"position0"),ot(this,"zoom0"),ot(this,"_domElementKeyEvents",null),ot(this,"getPolarAngle"),ot(this,"getAzimuthalAngle"),ot(this,"setPolarAngle"),ot(this,"setAzimuthalAngle"),ot(this,"getDistance"),ot(this,"getZoomScale"),ot(this,"listenToKeyEvents"),ot(this,"stopListenToKeyEvents"),ot(this,"saveState"),ot(this,"reset"),ot(this,"update"),ot(this,"connect"),ot(this,"dispose"),ot(this,"dollyIn"),ot(this,"dollyOut"),ot(this,"getScale"),ot(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>f.phi,this.getAzimuthalAngle=()=>f.theta,this.setPolarAngle=H=>{let le=Cv(H,2*Math.PI),Ie=f.phi;Ie<0&&(Ie+=2*Math.PI),le<0&&(le+=2*Math.PI);let k=Math.abs(le-Ie);2*Math.PI-k<k&&(le<Ie?le+=2*Math.PI:Ie+=2*Math.PI),p.phi=le-Ie,n.update()},this.setAzimuthalAngle=H=>{let le=Cv(H,2*Math.PI),Ie=f.theta;Ie<0&&(Ie+=2*Math.PI),le<0&&(le+=2*Math.PI);let k=Math.abs(le-Ie);2*Math.PI-k<k&&(le<Ie?le+=2*Math.PI:Ie+=2*Math.PI),p.theta=le-Ie,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=H=>{H.addEventListener("keydown",be),this._domElementKeyEvents=H},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",be),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),u=c.NONE},this.update=(()=>{const H=new D,le=new D(0,1,0),Ie=new Un().setFromUnitVectors(e.up,le),k=Ie.clone().invert(),Se=new D,te=new Un,fe=2*Math.PI;return function(){const Pe=n.object.position;Ie.setFromUnitVectors(e.up,le),k.copy(Ie).invert(),H.copy(Pe).sub(n.target),H.applyQuaternion(Ie),f.setFromVector3(H),n.autoRotate&&u===c.NONE&&K(Z()),n.enableDamping?(f.theta+=p.theta*n.dampingFactor,f.phi+=p.phi*n.dampingFactor):(f.theta+=p.theta,f.phi+=p.phi);let nt=n.minAzimuthAngle,It=n.maxAzimuthAngle;isFinite(nt)&&isFinite(It)&&(nt<-Math.PI?nt+=fe:nt>Math.PI&&(nt-=fe),It<-Math.PI?It+=fe:It>Math.PI&&(It-=fe),nt<=It?f.theta=Math.max(nt,Math.min(It,f.theta)):f.theta=f.theta>(nt+It)/2?Math.max(nt,f.theta):Math.min(It,f.theta)),f.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,f.phi)),f.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(g,n.dampingFactor):n.target.add(g),n.zoomToCursor&&C||n.object.isOrthographicCamera?f.radius=Xe(f.radius):f.radius=Xe(f.radius*m),H.setFromSpherical(f),H.applyQuaternion(k),Pe.copy(n.target).add(H),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(p.theta*=1-n.dampingFactor,p.phi*=1-n.dampingFactor,g.multiplyScalar(1-n.dampingFactor)):(p.set(0,0,0),g.set(0,0,0));let Vt=!1;if(n.zoomToCursor&&C){let At=null;if(n.object instanceof tn&&n.object.isPerspectiveCamera){const rn=H.length();At=Xe(rn*m);const Tn=rn-At;n.object.position.addScaledVector(L,Tn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const rn=new D(F.x,F.y,0);rn.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Vt=!0;const Tn=new D(F.x,F.y,0);Tn.unproject(n.object),n.object.position.sub(Tn).add(rn),n.object.updateMatrixWorld(),At=H.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;At!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(At).add(n.object.position):(ru.origin.copy(n.object.position),ru.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ru.direction))<vR?e.lookAt(n.target):(Av.setFromNormalAndCoplanarPoint(n.object.up,n.target),ru.intersectPlane(Av,n.target))))}else n.object instanceof kr&&n.object.isOrthographicCamera&&(Vt=m!==1,Vt&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix()));return m=1,C=!1,Vt||Se.distanceToSquared(n.object.position)>h||8*(1-te.dot(n.object.quaternion))>h?(n.dispatchEvent(i),Se.copy(n.object.position),te.copy(n.object.quaternion),Vt=!1,!0):!1}})(),this.connect=H=>{n.domElement=H,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",xe),n.domElement.addEventListener("pointerdown",P),n.domElement.addEventListener("pointercancel",ae),n.domElement.addEventListener("wheel",Ye)},this.dispose=()=>{var H,le,Ie,k,Se,te;n.domElement&&(n.domElement.style.touchAction="auto"),(H=n.domElement)==null||H.removeEventListener("contextmenu",xe),(le=n.domElement)==null||le.removeEventListener("pointerdown",P),(Ie=n.domElement)==null||Ie.removeEventListener("pointercancel",ae),(k=n.domElement)==null||k.removeEventListener("wheel",Ye),(Se=n.domElement)==null||Se.ownerDocument.removeEventListener("pointermove",j),(te=n.domElement)==null||te.ownerDocument.removeEventListener("pointerup",ae),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",be)};const n=this,i={type:"change"},s={type:"start"},a={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=c.NONE;const h=1e-6,f=new ep,p=new ep;let m=1;const g=new D,y=new ue,M=new ue,x=new ue,_=new ue,w=new ue,E=new ue,T=new ue,U=new ue,R=new ue,L=new D,F=new ue;let C=!1;const A=[],N={};function Z(){return 2*Math.PI/60/60*n.autoRotateSpeed}function q(){return Math.pow(.95,n.zoomSpeed)}function K(H){n.reverseOrbit||n.reverseHorizontalOrbit?p.theta+=H:p.theta-=H}function ce(H){n.reverseOrbit||n.reverseVerticalOrbit?p.phi+=H:p.p
3878hi-=H}const Q=(()=>{const H=new D;return function(Ie,k){H.setFromMatrixColumn(k,0),H.multiplyScalar(-Ie),g.add(H)}})(),ve=(()=>{const H=new D;return function(Ie,k){n.screenSpacePanning===!0?H.setFromMatrixColumn(k,1):(H.setFromMatrixColumn(k,0),H.crossVectors(n.object.up,H)),H.multiplyScalar(Ie),g.add(H)}})(),V=(()=>{const H=new D;return function(Ie,k){const Se=n.domElement;if(Se&&n.object instanceof tn&&n.object.isPerspectiveCamera){const te=n.object.position;H.copy(te).sub(n.target);let fe=H.length();fe*=Math.tan(n.object.fov/2*Math.PI/180),Q(2*Ie*fe/Se.clientHeight,n.object.matrix),ve(2*k*fe/Se.clientHeight,n.object.matrix)}else Se&&n.object instanceof kr&&n.object.isOrthographicCamera?(Q(Ie*(n.object.right-n.object.left)/n.object.zoom/Se.clientWidth,n.object.matrix),ve(k*(n.object.top-n.object.bottom)/n.object.zoom/Se.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function re(H){n.object instanceof tn&&n.object.isPerspectiveCamera||n.object instanceof kr&&n.object.isOrthographicCamera?m=H:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ie(H){re(m/H)}function de(H){re(m*H)}function Re(H){if(!n.zoomToCursor||!n.domElement)return;C=!0;const le=n.domElement.getBoundingClientRect(),Ie=H.clientX-le.left,k=H.clientY-le.top,Se=le.width,te=le.height;F.x=Ie/Se*2-1,F.y=-(k/te)*2+1,L.set(F.x,F.y,1).unproject(n.object).sub(n.object.position).normalize()}function Xe(H){return Math.max(n.minDistance,Math.min(n.maxDistance,H))}function se(H){y.set(H.clientX,H.clientY)}function _e(H){Re(H),T.set(H.clientX,H.clientY)}function Le(H){_.set(H.clientX,H.clientY)}function Me(H){M.set(H.clientX,H.clientY),x.subVectors(M,y).multiplyScalar(n.rotateSpeed);const le=n.domElement;le&&(K(2*Math.PI*x.x/le.clientHeight),ce(2*Math.PI*x.y/le.clientHeight)),y.copy(M),n.update()}function et(H){U.set(H.clientX,H.clientY),R.subVectors(U,T),R.y>0?ie(q()):R.y<0&&de(q()),T.copy(U),n.update()}function lt(H){w.set(H.clientX,H.clientY),E.subVectors(w,_).multiplyScalar(n.panSpeed),V(E.x,E.y),_.copy(w),n.update()}function tt(H){Re(H),H.deltaY<0?de(q()):H.deltaY>0&&ie(q()),n.update()}function ft(H){let le=!1;switch(H.code){case n.keys.UP:V(0,n.keyPanSpeed),le=!0;break;case n.keys.BOTTOM:V(0,-n.keyPanSpeed),le=!0;break;case n.keys.LEFT:V(n.keyPanSpeed,0),le=!0;break;case n.keys.RIGHT:V(-n.keyPanSpeed,0),le=!0;break}le&&(H.preventDefault(),n.update())}function pe(){if(A.length==1)y.set(A[0].pageX,A[0].pageY);else{const H=.5*(A[0].pageX+A[1].pageX),le=.5*(A[0].pageY+A[1].pageY);y.set(H,le)}}function ge(){if(A.length==1)_.set(A[0].pageX,A[0].pageY);else{const H=.5*(A[0].pageX+A[1].pageX),le=.5*(A[0].pageY+A[1].pageY);_.set(H,le)}}function z(){const H=A[0].pageX-A[1].pageX,le=A[0].pageY-A[1].pageY,Ie=Math.sqrt(H*H+le*le);T.set(0,Ie)}function Ke(){n.enableZoom&&z(),n.enablePan&&ge()}function ye(){n.enableZoom&&z(),n.enableRotate&&pe()}function ze(H){if(A.length==1)M.set(H.pageX,H.pageY);else{const Ie=He(H),k=.5*(H.pageX+Ie.x),Se=.5*(H.pageY+Ie.y);M.set(k,Se)}x.subVectors(M,y).multiplyScalar(n.rotateSpeed);const le=n.domElement;le&&(K(2*Math.PI*x.x/le.clientHeight),ce(2*Math.PI*x.y/le.clientHeight)),y.copy(M)}function Te(H){if(A.length==1)w.set(H.pageX,H.pageY);else{const le=He(H),Ie=.5*(H.pageX+le.x),k=.5*(H.pageY+le.y);w.set(Ie,k)}E.subVectors(w,_).multiplyScalar(n.panSpeed),V(E.x,E.y),_.copy(w)}function it(H){const le=He(H),Ie=H.pageX-le.x,k=H.pageY-le.y,Se=Math.sqrt(Ie*Ie+k*k);U.set(0,Se),R.set(0,Math.pow(U.y/T.y,n.zoomSpeed)),ie(R.y),T.copy(U)}function De(H){n.enableZoom&&it(H),n.enablePan&&Te(H)}function O(H){n.enableZoom&&it(H),n.enableRotate&&ze(H)}function P(H){var le,Ie;n.enabled!==!1&&(A.length===0&&((le=n.domElement)==null||le.ownerDocument.addEventListener("pointermove",j),(Ie=n.domElement)==null||Ie.ownerDocument.addEventListener("pointerup",ae)),Ge(H),H.pointerType==="touch"?ke(H):me(H))}function j(H){n.enabled!==!1&&(H.pointerType==="touch"?St(H):he(H))}function ae(H){var le,Ie,k;rt(H),A.length===0&&((le=n.domElement)==null||le.releasePointerCapture(H.pointerId),(Ie=n.domElement)==null||Ie.ownerDocument.removeEventListener("pointermove",j),(k=n.domElement)==null||k.ownerDocument.removeEventListener("pointerup",ae)),n.dispatchEvent(a),u=c.NONE}function me(H){let le;
3878switch(H.button){case 0:le=n.mouseButtons.LEFT;break;case 1:le=n.mouseButtons.MIDDLE;break;case 2:le=n.mouseButtons.RIGHT;break;default:le=-1}switch(le){case gs.DOLLY:if(n.enableZoom===!1)return;_e(H),u=c.DOLLY;break;case gs.ROTATE:if(H.ctrlKey||H.metaKey||H.shiftKey){if(n.enablePan===!1)return;Le(H),u=c.PAN}else{if(n.enableRotate===!1)return;se(H),u=c.ROTATE}break;case gs.PAN:if(H.ctrlKey||H.metaKey||H.shiftKey){if(n.enableRotate===!1)return;se(H),u=c.ROTATE}else{if(n.enablePan===!1)return;Le(H),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function he(H){if(n.enabled!==!1)switch(u){case c.ROTATE:if(n.enableRotate===!1)return;Me(H);break;case c.DOLLY:if(n.enableZoom===!1)return;et(H);break;case c.PAN:if(n.enablePan===!1)return;lt(H);break}}function Ye(H){n.enabled===!1||n.enableZoom===!1||u!==c.NONE&&u!==c.ROTATE||(H.preventDefault(),n.dispatchEvent(s),tt(H),n.dispatchEvent(a))}function be(H){n.enabled===!1||n.enablePan===!1||ft(H)}function ke(H){switch(ct(H),A.length){case 1:switch(n.touches.ONE){case vs.ROTATE:if(n.enableRotate===!1)return;pe(),u=c.TOUCH_ROTATE;break;case vs.PAN:if(n.enablePan===!1)return;ge(),u=c.TOUCH_PAN;break;default:u=c.NONE}break;case 2:switch(n.touches.TWO){case vs.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ke(),u=c.TOUCH_DOLLY_PAN;break;case vs.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ye(),u=c.TOUCH_DOLLY_ROTATE;break;default:u=c.NONE}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function St(H){switch(ct(H),u){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;ze(H),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;Te(H),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;De(H),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;O(H),n.update();break;default:u=c.NONE}}function xe(H){n.enabled!==!1&&H.preventDefault()}function Ge(H){A.push(H)}function rt(H){delete N[H.pointerId];for(let le=0;le<A.length;le++)if(A[le].pointerId==H.pointerId){A.splice(le,1);return}}function ct(H){let le=N[H.pointerId];le===void 0&&(le=new ue,N[H.pointerId]=le),le.set(H.pageX,H.pageY)}function He(H){const le=H.pointerId===A[0].pointerId?A[1]:A[0];return N[le.pointerId]}this.dollyIn=(H=q())=>{de(H),n.update()},this.dollyOut=(H=q())=>{ie(H),n.update()},this.getScale=()=>m,this.setScale=H=>{re(H),n.update()},this.getZoomScale=()=>q(),t!==void 0&&this.connect(t),this.update()}};const Rv=new _n,su=new D;class Kp extends Hp{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new Ze(e,3)),this.setAttribute("uv",new Ze(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new Ku(t,6,1);return this.setAttribute("instanceStart",new si(n,3,0)),this.setAttribute("instanceEnd",new si(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new Ku(n,t*2,1);return this.setAttribute("instanceColorStart",new si(i,t,0)),this.setAttribute("instanceColorEnd",new si(i,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Np(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _n);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Rv.setFromBufferAttribute(t),this.boundingBox.union(Rv))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)su.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(su)),su.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(su));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class sx extends Kp{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e,t=3){const n=e.length-t,i=new Float32Array(2*n);if(t===3)for(let s=0;s<n;s+=t)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5];else for(let s=0;s<n;s+=t)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5],i[2*s+6]=e[s+6],i[2*s+7]=e[s+7];return super.setColors(i,t),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Qp extends _i{constructor(e){super({type:"LineMaterial",uniforms:qu.clone(qu.merge([Ae.common,Ae.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ue(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
3879				#include <common>
3880				#include <fog_pars_vertex>
3881				#include <logdepthbuf_pars_vertex>
3882				#include <clipping_planes_pars_vertex>
3883
3884				uniform float linewidth;
3885				uniform vec2 resolution;
3886
3887				attribute vec3 instanceStart;
3888				attribute vec3 instanceEnd;
3889
3890				#ifdef USE_COLOR
3891					#ifdef USE_LINE_COLOR_ALPHA
3892						varying vec4 vLineColor;
3893						attribute vec4 instanceColorStart;
3894						attribute vec4 instanceColorEnd;
3895					#else
3896						varying vec3 vLineColor;
3897						attribute vec3 instanceColorStart;
3898						attribute vec3 instanceColorEnd;
3899					#endif
3900				#endif
3901
3902				#ifdef WORLD_UNITS
3903
3904					varying vec4 worldPos;
3905					varying vec3 worldStart;
3906					varying vec3 worldEnd;
3907
3908					#ifdef USE_DASH
3909
3910						varying vec2 vUv;
3911
3912					#endif
3913
3914				#else
3915
3916					varying vec2 vUv;
3917
3918				#endif
3919
3920				#ifdef USE_DASH
3921
3922					uniform float dashScale;
3923					attribute float instanceDistanceStart;
3924					attribute float instanceDistanceEnd;
3925					varying float vLineDistance;
3926
3927				#endif
3928
3929				void trimSegment( const in vec4 start, inout vec4 end ) {
3930
3931					// trim end segment so it terminates between the camera plane and the near plane
3932
3933					// conservative estimate of the near plane
3934					float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
3935					float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
3936					float nearEstimate = - 0.5 * b / a;
3937
3938					float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
3939
3940					end.xyz = mix( start.xyz, end.xyz, alpha );
3941
3942				}
3943
3944				void main() {
3945
3946					#ifdef USE_COLOR
3947
3948						vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
3949
3950					#endif
3951
3952					#ifdef USE_DASH
3953
3954						vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
3955						vUv = uv;
3956
3957					#endif
3958
3959					float aspect = resolution.x / resolution.y;
3960
3961					// camera space
3962					vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
3963					vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
3964
3965					#ifdef WORLD_UNITS
3966
3967						worldStart = start.xyz;
3968						worldEnd = end.xyz;
3969
3970					#else
3971
3972						vUv = uv;
3973
3974					#endif
3975
3976					// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
3977					// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
3978					// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
3979					// perhaps there is a more elegant solution -- WestLangley
3980
3981					bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
3982
3983					if ( perspective ) {
3984
3985						if ( start.z < 0.0 && end.z >= 0.0 ) {
3986
3987							trimSegment( start, end );
3988
3989						} else if ( end.z < 0.0 && start.z >= 0.0 ) {
3990
3991							trimSegment( end, start );
3992
3993						}
3994
3995					}
3996
3997					// clip space
3998					vec4 clipStart = projectionMatrix * start;
3999					vec4 clipEnd = projectionMatrix * end;
4000
4001					// ndc space
4002					vec3 ndcStart = clipStart.xyz / clipStart.w;
4003					vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
4004
4005					// direction
4006					vec2 dir = ndcEnd.xy - ndcStart.xy;
4007
4008					// account for clip-space aspect ratio
4009					dir.x *= aspect;
4010					dir = normalize( dir );
4011
4012					#ifdef WORLD_UNITS
4013
4014						// get the offset direction as perpendicular to the view vector
4015						vec3 worldDir = normalize( end.xyz - start.xyz );
4016						vec3 offset;
4017						if ( position.y < 0.5 ) {
4018
4019							offset = normalize( cross( start.xyz, worldDir ) );
4020
4021						} else {
4022
4023							offset = normalize( cross( end.xyz, worldDir ) );
4024
4025						}
4026
4027						// sign flip
4028						if ( position.x < 0.0 ) offset *= - 1.0;
4029
4030						float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
4031
4032						// don't extend the line if we're rendering dashes because we
4033						// won't be rendering the endcaps
4034						#ifndef USE_DASH
4035
4036							// extend the line bounds to encompass  endcaps
4037							start.xyz += - worldDir * linewidth * 0.5;
4038							end.xyz += worldDir * linewidth * 0.5;
4039
4040							// shift the position of the quad so it hugs the forward edge of the line
4041							offset.xy -= dir * forwardOffset;
4042							offset.z += 0.5;
4043
4044						#endif
4045
4046						// endcaps
4047						if ( position.y > 1.0 || position.y < 0.0 ) {
4048
4049							offset.xy += dir * 2.0 * forwardOffset;
4050
4051						}
4052
4053						// adjust for linewidth
4054						offset *= linewidth * 0.5;
4055
4056						// set the world position
4057						worldPos = ( position.y < 0.5 ) ? start : end;
4058						worldPos.xyz += offset;
4059
4060						// project the worldpos
4061						vec4 clip = projectionMatrix * worldPos;
4062
4063						// shift the depth of the projected points so the line
4064						// segments overlap neatly
4065						vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
4066						clip.z = clipPose.z * clip.w;
4067
4068					#else
4069
4070						vec2 offset = vec2( dir.y, - dir.x );
4071						// undo aspect ratio adjustment
4072						dir.x /= aspect;
4073						offset.x /= aspect;
4074
4075						// sign flip
4076						if ( position.x < 0.0 ) offset *= - 1.0;
4077
4078						// endcaps
4079						if ( position.y < 0.0 ) {
4080
4081							offset += - dir;
4082
4083						} else if ( position.y > 1.0 ) {
4084
4085							offset += dir;
4086
4087						}
4088
4089						// adjust for linewidth
4090						offset *= linewidth;
4091
4092						// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
4093						offset /= resolution.y;
4094
4095						// select end
4096						vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
4097
4098						// back to clip space
4099						offset *= clip.w;
4100
4101						clip.xy += offset;
4102
4103					#endif
4104
4105					gl_Position = clip;
4106
4107					vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
4108
4109					#include <logdepthbuf_vertex>
4110					#include <clipping_planes_vertex>
4111					#include <fog_vertex>
4112
4113				}
4114			`,fragmentShader:`
4115				uniform vec3 diffuse;
4116				uniform float opacity;
4117				uniform float linewidth;
4118
4119				#ifdef USE_DASH
4120
4121					uniform float dashOffset;
4122					uniform float dashSize;
4123					uniform float gapSize;
4124
4125				#endif
4126
4127				varying float vLineDistance;
4128
4129				#ifdef WORLD_UNITS
4130
4131					varying vec4 worldPos;
4132					varying vec3 worldStart;
4133					varying vec3 worldEnd;
4134
4135					#ifdef USE_DASH
4136
4137						varying vec2 vUv;
4138
4139					#endif
4140
4141				#else
4142
4143					varying vec2 vUv;
4144
4145				#endif
4146
4147				#include <common>
4148				#include <fog_pars_fragment>
4149				#include <logdepthbuf_pars_fragment>
4150				#include <clipping_planes_pars_fragment>
4151
4152				#ifdef USE_COLOR
4153					#ifdef USE_LINE_COLOR_ALPHA
4154						varying vec4 vLineColor;
4155					#else
4156						varying vec3 vLineColor;
4157					#endif
4158				#endif
4159
4160				vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
4161
4162					float mua;
4163					float mub;
4164
4165					vec3 p13 = p1 - p3;
4166					vec3 p43 = p4 - p3;
4167
4168					vec3 p21 = p2 - p1;
4169
4170					float d1343 = dot( p13, p43 );
4171					float d4321 = dot( p43, p21 );
4172					float d1321 = dot( p13, p21 );
4173					float d4343 = dot( p43, p43 );
4174					float d2121 = dot( p21, p21 );
4175
4176					float denom = d2121 * d4343 - d4321 * d4321;
4177
4178					float numer = d1343 * d4321 - d1321 * d4343;
4179
4180					mua = numer / denom;
4181					mua = clamp( mua, 0.0, 1.0 );
4182					mub = ( d1343 + d4321 * ( mua ) ) / d4343;
4183					mub = clamp( mub, 0.0, 1.0 );
4184
4185					return vec2( mua, mub );
4186
4187				}
4188
4189				void main() {
4190
4191					#include <clipping_planes_fragment>
4192
4193					#ifdef USE_DASH
4194
4195						if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
4196
4197						if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
4198
4199					#endif
4200
4201					float alpha = opacity;
4202
4203					#ifdef WORLD_UNITS
4204
4205						// Find the closest points on the view ray and the line segment
4206						vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
4207						vec3 lineDir = worldEnd - worldStart;
4208						vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
4209
4210						vec3 p1 = worldStart + lineDir * params.x;
4211						vec3 p2 = rayEnd * params.y;
4212						vec3 delta = p1 - p2;
4213						float len = length( delta );
4214						float norm = len / linewidth;
4215
4216						#ifndef USE_DASH
4217
4218							#ifdef USE_ALPHA_TO_COVERAGE
4219
4220								float dnorm = fwidth( norm );
4221								alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
4222
4223							#else
4224
4225								if ( norm > 0.5 ) {
4226
4227									discard;
4228
4229								}
4230
4231							#endif
4232
4233						#endif
4234
4235					#else
4236
4237						#ifdef USE_ALPHA_TO_COVERAGE
4238
4239							// artifacts appear on some hardware if a derivative is taken within a conditional
4240							float a = vUv.x;
4241							float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4242							float len2 = a * a + b * b;
4243							float dlen = fwidth( len2 );
4244
4245							if ( abs( vUv.y ) > 1.0 ) {
4246
4247								alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
4248
4249							}
4250
4251						#else
4252
4253							if ( abs( vUv.y ) > 1.0 ) {
4254
4255								float a = vUv.x;
4256								float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4257								float len2 = a * a + b * b;
4258
4259								if ( len2 > 1.0 ) discard;
4260
4261							}
4262
4263						#endif
4264
4265					#endif
4266
4267					vec4 diffuseColor = vec4( diffuse, alpha );
4268					#ifdef USE_COLOR
4269						#ifdef USE_LINE_COLOR_ALPHA
4270							diffuseColor *= vLineColor;
4271						#else
4272							diffuseColor.rgb *= vLineColor;
4273						#endif
4274					#endif
4275
4276					#include <logdepthbuf_fragment>
4277
4278					gl_FragColor = diffuseColor;
4279
4280					#include <tonemapping_fragment>
4281					#include <${ix>=154?"colorspace_fragment":"encodings_fragment"}>
4282					#include <fog_fragment>
4283					#include <premultiplied_alpha_fragment>
4284
4285				}
4286			`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}}
4286,alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const Nd=new bt,Pv=new D,Iv=new D,Sn=new bt,Mn=new bt,Vi=new bt,Od=new D,Fd=new ut,En=new Ny,Lv=new D,ou=new _n,au=new yn,Hi=new bt;let Wi,Ps;function Dv(r,e,t){return Hi.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),Hi.multiplyScalar(1/Hi.w),Hi.x=Ps/t.width,Hi.y=Ps/t.height,Hi.applyMatrix4(r.projectionMatrixInverse),Hi.multiplyScalar(1/Hi.w),Math.abs(Math.max(Hi.x,Hi.y))}function yR(r,e){const t=r.matrixWorld,n=r.geometry,i=n.attributes.instanceStart,s=n.attributes.instanceEnd,a=Math.min(n.instanceCount,i.count);for(let c=0,u=a;c<u;c++){En.start.fromBufferAttribute(i,c),En.end.fromBufferAttribute(s,c),En.applyMatrix4(t);const h=new D,f=new D;Wi.distanceSqToSegment(En.start,En.end,f,h),f.distanceTo(h)<Ps*.5&&e.push({point:f,pointOnLine:h,distance:Wi.origin.distanceTo(f),object:r,face:null,faceIndex:c,uv:null,[rx]:null})}}function xR(r,e,t){const n=e.projectionMatrix,s=r.material.resolution,a=r.matrixWorld,c=r.geometry,u=c.attributes.instanceStart,h=c.attributes.instanceEnd,f=Math.min(c.instanceCount,u.count),p=-e.near;Wi.at(1,Vi),Vi.w=1,Vi.applyMatrix4(e.matrixWorldInverse),Vi.applyMatrix4(n),Vi.multiplyScalar(1/Vi.w),Vi.x*=s.x/2,Vi.y*=s.y/2,Vi.z=0,Od.copy(Vi),Fd.multiplyMatrices(e.matrixWorldInverse,a);for(let m=0,g=f;m<g;m++){if(Sn.fromBufferAttribute(u,m),Mn.fromBufferAttribute(h,m),Sn.w=1,Mn.w=1,Sn.applyMatrix4(Fd),Mn.applyMatrix4(Fd),Sn.z>p&&Mn.z>p)continue;if(Sn.z>p){const E=Sn.z-Mn.z,T=(Sn.z-p)/E;Sn.lerp(Mn,T)}else if(Mn.z>p){const E=Mn.z-Sn.z,T=(Mn.z-p)/E;Mn.lerp(Sn,T)}Sn.applyMatrix4(n),Mn.applyMatrix4(n),Sn.multiplyScalar(1/Sn.w),Mn.multiplyScalar(1/Mn.w),Sn.x*=s.x/2,Sn.y*=s.y/2,Mn.x*=s.x/2,Mn.y*=s.y/2,En.start.copy(Sn),En.start.z=0,En.end.copy(Mn),En.end.z=0;const M=En.closestPointToPointParameter(Od,!0);En.at(M,Lv);const x=A_.lerp(Sn.z,Mn.z,M),_=x>=-1&&x<=1,w=Od.distanceTo(Lv)<Ps*.5;if(_&&w){En.start.fromBufferAttribute(u,m),En.end.fromBufferAttribute(h,m),En.start.applyMatrix4(a),En.end.applyMatrix4(a);const E=new D,T=new D;Wi.distanceSqToSegment(En.start,En.end,T,E),t.push({point:T,pointOnLine:E,distance:Wi.origin.distanceTo(T),object:r,face:null,faceIndex:m,uv:null,[rx]:null})}}}class ox extends nn{constructor(e=new Kp,t=new Qp({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let a=0,c=0,u=t.count;a<u;a++,c+=2)Pv.fromBufferAttribute(t,a),Iv.fromBufferAttribute(n,a),i[c]=c===0?0:i[c-1],i[c+1]=i[c]+Pv.distanceTo(Iv);const s=new Ku(i,2,1);return e.setAttribute("instanceDistanceStart",new si(s,1,0)),e.setAttribute("instanceDistanceEnd",new si(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera;i===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Wi=e.ray;const a=this.matrixWorld,c=this.geometry,u=this.material;Ps=u.linewidth+s,c.boundingSphere===null&&c.computeBoundingSphere(),au.copy(c.boundingSphere).applyMatrix4(a);let h;if(n)h=Ps*.5;else{const p=Math.max(i.near,au.distanceToPoint(Wi.origin));h=Dv(i,p,u.resolution)}if(au.radius+=h,Wi.intersectsSphere(au)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),ou.copy(c.boundingBox).applyMatrix4(a);let f;if(n)f=Ps*.5;else{const p=Math.max(i.near,ou.distanceToPoint(Wi.origin));f=Dv(i,p,u.resolution)}ou.expandByScalar(f),Wi.intersectsBox(ou)!==!1&&(n?yR(this,t):xR(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Nd),this.material.uniforms.resolution.value.set(Nd.z,Nd.w))}}class SR extends ox{constructor(e=new sx,t=new Qp({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const DR=Ce.forwardRef(function({points:e,color:t=16777215,vertexColors:n,linewidth:i,lineWidth:s,segments:a,dashed:c,...u},h){var f,p;const m=ur(_=>_.size),g=Ce.useMemo(()=>a?new ox:new SR,[a]),[y]=Ce.useState(()=>new Qp),M=(n==null||(f=n[0])==null?void 0:f.length)===4?4:3,x=Ce.useMemo(()=>{const _=a?new Kp:new sx,w=e.map(E=>
4286{const T=Array.isArray(E);return E instanceof D||E instanceof bt?[E.x,E.y,E.z]:E instanceof ue?[E.x,E.y,0]:T&&E.length===3?[E[0],E[1],E[2]]:T&&E.length===2?[E[0],E[1],0]:E});if(_.setPositions(w.flat()),n){t=16777215;const E=n.map(T=>T instanceof Ve?T.toArray():T);_.setColors(E.flat(),M)}return _},[e,a,n,M]);return Ce.useLayoutEffect(()=>{g.computeLineDistances()},[e,g]),Ce.useLayoutEffect(()=>{c?y.defines.USE_DASH="":delete y.defines.USE_DASH,y.needsUpdate=!0},[c,y]),Ce.useEffect(()=>()=>{x.dispose(),y.dispose()},[x]),Ce.createElement("primitive",Fo({object:g,ref:h},u),Ce.createElement("primitive",{object:x,attach:"geometry"}),Ce.createElement("primitive",Fo({object:y,attach:"material",color:t,vertexColors:!!n,resolution:[m.width,m.height],linewidth:(p=i??s)!==null&&p!==void 0?p:1,dashed:c,transparent:M===4},u)))}),UR=Ce.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:s=!1,onChange:a,onStart:c,onEnd:u,...h},f)=>{const p=ur(R=>R.invalidate),m=ur(R=>R.camera),g=ur(R=>R.gl),y=ur(R=>R.events),M=ur(R=>R.setEvents),x=ur(R=>R.set),_=ur(R=>R.get),w=ur(R=>R.performance),E=e||m,T=n||y.connected||g.domElement,U=Ce.useMemo(()=>new _R(E),[E]);return WC(()=>{U.enabled&&U.update()},-1),Ce.useEffect(()=>(s&&U.connect(s===!0?T:s),U.connect(T),()=>void U.dispose()),[s,T,t,U,p]),Ce.useEffect(()=>{const R=C=>{p(),t&&w.regress(),a&&a(C)},L=C=>{c&&c(C)},F=C=>{u&&u(C)};return U.addEventListener("change",R),U.addEventListener("start",L),U.addEventListener("end",F),()=>{U.removeEventListener("start",L),U.removeEventListener("end",F),U.removeEventListener("change",R)}},[a,c,u,U,p,M]),Ce.useEffect(()=>{if(r){const R=_().controls;return x({controls:U}),()=>x({controls:R})}},[r,U]),Ce.createElement("primitive",Fo({ref:f,object:U,enableDamping:i},h))});function MR(r,e){const t=r+"Geometry";return Ce.forwardRef(({args:n,children:i,...s},a)=>{const c=Ce.useRef(null);return Ce.useImperativeHandle(a,()=>c.current),Ce.useLayoutEffect(()=>void(e==null?void 0:e(c.current))),Ce.createElement("mesh",Fo({ref:c},s),Ce.createElement(t,{attach:"geometry",args:n}),i)})}const NR=MR("sphere");export{IR as C,DR as L,UR as O,Dp as Q,NR as S,D as V,bR as _,Kx as c,WC as u,AR as w};

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.