vendor: 25,083 bytes, lines 1-5
1import{r as Ye,g as i1,j as _t}from"./index-C9JlvMw-.js";function fl(){return fl=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},fl.apply(null,arguments)}/** 2 * @license 3 * Copyright 2010-2023 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const Ju="160",Hs={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Vs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},zv=0,pd=1,Gv=2,r1=3,Hv=0,Ku=1,rl=2,Wi=3,Ur=0,si=1,pi=2,s1=2,Ir=0,Ks=1,md=2,gd=3,vd=4,Vv=5,ns=100,Wv=101,Xv=102,_d=103,yd=104,Yv=200,jv=201,qv=202,Zv=203,Vu=204,Wu=205,Jv=206,Kv=207,Qv=208,$v=209,e_=210,t_=211,n_=212,i_=213,r_=214,s_=0,o_=1,a_=2,dl=3,l_=4,c_=5,u_=6,h_=7,Dl=0,f_=1,d_=2,rr=0,p_=1,m_=2,g_=3,hp=4,v_=5,__=6,xd="attached",y_="detached",Qu=300,Dr=301,ls=302,pl=303,ml=304,fa=306,gl=1e3,Vn=1001,vl=1002,hn=1003,Xu=1004,o1=1004,sl=1005,a1=1005,Kt=1006,fp=1007,l1=1007,cs=1008,c1=1008,sr=1009,x_=1010,S_=1011,$u=1012,dp=1013,Pr=1014,Yi=1015,aa=1016,pp=1017,mp=1018,is=1020,M_=1021,ri=1023,E_=1024,w_=1025,rs=1026,no=1027,b_=1028,gp=1029,T_=1030,vp=1031,_p=1033,Uu=33776,Du=33777,Nu=33778,Fu=33779,Sd=35840,Md=35841,Ed=35842,wd=35843,yp=36196,bd=37492,Td=37496,Ad=37808,Cd=37809,Rd=37810,Pd=37811,Ld=37812,Id=37813,Ud=37814,Dd=37815,Nd=37816,Fd=37817,Od=37818,Bd=37819,kd=37820,zd=37821,Ou=36492,Gd=36494,Hd=36495,A_=36283,Vd=36284,Wd=36285,Xd=36286,C_=2200,R_=2201,P_=2202,_l=2300,yl=2301,Bu=2302,js=2400,qs=2401,xl=2402,eh=2500,xp=2501,u1=0,h1=1,f1=2,Sp=3e3,ss=3001,L_=3200,Mp=3201,us=0,I_=1,Ai="",yn="srgb",ar="srgb-linear",th="display-p3",Nl="display-p3-linear",Sl="linear",Wt="srgb",Ml="rec709",El="p3",d1=0,Ws=7680,p1=7681,m1=7682,g1=7683,v1=34055,_1=34056,y1=5386,x1=512,S1=513,M1=514,E1=515,w1=516,b1=517,T1=518,Yd=519,U_=512,D_=513,N_=514,Ep=515,F_=516,O_=517,B_=518,k_=519,wl=35044,A1=35048,C1=35040,R1=35045,P1=35049,L1=35041,I1=35046,U1=35050,D1=35042,N1="100",jd="300 es",Yu=1035,ji=2e3,la=2001;let Or=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 r=i.indexOf(t);r!==-1&&i.splice(r,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 r=0,o=i.length;r<o;r++)i[r].call(this,e);e.target=null}}};const zn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Ig=1234567;const Qs=Math.PI/180,ca=180/Math.PI;function Ci(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(zn[s&255]+zn[s>>8&255]+zn[s>>16&255]+zn[s>>24&255]+"-"+zn[e&255]+zn[e>>8&255]+"-"+zn[e>>16&15|64]+zn[e>>24&255]+"-"+zn[t&63|128]+zn[t>>8&255]+"-"+zn[t>>16&255]+zn[t>>24&255]+zn[n&255]+zn[n>>8&255]+zn[n>>16&255]+zn[n>>24&255]).toLowerCase()}function nn(s,e,t){return Math.max(e,Math.min(t,s))}function wp(s,e){return(s%e+e)%e}function F1(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function O1(s,e,t){return s!==e?(t-s)/(e-s):0}function ol(s,e,t){return(1-t)*s+t*e}function B1(s,e,t,n){return ol(s,e,1-Math.exp(-t*n))}function k1(s,e=1){return e-Math.abs(wp(s,e*2)-e)}function z1(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function G1(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function H1(s,e){return s+Math.floor(Math.random()*(e-s+1))}function V1(s,e){return s+Math.random()*(e-s)}function W1(s){return s*(.5-Math.random())}function X1(s){s!==void 0&&(Ig=s);let e=Ig+=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 Y1(s){return s*Qs}function j1(s){return s*ca}function qd(s){return(s&s-1)===0&&s!==0}function q1(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function ju(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Z1(s,e,t,n,i){const r=Math.cos,o=Math.sin,a=r(t/2),c=o(t/2),h=r((e+n)/2),f=o((e+n)/2),d=r((e-n)/2),p=o((e-n)/2),m=r((n-e)/2),v=o((n-e)/2);switch(i){case"XYX":s.set(a*f,c*d,c*p,a*h);break;case"YZY":s.set(c*p,a*f,c*d,a*h);break;case"ZXZ":s.set(c*d,c*p,a*f,a*h);break;case"XZX":s.set(a*f,c*v,c*m,a*h);break;case"YXY":s.set(c*m,a*f,c*v,a*h);break;case"ZYZ":s.set(c*v,c*m,a*f,a*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function mi(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function bt(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const J1={DEG2RAD:Qs,RAD2DEG:ca,generateUUID:Ci,clamp:nn,euclideanModulo:wp,mapLinear:F1,inverseLerp:O1,lerp:ol,damp:B1,pingpong:k1,smoothstep:z1,smootherstep:G1,randInt:H1,randFloat:V1,randFloatSpread:W1,seededRandom:X1,degToRad:Y1,radToDeg:j1,isPowerOfTwo:qd,ceilPowerOfTwo:q1,floorPowerOfTwo:ju,setQuaternionFromProperEuler:Z1,normalize:bt,denormalize:mi};class Re{constructor(e=0,t=0){Re.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class wt{constructor(e,t,n,i,r,o,a,c,h){wt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,o,a,c,h)}set(e,t,n,i,r,o,a,c,h){const f=this.elements;return f[0]=e,f[1]=i,f[2]=a,f[3]=t,f[4]=r,f[5]=c,f[6]=n,f[7]=o,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,r=this.elements,o=n[0],a=n[3],c=n[6],h=n[1],f=n[4],d=n[7],p=n[2],m=n[5],v=n[8],S=i[0],y=i[3],_=i[6],E=i[1],M=i[4],b=i[7],P=i[2],R=i[5],L=i[8];return r[0]=o*S+a*E+c*P,r[3]=o*y+a*M+c*R,r[6]=o*_+a*b+c*L,r[1]=h*S+f*E+d*P,r[4]=h*y+f*M+d*R,r[7]=h*_+f*b+d*L,r[2]=p*S+m*E+v*P,r[5]=p*y+m*M+v*R,r[8]=p*_+m*b+v*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],r=e[3],o=e[4],a=e[5],c=e[6],h=e[7],f=e[8];return t*o*f-t*a*h-n*r*f+n*a*c+i*r*h-i*o*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],c=e[6],h=e[7],f=e[8],d=f*o-a*h,p=a*c-f*r,m=h*r-o*c,v=t*d+n*p+i*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/v;return e[0]=d*S,e[1]=(i*h-f*n)*S,e[2]=(a*n-i*o)*S,e[3]=p*S,e[4]=(f*t-i*c)*S,e[5]=(i*r-a*t)*S,e[6]=m*S,e[7]=(n*c-h*t)*S,e[8]=(o*t-n*r)*S,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,o,a){const c=Math.cos(r),h=Math.sin(r);return this.set(n*c,n*h,-n*(c*o+h*a)+o+e,-i*h,i*c,-i*(-h*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(xf.makeScale(e,t)),this}rotate(e){return this.premultiply(xf.makeRotation(-e)),this}translate(e,t){return this.premultiply(xf.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 xf=new wt;function z_(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const K1={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ea(s,e){return new K1[s](e)}function bl(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function G_(){const s=bl("canvas");return s.style.display="block",s}const Ug={};function al(s){s in Ug||(Ug[s]=!0,console.warn(s))}const Dg=new wt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ng=new wt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Nc={[ar]:{transfer:Sl,primaries:Ml,toReference:s=>s,fromReference:s=>s},[yn]:{transfer:Wt,primaries:Ml,toReference:s=>s.convertSRGBToLinear(),fromReference:s=>s.convertLinearToSRGB()},[Nl]:{transfer:Sl,primaries:El,toReference:s=>s.applyMatrix3(Ng),fromReference:s=>s.applyMatrix3(Dg)},[th]:{transfer:Wt,primaries:El,toReference:s=>s.convertSRGBToLinear().applyMatrix3(Ng),fromReference:s=>s.applyMatrix3(Dg).convertLinearToSRGB()}},Q1=new Set([ar,Nl]),Bt={enabled:!0,_workingColorSpace:ar,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(s){if(!Q1.has(s))throw new Error(`Unsupported working color space, "${s}".`);this._workingColorSpace=s},convert:function(s,e,t){if(this.enabled===!1||e===t||!e||!t)return s;const n=Nc[e].toReference,i=Nc[t].fromReference;return i(n(s))},fromWorkingColorSpace:function(s,e){return this.convert(s,this._workingColorSpace,e)},toWorkingColorSpace:function(s,e){return this.convert(s,e,this._workingColorSpace)},getPrimaries:function(s){return Nc[s].primaries},getTransfer:function(s){return s===Ai?Sl:Nc[s].transfer}};function oa(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Sf(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let Ao;class bp{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ao===void 0&&(Ao=bl("canvas")),Ao.width=e.width,Ao.height=e.height;const n=Ao.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ao}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=bl("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let o=0;o<r.length;o++)r[o]=oa(r[o]/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(oa(t[n]/255)*255):t[n]=oa(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 $1=0;class Zs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:$1++}),this.uuid=Ci(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?r.push(Mf(i[o].image)):r.push(Mf(i[o]))}else r=Mf(i);n.url=r}return t||(e.images[this.uuid]=n),n}}function Mf(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?bp.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let eS=0;class sn extends Or{constructor(e=sn.DEFAULT_IMAGE,t=sn.DEFAULT_MAPPING,n=Vn,i=Vn,r=Kt,o=cs,a=ri,c=sr,h=sn.DEFAULT_ANISOTROPY,f=Ai){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eS++}),this.uuid=Ci(),this.name="",this.source=new Zs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=h,this.format=a,this.internalFormat=null,this.type=c,this.offset=new Re(0,0),this.repeat=new Re(1,1),this.center=new Re(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new wt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof f=="string"?this.colorSpace=f:(al("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=f===ss?yn:Ai),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Qu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case gl:e.x=e.x-Math.floor(e.x);break;case Vn:e.x=e.x<0?0:1;break;case vl: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 gl:e.y=e.y-Math.floor(e.y);break;case Vn:e.y=e.y<0?0:1;break;case vl:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return al("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===yn?ss:Sp}set encoding(e){al("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===ss?yn:Ai}}sn.DEFAULT_IMAGE=null;sn.DEFAULT_MAPPING=Qu;sn.DEFAULT_ANISOTROPY=1;class Ft{constructor(e=0,t=0,n=0,i=1){Ft.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const c=e.elements,h=c[0],f=c[4],d=c[8],p=c[1],m=c[5],v=c[9],S=c[2],y=c[6],_=c[10];if(Math.abs(f-p)<.01&&Math.abs(d-S)<.01&&Math.abs(v-y)<.01){if(Math.abs(f+p)<.1&&Math.abs(d+S)<.1&&Math.abs(v+y)<.1&&Math.abs(h+m+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(h+1)/2,b=(m+1)/2,P=(_+1)/2,R=(f+p)/4,L=(d+S)/4,D=(v+y)/4;return M>b&&M>P?M<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(M),i=R/n,r=L/n):b>P?b<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(b),n=R/i,r=D/i):P<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(P),n=L/r,i=D/r),this.set(n,i,r,t),this}let E=Math.sqrt((y-v)*(y-v)+(d-S)*(d-S)+(p-f)*(p-f));return Math.abs(E)<.001&&(E=1),this.x=(y-v)/E,this.y=(d-S)/E,this.z=(p-f)/E,this.w=Math.acos((h+m+_-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}
vendor: 1,862 bytes, line 5
5round(){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 H_ extends Or{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ft(0,0,e,t),this.scissorTest=!1,this.viewport=new Ft(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(al("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace
vendor: 4,785 bytes, line 5
5=n.encoding===ss?yn:Ai),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Kt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new sn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps,this.texture.internalFormat=n.internalFormat,this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Zs(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class qi extends H_{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class nh extends sn{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=hn,this.minFilter=hn,this.wrapR=Vn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class tS extends qi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new nh(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Tp extends sn{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=hn,this.minFilter=hn,this.wrapR=Vn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class nS extends qi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Tp(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class iS extends qi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const r=this.texture;this.texture=[];for(let o=0;o<n;o++)this.texture[o]=r.clone(),this.texture[o].isRenderTargetTexture=!0}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class Wn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,o,a){let c=n[i+0],h=n[i+1],f=n[i+2],d=n[i+3];const p=r[o+0],m=r[o+1],v=r[o+2],S=r[o+3];if(a===0){e[t+0]=c,e[t+1]=h,e[t+2]=f,e[t+3]=d;return}if(a===1){e[t+0]=p,e[t+1]=m,e[t+2]=v,e[t+3]=S;return}if(d!==S||c!==p||h!==m||f!==v){let y=1-a;const _=c*p+h*m+f*v+d*S,E=_>=0?1:-1,M=1-_*_;if(M>Number.EPSILON){const P=Math.sqrt(M),R=Math.atan2(P,_*E);y=Math.sin(y*R)/P,a=Math.sin(a*R)/P}const b=a*E;if(c=c*y+p*b,h=h*y+m*b,f=f*y+v*b,d=d*y+S*b,y===1-a){const P=1/Math.sqrt(c*c+h*h+f*f+d*d);c*=P,h*=P,f*=P,d*=P}}e[t]=c,e[t+1]=h,e[t+2]=f,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,i,r,o){const a=n[i],c=n[i+1],h=n[i+2],f=n[i+3],d=r[o],p=r[o+1],m=r[o+2],v=r[o+3];return e[t]=a*v+f*d+c*m-h*p,e[t+1]=c*v+f*p+h*d-a*m,e[t+2]=h*v+f*m+a*p-c*d,e[t+3]=f*v-a*d-c*p-h*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,h=a(n/2),f=
vendor: 4,194 bytes, line 5
5a(i/2),d=a(r/2),p=c(n/2),m=c(i/2),v=c(r/2);switch(o){case"XYZ":this._x=p*f*d+h*m*v,this._y=h*m*d-p*f*v,this._z=h*f*v+p*m*d,this._w=h*f*d-p*m*v;break;case"YXZ":this._x=p*f*d+h*m*v,this._y=h*m*d-p*f*v,this._z=h*f*v-p*m*d,this._w=h*f*d+p*m*v;break;case"ZXY":this._x=p*f*d-h*m*v,this._y=h*m*d+p*f*v,this._z=h*f*v+p*m*d,this._w=h*f*d-p*m*v;break;case"ZYX":this._x=p*f*d-h*m*v,this._y=h*m*d+p*f*v,this._z=h*f*v-p*m*d,this._w=h*f*d+p*m*v;break;case"YZX":this._x=p*f*d+h*m*v,this._y=h*m*d+p*f*v,this._z=h*f*v-p*m*d,this._w=h*f*d-p*m*v;break;case"XZY":this._x=p*f*d-h*m*v,this._y=h*m*d-p*f*v,this._z=h*f*v+p*m*d,this._w=h*f*d+p*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],o=t[1],a=t[5],c=t[9],h=t[2],f=t[6],d=t[10],p=n+a+d;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(f-c)*m,this._y=(r-h)*m,this._z=(o-i)*m}else if(n>a&&n>d){const m=2*Math.sqrt(1+n-a-d);this._w=(f-c)/m,this._x=.25*m,this._y=(i+o)/m,this._z=(r+h)/m}else if(a>d){const m=2*Math.sqrt(1+a-n-d);this._w=(r-h)/m,this._x=(i+o)/m,this._y=.25*m,this._z=(c+f)/m}else{const m=2*Math.sqrt(1+d-n-a);this._w=(o-i)/m,this._x=(r+h)/m,this._y=(c+f)/m,this._z=.25*m}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(nn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,c=t._y,h=t._z,f=t._w;return this._x=n*f+o*a+i*h-r*c,this._y=i*f+o*c+r*a-n*h,this._z=r*f+o*h+n*c-i*a,this._w=o*f-n*a-i*c-r*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,r=this._z,o=this._w;let a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const c=1-a*a;if(c<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*n+t*this._x,this._y=m*i+t*this._y,this._z=m*r+t*this._z,this.normalize(),this}const h=Math.sqrt(c),f=Math.atan2(h,a),d=Math.sin((1-t)*f)/h,p=Math.sin(t*f)/h;return this._w=o*d+this._w*p,this._x=n*d+this._x*p,this._y=i*d+this._y*p,this._z=r*d+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}
vendor: 49,950 bytes, line 5
5_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class H{constructor(e=0,t=0,n=0){H.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(Fg.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Fg.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,c=e.w,h=2*(o*i-a*n),f=2*(a*t-r*i),d=2*(r*n-o*t);return this.x=t+c*h+o*d-a*f,this.y=n+c*f+a*h-r*d,this.z=i+c*d+r*f-o*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,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,c=t.z;return this.x=i*c-r*a,this.y=r*o-n*c,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ef.copy(this).projectOnVector(e),this.sub(Ef)}reflect(e){return this.sub(Ef.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(nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ef=new H,Fg=new Wn;class Cn{constructor(e=new H(1/0,1/0,1/0),t=new H(-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(Gi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Gi.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=Gi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Gi):Gi.fromBufferAttribute(r,o),Gi.applyMatrix4(e.matrixWorld),this.expandByPoint(Gi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Fc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Fc.copy(n.boundingBox)),Fc.applyMatrix4(e.matrixWorld),this.union(Fc)}const i=e.children;for(let r=0,o=i.length;r<o;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Gi),Gi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Va),Oc.subVectors(this.max,Va),Co.subVectors(e.a,Va),Ro.subVectors(e.b,Va),Po.subVectors(e.c,Va),Zr.subVectors(Ro,Co),Jr.subVectors(Po,Ro),Ls.subVectors(Co,Po);let t=[0,-Zr.z,Zr.y,0,-Jr.z,Jr.y,0,-Ls.z,Ls.y,Zr.z,0,-Zr.x,Jr.z,0,-Jr.x,Ls.z,0,-Ls.x,-Zr.y,Zr.x,0,-Jr.y,Jr.x,0,-Ls.y,Ls.x,0];return!wf(t,Co,Ro,Po,Oc)||(t=[1,0,0,0,1,0,0,0,1],!wf(t,Co,Ro,Po,Oc))?!1:(Bc.crossVectors(Zr,Jr),t=[Bc.x,Bc.y,Bc.z],wf(t,Co,Ro,Po,Oc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Gi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Gi).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:(Sr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Sr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Sr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Sr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Sr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Sr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Sr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Sr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Sr),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 Sr=[new H,new H,new H,new H,new H,new H,new H,new H],Gi=new H,Fc=new Cn,Co=new H,Ro=new H,Po=new H,Zr=new H,Jr=new H,Ls=new H,Va=new H,Oc=new H,Bc=new H,Is=new H;function wf(s,e,t,n,i){for(let r=0,o=s.length-3;r<=o;r+=3){Is.fromArray(s,r);const a=i.x*Math.abs(Is.x)+i.y*Math.abs(Is.y)+i.z*Math.abs(Is.z),c=e.dot(Is),h=t.dot(Is),f=n.dot(Is);if(Math.max(-Math.max(c,h,f),Math.min(c,h,f))>a)return!1}return!0}const rS=new Cn,Wa=new H,bf=new H;class Rn{constructor(e=new H,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):rS.setFromPoints(e).getCenter(n);let i=0;for(let r=0,o=e.length;r<o;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}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;Wa.subVectors(e,this.center);const t=Wa.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Wa,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):(bf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Wa.copy(e.center).add(bf)),this.expandByPoint(Wa.copy(e.center).sub(bf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Mr=new H,Tf=new H,kc=new H,Kr=new H,Af=new H,zc=new H,Cf=new H;class oo{constructor(e=new H,t=new H(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,Mr)),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=Mr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Mr.copy(this.origin).addScaledVector(this.direction,t),Mr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Tf.copy(e).add(t).multiplyScalar(.5),kc.copy(t).sub(e).normalize(),Kr.copy(this.origin).sub(Tf);const r=e.distanceTo(t)*.5,o=-this.direction.dot(kc),a=Kr.dot(this.direction),c=-Kr.dot(kc),h=Kr.lengthSq(),f=Math.abs(1-o*o);let d,p,m,v;if(f>0)if(d=o*c-a,p=o*a-c,v=r*f,d>=0)if(p>=-v)if(p<=v){const S=1/f;d*=S,p*=S,m=d*(d+o*p+2*a)+p*(o*d+p+2*c)+h}else p=r,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*c)+h;else p=-r,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*c)+h;else p<=-v?(d=Math.max(0,-(-o*r+a)),p=d>0?-r:Math.min(Math.max(-r,-c),r),m=-d*d+p*(p+2*c)+h):p<=v?(d=0,p=Math.min(Math.max(-r,-c),r),m=p*(p+2*c)+h):(d=Math.max(0,-(o*r+a)),p=d>0?r:Math.min(Math.max(-r,-c),r),m=-d*d+p*(p+2*c)+h);else p=o>0?-r:r,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*c)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(Tf).addScaledVector(kc,p),m}intersectSphere(e,t){Mr.subVectors(e.center,this.origin);const n=Mr.dot(this.direction),i=Mr.dot(Mr)-n*n,r=e.radius*e.radius;if(i>r)return null;const o=Math.sqrt(r-i),a=n-o,c=n+o;return c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,o,a,c;const h=1/this.direction.x,f=1/this.direction.y,d=1/this.direction.z,p=this.origin;return h>=0?(n=(e.min.x-p.x)*h,i=(e.max.x-p.x)*h):(n=(e.max.x-p.x)*h,i=(e.min.x-p.x)*h),f>=0?(r=(e.min.y-p.y)*f,o=(e.max.y-p.y)*f):(r=(e.max.y-p.y)*f,o=(e.min.y-p.y)*f),n>o||r>i||((r>n||isNaN(n))&&(n=r),(o<i||isNaN(i))&&(i=o),d>=0?(a=(e.min.z-p.z)*d,c=(e.max.z-p.z)*d):(a=(e.max.z-p.z)*d,c=(e.min.z-p.z)*d),n>c||a>i)||((a>n||n!==n)&&(n=a),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Mr)!==null}intersectTriangle(e,t,n,i,r){Af.subVectors(t,e),zc.subVectors(n,e),Cf.crossVectors(Af,zc);let o=this.direction.dot(Cf),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Kr.subVectors(this.origin,e);const c=a*this.direction.dot(zc.crossVectors(Kr,zc));if(c<0)return null;const h=a*this.direction.dot(Af.cross(Kr));if(h<0||c+h>o)return null;const f=-a*Kr.dot(Cf);return f<0?null:this.at(f/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class yt{constructor(e,t,n,i,r,o,a,c,h,f,d,p,m,v,S,y){yt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,o,a,c,h,f,d,p,m,v,S,y)}set(e,t,n,i,r,o,a,c,h,f,d,p,m,v,S,y){const _=this.elements;return _[0]=e,_[4]=t,_[8]=n,_[12]=i,_[1]=r,_[5]=o,_[9]=a,_[13]=c,_[2]=h,_[6]=f,_[10]=d,_[14]=p,_[3]=m,_[7]=v,_[11]=S,_[15]=y,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 yt().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/Lo.setFromMatrixColumn(e,0).length(),r=1/Lo.setFromMatrixColumn(e,1).length(),o=1/Lo.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(i),h=Math.sin(i),f=Math.cos(r),d=Math.sin(r);if(e.order==="XYZ"){const p=o*f,m=o*d,v=a*f,S=a*d;t[0]=c*f,t[4]=-c*d,t[8]=h,t[1]=m+v*h,t[5]=p-S*h,t[9]=-a*c,t[2]=S-p*h,t[6]=v+m*h,t[10]=o*c}else if(e.order==="YXZ"){const p=c*f,m=c*d,v=h*f,S=h*d;t[0]=p+S*a,t[4]=v*a-m,t[8]=o*h,t[1]=o*d,t[5]=o*f,t[9]=-a,t[2]=m*a-v,t[6]=S+p*a,t[10]=o*c}else if(e.order==="ZXY"){const p=c*f,m=c*d,v=h*f,S=h*d;t[0]=p-S*a,t[4]=-o*d,t[8]=v+m*a,t[1]=m+v*a,t[5]=o*f,t[9]=S-p*a,t[2]=-o*h,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){const p=o*f,m=o*d,v=a*f,S=a*d;t[0]=c*f,t[4]=v*h-m,t[8]=p*h+S,t[1]=c*d,t[5]=S*h+p,t[9]=m*h-v,t[2]=-h,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){const p=o*c,m=o*h,v=a*c,S=a*h;t[0]=c*f,t[4]=S-p*d,t[8]=v*d+m,t[1]=d,t[5]=o*f,t[9]=-a*f,t[2]=-h*f,t[6]=m*d+v,t[10]=p-S*d}else if(e.order==="XZY"){const p=o*c,m=o*h,v=a*c,S=a*h;t[0]=c*f,t[4]=-d,t[8]=h*f,t[1]=p*d+S,t[5]=o*f,t[9]=m*d-v,t[2]=v*d-m,t[6]=a*f,t[10]=S*d+p}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(sS,e,oS)}lookAt(e,t,n){const i=this.elements;return bi.subVectors(e,t),bi.lengthSq()===0&&(bi.z=1),bi.normalize(),Qr.crossVectors(n,bi),Qr.lengthSq()===0&&(Math.abs(n.z)===1?bi.x+=1e-4:bi.z+=1e-4,bi.normalize(),Qr.crossVectors(n,bi)),Qr.normalize(),Gc.crossVectors(bi,Qr),i[0]=Qr.x,i[4]=Gc.x,i[8]=bi.x,i[1]=Qr.y,i[5]=Gc.y,i[9]=bi.y,i[2]=Qr.z,i[6]=Gc.z,i[10]=bi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],c=n[8],h=n[12],f=n[1],d=n[5],p=n[9],m=n[13],v=n[2],S=n[6],y=n[10],_=n[14],E=n[3],M=n[7],b=n[11],P=n[15],R=i[0],L=i[4],D=i[8],A=i[12],C=i[1],k=i[5],B=i[9],ee=i[13],N=i[2],q=i[6],K=i[10],re=i[14],Z=i[3],W=i[7],V=i[11],F=i[15];return r[0]=o*R+a*C+c*N+h*Z,r[4]=o*L+a*k+c*q+h*W,r[8]=o*D+a*B+c*K+h*V,r[12]=o*A+a*ee+c*re+h*F,r[1]=f*R+d*C+p*N+m*Z,r[5]=f*L+d*k+p*q+m*W,r[9]=f*D+d*B+p*K+m*V,r[13]=f*A+d*ee+p*re+m*F,r[2]=v*R+S*C+y*N+_*Z,r[6]=v*L+S*k+y*q+_*W,r[10]=v*D+S*B+y*K+_*V,r[14]=v*A+S*ee+y*re+_*F,r[3]=E*R+M*C+b*N+P*Z,r[7]=E*L+M*k+b*q+P*W,r[11]=E*D+M*B+b*K+P*V,r[15]=E*A+M*ee+b*re+P*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],o=e[1],a=e[5],c=e[9],h=e[13],f=e[2],d=e[6],p=e[10],m=e[14],v=e[3],S=e[7],y=e[11],_=e[15];return v*(+r*c*d-i*h*d-r*a*p+n*h*p+i*a*m-n*c*m)+S*(+t*c*m-t*h*p+r*o*p-i*o*m+i*h*f-r*c*f)+y*(+t*h*d-t*a*m-r*o*d+n*o*m+r*a*f-n*h*f)+_*(-i*a*f-t*c*d+t*a*p+i*o*d-n*o*p+n*c*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],r=e[3],o=e[4],a=e[5],c=e[6],h=e[7],f=e[8],d=e[9],p=e[10],m=e[11],v=e[12],S=e[13],y=e[14],_=e[15],E=d*y*h-S*p*h+S*c*m-a*y*m-d*c*_+a*p*_,M=v*p*h-f*y*h-v*c*m+o*y*m+f*c*_-o*p*_,b=f*S*h-v*d*h+v*a*m-o*S*m-f*a*_+o*d*_,P=v*d*c-f*S*c-v*a*p+o*S*p+f*a*y-o*d*y,R=t*E+n*M+i*b+r*P;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]=E*L,e[1]=(S*p*r-d*y*r-S*i*m+n*y*m+d*i*_-n*p*_)*L,e[2]=(a*y*r-S*c*r+S*i*h-n*y*h-a*i*_+n*c*_)*L,e[3]=(d*c*r-a*p*r-d*i*h+n*p*h+a*i*m-n*c*m)*L,e[4]=M*L,e[5]=(f*y*r-v*p*r+v*i*m-t*y*m-f*i*_+t*p*_)*L,e[6]=(v*c*r-o*y*r-v*i*h+t*y*h+o*i*_-t*c*_)*L,e[7]=(o*p*r-f*c*r+f*i*h-t*p*h-o*i*m+t*c*m)*L,e[8]=b*L,e[9]=(v*d*r-f*S*r-v*n*m+t*S*m+f*n*_-t*d*_)*L,e[10]=(o*S*r-v*a*r+v*n*h-t*S*h-o*n*_+t*a*_)*L,e[11]=(f*a*r-o*d*r-f*n*h+t*d*h+o*n*m-t*a*m)*L,e[12]=P*L,e[13]=(f*S*i-v*d*i+v*n*p-t*S*p-f*n*y+t*d*y)*L,e[14]=(v*a*i-o*S*i-v*n*c+t*S*c+o*n*y-t*a*y)*L,e[15]=(o*d*i-f*a*i+f*n*c-t*d*c-o*n*p+t*a*p)*L,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,o=e.x,a=e.y,c=e.z,h=r*o,f=r*a;return this.set(h*o+n,h*a-i*c,h*c+i*a,0,h*a+i*c,f*a+n,f*c-i*o,0,h*c-i*a,f*c+i*o,r*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,o){return this.set(1,n,r,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,o=t._y,a=t._z,c=t._w,h=r+r,f=o+o,d=a+a,p=r*h,m=r*f,v=r*d,S=o*f,y=o*d,_=a*d,E=c*h,M=c*f,b=c*d,P=n.x,R=n.y,L=n.z;return i[0]=(1-(S+_))*P,i[1]=(m+b)*P,i[2]=(v-M)*P,i[3]=0,i[4]=(m-b)*R,i[5]=(1-(p+_))*R,i[6]=(y+E)*R,i[7]=0,i[8]=(v+M)*L,i[9]=(y-E)*L,i[10]=(1-(p+S))*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 r=Lo.set(i[0],i[1],i[2]).length();const o=Lo.set(i[4],i[5],i[6]).length(),a=Lo.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Hi.copy(this);const h=1/r,f=1/o,d=1/a;return Hi.elements[0]*=h,Hi.elements[1]*=h,Hi.elements[2]*=h,Hi.elements[4]*=f,Hi.elements[5]*=f,Hi.elements[6]*=f,Hi.elements[8]*=d,Hi.elements[9]*=d,Hi.elements[10]*=d,t.setFromRotationMatrix(Hi),n.x=r,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,o,a=ji){const c=this.elements,h=2*r/(t-e),f=2*r/(n-i),d=(t+e)/(t-e),p=(n+i)/(n-i);let m,v;if(a===ji)m=-(o+r)/(o-r),v=-2*o*r/(o-r);else if(a===la)m=-o/(o-r),v=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=h,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=f,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=v,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,o,a=ji){const c=this.elements,h=1/(t-e),f=1/(n-i),d=1/(o-r),p=(t+e)*h,m=(n+i)*f;let v,S;if(a===ji)v=(o+r)*d,S=-2*d;else if(a===la)v=r*d,S=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=2*h,c[4]=0,c[8]=0,c[12]=-p,c[1]=0,c[5]=2*f,c[9]=0,c[13]=-m,c[2]=0,c[6]=0,c[10]=S,c[14]=-v,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Lo=new H,Hi=new yt,sS=new H(0,0,0),oS=new H(1,1,1),Qr=new H,Gc=new H,bi=new H,Og=new yt,Bg=new Wn;class Fl{constructor(e=0,t=0,n=0,i=Fl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],o=i[4],a=i[8],c=i[1],h=i[5],f=i[9],d=i[2],p=i[6],m=i[10];switch(t){case"XYZ":this._y=Math.asin(nn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,m),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(p,h),this._z=0);break;case"YXZ":this._x=Math.asin(-nn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-d,r),this._z=0);break;case"ZXY":this._x=Math.asin(nn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-nn(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,h));break;case"YZX":this._z=Math.asin(nn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,h),this._y=Math.atan2(-d,r)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,h),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-f,m),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 Og.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Og,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Bg.setFromEuler(this),this.setFromQuaternion(Bg,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}}Fl.DEFAULT_ORDER="XYZ";class $s{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 aS=0;const kg=new H,Io=new Wn,Er=new yt,Hc=new H,Xa=new H,lS=new H,cS=new Wn,zg=new H(1,0,0),Gg=new H(0,1,0),Hg=new H(0,0,1),uS={type:"added"},hS={type:"removed"};class Nt extends Or{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:aS++}),this.uuid=Ci(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Nt.DEFAULT_UP.clone();const e=new H,t=new Fl,n=new Wn,i=new H(1,1,1);function r(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(o),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 yt},normalMatrix:{value:new wt}}),this.matrix=new yt,this.matrixWorld=new yt,this.matrixAutoUpdate=Nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new $s,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Io.setFromAxisAngle(e,t),this.quaternion.multiply(Io),this}rotateOnWorldAxis(e,t){return Io.setFromAxisAngle(e,t),this.quaternion.premultiply(Io),this}rotateX(e){return this.rotateOnAxis(zg,e)}rotateY(e){return this.rotateOnAxis(Gg,e)}rotateZ(e){return this.rotateOnAxis(Hg,e)}translateOnAxis(e,t){return kg.copy(e).applyQuaternion(this.quaternion),this.position.add(kg.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(zg,e)}translateY(e){return this.translateOnAxis(Gg,e)}translateZ(e){return this.translateOnAxis(Hg,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Er.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Hc.copy(e):Hc.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Xa.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Er.lookAt(Xa,Hc,this.up):Er.lookAt(Hc,Xa,this.up),this.quaternion.setFromRotationMatrix(Er),i&&(Er.extractRotation(i.matrixWorld),Io.setFromRotationMatrix(Er),this.quaternion.premultiply(Io.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(uS)):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(hS)),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),Er.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Er.multiply(e.parent.matrixWorld)),e.applyMatrix4(Er),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,o=i.length;r<o;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xa,e,lS),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xa,cS,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){const r=t[n];(r.matrixWorldAutoUpdate===!0||e===!0)&&r.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let r=0,o=i.length;r<o;r++){const a=i[r];a.matrixWorldAutoUpdate===!0&&a.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(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let h=0,f=c.length;h<f;h++){const d=c[h];r(e.shapes,d)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let c=0,h=this.material.length;c<h;c++)a.push(r(e.materials,this.material[c]));i.material=a}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const c=this.animations[a];i.animations.push(r(e.animations,c))}}if(t){const a=o(e.geometries),c=o(e.materials),h=o(e.textures),f=o(e.images),d=o(e.shapes),p=o(e.skeletons),m=o(e.animations),v=o(e.nodes);a.length>0&&(n.geometries=a),c.length>0&&(n.materials=c),h.length>0&&(n.textures=h),f.length>0&&(n.images=f),d.length>0&&(n.shapes=d),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),v.length>0&&(n.nodes=v)}return n.object=i,n;function o(a){const c=[];for(const h in a){const f=a[h];delete f.metadata,c.push(f)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Nt.DEFAULT_UP=new H(0,1,0);Nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Vi=new H,wr=new H,Rf=new H,br=new H,Uo=new H,Do=new H,Vg=new H,Pf=new H,Lf=new H,If=new H;let Vc=!1;class di{constructor(e=new H,t=new H,n=new H){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Vi.subVectors(e,t),i.cross(Vi);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Vi.subVectors(i,t),wr.subVectors(n,t),Rf.subVectors(e,t);const o=Vi.dot(Vi),a=Vi.dot(wr),c=Vi.dot(Rf),h=wr.dot(wr),f=wr.dot(Rf),d=o*h-a*a;if(d===0)return r.set(0,0,0),null;const p=1/d,m=(h*c-a*f)*p,v=(o*f-a*c)*p;return r.set(1-m-v,v,m)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,br)===null?!1:br.x>=0&&br.y>=0&&br.x+br.y<=1}static getUV(e,t,n,i,r,o,a,c){return Vc===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Vc=!0),this.getInterpolation(e,t,n,i,r,o,a,c)}static getInterpolation(e,t,n,i,r,o,a,c){return this.getBarycoord(e,t,n,i,br)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,br.x),c.addScaledVector(o,br.y),c.addScaledVector(a,br.z),c)}static isFrontFacing(e,t,n,i){return Vi.subVectors(n,t),wr.subVectors(e,t),Vi.cross(wr).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 Vi.subVectors(this.c,this.b),wr.subVectors(this.a,this.b),Vi.cross(wr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return Vc===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Vc=!0),di.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}getInterpolation(e,t,n,i,r){return di.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let o,a;Uo.subVectors(i,n),Do.subVectors(r,n),Pf.subVectors(e,n);const c=Uo.dot(Pf),h=Do.dot(Pf);if(c<=0&&h<=0)return t.copy(n);Lf.subVectors(e,i);const f=Uo.dot(Lf),d=Do.dot(Lf);if(f>=0&&d<=f)return t.copy(i);const p=c*d-f*h;if(p<=0&&c>=0&&f<=0)return o=c/(c-f),t.copy(n).addScaledVector(Uo,o);If.subVectors(e,r);const m=Uo.dot(If),v=Do.dot(If);if(v>=0&&m<=v)return t.copy(r);const S=m*h-c*v;if(S<=0&&h>=0&&v<=0)return a=h/(h-v),t.copy(n).addScaledVector(Do,a);const y=f*v-m*d;if(y<=0&&d-f>=0&&m-v>=0)return Vg.subVectors(r,i),a=(d-f)/(d-f+(m-v)),t.copy(i).addScaledVector(Vg,a);const _=1/(y+S+p);return o=S*_,a=p*_,t.copy(n).addScaledVector(Uo,o).addScaledVector(Do,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const V_={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},$r={h:0,s:0,l:0},Wc={h:0,s:0,l:0};function Uf(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class $e{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=yn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Bt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Bt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Bt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Bt.workingColorSpace){if(e=wp(e,1),t=nn(t,0,1),n=nn(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,o=2*n-r;this.r=Uf(o,r,e+1/3),this.g=Uf(o,r,e),this.b=Uf(o,r,e-1/3)}return Bt.toWorkingColorSpace(this,i),this}setStyle(e,t=yn){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=yn){const n=V_[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=oa(e.r),this.g=oa(e.g),this.b=oa(e.b),this}copyLinearToSRGB(e){return this.r=Sf(e.r),this.g=Sf(e.g),this.b=Sf(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yn){return Bt.fromWorkingColorSpace(Gn.copy(this),e),Math.round(nn(Gn.r*255,0,255))*65536+Math.round(nn(Gn.g*255,0,255))*256+Math.round(nn(Gn.b*255,0,255))}getHexString(e=yn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Bt.workingColorSpace){Bt.fromWorkingColorSpace(Gn.copy(this),t);const n=Gn.r,i=Gn.g,r=Gn.b,o=Math.max(n,i,r),a=Math.min(n,i,r);let c,h;const f=(a+o)/2;if(a===o)c=0,h=0;else{const d=o-a;switch(h=f<=.5?d/(o+a):d/(2-o-a),o){case n:c=(i-r)/d+(i<r?6:0);break;case i:c=(r-n)/d+2;break;case r:c=(n-i)/d+4;break}c/=6}return e.h=c,e.s=h,e.l=f,e}getRGB(e,t=Bt.workingColorSpace){return Bt.fromWorkingColorSpace(Gn.copy(this),t),e.r=Gn.r,e.g=Gn.g,e.b=Gn.b,e}getStyle(e=yn){Bt.fromWorkingColorSpace(Gn.copy(this),e);const t=Gn.r,n=Gn.g,i=Gn.b;return e!==yn?`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($r),this.setHSL($r.h+e,$r.s+t,$r.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}
vendor: 2,644 bytes, line 5
5lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL($r),e.getHSL(Wc);const n=ol($r.h,Wc.h,t),i=ol($r.s,Wc.s,t),r=ol($r.l,Wc.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Gn=new $e;$e.NAMES=V_;let fS=0;class Xn extends Or{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:fS++}),this.uuid=Ci(),this.name="",this.type="Material",this.blending=Ks,this.side=Ur,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Vu,this.blendDst=Wu,this.blendEquation=ns,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new $e(0,0,0),this.blendAlpha=0,this.depthFunc=dl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Yd,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ws,this.stencilZFail=Ws,this.stencilZPass=Ws,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 19,915 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ks&&(n.blending=this.blending),this.side!==Ur&&(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!==Vu&&(n.blendSrc=this.blendSrc),this.blendDst!==Wu&&(n.blendDst=this.blendDst),this.blendEquation!==ns&&(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!==dl&&(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!==Yd&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ws&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ws&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ws&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const o=[];for(const a in r){const c=r[a];delete c.metadata,o.push(c)}return o}if(t){const r=i(e.textures),o=i(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Br extends Xn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new $e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Dl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Rr=dS();function dS(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let c=0;c<256;++c){const h=c-127;h<-27?(n[c]=0,n[c|256]=32768,i[c]=24,i[c|256]=24):h<-14?(n[c]=1024>>-h-14,n[c|256]=1024>>-h-14|32768,i[c]=-h-1,i[c|256]=-h-1):h<=15?(n[c]=h+15<<10,n[c|256]=h+15<<10|32768,i[c]=13,i[c|256]=13):h<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let c=1;c<1024;++c){let h=c<<13,f=0;for(;!(h&8388608);)h<<=1,f-=8388608;h&=-8388609,f+=947912704,r[c]=h|f}for(let c=1024;c<2048;++c)r[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(a[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:o,offsetTable:a}}function fi(s){Math.abs(s)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),s=nn(s,-65504,65504),Rr.floatView[0]=s;const e=Rr.uint32View[0],t=e>>23&511;return Rr.baseTable[t]+((e&8388607)>>Rr.shiftTable[t])}function il(s){const e=s>>10;return Rr.uint32View[0]=Rr.mantissaTable[Rr.offsetTable[e]+(s&1023)]+Rr.exponentTable[e],Rr.floatView[0]}const pS={toHalfFloat:fi,fromHalfFloat:il},vn=new H,Xc=new Re;class kt{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=wl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Yi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Xc.fromBufferAttribute(this,t),Xc.applyMatrix3(e),this.setXY(t,Xc.x,Xc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)vn.fromBufferAttribute(this,t),vn.applyMatrix3(e),this.setXYZ(t,vn.x,vn.y,vn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)vn.fromBufferAttribute(this,t),vn.applyMatrix4(e),this.setXYZ(t,vn.x,vn.y,vn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)vn.fromBufferAttribute(this,t),vn.applyNormalMatrix(e),this.setXYZ(t,vn.x,vn.y,vn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)vn.fromBufferAttribute(this,t),vn.transformDirection(e),this.setXYZ(t,vn.x,vn.y,vn.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=mi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=bt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=mi(t,this.array)),t}setX(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=mi(t,this.array)),t}setY(e,t){return this.normalized&&(t=bt(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=mi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=bt(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=mi(t,this.array)),t}setW(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=bt(t,this.array),n=bt(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=bt(t,this.array),n=bt(n,this.array),i=bt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array),i=bt(i,this.array),r=bt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==wl&&(e.usage=this.usage),e}}class mS extends kt{constructor(e,t,n){super(new Int8Array(e),t,n)}}class gS extends kt{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class vS extends kt{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class _S extends kt{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Ap extends kt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class yS extends kt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Cp extends kt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class xS extends kt{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=il(this.array[e*this.itemSize]);return this.normalized&&(t=mi(t,this.array)),t}setX(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize]=fi(t),this}getY(e){let t=il(this.array[e*this.itemSize+1]);return this.normalized&&(t=mi(t,this.array)),t}setY(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize+1]=fi(t),this}getZ(e){let t=il(this.array[e*this.itemSize+2]);return this.normalized&&(t=mi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize+2]=fi(t),this}getW(e){let t=il(this.array[e*this.itemSize+3]);return this.normalized&&(t=mi(t,this.array)),t}setW(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize+3]=fi(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array)),this.array[e+0]=fi(t),this.array[e+1]=fi(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array),i=bt(i,this.array)),this.array[e+0]=fi(t),this.array[e+1]=fi(n),this.array[e+2]=fi(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array),i=bt(i,this.array),r=bt(r,this.array)),this.array[e+0]=fi(t),this.array[e+1]=fi(n),this.array[e+2]=fi(i),this.array[e+3]=fi(r),this}}class st extends kt{constructor(e,t,n){super(new Float32Array(e),t,n)}}class SS extends kt{constructor(e,t,n){super(new Float64Array(e),t,n)}}let MS=0;const Bi=new yt,Df=new Nt,No=new H,Ti=new Cn,Ya=new Cn,An=new H;class Tt extends Or{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:MS++}),this.uuid=Ci(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(z_(e)?Cp:Ap)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new wt().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Bi.makeRotationFromQuaternion(e),this.applyMatrix4(Bi),this}rotateX(e){return Bi.makeRotationX(e),this.applyMatrix4(Bi),this}rotateY(e){return Bi.makeRotationY(e),this.applyMatrix4(Bi),this}rotateZ(e){return Bi.makeRotationZ(e),this.applyMatrix4(Bi),this}translate(e,t,n){return Bi.makeTranslation(e,t,n),this.applyMatrix4(Bi),this}scale(e,t,n){return Bi.makeScale(e,t,n),this.applyMatrix4(Bi),this}lookAt(e){return Df.lookAt(e),Df.updateMatrix(),this.applyMatrix4(Df.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(No).negate(),this.translate(No.x,No.y,No.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new st(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Cn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingBox.set(new H(-1/0,-1/0,-1/0),new H(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const r=t[n];Ti.setFromBufferAttribute(r),this.morphTargetsRelative?(An.addVectors(this.boundingBox.min,Ti.min),this.boundingBox.expandByPoint(An),An.addVectors(this.boundingBox.max,Ti.max),this.boundingBox.expandByPoint(An)):(this.boundingBox.expandByPoint(Ti.min),this.boundingBox.expandByPoint(Ti.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 Rn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingSphere.set(new H,1/0);return}if(e){const n=this.boundingSphere.center;if(Ti.setFromBufferAttribute(e),t)for(let r=0,o=t.length;r<o;r++){const a=t[r];Ya.setFromBufferAttribute(a),this.morphTargetsRelative?(An.addVectors(Ti.min,Ya.min),Ti.expandByPoint(An),An.addVectors(Ti.max,Ya.max),Ti.expandByPoint(An)):(Ti.expandByPoint(Ya.min),Ti.expandByPoint(Ya.max))}Ti.getCenter(n);let i=0;for(let r=0,o=e.count;r<o;r++)An.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(An));if(t)for(let r=0,o=t.length;r<o;r++){const a=t[r],c=this.morphTargetsRelative;for(let h=0,f=a.count;h<f;h++)An.fromBufferAttribute(a,h),c&&(No.fromBufferAttribute(e,h),An.add(No)),i=Math.max(i,n.distanceToSquared(An))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,r=t.normal.array,o=t.uv.array,a=i.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new kt(new Float32Array(4*a),4));const c=this.getAttribute("tangent").array,h=[],f=[];for(let C=0;C<a;C++)h[C]=new H,f[C]=new H;const d=new H,p=new H,m=new H,v=new Re,S=new Re,y=new Re,_=new H,E=new H;function M(C,k,B){d.fromArray(i,C*3),p.fromArray(i,k*3),m.fromArray(i,B*3),v.fromArray(o,C*2),S.fromArray(o,k*2),y.fromArray(o,B*2),p.sub(d),m.sub(d),S.sub(v),y.sub(v);const ee=1/(S.x*y.y-y.x*S.y);isFinite(ee)&&(_.copy(p).multiplyScalar(y.y).addScaledVector(m,-S.y).multiplyScalar(ee),E.copy(m).multiplyScalar(S.x).addScaledVector(p,-y.x).multiplyScalar(ee),h[C].add(_),h[k].add(_),h[B].add(_),f[C].add(E),f[k].add(E),f[B].add(E))}let b=this.groups;b.length===0&&(b=[{start:0,count:n.length}]);for(let C=0,k=b.length;C<k;++C){const B=b[C],ee=B.start,N=B.count;for(let q=ee,K=ee+N;q<K;q+=3)M(n[q+0],n[q+1],n[q+2])}const P=new H,R=new H,L=new H,D=new H;function A(C){L.fromArray(r,C*3),D.copy(L);const k=h[C];P.copy(k),P.sub(L.multiplyScalar(L.dot(k))).normalize(),R.crossVectors(D,k);const ee=R.dot(f[C])<0?-1:1;c[C*4]=P.x,c[C*4+1]=P.y,c[C*4+2]=P.z,c[C*4+3]=ee}for(let C=0,k=b.length;C<k;++C){const B=b[C],ee=B.start,N=B.count;for(let q=ee,K=ee+N;q<K;q+=3)A(n[q+0]),A(n[q+1]),A(n[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 kt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,m=n.count;p<m;p++)n.setXYZ(p,0,0,0);const i=new H,r=new H,o=new H,a=new H,c=new H,h=new H,f=new H,d=new H;if(e)for(let p=0,m=e.count;p<m;p+=3){const v=e.getX(p+0),S=e.getX(p+1),y=e.getX(p+2);i.fromBufferAttribute(t,v),r.fromBufferAttribute(t,S),o.fromBufferAttribute(t,y),f.subVectors(o,r),d.subVectors(i,r),f.cross(d),a.fromBufferAttribute(n,v),c.fromBufferAttribute(n,S),h.fromBufferAttribute(n,y),a.add(f),c.add(f),h.add(f),n.setXYZ(v,a.x,a.y,a.z),n.setXYZ(S,c.x,c.y,c.z),n.setXYZ(y,h.x,h.y,h.z)}else for(let p=0,m=t.count;p<m;p+=3)i.fromBufferAttribute(t,p+0),r.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),f.subVectors(o,r),d.subVectors(i,r),f.cross(d),n.setXYZ(p+0,f.x,f.y,f.z),n.setXYZ(p+1,f.x,f.y,f.z),n.setXYZ(p+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++)An.fromBufferAttribute(e,t),An.normalize(),e.setXYZ(t,An.x,An.y,An.z)}toNonIndexed(){function e(a,c){const h=a.array,f=a.itemSize,d=a.normalized,p=new h.constructor(c.length*f);let m=0,v=0;for(let S=0,y=c.length;S<y;S++){a.isInterleavedBufferAttribute?m=c[S]*a.data.stride+a.offset:m=c[S]*f;for(let _=0;_<f;_++)p[v++]=h[m++]}return new kt(p,f,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Tt,n=this.index.array,i=this.attributes;for(const a in i){const c=i[a],h=e(c,n);t.setAttribute(a,h)}const r=this.morphAttributes;for(const a in r){const c=[],h=r[a];for(let f=0,d=h.length;f<d;f++){const p=h[f],m=e(p,n);c.push(m)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,c=o.length;a<c;a++){const h=o[a];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 26,188 bytes, lines 5-98
5if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const h in c)c[h]!==void 0&&(e[h]=c[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 c in n){const h=n[c];e.data.attributes[c]=h.toJSON(e.data)}const i={};let r=!1;for(const c in this.morphAttributes){const h=this.morphAttributes[c],f=[];for(let d=0,p=h.length;d<p;d++){const m=h[d];f.push(m.toJSON(e.data))}f.length>0&&(i[c]=f,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const h in i){const f=i[h];this.setAttribute(h,f.clone(t))}const r=e.morphAttributes;for(const h in r){const f=[],d=r[h];for(let p=0,m=d.length;p<m;p++)f.push(d[p].clone(t));this.morphAttributes[h]=f}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let h=0,f=o.length;h<f;h++){const d=o[h];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Wg=new yt,Us=new oo,Yc=new Rn,Xg=new H,Fo=new H,Oo=new H,Bo=new H,Nf=new H,jc=new H,qc=new Re,Zc=new Re,Jc=new Re,Yg=new H,jg=new H,qg=new H,Kc=new H,Qc=new H;class rn extends Nt{constructor(e=new Tt,t=new Br){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 r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(r&&a){jc.set(0,0,0);for(let c=0,h=r.length;c<h;c++){const f=a[c],d=r[c];f!==0&&(Nf.fromBufferAttribute(d,e),o?jc.addScaledVector(Nf,f):jc.addScaledVector(Nf.sub(t),f))}t.add(jc)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Yc.copy(n.boundingSphere),Yc.applyMatrix4(r),Us.copy(e.ray).recast(e.near),!(Yc.containsPoint(Us.origin)===!1&&(Us.intersectSphere(Yc,Xg)===null||Us.origin.distanceToSquared(Xg)>(e.far-e.near)**2))&&(Wg.copy(r).invert(),Us.copy(e.ray).applyMatrix4(Wg),!(n.boundingBox!==null&&Us.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Us)))}_computeIntersections(e,t,n){let i;const r=this.geometry,o=this.material,a=r.index,c=r.attributes.position,h=r.attributes.uv,f=r.attributes.uv1,d=r.attributes.normal,p=r.groups,m=r.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,S=p.length;v<S;v++){const y=p[v],_=o[y.materialIndex],E=Math.max(y.start,m.start),M=Math.min(a.count,Math.min(y.start+y.count,m.start+m.count));for(let b=E,P=M;b<P;b+=3){const R=a.getX(b),L=a.getX(b+1),D=a.getX(b+2);i=$c(this,_,e,n,h,f,d,R,L,D),i&&(i.faceIndex=Math.floor(b/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{const v=Math.max(0,m.start),S=Math.min(a.count,m.start+m.count);for(let y=v,_=S;y<_;y+=3){const E=a.getX(y),M=a.getX(y+1),b=a.getX(y+2);i=$c(this,o,e,n,h,f,d,E,M,b),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(o))for(let v=0,S=p.length;v<S;v++){const y=p[v],_=o[y.materialIndex],E=Math.max(y.start,m.start),M=Math.min(c.count,Math.min(y.start+y.count,m.start+m.count));for(let b=E,P=M;b<P;b+=3){const R=b,L=b+1,D=b+2;i=$c(this,_,e,n,h,f,d,R,L,D),i&&(i.faceIndex=Math.floor(b/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{const v=Math.max(0,m.start),S=Math.min(c.count,m.start+m.count);for(let y=v,_=S;y<_;y+=3){const E=y,M=y+1,b=y+2;i=$c(this,o,e,n,h,f,d,E,M,b),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}}}function ES(s,e,t,n,i,r,o,a){let c;if(e.side===si?c=n.intersectTriangle(o,r,i,!0,a):c=n.intersectTriangle(i,r,o,e.side===Ur,a),c===null)return null;Qc.copy(a),Qc.applyMatrix4(s.matrixWorld);const h=t.ray.origin.distanceTo(Qc);return h<t.near||h>t.far?null:{distance:h,point:Qc.clone(),object:s}}function $c(s,e,t,n,i,r,o,a,c,h){s.getVertexPosition(a,Fo),s.getVertexPosition(c,Oo),s.getVertexPosition(h,Bo);const f=ES(s,e,t,n,Fo,Oo,Bo,Kc);if(f){i&&(qc.fromBufferAttribute(i,a),Zc.fromBufferAttribute(i,c),Jc.fromBufferAttribute(i,h),f.uv=di.getInterpolation(Kc,Fo,Oo,Bo,qc,Zc,Jc,new Re)),r&&(qc.fromBufferAttribute(r,a),Zc.fromBufferAttribute(r,c),Jc.fromBufferAttribute(r,h),f.uv1=di.getInterpolation(Kc,Fo,Oo,Bo,qc,Zc,Jc,new Re),f.uv2=f.uv1),o&&(Yg.fromBufferAttribute(o,a),jg.fromBufferAttribute(o,c),qg.fromBufferAttribute(o,h),f.normal=di.getInterpolation(Kc,Fo,Oo,Bo,Yg,jg,qg,new H),f.normal.dot(n.direction)>0&&f.normal.multiplyScalar(-1));const d={a,b:c,c:h,normal:new H,materialIndex:0};di.getNormal(Fo,Oo,Bo,d.normal),f.face=d}return f}class ao extends Tt{constructor(e=1,t=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const a=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const c=[],h=[],f=[],d=[];let p=0,m=0;v("z","y","x",-1,-1,n,t,e,o,r,0),v("z","y","x",1,-1,n,t,-e,o,r,1),v("x","z","y",1,1,e,n,t,i,o,2),v("x","z","y",1,-1,e,n,-t,i,o,3),v("x","y","z",1,-1,e,t,n,i,r,4),v("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(c),this.setAttribute("position",new st(h,3)),this.setAttribute("normal",new st(f,3)),this.setAttribute("uv",new st(d,2));function v(S,y,_,E,M,b,P,R,L,D,A){const C=b/L,k=P/D,B=b/2,ee=P/2,N=R/2,q=L+1,K=D+1;let re=0,Z=0;const W=new H;for(let V=0;V<K;V++){const F=V*k-ee;for(let j=0;j<q;j++){const G=j*C-B;W[S]=G*E,W[y]=F*M,W[_]=N,h.push(W.x,W.y,W.z),W[S]=0,W[y]=0,W[_]=R>0?1:-1,f.push(W.x,W.y,W.z),d.push(j/L),d.push(1-V/D),re+=1}}for(let V=0;V<D;V++)for(let F=0;F<L;F++){const j=p+F+q*V,G=p+F+q*(V+1),$=p+(F+1)+q*(V+1),te=p+(F+1)+q*V;c.push(j,G,te),c.push(G,$,te),Z+=6}a.addGroup(m,Z,A),m+=Z,p+=re}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ao(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ua(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function ii(s){const e={};for(let t=0;t<s.length;t++){const n=ua(s[t]);for(const i in n)e[i]=n[i]}return e}function wS(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function W_(s){return s.getRenderTarget()===null?s.outputColorSpace:Bt.workingColorSpace}const Rp={clone:ua,merge:ii};var bS=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,TS=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class lr extends Xn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=bS,this.fragmentShader=TS,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ua(e.uniforms),this.uniformsGroups=wS(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ol extends Nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new yt,this.projectionMatrix=new yt,this.projectionMatrixInverse=new yt,this.coordinateSystem=ji}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class fn extends Ol{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=ca*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Qs*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ca*2*Math.atan(Math.tan(Qs*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Qs*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,h=o.fullHeight;r+=o.offsetX*i/c,t-=o.offsetY*n/h,i*=o.width/c,n*=o.height/h}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ko=-90,zo=1;class X_ extends Nt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new fn(ko,zo,e,t);i.layers=this.layers,this.add(i);const r=new fn(ko,zo,e,t);r.layers=this.layers,this.add(r);const o=new fn(ko,zo,e,t);o.layers=this.layers,this.add(o);const a=new fn(ko,zo,e,t);a.layers=this.layers,this.add(a);const c=new fn(ko,zo,e,t);c.layers=this.layers,this.add(c);const h=new fn(ko,zo,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,o,a,c]=t;for(const h of t)this.remove(h);if(e===ji)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===la)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const 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[r,o,a,c,h,f]=this.children,d=e.getRenderTarget(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const S=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,o),e.setRenderTarget(n,2,i),e.render(t,a),e.setRenderTarget(n,3,i),e.render(t,c),e.setRenderTarget(n,4,i),e.render(t,h),n.texture.generateMipmaps=S,e.setRenderTarget(n,5,i),e.render(t,f),e.setRenderTarget(d,p,m),e.xr.enabled=v,n.texture.needsPMREMUpdate=!0}}class Bl extends sn{constructor(e,t,n,i,r,o,a,c,h,f){e=e!==void 0?e:[],t=t!==void 0?t:Dr,super(e,t,n,i,r,o,a,c,h,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Y_ extends qi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];t.encoding!==void 0&&(al("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===ss?yn:Ai),this.texture=new Bl(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:Kt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},i=new ao(5,5,5),r=new lr({name:"CubemapFromEquirect",uniforms:ua(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:Ir});r.uniforms.tEquirect.value=t;const o=new rn(i,r),a=t.minFilter;return t.minFilter===cs&&(t.minFilter=Kt),new X_(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(r)}}const Ff=new H,AS=new H,CS=new wt;class Cr{constructor(e=new H(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=Ff.subVectors(n,t).cross(AS.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(Ff),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||CS.getNormalMatrix(e),i=this.coplanarPoint(Ff).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ds=new Rn,eu=new H;class kl{constructor(e=new Cr,t=new Cr,n=new Cr,i=new Cr,r=new Cr,o=new Cr){this.planes=[e,t,n,i,r,o]}set(e,t,n,i,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ji){const n=this.planes,i=e.elements,r=i[0],o=i[1],a=i[2],c=i[3],h=i[4],f=i[5],d=i[6],p=i[7],m=i[8],v=i[9],S=i[10],y=i[11],_=i[12],E=i[13],M=i[14],b=i[15];if(n[0].setComponents(c-r,p-h,y-m,b-_).normalize(),n[1].setComponents(c+r,p+h,y+m,b+_).normalize(),n[2].setComponents(c+o,p+f,y+v,b+E).normalize(),n[3].setComponents(c-o,p-f,y-v,b-E).normalize(),n[4].setComponents(c-a,p-d,y-S,b-M).normalize(),t===ji)n[5].setComponents(c+a,p+d,y+S,b+M).normalize();else if(t===la)n[5].setComponents(a,d,S,M).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(),Ds.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ds.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ds)}intersectsSprite(e){return Ds.center.set(0,0,0),Ds.radius=.7071067811865476,Ds.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ds)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(eu.x=i.normal.x>0?e.max.x:e.min.x,eu.y=i.normal.y>0?e.max.y:e.min.y,eu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(eu)<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 j_(){let s=null,e=!1,t=null,n=null;function i(r,o){t(r,o),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function RS(s,e){const t=e.isWebGL2,n=new WeakMap;function i(h,f){const d=h.array,p=h.usage,m=d.byteLength,v=s.createBuffer();s.bindBuffer(f,v),s.bufferData(f,d,p),h.onUploadCallback();let S;if(d instanceof Float32Array)S=s.FLOAT;else if(d instanceof Uint16Array)if(h.isFloat16BufferAttribute)if(t)S=s.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else S=s.UNSIGNED_SHORT;else if(d instanceof Int16Array)S=s.SHORT;else if(d instanceof Uint32Array)S=s.UNSIGNED_INT;else if(d instanceof Int32Array)S=s.INT;else if(d instanceof Int8Array)S=s.BYTE;else if(d instanceof Uint8Array)S=s.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)S=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:v,type:S,bytesPerElement:d.BYTES_PER_ELEMENT,version:h.version,size:m}}function r(h,f,d){const p=f.array,m=f._updateRange,v=f.updateRanges;if(s.bindBuffer(d,h),m.count===-1&&v.length===0&&s.bufferSubData(d,0,p),v.length!==0){for(let S=0,y=v.length;S<y;S++){const _=v[S];t?s.bufferSubData(d,_.start*p.BYTES_PER_ELEMENT,p,_.start,_.count):s.bufferSubData(d,_.start*p.BYTES_PER_ELEMENT,p.subarray(_.start,_.start+_.count))}f.clearUpdateRanges()}m.count!==-1&&(t?s.bufferSubData(d,m.offset*p.BYTES_PER_ELEMENT,p,m.offset,m.count):s.bufferSubData(d,m.offset*p.BYTES_PER_ELEMENT,p.subarray(m.offset,m.offset+m.count)),m.count=-1),f.onUploadCallback()}function o(h){return h.isInterleavedBufferAttribute&&(h=h.data),n.get(h)}function a(h){h.isInterleavedBufferAttribute&&(h=h.data);const f=n.get(h);f&&(s.deleteBuffer(f.buffer),n.delete(h))}function c(h,f){if(h.isGLBufferAttribute){const p=n.get(h);(!p||p.version<h.version)&&n.set(h,{buffer:h.buffer,type:h.type,bytesPerElement:h.elementSize,version:h.version});return}h.isInterleavedBufferAttribute&&(h=h.data);const d=n.get(h);if(d===void 0)n.set(h,i(h,f));else if(d.version<h.version){if(d.size!==h.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.");r(d.buffer,h,f),d.version=h.version}}return{get:o,remove:a,update:c}}class hs extends Tt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,o=t/2,a=Math.floor(n),c=Math.floor(i),h=a+1,f=c+1,d=e/a,p=t/c,m=[],v=[],S=[],y=[];for(let _=0;_<f;_++){const E=_*p-o;for(let M=0;M<h;M++){const b=M*d-r;v.push(b,-E,0),S.push(0,0,1),y.push(M/a),y.push(1-_/c)}}for(let _=0;_<c;_++)for(let E=0;E<a;E++){const M=E+h*_,b=E+h*(_+1),P=E+1+h*(_+1),R=E+1+h*_;m.push(M,b,R),m.push(b,P,R)}this.setIndex(m),this.setAttribute("position",new st(v,3)),this.setAttribute("normal",new st(S,3)),this.setAttribute("uv",new st(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hs(e.width,e.height,e.widthSegments,e.heightSegments)}}var PS=`#ifdef USE_ALPHAHASH 45 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 46#endif`,LS=`#ifdef USE_ALPHAHASH 47 const float ALPHA_HASH_SCALE = 0.05; 48 float hash2D( vec2 value ) { 49 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 50 } 51 float hash3D( vec3 value ) { 52 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 53 } 54 float getAlphaHashThreshold( vec3 position ) { 55 float maxDeriv = max( 56 length( dFdx( position.xyz ) ), 57 length( dFdy( position.xyz ) ) 58 ); 59 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 60 vec2 pixScales = vec2( 61 exp2( floor( log2( pixScale ) ) ), 62 exp2( ceil( log2( pixScale ) ) ) 63 ); 64 vec2 alpha = vec2( 65 hash3D( floor( pixScales.x * position.xyz ) ), 66 hash3D( floor( pixScales.y * position.xyz ) ) 67 ); 68 float lerpFactor = fract( log2( pixScale ) ); 69 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 70 float a = min( lerpFactor, 1.0 - lerpFactor ); 71 vec3 cases = vec3( 72 x * x / ( 2.0 * a * ( 1.0 - a ) ), 73 ( x - 0.5 * a ) / ( 1.0 - a ), 74 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 75 ); 76 float threshold = ( x < ( 1.0 - a ) ) 77 ? ( ( x < a ) ? cases.x : cases.y ) 78 : cases.z; 79 return clamp( threshold , 1.0e-6, 1.0 ); 80 } 81#endif`,IS=`#ifdef USE_ALPHAMAP 82 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 83#endif`,US=`#ifdef USE_ALPHAMAP 84 uniform sampler2D alphaMap; 85#endif`,DS=`#ifdef USE_ALPHATEST 86 if ( diffuseColor.a < alphaTest ) discard; 87#endif`,NS=`#ifdef USE_ALPHATEST 88 uniform float alphaTest; 89#endif`,FS=`#ifdef USE_AOMAP 90 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 91 reflectedLight.indirectDiffuse *= ambientOcclusion; 92 #if defined( USE_CLEARCOAT ) 93 clearcoatSpecularIndirect *= ambientOcclusion; 94 #endif 95 #if defined( USE_SHEEN ) 96 sheenSpecularIndirect *= ambientOcclusion; 97 #endif 98 #if defined( USE_ENVMAP ) && defined( STANDARD )
99 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 100 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 101 #endif 102#endif`,OS=`#ifdef USE_AOMAP 103 uniform sampler2D aoMap; 104 uniform float aoMapIntensity; 105#endif`,BS=`#ifdef USE_BATCHING 106 attribute float batchId; 107 uniform highp sampler2D batchingTexture; 108 mat4 getBatchingMatrix( const in float i ) { 109 int size = textureSize( batchingTexture, 0 ).x; 110 int j = int( i ) * 4; 111 int x = j % size; 112 int y = j / size; 113 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 114 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 115 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 116 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 117 return mat4( v1, v2, v3, v4 ); 118 } 119#endif`,kS=`#ifdef USE_BATCHING 120 mat4 batchingMatrix = getBatchingMatrix( batchId ); 121#endif`,zS=`vec3 transformed = vec3( position ); 122#ifdef USE_ALPHAHASH 123 vPosition = vec3( position ); 124#endif`,GS=`vec3 objectNormal = vec3( normal ); 125#ifdef USE_TANGENT 126 vec3 objectTangent = vec3( tangent.xyz ); 127#endif`,HS=`float G_BlinnPhong_Implicit( ) { 128 return 0.25; 129} 130float D_BlinnPhong( const in float shininess, const in float dotNH ) { 131 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 132} 133vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 134 vec3 halfDir = normalize( lightDir + viewDir ); 135 float dotNH = saturate( dot( normal, halfDir ) ); 136 float dotVH = saturate( dot( viewDir, halfDir ) ); 137 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 138 float G = G_BlinnPhong_Implicit( ); 139 float D = D_BlinnPhong( shininess, dotNH ); 140 return F * ( G * D ); 141} // validated`,VS=`#ifdef USE_IRIDESCENCE 142 const mat3 XYZ_TO_REC709 = mat3( 143 3.2404542, -0.9692660, 0.0556434, 144 -1.5371385, 1.8760108, -0.2040259, 145 -0.4985314, 0.0415560, 1.0572252 146 ); 147 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 148 vec3 sqrtF0 = sqrt( fresnel0 ); 149 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 150 } 151 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 152 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 153 } 154 float IorToFresnel0( float transmittedIor, float incidentIor ) { 155 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 156 } 157 vec3 evalSensitivity( float OPD, vec3 shift ) { 158 float phase = 2.0 * PI * OPD * 1.0e-9; 159 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 160 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 161 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 162 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 163 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 164 xyz /= 1.0685e-7; 165 vec3 rgb = XYZ_TO_REC709 * xyz; 166 return rgb; 167 } 168 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 169 vec3 I; 170 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 171 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 172 float cosTheta2Sq = 1.0 - sinTheta2Sq; 173 if ( cosTheta2Sq < 0.0 ) { 174 return vec3( 1.0 ); 175 } 176 float cosTheta2 = sqrt( cosTheta2Sq ); 177 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 178 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
179 float T121 = 1.0 - R12; 180 float phi12 = 0.0; 181 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 182 float phi21 = PI - phi12; 183 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 184 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 185 vec3 phi23 = vec3( 0.0 ); 186 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 187 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 188 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 189 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 190 vec3 phi = vec3( phi21 ) + phi23; 191 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 192 vec3 r123 = sqrt( R123 ); 193 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 194 vec3 C0 = R12 + Rs; 195 I = C0; 196 vec3 Cm = Rs - T121; 197 for ( int m = 1; m <= 2; ++ m ) { 198 Cm *= r123; 199 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 200 I += Cm * Sm; 201 } 202 return max( I, vec3( 0.0 ) ); 203 } 204#endif`,WS=`#ifdef USE_BUMPMAP 205 uniform sampler2D bumpMap; 206 uniform float bumpScale; 207 vec2 dHdxy_fwd() { 208 vec2 dSTdx = dFdx( vBumpMapUv ); 209 vec2 dSTdy = dFdy( vBumpMapUv ); 210 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 211 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 212 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 213 return vec2( dBx, dBy ); 214 } 215 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 216 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 217 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 218 vec3 vN = surf_norm; 219 vec3 R1 = cross( vSigmaY, vN ); 220 vec3 R2 = cross( vN, vSigmaX ); 221 float fDet = dot( vSigmaX, R1 ) * faceDirection; 222 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 223 return normalize( abs( fDet ) * surf_norm - vGrad ); 224 } 225#endif`,XS=`#if NUM_CLIPPING_PLANES > 0 226 vec4 plane; 227 #pragma unroll_loop_start 228 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 229 plane = clippingPlanes[ i ]; 230 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 231 } 232 #pragma unroll_loop_end 233 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 234 bool clipped = true; 235 #pragma unroll_loop_start 236 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 237 plane = clippingPlanes[ i ]; 238 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 239 } 240 #pragma unroll_loop_end 241 if ( clipped ) discard; 242 #endif 243#endif`,YS=`#if NUM_CLIPPING_PLANES > 0 244 varying vec3 vClipPosition; 245 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 246#endif`,jS=`#if NUM_CLIPPING_PLANES > 0 247 varying vec3 vClipPosition; 248#endif`,qS=`#if NUM_CLIPPING_PLANES > 0 249 vClipPosition = - mvPosition.xyz; 250#endif`,ZS=`#if defined( USE_COLOR_ALPHA ) 251 diffuseColor *= vColor; 252#elif defined( USE_COLOR ) 253 diffuseColor.rgb *= vColor; 254#endif`,JS=`#if defined( USE_COLOR_ALPHA ) 255 varying vec4 vColor; 256#elif defined( USE_COLOR ) 257 varying vec3 vColor; 258#endif`,KS=`#if defined( USE_COLOR_ALPHA ) 259 varying vec4 vColor; 260#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 261 varying vec3 vColor; 262#endif`,QS=`#if defined( USE_COLOR_ALPHA ) 263 vColor = vec4( 1.0 ); 264#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 265 vColor = vec3( 1.0 ); 266#endif 267#ifdef USE_COLOR 268 vColor *= color; 269#endif 270#ifdef USE_INSTANCING_COLOR 271 vColor.xyz *= instanceColor.xyz; 272#endif`,$S=`#define PI 3.141592653589793 273#define PI2 6.283185307179586 274#define PI_HALF 1.5707963267948966 275#define RECIPROCAL_PI 0.3183098861837907 276#define RECIPROCAL_PI2 0.15915494309189535 277#define EPSILON 1e-6 278#ifndef saturate 279#define saturate( a ) clamp( a, 0.0, 1.0 ) 280#endif 281#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 282float pow2( const in float x ) { return x*x; } 283vec3 pow2( const in vec3 x ) { return x*x; } 284float pow3( const in float x ) { return x*x*x; } 285float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 286float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 287float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 288highp float rand( const in vec2 uv ) { 289 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 290 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 291 return fract( sin( sn ) * c ); 292} 293#ifdef HIGH_PRECISION 294 float precisionSafeLength( vec3 v ) { return length( v ); } 295#else 296 float precisionSafeLength( vec3 v ) { 297 float maxComponent = max3( abs( v ) ); 298 return length( v / maxComponent ) * maxComponent; 299 } 300#endif 301struct IncidentLight { 302 vec3 color; 303 vec3 direction; 304 bool visible; 305}; 306struct ReflectedLight { 307 vec3 directDiffuse; 308 vec3 directSpecular; 309 vec3 indirectDiffuse; 310 vec3 indirectSpecular; 311}; 312#ifdef USE_ALPHAHASH 313 varying vec3 vPosition; 314#endif 315vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 316 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 317} 318vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 319 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 320} 321mat3 transposeMat3( const in mat3 m ) { 322 mat3 tmp; 323 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 324 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 325 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 326 return tmp; 327} 328float luminance( const in vec3 rgb ) { 329 const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); 330 return dot( weights, rgb ); 331} 332bool isPerspectiveMatrix( mat4 m ) { 333 return m[ 2 ][ 3 ] == - 1.0; 334} 335vec2 equirectUv( in vec3 dir ) { 336 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 337 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 338 return vec2( u, v ); 339}
340vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 341 return RECIPROCAL_PI * diffuseColor; 342} 343vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 344 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 345 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 346} 347float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 348 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 349 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 350} // validated`,eM=`#ifdef ENVMAP_TYPE_CUBE_UV 351 #define cubeUV_minMipLevel 4.0 352 #define cubeUV_minTileSize 16.0 353 float getFace( vec3 direction ) { 354 vec3 absDirection = abs( direction ); 355 float face = - 1.0; 356 if ( absDirection.x > absDirection.z ) { 357 if ( absDirection.x > absDirection.y ) 358 face = direction.x > 0.0 ? 0.0 : 3.0; 359 else 360 face = direction.y > 0.0 ? 1.0 : 4.0; 361 } else { 362 if ( absDirection.z > absDirection.y ) 363 face = direction.z > 0.0 ? 2.0 : 5.0; 364 else 365 face = direction.y > 0.0 ? 1.0 : 4.0; 366 } 367 return face; 368 } 369 vec2 getUV( vec3 direction, float face ) { 370 vec2 uv; 371 if ( face == 0.0 ) { 372 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 373 } else if ( face == 1.0 ) { 374 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 375 } else if ( face == 2.0 ) { 376 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 377 } else if ( face == 3.0 ) { 378 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 379 } else if ( face == 4.0 ) { 380 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 381 } else { 382 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 383 } 384 return 0.5 * ( uv + 1.0 ); 385 } 386 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 387 float face = getFace( direction ); 388 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 389 mipInt = max( mipInt, cubeUV_minMipLevel ); 390 float faceSize = exp2( mipInt ); 391 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 392 if ( face > 2.0 ) { 393 uv.y += faceSize; 394 face -= 3.0; 395 } 396 uv.x += face * faceSize; 397 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 398 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 399 uv.x *= CUBEUV_TEXEL_WIDTH; 400 uv.y *= CUBEUV_TEXEL_HEIGHT; 401 #ifdef texture2DGradEXT 402 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 403 #else 404 return texture2D( envMap, uv ).rgb; 405 #endif 406 } 407 #define cubeUV_r0 1.0 408 #define cubeUV_m0 - 2.0 409 #define cubeUV_r1 0.8 410 #define cubeUV_m1 - 1.0 411 #define cubeUV_r4 0.4 412 #define cubeUV_m4 2.0 413 #define cubeUV_r5 0.305 414 #define cubeUV_m5 3.0 415 #define cubeUV_r6 0.21 416 #define cubeUV_m6 4.0 417 float roughnessToMip( float roughness ) { 418 float mip = 0.0; 419 if ( roughness >= cubeUV_r1 ) { 420 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 421 } else if ( roughness >= cubeUV_r4 ) { 422 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 423 } else if ( roughness >= cubeUV_r5 ) { 424 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 425 } else if ( roughness >= cubeUV_r6 ) { 426 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 427 } else { 428 mip = - 2.0 * log2( 1.16 * roughness ); } 429 return mip; 430 } 431 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 432 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 433 float mipF = fract( mip ); 434 float mipInt = floor( mip ); 435 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 436 if ( mipF == 0.0 ) { 437 return vec4( color0, 1.0 ); 438 } else { 439 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 440 return vec4( mix( color0, color1, mipF ), 1.0 ); 441 } 442 } 443#endif`,tM=`vec3 transformedNormal = objectNormal; 444#ifdef USE_TANGENT 445 vec3 transformedTangent = objectTangent; 446#endif 447#ifdef USE_BATCHING 448 mat3 bm = mat3( batchingMatrix ); 449 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 450 transformedNormal = bm * transformedNormal; 451 #ifdef USE_TANGENT 452 transformedTangent = bm * transformedTangent; 453 #endif 454#endif 455#ifdef USE_INSTANCING 456 mat3 im = mat3( instanceMatrix ); 457 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 458 transformedNormal = im * transformedNormal; 459 #ifdef USE_TANGENT 460 transformedTangent = im * transformedTangent; 461 #endif 462#endif 463transformedNormal = normalMatrix * transformedNormal; 464#ifdef FLIP_SIDED 465 transformedNormal = - transformedNormal; 466#endif 467#ifdef USE_TANGENT 468 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 469 #ifdef FLIP_SIDED 470 transformedTangent = - transformedTangent; 471 #endif 472#endif`,nM=`#ifdef USE_DISPLACEMENTMAP 473 uniform sampler2D displacementMap; 474 uniform float displacementScale; 475 uniform float displacementBias; 476#endif`,iM=`#ifdef USE_DISPLACEMENTMAP 477 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
477placementBias ); 478#endif`,rM=`#ifdef USE_EMISSIVEMAP 479 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 480 totalEmissiveRadiance *= emissiveColor.rgb; 481#endif`,sM=`#ifdef USE_EMISSIVEMAP 482 uniform sampler2D emissiveMap; 483#endif`,oM="gl_FragColor = linearToOutputTexel( gl_FragColor );",aM=` 484const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( 485 vec3( 0.8224621, 0.177538, 0.0 ), 486 vec3( 0.0331941, 0.9668058, 0.0 ), 487 vec3( 0.0170827, 0.0723974, 0.9105199 ) 488); 489const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( 490 vec3( 1.2249401, - 0.2249404, 0.0 ), 491 vec3( - 0.0420569, 1.0420571, 0.0 ), 492 vec3( - 0.0196376, - 0.0786361, 1.0982735 ) 493); 494vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { 495 return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); 496} 497vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { 498 return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); 499} 500vec4 LinearTransferOETF( in vec4 value ) { 501 return value; 502} 503vec4 sRGBTransferOETF( in vec4 value ) { 504 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 505} 506vec4 LinearToLinear( in vec4 value ) { 507 return value; 508} 509vec4 LinearTosRGB( in vec4 value ) { 510 return sRGBTransferOETF( value ); 511}`,lM=`#ifdef USE_ENVMAP 512 #ifdef ENV_WORLDPOS 513 vec3 cameraToFrag; 514 if ( isOrthographic ) { 515 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 516 } else { 517 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 518 } 519 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 520 #ifdef ENVMAP_MODE_REFLECTION 521 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 522 #else 523 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 524 #endif 525 #else 526 vec3 reflectVec = vReflect; 527 #endif 528 #ifdef ENVMAP_TYPE_CUBE 529 vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 530 #else 531 vec4 envColor = vec4( 0.0 ); 532 #endif 533 #ifdef ENVMAP_BLENDING_MULTIPLY 534 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 535 #elif defined( ENVMAP_BLENDING_MIX ) 536 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 537 #elif defined( ENVMAP_BLENDING_ADD ) 538 outgoingLight += envColor.xyz * specularStrength * reflectivity; 539 #endif 540#endif`,cM=`#ifdef USE_ENVMAP 541 uniform float envMapIntensity; 542 uniform float flipEnvMap; 543 #ifdef ENVMAP_TYPE_CUBE 544 uniform samplerCube envMap; 545 #else 546 uniform sampler2D envMap; 547 #endif 548 549#endif`,uM=`#ifdef USE_ENVMAP 550 uniform float reflectivity; 551 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 552 #define ENV_WORLDPOS 553 #endif 554 #ifdef ENV_WORLDPOS 555 varying vec3 vWorldPosition; 556 uniform float refractionRatio; 557 #else 558 varying vec3 vReflect; 559 #endif 560#endif`,hM=`#ifdef USE_ENVMAP 561 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 562 #define ENV_WORLDPOS 563 #endif 564 #ifdef ENV_WORLDPOS 565 566 varying vec3 vWorldPosition; 567 #else 568 varying vec3 vReflect; 569 uniform float refractionRatio; 570 #endif 571#endif`,fM=`#ifdef USE_ENVMAP 572 #ifdef ENV_WORLDPOS 573 vWorldPosition = worldPosition.xyz; 574 #else 575 vec3 cameraToVertex; 576 if ( isOrthographic ) { 577 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 578 } else {
579 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 580 } 581 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 582 #ifdef ENVMAP_MODE_REFLECTION 583 vReflect = reflect( cameraToVertex, worldNormal ); 584 #else 585 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 586 #endif 587 #endif 588#endif`,dM=`#ifdef USE_FOG 589 vFogDepth = - mvPosition.z; 590#endif`,pM=`#ifdef USE_FOG 591 varying float vFogDepth; 592#endif`,mM=`#ifdef USE_FOG 593 #ifdef FOG_EXP2 594 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 595 #else 596 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 597 #endif 598 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 599#endif`,gM=`#ifdef USE_FOG 600 uniform vec3 fogColor; 601 varying float vFogDepth; 602 #ifdef FOG_EXP2 603 uniform float fogDensity; 604 #else 605 uniform float fogNear; 606 uniform float fogFar; 607 #endif 608#endif`,vM=`#ifdef USE_GRADIENTMAP 609 uniform sampler2D gradientMap; 610#endif 611vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 612 float dotNL = dot( normal, lightDirection ); 613 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 614 #ifdef USE_GRADIENTMAP 615 return vec3( texture2D( gradientMap, coord ).r ); 616 #else 617 vec2 fw = fwidth( coord ) * 0.5; 618 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 619 #endif 620}`,_M=`#ifdef USE_LIGHTMAP 621 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 622 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 623 reflectedLight.indirectDiffuse += lightMapIrradiance; 624#endif`,yM=`#ifdef USE_LIGHTMAP 625 uniform sampler2D lightMap; 626 uniform float lightMapIntensity; 627#endif`,xM=`LambertMaterial material; 628material.diffuseColor = diffuseColor.rgb; 629material.specularStrength = specularStrength;`,SM=`varying vec3 vViewPosition; 630struct LambertMaterial { 631 vec3 diffuseColor; 632 float specularStrength; 633}; 634void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 635 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 636 vec3 irradiance = dotNL * directLight.color; 637 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 638} 639void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 640 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 641} 642#define RE_Direct RE_Direct_Lambert 643#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,MM=`uniform bool receiveShadow; 644uniform vec3 ambientLightColor; 645#if defined( USE_LIGHT_PROBES ) 646 uniform vec3 lightProbe[ 9 ]; 647#endif 648vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 649 float x = normal.x, y = normal.y, z = normal.z; 650 vec3 result = shCoefficients[ 0 ] * 0.886227; 651 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 652 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 653 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 654 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 655 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 656 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 657 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 658 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 659 return result; 660} 661vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 662 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 663 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 664 return irradiance; 665} 666vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 667 vec3 irradiance = ambientLightColor; 668 return irradiance; 669} 670float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 671 #if defined ( LEGACY_LIGHTS ) 672 if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { 673 return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); 674 } 675 return 1.0; 676 #else 677 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 678 if ( cutoffDistance > 0.0 ) { 679 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 680 } 681 return distanceFalloff; 682 #endif 683} 684float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 685 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 686} 687#if NUM_DIR_LIGHTS > 0 688 struct DirectionalLight { 689 vec3 direction; 690 vec3 color; 691 }; 692 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 693 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 694 light.color = directionalLight.color; 695 light.direction = directionalLight.direction; 696 light.visible = true; 697 } 698#endif 699#if NUM_POINT_LIGHTS > 0 700 struct PointLight { 701 vec3 position; 702 vec3 color; 703 float distance; 704 float decay; 705 }; 706 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 707 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 708 vec3 lVector = pointLight.position - geometryPosition; 709 light.direction = normalize( lVector ); 710 float lightDistance = length( lVector ); 711 light.color = pointLight.color; 712 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 713 light.visible = ( light.color != vec3( 0.0 ) ); 714 } 715#endif
716#if NUM_SPOT_LIGHTS > 0 717 struct SpotLight { 718 vec3 position; 719 vec3 direction; 720 vec3 color; 721 float distance; 722 float decay; 723 float coneCos; 724 float penumbraCos; 725 }; 726 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 727 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 728 vec3 lVector = spotLight.position - geometryPosition; 729 light.direction = normalize( lVector ); 730 float angleCos = dot( light.direction, spotLight.direction ); 731 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 732 if ( spotAttenuation > 0.0 ) { 733 float lightDistance = length( lVector ); 734 light.color = spotLight.color * spotAttenuation; 735 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 736 light.visible = ( light.color != vec3( 0.0 ) ); 737 } else { 738 light.color = vec3( 0.0 ); 739 light.visible = false; 740 } 741 } 742#endif 743#if NUM_RECT_AREA_LIGHTS > 0 744 struct RectAreaLight { 745 vec3 color; 746 vec3 position; 747 vec3 halfWidth; 748 vec3 halfHeight; 749 }; 750 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 751 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 752#endif 753#if NUM_HEMI_LIGHTS > 0 754 struct HemisphereLight { 755 vec3 direction; 756 vec3 skyColor; 757 vec3 groundColor; 758 }; 759 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 760 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 761 float dotNL = dot( normal, hemiLight.direction ); 762 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 763 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 764 return irradiance; 765 } 766#endif`,EM=`#ifdef USE_ENVMAP 767 vec3 getIBLIrradiance( const in vec3 normal ) { 768 #ifdef ENVMAP_TYPE_CUBE_UV 769 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 770 vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); 771 return PI * envMapColor.rgb * envMapIntensity; 772 #else 773 return vec3( 0.0 ); 774 #endif 775 } 776 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 777 #ifdef ENVMAP_TYPE_CUBE_UV 778 vec3 reflectVec = reflect( - viewDir, normal ); 779 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 780 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 781 vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); 782 return envMapColor.rgb * envMapIntensity; 783 #else 784 return vec3( 0.0 ); 785 #endif 786 } 787 #ifdef USE_ANISOTROPY 788 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 789 #ifdef ENVMAP_TYPE_CUBE_UV 790 vec3 bentNormal = cross( bitangent, viewDir ); 791 bentNormal = normalize( cross( bentNormal, bitangent ) ); 792 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 793 return getIBLRadiance( viewDir, bentNormal, roughness ); 794 #else 795 return vec3( 0.0 ); 796 #endif 797 } 798 #endif 799#endif`,wM=`ToonMaterial material; 800material.diffuseColor = diffuseColor.rgb;`,bM=`varying vec3 vViewPosition; 801struct ToonMaterial { 802 vec3 diffuseColor; 803}; 804void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 805 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 806 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 807} 808void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 809 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 810} 811#define RE_Direct RE_Direct_Toon 812#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,TM=`BlinnPhongMaterial material; 813material.diffuseColor = diffuseColor.rgb; 814material.specularColor = specular; 815material.specularShininess = shininess; 816material.specularStrength = specularStrength;`,AM=`varying vec3 vViewPosition; 817struct BlinnPhongMaterial { 818 vec3 diffuseColor; 819 vec3 specularColor; 820 float specularShininess; 821 float specularStrength; 822}; 823void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
824 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 825 vec3 irradiance = dotNL * directLight.color; 826 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 827 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 828} 829void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 830 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 831} 832#define RE_Direct RE_Direct_BlinnPhong 833#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,CM=`PhysicalMaterial material; 834material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 835vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 836float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 837material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 838material.roughness = min( material.roughness, 1.0 ); 839#ifdef IOR 840 material.ior = ior; 841 #ifdef USE_SPECULAR 842 float specularIntensityFactor = specularIntensity; 843 vec3 specularColorFactor = specularColor; 844 #ifdef USE_SPECULAR_COLORMAP 845 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 846 #endif 847 #ifdef USE_SPECULAR_INTENSITYMAP 848 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 849 #endif 850 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 851 #else 852 float specularIntensityFactor = 1.0; 853 vec3 specularColorFactor = vec3( 1.0 ); 854 material.specularF90 = 1.0; 855 #endif 856 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 857#else 858 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 859 material.specularF90 = 1.0; 860#endif 861#ifdef USE_CLEARCOAT 862 material.clearcoat = clearcoat; 863 material.clearcoatRoughness = clearcoatRoughness; 864 material.clearcoatF0 = vec3( 0.04 ); 865 material.clearcoatF90 = 1.0; 866 #ifdef USE_CLEARCOATMAP 867 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 868 #endif 869 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 870 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 871 #endif 872 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 873 material.clearcoatRoughness += geometryRoughness; 874 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 875#endif 876#ifdef USE_IRIDESCENCE 877 material.iridescence = iridescence; 878 material.iridescenceIOR = iridescenceIOR; 879 #ifdef USE_IRIDESCENCEMAP 880 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 881 #endif 882 #ifdef USE_IRIDESCENCE_THICKNESSMAP 883 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 884 #else 885 material.iridescenceThickness = iridescenceThicknessMaximum; 886 #endif 887#endif 888#ifdef USE_SHEEN 889 material.sheenColor = sheenColor; 890 #ifdef USE_SHEEN_COLORMAP 891 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 892 #endif 893 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 894 #ifdef USE_SHEEN_ROUGHNESSMAP 895 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 896 #endif 897#endif 898#ifdef USE_ANISOTROPY 899 #ifdef USE_ANISOTROPYMAP 900 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 901 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 902 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 903 #else 904 vec2 anisotropyV = anisotropyVector; 905 #endif 906 material.anisotropy = length( anisotropyV ); 907 if( material.anisotropy == 0.0 ) { 908 anisotropyV = vec2( 1.0, 0.0 ); 909 } else { 910 anisotropyV /= material.anisotropy; 911 material.anisotropy = saturate( material.anisotropy ); 912 } 913 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
914 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 915 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 916#endif`,RM=`struct PhysicalMaterial { 917 vec3 diffuseColor; 918 float roughness; 919 vec3 specularColor; 920 float specularF90
vendor: 14,563 bytes, lines 920-1216
920; 921 #ifdef USE_CLEARCOAT 922 float clearcoat; 923 float clearcoatRoughness; 924 vec3 clearcoatF0; 925 float clearcoatF90; 926 #endif 927 #ifdef USE_IRIDESCENCE 928 float iridescence; 929 float iridescenceIOR; 930 float iridescenceThickness; 931 vec3 iridescenceFresnel; 932 vec3 iridescenceF0; 933 #endif 934 #ifdef USE_SHEEN 935 vec3 sheenColor; 936 float sheenRoughness; 937 #endif 938 #ifdef IOR 939 float ior; 940 #endif 941 #ifdef USE_TRANSMISSION 942 float transmission; 943 float transmissionAlpha; 944 float thickness; 945 float attenuationDistance; 946 vec3 attenuationColor; 947 #endif 948 #ifdef USE_ANISOTROPY 949 float anisotropy; 950 float alphaT; 951 vec3 anisotropyT; 952 vec3 anisotropyB; 953 #endif 954}; 955vec3 clearcoatSpecularDirect = vec3( 0.0 ); 956vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 957vec3 sheenSpecularDirect = vec3( 0.0 ); 958vec3 sheenSpecularIndirect = vec3(0.0 ); 959vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 960 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 961 float x2 = x * x; 962 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 963 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 964} 965float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 966 float a2 = pow2( alpha ); 967 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 968 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 969 return 0.5 / max( gv + gl, EPSILON ); 970} 971float D_GGX( const in float alpha, const in float dotNH ) { 972 float a2 = pow2( alpha ); 973 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 974 return RECIPROCAL_PI * a2 / pow2( denom ); 975} 976#ifdef USE_ANISOTROPY 977 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 978 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 979 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 980 float v = 0.5 / ( gv + gl ); 981 return saturate(v); 982 } 983 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 984 float a2 = alphaT * alphaB; 985 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 986 highp float v2 = dot( v, v ); 987 float w2 = a2 / v2; 988 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 989 } 990#endif 991#ifdef USE_CLEARCOAT 992 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 993 vec3 f0 = material.clearcoatF0; 994 float f90 = material.clearcoatF90; 995 float roughness = material.clearcoatRoughness; 996 float alpha = pow2( roughness ); 997 vec3 halfDir = normalize( lightDir + viewDir ); 998 float dotNL = saturate( dot( normal, lightDir ) ); 999 float dotNV = saturate( dot( normal, viewDir ) ); 1000 float dotNH = saturate( dot( normal, halfDir ) ); 1001 float dotVH = saturate( dot( viewDir, halfDir ) ); 1002 vec3 F = F_Schlick( f0, f90, dotVH ); 1003 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1004 float D = D_GGX( alpha, dotNH ); 1005 return F * ( V * D ); 1006 } 1007#endif 1008vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1009 vec3 f0 = material.specularColor; 1010 float f90 = material.specularF90; 1011 float roughness = material.roughness; 1012 float alpha = pow2( roughness ); 1013 vec3 halfDir = normalize( lightDir + viewDir ); 1014 float dotNL = saturate( dot( normal, lightDir ) ); 1015 float dotNV = saturate( dot( normal, viewDir ) ); 1016 float dotNH = saturate( dot( normal, halfDir ) ); 1017 float dotVH = saturate( dot( viewDir, halfDir ) ); 1018 vec3 F = F_Schlick( f0, f90, dotVH ); 1019 #ifdef USE_IRIDESCENCE 1020 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1021 #endif 1022 #ifdef USE_ANISOTROPY 1023 float dotTL = dot( material.anisotropyT, lightDir ); 1024 float dotTV = dot( material.anisotropyT, viewDir ); 1025 float dotTH = dot( material.anisotropyT, halfDir ); 1026 float dotBL = dot( material.anisotropyB, lightDir ); 1027 float dotBV = dot( material.anisotropyB, viewDir ); 1028 float dotBH = dot( material.anisotropyB, halfDir ); 1029 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1030 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1031 #else 1032 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1033 float D = D_GGX( alpha, dotNH ); 1034 #endif 1035 return F * ( V * D ); 1036} 1037vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1038 const float LUT_SIZE = 64.0; 1039 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1040 const float LUT_BIAS = 0.5 / LUT_SIZE; 1041 float dotNV = saturate( dot( N, V ) ); 1042 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1043 uv = uv * LUT_SCALE + LUT_BIAS; 1044 return uv; 1045} 1046float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1047 float l = length( f ); 1048 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1049} 1050vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1051 float x = dot( v1, v2 ); 1052 float y = abs( x ); 1053 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1054 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1055 float v = a / b; 1056 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1057 return cross( v1, v2 ) * theta_sintheta; 1058} 1059vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1060 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1061 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1062 vec3 lightNormal = cross( v1, v2 ); 1063 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1064 vec3 T1, T2; 1065 T1 = normalize( V - N * dot( V, N ) ); 1066 T2 = - cross( N, T1 ); 1067 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1068 vec3 coords[ 4 ]; 1069 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1070 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1071 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1072 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1073 coords[ 0 ] = normalize( coords[ 0 ] ); 1074 coords[ 1 ] = normalize( coords[ 1 ] ); 1075 coords[ 2 ] = normalize( coords[ 2 ] ); 1076 coords[ 3 ] = normalize( coords[ 3 ] ); 1077 vec3 vectorFormFactor = vec3( 0.0 ); 1078 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1079 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1080 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1081 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1082 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1083 return vec3( result ); 1084} 1085#if defined( USE_SHEEN ) 1086float D_Charlie( float roughness, float dotNH ) { 1087 float alpha = pow2( roughness ); 1088 float invAlpha = 1.0 / alpha; 1089 float cos2h = dotNH * dotNH; 1090 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1091 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1092} 1093float V_Neubelt( float dotNV, float dotNL ) { 1094 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1095} 1096vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1097 vec3 halfDir = normalize( lightDir + viewDir ); 1098 float dotNL = saturate( dot( normal, lightDir ) ); 1099 float dotNV = saturate( dot( normal, viewDir ) ); 1100 float dotNH = saturate( dot( normal, halfDir ) ); 1101 float D = D_Charlie( sheenRoughness, dotNH ); 1102 float V = V_Neubelt( dotNV, dotNL ); 1103 return sheenColor * ( D * V ); 1104} 1105#endif 1106float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1107 float dotNV = saturate( dot( normal, viewDir ) ); 1108 float r2 = roughness * roughness; 1109 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1110 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1111 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1112 return saturate( DG * RECIPROCAL_PI ); 1113} 1114vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1115 float dotNV = saturate( dot( normal, viewDir ) ); 1116 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1117 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1118 vec4 r = roughness * c0 + c1; 1119 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1120 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1121 return fab; 1122} 1123vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1124 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1125 return specularColor * fab.x + specularF90 * fab.y; 1126} 1127#ifdef USE_IRIDESCENCE 1128void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1129#else 1130void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1131#endif 1132 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1133 #ifdef USE_IRIDESCENCE 1134 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1135 #else 1136 vec3 Fr = specularColor; 1137 #endif 1138 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1139 float Ess = fab.x + fab.y; 1140 float Ems = 1.0 - Ess; 1141 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1142 singleScatter += FssEss; 1143 multiScatter += Fms * Ems; 1144} 1145#if NUM_RECT_AREA_LIGHTS > 0 1146 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1147 vec3 normal = geometryNormal; 1148 vec3 viewDir = geometryViewDir; 1149 vec3 position = geometryPosition; 1150 vec3 lightPos = rectAreaLight.position; 1151 vec3 halfWidth = rectAreaLight.halfWidth; 1152 vec3 halfHeight = rectAreaLight.halfHeight; 1153 vec3 lightColor = rectAreaLight.color; 1154 float roughness = material.roughness; 1155 vec3 rectCoords[ 4 ]; 1156 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1157 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1158 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1159 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1160 vec4 t1 = texture2D( ltc_1, uv ); 1161 vec4 t2 = texture2D( ltc_2, uv ); 1162 mat3 mInv = mat3( 1163 vec3( t1.x, 0, t1.y ), 1164 vec3( 0, 1, 0 ), 1165 vec3( t1.z, 0, t1.w ) 1166 ); 1167 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1168 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1169 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1170 } 1171#endif 1172void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1173 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1174 vec3 irradiance = dotNL * directLight.color; 1175 #ifdef USE_CLEARCOAT 1176 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1177 vec3 ccIrradiance = dotNLcc * directLight.color; 1178 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1179 #endif 1180 #ifdef USE_SHEEN 1181 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1182 #endif 1183 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1184 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1185} 1186void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1187 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1188} 1189void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1190 #ifdef USE_CLEARCOAT 1191 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1192 #endif 1193 #ifdef USE_SHEEN 1194 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1195 #endif 1196 vec3 singleScattering = vec3( 0.0 ); 1197 vec3 multiScattering = vec3( 0.0 ); 1198 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1199 #ifdef USE_IRIDESCENCE 1200 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1201 #else 1202 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1203 #endif 1204 vec3 totalScattering = singleScattering + multiScattering; 1205 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1206 reflectedLight.indirectSpecular += radiance * singleScattering; 1207 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1208 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1209} 1210#define RE_Direct RE_Direct_Physical 1211#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1212#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1213#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1214float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1215 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1216}`,
1216PM=` 1217vec3 geometryPosition = - vViewPosition; 1218vec3 geometryNormal = normal; 1219vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1220vec3 geometryClearcoatNormal = vec3( 0.0 ); 1221#ifdef USE_CLEARCOAT 1222 geometryClearcoatNormal = clearcoatNormal; 1223#endif 1224#ifdef USE_IRIDESCENCE 1225 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1226 if ( material.iridescenceThickness == 0.0 ) { 1227 material.iridescence = 0.0; 1228 } else { 1229 material.iridescence = saturate( material.iridescence ); 1230 } 1231 if ( material.iridescence > 0.0 ) { 1232 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1233 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1234 } 1235#endif 1236IncidentLight directLight; 1237#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1238 PointLight pointLight; 1239 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1240 PointLightShadow pointLightShadow; 1241 #endif 1242 #pragma unroll_loop_start 1243 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1244 pointLight = pointLights[ i ]; 1245 getPointLightInfo( pointLight, geometryPosition, directLight ); 1246 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1247 pointLightShadow = pointLightShadows[ i ]; 1248 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1249 #endif 1250 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1251 } 1252 #pragma unroll_loop_end 1253#endif 1254#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1255 SpotLight spotLight; 1256 vec4 spotColor; 1257 vec3 spotLightCoord; 1258 bool inSpotLightMap; 1259 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1260 SpotLightShadow spotLightShadow; 1261 #endif 1262 #pragma unroll_loop_start 1263 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1264 spotLight = spotLights[ i ]; 1265 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1266 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1267 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1268 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1269 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1270 #else 1271 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1272 #endif 1273 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1274 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1275 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1276 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1277 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1278 #endif 1279 #undef SPOT_LIGHT_MAP_INDEX 1280 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1281 spotLightShadow = spotLightShadows[ i ]; 1282 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1283 #endif 1284 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1285 } 1286 #pragma unroll_loop_end 1287#endif 1288#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1289 DirectionalLight directionalLight; 1290 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1291 DirectionalLightShadow directionalLightShadow; 1292 #endif 1293 #pragma unroll_loop_start 1294 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1295 directionalLight = directionalLights[ i ]; 1296 getDirectionalLightInfo( directionalLight, directLight ); 1297 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1298 directionalLightShadow = directionalLightShadows[ i ]; 1299 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1300 #endif 1301 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1302 } 1303 #pragma unroll_loop_end 1304#endif 1305#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1306 RectAreaLight rectAreaLight; 1307 #pragma unroll_loop_start 1308 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1309 rectAreaLight = rectAreaLights[ i ]; 1310 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1311 } 1312 #pragma unroll_loop_end 1313#endif 1314#if defined( RE_IndirectDiffuse ) 1315 vec3 iblIrradiance = vec3( 0.0 ); 1316 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1317 #if defined( USE_LIGHT_PROBES ) 1318 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1319 #endif 1320 #if ( NUM_HEMI_LIGHTS > 0 ) 1321 #pragma unroll_loop_start 1322 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1323 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1324 } 1325 #pragma unroll_loop_end 1326 #endif 1327#endif 1328#if defined( RE_IndirectSpecular ) 1329 vec3 radiance = vec3( 0.0 ); 1330 vec3 clearcoatRadiance = vec3( 0.0 ); 1331#endif`,LM=`#if defined( RE_IndirectDiffuse ) 1332 #ifdef USE_LIGHTMAP 1333 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1334 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1335 irradiance += lightMapIrradiance; 1336 #endif 1337 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1338 iblIrradiance += getIBLIrradiance( geometryNormal ); 1339 #endif 1340#endif 1341#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1342 #ifdef USE_ANISOTROPY 1343 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1344 #else 1345 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1346 #endif 1347 #ifdef USE_CLEARCOAT 1348 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1349 #endif 1350#endif`,IM=`#if defined( RE_IndirectDiffuse ) 1351 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1352#endif 1353#if defined( RE_IndirectSpecular ) 1354 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1355#endif`,UM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1356 gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1357#endif`,DM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1358 uniform float logDepthBufFC; 1359 varying float vFragDepth; 1360 varying float vIsPerspective; 1361#endif`,NM=`#ifdef USE_LOGDEPTHBUF 1362 #ifdef USE_LOGDEPTHBUF_EXT 1363 varying float vFragDepth; 1364 varying float vIsPerspective; 1365 #else 1366 uniform float logDepthBufFC; 1367 #endif 1368#endif`,FM=`#ifdef USE_LOGDEPTHBUF 1369 #ifdef USE_LOGDEPTHBUF_EXT 1370 vFragDepth = 1.0 + gl_Position.w; 1371 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1372 #else 1373 if ( isPerspectiveMatrix( projectionMatrix ) ) { 1374 gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; 1375 gl_Position.z *= gl_Position.w; 1376 } 1377 #endif 1378#endif`,OM=`#ifdef USE_MAP 1379 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1380 #ifdef DECODE_VIDEO_TEXTURE 1381 sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); 1382 1383 #endif 1384 diffuseColor *= sampledDiffuseColor; 1385#endif`,BM=`#ifdef USE_MAP 1386 uniform sampler2D map; 1387#endif`,kM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1388 #if defined( USE_POINTS_UV ) 1389 vec2 uv = vUv; 1390 #else 1391 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1392 #endif 1393#endif 1394#ifdef USE_MAP 1395 diffuseColor *= texture2D( map, uv ); 1396#endif 1397#ifdef USE_ALPHAMAP 1398 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1399#endif`,zM=`#if defined( USE_POINTS_UV ) 1400 varying vec2 vUv; 1401#else 1402 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1403 uniform mat3 uvTransform; 1404 #endif 1405#endif 1406#ifdef USE_MAP 1407 uniform sampler2D map; 1408#endif 1409#ifdef USE_ALPHAMAP 1410 uniform sampler2D alphaMap; 1411#endif`,GM=`float metalnessFactor = metalness; 1412#ifdef USE_METALNESSMAP 1413 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1414 metalnessFactor *= texelMetalness.b; 1415#endif`,HM=`#ifdef USE_METALNESSMAP 1416 uniform sampler2D metalnessMap; 1417#endif`,VM=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 1418 vColor *= morphTargetBaseInfluence; 1419 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1420 #if defined( USE_COLOR_ALPHA ) 1421 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1422 #elif defined( USE_COLOR ) 1423 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1424 #endif 1425 } 1426#endif`,WM=`#ifdef USE_MORPHNORMALS 1427 objectNormal *= morphTargetBaseInfluence; 1428 #ifdef MORPHTARGETS_TEXTURE 1429 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1430 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1431 } 1432 #else 1433 objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; 1434 objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; 1435 objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; 1436 objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; 1437 #endif 1438#endif`,XM=`#ifdef USE_MORPHTARGETS 1439 uniform float morphTargetBaseInfluence; 1440 #ifdef MORPHTARGETS_TEXTURE 1441 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1442 uniform sampler2DArray morphTargetsTexture; 1443 uniform ivec2 morphTargetsTextureSize; 1444 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1445 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1446 int y = texelIndex / morphTargetsTextureSize.x; 1447 int x = texelIndex - y * morphTargetsTextureSize.x; 1448 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1449 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1450 } 1451 #else 1452 #ifndef USE_MORPHNORMALS 1453 uniform float morphTargetInfluences[ 8 ]; 1454 #else 1455 uniform float morphTargetInfluences[ 4 ]; 1456 #endif 1457 #endif 1458#endif`,YM=`#ifdef USE_MORPHTARGETS 1459 transformed *= morphTargetBaseInfluence; 1460 #ifdef MORPHTARGETS_TEXTURE 1461 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1462 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1463 } 1464 #else 1465 transformed += morphTarget0 * morphTargetInfluences[ 0 ]; 1466 transformed += morphTarget1 * morphTargetInfluences[ 1 ]; 1467 transformed += morphTarget2 * morphTargetInfluences[ 2 ]; 1468 transformed += morphTarget3 * morphTargetInfluences[ 3 ]; 1469 #ifndef USE_MORPHNORMALS 1470 transformed += morphTarget4 * morphTargetInfluences[ 4 ]; 1471 transformed += morphTarget5 * morphTargetInfluences[ 5 ]; 1472 transformed += morphTarget6 * morphTargetInfluences[ 6 ]; 1473 transformed += morphTarget7 * morphTargetInfluences[ 7 ]; 1474 #endif 1475 #endif 1476#endif`,jM=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1477#ifdef FLAT_SHADED 1478 vec3 fdx = dFdx( vViewPosition ); 1479 vec3 fdy = dFdy( vViewPosition ); 1480 vec3 normal = normalize( cross( fdx, fdy ) ); 1481#else 1482 vec3 normal = normalize( vNormal ); 1483 #ifdef DOUBLE_SIDED 1484 normal *= faceDirection; 1485 #endif 1486#endif 1487#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1488 #ifdef USE_TANGENT 1489 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1490 #else 1491 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1492 #if defined( USE_NORMALMAP ) 1493 vNormalMapUv 1494 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1495 vClearcoatNormalMapUv 1496 #else 1497 vUv 1498 #endif 1499 ); 1500 #endif 1501 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1502 tbn[0] *= faceDirection; 1503 tbn[1] *= faceDirection; 1504 #endif 1505#endif 1506#ifdef USE_CLEARCOAT_NORMALMAP 1507 #ifdef USE_TANGENT 1508 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1509 #else 1510 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1511 #endif 1512 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1513 tbn2[0] *= faceDirection; 1514 tbn2[1] *= faceDirection; 1515 #endif 1516#endif 1517vec3 nonPerturbedNormal = normal;`,qM=`#ifdef USE_NORMALMAP_OBJECTSPACE 1518 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1519 #ifdef FLIP_SIDED 1520 normal = - normal; 1521 #endif 1522 #ifdef DOUBLE_SIDED 1523 normal = normal * faceDirection; 1524 #endif 1525 normal = normalize( normalMatrix * normal ); 1526#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1527 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1528 mapN.xy *= normalScale; 1529 normal = normalize( tbn * mapN ); 1530#elif defined( USE_BUMPMAP )
1531 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1532#endif`,ZM=`#ifndef FLAT_SHADED 1533 varying vec3 vNormal; 1534 #ifdef USE_TANGENT 1535 varying vec3 vTangent; 1536 varying vec3 vBitangent; 1537 #endif 1538#endif`,JM=`#ifndef FLAT_SHADED 1539 varying vec3 vNormal; 1540 #ifdef USE_TANGENT 1541 varying vec3 vTangent; 1542 varying vec3 vBitangent; 1543 #endif 1544#endif`,KM=`#ifndef FLAT_SHADED 1545 vNormal = normalize( transformedNormal ); 1546 #ifdef USE_TANGENT 1547 vTangent = normalize( transformedTangent ); 1548 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1549 #endif 1550#endif`,QM=`#ifdef USE_NORMALMAP 1551 uniform sampler2D normalMap; 1552 uniform vec2 normalScale; 1553#endif 1554#ifdef USE_NORMALMAP_OBJECTSPACE 1555 uniform mat3 normalMatrix; 1556#endif 1557#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1558 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1559 vec3 q0 = dFdx( eye_pos.xyz ); 1560 vec3 q1 = dFdy( eye_pos.xyz ); 1561 vec2 st0 = dFdx( uv.st ); 1562 vec2 st1 = dFdy( uv.st ); 1563 vec3 N = surf_norm; 1564 vec3 q1perp = cross( q1, N ); 1565 vec3 q0perp = cross( N, q0 ); 1566 vec3 T = q1perp * st0.x + q0perp * st1.x; 1567 vec3 B = q1perp * st0.y + q0perp * st1.y; 1568 float det = max( dot( T, T ), dot( B, B ) ); 1569 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1570 return mat3( T * scale, B * scale, N ); 1571 } 1572#endif`,$M=`#ifdef USE_CLEARCOAT 1573 vec3 clearcoatNormal = nonPerturbedNormal; 1574#endif`,eE=`#ifdef USE_CLEARCOAT_NORMALMAP 1575 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1576 clearcoatMapN.xy *= clearcoatNormalScale; 1577 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1578#endif`,tE=`#ifdef USE_CLEARCOATMAP 1579 uniform sampler2D clearcoatMap; 1580#endif 1581#ifdef USE_CLEARCOAT_NORMALMAP 1582 uniform sampler2D clearcoatNormalMap; 1583 uniform vec2 clearcoatNormalScale; 1584#endif 1585#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1586 uniform sampler2D clearcoatRoughnessMap; 1587#endif`,nE=`#ifdef USE_IRIDESCENCEMAP 1588 uniform sampler2D iridescenceMap; 1589#endif 1590#ifdef USE_IRIDESCENCE_THICKNESSMAP 1591 uniform sampler2D iridescenceThicknessMap; 1592#endif`,iE=`#ifdef OPAQUE 1593diffuseColor.a = 1.0; 1594#endif 1595#ifdef USE_TRANSMISSION 1596diffuseColor.a *= material.transmissionAlpha; 1597#endif 1598gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,rE=`vec3 packNormalToRGB( const in vec3 normal ) { 1599 return normalize( normal ) * 0.5 + 0.5; 1600} 1601vec3 unpackRGBToNormal( const in vec3 rgb ) { 1602 return 2.0 * rgb.xyz - 1.0; 1603} 1604const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; 1605const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); 1606const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); 1607const float ShiftRight8 = 1. / 256.; 1608vec4 packDepthToRGBA( const in float v ) { 1609 vec4 r = vec4( fract( v * PackFactors ), v ); 1610 r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; 1611} 1612float unpackRGBAToDepth( const in vec4 v ) { 1613 return dot( v, UnpackFactors ); 1614} 1615vec2 packDepthToRG( in highp float v ) { 1616 return packDepthToRGBA( v ).yx; 1617} 1618float unpackRGToDepth( const in highp vec2 v ) { 1619 return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); 1620} 1621vec4 pack2HalfToRGBA( vec2 v ) { 1622 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1623 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1624} 1625vec2 unpackRGBATo2Half( vec4 v ) { 1626 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1627} 1628float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1629 return ( viewZ + near ) / ( near - far ); 1630} 1631float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1632 return depth * ( near - far ) - near; 1633} 1634float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1635 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1636} 1637float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1638 return ( near * far ) / ( ( far - near ) * depth - far ); 1639}`,sE=`#ifdef PREMULTIPLIED_ALPHA 1640 gl_FragColor.rgb *= gl_FragColor.a; 1641#endif`,oE=`vec4 mvPosition = vec4( transformed, 1.0 ); 1642#ifdef USE_BATCHING 1643 mvPosition = batchingMatrix * mvPosition; 1644#endif 1645#ifdef USE_INSTANCING 1646 mvPosition = instanceMatrix * mvPosition; 1647#endif 1648mvPosition = modelViewMatrix * mvPosition; 1649gl_Position = projectionMatrix * mvPosition;`,aE=`#ifdef DITHERING 1650 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1651#endif`,lE=`#ifdef DITHERING 1652 vec3 dithering( vec3 color ) { 1653 float grid_position = rand( gl_FragCoord.xy ); 1654 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1655 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1656 return color + dither_shift_RGB; 1657 } 1658#endif`,cE=`float roughnessFactor = roughness; 1659#ifdef USE_ROUGHNESSMAP 1660 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1661 roughnessFactor *= texelRoughness.g; 1662#endif`,uE=`#ifdef USE_ROUGHNESSMAP 1663 uniform sampler2D roughnessMap;
1664#endif`,hE=`#if NUM_SPOT_LIGHT_COORDS > 0 1665 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1666#endif 1667#if NUM_SPOT_LIGHT_MAPS > 0 1668 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1669#endif 1670#ifdef USE_SHADOWMAP 1671 #if NUM_DIR_LIGHT_SHADOWS > 0 1672 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1673 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1674 struct DirectionalLightShadow { 1675 float shadowBias; 1676 float shadowNormalBias; 1677 float shadowRadius; 1678 vec2 shadowMapSize; 1679 }; 1680 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1681 #endif 1682 #if NUM_SPOT_LIGHT_SHADOWS > 0 1683 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1684 struct SpotLightShadow { 1685 float shadowBias; 1686 float shadowNormalBias; 1687 float shadowRadius; 1688 vec2 shadowMapSize; 1689 }; 1690 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1691 #endif 1692 #if NUM_POINT_LIGHT_SHADOWS > 0 1693 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1694 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1695 struct PointLightShadow { 1696 float shadowBias; 1697 float shadowNormalBias; 1698 float shadowRadius; 1699 vec2 shadowMapSize; 1700 float shadowCameraNear; 1701 float shadowCameraFar; 1702 }; 1703 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1704 #endif 1705 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1706 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1707 } 1708 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1709 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1710 } 1711 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1712 float occlusion = 1.0; 1713 vec2 distribution = texture2DDistribution( shadow, uv ); 1714 float hard_shadow = step( compare , distribution.x ); 1715 if (hard_shadow != 1.0 ) { 1716 float distance = compare - distribution.x ; 1717 float variance = max( 0.00000, distribution.y * distribution.y ); 1718 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1719 } 1720 return occlusion; 1721 } 1722 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1723 float shadow = 1.0; 1724 shadowCoord.xyz /= shadowCoord.w; 1725 shadowCoord.z += shadowBias; 1726 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1727 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1728 if ( frustumTest ) { 1729 #if defined( SHADOWMAP_TYPE_PCF ) 1730 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1731 float dx0 = - texelSize.x * shadowRadius; 1732 float dy0 = - texelSize.y * shadowRadius; 1733 float dx1 = + texelSize.x * shadowRadius; 1734 float dy1 = + texelSize.y * shadowRadius; 1735 float dx2 = dx0 / 2.0; 1736 float dy2 = dy0 / 2.0; 1737 float dx3 = dx1 / 2.0; 1738 float dy3 = dy1 / 2.0; 1739 shadow = ( 1740 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1741 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1742 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1743 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1744 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1745 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1746 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1747 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1748 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1749 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1750 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1751 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1752 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1753 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1754 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1755 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1756 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1757 ) * ( 1.0 / 17.0 ); 1758 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1759 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1760 float dx = texelSize.x; 1761 float dy = texelSize.y; 1762 vec2 uv = shadowCoord.xy;
1763 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1764 uv -= f * texelSize; 1765 shadow = ( 1766 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1767 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1768 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1769 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1770 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1771 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1772 f.x ) + 1773 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1774 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1775 f.x ) + 1776 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1777 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1778 f.y ) + 1779 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1780 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1781 f.y ) + 1782 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1783 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1784 f.x ), 1785 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1786 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1787 f.x ), 1788 f.y ) 1789 ) * ( 1.0 / 9.0 ); 1790 #elif defined( SHADOWMAP_TYPE_VSM ) 1791 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1792 #else 1793 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1794 #endif 1795 } 1796 return shadow; 1797 } 1798 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1799 vec3 absV = abs( v ); 1800 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1801 absV *= scaleToCube; 1802 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1803 vec2 planar = v.xy; 1804 float almostATexel = 1.5 * texelSizeY; 1805 float almostOne = 1.0 - almostATexel; 1806 if ( absV.z >= almostOne ) { 1807 if ( v.z > 0.0 ) 1808 planar.x = 4.0 - v.x; 1809 } else if ( absV.x >= almostOne ) { 1810 float signX = sign( v.x ); 1811 planar.x = v.z * signX + 2.0 * signX; 1812 } else if ( absV.y >= almostOne ) { 1813 float signY = sign( v.y ); 1814 planar.x = v.x + 2.0 * signY + 2.0; 1815 planar.y = v.z * signY - 2.0; 1816 } 1817 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1818 } 1819 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1820 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1821 vec3 lightToPosition = shadowCoord.xyz; 1822 float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1823 vec3 bd3D = normalize( lightToPosition ); 1824 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1825 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1826 return ( 1827 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1828 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1829 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1830 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1831 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1832 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1833 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1834 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1835 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1836 ) * ( 1.0 / 9.0 ); 1837 #else 1838 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1839 #endif 1840 } 1841#endif`,fE=`#if NUM_SPOT_LIGHT_COORDS > 0 1842 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1843 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1844#endif 1845#ifdef USE_SHADOWMAP 1846 #if NUM_DIR_LIGHT_SHADOWS > 0 1847 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1848 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1849 struct DirectionalLightShadow { 1850 float shadowBias; 1851 float shadowNormalBias; 1852 float shadowRadius; 1853 vec2 shadowMapSize; 1854 }; 1855 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1856 #endif
1857 #if NUM_SPOT_LIGHT_SHADOWS > 0 1858 struct SpotLightShadow { 1859 float shadowBias; 1860 float shadowNormalBias; 1861 float shadowRadius; 1862 vec2 shadowMapSize; 1863 }; 1864 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1865 #endif 1866 #if NUM_POINT_LIGHT_SHADOWS > 0 1867 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1868 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1869 struct PointLightShadow { 1870 float shadowBias; 1871 float shadowNormalBias; 1872 float shadowRadius; 1873 vec2 shadowMapSize; 1874 float shadowCameraNear; 1875 float shadowCameraFar; 1876 }; 1877 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1878 #endif 1879#endif`,dE=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1880 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1881 vec4 shadowWorldPosition; 1882#endif 1883#if defined( USE_SHADOWMAP ) 1884 #if NUM_DIR_LIGHT_SHADOWS > 0 1885 #pragma unroll_loop_start 1886 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1887 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1888 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1889 } 1890 #pragma unroll_loop_end 1891 #endif 1892 #if NUM_POINT_LIGHT_SHADOWS > 0 1893 #pragma unroll_loop_start 1894 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1895 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1896 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1897 } 1898 #pragma unroll_loop_end 1899 #endif 1900#endif 1901#if NUM_SPOT_LIGHT_COORDS > 0 1902 #pragma unroll_loop_start 1903 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1904 shadowWorldPosition = worldPosition; 1905 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1906 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1907 #endif 1908 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1909 } 1910 #pragma unroll_loop_end 1911#endif`,pE=`float getShadowMask() { 1912 float shadow = 1.0; 1913 #ifdef USE_SHADOWMAP 1914 #if NUM_DIR_LIGHT_SHADOWS > 0 1915 DirectionalLightShadow directionalLight; 1916 #pragma unroll_loop_start 1917 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1918 directionalLight = directionalLightShadows[ i ]; 1919 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1920 } 1921 #pragma unroll_loop_end 1922 #endif 1923 #if NUM_SPOT_LIGHT_SHADOWS > 0 1924 SpotLightShadow spotLight; 1925 #pragma unroll_loop_start 1926 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1927 spotLight = spotLightShadows[ i ]; 1928 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1929 } 1930 #pragma unroll_loop_end 1931 #endif 1932 #if NUM_POINT_LIGHT_SHADOWS > 0 1933 PointLightShadow pointLight; 1934 #pragma unroll_loop_start 1935 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1936 pointLight = pointLightShadows[ i ]; 1937 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1938 } 1939 #pragma unroll_loop_end 1940 #endif 1941 #endif 1942 return shadow; 1943}`,mE=`#ifdef USE_SKINNING 1944 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1945 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1946 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1947 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1948#endif`,gE=`#ifdef USE_SKINNING 1949 uniform mat4 bindMatrix; 1950 uniform mat4 bindMatrixInverse; 1951 uniform highp sampler2D boneTexture; 1952 mat4 getBoneMatrix( const in float i ) { 1953 int size = textureSize( boneTexture, 0 ).x; 1954 int j = int( i ) * 4; 1955 int x = j % size; 1956 int y = j / size; 1957 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 1958 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 1959 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 1960 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 1961 return mat4( v1, v2, v3, v4 ); 1962 } 1963#endif`,vE=`#ifdef USE_SKINNING 1964 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 1965 vec4 skinned = vec4( 0.0 ); 1966 skinned += boneMatX * skinVertex * skinWeight.x; 1967 skinned += boneMatY * skinVertex * skinWeight.y; 1968 skinned += boneMatZ * skinVertex * skinWeight.z; 1969 skinned += boneMatW * skinVertex * skinWeight.w; 1970 transformed = ( bindMatrixInverse * skinned ).xyz; 1971#endif`,_E=`#ifdef USE_SKINNING 1972 mat4 skinMatrix = mat4( 0.0 ); 1973 skinMatrix += skinWeight.x * boneMatX; 1974 skinMatrix += skinWeight.y * boneMatY; 1975 skinMatrix += skinWeight.z * boneMatZ; 1976 skinMatrix += skinWeight.w * boneMatW; 1977 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 1978 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 1979 #ifdef USE_TANGENT 1980 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 1981 #endif 1982#endif`,yE=`float specularStrength; 1983#ifdef USE_SPECULARMAP 1984 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 1985 specularStrength = texelSpecular.r; 1986#else 1987 specularStrength = 1.0; 1988#endif`,xE=`#ifdef USE_SPECULARMAP 1989 uniform sampler2D specularMap; 1990#endif`,SE=`#if defined( TONE_MAPPING ) 1991 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 1992#endif`,ME=`#ifndef saturate 1993#define saturate( a ) clamp( a, 0.0, 1.0 ) 1994#endif 1995uniform float toneMappingExposure; 1996vec3 LinearToneMapping( vec3 color ) { 1997 return saturate( toneMappingExposure * color ); 1998} 1999vec3 ReinhardToneMapping( vec3 color ) { 2000 color *= toneMappingExposure; 2001 return saturate( color / ( vec3( 1.0 ) + color ) ); 2002} 2003vec3 OptimizedCineonToneMapping( vec3 color ) { 2004 color *= toneMappingExposure; 2005 color = max( vec3( 0.0 ), color - 0.004 ); 2006 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2007} 2008vec3 RRTAndODTFit( vec3 v ) { 2009 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2010 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2011 return a / b; 2012} 2013vec3 ACESFilmicToneMapping( vec3 color ) { 2014 const mat3 ACESInputMat = mat3( 2015 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2016 vec3( 0.04823, 0.01566, 0.83777 ) 2017 ); 2018 const mat3 ACESOutputMat = mat3( 2019 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2020 vec3( -0.07367, -0.00605, 1.07602 ) 2021 ); 2022 color *= toneMappingExposure / 0.6; 2023 color = ACESInputMat * color; 2024 color = RRTAndODTFit( color ); 2025 color = ACESOutputMat * color; 2026 return saturate( color ); 2027} 2028const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2029 vec3( 1.6605, - 0.1246, - 0.0182 ), 2030 vec3( - 0.5876, 1.1329, - 0.1006 ), 2031 vec3( - 0.0728, - 0.0083, 1.1187 ) 2032); 2033const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2034 vec3( 0.6274, 0.0691, 0.0164 ), 2035 vec3( 0.3293, 0.9195, 0.0880 ), 2036 vec3( 0.0433, 0.0113, 0.8956 ) 2037); 2038vec3 agxDefaultContrastApprox( vec3 x ) { 2039 vec3 x2 = x * x; 2040 vec3 x4 = x2 * x2; 2041 return + 15.5 * x4 * x2 2042 - 40.14 * x4 * x 2043 + 31.96 * x4 2044 - 6.868 * x2 * x 2045 + 0.4298 * x2 2046 + 0.1191 * x 2047 - 0.00232; 2048} 2049vec3 AgXToneMapping( vec3 color ) { 2050 const mat3 AgXInsetMatrix = mat3( 2051 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2052 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2053 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2054 );
2055 const mat3 AgXOutsetMatrix = mat3( 2056 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2057 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2058 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2059 ); 2060 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2061 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2062 color *= toneMappingExposure; 2063 color = AgXInsetMatrix * color; 2064 color = max( color, 1e-10 ); color = log2( color ); 2065 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2066 color = clamp( color, 0.0, 1.0 ); 2067 color = agxDefaultContrastApprox( color ); 2068 color = AgXOutsetMatrix * color; 2069 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2070 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2071 return color; 2072} 2073vec3 CustomToneMapping( vec3 color ) { return color; }`,EE=`#ifdef USE_TRANSMISSION 2074 material.transmission = transmission; 2075 material.transmissionAlpha = 1.0; 2076 material.thickness = thickness; 2077 material.attenuationDistance = attenuationDistance; 2078 material.attenuationColor = attenuationColor; 2079 #ifdef USE_TRANSMISSIONMAP 2080 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2081 #endif 2082 #ifdef USE_THICKNESSMAP 2083 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2084 #endif 2085 vec3 pos = vWorldPosition; 2086 vec3 v = normalize( cameraPosition - pos ); 2087 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2088 vec4 transmitted = getIBLVolumeRefraction( 2089 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2090 pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, 2091 material.attenuationColor, material.attenuationDistance ); 2092 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2093 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2094#endif`,wE=`#ifdef USE_TRANSMISSION 2095 uniform float transmission; 2096 uniform float thickness; 2097 uniform float attenuationDistance; 2098 uniform vec3 attenuationColor; 2099 #ifdef USE_TRANSMISSIONMAP 2100 uniform sampler2D transmissionMap; 2101 #endif 2102 #ifdef USE_THICKNESSMAP 2103 uniform sampler2D thicknessMap; 2104 #endif 2105 uniform vec2 transmissionSamplerSize; 2106 uniform sampler2D transmissionSamplerMap; 2107 uniform mat4 modelMatrix; 2108 uniform mat4 projectionMatrix; 2109 varying vec3 vWorldPosition; 2110 float w0( float a ) { 2111 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2112 } 2113 float w1( float a ) { 2114 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2115 } 2116 float w2( float a ){ 2117 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2118 } 2119 float w3( float a ) { 2120 return ( 1.0 / 6.0 ) * ( a * a * a ); 2121 } 2122 float g0( float a ) { 2123 return w0( a ) + w1( a ); 2124 } 2125 float g1( float a ) { 2126 return w2( a ) + w3( a ); 2127 } 2128 float h0( float a ) { 2129 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2130 } 2131 float h1( float a ) { 2132 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2133 } 2134 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2135 uv = uv * texelSize.zw + 0.5; 2136 vec2 iuv = floor( uv ); 2137 vec2 fuv = fract( uv ); 2138 float g0x = g0( fuv.x ); 2139 float g1x = g1( fuv.x ); 2140 float h0x = h0( fuv.x ); 2141 float h1x = h1( fuv.x ); 2142 float h0y = h0( fuv.y ); 2143 float h1y = h1( fuv.y ); 2144 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2145 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2146 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2147 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2148 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2149 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2150 } 2151 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2152 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2153 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2154 vec2 fLodSizeInv = 1.0 / fLodSize; 2155 vec2 cLodSizeInv = 1.0 / cLodSize; 2156 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2157 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2158 return mix( fSample, cSample, fract( lod ) ); 2159 } 2160 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2161 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2162 vec3 modelScale; 2163 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2164 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2165 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2166 return normalize( refractionVector ) * thickness * modelScale; 2167 } 2168 float applyIorToRoughness( const in float roughness, const in float ior ) { 2169 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2170 } 2171 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2172 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2173 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2174 } 2175 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2176 if ( isinf( attenuationDistance ) ) { 2177 return vec3( 1.0 ); 2178 } else { 2179 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2180 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2181 } 2182 } 2183 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2184 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2185 const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, 2186 const in vec3 attenuationColor, const in float attenuationDistance ) { 2187 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2188 vec3 refractedRayExit = position + transmissionRay; 2189 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2190 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2191 refractionCoords += 1.0; 2192 refractionCoords /= 2.0; 2193 vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2194 vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2195 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2196 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2197 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2198 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2199 } 2200#endif`,bE=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2201 varying vec2 vUv; 2202#endif 2203#ifdef USE_MAP 2204 varying vec2 vMapUv; 2205#endif 2206#ifdef USE_ALPHAMAP
2207 varying vec2 vAlphaMapUv; 2208#endif 2209#ifdef USE_LIGHTMAP 2210 varying vec2 vLightMapUv; 2211#endif 2212#ifdef USE_AOMAP 2213 varying vec2 vAoMapUv; 2214#endif 2215#ifdef USE_BUMPMAP 2216 varying vec2 vBumpMapUv; 2217#endif 2218#ifdef USE_NORMALMAP 2219 varying vec2 vNormalMapUv; 2220#endif 2221#ifdef USE_EMISSIVEMAP 2222 varying vec2 vEmissiveMapUv; 2223#endif 2224#ifdef USE_METALNESSMAP 2225 varying vec2 vMetalnessMapUv; 2226#endif 2227#ifdef USE_ROUGHNESSMAP 2228 varying vec2 vRoughnessMapUv; 2229#endif 2230#ifdef USE_ANISOTROPYMAP 2231 varying vec2 vAnisotropyMapUv; 2232#endif 2233#ifdef USE_CLEARCOATMAP 2234 varying vec2 vClearcoatMapUv; 2235#endif 2236#ifdef USE_CLEARCOAT_NORMALMAP 2237 varying vec2 vClearcoatNormalMapUv; 2238#endif 2239#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2240 varying vec2 vClearcoatRoughnessMapUv; 2241#endif 2242#ifdef USE_IRIDESCENCEMAP 2243 varying vec2 vIridescenceMapUv; 2244#endif 2245#ifdef USE_IRIDESCENCE_THICKNESSMAP 2246 varying vec2 vIridescenceThicknessMapUv; 2247#endif 2248#ifdef USE_SHEEN_COLORMAP 2249 varying vec2 vSheenColorMapUv; 2250#endif 2251#ifdef USE_SHEEN_ROUGHNESSMAP 2252 varying vec2 vSheenRoughnessMapUv; 2253#endif 2254#ifdef USE_SPECULARMAP 2255 varying vec2 vSpecularMapUv; 2256#endif 2257#ifdef USE_SPECULAR_COLORMAP 2258 varying vec2 vSpecularColorMapUv; 2259#endif 2260#ifdef USE_SPECULAR_INTENSITYMAP 2261 varying vec2 vSpecularIntensityMapUv; 2262#endif 2263#ifdef USE_TRANSMISSIONMAP 2264 uniform mat3 transmissionMapTransform; 2265 varying vec2 vTransmissionMapUv; 2266#endif 2267#ifdef USE_THICKNESSMAP 2268 uniform mat3 thicknessMapTransform; 2269 varying vec2 vThicknessMapUv; 2270#endif`,TE=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2271 varying vec2 vUv; 2272#endif 2273#ifdef USE_MAP 2274 uniform mat3 mapTransform; 2275 varying vec2 vMapUv; 2276#endif 2277#ifdef USE_ALPHAMAP 2278 uniform mat3 alphaMapTransform; 2279 varying vec2 vAlphaMapUv; 2280#endif 2281#ifdef USE_LIGHTMAP 2282 uniform mat3 lightMapTransform; 2283 varying vec2 vLightMapUv; 2284#endif 2285#ifdef USE_AOMAP 2286 uniform mat3 aoMapTransform; 2287 varying vec2 vAoMapUv; 2288#endif 2289#ifdef USE_BUMPMAP 2290 uniform mat3 bumpMapTransform; 2291 varying vec2 vBumpMapUv; 2292#endif 2293#ifdef USE_NORMALMAP 2294 uniform mat3 normalMapTransform; 2295 varying vec2 vNormalMapUv; 2296#endif 2297#ifdef USE_DISPLACEMENTMAP 2298 uniform mat3 displacementMapTransform; 2299 varying vec2 vDisplacementMapUv; 2300#endif 2301#ifdef USE_EMISSIVEMAP 2302 uniform mat3 emissiveMapTransform; 2303 varying vec2 vEmissiveMapUv; 2304#endif 2305#ifdef USE_METALNESSMAP 2306 uniform mat3 metalnessMapTransform; 2307 varying vec2 vMetalnessMapUv; 2308#endif 2309#ifdef USE_ROUGHNESSMAP 2310 uniform mat3 roughnessMapTransform; 2311 varying vec2 vRoughnessMapUv; 2312#endif 2313#ifdef USE_ANISOTROPYMAP 2314 uniform mat3 anisotropyMapTransform; 2315 varying vec2 vAnisotropyMapUv; 2316#endif 2317#ifdef USE_CLEARCOATMAP 2318 uniform mat3 clearcoatMapTransform; 2319 varying vec2 vClearcoatMapUv; 2320#endif 2321#ifdef USE_CLEARCOAT_NORMALMAP 2322 uniform mat3 clearcoatNormalMapTransform; 2323 varying vec2 vClearcoatNormalMapUv; 2324#endif 2325#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2326 uniform mat3 clearcoatRoughnessMapTransform; 2327 varying vec2 vClearcoatRoughnessMapUv; 2328#endif 2329#ifdef USE_SHEEN_COLORMAP 2330 uniform mat3 sheenColorMapTransform; 2331 varying vec2 vSheenColorMapUv; 2332#endif 2333#ifdef USE_SHEEN_ROUGHNESSMAP 2334 uniform mat3 sheenRoughnessMapTransform; 2335 varying vec2 vSheenRoughnessMapUv; 2336#endif 2337#ifdef USE_IRIDESCENCEMAP 2338 uniform mat3 iridescenceMapTransform; 2339 varying vec2 vIridescenceMapUv; 2340#endif 2341#ifdef USE_IRIDESCENCE_THICKNESSMAP 2342 uniform mat3 iridescenceThicknessMapTransform; 2343 varying vec2 vIridescenceThicknessMapUv; 2344#endif 2345#ifdef USE_SPECULARMAP 2346 uniform mat3 specularMapTransform; 2347 varying vec2 vSpecularMapUv; 2348#endif 2349#ifdef USE_SPECULAR_COLORMAP 2350 uniform mat3 specularColorMapTransform; 2351 varying vec2 vSpecularColorMapUv; 2352#endif 2353#ifdef USE_SPECULAR_INTENSITYMAP 2354 uniform mat3 specularIntensityMapTransform; 2355 varying vec2 vSpecularIntensityMapUv; 2356#endif 2357#ifdef USE_TRANSMISSIONMAP 2358 uniform mat3 transmissionMapTransform; 2359 varying vec2 vTransmissionMapUv; 2360#endif 2361#ifdef USE_THICKNESSMAP 2362 uniform mat3 thicknessMapTransform; 2363 varying vec2 vThicknessMapUv; 2364#endif`,AE=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2365 vUv = vec3( uv, 1 ).xy; 2366#endif 2367#ifdef USE_MAP 2368 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2369#endif 2370#ifdef USE_ALPHAMAP 2371 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2372#endif 2373#ifdef USE_LIGHTMAP 2374 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2375#endif 2376#ifdef USE_AOMAP 2377 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2378#endif 2379#ifdef USE_BUMPMAP 2380 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2381#endif 2382#ifdef USE_NORMALMAP 2383 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2384#endif 2385#ifdef USE_DISPLACEMENTMAP 2386 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2387#endif 2388#ifdef USE_EMISSIVEMAP 2389 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2390#endif 2391#ifdef USE_METALNESSMAP 2392 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2393#endif 2394#ifdef USE_ROUGHNESSMAP 2395 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2396#endif 2397#ifdef USE_ANISOTROPYMAP 2398 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2399#endif 2400#ifdef USE_CLEARCOATMAP 2401 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2402#endif 2403#ifdef USE_CLEARCOAT_NORMALMAP 2404 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2405#endif 2406#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2407 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2408#endif
2409#ifdef USE_IRIDESCENCEMAP 2410 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2411#endif 2412#ifdef USE_IRIDESCENCE_THICKNESSMAP 2413 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2414#endif 2415#ifdef USE_SHEEN_COLORMAP 2416 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2417#endif 2418#ifdef USE_SHEEN_ROUGHNESSMAP 2419 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2420#endif 2421#ifdef USE_SPECULARMAP 2422 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2423#endif 2424#ifdef USE_SPECULAR_COLORMAP 2425 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2426#endif 2427#ifdef USE_SPECULAR_INTENSITYMAP 2428 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2429#endif 2430#ifdef USE_TRANSMISSIONMAP 2431 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2432#endif 2433#ifdef USE_THICKNESSMAP 2434 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2435#endif`,CE=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2436 vec4 worldPosition = vec4( transformed, 1.0 ); 2437 #ifdef USE_BATCHING 2438 worldPosition = batchingMatrix * worldPosition; 2439 #endif 2440 #ifdef USE_INSTANCING 2441 worldPosition = instanceMatrix * worldPosition; 2442 #endif 2443 worldPosition = modelMatrix * worldPosition; 2444#endif`;const RE=`varying vec2 vUv; 2445uniform mat3 uvTransform; 2446void main() { 2447 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2448 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2449}`,PE=`uniform sampler2D t2D; 2450uniform float backgroundIntensity; 2451varying vec2 vUv; 2452void main() { 2453 vec4 texColor = texture2D( t2D, vUv ); 2454 #ifdef DECODE_VIDEO_TEXTURE 2455 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2456 #endif 2457 texColor.rgb *= backgroundIntensity; 2458 gl_FragColor = texColor; 2459 #include <tonemapping_fragment> 2460 #include <colorspace_fragment> 2461}`,LE=`varying vec3 vWorldDirection; 2462#include <common> 2463void main() { 2464 vWorldDirection = transformDirection( position, modelMatrix ); 2465 #include <begin_vertex> 2466 #include <project_vertex> 2467 gl_Position.z = gl_Position.w; 2468}`,IE=`#ifdef ENVMAP_TYPE_CUBE 2469 uniform samplerCube envMap; 2470#elif defined( ENVMAP_TYPE_CUBE_UV ) 2471 uniform sampler2D envMap; 2472#endif 2473uniform float flipEnvMap; 2474uniform float backgroundBlurriness; 2475uniform float backgroundIntensity; 2476varying vec3 vWorldDirection; 2477#include <cube_uv_reflection_fragment> 2478void main() { 2479 #ifdef ENVMAP_TYPE_CUBE 2480 vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2481 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2482 vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); 2483 #else 2484 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2485 #endif 2486 texColor.rgb *= backgroundIntensity; 2487 gl_FragColor = texColor; 2488 #include <tonemapping_fragment> 2489 #include <colorspace_fragment> 2490}`,UE=`varying vec3 vWorldDirection; 2491#include <common> 2492void main() { 2493 vWorldDirection = transformDirection( position, modelMatrix ); 2494 #include <begin_vertex> 2495 #include <project_vertex> 2496 gl_Position.z = gl_Position.w; 2497}`,DE=`uniform samplerCube tCube; 2498uniform float tFlip; 2499uniform float opacity; 2500varying vec3 vWorldDirection; 2501void main() { 2502 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2503 gl_FragColor = texColor; 2504 gl_FragColor.a *= opacity; 2505 #include <tonemapping_fragment> 2506 #include <colorspace_fragment> 2507}`,NE=`#include <common> 2508#include <batching_pars_vertex> 2509#include <uv_pars_vertex> 2510#include <displacementmap_pars_vertex> 2511#include <morphtarget_pars_vertex> 2512#include <skinning_pars_vertex> 2513#include <logdepthbuf_pars_vertex> 2514#include <clipping_planes_pars_vertex> 2515varying vec2 vHighPrecisionZW; 2516void main() { 2517 #include <uv_vertex> 2518 #include <batching_vertex> 2519 #include <skinbase_vertex> 2520 #ifdef USE_DISPLACEMENTMAP 2521 #include <beginnormal_vertex> 2522 #include <morphnormal_vertex> 2523 #include <skinnormal_vertex> 2524 #endif 2525 #include <begin_vertex> 2526 #include <morphtarget_vertex> 2527 #include <skinning_vertex> 2528 #include <displacementmap_vertex> 2529 #include <project_vertex> 2530 #include <logdepthbuf_vertex> 2531 #include <clipping_planes_vertex> 2532 vHighPrecisionZW = gl_Position.zw; 2533}`,FE=`#if DEPTH_PACKING == 3200 2534 uniform float opacity; 2535#endif 2536#include <common> 2537#include <packing> 2538#include <uv_pars_fragment> 2539#include <map_pars_fragment> 2540#include <alphamap_pars_fragment> 2541#include <alphatest_pars_fragment> 2542#include <alphahash_pars_fragment> 2543#include <logdepthbuf_pars_fragment> 2544#include <clipping_planes_pars_fragment> 2545varying vec2 vHighPrecisionZW; 2546void main() { 2547 #include <clipping_planes_fragment> 2548 vec4 diffuseColor = vec4( 1.0 ); 2549 #if DEPTH_PACKING == 3200 2550 diffuseColor.a = opacity; 2551 #endif 2552 #include <map_fragment> 2553 #include <alphamap_fragment> 2554 #include <alphatest_fragment> 2555 #include <alphahash_fragment> 2556 #include <logdepthbuf_fragment> 2557 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2558 #if DEPTH_PACKING == 3200 2559 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2560 #elif DEPTH_PACKING == 3201 2561 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2562 #endif 2563}`,OE=`#define DISTANCE 2564varying vec3 vWorldPosition; 2565#include <common> 2566#include <batching_pars_vertex> 2567#include <uv_pars_vertex> 2568#include <displacementmap_pars_vertex> 2569#include <morphtarget_pars_vertex> 2570#include <skinning_pars_vertex> 2571#include <clipping_planes_pars_vertex> 2572void main() { 2573 #include <uv_vertex> 2574 #include <batching_vertex> 2575 #include <skinbase_vertex> 2576 #ifdef USE_DISPLACEMENTMAP 2577 #include <beginnormal_vertex> 2578 #include <morphnormal_vertex> 2579 #include <skinnormal_vertex> 2580 #endif 2581 #include <begin_vertex> 2582 #include <morphtarget_vertex> 2583 #include <skinning_vertex> 2584 #include <displacementmap_vertex> 2585 #include <project_vertex> 2586 #include <worldpos_vertex> 2587 #include <clipping_planes_vertex> 2588 vWorldPosition = worldPosition.xyz; 2589}`,BE=`#define DISTANCE 2590uniform vec3 referencePosition; 2591uniform float nearDistance; 2592uniform float farDistance; 2593varying vec3 vWorldPosition; 2594#include <common> 2595#include <packing> 2596#include <uv_pars_fragment> 2597#include <map_pars_fragment> 2598#include <alphamap_pars_fragment> 2599#include <alphatest_pars_fragment> 2600#include <alphahash_pars_fragment> 2601#include <clipping_planes_pars_fragment> 2602void main () { 2603 #include <clipping_planes_fragment> 2604 vec4 diffuseColor = vec4( 1.0 ); 2605 #include <map_fragment> 2606 #include <alphamap_fragment> 2607 #include <alphatest_fragment> 2608 #include <alphahash_fragment> 2609 float dist = length( vWorldPosition - referencePosition ); 2610 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2611 dist = saturate( dist ); 2612 gl_FragColor = packDepthToRGBA( dist ); 2613}`,kE=`varying vec3 vWorldDirection; 2614#include <common> 2615void main() { 2616 vWorldDirection = transformDirection( position, modelMatrix ); 2617 #include <begin_vertex> 2618 #include <project_vertex> 2619}`,zE=`uniform sampler2D tEquirect; 2620varying vec3 vWorldDirection; 2621#include <common> 2622void main() { 2623 vec3 direction = normalize( vWorldDirection ); 2624 vec2 sampleUV = equirectUv( direction ); 2625 gl_FragColor = texture2D( tEquirect, sampleUV ); 2626 #include <tonemapping_fragment> 2627 #include <colorspace_fragment> 2628}`,GE=`uniform float scale; 2629attribute float lineDistance; 2630varying float vLineDistance; 2631#include <common> 2632#include <uv_pars_vertex> 2633#include <color_pars_vertex> 2634#include <fog_pars_vertex> 2635#include <morphtarget_pars_vertex> 2636#include <logdepthbuf_pars_vertex> 2637#include <clipping_planes_pars_vertex> 2638void main() { 2639 vLineDistance = scale * lineDistance; 2640 #include <uv_vertex> 2641 #include <color_vertex> 2642 #include <morphcolor_vertex> 2643 #include <begin_vertex> 2644 #include <morphtarget_vertex> 2645 #include <project_vertex> 2646 #include <logdepthbuf_vertex> 2647 #include <clipping_planes_vertex> 2648 #include <fog_vertex> 2649}`,HE=`uniform vec3 diffuse; 2650uniform float opacity; 2651uniform float dashSize; 2652uniform float totalSize; 2653varying float vLineDistance; 2654#include <common> 2655#include <color_pars_fragment> 2656#include <uv_pars_fragment> 2657#include <map_pars_fragment> 2658#include <fog_pars_fragment> 2659#include <logdepthbuf_pars_fragment> 2660#include <clipping_planes_pars_fragment> 2661void main() { 2662 #include <clipping_planes_fragment> 2663 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2664 discard; 2665 } 2666 vec3 outgoingLight = vec3( 0.0 ); 2667 vec4 diffuseColor = vec4( diffuse, opacity ); 2668 #include <logdepthbuf_fragment> 2669 #include <map_fragment> 2670 #include <color_fragment> 2671 outgoingLight = diffuseColor.rgb; 2672 #include <opaque_fragment> 2673 #include <tonemapping_fragment> 2674 #include <colorspace_fragment> 2675 #include <fog_fragment> 2676 #include <premultiplied_alpha_fragment> 2677}`,VE=`#include <common> 2678#include <batching_pars_vertex> 2679#include <uv_pars_vertex> 2680#include <envmap_pars_vertex> 2681#include <color_pars_vertex> 2682#include <fog_pars_vertex> 2683#include <morphtarget_pars_vertex> 2684#include <skinning_pars_vertex> 2685#include <logdepthbuf_pars_vertex> 2686#include <clipping_planes_pars_vertex> 2687void main() { 2688 #include <uv_vertex> 2689 #include <color_vertex> 2690 #include <morphcolor_vertex> 2691 #include <batching_vertex> 2692 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2693 #include <beginnormal_vertex> 2694 #include <morphnormal_vertex> 2695 #include <skinbase_vertex> 2696 #include <skinnormal_vertex> 2697 #include <defaultnormal_vertex> 2698 #endif 2699 #include <begin_vertex> 2700 #include <morphtarget_vertex> 2701 #include <skinning_vertex> 2702 #include <project_vertex> 2703 #include <logdepthbuf_vertex> 2704 #include <clipping_planes_vertex> 2705 #include <worldpos_vertex> 2706 #include <envmap_vertex> 2707 #include <fog_vertex> 2708}`,WE=`uniform vec3 diffuse; 2709uniform float opacity; 2710#ifndef FLAT_SHADED 2711 varying vec3 vNormal; 2712#endif 2713#include <common> 2714#include <dithering_pars_fragment> 2715#include <color_pars_fragment> 2716#include <uv_pars_fragment> 2717#include <map_pars_fragment> 2718#include <alphamap_pars_fragment> 2719#include <alphatest_pars_fragment> 2720#include <alphahash_pars_fragment> 2721#include <aomap_pars_fragment> 2722#include <lightmap_pars_fragment> 2723#include <envmap_common_pars_fragment> 2724#include <envmap_pars_fragment> 2725#include <fog_pars_fragment> 2726#include <specularmap_pars_fragment> 2727#include <logdepthbuf_pars_fragment> 2728#include <clipping_planes_pars_fragment> 2729void main() { 2730 #include <clipping_planes_fragment> 2731 vec4 diffuseColor = vec4( diffuse, opacity ); 2732 #include <logdepthbuf_fragment> 2733 #include <map_fragment> 2734 #include <color_fragment> 2735 #include <alphamap_fragment> 2736 #include <alphatest_fragment> 2737 #include <alphahash_fragment> 2738 #include <specularmap_fragment> 2739 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2740 #ifdef USE_LIGHTMAP 2741 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2742 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2743 #else 2744 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2745 #endif 2746 #include <aomap_fragment> 2747 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2748 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2749 #include <envmap_fragment> 2750 #include <opaque_fragment> 2751 #include <tonemapping_fragment> 2752 #include <colorspace_fragment> 2753 #include <fog_fragment> 2754 #include <premultiplied_alpha_fragment> 2755 #include <dithering_fragment> 2756}`,XE=`#define LAMBERT 2757varying vec3 vViewPosition; 2758#include <common> 2759#include <batching_pars_vertex> 2760#include <uv_pars_vertex> 2761#include <displacementmap_pars_vertex> 2762#include <envmap_pars_vertex> 2763#include <color_pars_vertex> 2764#include <fog_pars_vertex> 2765#include <normal_pars_vertex> 2766#include <morphtarget_pars_vertex> 2767#include <skinning_pars_vertex> 2768#include <shadowmap_pars_vertex> 2769#include <logdepthbuf_pars_vertex> 2770#include <clipping_planes_pars_vertex> 2771void main() { 2772 #include <uv_vertex> 2773 #include <color_vertex> 2774 #include <morphcolor_vertex> 2775 #include <batching_vertex> 2776 #include <beginnormal_vertex> 2777 #include <morphnormal_vertex> 2778 #include <skinbase_vertex> 2779 #include <skinnormal_vertex> 2780 #include <defaultnormal_vertex> 2781 #include <normal_vertex> 2782 #include <begin_vertex> 2783 #include <morphtarget_vertex> 2784 #include <skinning_vertex> 2785 #include <displacementmap_vertex> 2786 #include <project_vertex> 2787 #include <logdepthbuf_vertex> 2788 #include <clipping_planes_vertex> 2789 vViewPosition = - mvPosition.xyz; 2790 #include <worldpos_vertex> 2791 #include <envmap_vertex> 2792 #include <shadowmap_vertex> 2793 #include <fog_vertex> 2794}`,YE=`#define LAMBERT 2795uniform vec3 diffuse; 2796uniform vec3 emissive; 2797uniform float opacity; 2798#include <common> 2799#include <packing> 2800#include <dithering_pars_fragment> 2801#include <color_pars_fragment> 2802#include <uv_pars_fragment> 2803#include <map_pars_fragment> 2804#include <alphamap_pars_fragment> 2805#include <alphatest_pars_fragment> 2806#include <alphahash_pars_fragment> 2807#include <aomap_pars_fragment> 2808#include <lightmap_pars_fragment> 2809#include <emissivemap_pars_fragment> 2810#include <envmap_common_pars_fragment> 2811#include <envmap_pars_fragment> 2812#include <fog_pars_fragment> 2813#include <bsdfs> 2814#include <lights_pars_begin> 2815#include <normal_pars_fragment> 2816#include <lights_lambert_pars_fragment> 2817#include <shadowmap_pars_fragment> 2818#include <bumpmap_pars_fragment> 2819#include <normalmap_pars_fragment> 2820#include <specularmap_pars_fragment> 2821#include <logdepthbuf_pars_fragment> 2822#include <clipping_planes_pars_fragment> 2823void main() { 2824 #include <clipping_planes_fragment> 2825 vec4 diffuseColor = vec4( diffuse, opacity ); 2826 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2827 vec3 totalEmissiveRadiance = emissive; 2828 #include <logdepthbuf_fragment> 2829 #include <map_fragment> 2830 #include <color_fragment> 2831 #include <alphamap_fragment> 2832 #include <alphatest_fragment> 2833 #include <alphahash_fragment> 2834 #include <specularmap_fragment> 2835 #include <normal_fragment_begin> 2836 #include <normal_fragment_maps> 2837 #include <emissivemap_fragment> 2838 #include <lights_lambert_fragment> 2839 #include <lights_fragment_begin> 2840 #include <lights_fragment_maps> 2841 #include <lights_fragment_end> 2842 #include <aomap_fragment> 2843 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2844 #include <envmap_fragment> 2845 #include <opaque_fragment> 2846 #include <tonemapping_fragment> 2847 #include <colorspace_fragment> 2848 #include <fog_fragment> 2849 #include <premultiplied_alpha_fragment> 2850 #include <dithering_fragment> 2851}`,jE=`#define MATCAP 2852varying vec3 vViewPosition; 2853#include <common> 2854#include <batching_pars_vertex> 2855#include <uv_pars_vertex> 2856#include <color_pars_vertex> 2857#include <displacementmap_pars_vertex> 2858#include <fog_pars_vertex> 2859#include <normal_pars_vertex> 2860#include <morphtarget_pars_vertex> 2861#include <skinning_pars_vertex> 2862#include <logdepthbuf_pars_vertex> 2863#include <clipping_planes_pars_vertex> 2864void main() { 2865 #include <uv_vertex> 2866 #include <color_vertex> 2867 #include <morphcolor_vertex> 2868 #include <batching_vertex> 2869 #include <beginnormal_vertex> 2870 #include <morphnormal_vertex> 2871 #include <skinbase_vertex> 2872 #include <skinnormal_vertex> 2873 #include <defaultnormal_vertex> 2874 #include <normal_vertex> 2875 #include <begin_vertex> 2876 #include <morphtarget_vertex> 2877 #include <skinning_vertex> 2878 #include <displacementmap_vertex> 2879 #include <project_vertex> 2880 #include <logdepthbuf_vertex> 2881 #include <clipping_planes_vertex> 2882 #include <fog_vertex> 2883 vViewPosition = - mvPosition.xyz; 2884}`,qE=`#define MATCAP 2885uniform vec3 diffuse; 2886uniform float opacity; 2887uniform sampler2D matcap; 2888varying vec3 vViewPosition; 2889#include <common> 2890#include <dithering_pars_fragment> 2891#include <color_pars_fragment> 2892#include <uv_pars_fragment> 2893#include <map_pars_fragment> 2894#include <alphamap_pars_fragment> 2895#include <alphatest_pars_fragment> 2896#include <alphahash_pars_fragment> 2897#include <fog_pars_fragment> 2898#include <normal_pars_fragment> 2899#include <bumpmap_pars_fragment> 2900#include <normalmap_pars_fragment> 2901#include <logdepthbuf_pars_fragment> 2902#include <clipping_planes_pars_fragment> 2903void main() { 2904 #include <clipping_planes_fragment> 2905 vec4 diffuseColor = vec4( diffuse, opacity ); 2906 #include <logdepthbuf_fragment> 2907 #include <map_fragment> 2908 #include <color_fragment> 2909 #include <alphamap_fragment> 2910 #include <alphatest_fragment> 2911 #include <alphahash_fragment> 2912 #include <normal_fragment_begin> 2913 #include <normal_fragment_maps> 2914 vec3 viewDir = normalize( vViewPosition ); 2915 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 2916 vec3 y = cross( viewDir,
2916x ); 2917 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 2918 #ifdef USE_MATCAP 2919 vec4 matcapColor = texture2D( matcap, uv ); 2920 #else 2921 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 2922 #endif 2923 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 2924 #include <opaque_fragment> 2925 #include <tonemapping_fragment> 2926 #include <colorspace_fragment> 2927 #include <fog_fragment> 2928 #include <premultiplied_alpha_fragment> 2929 #include <dithering_fragment> 2930}`,ZE=`#define NORMAL 2931#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2932 varying vec3 vViewPosition; 2933#endif 2934#include <common> 2935#include <batching_pars_vertex> 2936#include <uv_pars_vertex> 2937#include <displacementmap_pars_vertex> 2938#include <normal_pars_vertex> 2939#include <morphtarget_pars_vertex> 2940#include <skinning_pars_vertex> 2941#include <logdepthbuf_pars_vertex> 2942#include <clipping_planes_pars_vertex> 2943void main() { 2944 #include <uv_vertex> 2945 #include <batching_vertex> 2946 #include <beginnormal_vertex> 2947 #include <morphnormal_vertex> 2948 #include <skinbase_vertex> 2949 #include <skinnormal_vertex> 2950 #include <defaultnormal_vertex> 2951 #include <normal_vertex> 2952 #include <begin_vertex> 2953 #include <morphtarget_vertex> 2954 #include <skinning_vertex> 2955 #include <displacementmap_vertex> 2956 #include <project_vertex> 2957 #include <logdepthbuf_vertex> 2958 #include <clipping_planes_vertex> 2959#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2960 vViewPosition = - mvPosition.xyz; 2961#endif 2962}`,JE=`#define NORMAL 2963uniform float opacity; 2964#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 2965 varying vec3 vViewPosition; 2966#endif 2967#include <packing> 2968#include <uv_pars_fragment> 2969#include <normal_pars_fragment> 2970#include <bumpmap_pars_fragment> 2971#include <normalmap_pars_fragment> 2972#include <logdepthbuf_pars_fragment> 2973#include <clipping_planes_pars_fragment> 2974void main() { 2975 #include <clipping_planes_fragment> 2976 #include <logdepthbuf_fragment> 2977 #include <normal_fragment_begin> 2978 #include <normal_fragment_maps> 2979 gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); 2980 #ifdef OPAQUE 2981 gl_FragColor.a = 1.0; 2982 #endif 2983}`,KE=`#define PHONG 2984varying vec3 vViewPosition; 2985#include <common> 2986#include <batching_pars_vertex> 2987#include <uv_pars_vertex> 2988#include <displacementmap_pars_vertex> 2989#include <envmap_pars_vertex> 2990#include <color_pars_vertex> 2991#include <fog_pars_vertex> 2992#include <normal_pars_vertex> 2993#include <morphtarget_pars_vertex> 2994#include <skinning_pars_vertex> 2995#include <shadowmap_pars_vertex> 2996#include <logdepthbuf_pars_vertex> 2997#include <clipping_planes_pars_vertex> 2998void main() { 2999 #include <uv_vertex> 3000 #include <color_vertex> 3001 #include <morphcolor_vertex> 3002 #include <batching_vertex> 3003 #include <beginnormal_vertex> 3004 #include <morphnormal_vertex> 3005 #include <skinbase_vertex> 3006 #include <skinnormal_vertex> 3007 #include <defaultnormal_vertex> 3008 #include <normal_vertex> 3009 #include <begin_vertex> 3010 #include <morphtarget_vertex> 3011 #include <skinning_vertex> 3012 #include <displacementmap_vertex> 3013 #include <project_vertex> 3014 #include <logdepthbuf_vertex> 3015 #include <clipping_planes_vertex> 3016 vViewPosition = - mvPosition.xyz; 3017 #include <worldpos_vertex> 3018 #include <envmap_vertex> 3019 #include <shadowmap_vertex> 3020 #include <fog_vertex> 3021}`,QE=`#define PHONG 3022uniform vec3 diffuse; 3023uniform vec3 emissive; 3024uniform vec3 specular; 3025uniform float shininess; 3026uniform float opacity; 3027#include <common> 3028#include <packing> 3029#include <dithering_pars_fragment> 3030#include <color_pars_fragment> 3031#include <uv_pars_fragment> 3032#include <map_pars_fragment> 3033#include <alphamap_pars_fragment> 3034#include <alphatest_pars_fragment> 3035#include <alphahash_pars_fragment> 3036#include <aomap_pars_fragment> 3037#include <lightmap_pars_fragment> 3038#include <emissivemap_pars_fragment> 3039#include <envmap_common_pars_fragment> 3040#include <envmap_pars_fragment> 3041#include <fog_pars_fragment> 3042#include <bsdfs> 3043#include <lights_pars_begin> 3044#include <normal_pars_fragment> 3045#include <lights_phong_pars_fragment> 3046#include <shadowmap_pars_fragment> 3047#include <bumpmap_pars_fragment> 3048#include <normalmap_pars_fragment> 3049#include <specularmap_pars_fragment> 3050#include <logdepthbuf_pars_fragment> 3051#include <clipping_planes_pars_fragment> 3052void main() { 3053 #include <clipping_planes_fragment> 3054 vec4 diffuseColor = vec4( diffuse, opacity ); 3055 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3056 vec3 totalEmissiveRadiance = emissive; 3057 #include <logdepthbuf_fragment> 3058 #include <map_fragment> 3059 #include <color_fragment> 3060 #include <alphamap_fragment> 3061 #include <alphatest_fragment> 3062 #include <alphahash_fragment> 3063 #include <specularmap_fragment> 3064 #include <normal_fragment_begin> 3065 #include <normal_fragment_maps> 3066 #include <emissivemap_fragment> 3067 #include <lights_phong_fragment> 3068 #include <lights_fragment_begin> 3069 #include <lights_fragment_maps> 3070 #include <lights_fragment_end> 3071 #include <aomap_fragment> 3072 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3073 #include <envmap_fragment> 3074 #include <opaque_fragment> 3075 #include <tonemapping_fragment> 3076 #include <colorspace_fragment> 3077 #include <fog_fragment> 3078 #include <premultiplied_alpha_fragment> 3079 #include <dithering_fragment> 3080}`,$E=`#define STANDARD 3081varying vec3 vViewPosition; 3082#ifdef USE_TRANSMISSION 3083 varying vec3 vWorldPosition; 3084#endif 3085#include <common> 3086#include <batching_pars_vertex> 3087#include <uv_pars_vertex> 3088#include <displacementmap_pars_vertex> 3089#include <color_pars_vertex> 3090#include <fog_pars_vertex> 3091#include <normal_pars_vertex> 3092#include <morphtarget_pars_vertex> 3093#include <skinning_pars_vertex> 3094#include <shadowmap_pars_vertex> 3095#include <logdepthbuf_pars_vertex> 3096#include <clipping_planes_pars_vertex> 3097void main() { 3098 #include <uv_vertex> 3099 #include <color_vertex> 3100 #include <morphcolor_vertex> 3101 #include <batching_vertex> 3102 #include <beginnormal_vertex> 3103 #include <morphnormal_vertex> 3104 #include <skinbase_vertex> 3105 #include <skinnormal_vertex> 3106 #include <defaultnormal_vertex> 3107 #include <normal_vertex> 3108 #include <begin_vertex> 3109 #include <morphtarget_vertex> 3110 #include <skinning_vertex> 3111 #include <displacementmap_vertex> 3112 #include <project_vertex> 3113 #include <logdepthbuf_vertex> 3114 #include <clipping_planes_vertex> 3115 vViewPosition = - mvPosition.xyz; 3116 #include <worldpos_vertex> 3117 #include <shadowmap_vertex> 3118 #include <fog_vertex> 3119#ifdef USE_TRANSMISSION 3120 vWorldPosition = worldPosition.xyz; 3121#endif 3122}`,ew=`#define STANDARD 3123#ifdef PHYSICAL 3124 #define IOR 3125 #define USE_SPECULAR 3126#endif 3127uniform vec3 diffuse; 3128uniform vec3 emissive; 3129uniform float roughness; 3130uniform float metalness; 3131uniform float opacity; 3132#ifdef IOR 3133 uniform float ior; 3134#endif 3135#ifdef USE_SPECULAR 3136 uniform float specularIntensity; 3137 uniform vec3 specularColor; 3138 #ifdef USE_SPECULAR_COLORMAP 3139 uniform sampler2D specularColorMap; 3140 #endif 3141 #ifdef USE_SPECULAR_INTENSITYMAP 3142 uniform sampler2D specularIntensityMap; 3143 #endif 3144#endif 3145#ifdef USE_CLEARCOAT 3146 uniform float clearcoat; 3147 uniform float clearcoatRoughness; 3148#endif
3149#ifdef USE_IRIDESCENCE 3150 uniform float iridescence; 3151 uniform float iridescenceIOR; 3152 uniform float iridescenceThicknessMinimum; 3153 uniform float iridescenceThicknessMaximum; 3154#endif 3155#ifdef USE_SHEEN 3156 uniform vec3 sheenColor; 3157 uniform float sheenRoughness; 3158 #ifdef USE_SHEEN_COLORMAP 3159 uniform sampler2D sheenColorMap; 3160 #endif 3161 #ifdef USE_SHEEN_ROUGHNESSMAP 3162 uniform sampler2D sheenRoughnessMap; 3163 #endif 3164#endif 3165#ifdef USE_ANISOTROPY 3166 uniform vec2 anisotropyVector; 3167 #ifdef USE_ANISOTROPYMAP 3168 uniform sampler2D anisotropyMap; 3169 #endif 3170#endif 3171varying vec3 vViewPosition; 3172#include <common> 3173#include <packing> 3174#include <dithering_pars_fragment> 3175#include <color_pars_fragment> 3176#include <uv_pars_fragment> 3177#include <map_pars_fragment> 3178#include <alphamap_pars_fragment> 3179#include <alphatest_pars_fragment> 3180#include <alphahash_pars_fragment> 3181#include <aomap_pars_fragment> 3182#include <lightmap_pars_fragment> 3183#include <emissivemap_pars_fragment> 3184#include <iridescence_fragment> 3185#include <cube_uv_reflection_fragment> 3186#include <envmap_common_pars_fragment> 3187#include <envmap_physical_pars_fragment> 3188#include <fog_pars_fragment> 3189#include <lights_pars_begin> 3190#include <normal_pars_fragment> 3191#include <lights_physical_pars_fragment> 3192#include <transmission_pars_fragment> 3193#include <shadowmap_pars_fragment> 3194#include <bumpmap_pars_fragment> 3195#include <normalmap_pars_fragment> 3196#include <clearcoat_pars_fragment> 3197#include <iridescence_pars_fragment> 3198#include <roughnessmap_pars_fragment> 3199#include <metalnessmap_pars_fragment> 3200#include <logdepthbuf_pars_fragment> 3201#include <clipping_planes_pars_fragment> 3202void main() { 3203 #include <clipping_planes_fragment> 3204 vec4 diffuseColor = vec4( diffuse, opacity ); 3205 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3206 vec3 totalEmissiveRadiance = emissive; 3207 #include <logdepthbuf_fragment> 3208 #include <map_fragment> 3209 #include <color_fragment> 3210 #include <alphamap_fragment> 3211 #include <alphatest_fragment> 3212 #include <alphahash_fragment> 3213 #include <roughnessmap_fragment> 3214 #include <metalnessmap_fragment> 3215 #include <normal_fragment_begin> 3216 #include <normal_fragment_maps> 3217 #include <clearcoat_normal_fragment_begin> 3218 #include <clearcoat_normal_fragment_maps> 3219 #include <emissivemap_fragment> 3220 #include <lights_physical_fragment> 3221 #include <lights_fragment_begin> 3222 #include <lights_fragment_maps> 3223 #include <lights_fragment_end> 3224 #include <aomap_fragment> 3225 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3226 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3227 #include <transmission_fragment> 3228 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3229 #ifdef USE_SHEEN 3230 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3231 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3232 #endif 3233 #ifdef USE_CLEARCOAT 3234 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3235 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3236 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3237 #endif 3238 #include <opaque_fragment> 3239 #include <tonemapping_fragment> 3240 #include <colorspace_fragment> 3241 #include <fog_fragment> 3242 #include <premultiplied_alpha_fragment> 3243 #include <dithering_fragment> 3244}`,tw=`#define TOON 3245varying vec3 vViewPosition; 3246#include <common> 3247#include <batching_pars_vertex> 3248#include <uv_pars_vertex> 3249#include <displacementmap_pars_vertex> 3250#include <color_pars_vertex> 3251#include <fog_pars_vertex> 3252#include <normal_pars_vertex> 3253#include <morphtarget_pars_vertex> 3254#include <skinning_pars_vertex> 3255#include <shadowmap_pars_vertex> 3256#include <logdepthbuf_pars_vertex> 3257#include <clipping_planes_pars_vertex> 3258void main() { 3259 #include <uv_vertex> 3260 #include <color_vertex> 3261 #include <morphcolor_vertex> 3262 #include <batching_vertex> 3263 #include <beginnormal_vertex> 3264 #include <morphnormal_vertex> 3265 #include <skinbase_vertex> 3266 #include <skinnormal_vertex> 3267 #include <defaultnormal_vertex> 3268 #include <normal_vertex> 3269 #include <begin_vertex> 3270 #include <morphtarget_vertex> 3271 #include <skinning_vertex> 3272 #include <displacementmap_vertex> 3273 #include <project_vertex> 3274 #include <logdepthbuf_vertex> 3275 #include <clipping_planes_vertex> 3276 vViewPosition = - mvPosition.xyz; 3277 #include <worldpos_vertex> 3278 #include <shadowmap_vertex> 3279 #include <fog_vertex> 3280}`,nw=`#define TOON 3281uniform vec3 diffuse; 3282uniform vec3 emissive; 3283uniform float opacity; 3284#include <common> 3285#include <packing> 3286#include <dithering_pars_fragment> 3287#include <color_pars_fragment> 3288#include <uv_pars_fragment> 3289#include <map_pars_fragment> 3290#include <alphamap_pars_fragment> 3291#include <alphatest_pars_fragment> 3292#include <alphahash_pars_fragment> 3293#include <aomap_pars_fragment> 3294#include <lightmap_pars_fragment> 3295#include <emissivemap_pars_fragment> 3296#include <gradientmap_pars_fragment> 3297#include <fog_pars_fragment> 3298#include <bsdfs> 3299#include <lights_pars_begin> 3300#include <normal_pars_fragment> 3301#include <lights_toon_pars_fragment> 3302#include <shadowmap_pars_fragment> 3303#include <bumpmap_pars_fragment> 3304#include <normalmap_pars_fragment> 3305#include <logdepthbuf_pars_fragment> 3306#include <clipping_planes_pars_fragment> 3307void main() { 3308 #include <clipping_planes_fragment> 3309 vec4 diffuseColor = vec4( diffuse, opacity ); 3310 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3311 vec3 totalEmissiveRadiance = emissive; 3312 #include <logdepthbuf_fragment> 3313 #include <map_fragment> 3314 #include <color_fragment> 3315 #include <alphamap_fragment> 3316 #include <alphatest_fragment> 3317 #include <alphahash_fragment> 3318 #include <normal_fragment_begin> 3319 #include <normal_fragment_maps> 3320 #include <emissivemap_fragment> 3321 #include <lights_toon_fragment> 3322 #include <lights_fragment_begin> 3323 #include <lights_fragment_maps> 3324 #include <lights_fragment_end> 3325 #include <aomap_fragment> 3326 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3327 #include <opaque_fragment> 3328 #include <tonemapping_fragment> 3329 #include <colorspace_fragment> 3330 #include <fog_fragment> 3331 #include <premultiplied_alpha_fragment> 3332 #include <dithering_fragment> 3333}`,iw=`uniform float size; 3334uniform float scale; 3335#include <common> 3336#include <color_pars_vertex> 3337#include <fog_pars_vertex> 3338#include <morphtarget_pars_vertex> 3339#include <logdepthbuf_pars_vertex> 3340#include <clipping_planes_pars_vertex> 3341#ifdef USE_POINTS_UV 3342 varying vec2 vUv; 3343 uniform mat3 uvTransform; 3344#endif 3345void main() { 3346 #ifdef USE_POINTS_UV 3347 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3348 #endif 3349 #include <color_vertex> 3350 #include <morphcolor_vertex> 3351 #include <begin_vertex> 3352 #include <morphtarget_vertex> 3353 #include <project_vertex> 3354 gl_PointSize = size; 3355 #ifdef USE_SIZEATTENUATION 3356 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3357 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3358 #endif 3359 #include <logdepthbuf_vertex> 3360 #include <clipping_planes_vertex> 3361 #include <worldpos_vertex> 3362 #include <fog_vertex> 3363}`,rw=`uniform vec3 diffuse; 3364uniform float opacity; 3365#include <common> 3366#include <color_pars_fragment> 3367#include <map_particle_pars_fragment> 3368#include <alphatest_pars_fragment> 3369#include <alphahash_pars_fragment> 3370#include <fog_pars_fragment> 3371#include <logdepthbuf_pars_fragment> 3372#include <clipping_planes_pars_fragment> 3373void main() { 3374 #include <clipping_planes_fragment> 3375 vec3 outgoingLight = vec3( 0.0 ); 3376 vec4 diffuseColor = vec4( diffuse, opacity ); 3377 #include <logdepthbuf_fragment> 3378 #include <map_particle_fragment> 3379 #include <color_fragment> 3380 #include <alphatest_fragment> 3381 #include <alphahash_fragment> 3382 outgoingLight = diffuseColor.rgb; 3383 #include <opaque_fragment> 3384 #include <tonemapping_fragment> 3385 #include <colorspace_fragment> 3386 #include <fog_fragment> 3387 #include <premultiplied_alpha_fragment> 3388}`,sw=`#include <common> 3389#include <batching_pars_vertex> 3390#include <fog_pars_vertex> 3391#include <morphtarget_pars_vertex> 3392#include <skinning_pars_vertex> 3393#include <logdepthbuf_pars_vertex> 3394#include <shadowmap_pars_vertex> 3395void main() { 3396 #include <batching_vertex> 3397 #include <beginnormal_vertex> 3398 #include <morphnormal_vertex> 3399 #include <skinbase_vertex> 3400 #include <skinnormal_vertex> 3401 #include <defaultnormal_vertex> 3402 #include <begin_vertex> 3403 #include <morphtarget_vertex> 3404 #include <skinning_vertex> 3405 #include <project_vertex> 3406 #include <logdepthbuf_vertex> 3407 #include <worldpos_vertex> 3408 #include <shadowmap_vertex> 3409 #include <fog_vertex> 3410}`,ow=`uniform vec3 color; 3411uniform float opacity; 3412#include <common> 3413#include <packing> 3414#include <fog_pars_fragment> 3415#include <bsdfs> 3416#include <lights_pars_begin> 3417#include <logdepthbuf_pars_fragment> 3418#include <shadowmap_pars_fragment> 3419#include <shadowmask_pars_fragment> 3420void main() { 3421 #include <logdepthbuf_fragment> 3422 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3423 #include <tonemapping_fragment> 3424 #include <colorspace_fragment> 3425 #include <fog_fragment> 3426}`,aw=`uniform float rotation; 3427uniform vec2 center; 3428#include <common> 3429#include <uv_pars_vertex> 3430#include <fog_pars_vertex> 3431#include <logdepthbuf_pars_vertex> 3432#include <clipping_planes_pars_vertex> 3433void main() { 3434 #include <uv_vertex> 3435 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 3436 vec2 scale; 3437 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 3438 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 3439 #ifndef USE_SIZEATTENUATION 3440 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3441 if ( isPerspective ) scale *= - mvPosition.z; 3442 #endif 3443 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3444 vec2 rotatedPosition; 3445 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3446 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3447 mvPosition.xy += rotatedPosition; 3448 gl_Position = projectionMatrix * mvPosition; 3449 #include <logdepthbuf_vertex> 3450 #include <clipping_planes_vertex> 3451 #include <fog_vertex> 3452}`,lw=`uniform vec3 diffuse; 3453uniform float opacity; 3454#include <common> 3455#include <uv_pars_fragment> 3456#include <map_pars_fragment> 3457#include <alphamap_pars_fragment> 3458#include <alphatest_pars_fragment> 3459#include <alphahash_pars_fragment> 3460#include <fog_pars_fragment> 3461#include <logdepthbuf_pars_fragment> 3462#include <clipping_planes_pars_fragment> 3463void main() { 3464 #include <clipping_planes_fragment> 3465 vec3 outgoingLight = vec3( 0.0 ); 3466 vec4 diffuseColor = vec4( diffuse, opacity ); 3467 #include <logdepthbuf_fragment> 3468 #include <map_fragment> 3469 #include <alphamap_fragment> 3470 #include <alphatest_fragment> 3471 #include <alphahash_fragment> 3472 outgoingLight = diffuseColor.rgb; 3473 #include <opaque_fragment> 3474 #include <tonemapping_fragment> 3475 #include <colorspace_fragment> 3476 #include <fog_fragment> 3477}
3477`,Et={alphahash_fragment:PS,alphahash_pars_fragment:LS,alphamap_fragment:IS,alphamap_pars_fragment:US,alphatest_fragment:DS,alphatest_pars_fragment:NS,aomap_fragment:FS,aomap_pars_fragment:OS,batching_pars_vertex:BS,batching_vertex:kS,begin_vertex:zS,beginnormal_vertex:GS,bsdfs:HS,iridescence_fragment:VS,bumpmap_pars_fragment:WS,clipping_planes_fragment:XS,clipping_planes_pars_fragment:YS,clipping_planes_pars_vertex:jS,clipping_planes_vertex:qS,color_fragment:ZS,color_pars_fragment:JS,color_pars_vertex:KS,color_vertex:QS,common:$S,cube_uv_reflection_fragment:eM,defaultnormal_vertex:tM,displacementmap_pars_vertex:nM,displacementmap_vertex:iM,emissivemap_fragment:rM,emissivemap_pars_fragment:sM,colorspace_fragment:oM,colorspace_pars_fragment:aM,envmap_fragment:lM,envmap_common_pars_fragment:cM,envmap_pars_fragment:uM,envmap_pars_vertex:hM,envmap_physical_pars_fragment:EM,envmap_vertex:fM,fog_vertex:dM,fog_pars_vertex:pM,fog_fragment:mM,fog_pars_fragment:gM,gradientmap_pars_fragment:vM,lightmap_fragment:_M,lightmap_pars_fragment:yM,lights_lambert_fragment:xM,lights_lambert_pars_fragment:SM,lights_pars_begin:MM,lights_toon_fragment:wM,lights_toon_pars_fragment:bM,lights_phong_fragment:TM,lights_phong_pars_fragment:AM,lights_physical_fragment:CM,lights_physical_pars_fragment:RM,lights_fragment_begin:PM,lights_fragment_maps:LM,lights_fragment_end:IM,logdepthbuf_fragment:UM,logdepthbuf_pars_fragment:DM,logdepthbuf_pars_vertex:NM,logdepthbuf_vertex:FM,map_fragment:OM,map_pars_fragment:BM,map_particle_fragment:kM,map_particle_pars_fragment:zM,metalnessmap_fragment:GM,metalnessmap_pars_fragment:HM,morphcolor_vertex:VM,morphnormal_vertex:WM,morphtarget_pars_vertex:XM,morphtarget_vertex:YM,normal_fragment_begin:jM,normal_fragment_maps:qM,normal_pars_fragment:ZM,normal_pars_vertex:JM,normal_vertex:KM,normalmap_pars_fragment:QM,clearcoat_normal_fragment_begin:$M,clearcoat_normal_fragment_maps:eE,clearcoat_pars_fragment:tE,iridescence_pars_fragment:nE,opaque_fragment:iE,packing:rE,premultiplied_alpha_fragment:sE,project_vertex:oE,dithering_fragment:aE,dithering_pars_fragment:lE,roughnessmap_fragment:cE,roughnessmap_pars_fragment:uE,shadowmap_pars_fragment:hE,shadowmap_pars_vertex:fE,shadowmap_vertex:dE,shadowmask_pars_fragment:pE,skinbase_vertex:mE,skinning_pars_vertex:gE,skinning_vertex:vE,skinnormal_vertex:_E,specularmap_fragment:yE,specularmap_pars_fragment:xE,tonemapping_fragment:SE,tonemapping_pars_fragment:ME,transmission_fragment:EE,transmission_pars_fragment:wE,uv_pars_fragment:bE,uv_pars_vertex:TE,uv_vertex:AE,worldpos_vertex:CE,background_vert:RE,background_frag:PE,backgroundCube_vert:LE,backgroundCube_frag:IE,cube_vert:UE,cube_frag:DE,depth_vert:NE,depth_frag:FE,distanceRGBA_vert:OE,distanceRGBA_frag:BE,equirect_vert:kE,equirect_frag:zE,linedashed_vert:GE,linedashed_frag:HE,meshbasic_vert:VE,meshbasic_frag:WE,meshlambert_vert:XE,meshlambert_frag:YE,meshmatcap_vert:jE,meshmatcap_frag:qE,meshnormal_vert:ZE,meshnormal_frag:JE,meshphong_vert:KE,meshphong_frag:QE,meshphysical_vert:$E,meshphysical_frag:ew,meshtoon_vert:tw,meshtoon_frag:nw,points_vert:iw,points_frag:rw,shadow_vert:sw,shadow_frag:ow,sprite_vert:aw,sprite_frag:lw},qe={common:{diffuse:{value:new $e(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new wt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new wt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new wt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new wt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new wt},normalScale:{value:new Re(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new wt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new wt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new wt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new wt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new $e(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new $e(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0},uvTransform:{value:new wt}},sprite:{diffuse:{value:new $e(16777215)},opacity:{value:1},center:{value:new Re(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}}},Xi={basic:{uniforms:ii([qe.common,qe.specularmap,qe.envmap,qe.aomap,qe.lightmap,qe.fog]),vertexShader:Et.meshbasic_vert,fragmentShader:Et.meshbasic_frag},lambert:{uniforms:ii([qe.common,qe.specularmap,qe.envmap,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.fog,qe.lights,{emissive:{value:new $e(0)}}]),vertexShader:Et.meshlambert_vert,fragmentShader:Et.meshlambert_frag},phong:{uniforms:ii([qe.common,qe.specularmap,qe.envmap,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.fog,qe.lights,{emissive:{value:new $e(0)},specular:{value:new $e(1118481)},shininess:{value:30}}]),vertexShader:Et.meshphong_vert,fragmentShader:Et.meshphong_frag},standard:{uniforms:ii([qe.common,qe.envmap,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.roughnessmap,qe.metalnessmap,qe.fog,qe.lights,{emissive:{value:new $e(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag},toon:{uniforms:ii([qe.common,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.gradientmap,qe.fog,qe.lights,{emissive:{value:new $e(0)}}]),vertexShader:Et.meshtoon_vert,fragmentShader:Et.meshtoon_frag},matcap:{uniforms:ii([qe.common,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.fog,{matc
vendor: 4,821 bytes, line 3477
3477ap:{value:null}}]),vertexShader:Et.meshmatcap_vert,fragmentShader:Et.meshmatcap_frag},points:{uniforms:ii([qe.points,qe.fog]),vertexShader:Et.points_vert,fragmentShader:Et.points_frag},dashed:{uniforms:ii([qe.common,qe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Et.linedashed_vert,fragmentShader:Et.linedashed_frag},depth:{uniforms:ii([qe.common,qe.displacementmap]),vertexShader:Et.depth_vert,fragmentShader:Et.depth_frag},normal:{uniforms:ii([qe.common,qe.bumpmap,qe.normalmap,qe.displacementmap,{opacity:{value:1}}]),vertexShader:Et.meshnormal_vert,fragmentShader:Et.meshnormal_frag},sprite:{uniforms:ii([qe.sprite,qe.fog]),vertexShader:Et.sprite_vert,fragmentShader:Et.sprite_frag},background:{uniforms:{uvTransform:{value:new wt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Et.background_vert,fragmentShader:Et.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Et.backgroundCube_vert,fragmentShader:Et.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Et.cube_vert,fragmentShader:Et.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Et.equirect_vert,fragmentShader:Et.equirect_frag},distanceRGBA:{uniforms:ii([qe.common,qe.displacementmap,{referencePosition:{value:new H},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Et.distanceRGBA_vert,fragmentShader:Et.distanceRGBA_frag},shadow:{uniforms:ii([qe.lights,qe.fog,{color:{value:new $e(0)},opacity:{value:1}}]),vertexShader:Et.shadow_vert,fragmentShader:Et.shadow_frag}};Xi.physical={uniforms:ii([Xi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new wt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new wt},clearcoatNormalScale:{value:new Re(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new wt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new wt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new wt},sheen:{value:0},sheenColor:{value:new $e(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new wt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new wt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new wt},transmissionSamplerSize:{value:new Re},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new wt},attenuationDistance:{value:0},attenuationColor:{value:new $e(0)},specularColor:{value:new $e(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new wt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new wt},anisotropyVector:{value:new Re},anisotropyMap:{value:null},anisotropyMapTransform:{value:new wt}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag};const tu={r:0,b:0,g:0};function cw(s,e,t,n,i,r,o){const a=new $e(0);let c=r===!0?0:1,h,f,d=null,p=0,m=null;function v(y,_){let E=!1,M=_.isScene===!0?_.background:null;M&&M.isTexture&&(M=(_.backgroundBlurriness>0?t:e).get(M)),M===null?S(a,c):M&&M.isColor&&(S(M,1),E=!0);const b=s.xr.getEnvironmentBlendMode();b==="additive"?n.buffers.color.setClear(0,0,0,1,o):b==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(s.autoClear||E)&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),M&&(M.isCubeTexture||M.mapping===fa)?(f===void 0&&(f=new rn(new ao(1,1,1),new lr({name:"BackgroundCubeMaterial",uniforms:ua(Xi.backgroundCube.uniforms),vertexShader:Xi.backgroundCube.vertexShader,fragmentShader:Xi.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(P,R,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(f)),f.material.uniforms.envMap.value=M,f.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,f.material.toneMapped=Bt.getTransfer(M.colorSpace)!==Wt,(d!==M||p!==M.version||m!==s.toneMapping)&&(f.material.needsUpdate=!0,d=M,p=M.version,m=s.toneMapping),f.layers.enableAll(),y.unshift(f,f.geometry,f.material,0,0,null)):M&&M.isTexture&&(h===void 0&&(h=new rn(new hs(2,2),new lr({name:"Backgroun
3477dMaterial",uniforms:ua(Xi.background.uniforms),vertexShader:Xi.background.vertexShader,fragmentShader:Xi.background.fragmentShader,side:Ur,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=M,h.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,h.material.toneMapped=Bt.getTransfer(M.colorSpace)!==Wt,M.matrixAutoUpdate===!0&&M.updateMatrix(),h.material.uniforms.uvTransform.value.copy(M.matrix),(d!==M||p!==M.version||m!==s.toneMapping)&&(h.material.needsUpdate=!0,d=M,p=M.version,m=s.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null))}function S(y,_){y.getRGB(tu,W_(s)),n.buffers.color.setClear(tu.r,tu.g,tu.b,_,o)}return{getClearColor:function(){return a},setClearColor:function(y,_=1){a.set(y),c=_,S(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(y){c=y,S(a,c)},render:v}}function uw(s,e,t,n){const i=s.getParameter(s.MAX_VERTEX_ATTRIBS),r=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||r!==null,a={},c=y(null);let h=c,f=!1;function d(N,q,K,re,Z){let W=!1;if(o){const V=S(re,K,q);h!==V&&(h=V,m(h.object)),W=_(N,re,K,Z),W&&E(N,re,K,Z)}else{const V=q.wireframe===!0;(h.geometry!==re.id||h.program!==K.id||h.wireframe!==V)&&(h.geometry=re.id,h.program=K.id,h.wireframe=V,W=!0)}Z!==null&&t.update(Z,s.ELEMENT_ARRAY_BUFFER),(W||f)&&(f=!1,D(N,q,K,re),Z!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,t.get(Z).buffer))}function p(){return n.isWebGL2?s.createVertexArray():r.createVertexArrayOES()}function m(N){return n.isWebGL2?s.bindVertexArray(N):r.bindVertexArrayOES(N)}function v(N){return n.isWebGL2?s.deleteVertexArray(N):r.deleteVertexArrayOES(N)}function S(N,q,K){const re=K.wireframe===!0;let Z=a[N.id];Z===void 0&&(Z={},a[N.id]=Z);let W=Z[q.id];W===void 0&&(W={},Z[q.id]=W);let V=W[re];return V===void 0&&(V=y(p()),W[re]=V),V}function y(N){const q=[],K=[],re=[];for(let Z=0;Z<i;Z++)q[Z]=0,K[Z]=0,re[Z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:q,enabledAttributes:K,attributeDivisors:re,object:N,attributes:{},index:null}}function _(N,q,K,re){const Z=h.attributes,W=q.attributes;let V=0;const F=K.getAttributes();for(const j in F)if(F[j].location>=0){const $=Z[j];let te=W[j];if(te===void 0&&(j==="instanceMatrix"&&N.instanceMatrix&&(te=N.instanceMatrix),j==="instanceColor"&&N.instanceColor&&(te=N.instanceColor)),$===void 0||$.attribute!==te||te&&$.data!==te.data)return!0;V++}return h.attributesNum!==V||h.index!==re}function E(N,q,K,re){const Z={},W=q.attributes;let V=0;const F=K.getAttributes();for(const j in F)if(F[j].location>=0){let $=W[j];$===void 0&&(j==="instanceMatrix"&&N.instanceMatrix&&($=N.instanceMatrix),j==="instanceColor"&&N.instanceColor&&($=N.instanceColor));const te={};te.attribute=$,$&&$.data&&(te.data=$.data),Z[j]=te,V++}h.attributes=Z,h.attributesNum=V,h.index=re}function M(){const N=h.newAttributes;for(let q=0,K=N.length;q<K;q++)N[q]=0}function b(N){P(N,0)}function P(N,q){const K=h.newAttributes,re=h.enabledAttributes,Z=h.attributeDivisors;K[N]=1,re[N]===0&&(s.enableVertexAttribArray(N),re[N]=1),Z[N]!==q&&((n.isWebGL2?s:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](N,q),Z[N]=q)}function R(){const N=h.newAttributes,q=h.enabledAttributes;for(let K=0,re=q.length;K<re;K++)q[K]!==N[K]&&(s.disableVertexAttribArray(K),q[K]=0)}function L(N,q,K,re,Z,W,V){V===!0?s.vertexAttribIPointer(N,q,K,Z,W):s.vertexAttribPointer(N,q,K,re,Z,W)}function D(N,q,K,re){if(n.isWebGL2===!1&&(N.isInstancedMesh||re.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;M();const Z=re.attributes,W=K.getAttributes(),V=q.defaultAttributeValues;for(const F in W){const j=W[F];if(j.location>=0){let G=Z[F];if(G===void 0&&(F==="instanceMatrix"&&N.instanceMatrix&&(G=N.instanceMatrix),F==="instanceColor"&&N.instanceColor&&(G=N.instanceColor)),G!==void 0){const $=G.normalized,te=G.itemSize,ae=t.get(G);if(ae===void 0)continue;
vendor: 6,338 bytes, line 3477
3477const ne=ae.buffer,pe=ae.type,Ie=ae.bytesPerElement,Pe=n.isWebGL2===!0&&(pe===s.INT||pe===s.UNSIGNED_INT||G.gpuType===dp);if(G.isInterleavedBufferAttribute){const Se=G.data,O=Se.stride,Me=G.offset;if(Se.isInstancedInterleavedBuffer){for(let ue=0;ue<j.locationSize;ue++)P(j.location+ue,Se.meshPerAttribute);N.isInstancedMesh!==!0&&re._maxInstanceCount===void 0&&(re._maxInstanceCount=Se.meshPerAttribute*Se.count)}else for(let ue=0;ue<j.locationSize;ue++)b(j.location+ue);s.bindBuffer(s.ARRAY_BUFFER,ne);for(let ue=0;ue<j.locationSize;ue++)L(j.location+ue,te/j.locationSize,pe,$,O*Ie,(Me+te/j.locationSize*ue)*Ie,Pe)}else{if(G.isInstancedBufferAttribute){for(let Se=0;Se<j.locationSize;Se++)P(j.location+Se,G.meshPerAttribute);N.isInstancedMesh!==!0&&re._maxInstanceCount===void 0&&(re._maxInstanceCount=G.meshPerAttribute*G.count)}else for(let Se=0;Se<j.locationSize;Se++)b(j.location+Se);s.bindBuffer(s.ARRAY_BUFFER,ne);for(let Se=0;Se<j.locationSize;Se++)L(j.location+Se,te/j.locationSize,pe,$,te*Ie,te/j.locationSize*Se*Ie,Pe)}}else if(V!==void 0){const $=V[F];if($!==void 0)switch($.length){case 2:s.vertexAttrib2fv(j.location,$);break;case 3:s.vertexAttrib3fv(j.location,$);break;case 4:s.vertexAttrib4fv(j.location,$);break;default:s.vertexAttrib1fv(j.location,$)}}}}R()}function A(){B();for(const N in a){const q=a[N];for(const K in q){const re=q[K];for(const Z in re)v(re[Z].object),delete re[Z];delete q[K]}delete a[N]}}function C(N){if(a[N.id]===void 0)return;const q=a[N.id];for(const K in q){const re=q[K];for(const Z in re)v(re[Z].object),delete re[Z];delete q[K]}delete a[N.id]}function k(N){for(const q in a){const K=a[q];if(K[N.id]===void 0)continue;const re=K[N.id];for(const Z in re)v(re[Z].object),delete re[Z];delete K[N.id]}}function B(){ee(),f=!0,h!==c&&(h=c,m(h.object))}function ee(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:d,reset:B,resetDefaultState:ee,dispose:A,releaseStatesOfGeometry:C,releaseStatesOfProgram:k,initAttributes:M,enableAttribute:b,disableUnusedAttributes:R}}function hw(s,e,t,n){const i=n.isWebGL2;let r;function o(f){r=f}function a(f,d){s.drawArrays(r,f,d),t.update(d,r,1)}function c(f,d,p){if(p===0)return;let m,v;if(i)m=s,v="drawArraysInstanced";else if(m=e.get("ANGLE_instanced_arrays"),v="drawArraysInstancedANGLE",m===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[v](r,f,d,p),t.update(d,r,p)}function h(f,d,p){if(p===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let v=0;v<p;v++)this.render(f[v],d[v]);else{m.multiDrawArraysWEBGL(r,f,0,d,0,p);let v=0;for(let S=0;S<p;S++)v+=d[S];t.update(v,r,1)}}this.setMode=o,this.render=a,this.renderInstances=c,this.renderMultiDraw=h}function fw(s,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");n=s.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function r(L){if(L==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&s.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const c=r(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);const h=o||e.has("WEBGL_draw_buffers"),f=t.logarithmicDepthBuffer===!0,d=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),p=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=s.getParameter(s.MAX_TEXTURE_SIZE),v=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),S=s.getParameter(s.MAX_VERTEX_ATTRIBS),y=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),_=s.getParameter(s.MAX_VARYING_VECTORS),E=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),M=p>0,b=o||e.has("OES_texture_float"),P=M&&b,R=o?s.getParameter(s.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:h,getMaxAnisotropy:i,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:f,maxTextures:d,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:v,maxAttributes:S,maxVertexUniforms:y,maxVaryings:_,maxFragmentUniforms:E,vertexTextures:M,floatFragmentTextures:b,floatVertexTextures:P,maxSamples:R}}function dw(s){const e=this;let t=null,n=0,i=!1,r=!1;const o=new Cr,a=new wt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(d,p){const m=d.length!==0||p||n!==0||i;return i=p,n=d.length,m},this.beginShadows=function(){r=!0,f(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(d,p){t=f(d,p,0)},this.setState=function(d,p,m){const v=d.clippingPlanes,S=d.clipIntersection,y=d.clipShadows,_=s.get(d);if(!i||v===null||v.length===0||r&&!y)r?f(null):h();else{const E=r?0:n,M=E*4;let b=_.clippingState||null;c.value=b,b=f(v,p,M,m);for(let P=0;P!==M;++P)b[P]=t[P];_.clippingState=b,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=E}};function h(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function f(d,p,m,v){const S=d!==null?d.length:0;let y=null;if(S!==0){if(y=c.value,v!==!0||y===null){const _=m+S*4,E=p.matrixWorldInverse;a.getNormalMatrix(E),(y===null||y.length<_)&&(y=new Float32Array(_));for(let M=0,b=m;M!==S;++M,b+=4)o.copy(d[M]).applyMatrix4(E,a),o.normal.toArray(y,b),y[b+3]=o.constant}c.value=y,c.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,y}}function pw(s){let e=new WeakMap;function t(o,a){return a===pl?o.mapping=Dr:a===ml&&(o.mapping=ls),o}function n(o){if(o&&o.isTexture){const a=o.mapping;if(a===pl||a===ml)if(e.has(o)){const c=e.get(o).texture;return t(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const h=new Y_(c.height/2);return h.fromEquirectangularTexture(s,o),e.set(o,h),o.addEventListener("dispose",i),t(h.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}class os extends Ol{constructor(e=-1,t=1,n=1,i=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
3477phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,o=n+e,a=i+t,c=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;r+=h*this.view.offsetX,o=r+h*this.view.width,a-=f*this.view.offsetY,c=a-f*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const ta=4,Zg=[.125,.215,.35,.446,.526,.582],Ys=20,Of=new os,Jg=new $e;let Bf=null,kf=0,zf=0;const Xs=(1+Math.sqrt(5))/2,Go=1/Xs,Kg=[new H(1,1,1),new H(-1,1,1),new H(1,1,-1),new H(-1,1,-1),new H(0,Xs,Go),new H(0,Xs,-Go),new H(Go,0,Xs),new H(-Go,0,Xs),new H(Xs,Go,0),new H(-Xs,Go,0)];class Zd{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){Bf=this._renderer.getRenderTarget(),kf=this._renderer.getActiveCubeFace(),zf=this._renderer.getActiveMipmapLevel(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=e0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=$g(),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(Bf,kf,zf),e.scissorTest=!1,nu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Dr||e.mapping===ls?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Bf=this._renderer.getRenderTarget(),kf=this._renderer.getActiveCubeFace(),zf=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Kt,minFilter:Kt,generateMipmaps:!1,type:aa,format:ri,colorSpace:ar,depthBuffer:!1},i=Qg(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Qg(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=mw(r)),this._blurMaterial=gw(r,e,t)}return i}_compileMaterial(e){const t=new rn(this._lodPlanes[0],e);this._renderer.compile(t,Of)}_sceneToCubeUV(e,t,n,i){const a=new fn(90,1,t,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],f=this._renderer,d=f.autoClear,p=f.toneMapping;f.getClearColor(Jg),f.toneMapping=rr,f.autoClear=!1;
vendor: 5,406 bytes, lines 3477-3552
3477const m=new Br({name:"PMREM.Background",side:si,depthWrite:!1,depthTest:!1}),v=new rn(new ao,m);let S=!1;const y=e.background;y?y.isColor&&(m.color.copy(y),e.background=null,S=!0):(m.color.copy(Jg),S=!0);for(let _=0;_<6;_++){const E=_%3;E===0?(a.up.set(0,c[_],0),a.lookAt(h[_],0,0)):E===1?(a.up.set(0,0,c[_]),a.lookAt(0,h[_],0)):(a.up.set(0,c[_],0),a.lookAt(0,0,h[_]));const M=this._cubeSize;nu(i,E*M,_>2?M:0,M,M),f.setRenderTarget(i),S&&f.render(v,a),f.render(e,a)}v.geometry.dispose(),v.material.dispose(),f.toneMapping=p,f.autoClear=d,e.background=y}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Dr||e.mapping===ls;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=e0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=$g());const r=i?this._cubemapMaterial:this._equirectMaterial,o=new rn(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const c=this._cubeSize;nu(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(o,Of)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const r=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),o=Kg[(i-1)%Kg.length];this._blur(e,i-1,i,r,o)}t.autoClear=n}_blur(e,t,n,i,r){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",r),this._halfBlur(o,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,o,a){const c=this._renderer,h=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const f=3,d=new rn(this._lodPlanes[i],h),p=h.uniforms,m=this._sizeLods[n]-1,v=isFinite(r)?Math.PI/(2*m):2*Math.PI/(2*Ys-1),S=r/v,y=isFinite(r)?1+Math.floor(f*S):Ys;y>Ys&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${Ys}`);const _=[];let E=0;for(let L=0;L<Ys;++L){const D=L/S,A=Math.exp(-D*D/2);_.push(A),L===0?E+=A:L<y&&(E+=2*A)}for(let L=0;L<_.length;L++)_[L]=_[L]/E;p.envMap.value=e.texture,p.samples.value=y,p.weights.value=_,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);const{_lodMax:M}=this;p.dTheta.value=v,p.mipInt.value=M-n;const b=this._sizeLods[i],P=3*b*(i>M-ta?i-M+ta:0),R=4*(this._cubeSize-b);nu(t,P,R,3*b,2*b),c.setRenderTarget(t),c.render(d,Of)}}function mw(s){const e=[],t=[],n=[];let i=s;const r=s-ta+1+Zg.length;for(let o=0;o<r;o++){const a=Math.pow(2,i);t.push(a);let c=1/a;o>s-ta?c=Zg[o-s+ta-1]:o===0&&(c=0),n.push(c);const h=1/(a-2),f=-h,d=1+h,p=[f,f,d,f,d,d,f,f,d,d,f,d],m=6,v=6,S=3,y=2,_=1,E=new Float32Array(S*v*m),M=new Float32Array(y*v*m),b=new Float32Array(_*v*m);for(let R=0;R<m;R++){const L=R%3*2/3-1,D=R>2?0:-1,A=[L,D,0,L+2/3,D,0,L+2/3,D+1,0,L,D,0,L+2/3,D+1,0,L,D+1,0];E.set(A,S*v*R),M.set(p,y*v*R);const C=[R,R,R,R,R,R];b.set(C,_*v*R)}const P=new Tt;P.setAttribute("position",new kt(E,S)),P.setAttribute("uv",new kt(M,y)),P.setAttribute("faceIndex",new kt(b,_)),e.push(P),i>ta&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Qg(s,e,t){const n=new qi(s,e,t);return n.texture.mapping=fa,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function nu(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function gw(s,e,t){const n=new Float32Array(Ys),i=new H(0,1,0);return new lr({name:"SphericalGaussianBlur",defines:{n:Ys,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Pp(),fragmentShader:` 3478 3479 precision mediump float; 3480 precision mediump int; 3481 3482 varying vec3 vOutputDirection; 3483 3484 uniform sampler2D envMap; 3485 uniform int samples; 3486 uniform float weights[ n ]; 3487 uniform bool latitudinal; 3488 uniform float dTheta; 3489 uniform float mipInt; 3490 uniform vec3 poleAxis; 3491 3492 #define ENVMAP_TYPE_CUBE_UV 3493 #include <cube_uv_reflection_fragment> 3494 3495 vec3 getSample( float theta, vec3 axis ) { 3496 3497 float cosTheta = cos( theta ); 3498 // Rodrigues' axis-angle rotation 3499 vec3 sampleDirection = vOutputDirection * cosTheta 3500 + cross( axis, vOutputDirection ) * sin( theta ) 3501 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3502 3503 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3504 3505 } 3506 3507 void main() { 3508 3509 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3510 3511 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3512 3513 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3514 3515 } 3516 3517 axis = normalize( axis ); 3518 3519 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3520 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3521 3522 for ( int i = 1; i < n; i++ ) { 3523 3524 if ( i >= samples ) { 3525 3526 break; 3527 3528 } 3529 3530 float theta = dTheta * float( i ); 3531 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3532 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3533 3534 } 3535 3536 } 3537 `,blending:Ir,depthTest:!1,depthWrite:!1})}function $g(){return new lr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Pp(),fragmentShader:` 3538 3539 precision mediump float; 3540 precision mediump int; 3541 3542 varying vec3 vOutputDirection; 3543 3544 uniform sampler2D envMap; 3545 3546 #include <common> 3547 3548 void main() { 3549 3550 vec3 outputDirection = normalize( vOutputDirection ); 3551 vec2 uv = equirectUv( outputDirection ); 3552
3553 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3554 3555 } 3556 `,blending:Ir,depthTest:!1,depthWrite:!1})}function e0(){return new lr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Pp(),fragmentShader:` 3557 3558 precision mediump float; 3559 precision mediump int; 3560 3561 uniform float flipEnvMap; 3562 3563 varying vec3 vOutputDirection; 3564 3565 uniform samplerCube envMap; 3566 3567 void main() { 3568 3569 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3570 3571 } 3572 `,blending:Ir,depthTest:!1,depthWrite:!1})}function Pp(){return` 3573 3574 precision mediump float; 3575 precision mediump int; 3576 3577 attribute float faceIndex; 3578 3579 varying vec3 vOutputDirection; 3580 3581 // RH coordinate system; PMREM face-indexing convention 3582 vec3 getDirection( vec2 uv, float face ) { 3583 3584 uv = 2.0 * uv - 1.0; 3585 3586 vec3 direction = vec3( uv, 1.0 ); 3587 3588 if ( face == 0.0 ) { 3589 3590 direction = direction.zyx; // ( 1, v, u ) pos x 3591 3592 } else if ( face == 1.0 ) { 3593 3594 direction = direction.xzy; 3595 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3596 3597 } else if ( face == 2.0 ) { 3598 3599 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3600 3601 } else if ( face == 3.0 ) { 3602 3603 direction = direction.zyx; 3604 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3605 3606 } else if ( face == 4.0 ) { 3607 3608 direction = direction.xzy; 3609 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3610 3611 } else if ( face == 5.0 ) { 3612 3613 direction.z *= -1.0; // ( u, v, -1 ) neg z 3614 3615 } 3616 3617 return direction; 3618 3619 } 3620 3621 void main() { 3622 3623 vOutputDirection = getDirection( uv, faceIndex ); 3624 gl_Position = vec4( position, 1.0 ); 3625 3626 } 3627 `}function vw(s){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const c=a.mapping,h=c===pl||c===ml,f=c===Dr||c===ls;if(h||f)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let d=e.get(a);return t===null&&(t=new Zd(s)),d=h?t.fromEquirectangular(a,d):t.fromCubemap(a,d),e.set(a,d),d.texture}else{if(e.has(a))return e.get(a).texture;{const d=a.image;if(h&&d&&d.height>0||f&&d&&i(d)){t===null&&(t=new Zd(s));const p=h?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,p),a.addEventListener("dispose",r),p.texture}else return null}}}return a}function i(a){let c=0;const h=6;for(let f=0;f<h;f++)a[f]!==void 0&&c++;return c===h}function r(a){const c=a.target;c.removeEventListener("dispose",r);const h=e.get(c);h!==void 0&&(e.delete(c),h.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function _w(s){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=s.getExtension("WEBGL_depth_texture")||s.getExtension("MOZ_WEBGL_depth_texture")||s.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=s.getExtension("WEBGL_compressed_texture_s3tc")||s.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=s.getExtension("WEBGL_compressed_texture_pvrtc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=s.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function yw(s,e,t,n){const i={},r=new WeakMap;function o(d){const p=d.target;p.index!==null&&e.remove(p.index);for(const v in p.attributes)e.remove(p.attributes[v]);for(const v in p.morphAttributes){const S=p.morphAttributes[v];for(let y=0,_=S.length;y<_;y++)e.remove(S[y])}p.removeEventListener("dispose",o),delete i[p.id];const m=r.get(p);m&&(e.remove(m),r.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function a(d,p){return i[p.id]===!0||(p.addEventListener("dispose",o),i[p.id]=!0,t.memory.geometries++),p}function c(d){const p=d.attributes;for(const v in p)e.update(p[v],s.ARRAY_BUFFER);const m=d.morphAttributes;for(const v in m){const S=m[v];for(let y=0,_=S.length;y<_;y++)e.update(S[y],s.ARRAY_BUFFER)}}function h(d){const p=[],m=d.index,v=d.attributes.position;let S=0;if(m!==null){const E=m.array;S=m.version;for(let M=0,b=E.length;M<b;M+=3){const P=E[M+0],R=E[M+1],L=E[M+2];p.push(P,R,R,L,L,P)}}else if(v!==void 0){const E=v.array;S=v.version;for(let M=0,b=E.length/3-1;M<b;M+=3){const P=M+0,R=M+1,L=M+2;p.push(P,R,R,L,L,P)}}else return;const y=new(z_(p)?Cp:Ap)(p,1);y.version=S;const _=r.get(d);_&&e.remove(_),r.set(d,y)}function f(d){const p=r.get(d);if(p){const m=d.index;m!==null&&p.version<m.version&&h(d)}else h(d);return r.get(d)}return{get:a,update:c,getWireframeAttribute:f}}
3627function xw(s,e,t,n){const i=n.isWebGL2;let r;function o(m){r=m}let a,c;function h(m){a=m.type,c=m.bytesPerElement}function f(m,v){s.drawElements(r,v,a,m*c),t.update(v,r,1)}function d(m,v,S){if(S===0)return;let y,_;if(i)y=s,_="drawElementsInstanced";else if(y=e.get("ANGLE_instanced_arrays"),_="drawElementsInstancedANGLE",y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[_](r,v,a,m*c,S),t.update(v,r,S)}function p(m,v,S){if(S===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let _=0;_<S;_++)this.render(m[_]/c,v[_]);else{y.multiDrawElementsWEBGL(r,v,0,a,m,0,S);let _=0;for(let E=0;E<S;E++)_+=v[E];t.update(_,r,1)}}this.setMode=o,this.setIndex=h,this.render=f,this.renderInstances=d,this.renderMultiDraw=p}function Sw(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,o,a){switch(t.calls++,o){case s.TRIANGLES:t.triangles+=a*(r/3);break;case s.LINES:t.lines+=a*(r/2);break;case s.LINE_STRIP:t.lines+=a*(r-1);break;case s.LINE_LOOP:t.lines+=a*r;break;case s.POINTS:t.points+=a*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);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 Mw(s,e){return s[0]-e[0]}function Ew(s,e){return Math.abs(e[1])-Math.abs(s[1])}function ww(s,e,t){const n={},i=new Float32Array(8),r=new WeakMap,o=new Ft,a=[];for(let h=0;h<8;h++)a[h]=[h,0];function c(h,f,d){const p=h.morphTargetInfluences;if(e.isWebGL2===!0){const m=f.morphAttributes.position||f.morphAttributes.normal||f.morphAttributes.color,v=m!==void 0?m.length:0;let S=r.get(f);if(S===void 0||S.count!==v){let N=function(){B.dispose(),r.delete(f),f.removeEventListener("dispose",N)};S!==void 0&&S.texture.dispose();const E=f.morphAttributes.position!==void 0,M=f.morphAttributes.normal!==void 0,b=f.morphAttributes.color!==void 0,P=f.morphAttributes.position||[],R=f.morphAttributes.normal||[],L=f.morphAttributes.color||[];let D=0;E===!0&&(D=1),M===!0&&(D=2),b===!0&&(D=3);let A=f.attributes.position.count*D,C=1;A>e.maxTextureSize&&(C=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const k=new Float32Array(A*C*4*v),B=new nh(k,A,C,v);B.type=Yi,B.needsUpdate=!0;const ee=D*4;for(let q=0;q<v;q++){const K=P[q],re=R[q],Z=L[q],W=A*C*4*q;for(let V=0;V<K.count;V++){const F=V*ee;E===!0&&(o.fromBufferAttribute(K,V),k[W+F+0]=o.x,k[W+F+1]=o.y,k[W+F+2]=o.z,k[W+F+3]=0),M===!0&&(o.fromBufferAttribute(re,V),k[W+F+4]=o.x,k[W+F+5]=o.y,k[W+F+6]=o.z,k[W+F+7]=0),b===!0&&(o.fromBufferAttribute(Z,V),k[W+F+8]=o.x,k[W+F+9]=o.y,k[W+F+10]=o.z,k[W+F+11]=Z.itemSize===4?o.w:1)}}S={count:v,texture:B,size:new Re(A,C)},r.set(f,S),f.addEventListener("dispose",N)}let y=0;for(let E=0;E<p.length;E++)y+=p[E];const _=f.morphTargetsRelative?1:1-y;d.getUniforms().setValue(s,"morphTargetBaseInfluence",_),d.getUniforms().setValue(s,"morphTargetInfluences",p),d.getUniforms().setValue(s,"morphTargetsTexture",S.texture,t),d.getUniforms().setValue(s,"morphTargetsTextureSize",S.size)}else{const m=p===void 0?0:p.length;let v=n[f.id];if(v===void 0||v.length!==m){v=[];for(let M=0;M<m;M++)v[M]=[M,0];n[f.id]=v}for(let M=0;M<m;M++){const b=v[M];b[0]=M,b[1]=p[M]}v.sort(Ew);for(let M=0;M<8;M++)M<m&&v[M][1]?(a[M][0]=v[M][0],a[M][1]=v[M][1]):(a[M][0]=Number.MAX_SAFE_INTEGER,a[M][1]=0);a.sort(Mw);const S=f.morphAttributes.position,y=f.morphAttributes.normal;let _=0;for(let M=0;M<8;M++){const b=a[M],P=b[0],R=b[1];P!==Number.MAX_SAFE_INTEGER&&R?(S&&f.getAttribute("morphTarget"+M)!==S[P]&&f.setAttribute("morphTarget"+M,S[P]),y&&f.getAttribute("morphNormal"+M)!==y[P]&&f.setAttribute("morphNormal"+M,y[P]),i[M]=R,_+=R):(S&&f.hasAttribute("morphTarget"+M)===!0&&f.deleteAttribute("morphTarget"+M),y&&f.hasAttribute("morphNormal"+M)===!0&&f.deleteAttribute("morphNormal"+M),i[M]=0)}const E=f.morphTargetsRelative?1:1-_;d.getUniforms().setValue(s,"morphTargetBaseInfluence",E),d.getUniforms().setValue(s,"morphTargetInfluences",i)}}return{update:c}}function bw(s,e,t,n){let i=new WeakMap;function r(c){const h=n.render.frame,f=c.geometry,d=e.get(c,f);
vendor: 22,206 bytes, lines 3627-3647
3627if(i.get(d)!==h&&(e.update(d),i.set(d,h)),c.isInstancedMesh&&(c.hasEventListener("dispose",a)===!1&&c.addEventListener("dispose",a),i.get(c)!==h&&(t.update(c.instanceMatrix,s.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,s.ARRAY_BUFFER),i.set(c,h))),c.isSkinnedMesh){const p=c.skeleton;i.get(p)!==h&&(p.update(),i.set(p,h))}return d}function o(){i=new WeakMap}function a(c){const h=c.target;h.removeEventListener("dispose",a),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:r,dispose:o}}class Lp extends sn{constructor(e,t,n,i,r,o,a,c,h,f){if(f=f!==void 0?f:rs,f!==rs&&f!==no)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&f===rs&&(n=Pr),n===void 0&&f===no&&(n=is),super(null,i,r,o,a,c,f,n,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:hn,this.minFilter=c!==void 0?c:hn,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 q_=new sn,Z_=new Lp(1,1);Z_.compareFunction=Ep;const J_=new nh,K_=new Tp,Q_=new Bl,t0=[],n0=[],i0=new Float32Array(16),r0=new Float32Array(9),s0=new Float32Array(4);function da(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let r=t0[i];if(r===void 0&&(r=new Float32Array(i),t0[i]=r),e!==0){n.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,s[o].toArray(r,a)}return r}function xn(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function Sn(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function ih(s,e){let t=n0[e];t===void 0&&(t=new Int32Array(e),n0[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function Tw(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function Aw(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(xn(t,e))return;s.uniform2fv(this.addr,e),Sn(t,e)}}function Cw(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(xn(t,e))return;s.uniform3fv(this.addr,e),Sn(t,e)}}function Rw(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(xn(t,e))return;s.uniform4fv(this.addr,e),Sn(t,e)}}function Pw(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(xn(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),Sn(t,e)}else{if(xn(t,n))return;s0.set(n),s.uniformMatrix2fv(this.addr,!1,s0),Sn(t,n)}}function Lw(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(xn(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),Sn(t,e)}else{if(xn(t,n))return;r0.set(n),s.uniformMatrix3fv(this.addr,!1,r0),Sn(t,n)}}function Iw(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(xn(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),Sn(t,e)}else{if(xn(t,n))return;i0.set(n),s.uniformMatrix4fv(this.addr,!1,i0),Sn(t,n)}}function Uw(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function Dw(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(xn(t,e))return;s.uniform2iv(this.addr,e),Sn(t,e)}}function Nw(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(xn(t,e))return;s.uniform3iv(this.addr,e),Sn(t,e)}}function Fw(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(xn(t,e))return;s.uniform4iv(this.addr,e),Sn(t,e)}}function Ow(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function Bw(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(xn(t,e))return;s.uniform2uiv(this.addr,e),Sn(t,e)}}function kw(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(xn(t,e))return;s.uniform3uiv(this.addr,e),Sn(t,e)}}function zw(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(xn(t,e))return;s.uniform4uiv(this.addr,e),Sn(t,e)}}function Gw(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);const r=this.type===s.SAMPLER_2D_SHADOW?Z_:q_;t.setTexture2D(e||r,i)}function Hw(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||K_,i)}function Vw(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Q_,i)}function Ww(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||J_,i)}function Xw(s){switch(s){case 5126:return Tw;case 35664:return Aw;case 35665:return Cw;case 35666:return Rw;case 35674:return Pw;case 35675:return Lw;case 35676:return Iw;case 5124:case 35670:return Uw;case 35667:case 35671:return Dw;case 35668:case 35672:return Nw;case 35669:case 35673:return Fw;case 5125:return Ow;case 36294:return Bw;case 36295:return kw;case 36296:return zw;case 35678:case 36198:case 36298:case 36306:case 35682:return Gw;case 35679:case 36299:case 36307:return Hw;case 35680:case 36300:case 36308:case 36293:return Vw;case 36289:case 36303:case 36311:case 36292:return Ww}}function Yw(s,e){s.uniform1fv(this.addr,e)}function jw(s,e){const t=da(e,this.size,2);s.uniform2fv(this.addr,t)}function qw(s,e){const t=da(e,this.size,3);s.uniform3fv(this.addr,t)}function Zw(s,e){const t=da(e,this.size,4);s.uniform4fv(this.addr,t)}function Jw(s,e){const t=da(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function Kw(s,e){const t=da(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function Qw(s,e){const t=da(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function $w(s,e){s.uniform1iv(this.addr,e)}function eb(s,e){s.uniform2iv(this.addr,e)}function tb(s,e){s.uniform3iv(this.addr,e)}function nb(s,e){s.uniform4iv(this.addr,e)}function ib(s,e){s.uniform1uiv(this.addr,e)}function rb(s,e){s.uniform2uiv(this.addr,e)}function sb(s,e){s.uniform3uiv(this.addr,e)}function ob(s,e){s.uniform4uiv(this.addr,e)}function ab(s,e,t){const n=this.cache,i=e.length,r=ih(t,i);xn(n,r)||(s.uniform1iv(this.addr,r),Sn(n,r));for(let o=0;o!==i;++o)t.setTexture2D(e[o]||q_,r[o])}function lb(s,e,t){const n=this.cache,i=e.length,r=ih(t,i);xn(n,r)||(s.uniform1iv(this.addr,r),Sn(n,r));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||K_,r[o])}function cb(s,e,t){const n=this.cache,i=e.length,r=ih(t,i);xn(n,r)||(s.uniform1iv(this.addr,r),Sn(n,r));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||Q_,r[o])}function ub(s,e,t){const n=this.cache,i=e.length,r=ih(t,i);xn(n,r)||(s.uniform1iv(this.addr,r),Sn(n,r));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||J_,r[o])}function hb(s){switch(s){case 5126:return Yw;case 35664:return jw;case 35665:return qw;case 35666:return Zw;case 35674:return Jw;case 35675:return Kw;case 35676:return Qw;case 5124:case 35670:return $w;case 35667:case 35671:return eb;case 35668:case 35672:return tb;case 35669:case 35673:return nb;case 5125:return ib;case 36294:return rb;case 36295:return sb;case 36296:return ob;case 35678:case 36198:case 36298:case 36306:case 35682:return ab;case 35679:case 36299:case 36307:return lb;case 35680:case 36300:case 36308:case 36293:return cb;case 36289:case 36303:case 36311:case 36292:return ub}}class fb{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Xw(t.type)}}class db{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=hb(t.type)}}class pb{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,o=i.length;r!==o;++r){const a=i[r];a.setValue(e,t[a.id],n)}}}const Gf=/(\w+)(\])?(\[|\.)?/g;function o0(s,e){s.seq.push(e),s.map[e.id]=e}function mb(s,e,t){const n=s.name,i=n.length;for(Gf.lastIndex=0;;){const r=Gf.exec(n),o=Gf.lastIndex;let a=r[1];const c=r[2]==="]",h=r[3];if(c&&(a=a|0),h===void 0||h==="["&&o+2===i){o0(t,h===void 0?new fb(a,s,e):new db(a,s,e));break}else{let d=t.map[a];d===void 0&&(d=new pb(a),o0(t,d)),t=d}}}class ku{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const r=e.getActiveUniform(t,i),o=e.getUniformLocation(t,r.name);mb(r,o,this)}}setValue(e,t,n,i){const r=this.map[t];r!==void 0&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,o=t.length;r!==o;++r){const a=t[r],c=n[a.id];c.needsUpdate!==!1&&a.setValue(e,c.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const o=e[i];o.id in t&&n.push(o)}return n}}function a0(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const gb=37297;let vb=0;function _b(s,e){const t=s.split(` 3628`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let o=i;o<r;o++){const a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(` 3629`)}function yb(s){const e=Bt.getPrimaries(Bt.workingColorSpace),t=Bt.getPrimaries(s);let n;switch(e===t?n="":e===El&&t===Ml?n="LinearDisplayP3ToLinearSRGB":e===Ml&&t===El&&(n="LinearSRGBToLinearDisplayP3"),s){case ar:case Nl:return[n,"LinearTransferOETF"];case yn:case th:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",s),[n,"LinearTransferOETF"]}}function l0(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),i=s.getShaderInfoLog(e).trim();if(n&&i==="")return"";const r=/ERROR: 0:(\d+)/.exec(i);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` 3630 3631`+i+` 3632 3633`+_b(s.getShaderSource(e),o)}else return i}function xb(s,e){const t=yb(e);return`vec4 ${s}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function Sb(s,e){let t;switch(e){case p_:t="Linear";break;case m_:t="Reinhard";break;case g_:t="OptimizedCineon";break;case hp:t="ACESFilmic";break;case __:t="AgX";break;case v_:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Mb(s){return[s.extensionDerivatives||s.envMapCubeUVHeight||s.bumpMap||s.normalMapTangentSpace||s.clearcoatNormalMap||s.flatShading||s.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(s.extensionFragDepth||s.logarithmicDepthBuffer)&&s.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",s.extensionDrawBuffers&&s.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(s.extensionShaderTextureLOD||s.envMap||s.transmission)&&s.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(na).join(` 3634`)}function Eb(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":""].filter(na).join(` 3635`)}function wb(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3636`)}function bb(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const r=s.getActiveAttrib(e,i),o=r.name;let a=1;r.type===s.FLOAT_MAT2&&(a=2),r.type===s.FLOAT_MAT3&&(a=3),r.type===s.FLOAT_MAT4&&(a=4),t[o]={type:r.type,location:s.getAttribLocation(e,o),locationSize:a}}return t}function na(s){return s!==""}function c0(s,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.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 u0(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Tb=/^[ \t]*#include +<([\w\d./]+)>/gm;function Jd(s){return s.replace(Tb,Cb)}const Ab=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Cb(s,e){let t=Et[e];if(t===void 0){const n=Ab.get(e);if(n!==void 0)t=Et[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 Jd(t)}const Rb=/#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 h0(s){return s.replace(Rb,Pb)}function Pb(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function f0(s){let e="precision "+s.precision+` float; 3637precision `+s.precision+" int;";return s.precision==="highp"?e+=` 3638#define HIGH_PRECISION`:s.precision==="mediump"?e+=` 3639#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=` 3640#define LOW_PRECISION`),e}function Lb(s){let e="SHADOWMAP_TYPE_BASIC";return s.shadowMapType===Ku?e="SHADOWMAP_TYPE_PCF":s.shadowMapType===rl?e="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===Wi&&(e="SHADOWMAP_TYPE_VSM"),e}function Ib(s){let e="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case Dr:case ls:e="ENVMAP_TYPE_CUBE";break;case fa:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Ub(s){let e="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case ls:e="ENVMAP_MODE_REFRACTION";break}return e}function Db(s){let e="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case Dl:e="ENVMAP_BLENDING_MULTIPLY";break;case f_:e="ENVMAP_BLENDING_MIX";break;case d_:e="ENVMAP_BLENDING_ADD";break}return e}function Nb(s){const e=s.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function Fb(s,e,t,n){const i=s.getContext(),r=t.defines;let o=t.vertexShader,a=t.fragmentShader;const c=Lb(t),h=Ib(t),f=Ub(t),d=Db(t),p=Nb(t),m=t.isWebGL2?"":Mb(t),v=Eb(t),S=wb(r),y=i.createProgram();let _,E,M=t.glslVersion?"#version "+t.glslVersion+` 3641`:"";t.isRawShaderMaterial?(_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S].filter(na).join(` 3642`),_.length>0&&(_+=` 3643`),E=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S].filter(na).join(` 3644`),E.length>0&&(E+=` 3645`)):(_=[f0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+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&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3646`].filter(na).join(` 3647`),E=[m,f0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+f:"",t.envMap?"#define "+d:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IR
3647IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==rr?"#define TONE_MAPPING":"",t.toneMapping!==rr?Et.tonemapping_pars_fragment:"",t.toneMapping!==rr?Sb("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Et.colorspace_pars_fragment,xb("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3648`].filter(na).join(` 3649`)),o=Jd(o),o=c0(o,t),o=u0(o,t),a=Jd(a),a=c0(a,t),a=u0(a,t),o=h0(o),a=h0(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(M=`#version 300 es 3650`,_=[v,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` 3651`)+` 3652`+_,E=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===jd?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===jd?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` 3653`)+` 3654`+E);const b=M+_+o,P=M+E+a,R=a0(i,i.VERTEX_SHADER,b),L=a0(i,i.FRAGMENT_SHADER,P);i.attachShader(y,R),i.attachShader(y,L),t.index0AttributeName!==void 0?i.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);function D(B){if(s.debug.checkShaderErrors){const ee=i.getProgramInfoLog(y).trim(),N=i.getShaderInfoLog(R).trim(),q=i.getShaderInfoLog(L).trim();let K=!0,re=!0;if(i.getProgramParameter(y,i.LINK_STATUS)===!1)if(K=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,y,R,L);else{const Z=l0(i,R,"vertex"),W=l0(i,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(y,i.VALIDATE_STATUS)+` 3655 3656Program Info Log: `+ee+` 3657`+Z+` 3658`+W)}else ee!==""?console.warn("THREE.WebGLProgram: Program Info Log:",ee):(N===""||q==="")&&(re=!1);re&&(B.diagnostics={runnable:K,programLog:ee,vertexShader:{log:N,prefix:_},fragmentShader:{log:q,prefix:E}})}i.deleteShader(R),i.deleteShader(L),A=new ku(i,y),C=bb(i,y)}let A;this.getUniforms=function(){return A===void 0&&D(this),A};let C;this.getAttributes=function(){return C===void 0&&D(this),C};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(y,gb)),
vendor: 7,541 bytes, line 3658
3658k},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=vb++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=R,this.fragmentShader=L,this}let Ob=0;class Bb{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new kb(e),t.set(e,n)),n}}class kb{constructor(e){this.id=Ob++,this.code=e,this.usedTimes=0}}function zb(s,e,t,n,i,r,o){const a=new $s,c=new Bb,h=[],f=i.isWebGL2,d=i.logarithmicDepthBuffer,p=i.vertexTextures;let m=i.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function S(A){return A===0?"uv":`uv${A}`}function y(A,C,k,B,ee){const N=B.fog,q=ee.geometry,K=A.isMeshStandardMaterial?B.environment:null,re=(A.isMeshStandardMaterial?t:e).get(A.envMap||K),Z=re&&re.mapping===fa?re.image.height:null,W=v[A.type];A.precision!==null&&(m=i.getMaxPrecision(A.precision),m!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const V=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,F=V!==void 0?V.length:0;let j=0;q.morphAttributes.position!==void 0&&(j=1),q.morphAttributes.normal!==void 0&&(j=2),q.morphAttributes.color!==void 0&&(j=3);let G,$,te,ae;if(W){const At=Xi[W];G=At.vertexShader,$=At.fragmentShader}else G=A.vertexShader,$=A.fragmentShader,c.update(A),te=c.getVertexShaderID(A),ae=c.getFragmentShaderID(A);const ne=s.getRenderTarget(),pe=ee.isInstancedMesh===!0,Ie=ee.isBatchedMesh===!0,Pe=!!A.map,Se=!!A.matcap,O=!!re,Me=!!A.aoMap,ue=!!A.lightMap,de=!!A.bumpMap,oe=!!A.normalMap,Ue=!!A.displacementMap,fe=!!A.emissiveMap,U=!!A.metalnessMap,I=!!A.roughnessMap,X=A.anisotropy>0,ye=A.clearcoat>0,ce=A.iridescence>0,he=A.sheen>0,Te=A.transmission>0,Ne=X&&!!A.anisotropyMap,Ce=ye&&!!A.clearcoatMap,De=ye&&!!A.clearcoatNormalMap,ke=ye&&!!A.clearcoatRoughnessMap,xe=ce&&!!A.iridescenceMap,it=ce&&!!A.iridescenceThicknessMap,tt=he&&!!A.sheenColorMap,Xe=he&&!!A.sheenRoughnessMap,ze=!!A.specularMap,Le=!!A.specularColorMap,Q=!!A.specularIntensityMap,we=Te&&!!A.transmissionMap,We=Te&&!!A.thicknessMap,Be=!!A.gradientMap,ge=!!A.alphaMap,J=A.alphaTest>0,Ge=!!A.alphaHash,Fe=!!A.extensions,He=!!q.attributes.uv1,je=!!q.attributes.uv2,rt=!!q.attributes.uv3;let Ze=rr;return A.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(Ze=s.toneMapping),{isWebGL2:f,shaderID:W,shaderType:A.type,shaderName:A.name,vertexShader:G,fragmentShader:$,defines:A.defines,customVertexShaderID:te,customFragmentShaderID:ae,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:Ie,instancing:pe,instancingColor:pe&&ee.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:ne===null?s.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:ar,map:Pe,matcap:Se,envMap:O,envMapMode:O&&re.mapping,envMapCubeUVHeight:Z,aoMap:Me,lightMap:ue,bumpMap:de,normalMap:oe,displacementMap:p&&Ue,emissiveMap:fe,normalMapObjectSpace:oe&&A.normalMapType===I_,normalMapTangentSpace:oe&&A.normalMapType===us,metalnessMap:U,roughnessMap:I,anisotropy:X,anisotropyMap:Ne,clearcoat:ye,clearcoatMap:Ce,clearcoatNormalMap:De,clearcoatRoughnessMap:ke,iridescence:ce,iridescenceMap:xe,iridescenceThicknessMap:it,sheen:he,sheenColorMap:tt,sheenRoughnessMap:Xe,specularMap:ze,specularColorMap:Le,specularIntensityMap:Q,transmission:Te,transmissionMap:we,thicknessMap:We,gradientMap:Be,opaque:A.transparent===!1&&A.blending===Ks,alphaMap:ge,alphaTest:J,alphaHash:Ge,combine:A.combine,mapUv:Pe&&S(A.map.channel),aoMapUv:Me&&S(A.aoMap.channel),lightMapUv:ue&&S(A.lightMap.channel),bumpMapUv:de&&S(A.bumpMap.channel),normalMapUv:oe&&S(A.normalMap.channel),displacementMapUv:Ue&&S(A.displacementMap.channel),emissiveMapUv:fe&&S(A.emissiveMap.channel),metalnessMapUv:U&&S(A.metalnessMap.channel),roughnessMapUv:I&&S(A.roughnessMap.channel),anisotropyMapUv:Ne&&S(A.anisotropyMap.channel),clearcoatMapUv:Ce&&S(A.clearcoatMap.channel),clearcoatNormalMapUv:De&&S(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ke&&S(A.clearcoatRoughnessMap.channel),iridescenceMapUv:xe&&S(A.iridescenceMap.channel),iridescenceThicknessMapUv:it&&S(A.iridescenceThicknessMap.channel),sheenColorMapUv:tt&&S(A.sheenColorMap.channel),sheenRoughnessMapUv:Xe&&S(A.sheenRoughnessMap.channel),specularMapUv:ze&&S(A.specularMap.channel),specularColorMapUv:Le&&S(A.specularColorMap.channel),specularIntensityMapUv:Q&&S(A.specularIntensityMap.channel),transmissionMapUv:we&&S(A.transmissionMap.channel),thicknessMapUv:We&&S(A.thicknessMap.channel),alphaMapUv:ge&&S(A.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(oe||X),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,vertexUv1s:He,vertexUv2s:je,vertexUv3s:rt,pointsUvs:ee.isPoints===!0&&!!q.attributes.uv&&(Pe||ge),fog:!!N,useFog:A.fog===!0,fogExp2:N&&N.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:ee.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:F,morphTextureStride:j,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:s.shadowMap.enabled&&k.length>0,shadowMapType:s.shadowMap.type,toneMapping:Ze,useLegacyLights:s._useLegacyLights,decodeVideoTexture:Pe&&A.map.isVideoTexture===!0&&Bt.getTransfer(A.map.colorSpace)===Wt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===pi,flipSided:A.side===si,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:Fe&&A.extensions.derivatives===!0,extensionFragDepth:Fe&&A.extensions.fragDepth===!0,extensionDrawBuffers:Fe&&A.extensions.drawBuffers===!0,extensionShaderTextureLOD:Fe&&A.extensions.shaderTextureLOD===!0,extensionCl
vendor: 4,686 bytes, line 3658
3658ipCullDistance:Fe&&A.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:f||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()}}function _(A){const C=[];if(A.shaderID?C.push(A.shaderID):(C.push(A.customVertexShaderID),C.push(A.customFragmentShaderID)),A.defines!==void 0)for(const k in A.defines)C.push(k),C.push(A.defines[k]);return A.isRawShaderMaterial===!1&&(E(C,A),M(C,A),C.push(s.outputColorSpace)),C.push(A.customProgramCacheKey),C.join()}function E(A,C){A.push(C.precision),A.push(C.outputColorSpace),A.push(C.envMapMode),A.push(C.envMapCubeUVHeight),A.push(C.mapUv),A.push(C.alphaMapUv),A.push(C.lightMapUv),A.push(C.aoMapUv),A.push(C.bumpMapUv),A.push(C.normalMapUv),A.push(C.displacementMapUv),A.push(C.emissiveMapUv),A.push(C.metalnessMapUv),A.push(C.roughnessMapUv),A.push(C.anisotropyMapUv),A.push(C.clearcoatMapUv),A.push(C.clearcoatNormalMapUv),A.push(C.clearcoatRoughnessMapUv),A.push(C.iridescenceMapUv),A.push(C.iridescenceThicknessMapUv),A.push(C.sheenColorMapUv),A.push(C.sheenRoughnessMapUv),A.push(C.specularMapUv),A.push(C.specularColorMapUv),A.push(C.specularIntensityMapUv),A.push(C.transmissionMapUv),A.push(C.thicknessMapUv),A.push(C.combine),A.push(C.fogExp2),A.push(C.sizeAttenuation),A.push(C.morphTargetsCount),A.push(C.morphAttributeCount),A.push(C.numDirLights),A.push(C.numPointLights),A.push(C.numSpotLights),A.push(C.numSpotLightMaps),A.push(C.numHemiLights),A.push(C.numRectAreaLights),A.push(C.numDirLightShadows),A.push(C.numPointLightShadows),A.push(C.numSpotLightShadows),A.push(C.numSpotLightShadowsWithMaps),A.push(C.numLightProbes),A.push(C.shadowMapType),A.push(C.toneMapping),A.push(C.numClippingPlanes),A.push(C.numClipIntersection),A.push(C.depthPacking)}function M(A,C){a.disableAll(),C.isWebGL2&&a.enable(0),C.supportsVertexTextures&&a.enable(1),C.instancing&&a.enable(2),C.instancingColor&&a.enable(3),C.matcap&&a.enable(4),C.envMap&&a.enable(5),C.normalMapObjectSpace&&a.enable(6),C.normalMapTangentSpace&&a.enable(7),C.clearcoat&&a.enable(8),C.iridescence&&a.enable(9),C.alphaTest&&a.enable(10),C.vertexColors&&a.enable(11),C.vertexAlphas&&a.enable(12),C.vertexUv1s&&a.enable(13),C.vertexUv2s&&a.enable(14),C.vertexUv3s&&a.enable(15),C.vertexTangents&&a.enable(16),C.anisotropy&&a.enable(17),C.alphaHash&&a.enable(18),C.batching&&a.enable(19),A.push(a.mask),a.disableAll(),C.fog&&a.enable(0),C.useFog&&a.enable(1),C.flatShading&&a.enable(2),C.logarithmicDepthBuffer&&a.enable(3),C.skinning&&a.enable(4),C.morphTargets&&a.enable(5),C.morphNormals&&a.enable(6),C.morphColors&&a.enable(7),C.premultipliedAlpha&&a.enable(8),C.shadowMapEnabled&&a.enable(9),C.useLegacyLights&&a.enable(10),C.doubleSided&&a.enable(11),C.flipSided&&a.enable(12),C.useDepthPacking&&a.enable(13),C.dithering&&a.enable(14),C.transmission&&a.enable(15),C.sheen&&a.enable(16),C.opaque&&a.enable(17),C.pointsUvs&&a.enable(18),C.decodeVideoTexture&&a.enable(19),A.push(a.mask)}function b(A){const C=v[A.type];let k;if(C){const B=Xi[C];k=Rp.clone(B.uniforms)}else k=A.uniforms;return k}function P(A,C){let k;for(let B=0,ee=h.length;B<ee;B++){const N=h[B];if(N.cacheKey===C){k=N,++k.usedTimes;break}}return k===void 0&&(k=new Fb(s,C,A,r),h.push(k)),k}function R(A){if(--A.usedTimes===0){const C=h.indexOf(A);h[C]=h[h.length-1],h.pop(),A.destroy()}}function L(A){c.remove(A)}function D(){c.dispose()}return{getParameters:y,getProgramCacheKey:_,getUniforms:b,acquireProgram:P,releaseProgram:R,releaseShaderCache:L,programs:h,dispose:D}}function Gb(){let s=new WeakMap;function e(r){let o=s.get(r);return o===void 0&&(o={},s.set(r,o)),o}function t(r){s.delete(r)}function n(r,o,a){s.get(r)[o]=a}function i(){s=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function Hb(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function d0(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function p0(){const s=[];let e=0;const t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function o(d,p,m,v,S,y){let _=s[e];return _===void 0?(_={id:d.id,object:d,geometry:p,material:m,groupOrder:v,renderOrder:d.renderOrder,z:S,group:y},s[e]=_):(_.id=d.id,_.object=d,_.geometry=p,_.material=m,_.groupOrder=v,_.renderOrder=d.renderOrder,_.z
vendor: 4,373 bytes, line 3658
3658=S,_.group=y),e++,_}function a(d,p,m,v,S,y){const _=o(d,p,m,v,S,y);m.transmission>0?n.push(_):m.transparent===!0?i.push(_):t.push(_)}function c(d,p,m,v,S,y){const _=o(d,p,m,v,S,y);m.transmission>0?n.unshift(_):m.transparent===!0?i.unshift(_):t.unshift(_)}function h(d,p){t.length>1&&t.sort(d||Hb),n.length>1&&n.sort(p||d0),i.length>1&&i.sort(p||d0)}function f(){for(let d=e,p=s.length;d<p;d++){const m=s[d];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:a,unshift:c,finish:f,sort:h}}function Vb(){let s=new WeakMap;function e(n,i){const r=s.get(n);let o;return r===void 0?(o=new p0,s.set(n,[o])):i>=r.length?(o=new p0,r.push(o)):o=r[i],o}function t(){s=new WeakMap}return{get:e,dispose:t}}function Wb(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new H,color:new $e};break;case"SpotLight":t={position:new H,direction:new H,color:new $e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new H,color:new $e,distance:0,decay:0};break;case"HemisphereLight":t={direction:new H,skyColor:new $e,groundColor:new $e};break;case"RectAreaLight":t={color:new $e,position:new H,halfWidth:new H,halfHeight:new H};break}return s[e.id]=t,t}}}function Xb(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Re};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Re};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Re,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let Yb=0;function jb(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function qb(s,e){const t=new Wb,n=Xb(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)i.probe.push(new H);const r=new H,o=new yt,a=new yt;function c(f,d){let p=0,m=0,v=0;for(let B=0;B<9;B++)i.probe[B].set(0,0,0);let S=0,y=0,_=0,E=0,M=0,b=0,P=0,R=0,L=0,D=0,A=0;f.sort(jb);const C=d===!0?Math.PI:1;for(let B=0,ee=f.length;B<ee;B++){const N=f[B],q=N.color,K=N.intensity,re=N.distance,Z=N.shadow&&N.shadow.map?N.shadow.map.texture:null;if(N.isAmbientLight)p+=q.r*K*C,m+=q.g*K*C,v+=q.b*K*C;else if(N.isLightProbe){for(let W=0;W<9;W++)i.probe[W].addScaledVector(N.sh.coefficients[W],K);A++}else if(N.isDirectionalLight){const W=t.get(N);if(W.color.copy(N.color).multiplyScalar(N.intensity*C),N.castShadow){const V=N.shadow,F=n.get(N);F.shadowBias=V.bias,F.shadowNormalBias=V.normalBias,F.shadowRadius=V.radius,F.shadowMapSize=V.mapSize,i.directionalShadow[S]=F,i.directionalShadowMap[S]=Z,i.directionalShadowMatrix[S]=N.shadow.matrix,b++}i.directional[S]=W,S++}else if(N.isSpotLight){const W=t.get(N);W.position.setFromMatrixPosition(N.matrixWorld),W.color.copy(q).multiplyScalar(K*C),W.distance=re,W.coneCos=Math.cos(N.angle),W.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),W.decay=N.decay,i.spot[_]=W;const V=N.shadow;if(N.map&&(i.spotLightMap[L]=N.map,L++,V.updateMatrices(N),N.castShadow&&D++),i.spotLightMatrix[_]=V.matrix,N.castShadow){const F=n.get(N);F.shadowBias=V.bias,F.shadowNormalBias=V.normalBias,F.shadowRadius=V.radius,F.shadowMapSize=V.mapSize,i.spotShadow[_]=F,i.spotShadowMap[_]=Z,R++}_++}else if(N.isRectAreaLight){const W=t.get(N);W.color.copy(q).multiplyScalar(K),W.halfWidth.set(N.width*.5,0,0),W.halfHeight.set(0,N.height*.5,0),i.rectArea[E]=W,E++}else if(N.isPointLight){const W=t.get(N);if(W.color.copy(N.color).multiplyScalar(N.intensity*C),W.distance=N.distance,W.decay=N.decay,N.castShadow){const V=N.shadow,F=n.get(N);F.shadowBias=V.bias,F.shadowNormalBias=V.normalBias,F.shadowRadius=V.radius,F.shadowMapSize=V.mapSize,F.shadowCameraNear=V.
3658camera.near,F.shadowCameraFar=V.camera.far,i.pointShadow[y]=F,i.pointShadowMap[y]=Z,i.pointShadowMatrix[y]=N.shadow.matrix,P++}i.point[y]=W,y++}else if(N.isHemisphereLight){const W=t.get(N);W.skyColor.copy(N.color).multiplyScalar(K*C),W.groundColor.copy(N.groundColor).multiplyScalar(K*C),i.hemi[M]=W,M++}}E>0&&(e.isWebGL2?s.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=qe.LTC_FLOAT_1,i.rectAreaLTC2=qe.LTC_FLOAT_2):(i.rectAreaLTC1=qe.LTC_HALF_1,i.rectAreaLTC2=qe.LTC_HALF_2):s.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=qe.LTC_FLOAT_1,i.rectAreaLTC2=qe.LTC_FLOAT_2):s.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=qe.LTC_HALF_1,i.rectAreaLTC2=qe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=p,i.ambient[1]=m,i.ambient[2]=v;const k=i.hash;(k.directionalLength!==S||k.pointLength!==y||k.spotLength!==_||k.rectAreaLength!==E||k.hemiLength!==M||k.numDirectionalShadows!==b||k.numPointShadows!==P||k.numSpotShadows!==R||k.numSpotMaps!==L||k.numLightProbes!==A)&&(i.directional.length=S,i.spot.length=_,i.rectArea.length=E,i.point.length=y,i.hemi.length=M,i.directionalShadow.length=b,i.directionalShadowMap.length=b,i.pointShadow.length=P,i.pointShadowMap.length=P,i.spotShadow.length=R,i.spotShadowMap.length=R,i.directionalShadowMatrix.length=b,i.pointShadowMatrix.length=P,i.spotLightMatrix.length=R+L-D,i.spotLightMap.length=L,i.numSpotLightShadowsWithMaps=D,i.numLightProbes=A,k.directionalLength=S,k.pointLength=y,k.spotLength=_,k.rectAreaLength=E,k.hemiLength=M,k.numDirectionalShadows=b,k.numPointShadows=P,k.numSpotShadows=R,k.numSpotMaps=L,k.numLightProbes=A,i.version=Yb++)}function h(f,d){let p=0,m=0,v=0,S=0,y=0;const _=d.matrixWorldInverse;for(let E=0,M=f.length;E<M;E++){const b=f[E];if(b.isDirectionalLight){const P=i.directional[p];P.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),P.direction.sub(r),P.direction.transformDirection(_),p++}else if(b.isSpotLight){const P=i.spot[v];P.position.setFromMatrixPosition(b.matrixWorld),P.position.applyMatrix4(_),P.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),P.direction.sub(r),P.direction.transformDirection(_),v++}else if(b.isRectAreaLight){const P=i.rectArea[S];P.position.setFromMatrixPosition(b.matrixWorld),P.position.applyMatrix4(_),a.identity(),o.copy(b.matrixWorld),o.premultiply(_),a.extractRotation(o),P.halfWidth.set(b.width*.5,0,0),P.halfHeight.set(0,b.height*.5,0),P.halfWidth.applyMatrix4(a),P.halfHeight.applyMatrix4(a),S++}else if(b.isPointLight){const P=i.point[m];P.position.setFromMatrixPosition(b.matrixWorld),P.position.applyMatrix4(_),m
vendor: 11,361 bytes, lines 3658-3686
3658++}else if(b.isHemisphereLight){const P=i.hemi[y];P.direction.setFromMatrixPosition(b.matrixWorld),P.direction.transformDirection(_),y++}}}return{setup:c,setupView:h,state:i}}function m0(s,e){const t=new qb(s,e),n=[],i=[];function r(){n.length=0,i.length=0}function o(d){n.push(d)}function a(d){i.push(d)}function c(d){t.setup(n,d)}function h(d){t.setupView(n,d)}return{init:r,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:c,setupLightsView:h,pushLight:o,pushShadow:a}}function Zb(s,e){let t=new WeakMap;function n(r,o=0){const a=t.get(r);let c;return a===void 0?(c=new m0(s,e),t.set(r,[c])):o>=a.length?(c=new m0(s,e),a.push(c)):c=a[o],c}function i(){t=new WeakMap}return{get:n,dispose:i}}class rh extends Xn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=L_,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 sh extends Xn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Jb=`void main() { 3659 gl_Position = vec4( position, 1.0 ); 3660}`,Kb=`uniform sampler2D shadow_pass; 3661uniform vec2 resolution; 3662uniform float radius; 3663#include <packing> 3664void main() { 3665 const float samples = float( VSM_SAMPLES ); 3666 float mean = 0.0; 3667 float squared_mean = 0.0; 3668 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3669 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3670 for ( float i = 0.0; i < samples; i ++ ) { 3671 float uvOffset = uvStart + i * uvStride; 3672 #ifdef HORIZONTAL_PASS 3673 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3674 mean += distribution.x; 3675 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3676 #else 3677 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3678 mean += depth; 3679 squared_mean += depth * depth; 3680 #endif 3681 } 3682 mean = mean / samples; 3683 squared_mean = squared_mean / samples; 3684 float std_dev = sqrt( squared_mean - mean * mean ); 3685 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3686}`;function Qb(s,e,t){let n=new kl;const i=new Re,r=new Re,o=new Ft,a=new rh({depthPacking:Mp}),c=new sh,h={},f=t.maxTextureSize,d={[Ur]:si,[si]:Ur,[pi]:pi},p=new lr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Re},radius:{value:4}},vertexShader:Jb,fragmentShader:Kb}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const v=new Tt;v.setAttribute("position",new kt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new rn(v,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ku;let _=this.type;this.render=function(R,L,D){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||R.length===0)return;const A=s.getRenderTarget(),C=s.getActiveCubeFace(),k=s.getActiveMipmapLevel(),B=s.state;B.setBlending(Ir),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const ee=_!==Wi&&this.type===Wi,N=_===Wi&&this.type!==Wi;for(let q=0,K=R.length;q<K;q++){const re=R[q],Z=re.shadow;if(Z===void 0){console.warn("THREE.WebGLShadowMap:",re,"has no shadow.");continue}if(Z.autoUpdate===!1&&Z.needsUpdate===!1)continue;i.copy(Z.mapSize);const W=Z.getFrameExtents();if(i.multiply(W),r.copy(Z.mapSize),(i.x>f||i.y>f)&&(i.x>f&&(r.x=Math.floor(f/W.x),i.x=r.x*W.x,Z.mapSize.x=r.x),i.y>f&&(r.y=Math.floor(f/W.y),i.y=r.y*W.y,Z.mapSize.y=r.y)),Z.map===null||ee===!0||N===!0){const F=this.type!==Wi?{minFilter:hn,magFilter:hn}:{};Z.map!==null&&Z.map.dispose(),Z.map=new qi(i.x,i.y,F),Z.map.texture.name=re.name+".shadowMap",Z.camera.updateProjectionMatrix()}s.setRenderTarget(Z.map),s.clear();const V=Z.getViewportCount();for(let F=0;F<V;F++){const j=Z.getViewport(F);o.set(r.x*j.x,r.y*j.y,r.x*j.z,r.y*j.w),B.viewport(o),Z.updateMatrices(re,F),n=Z.getFrustum(),b(L,D,Z.camera,re,this.type)}Z.isPointLightShadow!==!0&&this.type===Wi&&E(Z,D),Z.needsUpdate=!1}_=this.type,y.needsUpdate=!1,s.setRenderTarget(A,C,k)};function E(R,L){const D=e.update(S);p.defines.VSM_SAMPLES!==R.blurSamples&&(p.defines.VSM_SAMPLES=R.blurSamples,m.defines.VSM_SAMPLES=R.blurSamples,p.needsUpdate=!0,m.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new qi(i.x,i.y)),p.uniforms.shadow_pass.value=R.map.texture,p.uniforms.resolution.value=R.mapSize,p.uniforms.radius.value=R.radius,s.setRenderTarget(R.mapPass),s.clear(),s.renderBufferDirect(L,null,D,p,S,null),m.uniforms.shadow_pass.value=R.mapPass.texture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,s.setRenderTarget(R.map),s.clear(),s.renderBufferDirect(L,null,D,m,S,null)}function M(R,L,D,A){let C=null;const k=D.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(k!==void 0)C=k;else if(C=D.isPointLight===!0?c:a,s.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 B=C.uuid,ee=L.uuid;let N=h[B];N===void 0&&(N={},h[B]=N);let q=N[ee];q===void 0&&(q=C.clone(),N[ee]=q,L.addEventListener("dispose",P)),C=q}if(C.visible=L.visible,C.wireframe=L.wireframe,A===Wi?C.side=L.shadowSide!==null?L.shadowSide:L.side:C.side=L.shadowSide!==null?L.shadowSide:d[L.side],C.alphaMap=L.alphaMap,C.alphaTest=L.alphaTest,C.map=L.map,C.clipShadows=L.clipShadows,C.clippingPlanes=L.clippingPlanes,C.clipIntersection=L.clipIntersection,C.displacementMap=L.displacementMap,C.displacementScale=L.displacementScale,C.displacementBias=L.displacementBias,C.wireframeLinewidth=L.wireframeLinewidth,C.linewidth=L.linewidth,D.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const B=s.properties.get(C);B.light=D}return C}function b(R,L,D,A,C){if(R.visible===!1)return;if(R.layers.test(L.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&C===Wi)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,R.matrixWorld);const ee=e.update(R),N=R.material;if(Array.isArray(N)){const q=ee.groups;for(let K=0,re=q.length;K<re;K++){const Z=q[K],W=N[Z.materialIndex];if(W&&W.visible){const V=M(R,W,A,C);R.onBeforeShadow(s,R,L,D,ee,V,Z),s.renderBufferDirect(D,null,ee,V,R,Z),R.onAfterShadow(s,R,L,D,ee,V,Z)}}}else if(N.visible){const q=M(R,N,A,C);R.onBeforeShadow(s,R,L,D,ee,q,null),s.renderBufferDirect(D,null,ee,q,R,null),R.onAfterShadow(s,R,L,D,ee,q,null)}}const B=R.children;for(let ee=0,N=B.length;ee<N;ee++)b(B[ee],L,D,A,C)}function P(R){R.target.removeEventListener("dispose",P);for(const D in h){const A=h[D],C=R.target.uuid;C in A&&(A[C].dispose(),delete A[C])}}}function $b(s,e,t){const n=t.isWebGL2;function i(){let J=!1;const Ge=new Ft;let Fe=null;const He=new Ft(0,0,0,0);return{setMask:function(je){Fe!==je&&!J&&(s.colorMask(je,je,je,je),Fe=je)},setLocked:function(je){J=je},setClear:function(je,rt,Ze,ht,At){At===!0&&(je*=ht,rt*=ht,Ze*=ht),Ge.set(je,rt,Ze,ht),He.equals(Ge)===!1&&(s.clearColor(je,rt,Ze,ht),He.copy(Ge))},reset:function(){J=!1,Fe=null,He.set(-1,0,0,0)}}}function r(){let J=!1,Ge=null,Fe=null,He=null;return{setTest:function(je){je?Ie(s.DEPTH_TEST):Pe(s.DEPTH_TEST)},setMask:function(je){Ge!==je&&!J&&(s.depthMask(je),Ge=je)},setFunc:function(je){if(Fe!==je){switch(je){case s_:s.depthFunc(s.NEVER);break;case o_:s.depthFunc(s.ALWAYS);break;case a_:s.depthFunc(s.LESS);break;case dl:s.depthFunc(s.LEQUAL);break;case l_:s.depthFunc(s.EQUAL);break;case c_:s.depthFunc(s.GEQUAL);break;case u_:s.depthFunc(s.GREATER);break;case h_:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}Fe=je}},setLocked:function(je){J=je},setClear:function(je){He!==je&&(s.clearDepth(je),He=je)},reset:function(){J=!1,Ge=null,Fe=null,He=null}}}function o(){let J=!1,Ge=null,Fe=null,He=null,je=null,rt=null,Ze=null,ht=null,At=null;return{setTest:function(gt){J||(gt?Ie(s.STENCIL_TEST):Pe(s.STENCIL_TEST))},setMask:function(gt){Ge!==gt&&!J&&(s.stencilMask(gt),Ge=gt)},setFunc:function(gt,Lt,Yt){(Fe!==gt||He!==Lt||je!==Yt)&&(s.stencilFunc(gt,Lt,Yt),Fe=gt,He=Lt,je=Yt)},setOp:function(gt,Lt,Yt){(rt!==gt||Ze!==Lt||ht!==Yt)&&(s.stencilOp(gt,Lt,Yt),rt=gt,Ze=Lt,ht=Yt)},setLocked:function(gt){J=gt},setClear:function(gt){At!==gt&&(s.clearStencil(gt),At=gt)},reset:function(){J=!1,Ge=null,Fe=null,He=null,je=null,rt=null,Ze=null,ht=null,At=null}}}const a=new i,c=new r,h=new o,f=new WeakMap,d=new WeakMap;let p={},m={},v=new WeakMap,S=[],y=null,_=!1,E=null,M=null,b=null,P=null,R=null,L=null,D=null,A=new $e(0,0,0),C=0,k=!1,B=null,ee=null,N=null,q=null,K=null;const re=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Z=!1,W=0;const V=s.getParameter(s.VERSION);V.indexOf("WebGL")!==-1?(W=parseFloat(/^WebGL (\d)/.exec(V)[1]),Z=W>=1):V.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),Z=W>=2);let F=null,j={};const G=s.getParameter(s.SCISSOR_BOX),$=s.getParameter(s.VIEWPORT),te=new Ft().fromArray(G),ae=new Ft().fromArray($);function ne(J,Ge,Fe,He){const je=new Uint8Array(4),rt=s.createTexture();s.bindTexture(J,rt),s.texParameteri(J,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(J,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let Ze=0;Ze<Fe;Ze++)n&&(J===s.TEXTURE_3D||J===s.TEXTURE_2D_ARRAY)?s.texImage3D(Ge,0,s.RGBA,1,1,He,0,s.RGBA,s.UNSIGNED_BYTE,je):s.texImage2D(Ge+Ze,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,je);return rt}const pe={};pe[s.TEXTURE_2D]=ne(s.TEXTURE_2D,s.TEXTURE_2D,1),pe[s.TEXTURE_CUBE_MAP]=ne(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(pe[s.TEXTURE_2D_ARRAY]=ne(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),pe[s.TEXTURE_3D]=ne(s.TEXTURE_3D,s.TEXTURE_3D,1,1)),a.setClear(0,0,0,1),c.setClear(1),h.setClear(0),Ie(s.DEPTH_TEST),c.setFunc(dl),fe(!1),U(pd),Ie(s.CULL_FACE),oe(Ir);function Ie(J){p[J]!==!0&&(s.enable(J),p[J]=!0)}function Pe(J){p[J]!==!1&&(s.disable(J),p[J]=!1)}function Se(J,Ge){return m[J]!==Ge?(s.bindFramebuffer(J,Ge),m[J]=Ge,n&&(J===s.DRAW_FRAMEBUFFER&&(m[s.FRAMEBUFFER]=Ge),J===s.FRAMEBUFFER&&(m[s.DRAW_FRAMEBUFFER]=Ge)),!0):!1}function O(J,Ge){let Fe=S,He=!1;if(J)if(Fe=v.get(Ge),Fe===void 0&&(Fe=[],v.set(Ge,Fe)),J.isWebGLMultipleRenderTargets){const je=J.texture;if(Fe.length!==je.length||Fe[0]!==s.COLOR_ATTACHMENT0){for(let rt=0,Ze=je.length;rt<Ze;rt++)Fe[rt]=s.COLOR_ATTACHMENT0+rt;Fe.length=je.length,He=!0}}else Fe[0]!==s.COLOR_ATTACHMENT0&&(Fe[0]=s.COLOR_ATTACHMENT0,He=!0);else Fe[0]!==s.BACK&&(Fe[0]=s.BACK,He=!0);He&&(t.isWebGL2?s.drawBuffers(Fe):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Fe))}function Me(J){return y!==J?(s.useProgram(J),y=J,!0):!1}const ue={[ns]:s.FUNC_ADD,[Wv]:s.FUNC_SUBTRACT,[Xv]:s.FUNC_REVERSE_SUBTRACT};if(n)ue[_d]=s.MIN,ue[yd]=s.MAX;else{const J=e.get("EXT_blend_minmax");
vendor: 5,058 bytes, line 3686
3686J!==null&&(ue[_d]=J.MIN_EXT,ue[yd]=J.MAX_EXT)}const de={[Yv]:s.ZERO,[jv]:s.ONE,[qv]:s.SRC_COLOR,[Vu]:s.SRC_ALPHA,[e_]:s.SRC_ALPHA_SATURATE,[Qv]:s.DST_COLOR,[Jv]:s.DST_ALPHA,[Zv]:s.ONE_MINUS_SRC_COLOR,[Wu]:s.ONE_MINUS_SRC_ALPHA,[$v]:s.ONE_MINUS_DST_COLOR,[Kv]:s.ONE_MINUS_DST_ALPHA,[t_]:s.CONSTANT_COLOR,[n_]:s.ONE_MINUS_CONSTANT_COLOR,[i_]:s.CONSTANT_ALPHA,[r_]:s.ONE_MINUS_CONSTANT_ALPHA};function oe(J,Ge,Fe,He,je,rt,Ze,ht,At,gt){if(J===Ir){_===!0&&(Pe(s.BLEND),_=!1);return}if(_===!1&&(Ie(s.BLEND),_=!0),J!==Vv){if(J!==E||gt!==k){if((M!==ns||R!==ns)&&(s.blendEquation(s.FUNC_ADD),M=ns,R=ns),gt)switch(J){case Ks:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case md:s.blendFunc(s.ONE,s.ONE);break;case gd:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case vd:s.blendFuncSeparate(s.ZERO,s.SRC_COLOR,s.ZERO,s.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",J);break}else switch(J){case Ks:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case md:s.blendFunc(s.SRC_ALPHA,s.ONE);break;case gd:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case vd:s.blendFunc(s.ZERO,s.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",J);break}b=null,P=null,L=null,D=null,A.set(0,0,0),C=0,E=J,k=gt}return}je=je||Ge,rt=rt||Fe,Ze=Ze||He,(Ge!==M||je!==R)&&(s.blendEquationSeparate(ue[Ge],ue[je]),M=Ge,R=je),(Fe!==b||He!==P||rt!==L||Ze!==D)&&(s.blendFuncSeparate(de[Fe],de[He],de[rt],de[Ze]),b=Fe,P=He,L=rt,D=Ze),(ht.equals(A)===!1||At!==C)&&(s.blendColor(ht.r,ht.g,ht.b,At),A.copy(ht),C=At),E=J,k=!1}function Ue(J,Ge){J.side===pi?Pe(s.CULL_FACE):Ie(s.CULL_FACE);let Fe=J.side===si;Ge&&(Fe=!Fe),fe(Fe),J.blending===Ks&&J.transparent===!1?oe(Ir):oe(J.blending,J.blendEquation,J.blendSrc,J.blendDst,J.blendEquationAlpha,J.blendSrcAlpha,J.blendDstAlpha,J.blendColor,J.blendAlpha,J.premultipliedAlpha),c.setFunc(J.depthFunc),c.setTest(J.depthTest),c.setMask(J.depthWrite),a.setMask(J.colorWrite);const He=J.stencilWrite;h.setTest(He),He&&(h.setMask(J.stencilWriteMask),h.setFunc(J.stencilFunc,J.stencilRef,J.stencilFuncMask),h.setOp(J.stencilFail,J.stencilZFail,J.stencilZPass)),X(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),J.alphaToCoverage===!0?Ie(s.SAMPLE_ALPHA_TO_COVERAGE):Pe(s.SAMPLE_ALPHA_TO_COVERAGE)}function fe(J){B!==J&&(J?s.frontFace(s.CW):s.frontFace(s.CCW),B=J)}function U(J){J!==zv?(Ie(s.CULL_FACE),J!==ee&&(J===pd?s.cullFace(s.BACK):J===Gv?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):Pe(s.CULL_FACE),ee=J}function I(J){J!==N&&(Z&&s.lineWidth(J),N=J)}function X(J,Ge,Fe){J?(Ie(s.POLYGON_OFFSET_FILL),(q!==Ge||K!==Fe)&&(s.polygonOffset(Ge,Fe),q=Ge,K=Fe)):Pe(s.POLYGON_OFFSET_FILL)}function ye(J){J?Ie(s.SCISSOR_TEST):Pe(s.SCISSOR_TEST)}function ce(J){J===void 0&&(J=s.TEXTURE0+re-1),F!==J&&(s.activeTexture(J),F=J)}function he(J,Ge,Fe){Fe===void 0&&(F===null?Fe=s.TEXTURE0+re-1:Fe=F);let He=j[Fe];He===void 0&&(He={type:void 0,texture:void 0},j[Fe]=He),(He.type!==J||He.texture!==Ge)&&(F!==Fe&&(s.activeTexture(Fe),F=Fe),s.bindTexture(J,Ge||pe[J]),He.type=J,He.texture=Ge)}function Te(){const J=j[F];J!==void 0&&J.type!==void 0&&(s.bindTexture(J.type,null),J.type=void 0,J.texture=void 0)}function Ne(){try{s.compressedTexImage2D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Ce(){try{s.compressedTexImage3D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function De(){try{s.texSubImage2D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function ke(){try{s.texSubImage3D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function xe(){try{s.compressedTexSubImage2D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function it(){try{s.compressedTexSubImage3D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function tt(){try{s.texStorage2D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Xe(){try{s.texStorage3D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function ze(){try{s.texImage2D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Le(){try{s.texImage3D.apply(s,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Q(J){te.equals(J)===!1&&(s.scissor(J.x,J.y,J.z,J.w),te.copy(J))}function we(J){ae.equals(J)===!1&&(s.viewport(J.x,J.y,J.z,J.w),ae.copy(J))}function We(J,Ge){let Fe=d.get(Ge);Fe===void 0&&(Fe=new WeakMap,d.set(Ge,Fe));let He=Fe.get(J);He===void 0&&(He=s.getUniformBlockIndex(Ge,J.name),Fe.set(J,He))}function Be(J,Ge){const He=d.get(Ge).get(J);f.get(Ge)!==He&&(s.uniformBlockBinding(Ge,He,J.__bindingPointIndex),f.set(Ge,He))}function ge(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor
3686(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),n===!0&&(s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null)),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),p={},F=null,j={},m={},v=new WeakMap,S=[],y=null,_=!1,E=null,M=null,b=null,P=null,R=null,L=null,D=null,A=new $e(0,0,0),C=0,k=!1,B=null,ee=null,N=null,q=null,K=null,te.set(0,0,s.canvas.width,s.canvas.height),ae.set(0,0,s.canvas.width,s.canvas.height),a.reset(),c.reset(),h.reset()}return{buffers:{color:a,depth:c,stencil:h},enable:Ie,disable:Pe,bindFramebuffer:Se,drawBuffers:O,useProgram:Me,setBlending:oe,setMaterial:Ue,setFlipSided:fe,setCullFace:U,setLineWidth:I,setPolygonOffset:X,setScissorTest:ye,activeTexture:ce,bindTexture:he,unbindTexture:Te,compressedTexImage2D:Ne,compressedTexImage3D:Ce,texImage2D:ze,texImage3D:Le,updateUBOMapping:We,uniformBlockBinding:Be,texStorage2D:tt,texStorage3D:Xe,texSubImage2D:De,texSubImage3D:ke,compressedTexSubImage2D:xe,compressedTexSubImage3D:it,scissor:Q,viewport:we,reset:ge}}function eT(s,e,t,n,i,r,o){const a=i.isWebGL2,c=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,h=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new WeakMap;let d;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(U,I){return m?new OffscreenCanvas(U,I):bl("canvas")}function S(U,I,X,ye){let ce=1;if((U.width>ye||U.height>ye)&&(ce=ye/Math.max(U.width,U.height)),ce<1||I===!0)if(typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&U instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&U instanceof ImageBitmap){const he=I?ju:Math.floor,Te=he(ce*U.width),Ne=he(ce*U.height);d===void 0&&(d=v(Te,Ne));const Ce=X?v(Te,Ne):d;return Ce.width=Te,Ce.height=Ne,Ce.getContext("2d").drawImage(U,0,0,Te,Ne),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+U.width+"x"+U.height+") to ("+Te+"x"+Ne+")."),Ce}else return"data"in U&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+U.width+"x"+U.height+")."),U;return U}function y(U){return qd(U.width)&&qd(U.height)}function _(U){return a?!1:U.wrapS!==Vn||U.wrapT!==Vn||U.minFilter!==hn&&U.minFilter!==Kt}function E(U,I){return U.generateMipmaps&&I&&U.minFilter!==hn&&U.minFilter!==Kt}function M(U){s.generateMipmap(U)}function b(U,I,X,ye,ce=!1){if(a===!1)return I;if(U!==null){if(s[U]!==void 0)return s[U];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+U+"'")}let he=I;if(I===s.RED&&(X===s.FLOAT&&(he=s.R32F),X===s.HALF_FLOAT&&(he=s.R16F),X===s.UNSIGNED_BYTE&&(he=s.R8)),I===s.RED_INTEGER&&(X===s.UNSIGNED_BYTE&&(he=s.R8UI),X===s.UNSIGNED_SHORT&&(he=s.R16UI),X===s.UNSIGNED_INT&&(he=s.R32UI),X===s.BYTE&&(he=s.R8I),X===s.SHORT&&(he=s.R16I),X===s.INT&&(he=s.R32I)),I===s.RG&&(X===s.FLOAT&&(he=s.RG32F),X===s.HALF_FLOAT&&(he=s.RG16F),X===s.UNSIGNED_BYTE&&(he=s.RG8)),I===s.RGBA){const Te=ce?Sl:Bt.getTransfer(ye);X===s.FLOAT&&(he=s.RGBA32F),X===s.HALF_FLOAT&&(he=s.RGBA16F),X===s.UNSIGNED_BYTE&&(he=Te===Wt?s.SRGB8_ALPHA8:s.RGBA8),X===s.UNSIGNED_SHORT_4_4_4_4&&(he=s.RGBA4),X===s.UNSIGNED_SHORT_5_5_5_1&&(he=s.RGB5_A1)}return(he===s.R16F||he===s.R32F||he===s.RG16F||he===s.RG32F||he===s.RGBA16F||he===s.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function P(U,I,X){return E(U,X)===!0||U.isFramebufferTexture&&U.minFilter!==hn&&U.minFilter!==Kt?Math.log2(Math.max(I.width,I.height))+1:U.mipmaps!==void 0&&U.mipmaps.length>0?U.mipmaps.length:U.isCompressedTexture&&Array.isArray(U.image)?I.mipmaps.length:1}function R(U){return U===hn||U===Xu||U===sl?s.NEAREST:s.LINEAR}function L(U){const I=U.target;I.removeEventListener("dispose",L),A(I),I.isVideoTexture&&f.delete(I)}function D(U){const I=U.target;I.removeEventListener("dispose",D),k(I)}function A(U){const I=n.get(U);if(I.__webglInit===void 0)return;const X=U.source,ye=p.get(X);if(ye){const ce=ye[I.__cacheKey];ce.usedTimes--,ce.usedTimes===0&&C(U),Object.keys(ye).length===0&&p.delete(X)}n.remove(U)}function C(U){const I=n.get(U);s.deleteTexture(I.__webglTexture);const X=U.source,ye=p.get(X);delete ye[I.__cacheKey],o.memory.textures--}function k(U){const I=U.texture,X=n.get(U),ye=n.get(I);if(ye.__webglTexture!==void 0&&(s.deleteTexture(ye.__webglTexture),o.memory.textures--),U.depthTexture&&U.depthTexture.dispose(),U.isWebGLCubeRen
3686derTarget)for(let ce=0;ce<6;ce++){if(Array.isArray(X.__webglFramebuffer[ce]))for(let he=0;he<X.__webglFramebuffer[ce].length;he++)s.deleteFramebuffer(X.__webglFramebuffer[ce][he]);else s.deleteFramebuffer(X.__webglFramebuffer[ce]);X.__webglDepthbuffer&&s.deleteRenderbuffer(X.__webglDepthbuffer[ce])}else{if(Array.isArray(X.__webglFramebuffer))for(let ce=0;ce<X.__webglFramebuffer.length;ce++)s.deleteFramebuffer(X.__webglFramebuffer[ce]);else s.deleteFramebuffer(X.__webglFramebuffer);if(X.__webglDepthbuffer&&s.deleteRenderbuffer(X.__webglDepthbuffer),X.__webglMultisampledFramebuffer&&s.deleteFramebuffer(X.__webglMultisampledFramebuffer),X.__webglColorRenderbuffer)for(let ce=0;ce<X.__webglColorRenderbuffer.length;ce++)X.__webglColorRenderbuffer[ce]&&s.deleteRenderbuffer(X.__webglColorRenderbuffer[ce]);X.__webglDepthRenderbuffer&&s.deleteRenderbuffer(X.__webglDepthRenderbuffer)}if(U.isWebGLMultipleRenderTargets)for(let ce=0,he=I.length;ce<he;ce++){const Te=n.get(I[ce]);Te.__webglTexture&&(s.deleteTexture(Te.__webglTexture),o.memory.textures--),n.remove(I[ce])}n.remove(I),n.remove(U)}let B=0;function ee(){B=0}function N(){const U=B;return U>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+U+" texture units while this GPU supports only "+i.maxTextures),B+=1,U}function q(U){const I=[];return I.push(U.wrapS),I.push(U.wrapT),I.push(U.wrapR||0),I.push(U.magFilter),I.push(U.minFilter),I.push(U.anisotropy),I.push(U.internalFormat),I.push(U.format),I.push(U.type),I.push(U.generateMipmaps),I.push(U.premultiplyAlpha),I.push(U.flipY),I.push(U.unpackAlignment),I.push(U.colorSpace),I.join()}function K(U,I){const X=n.get(U);if(U.isVideoTexture&&Ue(U),U.isRenderTargetTexture===!1&&U.version>0&&X.__version!==U.version){const ye=U.image;if(ye===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ye.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{te(X,U,I);return}}t.bindTexture(s.TEXTURE_2D,X.__webglTexture,s.TEXTURE0+I)}function re(U,I){const X=n.get(U);if(U.version>0&&X.__version!==U.version){te(X,U,I);return}t.bindTexture(s.TEXTURE_2D_ARRAY,X.__webglTexture,s.TEXTURE0+I)}function Z(U,I){const X=n.get(U);if(U.version>0&&X.__version!==U.version){te(X,U,I);return}t.bindTexture(s.TEXTURE_3D,X.__webglTexture,s.TEXTURE0+I)}function W(U,I){const X=n.get(U);if(U.version>0&&X.__version!==U.version){ae(X,U,I);return}t.bindTexture(s.TEXTURE_CUBE_MAP,X.__webglTexture,s.TEXTURE0+I)}const V={[gl]:s.REPEAT,[Vn]:s.CLAMP_TO_EDGE,[vl]:s.MIRRORED_REPEAT},F={[hn]:s.NEAREST,[Xu]:s.NEAREST_MIPMAP_NEAREST,[sl]:s.NEAREST_MIPMAP_LINEAR,[Kt]:s.LINEAR,[fp]:s.LINEAR_MIPMAP_NEAREST,[cs]:s.LINEAR_MIPMAP_LINEAR},j={[U_]:s.NEVER,[k_]:s.ALWAYS,[D_]:s.LESS,[Ep]:s.LEQUAL,[N_]:s.EQUAL,[B_]:s.GEQUAL,[F_]:s.GREATER,[O_]:s.NOTEQUAL};function G(U,I,X){if(X?(s.texParameteri(U,s.TEXTURE_WRAP_S,V[I.wrapS]),s.texParameteri(U,s.TEXTURE_WRAP_T,V[I.wrapT]),(U===s.TEXTURE_3D||U===s.TEXTURE_2D_ARRAY)&&s.texParameteri(U,s.TEXTURE_WRAP_R,V[I.wrapR]),s.texParameteri(U,s.TEXTURE_MAG_FILTER,F[I.magFilter]),s.texParameteri(U,s.TEXTURE_MIN_FILTER,F[I.minFilter])):(s.texParameteri(U,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(U,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),(U===s.TEXTURE_3D||U===s.TEXTURE_2D_ARRAY)&&s.texParameteri(U,s.TEXTURE_WRAP_R,s.CLAMP_TO_EDGE),(I.wrapS!==Vn||I.wrapT!==Vn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),s.texParameteri(U,s.TEXTURE_MAG_FILTER,R(I.magFilter)),s.texParameteri(U,s.TEXTURE_MIN_FILTER,R(I.minFilter)),I.minFilter!==hn&&I.minFilter!==Kt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),I.compareFunction&&(s.texParameteri(U,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(U,s.TEXTURE_COMPARE_FUNC,j[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ye=e.get("EXT_texture_filter_anisotropic");if(I.magFilter===hn||I.minFilter!==sl&&I.minFilter!==cs||I.type===Yi&&e.has("OES_texture_float_linear")===!1||a===!1&&I.type===aa&&e.has("OES_texture_half_float_linear")===!1)return;(I.anisotropy>1||n.get(I).__currentAnisotropy)&&(s.texParameterf(U,ye.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,i.getMaxAnisotropy())),n.get(I).__currentAnisotropy=I.anisotropy)}}function $(U,I){let X=!1;U.__webglInit===void 0&&(U.__webglInit=!0,I.addEventListener("dispose",L));const ye=I.source;let ce=p.get(ye);ce===void 0&&(ce={},p.set(ye,ce));const he=q(I);if(he!==U.__cacheKey){ce[he]===void 0&&(ce[he]={texture:s.createTexture(),usedTimes:0},o.memory.textures++,X=!0),ce[he].usedTimes++;const Te=ce[U.__cacheKey];Te!==void 0&&(ce[U.__cacheKey].usedTimes--,Te.usedTimes===0&&C(I)),U.__cacheKey=he,U.__webglTexture=ce[he].texture}return X}function te(U,I,X){let ye=s.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(ye=s.TEXTURE_2D_ARRAY),I.isData3DTexture&&(ye=s.TEXTURE_3D);const ce=$(U,I),he=I.source;t.bindTexture(ye,U.__webglTexture,s.TEXTURE0+X);const Te=n.get(he);if(he.version!==Te.__version||ce===!0){t.activeTexture(s.TEXTURE0+X);
3686const Ne=Bt.getPrimaries(Bt.workingColorSpace),Ce=I.colorSpace===Ai?null:Bt.getPrimaries(I.colorSpace),De=I.colorSpace===Ai||Ne===Ce?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,I.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,I.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,De);const ke=_(I)&&y(I.image)===!1;let xe=S(I.image,ke,!1,i.maxTextureSize);xe=fe(I,xe);const it=y(xe)||a,tt=r.convert(I.format,I.colorSpace);let Xe=r.convert(I.type),ze=b(I.internalFormat,tt,Xe,I.colorSpace,I.isVideoTexture);G(ye,I,it);let Le;const Q=I.mipmaps,we=a&&I.isVideoTexture!==!0&&ze!==yp,We=Te.__version===void 0||ce===!0,Be=P(I,xe,it);if(I.isDepthTexture)ze=s.DEPTH_COMPONENT,a?I.type===Yi?ze=s.DEPTH_COMPONENT32F:I.type===Pr?ze=s.DEPTH_COMPONENT24:I.type===is?ze=s.DEPTH24_STENCIL8:ze=s.DEPTH_COMPONENT16:I.type===Yi&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),I.format===rs&&ze===s.DEPTH_COMPONENT&&I.type!==$u&&I.type!==Pr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),I.type=Pr,Xe=r.convert(I.type)),I.format===no&&ze===s.DEPTH_COMPONENT&&(ze=s.DEPTH_STENCIL,I.type!==is&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),I.type=is,Xe=r.convert(I.type))),We&&(we?t.texStorage2D(s.TEXTURE_2D,1,ze,xe.width,xe.height):t.texImage2D(s.TEXTURE_2D,0,ze,xe.width,xe.height,0,tt,Xe,null));else if(I.isDataTexture)if(Q.length>0&&it){we&&We&&t.texStorage2D(s.TEXTURE_2D,Be,ze,Q[0].width,Q[0].height);for(let ge=0,J=Q.length;ge<J;ge++)Le=Q[ge],we?t.texSubImage2D(s.TEXTURE_2D,ge,0,0,Le.width,Le.height,tt,Xe,Le.data):t.texImage2D(s.TEXTURE_2D,ge,ze,Le.width,Le.height,0,tt,Xe,Le.data);I.generateMipmaps=!1}else we?(We&&t.texStorage2D(s.TEXTURE_2D,Be,ze,xe.width,xe.height),t.texSubImage2D(s.TEXTURE_2D,0,0,0,xe.width,xe.height,tt,Xe,xe.data)):t.texImage2D(s.TEXTURE_2D,0,ze,xe.width,xe.height,0,tt,Xe,xe.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){we&&We&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Be,ze,Q[0].width,Q[0].height,xe.depth);for(let ge=0,J=Q.length;ge<J;ge++)Le=Q[ge],I.format!==ri?tt!==null?we?t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,ge,0,0,0,Le.width,Le.height,xe.depth,tt,Le.data,0,0):t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,ge,ze,Le.width,Le.height,xe.depth,0,Le.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):we?t.texSubImage3D(s.TEXTURE_2D_ARRAY,ge,0,0,0,Le.width,Le.height,xe.depth,tt,Xe,Le.data):t.texImage3D(s.TEXTURE_2D_ARRAY,ge,ze,Le.width,Le.height,xe.depth,0,tt,Xe,Le.data)}else{we&&We&&t.texStorage2D(s.TEXTURE_2D,Be,ze,Q[0].width,Q[0].height);for(let ge=0,J=Q.length;ge<J;ge++)Le=Q[ge],I.format!==ri?tt!==null?we?t.compressedTexSubImage2D(s.TEXTURE_2D,ge,0,0,Le.width,Le.height,tt,Le.data):t.compressedTexImage2D(s.TEXTURE_2D,ge,ze,Le.width,Le.height,0,Le.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):we?t.texSubImage2D(s.TEXTURE_2D,ge,0,0,Le.width,Le.height,tt,Xe,Le.data):t.texImage2D(s.TEXTURE_2D,ge,ze,Le.width,Le.height,0,tt,Xe,Le.data)}else if(I.isDataArrayTexture)we?(We&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Be,ze,xe.width,xe.height,xe.depth),t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,xe.width,xe.height,xe.depth,tt,Xe,xe.data)):t.texImage3D(s.TEXTURE_2D_ARRAY,0,ze,xe.width,xe.height,xe.depth,0,tt,Xe,xe.data);else if(I.isData3DTexture)we?(We&&t.texStorage3D(s.TEXTURE_3D,Be,ze,xe.width,xe.height,xe.depth),t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,xe.width,xe.height,xe.depth,tt,Xe,xe.data)):t.texImage3D(s.TEXTURE_3D,0,ze,xe.width,xe.height,xe.depth,0,tt,Xe,xe.data);else if(I.isFramebufferTexture){if(We)if(we)t.texStorage2D(s.TEXTURE_2D,Be,ze,xe.width,xe.height);else{let ge=xe.width,J=xe.height;for(let Ge=0;Ge<Be;Ge++)t.texImage2D(s.TEXTURE_2D,Ge,ze,ge,J,0,tt,Xe,null),ge>>=1,J>>=1}}else if(Q.length>0&&it){we&&We&&t.texStorage2D(s.TEXTURE_2D,Be,ze,Q[0].width,Q[0].height);for(let ge=0,J=Q.length;ge<J;ge++)Le=Q[ge],we?t.texSubImage2D(s.TEXTURE_2D,ge,0,0,tt,Xe,Le):t.texImage2D(s.TEXTURE_2D,ge,ze,tt,Xe,Le);I.generateMipmaps=!1}
3686else we?(We&&t.texStorage2D(s.TEXTURE_2D,Be,ze,xe.width,xe.height),t.texSubImage2D(s.TEXTURE_2D,0,0,0,tt,Xe,xe)):t.texImage2D(s.TEXTURE_2D,0,ze,tt,Xe,xe);E(I,it)&&M(ye),Te.__version=he.version,I.onUpdate&&I.onUpdate(I)}U.__version=I.version}function ae(U,I,X){if(I.image.length!==6)return;const ye=$(U,I),ce=I.source;t.bindTexture(s.TEXTURE_CUBE_MAP,U.__webglTexture,s.TEXTURE0+X);const he=n.get(ce);if(ce.version!==he.__version||ye===!0){t.activeTexture(s.TEXTURE0+X);const Te=Bt.getPrimaries(Bt.workingColorSpace),Ne=I.colorSpace===Ai?null:Bt.getPrimaries(I.colorSpace),Ce=I.colorSpace===Ai||Te===Ne?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,I.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,I.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ce);const De=I.isCompressedTexture||I.image[0].isCompressedTexture,ke=I.image[0]&&I.image[0].isDataTexture,xe=[];for(let ge=0;ge<6;ge++)!De&&!ke?xe[ge]=S(I.image[ge],!1,!0,i.maxCubemapSize):xe[ge]=ke?I.image[ge].image:I.image[ge],xe[ge]=fe(I,xe[ge]);const it=xe[0],tt=y(it)||a,Xe=r.convert(I.format,I.colorSpace),ze=r.convert(I.type),Le=b(I.internalFormat,Xe,ze,I.colorSpace),Q=a&&I.isVideoTexture!==!0,we=he.__version===void 0||ye===!0;let We=P(I,it,tt);G(s.TEXTURE_CUBE_MAP,I,tt);let Be;if(De){Q&&we&&t.texStorage2D(s.TEXTURE_CUBE_MAP,We,Le,it.width,it.height);for(let ge=0;ge<6;ge++){Be=xe[ge].mipmaps;for(let J=0;J<Be.length;J++){const Ge=Be[J];I.format!==ri?Xe!==null?Q?t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,J,0,0,Ge.width,Ge.height,Xe,Ge.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,J,Le,Ge.width,Ge.height,0,Ge.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Q?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,J,0,0,Ge.width,Ge.height,Xe,ze,Ge.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,J,Le,Ge.width,Ge.height,0,Xe,ze,Ge.data)}}}else{Be=I.mipmaps,Q&&we&&(Be.length>0&&We++,t.texStorage2D(s.TEXTURE_CUBE_MAP,We,Le,xe[0].width,xe[0].height));for(let ge=0;ge<6;ge++)if(ke){Q?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,xe[ge].width,xe[ge].height,Xe,ze,xe[ge].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,Le,xe[ge].width,xe[ge].height,0,Xe,ze,xe[ge].data);for(let J=0;J<Be.length;J++){const Fe=Be[J].image[ge].image;Q?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,J+1,0,0,Fe.width,Fe.height,Xe,ze,Fe.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,J+1,Le,Fe.width,Fe.height,0,Xe,ze,Fe.data)}}else{Q?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,Xe,ze,xe[ge]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,Le,Xe,ze,xe[ge]);for(let J=0;J<Be.length;J++){const Ge=Be[J];Q?t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,J+1,0,0,Xe,ze,Ge.image[ge]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,J+1,Le,Xe,ze,Ge.image[ge])}}}E(I,tt)&&M(s.TEXTURE_CUBE_MAP),he.__version=ce.version,I.onUpdate&&I.onUpdate(I)}U.__version=I.version}function ne(U,I,X,ye,ce,he){const Te=r.convert(X.format,X.colorSpace),Ne=r.convert(X.type),Ce=b(X.internalFormat,Te,Ne,X.colorSpace);if(!n.get(I).__hasExternalTextures){const ke=Math.max(1,I.width>>he),xe=Math.max(1,I.height>>he);ce===s.TEXTURE_3D||ce===s.TEXTURE_2D_ARRAY?t.texImage3D(ce,he,Ce,ke,xe,I.depth,0,Te,Ne,null):t.texImage2D(ce,he,Ce,ke,xe,0,Te,Ne,null)}t.bindFramebuffer(s.FRAMEBUFFER,U),oe(I)?c.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,ye,ce,n.get(X).__webglTexture,0,de(I)):(ce===s.TEXTURE_2D||ce>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&ce<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,ye,ce,n.get(X).__webglTexture,he),t.bindFramebuffer(s.FRAMEBUFFER,null)}function pe(U,I,X){if(s.bindRenderbuffer(s.RENDERBUFFER,U),I.depthBuffer&&!I.stencilBuffer){let ye=a===!0?s.DEPTH_COMPONENT24:s.DEPTH_COMPONENT16;if(X||oe(I)){const ce=I.depthTexture;ce&&ce.isDepthTexture&&(ce.type===Yi?ye=s.DEPTH_COMPONENT32F:ce.type===Pr&&(ye=s.DEPTH_COMPONENT24));const he=de(I);oe(I)?c.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,he,ye,I.width,I.height):s.renderbufferStorageMultisample(s.RENDERBUFFER,he,ye,I.width,I.height)}else s.renderbufferStorage(s.RENDERBUFFER,ye,I.width,I.height);s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,U)}else if(I.depthBuffer&&I.stencilBuffer){const ye=de(I);X&&oe(I)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,ye,s.DEPTH24_STENCIL8,I.width,I.height):oe(I)?c.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,ye,s.DEPTH24_STENCIL8,I.width,I.height):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,I.width,I.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,U)}else{const ye=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let ce=0;ce<ye.length;ce++){const he=ye[ce],Te=r.convert(he.format,he.colorSpace),Ne=r.convert(he.type),Ce=b(he.internalFormat,Te,Ne,he.colorSpace),De=de(I);X&&oe(I)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,De,Ce,I.width,I.height):oe(I)?c.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,De,Ce,I.width,I.height):s.renderbufferStorage(s.RENDERBUFFER,Ce,I.width,I.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}
3686function Ie(U,I){if(I&&I.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(s.FRAMEBUFFER,U),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(I.depthTexture).__webglTexture||I.depthTexture.image.width!==I.width||I.depthTexture.image.height!==I.height)&&(I.depthTexture.image.width=I.width,I.depthTexture.image.height=I.height,I.depthTexture.needsUpdate=!0),K(I.depthTexture,0);const ye=n.get(I.depthTexture).__webglTexture,ce=de(I);if(I.depthTexture.format===rs)oe(I)?c.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,ye,0,ce):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,ye,0);else if(I.depthTexture.format===no)oe(I)?c.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,ye,0,ce):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,ye,0);else throw new Error("Unknown depthTexture format")}function Pe(U){const I=n.get(U),X=U.isWebGLCubeRenderTarget===!0;if(U.depthTexture&&!I.__autoAllocateDepthBuffer){if(X)throw new Error("target.depthTexture not supported in Cube render targets");Ie(I.__webglFramebuffer,U)}else if(X){I.__webglDepthbuffer=[];for(let ye=0;ye<6;ye++)t.bindFramebuffer(s.FRAMEBUFFER,I.__webglFramebuffer[ye]),I.__webglDepthbuffer[ye]=s.createRenderbuffer(),pe(I.__webglDepthbuffer[ye],U,!1)}else t.bindFramebuffer(s.FRAMEBUFFER,I.__webglFramebuffer),I.__webglDepthbuffer=s.createRenderbuffer(),pe(I.__webglDepthbuffer,U,!1);t.bindFramebuffer(s.FRAMEBUFFER,null)}function Se(U,I,X){const ye=n.get(U);I!==void 0&&ne(ye.__webglFramebuffer,U,U.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),X!==void 0&&Pe(U)}function O(U){const I=U.texture,X=n.get(U),ye=n.get(I);U.addEventListener("dispose",D),U.isWebGLMultipleRenderTargets!==!0&&(ye.__webglTexture===void 0&&(ye.__webglTexture=s.createTexture()),ye.__version=I.version,o.memory.textures++);const ce=U.isWebGLCubeRenderTarget===!0,he=U.isWebGLMultipleRenderTargets===!0,Te=y(U)||a;if(ce){X.__webglFramebuffer=[];for(let Ne=0;Ne<6;Ne++)if(a&&I.mipmaps&&I.mipmaps.length>0){X.__webglFramebuffer[Ne]=[];for(let Ce=0;Ce<I.mipmaps.length;Ce++)X.__webglFramebuffer[Ne][Ce]=s.createFramebuffer()}else X.__webglFramebuffer[Ne]=s.createFramebuffer()}else{if(a&&I.mipmaps&&I.mipmaps.length>0){X.__webglFramebuffer=[];for(let Ne=0;Ne<I.mipmaps.length;Ne++)X.__webglFramebuffer[Ne]=s.createFramebuffer()}else X.__webglFramebuffer=s.createFramebuffer();if(he)if(i.drawBuffers){const Ne=U.texture;for(let Ce=0,De=Ne.length;Ce<De;Ce++){const ke=n.get(Ne[Ce]);ke.__webglTexture===void 0&&(ke.__webglTexture=s.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&U.samples>0&&oe(U)===!1){const Ne=he?I:[I];X.__webglMultisampledFramebuffer=s.createFramebuffer(),X.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,X.__webglMultisampledFramebuffer);for(let Ce=0;Ce<Ne.length;Ce++){const De=Ne[Ce];X.__webglColorRenderbuffer[Ce]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,X.__webglColorRenderbuffer[Ce]);const ke=r.convert(De.format,De.colorSpace),xe=r.convert(De.type),it=b(De.internalFormat,ke,xe,De.colorSpace,U.isXRRenderTarget===!0),tt=de(U);s.renderbufferStorageMultisample(s.RENDERBUFFER,tt,it,U.width,U.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+Ce,s.RENDERBUFFER,X.__webglColorRenderbuffer[Ce])}s.bindRenderbuffer(s.RENDERBUFFER,null),U.depthBuffer&&(X.__webglDepthRenderbuffer=s.createRenderbuffer(),pe(X.__webglDepthRenderbuffer,U,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(ce){t.bindTexture(s.TEXTURE_CUBE_MAP,ye.__webglTexture),G(s.TEXTURE_CUBE_MAP,I,Te);for(let Ne=0;Ne<6;Ne++)if(a&&I.mipmaps&&I.mipmaps.length>0)for(let Ce=0;Ce<I.mipmaps.length;Ce++)ne(X.__webglFramebuffer[Ne][Ce],U,I,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,Ce);else ne(X.__webglFramebuffer[Ne],U,I,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0);E(I,Te)&&M(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(he){const Ne=U.texture;for(let Ce=0,De=Ne.length;Ce<De;Ce++){const ke=Ne[Ce],xe=n.get(ke);t.bindTexture(s.TEXTURE_2D,xe.__webglTexture),G(s.TEXTURE_2D,ke,Te),ne(X.__webglFramebuffer,U,ke,s.COLOR_ATTACHMENT0+Ce,s.TEXTURE_2D,0),E(ke,Te)&&M(s.TEXTURE_2D)}t.unbindTexture()}else{let Ne=s.TEXTURE_2D;
3686if((U.isWebGL3DRenderTarget||U.isWebGLArrayRenderTarget)&&(a?Ne=U.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Ne,ye.__webglTexture),G(Ne,I,Te),a&&I.mipmaps&&I.mipmaps.length>0)for(let Ce=0;Ce<I.mipmaps.length;Ce++)ne(X.__webglFramebuffer[Ce],U,I,s.COLOR_ATTACHMENT0,Ne,Ce);else ne(X.__webglFramebuffer,U,I,s.COLOR_ATTACHMENT0,Ne,0);E(I,Te)&&M(Ne),t.unbindTexture()}U.depthBuffer&&Pe(U)}function Me(U){const I=y(U)||a,X=U.isWebGLMultipleRenderTargets===!0?U.texture:[U.texture];for(let ye=0,ce=X.length;ye<ce;ye++){const he=X[ye];if(E(he,I)){const Te=U.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D,Ne=n.get(he).__webglTexture;t.bindTexture(Te,Ne),M(Te),t.unbindTexture()}}}function ue(U){if(a&&U.samples>0&&oe(U)===!1){const I=U.isWebGLMultipleRenderTargets?U.texture:[U.texture],X=U.width,ye=U.height;let ce=s.COLOR_BUFFER_BIT;const he=[],Te=U.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Ne=n.get(U),Ce=U.isWebGLMultipleRenderTargets===!0;if(Ce)for(let De=0;De<I.length;De++)t.bindFramebuffer(s.FRAMEBUFFER,Ne.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+De,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,Ne.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+De,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,Ne.__webglMultisampledFramebuffer),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Ne.__webglFramebuffer);for(let De=0;De<I.length;De++){he.push(s.COLOR_ATTACHMENT0+De),U.depthBuffer&&he.push(Te);const ke=Ne.__ignoreDepthValues!==void 0?Ne.__ignoreDepthValues:!1;if(ke===!1&&(U.depthBuffer&&(ce|=s.DEPTH_BUFFER_BIT),U.stencilBuffer&&(ce|=s.STENCIL_BUFFER_BIT)),Ce&&s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,Ne.__webglColorRenderbuffer[De]),ke===!0&&(s.invalidateFramebuffer(s.READ_FRAMEBUFFER,[Te]),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[Te])),Ce){const xe=n.get(I[De]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,xe,0)}s.blitFramebuffer(0,0,X,ye,0,0,X,ye,ce,s.NEAREST),h&&s.invalidateFramebuffer(s.READ_FRAMEBUFFER,he)}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),Ce)for(let De=0;De<I.length;De++){t.bindFramebuffer(s.FRAMEBUFFER,Ne.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+De,s.RENDERBUFFER,Ne.__webglColorRenderbuffer[De]);const ke=n.get(I[De]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,Ne.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+De,s.TEXTURE_2D,ke,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Ne.__webglMultisampledFramebuffer)}}function de(U){return Math.min(i.maxSamples,U.samples)}function oe(U){const I=n.get(U);return a&&U.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function Ue(U){const I=o.render.frame;f.get(U)!==I&&(f.set(U,I),U.update())}function fe(U,I){const X=U.colorSpace,ye=U.format,ce=U.type;return U.isCompressedTexture===!0||U.isVideoTexture===!0||U.format===Yu||X!==ar&&X!==Ai&&(Bt.getTransfer(X)===Wt?a===!1?e.has("EXT_sRGB")===!0&&ye===ri?(U.format=Yu,U.minFilter=Kt,U.generateMipmaps=!1):I=bp.sRGBToLinear(I):(ye!==ri||ce!==sr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",X)),I}this.allocateTextureUnit=N,this.resetTextureUnits=ee,this.setTexture2D=K,this.setTexture2DArray=re,this.setTexture3D=Z,this.setTextureCube=W,this.rebindTextures=Se,this.setupRenderTarget=O,this.updateRenderTargetMipmap=Me,this.updateMultisampleRenderTarget=ue,this.setupDepthRenderbuffer=Pe,this.setupFrameBufferTexture=ne,this.useMultisampledRTT=oe}function $_(s,e,t){const n=t.isWebGL2;function i(r,o=Ai){let a;const c=Bt.getTransfer(o);if(r===sr)return s.UNSIGNED_BYTE;if(r===pp)return s.UNSIGNED_SHORT_4_4_4_4;if(r===mp)return s.UNSIGNED_SHORT_5_5_5_1;if(r===x_)return s.BYTE;if(r===S_)return s.SHORT;if(r===$u)return s.UNSIGNED_SHORT;if(r===dp)return s.INT;if(r===Pr)return s.UNSIGNED_INT;if(r===Yi)return s.FLOAT;
vendor: 23,702 bytes, line 3686
3686if(r===aa)return n?s.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===M_)return s.ALPHA;if(r===ri)return s.RGBA;if(r===E_)return s.LUMINANCE;if(r===w_)return s.LUMINANCE_ALPHA;if(r===rs)return s.DEPTH_COMPONENT;if(r===no)return s.DEPTH_STENCIL;if(r===Yu)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===b_)return s.RED;if(r===gp)return s.RED_INTEGER;if(r===T_)return s.RG;if(r===vp)return s.RG_INTEGER;if(r===_p)return s.RGBA_INTEGER;if(r===Uu||r===Du||r===Nu||r===Fu)if(c===Wt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===Uu)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Du)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Nu)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Fu)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===Uu)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Du)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Nu)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Fu)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Sd||r===Md||r===Ed||r===wd)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===Sd)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Md)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Ed)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===wd)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===yp)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===bd||r===Td)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===bd)return c===Wt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===Td)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Ad||r===Cd||r===Rd||r===Pd||r===Ld||r===Id||r===Ud||r===Dd||r===Nd||r===Fd||r===Od||r===Bd||r===kd||r===zd)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===Ad)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Cd)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Rd)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===Pd)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Ld)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Id)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Ud)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Dd)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===Nd)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===Fd)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Od)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Bd)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===kd)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===zd)return c===Wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Ou||r===Gd||r===Hd)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===Ou)return c===Wt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===Gd)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===Hd)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===A_||r===Vd||r===Wd||r===Xd)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===Ou)return a.COMPRESSED_RED_RGTC1_EXT;if(r===Vd)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===Wd)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Xd)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===is?n?s.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):s[r]!==void 0?s[r]:null}return{convert:i}}class ey extends fn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class ia extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const tT={type:"move"};class Hf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ia,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 ia,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new H,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new H),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ia,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new H,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new H),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,o=null;const a=this._targetRay,c=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){o=!0;for(const S of e.hand.values()){const y=t.getJointPose(S,n),_=this._getHandJoint(h,S);y!==null&&(_.matrix.fromArray(y.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=y.radius),_.visible=y!==null}const f=h.joints["index-finger-tip"],d=h.joints["thumb-tip"],p=f.position.distanceTo(d.position),m=.02,v=.005;h.inputState.pinching&&p>m+v?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&p<=m-v&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(tT)))}return a!==null&&(a.visible=i!==null),c!==null&&(c.visible=r!==null),h!==null&&(h.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ia;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class nT extends Or{constructor(e,t){super();const n=this;let i=null,r=1,o=null,a="local-floor",c=1,h=null,f=null,d=null,p=null,m=null,v=null;const S=t.getContextAttributes();let y=null,_=null;const E=[],M=[],b=new Re;let P=null;const R=new fn;R.layers.enable(1),R.viewport=new Ft;const L=new fn;L.layers.enable(2),L.viewport=new Ft;const D=[R,L],A=new ey;A.layers.enable(1),A.layers.enable(2);let C=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(G){let $=E[G];return $===void 0&&($=new Hf,E[G]=$),$.getTargetRaySpace()},this.getControllerGrip=function(G){let $=E[G];return $===void 0&&($=new Hf,E[G]=$),$.getGripSpace()},this.getHand=function(G){let $=E[G];return $===void 0&&($=new Hf,E[G]=$),$.getHandSpace()};function B(G){const $=M.indexOf(G.inputSource);if($===-1)return;const te=E[$];te!==void 0&&(te.update(G.inputSource,G.frame,h||o),te.dispatchEvent({type:G.type,data:G.inputSource}))}function ee(){i.removeEventListener("select",B),i.removeEventListener("selectstart",B),i.removeEventListener("selectend",B),i.removeEventListener("squeeze",B),i.removeEventListener("squeezestart",B),i.removeEventListener("squeezeend",B),i.removeEventListener("end",ee),i.removeEventListener("inputsourceschange",N);for(let G=0;G<E.length;G++){const $=M[G];$!==null&&(M[G]=null,E[G].disconnect($))}C=null,k=null,e.setRenderTarget(y),m=null,p=null,d=null,i=null,_=null,j.stop(),n.isPresenting=!1,e.setPixelRatio(P),e.setSize(b.width,b.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(G){r=G,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(G){a=G,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||o},this.setReferenceSpace=function(G){h=G},this.getBaseLayer=function(){return p!==null?p:m},this.getBinding=function(){return d},this.getFrame=function(){return v},this.getSession=function(){return i},this.setSession=async function(G){if(i=G,i!==null){if(y=e.getRenderTarget(),i.addEventListener("select",B),i.addEventListener("selectstart",B),i.addEventListener("selectend",B),i.addEventListener("squeeze",B),i.addEventListener("squeezestart",B),i.addEventListener("squeezeend",B),i.addEventListener("end",ee),i.addEventListener("inputsourceschange",N),S.xrCompatible!==!0&&await t.makeXRCompatible(),P=e.getPixelRatio(),e.getSize(b),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const $={antialias:i.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:r};m=new XRWebGLLayer(i,t,$),i.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),_=new qi(m.framebufferWidth,m.framebufferHeight,{format:ri,type:sr,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil})}else{let $=null,te=null,ae=null;S.depth&&(ae=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,$=S.stencil?no:rs,te=S.stencil?is:Pr);const ne={colorFormat:t.RGBA8,depthFormat:ae,scaleFactor:r};d=new XRWebGLBinding(i,t),p=d.createProjectionLayer(ne),i.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),_=new qi(p.textureWidth,p.textureHeight,{format:ri,type:sr,depthTexture:new Lp(p.textureWidth,p.textureHeight,te,void 0,void 0,void 0,void 0,void 0,void 0,$),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0});const pe=e.properties.get(_);pe.__ignoreDepthValues=p.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(c),h=null,o=await i.requestReferenceSpace(a),j.setContext(i),j.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function N(G){for(let $=0;$<G.removed.length;$++){const te=G.removed[$],ae=M.indexOf(te);ae>=0&&(M[ae]=null,E[ae].disconnect(te))}for(let $=0;$<G.added.length;$++){const te=G.added[$];let ae=M.indexOf(te);if(ae===-1){for(let pe=0;pe<E.length;pe++)if(pe>=M.length){M.push(te),ae=pe;break}else if(M[pe]===null){M[pe]=te,ae=pe;break}if(ae===-1)break}const ne=E[ae];ne&&ne.connect(te)}}const q=new H,K=new H;function re(G,$,te){q.setFromMatrixPosition($.matrixWorld),K.setFromMatrixPosition(te.matrixWorld);const ae=q.distanceTo(K),ne=$.projectionMatrix.elements,pe=te.projectionMatrix.elements,Ie=ne[14]/(ne[10]-1),Pe=ne[14]/(ne[10]+1),Se=(ne[9]+1)/ne[5],O=(ne[9]-1)/ne[5],Me=(ne[8]-1)/ne[0],ue=(pe[8]+1)/pe[0],de=Ie*Me,oe=Ie*ue,Ue=ae/(-Me+ue),fe=Ue*-Me;$.matrixWorld.decompose(G.position,G.quaternion,G.scale),G.translateX(fe),G.translateZ(Ue),G.matrixWorld.compose(G.position,G.quaternion,G.scale),G.matrixWorldInverse.copy(G.matrixWorld).invert();const U=Ie+Ue,I=Pe+Ue,X=de-fe,ye=oe+(ae-fe),ce=Se*Pe/I*U,he=O*Pe/I*U;G.projectionMatrix.makePerspective(X,ye,ce,he,U,I),G.projectionMatrixInverse.copy(G.projectionMatrix).invert()}function Z(G,$){$===null?G.matrixWorld.copy(G.matrix):G.matrixWorld.multiplyMatrices($.matrixWorld,G.matrix),G.matrixWorldInverse.copy(G.matrixWorld).invert()}this.updateCamera=function(G){if(i===null)return;A.near=L.near=R.near=G.near,A.far=L.far=R.far=G.far,(C!==A.near||k!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,k=A.far);const $=G.parent,te=A.cameras;Z(A,$);for(let ae=0;ae<te.length;ae++)Z(te[ae],$);te.length===2?re(A,R,L):A.projectionMatrix.copy(R.projectionMatrix),W(G,A,$)};function W(G,$,te){te===null?G.matrix.copy($.matrixWorld):(G.matrix.copy(te.matrixWorld),G.matrix.invert(),G.matrix.multiply($.matrixWorld)),G.matrix.decompose(G.position,G.quaternion,G.scale),G.updateMatrixWorld(!0),G.projectionMatrix.copy($.projectionMatrix),G.projectionMatrixInverse.copy($.projectionMatrixInverse),G.isPerspectiveCamera&&(G.fov=ca*2*Math.atan(1/G.projectionMatrix.elements[5]),G.zoom=1)}this.getCamera=function(){return A},this.getFoveation=function(){if(!(p===null&&m===null))return c},this.setFoveation=function(G){c=G,p!==null&&(p.fixedFoveation=G),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=G)};let V=null;function F(G,$){if(f=$.getViewerPose(h||o),v=$,f!==null){const te=f.views;m!==null&&(e.setRenderTargetFramebuffer(_,m.framebuffer),e.setRenderTarget(_));let ae=!1;te.length!==A.cameras.length&&(A.cameras.length=0,ae=!0);for(let ne=0;ne<te.length;ne++){const pe=te[ne];let Ie=null;if(m!==null)Ie=m.getViewport(pe);else{const Se=d.getViewSubImage(p,pe);Ie=Se.viewport,ne===0&&(e.setRenderTargetTextures(_,Se.colorTexture,p.ignoreDepthValues?void 0:Se.depthStencilTexture),e.setRenderTarget(_))}let Pe=D[ne];Pe===void 0&&(Pe=new fn,Pe.layers.enable(ne),Pe.viewport=new Ft,D[ne]=Pe),Pe.matrix.fromArray(pe.transform.matrix),Pe.matrix.decompose(Pe.position,Pe.quaternion,Pe.scale),Pe.projectionMatrix.fromArray(pe.projectionMatrix),Pe.projectionMatrixInverse.copy(Pe.projectionMatrix).invert(),Pe.viewport.set(Ie.x,Ie.y,Ie.width,Ie.height),ne===0&&(A.matrix.copy(Pe.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),ae===!0&&A.cameras.push(Pe)}}for(let te=0;te<E.length;te++){const ae=M[te],ne=E[te];ae!==null&&ne!==void 0&&ne.update(ae,$,h||o)}V&&V(G,$),$.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:$}),v=null}const j=new j_;j.setAnimationLoop(F),this.setAnimationLoop=function(G){V=G},this.dispose=function(){}}}function iT(s,e){function t(y,_){y.matrixAutoUpdate===!0&&y.updateMatrix(),_.value.copy(y.matrix)}function n(y,_){_.color.getRGB(y.fogColor.value,W_(s)),_.isFog?(y.fogNear.value=_.near,y.fogFar.value=_.far):_.isFogExp2&&(y.fogDensity.value=_.density)}function i(y,_,E,M,b){_.isMeshBasicMaterial||_.isMeshLambertMaterial?r(y,_):_.isMeshToonMaterial?(r(y,_),d(y,_)):_.isMeshPhongMaterial?(r(y,_),f(y,_)):_.isMeshStandardMaterial?(r(y,_),p(y,_),_.isMeshPhysicalMaterial&&m(y,_,b)):_.isMeshMatcapMaterial?(r(y,_),v(y,_)):_.isMeshDepthMaterial?r(y,_):_.isMeshDistanceMaterial?(r(y,_),S(y,_)):_.isMeshNormalMaterial?r(y,_):_.isLineBasicMaterial?(o(y,_),_.isLineDashedMaterial&&a(y,_)):_.isPointsMaterial?c(y,_,E,M):_.isSpriteMaterial?h(y,_):_.isShadowMaterial?(y.color.value.copy(_.color),y.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function r(y,_){y.opacity.value=_.opacity,_.color&&y.diffuse.value.copy(_.color),_.emissive&&y.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.bumpMap&&(y.bumpMap.value=_.bumpMap,t(_.bumpMap,y.bumpMapTransform),y.bumpScale.value=_.bumpScale,_.side===si&&(y.bumpScale.value*=-1)),_.normalMap&&(y.normalMap.value=_.normalMap,t(_.normalMap,y.normalMapTransform),y.normalScale.value.copy(_.normalScale),_.side===si&&y.normalScale.value.negate()),_.displacementMap&&(y.displacementMap.value=_.displacementMap,t(_.displacementMap,y.displacementMapTransform),y.displacementScale.value=_.displacementScale,y.displacementBias.value=_.displacementBias),_.emissiveMap&&(y.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,y.emissiveMapTransform)),_.specularMap&&(y.specularMap.value=_.specularMap,t(_.specularMap,y.specularMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest);const E=e.get(_).envMap;if(E&&(y.envMap.value=E,y.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=_.reflectivity,y.ior.value=_.ior,y.refractionRatio.value=_.refractionRatio),_.lightMap){y.lightMap.value=_.lightMap;const M=s._useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=_.lightMapIntensity*M,t(_.lightMap,y.lightMapTransform)}_.aoMap&&(y.aoMap.value=_.aoMap,y.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,y.aoMapTransform))}function o(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform))}function a(y,_){y.dashSize.value=_.dashSize,y.totalSize.value=_.dashSize+_.gapSize,y.scale.value=_.scale}function c(y,_,E,M){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.size.value=_.size*E,y.scale.value=M*.5,_.map&&(y.map.value=_.map,t(_.map,y.uvTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function h(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.rotation.value=_.rotation,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function f(y,_){y.specular.value.copy(_.specular),y.shininess.value=Math.max(_.shininess,1e-4)}function d(y,_){_.gradientMap&&(y.gradientMap.value=_.gradientMap)}function p(y,_){y.metalness.value=_.metalness,_.metalnessMap&&(y.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,y.metalnessMapTransform)),y.roughness.value=_.roughness,_.roughnessMap&&(y.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,y.roughnessMapTransform)),e.get(_).envMap&&(y.envMapIntensity.value=_.envMapIntensity)}function m(y,_,E){y.ior.value=_.ior,_.sheen>0&&(y.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),y.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(y.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,y.sheenColorMapTransform)),_.sheenRoughnessMap&&(y.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,y.sheenRoughnessMapTransform))),_.clearcoat>0&&(y.clearcoat.value=_.clearcoat,y.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(y.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,y.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(y.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===si&&y.clearcoatNormalScale.value.negate())),_.iridescence>0&&(y.iridescence.value=_.iridescence,y.iridescenceIOR.value=_.iridescenceIOR,y.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(y.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,y.iridescenceMapTransform)),_.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),_.transmission>0&&(y.transmission.value=_.transmission,y.transmissionSamplerMap.value=E.texture,y.transmissionSamplerSize.value.set(E.width,E.height),_.transmissionMap&&(y.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,y.transmissionMapTransform)),y.thickness.value=_.thickness,_.thicknessMap&&(y.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=_.attenuationDistance,y.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(y.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(y.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=_.specularIntensity,y.specularColor.value.copy(_.specularColor),_.specularColorMap&&(y.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,y.specularColorMapTransform)),_.specularIntensityMap&&(y.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,y.specularIntensityMapTransform))}function v(y,_){_.matcap&&(y.matcap.value=_.matcap)}function S(y,_){const E=e.get(_).light;y.referencePosition.value.setFromMatrixPosition(E.matrixWorld),y.nearDistance.value=E.shadow.camera.near,y.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function rT(s,e,t,n){let i={},r={},o=[];const a=t.isWebGL2?s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(E,M){const b=M.program;n.uniformBlockBinding(E,b)}function h(E,M){let b=i[E.id];b===void 0&&(v(E),b=f(E),i[E.id]=b,E.addEventListener("dispose",y));const P=M.program;n.updateUBOMapping(E,P);const R=e.render.frame;r[E.id]!==R&&(p(E),r[E.id]=R)}function f(E){const M=d();E.__bindingPointIndex=M;const b=s.createBuffer(),P=E.__size,R=E.usage;return s.bindBuffer(s.UNIFORM_BUFFER,b),s.bufferData(s.UNIFORM_BUFFER,P,R),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,M,b),b}function d(){for(let E=0;E<a;E++)if(o.indexOf(E)===-1)return o.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(E){const M=i[E.id],b=E.uniforms,P=E.__cache;s.bindBuffer(s.UNIFORM_BUFFER,M);for(let R=0,L=b.length;R<L;R++){const D=Array.isArray(b[R])?b[R]:[b[R]];for(let A=0,C=D.length;A<C;A++){const k=D[A];if(m(k,R,A,P)===!0){const B=k.__offset,ee=Array.isArray(k.value)?k.value:[k.value];let N=0;for(let q=0;q<ee.length;q++){const K=ee[q],re=S(K);typeof K=="number"||typeof K=="boolean"?(k.__data[0]=K,s.bufferSubData(s.UNIFORM_BUFFER,B+N,k.__data)):K.isMatrix3?(k.__data[0]=K.elements[0],k.__data[1]=K.elements[1],k.__data[2]=K.elements[2],k.__data[3]=0,k.__data[4]=K.elements[3],k.__data[5]=K.elements[4],k.__data[6]=K.elements[5],k.__data[7]=0,k.__data[8]=K.elements[6],k.__data[9]=K.elements[7],k.__data[10]=K.elements[8],k.__data[11]=0):(K.toArray(k.__data,N),N+=re.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,B,k.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function m(E,M,b,P){const R=E.value,L=M+"_"+b;if(P[L]===void 0)return typeof R=="number"||typeof R=="boolean"?P[L]=R:P[L]=R.clone(),!0;{const D=P[L];if(typeof R=="number"||typeof R=="boolean"){if(D!==R)return P[L]=R,!0}else if(D.equals(R)===!1)return D.copy(R),!0}return!1}function v(E){const M=E.uniforms;let b=0;const P=16;for(let L=0,D=M.length;L<D;L++){const A=Array.isArray(M[L])?M[L]:[M[L]];for(let C=0,k=A.length;C<k;C++){const B=A[C],ee=Array.isArray(B.value)?B.value:[B.value];for(let N=0,q=ee.length;N<q;N++){const K=ee[N],re=S(K),Z=b%P;Z!==0&&P-Z<re.boundary&&(b+=P-Z),B.__data=new Float32Array(re.storage/Float32Array.BYTES_PER_ELEMENT),B.__offset=b,b+=re.storage}}}const R=b%P;return R>
36860&&(b+=P-R),E.__size=b,E.__cache={},this}function S(E){const M={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(M.boundary=4,M.storage=4):E.isVector2?(M.boundary=8,M.storage=8):E.isVector3||E.isColor?(M.boundary=16,M.storage=12):E.isVector4?(M.boundary=16,M.storage=16):E.isMatrix3?(M.boundary=48,M.storage=48):E.isMatrix4?(M.boundary=64,M.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),M}function y(E){const M=E.target;M.removeEventListener("dispose",y);const b=o.indexOf(M.__bindingPointIndex);o.splice(b,1),s.deleteBuffer(i[M.id]),delete i[M.id],delete r[M.id]}function _(){for(const E in i)s.deleteBuffer(i[E]);o=[],i={},r={}}return{bind:c,update:h,dispose:_}}class Ip{constructor(e={}){const{canvas:t=G_(),context:n=null,depth:i=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:h=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let p;n!==null?p=n.getContextAttributes().alpha:p=o;const m=new Uint32Array(4),v=new Int32Array(4);let S=null,y=null;const _=[],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=yn,this._useLegacyLights=!1,this.toneMapping=rr,this.toneMappingExposure=1;const M=this;let b=!1,P=0,R=0,L=null,D=-1,A=null;const C=new Ft,k=new Ft;let B=null;const ee=new $e(0);let N=0,q=t.width,K=t.height,re=1,Z=null,W=null;const V=new Ft(0,0,q,K),F=new Ft(0,0,q,K);let j=!1;const G=new kl;let $=!1,te=!1,ae=null;const ne=new yt,pe=new Re,Ie=new H,Pe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Se(){return L===null?re:1}let O=n;function Me(z,le){for(let _e=0;_e<z.length;_e++){const Ee=z[_e],ve=t.getContext(Ee,le);if(ve!==null)return ve}return null}try{const z={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:h,powerPreference:f,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ju}`),t.addEventListener("webglcontextlost",ge,!1),t.addEventListener("webglcontextrestored",J,!1),t.addEventListener("webglcontextcreationerror",Ge,!1),O===null){const le=["webgl2","webgl","experimental-webgl"];if(M.isWebGL1Renderer===!0&&le.shift(),O=Me(le,z),O===null)throw Me(le)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&O instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),O.getShaderPrecisionFormat===void 0&&(O.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(z){throw console.error("THREE.WebGLRenderer: "+z.message),z}let ue,de,oe,Ue,fe,U,I,X,ye,ce,he,Te,Ne,Ce,De,ke,xe,it,tt,Xe,ze,Le,Q,we;function We(){ue=new _w(O),de=new fw(O,ue,e),ue.init(de),Le=new $_(O,ue,de),oe=new $b(O,ue,de),Ue=new Sw(O),fe=new Gb,U=new eT(O,ue,oe,fe,de,Le,Ue),I=new pw(M),X=new vw(M),ye=new RS(O,de),Q=new uw(O,ue,ye,de),ce=new yw(O,ye,Ue,Q),he=new bw(O,ce,ye,Ue),tt=new ww(O,de,U),ke=new dw(fe),Te=new zb(M,I,X,ue,de,Q,ke),Ne=new iT(M,fe),Ce=new Vb,De=new Zb(ue,de),it=ne
vendor: 4,759 bytes, line 3686
3686w cw(M,I,X,oe,he,p,c),xe=new Qb(M,he,de),we=new rT(O,Ue,de,oe),Xe=new hw(O,ue,Ue,de),ze=new xw(O,ue,Ue,de),Ue.programs=Te.programs,M.capabilities=de,M.extensions=ue,M.properties=fe,M.renderLists=Ce,M.shadowMap=xe,M.state=oe,M.info=Ue}We();const Be=new nT(M,O);this.xr=Be,this.getContext=function(){return O},this.getContextAttributes=function(){return O.getContextAttributes()},this.forceContextLoss=function(){const z=ue.get("WEBGL_lose_context");z&&z.loseContext()},this.forceContextRestore=function(){const z=ue.get("WEBGL_lose_context");z&&z.restoreContext()},this.getPixelRatio=function(){return re},this.setPixelRatio=function(z){z!==void 0&&(re=z,this.setSize(q,K,!1))},this.getSize=function(z){return z.set(q,K)},this.setSize=function(z,le,_e=!0){if(Be.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=z,K=le,t.width=Math.floor(z*re),t.height=Math.floor(le*re),_e===!0&&(t.style.width=z+"px",t.style.height=le+"px"),this.setViewport(0,0,z,le)},this.getDrawingBufferSize=function(z){return z.set(q*re,K*re).floor()},this.setDrawingBufferSize=function(z,le,_e){q=z,K=le,re=_e,t.width=Math.floor(z*_e),t.height=Math.floor(le*_e),this.setViewport(0,0,z,le)},this.getCurrentViewport=function(z){return z.copy(C)},this.getViewport=function(z){return z.copy(V)},this.setViewport=function(z,le,_e,Ee){z.isVector4?V.set(z.x,z.y,z.z,z.w):V.set(z,le,_e,Ee),oe.viewport(C.copy(V).multiplyScalar(re).floor())},this.getScissor=function(z){return z.copy(F)},this.setScissor=function(z,le,_e,Ee){z.isVector4?F.set(z.x,z.y,z.z,z.w):F.set(z,le,_e,Ee),oe.scissor(k.copy(F).multiplyScalar(re).floor())},this.getScissorTest=function(){return j},this.setScissorTest=function(z){oe.setScissorTest(j=z)},this.setOpaqueSort=function(z){Z=z},this.setTransparentSort=function(z){W=z},this.getClearColor=function(z){return z.copy(it.getClearColor())},this.setClearColor=function(){it.setClearColor.apply(it,arguments)},this.getClearAlpha=function(){return it.getClearAlpha()},this.setClearAlpha=function(){it.setClearAlpha.apply(it,arguments)},this.clear=function(z=!0,le=!0,_e=!0){let Ee=0;if(z){let ve=!1;if(L!==null){const Je=L.texture.format;ve=Je===_p||Je===vp||Je===gp}if(ve){const Je=L.texture.type,ot=Je===sr||Je===Pr||Je===$u||Je===is||Je===pp||Je===mp,ct=it.getClearColor(),Oe=it.getClearAlpha(),mt=ct.r,vt=ct.g,ft=ct.b;ot?(m[0]=mt,m[1]=vt,m[2]=ft,m[3]=Oe,O.clearBufferuiv(O.COLOR,0,m)):(v[0]=mt,v[1]=vt,v[2]=ft,v[3]=Oe,O.clearBufferiv(O.COLOR,0,v))}else Ee|=O.COLOR_BUFFER_BIT}le&&(Ee|=O.DEPTH_BUFFER_BIT),_e&&(Ee|=O.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),O.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",ge,!1),t.removeEventListener("webglcontextrestored",J,!1),t.removeEventListener("webglcontextcreationerror",Ge,!1),Ce.dispose(),De.dispose(),fe.dispose(),I.dispose(),X.dispose(),he.dispose(),Q.dispose(),we.dispose(),Te.dispose(),Be.dispose(),Be.removeEventListener("sessionstart",At),Be.removeEventListener("sessionend",gt),ae&&(ae.dispose(),ae=null),Lt.stop()};function ge(z){z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function J(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const z=Ue.autoReset,le=xe.enabled,_e=xe.autoUpdate,Ee=xe.needsUpdate,ve=xe.type;We(),Ue.autoReset=z,xe.enabled=le,xe.autoUpdate=_e,xe.needsUpdate=Ee,xe.type=ve}function Ge(z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",z.statusMessage)}function Fe(z){const le=z.target;le.removeEventListener("dispose",Fe),He(le)}function He(z){je(z),fe.remove(z)}function je(z){const le=fe.get(z).programs;le!==void 0&&(le.forEach(function(_e){Te.releaseProgram(_e)}),z.isShaderMaterial&&Te.releaseShaderCache(z))}this.renderBufferDirect=function(z,le,_e,Ee,ve,Je){le===null&&(le=Pe);const ot=ve.isMesh&&ve.matrixWorld.determinant()<0,ct=ho(z,le,_e,Ee,ve);oe.setMaterial(Ee,ot);let Oe=_e.index,mt=1;if(Ee.wireframe===!0){if(Oe=ce.getWireframeAttribute(_e),Oe===void 0)return;mt=2}const vt=_e.drawRange,ft=_e.attributes.position;let zt=vt.start*mt,pn=(vt.start+vt.count)*mt;Je!==null&&(zt=Math.max(zt,Je.start*mt),pn=Math.min(pn,(Je.start+Je.count)*mt)),Oe!==null?(zt=Math.max(zt,0),pn=Math.min(pn,Oe.count)):ft!=null&&(zt=Math.max(zt,0),pn=Math.min(pn,ft.count));const Ot=pn-zt;if(Ot<0||Ot===1/0)return;Q.setup(ve,Ee,ct,_e,Oe);let qt,ut=Xe;if(Oe!==null&&(qt=ye.get(Oe),ut=ze,ut.setIndex(qt)),ve.isMesh)Ee.wireframe===!0?(oe.setLineWidth(Ee.wireframeLinewidth*Se()),ut.setMode(O.LINES)):ut.setMode(O.TRIANGLES);else if(ve.isLine){let et=Ee.linewidth;
vendor: 4,184 bytes, line 3686
3686et===void 0&&(et=1),oe.setLineWidth(et*Se()),ve.isLineSegments?ut.setMode(O.LINES):ve.isLineLoop?ut.setMode(O.LINE_LOOP):ut.setMode(O.LINE_STRIP)}else ve.isPoints?ut.setMode(O.POINTS):ve.isSprite&&ut.setMode(O.TRIANGLES);if(ve.isBatchedMesh)ut.renderMultiDraw(ve._multiDrawStarts,ve._multiDrawCounts,ve._multiDrawCount);else if(ve.isInstancedMesh)ut.renderInstances(zt,Ot,ve.count);else if(_e.isInstancedBufferGeometry){const et=_e._maxInstanceCount!==void 0?_e._maxInstanceCount:1/0,Pn=Math.min(_e.instanceCount,et);ut.renderInstances(zt,Ot,Pn)}else ut.render(zt,Ot)};function rt(z,le,_e){z.transparent===!0&&z.side===pi&&z.forceSinglePass===!1?(z.side=si,z.needsUpdate=!0,Nn(z,le,_e),z.side=Ur,z.needsUpdate=!0,Nn(z,le,_e),z.side=pi):Nn(z,le,_e)}this.compile=function(z,le,_e=null){_e===null&&(_e=z),y=De.get(_e),y.init(),E.push(y),_e.traverseVisible(function(ve){ve.isLight&&ve.layers.test(le.layers)&&(y.pushLight(ve),ve.castShadow&&y.pushShadow(ve))}),z!==_e&&z.traverseVisible(function(ve){ve.isLight&&ve.layers.test(le.layers)&&(y.pushLight(ve),ve.castShadow&&y.pushShadow(ve))}),y.setupLights(M._useLegacyLights);const Ee=new Set;return z.traverse(function(ve){const Je=ve.material;if(Je)if(Array.isArray(Je))for(let ot=0;ot<Je.length;ot++){const ct=Je[ot];rt(ct,_e,ve),Ee.add(ct)}else rt(Je,_e,ve),Ee.add(Je)}),E.pop(),y=null,Ee},this.compileAsync=function(z,le,_e=null){const Ee=this.compile(z,le,_e);return new Promise(ve=>{function Je(){if(Ee.forEach(function(ot){fe.get(ot).currentProgram.isReady()&&Ee.delete(ot)}),Ee.size===0){ve(z);return}setTimeout(Je,10)}ue.get("KHR_parallel_shader_compile")!==null?Je():setTimeout(Je,10)})};let Ze=null;function ht(z){Ze&&Ze(z)}function At(){Lt.stop()}function gt(){Lt.start()}const Lt=new j_;Lt.setAnimationLoop(ht),typeof self<"u"&&Lt.setContext(self),this.setAnimationLoop=function(z){Ze=z,Be.setAnimationLoop(z),z===null?Lt.stop():Lt.start()},Be.addEventListener("sessionstart",At),Be.addEventListener("sessionend",gt),this.render=function(z,le){if(le!==void 0&&le.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;z.matrixWorldAutoUpdate===!0&&z.updateMatrixWorld(),le.parent===null&&le.matrixWorldAutoUpdate===!0&&le.updateMatrixWorld(),Be.enabled===!0&&Be.isPresenting===!0&&(Be.cameraAutoUpdate===!0&&Be.updateCamera(le),le=Be.getCamera()),z.isScene===!0&&z.onBeforeRender(M,z,le,L),y=De.get(z,E.length),y.init(),E.push(y),ne.multiplyMatrices(le.projectionMatrix,le.matrixWorldInverse),G.setFromProjectionMatrix(ne),te=this.localClippingEnabled,$=ke.init(this.clippingPlanes,te),S=Ce.get(z,_.length),S.init(),_.push(S),Yt(z,le,0,M.sortObjects),S.finish(),M.sortObjects===!0&&S.sort(Z,W),this.info.render.frame++,$===!0&&ke.beginShadows();const _e=y.state.shadowsArray;if(xe.render(_e,z,le),$===!0&&ke.endShadows(),this.info.autoReset===!0&&this.info.reset(),it.render(S,z),y.setupLights(M._useLegacyLights),le.isArrayCamera){const Ee=le.cameras;for(let ve=0,Je=Ee.length;ve<Je;ve++){const ot=Ee[ve];oi(S,z,ot,ot.viewport)}}else oi(S,z,le);L!==null&&(U.updateMultisampleRenderTarget(L),U.updateRenderTargetMipmap(L)),z.isScene===!0&&z.onAfterRender(M,z,le),Q.resetDefaultState(),D=-1,A=null,E.pop(),E.length>0?y=E[E.length-1]:y=null,_.pop(),_.length>0?S=_[_.length-1]:S=null};function Yt(z,le,_e,Ee){if(z.visible===!1)return;if(z.layers.test(le.layers)){if(z.isGroup)_e=z.renderOrder;else if(z.isLOD)z.autoUpdate===!0&&z.update(le);else if(z.isLight)y.pushLight(z),z.castShadow&&y.pushShadow(z);else if(z.isSprite){if(!z.frustumCulled||G.intersectsSprite(z)){Ee&&Ie.setFromMatrixPosition(z.matrixWorld).applyMatrix4(ne);const ot=he.update(z),ct=z.material;ct.visible&&S.push(z,ot,ct,_e,Ie.z,null)}}else if((z.isMesh||z.isLine||z.isPoints)&&(!z.frustumCulled||G.intersectsObject(z))){const ot=he.update(z),ct=z.material;if(Ee&&(z.boundingSphere!==void 0?(z.boundingSphere===null&&z.computeBoundingSphere(),Ie.copy(z.boundingSphere.center)):(ot.boundingSphere===null&&ot.computeBoundingSphere(),Ie.copy(ot.boundingSphere.center)),Ie.applyMatrix4(z.matrixWorld).applyMatrix4(ne)),Array.isArray(ct)){const Oe=ot.groups;for(let mt=0,vt=Oe.length;mt<vt;
3686mt++){const ft=Oe[mt],zt=ct[ft.materialIndex];zt&&zt.visible&&S.push(z,ot,zt,_e,Ie.z,ft)}}else ct.visible&&S.push(z,ot,ct,_e,Ie.z,null)}}const Je=z.children;for(let ot=0,ct=Je.length;ot<ct;ot++)Yt(Je[ot],le,_e,Ee)}function oi(z,le,_e,Ee){const ve=z.opaque,Je=z.transmissive,ot=z.transparent;y.setupLightsView(_e),$===!0&&ke.setGlobalState(M.clippingPlanes,_e),Je.length>0&&jn(ve,Je,le,_e),Ee&&oe.viewport(C.copy(Ee)),ve.length>0&&qn(ve,le,_e),Je.length>0&&qn(Je,le,_e),ot.length>0&&qn(ot,le,_e),oe.buffers.depth.setTest(!0),oe.buffers.depth.setMask(!0),oe.buffers.color.setMask(!0),oe.setPolygonOffset(!1)}function jn(z,le,_e,Ee){if((_e.isScene===!0?_e.overrideMaterial:null)!==null)return;const Je=de.isWebGL2;ae===null&&(ae=new qi(1,1,{generateMipmaps:!0,type:ue.has("EXT_color_buffer_half_float")?aa:sr,minFilter:cs,samples:Je?4:0})),M.getDrawingBufferSize(pe),Je?ae.setSize(pe.x,pe.y):ae.setSize(ju(pe.x),ju(pe.y));const ot=M.getRenderTarget();M.setRenderTarget(ae),M.getClearColor(ee),N=M.getClearAlpha(),N<1&&M.setClearColor(16777215,.5),M.clear();const ct=M.toneMapping;M.toneMapping=rr,qn(z,_e,Ee),U.updateMultisampleRenderTarget(ae),U.updateRenderTargetMipmap(ae);let Oe=!1;for(let mt=0,vt=le.length;mt<vt;mt++){const ft=le[mt],zt=ft.object,pn=ft.geometry,Ot=ft.material,qt=ft.group;if(Ot.side===pi&&zt.layers.test(Ee.layers)){const ut=Ot.side;Ot.side=si,Ot.needsUpdate=!0,Dn(zt,_e,Ee,pn,Ot,qt),Ot.side=ut,Ot.needsUpdate=!0,Oe=!0}}Oe===!0&&(U.updateMultisampleRenderTarget(ae),U.updateRenderTargetMipmap(ae)),M.setRenderTarget(ot),M.setClearColor(ee,N),M.toneMapping=ct}function qn(z,le,_e){const Ee=le.isScene===!0?le.overrideMaterial:null;for(let ve=0,Je=z.length;ve<Je;ve++){const ot=z[ve],ct=ot.object,Oe=ot.geometry,mt=Ee===null?ot.material:Ee,vt=ot.group;ct.layers.test(_e.layers)&&Dn(ct,le,_e,Oe,mt,vt)}}function Dn(z,le,_e,Ee,ve,Je){z.onBeforeRender(M,le,_e,Ee,ve,Je),z.modelViewMatrix.multiplyMatrices(_e.matrixWorldInverse,z.matrixWorld),z.normalMatrix.getNormalMatrix(z.modelViewMatrix),ve.onBeforeRender(M,le,_e,Ee,z,Je),ve.transparent===!0&&ve.side===pi&&ve.forceSinglePass===!1?(ve.side=si,ve.needsUpdate=!0,M.renderBufferDirect(_e,le,Ee,ve,z,Je),ve.side=Ur,ve.needsUpdate=!0,M.renderBufferDirect(_e,le,Ee,ve,z,Je),ve.side=pi):M.renderBufferDirect(_e,le,Ee,ve,z,Je),z.onAfterRender(M,le,_e,Ee,ve,Je)}function Nn(z,le,_e){le.isScene!==!0&&(le=Pe);const Ee=fe.get(z),ve=y.state.lights,Je=y.state.shadowsArray,ot=ve.state.version,ct=Te.getParameters(z,ve.state,Je,le,_e),Oe=Te.getProgramCacheKey(ct);let mt=Ee.programs;Ee.environment=z.isMeshStandardMaterial?le.environment:null,Ee.fog=le.fog,Ee.envMap=(z.isMeshStandardMaterial?X:I).get(z.envMap||Ee.environment),mt===void 0&&(z.addEventListener("dispose",Fe),mt=new Map,Ee.programs=mt);let vt=mt.get(Oe);if(vt!==void 0){if(Ee.currentProgram===vt&&Ee.lightsStateVersion===ot)return Ri(z,ct),vt}else ct.uniforms=Te.getUniforms(z),z.onBuild(_e,ct,M),z.onBeforeCompile(ct,M),vt=Te.acquireProgram(ct,Oe),mt.set(Oe,vt),Ee.uniforms=ct.uniforms;
vendor: 4,171 bytes, line 3686
3686const ft=Ee.uniforms;return(!z.isShaderMaterial&&!z.isRawShaderMaterial||z.clipping===!0)&&(ft.clippingPlanes=ke.uniform),Ri(z,ct),Ee.needsLights=_a(z),Ee.lightsStateVersion=ot,Ee.needsLights&&(ft.ambientLightColor.value=ve.state.ambient,ft.lightProbe.value=ve.state.probe,ft.directionalLights.value=ve.state.directional,ft.directionalLightShadows.value=ve.state.directionalShadow,ft.spotLights.value=ve.state.spot,ft.spotLightShadows.value=ve.state.spotShadow,ft.rectAreaLights.value=ve.state.rectArea,ft.ltc_1.value=ve.state.rectAreaLTC1,ft.ltc_2.value=ve.state.rectAreaLTC2,ft.pointLights.value=ve.state.point,ft.pointLightShadows.value=ve.state.pointShadow,ft.hemisphereLights.value=ve.state.hemi,ft.directionalShadowMap.value=ve.state.directionalShadowMap,ft.directionalShadowMatrix.value=ve.state.directionalShadowMatrix,ft.spotShadowMap.value=ve.state.spotShadowMap,ft.spotLightMatrix.value=ve.state.spotLightMatrix,ft.spotLightMap.value=ve.state.spotLightMap,ft.pointShadowMap.value=ve.state.pointShadowMap,ft.pointShadowMatrix.value=ve.state.pointShadowMatrix),Ee.currentProgram=vt,Ee.uniformsList=null,vt}function dn(z){if(z.uniformsList===null){const le=z.currentProgram.getUniforms();z.uniformsList=ku.seqWithValue(le.seq,z.uniforms)}return z.uniformsList}function Ri(z,le){const _e=fe.get(z);_e.outputColorSpace=le.outputColorSpace,_e.batching=le.batching,_e.instancing=le.instancing,_e.instancingColor=le.instancingColor,_e.skinning=le.skinning,_e.morphTargets=le.morphTargets,_e.morphNormals=le.morphNormals,_e.morphColors=le.morphColors,_e.morphTargetsCount=le.morphTargetsCount,_e.numClippingPlanes=le.numClippingPlanes,_e.numIntersection=le.numClipIntersection,_e.vertexAlphas=le.vertexAlphas,_e.vertexTangents=le.vertexTangents,_e.toneMapping=le.toneMapping}function ho(z,le,_e,Ee,ve){le.isScene!==!0&&(le=Pe),U.resetTextureUnits();const Je=le.fog,ot=Ee.isMeshStandardMaterial?le.environment:null,ct=L===null?M.outputColorSpace:L.isXRRenderTarget===!0?L.texture.colorSpace:ar,Oe=(Ee.isMeshStandardMaterial?X:I).get(Ee.envMap||ot),mt=Ee.vertexColors===!0&&!!_e.attributes.color&&_e.attributes.color.itemSize===4,vt=!!_e.attributes.tangent&&(!!Ee.normalMap||Ee.anisotropy>0),ft=!!_e.morphAttributes.position,zt=!!_e.morphAttributes.normal,pn=!!_e.morphAttributes.color;let Ot=rr;Ee.toneMapped&&(L===null||L.isXRRenderTarget===!0)&&(Ot=M.toneMapping);const qt=_e.morphAttributes.position||_e.morphAttributes.normal||_e.morphAttributes.color,ut=qt!==void 0?qt.length:0,et=fe.get(Ee),Pn=y.state.lights;if($===!0&&(te===!0||z!==A)){const on=z===A&&Ee.id===D;ke.setState(Ee,z,on)}let Mt=!1;Ee.version===et.__version?(et.needsLights&&et.lightsStateVersion!==Pn.state.version||et.outputColorSpace!==ct||ve.isBatchedMesh&&et.batching===!1||!ve.isBatchedMesh&&et.batching===!0||ve.isInstancedMesh&&et.instancing===!1||!ve.isInstancedMesh&&et.instancing===!0||ve.isSkinnedMesh&&et.skinning===!1||!ve.isSkinnedMesh&&et.skinning===!0||ve.isInstancedMesh&&et.instancingColor===!0&&ve.instanceColor===null||ve.isInstancedMesh&&et.instancingColor===!1&&ve.instanceColor!==null||et.envMap!==Oe||Ee.fog===!0&&et.fog!==Je||et.numClippingPlanes!==void 0&&(et.numClippingPlanes!==ke.numPlanes||et.numIntersection!==ke.numIntersection)||et.vertexAlphas!==mt||et.vertexTangents!==vt||et.morphTargets!==ft||et.morphNormals!==zt||et.morphColors!==pn||et.toneMapping!==Ot||de.isWebGL2===!0&&et.morphTargetsCount!==ut)&&(Mt=!0):(Mt=!0,et.__version=Ee.version);let Vt=et.currentProgram;Mt===!0&&(Vt=Nn(Ee,le,ve));let vi=!1,Mn=!1,$t=!1;const Gt=Vt.getUniforms(),ai=et.uniforms;if(oe.useProgram(Vt.program)&&(vi=!0,Mn=!0,$t=!0),Ee.id!==D&&(D=Ee.id,Mn=!0),vi||A!==z){Gt.setValue(O,"projectionMatrix",z.projectionMatrix),Gt.setValue(O,"viewMatrix",z.matrixWorldInverse);const on=Gt.map.cameraPosition;on!==void 0&&on.setValue(O,Ie.setFromMatrixPosition(z.matrixWorld)),de.logarithmicDepthBuffer&&Gt.setValue(O,"logDepthBufFC",2/(Math.log(z.far+1)/Math.LN2)),(Ee.isMeshPhongMaterial||Ee.isMeshToonMaterial||Ee.isMeshLambertMaterial||Ee.isMeshBasicMaterial||Ee.isMeshStandardMaterial||Ee.isShaderMaterial)&&Gt.setValue(O,"isOrthographic",z.isOrthographicCamera===!0),A!==z&&(A=z,Mn=!0,$t
3686=!0)}if(ve.isSkinnedMesh){Gt.setOptional(O,ve,"bindMatrix"),Gt.setOptional(O,ve,"bindMatrixInverse");const on=ve.skeleton;on&&(de.floatVertexTextures?(on.boneTexture===null&&on.computeBoneTexture(),Gt.setValue(O,"boneTexture",on.boneTexture,U)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}ve.isBatchedMesh&&(Gt.setOptional(O,ve,"batchingTexture"),Gt.setValue(O,"batchingTexture",ve._matricesTexture,U));const Ki=_e.morphAttributes;if((Ki.position!==void 0||Ki.normal!==void 0||Ki.color!==void 0&&de.isWebGL2===!0)&&tt.update(ve,_e,Vt),(Mn||et.receiveShadow!==ve.receiveShadow)&&(et.receiveShadow=ve.receiveShadow,Gt.setValue(O,"receiveShadow",ve.receiveShadow)),Ee.isMeshGouraudMaterial&&Ee.envMap!==null&&(ai.envMap.value=Oe,ai.flipEnvMap.value=Oe.isCubeTexture&&Oe.isRenderTargetTexture===!1?-1:1),Mn&&(Gt.setValue(O,"toneMappingExposure",M.toneMappingExposure),et.needsLights&&ps(ai,$t),Je&&Ee.fog===!0&&Ne.refreshFogUniforms(ai,Je),Ne.refreshMaterialUniforms(ai,Ee,re,K,ae),ku.upload(O,dn(et),ai,U)),Ee.isShaderMaterial&&Ee.uniformsNeedUpdate===!0&&(ku.upload(O,dn(et),ai,U),Ee.uniformsNeedUpdate=!1),Ee.isSpriteMaterial&&Gt.setValue(O,"center",ve.center),Gt.setValue(O,"modelViewMatrix",ve.modelViewMatrix),Gt.setValue(O,"normalMatrix",ve.normalMatrix),Gt.setValue(O,"modelMatrix",ve.matrixWorld),Ee.isShaderMaterial||Ee.isRawShaderMaterial){const on=Ee.uniformsGroups;for(let Ln=0,Zn=on.length;Ln<Zn;Ln++)if(de.isWebGL2){const ur=on[Ln];we.update(ur,Vt),we.bind(ur,Vt)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Vt}function ps(z,le){z.ambientLightColor.needsUpdate=le,z.lightProbe.needsUpdate=le,z.directionalLights.needsUpdate=le,z.directionalLightShadows.needsUpdate=le,z.pointLights.needsUpdate=le,z.pointLightShadows.needsUpdate=le,z.spotLights.needsUpdate=le,z.spotLightShadows.needsUpdate=le,z.rectAreaLights.needsUpdate=le,z.hemisphereLights.needsUpdate=le}function _a(z){return z.isMeshLambertMaterial||z.isMeshToonMaterial||z.isMeshPhongMaterial||z.isMeshStandardMaterial||z.isShadowMaterial||z.isShaderMaterial&&z.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return L},this.setRenderTargetTextures=function(z,le,_e){fe.get(z.texture).__webglTexture=le,fe.get(z.depthTexture).__webglTexture=_e;const Ee=fe.get(z);Ee.__hasExternalTextures=!0,Ee.__hasExternalTextures&&(Ee.__autoAllocateDepthBuffer=_e===void 0,Ee.__autoAllocateDepthBuffer||ue.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(z,le){const _e=fe.get(z);_e.__webglFramebuffer=le,_e.__useDefaultFramebuffer=le===void 0},this.setRenderTarget=function(z,le=0,_e=0){L=z,P=le,R=_e;let Ee=!0,ve=null,Je=!1,ot=!1;if(z){const Oe=fe.get(z);Oe.__useDefaultFramebuffer!==void 0?(oe.bindFramebuffer(O.FRAMEBUFFER,null),Ee=!1):Oe.__webglFramebuffer===void 0?U.setupRenderTarget(z):Oe.__hasExternalTextures&&U.rebindTextures(z,fe.get(z.texture).__webglTexture,fe.get(z.depthTexture).__webglTexture);const mt=z.texture;(mt.isData3DTexture||mt.isDataArrayTexture||mt.isCompressedArrayTexture)&&(ot=!0);const vt=fe.get(z).__webglFramebuffer;z.isWebGLCubeRenderTarget?(Array.isArray(vt[le])?ve=vt[le][_e]:ve=vt[le],Je=!0):de.isWebGL2&&z.samples>0&&U.useMultisampledRTT(z)===!1?ve=fe.get(z).__webglMultisampledFramebuffer:Array.isArray(vt)?ve=vt[_e]:ve=vt,C.copy(z.viewport),k.copy(z.scissor),B=z.scissorTest}else C.copy(V).multiplyScalar(re).floor(),k.copy(F).multiplyScalar(re).floor(),B=j;if(oe.bindFramebuffer(O.FRAMEBUFFER,ve)&&de.drawBuffers&&Ee&&oe.drawBuffers(z,ve),oe.viewport(C),oe.scissor(k),oe.setScissorTest(B),Je){const Oe=fe.get(z.texture);O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+le,Oe.__webglTexture,_e)}else if(ot){const Oe=fe.get(z.texture),mt=le||0;O.framebufferTextureLayer(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,Oe.__webglTexture,_e||0,mt)}D=-1},this.readRenderTargetPixels=function(z,le,_e,Ee,ve,Je,ot){if(!(z&&z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ct=fe.get(z).__webglFramebuffer;
3686if(z.isWebGLCubeRenderTarget&&ot!==void 0&&(ct=ct[ot]),ct){oe.bindFramebuffer(O.FRAMEBUFFER,ct);try{const Oe=z.texture,mt=Oe.format,vt=Oe.type;if(mt!==ri&&Le.convert(mt)!==O.getParameter(O.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ft=vt===aa&&(ue.has("EXT_color_buffer_half_float")||de.isWebGL2&&ue.has("EXT_color_buffer_float"));if(vt!==sr&&Le.convert(vt)!==O.getParameter(O.IMPLEMENTATION_COLOR_READ_TYPE)&&!(vt===Yi&&(de.isWebGL2||ue.has("OES_texture_float")||ue.has("WEBGL_color_buffer_float")))&&!ft){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}le>=0&&le<=z.width-Ee&&_e>=0&&_e<=z.height-ve&&O.readPixels(le,_e,Ee,ve,Le.convert(mt),Le.convert(vt),Je)}finally{const Oe=L!==null?fe.get(L).__webglFramebuffer:null;oe.bindFramebuffer(O.FRAMEBUFFER,Oe)}}},this.copyFramebufferToTexture=function(z,le,_e=0){const Ee=Math.pow(2,-_e),ve=Math.floor(le.image.width*Ee),Je=Math.floor(le.image.height*Ee);U.setTexture2D(le,0),O.copyTexSubImage2D(O.TEXTURE_2D,_e,0,0,z.x,z.y,ve,Je),oe.unbindTexture()},this.copyTextureToTexture=function(z,le,_e,Ee=0){const ve=le.image.width,Je=le.image.height,ot=Le.convert(_e.format),ct=Le.convert(_e.type);U.setTexture2D(_e,0),O.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,_e.flipY),O.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_e.premultiplyAlpha),O.pixelStorei(O.UNPACK_ALIGNMENT,_e.unpackAlignment),le.isDataTexture?O.texSubImage2D(O.TEXTURE_2D,Ee,z.x,z.y,ve,Je,ot,ct,le.image.data):le.isCompressedTexture?O.compressedTexSubImage2D(O.TEXTURE_2D,Ee,z.x,z.y,le.mipmaps[0].width,le.mipmaps[0].height,ot,le.mipmaps[0].data):O.texSubImage2D(O.TEXTURE_2D,Ee,z.x,z.y,ot,ct,le.image),Ee===0&&_e.generateMipmaps&&O.generateMipmap(O.TEXTURE_2D),oe.unbindTexture()},this.copyTextureToTexture3D=function(z,le,_e,Ee,ve=0){if(M.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Je=z.max.x-z.min.x+1,ot=z.max.y-z.min.y+1,ct=z.max.z-z.min.z+1,Oe=Le.convert(Ee.format),mt=Le.convert(Ee.type);let vt;if(Ee.isData3DTexture)U.setTexture3D(Ee,0),vt=O.TEXTURE_3D;else if(Ee.isDataArrayTexture||Ee.isCompressedArrayTexture)U.setTexture2DArray(Ee,0),vt=O.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}O.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,Ee.flipY),O.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ee.premultiplyAlpha),O.pixelStorei(O.UNPACK_ALIGNMENT,Ee.unpackAlignment);const ft=O.getParameter(O.UNPACK_ROW_LENGTH),zt=O.getParameter(O.UNPACK_IMAGE_HEIGHT),pn=O.getParameter(O.UNPACK_SKIP_PIXELS),Ot=O.getParameter(O.UNPACK_SKIP_ROWS),qt=O.getParameter(O.UNPACK_SKIP_IMAGES),ut=_e.isCompressedTexture?_e.mipmaps[ve]:_e.image;O.pixelStorei(O.UNPACK_ROW_LENGTH,ut.width),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,ut.height),O.pixelStorei(O.UNPACK_SKIP_PIXELS,z.min.x),O.pixelStorei(O.UNPACK_SKIP_ROWS,z.min.y),O.pixelStorei(O.UNPACK_SKIP_IMAGES,z.min.z),_e.isDataTexture||_e.isData3DTexture?O.texSubImage3D(vt,ve,le.x,le.y,le.z,Je,ot,ct,Oe,mt,ut.data):_e.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),O.compressedTexSubImage3D(vt,ve,le.x,le.y,le.z,Je,ot,ct,Oe,ut.data)):O.texSubImage3D(vt,ve,le.x,le.y,le.z,Je,ot,ct,Oe,mt,ut),O.pixelStorei(O.UNPACK_ROW_LENGTH,ft),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,zt),O.pixelStorei(O.UNPACK_SKIP_PIXELS,pn),O.pixelStorei(O.UNPACK_SKIP_ROWS,Ot),O.pixelStorei(O.UNPACK_SKIP_IMAGES,qt),ve===0&&Ee.generateMipmaps&&O.generateMipmap(vt),oe.unbindTexture()},this.initTexture=function(z){z.isCubeTexture?U.setTextureCube(z,0):z.isData3DTexture?U.setTexture3D(z,0):z.isDataArrayTexture||z.isCompressedArrayTexture?U.setTexture2DArray(z,0):U.setTexture2D(z,0),oe.unbindTexture()},this.resetState=function(){P=0,R=0,L=null,oe.reset(),Q.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ji}get outputColorSpace(){return this._outputColorSpace}
vendor: 45,535 bytes, line 3686
3686set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===th?"display-p3":"srgb",t.unpackColorSpace=Bt.workingColorSpace===Nl?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===yn?ss:Sp}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===ss?yn:ar}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class ty extends Ip{}ty.prototype.isWebGL1Renderer=!0;class oh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new $e(e),this.density=t}clone(){return new oh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class ah{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new $e(e),this.near=t,this.far=n}clone(){return new ah(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Up extends Nt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class lh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=wl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Ci()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ci()),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=Ci()),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 ni=new H;class io{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++)ni.fromBufferAttribute(this,t),ni.applyMatrix4(e),this.setXYZ(t,ni.x,ni.y,ni.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ni.fromBufferAttribute(this,t),ni.applyNormalMatrix(e),this.setXYZ(t,ni.x,ni.y,ni.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ni.fromBufferAttribute(this,t),ni.transformDirection(e),this.setXYZ(t,ni.x,ni.y,ni.z);return this}setX(e,t){return this.normalized&&(t=bt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=bt(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=mi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=mi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=mi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=mi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=bt(t,this.array),n=bt(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=bt(t,this.array),n=bt(n,this.array),i=bt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array),i=bt(i,this.array),r=bt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new kt(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 io(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Dp extends Xn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new $e(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 Ho;const ja=new H,Vo=new H,Wo=new H,Xo=new Re,qa=new Re,ny=new yt,iu=new H,Za=new H,ru=new H,g0=new Re,Vf=new Re,v0=new Re;class iy extends Nt{constructor(e=new Dp){if(super(),this.isSprite=!0,this.type="Sprite",Ho===void 0){Ho=new Tt;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 lh(t,5);Ho.setIndex([0,1,2,0,2,3]),Ho.setAttribute("position",new io(n,3,0,!1)),Ho.setAttribute("uv",new io(n,2,3,!1))}this.geometry=Ho,this.material=e,this.center=new Re(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Vo.setFromMatrixScale(this.matrixWorld),ny.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Wo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Vo.multiplyScalar(-Wo.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;su(iu.set(-.5,-.5,0),Wo,o,Vo,i,r),su(Za.set(.5,-.5,0),Wo,o,Vo,i,r),su(ru.set(.5,.5,0),Wo,o,Vo,i,r),g0.set(0,0),Vf.set(1,0),v0.set(1,1);let a=e.ray.intersectTriangle(iu,Za,ru,!1,ja);if(a===null&&(su(Za.set(-.5,.5,0),Wo,o,Vo,i,r),Vf.set(0,1),a=e.ray.intersectTriangle(iu,ru,Za,!1,ja),a===null))return;const c=e.ray.origin.distanceTo(ja);c<e.near||c>e.far||t.push({distance:c,point:ja.clone(),uv:di.getInterpolation(ja,iu,Za,ru,g0,Vf,v0,new Re),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 su(s,e,t,n,i,r){Xo.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(qa.x=r*Xo.x-i*Xo.y,qa.y=i*Xo.x+r*Xo.y):qa.copy(Xo),s.copy(e),s.x+=qa.x,s.y+=qa.y,s.applyMatrix4(ny)}const ou=new H,_0=new H;class ry extends Nt{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 r=t[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){ou.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(ou);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ou.setFromMatrixPosition(e.matrixWorld),_0.setFromMatrixPosition(this.matrixWorld);const n=ou.distanceTo(_0)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;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,r=n.length;i<r;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const y0=new H,x0=new Ft,S0=new Ft,sT=new H,M0=new yt,au=new H,Wf=new Rn,E0=new yt,Xf=new oo;class sy extends rn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=xd,this.bindMatrix=new yt,this.bindMatrixInverse=new yt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Cn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,au),this.boundingBox.expandByPoint(au)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Rn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,au),this.boundingSphere.expandByPoint(au)}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(),Wf.copy(this.boundingSphere),Wf.applyMatrix4(i),e.ray.intersectsSphere(Wf)!==!1&&(E0.copy(i).invert(),Xf.copy(e.ray).applyMatrix4(E0),!(this.boundingBox!==null&&Xf.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Xf)))}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 Ft,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===xd?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===y_?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;x0.fromBufferAttribute(i.attributes.skinIndex,e),S0.fromBufferAttribute(i.attributes.skinWeight,e),y0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const o=S0.getComponent(r);if(o!==0){const a=x0.getComponent(r);M0.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(sT.copy(y0).applyMatrix4(M0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}class Np extends Nt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class eo extends sn{constructor(e=null,t=1,n=1,i,r,o,a,c,h=hn,f=hn,d,p){super(null,o,a,c,h,f,i,r,d,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const w0=new yt,oT=new yt;class ch{constructor(e=[],t=[]){this.uuid=Ci(),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 yt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new yt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,o=e.length;r<o;r++){const a=e[r]?e[r].matrixWorld:oT;w0.multiplyMatrices(a,t[r]),w0.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new ch(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 eo(t,e,e,ri,Yi);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let o=t[r];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),o=new Np),this.bones.push(o),this.boneInverses.push(new yt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class ro extends kt{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 yt,b0=new yt,lu=[],T0=new Cn,aT=new yt,Ja=new rn,Ka=new Rn;class oy extends rn{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ro(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,aT)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Cn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Yo),T0.copy(e.boundingBox).applyMatrix4(Yo),this.boundingBox.union(T0)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Rn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Yo),Ka.copy(e.boundingSphere).applyMatrix4(Yo),this.boundingSphere.union(Ka)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ja.geometry=this.geometry,Ja.material=this.material,Ja.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ka.copy(this.boundingSphere),Ka.applyMatrix4(n),e.ray.intersectsSphere(Ka)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,Yo),b0.multiplyMatrices(n,Yo),Ja.matrixWorld=b0,Ja.raycast(e,lu);for(let o=0,a=lu.length;o<a;o++){const c=lu[o];c.instanceId=r,c.object=this,t.push(c)}lu.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new ro(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}function lT(s,e){return s.z-e.z}function cT(s,e){return e.z-s.z}class uT{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t){const n=this.pool,i=this.list;this.index>=n.length&&n.push({start:-1,count:-1,z:-1});const r=n[this.index];i.push(r),this.index++,r.start=e.start,r.count=e.count,r.z=t}reset(){this.list.length=0,this.index=0}}const jo="batchId",es=new yt,A0=new yt,hT=new yt,C0=new yt,Yf=new kl,cu=new Cn,Ns=new Rn,Qa=new H,jf=new uT,Hn=new rn,uu=[];function fT(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let r=0;r<i;r++)for(let o=0;o<n;o++)e.setComponent(r+t,o,s.getComponent(r,o))}else e.array.set(s.array,t*n);e.needsUpdate=!0}class ay extends rn{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,t,n=t*2,i){super(new Tt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxGeometryCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new eo(t,e,e,ri,Yi);this._matricesTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxGeometryCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const a in e.attributes){const c=e.getAttribute(a),{array:h,itemSize:f,normalized:d}=c,p=new h.constructor(n*f),m=new c.constructor(p,f,d);m.setUsage(c.usage),t.setAttribute(a,m)}if(e.getIndex()!==null){const a=n>65536?new Uint32Array(r):new Uint16Array(r);t.setIndex(new kt(a,1))}const o=i>65536?new Uint32Array(n):new Uint16Array(n);t.setAttribute(jo,new kt(o,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(jo))throw new Error(`BatchedMesh: Geometry cannot use attribute "${jo}"`);const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(n===jo)continue;if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.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 Cn);const e=this._geometryCount,t=this.boundingBox,n=this._active;t.makeEmpty();for(let i=0;i<e;i++)n[i]!==!1&&(this.getMatrixAt(i,es),this.getBoundingBoxAt(i,cu).applyMatrix4(es),t.union(cu))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Rn);const e=this._geometryCount,t=this.boundingSphere,n=this._active;t.makeEmpty();for(let i=0;i<e;i++)n[i]!==!1&&(this.getMatrixAt(i,es),this.getBoundingSphereAt(i,Ns).applyMatrix4(es),t.union(Ns))}addGeometry(e,t=-1,n=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let r=null;const o=this._reservedRanges,a=this._drawRanges,c=this._bounds;this._geometryCount!==0&&(r=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,r===null?i.vertexStart=0:i.vertexStart=r.vertexStart+r.vertexCount;const h=e.getIndex(),f=h!==null;if(f&&(n===-1?i.indexCount=h.count:i.indexCount=n,r===null?i.indexStart=0:i.indexStart=r.indexStart+r.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const d=this._visibility,p=this._active,m=this._matricesTexture,v=this._matricesTexture.image.data;d.push(!0),p.push(!0);const S=this._geometryCount;this._geometryCount++,hT.toArray(v,S*16),m.needsUpdate=!0,o.push(i),a.push({start:f?i.indexStart:i.vertexStart,count:-1}),c.push({boxInitialized:!1,box:new Cn,sphereInitialized:!1,sphere:new Rn});const y=this.geometry.getAttribute(jo);for(let _=0;_<i.vertexCount;_++)y.setX(i.vertexStart+_,S);return y.needsUpdate=!0,this.setGeometryAt(S,e),S}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,r=n.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const c=a.vertexStart,h=a.vertexCount;for(const m in n.attributes){if(m===jo)continue;const v=t.getAttribute(m),S=n.getAttribute(m);fT(v,S,c);const y=v.itemSize;for(let _=v.count,E=h;_<E;_++){const M=c+_;for(let b=0;b<y;b++)S.setComponent(M,b,0)}S.needsUpdate=!0}if(i){const m=a.indexStart;for(let v=0;v<o.count;v++)r.setX(m+v,c+o.getX(v));for(let v=o.count,S=a.indexCount;v<S;v++)r.setX(m+v,c);r.needsUpdate=!0}const f=this._bounds[e];t.boundingBox!==null?(f.box.copy(t.boundingBox),f.boxInitialized=!0):f.boxInitialized=!1,t.boundingSphere!==null?(f.sphere.copy(t.boundingSphere),f.sphereInitialized=!0):f.sphereInitialized=!1;const d=this._drawRanges[e],p=t.getAttribute("position");return d.count=i?o.count:p.count,this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._active;return e>=t.length||t[e]===!1?this:(t[e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(this._active[e]===!1)return this;const i=this._bounds[e],r=i.box,o=this.geometry;if(i.boxInitialized===!1){r.makeEmpty();const a=o.index,c=o.attributes.position,h=this._drawRanges[e];for(let f=h.start,d=h.start+h.count;f<d;f++){let p=f;a&&(p=a.getX(p)),r.expandByPoint(Qa.fromBufferAttribute(c,p))}i.boxInitialized=!0}return t.copy(r),t}getBoundingSphereAt(e,t){if(this._active[e]===!1)return this;const i=this._bounds[e],r=i.sphere,o=this.geometry;if(i.sphereInitialized===!1){r.makeEmpty(),this.getBoundingBoxAt(e,cu),cu.getCenter(r.center);const a=o.index,c=o.attributes.position,h=this._drawRanges[e];let f=0;for(let d=h.start,p=h.start+h.count;d<p;d++){let m=d;a&&(m=a.getX(m)),Qa.fromBufferAttribute(c,m),f=Math.max(f,r.center.distanceToSquared(Qa))}r.radius=Math.sqrt(f),i.sphereInitialized=!0}return t.copy(r),t}setMatrixAt(e,t){const n=this._active,i=this._matricesTexture,r=this._matricesTexture.image.data,o=this._geometryCount;return e>=o||n[e]===!1?this:(t.toArray(r,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._active,i=this._matricesTexture.image.data,r=this._geometryCount;return e>=r||n[e]===!1?null:t.fromArray(i,e*16)}setVisibleAt(e,t){const n=this._visibility,i=this._active,r=this._geometryCount;return e>=r||i[e]===!1||n[e]===t?this:(n[e]=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._visibility,n=this._active,i=this._geometryCount;return e>=i||n[e]===!1?!1:t[e]}raycast(e,t){const n=this._visibility,i=this._active,r=this._drawRanges,o=this._geometryCount,a=this.matrixWorld,c=this.geometry;Hn.material=this.material,Hn.geometry.index=c.index,Hn.geometry.attributes=c.attributes,Hn.geometry.boundingBox===null&&(Hn.geometry.boundingBox=new Cn),Hn.geometry.boundingSphere===null&&(Hn.geometry.boundingSphere=new Rn);for(let h=0;h<o;h++){if(!n[h]||!i[h])continue;const f=r[h];Hn.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(h,Hn.matrixWorld).premultiply(a),this.getBoundingBoxAt(h,Hn.geometry.boundingBox),this.getBoundingSphereAt(h,Hn.geometry.boundingSphere),Hn.raycast(e,uu);for(let d=0,p=uu.length;d<p;d++){const m=uu[d];m.object=this,m.batchId=h,t.push(m)}uu.length=0}Hn.material=null,Hn.geometry.index=null,Hn.geometry.attributes={},Hn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,c=this._visibility,h=this._multiDrawStarts,f=this._multiDrawCounts,d=this._drawRanges,p=this.perObjectFrustumCulled;p&&(C0.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Yf.setFromProjectionMatrix(C0,e.isWebGPURenderer?la:ji));let m=0;if(this.sortObjects){A0.copy(this.matrixWorld).invert(),Qa.setFromMatrixPosition(n.matrixWorld).applyMatrix4(A0);for(let y=0,_=c.length;y<_;y++)if(c[y]){this.getMatrixAt(y,es),this.getBoundingSphereAt(y,Ns).applyMatrix4(es);let E=!1;if(p&&(E=!Yf.intersectsSphere(Ns)),!E){const M=Qa.distanceTo(Ns.center);jf.push(d[y],M)}}const v=jf.list,S=this.customSort;S===null?v.sort(r.transparent?cT:lT):S.call(this,v,n);for(let y=0,_=v.length;y<_;y++){const E=v[y];h[m]=E.start*a,f[m]=E.count,m++}jf.reset()}else for(let v=0,S=c.length;v<S;v++)if(c[v]){let y=!1;if(p&&(this.getMatrixAt(v,es),this.getBoundingSphereAt(v,Ns).applyMatrix4(es),y=!Yf.intersectsSphere(Ns)),!y){const _=d[v];h[m]=_.start*a,f[m]=_.count,m++}}this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,o){this.onBeforeRender(e,null,i,r,o)}}class Yn extends Xn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new $e(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 R0=new H,P0=new H,L0=new yt,qf=new oo,hu=new Rn;class Nr extends Nt{constructor(e=new Tt,t=new Yn){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,r=t.count;i<r;i++)R0.fromBufferAttribute(t,i-1),P0.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=R0.distanceTo(P0);e.setAttribute("lineDistance",new st(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),hu.copy(n.boundingSphere),hu.applyMatrix4(i),hu.radius+=r,e.ray.intersectsSphere(hu)===!1)return;L0.copy(i).invert(),qf.copy(e.ray).applyMatrix4(L0);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,h=new H,f=new H,d=new H,p=new H,m=this.isLineSegments?2:1,v=n.index,y=n.attributes.position;if(v!==null){const _=Math.max(0,o.start),E=Math.min(v.count,o.start+o.count);for(let M=_,b=E-1;M<b;M+=m){const P=v.getX(M),R=v.getX(M+1);if(h.fromBufferAttribute(y,P),f.fromBufferAttribute(y,R),qf.distanceSqToSegment(h,f,p,d)>c)continue;p.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(p);D<e.near||D>e.far||t.push({distance:D,point:d.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,o.start),E=Math.min(y.count,o.start+o.count);for(let M=_,b=E-1;M<b;M+=m){if(h.fromBufferAttribute(y,M),f.fromBufferAttribute(y,M+1),qf.distanceSqToSegment(h,f,p,d)>c)continue;p.applyMatrix4(this.matrixWorld);const R=e.ray.origin.distanceTo(p);R<e.near||R>e.far||t.push({distance:R,point:d.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}const I0=new H,U0=new H;class cr extends Nr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)I0.fromBufferAttribute(t,i),U0.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+I0.distanceTo(U0);e.setAttribute("lineDistance",new st(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ly extends Nr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Fp extends Xn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new $e(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 D0=new yt,Kd=new oo,fu=new Rn,du=new H;class cy extends Nt{constructor(e=new Tt,t=new Fp){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,r=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),fu.copy(n.boundingSphere),fu.applyMatrix4(i),fu.radius+=r,e.ray.intersectsSphere(fu)===!1)return;D0.copy(i).invert(),Kd.copy(e.ray).applyMatrix4(D0);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,h=n.index,d=n.attributes.position;if(h!==null){const p=Math.max(0,o.start),m=Math.min(h.count,o.start+o.count);for(let v=p,S=m;v<S;v++){const y=h.getX(v);du.fromBufferAttribute(d,y),N0(du,y,c,i,e,t,this)}}else{const p=Math.max(0,o.start),m=Math.min(d.count,o.start+o.count);for(let v=p,S=m;v<S;v++)du.fromBufferAttribute(d,v),N0(du,v,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function N0(s,e,t,n,i,r,o){const a=Kd.distanceSqToPoint(s);if(a<t){const c=new H;Kd.closestPointToPoint(s,c),c.applyMatrix4(n);const h=i.ray.origin.distanceTo(c);if(h<i.near||h>i.far)return;r.push({distance:h,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,object:o})}}class dT extends sn{constructor(e,t,n,i,r,o,a,c,h){super(e,t,n,i,r,o,a,c,h),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Kt,this.magFilter=r!==void 0?r:Kt,this.generateMipmaps=!1;const f=this;function d(){f.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}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 pT extends sn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=hn,this.minFilter=hn,this.generateMipmaps=!1,this.needsUpdate=!0}}class uh extends sn{constructor(e,t,n,i,r,o,a,c,h,f,d,p){super(null,o,a,c,h,f,i,r,d,p),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class mT extends uh{constructor(e,t,n,i,r,o){super(e,t,n,r,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Vn}}class gT extends uh{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Dr),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class vT extends sn{constructor(e,t,n,i,r,o,a,c,h){super(e,t,n,i,r,o,a,c,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Zi{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),r=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let o;t?o=t:o=e*n[r-1];let a=0,c=r-1,h;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),h=n[i]-o,h<0)a=i+1;else if(h>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(r-1);const f=n[i],p=n[i+1]-f,m=(o-f)/p;return(i+m)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),a=this.getPoint(r),c=t||(o.isVector2?new Re:new H);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new H,i=[],r=[],o=[],a=new H,c=new yt;for(let m=0;m<=e;m++){const v=m/e;i[m]=this.getTangentAt(v,new H)}r[0]=new H,o[0]=new H;let h=Number.MAX_VALUE;const f=Math.abs(i[0].x),d=Math.abs(i[0].y),p=Math.abs(i[0].z);f<=h&&(h=f,n.set(1,0,0)),d<=h&&(h=d,n.set(0,1,0)),p<=h&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),o[0].crossVectors(i[0],r[0]);for(let m=1;m<=e;m++){if(r[m]=r[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(i[m-1],i[m]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos(nn(i[m-1].dot(i[m]),-1,1));r[m].applyMatrix4(c.makeRotationAxis(a,v))}o[m].crossVectors(i[m],r[m])}if(t===!0){let m=Math.acos(nn(r[0].dot(r[e]),-1,1));m/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(m=-m);for(let v=1;v<=e;v++)r[v].applyMatrix4(c.makeRotationAxis(i[v],m*v)),o[v].crossVectors(i[v],r[v])}return{tangents:i,normals:r,binormals:o}}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 hh extends Zi{constructor(e=0,t=0,n=1,i=1,r=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t){const n=t||new Re,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(o?r=0:r=i),this.aClockwise===!0&&!o&&(r===i?r=-i:r=r-i);const a=this.aStartAngle+e*r;let c=this.aX+this.xRadius*Math.cos(a),h=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const f=Math.cos(this.aRotation),d=Math.sin(this.aRotation),p=c-this.aX,m=h-this.aY;c=p*f-m*d+this.aX,h=p*d+m*f+this.aY}return n.set(c,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 uy extends hh{constructor(e,t,n,i,r,o){super(e,t,n,n,i,r,o),this.isArcCurve=!0,this.type="ArcCurve"}}function Op(){let s=0,e=0,t=0,n=0;function i(r,o,a,c){s=r,e=a,t=-3*r+3*o-2*a-c,n=2*r-2*o+a+c}return{initCatmullRom:function(r,o,a,c,h){i(o,a,h*(a-r),h*(c-o))},initNonuniformCatmullRom:function(r,o,a,c,h,f,d){let p=(o-r)/h-(a-r)/(h+f)+(a-o)/f,m=(a-o)/f-(c-o)/(f+d)+(c-a)/d;p*=f,m*=f,i(o,a,p,m)},calc:function(r){const o=r*r,a=o*r;return s+e*r+t*o+n*a}}}const pu=new H,Zf=new Op,Jf=new Op,Kf=new Op;class hy extends Zi{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 H){const n=t,i=this.points,r=i.length,o=(r-(this.closed?0:1))*e;let a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let h,f;this.closed||a>0?h=i[(a-1)%r]:(pu.subVectors(i[0],i[1]).add(i[0]),h=pu);const d=i[a%r],p=i[(a+1)%r];if(this.closed||a+2<r?f=i[(a+2)%r]:(pu.subVectors(i[r-1],i[r-2]).add(i[r-1]),f=pu),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let v=Math.pow(h.distanceToSquared(d),m),S=Math.pow(d.distanceToSquared(p),m),y=Math.pow(p.distanceToSquared(f),m);S<1e-4&&(S=1),v<1e-4&&(v=S),y<1e-4&&(y=S),Zf.initNonuniformCatmullRom(h.x,d.x,p.x,f.x,v,S,y),Jf.initNonuniformCatmullRom(h.y,d.y,p.y,f.y,v,S,y),Kf.initNonuniformCatmullRom(h.z,d.z,p.z,f.z,v,S,y)}else this.curveType==="catmullrom"&&(Zf.initCatmullRom(h.x,d.x,p.x,f.x,this.tension),Jf.initCatmullRom(h.y,d.y,p.y,f.y,this.tension),Kf.initCatmullRom(h.z,d.z,p.z,f.z,this.tension));return n.set(Zf.calc(c),Jf.calc(c),Kf.calc(c)),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 H().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function F0(s,e,t,n,i){const r=(n-e)*.5,o=(i-t)*.5,a=s*s,c=s*a;return(2*t-2*n+r+o)*c+(-3*t+3*n-2*r-o)*a+r*s+t}function _T(s,e){const t=1-s;return t*t*e}function yT(s,e){return 2*(1-s)*s*e}function xT(s,e){return s*s*e}function ll(s,e,t,n){return _T(s,e)+yT(s,t)+xT(s,n)}function ST(s,e){const t=1-s;return t*t*t*e}function MT(s,e){const t=1-s;return 3*t*t*s*e}function ET(s,e){return 3*(1-s)*s*s*e}function wT(s,e){return s*s*s*e}function cl(s,e,t,n,i){return ST(s,e)+MT(s,t)+ET(s,n)+wT(s,i)}class Bp extends Zi{constructor(e=new Re,t=new Re,n=new Re,i=new Re){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Re){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(cl(e,i.x,r.x,o.x,a.x),cl(e,i.y,r.y,o.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.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 fy extends Zi{constructor(e=new H,t=new H,n=new H,i=new H){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new H){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(cl(e,i.x,r.x,o.x,a.x),cl(e,i.y,r.y,o.y,a.y),cl(e,i.z,r.z,o.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.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 kp extends Zi{constructor(e=new Re,t=new Re){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Re){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 3686
3686getTangent(e,t=new Re){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 dy extends Zi{constructor(e=new H,t=new H){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new H){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 H){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 zp extends Zi{constructor(e=new Re,t=new Re,n=new Re){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Re){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(ll(e,i.x,r.x,o.x),ll(e,i.y,r.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}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 Gp extends Zi{constructor(e=new H,t=new H,n=new H){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new H){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(ll(e,i.x,r.x,o.x),ll(e,i.y,r.y,o.y),ll(e,i.z,r.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}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 Hp extends Zi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Re){const n=t,i=this.points,r=(i.length-1)*e,o=Math.floor(r),a=r-o,c=i[o===0?o:o-1],h=i[o],f=i[o>i.length-2?i.length-1:o+1],d=i[o>i.length-3?i.length-1:o+2];return n.set(F0(a,c.x,h.x,f.x,d.x),F0(a,c.y,h.y,f.y,d.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 Re().fromArray(i))}return this}}var qu=Object.freeze({__proto__:null,ArcCurve:uy,CatmullRomCurve3:hy,CubicBezierCurve:Bp,CubicBezierCurve3:fy,EllipseCurve:hh,LineCurve:kp,LineCurve3:dy,QuadraticBezierCurve:zp,QuadraticBezierCurve3:Gp,SplineCurve:Hp});class py extends Zi{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 qu[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const o=i[r]-n,a=this.curves[r],c=a.getLength(),h=c===0?0:1-o/c;return a.getPointAt(h,t)}r++}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,r=this.curves;i<r.length;i++){const o=r[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isS
vendor: 6,564 bytes, line 3686
3686plineCurve?e*o.points.length:e,c=o.getPoints(a);for(let h=0;h<c.length;h++){const f=c[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 qu[i.type]().fromJSON(i))}return this}}class Tl extends py{constructor(e){super(),this.type="Path",this.currentPoint=new Re,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 kp(this.currentPoint.clone(),new Re(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new zp(this.currentPoint.clone(),new Re(e,t),new Re(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,o){const a=new Bp(this.currentPoint.clone(),new Re(e,t),new Re(n,i),new Re(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Hp(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,o){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,i,r,o),this}absarc(e,t,n,i,r,o){return this.absellipse(e,t,n,n,i,r,o),this}ellipse(e,t,n,i,r,o,a,c){const h=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+h,t+f,n,i,r,o,a,c),this}absellipse(e,t,n,i,r,o,a,c){const h=new hh(e,t,n,i,r,o,a,c);if(this.curves.length>0){const d=h.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.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 zl extends Tt{constructor(e=[new Re(0,-.5),new Re(.5,0),new Re(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=nn(i,0,Math.PI*2);const r=[],o=[],a=[],c=[],h=[],f=1/t,d=new H,p=new Re,m=new H,v=new H,S=new H;let y=0,_=0;for(let E=0;E<=e.length-1;E++)switch(E){case 0:y=e[E+1].x-e[E].x,_=e[E+1].y-e[E].y,m.x=_*1,m.y=-y,m.z=_*0,S.copy(m),m.normalize(),c.push(m.x,m.y,m.z);break;case e.length-1:c.push(S.x,S.y,S.z);break;default:y=e[E+1].x-e[E].x,_=e[E+1].y-e[E].y,m.x=_*1,m.y=-y,m.z=_*0,v.copy(m),m.x+=S.x,m.y+=S.y,m.z+=S.z,m.normalize(),c.push(m.x,m.y,m.z),S.copy(v)}for(let E=0;E<=t;E++){const M=n+E*f*i,b=Math.sin(M),P=Math.cos(M);for(let R=0;R<=e.length-1;R++){d.x=e[R].x*b,d.y=e[R].y,d.z=e[R].x*P,o.push(d.x,d.y,d.z),p.x=E/t,p.y=R/(e.length-1),a.push(p.x,p.y);const L=c[3*R+0]*b,D=c[3*R+1],A=c[3*R+0]*P;h.push(L,D,A)}}for(let E=0;E<t;E++)for(let M=0;M<e.length-1;M++){const b=M+E*e.length,P=b,R=b+e.length,L=b+e.length+1,D=b+1;r.push(P,R,D),r.push(L,D,R)}this.setIndex(r),this.setAttribute("position",new st(o,3)),this.setAttribute("uv",new st(a,2)),this.setAttribute("normal",new st(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zl(e.points,e.segments,e.phiStart,e.phiLength)}}class fh extends zl{constructor(e=1,t=1,n=4,i=8){const r=new Tl;r.absarc(0,-t/2,e,Math.PI*1.5,0),r.absarc(0,t/2,e,0,Math.PI*.5),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new fh(e.radius,e.length,e.capSegments,e.radialSegments)}}class dh extends Tt{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 r=[],o=[],a=[],c=[],h=new H,f=new Re;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let d=0,p=3;d<=t;d++,p+=3){const m=n+d/t*i;h.x=e*Math.cos(m),h.y=e*Math.sin(m),o.push(h.x,h.y,h.z),a.push(0,0,1),f.x=(o[p]/e+1)/2,f.y=(o[p+1]/e+1)/2,c.push(f.x,f.y)}for(let d=1;d<=t;d++)r.push(d,d+1,0);this.setIndex(r),this.setAttribute("position",new st(o,3)),this.setAttribute("normal",new st(a,3)),this.setAttribute("uv",new st(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dh(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class pa extends Tt{constructor(e=1,t=1,n=1,i=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};const h=this;i=Math.floor(i),r=Math.floor(r);const f=[],d=[],p=[],m=[];let v=0;const S=[],y=n/2;let _=0;E(),o===!1&&(e>0&&M(!0),t>0&&M(!1)),this.setIndex(f),this.setAttribute("position",new st(d,3)),this.setAttribute("normal",new st(p,3)),this.setAttribute("uv",new st(m,2));function E(){const b=new H,P=new H;let R=0;const L=(t-e)/n;for(let D=0;D<=r;D++){const A=[],C=D/r,k=C*(t-e)+e;for(let B=0;B<=i;B++){const ee=B/i,N=ee*c+a,q=Math.sin(N),K=Math.cos(N);P.x=k*q,P.y=-C*n+y,P.z=k*K,d.push(P.x,P.y,P.z),b.set(q,L,K).normalize(),p.push(b.x,b.y,b.z),m.push(ee,1-C),A.push(v++)}S.push(A)}for(let D=0;D<i;D++)for(let A=0;A<r;A++){const C=S[A][D],k=S[A+1][D],B=S[A+1][D+1],ee=S[A][D+1];f.push(C,k,ee),f.push(k,B,ee),R+=6}h.addGroup(_,R,0),_+=R}function M(b){const P=v,R=new Re,L=new H;let D=0;const A=b===!0?e:t,C=b===!0?1:-1;for(let B=1;B<=i;B++)d.push(0,y*C,0),p.push(0,C,0),m.push(.5,.5),v++;const k=v;for(let B=0;B<=i;B++){const N=B/i*c+a,q=Math.cos(N),K=Math.sin(N);L.x=A*K,L.y=y*C,L.z=A*q,d.push(L.x,L.y,L.z),p.push(0,C,0),R.x=q*.5+.5,R.y=K*.5*C+.5,m.push(R.x,R.y),v++}for(let B=0;B<i;B++){const ee=P+B,N=k+B;b===!0?f.push(N,N+1,ee):f.push(N+1,N,ee),D+=3}h.addGroup(_,D,b===!0?1:2),_+=D}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pa(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ph extends pa{constructor(e=1,t=1,n=32,i=1,r=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,r,o,a),this.type="C
3686oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}static fromJSON(e){return new ph(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class fs extends Tt{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],o=[];a(i),h(n),f(),this.setAttribute("position",new st(r,3)),this.setAttribute("normal",new st(r.slice(),3)),this.setAttribute("uv",new st(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(E){const M=new H,b=new H,P=new H;for(let R=0;R<t.length;R+=3)m(t[R+0],M),m(t[R+1],b),m(t[R+2],P),c(M,b,P,E)}function c(E,M,b,P){const R=P+1,L=[];for(let D=0;D<=R;D++){L[D]=[];const A=E.clone().lerp(b,D/R),C=M.clone().lerp(b,D/R),k=R-D;for(let B=0;B<=k;B++)B===0&&D===R?L[D][B]=A:L[D][B]=A.clone().lerp(C,B/k)}for(let D=0;D<R;D++)for(let A=0;A<2*(R-D)-1;A++){const C=Math.floor(A/2);A%2===0?(p(L[D][C+1]),p(L[D+1][C]),p(L[D][C])):(p(L[D][C+1]),p(L[D+1][C+1]),p(L[D+1][C]))}}function h(E){const M=new H;for(let b=0;b<r.length;b+=3)M.x=r[b+0],M.y=r[b+1],M.z=r[b+2],M.normalize().multiplyScalar(E),r[b+0]=M.x,r[b+1]=M.y,r[b+2]=M.z}function f(){const E=new H;for(let M=0;M<r.length;M+=3){E.x=r[M+0],E.y=r[M+1],E.z=r[M+2];const b=y(E)/2/Math.PI+.5,P=_(E)/Math.PI+.5;o.push(b,1-P)}v(),d()}function d(){for(let E=0;E<o.length;E+=6){const M=o[E+0],b=o[E+2],P=o[E+4],R=Math.max(M,b,P),L=Math.min(M,b,P);R>.9&&L<.1&&(M<.2&&(o[E+0]+=1),b<.2&&(o[E+2]+=1),P<.2&&(o[E+4]+=1))}}function p(E){r.push(E.x,E.y,E.z)}function m(E,M){const b=E*3;M.x=e[b+0],M.y=e[b+1],M.z=e[b+2]}function v(){const E=new H,M=new H,b=new H,P=new H,R=new Re,L=new Re,D=new Re;for(let A=0,C=0;A<r.length;A+=9,C+=6){E.set(r[A+0],r[A+1],r[A+2]),M.set(r[A+3],r[A+4],r[A+5]),b.set(r[A+6],r[A+7],r[A+8]),R.set(o[C+0],o[C+1]),L.set(o[C+2],o[C+3]),D.set(o[C+4],o[C+5]),P.copy(E).add(M).add(b).divideScalar(3);const k=y(P);S(R,C+0,E,k),S(L,C+2,M,k),S(D,C+4,b,k)}}function S(E,M,b,P){P<0&&E.x===1&&(o[M]=E.x-1),b.x===0&&b.z===0&&(o[M]=P/2/Math.PI+.5)}function y(E){return Math.atan2(E.z,-E.x)}function _(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fs(e.vertices,e.indices,e.radius,e.details)}}class mh extends fs{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,r=[-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],o=[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,
vendor: 278,602 bytes, lines 3686-3720
368619,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new mh(e.radius,e.detail)}}const mu=new H,gu=new H,Qf=new H,vu=new di;class my extends Tt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),r=Math.cos(Qs*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,h=[0,0,0],f=["a","b","c"],d=new Array(3),p={},m=[];for(let v=0;v<c;v+=3){o?(h[0]=o.getX(v),h[1]=o.getX(v+1),h[2]=o.getX(v+2)):(h[0]=v,h[1]=v+1,h[2]=v+2);const{a:S,b:y,c:_}=vu;if(S.fromBufferAttribute(a,h[0]),y.fromBufferAttribute(a,h[1]),_.fromBufferAttribute(a,h[2]),vu.getNormal(Qf),d[0]=`${Math.round(S.x*i)},${Math.round(S.y*i)},${Math.round(S.z*i)}`,d[1]=`${Math.round(y.x*i)},${Math.round(y.y*i)},${Math.round(y.z*i)}`,d[2]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let E=0;E<3;E++){const M=(E+1)%3,b=d[E],P=d[M],R=vu[f[E]],L=vu[f[M]],D=`${b}_${P}`,A=`${P}_${b}`;A in p&&p[A]?(Qf.dot(p[A].normal)<=r&&(m.push(R.x,R.y,R.z),m.push(L.x,L.y,L.z)),p[A]=null):D in p||(p[D]={index0:h[E],index1:h[M],normal:Qf.clone()})}}for(const v in p)if(p[v]){const{index0:S,index1:y}=p[v];mu.fromBufferAttribute(a,S),gu.fromBufferAttribute(a,y),m.push(mu.x,mu.y,mu.z),m.push(gu.x,gu.y,gu.z)}this.setAttribute("position",new st(m,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class as extends Tl{constructor(e){super(e),this.uuid=Ci(),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 Tl().fromJSON(i))}return this}}const bT={triangulate:function(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=gy(s,0,i,t,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,h,f,d,p,m;if(n&&(r=PT(s,e,r,t)),s.length>80*t){a=h=s[0],c=f=s[1];for(let v=t;v<i;v+=t)d=s[v],p=s[v+1],d<a&&(a=d),p<c&&(c=p),d>h&&(h=d),p>f&&(f=p);m=Math.max(h-a,f-c),m=m!==0?32767/m:0}return Al(r,o,t,a,c,m,0),o}};function gy(s,e,t,n,i){let r,o;if(i===GT(s,e,t,n)>0)for(r=e;r<t;r+=n)o=O0(r,s[r],s[r+1],o);else for(r=t-n;r>=e;r-=n)o=O0(r,s[r],s[r+1],o);return o&&gh(o,o.next)&&(Rl(o),o=o.next),o}function so(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(gh(t,t.next)||Qt(t.prev,t,t.next)===0)){if(Rl(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Al(s,e,t,n,i,r,o){if(!s)return;!o&&r&&NT(s,n,i,r);let a=s,c,h;for(;s.prev!==s.next;){if(c=s.prev,h=s.next,r?AT(s,n,i,r):TT(s)){e.push(c.i/t|0),e.push(s.i/t|0),e.push(h.i/t|0),Rl(s),s=h.next,a=h.next;continue}if(s=h,s===a){o?o===1?(s=CT(so(s),e,t),Al(s,e,t,n,i,r,2)):o===2&&RT(s,e,t,n,i,r):Al(so(s),e,t,n,i,r,1);break}}}function TT(s){const e=s.prev,t=s,n=s.next;if(Qt(e,t,n)>=0)return!1;const i=e.x,r=t.x,o=n.x,a=e.y,c=t.y,h=n.y,f=i<r?i<o?i:o:r<o?r:o,d=a<c?a<h?a:h:c<h?c:h,p=i>r?i>o?i:o:r>o?r:o,m=a>c?a>h?a:h:c>h?c:h;let v=n.next;for(;v!==e;){if(v.x>=f&&v.x<=p&&v.y>=d&&v.y<=m&&ra(i,a,r,c,o,h,v.x,v.y)&&Qt(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function AT(s,e,t,n){const i=s.prev,r=s,o=s.next;if(Qt(i,r,o)>=0)return!1;const a=i.x,c=r.x,h=o.x,f=i.y,d=r.y,p=o.y,m=a<c?a<h?a:h:c<h?c:h,v=f<d?f<p?f:p:d<p?d:p,S=a>c?a>h?a:h:c>h?c:h,y=f>d?f>p?f:p:d>p?d:p,_=Qd(m,v,e,t,n),E=Qd(S,y,e,t,n);let M=s.prevZ,b=s.nextZ;for(;M&&M.z>=_&&b&&b.z<=E;){if(M.x>=m&&M.x<=S&&M.y>=v&&M.y<=y&&M!==i&&M!==o&&ra(a,f,c,d,h,p,M.x,M.y)&&Qt(M.prev,M,M.next)>=0||(M=M.prevZ,b.x>=m&&b.x<=S&&b.y>=v&&b.y<=y&&b!==i&&b!==o&&ra(a,f,c,d,h,p,b.x,b.y)&&Qt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;M&&M.z>=_;){if(M.x>=m&&M.x<=S&&M.y>=v&&M.y<=y&&M!==i&&M!==o&&ra(a,f,c,d,h,p,M.x,M.y)&&Qt(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;b&&b.z<=E;){if(b.x>=m&&b.x<=S&&b.y>=v&&b.y<=y&&b!==i&&b!==o&&ra(a,f,c,d,h,p,b.x,b.y)&&Qt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function CT(s,e,t){let n=s;do{const i=n.prev,r=n.next.next;!gh(i,r)&&vy(i,n,n.next,r)&&Cl(i,r)&&Cl(r,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(r.i/t|0),Rl(n),Rl(n.next),n=s=r),n=n.next}while(n!==s);return so(n)}function RT(s,e,t,n,i,r){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&BT(o,a)){let c=_y(o,a);o=so(o,o.next),c=so(c,c.next),Al(o,e,t,n,i,r,0),Al(c,e,t,n,i,r,0);return}a=a.next}o=o.next}while(o!==s)}function PT(s,e,t,n){const i=[];let r,o,a,c,h;for(r=0,o=e.length;r<o;r++)a=e[r]*n,c=r<o-1?e[r+1]*n:s.length,h=gy(s,a,c,n,!1),h===h.next&&(h.steiner=!0),i.push(OT(h));for(i.sort(LT),r=0;r<i.length;r++)t=IT(i[r],t);return t}function LT(s,e){return s.x-e.x}function IT(s,e){const t=UT(s,e);if(!t)return e;const n=_y(t,s);return so(n,n.next),so(t,t.next)}function UT(s,e){let t=e,n=-1/0,i;const r=s.x,o=s.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const p=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=r&&p>n&&(n=p,i=t.x<t.next.x?t:t.next,p===r))return i}t=t.next}while(t!==e);if(!i)return null;const a=i,c=i.x,h=i.y;let f=1/0,d;t=i;do r>=t.x&&t.x>=c&&r!==t.x&&ra(o<h?r:n,o,c,h,o<h?n:r,o,t.x,t.y)&&(d=Math.abs(o-t.y)/(r-t.x),Cl(t,s)&&(d<f||d===f&&(t.x>i.x||t.x===i.x&&DT(i,t)))&&(i=t,f=d)),t=t.next;while(t!==a);return i}function DT(s,e){return Qt(s.prev,s,e.prev)<0&&Qt(e.next,s,s.next)<0}function NT(s,e,t,n){let i=s;do i.z===0&&(i.z=Qd(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,FT(i)}function FT(s){let e,t,n,i,r,o,a,c,h=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,n=t,a=0,e=0;e<h&&(a++,n=n.nextZ,!!n);e++);for(c=h;a>0||c>0&&n;)a!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,c--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;t=n}r.nextZ=null,h*=2}while(o>1);return s}function Qd(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function OT(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function ra(s,e,t,n,i,r,o,a){return(i-o)*(e-a)>=(s-o)*(r-a)&&(s-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(i-o)*(n-a)}function BT(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!kT(s,e)&&(Cl(s,e)&&Cl(e,s)&&zT(s,e)&&(Qt(s.prev,s,e.prev)||Qt(s,e.prev,e))||gh(s,e)&&Qt(s.prev,s,s.next)>0&&Qt(e.prev,e,e.next)>0)}function Qt(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function gh(s,e){return s.x===e.x&&s.y===e.y}function vy(s,e,t,n){const i=yu(Qt(s,e,t)),r=yu(Qt(s,e,n)),o=yu(Qt(t,n,s)),a=yu(Qt(t,n,e));return!!(i!==r&&o!==a||i===0&&_u(s,t,e)||r===0&&_u(s,n,e)||o===0&&_u(t,s,n)||a===0&&_u(t,e,n))}function _u(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function yu(s){return s>0?1:s<0?-1:0}function kT(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&vy(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Cl(s,e){return Qt(s.prev,s,s.next)<0?Qt(s,e,s.next)>=0&&Qt(s,s.prev,e)>=0:Qt(s,e,s.prev)<0||Qt(s,s.next,e)<0}function zT(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function _y(s,e){const t=new $d(s.i,s.x,s.y),n=new $d(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function O0(s,e,t,n){const i=new $d(s,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 Rl(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function $d(s,e,t){this.i=s,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 GT(s,e,t,n){let i=0;for(let r=e,o=t-n;r<t;r+=n)i+=(s[o]-s[r])*(s[r+1]+s[o+1]),o=r;return i}class or{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return or.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];B0(e),k0(n,e);let o=e.length;t.forEach(B0);for(let c=0;c<t.length;c++)i.push(o),o+=t[c].length,k0(n,t[c]);const a=bT.triangulate(n,i);for(let c=0;c<a.length;c+=3)r.push(a.slice(c,c+3));return r}}function B0(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function k0(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class ma extends Tt{constructor(e=new as([new Re(.5,.5),new Re(-.5,.5),new Re(-.5,-.5),new Re(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let a=0,c=e.length;a<c;a++){const h=e[a];o(h)}this.setAttribute("position",new st(i,3)),this.setAttribute("uv",new st(r,2)),this.computeVertexNormals();function o(a){const c=[],h=t.curveSegments!==void 0?t.curveSegments:12,f=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:m-.1,S=t.bevelOffset!==void 0?t.bevelOffset:0,y=t.bevelSegments!==void 0?t.bevelSegments:3;const _=t.extrudePath,E=t.UVGenerator!==void 0?t.UVGenerator:HT;let M,b=!1,P,R,L,D;_&&(M=_.getSpacedPoints(f),b=!0,p=!1,P=_.computeFrenetFrames(f,!1),R=new H,L=new H,D=new H),p||(y=0,m=0,v=0,S=0);const A=a.extractPoints(h);let C=A.shape;const k=A.holes;if(!or.isClockWise(C)){C=C.reverse();for(let O=0,Me=k.length;O<Me;O++){const ue=k[O];or.isClockWise(ue)&&(k[O]=ue.reverse())}}const ee=or.triangulateShape(C,k),N=C;for(let O=0,Me=k.length;O<Me;O++){const ue=k[O];C=C.concat(ue)}function q(O,Me,ue){return Me||console.error("THREE.ExtrudeGeometry: vec does not exist"),O.clone().addScaledVector(Me,ue)}const K=C.length,re=ee.length;function Z(O,Me,ue){let de,oe,Ue;const fe=O.x-Me.x,U=O.y-Me.y,I=ue.x-O.x,X=ue.y-O.y,ye=fe*fe+U*U,ce=fe*X-U*I;if(Math.abs(ce)>Number.EPSILON){const he=Math.sqrt(ye),Te=Math.sqrt(I*I+X*X),Ne=Me.x-U/he,Ce=Me.y+fe/he,De=ue.x-X/Te,ke=ue.y+I/Te,xe=((De-Ne)*X-(ke-Ce)*I)/(fe*X-U*I);de=Ne+fe*xe-O.x,oe=Ce+U*xe-O.y;const it=de*de+oe*oe;if(it<=2)return new Re(de,oe);Ue=Math.sqrt(it/2)}else{let he=!1;fe>Number.EPSILON?I>Number.EPSILON&&(he=!0):fe<-Number.EPSILON?I<-Number.EPSILON&&(he=!0):Math.sign(U)===Math.sign(X)&&(he=!0),he?(de=-U,oe=fe,Ue=Math.sqrt(ye)):(de=fe,oe=U,Ue=Math.sqrt(ye/2))}return new Re(de/Ue,oe/Ue)}const W=[];for(let O=0,Me=N.length,ue=Me-1,de=O+1;O<Me;O++,ue++,de++)ue===Me&&(ue=0),de===Me&&(de=0),W[O]=Z(N[O],N[ue],N[de]);const V=[];let F,j=W.concat();for(let O=0,Me=k.length;O<Me;O++){const ue=k[O];F=[];for(let de=0,oe=ue.length,Ue=oe-1,fe=de+1;de<oe;de++,Ue++,fe++)Ue===oe&&(Ue=0),fe===oe&&(fe=0),F[de]=Z(ue[de],ue[Ue],ue[fe]);V.push(F),j=j.concat(F)}for(let O=0;O<y;O++){const Me=O/y,ue=m*Math.cos(Me*Math.PI/2),de=v*Math.sin(Me*Math.PI/2)+S;for(let oe=0,Ue=N.length;oe<Ue;oe++){const fe=q(N[oe],W[oe],de);ne(fe.x,fe.y,-ue)}for(let oe=0,Ue=k.length;oe<Ue;oe++){const fe=k[oe];F=V[oe];for(let U=0,I=fe.length;U<I;U++){const X=q(fe[U],F[U],de);ne(X.x,X.y,-ue)}}}const G=v+S;for(let O=0;O<K;O++){const Me=p?q(C[O],j[O],G):C[O];b?(L.copy(P.normals[0]).multiplyScalar(Me.x),R.copy(P.binormals[0]).multiplyScalar(Me.y),D.copy(M[0]).add(L).add(R),ne(D.x,D.y,D.z)):ne(Me.x,Me.y,0)}for(let O=1;O<=f;O++)for(let Me=0;Me<K;Me++){const ue=p?q(C[Me],j[Me],G):C[Me];b?(L.copy(P.normals[O]).multiplyScalar(ue.x),R.copy(P.binormals[O]).multiplyScalar(ue.y),D.copy(M[O]).add(L).add(R),ne(D.x,D.y,D.z)):ne(ue.x,ue.y,d/f*O)}for(let O=y-1;O>=0;O--){const Me=O/y,ue=m*Math.cos(Me*Math.PI/2),de=v*Math.sin(Me*Math.PI/2)+S;for(let oe=0,Ue=N.length;oe<Ue;oe++){const fe=q(N[oe],W[oe],de);ne(fe.x,fe.y,d+ue)}for(let oe=0,Ue=k.length;oe<Ue;oe++){const fe=k[oe];F=V[oe];for(let U=0,I=fe.length;U<I;U++){const X=q(fe[U],F[U],de);b?ne(X.x,X.y+M[f-1].y,M[f-1].x+ue):ne(X.x,X.y,d+ue)}}}$(),te();function $(){const O=i.length/3;if(p){let Me=0,ue=K*Me;for(let de=0;de<re;de++){const oe=ee[de];pe(oe[2]+ue,oe[1]+ue,oe[0]+ue)}Me=f+y*2,ue=K*Me;for(let de=0;de<re;de++){const oe=ee[de];pe(oe[0]+ue,oe[1]+ue,oe[2]+ue)}}else{for(let Me=0;Me<re;Me++){const ue=ee[Me];pe(ue[2],ue[1],ue[0])}for(let Me=0;Me<re;Me++){const ue=ee[Me];pe(ue[0]+K*f,ue[1]+K*f,ue[2]+K*f)}}n.addGroup(O,i.length/3-O,0)}function te(){const O=i.length/3;let Me=0;ae(N,Me),Me+=N.length;for(let ue=0,de=k.length;ue<de;ue++){const oe=k[ue];ae(oe,Me),Me+=oe.length}n.addGroup(O,i.length/3-O,1)}function ae(O,Me){let ue=O.length;for(;--ue>=0;){const de=ue;let oe=ue-1;oe<0&&(oe=O.length-1);for(let Ue=0,fe=f+y*2;Ue<fe;Ue++){const U=K*Ue,I=K*(Ue+1),X=Me+de+U,ye=Me+oe+U,ce=Me+oe+I,he=Me+de+I;Ie(X,ye,ce,he)}}}function ne(O,Me,ue){c.push(O),c.push(Me),c.push(ue)}function pe(O,Me,ue){Pe(O),Pe(Me),Pe(ue);const de=i.length/3,oe=E.generateTopUV(n,i,de-3,de-2,de-1);Se(oe[0]),Se(oe[1]),Se(oe[2])}function Ie(O,Me,ue,de){Pe(O),Pe(Me),Pe(de),Pe(Me),Pe(ue),Pe(de);const oe=i.length/3,Ue=E.generateSideWallUV(n,i,oe-6,oe-3,oe-2,oe-1);Se(Ue[0]),Se(Ue[1]),Se(Ue[3]),Se(Ue[1]),Se(Ue[2]),Se(Ue[3])}function Pe(O){i.push(c[O*3+0]),i.push(c[O*3+1]),i.push(c[O*3+2])}function Se(O){r.push(O.x),r.push(O.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 VT(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,o=e.shapes.length;r<o;r++){const a=t[e.shapes[r]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new qu[i.type]().fromJSON(i)),new ma(n,e.options)}}const HT={generateTopUV:function(s,e,t,n,i){const r=e[t*3],o=e[t*3+1],a=e[n*3],c=e[n*3+1],h=e[i*3],f=e[i*3+1];return[new Re(r,o),new Re(a,c),new Re(h,f)]},generateSideWallUV:function(s,e,t,n,i,r){const o=e[t*3],a=e[t*3+1],c=e[t*3+2],h=e[n*3],f=e[n*3+1],d=e[n*3+2],p=e[i*3],m=e[i*3+1],v=e[i*3+2],S=e[r*3],y=e[r*3+1],_=e[r*3+2];return Math.abs(a-f)<Math.abs(o-h)?[new Re(o,1-c),new Re(h,1-d),new Re(p,1-v),new Re(S,1-_)]:[new Re(a,1-c),new Re(f,1-d),new Re(m,1-v),new Re(y,1-_)]}};function VT(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class vh extends fs{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],r=[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,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new vh(e.radius,e.detail)}}class Gl extends fs{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 Gl(e.radius,e.detail)}}class _h extends Tt{constructor(e=.5,t=1,n=32,i=1,r=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],c=[],h=[],f=[];let d=e;const p=(t-e)/i,m=new H,v=new Re;for(let S=0;S<=i;S++){for(let y=0;y<=n;y++){const _=r+y/n*o;m.x=d*Math.cos(_),m.y=d*Math.sin(_),c.push(m.x,m.y,m.z),h.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,f.push(v.x,v.y)}d+=p}for(let S=0;S<i;S++){const y=S*(n+1);for(let _=0;_<n;_++){const E=_+y,M=E,b=E+n+1,P=E+n+2,R=E+1;a.push(M,b,R),a.push(b,P,R)}}this.setIndex(a),this.setAttribute("position",new st(c,3)),this.setAttribute("normal",new st(h,3)),this.setAttribute("uv",new st(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _h(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class yh extends Tt{constructor(e=new as([new Re(0,.5),new Re(-.5,-.5),new Re(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)h(e);else for(let f=0;f<e.length;f++)h(e[f]),this.addGroup(a,c,f),a+=c,c=0;this.setIndex(n),this.setAttribute("position",new st(i,3)),this.setAttribute("normal",new st(r,3)),this.setAttribute("uv",new st(o,2));function h(f){const d=i.length/3,p=f.extractPoints(t);let m=p.shape;const v=p.holes;or.isClockWise(m)===!1&&(m=m.reverse());for(let y=0,_=v.length;y<_;y++){const E=v[y];or.isClockWise(E)===!0&&(v[y]=E.reverse())}const S=or.triangulateShape(m,v);for(let y=0,_=v.length;y<_;y++){const E=v[y];m=m.concat(E)}for(let y=0,_=m.length;y<_;y++){const E=m[y];i.push(E.x,E.y,0),r.push(0,0,1),o.push(E.x,E.y)}for(let y=0,_=S.length;y<_;y++){const E=S[y],M=E[0]+d,b=E[1]+d,P=E[2]+d;n.push(M,b,P),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return WT(t,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const o=t[e.shapes[i]];n.push(o)}return new yh(n,e.curveSegments)}}function WT(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class Hl extends Tt{constructor(e=1,t=32,n=16,i=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(o+a,Math.PI);let h=0;const f=[],d=new H,p=new H,m=[],v=[],S=[],y=[];for(let _=0;_<=n;_++){const E=[],M=_/n;let b=0;_===0&&o===0?b=.5/t:_===n&&c===Math.PI&&(b=-.5/t);for(let P=0;P<=t;P++){const R=P/t;d.x=-e*Math.cos(i+R*r)*Math.sin(o+M*a),d.y=e*Math.cos(o+M*a),d.z=e*Math.sin(i+R*r)*Math.sin(o+M*a),v.push(d.x,d.y,d.z),p.copy(d).normalize(),S.push(p.x,p.y,p.z),y.push(R+b,1-M),E.push(h++)}f.push(E)}for(let _=0;_<n;_++)for(let E=0;E<t;E++){const M=f[_][E+1],b=f[_][E],P=f[_+1][E],R=f[_+1][E+1];(_!==0||o>0)&&m.push(M,b,R),(_!==n-1||c<Math.PI)&&m.push(b,P,R)}this.setIndex(m),this.setAttribute("position",new st(v,3)),this.setAttribute("normal",new st(S,3)),this.setAttribute("uv",new st(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class xh extends fs{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 xh(e.radius,e.detail)}}class Sh extends Tt{constructor(e=1,t=.4,n=12,i=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],c=[],h=[],f=new H,d=new H,p=new H;for(let m=0;m<=n;m++)for(let v=0;v<=i;v++){const S=v/i*r,y=m/n*Math.PI*2;d.x=(e+t*Math.cos(y))*Math.cos(S),d.y=(e+t*Math.cos(y))*Math.sin(S),d.z=t*Math.sin(y),a.push(d.x,d.y,d.z),f.x=e*Math.cos(S),f.y=e*Math.sin(S),p.subVectors(d,f).normalize(),c.push(p.x,p.y,p.z),h.push(v/i),h.push(m/n)}for(let m=1;m<=n;m++)for(let v=1;v<=i;v++){const S=(i+1)*m+v-1,y=(i+1)*(m-1)+v-1,_=(i+1)*(m-1)+v,E=(i+1)*m+v;o.push(S,y,E),o.push(y,_,E)}this.setIndex(o),this.setAttribute("position",new st(a,3)),this.setAttribute("normal",new st(c,3)),this.setAttribute("uv",new st(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Mh extends Tt{constructor(e=1,t=.4,n=64,i=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],h=[],f=[],d=new H,p=new H,m=new H,v=new H,S=new H,y=new H,_=new H;for(let M=0;M<=n;++M){const b=M/n*r*Math.PI*2;E(b,r,o,e,m),E(b+.01,r,o,e,v),y.subVectors(v,m),_.addVectors(v,m),S.crossVectors(y,_),_.crossVectors(S,y),S.normalize(),_.normalize();for(let P=0;P<=i;++P){const R=P/i*Math.PI*2,L=-t*Math.cos(R),D=t*Math.sin(R);d.x=m.x+(L*_.x+D*S.x),d.y=m.y+(L*_.y+D*S.y),d.z=m.z+(L*_.z+D*S.z),c.push(d.x,d.y,d.z),p.subVectors(d,m).normalize(),h.push(p.x,p.y,p.z),f.push(M/n),f.push(P/i)}}for(let M=1;M<=n;M++)for(let b=1;b<=i;b++){const P=(i+1)*(M-1)+(b-1),R=(i+1)*M+(b-1),L=(i+1)*M+b,D=(i+1)*(M-1)+b;a.push(P,R,D),a.push(R,L,D)}this.setIndex(a),this.setAttribute("position",new st(c,3)),this.setAttribute("normal",new st(h,3)),this.setAttribute("uv",new st(f,2));function E(M,b,P,R,L){const D=Math.cos(M),A=Math.sin(M),C=P/b*M,k=Math.cos(C);L.x=R*(2+k)*.5*D,L.y=R*(2+k)*A*.5,L.z=R*Math.sin(C)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Mh(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Eh extends Tt{constructor(e=new Gp(new H(-1,-1,0),new H(-1,1,0),new H(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new H,c=new H,h=new Re;let f=new H;const d=[],p=[],m=[],v=[];S(),this.setIndex(v),this.setAttribute("position",new st(d,3)),this.setAttribute("normal",new st(p,3)),this.setAttribute("uv",new st(m,2));function S(){for(let M=0;M<t;M++)y(M);y(r===!1?t:0),E(),_()}function y(M){f=e.getPointAt(M/t,f);const b=o.normals[M],P=o.binormals[M];for(let R=0;R<=i;R++){const L=R/i*Math.PI*2,D=Math.sin(L),A=-Math.cos(L);c.x=A*b.x+D*P.x,c.y=A*b.y+D*P.y,c.z=A*b.z+D*P.z,c.normalize(),p.push(c.x,c.y,c.z),a.x=f.x+n*c.x,a.y=f.y+n*c.y,a.z=f.z+n*c.z,d.push(a.x,a.y,a.z)}}function _(){for(let M=1;M<=t;M++)for(let b=1;b<=i;b++){const P=(i+1)*(M-1)+(b-1),R=(i+1)*M+(b-1),L=(i+1)*M+b,D=(i+1)*(M-1)+b;v.push(P,R,D),v.push(R,L,D)}}function E(){for(let M=0;M<=t;M++)for(let b=0;b<=i;b++)h.x=M/t,h.y=b/i,m.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 Eh(new qu[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class yy extends Tt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new H,r=new H;if(e.index!==null){const o=e.attributes.position,a=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:a.count,materialIndex:0}]);for(let h=0,f=c.length;h<f;++h){const d=c[h],p=d.start,m=d.count;for(let v=p,S=p+m;v<S;v+=3)for(let y=0;y<3;y++){const _=a.getX(v+y),E=a.getX(v+(y+1)%3);i.fromBufferAttribute(o,_),r.fromBufferAttribute(o,E),z0(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const o=e.attributes.position;for(let a=0,c=o.count/3;a<c;a++)for(let h=0;h<3;h++){const f=3*a+h,d=3*a+(h+1)%3;i.fromBufferAttribute(o,f),r.fromBufferAttribute(o,d),z0(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new st(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function z0(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var G0=Object.freeze({__proto__:null,BoxGeometry:ao,CapsuleGeometry:fh,CircleGeometry:dh,ConeGeometry:ph,CylinderGeometry:pa,DodecahedronGeometry:mh,EdgesGeometry:my,ExtrudeGeometry:ma,IcosahedronGeometry:vh,LatheGeometry:zl,OctahedronGeometry:Gl,PlaneGeometry:hs,PolyhedronGeometry:fs,RingGeometry:_h,ShapeGeometry:yh,SphereGeometry:Hl,TetrahedronGeometry:xh,TorusGeometry:Sh,TorusKnotGeometry:Mh,TubeGeometry:Eh,WireframeGeometry:yy});class xy extends Xn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new $e(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 Sy extends lr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Vp extends Xn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new $e(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 $e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new Re(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class My extends Vp{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Re(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return nn(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 $e(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 $e(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new $e(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Ey extends Xn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new $e(16777215),this.specular=new $e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new Re(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Dl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class wy extends Xn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new $e(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new Re(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 by extends Xn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new Re(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 Ty extends Xn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new $e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new Re(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Dl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ay extends Xn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new $e(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new Re(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 Cy extends Yn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Js(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function Ry(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Py(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function ep(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,o=0;o!==n;++r){const a=t[r]*e;for(let c=0;c!==e;++c)i[o++]=s[a+c]}return i}function Wp(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=s[i++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do o=r[n],o!==void 0&&(e.push(r.time),t.push(o)),r=s[i++];while(r!==void 0)}function XT(s,e,t,n,i=30){const r=s.clone();r.name=e;const o=[];for(let c=0;c<r.tracks.length;++c){const h=r.tracks[c],f=h.getValueSize(),d=[],p=[];for(let m=0;m<h.times.length;++m){const v=h.times[m]*i;if(!(v<t||v>=n)){d.push(h.times[m]);for(let S=0;S<f;++S)p.push(h.values[m*f+S])}}d.length!==0&&(h.times=Js(d,h.times.constructor),h.values=Js(p,h.values.constructor),o.push(h))}r.tracks=o;let a=1/0;for(let c=0;c<r.tracks.length;++c)a>r.tracks[c].times[0]&&(a=r.tracks[c].times[0]);for(let c=0;c<r.tracks.length;++c)r.tracks[c].shift(-1*a);return r.resetDuration(),r}function YT(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,r=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;const h=s.tracks.find(function(_){return _.name===a.name&&_.ValueTypeName===c});if(h===void 0)continue;let f=0;const d=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let p=0;const m=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=m/3);const v=a.times.length-1;let S;if(r<=a.times[0]){const _=f,E=d-f;S=a.values.slice(_,E)}else if(r>=a.times[v]){const _=v*d+f,E=_+d-f;S=a.values.slice(_,E)}else{const _=a.createInterpolant(),E=f,M=d-f;_.evaluate(r),S=_.resultBuffer.slice(E,M)}c==="quaternion"&&new Wn().fromArray(S).normalize().conjugate().toArray(S);const y=h.times.length;for(let _=0;_<y;++_){const E=_*m+p;if(c==="quaternion")Wn.multiplyQuaternionsFlat(h.values,E,S,0,h.values,E);else{const M=m-p*2;for(let b=0;b<M;++b)h.values[E+b]-=S[b]}}}return s.blendMode=xp,s}const jT={convertArray:Js,isTypedArray:Ry,getKeyframeOrder:Py,sortedArray:ep,flattenJSON:Wp,subclip:XT,makeClipAdditive:YT};class Vl{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(n=2,r=a);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let o=0;o!==i;++o)t[o]=n[r+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Ly extends Vl{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:js,endingEnd:js}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,o=e+1,a=i[r],c=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case qs:r=e,a=2*t-n;break;case xl:r=i.length-2,a=t+i[r]-i[r+1];break;default:r=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case qs:o=e,c=2*n-t;break;case xl:o=1,c=n+i[1]-i[0];break;default:o=e-1,c=t}const h=(n-t)*.5,f=this.valueSize;this._weightPrev=h/(t-a),this._weightNext=h/(c-n),this._offsetPrev=r*f,this._offsetNext=o*f}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,h=c-a,f=this._offsetPrev,d=this._offsetNext,p=this._weightPrev,m=this._weightNext,v=(n-t)/(i-t),S=v*v,y=S*v,_=-p*y+2*p*S-p*v,E=(1+p)*y+(-1.5-2*p)*S+(-.5+p)*v+1,M=(-1-m)*y+(1.5+m)*S+.5*v,b=m*y-m*S;for(let P=0;P!==a;++P)r[P]=_*o[f+P]+E*o[h+P]+M*o[c+P]+b*o[d+P];return r}}class Xp extends Vl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,h=c-a,f=(n-t)/(i-t),d=1-f;for(let p=0;p!==a;++p)r[p]=o[h+p]*d+o[c+p]*f;return r}}class Iy extends Vl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Ji{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=Js(t,this.TimeBufferType),this.values=Js(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:Js(e.times,Array),values:Js(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Iy(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Xp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ly(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case _l:t=this.InterpolantFactoryMethodDiscrete;break;case yl:t=this.InterpolantFactoryMethodLinear;break;case Bu: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 _l;case this.InterpolantFactoryMethodLinear:return yl;case this.InterpolantFactoryMethodSmooth:return Bu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<e;)++r;for(;o!==-1&&n[o]>t;)--o;if(++o,r!==0||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&Ry(i))for(let a=0,c=i.length;a!==c;++a){const h=i[a];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Bu,r=e.length-1;let o=1;for(let a=1;a<r;++a){let c=!1;const h=e[a],f=e[a+1];if(h!==f&&(a!==1||h!==e[0]))if(i)c=!0;else{const d=a*n,p=d-n,m=d+n;for(let v=0;v!==n;++v){const S=t[d+v];if(S!==t[p+v]||S!==t[m+v]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];const d=a*n,p=o*n;for(let m=0;m!==n;++m)t[p+m]=t[d+m]}++o}}if(r>0){e[o]=e[r];for(let a=r*n,c=o*n,h=0;h!==n;++h)t[c+h]=t[a+h];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Ji.prototype.TimeBufferType=Float32Array;Ji.prototype.ValueBufferType=Float32Array;Ji.prototype.DefaultInterpolation=yl;class lo extends Ji{}lo.prototype.ValueTypeName="bool";lo.prototype.ValueBufferType=Array;lo.prototype.DefaultInterpolation=_l;lo.prototype.InterpolantFactoryMethodLinear=void 0;lo.prototype.InterpolantFactoryMethodSmooth=void 0;class Yp extends Ji{}Yp.prototype.ValueTypeName="color";class Pl extends Ji{}Pl.prototype.ValueTypeName="number";class Uy extends Vl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let h=e*a;for(let f=h+a;h!==f;h+=4)Wn.slerpFlat(r,0,o,h-a,o,h,c);return r}}class ga extends Ji{InterpolantFactoryMethodLinear(e){return new Uy(this.times,this.values,this.getValueSize(),e)}}ga.prototype.ValueTypeName="quaternion";ga.prototype.DefaultInterpolation=yl;ga.prototype.InterpolantFactoryMethodSmooth=void 0;class co extends Ji{}co.prototype.ValueTypeName="string";co.prototype.ValueBufferType=Array;co.prototype.DefaultInterpolation=_l;co.prototype.InterpolantFactoryMethodLinear=void 0;co.prototype.InterpolantFactoryMethodSmooth=void 0;class Ll extends Ji{}Ll.prototype.ValueTypeName="vector";class Il{constructor(e,t=-1,n,i=eh){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ci(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(ZT(n[o]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=n.length;r!==o;++r)t.push(Ji.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,o=[];for(let a=0;a<r;a++){let c=[],h=[];c.push((a+r-1)%r,a,(a+1)%r),h.push(0,1,0);const f=Py(c);c=ep(c,1,f),h=ep(h,1,f),!i&&c[0]===0&&(c.push(r),h.push(h[0])),o.push(new Pl(".morphTargetInfluences["+t[a].name+"]",c,h).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const h=e[a],f=h.name.match(r);if(f&&f.length>1){const d=f[1];let p=i[d];p||(i[d]=p=[]),p.push(h)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(d,p,m,v,S){if(m.length!==0){const y=[],_=[];Wp(m,y,_,v),y.length!==0&&S.push(new d(p,y,_))}},i=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const h=e.hierarchy||[];for(let d=0;d<h.length;d++){const p=h[d].keys;if(!(!p||p.length===0))if(p[0].morphTargets){const m={};let v;for(v=0;v<p.length;v++)if(p[v].morphTargets)for(let S=0;S<p[v].morphTargets.length;S++)m[p[v].morphTargets[S]]=-1;for(const S in m){const y=[],_=[];for(let E=0;E!==p[v].morphTargets.length;++E){const M=p[v];y.push(M.time),_.push(M.morphTarget===S?1:0)}i.push(new Pl(".morphTargetInfluence["+S+"]",y,_))}c=m.length*o}else{const m=".bones["+t[d].name+"]";n(Ll,m+".position",p,"pos",i),n(ga,m+".quaternion",p,"rot",i),n(Ll,m+".scale",p,"scl",i)}}return i.length===0?null:new this(r,c,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function qT(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Pl;case"vector":case"vector2":case"vector3":case"vector4":return Ll;case"color":return Yp;case"quaternion":return ga;case"bool":case"boolean":return lo;case"string":return co}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function ZT(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=qT(s.type);if(s.times===void 0){const t=[],n=[];Wp(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Lr={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class jp{constructor(e,t,n){const i=this;let r=!1,o=0,a=0,c;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(f){a++,r===!1&&i.onStart!==void 0&&i.onStart(f,o,a),r=!0},this.itemEnd=function(f){o++,i.onProgress!==void 0&&i.onProgress(f,o,a),o===a&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(f){i.onError!==void 0&&i.onError(f)},this.resolveURL=function(f){return c?c(f):f},this.setURLModifier=function(f){return c=f,this},this.addHandler=function(f,d){return h.push(f,d),this},this.removeHandler=function(f){const d=h.indexOf(f);return d!==-1&&h.splice(d,2),this},this.getHandler=function(f){for(let d=0,p=h.length;d<p;d+=2){const m=h[d],v=h[d+1];if(m.global&&(m.lastIndex=0),m.test(f))return v}return null}}}const Dy=new jp;class gi{constructor(e){this.manager=e!==void 0?e:Dy,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}gi.DEFAULT_MATERIAL_NAME="__DEFAULT";const Tr={};class JT extends Error{constructor(e,t){super(e),this.response=t}}class Fr extends gi{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 r=Lr.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(Tr[e]!==void 0){Tr[e].push({onLoad:t,onProgress:n,onError:i});return}Tr[e]=[],Tr[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).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=Tr[e],d=h.body.getReader(),p=h.headers.get("Content-Length")||h.headers.get("X-File-Size"),m=p?parseInt(p):0,v=m!==0;let S=0;const y=new ReadableStream({start(_){E();function E(){d.read().then(({done:M,value:b})=>{if(M)_.close();else{S+=b.byteLength;const P=new ProgressEvent("progress",{lengthComputable:v,loaded:S,total:m});for(let R=0,L=f.length;R<L;R++){const D=f[R];D.onProgress&&D.onProgress(P)}_.enqueue(b),E()}})}}});return new Response(y)}else throw new JT(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(c){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(f=>new DOMParser().parseFromString(f,a));case"json":return h.json();default:if(a===void 0)return h.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),p=d&&d[1]?d[1].toLowerCase():void 0,m=new TextDecoder(p);return h.arrayBuffer().then(v=>m.decode(v))}}}).then(h=>{Lr.add(e,h);const f=Tr[e];delete Tr[e];for(let d=0,p=f.length;d<p;d++){const m=f[d];m.onLoad&&m.onLoad(h)}}).catch(h=>{const f=Tr[e];if(f===void 0)throw this.manager.itemError(e),h;delete Tr[e];for(let d=0,p=f.length;d<p;d++){const m=f[d];m.onError&&m.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 KT extends gi{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Fr(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Il.parse(e[n]);t.push(i)}return t}}class QT extends gi{constructor(e){super(e)}load(e,t,n,i){const r=this,o=[],a=new uh,c=new Fr(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(r.withCredentials);let h=0;function f(d){c.load(e[d],function(p){const m=r.parse(p,!0);o[d]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},h+=1,h===6&&(m.mipmapCount===1&&(a.minFilter=Kt),a.image=o,a.format=m.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let d=0,p=e.length;d<p;++d)f(d);else c.load(e,function(d){const p=r.parse(d,!0);if(p.isCubemap){const m=p.mipmaps.length/p.mipmapCount;for(let v=0;v<m;v++){o[v]={mipmaps:[]};for(let S=0;S<p.mipmapCount;S++)o[v].mipmaps.push(p.mipmaps[v*p.mipmapCount+S]),o[v].format=p.format,o[v].width=p.width,o[v].height=p.height}a.image=o}else a.image.width=p.width,a.image.height=p.height,a.mipmaps=p.mipmaps;p.mipmapCount===1&&(a.minFilter=Kt),a.format=p.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class Ul extends gi{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Lr.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=bl("img");function c(){f(),Lr.add(e,this),t&&t(this),r.manager.itemEnd(e)}function h(d){f(),i&&i(d),r.manager.itemError(e),r.manager.itemEnd(e)}function f(){a.removeEventListener("load",c,!1),a.removeEventListener("error",h,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class $T extends gi{constructor(e){super(e)}load(e,t,n,i){const r=new Bl;r.colorSpace=yn;const o=new Ul(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(h){o.load(e[h],function(f){r.images[h]=f,a++,a===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let h=0;h<e.length;++h)c(h);return r}}class eA extends gi{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new eo,a=new Fr(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(c){let h;try{h=r.parse(c)}catch(f){if(i!==void 0)i(f);else{console.error(f);return}}h.image!==void 0?o.image=h.image:h.data!==void 0&&(o.image.width=h.width,o.image.height=h.height,o.image.data=h.data),o.wrapS=h.wrapS!==void 0?h.wrapS:Vn,o.wrapT=h.wrapT!==void 0?h.wrapT:Vn,o.magFilter=h.magFilter!==void 0?h.magFilter:Kt,o.minFilter=h.minFilter!==void 0?h.minFilter:Kt,o.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0?o.colorSpace=h.colorSpace:h.encoding!==void 0&&(o.encoding=h.encoding),h.flipY!==void 0&&(o.flipY=h.flipY),h.format!==void 0&&(o.format=h.format),h.type!==void 0&&(o.type=h.type),h.mipmaps!==void 0&&(o.mipmaps=h.mipmaps,o.minFilter=cs),h.mipmapCount===1&&(o.minFilter=Kt),h.generateMipmaps!==void 0&&(o.generateMipmaps=h.generateMipmaps),o.needsUpdate=!0,t&&t(o,h)},n,i),o}}class tA extends gi{constructor(e){super(e)}load(e,t,n,i){const r=new sn,o=new Ul(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class ds extends Nt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new $e(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class Ny extends ds{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new $e(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const $f=new yt,H0=new H,V0=new H;class qp{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Re(512,512),this.map=null,this.mapPass=null,this.matrix=new yt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new kl,this._frameExtents=new Re(1,1),this._viewportCount=1,this._viewports=[new Ft(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;H0.setFromMatrixPosition(e.matrixWorld),t.position.copy(H0),V0.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(V0),t.updateMatrixWorld(),$f.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix($f),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply($f)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class nA extends qp{constructor(){super(new fn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ca*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Fy extends ds{constructor(e,t,n=0,i=Math.PI/3,r=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.target=new Nt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new nA}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 W0=new yt,$a=new H,ed=new H;class iA extends qp{constructor(){super(new fn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Re(4,2),this._viewportCount=6,this._viewports=[new Ft(2,1,1,1),new Ft(0,1,1,1),new Ft(3,1,1,1),new Ft(1,1,1,1),new Ft(3,0,1,1),new Ft(1,0,1,1)],this._cubeDirections=[new H(1,0,0),new H(-1,0,0),new H(0,0,1),new H(0,0,-1),new H(0,1,0),new H(0,-1,0)],this._cubeUps=[new H(0,1,0),new H(0,1,0),new H(0,1,0),new H(0,1,0),new H(0,0,1),new H(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),$a.setFromMatrixPosition(e.matrixWorld),n.position.copy($a),ed.copy(n.position),ed.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(ed),n.updateMatrixWorld(),i.makeTranslation(-$a.x,-$a.y,-$a.z),W0.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(W0)}}class Oy extends ds{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 iA}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 rA extends qp{constructor(){super(new os(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class By extends ds{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.target=new Nt,this.shadow=new rA}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class ky extends ds{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class zy extends ds{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 Gy{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new H)}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,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*r),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*r)),t.addScaledVector(o[6],.315392*(3*r*r-1)),t.addScaledVector(o[7],1.092548*(n*r)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*r),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*r),t.addScaledVector(o[6],.743125*r*r-.247708),t.addScaledVector(o[7],2*.429043*n*r),t.addScaledVector(o[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,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Hy extends ds{constructor(e=new Gy,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 wh extends gi{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,o=new Fr(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(r){return t[r]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",r),t[r]}const i=wh.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 $e().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(i.uniforms[r]={},o.type){case"t":i.uniforms[r].value=n(o.value);break;case"c":i.uniforms[r].value=new $e().setHex(o.value);break;case"v2":i.uniforms[r].value=new Re().fromArray(o.value);break;case"v3":i.uniforms[r].value=new H().fromArray(o.value);break;case"v4":i.uniforms[r].value=new Ft().fromArray(o.value);break;case"m3":i.uniforms[r].value=new wt().fromArray(o.value);break;case"m4":i.uniforms[r].value=new yt().fromArray(o.value);break;default:i.uniforms[r].value=o.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 r in e.extensions)i.extensions[r]=e.extensions[r];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 r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new Re().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Re().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:xy,SpriteMaterial:Dp,RawShaderMaterial:Sy,ShaderMaterial:lr,PointsMaterial:Fp,MeshPhysicalMaterial:My,MeshStandardMaterial:Vp,MeshPhongMaterial:Ey,MeshToonMaterial:wy,MeshNormalMaterial:by,MeshLambertMaterial:Ty,MeshDepthMaterial:rh,MeshDistanceMaterial:sh,MeshBasicMaterial:Br,MeshMatcapMaterial:Ay,LineDashedMaterial:Cy,LineBasicMaterial:Yn,Material:Xn};return new t[e]}}class tp{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Zp extends Tt{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 Vy extends gi{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Fr(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(m,v){if(t[v]!==void 0)return t[v];const y=m.interleavedBuffers[v],_=r(m,y.buffer),E=ea(y.type,_),M=new lh(E,y.stride);return M.uuid=y.uuid,t[v]=M,M}function r(m,v){if(n[v]!==void 0)return n[v];const y=m.arrayBuffers[v],_=new Uint32Array(y).buffer;return n[v]=_,_}const o=e.isInstancedBufferGeometry?new Zp:new Tt,a=e.data.index;if(a!==void 0){const m=ea(a.type,a.array);o.setIndex(new kt(m,1))}const c=e.data.attributes;for(const m in c){const v=c[m];let S;if(v.isInterleavedBufferAttribute){const y=i(e.data,v.data);S=new io(y,v.itemSize,v.offset,v.normalized)}else{const y=ea(v.type,v.array),_=v.isInstancedBufferAttribute?ro:kt;S=new _(y,v.itemSize,v.normalized)}v.name!==void 0&&(S.name=v.name),v.usage!==void 0&&S.setUsage(v.usage),o.setAttribute(m,S)}const h=e.data.morphAttributes;if(h)for(const m in h){const v=h[m],S=[];for(let y=0,_=v.length;y<_;y++){const E=v[y];let M;if(E.isInterleavedBufferAttribute){const b=i(e.data,E.data);M=new io(b,E.itemSize,E.offset,E.normalized)}else{const b=ea(E.type,E.array);M=new kt(b,E.itemSize,E.normalized)}E.name!==void 0&&(M.name=E.name),S.push(M)}o.morphAttributes[m]=S}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let m=0,v=d.length;m!==v;++m){const S=d[m];o.addGroup(S.start,S.count,S.materialIndex)}const p=e.data.boundingSphere;if(p!==void 0){const m=new H;p.center!==void 0&&m.fromArray(p.center),o.boundingSphere=new Rn(m,p.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class sA extends gi{constructor(e){super(e)}load(e,t,n,i){const r=this,o=this.path===""?tp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Fr(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){let h=null;try{h=JSON.parse(c)}catch(d){i!==void 0&&i(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.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}r.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?tp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new Fr(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const o=await r.loadAsync(e,t),a=JSON.parse(o),c=a.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(h)}),a=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,a),h=this.parseObject(e.object,r,c,a,n),f=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,f),t!==void 0){let d=!1;for(const p in o)if(o[p].data instanceof HTMLImageElement){d=!0;break}d===!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),r=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,i,a,o,t),h=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,h),c}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new as().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=new ch().fromJSON(e[r],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Vy;for(let r=0,o=e.length;r<o;r++){let a;const c=e[r];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(c);break;default:c.type in G0?a=G0[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}a.uuid=c.uuid,c.name!==void 0&&(a.name=c.name),c.userData!==void 0&&(a.userData=c.userData),n[c.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const r=new wh;r.setTextures(t);for(let o=0,a=e.length;o<a;o++){const c=e[o];n[c.uuid]===void 0&&(n[c.uuid]=r.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],r=Il.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function o(c){return n.manager.itemStart(c),r.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function a(c){if(typeof c=="string"){const h=c,f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return o(f)}else return c.data?{data:ea(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new jp(t);r=new Ul(c),r.setCrossOrigin(this.crossOrigin);for(let h=0,f=e.length;h<f;h++){const d=e[h],p=d.url;if(Array.isArray(p)){const m=[];for(let v=0,S=p.length;v<S;v++){const y=p[v],_=a(y);_!==null&&(_ instanceof HTMLImageElement?m.push(_):m.push(new eo(_.data,_.width,_.height)))}i[d.uuid]=new Zs(m)}else{const m=a(d.url);i[d.uuid]=new Zs(m)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(o){if(typeof o=="string"){const a=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(c)}else return o.data?{data:ea(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new Ul(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const c=e[o],h=c.url;if(Array.isArray(h)){const f=[];for(let d=0,p=h.length;d<p;d++){const m=h[d],v=await r(m);v!==null&&(v instanceof HTMLImageElement?f.push(v):f.push(new eo(v.data,v.width,v.height)))}n[c.uuid]=new Zs(f)}else{const f=await r(c.url);n[c.uuid]=new Zs(f)}}}return n}parseTextures(e,t){function n(r,o){return typeof r=="number"?r:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",r),o[r])}const i={};if(e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=e[r];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const c=t[a.image],h=c.data;let f;Array.isArray(h)?(f=new Bl,h.length===6&&(f.needsUpdate=!0)):(h&&h.data?f=new eo:f=new sn,h&&(f.needsUpdate=!0)),f.source=c,f.uuid=a.uuid,a.name!==void 0&&(f.name=a.name),a.mapping!==void 0&&(f.mapping=n(a.mapping,oA)),a.channel!==void 0&&(f.channel=a.channel),a.offset!==void 0&&f.offset.fromArray(a.offset),a.repeat!==void 0&&f.repeat.fromArray(a.repeat),a.center!==void 0&&f.center.fromArray(a.center),a.rotation!==void 0&&(f.rotation=a.rotation),a.wrap!==void 0&&(f.wrapS=n(a.wrap[0],X0),f.wrapT=n(a.wrap[1],X0)),a.format!==void 0&&(f.format=a.format),a.internalFormat!==void 0&&(f.internalFormat=a.internalFormat),a.type!==void 0&&(f.type=a.type),a.colorSpace!==void 0&&(f.colorSpace=a.colorSpace),a.encoding!==void 0&&(f.encoding=a.encoding),a.minFilter!==void 0&&(f.minFilter=n(a.minFilter,Y0)),a.magFilter!==void 0&&(f.magFilter=n(a.magFilter,Y0)),a.anisotropy!==void 0&&(f.anisotropy=a.anisotropy),a.flipY!==void 0&&(f.flipY=a.flipY),a.generateMipmaps!==void 0&&(f.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(f.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(f.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(f.compareFunction=a.compareFunction),a.userData!==void 0&&(f.userData=a.userData),i[a.uuid]=f}return i}parseObject(e,t,n,i,r){let o;function a(p){return t[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",p),t[p]}function c(p){if(p!==void 0){if(Array.isArray(p)){const m=[];for(let v=0,S=p.length;v<S;v++){const y=p[v];n[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",y),m.push(n[y])}return m}return n[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",p),n[p]}}function h(p){return i[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",p),i[p]}let f,d;switch(e.type){case"Scene":o=new Up,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new $e(e.background):o.background=h(e.background)),e.environment!==void 0&&(o.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new ah(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new oh(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":o=new fn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new os(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new ky(e.color,e.intensity);break;case"DirectionalLight":o=new By(e.color,e.intensity);break;case"PointLight":o=new Oy(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new zy(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new Fy(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new Ny(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Hy().fromJSON(e);break;case"SkinnedMesh":f=a(e.geometry),d=c(e.material),o=new sy(f,d),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":f=a(e.geometry),d=c(e.material),o=new rn(f,d);break;case"InstancedMesh":f=a(e.geometry),d=c(e.material);const p=e.count,m=e.instanceMatrix,v=e.instanceColor;o=new oy(f,d,p),o.instanceMatrix=new ro(new Float32Array(m.array),16),v!==void 0&&(o.instanceColor=new ro(new Float32Array(v.array),v.itemSize));break;case"BatchedMesh":f=a(e.geometry),d=c(e.material),o=new ay(e.maxGeometryCount,e.maxVertexCount,e.maxIndexCount,d),o.geometry=f,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(S=>{const y=new Cn;y.min.fromArray(S.boxMin),y.max.fromArray(S.boxMax);const _=new Rn;return _.radius=S.sphereRadius,_.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:y,sphereInitialized:S.sphereInitialized,sphere:_}}),o._maxGeometryCount=e.maxGeometryCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=h(e.matricesTexture.uuid);break;case"LOD":o=new ry;break;case"Line":o=new Nr(a(e.geometry),c(e.material));break;case"LineLoop":o=new ly(a(e.geometry),c(e.material));break;case"LineSegments":o=new cr(a(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new cy(a(e.geometry),c(e.material));break;case"Sprite":o=new iy(c(e.material));break;case"Group":o=new ia;break;case"Bone":o=new Np;break;default:o=new Nt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let m=0;m<p.length;m++)o.add(this.parseObject(p[m],t,n,i,r))}if(e.animations!==void 0){const p=e.animations;for(let m=0;m<p.length;m++){const v=p[m];o.animations.push(r[v])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const p=e.levels;for(let m=0;m<p.length;m++){const v=p[m],S=o.getObjectByProperty("uuid",v.object);S!==void 0&&o.addLevel(S,v.distance,v.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}}const oA={UVMapping:Qu,CubeReflectionMapping:Dr,CubeRefractionMapping:ls,EquirectangularReflectionMapping:pl,EquirectangularRefractionMapping:ml,CubeUVReflectionMapping:fa},X0={RepeatWrapping:gl,ClampToEdgeWrapping:Vn,MirroredRepeatWrapping:vl},Y0={NearestFilter:hn,NearestMipmapNearestFilter:Xu,NearestMipmapLinearFilter:sl,LinearFilter:Kt,LinearMipmapNearestFilter:fp,LinearMipmapLinearFilter:cs};class aA extends gi{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Lr.get(e);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(h=>{t&&t(h),r.manager.itemEnd(e)}).catch(h=>{i&&i(h)});return}return setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const c=fetch(e,a).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(h){return Lr.add(e,h),t&&t(h),r.manager.itemEnd(e),h}).catch(function(h){i&&i(h),Lr.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});Lr.add(e,c),r.manager.itemStart(e)}}let xu;class Jp{static getContext(){return xu===void 0&&(xu=new(window.AudioContext||window.webkitAudioContext)),xu}static setContext(e){xu=e}}class lA extends gi{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Fr(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const h=c.slice(0);Jp.getContext().decodeAudioData(h,function(d){t(d)}).catch(a)}catch(h){a(h)}},n,i);function a(c){i?i(c):console.error(c),r.manager.itemError(e)}}}const j0=new yt,q0=new yt,Fs=new yt;class cA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new fn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new fn,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,Fs.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,o=t.near*Math.tan(Qs*t.fov*.5)/t.zoom;let a,c;q0.elements[12]=-i,j0.elements[12]=i,a=-o*t.aspect+r,c=o*t.aspect+r,Fs.elements[0]=2*t.near/(c-a),Fs.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(Fs),a=-o*t.aspect-r,c=o*t.aspect-r,Fs.elements[0]=2*t.near/(c-a),Fs.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(Fs)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(q0),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(j0)}}class Kp{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Z0(),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=Z0();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Z0(){return(typeof performance>"u"?Date:performance).now()}const Os=new H,J0=new Wn,uA=new H,Bs=new H;class hA extends Nt{constructor(){super(),this.type="AudioListener",this.context=Jp.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Kp}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(Os,J0,uA),Bs.set(0,0,-1).applyQuaternion(J0),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Os.x,i),t.positionY.linearRampToValueAtTime(Os.y,i),t.positionZ.linearRampToValueAtTime(Os.z,i),t.forwardX.linearRampToValueAtTime(Bs.x,i),t.forwardY.linearRampToValueAtTime(Bs.y,i),t.forwardZ.linearRampToValueAtTime(Bs.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Os.x,Os.y,Os.z),t.setOrientation(Bs.x,Bs.y,Bs.z,n.x,n.y,n.z)}}class Wy extends Nt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const ks=new H,K0=new Wn,fA=new H,zs=new H;class dA extends Wy{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(ks,K0,fA),zs.set(0,0,1).applyQuaternion(K0);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ks.x,n),t.positionY.linearRampToValueAtTime(ks.y,n),t.positionZ.linearRampToValueAtTime(ks.z,n),t.orientationX.linearRampToValueAtTime(zs.x,n),t.orientationY.linearRampToValueAtTime(zs.y,n),t.orientationZ.linearRampToValueAtTime(zs.z,n)}else t.setPosition(ks.x,ks.y,ks.z),t.setOrientation(zs.x,zs.y,zs.z)}}class pA{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 Xy{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,o;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,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,r=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[r+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,r,0,a,i)}this.cumulativeWeight=o}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,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,h=t+t;c!==h;++c)if(n[c]!==n[c+t]){a.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 r=n,o=i;r!==o;++r)t[r]=t[i+r%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,r){if(i>=.5)for(let o=0;o!==r;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Wn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const o=this._workIndex*r;Wn.multiplyQuaternionsFlat(e,o,e,t,e,n),Wn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,r){const o=1-i;for(let a=0;a!==r;++a){const c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const Qp="\\[\\]\\.:\\/",mA=new RegExp("["+Qp+"]","g"),$p="[^"+Qp+"]",gA="[^"+Qp.replace("\\.","")+"]",vA=/((?:WC+[\/:])*)/.source.replace("WC",$p),_A=/(WCOD+)?/.source.replace("WCOD",gA),yA=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",$p),xA=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",$p),SA=new RegExp("^"+vA+_A+yA+xA+"$"),MA=["material","materials","bones","map"];class EA{constructor(e,t,n){const i=n||It.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class It{constructor(e,t,n){this.path=t,this.parsedPath=n||It.parseTrackName(t),this.node=It.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 It.Composite(e,t,n):new It(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(mA,"")}static parseTrackName(e){const t=SA.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);MA.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r){for(let o=0;o<r.length;o++){const a=r[o];if(a.name===t||a.uuid===t)return a;const c=n(a.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=It.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 o=e[i];if(o===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 a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}It.Composite=EA;It.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};It.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};It.prototype.GetterByBindingType=[It.prototype._getValue_direct,It.prototype._getValue_array,It.prototype._getValue_arrayElement,It.prototype._getValue_toArray];It.prototype.SetterByBindingTypeAndVersioning=[[It.prototype._setValue_direct,It.prototype._setValue_direct_setNeedsUpdate,It.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[It.prototype._setValue_array,It.prototype._setValue_array_setNeedsUpdate,It.prototype._setValue_array_setMatrixWorldNeedsUpdate],[It.prototype._setValue_arrayElement,It.prototype._setValue_arrayElement_setNeedsUpdate,It.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[It.prototype._setValue_fromArray,It.prototype._setValue_fromArray_setNeedsUpdate,It.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class wA{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Ci(),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,r=this._bindings,o=r.length;let a,c=e.length,h=this.nCachedObjects_;for(let f=0,d=arguments.length;f!==d;++f){const p=arguments[f],m=p.uuid;let v=t[m];if(v===void 0){v=c++,t[m]=v,e.push(p);for(let S=0,y=o;S!==y;++S)r[S].push(new It(p,n[S],i[S]))}else if(v<h){a=e[v];const S=--h,y=e[S];t[y.uuid]=v,e[v]=y,t[m]=S,e[S]=p;for(let _=0,E=o;_!==E;++_){const M=r[_],b=M[S];let P=M[v];M[v]=b,P===void 0&&(P=new It(p,n[_],i[_])),M[S]=P}}else e[v]!==a&&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 r=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const c=arguments[o],h=c.uuid,f=t[h];if(f!==void 0&&f>=r){const d=r++,p=e[d];t[p.uuid]=f,e[f]=p,t[h]=d,e[d]=c;for(let m=0,v=i;m!==v;++m){const S=n[m],y=S[d],_=S[f];S[f]=y,S[d]=_}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const h=arguments[a],f=h.uuid,d=t[f];if(d!==void 0)if(delete t[f],d<r){const p=--r,m=e[p],v=--o,S=e[v];t[m.uuid]=d,e[d]=m,t[S.uuid]=p,e[p]=S,e.pop();for(let y=0,_=i;y!==_;++y){const E=n[y],M=E[p],b=E[v];E[d]=M,E[p]=b,E.pop()}}else{const p=--o,m=e[p];p>0&&(t[m.uuid]=d),e[d]=m,e.pop();for(let v=0,S=i;v!==S;++v){const y=n[v];y[d]=y[p],y.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const o=this._paths,a=this._parsedPaths,c=this._objects,h=c.length,f=this.nCachedObjects_,d=new Array(h);i=r.length,n[e]=i,o.push(e),a.push(t),r.push(d);for(let p=f,m=c.length;p!==m;++p){const v=c[p];d[p]=new It(v,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],h=e[a];t[h]=n,o[n]=c,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}class Yy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,o=r.length,a=new Array(o),c={endingStart:js,endingEnd:js};for(let h=0;h!==o;++h){const f=r[h].createInterpolant(null);a[h]=f,f.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=R_,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,r=e._clip.duration,o=r/i,a=i/r;e.warp(1,o,t),this.warp(a,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,r=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,h=a.sampleValues;return c[0]=r,c[1]=r+n,h[0]=e/o,h[1]=t/o,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 r=this._startTime;if(r!==null){const c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case xp:for(let f=0,d=c.length;f!==d;++f)c[f].evaluate(o),h[f].accumulateAdditive(a);break;case eh:default:for(let f=0,d=c.length;f!==d;++f)c[f].evaluate(o),h[f].accumulate(i,a)}}}_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,r=this._loopCount;const o=n===P_;if(e===0)return r===-1?i:o&&(r&1)===1?t-i:i;if(n===C_){r===-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(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,r+=Math.abs(a);const c=this.repetitions-r;if(c<=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(c===1){const h=e<0;this._setEndings(h,!h,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=qs,i.endingEnd=qs):(e?i.endingStart=this.zeroSlopeAtStart?qs:js:i.endingStart=xl,t?i.endingEnd=this.zeroSlopeAtEnd?qs:js:i.endingEnd=xl)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=r,c[0]=t,a[1]=r+e,c[1]=n,this}}const bA=new Float32Array(1);class TA extends Or{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,r=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,h=this._bindingsByRootAndName;let f=h[c];f===void 0&&(f={},h[c]=f);for(let d=0;d!==r;++d){const p=i[d],m=p.name;let v=f[m];if(v!==void 0)++v.referenceCount,o[d]=v;else{if(v=o[d],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,c,m));continue}const S=t&&t._propertyBindings[d].binding.parsedPath;v=new Xy(It.create(n,m,S),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,c,m),o[d]=v}a[d].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.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 r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}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,r=this._actionsByClip;let o=r[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.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 r=e._clip.uuid,o=this._actionsByClip,a=o[r],c=a.knownActions,h=c[c.length-1],f=e._byClipCacheIndex;h._byClipCacheIndex=f,c[f]=h,c.pop(),e._byClipCacheIndex=null;const d=a.actionByRoot,p=(e._localRoot||this._root).uuid;delete d[p],c.length===0&&delete o[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],c=t[t.length-1],h=e._cacheIndex;c._cacheIndex=h,t[h]=c,t.pop(),delete a[r],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Xp(new Float32Array(2),new Float32Array(2),1,bA),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let o=typeof e=="string"?Il.findByName(i,e):e;const a=o!==null?o.uuid:e,c=this._actionsByClip[a];let h=null;if(n===void 0&&(o!==null?n=o.blendMode:n=eh),c!==void 0){const d=c.actionByRoot[r];if(d!==void 0&&d.blendMode===n)return d;h=c.knownActions[0],o===null&&(o=h._clip)}if(o===null)return null;const f=new Yy(this,o,t,n);return this._bindAction(f,h),this._addInactiveAction(f,a,r),f}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?Il.findByName(n,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.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,r=Math.sign(e),o=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,r,o);const a=this._bindings,c=this._nActiveBindings;for(let h=0;h!==c;++h)a[h].apply(o);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,r=i[n];if(r!==void 0){const o=r.knownActions;for(let a=0,c=o.length;a!==c;++a){const h=o[a];this._deactivateAction(h);const f=h._cacheIndex,d=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,d._cacheIndex=f,t[f]=d,t.pop(),this._removeInactiveBindingsForAction(h)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(const o in r){const a=r[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class em{constructor(e){this.value=e}clone(){return new em(this.value.clone===void 0?this.value:this.value.clone())}}let AA=0;class CA extends Or{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:AA++}),this.name="",this.usage=wl,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 r=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<r.length;o++)this.uniforms.push(r[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class RA extends lh{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 PA{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class jy{constructor(e,t,n=0,i=1/0){this.ray=new oo(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new $s,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: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return np(e,this,n,t),n.sort(Q0),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)np(e[i],this,n,t);return n.sort(Q0),n}}function Q0(s,e){return s.distance-e.distance}function np(s,e,t,n){if(s.layers.test(e.layers)&&s.raycast(e,t),n===!0){const i=s.children;for(let r=0,o=i.length;r<o;r++)np(i[r],e,t,!0)}}class ip{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(nn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class LA{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const $0=new Re;class IA{constructor(e=new Re(1/0,1/0),t=new Re(-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=$0.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,$0).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 ev=new H,Su=new H;class UA{constructor(e=new H,t=new H){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){ev.subVectors(e,this.start),Su.subVectors(this.end,this.start);const n=Su.dot(Su);let r=Su.dot(ev)/n;return t&&(r=nn(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const tv=new H;class DA extends Nt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Tt,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 o=0,a=1,c=32;o<c;o++,a++){const h=o/c*Math.PI*2,f=a/c*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(f),Math.sin(f),1)}n.setAttribute("position",new st(i,3));const r=new Yn({fog:!1,toneMapped:!1});this.cone=new cr(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),tv.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(tv),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const ts=new H,Mu=new yt,td=new yt;class NA extends cr{constructor(e){const t=qy(e),n=new Tt,i=[],r=[],o=new $e(0,0,1),a=new $e(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),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new st(i,3)),n.setAttribute("color",new st(r,3));const c=new Yn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,c),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 r=0,o=0;r<t.length;r++){const a=t[r];a.parent&&a.parent.isBone&&(Mu.multiplyMatrices(td,a.matrixWorld),ts.setFromMatrixPosition(Mu),i.setXYZ(o,ts.x,ts.y,ts.z),Mu.multiplyMatrices(td,a.parent.matrixWorld),ts.setFromMatrixPosition(Mu),i.setXYZ(o+1,ts.x,ts.y,ts.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function qy(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push.apply(e,qy(s.children[t]));return e}class FA extends rn{constructor(e,t,n){const i=new Hl(t,4,2),r=new Br({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),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 OA=new H,nv=new $e,iv=new $e;class BA extends Nt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Gl(t);i.rotateY(Math.PI*.5),this.material=new Br({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),o=new Float32Array(r.count*3);i.setAttribute("color",new kt(o,3)),this.add(new rn(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");nv.copy(this.light.color),iv.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?nv:iv;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(OA.setFromMatrixPosition(this.light.matrixWorld).negate())}}class kA extends cr{constructor(e=10,t=10,n=4473924,i=8947848){n=new $e(n),i=new $e(i);const r=t/2,o=e/t,a=e/2,c=[],h=[];for(let p=0,m=0,v=-a;p<=t;p++,v+=o){c.push(-a,0,v,a,0,v),c.push(v,0,-a,v,0,a);const S=p===r?n:i;S.toArray(h,m),m+=3,S.toArray(h,m),m+=3,S.toArray(h,m),m+=3,S.toArray(h,m),m+=3}const f=new Tt;f.setAttribute("position",new st(c,3)),f.setAttribute("color",new st(h,3));const d=new Yn({vertexColors:!0,toneMapped:!1});super(f,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class zA extends cr{constructor(e=10,t=16,n=8,i=64,r=4473924,o=8947848){r=new $e(r),o=new $e(o);const a=[],c=[];if(t>1)for(let d=0;d<t;d++){const p=d/t*(Math.PI*2),m=Math.sin(p)*e,v=Math.cos(p)*e;a.push(0,0,0),a.push(m,0,v);const S=d&1?r:o;c.push(S.r,S.g,S.b),c.push(S.r,S.g,S.b)}for(let d=0;d<n;d++){const p=d&1?r:o,m=e-e/n*d;for(let v=0;v<i;v++){let S=v/i*(Math.PI*2),y=Math.sin(S)*m,_=Math.cos(S)*m;a.push(y,0,_),c.push(p.r,p.g,p.b),S=(v+1)/i*(Math.PI*2),y=Math.sin(S)*m,_=Math.cos(S)*m,a.push(y,0,_),c.push(p.r,p.g,p.b)}}const h=new Tt;h.setAttribute("position",new st(a,3)),h.setAttribute("color",new st(c,3));const f=new Yn({vertexColors:!0,toneMapped:!1});super(h,f),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const rv=new H,Eu=new H,sv=new H;class GA extends Nt{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 Tt;i.setAttribute("position",new st([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new Yn({fog:!1,toneMapped:!1});this.lightPlane=new Nr(i,r),this.add(this.lightPlane),i=new Tt,i.setAttribute("position",new st([0,0,0,0,0,1],3)),this.targetLine=new Nr(i,r),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),rv.setFromMatrixPosition(this.light.matrixWorld),Eu.setFromMatrixPosition(this.light.target.matrixWorld),sv.subVectors(Eu,rv),this.lightPlane.lookAt(Eu),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(Eu),this.targetLine.scale.z=sv.length()}}const wu=new H,tn=new Ol;class HA extends cr{constructor(e){const t=new Tt,n=new Yn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(v,S){c(v),c(S)}function c(v){i.push(0,0,0),r.push(0,0,0),o[v]===void 0&&(o[v]=[]),o[v].push(i.length/3-1)}t.setAttribute("position",new st(i,3)),t.setAttribute("color",new st(r,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=o,this.update();const h=new $e(16755200),f=new $e(16711680),d=new $e(43775),p=new $e(16777215),m=new $e(3355443);this.setColors(h,f,d,p,m)}setColors(e,t,n,i,r){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;tn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),un("c",t,e,tn,0,0,-1),un("t",t,e,tn,0,0,1),un("n1",t,e,tn,-n,-i,-1),un("n2",t,e,tn,n,-i,-1),un("n3",t,e,tn,-n,i,-1),un("n4",t,e,tn,n,i,-1),un("f1",t,e,tn,-n,-i,1),un("f2",t,e,tn,n,-i,1),un("f3",t,e,tn,-n,i,1),un("f4",t,e,tn,n,i,1),un("u1",t,e,tn,n*.7,i*1.1,-1),un("u2",t,e,tn,-n*.7,i*1.1,-1),un("u3",t,e,tn,0,i*2,-1),un("cf1",t,e,tn,-n,0,1),un("cf2",t,e,tn,n,0,1),un("cf3",t,e,tn,0,-i,1),un("cf4",t,e,tn,0,i,1),un("cn1",t,e,tn,-n,0,-1),un("cn2",t,e,tn,n,0,-1),un("cn3",t,e,tn,0,-i,-1),un("cn4",t,e,tn,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function un(s,e,t,n,i,r,o){wu.set(i,r,o).unproject(n);const a=e[s];if(a!==void 0){const c=t.getAttribute("position");for(let h=0,f=a.length;h<f;h++)c.setXYZ(a[h],wu.x,wu.y,wu.z)}}const bu=new Cn;class VA extends cr{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),r=new Tt;r.setIndex(new kt(n,1)),r.setAttribute("position",new kt(i,3)),super(r,new Yn({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&&bu.setFromObject(this.object),bu.isEmpty())return;const t=bu.min,n=bu.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[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 WA extends cr{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],r=new Tt;r.setIndex(new kt(n,1)),r.setAttribute("position",new st(i,3)),super(r,new Yn({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 XA extends Nr{constructor(e,t=1,n=16776960){const i=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new Tt;o.setAttribute("position",new st(r,3)),o.computeBoundingSphere(),super(o,new Yn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new Tt;c.setAttribute("position",new st(a,3)),c.computeBoundingSphere(),this.add(new rn(c,new Br({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 ov=new H;let Tu,nd;class YA extends Nt{constructor(e=new H(0,0,1),t=new H(0,0,0),n=1,i=16776960,r=n*.2,o=r*.2){super(),this.type="ArrowHelper",Tu===void 0&&(Tu=new Tt,Tu.setAttribute("position",new st([0,0,0,0,1,0],3)),nd=new pa(0,.5,1,5,1),nd.translate(0,-.5,0)),this.position.copy(t),this.line=new Nr(Tu,new Yn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new rn(nd,new Br({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,o)}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{ov.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(ov,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 jA extends cr{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 Tt;i.setAttribute("position",new st(t,3)),i.setAttribute("color",new st(n,3));const r=new Yn({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new $e,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class qA{constructor(){this.type="ShapePath",this.color=new $e,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Tl,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,r,o){return this.currentPath.bezierCurveTo(e,t,n,i,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(_){const E=[];for(let M=0,b=_.length;M<b;M++){const P=_[M],R=new as;R.curves=P.curves,E.push(R)}return E}function n(_,E){const M=E.length;let b=!1;for(let P=M-1,R=0;R<M;P=R++){let L=E[P],D=E[R],A=D.x-L.x,C=D.y-L.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(L=E[R],A=-A,D=E[P],C=-C),_.y<L.y||_.y>D.y)continue;if(_.y===L.y){if(_.x===L.x)return!0}else{const k=C*(_.x-L.x)-A*(_.y-L.y);if(k===0)return!0;if(k<0)continue;b=!b}}else{if(_.y!==L.y)continue;if(D.x<=_.x&&_.x<=L.x||L.x<=_.x&&_.x<=D.x)return!0}}return b}const i=or.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,c;const h=[];if(r.length===1)return a=r[0],c=new as,c.curves=a.curves,h.push(c),h;let f=!i(r[0].getPoints());f=e?!f:f;const d=[],p=[];let m=[],v=0,S;p[v]=void 0,m[v]=[];for(let _=0,E=r.length;_<E;_++)a=r[_],S=a.getPoints(),o=i(S),o=e?!o:o,o?(!f&&p[v]&&v++,p[v]={s:new as,p:S},p[v].s.curves=a.curves,f&&v++,m[v]=[]):m[v].push({h:a,p:S[0]});if(!p[0])return t(r);if(p.length>1){let _=!1,E=0;for(let M=0,b=p.length;M<b;M++)d[M]=[];for(let M=0,b=p.length;M<b;M++){const P=m[M];for(let R=0;R<P.length;R++){const L=P[R];let D=!0;for(let A=0;A<p.length;A++)n(L.p,p[A].p)&&(M!==A&&E++,D?(D=!1,d[A].push(L)):_=!0);D&&d[M].push(L)}}E>0&&_===!1&&(m=d)}let y;for(let _=0,E=p.length;_<E;_++){c=p[_].s,h.push(c),y=m[_];for(let M=0,b=y.length;M<b;M++)c.holes.push(y[M].h)}return h}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ju}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ju);const ZA=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:hp,AddEquation:ns,AddOperation:d_,AdditiveAnimationBlendMode:xp,AdditiveBlending:md,AgXToneMapping:__,AlphaFormat:M_,AlwaysCompare:k_,AlwaysDepth:o_,AlwaysStencilFunc:Yd,AmbientLight:ky,AnimationAction:Yy,AnimationClip:Il,AnimationLoader:KT,AnimationMixer:TA,AnimationObjectGroup:wA,AnimationUtils:jT,ArcCurve:uy,ArrayCamera:ey,ArrowHelper:YA,AttachedBindMode:xd,Audio:Wy,AudioAnalyser:pA,AudioContext:Jp,AudioListener:hA,AudioLoader:lA,AxesHelper:jA,BackSide:si,BasicDepthPacking:L_,BasicShadowMap:Hv,BatchedMesh:ay,Bone:Np,BooleanKeyframeTrack:lo,Box2:IA,Box3:Cn,Box3Helper:WA,BoxGeometry:ao,BoxHelper:VA,BufferAttribute:kt,BufferGeometry:Tt,BufferGeometryLoader:Vy,ByteType:x_,Cache:Lr,Camera:Ol,CameraHelper:HA,CanvasTexture:vT,CapsuleGeometry:fh,CatmullRomCurve3:hy,CineonToneMapping:g_,CircleGeometry:dh,ClampToEdgeWrapping:Vn,Clock:Kp,Color:$e,ColorKeyframeTrack:Yp,ColorManagement:Bt,CompressedArrayTexture:mT,CompressedCubeTexture:gT,CompressedTexture:uh,CompressedTextureLoader:QT,ConeGeometry:ph,ConstantAlphaFactor:i_,ConstantColorFactor:t_,CubeCamera:X_,CubeReflectionMapping:Dr,CubeRefractionMapping:ls,CubeTexture:Bl,CubeTextureLoader:$T,CubeUVReflectionMapping:fa,CubicBezierCurve:Bp,CubicBezierCurve3:fy,CubicInterpolant:Ly,CullFaceBack:pd,CullFaceFront:Gv,CullFaceFrontBack:r1,CullFaceNone:zv,Curve:Zi,CurvePath:py,CustomBlending:Vv,CustomToneMapping:v_,CylinderGeometry:pa,Cylindrical:LA,Data3DTexture:Tp,DataArrayTexture:nh,DataTexture:eo,DataTextureLoader:eA,DataUtils:pS,DecrementStencilOp:g1,DecrementWrapStencilOp:_1,DefaultLoadingManager:Dy,DepthFormat:rs,DepthStencilFormat:no,DepthTexture:Lp,DetachedBindMode:y_,DirectionalLight:By,DirectionalLightHelper:GA,DiscreteInterpolant:Iy,DisplayP3ColorSpace:th,DodecahedronGeometry:mh,DoubleSide:pi,DstAlphaFactor:Jv,DstColorFactor:Qv,DynamicCopyUsage:U1,DynamicDrawUsage:A1,DynamicReadUsage:P1,EdgesGeometry:my,EllipseCurve:hh,EqualCompare:N_,EqualDepth:l_,EqualStencilFunc:M1,EquirectangularReflectionMapping:pl,EquirectangularRefractionMapping:ml,Euler:Fl,EventDispatcher:Or,ExtrudeGeometry:ma,FileLoader:Fr,Float16BufferAttribute:xS,Float32BufferAttribute:st,Float64BufferAttribute:SS,FloatType:Yi,Fog:ah,FogExp2:oh,FramebufferTexture:pT,FrontSide:Ur,Frustum:kl,GLBufferAttribute:PA,GLSL1:N1,GLSL3:jd,GreaterCompare:F_,GreaterDepth:u_,GreaterEqualCompare:B_,GreaterEqualDepth:c_,GreaterEqualStencilFunc:T1,GreaterStencilFunc:w1,GridHelper:kA,Group:ia,HalfFloatType:aa,HemisphereLight:Ny,HemisphereLightHelper:BA,IcosahedronGeometry:vh,ImageBitmapLoader:aA,ImageLoader:Ul,ImageUtils:bp,IncrementStencilOp:m1,IncrementWrapStencilOp:v1,InstancedBufferAttribute:ro,InstancedBufferGeometry:Zp,InstancedInterleavedBuffer:RA,InstancedMesh:oy,Int16BufferAttribute:_S,Int32BufferAttribute:yS,Int8BufferAttribute:mS,IntType:dp,InterleavedBuffer:lh,InterleavedBufferAttribute:io,Interpolant:Vl,InterpolateDiscrete:_l,InterpolateLinear:yl,InterpolateSmooth:Bu,InvertStencilOp:y1,KeepStencilOp:Ws,KeyframeTrack:Ji,LOD:ry,LatheGeometry:zl,Layers:$s,LessCompare:D_,LessDepth:a_,LessEqualCompare:Ep,LessEqualDepth:dl,LessEqualStencilFunc:E1,LessStencilFunc:S1,Light:ds,LightProbe:Hy,Line:Nr,Line3:UA,LineBasicMaterial:Yn,LineCurve:kp,LineCurve3:dy,LineDashedMaterial:Cy,LineLoop:ly,LineSegments:cr,LinearDisplayP3ColorSpace:Nl,LinearEncoding:Sp,LinearFilter:Kt,LinearInterpolant:Xp,LinearMipMapLinearFilter:c1,LinearMipMapNearestFilter:l1,LinearMipmapLinearFilter:cs,LinearMipmapNearestFilter:fp,LinearSRGBColorSpace:ar,LinearToneMapping:p_,LinearTransfer:Sl,Loader:gi,LoaderUtils:tp,LoadingManager:jp,LoopOnce:C_,LoopPingPong:P_,LoopRepeat:R_,LuminanceAlphaFormat:w_,LuminanceFormat:E_,MOUSE:Hs,Material:Xn,MaterialLoader:wh,MathUtils:J1,Matrix3:wt,Matrix4:yt,MaxEquation:yd,Mesh:rn,MeshBasicMaterial:Br,MeshDepthMaterial:rh,MeshDistanceMaterial:sh,MeshLambertMaterial:Ty,MeshMatcapMaterial:Ay,MeshNormalMaterial:by,MeshPhongMaterial:Ey,MeshPhysicalMaterial:My,MeshStandardMaterial:Vp,MeshToonMaterial:wy,MinEquation:_d,MirroredRepeatWrapping:vl,MixOperation:f_,MultiplyBlending:vd,MultiplyOperation:Dl,NearestFilter:hn,NearestMipMapLinearFilter:a1,NearestMipMapNearestFilter:o1,NearestMipmapLinearFilter:sl,NearestMipmapNearestFilter:Xu,NeverCompare:U_,NeverDepth:s_,NeverStencilFunc:x1,NoBlending:Ir,NoColorSpace:Ai,NoToneMapping:rr,NormalAnimationBlendMode:eh,NormalBlending:Ks,NotEqualCompare:O_,NotEqualDepth:h_,NotEqualStencilFunc:b1,NumberKeyframeTrack:Pl,Object3D:Nt,ObjectLoader:sA,ObjectSpaceNormalMap:I_,OctahedronGeometry:Gl,OneFactor:jv,OneMinusConstantAlphaFactor:r_,OneMinusConstantColorFactor:n_,OneMinusDstAlphaFactor:Kv,OneMinusDstColorFactor:$v,OneMinusSrcAlphaFactor:Wu,OneMinusSrcColorFactor:Zv,OrthographicCamera:os,P3Primaries:El,PCFShadowMap:Ku,PCFSoftShadowMap:rl,PMREMGenerator:Zd,Path:Tl,PerspectiveCamera:fn,Plane:Cr,PlaneGeometry:hs,PlaneHelper:XA,PointLight:Oy,PointLightHelper:FA,Points:cy,PointsMaterial:Fp,PolarGridHelper:zA,PolyhedronGeometry:fs,PositionalAudio:dA,PropertyBinding:It,PropertyMixer:Xy,QuadraticBezierCurve:zp,QuadraticBezierCurve3:Gp,Quaternion:Wn,QuaternionKeyframeTrack:ga,QuaternionLinearInterpolant:Uy,RED_GREEN_RGTC2_Format:Wd,RED_RGTC1_Format:A_,REVISION:Ju,RGBADepthPacking:Mp,RGBAFormat:ri,RGBAIntegerFormat:_p,RGBA_ASTC_10x10_Format:Bd,RGBA_ASTC_10x5_Format:Nd,RGBA_ASTC_10x6_Format:Fd,RGBA_ASTC_10x8_Format:Od,RGBA_ASTC_12x10_Format:kd,RGBA_ASTC_12x12_Format:zd,RGBA_ASTC_4x4_Format:Ad,RGBA_ASTC_5x4_Format:Cd,RGBA_ASTC_5x5_Format:Rd,RGBA_ASTC_6x5_Format:Pd,RGBA_ASTC_6x6_Format:Ld,RGBA_ASTC_8x5_Format:Id,RGBA_ASTC_8x6_Format:Ud,RGBA_ASTC_8x8_Format:Dd,RGBA_BPTC_Format:Ou,RGBA_ETC2_EAC_Format:Td,RGBA_PVRTC_2BPPV1_Format:wd,RGBA_PVRTC_4BPPV1_Format:Ed,RGBA_S3TC_DXT1_Format:Du,RGBA_S3TC_DXT3_Format:Nu,RGBA_S3TC_DXT5_Format:Fu,RGB_BPTC_SIGNED_Format:Gd,RGB_BPTC_UNSIGNED_Format:Hd,RGB_ETC1_Format:yp,RGB_ETC2_Format:bd,RGB_PVRTC_2BPPV1_Format:Md,RGB_PVRTC_4BPPV1_Format:Sd,RGB_S3TC_DXT1_Format:Uu,RGFormat:T_,RGIntegerFormat:vp,RawShaderMaterial:Sy,Ray:oo,Raycaster:jy,Rec709Primaries:Ml,RectAreaLight:zy,RedFormat:b_,RedIntegerFormat:gp,ReinhardToneMapping:m_,RenderTarget:H_,RepeatWrapping:gl,ReplaceStencilOp:p1,ReverseSubtractEquation:Xv,RingGeometry:_h,SIGNED_RED_GREEN_RGTC2_Format:Xd,SIGNED_RED_RGTC1_Format:Vd,SRGBColorSpace:yn,SRGBTransfer:Wt,Scene:Up,ShaderChunk:Et,ShaderLib:Xi,ShaderMaterial:lr,ShadowMaterial:xy,Shape:as,ShapeGeometry:yh,ShapePath:qA,ShapeUtils:or,ShortType:S_,Skeleton:ch,SkeletonHelper:NA,SkinnedMesh:sy,Source:Zs,Sphere:Rn,SphereGeometry:Hl,Spherical:ip,SphericalHarmonics3:Gy,SplineCurve:Hp,SpotLight:Fy,SpotLightHelper:DA,Sprite:iy,SpriteMaterial:Dp,SrcAlphaFactor:Vu,SrcAlphaSaturateFactor:e_,SrcColorFactor:qv,StaticCopyUsage:I1,StaticDrawUsage:wl,StaticReadUsage:R1,StereoCamera:cA,StreamCopyUsage:D1,StreamDrawUsage:C1,StreamReadUsage:L1,StringKeyframeTrack:co,SubtractEquation:Wv,SubtractiveBlending:gd,TOUCH:Vs,TangentSpaceNormalMap:us,TetrahedronGeometry:xh,Texture:sn,TextureLoader:tA,TorusGeometry:Sh,TorusKnotGeometry:Mh,Triangle:di,TriangleFanDrawMode:f1,TriangleStripDrawMode:h1,TrianglesDrawMode:u1,TubeGeometry:Eh,TwoPassDoubleSide:s1,UVMapping:Qu,Uint16BufferAttribute:Ap,Uint32BufferAttribute:Cp,Uint8BufferAttribute:gS,Uint8ClampedBufferAttribute:vS,Uniform:em,UniformsGroup:CA,UniformsLib:qe,UniformsUtils:Rp,UnsignedByteType:sr,UnsignedInt248Type:is,UnsignedIntType:Pr,UnsignedShort4444Type:pp,UnsignedShort5551Type:mp,UnsignedShortType:$u,VSMShadowMap:Wi,Vector2:Re,Vector3:H,Vector4:Ft,VectorKeyframeTrack:Ll,VideoTexture:dT,WebGL1Renderer:ty,WebGL3DRenderTarget:nS,WebGLArrayRenderTarget:tS,WebGLCoordinateSystem:ji,WebGLCubeRenderTarget:Y_,WebGLMultipleRenderTargets:iS,WebGLRenderTarget:qi,WebGLRenderer:Ip,WebGLUtils:$_,WebGPUCoordinateSystem:la,WireframeGeometry:yy,WrapAroundEnding:xl,ZeroCurvatureEnding:js,ZeroFactor:Yv,ZeroSlopeEnding:qs,ZeroStencilOp:d1,_SRGBAFormat:Yu,createCanvasElement:G_,sRGBEncoding:ss},Symbol.toStringTag,{value:"Module"}));var Zy={exports:{}},uo={};/** 3687 * @license React 3688 * react-reconciler-constants.production.min.js 3689 * 3690 * Copyright (c) Facebook, Inc. and its affiliates. 3691 * 3692 * This source code is licensed under the MIT license found in the 3693 * LICENSE file in the root directory of this source tree. 3694 */uo.ConcurrentRoot=1;uo.ContinuousEventPriority=4;uo.DefaultEventPriority=16;uo.DiscreteEventPriority=1;uo.IdleEventPriority=536870912;uo.LegacyRoot=0;Zy.exports=uo;var sa=Zy.exports;function JA(s){let e;const t=new Set,n=(h,f)=>{const d=typeof h=="function"?h(e):h;if(d!==e){const p=e;e=f?d:Object.assign({},e,d),t.forEach(m=>m(e,p))}},i=()=>e,r=(h,f=i,d=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=f(e);function m(){const v=f(e);if(!d(p,v)){const S=p;h(p=v,S)}}return t.add(m),()=>t.delete(m)},c={setState:n,getState:i,subscribe:(h,f,d)=>f||d?r(h,f,d):(t.add(h),()=>t.delete(h)),destroy:()=>t.clear()};return e=s(n,i,c),c}const KA=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),av=KA?Ye.useEffect:Ye.useLayoutEffect;function QA(s){const e=typeof s=="function"?JA(s):s,t=(n=e.getState,i=Object.is)=>{const[,r]=Ye.useReducer(y=>y+1,0),o=e.getState(),a=Ye.useRef(o),c=Ye.useRef(n),h=Ye.useRef(i),f=Ye.useRef(!1),d=Ye.useRef();d.current===void 0&&(d.current=n(o));let p,m=!1;(a.current!==o||c.current!==n||h.current!==i||f.current)&&(p=n(o),m=!i(d.current,p)),av(()=>{m&&(d.current=p),a.current=o,c.current=n,h.current=i,f.current=!1});const v=Ye.useRef(o);av(()=>{const y=()=>{try{const E=e.getState(),M=c.current(E);h.current(d.current,M)||(a.current=E,d.current=M,r())}catch{f.current=!0,r()}},_=e.subscribe(y);return e.getState()!==v.current&&y(),_},[]);const S=m?p:d.current;return Ye.useDebugValue(S),S};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}const $A=s=>typeof s=="object"&&typeof s.then=="function",Au=[];function e2(s,e,t=(n,i)=>n===i){if(s===e)return!0;if(!s||!e)return!1;const n=s.length;if(e.length!==n)return!1;for(let i=0;i<n;i++)if(!t(s[i],e[i]))return!1;return!0}function t2(s,e=null,t=!1,n={}){e===null&&(e=[s]);for(const r of Au)if(e2(e,r.keys,r.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(r,"error"))throw r.error;if(Object.prototype.hasOwnProperty.call(r,"response"))return n.lifespan&&n.lifespan>0&&(r.timeout&&clearTimeout(r.timeout),r.timeout=setTimeout(r.remove,n.lifespan)),r.response;if(!t)throw r.promise}const i={keys:e,equal:n.equal,remove:()=>{const r=Au.indexOf(i);r!==-1&&Au.splice(r,1)},promise:($A(s)?s:s(...e)).then(r=>{i.response=r,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(r=>i.error=r)};if(Au.push(i),!t)throw i.promise}const n2=(s,e,t)=>t2(s,e,!1,t);var Jy={exports:{}},Ky={exports:{}},Qy={};/** 3695 * @license React 3696 * scheduler.production.min.js 3697 * 3698 * Copyright (c) Facebook, Inc. and its affiliates. 3699 * 3700 * This source code is licensed under the MIT license found in the 3701 * LICENSE file in the root directory of this source tree. 3702 */(function(s){function e(Z,W){var V=Z.length;Z.push(W);e:for(;0<V;){var F=V-1>>>1,j=Z[F];if(0<i(j,W))Z[F]=W,Z[V]=j,V=F;else break e}}function t(Z){return Z.length===0?null:Z[0]}function n(Z){if(Z.length===0)return null;var W=Z[0],V=Z.pop();if(V!==W){Z[0]=V;e:for(var F=0,j=Z.length,G=j>>>1;F<G;){var $=2*(F+1)-1,te=Z[$],ae=$+1,ne=Z[ae];if(0>i(te,V))ae<j&&0>i(ne,te)?(Z[F]=ne,Z[ae]=V,F=ae):(Z[F]=te,Z[$]=V,F=$);else if(ae<j&&0>i(ne,V))Z[F]=ne,Z[ae]=V,F=ae;else break e}}return W}function i(Z,W){var V=Z.sortIndex-W.sortIndex;return V!==0?V:Z.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var r=performance;s.unstable_now=function(){return r.now()}}else{var o=Date,a=o.now();s.unstable_now=function(){return o.now()-a}}var c=[],h=[],f=1,d=null,p=3,m=!1,v=!1,S=!1,y=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(Z){for(var W=t(h);W!==null;){if(W.callback===null)n(h);else if(W.startTime<=Z)n(h),W.sortIndex=W.expirationTime,e(c,W);else break;W=t(h)}}function b(Z){if(S=!1,M(Z),!v)if(t(c)!==null)v=!0,K(P);else{var W=t(h);W!==null&&re(b,W.startTime-Z)}}function P(Z,W){v=!1,S&&(S=!1,_(D),D=-1),m=!0;var V=p;try{for(M(W),d=t(c);d!==null&&(!(d.expirationTime>W)||Z&&!k());){var F=d.callback;if(typeof F=="function"){d.callback=null,p=d.priorityLevel;var j=F(d.expirationTime<=W);W=s.unstable_now(),typeof j=="function"?d.callback=j:d===t(c)&&n(c),M(W)}else n(c);d=t(c)}if(d!==null)var G=!0;else{var $=t(h);$!==null&&re(b,$.startTime-W),G=!1}return G}finally{d=null,p=V,m=!1}}var R=!1,L=null,D=-1,A=5,C=-1;function k(){return!(s.unstable_now()-C<A)}function B(){if(L!==null){var Z=s.unstable_now();C=Z;var W=!0;try{W=L(!0,Z)}finally{W?ee():(R=!1,L=null)}}else R=!1}var ee;if(typeof E=="function")ee=function(){E(B)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,q=N.port2;N.port1.onmessage=B,ee=function(){q.postMessage(null)}}else ee=function(){y(B,0)};function K(Z){L=Z,R||(R=!0,ee())}function re(Z,W){D=y(function(){Z(s.unstable_now())},W)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(Z){Z.callback=null},s.unstable_continueExecution=function(){v||m||(v=!0,K(P))},s.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<Z?Math.floor(1e3/Z):5},s.unstable_getCurrentPriorityLevel=function(){return p},s.unstable_getFirstCallbackNode=function(){return t(c)},s.unstable_next=function(Z){switch(p){case 1:case 2:case 3:var W=3;break;default:W=p}var V=p;p=W;try{return Z()}finally{p=V}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(Z,W){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var V=p;p=Z;try{return W()}finally{p=V}},s.unstable_scheduleCallback=function(Z,W,V){var F=s.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?F+V:F):V=F,Z){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=V+j,Z={id:f++,callback:W,priorityLevel:Z,startTime:V,expirationTime:j,sortIndex:-1},V>F?(Z.sortIndex=V,e(h,Z),t(c)===null&&Z===t(h)&&(S?(_(D),D=-1):S=!0,re(b,V-F))):(Z.sortIndex=j,e(c,Z),v||m||(v=!0,K(P))),Z},s.unstable_shouldYield=k,s.unstable_wrapCallback=function(Z){var W=p;return function(){var V=p;p=W;try{return Z.apply(this,arguments)}finally{p=V}}}})(Qy);Ky.exports=Qy;var rp=Ky.exports;/** 3703 * @license React 3704 * react-reconciler.production.min.js 3705 * 3706 * Copyright (c) Facebook, Inc. and its affiliates. 3707 * 3708 * This source code is licensed under the MIT license found in the 3709 * LICENSE file in the root directory of this source tree. 3710 */var i2=function(e){var t={},n=Ye,i=rp,r=Object.assign;function o(l){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+l,g=1;g<arguments.length;g++)u+="&args[]="+encodeURIComponent(arguments[g]);return"Minified React error #"+l+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,c=Symbol.for("react.element"),h=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),v=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),P=Symbol.iterator;function R(l){return l===null||typeof l!="object"?null:(l=P&&l[P]||l["@@iterator"],typeof l=="function"?l:null)}function L(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case f:return"Fragment";case h:return"Portal";case p:return"Profiler";case d:return"StrictMode";case y:return"Suspense";case _:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case v:return(l.displayName||"Context")+".Consumer";case m:return(l._context.displayName||"Context")+".Provider";case S:var u=l.render;return l=l.displayName,l||(l=u.displayName||u.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case E:return u=l.displayName||null,u!==null?u:L(l.type)||"Memo";case M:u=l._payload,l=l._init;try{return L(l(u))}catch{}}return null}function D(l){var u=l.type;switch(l.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=u.render,l=l.displayName||l.name||"",u.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return L(u);case 8:return u===d?"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 u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function A(l){var u=l,g=l;if(l.alternate)for(;u.return;)u=u.return;else{l=u;do u=l,u.flags&4098&&(g=u.return),l=u.return;while(l)}return u.tag===3?g:null}function C(l){if(A(l)!==l)throw Error(o(188))}function k(l){var u=l.alternate;if(!u){if(u=A(l),u===null)throw Error(o(188));return u!==l?null:l}for(var g=l,x=u;;){var w=g.return;if(w===null)break;var T=w.alternate;if(T===null){if(x=w.return,x!==null){g=x;continue}break}if(w.child===T.child){for(T=w.child;T;){if(T===g)return C(w),l;if(T===x)return C(w),u;T=T.sibling}throw Error(o(188))}if(g.return!==x.return)g=w,x=T;else{for(var Y=!1,ie=w.child;ie;){if(ie===g){Y=!0,g=w,x=T;break}if(ie===x){Y=!0,x=w,g=T;break}ie=ie.sibling}if(!Y){for(ie=T.child;ie;){if(ie===g){Y=!0,g=T,x=w;break}if(ie===x){Y=!0,x=T,g=w;break}ie=ie.sibling}if(!Y)throw Error(o(189))}}if(g.alternate!==x)throw Error(o(190))}if(g.tag!==3)throw Error(o(188));return g.stateNode.current===g?l:u}function B(l){return l=k(l),l!==null?ee(l):null}function ee(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var u=ee(l);if(u!==null)return u;l=l.sibling}return null}function N(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){if(l.tag!==4){var u=N(l);if(u!==null)return u}l=l.sibling}return null}var q=Array.isArray,K=e.getPublicInstance,re=e.getRootHostContext,Z=e.getChildHostContext,W=e.prepareForCommit,V=e.resetAfterCommit,F=e.createInstance,j=e.appendInitialChild,G=e.finalizeInitialChildren,$=e.prepareUpdate,te=e.shouldSetTextContent,ae=e.createTextInstance,ne=e.scheduleTimeout,pe=e.cancelTimeout,Ie=e.noTimeout,Pe=e.isPrimaryRenderer,Se=e.supportsMutation,O=e.supportsPersistence,Me=e.supportsHydration,ue=e.getInstanceFromNode,de=e.preparePortalMount,oe=e.getCurrentEventPriority,Ue=e.detachDeletedInstance,fe=e.supportsMicrotasks,U=e.scheduleMicrotask,I=e.supportsTestSelectors,X=e.findFiberRoot,ye=e.getBoundingRect,ce=e.getTextContent,he=e.isHiddenSubtree,Te=e.matchAccessibilityRole,Ne=e.setFocusIfFocusable,Ce=e.setupIntersectionObserver,De=e.appendChild,ke=e.appendChildToContainer,xe=e.commitTextUpdate,it=e.commitMount,tt=e.commitUpdate,Xe=e.insertBefore,ze=e.insertInContainerBefore,Le=e.removeChild,Q=e.removeChildFromContainer,we=e.resetTextContent,We=e.hideInstance,Be=e.hideTextInstance,ge=e.unhideInstance,J=e.unhideTextInstance,Ge=e.clearContainer,Fe=e.cloneInstance,He=e.createContainerChildSet,je=e.appendChildToContainerChildSet,rt=e.finalizeContainerChildren,Ze=e.replaceContainerChildren,ht=e.cloneHiddenInstance,At=e.cloneHiddenTextInstance,gt=e.canHydrateInstance,Lt=e.canHydrateTextInstance,Yt=e.canHydrateSuspenseInstance,oi=e.isSuspenseInstancePending,jn=e.isSuspenseInstanceFallback,qn=e.registerSuspenseInstanceRetry,Dn=e.getNextHydratableSibling,Nn=e.getFirstHydratableChild,dn=e.getFirstHydratableChildWithinContainer,Ri=e.getFirstHydratableChildWithinSuspenseInstance,ho=e.hydrateInstance,ps=e.hydrateTextInstance,_a=e.hydrateSuspenseInstance,z=e.getNextHydratableInstanceAfterSuspenseInstance,le=e.commitHydratedContainer,_e=e.commitHydratedSuspenseInstance,Ee=e.clearSuspenseBoundary,ve=e.clearSuspenseBoundaryFromContainer,Je=e.shouldDeleteUnhydratedTailInstances,ot=e.didNotMatchHydratedContainerTextInstance,ct=e.didNotMatchHydratedTextInstance,Oe;function mt(l){if(Oe===void 0)try{throw Error()}catch(g){var u=g.stack.trim().match(/\n( *(at )?)/);Oe=u&&u[1]||""}return` 3711`+Oe+l}var vt=!1;function ft(l,u){if(!l||vt)return"";vt=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(Ve){var x=Ve}Reflect.construct(l,[],u)}else{try{u.call()}catch(Ve){x=Ve}l.call(u.prototype)}else{try{throw Error()}catch(Ve){x=Ve}l()}}catch(Ve){if(Ve&&x&&typeof Ve.stack=="string"){for(var w=Ve.stack.split(` 3712`),T=x.stack.split(` 3713`),Y=w.length-1,ie=T.length-1;1<=Y&&0<=ie&&w[Y]!==T[ie];)ie--;for(;1<=Y&&0<=ie;Y--,ie--)if(w[Y]!==T[ie]){if(Y!==1||ie!==1)do if(Y--,ie--,0>ie||w[Y]!==T[ie]){var Ae=` 3714`+w[Y].replace(" at new "," at ");return l.displayName&&Ae.includes("<anonymous>")&&(Ae=Ae.replace("<anonymous>",l.displayName)),Ae}while(1<=Y&&0<=ie);break}}}finally{vt=!1,Error.prepareStackTrace=g}return(l=l?l.displayName||l.name:"")?mt(l):""}var zt=Object.prototype.hasOwnProperty,pn=[],Ot=-1;function qt(l){return{current:l}}function ut(l){0>Ot||(l.current=pn[Ot],pn[Ot]=null,Ot--)}function et(l,u){Ot++,pn[Ot]=l.current,l.current=u}var Pn={},Mt=qt(Pn),Vt=qt(!1),vi=Pn;function Mn(l,u){var g=l.type.contextTypes;if(!g)return Pn;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===u)return x.__reactInternalMemoizedMaskedChildContext;var w={},T;for(T in g)w[T]=u[T];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=u,l.__reactInternalMemoizedMaskedChildContext=w),w}function $t(l){return l=l.childContextTypes,l!=null}function Gt(){ut(Vt),ut(Mt)}function ai(l,u,g){if(Mt.current!==Pn)throw Error(o(168));et(Mt,u),et(Vt,g)}function Ki(l,u,g){var x=l.stateNode;if(u=u.childContextTypes,typeof x.getChildContext!="function")return g;x=x.getChildContext();for(var w in x)if(!(w in u))throw Error(o(108,D(l)||"Unknown",w));return r({},g,x)}function on(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Pn,vi=Mt.current,et(Mt,l),et(Vt,Vt.current),!0}function Ln(l,u,g){var x=l.stateNode;if(!x)throw Error(o(169));g?(l=Ki(l,u,vi),x.__reactInternalMemoizedMergedChildContext=l,ut(Vt),ut(Mt),et(Mt,l)):ut(Vt),et(Vt,g)}var Zn=Math.clz32?Math.clz32:Xl,ur=Math.log,ms=Math.LN2;function Xl(l){return l>>>=0,l===0?32:31-(ur(l)/ms|0)|0}var hr=64,fr=4194304;function dr(l){switch(l&-l){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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function gs(l,u){var g=l.pendingLanes;if(g===0)return 0;var x=0,w=l.suspendedLanes,T=l.pingedLanes,Y=g&268435455;if(Y!==0){var ie=Y&~w;ie!==0?x=dr(ie):(T&=Y,T!==0&&(x=dr(T)))}else Y=g&~w,Y!==0?x=dr(Y):T!==0&&(x=dr(T));if(x===0)return 0;if(u!==0&&u!==x&&!(u&w)&&(w=x&-x,T=u&-u,w>=T||w===16&&(T&4194240)!==0))return u;if(x&4&&(x|=g&16),u=l.entangledLanes,u!==0)for(l=l.entanglements,u&=x;0<u;)g=31-Zn(u),w=1<<g,x|=l[g],u&=~w;return x}function Yl(l,u){switch(l){case 1:case 2:case 4:return u+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 u+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 ya(l,u){for(var g=l.suspendedLanes,x=l.pingedLanes,w=l.expirationTimes,T=l.pendingLanes;0<T;){var Y=31-Zn(T),ie=1<<Y,Ae=w[Y];Ae===-1?(!(ie&g)||ie&x)&&(w[Y]=Yl(ie,u)):Ae<=u&&(l.expiredLanes|=ie),T&=~ie}}function pr(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function fo(l){for(var u=[],g=0;31>g;g++)u.push(l);return u}function Qi(l,u,g){l.pendingLanes|=u,u!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,u=31-Zn(u),l[u]=g}function kr(l,u){var g=l.pendingLanes&~u;l.pendingLanes=u,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=u,l.mutableReadLanes&=u,l.entangledLanes&=u,u=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0<g;){var w=31-Zn(g),T=1<<w;u[w]=0,x[w]=-1,l[w]=-1,g&=~T}}function $i(l,u){var g=l.entangledLanes|=u;for(l=l.entanglements;g;){var x=31-Zn(g),w=1<<x;w&u|l[x]&u&&(l[x]|=u),g&=~w}}var Pt=0;function xa(l){return l&=-l,1<l?4<l?l&268435455?16:536870912:4:1}var mr=i.unstable_scheduleCallback,po=i.unstable_cancelCallback,Sa=i.unstable_shouldYield,jl=i.unstable_requestPaint,Zt=i.unstable_now,vs=i.unstable_ImmediatePriority,ql=i.unstable_UserBlockingPriority,Jn=i.unstable_NormalPriority,Ma=i.unstable_IdlePriority,_s=null,_i=null;function Ea(l){if(_i&&typeof _i.onCommitFiberRoot=="function")try{_i.onCommitFiberRoot(_s,l,void 0,(l.current.flags&128)===128)}catch{}}function Zl(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var yi=typeof Object.is=="function"?Object.is:Zl,Kn=null,er=!1,Pi=!1;function wa(l){Kn===null?Kn=[l]:Kn.push(l)}function ba(l){er=!0,wa(l)}function li(){if(!Pi&&Kn!==null){Pi=!0;var l=0,u=Pt;try{var g=Kn;for(Pt=1;l<g.length;l++){var x=g[l];do x=x(!0);while(x!==null)}Kn=null,er=!1}catch(w){throw Kn!==null&&(Kn=Kn.slice(l+1)),mr(vs,li),w}finally{Pt=u,Pi=!1}}return null}var ys=a.ReactCurrentBatchConfig;function xs(l,u){if(yi(l,u))return!0;if(typeof l!="object"||l===null||typeof u!="object"||u===null)return!1;var g=Object.keys(l),x=Object.keys(u);if(g.length!==x.length)return!1;for(x=0;x<g.length;x++){var w=g[x];if(!zt.call(u,w)||!yi(l[w],u[w]))return!1}return!0}function Ss(l){switch(l.tag){case 5:return mt(l.type);case 16:return mt("Lazy");case 13:return mt("Suspense");case 19:return mt("SuspenseList");case 0:case 2:case 15:return l=ft(l.type,!1),l;case 11:return l=ft(l.type.render,!1),l;case 1:return l=ft(l.type,!0),l;default:return""}}function Qn(l,u){if(l&&l.defaultProps){u=r({},u),l=l.defaultProps;for(var g in l)u[g]===void 0&&(u[g]=l[g]);return u}return u}var En=qt(null),mo=null,ki=null,zr=null;function go(){zr=ki=mo=null}function Jl(l,u,g){Pe?(et(En,u._currentValue),u._currentValue=g):(et(En,u._currentValue2),u._currentValue2=g)}function wn(l){var u=En.current;ut(En),Pe?l._currentValue=u:l._currentValue2=u}function $n(l,u,g){for(;l!==null;){var x=l.alternate;if((l.childLanes&u)!==u?(l.childLanes|=u,x!==null&&(x.childLanes|=u)):x!==null&&(x.childLanes&u)!==u&&(x.childLanes|=u),l===g)break;l=l.return}}function an(l,u){mo=l,zr=ki=null,l=l.dependencies,l!==null&&l.firstContext!==null&&(l.lanes&u&&(Ei=!0),l.firstContext=null)}function ln(l){var u=Pe?l._currentValue:l._currentValue2;if(zr!==l)if(l={context:l,memoizedValue:u,next:null},ki===null){if(mo===null)throw Error(o(308));ki=l,mo.dependencies={lanes:0,firstContext:l}}else ki=ki.next=l;return u}var xi=null,Gr=!1;function Th(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function sm(l,u){l=l.updateQueue,u.updateQueue===l&&(u.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function gr(l,u){return{eventTime:l,lane:u,tag:0,payload:null,callback:null,next:null}}function Hr(l,u){var g=l.updateQueue;g!==null&&(g=g.shared,mn!==null&&l.mode&1&&!(Rt&2)?(l=g.interleaved,l===null?(u.next=u,xi===null?xi=[g]:xi.push(g)):(u.next=l.next,l.next=u),g.interleaved=u):(l=g.pending,l===null?u.next=u:(u.next=l.next,l.next=u),g.pending=u))}function Kl(l,u,g){if(u=u.updateQueue,u!==null&&(u=u.shared,(g&4194240)!==0)){var x=u.lanes;x&=l.pendingLanes,g|=x,u.lanes=g,$i(l,g)}}function om(l,u){var g=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,g===x)){var w=null,T=null;if(g=g.firstBaseUpdate,g!==null){do{var Y={eventTime:g.eventTime,lane:g.lane,tag:g.tag,payload:g.payload,callback:g.callback,next:null};T===null?w=T=Y:T=T.next=Y,g=g.next}while(g!==null);T===null?w=T=u:T=T.next=u}else w=T=u;g={baseState:x.baseState,firstBaseUpdate:w,lastBaseUpdate:T,shared:x.shared,effects:x.effects},l.updateQueue=g;return}l=g.lastBaseUpdate,l===null?g.firstBaseUpdate=u:l.next=u,g.lastBaseUpdate=u}function Ql(l,u,g,x){var w=l.updateQueue;Gr=!1;var T=w.firstBaseUpdate,Y=w.lastBaseUpdate,ie=w.shared.pending;if(ie!==null){w.shared.pending=null;var Ae=ie,Ve=Ae.next;Ae.next=null,Y===null?T=Ve:Y.next=Ve,Y=Ae;var nt=l.alternate;nt!==null&&(nt=nt.updateQueue,ie=nt.lastBaseUpdate,ie!==Y&&(ie===null?nt.firstBaseUpdate=Ve:ie.next=Ve,nt.lastBaseUpdate=Ae))}if(T!==null){var xt=w.baseState;Y=0,nt=Ve=Ae=null,ie=T;do{var dt=ie.lane,Ht=ie.eventTime;if((x&dt)===dt){nt!==null&&(nt=nt.next={eventTime:Ht,lane:0,tag:ie.tag,payload:ie.payload,callback:ie.callback,next:null});e:{var lt=l,kn=ie;switch(dt=u,Ht=g,kn.tag){case 1:if(lt=kn.payload,typeof lt=="function"){xt=lt.call(Ht,xt,dt);break e}xt=lt;break e;case 3:lt.flags=lt.flags&-65537|128;case 0:if(lt=kn.payload,dt=typeof lt=="function"?lt.call(Ht,xt,dt):lt,dt==null)break e;xt=r({},xt,dt);break e;case 2:Gr=!0}}ie.callback!==null&&ie.lane!==0&&(l.flags|=64,dt=w.effects,dt===null?w.effects=[ie]:dt.push(ie))}else Ht={eventTime:Ht,lane:dt,tag:ie.tag,payload:ie.payload,callback:ie.callback,next:null},nt===null?(Ve=nt=Ht,Ae=xt):nt=nt.next=Ht,Y|=dt;if(ie=ie.next,ie===null){if(ie=w.shared.pending,ie===null)break;dt=ie,ie=dt.next,dt.next=null,w.lastBaseUpdate=dt,w.shared.pending=null}}while(!0);if(nt===null&&(Ae=xt),w.baseState=Ae,w.firstBaseUpdate=Ve,w.lastBaseUpdate=nt,u=w.shared.interleaved,u!==null){w=u;do Y|=w.lane,w=w.next;while(w!==u)}else T===null&&(w.shared.lanes=0);bo|=Y,l.lanes=Y,l.memoizedState=xt}}function am(l,u,g){if(l=u.effects,u.effects=null,l!==null)for(u=0;u<l.length;u++){var x=l[u],w=x.callback;if(w!==null){if(x.callback=null,x=g,typeof w!="function")throw Error(o(191,w));w.call(x)}}}var lm=new n.Component().refs;function Ah(l,u,g,x){u=l.memoizedState,g=g(x,u),g=g==null?u:r({},u,g),l.memoizedState=g,l.lanes===0&&(l.updateQueue.baseState=g)}var $l={isMounted:function(l){return(l=l._reactInternals)?A(l)===l:!1},enqueueSetState:function(l,u,g){l=l._reactInternals;var x=ti(),w=Xr(l),T=gr(x,w);T.payload=u,g!=null&&(T.callback=g),Hr(l,T),u=Ni(l,w,x),u!==null&&Kl(u,l,w)},enqueueReplaceState:function(l,u,g){l=l._reactInternals;var x=ti(),w=Xr(l),T=gr(x,w);T.tag=1,T.payload=u,g!=null&&(T.callback=g),Hr(l,T),u=Ni(l,w,x),u!==null&&Kl(u,l,w)},enqueueForceUpdate:function(l,u){l=l._reactInternals;var g=ti(),x=Xr(l),w=gr(g,x);w.tag=2,u!=null&&(w.callback=u),Hr(l,w),u=Ni(l,x,g),u!==null&&Kl(u,l,x)}};function cm(l,u,g,x,w,T,Y){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(x,T,Y):u.prototype&&u.prototype.isPureReactComponent?!xs(g,x)||!xs(w,T):!0}function um(l,u,g){var x=!1,w=Pn,T=u.contextType;return typeof T=="object"&&T!==null?T=ln(T):(w=$t(u)?vi:Mt.current,x=u.contextTypes,T=(x=x!=null)?Mn(l,w):Pn),u=new u(g,T),l.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=$l,l.stateNode=u,u._reactInternals=l,x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=w,l.__reactInternalMemoizedMaskedChildContext=T),u}function hm(l,u,g,x){l=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(g,x),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(g,x),u.state!==l&&$l.enqueueReplaceState(u,u.state,null)}function Ch(l,u,g,x){var w=l.stateNode;w.props=g,w.state=l.memoizedState,w.refs=lm,Th(l);var T=u.contextType;typeof T=="object"&&T!==null?w.context=ln(T):(T=$t(u)?vi:Mt.current,w.context=Mn(l,T)),w.state=l.memoizedState,T=u.getDerivedStateFromProps,typeof T=="function"&&(Ah(l,u,T,g),w.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(u=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),u!==w.state&&$l.enqueueReplaceState(w,w.state,null),Ql(l,g,w,x),w.state=l.memoizedState),typeof w.componentDidMount=="function"&&(l.flags|=4194308)}var vo=[],_o=0,ec=null,tc=0,Li=[],Ii=0,Ms=null,vr=1,_r="";function Es(l,u){vo[_o++]=tc,vo[_o++]=ec,ec=l,tc=u}function fm(l,u,g){Li[Ii++]=vr,Li[Ii++]=_r,Li[Ii++]=Ms,Ms=l;var x=vr;l=_r;var w=32-Zn(x)-1;x&=~(1<<w),g+=1;var T=32-Zn(u)+w;if(30<T){var Y=w-w%5;T=(x&(1<<Y)-1).toString(32),x>>=Y,w-=Y,vr=1<<32-Zn(u)+w|g<<w|x,_r=T+l}else vr=1<<T|g<<w|x,_r=l}function Rh(l){l.return!==null&&(Es(l,1),fm(l,1,0))}function Ph(l){for(;l===ec;)ec=vo[--_o],vo[_o]=null,tc=vo[--_o],vo[_o]=null;for(;l===Ms;)Ms=Li[--Ii],Li[Ii]=null,_r=Li[--Ii],Li[Ii]=null,vr=Li[--Ii],Li[Ii]=null}var Si=null,Mi=null,jt=!1,Ta=!1,zi=null;function dm(l,u){var g=Fi(5,null,null,0);g.elementType="DELETED",g.stateNode=u,g.return=l,u=l.deletions,u===null?(l.deletions=[g],l.flags|=16):u.push(g)}function pm(l,u){switch(l.tag){case 5:return u=gt(u,l.type,l.pendingProps),u!==null?(l.stateNode=u,Si=l,Mi=Nn(u),!0):!1;case 6:return u=Lt(u,l.pendingProps),u!==null?(l.stateNode=u,Si=l,Mi=null,!0):!1;case 13:if(u=Yt(u),u!==null){var g=Ms!==null?{id:vr,overflow:_r}:null;return l.memoizedState={dehydrated:u,treeContext:g,retryLane:1073741824},g=Fi(18,null,null,0),g.stateNode=u,g.return=l,l.child=g,Si=l,Mi=null,!0}return!1;default:return!1}}function Lh(l){return(l.mode&1)!==0&&(l.flags&128)===0}function Ih(l){if(jt){var u=Mi;if(u){var g=u;if(!pm(l,u)){if(Lh(l))throw Error(o(418));u=Dn(g);var x=Si;u&&pm(l,u)?dm(x,g):(l.flags=l.flags&-4097|2,jt=!1,Si=l)}}else{if(Lh(l))throw Error(o(418));l.flags=l.flags&-4097|2,jt=!1,Si=l}}}function mm(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;Si=l}function Aa(l){if(!Me||l!==Si)return!1;if(!jt)return mm(l),jt=!0,!1;if(l.tag!==3&&(l.tag!==5||Je(l.type)&&!te(l.type,l.memoizedProps))){var u=Mi;if(u){if(Lh(l)){for(l=Mi;l;)l=Dn(l);throw Error(o(418))}for(;u;)dm(l,u),u=Dn(u)}}if(mm(l),l.tag===13){if(!Me)throw Error(o(316));if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(o(317));Mi=z(l)}else Mi=Si?Dn(l.stateNode):null;return!0}function yo(){Me&&(Mi=Si=null,Ta=jt=!1)}function Uh(l){zi===null?zi=[l]:zi.push(l)}function Ca(l,u,g){if(l=g.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(g._owner){if(g=g._owner,g){if(g.tag!==1)throw Error(o(309));var x=g.stateNode}if(!x)throw Error(o(147,l));var w=x,T=""+l;return u!==null&&u.ref!==null&&typeof u.ref=="function"&&u.ref._stringRef===T?u.ref:(u=function(Y){var ie=w.refs;ie===lm&&(ie=w.refs={}),Y===null?delete ie[T]:ie[T]=Y},u._stringRef=T,u)}if(typeof l!="string")throw Error(o(284));if(!g._owner)throw Error(o(290,l))}return l}function nc(l,u){throw l=Object.prototype.toString.call(u),Error(o(31,l==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":l))}function gm(l){var u=l._init;return u(l._payload)}function vm(l){function u(me,se){if(l){var be=me.deletions;be===null?(me.deletions=[se],me.flags|=16):be.push(se)}}function g(me,se){if(!l)return null;for(;se!==null;)u(me,se),se=se.sibling;return null}function x(me,se){for(me=new Map;se!==null;)se.key!==null?me.set(se.key,se):me.set(se.index,se),se=se.sibling;return me}function w(me,se){return me=jr(me,se),me.index=0,me.sibling=null,me}function T(me,se,be){return me.index=be,l?(be=me.alternate,be!==null?(be=be.index,be<se?(me.flags|=2,se):be):(me.flags|=2,se)):(me.flags|=1048576,se)}function Y(me){return l&&me.alternate===null&&(me.flags|=2),me}function ie(me,se,be,Qe){return se===null||se.tag!==6?(se=vf(be,me.mode,Qe),se.return=me,se):(se=w(se,be),se.return=me,se)}function Ae(me,se,be,Qe){var at=be.type;return at===f?nt(me,se,be.props.children,Qe,be.key):se!==null&&(se.elementType===at||typeof at=="object"&&at!==null&&at.$$typeof===M&&gm(at)===se.type)?(Qe=w(se,be.props),Qe.ref=Ca(me,se,be),Qe.return=me,Qe):(Qe=Uc(be.type,be.key,be.props,null,me.mode,Qe),Qe.ref=Ca(me,se,be),Qe.return=me,Qe)}function Ve(me,se,be,Qe){return se===null||se.tag!==4||se.stateNode.containerInfo!==be.containerInfo||se.stateNode.implementation!==be.implementation?(se=_f(be,me.mode,Qe),se.return=me,se):(se=w(se,be.children||[]),se.return=me,se)}function nt(me,se,be,Qe,at){return se===null||se.tag!==7?(se=Ps(be,me.mode,Qe,at),se.return=me,se):(se=w(se,be),se.return=me,se)}function xt(me,se,be){if(typeof se=="string"&&se!==""||typeof se=="number")return se=vf(""+se,me.mode,be),se.return=me,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case c:return be=Uc(se.type,se.key,se.props,null,me.mode,be),be.ref=Ca(me,null,se),be.return=me,be;case h:return se=_f(se,me.mode,be),se.return=me,se;case M:var Qe=se._init;return xt(me,Qe(se._payload),be)}if(q(se)||R(se))return se=Ps(se,me.mode,be,null),se.return=me,se;nc(me,se)}return null}function dt(me,se,be,Qe){var at=se!==null?se.key:null;if(typeof be=="string"&&be!==""||typeof be=="number")return at!==null?null:ie(me,se,""+be,Qe);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case c:return be.key===at?Ae(me,se,be,Qe):null;case h:return be.key===at?Ve(me,se,be,Qe):null;case M:return at=be._init,dt(me,se,at(be._payload),Qe)}if(q(be)||R(be))return at!==null?null:nt(me,se,be,Qe,null);nc(me,be)}return null}function Ht(me,se,be,Qe,at){if(typeof Qe=="string"&&Qe!==""||typeof Qe=="number")return me=me.get(be)||null,ie(se,me,""+Qe,at);if(typeof Qe=="object"&&Qe!==null){switch(Qe.$$typeof){case c:return me=me.get(Qe.key===null?be:Qe.key)||null,Ae(se,me,Qe,at);case h:return me=me.get(Qe.key===null?be:Qe.key)||null,Ve(se,me,Qe,at);case M:var Ct=Qe._init;return Ht(me,se,be,Ct(Qe._payload),at)}if(q(Qe)||R(Qe))return me=me.get(be)||null,nt(se,me,Qe,at,null);nc(se,Qe)}return null}function lt(me,se,be,Qe){for(var at=null,Ct=null,St=se,Ut=se=0,Tn=null;St!==null&&Ut<be.length;Ut++){St.index>Ut?(Tn=St,St=null):Tn=St.sibling;var Dt=dt(me,St,be[Ut],Qe);if(Dt===null){St===null&&(St=Tn);break}l&&St&&Dt.alternate===null&&u(me,St),se=T(Dt,se,Ut),Ct===null?at=Dt:Ct.sibling=Dt,Ct=Dt,St=Tn}if(Ut===be.length)return g(me,St),jt&&Es(me,Ut),at;if(St===null){for(;Ut<be.length;Ut++)St=xt(me,be[Ut],Qe),St!==null&&(se=T(St,se,Ut),Ct===null?at=St:Ct.sibling=St,Ct=St);return jt&&Es(me,Ut),at}for(St=x(me,St);Ut<be.length;Ut++)Tn=Ht(St,me,Ut,be[Ut],Qe),Tn!==null&&(l&&Tn.alternate!==null&&St.delete(Tn.key===null?Ut:Tn.key),se=T(Tn,se,Ut),Ct===null?at=Tn:Ct.sibling=Tn,Ct=Tn);return l&&St.forEach(function(qr){return u(me,qr)}),jt&&Es(me,Ut),at}function kn(me,se,be,Qe){var at=R(be);if(typeof at!="function")throw Error(o(150));if(be=at.call(be),be==null)throw Error(o(151));for(var Ct=at=null,St=se,Ut=se=0,Tn=null,Dt=be.next();St!==null&&!Dt.done;Ut++,Dt=be.next()){St.index>Ut?(Tn=St,St=null):Tn=St.sibling;var qr=dt(me,St,Dt.value,Qe);if(qr===null){St===null&&(St=Tn);break}l&&St&&qr.alternate===null&&u(me,St),se=T(qr,se,Ut),Ct===null?at=qr:Ct.sibling=qr,Ct=qr,St=Tn}if(Dt.done)return g(me,St),jt&&Es(me,Ut),at;if(St===null){for(;!Dt.done;Ut++,Dt=be.next())Dt=xt(me,Dt.value,Qe),Dt!==null&&(se=T(Dt,se,Ut),Ct===null?at=Dt:Ct.sibling=Dt,Ct=Dt);return jt&&Es(me,Ut),at}for(St=x(me,St);!Dt.done;Ut++,Dt=be.next())Dt=Ht(St,me,Ut,Dt.value,Qe),Dt!==null&&(l&&Dt.alternate!==null&&St.delete(Dt.key===null?Ut:Dt.key),se=T(Dt,se,Ut),Ct===null?at=Dt:Ct.sibling=Dt,Ct=Dt);return l&&St.forEach(function(n1){return u(me,n1)}),jt&&Es(me,Ut),at}function Oi(me,se,be,Qe){if(typeof be=="object"&&be!==null&&be.type===f&&be.key===null&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case c:e:{for(var at=be.key,Ct=se;Ct!==null;){if(Ct.key===at){if(at=be.type,at===f){if(Ct.tag===7){g(me,Ct.sibling),se=w(Ct,be.props.children),se.return=me,me=se;break e}}else if(Ct.elementType===at||typeof at=="object"&&at!==null&&at.$$typeof===M&&gm(at)===Ct.type){g(me,Ct.sibling),se=w(Ct,be.props),se.ref=Ca(me,Ct,be),se.return=me,me=se;break e}g(me,Ct);break}else u(me,Ct);Ct=Ct.sibling}be.type===f?(se=Ps(be.props.children,me.mode,Qe,be.key),se.return=me,me=se):(Qe=Uc(be.type,be.key,be.props,null,me.mode,Qe),Qe.ref=Ca(me,se,be),Qe.return=me,me=Qe)}return Y(me);case h:e:{for(Ct=be.key;se!==null;){if(se.key===Ct)if(se.tag===4&&se.stateNode.containerInfo===be.containerInfo&&se.stateNode.implementation===be.implementation){g(me,se.sibling),se=w(se,be.children||[]),se.return=me,me=se;break e}else{g(me,se);break}else u(me,se);se=se.sibling}se=_f(be,me.mode,Qe),se.return=me,me=se}return Y(me);case M:return Ct=be._init,Oi(me,se,Ct(be._payload),Qe)}if(q(be))return lt(me,se,be,Qe);if(R(be))return kn(me,se,be,Qe);nc(me,be)}return typeof be=="string"&&be!==""||typeof be=="number"?(be=""+be,se!==null&&se.tag===6?(g(me,se.sibling),se=w(se,be),se.return=me,me=se):(g(me,se),se=vf(be,me.mode,Qe),se.return=me,me=se),Y(me)):g(me,se)}return Oi}var xo=vm(!0),_m=vm(!1),Ra={},Ui=qt(Ra),Pa=qt(Ra),So=qt(Ra);function tr(l){if(l===Ra)throw Error(o(174));return l}function Dh(l,u){et(So,u),et(Pa,l),et(Ui,Ra),l=re(u),ut(Ui),et(Ui,l)}function Mo(){ut(Ui),ut(Pa),ut(So)}function ym(l){var u=tr(So.current),g=tr(Ui.current);u=Z(g,l.type,u),g!==u&&(et(Pa,l),et(Ui,u))}function Nh(l){Pa.current===l&&(ut(Ui),ut(Pa))}var Jt=qt(0);function ic(l){for(var u=l;u!==null;){if(u.tag===13){var g=u.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||oi(g)||jn(g)))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if(u.flags&128)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var Fh=[];function Oh(){for(var l=0;l<Fh.length;l++){var u=Fh[l];Pe?u._workInProgressVersionPrimary=null:u._workInProgressVersionSecondary=null}Fh.length=0}var rc=a.ReactCurrentDispatcher,Di=a.ReactCurrentBatchConfig,Eo=0,en=null,Fn=null,bn=null,sc=!1,La=!1,Ia=0,Ax=0;function On(){throw Error(o(321))}function Bh(l,u){if(u===null)return!1;for(var g=0;g<u.length&&g<l.length;g++)if(!yi(l[g],u[g]))return!1;return!0}function kh(l,u,g,x,w,T){if(Eo=T,en=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,rc.current=l===null||l.memoizedState===null?Lx:Ix,l=g(x,w),La){T=0;do{if(La=!1,Ia=0,25<=T)throw Error(o(301));T+=1,bn=Fn=null,u.updateQueue=null,rc.current=Ux,l=g(x,w)}while(La)}if(rc.current=uc,u=Fn!==null&&Fn.next!==null,Eo=0,bn=Fn=en=null,sc=!1,u)throw Error(o(300));return l}function zh(){var l=Ia!==0;return Ia=0,l}function yr(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bn===null?en.memoizedState=bn=l:bn=bn.next=l,bn}function nr(){if(Fn===null){var l=en.alternate;l=l!==null?l.memoizedState:null}else l=Fn.next;var u=bn===null?en.memoizedState:bn.next;if(u!==null)bn=u,Fn=l;else{if(l===null)throw Error(o(310));Fn=l,l={memoizedState:Fn.memoizedState,baseState:Fn.baseState,baseQueue:Fn.baseQueue,queue:Fn.queue,next:null},bn===null?en.memoizedState=bn=l:bn=bn.next=l}return bn}function ws(l,u){return typeof u=="function"?u(l):u}function oc(l){var u=nr(),g=u.queue;if(g===null)throw Error(o(311));g.lastRenderedReducer=l;var x=Fn,w=x.baseQueue,T=g.pending;if(T!==null){if(w!==null){var Y=w.next;w.next=T.next,T.next=Y}x.baseQueue=w=T,g.pending=null}if(w!==null){T=w.next,x=x.baseState;var ie=Y=null,Ae=null,Ve=T;do{var nt=Ve.lane;if((Eo&nt)===nt)Ae!==null&&(Ae=Ae.next={lane:0,action:Ve.action,hasEagerState:Ve.hasEagerState,eagerState:Ve.eagerState,next:null}),x=Ve.hasEagerState?Ve.eagerState:l(x,Ve.action);else{var xt={lane:nt,action:Ve.action,hasEagerState:Ve.hasEagerState,eagerState:Ve.eagerState,next:null};Ae===null?(ie=Ae=xt,Y=x):Ae=Ae.next=xt,en.lanes|=nt,bo|=nt}Ve=Ve.next}while(Ve!==null&&Ve!==T);Ae===null?Y=x:Ae.next=ie,yi(x,u.memoizedState)||(Ei=!0),u.memoizedState=x,u.baseState=Y,u.baseQueue=Ae,g.lastRenderedState=x}if(l=g.interleaved,l!==null){w=l;do T=w.lane,en.lanes|=T,bo|=T,w=w.next;while(w!==l)}else w===null&&(g.lanes=0);return[u.memoizedState,g.dispatch]}function ac(l){var u=nr(),g=u.queue;if(g===null)throw Error(o(311));g.lastRenderedReducer=l;var x=g.dispatch,w=g.pending,T=u.memoizedState;if(w!==null){g.pending=null;var Y=w=w.next;do T=l(T,Y.action),Y=Y.next;while(Y!==w);yi(T,u.memoizedState)||(Ei=!0),u.memoizedState=T,u.baseQueue===null&&(u.baseState=T),g.lastRenderedState=T}return[T,x]}function xm(){}function Sm(l,u){var g=en,x=nr(),w=u(),T=!yi(x.memoizedState,w);if(T&&(x.memoizedState=w,Ei=!0),x=x.queue,Da(wm.bind(null,g,x,l),[l]),x.getSnapshot!==u||T||bn!==null&&bn.memoizedState.tag&1){if(g.flags|=2048,Ua(9,Em.bind(null,g,x,w,u),void 0,null),mn===null)throw Error(o(349));Eo&30||Mm(g,u,w)}return w}function Mm(l,u,g){l.flags|=16384,l={getSnapshot:u,value:g},u=en.updateQueue,u===null?(u={lastEffect:null,stores:null},en.updateQueue=u,u.stores=[l]):(g=u.stores,g===null?u.stores=[l]:g.push(l))}function Em(l,u,g,x){u.value=g,u.getSnapshot=x,bm(u)&&Ni(l,1,-1)}function wm(l,u,g){return g(function(){bm(u)&&Ni(l,1,-1)})}function bm(l){var u=l.getSnapshot;l=l.value;try{var g=u();return!yi(l,g)}catch{return!0}}function Gh(l){var u=yr();return typeof l=="function"&&(l=l()),u.memoizedState=u.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ws,lastRenderedState:l},u.queue=l,l=l.dispatch=Px.bind(null,en,l),[u.memoizedState,l]}function Ua(l,u,g,x){return l={tag:l,create:u,destroy:g,deps:x,next:null},u=en.updateQueue,u===null?(u={lastEffect:null,stores:null},en.updateQueue=u,u.lastEffect=l.next=l):(g=u.lastEffect,g===null?u.lastEffect=l.next=l:(x=g.next,g.next=l,l.next=x,u.lastEffect=l)),l}function Tm(){return nr().memoizedState}function lc(l,u,g,x){var w=yr();en.flags|=l,w.memoizedState=Ua(1|u,g,void 0,x===void 0?null:x)}function cc(l,u,g,x){var w=nr();x=x===void 0?null:x;var T=void 0;if(Fn!==null){var Y=Fn.memoizedState;if(T=Y.destroy,x!==null&&Bh(x,Y.deps)){w.memoizedState=Ua(u,g,T,x);return}}en.flags|=l,w.memoizedState=Ua(1|u,g,T,x)}function Hh(l,u){return lc(8390656,8,l,u)}function Da(l,u){return cc(2048,8,l,u)}function Am(l,u){return cc(4,2,l,u)}function Cm(l,u){return cc(4,4,l,u)}function Rm(l,u){if(typeof u=="function")return l=l(),u(l),function(){u(null)};if(u!=null)return l=l(),u.current=l,function(){u.current=null}}function Pm(l,u,g){return g=g!=null?g.concat([l]):null,cc(4,4,Rm.bind(null,u,l),g)}function Vh(){}function Lm(l,u){var g=nr();u=u===void 0?null:u;var x=g.memoizedState;return x!==null&&u!==null&&Bh(u,x[1])?x[0]:(g.memoizedState=[l,u],l)}function Im(l,u){var g=nr();u=u===void 0?null:u;var x=g.memoizedState;return x!==null&&u!==null&&Bh(u,x[1])?x[0]:(l=l(),g.memoizedState=[l,u],l)}function Cx(l,u){var g=Pt;Pt=g!==0&&4>g?g:4,l(!0);var x=Di.transition;Di.transition={};try{l(!1),u()}finally{Pt=g,Di.transition=x}}function Um(){return nr().memoizedState}function Rx(l,u,g){var x=Xr(l);g={lane:x,action:g,hasEagerState:!1,eagerState:null,next:null},Dm(l)?Nm(u,g):(Fm(l,u,g),g=ti(),l=Ni(l,x,g),l!==null&&Om(l,u,x))}function Px(l,u,g){var x=Xr(l),w={lane:x,action:g,hasEagerState:!1,eagerState:null,next:null};if(Dm(l))Nm(u,w);else{Fm(l,u,w);var T=l.alternate;if(l.lanes===0&&(T===null||T.lanes===0)&&(T=u.lastRenderedReducer,T!==null))try{var Y=u.lastRenderedState,ie=T(Y,g);if(w.hasEagerState=!0,w.eagerState=ie,yi(ie,Y))return}catch{}finally{}g=ti(),l=Ni(l,x,g),l!==null&&Om(l,u,x)}}function Dm(l){var u=l.alternate;return l===en||u!==null&&u===en}function Nm(l,u){La=sc=!0;var g=l.pending;g===null?u.next=u:(u.next=g.next,g.next=u),l.pending=u}function Fm(l,u,g){mn!==null&&l.mode&1&&!(Rt&2)?(l=u.interleaved,l===null?(g.next=g,xi===null?xi=[u]:xi.push(u)):(g.next=l.next,l.next=g),u.interleaved=g):(l=u.pending,l===null?g.next=g:(g.next=l.next,l.next=g),u.pending=g)}function Om(l,u,g){if(g&4194240){var x=u.lanes;x&=l.pendingLanes,g|=x,u.lanes=g,$i(l,g)}}var uc={readContext:ln,useCallback:On,useContext:On,useEffect:On,useImperativeHandle:On,useInsertionEffect:On,useLayoutEffect:On,useMemo:On,useReducer:On,useRef:On,useState:On,useDebugValue:On,useDeferredValue:On,useTransition:On,useMutableSource:On,useSyncExternalStore:On,useId:On,unstable_isNewReconciler:!1},Lx={readContext:ln,useCallback:function(l,u){return yr().memoizedState=[l,u===void 0?null:u],l},useContext:ln,useEffect:Hh,useImperativeHandle:function(l,u,g){return g=g!=null?g.concat([l]):null,lc(4194308,4,Rm.bind(null,u,l),g)},useLayoutEffect:function(l,u){return lc(4194308,4,l,u)},useInsertionEffect:function(l,u){return lc(4,2,l,u)},useMemo:function(l,u){var g=yr();return u=u===void 0?null:u,l=l(),g.memoizedState=[l,u],l},useReducer:function(l,u,g){var x=yr();return u=g!==void 0?g(u):u,x.memoizedState=x.baseState=u,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},x.queue=l,l=l.dispatch=Rx.bind(null,en,l),[x.memoizedState,l]},useRef:function(l){var u=yr();return l={current:l},u.memoizedState=l},useState:Gh,useDebugValue:Vh,useDeferredValue:function(l){var u=Gh(l),g=u[0],x=u[1];return Hh(function(){var w=Di.transition;Di.transition={};try{x(l)}finally{Di.transition=w}},[l]),g},useTransition:function(){var l=Gh(!1),u=l[0];return l=Cx.bind(null,l[1]),yr().memoizedState=l,[u,l]},useMutableSource:function(){},useSyncExternalStore:function(l,u,g){var x=en,w=yr();if(jt){if(g===void 0)throw Error(o(407));g=g()}else{if(g=u(),mn===null)throw Error(o(349));Eo&30||Mm(x,u,g)}w.memoizedState=g;var T={value:g,getSnapshot:u};return w.queue=T,Hh(wm.bind(null,x,T,l),[l]),x.flags|=2048,Ua(9,Em.bind(null,x,T,g,u),void 0,null),g},useId:function(){var l=yr(),u=mn.identifierPrefix;if(jt){var g=_r,x=vr;g=(x&~(1<<32-Zn(x)-1)).toString(32)+g,u=":"+u+"R"+g,g=Ia++,0<g&&(u+="H"+g.toString(32)),u+=":"}else g=Ax++,u=":"+u+"r"+g.toString(32)+":";return l.memoizedState=u},unstable_isNewReconciler:!1},Ix={readContext:ln,useCallback:Lm,useContext:ln,useEffect:Da,useImperativeHandle:Pm,useInsertionEffect:Am,useLayoutEffect:Cm,useMemo:Im,useReducer:oc,useRef:Tm,useState:function(){return oc(ws)},useDebugValue:Vh,useDeferredValue:function(l){var u=oc(ws),g=u[0],x=u[1];return Da(function(){var w=Di.transition;Di.transition={};try{x(l)}finally{Di.transition=w}},[l]),g},useTransition:function(){var l=oc(ws)[0],u=nr().memoizedState;return[l,u]},useMutableSource:xm,useSyncExternalStore:Sm,useId:Um,unstable_isNewReconciler:!1},Ux={readContext:ln,useCallback:Lm,useContext:ln,useEffect:Da,useImperativeHandle:Pm,useInsertionEffect:Am,useLayoutEffect:Cm,useMemo:Im,useReducer:ac,useRef:Tm,useState:function(){return ac(ws)},useDebugValue:Vh,useDeferredValue:function(l){var u=ac(ws),g=u[0],x=u[1];return Da(function(){var w=Di.transition;Di.transition={};try{x(l)}finally{Di.transition=w}},[l]),g},useTransition:function(){var l=ac(ws)[0],u=nr().memoizedState;return[l,u]},useMutableSource:xm,useSyncExternalStore:Sm,useId:Um,unstable_isNewReconciler:!1};function Wh(l,u){try{var g="",x=u;do g+=Ss(x),x=x.return;while(x);var w=g}catch(T){w=` 3715Error generating stack: `+T.message+` 3716`+T.stack}return{value:l,source:u,stack:w}}function Xh(l,u){try{console.error(u.value)}catch(g){setTimeout(function(){throw g})}}var Dx=typeof WeakMap=="function"?WeakMap:Map;function Bm(l,u,g){g=gr(-1,g),g.tag=3,g.payload={element:null};var x=u.value;return g.callback=function(){Tc||(Tc=!0,uf=x),Xh(l,u)},g}function km(l,u,g){g=gr(-1,g),g.tag=3;var x=l.type.getDerivedStateFromError;if(typeof x=="function"){var w=u.value;g.payload=function(){return x(w)},g.callback=function(){Xh(l,u)}}var T=l.stateNode;return T!==null&&typeof T.componentDidCatch=="function"&&(g.callback=function(){Xh(l,u),typeof x!="function"&&(Vr===null?Vr=new Set([this]):Vr.add(this));var Y=u.stack;this.componentDidCatch(u.value,{componentStack:Y!==null?Y:""})}),g}function zm(l,u,g){var x=l.pingCache;if(x===null){x=l.pingCache=new Dx;var w=new Set;x.set(u,w)}else w=x.get(u),w===void 0&&(w=new Set,x.set(u,w));w.has(g)||(w.add(g),l=qx.bind(null,l,u,g),u.then(l,l))}function Gm(l){do{var u;if((u=l.tag===13)&&(u=l.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return l;l=l.return}while(l!==null);return null}function Hm(l,u,g,x,w){return l.mode&1?(l.flags|=65536,l.lanes=w,l):(l===u?l.flags|=65536:(l.flags|=128,g.flags|=131072,g.flags&=-52805,g.tag===1&&(g.alternate===null?g.tag=17:(u=gr(-1,1),u.tag=2,Hr(g,u))),g.lanes|=1),l)}function ir(l){l.flags|=4}function Vm(l,u){if(l!==null&&l.child===u.child)return!0;if(u.flags&16)return!1;for(l=u.child;l!==null;){if(l.flags&12854||l.subtreeFlags&12854)return!1;l=l.sibling}return!0}var Na,Fa,hc,fc;if(Se)Na=function(l,u){for(var g=u.child;g!==null;){if(g.tag===5||g.tag===6)j(l,g.stateNode);else if(g.tag!==4&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===u)break;for(;g.sibling===null;){if(g.return===null||g.return===u)return;g=g.return}g.sibling.return=g.return,g=g.sibling}},Fa=function(){},hc=function(l,u,g,x,w){if(l=l.memoizedProps,l!==x){var T=u.stateNode,Y=tr(Ui.current);g=$(T,g,l,x,w,Y),(u.updateQueue=g)&&ir(u)}},fc=function(l,u,g,x){g!==x&&ir(u)};else if(O){Na=function(l,u,g,x){for(var w=u.child;w!==null;){if(w.tag===5){var T=w.stateNode;g&&x&&(T=ht(T,w.type,w.memoizedProps,w)),j(l,T)}else if(w.tag===6)T=w.stateNode,g&&x&&(T=At(T,w.memoizedProps,w)),j(l,T);else if(w.tag!==4){if(w.tag===22&&w.memoizedState!==null)T=w.child,T!==null&&(T.return=w),Na(l,w,!0,!0);else if(w.child!==null){w.child.return=w,w=w.child;continue}}if(w===u)break;for(;w.sibling===null;){if(w.return===null||w.return===u)return;w=w.return}w.sibling.return=w.return,w=w.sibling}};var Wm=function(l,u,g,x){for(var w=u.child;w!==null;){if(w.tag===5){var T=w.stateNode;g&&x&&(T=ht(T,w.type,w.memoizedProps,w)),je(l,T)}else if(w.tag===6)T=w.stateNode,g&&x&&(T=At(T,w.memoizedProps,w)),je(l,T);else if(w.tag!==4){if(w.tag===22&&w.memoizedState!==null)T=w.child,T!==null&&(T.return=w),Wm(l,w,!0,!0);else if(w.child!==null){w.child.return=w,w=w.child;continue}}if(w===u)break;for(;w.sibling===null;){if(w.return===null||w.return===u)return;w=w.return}w.sibling.return=w.return,w=w.sibling}};Fa=function(l,u){var g=u.stateNode;if(!Vm(l,u)){l=g.containerInfo;var x=He(l);Wm(x,u,!1,!1),g.pendingChildren=x,ir(u),rt(l,x)}},hc=function(l,u,g,x,w){var T=l.stateNode,Y=l.memoizedProps;if((l=Vm(l,u))&&Y===x)u.stateNode=T;else{var ie=u.stateNode,Ae=tr(Ui.current),Ve=null;Y!==x&&(Ve=$(ie,g,Y,x,w,Ae)),l&&Ve===null?u.stateNode=T:(T=Fe(T,Ve,g,Y,x,u,l,ie),G(T,g,x,w,Ae)&&ir(u),u.stateNode=T,l?ir(u):Na(T,u,!1,!1))}},fc=function(l,u,g,x){g!==x?(l=tr(So.current),g=tr(Ui.current),u.stateNode=ae(x,l,g,u),ir(u)):u.stateNode=l.stateNode}}else Fa=function(){},hc=function(){},fc=function(){};function Oa(l,u){if(!jt)switch(l.tailMode){case"hidden":u=l.tail;for(var g=null;u!==null;)u.alternate!==null&&(g=u),u=u.sibling;g===null?l.tail=null:g.sibling=null;break;case"collapsed":g=l.tail;for(var x=null;g!==null;)g.alternate!==null&&(x=g),g=g.sibling;x===null?u||l.tail===null?l.tail=null:l.tail.sibling=null:x.sibling=null}}function Bn(l){var u=l.alternate!==null&&l.alternate.child===l.child,g=0,x=0;if(u)for(var w=l.child;w!==null;)g|=w.lanes|w.childLanes,x|=w.subtreeFlags&14680064,x|=w.flags&14680064,w.return=l,w=w.sibling;else for(w=l.child;w!==null;)g|=w.lanes|w.childLanes,x|=w.subtreeFlags,x|=w.flags,w.return=l,w=w.sibling;return l.subtreeFlags|=x,l.childLanes=g,u}function Nx(l,u,g){var x=u.pendingProps;switch(Ph(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bn(u),null;case 1:return $t(u.type)&&Gt(),Bn(u),null;case 3:return x=u.stateNode,Mo(),ut(Vt),ut(Mt),Oh(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(l===null||l.child===null)&&(Aa(u)?ir(u):l===null||l.memoizedState.isDehydrated&&!(u.flags&256)||(u.flags|=1024,zi!==null&&(df(zi),zi=null))),Fa(l,u),Bn(u),null;case 5:Nh(u),g=tr(So.current);var w=u.type;if(l!==null&&u.stateNode!=null)hc(l,u,w,x,g),l.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!x){if(u.stateNode===null)throw Error(o(166));return Bn(u),null}if(l=tr(Ui.current),Aa(u)){if(!Me)throw Error(o(175));l=ho(u.stateNode,u.type,u.memoizedProps,g,l,u,!Ta),u.updateQueue=l,l!==null&&ir(u)}else{var T=F(w,x,g,l,u);Na(T,u,!1,!1),u.stateNode=T,G(T,w,x,g,l)&&ir(u)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return Bn(u),null;case 6:if(l&&u.stateNode!=null)fc(l,u,l.memoizedProps,x);else{if(typeof x!="string"&&u.stateNode===null)throw Error(o(166));if(l=tr(So.current),g=tr(Ui.current),Aa(u)){if(!Me)throw Error(o(176));if(l=u.stateNode,x=u.memoizedProps,(g=ps(l,x,u,!Ta))&&(w=Si,w!==null))switch(T=(w.mode&1)!==0,w.tag){case 3:ot(w.stateNode.containerInfo,l,x,T);break;case 5:ct(w.type,w.memoizedProps,w.stateNode,l,x,T)}g&&ir(u)}else u.stateNode=ae(x,l,g,u)}return Bn(u),null;case 13:if(ut(Jt),x=u.memoizedState,jt&&Mi!==null&&u.mode&1&&!(u.flags&128)){for(l=Mi;l;)l=Dn(l);return yo(),u.flags|=98560,u}if(x!==null&&x.dehydrated!==null){if(x=Aa(u),l===null){if(!x)throw Error(o(318));if(!Me)throw Error(o(344));if(l=u.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(o(317));_a(l,u)}else yo(),!(u.flags&128)&&(u.memoizedState=null),u.flags|=4;return Bn(u),null}return zi!==null&&(df(zi),zi=null),u.flags&128?(u.lanes=g,u):(x=x!==null,g=!1,l===null?Aa(u):g=l.memoizedState!==null,x&&!g&&(u.child.flags|=8192,u.mode&1&&(l===null||Jt.current&1?_n===0&&(_n=3):mf())),u.updateQueue!==null&&(u.flags|=4),Bn(u),null);case 4:return Mo(),Fa(l,u),l===null&&de(u.stateNode.containerInfo),Bn(u),null;case 10:return wn(u.type._context),Bn(u),null;case 17:return $t(u.type)&&Gt(),Bn(u),null;case 19:if(ut(Jt),w=u.memoizedState,w===null)return Bn(u),null;if(x=(u.flags&128)!==0,T=w.rendering,T===null)if(x)Oa(w,!1);else{if(_n!==0||l!==null&&l.flags&128)for(l=u.child;l!==null;){if(T=ic(l),T!==null){for(u.flags|=128,Oa(w,!1),l=T.updateQueue,l!==null&&(u.updateQueue=l,u.flags|=4),u.subtreeFlags=0,l=g,x=u.child;x!==null;)g=x,w=l,g.flags&=14680066,T=g.alternate,T===null?(g.childLanes=0,g.lanes=w,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=T.childLanes,g.lanes=T.lanes,g.child=T.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=T.memoizedProps,g.memoizedState=T.memoizedState,g.updateQueue=T.updateQueue,g.type=T.type,w=T.dependencies,g.dependencies=w===null?null:{lanes:w.lanes,firstContext:w.firstContext}),x=x.sibling;return et(Jt,Jt.current&1|2),u.child}l=l.sibling}w.tail!==null&&Zt()>cf&&(u.flags|=128,x=!0,Oa(w,!1),u.lanes=4194304)}else{if(!x)if(l=ic(T),l!==null){if(u.flags|=128,x=!0,l=l.updateQueue,l!==null&&(u.updateQueue=l,u.flags|=4),Oa(w,!0),w.tail===null&&w.tailMode==="hidden"&&!T.alternate&&!jt)return Bn(u),null}else 2*Zt()-w.renderingStartTime>cf&&g!==1073741824&&(u.flags|=128,x=!0,Oa(w,!1),u.lanes=4194304);w.isBackwards?(T.sibling=u.child,u.child=T):(l=w.last,l!==null?l.sibling=T:u.child=T,w.last=T)}return w.tail!==null?(u=w.tail,w.rendering=u,w.tail=u.sibling,w.renderingStartTime=Zt(),u.sibling=null,l=Jt.current,et(Jt,x?l&1|2:l&1),u):(Bn(u),null);case 22:case 23:return pf(),x=u.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(u.flags|=8192),x&&u.mode&1?wi&1073741824&&(Bn(u),Se&&u.subtreeFlags&6&&(u.flags|=8192)):Bn(u),null;case 24:return null;case 25:return null}throw Error(o(156,u.tag))}var Fx=a.ReactCurrentOwner,Ei=!1;function ei(l,u,g,x){u.child=l===null?_m(u,null,g,x):xo(u,l.child,g,x)}function Xm(l,u,g,x,w){g=g.render;var T=u.ref;return an(u,w),x=kh(l,u,g,x,T,w),g=zh(),l!==null&&!Ei?(u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~w,xr(l,u,w)):(jt&&g&&Rh(u),u.flags|=1,ei(l,u,x,w),u.child)}function Ym(l,u,g,x,w){if(l===null){var T=g.type;return typeof T=="function"&&!gf(T)&&T.defaultProps===void 0&&g.compare===null&&g.defaultProps===void 0?(u.tag=15,u.type=T,jm(l,u,T,x,w)):(l=Uc(g.type,null,x,u,u.mode,w),l.ref=u.ref,l.return=u,u.child=l)}if(T=l.child,!(l.lanes&w)){var Y=T.memoizedProps;if(g=g.compare,g=g!==null?g:xs,g(Y,x)&&l.ref===u.ref)return xr(l,u,w)}return u.flags|=1,l=jr(T,x),l.ref=u.ref,l.return=u,u.child=l}function jm(l,u,g,x,w){if(l!==null&&xs(l.memoizedProps,x)&&l.ref===u.ref)if(Ei=!1,(l.lanes&w)!==0)l.flags&131072&&(Ei=!0);else return u.lanes=l.lanes,xr(l,u,w);return Yh(l,u,g,x,w)}function qm(l,u,g){var x=u.pendingProps,w=x.children,T=l!==null?l.memoizedState:null;if(x.mode==="hidden")if(!(u.mode&1))u.memoizedState={baseLanes:0,cachePool:null},et(wo,wi),wi|=g;else if(g&1073741824)u.memoizedState={baseLanes:0,cachePool:null},x=T!==null?T.baseLanes:g,et(wo,wi),wi|=x;else return l=T!==null?T.baseLanes|g:g,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:l,cachePool:null},u.updateQueue=null,et(wo,wi),wi|=l,null;else T!==null?(x=T.baseLanes|g,u.memoizedState=null):x=g,et(wo,wi),wi|=x;return ei(l,u,w,g),u.child}function Zm(l,u){var g=u.ref;(l===null&&g!==null||l!==null&&l.ref!==g)&&(u.flags|=512,u.flags|=2097152)}function Yh(l,u,g,x,w){var T=$t(g)?vi:Mt.current;return T=Mn(u,T),an(u,w),g=kh(l,u,g,x,T,w),x=zh(),l!==null&&!Ei?(u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~w,xr(l,u,w)):(jt&&x&&Rh(u),u.flags|=1,ei(l,u,g,w),u.child)}function Jm(l,u,g,x,w){if($t(g)){var T=!0;on(u)}else T=!1;if(an(u,w),u.stateNode===null)l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2),um(u,g,x),Ch(u,g,x,w),x=!0;else if(l===null){var Y=u.stateNode,ie=u.memoizedProps;Y.props=ie;var Ae=Y.context,Ve=g.contextType;typeof Ve=="object"&&Ve!==null?Ve=ln(Ve):(Ve=$t(g)?vi:Mt.current,Ve=Mn(u,Ve));var nt=g.getDerivedStateFromProps,xt=typeof nt=="function"||typeof Y.getSnapshotBeforeUpdate=="function";xt||typeof Y.UNSAFE_componentWillReceiveProps!="function"&&typeof Y.componentWillReceiveProps!="function"||(ie!==x||Ae!==Ve)&&hm(u,Y,x,Ve),Gr=!1;var dt=u.memoizedState;Y.state=dt,Ql(u,x,Y,w),Ae=u.memoizedState,ie!==x||dt!==Ae||Vt.current||Gr?(typeof nt=="function"&&(Ah(u,g,nt,x),Ae=u.memoizedState),(ie=Gr||cm(u,g,ie,x,dt,Ae,Ve))?(xt||typeof Y.UNSAFE_componentWillMount!="function"&&typeof Y.componentWillMount!="function"||(typeof Y.componentWillMount=="function"&&Y.componentWillMount(),typeof Y.UNSAFE_componentWillMount=="function"&&Y.UNSAFE_componentWillMount()),typeof Y.componentDidMount=="function"&&(u.flags|=4194308)):(typeof Y.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=x,u.memoizedState=Ae),Y.props=x,Y.state=Ae,Y.context=Ve,x=ie):(typeof Y.componentDidMount=="function"&&(u.flags|=4194308),x=!1)}else{Y=u.stateNode,sm(l,u),ie=u.memoizedProps,Ve=u.type===u.elementType?ie:Qn(u.type,ie),Y.props=Ve,xt=u.pendingProps,dt=Y.context,Ae=g.contextType,typeof Ae=="object"&&Ae!==null?Ae=ln(Ae):(Ae=$t(g)?vi:Mt.current,Ae=Mn(u,Ae));var Ht=g.getDerivedStateFromProps;(nt=typeof Ht=="function"||typeof Y.getSnapshotBeforeUpdate=="function")||typeof Y.UNSAFE_componentWillReceiveProps!="function"&&typeof Y.componentWillReceiveProps!="function"||(ie!==xt||dt!==Ae)&&hm(u,Y,x,Ae),Gr=!1,dt=u.memoizedState,Y.state=dt,Ql(u,x,Y,w);var lt=u.memoizedState;ie!==xt||dt!==lt||Vt.current||Gr?(typeof Ht=="function"&&(Ah(u,g,Ht,x),lt=u.memoizedState),(Ve=Gr||cm(u,g,Ve,x,dt,lt,Ae)||!1)?(nt||typeof Y.UNSAFE_componentWillUpdate!="function"&&typeof Y.componentWillUpdate!="function"||(typeof Y.componentWillUpdate=="function"&&Y.componentWillUpdate(x,lt,Ae),typeof Y.UNSAFE_componentWillUpdate=="function"&&Y.UNSAFE_componentWillUpdate(x,lt,Ae)),typeof Y.componentDidUpdate=="function"&&(u.flags|=4),typeof Y.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof Y.componentDidUpdate!="function"||ie===l.memoizedProps&&dt===l.memoizedState||(u.flags|=4),typeof Y.getSnapshotBeforeUpdate!="function"||ie===l.memoizedProps&&dt===l.memoizedState||(u.flags|=1024),u.memoizedProps=x,u.memoizedState=lt),Y.props=x,Y.state=lt,Y.context=Ae,x=Ve):(typeof Y.componentDidUpdate!="function"||ie===l.memoizedProps&&dt===l.memoizedState||(u.flags|=4),typeof Y.getSnapshotBeforeUpdate!="function"||ie===l.memoizedProps&&dt===l.memoizedState||(u.flags|=1024),x=!1)}return jh(l,u,g,x,T,w)}function jh(l,u,g,x,w,T){Zm(l,u);var Y=(u.flags&128)!==0;if(!x&&!Y)return w&&Ln(u,g,!1),xr(l,u,T);x=u.stateNode,Fx.current=u;var ie=Y&&typeof g.getDerivedStateFromError!="function"?null:x.render();return u.flags|=1,l!==null&&Y?(u.child=xo(u,l.child,null,T),u.child=xo(u,null,ie,T)):ei(l,u,ie,T),u.memoizedState=x.state,w&&Ln(u,g,!0),u.child}function Km(l){var u=l.stateNode;u.pendingContext?ai(l,u.pendingContext,u.pendingContext!==u.context):u.context&&ai(l,u.context,!1),Dh(l,u.containerInfo)}function Qm(l,u,g,x,w){return yo(),Uh(w),u.flags|=256,ei(l,u,g,x),u.child}var dc={dehydrated:null,treeContext:null,retryLane:0};function pc(l){return{baseLanes:l,cachePool:null}}function $m(l,u,g){var x=u.pendingProps,w=Jt.current,T=!1,Y=(u.flags&128)!==0,ie;if((ie=Y)||(ie=l!==null&&l.memoizedState===null?!1:(w&2)!==0),ie?(T=!0,u.flags&=-129):(l===null||l.memoizedState!==null)&&(w|=1),et(Jt,w&1),l===null)return Ih(u),l=u.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?(u.mode&1?jn(l)?u.lanes=8:u.lanes=1073741824:u.lanes=1,null):(w=x.children,l=x.fallback,T?(x=u.mode,T=u.child,w={mode:"hidden",children:w},!(x&1)&&T!==null?(T.childLanes=0,T.pendingProps=w):T=Dc(w,x,0,null),l=Ps(l,x,g,null),T.return=u,l.return=u,T.sibling=l,u.child=T,u.child.memoizedState=pc(g),u.memoizedState=dc,l):qh(u,w));if(w=l.memoizedState,w!==null){if(ie=w.dehydrated,ie!==null){if(Y)return u.flags&256?(u.flags&=-257,mc(l,u,g,Error(o(422)))):u.memoizedState!==null?(u.child=l.child,u.flags|=128,null):(T=x.fallback,w=u.mode,x=Dc({mode:"visible",children:x.children},w,0,null),T=Ps(T,w,g,null),T.flags|=2,x.return=u,T.return=u,x.sibling=T,u.child=x,u.mode&1&&xo(u,l.child,null,g),u.child.memoizedState=pc(g),u.memoizedState=dc,T);if(!(u.mode&1))u=mc(l,u,g,null);else if(jn(ie))u=mc(l,u,g,Error(o(419)));else if(x=(g&l.childLanes)!==0,Ei||x){if(x=mn,x!==null){switch(g&-g){case 4:T=2;break;case 16:T=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:T=32;break;case 536870912:T=268435456;break;default:T=0}x=T&(x.suspendedLanes|g)?0:T,x!==0&&x!==w.retryLane&&(w.retryLane=x,Ni(l,x,-1))}mf(),u=mc(l,u,g,Error(o(421)))}else oi(ie)?(u.flags|=128,u.child=l.child,u=Zx.bind(null,l),qn(ie,u),u=null):(g=w.treeContext,Me&&(Mi=Ri(ie),Si=u,jt=!0,zi=null,Ta=!1,g!==null&&(Li[Ii++]=vr,Li[Ii++]=_r,Li[Ii++]=Ms,vr=g.id,_r=g.overflow,Ms=u)),u=qh(u,u.pendingProps.children),u.flags|=4096);return u}return T?(x=tg(l,u,x.children,x.fallback,g),T=u.child,w=l.child.memoizedState,T.memoizedState=w===null?pc(g):{baseLanes:w.baseLanes|g,cachePool:null},T.childLanes=l.childLanes&~g,u.memoizedState=dc,x):(g=eg(l,u,x.children,g),u.memoizedState=null,g)}return T?(x=tg(l,u,x.children,x.fallback,g),T=u.child,w=l.child.memoizedState,T.memoizedState=w===null?pc(g):{baseLanes:w.baseLanes|g,cachePool:null},T.childLanes=l.childLanes&~g,u.memoizedState=dc,x):(g=eg(l,u,x.children,g),u.memoizedState=null,g)}function qh(l,u){return u=Dc({mode:"visible",children:u},l.mode,0,null),u.return=l,l.child=u}function eg(l,u,g,x){var w=l.child;return l=w.sibling,g=jr(w,{mode:"visible",children:g}),!(u.mode&1)&&(g.lanes=x),g.return=u,g.sibling=null,l!==null&&(x=u.deletions,x===null?(u.deletions=[l],u.flags|=16):x.push(l)),u.child=g}function tg(l,u,g,x,w){var T=u.mode;l=l.child;var Y=l.sibling,ie={mode:"hidden",children:g};return!(T&1)&&u.child!==l?(g=u.child,g.childLanes=0,g.pendingProps=ie,u.deletions=null):(g=jr(l,ie),g.subtreeFlags=l.subtreeFlags&14680064),Y!==null?x=jr(Y,x):(x=Ps(x,T,w,null),x.flags|=2),x.return=u,g.return=u,g.sibling=x,u.child=g,x}function mc(l,u,g,x){return x!==null&&Uh(x),xo(u,l.child,null,g),l=qh(u,u.pendingProps.children),l.flags|=2,u.memoizedState=null,l}function ng(l,u,g){l.lanes|=u;var x=l.alternate;x!==null&&(x.lanes|=u),$n(l.return,u,g)}function Zh(l,u,g,x,w){var T=l.memoizedState;T===null?l.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:x,tail:g,tailMode:w}:(T.isBackwards=u,T.rendering=null,T.renderingStartTime=0,T.last=x,T.tail=g,T.tailMode=w)}function ig(l,u,g){var x=u.pendingProps,w=x.revealOrder,T=x.tail;if(ei(l,u,x.children,g),x=Jt.current,x&2)x=x&1|2,u.flags|=128;else{if(l!==null&&l.flags&128)e:for(l=u.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&ng(l,g,u);else if(l.tag===19)ng(l,g,u);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===u)break e;for(;l.sibling===null;){if(l.return===null||l.return===u)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}x&=1}if(et(Jt,x),!(u.mode&1))u.memoizedState=null;else switch(w){case"forwards":for(g=u.child,w=null;g!==null;)l=g.alternate,l!==null&&ic(l)===null&&(w=g),g=g.sibling;g=w,g===null?(w=u.child,u.child=null):(w=g.sibling,g.sibling=null),Zh(u,!1,w,g,T);break;case"backwards":for(g=null,w=u.child,u.child=null;w!==null;){if(l=w.alternate,l!==null&&ic(l)===null){u.child=w;break}l=w.sibling,w.sibling=g,g=w,w=l}Zh(u,!0,g,null,T);break;case"together":Zh(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function xr(l,u,g){if(l!==null&&(u.dependencies=l.dependencies),bo|=u.lanes,!(g&u.childLanes))return null;if(l!==null&&u.child!==l.child)throw Error(o(153));if(u.child!==null){for(l=u.child,g=jr(l,l.pendingProps),u.child=g,g.return=u;l.sibling!==null;)l=l.sibling,g=g.sibling=jr(l,l.pendingProps),g.return=u;g.sibling=null}return u.child}function Ox(l,u,g){switch(u.tag){case 3:Km(u),yo();break;case 5:ym(u);break;case 1:$t(u.type)&&on(u);break;case 4:Dh(u,u.stateNode.containerInfo);break;case 10:Jl(u,u.type._context,u.memoizedProps.value);break;case 13:var x=u.memoizedState;if(x!==null)return x.dehydrated!==null?(et(Jt,Jt.current&1),u.flags|=128,null):g&u.child.childLanes?$m(l,u,g):(et(Jt,Jt.current&1),l=xr(l,u,g),l!==null?l.sibling:null);et(Jt,Jt.current&1);break;case 19:if(x=(g&u.childLanes)!==0,l.flags&128){if(x)return ig(l,u,g);u.flags|=128}var w=u.memoizedState;if(w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),et(Jt,Jt.current),x)break;return null;case 22:case 23:return u.lanes=0,qm(l,u,g)}return xr(l,u,g)}function Bx(l,u){switch(Ph(u),u.tag){case 1:return $t(u.type)&&Gt(),l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 3:return Mo(),ut(Vt),ut(Mt),Oh(),l=u.flags,l&65536&&!(l&128)?(u.flags=l&-65537|128,u):null;case 5:return Nh(u),null;case 13:if(ut(Jt),l=u.memoizedState,l!==null&&l.dehydrated!==null){if(u.alternate===null)throw Error(o(340));yo()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 19:return ut(Jt),null;case 4:return Mo(),null;case 10:return wn(u.type._context),null;case 22:case 23:return pf(),null;case 24:return null;default:return null}}var gc=!1,bs=!1,kx=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function vc(l,u){var g=l.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(x){hi(l,u,x)}else g.current=null}function Jh(l,u,g){try{g()}catch(x){hi(l,u,x)}}var rg=!1;function zx(l,u){for(W(l.containerInfo),Ke=u;Ke!==null;)if(l=Ke,u=l.child,(l.subtreeFlags&1028)!==0&&u!==null)u.return=l,Ke=u;else for(;Ke!==null;){l=Ke;try{var g=l.alternate;if(l.flags&1024)switch(l.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,w=g.memoizedState,T=l.stateNode,Y=T.getSnapshotBeforeUpdate(l.elementType===l.type?x:Qn(l.type,x),w);T.__reactInternalSnapshotBeforeUpdate=Y}break;case 3:Se&&Ge(l.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ie){hi(l,l.return,ie)}if(u=l.sibling,u!==null){u.return=l.return,Ke=u;break}Ke=l.return}return g=rg,rg=!1,g}function Ts(l,u,g){var x=u.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&l)===l){var T=w.destroy;w.destroy=void 0,T!==void 0&&Jh(u,g,T)}w=w.next}while(w!==x)}}function Ba(l,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var g=u=u.next;do{if((g.tag&l)===l){var x=g.create;g.destroy=x()}g=g.next}while(g!==u)}}function Kh(l){var u=l.ref;if(u!==null){var g=l.stateNode;switch(l.tag){case 5:l=K(g);break;default:l=g}typeof u=="function"?u(l):u.current=l}}function sg(l,u,g){if(_i&&typeof _i.onCommitFiberUnmount=="function")try{_i.onCommitFiberUnmount(_s,u)}catch{}switch(u.tag){case 0:case 11:case 14:case 15:if(l=u.updateQueue,l!==null&&(l=l.lastEffect,l!==null)){var x=l=l.next;do{var w=x,T=w.destroy;w=w.tag,T!==void 0&&(w&2||w&4)&&Jh(u,g,T),x=x.next}while(x!==l)}break;case 1:if(vc(u,g),l=u.stateNode,typeof l.componentWillUnmount=="function")try{l.props=u.memoizedProps,l.state=u.memoizedState,l.componentWillUnmount()}catch(Y){hi(u,g,Y)}break;case 5:vc(u,g);break;case 4:Se?hg(l,u,g):O&&O&&(u=u.stateNode.containerInfo,g=He(u),Ze(u,g))}}function og(l,u,g){for(var x=u;;)if(sg(l,x,g),x.child===null||Se&&x.tag===4){if(x===u)break;for(;x.sibling===null;){if(x.return===null||x.return===u)return;x=x.return}x.sibling.return=x.return,x=x.sibling}else x.child.return=x,x=x.child}function ag(l){var u=l.alternate;u!==null&&(l.alternate=null,ag(u)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(u=l.stateNode,u!==null&&Ue(u)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function lg(l){return l.tag===5||l.tag===3||l.tag===4}function cg(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||lg(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function ug(l){if(Se){e:{for(var u=l.return;u!==null;){if(lg(u))break e;u=u.return}throw Error(o(160))}var g=u;switch(g.tag){case 5:u=g.stateNode,g.flags&32&&(we(u),g.flags&=-33),g=cg(l),$h(l,g,u);break;case 3:case 4:u=g.stateNode.containerInfo,g=cg(l),Qh(l,g,u);break;default:throw Error(o(161))}}}function Qh(l,u,g){var x=l.tag;if(x===5||x===6)l=l.stateNode,u?ze(g,l,u):ke(g,l);else if(x!==4&&(l=l.child,l!==null))for(Qh(l,u,g),l=l.sibling;l!==null;)Qh(l,u,g),l=l.sibling}function $h(l,u,g){var x=l.tag;if(x===5||x===6)l=l.stateNode,u?Xe(g,l,u):De(g,l);else if(x!==4&&(l=l.child,l!==null))for($h(l,u,g),l=l.sibling;l!==null;)$h(l,u,g),l=l.sibling}function hg(l,u,g){for(var x=u,w=!1,T,Y;;){if(!w){w=x.return;e:for(;;){if(w===null)throw Error(o(160));switch(T=w.stateNode,w.tag){case 5:Y=!1;break e;case 3:T=T.containerInfo,Y=!0;break e;case 4:T=T.containerInfo,Y=!0;break e}w=w.return}w=!0}if(x.tag===5||x.tag===6)og(l,x,g),Y?Q(T,x.stateNode):Le(T,x.stateNode);else if(x.tag===18)Y?ve(T,x.stateNode):Ee(T,x.stateNode);else if(x.tag===4){if(x.child!==null){T=x.stateNode.containerInfo,Y=!0,x.child.return=x,x=x.child;continue}}else if(sg(l,x,g),x.child!==null){x.child.return=x,x=x.child;continue}if(x===u)break;for(;x.sibling===null;){if(x.return===null||x.return===u)return;x=x.return,x.tag===4&&(w=!1)}x.sibling.return=x.return,x=x.sibling}}function ef(l,u){if(Se){switch(u.tag){case 0:case 11:case 14:case 15:Ts(3,u,u.return),Ba(3,u),Ts(5,u,u.return);return;case 1:return;case 5:var g=u.stateNode;if(g!=null){var x=u.memoizedProps;l=l!==null?l.memoizedProps:x;var w=u.type,T=u.updateQueue;u.updateQueue=null,T!==null&&tt(g,T,w,l,x,u)}return;case 6:if(u.stateNode===null)throw Error(o(162));g=u.memoizedProps,xe(u.stateNode,l!==null?l.memoizedProps:g,g);return;case 3:Me&&l!==null&&l.memoizedState.isDehydrated&&le(u.stateNode.containerInfo);return;case 12:return;case 13:_c(u);return;case 19:_c(u);return;case 17:return}throw Error(o(163))}switch(u.tag){case 0:case 11:case 14:case 15:Ts(3,u,u.return),Ba(3,u),Ts(5,u,u.return);return;case 12:return;case 13:_c(u);return;case 19:_c(u);return;case 3:Me&&l!==null&&l.memoizedState.isDehydrated&&le(u.stateNode.containerInfo);break;case 22:case 23:return}e:if(O){switch(u.tag){case 1:case 5:case 6:break e;case 3:case 4:u=u.stateNode,Ze(u.containerInfo,u.pendingChildren);break e}throw Error(o(163))}}function _c(l){var u=l.updateQueue;if(u!==null){l.updateQueue=null;var g=l.stateNode;g===null&&(g=l.stateNode=new kx),u.forEach(function(x){var w=Jx.bind(null,l,x);g.has(x)||(g.add(x),x.then(w,w))})}}function Gx(l,u){for(Ke=u;Ke!==null;){u=Ke;var g=u.deletions;if(g!==null)for(var x=0;x<g.length;x++){var w=g[x];try{var T=l;Se?hg(T,w,u):og(T,w,u);var Y=w.alternate;Y!==null&&(Y.return=null),w.return=null}catch(at){hi(w,u,at)}}if(g=u.child,u.subtreeFlags&12854&&g!==null)g.return=u,Ke=g;else for(;Ke!==null;){u=Ke;try{var ie=u.flags;if(ie&32&&Se&&we(u.stateNode),ie&512){var Ae=u.alternate;if(Ae!==null){var Ve=Ae.ref;Ve!==null&&(typeof Ve=="function"?Ve(null):Ve.current=null)}}if(ie&8192)switch(u.tag){case 13:if(u.memoizedState!==null){var nt=u.alternate;(nt===null||nt.memoizedState===null)&&(lf=Zt())}break;case 22:var xt=u.memoizedState!==null,dt=u.alternate,Ht=dt!==null&&dt.memoizedState!==null;if(g=u,Se){e:if(x=g,w=xt,T=null,Se)for(var lt=x;;){if(lt.tag===5){if(T===null){T=lt;var kn=lt.stateNode;w?We(kn):ge(lt.stateNode,lt.memoizedProps)}}else if(lt.tag===6){if(T===null){var Oi=lt.stateNode;w?Be(Oi):J(Oi,lt.memoizedProps)}}else if((lt.tag!==22&<.tag!==23||lt.memoizedState===null||lt===x)&<.child!==null){lt.child.return=lt,lt=lt.child;continue}if(lt===x)break;for(;lt.sibling===null;){if(lt.return===null||lt.return===x)break e;T===lt&&(T=null),lt=lt.return}T===lt&&(T=null),lt.sibling.return=lt.return,lt=lt.sibling}}if(xt&&!Ht&&g.mode&1){Ke=g;for(var me=g.child;me!==null;){for(g=Ke=me;Ke!==null;){x=Ke;var se=x.child;switch(x.tag){case 0:case 11:case 14:case 15:Ts(4,x,x.return);break;case 1:vc(x,x.return);var be=x.stateNode;if(typeof be.componentWillUnmount=="function"){var Qe=x.return;try{be.props=x.memoizedProps,be.state=x.memoizedState,be.componentWillUnmount()}catch(at){hi(x,Qe,at)}}break;case 5:vc(x,x.return);break;case 22:if(x.memoizedState!==null){pg(g);continue}}se!==null?(se.return=x,Ke=se):pg(g)}me=me.sibling}}}switch(ie&4102){case 2:ug(u),u.flags&=-3;break;case 6:ug(u),u.flags&=-3,ef(u.alternate,u);break;case 4096:u.flags&=-4097;break;case 4100:u.flags&=-4097,ef(u.alternate,u);break;case 4:ef(u.alternate,u)}}catch(at){hi(u,u.return,at)}if(g=u.sibling,g!==null){g.return=u.return,Ke=g;break}Ke=u.return}}}function Hx(l,u,g){Ke=l,fg(l)}function fg(l,u,g){for(var x=(l.mode&1)!==0;Ke!==null;){var w=Ke,T=w.child;if(w.tag===22&&x){var Y=w.memoizedState!==null||gc;if(!Y){var ie=w.alternate,Ae=ie!==null&&ie.memoizedState!==null||bs;ie=gc;var Ve=bs;if(gc=Y,(bs=Ae)&&!Ve)for(Ke=w;Ke!==null;)Y=Ke,Ae=Y.child,Y.tag===22&&Y.memoizedState!==null?mg(w):Ae!==null?(Ae.return=Y,Ke=Ae):mg(w);for(;T!==null;)Ke=T,fg(T),T=T.sibling;Ke=w,gc=ie,bs=Ve}dg(l)}else w.subtreeFlags&8772&&T!==null?(T.return=w,Ke=T):dg(l)}}function dg(l){for(;Ke!==null;){var u=Ke;if(u.flags&8772){var g=u.alternate;try{if(u.flags&8772)switch(u.tag){case 0:case 11:case 15:bs||Ba(5,u);break;case 1:var x=u.stateNode;if(u.flags&4&&!bs)if(g===null)x.componentDidMount();else{var w=u.elementType===u.type?g.memoizedProps:Qn(u.type,g.memoizedProps);x.componentDidUpdate(w,g.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var T=u.updateQueue;T!==null&&am(u,T,x);break;case 3:var Y=u.updateQueue;if(Y!==null){if(g=null,u.child!==null)switch(u.child.tag){case 5:g=K(u.child.stateNode);break;case 1:g=u.child.stateNode}am(u,Y,g)}break;case 5:var ie=u.stateNode;g===null&&u.flags&4&&it(ie,u.type,u.memoizedProps,u);break;case 6:break;case 4:break;case 12:break;case 13:if(Me&&u.memoizedState===null){var Ae=u.alternate;if(Ae!==null){var Ve=Ae.memoizedState;if(Ve!==null){var nt=Ve.dehydrated;nt!==null&&_e(nt)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}bs||u.flags&512&&Kh(u)}catch(xt){hi(u,u.return,xt)}}if(u===l){Ke=null;break}if(g=u.sibling,g!==null){g.return=u.return,Ke=g;break}Ke=u.return}}function pg(l){for(;Ke!==null;){var u=Ke;if(u===l){Ke=null;break}var g=u.sibling;if(g!==null){g.return=u.return,Ke=g;break}Ke=u.return}}function mg(l){for(;Ke!==null;){var u=Ke;try{switch(u.tag){case 0:case 11:case 15:var g=u.return;try{Ba(4,u)}catch(Ae){hi(u,g,Ae)}break;case 1:var x=u.stateNode;if(typeof x.componentDidMount=="function"){var w=u.return;try{x.componentDidMount()}catch(Ae){hi(u,w,Ae)}}var T=u.return;try{Kh(u)}catch(Ae){hi(u,T,Ae)}break;case 5:var Y=u.return;try{Kh(u)}catch(Ae){hi(u,Y,Ae)}}}catch(Ae){hi(u,u.return,Ae)}if(u===l){Ke=null;break}var ie=u.sibling;if(ie!==null){ie.return=u.return,Ke=ie;break}Ke=u.return}}var yc=0,xc=1,Sc=2,Mc=3,Ec=4;if(typeof Symbol=="function"&&Symbol.for){var ka=Symbol.for;yc=ka("selector.component"),xc=ka("selector.has_pseudo_class"),Sc=ka("selector.role"),Mc=ka("selector.test_id"),Ec=ka("selector.text")}function tf(l){var u=ue(l);if(u!=null){if(typeof u.memoizedProps["data-testname"]!="string")throw Error(o(364));return u}if(l=X(l),l===null)throw Error(o(362));return l.stateNode.current}function nf(l,u){switch(u.$$typeof){case yc:if(l.type===u.value)return!0;break;case xc:e:{u=u.value,l=[l,0];for(var g=0;g<l.length;){var x=l[g++],w=l[g++],T=u[w];if(x.tag!==5||!he(x)){for(;T!=null&&nf(x,T);)w++,T=u[w];if(w===u.length){u=!0;break e}else for(x=x.child;x!==null;)l.push(x,w),x=x.sibling}}u=!1}return u;case Sc:if(l.tag===5&&Te(l.stateNode,u.value))return!0;break;case Ec:if((l.tag===5||l.tag===6)&&(l=ce(l),l!==null&&0<=l.indexOf(u.value)))return!0;break;case Mc:if(l.tag===5&&(l=l.memoizedProps["data-testname"],typeof l=="string"&&l.toLowerCase()===u.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function rf(l){switch(l.$$typeof){case yc:return"<"+(L(l.value)||"Unknown")+">";case xc:return":has("+(rf(l)||"")+")";case Sc:return'[role="'+l.value+'"]';case Ec:return'"'+l.value+'"';case Mc:return'[data-testname="'+l.value+'"]';default:throw Error(o(365))}}function gg(l,u){var g=[];l=[l,0];for(var x=0;x<l.length;){var w=l[x++],T=l[x++],Y=u[T];if(w.tag!==5||!he(w)){for(;Y!=null&&nf(w,Y);)T++,Y=u[T];if(T===u.length)g.push(w);else for(w=w.child;w!==null;)l.push(w,T),w=w.sibling}}return g}function sf(l,u){if(!I)throw Error(o(363));l=tf(l),l=gg(l,u),u=[],l=Array.from(l);for(var g=0;g<l.length;){var x=l[g++];if(x.tag===5)he(x)||u.push(x.stateNode);else for(x=x.child;x!==null;)l.push(x),x=x.sibling}return u}var Vx=Math.ceil,wc=a.ReactCurrentDispatcher,of=a.ReactCurrentOwner,cn=a.ReactCurrentBatchConfig,Rt=0,mn=null,gn=null,In=0,wi=0,wo=qt(0),_n=0,za=null,bo=0,bc=0,af=0,Ga=null,ci=null,lf=0,cf=1/0;function To(){cf=Zt()+500}var Tc=!1,uf=null,Vr=null,Ac=!1,Wr=null,Cc=0,Ha=0,hf=null,Rc=-1,Pc=0;function ti(){return Rt&6?Zt():Rc!==-1?Rc:Rc=Zt()}function Xr(l){return l.mode&1?Rt&2&&In!==0?In&-In:ys.transition!==null?(Pc===0&&(l=hr,hr<<=1,!(hr&4194240)&&(hr=64),Pc=l),Pc):(l=Pt,l!==0?l:oe()):1}function Ni(l,u,g){if(50<Ha)throw Ha=0,hf=null,Error(o(185));var x=Lc(l,u);return x===null?null:(Qi(x,u,g),(!(Rt&2)||x!==mn)&&(x===mn&&(!(Rt&2)&&(bc|=u),_n===4&&Yr(x,In)),ui(x,g),u===1&&Rt===0&&!(l.mode&1)&&(To(),er&&li())),x)}function Lc(l,u){l.lanes|=u;var g=l.alternate;for(g!==null&&(g.lanes|=u),g=l,l=l.return;l!==null;)l.childLanes|=u,g=l.alternate,g!==null&&(g.childLanes|=u),g=l,l=l.return;return g.tag===3?g.stateNode:null}function ui(l,u){var g=l.callbackNode;ya(l,u);var x=gs(l,l===mn?In:0);if(x===0)g!==null&&po(g),l.callbackNode=null,l.callbackPriority=0;else if(u=x&-x,l.callbackPriority!==u){if(g!=null&&po(g),u===1)l.tag===0?ba(_g.bind(null,l)):wa(_g.bind(null,l)),fe?U(function(){Rt===0&&li()}):mr(vs,li),g=null;else{switch(xa(x)){case 1:g=vs;break;case 4:g=ql;break;case 16:g=Jn;break;case 536870912:g=Ma;break;default:g=Jn}g=Ag(g,vg.bind(null,l))}l.callbackPriority=u,l.callbackNode=g}}function vg(l,u){if(Rc=-1,Pc=0,Rt&6)throw Error(o(327));var g=l.callbackNode;if(Rs()&&l.callbackNode!==g)return null;var x=gs(l,l===mn?In:0);if(x===0)return null;if(x&30||x&l.expiredLanes||u)u=Ic(l,x);else{u=x;var w=Rt;Rt|=2;var T=Sg();(mn!==l||In!==u)&&(To(),As(l,u));do try{Yx();break}catch(ie){xg(l,ie)}while(!0);go(),wc.current=T,Rt=w,gn!==null?u=0:(mn=null,In=0,u=_n)}if(u!==0){if(u===2&&(w=pr(l),w!==0&&(x=w,u=ff(l,w))),u===1)throw g=za,As(l,0),Yr(l,x),ui(l,Zt()),g;if(u===6)Yr(l,x);else{if(w=l.current.alternate,!(x&30)&&!Wx(w)&&(u=Ic(l,x),u===2&&(T=pr(l),T!==0&&(x=T,u=ff(l,T))),u===1))throw g=za,As(l,0),Yr(l,x),ui(l,Zt()),g;switch(l.finishedWork=w,l.finishedLanes=x,u){case 0:case 1:throw Error(o(345));case 2:Cs(l,ci);break;case 3:if(Yr(l,x),(x&130023424)===x&&(u=lf+500-Zt(),10<u)){if(gs(l,0)!==0)break;if(w=l.suspendedLanes,(w&x)!==x){ti(),l.pingedLanes|=l.suspendedLanes&w;break}l.timeoutHandle=ne(Cs.bind(null,l,ci),u);break}Cs(l,ci);break;case 4:if(Yr(l,x),(x&4194240)===x)break;for(u=l.eventTimes,w=-1;0<x;){var Y=31-Zn(x);T=1<<Y,Y=u[Y],Y>w&&(w=Y),x&=~T}if(x=w,x=Zt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*Vx(x/1960))-x,10<x){l.timeoutHandle=ne(Cs.bind(null,l,ci),x);break}Cs(l,ci);break;case 5:Cs(l,ci);break;default:throw Error(o(329))}}}return ui(l,Zt()),l.callbackNode===g?vg.bind(null,l):null}function ff(l,u){var g=Ga;return l.current.memoizedState.isDehydrated&&(As(l,u).flags|=256),l=Ic(l,u),l!==2&&(u=ci,ci=g,u!==null&&df(u)),l}function df(l){ci===null?ci=l:ci.push.apply(ci,l)}function Wx(l){for(var u=l;;){if(u.flags&16384){var g=u.updateQueue;if(g!==null&&(g=g.stores,g!==null))for(var x=0;x<g.length;x++){var w=g[x],T=w.getSnapshot;w=w.value;try{if(!yi(T(),w))return!1}catch{return!1}}}if(g=u.child,u.subtreeFlags&16384&&g!==null)g.return=u,u=g;else{if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function Yr(l,u){for(u&=~af,u&=~bc,l.suspendedLanes|=u,l.pingedLanes&=~u,l=l.expirationTimes;0<u;){var g=31-Zn(u),x=1<<g;l[g]=-1,u&=~x}}function _g(l){if(Rt&6)throw Error(o(327));Rs();var u=gs(l,0);if(!(u&1))return ui(l,Zt()),null;var g=Ic(l,u);if(l.tag!==0&&g===2){var x=pr(l);x!==0&&(u=x,g=ff(l,x))}if(g===1)throw g=za,As(l,0),Yr(l,u),ui(l,Zt()),g;if(g===6)throw Error(o(345));return l.finishedWork=l.current.alternate,l.finishedLanes=u,Cs(l,ci),ui(l,Zt()),null}function yg(l){Wr!==null&&Wr.tag===0&&!(Rt&6)&&Rs();var u=Rt;Rt|=1;var g=cn.transition,x=Pt;try{if(cn.transition=null,Pt=1,l)return l()}finally{Pt=x,cn.transition=g,Rt=u,!(Rt&6)&&li()}}function pf(){wi=wo.current,ut(wo)}function As(l,u){l.finishedWork=null,l.finishedLanes=0;var g=l.timeoutHandle;if(g!==Ie&&(l.timeoutHandle=Ie,pe(g)),gn!==null)for(g=gn.return;g!==null;){var x=g;switch(Ph(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&Gt();break;case 3:Mo(),ut(Vt),ut(Mt),Oh();break;case 5:Nh(x);break;case 4:Mo();break;case 13:ut(Jt);break;case 19:ut(Jt);break;case 10:wn(x.type._context);break;case 22:case 23:pf()}g=g.return}if(mn=l,gn=l=jr(l.current,null),In=wi=u,_n=0,za=null,af=bc=bo=0,ci=Ga=null,xi!==null){for(u=0;u<xi.length;u++)if(g=xi[u],x=g.interleaved,x!==null){g.interleaved=null;var w=x.next,T=g.pending;if(T!==null){var Y=T.next;T.next=w,x.next=Y}g.pending=x}xi=null}return l}function xg(l,u){do{var g=gn;try{if(go(),rc.current=uc,sc){for(var x=en.memoizedState;x!==null;){var w=x.queue;w!==null&&(w.pending=null),x=x.next}sc=!1}if(Eo=0,bn=Fn=en=null,La=!1,Ia=0,of.current=null,g===null||g.return===null){_n=1,za=u,gn=null;break}e:{var T=l,Y=g.return,ie=g,Ae=u;if(u=In,ie.flags|=32768,Ae!==null&&typeof Ae=="object"&&typeof Ae.then=="function"){var Ve=Ae,nt=ie,xt=nt.tag;if(!(nt.mode&1)&&(xt===0||xt===11||xt===15)){var dt=nt.alternate;dt?(nt.updateQueue=dt.updateQueue,nt.memoizedState=dt.memoizedState,nt.lanes=dt.lanes):(nt.updateQueue=null,nt.memoizedState=null)}var Ht=Gm(Y);if(Ht!==null){Ht.flags&=-257,Hm(Ht,Y,ie,T,u),Ht.mode&1&&zm(T,Ve,u),u=Ht,Ae=Ve;var lt=u.updateQueue;if(lt===null){var kn=new Set;kn.add(Ae),u.updateQueue=kn}else lt.add(Ae);break e}else{if(!(u&1)){zm(T,Ve,u),mf();break e}Ae=Error(o(426))}}else if(jt&&ie.mode&1){var Oi=Gm(Y);if(Oi!==null){!(Oi.flags&65536)&&(Oi.flags|=256),Hm(Oi,Y,ie,T,u),Uh(Ae);break e}}T=Ae,_n!==4&&(_n=2),Ga===null?Ga=[T]:Ga.push(T),Ae=Wh(Ae,ie),ie=Y;do{switch(ie.tag){case 3:ie.flags|=65536,u&=-u,ie.lanes|=u;var me=Bm(ie,Ae,u);om(ie,me);break e;case 1:T=Ae;var se=ie.type,be=ie.stateNode;if(!(ie.flags&128)&&(typeof se.getDerivedStateFromError=="function"||be!==null&&typeof be.componentDidCatch=="function"&&(Vr===null||!Vr.has(be)))){ie.flags|=65536,u&=-u,ie.lanes|=u;var Qe=km(ie,T,u);om(ie,Qe);break e}}ie=ie.return}while(ie!==null)}Eg(g)}catch(at){u=at,gn===g&&g!==null&&(gn=g=g.return);continue}break}while(!0)}function Sg(){var l=wc.current;return wc.current=uc,l===null?uc:l}function mf(){(_n===0||_n===3||_n===2)&&(_n=4),mn===null||!(bo&268435455)&&!(bc&268435455)||Yr(mn,In)}function Ic(l,u){var g=Rt;Rt|=2;var x=Sg();mn===l&&In===u||As(l,u);do try{Xx();break}catch(w){xg(l,w)}while(!0);if(go(),Rt=g,wc.current=x,gn!==null)throw Error(o(261));return mn=null,In=0,_n}function Xx(){for(;gn!==null;)Mg(gn)}function Yx(){for(;gn!==null&&!Sa();)Mg(gn)}function Mg(l){var u=Tg(l.alternate,l,wi);l.memoizedProps=l.pendingProps,u===null?Eg(l):gn=u,of.current=null}function Eg(l){var u=l;do{var g=u.alternate;if(l=u.return,u.flags&32768){if(g=Bx(g,u),g!==null){g.flags&=32767,gn=g;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{_n=6,gn=null;return}}else if(g=Nx(g,u,wi),g!==null){gn=g;return}if(u=u.sibling,u!==null){gn=u;return}gn=u=l}while(u!==null);_n===0&&(_n=5)}function Cs(l,u){var g=Pt,x=cn.transition;try{cn.transition=null,Pt=1,jx(l,u,g)}finally{cn.transition=x,Pt=g}return null}function jx(l,u,g){do Rs();while(Wr!==null);if(Rt&6)throw Error(o(327));var x=l.finishedWork,w=l.finishedLanes;if(x===null)return null;if(l.finishedWork=null,l.finishedLanes=0,x===l.current)throw Error(o(177));l.callbackNode=null,l.callbackPriority=0;var T=x.lanes|x.childLanes;if(kr(l,T),l===mn&&(gn=mn=null,In=0),!(x.subtreeFlags&2064)&&!(x.flags&2064)||Ac||(Ac=!0,Ag(Jn,function(){return Rs(),null})),T=(x.flags&15990)!==0,x.subtreeFlags&15990||T){T=cn.transition,cn.transition=null;var Y=Pt;Pt=1;var ie=Rt;Rt|=4,of.current=null,zx(l,x),Gx(l,x),V(l.containerInfo),l.current=x,Hx(x),jl(),Rt=ie,Pt=Y,cn.transition=T}else l.current=x;if(Ac&&(Ac=!1,Wr=l,Cc=w),T=l.pendingLanes,T===0&&(Vr=null),Ea(x.stateNode),ui(l,Zt()),u!==null)for(g=l.onRecoverableError,x=0;x<u.length;x++)g(u[x]);if(Tc)throw Tc=!1,l=uf,uf=null,l;return Cc&1&&l.tag!==0&&Rs(),T=l.pendingLanes,T&1?l===hf?Ha++:(Ha=0,hf=l):Ha=0,li(),null}function Rs(){if(Wr!==null){var l=xa(Cc),u=cn.transition,g=Pt;try{if(cn.transition=null,Pt=16>l?16:l,Wr===null)var x=!1;else{if(l=Wr,Wr=null,Cc=0,Rt&6)throw Error(o(331));var w=Rt;for(Rt|=4,Ke=l.current;Ke!==null;){var T=Ke,Y=T.child;if(Ke.flags&16){var ie=T.deletions;if(ie!==null){for(var Ae=0;Ae<ie.length;Ae++){var Ve=ie[Ae];for(Ke=Ve;Ke!==null;){var nt=Ke;switch(nt.tag){case 0:case 11:case 15:Ts(8,nt,T)}var xt=nt.child;if(xt!==null)xt.return=nt,Ke=xt;else for(;Ke!==null;){nt=Ke;var dt=nt.sibling,Ht=nt.return;if(ag(nt),nt===Ve){Ke=null;break}if(dt!==null){dt.return=Ht,Ke=dt;break}Ke=Ht}}}var lt=T.alternate;if(lt!==null){var kn=lt.child;if(kn!==null){lt.child=null;do{var Oi=kn.sibling;kn.sibling=null,kn=Oi}while(kn!==null)}}Ke=T}}if(T.subtreeFlags&2064&&Y!==null)Y.return=T,Ke=Y;else e:for(;Ke!==null;){if(T=Ke,T.flags&2048)switch(T.tag){case 0:case 11:case 15:Ts(9,T,T.return)}var me=T.sibling;if(me!==null){me.return=T.return,Ke=me;break e}Ke=T.return}}var se=l.current;for(Ke=se;Ke!==null;){Y=Ke;var be=Y.child;if(Y.subtreeFlags&2064&&be!==null)be.return=Y,Ke=be;else e:for(Y=se;Ke!==null;){if(ie=Ke,ie.flags&2048)try{switch(ie.tag){case 0:case 11:case 15:Ba(9,ie)}}catch(at){hi(ie,ie.return,at)}if(ie===Y){Ke=null;break e}var Qe=ie.sibling;if(Qe!==null){Qe.return=ie.return,Ke=Qe;break e}Ke=ie.return}}if(Rt=w,li(),_i&&typeof _i.onPostCommitFiberRoot=="function")try{_i.onPostCommitFiberRoot(_s,l)}catch{}x=!0}return x}finally{Pt=g,cn.transition=u}}return!1}function wg(l,u,g){u=Wh(g,u),u=Bm(l,u,1),Hr(l,u),u=ti(),l=Lc(l,1),l!==null&&(Qi(l,1,u),ui(l,u))}function hi(l,u,g){if(l.tag===3)wg(l,l,g);else for(;u!==null;){if(u.tag===3){wg(u,l,g);break}else if(u.tag===1){var x=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(Vr===null||!Vr.has(x))){l=Wh(g,l),l=km(u,l,1),Hr(u,l),l=ti(),u=Lc(u,1),u!==null&&(Qi(u,1,l),ui(u,l));break}}u=u.return}}function qx(l,u,g){var x=l.pingCache;x!==null&&x.delete(u),u=ti(),l.pingedLanes|=l.suspendedLanes&g,mn===l&&(In&g)===g&&(_n===4||_n===3&&(In&130023424)===In&&500>Zt()-lf?As(l,0):af|=g),ui(l,u)}function bg(l,u){u===0&&(l.mode&1?(u=fr,fr<<=1,!(fr&130023424)&&(fr=4194304)):u=1);var g=ti();l=Lc(l,u),l!==null&&(Qi(l,u,g),ui(l,g))}function Zx(l){var u=l.memoizedState,g=0;u!==null&&(g=u.retryLane),bg(l,g)}function Jx(l,u){var g=0;switch(l.tag){case 13:var x=l.stateNode,w=l.memoizedState;w!==null&&(g=w.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(o(314))}x!==null&&x.delete(u),bg(l,g)}var Tg;Tg=function(l,u,g){if(l!==null)if(l.memoizedProps!==u.pendingProps||Vt.current)Ei=!0;else{if(!(l.lanes&g)&&!(u.flags&128))return Ei=!1,Ox(l,u,g);Ei=!!(l.flags&131072)}else Ei=!1,jt&&u.flags&1048576&&fm(u,tc,u.index);switch(u.lanes=0,u.tag){case 2:var x=u.type;l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2),l=u.pendingProps;var w=Mn(u,Mt.current);an(u,g),w=kh(null,u,x,l,w,g);var T=zh();return u.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,$t(x)?(T=!0,on(u)):T=!1,u.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Th(u),w.updater=$l,u.stateNode=w,w._reactInternals=u,Ch(u,x,l,g),u=jh(null,u,x,!0,T,g)):(u.tag=0,jt&&T&&Rh(u),ei(null,u,w,g),u=u.child),u;case 16:x=u.elementType;e:{switch(l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2),l=u.pendingProps,w=x._init,x=w(x._payload),u.type=x,w=u.tag=Qx(x),l=Qn(x,l),w){case 0:u=Yh(null,u,x,l,g);break e;case 1:u=Jm(null,u,x,l,g);break e;case 11:u=Xm(null,u,x,l,g);break e;case 14:u=Ym(null,u,x,Qn(x.type,l),g);break e}throw Error(o(306,x,""))}return u;case 0:return x=u.type,w=u.pendingProps,w=u.elementType===x?w:Qn(x,w),Yh(l,u,x,w,g);case 1:return x=u.type,w=u.pendingProps,w=u.elementType===x?w:Qn(x,w),Jm(l,u,x,w,g);case 3:e:{if(Km(u),l===null)throw Error(o(387));x=u.pendingProps,T=u.memoizedState,w=T.element,sm(l,u),Ql(u,x,null,g);var Y=u.memoizedState;if(x=Y.element,Me&&T.isDehydrated)if(T={element:x,isDehydrated:!1,cache:Y.cache,transitions:Y.transitions},u.updateQueue.baseState=T,u.memoizedState=T,u.flags&256){w=Error(o(423)),u=Qm(l,u,x,g,w);break e}else if(x!==w){w=Error(o(424)),u=Qm(l,u,x,g,w);break e}else for(Me&&(Mi=dn(u.stateNode.containerInfo),Si=u,jt=!0,zi=null,Ta=!1),g=_m(u,null,x,g),u.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(yo(),x===w){u=xr(l,u,g);break e}ei(l,u,x,g)}u=u.child}return u;case 5:return ym(u),l===null&&Ih(u),x=u.type,w=u.pendingProps,T=l!==null?l.memoizedProps:null,Y=w.children,te(x,w)?Y=null:T!==null&&te(x,T)&&(u.flags|=32),Zm(l,u),ei(l,u,Y,g),u.child;case 6:return l===null&&Ih(u),null;case 13:return $m(l,u,g);case 4:return Dh(u,u.stateNode.containerInfo),x=u.pendingProps,l===null?u.child=xo(u,null,x,g):ei(l,u,x,g),u.child;case 11:return x=u.type,w=u.pendingProps,w=u.elementType===x?w:Qn(x,w),Xm(l,u,x,w,g);case 7:return ei(l,u,u.pendingProps,g),u.child;case 8:return ei(l,u,u.pendingProps.children,g),u.child;case 12:return ei(l,u,u.pendingProps.children,g),u.child;case 10:e:{if(x=u.type._context,w=u.pendingProps,T=u.memoizedProps,Y=w.value,Jl(u,x,Y),T!==null)if(yi(T.value,Y)){if(T.children===w.children&&!Vt.current){u=xr(l,u,g);break e}}else for(T=u.child,T!==null&&(T.return=u);T!==null;){var ie=T.dependencies;if(ie!==null){Y=T.child;for(var Ae=ie.firstContext;Ae!==null;){if(Ae.context===x){if(T.tag===1){Ae=gr(-1,g&-g),Ae.tag=2;var Ve=T.updateQueue;if(Ve!==null){Ve=Ve.shared;var nt=Ve.pending;nt===null?Ae.next=Ae:(Ae.next=nt.next,nt.next=Ae),Ve.pending=Ae}}T.lanes|=g,Ae=T.alternate,Ae!==null&&(Ae.lanes|=g),$n(T.return,g,u),ie.lanes|=g;break}Ae=Ae.next}}else if(T.tag===10)Y=T.type===u.type?null:T.child;else if(T.tag===18){if(Y=T.return,Y===null)throw Error(o(341));Y.lanes|=g,ie=Y.alternate,ie!==null&&(ie.lanes|=g),$n(Y,g,u),Y=T.sibling}else Y=T.child;if(Y!==null)Y.return=T;else for(Y=T;Y!==null;){if(Y===u){Y=null;break}if(T=Y.sibling,T!==null){T.return=Y.return,Y=T;break}Y=Y.return}T=Y}ei(l,u,w.children,g),u=u.child}return u;case 9:return w=u.type,x=u.pendingProps.children,an(u,g),w=ln(w),x=x(w),u.flags|=1,ei(l,u,x,g),u.child;case 14:return x=u.type,w=Qn(x,u.pendingProps),w=Qn(x.type,w),Ym(l,u,x,w,g);case 15:return jm(l,u,u.type,u.pendingProps,g);case 17:return x=u.type,w=u.pendingProps,w=u.elementType===x?w:Qn(x,w),l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2),u.tag=1,$t(x)?(l=!0,on(u)):l=!1,an(u,g),um(u,x,w),Ch(u,x,w,g),jh(null,u,x,!0,l,g);case 19:return ig(l,u,g);case 22:return qm(l,u,g)}throw Error(o(156,u.tag))};function Ag(l,u){return mr(l,u)}function Kx(l,u,g,x){this.tag=l,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fi(l,u,g,x){return new Kx(l,u,g,x)}function gf(l){return l=l.prototype,!(!l||!l.isReactComponent)}function Qx(l){if(typeof l=="function")return gf(l)?1:0;if(l!=null){if(l=l.$$typeof,l===S)return 11;if(l===E)return 14}return 2}function jr(l,u){var g=l.alternate;return g===null?(g=Fi(l.tag,u,l.key,l.mode),g.elementType=l.elementType,g.type=l.type,g.stateNode=l.stateNode,g.alternate=l,l.alternate=g):(g.pendingProps=u,g.type=l.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=l.flags&14680064,g.childLanes=l.childLanes,g.lanes=l.lanes,g.child=l.child,g.memoizedProps=l.memoizedProps,g.memoizedState=l.memoizedState,g.updateQueue=l.updateQueue,u=l.dependencies,g.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},g.sibling=l.sibling,g.index=l.index,g.ref=l.ref,g}function Uc(l,u,g,x,w,T){var Y=2;if(x=l,typeof l=="function")gf(l)&&(Y=1);else if(typeof l=="string")Y=5;else e:switch(l){case f:return Ps(g.children,w,T,u);case d:Y=8,w|=8;break;case p:return l=Fi(12,g,u,w|2),l.elementType=p,l.lanes=T,l;case y:return l=Fi(13,g,u,w),l.elementType=y,l.lanes=T,l;case _:return l=Fi(19,g,u,w),l.elementType=_,l.lanes=T,l;case b:return Dc(g,w,T,u);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case m:Y=10;break e;case v:Y=9;break e;case S:Y=11;break e;case E:Y=14;break e;case M:Y=16,x=null;break e}throw Error(o(130,l==null?l:typeof l,""))}return u=Fi(Y,g,u,w),u.elementType=l,u.type=x,u.lanes=T,u}function Ps(l,u,g,x){return l=Fi(7,l,x,u),l.lanes=g,l}function Dc(l,u,g,x){return l=Fi(22,l,x,u),l.elementType=b,l.lanes=g,l.stateNode={},l}function vf(l,u,g){return l=Fi(6,l,null,u),l.lanes=g,l}function _f(l,u,g){return u=Fi(4,l.children!==null?l.children:[],l.key,u),u.lanes=g,u.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},u}function $x(l,u,g,x,w){this.tag=u,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ie,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=fo(0),this.expirationTimes=fo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fo(0),this.identifierPrefix=x,this.onRecoverableError=w,Me&&(this.mutableSourceEagerHydrationData=null)}function Cg(l,u,g,x,w,T,Y,ie,Ae){return l=new $x(l,u,g,ie,Ae),u===1?(u=1,T===!0&&(u|=8)):u=0,T=Fi(3,null,null,u),l.current=T,T.stateNode=l,T.memoizedState={element:x,isDehydrated:g,cache:null,transitions:null},Th(T),l}function Rg(l){if(!l)return Pn;l=l._reactInternals;e:{if(A(l)!==l||l.tag!==1)throw Error(o(170));var u=l;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if($t(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(o(171))}if(l.tag===1){var g=l.type;if($t(g))return Ki(l,g,u)}return u}function Pg(l){var u=l._reactInternals;if(u===void 0)throw typeof l.render=="function"?Error(o(188)):(l=Object.keys(l).join(","),Error(o(268,l)));return l=B(u),l===null?null:l.stateNode}function Lg(l,u){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var g=l.retryLane;l.retryLane=g!==0&&g<u?g:u}}function yf(l,u){Lg(l,u),(l=l.alternate)&&Lg(l,u)}function e1(l){return l=B(l),l===null?null:l.stateNode}function t1(){return null}return t.attemptContinuousHydration=function(l){if(l.tag===13){var u=ti();Ni(l,134217728,u),yf(l,134217728)}},t.attemptHydrationAtCurrentPriority=function(l){if(l.tag===13){var u=ti(),g=Xr(l);Ni(l,g,u),yf(l,g)}},t.attemptSynchronousHydration=function(l){switch(l.tag){case 3:var u=l.stateNode;if(u.current.memoizedState.isDehydrated){var g=dr(u.pendingLanes);g!==0&&($i(u,g|1),ui(u,Zt()),!(Rt&6)&&(To(),li()))}break;case 13:var x=ti();yg(function(){return Ni(l,1,x)}),yf(l,1)}},t.batchedUpdates=function(l,u){var g=Rt;Rt|=1;try{return l(u)}finally{Rt=g,Rt===0&&(To(),er&&li())}},t.createComponentSelector=function(l){return{$$typeof:yc,value:l}},t.createContainer=function(l,u,g,x,w,T,Y){return Cg(l,u,!1,null,g,x,w,T,Y)},t.createHasPseudoClassSelector=function(l){return{$$typeof:xc,value:l}},t.createHydrationContainer=function(l,u,g,x,w,T,Y,ie,Ae){return l=Cg(g,x,!0,l,w,T,Y,ie,Ae),l.context=Rg(null),g=l.current,x=ti(),w=Xr(g),T=gr(x,w),T.callback=u??null,Hr(g,T),l.current.lanes=w,Qi(l,w,x),ui(l,x),l},t.createPortal=function(l,u,g){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:x==null?null:""+x,children:l,containerInfo:u,implementation:g}},t.createRoleSelector=function(l){return{$$typeof:Sc,value:l}},t.createTestNameSelector=function(l){return{$$typeof:Mc,value:l}},t.createTextSelector=function(l){return{$$typeof:Ec,value:l}},t.deferredUpdates=function(l){var u=Pt,g=cn.transition;try{return cn.transition=null,Pt=16,l()}finally{Pt=u,cn.transition=g}},t.discreteUpdates=function(l,u,g,x,w){var T=Pt,Y=cn.transition;try{return cn.transition=null,Pt=1,l(u,g,x,w)}finally{Pt=T,cn.transition=Y,Rt===0&&To()}},t.findAllNodes=sf,t.findBoundingRects=function(l,u){if(!I)throw Error(o(363));u=sf(l,u),l=[];for(var g=0;g<u.length;g++)l.push(ye(u[g]));for(u=l.length-1;0<u;u--){g=l[u];for(var x=g.x,w=x+g.width,T=g.y,Y=T+g.height,ie=u-1;0<=ie;ie--)if(u!==ie){var Ae=l[ie],Ve=Ae.x,nt=Ve+Ae.width,xt=Ae.y,dt=xt+Ae.height;if(x>=Ve&&T>=xt&&w<=nt&&Y<=dt){l.splice(u,1);break}else if(x!==Ve||g.width!==Ae.width||dt<T||xt>Y){if(!(T!==xt||g.height!==Ae.height||nt<x||Ve>w)){Ve>x&&(Ae.width+=Ve-x,Ae.x=x),nt<w&&(Ae.width=w-Ve),l.splice(u,1);break}}else{xt>T&&(Ae.height+=xt-T,Ae.y=T),dt<Y&&(Ae.height=Y-xt),l.splice(u,1);break}}}return l},t.findHostInstance=Pg,t.findHostInstanceWithNoPortals=function(l){return l=k(l),l=l!==null?N(l):null,l===null?null:l.stateNode},t.findHostInstanceWithWarning=function(l){return Pg(l)},t.flushControlled=function(l){var u=Rt;Rt|=1;var g=cn.transition,x=Pt;try{cn.transition=null,Pt=1,l()}finally{Pt=x,cn.transition=g,Rt=u,Rt===0&&(To(),li())}},t.flushPassiveEffects=Rs,t.flushSync=yg,t.focusWithin=function(l,u){if(!I)throw Error(o(363));for(l=tf(l),u=gg(l,u),u=Array.from(u),l=0;l<u.length;){var g=u[l++];if(!he(g)){if(g.tag===5&&Ne(g.stateNode))return!0;for(g=g.child;g!==null;)u.push(g),g=g.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Pt},t.getFindAllNodesFailureDescription=function(l,u){if(!I)throw Error(o(363));var g=0,x=[];l=[tf(l),0];for(var w=0;w<l.length;){var T=l[w++],Y=l[w++],ie=u[Y];if((T.tag!==5||!he(T))&&(nf(T,ie)&&(x.push(rf(ie)),Y++,Y>g&&(g=Y)),Y<u.length))for(T=T.child;T!==null;)l.push(T,Y),T=T.sibling}if(g<u.length){for(l=[];g<u.length;g++)l.push(rf(u[g]));return`findAllNodes was able to match part of the selector: 3717 `+(x.join(" > ")+` 3718 3719No matching component was found for: 3720 `)+l.join(" > ")}return null},t.getPublicRootInstance=function(l){if(l=l.current,!l.child)return null;switch(l.child.tag){case 5:return K(l.child.stateNode);default:return l.child.stateNode}},t.injectIntoDevTools=function(l){if(l={bundleType:l.bundleType,version:l.version,rendererPackageName:l.rendererPackageName,rendererConfig:l.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:e1,findFiberByHostInstance:l.findFiberByHostInstance||t1,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")l=!1;else{var u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(u.isDisabled||!u.supportsFiber)l=!0;else{try{_s=u.inject(l),_i=u}catch{}l=!!u.checkDCE}}return l},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(l,u,g,x){if(!I)throw Error(o(363));l=sf(l,u);var w=Ce(l,g,x).disconnect;return{disconnect:function(){w()}}},t.registerMutableSourceForHydration=function(l,u){var g=u._getVersion;g=g(u._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[u,g]:l.mutableSourceEagerHydrationData.push(u,g)},t.runWithPriority=function(l,u){var g=Pt;try{return Pt=l,u()}finally{Pt=g}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(l,u,g,x){var w=u.current,T=ti(),Y=Xr(w);return g=Rg(g),u.context===null?u.context=g:u.pendingContext=g,u=gr(T,Y),u.payload={element:l},x=x===void 0?null:x,x!==null&&(u.callback=x),Hr(w,u),l=Ni(w,Y,T),l!==null&&Kl(l,w,Y),Y},t};Jy.exports=i2;var r2=Jy.exports;const s2=i1(r2),tm={},o2=s=>void Object.assign(tm,s);function a2(s,e){function t(f,{args:d=[],attach:p,...m},v){let S=`${f[0].toUpperCase()}${f.slice(1)}`,y;if(f==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const _=m.object;y=Ko(_,{type:f,root:v,attach:p,primitive:!0})}else{const _=tm[S];if(!_)throw new Error(`R3F: ${S} 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(d))throw new Error("R3F: The args prop must be an array!");y=Ko(new _(...d),{type:f,root:v,attach:p,memoizedProps:{args:d}})}return y.__r3f.attach===void 0&&(y.isBufferGeometry?y.__r3f.attach="geometry":y.isMaterial&&(y.__r3f.attach="material")),S!=="inject"&&sd(y,m),y}function n(f,d){let p=!1;if(d){var m,v;(m=d.__r3f)!=null&&m.attach?rd(f,d,d.__r3f.attach):d.isObject3D&&f.isObject3D&&(f.add(d),p=!0),p||(v=f.__r3f)==null||v.objects.push(d),d.__r3f||Ko(d,{}),d.__r3f.parent=f,op(d),Qo(d)}}function i(f,d,p){let m=!1;if(d){var v,S;if((v=d.__r3f)!=null&&v.attach)rd(f,d,d.__r3f.attach);else if(d.isObject3D&&f.isObject3D){d.parent=f,d.dispatchEvent({type:"added"}),f.dispatchEvent({type:"childadded",child:d});const y=f.children.filter(E=>E!==d),_=y.indexOf(p);f.children=[...y.slice(0,_),d,...y.slice(_)],m=!0}m||(S=f.__r3f)==null||S.objects.push(d),d.__r3f||Ko(d,{}),d.__r3f.parent=f,op(d),Qo(d)}}function r(f,d,p=!1){f&&[...f].forEach(m=>o(d,m,p))}function o(f,d,p){if(d){var m,v,S;if(d.__r3f&&(d.__r3f.parent=null),(m=f.__r3f)!=null&&m.objects&&(f.__r3f.objects=f.__r3f.objects.filter(b=>b!==d)),(v=d.__r3f)!=null&&v.attach)fv(f,d,d.__r3f.attach);else if(d.isObject3D&&f.isObject3D){var y;f.remove(d),(y=d.__r3f)!=null&&y.root&&m2(zu(d),d)}const E=(S=d.__r3f)==null?void 0:S.primitive,M=!E&&(p===void 0?d.dispose!==null:p);if(!E){var _;r((_=d.__r3f)==null?void 0:_.objects,d,M),r(d.children,d,M)}if(delete d.__r3f,M&&d.dispose&&d.type!=="Scene"){const b=()=>{try{d.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?rp.unstable_scheduleCallback(rp.unstable_IdlePriority,b):b()}Qo(f)}}function a(f,d,p,m){var v;const S=(v=f.__r3f)==null?void 0:v.parent;if(!S)return;const y=t(d,p,f.__r3f.root);if(f.children){for(const _ of f.children)_.__r3f&&n(y,_);f.children=f.children.filter(_=>!_.__r3f)}f.__r3f.objects.forEach(_=>n(y,_)),f.__r3f.objects=[],f.__r3f.autoRemovedBeforeAppend||o(S,f),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),n(S,y),y.raycast&&y.__r3f.eventCount&&zu(y).getState().internal.interaction.push(y),[m,m.alternate].forEach(_=>{_!==null&&(_.stateNode=y,_.ref&&(typeof _.ref=="function"?_.ref(y):_.ref.current=y))})}const c=()=>{};return{reconciler:s2({createInstance:t,removeChild:o,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(f,d)=>{if(!d)return;const p=f.getState().scene;p.__r3f&&(p.__r3f.root=f,n(p,d))},removeChildFromContainer:(f,d)=>{d&&o(f.getState().scene,d)},insertInContainerBefore:(f,d,p)=>{if(!d||!p)return;const m=f.getState().scene;m.__r3f&&i(m,d,p)},getRootHostContext:()=>null,getChildHostContext:f=>f,finalizeInitialChildren(f){var d;return!!((d=f==null?void 0:f.__r3f)!=null?d:{}).handlers},prepareUpdate(f,d,p,m){var v;if(((v=f==null?void 0:f.__r3f)!=null?v:{}).primitive&&m.object&&m.object!==f)return[!0];{const{args:y=[],children:_,...E}=m,{args:M=[],children:b,...P}=p;if(!Array.isArray(y))throw new Error("R3F: the args prop must be an array!");if(y.some((L,D)=>L!==M[D]))return[!0];const R=sx(f,E,P,!0);return R.changes.length?[!1,R]:null}},commitUpdate(f,[d,p],m,v,S,y){d?a(f,m,S,y):sd(f,p)},commitMount(f,d,p,m){var v;const S=(v=f.__r3f)!=null?v:{};f.raycast&&S.handlers&&S.eventCount&&zu(f).getState().internal.interaction.push(f)},getPublicInstance:f=>f,prepareForCommit:()=>null,preparePortalMount:f=>Ko(f.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(f){var d;const{attach:p,parent:m}=(d=f.__r3f)!=null?d:{};p&&m&&fv(m,f,p),f.isObject3D&&(f.visible=!1),Qo(f)},unhideInstance(f,d){var p;const{attach:m,parent:v}=(p=f.__r3f)!=null?p:{};m&&v&&rd(v,f,m),(f.isObject3D&&d.visible==null||d.visible)&&(f.visible=!0),Qo(f)},createTextInstance:c,hideTextInstance:c,unhideTextInstance:c,getCurrentEventPriority:()=>e?e():sa.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Xt.fun(performance.now)?performance.now:Xt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Xt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Xt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:sd}}var lv,cv;const id=s=>"colorSpace"in s||"outputColorSpace"in s,$y=()=>{var s;return(s=tm.ColorManagement)!=null?s:null},ex=s=>s&&s.isOrthographicCamera,l2=s=>s&&s.hasOwnProperty("current"),Wl=typeof window<"u"&&((lv=window.document)!=null&&lv.createElement||((cv=window.navigator)==null?void 0:cv.product)==="ReactNative")?Ye.useLayoutEffect:Ye.useEffect;function tx(s){const e=Ye.useRef(s);return Wl(()=>void(e.current=s),[s]),e}function c2({set:s}){return Wl(()=>(s(new Promise(()=>null)),()=>s(!1)),[s]),null}class nx extends Ye.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}nx.getDerivedStateFromError=()=>({error:!0});const ix="__default",uv=new Map,u2=s=>s&&!!s.memoized&&!!s.changes;function rx(s){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(s)?Math.min(Math.max(s[0],t),s[1]):s}const el=s=>{var e;return(e=s.__r3f)==null?void 0:e.root.getState()};function zu(s){let e=s.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const Xt={obj:s=>s===Object(s)&&!Xt.arr(s)&&typeof s!="function",fun:s=>typeof s=="function",str:s=>typeof s=="string",num:s=>typeof s=="number",boo:s=>typeof s=="boolean",und:s=>s===void 0,arr:s=>Array.isArray(s),equ(s,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof s!=typeof e||!!s!=!!e)return!1;if(Xt.str(s)||Xt.num(s)||Xt.boo(s))return s===e;const r=Xt.obj(s);if(r&&n==="reference")return s===e;const o=Xt.arr(s);if(o&&t==="reference")return s===e;if((o||r)&&s===e)return!0;let a;for(a in s)if(!(a in e))return!1;if(r&&t==="shallow"&&n==="shallow"){for(a in i?e:s)if(!Xt.equ(s[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:s)if(s[a]!==e[a])return!1;if(Xt.und(a)){if(o&&s.length===0&&e.length===0||r&&Object.keys(s).length===0&&Object.keys(e).length===0)return!0;if(s!==e)return!1}return!0}};function h2(s){s.dispose&&s.type!=="Scene"&&s.dispose();for(const e in s)e.dispose==null||e.dispose(),delete s[e]}function Ko(s,e){const t=s;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},s}function sp(s,e){let t=s;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((r,o)=>r[o],s),{target:t,key:i}}else return{target:t,key:e}}const hv=/-\d+$/;function rd(s,e,t){if(Xt.str(t)){if(hv.test(t)){const r=t.replace(hv,""),{target:o,key:a}=sp(s,r);Array.isArray(o[a])||(o[a]=[])}const{target:n,key:i}=sp(s,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(s,e)}function fv(s,e,t){var n,i;if(Xt.str(t)){const{target:r,key:o}=sp(s,t),a=e.__r3f.previousAttach;a===void 0?delete r[o]:r[o]=a}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(s,e);(i=e.__r3f)==null||delete i.previousAttach}function sx(s,{children:e,key:t,ref:n,...i},{children:r,key:o,ref:a,...c}={},h=!1){const f=s.__r3f,d=Object.entries(i),p=[];if(h){const v=Object.keys(c);for(let S=0;S<v.length;S++)i.hasOwnProperty(v[S])||d.unshift([v[S],ix+"remove"])}d.forEach(([v,S])=>{var y;if((y=s.__r3f)!=null&&y.primitive&&v==="object"||Xt.equ(S,c[v]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(v))return p.push([v,S,!0,[]]);let _=[];v.includes("-")&&(_=v.split("-")),p.push([v,S,!1,_]);for(const E in i){const M=i[E];E.startsWith(`${v}-`)&&p.push([E,M,!1,E.split("-")])}});const m={...i};return f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.args&&(m.args=f.memoizedProps.args),f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.attach&&(m.attach=f.memoizedProps.attach),{memoized:m,changes:p}}const f2=typeof process<"u"&&!1;function sd(s,e){var t;const n=s.__r3f,i=n==null?void 0:n.root,r=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:a}=u2(e)?e:sx(s,e),c=n==null?void 0:n.eventCount;s.__r3f&&(s.__r3f.memoizedProps=o);for(let p=0;p<a.length;p++){let[m,v,S,y]=a[p];if(id(s)){const b="srgb",P="srgb-linear";m==="encoding"?(m="colorSpace",v=v===3001?b:P):m==="outputEncoding"&&(m="outputColorSpace",v=v===3001?b:P)}let _=s,E=_[m];if(y.length&&(E=y.reduce((M,b)=>M[b],s),!(E&&E.set))){const[M,...b]=y.reverse();_=b.reverse().reduce((P,R)=>P[R],s),m=M}if(v===ix+"remove")if(_.constructor){let M=uv.get(_.constructor);M||(M=new _.constructor,uv.set(_.constructor,M)),v=M[m]}else v=0;if(S&&n)v?n.handlers[m]=v:delete n.handlers[m],n.eventCount=Object.keys(n.handlers).length;else if(E&&E.set&&(E.copy||E instanceof $s)){if(Array.isArray(v))E.fromArray?E.fromArray(v):E.set(...v);else if(E.copy&&v&&v.constructor&&(f2?E.constructor.name===v.constructor.name:E.constructor===v.constructor))E.copy(v);else if(v!==void 0){var h;const M=(h=E)==null?void 0:h.isColor;!M&&E.setScalar?E.setScalar(v):E instanceof $s&&v instanceof $s?E.mask=v.mask:E.set(v),!$y()&&r&&!r.linear&&M&&E.convertSRGBToLinear()}}else{var f;if(_[m]=v,(f=_[m])!=null&&f.isTexture&&_[m].format===ri&&_[m].type===sr&&r){const M=_[m];id(M)&&id(r.gl)?M.colorSpace=r.gl.outputColorSpace:M.encoding=r.gl.outputEncoding}}Qo(s)}if(n&&n.parent&&s.raycast&&c!==n.eventCount){const p=zu(s).getState().internal,m=p.interaction.indexOf(s);m>-1&&p.interaction.splice(m,1),n.eventCount&&p.interaction.push(s)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(t=s.__r3f)!=null&&t.parent&&op(s),s}function Qo(s){var e,t;const n=(e=s.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function op(s){s.onUpdate==null||s.onUpdate(s)}function d2(s,e){s.manual||(ex(s)?(s.left=e.width/-2,s.right=e.width/2,s.top=e.height/2,s.bottom=e.height/-2):s.aspect=e.width/e.height,s.updateProjectionMatrix(),s.updateMatrixWorld())}function Cu(s){return(s.eventObject||s.object).uuid+"/"+s.index+s.instanceId}function p2(){var s;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return sa.DefaultEventPriority;switch((s=e.event)==null?void 0:s.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return sa.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return sa.ContinuousEventPriority;default:return sa.DefaultEventPriority}}function ox(s,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(s.delete(n),i.target.releasePointerCapture(n)))}function m2(s,e){const{internal:t}=s.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)=>{ox(t.capturedMap,e,n,i)})}function g2(s){function e(c){const{internal:h}=s.getState(),f=c.offsetX-h.initialClick[0],d=c.offsetY-h.initialClick[1];return Math.round(Math.sqrt(f*f+d*d))}function t(c){return c.filter(h=>["Move","Over","Enter","Out","Leave"].some(f=>{var d;return(d=h.__r3f)==null?void 0:d.handlers["onPointer"+f]}))}function n(c,h){const f=s.getState(),d=new Set,p=[],m=h?h(f.internal.interaction):f.internal.interaction;for(let _=0;_<m.length;_++){const E=el(m[_]);E&&(E.raycaster.camera=void 0)}f.previousRoot||f.events.compute==null||f.events.compute(c,f);function v(_){const E=el(_);if(!E||!E.events.enabled||E.raycaster.camera===null)return[];if(E.raycaster.camera===void 0){var M;E.events.compute==null||E.events.compute(c,E,(M=E.previousRoot)==null?void 0:M.getState()),E.raycaster.camera===void 0&&(E.raycaster.camera=null)}return E.raycaster.camera?E.raycaster.intersectObject(_,!0):[]}let S=m.flatMap(v).sort((_,E)=>{const M=el(_.object),b=el(E.object);return!M||!b?_.distance-E.distance:b.events.priority-M.events.priority||_.distance-E.distance}).filter(_=>{const E=Cu(_);return d.has(E)?!1:(d.add(E),!0)});f.events.filter&&(S=f.events.filter(S,f));for(const _ of S){let E=_.object;for(;E;){var y;(y=E.__r3f)!=null&&y.eventCount&&p.push({..._,eventObject:E}),E=E.parent}}if("pointerId"in c&&f.internal.capturedMap.has(c.pointerId))for(let _ of f.internal.capturedMap.get(c.pointerId).values())d.has(Cu(_.intersection))||p.push(_.intersection);return p}function i(c,h,f,d){const p=s.getState();if(c.length){const m={stopped:!1};for(const v of c){const S=el(v.object)||p,{raycaster:y,pointer:_,camera:E,internal:M}=S,b=new H(_.x,_.y,0).unproject(E),P=C=>{var k,B;return(k=(B=M.capturedMap.get(C))==null?void 0:B.has(v.eventObject))!=null?k:!1},R=C=>{const k={intersection:v,target:h.target};M.capturedMap.has(C)?M.capturedMap.get(C).set(v.eventObject,k):M.capturedMap.set(C,new Map([[v.eventObject,k]])),h.target.setPointerCapture(C)},L=C=>{const k=M.capturedMap.get(C);k&&ox(M.capturedMap,v.eventObject,k,C)};let D={};for(let C in h){let k=h[C];typeof k!="function"&&(D[C]=k)}let A={...v,...D,pointer:_,intersections:c,stopped:m.stopped,delta:f,unprojectedPoint:b,ray:y.ray,camera:E,stopPropagation(){const C="pointerId"in h&&M.capturedMap.get(h.pointerId);if((!C||C.has(v.eventObject))&&(A.stopped=m.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(k=>k.eventObject===v.eventObject))){const k=c.slice(0,c.indexOf(v));r([...k,v])}},target:{hasPointerCapture:P,setPointerCapture:R,releasePointerCapture:L},currentTarget:{hasPointerCapture:P,setPointerCapture:R,releasePointerCapture:L},nativeEvent:h};if(d(A),m.stopped===!0)break}}return c}function r(c){const{internal:h}=s.getState();for(const f of h.hovered.values())if(!c.length||!c.find(d=>d.object===f.object&&d.index===f.index&&d.instanceId===f.instanceId)){const p=f.eventObject.__r3f,m=p==null?void 0:p.handlers;if(h.hovered.delete(Cu(f)),p!=null&&p.eventCount){const v={...f,intersections:c};m.onPointerOut==null||m.onPointerOut(v),m.onPointerLeave==null||m.onPointerLeave(v)}}}function o(c,h){for(let f=0;f<h.length;f++){const d=h[f].__r3f;d==null||d.handlers.onPointerMissed==null||d.handlers.onPointerMissed(c)}}function a(c){switch(c){case"onPointerLeave":case"onPointerCancel":return()=>r([]);case"onLostPointerCapture":return h=>{const{internal:f}=s.getState();"pointerId"in h&&f.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{f.capturedMap.has(h.pointerId)&&(f.capturedMap.delete(h.pointerId),r([]))})}}return function(f){const{onPointerMissed:d,internal:p}=s.getState();p.lastEvent.current=f;const m=c==="onPointerMove",v=c==="onClick"||c==="onContextMenu"||c==="onDoubleClick",y=n(f,m?t:void 0),_=v?e(f):0;c==="onPointerDown"&&(p.initialClick=[f.offsetX,f.offsetY],p.initialHits=y.map(M=>M.eventObject)),v&&!y.length&&_<=2&&(o(f,p.interaction),d&&d(f)),m&&r(y);function E(M){const b=M.eventObject,P=b.__r3f,R=P==null?void 0:P.handlers;if(P!=null&&P.eventCount)if(m){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const L=Cu(M),D=p.hovered.get(L);D?D.stopped&&M.stopPropagation():(p.hovered.set(L,M),R.onPointerOver==null||R.onPointerOver(M),R.onPointerEnter==null||R.onPointerEnter(M))}R.onPointerMove==null||R.onPointerMove(M)}else{const L=R[c];L?(!v||p.initialHits.includes(b))&&(o(f,p.interaction.filter(D=>!p.initialHits.includes(D))),L(M)):v&&p.initialHits.includes(b)&&o(f,p.interaction.filter(D=>!p.initialHits.includes(D)))}}i(y,f,_,E)}}return{handlePointer:a}}const ax=s=>!!(s!=null&&s.render),lx=Ye.createContext(null),v2=(s,e)=>{const t=QA((a,c)=>{const h=new H,f=new H,d=new H;function p(_=c().camera,E=f,M=c().size){const{width:b,height:P,top:R,left:L}=M,D=b/P;E.isVector3?d.copy(E):d.set(...E);const A=_.getWorldPosition(h).distanceTo(d);if(ex(_))return{width:b/_.zoom,height:P/_.zoom,top:R,left:L,factor:1,distance:A,aspect:D};{const C=_.fov*Math.PI/180,k=2*Math.tan(C/2)*A,B=k*(b/P);return{width:B,height:k,top:R,left:L,factor:b/B,distance:A,aspect:D}}}let m;const v=_=>a(E=>({performance:{...E.performance,current:_}})),S=new Re;return{set:a,get:c,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(_=1)=>s(c(),_),advance:(_,E)=>e(_,E,c()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Kp,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const _=c();m&&clearTimeout(m),_.performance.current!==_.performance.min&&v(_.performance.min),m=setTimeout(()=>v(c().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:p},setEvents:_=>a(E=>({...E,events:{...E.events,..._}})),setSize:(_,E,M,b,P)=>{const R=c().camera,L={width:_,height:E,top:b||0,left:P||0,updateStyle:M};a(D=>({size:L,viewport:{...D.viewport,...p(R,f,L)}}))},setDpr:_=>a(E=>{const M=rx(_);return{viewport:{...E.viewport,dpr:M,initialDpr:E.viewport.initialDpr||M}}}),setFrameloop:(_="always")=>{const E=c().clock;E.stop(),E.elapsedTime=0,_!=="never"&&(E.start(),E.elapsedTime=0),a(()=>({frameloop:_}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:Ye.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(_,E,M)=>{const b=c().internal;return b.priority=b.priority+(E>0?1:0),b.subscribers.push({ref:_,priority:E,store:M}),b.subscribers=b.subscribers.sort((P,R)=>P.priority-R.priority),()=>{const P=c().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(E>0?1:0),P.subscribers=P.subscribers.filter(R=>R.ref!==_))}}}}}),n=t.getState();let i=n.size,r=n.viewport.dpr,o=n.camera;return t.subscribe(()=>{const{camera:a,size:c,viewport:h,gl:f,set:d}=t.getState();if(c.width!==i.width||c.height!==i.height||h.dpr!==r){var p;i=c,r=h.dpr,d2(a,c),f.setPixelRatio(h.dpr);const m=(p=c.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&f.domElement instanceof HTMLCanvasElement;f.setSize(c.width,c.height,m)}a!==o&&(o=a,d(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>s(a)),t};let Ru,_2=new Set,y2=new Set,x2=new Set;function od(s,e){if(s.size)for(const{callback:t}of s.values())t(e)}function tl(s,e){switch(s){case"before":return od(_2,e);case"after":return od(y2,e);case"tail":return od(x2,e)}}let ad,ld;function cd(s,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof s=="number"&&(n=s-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=s),ad=e.internal.subscribers,Ru=0;Ru<ad.length;Ru++)ld=ad[Ru],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 S2(s){let e=!1,t=!1,n,i,r;function o(h){i=requestAnimationFrame(o),e=!0,n=0,tl("before",h),t=!0;for(const d of s.values()){var f;r=d.store.getState(),r.internal.active&&(r.frameloop==="always"||r.internal.frames>0)&&!((f=r.gl.xr)!=null&&f.isPresenting)&&(n+=cd(h,r))}if(t=!1,tl("after",h),n===0)return tl("tail",h),e=!1,cancelAnimationFrame(i)}function a(h,f=1){var d;if(!h)return s.forEach(p=>a(p.store.getState(),f));(d=h.gl.xr)!=null&&d.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(o)))}function c(h,f=!0,d,p){if(f&&tl("before",h),d)cd(h,d,p);else for(const m of s.values())cd(h,m.store.getState());f&&tl("after",h)}return{loop:o,invalidate:a,advance:c}}function cx(){const s=Ye.useContext(lx);if(!s)throw new Error("R3F: Hooks can only be used within the Canvas component!");return s}function Ar(s=t=>t,e){return cx()(s,e)}function M2(s,e=0){const t=cx(),n=t.getState().internal.subscribe,i=tx(s);return Wl(()=>n(i,e,t),[e,n,t]),null}const ha=new Map,{invalidate:dv,advance:pv}=S2(ha),{reconciler:Zu,applyProps:qo}=a2(ha,p2),Zo={objects:"shallow",strict:!1},E2=(s,e)=>{const t=typeof s=="function"?s(e):s;return ax(t)?t:new Ip({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...s})};function w2(s,e){const t=typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement;if(e){const{width:n,height:i,top:r,left:o,updateStyle:a=t}=e;return{width:n,height:i,top:r,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement&&s.parentElement){const{width:n,height:i,top:r,left:o}=s.parentElement.getBoundingClientRect();return{width:n,height:i,top:r,left:o,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas)return{width:s.width,height:s.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function b2(s){const e=ha.get(s),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,r=n||v2(dv,pv),o=t||Zu.createContainer(r,sa.ConcurrentRoot,null,!1,null,"",i,null);e||ha.set(s,{fiber:o,store:r});let a,c=!1,h;return{configure(f={}){let{gl:d,size:p,scene:m,events:v,onCreated:S,shadows:y=!1,linear:_=!1,flat:E=!1,legacy:M=!1,orthographic:b=!1,frameloop:P="always",dpr:R=[1,2],performance:L,raycaster:D,camera:A,onPointerMissed:C}=f,k=r.getState(),B=k.gl;k.gl||k.set({gl:B=E2(d,s)});let ee=k.raycaster;ee||k.set({raycaster:ee=new jy});const{params:N,...q}=D||{};if(Xt.equ(q,ee,Zo)||qo(ee,{...q}),Xt.equ(N,ee.params,Zo)||qo(ee,{params:{...ee.params,...N}}),!k.camera||k.camera===h&&!Xt.equ(h,A,Zo)){h=A;const V=A instanceof Ol,F=V?A:b?new os(0,0,0,0,.1,1e3):new fn(75,0,.1,1e3);V||(F.position.z=5,A&&(qo(F,A),("aspect"in A||"left"in A||"right"in A||"bottom"in A||"top"in A)&&(F.manual=!0,F.updateProjectionMatrix())),!k.camera&&!(A!=null&&A.rotation)&&F.lookAt(0,0,0)),k.set({camera:F}),ee.camera=F}if(!k.scene){let V;m!=null&&m.isScene?V=m:(V=new Up,m&&qo(V,m)),k.set({scene:Ko(V)})}if(!k.xr){var K;const V=(G,$)=>{const te=r.getState();te.frameloop!=="never"&&pv(G,!0,te,$)},F=()=>{const G=r.getState();G.gl.xr.enabled=G.gl.xr.isPresenting,G.gl.xr.setAnimationLoop(G.gl.xr.isPresenting?V:null),G.gl.xr.isPresenting||dv(G)},j={connect(){const G=r.getState().gl;G.xr.addEventListener("sessionstart",F),G.xr.addEventListener("sessionend",F)},disconnect(){const G=r.getState().gl;G.xr.removeEventListener("sessionstart",F),G.xr.removeEventListener("sessionend",F)}};typeof((K=B.xr)==null?void 0:K.addEventListener)=="function"&&j.connect(),k.set({xr:j})}if(B.shadowMap){const V=B.shadowMap.enabled,F=B.shadowMap.type;if(B.shadowMap.enabled=!!y,Xt.boo(y))B.shadowMap.type=rl;else if(Xt.str(y)){var re;const j={basic:Hv,percentage:Ku,soft:rl,variance:Wi};B.shadowMap.type=(re=j[y])!=null?re:rl}else Xt.obj(y)&&Object.assign(B.shadowMap,y);(V!==B.shadowMap.enabled||F!==B.shadowMap.type)&&(B.shadowMap.needsUpdate=!0)}const Z=$y();Z&&("enabled"in Z?Z.enabled=!M:"legacyMode"in Z&&(Z.legacyMode=M)),c||qo(B,{outputEncoding:_?3e3:3001,toneMapping:E?rr:hp}),k.legacy!==M&&k.set(()=>({legacy:M})),k.linear!==_&&k.set(()=>({linear:_})),k.flat!==E&&k.set(()=>({flat:E})),d&&!Xt.fun(d)&&!ax(d)&&!Xt.equ(d,B,Zo)&&qo(B,d),v&&!k.events.handlers&&k.set({events:v(r)});const W=w2(s,p);return Xt.equ(W,k.size,Zo)||k.setSize(W.width,W.height,W.updateStyle,W.top,W.left),R&&k.viewport.dpr!==rx(R)&&k.setDpr(R),k.frameloop!==P&&k.setFrameloop(P),k.onPointerMissed||k.set({onPointerMissed:C}),L&&!Xt.equ(L,k.performance,Zo)&&k.set(V=>({performance:{...V.performance,...L}})),a=S,c=!0,this},render(f){return c||this.configure(),Zu.updateContainer(_t.jsx(T2,{store:r,children:f,onCreated:a,rootElement:s}),o,null,()=>{}),r},unmount(){ux(s)}}}function T2({store:s,children:e,onCreated:t,rootElement:n}){return Wl(()=>{const i=s.getState();i.set(r=>({internal:{...r.internal,active:!0}})),t&&t(i),s.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),_t.jsx(lx.Provider,{value:s,children:e})}function ux(s,e){const t=ha.get(s),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),Zu.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var r,o,a,c;i.events.disconnect==null||i.events.disconnect(),(r=i.gl)==null||(o=r.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(c=i.gl)!=null&&c.xr&&i.xr.disconnect(),h2(i),ha.delete(s)}catch{}},500)})}}Zu.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:Ye.version});
3720const 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 A2(s){const{handlePointer:e}=g2(s);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}=s.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:r}=s.getState();r.disconnect==null||r.disconnect(),i(o=>({events:{...o.events,connected:t}})),Object.entries((n=r.handlers)!=null?n:[]).forEach(([o,a])=>{const[c,h]=ud[o];t.addEventListener(c,a,{passive:h})})},disconnect:()=>{const{set:t,events:n}=s.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([r,o])=>{if(n&&n.connected instanceof HTMLElement){const[a]=ud[r];n.connected.removeEventListener(a,o)}}),t(r=>({events:{...r.events,connected:void 0}}))}}}}function mv(s,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>s(...n),e)}}function C2({debounce:s,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[r,o]=Ye.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=Ye.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:r,orientationHandler:null}),c=s?typeof s=="number"?s:s.scroll:null,h=s?typeof s=="number"?s:s.resize:null,f=Ye.useRef(!1);Ye.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[d,p,m]=Ye.useMemo(()=>{const _=()=>{if(!a.current.element)return;const{left:E,top:M,width:b,height:P,bottom:R,right:L,x:D,y:A}=a.current.element.getBoundingClientRect(),C={left:E,top:M,width:b,height:P,bottom:R,right:L,x:D,y:A};a.current.element instanceof HTMLElement&&n&&(C.height=a.current.element.offsetHeight,C.width=a.current.element.offsetWidth),Object.freeze(C),f.current&&!I2(a.current.lastBounds,C)&&o(a.current.lastBounds=C)};return[_,h?mv(_,h):_,c?mv(_,c):_]},[o,n,c,h]);function v(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",m,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function S(){a.current.element&&(a.current.resizeObserver=new i(m),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(_=>_.addEventListener("scroll",m,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{m()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const y=_=>{!_||_===a.current.element||(v(),a.current.element=_,a.current.scrollContainers=hx(_),S())};return P2(m,!!e),R2(p),Ye.useEffect(()=>{v(),S()},[e,m,p]),Ye.useEffect(()=>v,[]),[y,r,d]}function R2(s){Ye.useEffect(()=>{const e=s;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[s])}function P2(s,e){Ye.useEffect(()=>{if(e){const t=s;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[s,e])}function hx(s){const e=[];
3720if(!s||s===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(s);return[t,n,i].some(r=>r==="auto"||r==="scroll")&&e.push(s),[...e,...hx(s.parentElement)]}const L2=["x","y","top","bottom","left","right","width","height"],I2=(s,e)=>L2.every(t=>s[t]===e[t]);var U2=Object.defineProperty,D2=Object.defineProperties,N2=Object.getOwnPropertyDescriptors,gv=Object.getOwnPropertySymbols,F2=Object.prototype.hasOwnProperty,O2=Object.prototype.propertyIsEnumerable,vv=(s,e,t)=>e in s?U2(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,_v=(s,e)=>{for(var t in e||(e={}))F2.call(e,t)&&vv(s,t,e[t]);if(gv)for(var t of gv(e))O2.call(e,t)&&vv(s,t,e[t]);return s},B2=(s,e)=>D2(s,N2(e)),yv,xv;typeof window<"u"&&((yv=window.document)!=null&&yv.createElement||((xv=window.navigator)==null?void 0:xv.product)==="ReactNative")?Ye.useLayoutEffect:Ye.useEffect;function fx(s,e,t){if(!s)return;if(t(s)===!0)return s;let n=s.child;for(;n;){const i=fx(n,e,t);if(i)return i;n=n.sibling}}function dx(s){try{return Object.defineProperties(s,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return s}}const Sv=console.error;console.error=function(){const s=[...arguments].join("");if(s!=null&&s.startsWith("Warning:")&&s.includes("useContext")){console.error=Sv;return}return Sv.apply(this,arguments)};const nm=dx(Ye.createContext(null));class px extends Ye.Component{render(){return Ye.createElement(nm.Provider,{value:this._reactInternals},this.props.children)}}function k2(){const s=Ye.useContext(nm);if(s===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=Ye.useId();return Ye.useMemo(()=>{for(const n of[s,s==null?void 0:s.alternate]){if(!n)continue;const i=fx(n,!1,r=>{let o=r.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[s,e])}function z2(){const s=k2(),[e]=Ye.useState(()=>new Map);e.clear();let t=s;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!==nm&&!e.has(i)&&e.set(i,Ye.useContext(dx(i)))}t=t.return}return e}function G2(){const s=z2();return Ye.useMemo(()=>Array.from(s.keys()).reduce((e,t)=>n=>Ye.createElement(e,null,Ye.createElement(t.Provider,B2(_v({},n),{value:s.get(t)}))),e=>Ye.createElement(px,_v({},e))),[s])}const H2=Ye.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:r,events:o=A2,eventSource:a,eventPrefix:c,shadows:h,linear:f,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:S,performance:y,raycaster:_,camera:E,scene:M,onPointerMissed:b,onCreated:P,...R},L){Ye.useMemo(()=>o2(ZA),[]);const D=G2(),[A,C]=C2({scroll:!0,debounce:{scroll:50,resize:0},...n}),k=Ye.useRef(null),B=Ye.useRef(null);Ye.useImperativeHandle(L,()=>k.current);const ee=tx(b),[N,q]=Ye.useState(!1),[K,re]=Ye.useState(!1);if(N)throw N;if(K)throw K;const Z=Ye.useRef(null);Wl(()=>{const V=k.current;C.width>0&&C.height>0&&V&&(Z.current||(Z.current=b2(V)),Z.current.configure({gl:r,events:o,shadows:h,linear:f,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:S,performance:y,raycaster:_,camera:E,scene:M,size:C,onPointerMissed:(...F)=>ee.current==null?void 0:ee.current(...F),onCreated:F=>{F.events.connect==null||F.events.connect(a?l2(a)?a.current:a:B.current),c&&F.setEvents({compute:(j,G)=>{const $=j[c+"X"],te=j[c+"Y"];G.pointer.set($/G.size.width*2-1,-(te/G.size.height)*2+1),G.raycaster.setFromCamera(G.pointer,G.camera)}}),P==null||P(F)}}),Z.current.render(_t.jsx(D,{children:_t.jsx(nx,{set:re,children:_t.jsx(Ye.Suspense,{fallback:_t.jsx(c2,{set:q}),children:e??null})})})))}),Ye.useEffect(()=>{const V=k.current;if(V)return()=>ux(V)},[]);const W=a?"none":"auto";return _t.jsx("div",{ref:B,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:W,...i},...R,children:_t.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:_t.jsx("canvas",{ref:k,style:{display:"block"},children:t})})})}),V2=Ye.forwardRef(function(e,t){return _t.jsx(px,{children:_t.jsx(H2,{...e,ref:t})})});var W2=Object.defineProperty,X2=(s,e,t)=>e in s?W2(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Y2=(s,e,t)=>(X2(s,e+"",t),t);class j2{constructor(){Y2(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 r=i.indexOf(t);r!==-1&&i.splice(r,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 r=0,o=i.length;r<o;r++)i[r].call(this,e);e.target=null}}}var q2=Object.defineProperty,Z2=(s,e,t)=>e in s?q2(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,pt=(s,e,t)=>(Z2(s,typeof e!="symbol"?e+"":e,t),t);
3720const Pu=new oo,Mv=new Cr,J2=Math.cos(70*(Math.PI/180)),Ev=(s,e)=>(s%e+e)%e;let K2=class extends j2{constructor(e,t){super(),pt(this,"object"),pt(this,"domElement"),pt(this,"enabled",!0),pt(this,"target",new H),pt(this,"minDistance",0),pt(this,"maxDistance",1/0),pt(this,"minZoom",0),pt(this,"maxZoom",1/0),pt(this,"minPolarAngle",0),pt(this,"maxPolarAngle",Math.PI),pt(this,"minAzimuthAngle",-1/0),pt(this,"maxAzimuthAngle",1/0),pt(this,"enableDamping",!1),pt(this,"dampingFactor",.05),pt(this,"enableZoom",!0),pt(this,"zoomSpeed",1),pt(this,"enableRotate",!0),pt(this,"rotateSpeed",1),pt(this,"enablePan",!0),pt(this,"panSpeed",1),pt(this,"screenSpacePanning",!0),pt(this,"keyPanSpeed",7),pt(this,"zoomToCursor",!1),pt(this,"autoRotate",!1),pt(this,"autoRotateSpeed",2),pt(this,"reverseOrbit",!1),pt(this,"reverseHorizontalOrbit",!1),pt(this,"reverseVerticalOrbit",!1),pt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),pt(this,"mouseButtons",{LEFT:Hs.ROTATE,MIDDLE:Hs.DOLLY,RIGHT:Hs.PAN}),pt(this,"touches",{ONE:Vs.ROTATE,TWO:Vs.DOLLY_PAN}),pt(this,"target0"),pt(this,"position0"),pt(this,"zoom0"),pt(this,"_domElementKeyEvents",null),pt(this,"getPolarAngle"),pt(this,"getAzimuthalAngle"),pt(this,"setPolarAngle"),pt(this,"setAzimuthalAngle"),pt(this,"getDistance"),pt(this,"getZoomScale"),pt(this,"listenToKeyEvents"),pt(this,"stopListenToKeyEvents"),pt(this,"saveState"),pt(this,"reset"),pt(this,"update"),pt(this,"connect"),pt(this,"dispose"),pt(this,"dollyIn"),pt(this,"dollyOut"),pt(this,"getScale"),pt(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=Q=>{let we=Ev(Q,2*Math.PI),We=f.phi;We<0&&(We+=2*Math.PI),we<0&&(we+=2*Math.PI);let Be=Math.abs(we-We);2*Math.PI-Be<Be&&(we<We?we+=2*Math.PI:We+=2*Math.PI),d.phi=we-We,n.update()},this.setAzimuthalAngle=Q=>{let we=Ev(Q,2*Math.PI),We=f.theta;We<0&&(We+=2*Math.PI),we<0&&(we+=2*Math.PI);let Be=Math.abs(we-We);2*Math.PI-Be<Be&&(we<We?we+=2*Math.PI:We+=2*Math.PI),d.theta=we-We,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=Q=>{Q.addEventListener("keydown",De),this._domElementKeyEvents=Q},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",De),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(),c=a.NONE},this.update=(()=>{const Q=new H,we=new H(0,1,0),We=new Wn().setFromUnitVectors(e.up,we),Be=We.clone().invert(),ge=new H,J=new Wn,Ge=2*Math.PI;return function(){const He=n.object.position;We.setFromUnitVectors(e.up,we),Be.copy(We).invert(),Q.copy(He).sub(n.target),Q.applyQuaternion(We),f.setFromVector3(Q),n.autoRotate&&c===a.NONE&&N(B()),n.enableDamping?(f.theta+=d.theta*n.dampingFactor,f.phi+=d.phi*n.dampingFactor):(f.theta+=d.theta,f.phi+=d.phi);let je=n.minAzimuthAngle,rt=n.maxAzimuthAngle;isFinite(je)&&isFinite(rt)&&(je<-Math.PI?je+=Ge:je>Math.PI&&(je-=Ge),rt<-Math.PI?rt+=Ge:rt>Math.PI&&(rt-=Ge),je<=rt?f.theta=Math.max(je,Math.min(rt,f.theta)):f.theta=f.theta>(je+rt)/2?Math.max(je,f.theta):Math.min(rt,f.theta)),f.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,f.phi)),f.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(m,n.dampingFactor):n.target.add(m),n.zoomToCursor&&A||n.object.isOrthographicCamera?f.radius=G(f.radius):f.radius=G(f.radius*p),Q.setFromSpherical(f),Q.applyQuaternion(Be),He.copy(n.target).add(Q),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(d.theta*=1-n.dampingFactor,d.phi*=1-n.dampingFactor,m.multiplyScalar(1-n.dampingFactor)):(d.set(0,0,0),m.set(0,0,0));let Ze=!1;if(n.zoomToCursor&&A){let ht=null;if(n.object instanceof fn&&n.object.isPerspectiveCamera){const At=Q.length();ht=G(At*p);const gt=At-ht;n.object.position.addScaledVector(L,gt),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const At=new H(D.x,D.y,0);At.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix(),Ze=!0;const gt=new H(D.x,D.y,0);gt.unproject(n.object),n.object.position.sub(gt).add(At),n.object.updateMatrixWorld(),ht=Q.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;ht!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(ht).add(n.object.position):(Pu.origin.copy(n.object.position),Pu.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Pu.direction))<J2?e.lookAt(n.target):(Mv.setFromNormalAndCoplanarPoint(n.object.up,n.target),Pu.intersectPlane(Mv,n.target))))}else n.object instanceof os&&n.object.isOrthographicCamera&&(Ze=p!==1,Ze&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix()));return p=1,A=!1,Ze||ge.distanceToSquared(n.object.position)>h||8*(1-J.dot(n.object.quaternion))>h?(n.dispatchEvent(i),ge.copy(n.object.position),J.copy(n.object.quaternion),Ze=!1,!0):!1}})(),this.connect=Q=>{n.domElement=Q,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",it),n.domElement.addEventListener("pointerdown",ye),n.domElement.addEventListener("pointercancel",he),n.domElement.addEventListener("wheel",Ce)},this.dispose=()=>{var Q,we,We,Be,ge,J;n.domElement&&(n.domElement.style.touchAction="auto"),(Q=n.domElement)==null||Q.removeEventListener("contextmenu",it),(we=n.domElement)==null||we.removeEventListener("pointerdown",ye),(We=n.domElement)==null||We.removeEventListener("pointercancel",he),(Be=n.domElement)==null||Be.removeEventListener("wheel",Ce),
3720(ge=n.domElement)==null||ge.ownerDocument.removeEventListener("pointermove",ce),(J=n.domElement)==null||J.ownerDocument.removeEventListener("pointerup",he),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",De)};const n=this,i={type:"change"},r={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let c=a.NONE;const h=1e-6,f=new ip,d=new ip;let p=1;const m=new H,v=new Re,S=new Re,y=new Re,_=new Re,E=new Re,M=new Re,b=new Re,P=new Re,R=new Re,L=new H,D=new Re;let A=!1;const C=[],k={};function B(){return 2*Math.PI/60/60*n.autoRotateSpeed}function ee(){return Math.pow(.95,n.zoomSpeed)}function N(Q){n.reverseOrbit||n.reverseHorizontalOrbit?d.theta+=Q:d.theta-=Q}function q(Q){n.reverseOrbit||n.reverseVerticalOrbit?d.phi+=Q:d.phi-=Q}const K=(()=>{const Q=new H;return function(We,Be){Q.setFromMatrixColumn(Be,0),Q.multiplyScalar(-We),m.add(Q)}})(),re=(()=>{const Q=new H;return function(We,Be){n.screenSpacePanning===!0?Q.setFromMatrixColumn(Be,1):(Q.setFromMatrixColumn(Be,0),Q.crossVectors(n.object.up,Q)),Q.multiplyScalar(We),m.add(Q)}})(),Z=(()=>{const Q=new H;return function(We,Be){const ge=n.domElement;if(ge&&n.object instanceof fn&&n.object.isPerspectiveCamera){const J=n.object.position;Q.copy(J).sub(n.target);let Ge=Q.length();Ge*=Math.tan(n.object.fov/2*Math.PI/180),K(2*We*Ge/ge.clientHeight,n.object.matrix),re(2*Be*Ge/ge.clientHeight,n.object.matrix)}else ge&&n.object instanceof os&&n.object.isOrthographicCamera?(K(We*(n.object.right-n.object.left)/n.object.zoom/ge.clientWidth,n.object.matrix),re(Be*(n.object.top-n.object.bottom)/n.object.zoom/ge.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function W(Q){n.object instanceof fn&&n.object.isPerspectiveCamera||n.object instanceof os&&n.object.isOrthographicCamera?p=Q:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function V(Q){W(p/Q)}function F(Q){W(p*Q)}function j(Q){if(!n.zoomToCursor||!n.domElement)return;A=!0;const we=n.domElement.getBoundingClientRect(),We=Q.clientX-we.left,Be=Q.clientY-we.top,ge=we.width,J=we.height;D.x=We/ge*2-1,D.y=-(Be/J)*2+1,L.set(D.x,D.y,1).unproject(n.object).sub(n.object.position).normalize()}function G(Q){return Math.max(n.minDistance,Math.min(n.maxDistance,Q))}function $(Q){v.set(Q.clientX,Q.clientY)}function te(Q){j(Q),b.set(Q.clientX,Q.clientY)}function ae(Q){_.set(Q.clientX,Q.clientY)}function ne(Q){S.set(Q.clientX,Q.clientY),y.subVectors(S,v).multiplyScalar(n.rotateSpeed);const we=n.domElement;we&&(N(2*Math.PI*y.x/we.clientHeight),q(2*Math.PI*y.y/we.clientHeight)),v.copy(S),n.update()}function pe(Q){P.set(Q.clientX,Q.clientY),R.subVectors(P,b),R.y>0?V(ee()):R.y<0&&F(ee()),b.copy(P),n.update()}function Ie(Q){E.set(Q.clientX,Q.clientY),M.subVectors(E,_).multiplyScalar(n.panSpeed),Z(M.x,M.y),_.copy(E),n.update()}function Pe(Q){j(Q),Q.deltaY<0?F(ee()):Q.deltaY>0&&V(ee()),n.update()}function Se(Q){let we=!1;switch(Q.code){case n.keys.UP:Z(0,n.keyPanSpeed),we=!0;break;case n.keys.BOTTOM:Z(0,-n.keyPanSpeed),we=!0;break;case n.keys.LEFT:Z(n.keyPanSpeed,0),we=!0;break;case n.keys.RIGHT:Z(-n.keyPanSpeed,0),we=!0;break}we&&(Q.preventDefault(),n.update())}function O(){if(C.length==1)v.set(C[0].pageX,C[0].pageY);else{const Q=.5*(C[0].pageX+C[1].pageX),we=.5*(C[0].pageY+C[1].pageY);
3720v.set(Q,we)}}function Me(){if(C.length==1)_.set(C[0].pageX,C[0].pageY);else{const Q=.5*(C[0].pageX+C[1].pageX),we=.5*(C[0].pageY+C[1].pageY);_.set(Q,we)}}function ue(){const Q=C[0].pageX-C[1].pageX,we=C[0].pageY-C[1].pageY,We=Math.sqrt(Q*Q+we*we);b.set(0,We)}function de(){n.enableZoom&&ue(),n.enablePan&&Me()}function oe(){n.enableZoom&&ue(),n.enableRotate&&O()}function Ue(Q){if(C.length==1)S.set(Q.pageX,Q.pageY);else{const We=Le(Q),Be=.5*(Q.pageX+We.x),ge=.5*(Q.pageY+We.y);S.set(Be,ge)}y.subVectors(S,v).multiplyScalar(n.rotateSpeed);const we=n.domElement;we&&(N(2*Math.PI*y.x/we.clientHeight),q(2*Math.PI*y.y/we.clientHeight)),v.copy(S)}function fe(Q){if(C.length==1)E.set(Q.pageX,Q.pageY);else{const we=Le(Q),We=.5*(Q.pageX+we.x),Be=.5*(Q.pageY+we.y);E.set(We,Be)}M.subVectors(E,_).multiplyScalar(n.panSpeed),Z(M.x,M.y),_.copy(E)}function U(Q){const we=Le(Q),We=Q.pageX-we.x,Be=Q.pageY-we.y,ge=Math.sqrt(We*We+Be*Be);P.set(0,ge),R.set(0,Math.pow(P.y/b.y,n.zoomSpeed)),V(R.y),b.copy(P)}function I(Q){n.enableZoom&&U(Q),n.enablePan&&fe(Q)}function X(Q){n.enableZoom&&U(Q),n.enableRotate&&Ue(Q)}function ye(Q){var we,We;n.enabled!==!1&&(C.length===0&&((we=n.domElement)==null||we.ownerDocument.addEventListener("pointermove",ce),(We=n.domElement)==null||We.ownerDocument.addEventListener("pointerup",he)),tt(Q),Q.pointerType==="touch"?ke(Q):Te(Q))}function ce(Q){n.enabled!==!1&&(Q.pointerType==="touch"?xe(Q):Ne(Q))}function he(Q){var we,We,Be;Xe(Q),C.length===0&&((we=n.domElement)==null||we.releasePointerCapture(Q.pointerId),(We=n.domElement)==null||We.ownerDocument.removeEventListener("pointermove",ce),(Be=n.domElement)==null||Be.ownerDocument.removeEventListener("pointerup",he)),n.dispatchEvent(o),c=a.NONE}function Te(Q){let we;switch(Q.button){case 0:we=n.mouseButtons.LEFT;break;case 1:we=n.mouseButtons.MIDDLE;break;case 2:we=n.mouseButtons.RIGHT;break;default:we=-1}switch(we){case Hs.DOLLY:if(n.enableZoom===!1)return;te(Q),c=a.DOLLY;break;case Hs.ROTATE:if(Q.ctrlKey||Q.metaKey||Q.shiftKey){if(n.enablePan===!1)return;ae(Q),c=a.PAN}else{if(n.enableRotate===!1)return;$(Q),c=a.ROTATE}break;case Hs.PAN:if(Q.ctrlKey||Q.metaKey||Q.shiftKey){if(n.enableRotate===!1)return;$(Q),c=a.ROTATE}else{if(n.enablePan===!1)return;ae(Q),c=a.PAN}break;default:c=a.NONE}c!==a.NONE&&n.dispatchEvent(r)}function Ne(Q){if(n.enabled!==!1)switch(c){case a.ROTATE:if(n.enableRotate===!1)return;ne(Q);break;case a.DOLLY:if(n.enableZoom===!1)return;pe(Q);break;case a.PAN:if(n.enablePan===!1)return;Ie(Q);break}}function Ce(Q){n.enabled===!1||n.enableZoom===!1||c!==a.NONE&&c!==a.ROTATE||(Q.preventDefault(),n.dispatchEvent(r),Pe(Q),n.dispatchEvent(o))}function De(Q){n.enabled===!1||n.enablePan===!1||Se(Q)}function ke(Q){switch(ze(Q),C.length){case 1:switch(n.touches.ONE){case Vs.ROTATE:if(n.enableRotate===!1)return;O(),c=a.TOUCH_ROTATE;break;case Vs.PAN:if(n.enablePan===!1)return;Me(),c=a.TOUCH_PAN;break;default:c=a.NONE}break;case 2:switch(n.touches.TWO){case Vs.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;de(),c=a.TOUCH_DOLLY_PAN;break;case Vs.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;oe(),c=a.TOUCH_DOLLY_ROTATE;break;default:c=a.NONE}break;default:c=a.NONE}c!==a.NONE&&n.dispatchEvent(r)}function xe(Q){switch(ze(Q),c){case a.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ue(Q),n.update();break;case a.TOUCH_PAN:if(n.enablePan===!1)return;fe(Q),n.update();break;case a.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;I(Q),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;X(Q),n.update();break;default:c=a.NONE}}function it(Q){n.enabled!==!1&&Q.preventDefault()}function tt(Q){C.push(Q)}function Xe(Q){delete k[Q.pointerId];for(let we=0;we<C.length;we++)if(C[we].pointerId==Q.pointerId){C.splice(we,1);return}}function ze(Q){let we=k[Q.pointerId];we===void 0&&(we=new Re,k[Q.pointerId]=we),we.set(Q.pageX,Q.pageY)}function Le(Q){const we=Q.pointerId===C[0].pointerId?C[1]:C[0];return k[we.pointerId]}this.dollyIn=(Q=ee())=>{F(Q),n.update()},this.dollyOut=(Q=ee())=>{V(Q),n.update()},this.getScale=()=>p,this.setScale=Q=>{W(Q),n.update()},this.getZoomScale=()=>ee(),t!==void 0&&this.connect(t),this.update()}};function Q2(){var s=Object.create(null);function e(i,r){var o=i.id,a=i.name,c=i.dependencies;c===void 0&&(c=[]);var h=i.init;h===void 0&&(h=function(){});var f=i.getTransferables;if(f===void 0&&(f=null),!s[o])try{c=c.map(function(p){return p&&p.isWorkerModule&&(e(p,function(m){if(m instanceof Error)throw m}),p=s[p.id].value),p}),h=n("<"+a+">
3720.init",h),f&&(f=n("<"+a+">.getTransferables",f));var d=null;typeof h=="function"?d=h.apply(void 0,c):console.error("worker module init function failed to rehydrate"),s[o]={id:o,value:d,getTransferables:f},r(d)}catch(p){p&&p.noLog||console.error(p),r(p)}}function t(i,r){var o,a=i.id,c=i.args;(!s[a]||typeof s[a].value!="function")&&r(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var h=(o=s[a]).value.apply(o,c);h&&typeof h.then=="function"?h.then(f,function(d){return r(d instanceof Error?d:new Error(""+d))}):f(h)}catch(d){r(d)}function f(d){try{var p=s[a].getTransferables&&s[a].getTransferables(d);(!p||!Array.isArray(p)||!p.length)&&(p=void 0),r(d,p)}catch(m){console.error(m),r(m)}}}function n(i,r){var o=void 0;self.troikaDefine=function(c){return o=c};var a=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/ 3721 3722troikaDefine( 3723`+r+` 3724)`],{type:"application/javascript"}));try{importScripts(a)}catch(c){console.error(c)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(i){var r=i.data,o=r.messageId,a=r.action,c=r.data;try{a==="registerModule"&&e(c,function(h){h instanceof Error?postMessage({messageId:o,success:!1,error:h.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof h=="function"}})}),a==="callModule"&&t(c,function(h,f){h instanceof Error?postMessage({messageId:o,success:!1,error:h.message}):postMessage({messageId:o,success:!0,result:h},f||void 0)})}catch(h){postMessage({messageId:o,success:!1,error:h.stack})}})}function $2(s){var e=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=s.dependencies,n=s.init;t=Array.isArray(t)?t.map(function(r){return r&&(r=r.onMainThread||r,r._getInitResult&&(r=r._getInitResult())),r}):[];var i=Promise.all(t).then(function(r){return n.apply(null,r)});return e._getInitResult=function(){return i},i},e}var mx=function(){var s=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),s=!0}catch(t){typeof process<"u",console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return mx=function(){return s},s},eC=0,tC=0,hd=!1,ul=Object.create(null),hl=Object.create(null),ap=Object.create(null);function va(s){if((!s||typeof s.init!="function")&&!hd)throw new Error("requires `options.init` function");var e=s.dependencies,t=s.init,n=s.getTransferables,i=s.workerId,r=$2(s);i==null&&(i="#default");var o="workerModule"+ ++eC,a=s.name||o,c=null;e=e&&e.map(function(f){return typeof f=="function"&&!f.workerModuleData&&(hd=!0,f=va({workerId:i,name:"<"+a+"> function dependency: "+f.name,init:`function(){return ( 3725`+Gu(f)+` 3726)}`}),hd=!1),f&&f.workerModuleData&&(f=f.workerModuleData),f});function h(){for(var f=[],d=arguments.length;d--;)f[d]=arguments[d];if(!mx())return r.apply(void 0,f);if(!c){c=wv(i,"registerModule",h.workerModuleData);var p=function(){c=null,hl[i].delete(p)};(hl[i]||(hl[i]=new Set)).add(p)}return c.then(function(m){var v=m.isCallable;if(v)return wv(i,"callModule",{id:o,args:f});throw new Error("Worker module function was called but `init` did not return a callable function")})}return h.workerModuleData={isWorkerModule:!0,id:o,name:a,dependencies:e,init:Gu(t),getTransferables:n&&Gu(n)},h.onMainThread=r,h}function nC(s){hl[s]&&hl[s].forEach(function(e){e()}),ul[s]&&(ul[s].terminate(),delete ul[s])}function Gu(s){var e=s.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function iC(s){var e=ul[s];if(!e){var t=Gu(Q2);e=ul[s]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+s.replace(/\*/g,"")+` **/ 3727 3728;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(n){var i=n.data,r=i.messageId,o=ap[r];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete ap[r],o(i)}}return e}function wv(s,e,t){return new Promise(function(n,i){var r=++tC;ap[r]=function(o){o.success?n(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},iC(s).postMessage({messageId:r,action:e,data:t})})}function gx(){var s=function(e){function t(W,V,F,j,G,$,te,ae){var ne=1-te;ae.x=ne*ne*W+2*ne*te*F+te*te*G,ae.y=ne*ne*V+2*ne*te*j+te*te*$}function n(W,V,F,j,G,$,te,ae,ne,pe){var Ie=1-ne;pe.x=Ie*Ie*Ie*W+3*Ie*Ie*ne*F+3*Ie*ne*ne*G+ne*ne*ne*te,pe.y=Ie*Ie*Ie*V+3*Ie*Ie*ne*j+3*Ie*ne*ne*$+ne*ne*ne*ae}function i(W,V){for(var F=/([MLQCZ])([^MLQCZ]*)/g,j,G,$,te,ae;j=F.exec(W);){var ne=j[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(pe){return parseFloat(pe)});switch(j[1]){case"M":te=G=ne[0],ae=$=ne[1];break;case"L":(ne[0]!==te||ne[1]!==ae)&&V("L",te,ae,te=ne[0],ae=ne[1]);break;case"Q":{V("Q",te,ae,te=ne[2],ae=ne[3],ne[0],ne[1]);break}case"C":{V("C",te,ae,te=ne[4],ae=ne[5],ne[0],ne[1],ne[2],ne[3]);break}case"Z":(te!==G||ae!==$)&&V("L",te,ae,G,$);break}}}function r(W,V,F){F===void 0&&(F=16);var j={x:0,y:0};i(W,function(G,$,te,ae,ne,pe,Ie,Pe,Se){switch(G){case"L":V($,te,ae,ne);break;case"Q":{for(var O=$,Me=te,ue=1;ue<F;ue++)t($,te,pe,Ie,ae,ne,ue/(F-1),j),V(O,Me,j.x,j.y),O=j.x,Me=j.y;break}case"C":{for(var de=$,oe=te,Ue=1;Ue<F;Ue++)n($,te,pe,Ie,Pe,Se,ae,ne,Ue/(F-1),j),V(de,oe,j.x,j.y),de=j.x,oe=j.y;break}}})}var o="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",a="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",c=new WeakMap,h={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1}
3728;function f(W,V){var F=W.getContext?W.getContext("webgl",h):W,j=c.get(F);if(!j){let Ie=function(de){var oe=$[de];if(!oe&&(oe=$[de]=F.getExtension(de),!oe))throw new Error(de+" not supported");return oe},Pe=function(de,oe){var Ue=F.createShader(oe);return F.shaderSource(Ue,de),F.compileShader(Ue),Ue},Se=function(de,oe,Ue,fe){if(!te[de]){var U={},I={},X=F.createProgram();F.attachShader(X,Pe(oe,F.VERTEX_SHADER)),F.attachShader(X,Pe(Ue,F.FRAGMENT_SHADER)),F.linkProgram(X),te[de]={program:X,transaction:function(ce){F.useProgram(X),ce({setUniform:function(Te,Ne){for(var Ce=[],De=arguments.length-2;De-- >0;)Ce[De]=arguments[De+2];var ke=I[Ne]||(I[Ne]=F.getUniformLocation(X,Ne));F["uniform"+Te].apply(F,[ke].concat(Ce))},setAttribute:function(Te,Ne,Ce,De,ke){var xe=U[Te];xe||(xe=U[Te]={buf:F.createBuffer(),loc:F.getAttribLocation(X,Te),data:null}),F.bindBuffer(F.ARRAY_BUFFER,xe.buf),F.vertexAttribPointer(xe.loc,Ne,F.FLOAT,!1,0,0),F.enableVertexAttribArray(xe.loc),G?F.vertexAttribDivisor(xe.loc,De):Ie("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(xe.loc,De),ke!==xe.data&&(F.bufferData(F.ARRAY_BUFFER,ke,Ce),xe.data=ke)}})}}}te[de].transaction(fe)},O=function(de,oe){ne++;try{F.activeTexture(F.TEXTURE0+ne);var Ue=ae[de];Ue||(Ue=ae[de]=F.createTexture(),F.bindTexture(F.TEXTURE_2D,Ue),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MIN_FILTER,F.NEAREST),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MAG_FILTER,F.NEAREST)),F.bindTexture(F.TEXTURE_2D,Ue),oe(Ue,ne)}finally{ne--}},Me=function(de,oe,Ue){var fe=F.createFramebuffer();pe.push(fe),F.bindFramebuffer(F.FRAMEBUFFER,fe),F.activeTexture(F.TEXTURE0+oe),F.bindTexture(F.TEXTURE_2D,de),F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,de,0);try{Ue(fe)}finally{F.deleteFramebuffer(fe),F.bindFramebuffer(F.FRAMEBUFFER,pe[--pe.length-1]||null)}},ue=function(){$={},te={},ae={},ne=-1,pe.length=0};var G=typeof WebGL2RenderingContext<"u"&&F instanceof WebGL2RenderingContext,$={},te={},ae={},ne=-1,pe=[];F.canvas.addEventListener("webglcontextlost",function(de){ue(),de.preventDefault()},!1),c.set(F,j={gl:F,isWebGL2:G,getExtension:Ie,withProgram:Se,withTexture:O,withTextureFramebuffer:Me,handleContextLoss:ue})}V(j)}function d(W,V,F,j,G,$,te,ae){te===void 0&&(te=15),ae===void 0&&(ae=null),f(W,function(ne){var pe=ne.gl,Ie=ne.withProgram,Pe=ne.withTexture;Pe("copy",function(Se,O){pe.texImage2D(pe.TEXTURE_2D,0,pe.RGBA,G,$,0,pe.RGBA,pe.UNSIGNED_BYTE,V),Ie("copy",o,a,function(Me){var ue=Me.setUniform,de=Me.setAttribute;de("aUV",2,pe.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),ue("1i","image",O),pe.bindFramebuffer(pe.FRAMEBUFFER,ae||null),pe.disable(pe.BLEND),pe.colorMask(te&8,te&4,te&2,te&1),pe.viewport(F,j,G,$),pe.scissor(F,j,G,$),pe.drawArrays(pe.TRIANGLES,0,3)})})})}function p(W,V,F){var j=W.width,G=W.height;f(W,function($){var te=$.gl,ae=new Uint8Array(j*G*4);te.readPixels(0,0,j,G,te.RGBA,te.UNSIGNED_BYTE,ae),W.width=V,W.height=F,d(te,ae,0,0,j,G)})}var m=Object.freeze({__proto__:null,withWebGLContext:f,renderImageData:d,resizeWebGLCanvasWithoutClearing:p});function v(W,V,F,j,G,$){$===void 0&&($=1);var te=new Uint8Array(W*V),ae=j[2]-j[0],ne=j[3]-j[1],pe=[];r(F,function(de,oe,Ue,fe){pe.push({x1:de,y1:oe,x2:Ue,y2:fe,minX:Math.min(de,Ue),minY:Math.min(oe,fe),maxX:Math.max(de,Ue),maxY:Math.max(oe,fe)})}),pe.sort(function(de,oe){return de.maxX-oe.maxX});for(var Ie=0;Ie<W;Ie++)for(var Pe=0;Pe<V;Pe++){var Se=Me(j[0]+ae*(Ie+.5)/W,j[1]+ne*(Pe+.5)/V),O=Math.pow(1-Math.abs(Se)/G,$)/2;Se<0&&(O=1-O),O=Math.max(0,Math.min(255,Math.round(O*255))),te[Pe*W+Ie]=O}return te;function Me(de,oe){for(var Ue=1/0,fe=1/0,U=pe.length;U--;){var I=pe[U];if(I.maxX+fe<=de)break;if(de+fe>I.minX&&oe-fe<I.maxY&&oe+fe>I.minY){var X=_(de,oe,I.x1,I.y1,I.x2,I.y2);X<Ue&&(Ue=X,fe=Math.sqrt(Ue))}}return ue(de,oe)&&(fe=-fe),fe}function ue(de,oe){for(var Ue=0,fe=pe.length;fe--;){var U=pe[fe];if(U.maxX<=de)break;var I=U.y1>oe!=U.y2>oe&&de<(U.x2-U.x1)*(oe-U.y1)/(U.y2-U.y1)+U.x1;I&&(Ue+=U.y1<U.y2?1:-1)}return Ue!==0}}function S(W,V,F,j,G,$,te,ae,ne,pe){$===void 0&&($=1),ae===void 0&&(ae=0),ne===void 0&&(ne=0),pe===void 0&&(pe=0),y(W,V,F,j,G,$,te,null,ae,ne,pe)}
3728function y(W,V,F,j,G,$,te,ae,ne,pe,Ie){$===void 0&&($=1),ne===void 0&&(ne=0),pe===void 0&&(pe=0),Ie===void 0&&(Ie=0);for(var Pe=v(W,V,F,j,G,$),Se=new Uint8Array(Pe.length*4),O=0;O<Pe.length;O++)Se[O*4+Ie]=Pe[O];d(te,Se,ne,pe,W,V,1<<3-Ie,ae)}function _(W,V,F,j,G,$){var te=G-F,ae=$-j,ne=te*te+ae*ae,pe=ne?Math.max(0,Math.min(1,((W-F)*te+(V-j)*ae)/ne)):0,Ie=W-(F+pe*te),Pe=V-(j+pe*ae);return Ie*Ie+Pe*Pe}var E=Object.freeze({__proto__:null,generate:v,generateIntoCanvas:S,generateIntoFramebuffer:y}),M="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",b="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",P="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",R=new Float32Array([0,0,2,0,0,2]),L=null,D=!1,A={},C=new WeakMap;function k(W){if(!D&&!q(W))throw new Error("WebGL generation not supported")}function B(W,V,F,j,G,$,te){if($===void 0&&($=1),te===void 0&&(te=null),!te&&(te=L,!te)){var ae=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!ae)throw new Error("OffscreenCanvas or DOM canvas not supported");te=L=ae.getContext("webgl",{depth:!1})}k(te);var ne=new Uint8Array(W*V*4);f(te,function(Se){var O=Se.gl,Me=Se.withTexture,ue=Se.withTextureFramebuffer;Me("readable",function(de,oe){O.texImage2D(O.TEXTURE_2D,0,O.RGBA,W,V,0,O.RGBA,O.UNSIGNED_BYTE,null),ue(de,oe,function(Ue){N(W,V,F,j,G,$,O,Ue,0,0,0),O.readPixels(0,0,W,V,O.RGBA,O.UNSIGNED_BYTE,ne)})})});for(var pe=new Uint8Array(W*V),Ie=0,Pe=0;Ie<ne.length;Ie+=4)pe[Pe++]=ne[Ie];return pe}function ee(W,V,F,j,G,$,te,ae,ne,pe){$===void 0&&($=1),ae===void 0&&(ae=0),ne===void 0&&(ne=0),pe===void 0&&(pe=0),N(W,V,F,j,G,$,te,null,ae,ne,pe)}function N(W,V,F,j,G,$,te,ae,ne,pe,Ie){$===void 0&&($=1),ne===void 0&&(ne=0),pe===void 0&&(pe=0),Ie===void 0&&(Ie=0),k(te);var Pe=[];r(F,function(Se,O,Me,ue){Pe.push(Se,O,Me,ue)}),Pe=new Float32Array(Pe),f(te,function(Se){var O=Se.gl,Me=Se.isWebGL2,ue=Se.getExtension,de=Se.withProgram,oe=Se.withTexture,Ue=Se.withTextureFramebuffer,fe=Se.handleContextLoss;if(oe("rawDistances",function(U,I){(W!==U._lastWidth||V!==U._lastHeight)&&O.texImage2D(O.TEXTURE_2D,0,O.RGBA,U._lastWidth=W,U._lastHeight=V,0,O.RGBA,O.UNSIGNED_BYTE,null),de("main",M,b,function(X){var ye=X.setAttribute,ce=X.setUniform,he=!Me&&ue("ANGLE_instanced_arrays"),Te=!Me&&ue("EXT_blend_minmax");ye("aUV",2,O.STATIC_DRAW,0,R),ye("aLineSegment",4,O.DYNAMIC_DRAW,1,Pe),ce.apply(void 0,["4f","uGlyphBounds"].concat(j)),ce("1f","uMaxDistance",G),ce("1f","uExponent",$),Ue(U,I,function(Ne){O.enable(O.BLEND),O.colorMask(!0,!0,!0,!0),O.viewport(0,0,W,V),O.scissor(0,0,W,V),O.blendFunc(O.ONE,O.ONE),O.blendEquationSeparate(O.FUNC_ADD,Me?O.MAX:Te.MAX_EXT),O.clear(O.COLOR_BUFFER_BIT),Me?O.drawArraysInstanced(O.TRIANGLES,0,3,Pe.length/4):he.drawArraysInstancedANGLE(O.TRIANGLES,0,3,Pe.length/4)})}),de("post",o,P,function(X){X.setAttribute("aUV",2,O.STATIC_DRAW,0,R),X.setUniform("1i","tex",I),O.bindFramebuffer(O.FRAMEBUFFER,ae),O.disable(O.BLEND),O.colorMask(Ie===0,Ie===1,Ie===2,Ie===3),O.viewport(ne,pe,W,V),O.scissor(ne,pe,W,V),O.drawArrays(O.TRIANGLES,0,3)})}),O.isContextLost())throw fe(),new Error("webgl context lost")})}function q(W){var V=!W||W===L?A:W.canvas||W,F=C.get(V);if(F===void 0){D=!0;var j=null;try{var G=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],$=B(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,W);F=$&&G.length===$.length&&$.every(function(te,ae){return te===G[ae]}),F||(j="bad trial run results",console.info(G,$))}catch(te){F=!1,j=te.message}j&&console.warn("WebGL SDF generation not supported:",j),D=!1,C.set(V,F)}return F}var K=Object.freeze({__proto__:null,generate:B,generateIntoCanvas:ee,generateIntoFramebuffer:N,isSupported:q});function re(W,V,F,j,G,$){G===void 0&&(G=Math.max(j[2]-j[0],j[3]-j[1])/2),$===void 0&&($=1);try{return B.apply(K,arguments)}catch(te){return console.info("WebGL SDF generation failed, falling back to JS",te),v.apply(E,arguments)}}function Z(W,V,F,j,G,$,te,ae,ne,pe){G===void 0&&(G=Math.max(j[2]-j[0],j[3]-j[1])/2),$===void 0&&($=1),ae===void 0&&(ae=0),ne===void 0&&(ne=0),pe===void 0&&(pe=0);try{return ee.apply(K,arguments)}catch(Ie){return console.info("WebGL SDF generation failed, falling back to JS",Ie),S.apply(E,arguments)}}return e.forEachPathCommand=i,e.generate=re,e.generateIntoCanvas=Z,e.javascript=E,e.pathToLineSegments=r,e.webgl=K,e.webglUtils=m,Object.defineProperty(e,"__esMo
3728dule",{value:!0}),e}({});return s}function rC(){var s=function(e){var t={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},n={},i={};n.L=1,i[1]="L",Object.keys(t).forEach(function(fe,U){n[fe]=1<<U+1,i[n[fe]]=fe}),Object.freeze(n);var r=n.LRI|n.RLI|n.FSI,o=n.L|n.R|n.AL,a=n.B|n.S|n.WS|n.ON|n.FSI|n.LRI|n.RLI|n.PDI,c=n.BN|n.RLE|n.LRE|n.RLO|n.LRO|n.PDF,h=n.S|n.WS|n.B|r|n.PDI|c,f=null;function d(){if(!f){f=new Map;var fe=function(I){if(t.hasOwnProperty(I)){var X=0;t[I].split(",").forEach(function(ye){var ce=ye.split("+"),he=ce[0],Te=ce[1];he=parseInt(he,36),Te=Te?parseInt(Te,36):0,f.set(X+=he,n[I]);for(var Ne=0;Ne<Te;Ne++)f.set(++X,n[I])})}};for(var U in t)fe(U)}}function p(fe){return d(),f.get(fe.codePointAt(0))||n.L}function m(fe){return i[p(fe)]}var v={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function S(fe,U){var I=36,X=0,ye=new Map,ce=U&&new Map,he;return fe.split(",").forEach(function Te(Ne){if(Ne.indexOf("+")!==-1)for(var Ce=+Ne;Ce--;)Te(he);else{he=Ne;var De=Ne.split(">"),ke=De[0],xe=De[1];ke=String.fromCodePoint(X+=parseInt(ke,I)),xe=String.fromCodePoint(X+=parseInt(xe,I)),ye.set(ke,xe),U&&ce.set(xe,ke)}}),{map:ye,reverseMap:ce}}var y,_,E;function M(){if(!y){var fe=S(v.pairs,!0),U=fe.map,I=fe.reverseMap;y=U,_=I,E=S(v.canonical,!1).map}}function b(fe){return M(),y.get(fe)||null}function P(fe){return M(),_.get(fe)||null}function R(fe){return M(),E.get(fe)||null}var L=n.L,D=n.R,A=n.EN,C=n.ES,k=n.ET,B=n.AN,ee=n.CS,N=n.B,q=n.S,K=n.ON,re=n.BN,Z=n.NSM,W=n.AL,V=n.LRO,F=n.RLO,j=n.LRE,G=n.RLE,$=n.PDF,te=n.LRI,ae=n.RLI,ne=n.FSI,pe=n.PDI;function Ie(fe,U){for(var I=125,X=new Uint32Array(fe.length),ye=0;ye<fe.length;ye++)X[ye]=p(fe[ye]);var ce=new Map;function he(wn,$n){var an=X[wn];X[wn]=$n,ce.set(an,ce.get(an)-1),an&a&&ce.set(a,ce.get(a)-1),ce.set($n,(ce.get($n)||0)+1),$n&a&&ce.set(a,(ce.get(a)||0)+1)}for(var Te=new Uint8Array(fe.length),Ne=new Map,Ce=[],De=null,ke=0;ke<fe.length;ke++)De||Ce.push(De={start:ke,end:fe.length-1,level:U==="rtl"?1:U==="ltr"?0:go(ke,!1)}),X[ke]&N&&(De.end=ke,De=null);for(var xe=G|j|F|V|r|pe|$|N,it=function(wn){return wn+(wn&1?1:2)},tt=function(wn){return wn+(wn&1?2:1)},Xe=0;Xe<Ce.length;Xe++){De=Ce[Xe];var ze=[{_level:De.level,_override:0,_isolate:0}],Le=void 0,Q=0,we=0,We=0;ce.clear();for(var Be=De.start;Be<=De.end;Be++){var ge=X[Be];if(Le=ze[ze.length-1],ce.set(ge,(ce.get(ge)||0)+1),ge&a&&ce.set(a,(ce.get(a)||0)+1),ge&xe)if(ge&(G|j)){Te[Be]=Le._level;var J=(ge===G?tt:it)(Le._level);J<=I&&!Q&&!we?ze.push({_level:J,_override:0,_isolate:0}):Q||we++}else if(ge&(F|V)){Te[Be]=Le._level;var Ge=(ge===F?tt:it)(Le._level);Ge<=I&&!Q&&!we?ze.push({_level:Ge,_override:ge&F?D:L,_isolate:0}):Q||we++}else if(ge&r){ge&ne&&(ge=go(Be+1,!0)===1?ae:te),Te[Be]=Le._level,Le._override&&he(Be,Le._override);var Fe=(ge===ae?tt:it)(Le._level);Fe<=I&&Q===0&&we===0?(We++,ze.push({_level:Fe,_override:0,_isolate:1,_isolInitIndex:Be})):Q++}else if(ge&pe){if(Q>0)Q--;else if(We>0){for(we=0;!ze[ze.length-1]._isolate;)ze.pop();var He=ze[ze.length-1]._isolInitIndex;He!=null&&(Ne.set(He,Be),Ne.set(Be,He)),ze.pop(),We--}Le=ze[ze.length-1],Te[Be]=Le._level,Le._override&&he(Be,Le._override)}else ge&$?(Q===0&&(we>0?we--:!Le._isolate&&ze.length>1&&(ze.pop(),Le=ze[ze.length-1])),Te[Be]=Le._level):ge&N&&(Te[Be]=De.level);else Te[Be]=Le._level,Le._override&&ge!==re&&he(Be,Le._override)}for(var je=[],rt=null,Ze=De.start;Ze<=De.end;Ze++){var ht=X[Ze];if(!(ht&c)){var At=Te[Ze],gt=ht&r,Lt=ht===pe;rt&&At===rt._level?(rt._end=Ze,rt._endsWithIsolInit=gt):je.push(rt={_start:Ze,_end:Ze,_level:At,_startsWithPDI:Lt,_endsWithIsolInit:gt})}}for(var Yt=[],oi=0;oi<je.length;oi++){var jn=je[oi];if(!jn._startsWithPDI||jn._startsWithPDI&&!Ne.has(jn._start)){for(var qn=[rt=jn],Dn=void 0;rt&&rt._endsWithIsolInit&&(Dn=Ne.get(rt._end))!=null;)for(var Nn=oi+1;Nn<je.length;Nn++)if(je[Nn]._start===Dn){qn.push(rt=je[Nn]);break}for(var dn=[],Ri=0;Ri<qn.length;Ri++)for(var ho=qn[Ri],ps=ho._start;ps<=ho._end;ps++)dn.push(ps);for(var _a=Te[dn[0]],z=De.level,le=dn[0]-1;le>=0;le--)if(!(X[le]&c)){z=Te[le];break}var _e=dn[dn.length-1],Ee=Te[_e],ve=De.level;if(!(X[_e]&r)){for(var Je=_e+1;Je<=De.end;Je++)if(!(X[Je]&c)){ve=Te[Je];break}}Yt.push({_seqIndices:dn,_sosType:Math.max(z,_a)%2?D:L,_eosType:Math.max(ve,Ee)%2?D:L})}}for(var ot=0;ot<Yt.length;ot++){var ct=Yt[ot],Oe=ct._seqIndices,mt=ct._sosType,vt=ct._eosType,ft=Te[Oe[0]]&1?D:L;if(ce.get(Z))for(var zt=0;zt<Oe.length;zt++){var pn=Oe[zt];if(X[pn]&Z){for(var Ot=mt,qt=zt-1;qt>=0;qt--)if(!(X[Oe[qt]]&c)){Ot=X[Oe[qt]];break}he(pn,Ot&(r|pe)?K:Ot)}}if(ce.get(A))for(var ut=0;ut<Oe.length;ut++){var et=Oe[ut];if(X[et]&A)for(var Pn=ut-1;Pn>=-1;Pn--){var Mt=Pn===-1?mt:X[Oe[Pn]];if(Mt&o){Mt===W&&he(et,B);break}}}if(ce.get(W))for(var Vt=0;Vt<Oe.length;Vt++){var vi=Oe[Vt];X[vi]&W&&he(vi,D)}if(ce.get(C)||ce.get(ee))for(var Mn=1;Mn<Oe.length-1;Mn++){var $t=Oe[Mn];if(X[$t]&(C|ee)){for(var Gt=0,ai=0,Ki=Mn-1;Ki>=0&&(Gt=X[Oe[Ki]],!!(Gt&c));Ki--);for(var on=Mn+1;on<Oe.length&&(ai=X[Oe[on]],!!(ai&c));on++);Gt===ai&&(X[$t]===C?Gt===A:Gt&(A|B))&&he($t,Gt)}}if(ce.get(A))for(var Ln=0;Ln<Oe.length;Ln++){var Zn=Oe[Ln];if(X[Zn]&A){for(var ur=Ln-1;ur>=0&&X[Oe[ur]]&(k|c);ur--)he(Oe[ur],A);for(Ln++;Ln<Oe.length&&X[Oe[Ln]]&(k|c|A);Ln++)X[Oe[Ln]]!==A&&he(Oe[Ln],A)}}if(ce.get(k)||ce.get(C)||ce.get(ee))for(var ms=0;ms<Oe.length;ms++){var Xl=Oe[ms];if(X[Xl]&(k|C|ee)){he(Xl,K);for(var hr=ms-1;hr>=0&&X[Oe[hr]]&c;hr--)he(Oe[hr],K);for(var fr=ms+1;fr<Oe.length&&X[Oe[fr]]&c;fr++)he(Oe[fr],K)}}if(ce.get(A))for(var dr=0,gs=mt;dr<Oe.length;dr++){var Yl=Oe[dr],ya=X[Yl];ya&A?gs===L&&he(Yl,L):ya&o&&(gs=ya)}if(ce.get(a)){var pr=D|A|B,fo=pr|L,Qi=[];{for(var kr=[],$i=0;$i<Oe.length;
vendor: 1,811 bytes, line 3728
3728$i++)if(X[Oe[$i]]&a){var Pt=fe[Oe[$i]],xa=void 0;if(b(Pt)!==null)if(kr.length<63)kr.push({char:Pt,seqIndex:$i});else break;else if((xa=P(Pt))!==null)for(var mr=kr.length-1;mr>=0;mr--){var po=kr[mr].char;if(po===xa||po===P(R(Pt))||b(R(po))===Pt){Qi.push([kr[mr].seqIndex,$i]),kr.length=mr;break}}}Qi.sort(function(wn,$n){return wn[0]-$n[0]})}for(var Sa=0;Sa<Qi.length;Sa++){for(var jl=Qi[Sa],Zt=jl[0],vs=jl[1],ql=!1,Jn=0,Ma=Zt+1;Ma<vs;Ma++){var _s=Oe[Ma];if(X[_s]&fo){ql=!0;var _i=X[_s]&pr?D:L;if(_i===ft){Jn=_i;break}}}if(ql&&!Jn){Jn=mt;for(var Ea=Zt-1;Ea>=0;Ea--){var Zl=Oe[Ea];if(X[Zl]&fo){var yi=X[Zl]&pr?D:L;yi!==ft?Jn=yi:Jn=ft;break}}}if(Jn){if(X[Oe[Zt]]=X[Oe[vs]]=Jn,Jn!==ft){for(var Kn=Zt+1;Kn<Oe.length;Kn++)if(!(X[Oe[Kn]]&c)){p(fe[Oe[Kn]])&Z&&(X[Oe[Kn]]=Jn);break}}if(Jn!==ft){for(var er=vs+1;er<Oe.length;er++)if(!(X[Oe[er]]&c)){p(fe[Oe[er]])&Z&&(X[Oe[er]]=Jn);break}}}}for(var Pi=0;Pi<Oe.length;Pi++)if(X[Oe[Pi]]&a){for(var wa=Pi,ba=Pi,li=mt,ys=Pi-1;ys>=0;ys--)if(X[Oe[ys]]&c)wa=ys;else{li=X[Oe[ys]]&pr?D:L;break}for(var xs=vt,Ss=Pi+1;Ss<Oe.length;Ss++)if(X[Oe[Ss]]&(a|c))ba=Ss;else{xs=X[Oe[Ss]]&pr?D:L;break}for(var Qn=wa;Qn<=ba;Qn++)X[Oe[Qn]]=li===xs?li:ft;Pi=ba}}}for(var En=De.start;En<=De.end;En++){var mo=Te[En],ki=X[En];if(mo&1?ki&(L|A|B)&&Te[En]++:ki&D?Te[En]++:ki&(B|A)&&(Te[En]+=2),ki&c&&(Te[En]=En===0?De.level:Te[En-1]),En===De.end||p(fe[En])&(q|N))for(var zr=En;zr>=0&&p(fe[zr])&h;zr--)Te[zr]=De.level}}return{levels:Te,paragraphs:Ce};function go(wn,$n){for(var an=wn;an<fe.length;an++){var ln=X[an];if(ln&(D|W))return 1;if(ln&(N|L)||$n&&ln===pe)return 0;if(ln&r){var xi=Jl(an);an=xi===-1?fe.length:xi}}return 0}function Jl(wn){for(var $n=1,an=wn+1;an<fe.length;an++){var ln=X[an];if(ln&N)break;if(ln&pe){if(--$n===0)return an}else ln&r&&$n++}return-1}}var Pe="14>1,j>2,t>2,u>2,1a>g,2v3>
37281,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",Se;function O(){if(!Se){var fe=S(Pe,!0),U=fe.map,I=fe.reverseMap;I.forEach(function(X,ye){U.set(ye,X)}),Se=U}}function Me(fe){return O(),Se.get(fe)||null}function ue(fe,U,I,X){var ye=fe.length;I=Math.max(0,I==null?0:+I),X=Math.min(ye-1,X==null?ye-1:+X);for(var ce=new Map,he=I;he<=X;he++)if(U[he]&1){var Te=Me(fe[he]);Te!==null&&ce.set(he,Te)}return ce}function de(fe,U,I,X){var ye=fe.length;I=Math.max(0,I==null?0:+I),X=Math.min(ye-1,X==null?ye-1:+X);var ce=[];return U.paragraphs.forEach(function(he){var Te=Math.max(I,he.start),Ne=Math.min(X,he.end);if(Te<Ne){for(var Ce=U.levels.slice(Te,Ne+1),De=Ne;De>=Te&&p(fe[De])&h;De--)Ce[De]=he.level;for(var ke=he.level,xe=1/0,it=0;it<Ce.length;it++){var tt=Ce[it];tt>ke&&(ke=tt),tt<xe&&(xe=tt|1)}for(var Xe=ke;Xe>=xe;Xe--)for(var ze=0;ze<Ce.length;ze++)if(Ce[ze]>=Xe){for(var Le=ze;ze+1<Ce.length&&Ce[ze+1]>=Xe;)ze++;ze>Le&&ce.push([Le+Te,ze+Te])}}}),ce}function oe(fe,U,I,X){var ye=Ue(fe,U,I,X),ce=[].concat(fe);return ye.forEach(function(he,Te){ce[Te]=(U.levels[he]&1?Me(fe[he]):null)||fe[he]}),ce.join("")}function Ue(fe,U,I,X){for(var ye=de(fe,U,I,X),ce=[],he=0;he<fe.length;he++)ce[he]=he;return ye.forEach(function(Te){for(var Ne=Te[0],Ce=Te[1],De=ce.slice(Ne,Ce+1),ke=De.length;ke--;)ce[Ce-ke]=De[ke]}),ce}return e.closingToOpeningBracket=P,e.getBidiCharType=p,e.getBidiCharTypeName=m,e.getCanonicalBracket=R,e.getEmbeddingLevels=Ie,e.getMirroredCharacter=Me,e.getMirroredCharactersMap=ue,e.getReorderSegments=de,e.getReorderedIndices=Ue,e.getReorderedString=oe,e.openingToClosingBracket=b,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return s}const vx=/\bvoid\s+main\s*\(\s*\)\s*{/g;function lp(s){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function t(n,i){let r=Et[i];return r?lp(r):n}return s.replace(e,t)}const Un=[];for(let s=0;s<256;s++)Un[s]=(s<16?"0":"")+s.toString(16);function sC(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Un[s&255]+Un[s>>8&255]+Un[s>>16&255]+Un[s>>24&255]+"-"+Un[e&255]+Un[e>>8&255]+"-"+Un[e>>16&15|64]+Un[e>>24&255]+"-"+Un[t&63|128]+Un[t>>8&255]+"-"+Un[t>>16&255]+Un[t>>24&255]+Un[n&255]+Un[n>>8&255]+Un[n>>16&255]+Un[n>>24&255]).toUpperCase()}const Gs=Object.assign||function(){let s=arguments[0];for(let e=1,t=arguments.length;e<t;e++){let n=arguments[e];if(n)for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[i]=n[i])}return s},oC=Date.now(),bv=new WeakMap,Tv=new Map;let aC=1e10;function cp(s,e){const t=hC(e);let n=bv.get(s);if(n||bv.set(s,n=Object.create(null)),n[t])return new n[t];const i=`_onBeforeCompile${t}`,r=function(h,f){s.onBeforeCompile.call(this,h,f);const d=this.customProgramCacheKey()+"|"+h.vertexShader+"|"+h.fragmentShader;let p=Tv[d];if(!p){const m=lC(this,h,e,t);p=Tv[d]=m}h.vertexShader=p.vertexShader,h.fragmentShader=p.fragmentShader,Gs(h.uniforms,this.uniforms),e.timeUniform&&(h.uniforms[e.timeUniform]={get value(){return Date.now()-oC}}),this[i]&&this[i](h)}
3728,o=function(){return a(e.chained?s:s.clone())},a=function(h){const f=Object.create(h,c);return Object.defineProperty(f,"baseMaterial",{value:s}),Object.defineProperty(f,"id",{value:aC++}),f.uuid=sC(),f.uniforms=Gs({},h.uniforms,e.uniforms),f.defines=Gs({},h.defines,e.defines),f.defines[`TROIKA_DERIVED_MATERIAL_${t}`]="",f.extensions=Gs({},h.extensions,e.extensions),f._listeners=void 0,f},c={constructor:{value:o},isDerivedMaterial:{value:!0},type:{get:()=>s.type,set:h=>{s.type=h}},isDerivedFrom:{writable:!0,configurable:!0,value:function(h){const f=this.baseMaterial;return h===f||f.isDerivedMaterial&&f.isDerivedFrom(h)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return s.customProgramCacheKey()+"|"+t}},onBeforeCompile:{get(){return r},set(h){this[i]=h}},copy:{writable:!0,configurable:!0,value:function(h){return s.copy.call(this,h),!s.isShaderMaterial&&!s.isDerivedMaterial&&(Gs(this.extensions,h.extensions),Gs(this.defines,h.defines),Gs(this.uniforms,Rp.clone(h.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const h=new s.constructor;return a(h).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let h=this._depthMaterial;return h||(h=this._depthMaterial=cp(s.isDerivedMaterial?s.getDepthMaterial():new rh({depthPacking:Mp}),e),h.defines.IS_DEPTH_MATERIAL="",h.uniforms=this.uniforms),h}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let h=this._distanceMaterial;return h||(h=this._distanceMaterial=cp(s.isDerivedMaterial?s.getDistanceMaterial():new sh,e),h.defines.IS_DISTANCE_MATERIAL="",h.uniforms=this.uniforms),h}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:h,_distanceMaterial:f}=this;h&&h.dispose(),f&&f.dispose(),s.dispose.call(this)}}};return n[t]=o,new o}function lC(s,{vertexShader:e,fragmentShader:t},n,i){let{vertexDefs:r,vertexMainIntro:o,vertexMainOutro:a,vertexTransform:c,fragmentDefs:h,fragmentMainIntro:f,fragmentMainOutro:d,fragmentColorTransform:p,customRewriter:m,timeUniform:v}=n;if(r=r||"",o=o||"",a=a||"",h=h||"",f=f||"",d=d||"",(c||m)&&(e=lp(e)),(p||m)&&(t=t.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,` 3729//!BEGIN_POST_CHUNK $1 3730$& 3731//!END_POST_CHUNK 3732`),t=lp(t)),m){let S=m({vertexShader:e,fragmentShader:t});e=S.vertexShader,t=S.fragmentShader}if(p){let S=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,y=>(S.push(y),"")),d=`${p} 3733${S.join(` 3734`)} 3735${d}`}if(v){const S=` 3736uniform float ${v}; 3737`;r=S+r,h=S+h}return c&&(e=`vec3 troika_position_${i}; 3738vec3 troika_normal_${i}; 3739vec2 troika_uv_${i}; 3740${e} 3741`,r=`${r} 3742void troikaVertexTransform${i}(inout vec3 position, inout vec3 normal, inout vec2 uv) { 3743 ${c} 3744} 3745`,o=` 3746troika_position_${i} = vec3(position); 3747troika_normal_${i} = vec3(normal); 3748troika_uv_${i} = vec2(uv); 3749troikaVertexTransform${i}(troika_position_${i}, troika_normal_${i}, troika_uv_${i}); 3750${o} 3751`,e=e.replace(/\b(position|normal|uv)\b/g,(S,y,_,E)=>/\battribute\s+vec[23]\s+$/.test(E.substr(0,_))?y:`troika_${y}_${i}`),s.map&&s.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=Av(e,i,r,o,a),t=Av(t,i,h,f,d),{vertexShader:e,fragmentShader:t}}function Av(s,e,t,n,i){return(n||i||t)&&(s=s.replace(vx,` 3752${t} 3753void troikaOrigMain${e}() {`),s+=` 3754void main() { 3755 ${n} 3756 troikaOrigMain${e}(); 3757 ${i} 3758}`),s}function cC(s,e){return s==="uniforms"?void 0:typeof e=="function"?e.toString():e}let uC=0;const Cv=new Map;function hC(s){const e=JSON.stringify(s,cC);let t=Cv.get(e);return t==null&&Cv.set(e,t=++uC),t}/*! 3759Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering. 3760Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE 3761*/function fC(){return typeof window>"u"&&(self.window=self),function(s){var e={parse:function(i){var r=e._bin,o=new Uint8Array(i);if(r.readASCII(o,0,4)=="ttcf"){var a=4;r.readUshort(o,a),a+=2,r.readUshort(o,a),a+=2;var c=r.readUint(o,a);a+=4;for(var h=[],f=0;f<c;f++){var d=r.readUint(o,a);a+=4,h.push(e._readFont(o,d))}return h}return[e._readFont(o,0)]},_readFont:function(i,r){var o=e._bin,a=r;o.readFixed(i,r),r+=4;var c=o.readUshort(i,r);r+=2,o.readUshort(i,r),r+=2,o.readUshort(i,r),r+=2,o.readUshort(i,r),r+=2;
vendor: 2,366 bytes, line 3761
3761for(var h=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],f={_data:i,_offset:a},d={},p=0;p<c;p++){var m=o.readASCII(i,r,4);r+=4,o.readUint(i,r),r+=4;var v=o.readUint(i,r);r+=4;var S=o.readUint(i,r);r+=4,d[m]={offset:v,length:S}}for(p=0;p<h.length;p++){var y=h[p];d[y]&&(f[y.trim()]=e[y.trim()].parse(i,d[y].offset,d[y].length,f))}return f},_tabOffset:function(i,r,o){for(var a=e._bin,c=a.readUshort(i,o+4),h=o+12,f=0;f<c;f++){var d=a.readASCII(i,h,4);h+=4,a.readUint(i,h),h+=4;var p=a.readUint(i,h);if(h+=4,a.readUint(i,h),h+=4,d==r)return p}return 0}};e._bin={readFixed:function(i,r){return(i[r]<<8|i[r+1])+(i[r+2]<<8|i[r+3])/65540},readF2dot14:function(i,r){return e._bin.readShort(i,r)/16384},readInt:function(i,r){return e._bin._view(i).getInt32(r)},readInt8:function(i,r){return e._bin._view(i).getInt8(r)},readShort:function(i,r){return e._bin._view(i).getInt16(r)},readUshort:function(i,r){return e._bin._view(i).getUint16(r)},readUshorts:function(i,r,o){for(var a=[],c=0;c<o;c++)a.push(e._bin.readUshort(i,r+2*c));return a},readUint:function(i,r){return e._bin._view(i).getUint32(r)},readUint64:function(i,r){return 4294967296*e._bin.readUint(i,r)+e._bin.readUint(i,r+4)},readASCII:function(i,r,o){for(var a="",c=0;c<o;c++)a+=String.fromCharCode(i[r+c]);return a},readUnicode:function(i,r,o){for(var a="",c=0;c<o;c++){var h=i[r++]<<8|i[r++];a+=String.fromCharCode(h)}return a},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(i,r,o){var a=e._bin._tdec;return a&&r==0&&o==i.length?a.decode(i):e._bin.readASCII(i,r,o)},readBytes:function(i,r,o){for(var a=[],c=0;c<o;c++)a.push(i[r+c]);return a},readASCIIArray:function(i,r,o){for(var a=[],c=0;c<o;c++)a.push(String.fromCharCode(i[r+c]));return a},_view:function(i){return i._dataView||(i._dataView=i.buffer?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(new Uint8Array(i).buffer))}},e._lctf={},e._lctf.parse=function(i,r,o,a,c){var h=e._bin,f={},d=r;h.readFixed(i,r),r+=4;var p=h.readUshort(i,r);r+=2;var m=h.readUshort(i,r);r+=2;var v=h.readUshort(i,r);return r+=2,f.scriptList=e._lctf.readScriptList(i,d+p),f.featureList=e._lctf.readFeatureList(i,d+m),f.lookupList=e._lctf.readLookupList(i,d+v,c),f},e._lctf.readLookupList=function(i,r,o){var a=e._bin,c=r,h=[],f=a.readUshort(i,r);r+=2;
3761for(var d=0;d<f;d++){var p=a.readUshort(i,r);r+=2;var m=e._lctf.readLookupTable(i,c+p,o);h.push(m)}return h},e._lctf.readLookupTable=function(i,r,o){var a=e._bin,c=r,h={tabs:[]};h.ltype=a.readUshort(i,r),r+=2,h.flag=a.readUshort(i,r),r+=2;var f=a.readUshort(i,r);r+=2;for(var d=h.ltype,p=0;p<f;p++){var m=a.readUshort(i,r);r+=2;var v=o(i,d,c+m,h);h.tabs.push(v)}return h},e._lctf.numOfOnes=function(i){for(var r=0,o=0;o<32;o++)i>>>o&1&&r++;return r},e._lctf.readClassDef=function(i,r){var o=e._bin,a=[],c=o.readUshort(i,r);if(r+=2,c==1){var h=o.readUshort(i,r);r+=2;var f=o.readUshort(i,r);r+=2;for(var d=0;d<f;d++)a.push(h+d),a.push(h+d),a.push(o.readUshort(i,r)),r+=2}if(c==2){var p=o.readUshort(i,r);for(r+=2,d=0;d<p;d++)a.push(o.readUshort(i,r)),r+=2,a.push(o.readUshort(i,r)),r+=2,a.push(o.readUshort(i,r)),r+=2}return a},e._lctf.getInterval=function(i,r){for(var o=0;o<i.length;o+=3){var a=i[o],c=i[o+1];if(i[o+2],a<=r&&r<=c)return o}return-1},e._lctf.readCoverage=function(i,r){var o=e._bin,a={};a.fmt=o.readUshort(i,r),r+=2;var c=o.readUshort(i,r);return r+=2,a.fmt==1&&(a.tab=o.readUshorts(i,r,c)),a.fmt==2&&(a.tab=o.readUshorts(i,r,3*c)),a},e._lctf.coverageIndex=function(i,r){var o=i.tab;if(i.fmt==1)return o.indexOf(r);if(i.fmt==2){var a=e._lctf.getInterval(o,r);if(a!=-1)return o[a+2]+(r-o[a])}return-1},e._lctf.readFeatureList=function(i,r){var o=e._bin,a=r,c=[],h=o.readUshort(i,r);r+=2;
3761for(var f=0;f<h;f++){var d=o.readASCII(i,r,4);r+=4;var p=o.readUshort(i,r);r+=2;var m=e._lctf.readFeatureTable(i,a+p);m.tag=d.trim(),c.push(m)}return c},e._lctf.readFeatureTable=function(i,r){var o=e._bin,a=r,c={},h=o.readUshort(i,r);r+=2,h>0&&(c.featureParams=a+h);var f=o.readUshort(i,r);r+=2,c.tab=[];for(var d=0;d<f;d++)c.tab.push(o.readUshort(i,r+2*d));return c},e._lctf.readScriptList=function(i,r){var o=e._bin,a=r,c={},h=o.readUshort(i,r);r+=2;for(var f=0;f<h;f++){var d=o.readASCII(i,r,4);r+=4;var p=o.readUshort(i,r);r+=2,c[d.trim()]=e._lctf.readScriptTable(i,a+p)}return c},e._lctf.readScriptTable=function(i,r){var o=e._bin,a=r,c={},h=o.readUshort(i,r);r+=2,h>0&&(c.default=e._lctf.readLangSysTable(i,a+h));var f=o.readUshort(i,r);r+=2;for(var d=0;d<f;d++){var p=o.readASCII(i,r,4);r+=4;var m=o.readUshort(i,r);r+=2,c[p.trim()]=e._lctf.readLangSysTable(i,a+m)}return c},e._lctf.readLangSysTable=function(i,r){var o=e._bin,a={};o.readUshort(i,r),r+=2,a.reqFeature=o.readUshort(i,r),r+=2;var c=o.readUshort(i,r);return r+=2,a.features=o.readUshorts(i,r,c),a},e.CFF={},e.CFF.parse=function(i,r,o){var a=e._bin;(i=new Uint8Array(i.buffer,r,o))[r=0],i[++r],i[++r],i[++r],r++;var c=[];r=e.CFF.readIndex(i,r,c);for(var h=[],f=0;f<c.length-1;f++)h.push(a.readASCII(i,r+c[f],c[f+1]-c[f]));r+=c[c.length-1];var d=[];r=e.CFF.readIndex(i,r,d);var p=[];for(f=0;f<d.length-1;f++)p.push(e.CFF.readDict(i,r+d[f],r+d[f+1]));r+=d[d.length-1];var m=p[0],v=[];r=e.CFF.readIndex(i,r,v);var S=[];for(f=0;f<v.length-1;f++)S.push(a.readASCII(i,r+v[f],v[f+1]-v[f]));if(r+=v[v.length-1],e.CFF.readSubrs(i,r,m),m.CharStrings){r=m.CharStrings,v=[],r=e.CFF.readIndex(i,r,v);var y=[];for(f=0;f<v.length-1;f++)y.push(a.readBytes(i,r+v[f],v[f+1]-v[f]));m.CharStrings=y}if(m.ROS){r=m.FDArray;var _=[];for(r=e.CFF.readIndex(i,r,_),m.FDArray=[],f=0;f<_.length-1;f++){var E=e.CFF.readDict(i,r+_[f],r+_[f+1]);e.CFF._readFDict(i,E,S),m.FDArray.push(E)}r+=_[_.length-1],r=m.FDSelect,m.FDSelect=[];var M=i[r];if(r++,M!=3)throw M;var b=a.readUshort(i,r);for(r+=2,f=0;f<b+1;f++)m.FDSelect.push(a.readUshort(i,r),i[r+2]),r+=3}return m.Encoding&&(m.Encoding=e.CFF.readEncoding(i,m.Encoding,m.CharStrings.length)),m.charset&&(m.charset=e.CFF.readCharset(i,m.charset,m.CharStrings.length)),e.CFF._readFDict(i,m,S),m},e.CFF._readFDict=function(i,r,o){var a;for(var c in r.Private&&(a=r.Private[1],r.Private=e.CFF.readDict(i,a,a+r.Private[0]),r.Private.Subrs&&e.CFF.readSubrs(i,a+r.Private.Subrs,r.Private)),r)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(c)!=-1&&(r[c]=o[r[c]-426+35])},e.CFF.readSubrs=function(i,r,o){var a=e._bin,c=[];r=e.CFF.readIndex(i,r,c);var h,f=c.length;h=f<1240?107:f<33900?1131:32768,o.Bias=h,o.Subrs=[];for(var d=0;d<c.length-1;d++)o.Subrs.push(a.readBytes(i,r+c[d],c[d+1]-c[d]))},e.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(i,r){for(var o=0;o<i.charset.length;o++)if(i.charset[o]==r)return o;return-1},e.CFF.glyphBySE=function(i,r){return r<0||r>255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[r])},e.CFF.readEncoding=function(i,r,o){e._bin;var a=[".notdef"],c=i[r];if(r++,c!=0)throw"error: unknown encoding format: "+c;var h=i[r];r++;for(var f=0;f<h;f++)a.push(i[r+f]);return a},e.CFF.readCharset=function(i,r,o){var a=e._bin,c=[".notdef"],h=i[r];if(r++,h==0)for(var f=0;f<o;f++){var d=a.readUshort(i,r);r+=2,c.push(d)}else{if(h!=1&&h!=2)throw"error: format: "+h;for(;c.length<o;){d=a.readUshort(i,r),r+=2;var p=0;for(h==1?(p=i[r],r++):(p=a.readUshort(i,r),r+=2),f=0;f<=p;f++)c.push(d),d++}}return c},e.CFF.readIndex=function(i,r,o){var a=e._bin,c=a.readUshort(i,r)+1,h=i[r+=2];if(r++,h==1)for(var f=0;f<c;f++)o.push(i[r+f]);else if(h==2)for(f=0;f<c;f++)o.push(a.readUshort(i,r+2*f));else if(h==3)for(f=0;f<c;f++)o.push(16777215&a.readUint(i,r+3*f-1));else if(c!=1)throw"unsupported offset size: "+h+", count: "+c;return(r+=c*h)-1},e.CFF.getCharString=function(i,r,o){var a=e._bin,c=i[r],h=i[r+1];i[r+2],i[r+3],i[r+4];var f=1,d=null,p=null;
3761c<=20&&(d=c,f=1),c==12&&(d=100*c+h,f=2),21<=c&&c<=27&&(d=c,f=1),c==28&&(p=a.readShort(i,r+1),f=3),29<=c&&c<=31&&(d=c,f=1),32<=c&&c<=246&&(p=c-139,f=1),247<=c&&c<=250&&(p=256*(c-247)+h+108,f=2),251<=c&&c<=254&&(p=256*-(c-251)-h-108,f=2),c==255&&(p=a.readInt(i,r+1)/65535,f=5),o.val=p??"o"+d,o.size=f},e.CFF.readCharString=function(i,r,o){for(var a=r+o,c=e._bin,h=[];r<a;){var f=i[r],d=i[r+1];i[r+2],i[r+3],i[r+4];var p=1,m=null,v=null;f<=20&&(m=f,p=1),f==12&&(m=100*f+d,p=2),f!=19&&f!=20||(m=f,p=2),21<=f&&f<=27&&(m=f,p=1),f==28&&(v=c.readShort(i,r+1),p=3),29<=f&&f<=31&&(m=f,p=1),32<=f&&f<=246&&(v=f-139,p=1),247<=f&&f<=250&&(v=256*(f-247)+d+108,p=2),251<=f&&f<=254&&(v=256*-(f-251)-d-108,p=2),f==255&&(v=c.readInt(i,r+1)/65535,p=5),h.push(v??"o"+m),r+=p}return h},e.CFF.readDict=function(i,r,o){for(var a=e._bin,c={},h=[];r<o;){var f=i[r],d=i[r+1];i[r+2],i[r+3],i[r+4];var p=1,m=null,v=null;if(f==28&&(v=a.readShort(i,r+1),p=3),f==29&&(v=a.readInt(i,r+1),p=5),32<=f&&f<=246&&(v=f-139,p=1),247<=f&&f<=250&&(v=256*(f-247)+d+108,p=2),251<=f&&f<=254&&(v=256*-(f-251)-d-108,p=2),f==255)throw v=a.readInt(i,r+1)/65535,p=5,"unknown number";if(f==30){var S=[];for(p=1;;){var y=i[r+p];p++;var _=y>>4,E=15&y;if(_!=15&&S.push(_),E!=15&&S.push(E),E==15)break}for(var M="",b=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],P=0;P<S.length;P++)M+=b[S[P]];v=parseFloat(M)}f<=21&&(m=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][f],p=1,f==12&&(m=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][d],p=2)),m!=null?(c[m]=h.length==1?h[0]:h,h=[]):h.push(v),r+=p}return c},e.cmap={},e.cmap.parse=function(i,r,o){i=new Uint8Array(i.buffer,r,o),r=0;var a=e._bin,c={};a.readUshort(i,r),r+=2;var h=a.readUshort(i,r);r+=2;var f=[];c.tables=[];for(var d=0;d<h;d++){var p=a.readUshort(i,r);r+=2;var m=a.readUshort(i,r);r+=2;var v=a.readUint(i,r);r+=4;var S="p"+p+"e"+m,y=f.indexOf(v);if(y==-1){var _;y=c.tables.length,f.push(v);var E=a.readUshort(i,v);E==0?_=e.cmap.parse0(i,v):E==4?_=e.cmap.parse4(i,v):E==6?_=e.cmap.parse6(i,v):E==12?_=e.cmap.parse12(i,v):console.debug("unknown format: "+E,p,m,v),c.tables.push(_)}if(c[S]!=null)throw"multiple tables for one platform+encoding";c[S]=y}return c},e.cmap.parse0=function(i,r){var o=e._bin,a={};a.format=o.readUshort(i,r),r+=2;var c=o.readUshort(i,r);r+=2,o.readUshort(i,r),r+=2,a.map=[];for(var h=0;h<c-6;h++)a.map.push(i[r+h]);return a},e.cmap.parse4=function(i,r){var o=e._bin,a=r,c={};c.format=o.readUshort(i,r),r+=2;var h=o.readUshort(i,r);r+=2,o.readUshort(i,r),r+=2;var f=o.readUshort(i,r);r+=2;var d=f/2;c.searchRange=o.readUshort(i,r),r+=2,c.entrySelector=o.readUshort(i,r),r+=2,c.rangeShift=o.readUshort(i,r),r+=2,c.endCount=o.readUshorts(i,r,d),r+=2*d,r+=2,c.startCount=o.readUshorts(i,r,d),r+=2*d,c.idDelta=[];for(var p=0;p<d;p++)c.idDelta.push(o.readShort(i,r)),r+=2;for(c.idRangeOffset=o.readUshorts(i,r,d),r+=2*d,c.glyphIdArray=[];r<a+h;)c.glyphIdArray.push(o.readUshort(i,r)),r+=2;return c},e.cmap.parse6=function(i,r){var o=e._bin,a={};a.format=o.readUshort(i,r),r+=2,o.readUshort(i,r),r+=2,o.readUshort(i,r),r+=2,a.firstCode=o.readUshort(i,r),r+=2;var c=o.readUshort(i,r);r+=2,a.glyphIdArray=[];for(var h=0;h<c;h++)a.glyphIdArray.push(o.readUshort(i,r)),r+=2;return a},e.cmap.parse12=function(i,r){var o=e._bin,a={};a.format=o.readUshort(i,r),r+=2,r+=2,o.readUint(i,r),r+=4,o.readUint(i,r),r+=4;var c=o.readUint(i,r);r+=4,a.groups=[];for(var h=0;h<c;h++){var f=r+12*h,d=o.readUint(i,f+0),p=o.readUint(i,f+4),m=o.readUint(i,f+8);a.groups.push([d,p,m])}return a},e.glyf={},e.glyf.parse=function(i,r,o,a){for(var c=[],h=0;h<a.maxp.numGlyphs;h++)c.push(null);return c},e.glyf._parseGlyf=function(i,r){var o=e._bin,a=i._data,c=e._tabOffset(a,"glyf",i._offset)+i.loca[r];if(i.loca[r]==i.loca[r+1])return null;var h={};if(h.noc=o.readShort(a,c),c+=2,h.xMin=o.readShort(a,c),c+=2,h.yMin=o.readShort(a,c),c+=2,h.xMax=o.readShort(a,c),c+=2,h.yMax=o.readShort(a,c),c+=2,h.xMin>=h.xMax||h.yMin>=h.yMax)return null;if(h.noc>0){h.endPts=[];for(var f=0;f<h.noc;f++)h.endPts.push(o.readUshort(a,c)),c+=2;var d=o.readUshort(a,c);if(c+=2,a.length-c<d)return null;h.instructions=o.readBytes(a,c,d),c+=d;var p=h.endPts[h.noc-1]+1;for(h.flags=[],f=0;f<p;f++){var m=a[c];if(c++,h.flags.push(m),(8&m)!=0){var v=a[c];c++;for(var S=0;S<v;S++)h.flags.push(m),f++}}for(h.xs=[],f=0;f<p;f++){var y=(2&h.flags[f])!=0,_=(16&h.flags[f])!=0;y?(h.xs.push(_?a[c]:-a[c]),c++):_?h.xs.push(0):(h.xs.push(o.readShort(a,c)),c+=2)}for(h.ys=[],f=0;f<p;f++)y=(4&h.flags[f])!=0,_=(32&h.flags[f])!=0,y?(h.ys.push(_?a[c]:-a[c]),c++):_?h.ys.push(0):(h.ys.push(o.readShort(a,c)),c+=2);var E=0,M=0;for(f=0;f<p;f++)E+=h.xs[f],M+=h.ys[f],h.xs[f]=E,h.ys[f]=M}else{var b;h.parts=[];do{b=o.readUshort(a,c),c+=2;var P={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(h.parts.push(P),P.glyphIndex=o.readUshort(a,c),c+=2,1&b){var R=o.readShort(a,c);c+=2;var L=o.readShort(a,c);c+=2}else R=o.readInt8(a,c),c++,L=o.readInt8(a,c),c++;2&b?(P.m.tx=R,P.m.ty=L):(P.p1=R,P.p2=L),8&b?(P.m.a=P.m.d=o.readF2dot14(a,c),c+=2):64&b?(P.m.a=o.readF2dot14(a,c),c+=2,P.m.d=o.readF2dot14(a,c),c+=2):128&b&&(P.m.a=o.readF2dot14(a,c),c+=2,P.m.b=o.readF2dot14(a,c),c+=2,P.m.c=o.readF2dot14(a,c),c+=2,P.m.d=o.readF2dot14(a,c),c+=2)}while(32&b);if(256&b){var D=o.readUshort(a,c);for(c+=2,h.instr=[],f=0;f<D;f++)h.instr.push(a[c]),c++}}return h},e.GDEF={},e.GDEF.parse=function(i,r,o,a){var c=r;r+=4;var h=e._bin.readUshort(i,r);return{glyphClassDef:h===0?null:e._lctf.readClassDef(i,c+h)}},e.GPOS={},e.GPOS.parse=function(i,r,o,a){return e._lctf.parse(i,r,o,a,e.GPOS.subt)},e.GPOS.subt=function(i,r,o,a){var c=e._bin,h=o,f={};if(f.fmt=c.readUshort(i,o),o+=2,r==1||r==2||r==3||r==7||r==8&&f.fmt<=2){var d=c.readUshort(i,o);o+=2,f.coverage=e._lctf.readCoverage(i,d+h)}if(r==1&&f.fmt==1){var p=c.readUshort(i,o);o+=2,p!=0&&(f.pos=e.GPOS.readValueRecord(i,o,p))}else if(r==2&&f.fmt>=1&&f.fmt<=2){p=c.readUshort(i,o),o+=2;var m=c.readUshort(i,o);o+=2;var v=e._lctf.numOfOnes(p),S=e._lctf.numOfOnes(m);if(f.fmt==1){f.pairsets=[];var y=c.readUshort(i,o);o+=2;for(var _=0;_<y;_++){var E=h+c.readUshort(i,o);o+=2;var M=c.readUshort(i,E);E+=2;for(var b=[],P=0;P<M;P++){var R=c.readUshort(i,E);E+=2,p!=0&&(B=e.GPOS.readValueRecord(i,E,p),E+=2*v),m!=0&&(ee=e.GPOS.readValueRecord(i,E,m),E+=2*S),b.push({gid2:R,val1:B,val2:ee})}f.pairsets.push(b)}}if(f.fmt==2){var L=c.readUshort(i,o);o+=2;var D=c.readUshort(i,o);o+=2;var A=c.readUshort(i,o);o+=2;var C=c.readUshort(i,o);for(o+=2,f.classDef1=e._lctf.readClassDef(i,h+L),f.classDef2=e._lctf.readClassDef(i,h+D),f.matrix=[],_=0;_<A;_++){var k=[];for(P=0;P<C;P++){var B=null,ee=null;p!=0&&(B=e.GPOS.readValueRecord(i,o,p),o+=2*v),m!=0&&(ee=e.GPOS.readValueRecord(i,o,m),o+=2*S),k.push({val1:B,val2:ee})}f.matrix.push(k)}}}else if(r==4&&f.fmt==1)f.markCoverage=e._lctf.readCoverage(i,c.readUshort(i,o)+h),f.baseCoverage=e._lctf.readCoverage(i,c.readUshort(i,o+2)+h),f.markClassCount=c.readUshort(i,o+4),f.markArray=e.GPOS.readMarkArray(i,c.readUshort(i,o+6)+h),f.baseArray=e.GPOS.readBaseArray(i,c.readUshort(i,o+8)+h,f.markClassCount);else if(r==6&&f.fmt==1)f.mark1Coverage=e._lctf.readCoverage(i,c.readUshort(i,o)+h),f.mark2Coverage=e._lctf.readCoverage(i,c.readUshort(i,o+2)+h),f.markClassCount=c.readUshort(i,o+4),f.mark1Array=e.GPOS.readMarkArray(i,c.readUshort(i,o+6)+h),f.mark2Array=e.GPOS.readBaseArray(i,c.readUshort(i,o+8)+h,f.markClassCount);else{if(r==9&&f.fmt==1){var N=c.readUshort(i,o);o+=2;var q=c.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=N;else if(a.ltype!=N)throw"invalid extension substitution";return e.GPOS.subt(i,a.ltype,h+q)}console.debug("unsupported GPOS table LookupType",r,"format",f.fmt)}return f},e.GPOS.readValueRecord=function(i,r,o){var a=e._bin,c=[];return c.push(1&o?a.readShort(i,r):0),r+=1&o?2:0,c.push(2&o?a.readShort(i,r):0),r+=2&o?2:0,c.push(4&o?a.readShort(i,r):0),r+=4&o?2:0,c.push(8&o?a.readShort(i,r):0),r+=8&o?2:0,c},e.GPOS.readBaseArray=function(i,r,o){var a=e._bin,c=[],h=r,f=a.readUshort(i,r);r+=2;
3761for(var d=0;d<f;d++){for(var p=[],m=0;m<o;m++)p.push(e.GPOS.readAnchorRecord(i,h+a.readUshort(i,r))),r+=2;c.push(p)}return c},e.GPOS.readMarkArray=function(i,r){var o=e._bin,a=[],c=r,h=o.readUshort(i,r);r+=2;for(var f=0;f<h;f++){var d=e.GPOS.readAnchorRecord(i,o.readUshort(i,r+2)+c);d.markClass=o.readUshort(i,r),a.push(d),r+=4}return a},e.GPOS.readAnchorRecord=function(i,r){var o=e._bin,a={};return a.fmt=o.readUshort(i,r),a.x=o.readShort(i,r+2),a.y=o.readShort(i,r+4),a},e.GSUB={},e.GSUB.parse=function(i,r,o,a){return e._lctf.parse(i,r,o,a,e.GSUB.subt)},e.GSUB.subt=function(i,r,o,a){var c=e._bin,h=o,f={};if(f.fmt=c.readUshort(i,o),o+=2,r!=1&&r!=2&&r!=4&&r!=5&&r!=6)return null;if(r==1||r==2||r==4||r==5&&f.fmt<=2||r==6&&f.fmt<=2){var d=c.readUshort(i,o);o+=2,f.coverage=e._lctf.readCoverage(i,h+d)}if(r==1&&f.fmt>=1&&f.fmt<=2){if(f.fmt==1)f.delta=c.readShort(i,o),o+=2;else if(f.fmt==2){var p=c.readUshort(i,o);o+=2,f.newg=c.readUshorts(i,o,p),o+=2*f.newg.length}}else if(r==2&&f.fmt==1){p=c.readUshort(i,o),o+=2,f.seqs=[];for(var m=0;m<p;m++){var v=c.readUshort(i,o)+h;o+=2;var S=c.readUshort(i,v);f.seqs.push(c.readUshorts(i,v+2,S))}}else if(r==4)for(f.vals=[],p=c.readUshort(i,o),o+=2,m=0;m<p;m++){var y=c.readUshort(i,o);o+=2,f.vals.push(e.GSUB.readLigatureSet(i,h+y))}else if(r==5&&f.fmt==2){if(f.fmt==2){var _=c.readUshort(i,o);o+=2,f.cDef=e._lctf.readClassDef(i,h+_),f.scset=[];var E=c.readUshort(i,o);for(o+=2,m=0;m<E;m++){var M=c.readUshort(i,o);o+=2,f.scset.push(M==0?null:e.GSUB.readSubClassSet(i,h+M))}}}else if(r==6&&f.fmt==3){if(f.fmt==3){for(m=0;m<3;m++){p=c.readUshort(i,o),o+=2;for(var b=[],P=0;P<p;P++)b.push(e._lctf.readCoverage(i,h+c.readUshort(i,o+2*P)));o+=2*p,m==0&&(f.backCvg=b),m==1&&(f.inptCvg=b),m==2&&(f.ahedCvg=b)}p=c.readUshort(i,o),o+=2,f.lookupRec=e.GSUB.readSubstLookupRecords(i,o,p)}}else{if(r==7&&f.fmt==1){var R=c.readUshort(i,o);o+=2;var L=c.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=R;else if(a.ltype!=R)throw"invalid extension substitution";return e.GSUB.subt(i,a.ltype,h+L)}console.debug("unsupported GSUB table LookupType",r,"format",f.fmt)}return f},e.GSUB.readSubClassSet=function(i,r){var o=e._bin.readUshort,a=r,c=[],h=o(i,r);r+=2;
3761for(var f=0;f<h;f++){var d=o(i,r);r+=2,c.push(e.GSUB.readSubClassRule(i,a+d))}return c},e.GSUB.readSubClassRule=function(i,r){var o=e._bin.readUshort,a={},c=o(i,r),h=o(i,r+=2);r+=2,a.input=[];for(var f=0;f<c-1;f++)a.input.push(o(i,r)),r+=2;return a.substLookupRecords=e.GSUB.readSubstLookupRecords(i,r,h),a},e.GSUB.readSubstLookupRecords=function(i,r,o){for(var a=e._bin.readUshort,c=[],h=0;h<o;h++)c.push(a(i,r),a(i,r+2)),r+=4;return c},e.GSUB.readChainSubClassSet=function(i,r){var o=e._bin,a=r,c=[],h=o.readUshort(i,r);r+=2;for(var f=0;f<h;f++){var d=o.readUshort(i,r);r+=2,c.push(e.GSUB.readChainSubClassRule(i,a+d))}return c},e.GSUB.readChainSubClassRule=function(i,r){for(var o=e._bin,a={},c=["backtrack","input","lookahead"],h=0;h<c.length;h++){var f=o.readUshort(i,r);r+=2,h==1&&f--,a[c[h]]=o.readUshorts(i,r,f),r+=2*a[c[h]].length}return f=o.readUshort(i,r),r+=2,a.subst=o.readUshorts(i,r,2*f),r+=2*a.subst.length,a},e.GSUB.readLigatureSet=function(i,r){var o=e._bin,a=r,c=[],h=o.readUshort(i,r);r+=2;for(var f=0;f<h;f++){var d=o.readUshort(i,r);r+=2,c.push(e.GSUB.readLigature(i,a+d))}return c},e.GSUB.readLigature=function(i,r){var o=e._bin,a={chain:[]};a.nglyph=o.readUshort(i,r),r+=2;var c=o.readUshort(i,r);r+=2;
3761for(var h=0;h<c-1;h++)a.chain.push(o.readUshort(i,r)),r+=2;return a},e.head={},e.head.parse=function(i,r,o){var a=e._bin,c={};return a.readFixed(i,r),r+=4,c.fontRevision=a.readFixed(i,r),r+=4,a.readUint(i,r),r+=4,a.readUint(i,r),r+=4,c.flags=a.readUshort(i,r),r+=2,c.unitsPerEm=a.readUshort(i,r),r+=2,c.created=a.readUint64(i,r),r+=8,c.modified=a.readUint64(i,r),r+=8,c.xMin=a.readShort(i,r),r+=2,c.yMin=a.readShort(i,r),r+=2,c.xMax=a.readShort(i,r),r+=2,c.yMax=a.readShort(i,r),r+=2,c.macStyle=a.readUshort(i,r),r+=2,c.lowestRecPPEM=a.readUshort(i,r),r+=2,c.fontDirectionHint=a.readShort(i,r),r+=2,c.indexToLocFormat=a.readShort(i,r),r+=2,c.glyphDataFormat=a.readShort(i,r),r+=2,c},e.hhea={},e.hhea.parse=function(i,r,o){var a=e._bin,c={};return a.readFixed(i,r),r+=4,c.ascender=a.readShort(i,r),r+=2,c.descender=a.readShort(i,r),r+=2,c.lineGap=a.readShort(i,r),r+=2,c.advanceWidthMax=a.readUshort(i,r),r+=2,c.minLeftSideBearing=a.readShort(i,r),r+=2,c.minRightSideBearing=a.readShort(i,r),r+=2,c.xMaxExtent=a.readShort(i,r),r+=2,c.caretSlopeRise=a.readShort(i,r),r+=2,c.caretSlopeRun=a.readShort(i,r),r+=2,c.caretOffset=a.readShort(i,r),r+=2,r+=8,c.metricDataFormat=a.readShort(i,r),r+=2,c.numberOfHMetrics=a.readUshort(i,r),r+=2,c},e.hmtx={},e.hmtx.parse=function(i,r,o,a){for(var c=e._bin,h={aWidth:[],lsBearing:[]},f=0,d=0,p=0;p<a.maxp.numGlyphs;p++)p<a.hhea.numberOfHMetrics&&(f=c.readUshort(i,r),r+=2,d=c.readShort(i,r),r+=2),h.aWidth.push(f),h.lsBearing.push(d);return h},e.kern={},e.kern.parse=function(i,r,o,a){var c=e._bin,h=c.readUshort(i,r);if(r+=2,h==1)return e.kern.parseV1(i,r-2,o,a);var f=c.readUshort(i,r);r+=2;
3761for(var d={glyph1:[],rval:[]},p=0;p<f;p++){r+=2,o=c.readUshort(i,r),r+=2;var m=c.readUshort(i,r);r+=2;var v=m>>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;r=e.kern.readFormat0(i,r,d)}return d},e.kern.parseV1=function(i,r,o,a){var c=e._bin;c.readFixed(i,r),r+=4;var h=c.readUint(i,r);r+=4;for(var f={glyph1:[],rval:[]},d=0;d<h;d++){c.readUint(i,r),r+=4;var p=c.readUshort(i,r);r+=2,c.readUshort(i,r),r+=2;var m=p>>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;r=e.kern.readFormat0(i,r,f)}return f},e.kern.readFormat0=function(i,r,o){var a=e._bin,c=-1,h=a.readUshort(i,r);r+=2,a.readUshort(i,r),r+=2,a.readUshort(i,r),r+=2,a.readUshort(i,r),r+=2;for(var f=0;f<h;f++){var d=a.readUshort(i,r);r+=2;var p=a.readUshort(i,r);r+=2;var m=a.readShort(i,r);r+=2,d!=c&&(o.glyph1.push(d),o.rval.push({glyph2:[],vals:[]}));var v=o.rval[o.rval.length-1];v.glyph2.push(p),v.vals.push(m),c=d}return r},e.loca={},e.loca.parse=function(i,r,o,a){var c=e._bin,h=[],f=a.head.indexToLocFormat,d=a.maxp.numGlyphs+1;if(f==0)for(var p=0;p<d;p++)h.push(c.readUshort(i,r+(p<<1))<<1);if(f==1)for(p=0;p<d;p++)h.push(c.readUint(i,r+(p<<2)));return h},e.maxp={},e.maxp.parse=function(i,r,o){var a=e._bin,c={},h=a.readUint(i,r);return r+=4,c.numGlyphs=a.readUshort(i,r),r+=2,h==65536&&(c.maxPoints=a.readUshort(i,r),r+=2,c.maxContours=a.readUshort(i,r),r+=2,c.maxCompositePoints=a.readUshort(i,r),r+=2,c.maxCompositeContours=a.readUshort(i,r),r+=2,c.maxZones=a.readUshort(i,r),r+=2,c.maxTwilightPoints=a.readUshort(i,r),r+=2,c.maxStorage=a.readUshort(i,r),r+=2,c.maxFunctionDefs=a.readUshort(i,r),r+=2,c.maxInstructionDefs=a.readUshort(i,r),r+=2,c.maxStackElements=a.readUshort(i,r),r+=2,c.maxSizeOfInstructions=a.readUshort(i,r),r+=2,c.maxComponentElements=a.readUshort(i,r),r+=2,c.maxComponentDepth=a.readUshort(i,r),r+=2),c},e.name={},e.name.parse=function(i,r,o){var a=e._bin,c={};a.readUshort(i,r),r+=2;var h=a.readUshort(i,r);r+=2,a.readUshort(i,r);for(var f,d=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],p=r+=2,m=0;m<h;m++){var v=a.readUshort(i,r);r+=2;var S=a.readUshort(i,r);r+=2;var y=a.readUshort(i,r);r+=2;var _=a.readUshort(i,r);r+=2;var E=a.readUshort(i,r);r+=2;var M=a.readUshort(i,r);r+=2;var b,P=d[_],R=p+12*h+M;if(v==0)b=a.readUnicode(i,R,E/2);else if(v==3&&S==0)b=a.readUnicode(i,R,E/2);else if(S==0)b=a.readASCII(i,R,E);else if(S==1)b=a.readUnicode(i,R,E/2);else if(S==3)b=a.readUnicode(i,R,E/2);else{if(v!=1)throw"unknown encoding "+S+", platformID: "+v;b=a.readASCII(i,R,E),console.debug("reading unknown MAC encoding "+S+" as ASCII")}var L="p"+v+","+y.toString(16);c[L]==null&&(c[L]={}),c[L][P!==void 0?P:_]=b,c[L]._lang=y}for(var D in c)if(c[D].postScriptName!=null&&c[D]._lang==1033)return c[D];for(var D in c)if(c[D].postScriptName!=null&&c[D]._lang==0)return c[D];for(var D in c)if(c[D].postScriptName!=null&&c[D]._lang==3084)return c[D];for(var D in c)if(c[D].postScriptName!=null)return c[D];for(var D in c){f=D;break}return console.debug("returning name table with languageID "+c[f]._lang),c[f]},e["OS/2"]={},e["OS/2"].parse=function(i,r,o){var a=e._bin.readUshort(i,r);r+=2;var c={};if(a==0)e["OS/2"].version0(i,r,c);else if(a==1)e["OS/2"].version1(i,r,c);else if(a==2||a==3||a==4)e["OS/2"].version2(i,r,c);else{if(a!=5)throw"unknown OS/2 table version: "+a;e["OS/2"].version5(i,r,c)}return c},e["OS/2"].version0=function(i,r,o){var a=e._bin;return o.xAvgCharWidth=a.readShort(i,r),r+=2,o.usWeightClass=a.readUshort(i,r),r+=2,o.usWidthClass=a.readUshort(i,r),r+=2,o.fsType=a.readUshort(i,r),r+=2,o.ySubscriptXSize=a.readShort(i,r),r+=2,o.ySubscriptYSize=a.readShort(i,r),r+=2,o.ySubscriptXOffset=a.readShort(i,r),r+=2,o.ySubscriptYOffset=a.readShort(i,r),r+=2,o.ySuperscriptXSize=a.readShort(i,r),r+=2,o.ySuperscriptYSize=a.readShort(i,r),r+=2,o.ySuperscriptXOffset=a.readShort(i,r),r+=2,o.ySuperscriptYOffset=a.readShort(i,r),r+=2,o.yStrikeoutSize=a.readShort(i,r),r+=2,o.yStrikeoutPosition=a.readShort(i,r),r+=2,o.sFamilyClass=a.readShort(i,r),r+=2,o.panose=a.readBytes(i,r,10),r+=10,o.ulUnicodeRange1=a.readUint(i,r),r+=4,o.ulUnicodeRange2=a.readUint(i,r),r+=4,o.ulUnicodeRange3=a.readUint(i,r),r+=4,o.ulUnicodeRange4=a.readUint(i,r),r+=4,o.achVendID=[a.readInt8(i,r),a.readInt8(i,r+1),a.readInt8(i,r+2),a.readInt8(i,r+3)],r+=4,o.fsSelection=a.readUshort(i,r),r+=2,o.usFirstCharIndex=a.readUshort(i,r),r+=2,o.usLastCharIndex=a.readUshort(i,r),r+=2,o.sTypoAscender=a.readShort(i,r),r+=2,o.sTypoDescender=a.readShort(i,r),r+=2,o.sTypoLineGap=a.readShort(i,r),r+=2,o.usWinAscent=a.readUshort(i,r),r+=2,o.usWinDescent=a.readUshort(i,r),r+=2},e["OS/2"].version1=function(i,r,o){var a=e._bin;return r=e["OS/2"].version0(i,r,o),o.ulCodePageRange1=a.readUint(i,r),r+=4,o.ulCodePageRange2=a.readUint(i,r),r+=4},e["OS/2"].version2=function(i,r,o){var a=e._bin;return r=e["OS/2"].version1(i,r,o),o.sxHeight=a.readShort(i,r),r+=2,o.sCapHeight=a.readShort(i,r),r+=2,o.usDefault=a.readUshort(i,r),r+=2,o.usBreak=a.readUshort(i,r),r+=2,o.usMaxContext=a.readUshort(i,r),r+=2},e["OS/2"].version5=function(i,r,o){var a=e._bin;return r=e["OS/2"].version2(i,r,o),o.usLowerOpticalPointSize=a.readUshort(i,r),r+=2,o.usUpperOpticalPointSize=a.readUshort(i,r),r+=2},e.post={},e.post.parse=function(i,r,o){var a=e._bin,c={};return c.version=a.readFixed(i,r),r+=4,c.italicAngle=a.readFixed(i,r),r+=4,c.underlinePosition=a.readShort(i,r),r+=2,c.underlineThickness=a.readShort(i,r),r+=2,c},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(i,r){var o=i.cmap,a=-1;if(o.p0e4!=null?a=o.p0e4:o.p3e1!=null?a=o.p3e1:o.p1e0!=null?a=o.p1e0:o.p0e3!=null&&(a=o.p0e3),a==-1)throw"no familiar platform and encoding!";var c=o.tables[a];if(c.format==0)return r>=c.map.length?0:c.map[r];if(c.format==4){for(var h=-1,f=0;f<c.endCount.length;f++)if(r<=c.endCount[f]){h=f;break}return h==-1||c.startCount[h]>r?0:65535&(c.idRangeOffset[h]!=0?c.glyphIdArray[r-c.startCount[h]+(c.idRangeOffset[h]>>1)-(c.idRangeOffset.length-h)]:r+c.idDelta[h])}if(c.format==12){if(r>c.groups[c.groups.length-1][1])return 0;for(f=0;f<c.groups.length;f++){var d=c.groups[f];if(d[0]<=r&&r<=d[1])return d[2]+(r-d[0])}return 0}throw"unknown cmap table format "+c.format},e.U.glyphToPath=function(i,r){var o={cmds:[],crds:[]};if(i.SVG&&i.SVG.entries[r]){var a=i.SVG.entries[r];
3761return a==null?o:(typeof a=="string"&&(a=e.SVG.toPath(a),i.SVG.entries[r]=a),a)}if(i.CFF){var c={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:i.CFF.Private?i.CFF.Private.defaultWidthX:0,open:!1},h=i.CFF,f=i.CFF.Private;if(h.ROS){for(var d=0;h.FDSelect[d+2]<=r;)d+=2;f=h.FDArray[h.FDSelect[d+1]].Private}e.U._drawCFF(i.CFF.CharStrings[r],c,h,f,o)}else i.glyf&&e.U._drawGlyf(r,i,o);return o},e.U._drawGlyf=function(i,r,o){var a=r.glyf[i];a==null&&(a=r.glyf[i]=e.glyf._parseGlyf(r,i)),a!=null&&(a.noc>-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,r,o))},e.U._simpleGlyph=function(i,r){for(var o=0;o<i.noc;o++){for(var a=o==0?0:i.endPts[o-1]+1,c=i.endPts[o],h=a;h<=c;h++){var f=h==a?c:h-1,d=h==c?a:h+1,p=1&i.flags[h],m=1&i.flags[f],v=1&i.flags[d],S=i.xs[h],y=i.ys[h];if(h==a)if(p){if(!m){e.U.P.moveTo(r,S,y);continue}e.U.P.moveTo(r,i.xs[f],i.ys[f])}else m?e.U.P.moveTo(r,i.xs[f],i.ys[f]):e.U.P.moveTo(r,(i.xs[f]+S)/2,(i.ys[f]+y)/2);p?m&&e.U.P.lineTo(r,S,y):v?e.U.P.qcurveTo(r,S,y,i.xs[d],i.ys[d]):e.U.P.qcurveTo(r,S,y,(S+i.xs[d])/2,(y+i.ys[d])/2)}e.U.P.closePath(r)}},e.U._compoGlyph=function(i,r,o){for(var a=0;a<i.parts.length;a++){var c={cmds:[],crds:[]},h=i.parts[a];e.U._drawGlyf(h.glyphIndex,r,c);for(var f=h.m,d=0;d<c.crds.length;d+=2){var p=c.crds[d],m=c.crds[d+1];o.crds.push(p*f.a+m*f.b+f.tx),o.crds.push(p*f.c+m*f.d+f.ty)}for(d=0;d<c.cmds.length;d++)o.cmds.push(c.cmds[d])}},e.U._getGlyphClass=function(i,r){var o=e._lctf.getInterval(r,i);return o==-1?0:r[o+2]},e.U._applySubs=function(i,r,o,a){for(var c=i.length-r-1,h=0;h<o.tabs.length;h++)if(o.tabs[h]!=null){var f,d=o.tabs[h];if(!d.coverage||(f=e._lctf.coverageIndex(d.coverage,i[r]))!=-1){if(o.ltype==1)i[r],d.fmt==1?i[r]=i[r]+d.delta:i[r]=d.newg[f];else if(o.ltype==4)for(var p=d.vals[f],m=0;m<p.length;m++){var v=p[m],S=v.chain.length;if(!(S>c)){for(var y=!0,_=0,E=0;E<S;E++){for(;i[r+_+(1+E)]==-1;)_++;v.chain[E]!=i[r+_+(1+E)]&&(y=!1)}if(y){for(i[r]=v.nglyph,E=0;E<S+_;E++)i[r+E+1]=-1;break}}}else if(o.ltype==5&&d.fmt==2)for(var M=e._lctf.getInterval(d.cDef,i[r]),b=d.cDef[M+2],P=d.scset[b],R=0;R<P.length;R++){var L=P[R],D=L.input;if(!(D.length>c)){for(y=!0,E=0;E<D.length;E++){var A=e._lctf.getInterval(d.cDef,i[r+1+E]);if(M==-1&&d.cDef[A+2]!=D[E]){y=!1;break}}if(y){var C=L.substLookupRecords;for(m=0;m<C.length;m+=2)C[m],C[m+1]}}}else if(o.ltype==6&&d.fmt==3){if(!e.U._glsCovered(i,d.backCvg,r-d.backCvg.length)||!e.U._glsCovered(i,d.inptCvg,r)||!e.U._glsCovered(i,d.ahedCvg,r+d.inptCvg.length))continue;var k=d.lookupRec;for(R=0;R<k.length;R+=2){M=k[R];var B=a[k[R+1]];e.U._applySubs(i,r+M,B,a)}}}}},e.U._glsCovered=function(i,r,o){for(var a=0;a<r.length;a++)if(e._lctf.coverageIndex(r[a],i[o+a])==-1)return!1;return!0},e.U.glyphsToPath=function(i,r,o){for(var a={cmds:[],crds:[]},c=0,h=0;h<r.length;h++){var f=r[h];if(f!=-1){for(var d=h<r.length-1&&r[h+1]!=-1?r[h+1]:0,p=e.U.glyphToPath(i,f),m=0;m<p.crds.length;m+=2)a.crds.push(p.crds[m]+c),a.crds.push(p.crds[m+1]);for(o&&a.cmds.push(o),m=0;m<p.cmds.length;m++)a.cmds.push(p.cmds[m]);o&&a.cmds.push("X"),c+=i.hmtx.aWidth[f],h<r.length-1&&(c+=e.U.getPairAdjustment(i,f,d))}}return a},e.U.P={},e.U.P.moveTo=function(i,r,o){i.cmds.push("M"),i.crds.push(r,o)},e.U.P.lineTo=function(i,r,o){i.cmds.push("L"),i.crds.push(r,o)},e.U.P.curveTo=function(i,r,o,a,c,h,f){i.cmds.push("C"),i.crds.push(r,o,a,c,h,f)},e.U.P.qcurveTo=function(i,r,o,a,c){i.cmds.push("Q"),i.crds.push(r,o,a,c)},e.U.P.closePath=function(i){i.cmds.push("Z")},e.U._drawCFF=function(i,r,o,a,c){for(var h=r.stack,f=r.nStems,d=r.haveWidth,p=r.width,m=r.open,v=0,S=r.x,y=r.y,_=0,E=0,M=0,b=0,P=0,R=0,L=0,D=0,A=0,C=0,k={val:0,size:0};v<i.length;){e.CFF.getCharString(i,v,k);var B=k.val;if(v+=k.size,B=="o1"||B=="o18")h.length%2!=0&&!d&&(p=h.shift()+a.nominalWidthX),f+=h.length>>1,h.length=0,d=!0;else if(B=="o3"||B=="o23")h.length%2!=0&&!d&&(p=h.shift()+a.nominalWidthX),f+=h.length>>1,h.length=0,d=!0;else if(B=="o4")h.length>1&&!d&&(p=h.shift()+a.nominalWidthX,d=!0),m&&e.U.P.closePath(c),y+=h.pop(),e.U.P.moveTo(c,S,y),m=!0;else if(B=="o5")for(;h.length>0;)S+=h.shift(),y+=h.shift(),e.U.P.lineTo(c,S,y);else if(B=="o6"||B=="o7")for(var ee=h.length,N=B=="o6",q=0;q<ee;q++){var K=h.shift();
3761N?S+=K:y+=K,N=!N,e.U.P.lineTo(c,S,y)}else if(B=="o8"||B=="o24"){ee=h.length;for(var re=0;re+6<=ee;)_=S+h.shift(),E=y+h.shift(),M=_+h.shift(),b=E+h.shift(),S=M+h.shift(),y=b+h.shift(),e.U.P.curveTo(c,_,E,M,b,S,y),re+=6;B=="o24"&&(S+=h.shift(),y+=h.shift(),e.U.P.lineTo(c,S,y))}else{if(B=="o11")break;if(B=="o1234"||B=="o1235"||B=="o1236"||B=="o1237")B=="o1234"&&(E=y,M=(_=S+h.shift())+h.shift(),C=b=E+h.shift(),R=b,D=y,S=(L=(P=(A=M+h.shift())+h.shift())+h.shift())+h.shift(),e.U.P.curveTo(c,_,E,M,b,A,C),e.U.P.curveTo(c,P,R,L,D,S,y)),B=="o1235"&&(_=S+h.shift(),E=y+h.shift(),M=_+h.shift(),b=E+h.shift(),A=M+h.shift(),C=b+h.shift(),P=A+h.shift(),R=C+h.shift(),L=P+h.shift(),D=R+h.shift(),S=L+h.shift(),y=D+h.shift(),h.shift(),e.U.P.curveTo(c,_,E,M,b,A,C),e.U.P.curveTo(c,P,R,L,D,S,y)),B=="o1236"&&(_=S+h.shift(),E=y+h.shift(),M=_+h.shift(),C=b=E+h.shift(),R=b,L=(P=(A=M+h.shift())+h.shift())+h.shift(),D=R+h.shift(),S=L+h.shift(),e.U.P.curveTo(c,_,E,M,b,A,C),e.U.P.curveTo(c,P,R,L,D,S,y)),B=="o1237"&&(_=S+h.shift(),E=y+h.shift(),M=_+h.shift(),b=E+h.shift(),A=M+h.shift(),C=b+h.shift(),P=A+h.shift(),R=C+h.shift(),L=P+h.shift(),D=R+h.shift(),Math.abs(L-S)>Math.abs(D-y)?S=L+h.shift():y=D+h.shift(),e.U.P.curveTo(c,_,E,M,b,A,C),e.U.P.curveTo(c,P,R,L,D,S,y));else if(B=="o14"){if(h.length>0&&!d&&(p=h.shift()+o.nominalWidthX,d=!0),h.length==4){var Z=h.shift(),W=h.shift(),V=h.shift(),F=h.shift(),j=e.CFF.glyphBySE(o,V),G=e.CFF.glyphBySE(o,F);e.U._drawCFF(o.CharStrings[j],r,o,a,c),r.x=Z,r.y=W,e.U._drawCFF(o.CharStrings[G],r,o,a,c)}m&&(e.U.P.closePath(c),m=!1)}else if(B=="o19"||B=="o20")h.length%2!=0&&!d&&(p=h.shift()+a.nominalWidthX),f+=h.length>>1,h.length=0,d=!0,v+=f+7>>3;else if(B=="o21")h.length>2&&!d&&(p=h.shift()+a.nominalWidthX,d=!0),y+=h.pop(),S+=h.pop(),m&&e.U.P.closePath(c),e.U.P.moveTo(c,S,y),m=!0;else if(B=="o22")h.length>1&&!d&&(p=h.shift()+a.nominalWidthX,d=!0),S+=h.pop(),m&&e.U.P.closePath(c),e.U.P.moveTo(c,S,y),m=!0;else if(B=="o25"){for(;h.length>6;)S+=h.shift(),y+=h.shift(),e.U.P.lineTo(c,S,y);_=S+h.shift(),E=y+h.shift(),M=_+h.shift(),b=E+h.shift(),S=M+h.shift(),y=b+h.shift(),e.U.P.curveTo(c,_,E,M,b,S,y)}else if(B=="o26")for(h.length%2&&(S+=h.shift());h.length>0;)_=S,E=y+h.shift(),S=M=_+h.shift(),y=(b=E+h.shift())+h.shift(),e.U.P.curveTo(c,_,E,M,b,S,y);else if(B=="o27")for(h.length%2&&(y+=h.shift());h.length>0;)E=y,M=(_=S+h.shift())+h.shift(),b=E+h.shift(),S=M+h.shift(),y=b,e.U.P.curveTo(c,_,E,M,b,S,y);else if(B=="o10"||B=="o29"){var $=B=="o10"?a:o;if(h.length==0)console.debug("error: empty stack");else{var te=h.pop(),ae=$.Subrs[te+$.Bias];r.x=S,r.y=y,r.nStems=f,r.haveWidth=d,r.width=p,r.open=m,e.U._drawCFF(ae,r,o,a,c),S=r.x,y=r.y,f=r.nStems,d=r.haveWidth,p=r.width,m=r.open}}else if(B=="o30"||B=="o31"){var ne=h.length,pe=(re=0,B=="o31");for(re+=ne-(ee=-3&ne);re<ee;)pe?(E=y,M=(_=S+h.shift())+h.shift(),y=(b=E+h.shift())+h.shift(),ee-re==5?(S=M+h.shift(),re++):S=M,pe=!1):(_=S,E=y+h.shift(),M=_+h.shift(),b=E+h.shift(),S=M+h.shift(),ee-re==5?(y=b+h.shift(),re++):y=b,pe=!0),e.U.P.curveTo(c,_,E,M,b,S,y),re+=4}else{if((B+"").charAt(0)=="o")throw console.debug("Unknown operation: "+B,i),B;h.push(B)}}}r.x=S,r.y=y,r.nStems=f,r.haveWidth=d,r.width=p,r.open=m};var t=e,n={Typr:t};return s.Typr=t,s.default=n,Object.defineProperty(s,"__esModule",{value:!0}),s}({}).Typr}/*! 3762Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate 3763(https://github.com/101arrowz/fflate) for use in Troika text rendering. 3764Original licenses apply: 3765- fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT) 3766- woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2) 3767*/function dC(){return function(s){var e=Uint8Array,t=Uint16Array,n=Uint32Array,i=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),r=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),o=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(B,ee){for(var N=new t(31),q=0;q<31;++q)N[q]=ee+=1<<B[q-1];var K=new n(N[30]);for(q=1;q<30;++q)for(var re=N[q];re<N[q+1];++re)K[re]=re-N[q]<<5|q;return[N,K]},c=a(i,2),h=c[0],f=c[1];h[28]=258,f[258]=28;for(var d=a(r,0)[0],p=new t(32768),m=0;m<32768;++m){var v=(43690&m)>>>1|(21845&m)<<1;v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4,p[m]=((65280&v)>>>8|(255&v)<<8)>>>1}var S=function(B,ee,N){for(var q=B.length,K=0,re=new t(ee);K<q;++K)++re[B[K]-1];var Z,W=new t(ee);for(K=0;K<ee;++K)W[K]=W[K-1]+re[K-1]<<1;{Z=new t(1<<ee);var V=15-ee;for(K=0;K<q;++K)if(B[K])for(var F=K<<4|B[K],j=ee-B[K],G=W[B[K]-1]++<<j,$=G|(1<<j)-1;G<=$;++G)Z[p[G]>>>V]=F}return Z},y=new e(288);for(m=0;m<144;++m)y[m]=8;for(m=144;m<256;++m)y[m]=9;for(m=256;m<280;
3767++m)y[m]=7;for(m=280;m<288;++m)y[m]=8;var _=new e(32);for(m=0;m<32;++m)_[m]=5;var E=S(y,9),M=S(_,5),b=function(B){for(var ee=B[0],N=1;N<B.length;++N)B[N]>ee&&(ee=B[N]);return ee},P=function(B,ee,N){var q=ee/8|0;return(B[q]|B[q+1]<<8)>>(7&ee)&N},R=function(B,ee){var N=ee/8|0;return(B[N]|B[N+1]<<8|B[N+2]<<16)>>(7&ee)},L=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],D=function(B,ee,N){var q=new Error(ee||L[B]);if(q.code=B,Error.captureStackTrace&&Error.captureStackTrace(q,D),!N)throw q;return q},A=function(B,ee,N){var q=B.length;if(!q||N&&!N.l&&q<5)return ee||new e(0);var K=!ee||N,re=!N||N.i;N||(N={}),ee||(ee=new e(3*q));var Z,W=function(Le){var Q=ee.length;if(Le>Q){var we=new e(Math.max(2*Q,Le));we.set(ee),ee=we}},V=N.f||0,F=N.p||0,j=N.b||0,G=N.l,$=N.d,te=N.m,ae=N.n,ne=8*q;do{if(!G){N.f=V=P(B,F,1);var pe=P(B,F+1,3);if(F+=3,!pe){var Ie=B[(I=((Z=F)/8|0)+(7&Z&&1)+4)-4]|B[I-3]<<8,Pe=I+Ie;if(Pe>q){re&&D(0);break}K&&W(j+Ie),ee.set(B.subarray(I,Pe),j),N.b=j+=Ie,N.p=F=8*Pe;continue}if(pe==1)G=E,$=M,te=9,ae=5;else if(pe==2){var Se=P(B,F,31)+257,O=P(B,F+10,15)+4,Me=Se+P(B,F+5,31)+1;F+=14;for(var ue=new e(Me),de=new e(19),oe=0;oe<O;++oe)de[o[oe]]=P(B,F+3*oe,7);F+=3*O;var Ue=b(de),fe=(1<<Ue)-1,U=S(de,Ue);for(oe=0;oe<Me;){var I,X=U[P(B,F,fe)];if(F+=15&X,(I=X>>>4)<16)ue[oe++]=I;else{var ye=0,ce=0;for(I==16?(ce=3+P(B,F,3),F+=2,ye=ue[oe-1]):I==17?(ce=3+P(B,F,7),F+=3):I==18&&(ce=11+P(B,F,127),F+=7);ce--;)ue[oe++]=ye}}var he=ue.subarray(0,Se),Te=ue.subarray(Se);te=b(he),ae=b(Te),G=S(he,te),$=S(Te,ae)}else D(1);if(F>ne){re&&D(0);break}}K&&W(j+131072);for(var Ne=(1<<te)-1,Ce=(1<<ae)-1,De=F;;De=F){var ke=(ye=G[R(B,F)&Ne])>>>4;if((F+=15&ye)>ne){re&&D(0);break}if(ye||D(2),ke<256)ee[j++]=ke;else{if(ke==256){De=F,G=null;break}var xe=ke-254;if(ke>264){var it=i[oe=ke-257];xe=P(B,F,(1<<it)-1)+h[oe],F+=it}var tt=$[R(B,F)&Ce],Xe=tt>>>4;if(tt||D(3),F+=15&tt,Te=d[Xe],Xe>3&&(it=r[Xe],Te+=R(B,F)&(1<<it)-1,F+=it),F>ne){re&&D(0);break}K&&W(j+131072);for(var ze=j+xe;j<ze;j+=4)ee[j]=ee[j-Te],ee[j+1]=ee[j+1-Te],ee[j+2]=ee[j+2-Te],ee[j+3]=ee[j+3-Te];j=ze}}N.l=G,N.p=De,N.b=j,G&&(V=1,N.m=te,N.d=$,N.n=ae)}while(!V);return j==ee.length?ee:function(Le,Q,we){(we==null||we>Le.length)&&(we=Le.length);var We=new(Le instanceof t?t:Le instanceof n?n:e)(we-Q);return We.set(Le.subarray(Q,we)),We}(ee,0,j)},C=new e(0),k=typeof TextDecoder<"u"&&new TextDecoder;try{k.decode(C,{stream:!0})}catch{}return s.convert_streams=function(B){var ee=new DataView(B),N=0;function q(){var Se=ee.getUint16(N);return N+=2,Se}function K(){var Se=ee.getUint32(N);return N+=4,Se}function re(Se){Ie.setUint16(Pe,Se),Pe+=2}function Z(Se){Ie.setUint32(Pe,Se),Pe+=4}for(var W={signature:K(),flavor:K(),length:K(),numTables:q(),reserved:q(),totalSfntSize:K(),majorVersion:q(),minorVersion:q(),metaOffset:K(),metaLength:K(),metaOrigLength:K(),privOffset:K(),privLength:K()},V=0;Math.pow(2,V)<=W.numTables;)V++;V--;for(var F=16*Math.pow(2,V),j=16*W.numTables-F,G=12,$=[],te=0;te<W.numTables;te++)$.push({tag:K(),offset:K(),compLength:K(),origLength:K(),origChecksum:K()}),G+=16;var ae,ne=new Uint8Array(12+16*$.length+$.reduce(function(Se,O){return Se+O.origLength+4},0)),pe=ne.buffer,Ie=new DataView(pe),Pe=0;return Z(W.flavor),re(W.numTables),re(F),re(V),re(j),$.forEach(function(Se){Z(Se.tag),Z(Se.origChecksum),Z(G),Z(Se.origLength),Se.outOffset=G,(G+=Se.origLength)%4!=0&&(G+=4-G%4)}),$.forEach(function(Se){var O,Me=B.slice(Se.offset,Se.offset+Se.compLength);if(Se.compLength!=Se.origLength){var ue=new Uint8Array(Se.origLength);O=new Uint8Array(Me,2),A(O,ue)}else ue=new Uint8Array(Me);ne.set(ue,Se.outOffset);var de=0;(G=Se.outOffset+Se.origLength)%4!=0&&(de=4-G%4),ne.set(new Uint8Array(de).buffer,Se.outOffset+Se.origLength),ae=G+de}),pe.slice(0,ae)},Object.defineProperty(s,"__esModule",{value:!0}),s}({}).convert_streams}function pC(s,e){const t={M:2,L:2,Q:4,C:6,Z:0},n={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},i=1,r=2,o=4,a=8,c=16,h=32;let f;function d(L){if(!f){const D={R:r,L:i,D:o,C:c,U:h,T:a};f=new Map;for(let A in n){let C=0;n[A].split(",").forEach(k=>{let[B,ee]=k.split("+");B=parseInt(B,36),ee=ee?parseInt(ee,36):0,f.set(C+=B,D[A]);for(let N=ee;N--;)f.set(++C,D[A])})}}return f.get(L)||h}const p=1,m=2,v=3,S=4,y=[null,"isol","init","fina","medi"];function _(L){const D=new Uint8Array(L.length);let A=h,C=p,k=-1;for(let B=0;B<L.length;B++){const ee=L.codePointAt(B);let N=d(ee)|0,q=p;
3767N&a||(A&(i|o|c)?N&(r|o|c)?(q=v,(C===p||C===v)&&D[k]++):N&(i|h)&&(C===m||C===S)&&D[k]--:A&(r|h)&&(C===m||C===S)&&D[k]--,C=D[B]=q,A=N,k=B,ee>65535&&B++)}return D}function E(L,D){const A=[];for(let k=0;k<D.length;k++){const B=D.codePointAt(k);B>65535&&k++,A.push(s.U.codeToGlyph(L,B))}const C=L.GSUB;if(C){const{lookupList:k,featureList:B}=C;let ee;const N=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,q=[];B.forEach(K=>{if(N.test(K.tag))for(let re=0;re<K.tab.length;re++){if(q[K.tab[re]])continue;q[K.tab[re]]=!0;const Z=k[K.tab[re]],W=/^(isol|init|fina|medi)$/.test(K.tag);W&&!ee&&(ee=_(D));for(let V=0;V<A.length;V++)(!ee||!W||y[ee[V]]===K.tag)&&s.U._applySubs(A,V,Z,k)}})}return A}function M(L,D){const A=new Int16Array(D.length*3);let C=0;for(;C<D.length;C++){const N=D[C];if(N===-1)continue;A[C*3+2]=L.hmtx.aWidth[N];const q=L.GPOS;if(q){const K=q.lookupList;for(let re=0;re<K.length;re++){const Z=K[re];for(let W=0;W<Z.tabs.length;W++){const V=Z.tabs[W];if(Z.ltype===1){if(s._lctf.coverageIndex(V.coverage,N)!==-1&&V.pos){ee(V.pos,C);break}}else if(Z.ltype===2){let F=null,j=k();if(j!==-1){const G=s._lctf.coverageIndex(V.coverage,D[j]);if(G!==-1){if(V.fmt===1){const $=V.pairsets[G];for(let te=0;te<$.length;te++)$[te].gid2===N&&(F=$[te])}else if(V.fmt===2){const $=s.U._getGlyphClass(D[j],V.classDef1),te=s.U._getGlyphClass(N,V.classDef2);F=V.matrix[$][te]}if(F){F.val1&&ee(F.val1,j),F.val2&&ee(F.val2,C);break}}}}else if(Z.ltype===4){const F=s._lctf.coverageIndex(V.markCoverage,N);if(F!==-1){const j=k(B),G=j===-1?-1:s._lctf.coverageIndex(V.baseCoverage,D[j]);if(G!==-1){const $=V.markArray[F],te=V.baseArray[G][$.markClass];A[C*3]=te.x-$.x+A[j*3]-A[j*3+2],A[C*3+1]=te.y-$.y+A[j*3+1];break}}}else if(Z.ltype===6){const F=s._lctf.coverageIndex(V.mark1Coverage,N);if(F!==-1){const j=k();if(j!==-1){const G=D[j];if(b(L,G)===3){const $=s._lctf.coverageIndex(V.mark2Coverage,G);if($!==-1){const te=V.mark1Array[F],ae=V.mark2Array[$][te.markClass];A[C*3]=ae.x-te.x+A[j*3]-A[j*3+2],A[C*3+1]=ae.y-te.y+A[j*3+1];break}}}}}}}}else if(L.kern&&!L.cff){const K=k();if(K!==-1){const re=L.kern.glyph1.indexOf(D[K]);if(re!==-1){const Z=L.kern.rval[re].glyph2.indexOf(N);Z!==-1&&(A[K*3+2]+=L.kern.rval[re].vals[Z])}}}}return A;function k(N){for(let q=C-1;q>=0;q--)if(D[q]!==-1&&(!N||N(D[q])))return q;return-1}function B(N){return b(L,N)===1}function ee(N,q){for(let K=0;K<3;K++)A[q*3+K]+=N[K]||0}}function b(L,D){const A=L.GDEF&&L.GDEF.glyphClassDef;return A?s.U._getGlyphClass(D,A):0}function P(...L){for(let D=0;D<L.length;D++)if(typeof L[D]=="number")return L[D]}function R(L){const D=Object.create(null),A=L["OS/2"],C=L.hhea,k=L.head.unitsPerEm,B=P(A&&A.sTypoAscender,C&&C.ascender,k),ee={unitsPerEm:k,ascender:B,descender:P(A&&A.sTypoDescender,C&&C.descender,0),capHeight:P(A&&A.sCapHeight,B),xHeight:P(A&&A.sxHeight,B),lineGap:P(A&&A.sTypoLineGap,C&&C.lineGap),supportsCodePoint(N){return s.U.codeToGlyph(L,N)>0},forEachGlyph(N,q,K,re){let Z=0;const W=1/ee.unitsPerEm*q,V=E(L,N);let F=0;const j=M(L,V);return V.forEach((G,$)=>{if(G!==-1){let te=D[G];if(!te){const{cmds:ae,crds:ne}=s.U.glyphToPath(L,G);let pe="",Ie=0;for(let ue=0,de=ae.length;ue<de;ue++){const oe=t[ae[ue]];pe+=ae[ue];for(let Ue=1;Ue<=oe;Ue++)pe+=(Ue>1?",":"")+ne[Ie++]}let Pe,Se,O,Me;if(ne.length){Pe=Se=1/0,O=Me=-1/0;for(let ue=0,de=ne.length;ue<de;ue+=2){let oe=ne[ue],Ue=ne[ue+1];oe<Pe&&(Pe=oe),Ue<Se&&(Se=Ue),oe>O&&(O=oe),Ue>Me&&(Me=Ue)}}else Pe=O=Se=Me=0;te=D[G]={index:G,advanceWidth:L.hmtx.aWidth[G],xMin:Pe,yMin:Se,xMax:O,yMax:Me,path:pe}}re.call(null,te,Z+j[$*3]*W,j[$*3+1]*W,F),Z+=j[$*3+2]*W,K&&(Z+=K*q)}F+=N.codePointAt(F)>65535?2:1}),Z}};return ee}return function(D){const A=new Uint8Array(D,0,4),C=s._bin.readASCII(A,0,4);if(C==="wOFF")D=e(D);else if(C==="wOF2")throw new Error("woff2 fonts not supported");return R(s.parse(D)[0])}}const mC=va({name:"Typr Font Parser",dependencies:[fC,dC,pC],init(s,e,t){const n=s(),i=e();return t(n,i)}});/*!
3768Custom bundle of @unicode-font-resolver/client v1.0.2 (https://github.com/lojjic/unicode-font-resolver) 3769for use in Troika text rendering. 3770Original MIT license applies 3771*/function gC(){return function(s){var e=function(){this.buckets=new Map};e.prototype.add=function(M){var b=M>>5;this.buckets.set(b,(this.buckets.get(b)||0)|1<<(31&M))},e.prototype.has=function(M){var b=this.buckets.get(M>>5);return b!==void 0&&(b&1<<(31&M))!=0},e.prototype.serialize=function(){var M=[];return this.buckets.forEach(function(b,P){M.push((+P).toString(36)+":"+b.toString(36))}),M.join(",")},e.prototype.deserialize=function(M){var b=this;this.buckets.clear(),M.split(",").forEach(function(P){var R=P.split(":");b.buckets.set(parseInt(R[0],36),parseInt(R[1],36))})};var t=Math.pow(2,8),n=t-1,i=~n;function r(M){var b=function(R){return R&i}(M).toString(16),P=function(R){return(R&i)+t-1}(M).toString(16);return"codepoint-index/plane"+(M>>16)+"/"+b+"-"+P+".json"}function o(M,b){var P=M&n,R=b.codePointAt(P/6|0);return((R=(R||48)-48)&1<<P%6)!=0}function a(M,b){var P;(P=M,P.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map(function(R){return R.split("-").map(function(L){return parseInt(L.trim(),16)})})).forEach(function(R){var L=R[0],D=R[1];D===void 0&&(D=L),b(L,D)})}function c(M,b){a(M,function(P,R){for(var L=P;L<=R;L++)b(L)})}var h={},f={},d=new WeakMap,p="https://cdn.jsdelivr.net/gh/lojjic/[email protected]/packages/data";function m(M){var b=d.get(M);return b||(b=new e,c(M.ranges,function(P){return b.add(P)}),d.set(M,b)),b}var v,S=new Map;function y(M,b,P){return M[b]?b:M[P]?P:function(R){for(var L in R)return L}(M)}function _(M,b){var P=b;if(!M.includes(P)){P=1/0;for(var R=0;R<M.length;R++)Math.abs(M[R]-b)<Math.abs(P-b)&&(P=M[R])}return P}function E(M){return v||(v=new Set,c("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",function(b){v.add(b)})),v.has(M)}return s.CodePointSet=e,s.clearCache=function(){h={},f={}},s.getFontsForString=function(M,b){b===void 0&&(b={});var P,R=b.lang;R===void 0&&(R=new RegExp("\\p{Script=Hangul}","u").test(P=M)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(P)?"ja":"en");var L=b.category;L===void 0&&(L="sans-serif");var D=b.style;D===void 0&&(D="normal");var A=b.weight;A===void 0&&(A=400);var C=(b.dataUrl||p).replace(/\/$/g,""),k=new Map,B=new Uint8Array(M.length),ee={},N={},q=new Array(M.length),K=new Map,re=!1;function Z(F){var j=S.get(F);return j||(j=fetch(C+"/"+F).then(function(G){if(!G.ok)throw new Error(G.statusText);return G.json().then(function($){if(!Array.isArray($)||$[0]!==1)throw new Error("Incorrect schema version; need 1, got "+$[0]);return $[1]})}).catch(function(G){if(C!==p)return re||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+C+'", trying default CDN. '+G.message),re=!0),C=p,S.delete(F),Z(F);throw G}),S.set(F,j)),j}for(var W=function(F){var j=M.codePointAt(F),G=r(j);q[F]=G,h[G]||K.has(G)||K.set(G,Z(G).then(function($){h[G]=$})),j>65535&&(F++,V=F)},V=0;V<M.length;V++)W(V);return Promise.all(K.values()).then(function(){K.clear();for(var F=function(G){var $=M.codePointAt(G),te=null,ae=h[q[G]],ne=void 0;for(var pe in ae){var Ie=N[pe];if(Ie===void 0&&(Ie=N[pe]=new RegExp(pe).test(R||"en")),Ie){for(var Pe in ne=pe,ae[pe])if(o($,ae[pe][Pe])){te=Pe;break}break}}if(!te){e:for(var Se in ae)if(Se!==ne){for(var O in ae[Se])if(o($,ae[Se][O])){te=O;break e}}}te||(console.debug("No font coverage for U+"+$.toString(16)),te="latin"),q[G]=te,f[te]||K.has(te)||K.set(te,Z("font-meta/"+te+".json").then(function(Me){f[te]=Me})),$>65535&&(G++,j=G)},j=0;j<M.length;j++)F(j);return Promise.all(K.values())}).then(function(){for(var F,j=null,G=0;G<M.length;G++){var $=M.codePointAt(G);if(j&&(E($)||m(j).has($)))B[G]=B[G-1];else{j=f[q[G]];var te=ee[j.id];if(!te){var ae=j.typeforms,ne=y(ae,L,"sans-serif"),pe=y(ae[ne],D,"normal"),Ie=_((F=ae[ne])===null||F===void 0?void 0:F[pe],A);te=ee[j.id]=C+"/font-files/"+j.id+"/"+ne+"."+pe+"."+Ie+".woff"}var Pe=k.get(te);Pe==null&&(Pe=k.size,k.set(te,Pe)),B[G]=Pe}$>65535&&(G++,B[G]=B[G-1])}return{fontUrls:Array.from(k.keys()),chars:B}})}
3771,Object.defineProperty(s,"__esModule",{value:!0}),s}({})}function vC(s,e){const t=Object.create(null),n=Object.create(null);function i(o,a){const c=h=>{console.error(`Failure loading font ${o}`,h)};try{const h=new XMLHttpRequest;h.open("get",o,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status>=400)c(new Error(h.statusText));else if(h.status>0)try{const f=s(h.response);f.src=o,a(f)}catch(f){c(f)}},h.onerror=c,h.send()}catch(h){c(h)}}function r(o,a){let c=t[o];c?a(c):n[o]?n[o].push(a):(n[o]=[a],i(o,h=>{h.src=o,t[o]=h,n[o].forEach(f=>f(h)),delete n[o]}))}return function(o,a,{lang:c,fonts:h=[],style:f="normal",weight:d="normal",unicodeFontsURL:p}={}){const m=new Uint8Array(o.length),v=[];o.length||E();const S=new Map,y=[];if(f!=="italic"&&(f="normal"),typeof d!="number"&&(d=d==="bold"?700:400),h&&!Array.isArray(h)&&(h=[h]),h=h.slice().filter(b=>!b.lang||b.lang.test(c)).reverse(),h.length){let L=0;(function D(A=0){for(let C=A,k=o.length;C<k;C++){const B=o.codePointAt(C);if(L===1&&v[m[C-1]].supportsCodePoint(B)||C>0&&/\s/.test(o[C]))m[C]=m[C-1],L===2&&(y[y.length-1][1]=C);else for(let ee=m[C],N=h.length;ee<=N;ee++)if(ee===N){const q=L===2?y[y.length-1]:y[y.length]=[C,C];q[1]=C,L=2}else{m[C]=ee;const{src:q,unicodeRange:K}=h[ee];if(!K||M(B,K)){const re=t[q];if(!re){r(q,()=>{D(C)});return}if(re.supportsCodePoint(B)){let Z=S.get(re);typeof Z!="number"&&(Z=v.length,v.push(re),S.set(re,Z)),m[C]=Z,L=1;break}}}B>65535&&C+1<k&&(m[C+1]=m[C],C++,L===2&&(y[y.length-1][1]=C))}_()})()}else y.push([0,o.length-1]),_();function _(){if(y.length){const b=y.map(P=>o.substring(P[0],P[1]+1)).join(` 3772`);e.getFontsForString(b,{lang:c||void 0,style:f,weight:d,dataUrl:p}).then(({fontUrls:P,chars:R})=>{const L=v.length;let D=0;y.forEach(C=>{for(let k=0,B=C[1]-C[0];k<=B;k++)m[C[0]+k]=R[D++]+L;D++});let A=0;P.forEach((C,k)=>{r(C,B=>{v[k+L]=B,++A===P.length&&E()})})})}else E()}function E(){a({chars:m,fonts:v})}function M(b,P){for(let R=0;R<P.length;R++){const[L,D=L]=P[R];if(L<=b&&b<=D)return!0}return!1}}}const _C=va({name:"FontResolver",dependencies:[vC,mC,gC],init(s,e,t){return s(e,t())}});function yC(s,e){const n=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,i="[^\\S\\u00A0]",r=new RegExp(`${i}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function o({text:v,lang:S,fonts:y,style:_,weight:E,preResolvedFonts:M,unicodeFontsURL:b},P){const R=({chars:L,fonts:D})=>{let A,C;const k=[];for(let B=0;B<L.length;B++)L[B]!==C?(C=L[B],k.push(A={start:B,end:B,fontObj:D[L[B]]})):A.end=B;P(k)};M?R(M):s(v,R,{lang:S,fonts:y,style:_,weight:E,unicodeFontsURL:b})}function a({text:v="",font:S,lang:y,sdfGlyphSize:_=64,fontSize:E=400,fontWeight:M=1,fontStyle:b="normal",letterSpacing:P=0,lineHeight:R="normal",maxWidth:L=1/0,direction:D,textAlign:A="left",textIndent:C=0,whiteSpace:k="normal",overflowWrap:B="normal",anchorX:ee=0,anchorY:N=0,metricsOnly:q=!1,unicodeFontsURL:K,preResolvedFonts:re=null,includeCaretPositions:Z=!1,chunkedBoundsSize:W=8192,colorRanges:V=null},F){const j=d(),G={fontLoad:0,typesetting:0};v.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),v=v.replace(/\r\n/g,` 3773`).replace(/\r/g,` 3774`)),E=+E,P=+P,L=+L,R=R||"normal",C=+C,o({text:v,lang:y,style:b,weight:M,fonts:typeof S=="string"?[{src:S}]:S,unicodeFontsURL:K,preResolvedFonts:re},$=>{G.fontLoad=d()-j;const te=isFinite(L);let ae=null,ne=null,pe=null,Ie=null,Pe=null,Se=null,O=null,Me=null,ue=0,de=0,oe=k!=="nowrap";const Ue=new Map,fe=d();let U=C,I=0,X=new p;const ye=[X];$.forEach(Ce=>{const{fontObj:De}=Ce,{ascender:ke,descender:xe,unitsPerEm:it,lineGap:tt,capHeight:Xe,xHeight:ze}=De;let Le=Ue.get(De);if(!Le){const ge=E/it,J=R==="normal"?(ke-xe+tt)*ge:R*E,Ge=(J-(ke-xe)*ge)/2,Fe=Math.min(J,(ke-xe)*ge),He=(ke+xe)/2*ge+Fe/2;Le={index:Ue.size,src:De.src,fontObj:De,fontSizeMult:ge,unitsPerEm:it,ascender:ke*ge,descender:xe*ge,capHeight:Xe*ge,xHeight:ze*ge,lineHeight:J,baseline:-Ge-ke*ge,caretTop:He,caretBottom:He-Fe},Ue.set(De,Le)}const{fontSizeMult:Q}=Le,we=v.slice(Ce.start,Ce.end+1);let We,Be;De.forEachGlyph(we,E,P,(ge,J,Ge,Fe)=>{J+=I,Fe+=Ce.start,We=J,Be=ge;const He=v.charAt(Fe),je=ge.advanceWidth*Q,rt=X.count;let Ze;if("isEmpty"in ge||(ge.isWhitespace=!!He&&new RegExp(i).test(He),ge.canBreakAfter=!!He&&r.test(He),ge.isEmpty=ge.xMin===ge.xMax||ge.yMin===ge.yMax||n.test(He)),!ge.isWhitespace&&!ge.isEmpty&&de++,oe&&te&&!ge.isWhitespace&&J+je+U>L&&rt){if(X.glyphAt(rt-1).glyphObj.canBreakAfter)Ze=new p,U=-J;else for(let At=rt;At--;)if(At===0&&B==="break-word"){Ze=new p,U=-J;break}else if(X.glyphAt(At).glyphObj.canBreakAfter){Ze=X.splitAt(At+1);const gt=Ze.glyphAt(0).x;U-=gt;for(let Lt=Ze.count;Lt--;)Ze.glyphAt(Lt).x-=gt;break}Ze&&(X.isSoftWrapped=!0,X=Ze,ye.push(X),ue=L)}
3774let ht=X.glyphAt(X.count);ht.glyphObj=ge,ht.x=J+U,ht.y=Ge,ht.width=je,ht.charIndex=Fe,ht.fontData=Le,He===` 3775`&&(X=new p,ye.push(X),U=-(J+je+P*E)+C)}),I=We+Be.advanceWidth*Q+P*E});let ce=0;ye.forEach(Ce=>{let De=!0;for(let ke=Ce.count;ke--;){const xe=Ce.glyphAt(ke);De&&!xe.glyphObj.isWhitespace&&(Ce.width=xe.x+xe.width,Ce.width>ue&&(ue=Ce.width),De=!1);let{lineHeight:it,capHeight:tt,xHeight:Xe,baseline:ze}=xe.fontData;it>Ce.lineHeight&&(Ce.lineHeight=it);const Le=ze-Ce.baseline;Le<0&&(Ce.baseline+=Le,Ce.cap+=Le,Ce.ex+=Le),Ce.cap=Math.max(Ce.cap,Ce.baseline+tt),Ce.ex=Math.max(Ce.ex,Ce.baseline+Xe)}Ce.baseline-=ce,Ce.cap-=ce,Ce.ex-=ce,ce+=Ce.lineHeight});let he=0,Te=0;if(ee&&(typeof ee=="number"?he=-ee:typeof ee=="string"&&(he=-ue*(ee==="left"?0:ee==="center"?.5:ee==="right"?1:h(ee)))),N&&(typeof N=="number"?Te=-N:typeof N=="string"&&(Te=N==="top"?0:N==="top-baseline"?-ye[0].baseline:N==="top-cap"?-ye[0].cap:N==="top-ex"?-ye[0].ex:N==="middle"?ce/2:N==="bottom"?ce:N==="bottom-baseline"?-ye[ye.length-1].baseline:h(N)*ce)),!q){const Ce=e.getEmbeddingLevels(v,D);ae=new Uint16Array(de),ne=new Uint8Array(de),pe=new Float32Array(de*2),Ie={},O=[1/0,1/0,-1/0,-1/0],Me=[],Z&&(Se=new Float32Array(v.length*4)),V&&(Pe=new Uint8Array(de*3));let De=0,ke=-1,xe=-1,it,tt;if(ye.forEach((Xe,ze)=>{let{count:Le,width:Q}=Xe;if(Le>0){let we=0;for(let Fe=Le;Fe--&&Xe.glyphAt(Fe).glyphObj.isWhitespace;)we++;let We=0,Be=0;if(A==="center")We=(ue-Q)/2;else if(A==="right")We=ue-Q;else if(A==="justify"&&Xe.isSoftWrapped){let Fe=0;for(let He=Le-we;He--;)Xe.glyphAt(He).glyphObj.isWhitespace&&Fe++;Be=(ue-Q)/Fe}if(Be||We){let Fe=0;for(let He=0;He<Le;He++){let je=Xe.glyphAt(He);const rt=je.glyphObj;je.x+=We+Fe,Be!==0&&rt.isWhitespace&&He<Le-we&&(Fe+=Be,je.width+=Be)}}const ge=e.getReorderSegments(v,Ce,Xe.glyphAt(0).charIndex,Xe.glyphAt(Xe.count-1).charIndex);for(let Fe=0;Fe<ge.length;Fe++){const[He,je]=ge[Fe];let rt=1/0,Ze=-1/0;for(let ht=0;ht<Le;ht++)if(Xe.glyphAt(ht).charIndex>=He){let At=ht,gt=ht;for(;gt<Le;gt++){let Lt=Xe.glyphAt(gt);if(Lt.charIndex>je)break;gt<Le-we&&(rt=Math.min(rt,Lt.x),Ze=Math.max(Ze,Lt.x+Lt.width))}for(let Lt=At;Lt<gt;Lt++){const Yt=Xe.glyphAt(Lt);Yt.x=Ze-(Yt.x+Yt.width-rt)}break}}let J;const Ge=Fe=>J=Fe;for(let Fe=0;Fe<Le;Fe++){const He=Xe.glyphAt(Fe);J=He.glyphObj;const je=J.index,rt=Ce.levels[He.charIndex]&1;if(rt){const Ze=e.getMirroredCharacter(v[He.charIndex]);Ze&&He.fontData.fontObj.forEachGlyph(Ze,0,0,Ge)}if(Z){const{charIndex:Ze,fontData:ht}=He,At=He.x+he,gt=He.x+He.width+he;Se[Ze*4]=rt?gt:At,Se[Ze*4+1]=rt?At:gt,Se[Ze*4+2]=Xe.baseline+ht.caretBottom+Te,Se[Ze*4+3]=Xe.baseline+ht.caretTop+Te;const Lt=Ze-ke;Lt>1&&f(Se,ke,Lt),ke=Ze}if(V){const{charIndex:Ze}=He;for(;Ze>xe;)xe++,V.hasOwnProperty(xe)&&(tt=V[xe])}if(!J.isWhitespace&&!J.isEmpty){const Ze=De++,{fontSizeMult:ht,src:At,index:gt}=He.fontData,Lt=Ie[At]||(Ie[At]={});Lt[je]||(Lt[je]={path:J.path,pathBounds:[J.xMin,J.yMin,J.xMax,J.yMax]});const Yt=He.x+he,oi=He.y+Xe.baseline+Te;pe[Ze*2]=Yt,pe[Ze*2+1]=oi;const jn=Yt+J.xMin*ht,qn=oi+J.yMin*ht,Dn=Yt+J.xMax*ht,Nn=oi+J.yMax*ht;jn<O[0]&&(O[0]=jn),qn<O[1]&&(O[1]=qn),Dn>O[2]&&(O[2]=Dn),Nn>O[3]&&(O[3]=Nn),Ze%W===0&&(it={start:Ze,end:Ze,rect:[1/0,1/0,-1/0,-1/0]},Me.push(it)),it.end++;const dn=it.rect;if(jn<dn[0]&&(dn[0]=jn),qn<dn[1]&&(dn[1]=qn),Dn>dn[2]&&(dn[2]=Dn),Nn>dn[3]&&(dn[3]=Nn),ae[Ze]=je,ne[Ze]=gt,V){const Ri=Ze*3;Pe[Ri]=tt>>16&255,Pe[Ri+1]=tt>>8&255,Pe[Ri+2]=tt&255}}}}}),Se){const Xe=v.length-ke;Xe>1&&f(Se,ke,Xe)}}const Ne=[];Ue.forEach(({index:Ce,src:De,unitsPerEm:ke,ascender:xe,descender:it,lineHeight:tt,capHeight:Xe,xHeight:ze})=>{Ne[Ce]={src:De,unitsPerEm:ke,ascender:xe,descender:it,lineHeight:tt,capHeight:Xe,xHeight:ze}}),G.typesetting=d()-fe,F({glyphIds:ae,glyphFontIndices:ne,glyphPositions:pe,glyphData:Ie,fontData:Ne,caretPositions:Se,glyphColors:Pe,chunkedBounds:Me,fontSize:E,topBaseline:Te+ye[0].baseline,blockBounds:[he,Te-ce,he+ue,Te],visibleBounds:O,timings:G})})}function c(v,S){a({...v,metricsOnly:!0},y=>{const[_,E,M,b]=y.blockBounds;S({width:M-_,height:b-E})})}function h(v){let S=v.match(/^([\d.]+)%$/),y=S?parseFloat(S[1]):NaN;return isNaN(y)?0:y/100}function f(v,S,y){const _=v[S*4],E=v[S*4+1],M=v[S*4+2],b=v[S*4+3],P=(E-_)/y;for(let R=0;R<y;R++){const L=(S+R)*4;v[L]=_+P*R,v[L+1]=_+P*(R+1),v[L+2]=M,v[L+3]=b}}function d(){return(self.performance||Date).now()}function p(){this.data=[]}const m=["glyphObj","x","y","width","charIndex","fontData"];return p.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/m.length)},glyphAt(v){let S=p.flyweight;return S.data=this.data,S.index=v,S},splitAt(v){let S=new p;return S.data=this.data.splice(v*m.length),S}},p.flyweight=m.reduce((v,S,y,_)=>(Object.defineProperty(v,S,{get(){return this.data[this.index*m.length+y]},set(E){this.data[this.index*m.length+y]=E}}),v),{data:null,index:0}),{typeset:a,measure:c}}const to=()=>(self.performance||Date).now(),bh=gx();let Rv;function xC(s,e,t,n,i,r,o,a,c,h,f=!0){return f?MC(s,e,t,n,i,r,o,a,c,h).then(null,d=>(Rv||(console.warn("WebGL SDF generation failed, falling back to JS",d),Rv=!0),Lv(s,e,t,n,i,r,o,a,c,h))):Lv(s,e,t,n,i,r,o,a,c,h)}const Hu=[],SC=5;let up=0;function _x(){const s=to();for(;Hu.length&&to()-s<SC;)Hu.shift()();up=Hu.length?setTimeout(_x,0):0}const MC=(...s)=>new Promise((e,t)=>
3775{Hu.push(()=>{const n=to();try{bh.webgl.generateIntoCanvas(...s),e({timing:to()-n})}catch(i){t(i)}}),up||(up=setTimeout(_x,0))}),EC=4,wC=2e3,Pv={};let bC=0;function Lv(s,e,t,n,i,r,o,a,c,h){const f="TroikaTextSDFGenerator_JS_"+bC++%EC;let d=Pv[f];return d||(d=Pv[f]={workerModule:va({name:f,workerId:f,dependencies:[gx,to],init(p,m){const v=p().javascript.generate;return function(...S){const y=m();return{textureData:v(...S),timing:m()-y}}},getTransferables(p){return[p.textureData.buffer]}}),requests:0,idleTimer:null}),d.requests++,clearTimeout(d.idleTimer),d.workerModule(s,e,t,n,i,r).then(({textureData:p,timing:m})=>{const v=to(),S=new Uint8Array(p.length*4);for(let y=0;y<p.length;y++)S[y*4+h]=p[y];return bh.webglUtils.renderImageData(o,S,a,c,s,e,1<<3-h),m+=to()-v,--d.requests===0&&(d.idleTimer=setTimeout(()=>{nC(f)},wC)),{timing:m}})}function TC(s){s._warm||(bh.webgl.isSupported(s),s._warm=!0)}const AC=bh.webglUtils.resizeWebGLCanvasWithoutClearing,$o={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048,useWorker:!0},CC=new $e;function Jo(){return(self.performance||Date).now()}const Iv=Object.create(null);function yx(s,e){s=LC({},s);const t=Jo(),{defaultFontURL:n}=$o,i=[];if(n&&i.push({label:"default",src:Uv(n)}),s.font&&i.push({label:"user",src:Uv(s.font)}),s.font=i,s.text=""+s.text,s.sdfGlyphSize=s.sdfGlyphSize||$o.sdfGlyphSize,s.unicodeFontsURL=s.unicodeFontsURL||$o.unicodeFontsURL,s.colorRanges!=null){let m={};for(let v in s.colorRanges)if(s.colorRanges.hasOwnProperty(v)){let S=s.colorRanges[v];typeof S!="number"&&(S=CC.set(S).getHex()),m[v]=S}s.colorRanges=m}Object.freeze(s);const{textureWidth:r,sdfExponent:o}=$o,{sdfGlyphSize:a}=s,c=r/a*4;let h=Iv[a];if(!h){const m=document.createElement("canvas");m.width=r,m.height=a*256/c,h=Iv[a]={glyphCount:0,sdfGlyphSize:a,sdfCanvas:m,sdfTexture:new sn(m,void 0,void 0,void 0,Kt,Kt),contextLost:!1,glyphsByFont:new Map},h.sdfTexture.generateMipmaps=!1,RC(h)}const{sdfTexture:f,sdfCanvas:d}=h;Mx(s).then(m=>{const{glyphIds:v,glyphFontIndices:S,fontData:y,glyphPositions:_,fontSize:E,timings:M}=m,b=[],P=new Float32Array(v.length*4);let R=0,L=0;const D=Jo(),A=y.map(N=>{let q=h.glyphsByFont.get(N.src);return q||h.glyphsByFont.set(N.src,q=new Map),q});v.forEach((N,q)=>{const K=S[q],{src:re,unitsPerEm:Z}=y[K];let W=A[K].get(N);if(!W){const{path:$,pathBounds:te}=m.glyphData[re][N],ae=Math.max(te[2]-te[0],te[3]-te[1])/a*($o.sdfMargin*a+.5),ne=h.glyphCount++,pe=[te[0]-ae,te[1]-ae,te[2]+ae,te[3]+ae];A[K].set(N,W={path:$,atlasIndex:ne,sdfViewBox:pe}),b.push(W)}const{sdfViewBox:V}=W,F=_[L++],j=_[L++],G=E/Z;P[R++]=F+V[0]*G,P[R++]=j+V[1]*G,P[R++]=F+V[2]*G,P[R++]=j+V[3]*G,v[q]=W.atlasIndex}),M.quads=(M.quads||0)+(Jo()-D);const C=Jo();M.sdf={};const k=d.height,B=Math.ceil(h.glyphCount/c),ee=Math.pow(2,Math.ceil(Math.log2(B*a)));ee>k&&(console.info(`Increasing SDF texture size ${k}->${ee}`),AC(d,r,ee),f.dispose()),Promise.all(b.map(N=>xx(N,h,s.gpuAccelerateSDF).then(({timing:q})=>{M.sdf[N.atlasIndex]=q}))).then(()=>{b.length&&!h.contextLost&&(Sx(h),f.needsUpdate=!0),M.sdfTotal=Jo()-C,M.total=Jo()-t,e(Object.freeze({parameters:s,sdfTexture:f,sdfGlyphSize:a,sdfExponent:o,glyphBounds:P,glyphAtlasIndices:v,glyphColors:m.glyphColors,caretPositions:m.caretPositions,chunkedBounds:m.chunkedBounds,ascender:m.ascender,descender:m.descender,lineHeight:m.lineHeight,capHeight:m.capHeight,xHeight:m.xHeight,topBaseline:m.topBaseline,blockBounds:m.blockBounds,visibleBounds:m.visibleBounds,timings:m.timings}))})}),Promise.resolve().then(()=>{h.contextLost||TC(d)})}function xx({path:s,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:n,sdfCanvas:i,contextLost:r},o){if(r)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:c}=$o,h=Math.max(t[2]-t[0],t[3]-t[1]),f=Math.floor(e/4),d=f%(a/n)*n,p=Math.floor(f/(a/n))*n,m=e%4;return xC(n,n,s,t,h,c,i,d,p,m,o)}function RC(s){const e=s.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),s.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),s.contextLost=!1;const n=[];
3775s.glyphsByFont.forEach(i=>{i.forEach(r=>{n.push(xx(r,s,!0))})}),Promise.all(n).then(()=>{Sx(s),s.sdfTexture.needsUpdate=!0})})}function PC({font:s,characters:e,sdfGlyphSize:t},n){let i=Array.isArray(e)?e.join(` 3776`):""+e;yx({font:s,sdfGlyphSize:t,text:i},n)}function LC(s,e){for(let t in e)e.hasOwnProperty(t)&&(s[t]=e[t]);return s}let Lu;function Uv(s){return Lu||(Lu=typeof document>"u"?{}:document.createElement("a")),Lu.href=s,Lu.href}function Sx(s){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=s,{width:n,height:i}=e,r=s.sdfCanvas.getContext("webgl");let o=t.image.data;(!o||o.length!==n*i*4)&&(o=new Uint8Array(n*i*4),t.image={width:n,height:i,data:o},t.flipY=!1,t.isDataTexture=!0),r.readPixels(0,0,n,i,r.RGBA,r.UNSIGNED_BYTE,o)}}const IC=va({name:"Typesetter",dependencies:[yC,_C,rC],init(s,e,t){return s(e,t())}}),Mx=va({name:"Typesetter",dependencies:[IC],init(s){return function(e){return new Promise(t=>{s.typeset(e,t)})}},getTransferables(s){const e=[];for(let t in s)s[t]&&s[t].buffer&&e.push(s[t].buffer);return e}});Mx.onMainThread;const Dv={};function UC(s){let e=Dv[s];return e||(e=Dv[s]=new hs(1,1,s,s).translate(.5,.5,0)),e}const DC="aTroikaGlyphBounds",Nv="aTroikaGlyphIndex",NC="aTroikaGlyphColor";class FC extends Zp{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Rn,this.boundingBox=new Cn}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=UC(e);["position","normal","uv"].forEach(n=>{this.attributes[n]=t.attributes[n].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,n,i,r){this.updateAttributeData(DC,e,4),this.updateAttributeData(Nv,t,1),this.updateAttributeData(NC,r,3),this._blockBounds=n,this._chunkedBounds=i,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:n}=this;if(t){const{PI:i,floor:r,min:o,max:a,sin:c,cos:h}=Math,f=i/2,d=i*2,p=Math.abs(t),m=e[0]/p,v=e[2]/p,S=r((m+f)/d)!==r((v+f)/d)?-p:o(c(m)*p,c(v)*p),y=r((m-f)/d)!==r((v-f)/d)?p:a(c(m)*p,c(v)*p),_=r((m+i)/d)!==r((v+i)/d)?p*2:a(p-h(m)*p,p-h(v)*p);n.min.set(S,e[1],t<0?-_:0),n.max.set(y,e[3],t<0?0:_)}else n.min.set(e[0],e[1],0),n.max.set(e[2],e[3],0);n.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(Nv).count,n=this._chunkedBounds;if(n)for(let i=n.length;i--;){t=n[i].end;let r=n[i].rect;if(r[1]<e.w&&r[3]>e.y&&r[0]<e.z&&r[2]>e.x)break}this.instanceCount=t}updateAttributeData(e,t,n){const i=this.getAttribute(e);t?i&&i.array.length===t.length?(i.array.set(t),i.needsUpdate=!0):(this.setAttribute(e,new ro(t,n)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}}const OC=` 3777uniform vec2 uTroikaSDFTextureSize; 3778uniform float uTroikaSDFGlyphSize; 3779uniform vec4 uTroikaTotalBounds; 3780uniform vec4 uTroikaClipRect; 3781uniform mat3 uTroikaOrient; 3782uniform bool uTroikaUseGlyphColors; 3783uniform float uTroikaEdgeOffset; 3784uniform float uTroikaBlurRadius; 3785uniform vec2 uTroikaPositionOffset; 3786uniform float uTroikaCurveRadius; 3787attribute vec4 aTroikaGlyphBounds; 3788attribute float aTroikaGlyphIndex; 3789attribute vec3 aTroikaGlyphColor; 3790varying vec2 vTroikaGlyphUV; 3791varying vec4 vTroikaTextureUVBounds; 3792varying float vTroikaTextureChannel; 3793varying vec3 vTroikaGlyphColor; 3794varying vec2 vTroikaGlyphDimensions; 3795`,BC=` 3796vec4 bounds = aTroikaGlyphBounds; 3797bounds.xz += uTroikaPositionOffset.x; 3798bounds.yw -= uTroikaPositionOffset.y; 3799 3800vec4 outlineBounds = vec4( 3801 bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius, 3802 bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius 3803); 3804vec4 clippedBounds = vec4( 3805 clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw), 3806 clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw) 3807); 3808 3809vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy); 3810 3811position.xy = mix(bounds.xy, bounds.zw, clippedXY); 3812 3813uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy); 3814 3815float rad = uTroikaCurveRadius; 3816if (rad != 0.0) { 3817 float angle = position.x / rad; 3818 position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad); 3819 normal.xz = vec2(sin(angle), cos(angle)); 3820} 3821 3822position = uTroikaOrient * position; 3823normal = uTroikaOrient * normal; 3824 3825vTroikaGlyphUV = clippedXY.xy; 3826vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]); 3827 3828 3829float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize; 3830vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize; 3831vec2 txStartUV = txUvPerSquare * vec2( 3832 mod(floor(aTroikaGlyphIndex / 4.0), txCols), 3833 floor(floor(aTroikaGlyphIndex / 4.0) / txCols) 3834); 3835vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare); 3836vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0); 3837`,kC=` 3838uniform sampler2D uTroikaSDFTexture; 3839uniform vec2 uTroikaSDFTextureSize; 3840uniform float uTroikaSDFGlyphSize; 3841uniform float uTroikaSDFExponent; 3842uniform float uTroikaEdgeOffset; 3843uniform float uTroikaFillOpacity; 3844uniform float uTroikaBlurRadius; 3845uniform vec3 uTroikaStrokeColor; 3846uniform float uTroikaStrokeWidth; 3847uniform float uTroikaStrokeOpacity; 3848uniform bool uTroikaSDFDebug; 3849varying vec2 vTroikaGlyphUV; 3850varying vec4 vTroikaTextureUVBounds; 3851varying float vTroikaTextureChannel; 3852varying vec2 vTroikaGlyphDimensions; 3853 3854float troikaSdfValueToSignedDistance(float alpha) { 3855 // Inverse of exponential encoding in webgl-sdf-generator 3856 3857 float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y); 3858 float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension; 3859 float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0); 3860 return signedDist; 3861} 3862 3863float troikaGlyphUvToSdfValue(vec2 glyphUV) { 3864 vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV); 3865 vec4 rgba = texture2D(uTroikaSDFTexture, textureUV); 3866 float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1 3867 return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a; 3868} 3869 3870float troikaGlyphUvToDistance(vec2 uv) { 3871 return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv)); 3872} 3873 3874float troikaGetAADist() { 3875 3876 #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300 3877 return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5; 3878 #else 3879 return vTroikaGlyphDimensions.x / 64.0; 3880 #endif 3881} 3882 3883float troikaGetFragDistValue() { 3884 vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize); 3885 float distance = troikaGlyphUvToDistance(clampedGlyphUV); 3886 3887 // Extrapolate distance when outside bounds: 3888 distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : 3889 length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions); 3890 3891 3892 3893 return distance; 3894} 3895 3896float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) { 3897 #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL) 3898 float alpha = step(-distanceOffset, -distance); 3899 #else 3900 3901 float alpha = smoothstep( 3902 distanceOffset + aaDist, 3903 distanceOffset - aaDist, 3904 distance 3905 ); 3906 #endif 3907 3908 return alpha; 3909} 3910`,zC=` 3911float aaDist = troikaGetAADist(); 3912float fragDistance = troikaGetFragDistValue(); 3913float edgeAlpha = uTroikaSDFDebug ? 3914 troikaGlyphUvToSdfValue(vTroikaGlyphUV) : 3915 troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius)); 3916 3917#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL) 3918vec4 fillRGBA = gl_FragColor; 3919fillRGBA.a *= uTroikaFillOpacity; 3920vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity); 3921if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb; 3922gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep( 3923 -uTroikaStrokeWidth - aaDist, 3924 -uTroikaStrokeWidth + aaDist, 3925 fragDistance 3926));
3927gl_FragColor.a *= edgeAlpha; 3928#endif 3929 3930if (edgeAlpha == 0.0) { 3931 discard; 3932} 3933`;function GC(s){const e=cp(s,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Re},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Ft(0,0,0,0)},uTroikaClipRect:{value:new Ft(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Re},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new $e},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new wt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:OC,vertexTransform:BC,fragmentDefs:kC,fragmentColorTransform:zC,customRewriter({vertexShader:t,fragmentShader:n}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(n)&&(n=n.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(t)||(t=t.replace(vx,`uniform vec3 diffuse; 3934$& 3935vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; 3936`))),{vertexShader:t,fragmentShader:n}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const im=new Br({color:16777215,side:pi,transparent:!0}),Fv=8421504,Ov=new yt,Iu=new H,fd=new H,nl=[],HC=new H,dd="+x+y";function Bv(s){return Array.isArray(s)?s[0]:s}let Ex=()=>{const s=new rn(new hs(1,1),im);return Ex=()=>s,s},wx=()=>{const s=new rn(new hs(1,1,32,1),im);return wx=()=>s,s};const VC={type:"syncstart"},WC={type:"synccomplete"},bx=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],XC=bx.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let Tx=class extends rn{constructor(){const e=new FC;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Fv,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=dd,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(VC),yx({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{n.forEach(i=>i&&i())})),this.dispatchEvent(WC),e&&e()})))}onBeforeRender(e,t,n,i,r,o){this.sync(),r.isTroikaTextMaterial&&this._prepareForRender(r)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return GC(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=im.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function n(){t.removeEventListener("dispose",n),e.dispose()})),this.hasOutline()){let n=e._outlineMtl;return n||(n=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),n.isTextOutlineMaterial=!0,n.depthWrite=!1,n.map=null,e.addEventListener("dispose",function i(){e.removeEventListener("dispose",i),n.dispose()})),[n,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return Bv(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return Bv(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,n=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:a,blockBounds:c}=i;n.uTroikaSDFTexture.value=a,n.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),n.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,n.uTroikaSDFExponent.value=i.sdfExponent,n.uTroikaTotalBounds.value.fromArray(c),n.uTroikaUseGlyphColors.value=!t&&!!i.glyphColors;let h=0,f=0,d=0,p,m,v,S=0,y=0;if(t){let{outlineWidth:E,outlineOffsetX:M,outlineOffsetY:b,outlineBlur:P,outlineOpacity:R}=this;h=this._parsePercent(E)||0,f=Math.max(0,this._parsePercent(P)||0),p=R,S=this._parsePercent(M)||0,y=this._parsePercent(b)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(v=this.strokeColor,n.uTroikaStrokeColor.value.set(v??Fv),m=this.strokeOpacity,m==null&&(m=1)),p=this.fillOpacity;n.uTroikaEdgeOffset.value=h,n.uTroikaPositionOffset.value.set(S,y),n.uTroikaBlurRadius.value=f,n.uTroikaStrokeWidth.value=d,n.uTroikaStrokeOpacity.value=m,n.uTroikaFillOpacity.value=p??1,n.uTroikaCurveRadius.value=this.curveRadius||0;let _=this.clipRect;if(_&&Array.isArray(_)&&_.length===4)n.uTroikaClipRect.value.fromArray(_);else{const E=(this.fontSize||.1)*100;n.uTroikaClipRect.value.set(c[0]-E,c[1]-E,c[2]+E,c[3]+E)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const r=t?this.outlineColor||0:this.color;if(r==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new $e;(r!==a._input||typeof r=="object")&&a.set(a._input=r)}let o=this.orientation||dd;if(o!==e._orientation){let a=n.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let c=o!==dd&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(c){let[,h,f,d,p]=c;Iu.set(0,0,0)[f]=h==="-"?1:-1,fd.set(0,0,0)[p]=d==="-"?-1:1,Ov.lookAt(HC,Iu.cross(fd),fd),a.setFromMatrix4(Ov)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),n=t?parseFloat(t[1]):NaN;e=(isNaN(n)?0:n/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new Re){t.copy(e);const n=this.curveRadius;return n&&(t.x=Math.atan2(e.x,Math.abs(n)-Math.abs(e.z))*Math.abs(n)),t}worldPositionToTextCoords(e,t=new Re){return Iu.copy(e),this.localPositionToTextCoords(this.worldToLocal(Iu),t)}raycast(e,t){const{textRenderInfo:n,curveRadius:i}=this;if(n){const r=n.blockBounds,o=i?wx():Ex(),a=o.geometry,{position:c,uv:h}=a.attributes;for(let f=0;f<h.count;f++){let d=r[0]+h.getX(f)*(r[2]-r[0]);const p=r[1]+h.getY(f)*(r[3]-r[1]);let m=0;i&&(m=i-Math.cos(d/i)*i,d=Math.sin(d/i)*i),c.setXYZ(f,d,p,m)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,nl.length=0,o.raycast(e,nl);for(let f=0;f<nl.length;f++)nl[f].object=this,t.push(nl[f])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,XC.forEach(n=>{this[n]=e[n]}),this}clone(){return new this.constructor().copy(this)}};bx.forEach(s=>{const e="_private_"+s;Object.defineProperty(Tx.prototype,s,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});new Cn;new $e;const YC=Ye.forwardRef(({sdfGlyphSize:s=64,anchorX:e="center",anchorY:t="middle",font:n,fontSize:i=1,children:r,characters:o,onSync:a,...c},h)=>{const f=Ar(({invalidate:v})=>v),[d]=Ye.useState(()=>new Tx),[p,m]=Ye.useMemo(()=>{const v=[];let S="";
3936return Ye.Children.forEach(r,y=>{typeof y=="string"||typeof y=="number"?S+=y:v.push(y)}),[v,S]},[r]);return n2(()=>new Promise(v=>PC({font:n,characters:o},v)),["troika-text",n,o]),Ye.useLayoutEffect(()=>void d.sync(()=>{f(),a&&a(d)})),Ye.useEffect(()=>()=>d.dispose(),[d]),Ye.createElement("primitive",fl({object:d,ref:h,font:n,text:m,anchorX:e,anchorY:t,fontSize:i,sdfGlyphSize:s},c),p)}),jC=Ye.forwardRef(({makeDefault:s,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:r=!1,onChange:o,onStart:a,onEnd:c,...h},f)=>{const d=Ar(R=>R.invalidate),p=Ar(R=>R.camera),m=Ar(R=>R.gl),v=Ar(R=>R.events),S=Ar(R=>R.setEvents),y=Ar(R=>R.set),_=Ar(R=>R.get),E=Ar(R=>R.performance),M=e||p,b=n||v.connected||m.domElement,P=Ye.useMemo(()=>new K2(M),[M]);return M2(()=>{P.enabled&&P.update()},-1),Ye.useEffect(()=>(r&&P.connect(r===!0?b:r),P.connect(b),()=>void P.dispose()),[r,b,t,P,d]),Ye.useEffect(()=>{const R=A=>{d(),t&&E.regress(),o&&o(A)},L=A=>{a&&a(A)},D=A=>{c&&c(A)};return P.addEventListener("change",R),P.addEventListener("start",L),P.addEventListener("end",D),()=>{P.removeEventListener("start",L),P.removeEventListener("end",D),P.removeEventListener("change",R)}},[o,a,c,P,d,S]),Ye.useEffect(()=>{if(s){const R=_().controls;return y({controls:P}),()=>y({controls:R})}},[s,P]),Ye.createElement("primitive",fl({ref:f,object:P,enableDamping:i},h))}),qC=Ye.forwardRef(function({children:e,disable:t,disableX:n,disableY:i,disableZ:r,left:o,right:a,top:c,bottom:h,front:f,back:d,onCentered:p,precise:m=!0,cacheKey:v=0,...S},y){const _=Ye.useRef(null),E=Ye.useRef(null),M=Ye.useRef(null);return Ye.useLayoutEffect(()=>{E.current.matrixWorld.identity();const b=new Cn().setFromObject(M.current,m),P=new H,R=new Rn,L=b.max.x-b.min.x,D=b.max.y-b.min.y,A=b.max.z-b.min.z;b.getCenter(P),b.getBoundingSphere(R);const C=c?D/2:h?-D/2:0,k=o?-L/2:a?L/2:0,B=f?A/2:d?-A/2:0;E.current.position.set(t||n?0:-P.x+k,t||i?0:-P.y+C,t||r?0:-P.z+B),typeof p<"u"&&p({parent:_.current.parent,container:_.current,width:L,height:D,depth:A,boundingBox:b,boundingSphere:R,center:P,verticalAlignment:C,horizontalAlignment:k,depthAlignment:B})},[v,p,c,o,f,t,n,i,r,m,a,h,d]),Ye.useImperativeHandle(y,()=>_.current,[]),Ye.createElement("group",fl({ref:_},S),Ye.createElement("group",{ref:E},Ye.createElement("group",{ref:M},e)))}),kv=(s,e)=>{const n=Math.cos(e[0]*Math.PI/180)*364e3;return s.map(([i,r])=>[(r-e[1])*n,(i-e[0])*364e3])},ZC=s=>{const e=s.reduce((t,[n,i])=>[t[0]+n,t[1]+i],[0,0]);return[e[0]/s.length,e[1]/s.length]},rm=s=>{const e=new as;if(s.length===0)return e;e.moveTo(s[0][0],s[0][1]);for(let t=1;t<s.length;t++)e.lineTo(s[t][0],s[t][1]);return e.closePath(),e},JC=({points:s})=>{const e=Ye.useMemo(()=>{const t=[];s.forEach(([i,r])=>{t.push(i,.1,r)}),s.length>0&&t.push(s[0][0],.1,s[0][1]);const n=new Tt;return n.setAttribute("position",new st(t,3)),n},[s]);return _t.jsx("primitive",{object:new Nr(e,new Yn({color:"#0ea5e9",linewidth:2}))})},KC=({points:s})=>{const e=Ye.useMemo(()=>rm(s),[s]);return _t.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.05,0],children:[_t.jsx("shapeGeometry",{args:[e]}),_t.jsx("meshBasicMaterial",{color:"#0ea5e9",transparent:!0,opacity:.1,side:pi})]})},QC=({points:s,height:e})=>{const t=Ye.useMemo(()=>{const n=rm(s),i={steps:1,depth:e,bevelEnabled:!1};return new ma(n,i)},[s,e]);return _t.jsx("mesh",{geometry:t,rotation:[-Math.PI/2,0,0],position:[0,0,0],children:_t.jsx("meshStandardMaterial",{color:"#6366f1",transparent:!0,opacity:.7,side:pi})})},$C=({points:s,height:e})=>{const t=Ye.useMemo(()=>{const n=rm(s),i={steps:1,depth:e,bevelEnabled:!1};return new ma(n,i)},[s,e]);return _t.jsx("mesh",{geometry:t,rotation:[-Math.PI/2,0,0],position:[0,0,0],children:_t.jsx("meshBasicMaterial",{color:"#4f46e5",wireframe:!0})})},eR=({size:s})=>_t.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,0],receiveShadow:!0,children:[_t.jsx("planeGeometry",{args:[s*2,s*2]}),_t.jsx("meshStandardMaterial",{color:"#f8fafc",side:pi})]}),tR=({size:s})=>{const e=Math.round(s/4/10)*10;return _t.jsxs("group",{position:[-s*.8,.2,s*.8],children:[_t.jsxs("mesh",{children:[_t.jsx("boxGeometry",{args:[e,.5,2]}),_t.jsx("meshBasicMaterial",{color:"#64748b"})]}),_t.jsx(qC,{position:[0,5,0],children:_t.jsxs(YC,{fontSize:8,color:"#64748b",children:[e," ft"]})})]})},oR=({parcelBoundary:s,buildableFootprint:e,extrusionHeight:t,permittedUse:n})=>{const i=Ye.useMemo(()=>ZC(s),[s]),r=Ye.useMemo(()=>kv(s,i),[s,i]),o=Ye.useMemo(()=>kv(e,i),[e,i]),a=Ye.useMemo(()=>{const c=[...r,...o],h=Math.max(...c.map(([f,d])=>Math.sqrt(f*f+d*d)));return Math.max(h*1.5,100)},[r,o]);return _t.jsxs("div",{className:"relative w-full h-full min-h-[400px] bg-gradient-to-b from-muted to-muted/50 rounded-lg overflow-hidden",children:[_t.jsx("div",{className:"absolute top-3 left-3 z-10 bg-background/90 backdrop-blur-sm px-3 py-1.5 rounded-md border shadow-sm",children:_t.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:"Conceptual massing. Not architectural design."})}),_t.jsx("div",{className:"absolute top-3 right-3 z-10 bg-primary/90 backdrop-blur-sm px-3 py-1.5 rounded-md",children:_t.jsx("p",{className:"text-xs text-primary-foreground font-medium",children:n})}),_t.jsx("div",{className:"absolute bottom-3 right-3 z-10 bg-background/90 backdrop-blur-sm px-3 py-1.5 rounded-md border shadow-sm",children:_t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Height: ",_t.jsxs("span",{className:"font-bold text-primary",children:[t," ft"]})]})}),_t.jsx(V2,{camera:{position:[a,a*.8,a],fov:50,near:1,far:a*10},shadows:!0,children:_t.jsxs(Ye.Suspense,{fallback:null,children:[_t.jsx("ambientLight",{intensity:.6}),_t.jsx("directionalLight",{position:[a,a*2,a],intensity:.8,castShadow:!0}
3936),_t.jsx("directionalLight",{position:[-a,a,-a],intensity:.3}),_t.jsx(eR,{size:a}),_t.jsx(JC,{points:r}),_t.jsx(KC,{points:r}),_t.jsx(QC,{points:o,height:t}),_t.jsx($C,{points:o,height:t}),_t.jsx(tR,{size:a}),_t.jsx(jC,{enablePan:!0,enableZoom:!0,enableRotate:!0,minDistance:a*.3,maxDistance:a*3,maxPolarAngle:Math.PI/2.1})]})})]})};export{oR as default};
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.