1import{m as qw,g as zw,a as Hw,c as LP,b as IP,d as Ww,e as BP,r as Sb,j as FP}from"./index-Df1MULyf.js";/** 2 * @license 3 * Copyright 2010-2026 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const NA="183",Eh={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},vh={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},$w=0,c_=1,jw=2,UP=0,Rh=1,Xw=2,ha=3,cs=0,Xn=1,Ui=2,gr=0,mr=1,Aa=2,$l=3,jl=4,Ju=5,zx=6,Mr=100,Hx=101,Wx=102,Qw=103,Yw=104,Xa=200,$x=201,jx=202,Xx=203,Gh=204,Vh=205,Qx=206,Yx=207,Kx=208,Zx=209,Jx=210,OP=211,kP=212,GP=213,VP=214,Yf=0,Kf=1,Zf=2,ou=3,Jf=4,ed=5,td=6,nd=7,Dd=0,Kw=1,Zw=2,wr=0,ev=1,tv=2,nv=3,iv=4,Jw=5,rv=6,sv=7,ov=300,Fo=301,Ra=302,Ch=303,Nh=304,ac=306,lc=1e3,xs=1001,uc=1002,jn=1003,av=1004,Ja=1005,li=1006,Ph=1007,vs=1008,qP=1008,yi=1009,ec=1010,tc=1011,Do=1012,dr=1013,ii=1014,zi=1015,Mi=1016,tg=1017,ng=1018,Hs=1020,ig=35902,rg=35899,lv=1021,Ld=1022,Wi=1023,Rr=1026,as=1027,Id=1028,PA=1029,ls=1030,DA=1031,zP=1032,LA=1033,Zl=33776,Jl=33777,eu=33778,tu=33779,id=35840,rd=35841,sd=35842,od=35843,qh=36196,zh=37492,Hh=37496,Wh=37488,$h=37489,cc=37490,jh=37491,Xh=37808,Qh=37809,Yh=37810,Kh=37811,Zh=37812,Jh=37813,eA=37814,tA=37815,nA=37816,iA=37817,rA=37818,sA=37819,oA=37820,aA=37821,lA=36492,h_=36494,A_=36495,uA=36283,cA=36284,hc=36285,hA=36286,HP=0,WP=1,Tb=2,$P=3200,ma=0,eE=1,_s="",Tr="srgb",au="srgb-linear",AA="linear",_t="srgb",b1="",tE="rg",jP="ga",XP=0,Vu=7680,QP=7681,YP=7682,KP=7683,ZP=34055,JP=34056,e7=5386,t7=512,n7=513,i7=514,r7=515,s7=516,o7=517,a7=518,f_=519,uv=512,sg=513,cv=514,fu=515,ad=516,hv=517,al=518,Av=519,fA=35044,ld=35048,Mb="300 es",us=2e3,co=2001,fa={COMPUTE:"compute",RENDER:"render"},tl={TEXTURE_COMPARE:"depthTextureCompare"};function l7(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function im(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function ud(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function nE(){const i=ud("canvas");return i.style.display="block",i}const wb={};function cd(...i){const e="THREE."+i.shift();console.log(e,...i)}function iE(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Oe(...i){i=iE(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ke(...i){i=iE(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function zn(...i){const e=i.join(" ");e in wb||(wb[e]=!0,Oe(...i))}function u7(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const fv={[Yf]:Kf,[Zf]:td,[Jf]:nd,[ou]:ed,[Kf]:Yf,[td]:Zf,[nd]:Jf,[ed]:ou};class Ia{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const Ir=["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 Eb=1234567;const Uf=Math.PI/180,Ac=180/Math.PI;function ga(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ir[i&255]+Ir[i>>8&255]+Ir[i>>16&255]+Ir[i>>24&255]+"-"+Ir[e&255]+Ir[e>>8&255]+"-"+Ir[e>>16&15|64]+Ir[e>>24&255]+"-"+Ir[t&63|128]+Ir[t>>8&255]+"-"+Ir[t>>16&255]+Ir[t>>24&255]+Ir[n&255]+Ir[n>>8&255]+Ir[n>>16&255]+Ir[n>>24&255]).toLowerCase()}function cn(i,e,t){return Math.max(e,Math.min(t,i))}function dv(i,e){return(i%e+e)%e}function c7(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}
vendor: 43,134 bytes, line 5
5function h7(i,e,t){return i!==e?(t-i)/(e-i):0}function Of(i,e,t){return(1-t)*i+t*e}function A7(i,e,t,n){return Of(i,e,1-Math.exp(-t*n))}function f7(i,e=1){return e-Math.abs(dv(i,e*2)-e)}function d7(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function p7(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function m7(i,e){return i+Math.floor(Math.random()*(e-i+1))}function g7(i,e){return i+Math.random()*(e-i)}function _7(i){return i*(.5-Math.random())}function x7(i){i!==void 0&&(Eb=i);let e=Eb+=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 v7(i){return i*Uf}function y7(i){return i*Ac}function b7(i){return(i&i-1)===0&&i!==0}function S7(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function T7(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function M7(i,e,t,n,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),u=s((e+n)/2),d=o((e+n)/2),p=s((e-n)/2),g=o((e-n)/2),x=s((n-e)/2),y=o((n-e)/2);switch(r){case"XYX":i.set(a*d,l*p,l*g,a*u);break;case"YZY":i.set(l*g,a*d,l*p,a*u);break;case"ZXZ":i.set(l*p,l*g,a*d,a*u);break;case"XZX":i.set(a*d,l*y,l*x,a*u);break;case"YXY":i.set(l*x,a*d,l*y,a*u);break;case"ZYZ":i.set(l*y,l*x,a*d,a*u);break;default:Oe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ss(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function bn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const og={DEG2RAD:Uf,RAD2DEG:Ac,generateUUID:ga,clamp:cn,euclideanModulo:dv,mapLinear:c7,inverseLerp:h7,lerp:Of,damp:A7,pingpong:f7,smoothstep:d7,smootherstep:p7,randInt:m7,randFloat:g7,randFloatSpread:_7,seededRandom:x7,degToRad:v7,radToDeg:y7,isPowerOfTwo:b7,ceilPowerOfTwo:S7,floorPowerOfTwo:T7,setQuaternionFromProperEuler:M7,normalize:bn,denormalize:ss};class We{constructor(e=0,t=0){We.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,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[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=cn(this.x,e.x,t.x),this.y=cn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=cn(this.x,e,t),this.y=cn(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(cn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(cn(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),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+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 ll{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],u=n[r+1],d=n[r+2],p=n[r+3],g=s[o+0],x=s[o+1],y=s[o+2],T=s[o+3];if(p!==T||l!==g||u!==x||d!==y){let S=l*g+u*x+d*y+p*T;S<0&&(g=-g,x=-x,y=-y,T=-T,S=-S);let M=1-a;if(S<.9995){const R=Math.acos(S),E=Math.sin(R);M=Math.sin(M*R)/E,a=Math.sin(a*R)/E,l=l*M+g*a,u=u*M+x*a,d=d*M+y*a,p=p*M+T*a}else{l=l*M+g*a,u=u*M+x*a,d=d*M+y*a,p=p*M+T*a;const R=1/Math.sqrt(l*l+u*u+d*d+p*p);l*=R,u*=R,d*=R,p*=R}}e[t]=l,e[t+1]=u,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,r,s,o){const a=n[r],l=n[r+1],u=n[r+2],d=n[r+3],p=s[o],g=s[o+1],x=s[o+2],y=s[o+3];return e[t]=a*y+d*p+l*x-u*g,e[t+1]=l*y+d*g+u*p-a*x,e[t+2]=u*y+d*x+a*g-l*p,e[t+3]=d*y-a*p-l*g-u*x,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,r){return this._x=e,this._y=t,this._z=n,this._w=r,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,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,u=a(n/2),d=a(r/2),p=a(s/2),g=l(n/2),x=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=g*d*p+u*x*y,this._y=u*x*p-g*d*y,this._z=u*d*y+g*x*p,this._w=u*d*p-g*x*y;break;case"YXZ":this._x=g*d*p+u*x*y,this._y=u*x*p-g*d*y,this._z=u*d*y-g*x*p,this._w=u*d*p+g*x*y;break;case"ZXY":this._x=g*d*p-u*x*y,this._y=u*x*p+g*d*y,this._z=u*d*y+g*x*p,this._w=u*d*p-g*x*y;break;case"ZYX":this._x=g*d*p-u*x*y,this._y=u*x*p+g*d*y,this._z=u*d*y-g*x*p,this._w=u*d*p+g*x*y;break;case"YZX":this._x=g*d*p+u*x*y,this._y=u*x*p+g*d*y,this._z=u*d*y-g*x*p,this._w=u*d*p-g*x*y;break;case"XZY":this._x=g*d*p-u*x*y,this._y=u*x*p-g*d*y,this._z=u*d*y+g*x*p,this._w=u*d*p+g*x*y;break;default:Oe("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],u=t[2],d=t[6],p=t[10],g=n+a+p;if(g>0){const x=.5/Math.sqrt(g+1);this._w=.25/x,this._x=(d-l)*x,this._y=(s-u)*x,this._z=(o-r)*x}else if(n>a&&n>p){const x=2*Math.sqrt(1+n-a-p);this._w=(d-l)/x,this._x=.25*x,this._y=(r+o)/x,this._z=(s+u)/x}else if(a>p){const x=2*Math.sqrt(1+a-n-p);this._w=(s-u)/x,this._x=(r+o)/x,this._y=.25*x,this._z=(l+d)/x}else{const x=2*Math.sqrt(1+p-n-a);this._w=(o-r)/x,this._x=(s+u)/x,this._y=(l+d)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(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(cn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(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,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,u=t._z,d=t._w;return this._x=n*d+o*a+r*u-s*l,this._y=r*d+o*l+s*a-n*u,this._z=s*d+o*u+n*l-r*a,this._w=o*d-n*a-r*l-s*u,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){const u=Math.acos(a),d=Math.sin(u);l=Math.sin(l*u)/d,t=Math.sin(t*u)/d,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class J{constructor(e=0,t=0,n=0){J.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(Rb.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Rb.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,u=2*(o*r-a*n),d=2*(a*t-s*r),p=2*(s*n-o*t);return this.x=t+l*u+o*p-a*d,this.y=n+l*d+a*u-s*p,this.z=r+l*p+s*d-o*u,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,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,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=cn(this.x,e.x,t.x),this.y=cn(this.y,e.y,t.y),this.z=cn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=cn(this.x,e,t),this.y=cn(this.y,e,t),this.z=cn(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(cn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*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 S1.copy(this).projectOnVector(e),this.sub(S1)}reflect(e){return this.sub(S1.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(cn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}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 r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*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(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const S1=new J,Rb=new ll;class pn{constructor(e,t,n,r,s,o,a,l,u){pn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,u)}set(e,t,n,r,s,o,a,l,u){const d=this.elements;return d[0]=e,d[1]=r,d[2]=a,d[3]=t,d[4]=s,d[5]=l,d[6]=n,d[7]=o,d[8]=u,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,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],u=n[1],d=n[4],p=n[7],g=n[2],x=n[5],y=n[8],T=r[0],S=r[3],M=r[6],R=r[1],E=r[4],N=r[7],U=r[2],L=r[5],F=r[8];return s[0]=o*T+a*R+l*U,s[3]=o*S+a*E+l*L,s[6]=o*M+a*N+l*F,s[1]=u*T+d*R+p*U,s[4]=u*S+d*E+p*L,s[7]=u*M+d*N+p*F,s[2]=g*T+x*R+y*U,s[5]=g*S+x*E+y*L,s[8]=g*M+x*N+y*F,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],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],d=e[8];return t*o*d-t*a*u-n*s*d+n*a*l+r*s*u-r*o*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],d=e[8],p=d*o-a*u,g=a*l-d*s,x=u*s-o*l,y=t*p+n*g+r*x;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const T=1/y;return e[0]=p*T,e[1]=(r*u-d*n)*T,e[2]=(a*n-r*o)*T,e[3]=g*T,e[4]=(d*t-r*l)*T,e[5]=(r*s-a*t)*T,e[6]=x*T,e[7]=(n*l-u*t)*T,e[8]=(o*t-n*s)*T,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,r,s,o,a){const l=Math.cos(s),u=Math.sin(s);return this.set(n*l,n*u,-n*(l*o+u*a)+o+e,-r*u,r*l,-r*(-u*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(T1.makeScale(e,t)),this}rotate(e){return this.premultiply(T1.makeRotation(-e)),this}translate(e,t){return this.premultiply(T1.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 r=0;r<9;r++)if(t[r]!==n[r])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 T1=new pn,Cb=new pn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Nb=new pn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function w7(){const i={enabled:!0,workingColorSpace:au,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===_t&&(r.r=nl(r.r),r.g=nl(r.g),r.b=nl(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===_t&&(r.r=Dh(r.r),r.g=Dh(r.g),r.b=Dh(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===_s?AA:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return zn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return zn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[au]:{primaries:e,whitePoint:n,transfer:AA,toXYZ:Cb,fromXYZ:Nb,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Tr},outputColorSpaceConfig:{drawingBufferColorSpace:Tr}},[Tr]:{primaries:e,whitePoint:n,transfer:_t,toXYZ:Cb,fromXYZ:Nb,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Tr}}}),i}const Yt=w7();function nl(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Dh(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Bc;class E7{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Bc===void 0&&(Bc=ud("canvas")),Bc.width=e.width,Bc.height=e.height;const r=Bc.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Bc}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=ud("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=nl(s[o]/255)*255;return n.putImageData(r,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(nl(t[n]/255)*255):t[n]=nl(t[n]);return{data:t,width:e.width,height:e.height}}else return Oe("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let R7=0;class pv{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:R7++}),this.uuid=ga(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}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:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(M1(r[o].image)):s.push(M1(r[o]))}else s=M1(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function M1(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?E7.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Oe("Texture: Unable to serialize Texture."),{})}let C7=0;const w1=new J;class tr extends Ia{constructor(e=tr.DEFAULT_IMAGE,t=tr.DEFAULT_MAPPING,n=xs,r=xs,s=li,o=vs,a=Wi,l=yi,u=tr.DEFAULT_ANISOTROPY,d=_s){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:C7++}),this.uuid=ga(),this.name="",this.source=new pv(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=u,this.format=a,this.internalFormat=null,this.type=l,this.offset=new We(0,0),this.repeat=new We(1,1),this.center=new We(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new pn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(w1).x}get height(){return this.source.getSize(w1).y}get depth(){return this.source.getSize(w1).z}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)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Oe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Oe(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}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.7,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!==ov)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case lc:e.x=e.x-Math.floor(e.x);break;case xs:e.x=e.x<0?0:1;break;case uc: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 lc:e.y=e.y-Math.floor(e.y);break;case xs:e.y=e.y<0?0:1;break;case uc:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}tr.DEFAULT_IMAGE=null;tr.DEFAULT_MAPPING=ov;tr.DEFAULT_ANISOTROPY=1;class rn{constructor(e=0,t=0,n=0,r=1){rn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}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,r){return this.x=e,this.y=t,this.z=n,this.w=r,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,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,u=l[0],d=l[4],p=l[8],g=l[1],x=l[5],y=l[9],T=l[2],S=l[6],M=l[10];if(Math.abs(d-g)<.01&&Math.abs(p-T)<.01&&Math.abs(y-S)<.01){if(Math.abs(d+g)<.1&&Math.abs(p+T)<.1&&Math.abs(y+S)<.1&&Math.abs(u+x+M-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(u+1)/2,N=(x+1)/2,U=(M+1)/2,L=(d+g)/4,F=(p+T)/4,P=(y+S)/4;return E>N&&E>U?E<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(E),r=L/n,s=F/n):N>U?N<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(N),n=L/r,s=P/r):U<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(U),n=F/s,r=P/s),this.set(n,r,s,t),this}let R=Math.sqrt((S-y)*(S-y)+(p-T)*(p-T)+(g-d)*(g-d));return Math.abs(R)<.001&&(R=1),this.x=(S-y)/R,this.y=(p-T)/R,this.z=(g-d)/R,this.w=Math.acos((u+x+M-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=cn(this.x,e.x,t.x),this.y=cn(this.y,e.y,t.y),this.z=cn(this.z,e.z,t.z),this.w=cn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=cn(this.x,e,t),this.y=cn(this.y,e,t),this.z=cn(this.z,e,t),this.w=cn(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(cn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Ba extends Ia{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:li,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new rn(0,0,e,t),this.scissorTest=!1,this.viewport=new rn(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new tr(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:li,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new pv(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class _a extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class mv extends tr{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=jn,this.minFilter=jn,this.wrapR=xs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class N7 extends tr{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=jn,this.minFilter=jn,this.wrapR=xs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class nn{constructor(e,t,n,r,s,o,a,l,u,d,p,g,x,y,T,S){nn.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,r,s,o,a,l,u,d,p,g,x,y,T,S)}set(e,t,n,r,s,o,a,l,u,d,p,g,x,y,T,S){const M=this.elements;return M[0]=e,M[4]=t,M[8]=n,M[12]=r,M[1]=s,M[5]=o,M[9]=a,M[13]=l,M[2]=u,M[6]=d,M[10]=p,M[14]=g,M[3]=x,M[7]=y,M[11]=T,M[15]=S,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 nn().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 this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(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){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,r=1/Fc.setFromMatrixColumn(e,0).length(),s=1/Fc.setFromMatrixColumn(e,1).length(),o=1/Fc.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*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,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),u=Math.sin(r),d=Math.cos(s),p=Math.sin(s);if(e.order==="XYZ"){const g=o*d,x=o*p,y=a*d,T=a*p;t[0]=l*d,t[4]=-l*p,t[8]=u,t[1]=x+y*u,t[5]=g-T*u,t[9]=-a*l,t[2]=T-g*u,t[6]=y+x*u,t[10]=o*l}else if(e.order==="YXZ"){const g=l*d,x=l*p,y=u*d,T=u*p;t[0]=g+T*a,t[4]=y*a-x,t[8]=o*u,t[1]=o*p,t[5]=o*d,t[9]=-a,t[2]=x*a-y,t[6]=T+g*a,t[10]=o*l}else if(e.order==="ZXY"){const g=l*d,x=l*p,y=u*d,T=u*p;t[0]=g-T*a,t[4]=-o*p,t[8]=y+x*a,t[1]=x+y*a,t[5]=o*d,t[9]=T-g*a,t[2]=-o*u,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const g=o*d,x=o*p,y=a*d,T=a*p;t[0]=l*d,t[4]=y*u-x,t[8]=g*u+T,t[1]=l*p,t[5]=T*u+g,t[9]=x*u-y,t[2]=-u,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const g=o*l,x=o*u,y=a*l,T=a*u;t[0]=l*d,t[4]=T-g*p,t[8]=y*p+x,t[1]=p,t[5]=o*d,t[9]=-a*d,t[2]=-u*d,t[6]=x*p+y,t[10]=g-T*p}else if(e.order==="XZY"){const g=o*l,x=o*u,y=a*l,T=a*u;t[0]=l*d,t[4]=-p,t[8]=u*d,t[1]=g*p+T,t[5]=o*d,t[9]=x*p-y,t[2]=y*p-x,t[6]=a*d,t[10]=T*p+g}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(P7,e,D7)}lookAt(e,t,n){const r=this.elements;return Ls.subVectors(e,t),Ls.lengthSq()===0&&(Ls.z=1),Ls.normalize(),Ml.crossVectors(n,Ls),Ml.lengthSq()===0&&(Math.abs(n.z)===1?Ls.x+=1e-4:Ls.z+=1e-4,Ls.normalize(),Ml.crossVectors(n,Ls)),Ml.normalize(),a0.crossVectors(Ls,Ml),r[0]=Ml.x,r[4]=a0.x,r[8]=Ls.x,r[1]=Ml.y,r[5]=a0.y,r[9]=Ls.y,r[2]=Ml.z,r[6]=a0.z,r[10]=Ls.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],u=n[12],d=n[1],p=n[5],g=n[9],x=n[13],y=n[2],T=n[6],S=n[10],M=n[14],R=n[3],E=n[7],N=n[11],U=n[15],L=r[0],F=r[4],P=r[8],I=r[12],$=r[1],k=r[5],W=r[9],j=r[13],Y=r[2],z=r[6],Q=r[10],ee=r[14],fe=r[3],le=r[7],Me=r[11],Ce=r[15];return s[0]=o*L+a*$+l*Y+u*fe,s[4]=o*F+a*k+l*z+u*le,s[8]=o*P+a*W+l*Q+u*Me,s[12]=o*I+a*j+l*ee+u*Ce,s[1]=d*L+p*$+g*Y+x*fe,s[5]=d*F+p*k+g*z+x*le,s[9]=d*P+p*W+g*Q+x*Me,s[13]=d*I+p*j+g*ee+x*Ce,s[2]=y*L+T*$+S*Y+M*fe,s[6]=y*F+T*k+S*z+M*le,s[10]=y*P+T*W+S*Q+M*Me,s[14]=y*I+T*j+S*ee+M*Ce,s[3]=R*L+E*$+N*Y+U*fe,s[7]=R*F+E*k+N*z+U*le,s[11]=R*P+E*W+N*Q+U*Me,s[15]=R*I+E*j+N*ee+U*Ce,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],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],u=e[13],d=e[2],p=e[6],g=e[10],x=e[14],y=e[3],T=e[7],S=e[11],M=e[15],R=l*x-u*g,E=a
vendor: 4,665 bytes, line 5
5*x-u*p,N=a*g-l*p,U=o*x-u*d,L=o*g-l*d,F=o*p-a*d;return t*(T*R-S*E+M*N)-n*(y*R-S*U+M*L)+r*(y*E-T*U+M*F)-s*(y*N-T*L+S*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 r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],d=e[8],p=e[9],g=e[10],x=e[11],y=e[12],T=e[13],S=e[14],M=e[15],R=t*a-n*o,E=t*l-r*o,N=t*u-s*o,U=n*l-r*a,L=n*u-s*a,F=r*u-s*l,P=d*T-p*y,I=d*S-g*y,$=d*M-x*y,k=p*S-g*T,W=p*M-x*T,j=g*M-x*S,Y=R*j-E*W+N*k+U*$-L*I+F*P;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/Y;return e[0]=(a*j-l*W+u*k)*z,e[1]=(r*W-n*j-s*k)*z,e[2]=(T*F-S*L+M*U)*z,e[3]=(g*L-p*F-x*U)*z,e[4]=(l*$-o*j-u*I)*z,e[5]=(t*j-r*$+s*I)*z,e[6]=(S*N-y*F-M*E)*z,e[7]=(d*F-g*N+x*E)*z,e[8]=(o*W-a*$+u*P)*z,e[9]=(n*$-t*W-s*P)*z,e[10]=(y*L-T*N+M*R)*z,e[11]=(p*N-d*L-x*R)*z,e[12]=(a*I-o*k-l*P)*z,e[13]=(t*k-n*I+r*P)*z,e[14]=(T*E-y*U-S*R)*z,e[15]=(d*U-p*E+g*R)*z,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}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),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,u=s*o,d=s*a;return this.set(u*o+n,u*a-r*l,u*l+r*a,0,u*a+r*l,d*a+n,d*l-r*o,0,u*l-r*a,d*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,u=s+s,d=o+o,p=a+a,g=s*u,x=s*d,y=s*p,T=o*d,S=o*p,M=a*p,R=l*u,E=l*d,N=l*p,U=n.x,L=n.y,F=n.z;return r[0]=(1-(T+M))*U,r[1]=(x+N)*U,r[2]=(y-E)*U,r[3]=0,r[4]=(x-N)*L,r[5]=(1-(g+M))*L,r[6]=(S+R)*L,r[7]=0,r[8]=(y+E)*F,r[9]=(S-R)*F,r[10]=(1-(g+T))*F,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return n.set(1,1,1),t.identity(),this;let o=Fc.set(r[0],r[1],r[2]).length();const a=Fc.set(r[4],r[5],r[6]).length(),l=Fc.set(r[8],r[9],r[10]).length();s<0&&(o=-o),xo.copy(this);const u=1/o,d=1/a,p=1/l;return xo.elements[0]*=u,xo.elements[1]*=u,xo.elements[2]*=u,xo.elements[4]*=d,xo.elements[5]*=d,xo.elements[6]*=d,xo.elements[8]*=p,xo.elements[9]*=p,xo.elements[10]*=p,t.setFromRotationMatrix(xo),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=us,l=!1){const u=this.elements,d=2*s/(t-e),p=2*s/(n-r),g=(t+e)/(t-e),x=(n+r)/(n-r);let y,T;if(l)y=s/(o-s),T=o*s/(o-s);else if(a===us)y=-(o+s)/(o-s),T=-2*o*s/(o-s);else if(a===co)y=-o/(o-s),T=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return u[0]=d,u[4]=0,u[8]=g,u[12]=0,u[1]=0,u[5]=p,u[9]=x,u[13]=0,u[2]=0,u[6]=0,u[10]=y,u[14]=T,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=us,l=!1){const u=this.elements,d=2/(t-e),p=2/(n-r),g=-(t+e)/(t-e),x=-(n+r)/(n-r);let y,T;if(l)y=1/(o-s),T=o/(o-s);else if(a===us)y=-2/(o-s),T=-(o+s)/(o-s);else if(a===co)y=-1/(o-s),T=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return u[0]=d,u[4]=0,u[8]=0,u[12]=g,u[1]=0,u[5]=p,u[9]=0,u[13]=x,u[2]=0,u[6]=0,u[10]=y,u[14]=T,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])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 Fc=new J,xo=new nn,P7=new J(0,0,0),D7=new J(1,1,1),Ml=new J,a0=new J,Ls=new J,Pb=new nn,Db=new ll;class Nr{constructor(e=0,t=0,n=0,r=Nr.DEFAULT_ORDER){this.isEuler
vendor: 24,546 bytes, line 5
5=!0,this._x=e,this._y=t,this._z=n,this._order=r}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,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,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 r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],u=r[5],d=r[9],p=r[2],g=r[6],x=r[10];switch(t){case"XYZ":this._y=Math.asin(cn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(g,u),this._z=0);break;case"YXZ":this._x=Math.asin(-cn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-p,s),this._z=0);break;case"ZXY":this._x=Math.asin(cn(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-p,x),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-cn(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(g,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin(cn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,u),this._y=Math.atan2(-p,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-cn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(g,u),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,x),this._y=0);break;default:Oe("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Pb.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Pb,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Db.setFromEuler(this),this.setFromQuaternion(Db,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}}Nr.DEFAULT_ORDER="XYZ";class gv{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 L7=0;const Lb=new J,Uc=new ll,Ga=new nn,l0=new J,ZA=new J,I7=new J,B7=new ll,Ib=new J(1,0,0),Bb=new J(0,1,0),Fb=new J(0,0,1),Ub={type:"added"},F7={type:"removed"},Oc={type:"childadded",child:null},E1={type:"childremoved",child:null};class Ei extends Ia{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:L7++}),this.uuid=ga(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ei.DEFAULT_UP.clone();const e=new J,t=new Nr,n=new ll,r=new J(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),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:r},modelViewMatrix:{value:new nn},normalMatrix:{value:new pn}}),this.matrix=new nn,this.matrixWorld=new nn,this.matrixAutoUpdate=Ei.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ei.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new gv,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}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 Uc.setFromAxisAngle(e,t),this.quaternion.multiply(Uc),this}rotateOnWorldAxis(e,t){return Uc.setFromAxisAngle(e,t),this.quaternion.premultiply(Uc),this}rotateX(e){return this.rotateOnAxis(Ib,e)}rotateY(e){return this.rotateOnAxis(Bb,e)}rotateZ(e){return this.rotateOnAxis(Fb,e)}translateOnAxis(e,t){return Lb.copy(e).applyQuaternion(this.quaternion),this.position.add(Lb.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ib,e)}translateY(e){return this.translateOnAxis(Bb,e)}translateZ(e){return this.translateOnAxis(Fb,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ga.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?l0.copy(e):l0.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),ZA.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ga.lookAt(ZA,l0,this.up):Ga.lookAt(l0,ZA,this.up),this.quaternion.setFromRotationMatrix(Ga),r&&(Ga.extractRotation(r.matrixWorld),Uc.setFromRotationMatrix(Ga),this.quaternion.premultiply(Uc.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ke("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ub),Oc.child=e,this.dispatchEvent(Oc),Oc.child=null):ke("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(F7),E1.child=e,this.dispatchEvent(E1),E1.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ga.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ga.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ga),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ub),Oc.child=e,this.dispatchEvent(Oc),Oc.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;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 r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ZA,e,I7),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ZA,B7,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,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;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);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let u=0,d=l.length;u<d;u++){const p=l[u];s(e.shapes,p)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,u=this.material.length;l<u;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),u=o(e.textures),d=o(e.images),p=o(e.shapes),g=o(e.skeletons),x=o(e.animations),y=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),u.length>0&&(n.textures=u),d.length>0&&(n.images=d),p.length>0&&(n.shapes=p),g.length>0&&(n.skeletons=g),x.length>0&&(n.animations=x),y.length>0&&(n.nodes=y)}return n.object=r,n;function o(a){const l=[];for(const u in a){const d=a[u];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),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.static=e.static,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 r=e.children[n];this.add(r.clone())}return this}}Ei.DEFAULT_UP=new J(0,1,0);Ei.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ei.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let ys=class extends Ei{constructor(){super(),this.isGroup=!0,this.type="Group"}};const U7={type:"move"};class kp{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ys,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 ys,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new J,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new J),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ys,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new J,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new J),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 r=null,s=null,o=null;const a=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(const T of e.hand.values()){const S=t.getJointPose(T,n),M=this._getHandJoint(u,T);S!==null&&(M.matrix.fromArray(S.transform.matrix),M.matrix.decompose(M.position,M.rotation,M.scale),M.matrixWorldNeedsUpdate=!0,M.jointRadius=S.radius),M.visible=S!==null}const d=u.joints["index-finger-tip"],p=u.joints["thumb-tip"],g=d.position.distanceTo(p.position),x=.02,y=.005;u.inputState.pinching&&g>x+y?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&g<=x-y&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(U7)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ys;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const rE={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},wl={h:0,s:0,l:0},u0={h:0,s:0,l:0};function R1(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let It=class{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 r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Tr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Yt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Yt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Yt.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Yt.workingColorSpace){if(e=dv(e,1),t=cn(t,0,1),n=cn(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=R1(o,s,e+1/3),this.g=R1(o,s,e),this.b=R1(o,s,e-1/3)}return Yt.colorSpaceToWorking(this,r),this}setStyle(e,t=Tr){function n(s){s!==void 0&&parseFloat(s)<1&&Oe("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Oe("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);Oe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Tr){const n=rE[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Oe("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=nl(e.r),this.g=nl(e.g),this.b=nl(e.b),this}copyLinearToSRGB(e){return this.r=Dh(e.r),this.g=Dh(e.g),this.b=Dh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Tr){return Yt.workingToColorSpace(Br.copy(this),e),Math.round(cn(Br.r*255,0,255))*65536+Math.round(cn(Br.g*255,0,255))*256+Math.round(cn(Br.b*255,0,255))}getHexString(e=Tr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Yt.workingColorSpace){Yt.workingToColorSpace(Br.copy(this),t);const n=Br.r,r=Br.g,s=Br.b,o=Math.max(n,r,s),a=Math.min(n,r,s);let l,u;const d=(a+o)/2;if(a===o)l=0,u=0;else{const p=o-a;switch(u=d<=.5?p/(o+a):p/(2-o-a),o){case n:l=(r-s)/p+(r<s?6:0);break;case r:l=(s-n)/p+2;break;case s:l=(n-r)/p+4;break}l/=6}return e.h=l,e.s=u,e.l=d,e}getRGB(e,t=Yt.workingColorSpace){return Yt.workingToColorSpace(Br.copy(this),t),e.r=Br.r,e.g=Br.g,e.b=Br.b,e}getStyle(e=Tr){Yt.workingToColorSpace(Br.copy(this),e);const t=Br.r,n=Br.g,r=Br.b;return e!==Tr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(wl),this.setHSL(wl.h+e,wl.s+t,wl.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: 4,457 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(wl),e.getHSL(u0);const n=Of(wl.h,u0.h,t),r=Of(wl.s,u0.s,t),s=Of(wl.l,u0.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,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 Br=new It;It.NAMES=rE;class _v extends Ei{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Nr,this.environmentIntensity=1,this.environmentRotation=new Nr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const vo=new J,Va=new J,C1=new J,qa=new J,kc=new J,Gc=new J,Ob=new J,N1=new J,P1=new J,D1=new J,L1=new rn,I1=new rn,B1=new rn;class Co{constructor(e=new J,t=new J,n=new J){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),vo.subVectors(e,t),r.cross(vo);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){vo.subVectors(r,t),Va.subVectors(n,t),C1.subVectors(e,t);const o=vo.dot(vo),a=vo.dot(Va),l=vo.dot(C1),u=Va.dot(Va),d=Va.dot(C1),p=o*u-a*a;if(p===0)return s.set(0,0,0),null;const g=1/p,x=(u*l-a*d)*g,y=(o*d-a*l)*g;return s.set(1-x-y,y,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,qa)===null?!1:qa.x>=0&&qa.y>=0&&qa.x+qa.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,qa)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,qa.x),l.addScaledVector(o,qa.y),l.addScaledVector(a,qa.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return L1.setScalar(0),I1.setScalar(0),B1.setScalar(0),L1.fromBufferAttribute(e,t),I1.fromBufferAttribute(e,n),B1.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(L1,s.x),o.addScaledVector(I1,s.y),o.addScaledVector(B1,s.z),o}static isFrontFacing(e,t,n,r){return vo.subVectors(n,t),Va.subVectors(e,t),vo.cross(Va).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),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 vo.subVectors(this.c,this.b),Va.subVectors(this.a,this.b),vo.cross(Va).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Co.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Co.getBarycoord(e,this.a,this.b,this.c,t)}
vendor: 10,603 bytes, line 5
5getInterpolation(e,t,n,r,s){return Co.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Co.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Co.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let o,a;kc.subVectors(r,n),Gc.subVectors(s,n),N1.subVectors(e,n);const l=kc.dot(N1),u=Gc.dot(N1);if(l<=0&&u<=0)return t.copy(n);P1.subVectors(e,r);const d=kc.dot(P1),p=Gc.dot(P1);if(d>=0&&p<=d)return t.copy(r);const g=l*p-d*u;if(g<=0&&l>=0&&d<=0)return o=l/(l-d),t.copy(n).addScaledVector(kc,o);D1.subVectors(e,s);const x=kc.dot(D1),y=Gc.dot(D1);if(y>=0&&x<=y)return t.copy(s);const T=x*u-l*y;if(T<=0&&u>=0&&y<=0)return a=u/(u-y),t.copy(n).addScaledVector(Gc,a);const S=d*y-x*p;if(S<=0&&p-d>=0&&x-y>=0)return Ob.subVectors(s,r),a=(p-d)/(p-d+(x-y)),t.copy(r).addScaledVector(Ob,a);const M=1/(S+T+g);return o=T*M,a=g*M,t.copy(n).addScaledVector(kc,o).addScaledVector(Gc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class du{constructor(e=new J(1/0,1/0,1/0),t=new J(-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(yo.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(yo.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=yo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,yo):yo.fromBufferAttribute(s,o),yo.applyMatrix4(e.matrixWorld),this.expandByPoint(yo);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),c0.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),c0.copy(n.boundingBox)),c0.applyMatrix4(e.matrixWorld),this.union(c0)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,yo),yo.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(JA),h0.subVectors(this.max,JA),Vc.subVectors(e.a,JA),qc.subVectors(e.b,JA),zc.subVectors(e.c,JA),El.subVectors(qc,Vc),Rl.subVectors(zc,qc),Eu.subVectors(Vc,zc);let t=[0,-El.z,El.y,0,-Rl.z,Rl.y,0,-Eu.z,Eu.y,El.z,0,-El.x,Rl.z,0,-Rl.x,Eu.z,0,-Eu.x,-El.y,El.x,0,-Rl.y,Rl.x,0,-Eu.y,Eu.x,0];return!F1(t,Vc,qc,zc,h0)||(t=[1,0,0,0,1,0,0,0,1],!F1(t,Vc,qc,zc,h0))?!1:(A0.crossVectors(El,Rl),t=[A0.x,A0.y,A0.z],F1(t,Vc,qc,zc,h0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,yo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(yo).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:(za[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),za[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),za[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),za[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),za[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),za[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),za[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),za[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(za),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const za=[new J,new J,new J,new J,new J,new J,new J,new J],yo=new J,c0=new du,Vc=new J,qc=new J,zc=new J,El=new J,Rl=new J,Eu=new J,JA=new J,h0=new J,A0=new J,Ru=new J;function F1(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){Ru.fromArray(i,s);const a=r.x*Math.abs(Ru.x)+r.y*Math.abs(Ru.y)+r.z*Math.abs(Ru.z),l=e.dot(Ru),u=t.dot(Ru),d=n.dot(Ru);if(Math.max(-Math.max(l,u,d),Math.min(l,u,d))>a)return!1}return!0}const Ya=O7();function O7(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const u=l-127;u<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):u<-14?(n[l]=1024>>-u-14,n[l|256]=1024>>-u-14|32768,r[l]=-u-1,r[l|256]=-u-1):u<=15?(n[l]=u+15<<10,n[l|256]=u+15<<10|32768,r[l]=13,r[l|256]=13):u<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let u=l<<13,d=0;for(;!(u&8388608);)u<<=1,d-=8388608;u&=-8388609,d+=947912704,s[l]=u|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Is(i){Math.abs(i)>65504&&Oe("DataUtils.toHalfFloat(): Value out of range."),i=cn(i,-65504,65504),Ya.floatView[0]=i;const e=Ya.uint32View[0],t=e>>23&511;return Ya.baseTable[t]+((e&8388607)>>Ya.shiftTable[t])}function f0(i){const e=i>>10;return Ya.uint32View[0]=Ya.mantissaTable[Ya.offsetTable[e]+(i&1023)]+Ya.exponentTable[e],Ya.floatView[0]}const Ji=new J,d0=new We;let k7=0;class Di{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:k7++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=fA,this.updateRanges=[],this.gpuType=zi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];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++)d0.fromBufferAttribute(this,t),d0.applyMatrix3(e),this.setXY(t,d0.x,d0.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ji.fromBufferAttribute(this,t),Ji.applyMatrix3(e),this.setXYZ(t,Ji.x,Ji.y,Ji.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ji.fromBufferAttribute(this,t),Ji.applyMatrix4(e),this.setXYZ(t,Ji.x,Ji.y,Ji.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ji.fromBufferAttribute(this,t),Ji.applyNormalMatrix(e),this.setXYZ(t,Ji.x,Ji.y,Ji.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ji.fromBufferAttribute(this,t),Ji.transformDirection(e),this.setXYZ(t,Ji.x,Ji.y,Ji.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=ss(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=bn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ss(t,this.array)),t}setX(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ss(t,this.array)),t}setY(e,t){return this.normalized&&(t=bn(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=ss(t,this.array)),t}setZ(e,t){return this.normalized&&(t=bn(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=ss(t,this.array)),t}setW(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),r=bn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}
vendor: 5,288 bytes, line 5
5setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),r=bn(r,this.array),s=bn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==fA&&(e.usage=this.usage),e}}class xv extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class vv extends Di{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class sE extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=f0(this.array[e*this.itemSize]);return this.normalized&&(t=ss(t,this.array)),t}setX(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize]=Is(t),this}getY(e){let t=f0(this.array[e*this.itemSize+1]);return this.normalized&&(t=ss(t,this.array)),t}setY(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize+1]=Is(t),this}getZ(e){let t=f0(this.array[e*this.itemSize+2]);return this.normalized&&(t=ss(t,this.array)),t}setZ(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize+2]=Is(t),this}getW(e){let t=f0(this.array[e*this.itemSize+3]);return this.normalized&&(t=ss(t,this.array)),t}setW(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize+3]=Is(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array)),this.array[e+0]=Is(t),this.array[e+1]=Is(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),r=bn(r,this.array)),this.array[e+0]=Is(t),this.array[e+1]=Is(n),this.array[e+2]=Is(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),r=bn(r,this.array),s=bn(s,this.array)),this.array[e+0]=Is(t),this.array[e+1]=Is(n),this.array[e+2]=Is(r),this.array[e+3]=Is(s),this}}class Fn extends Di{constructor(e,t,n){super(new Float32Array(e),t,n)}}const G7=new du,ef=new J,U1=new J;class fl{constructor(e=new J,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):G7.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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;ef.subVectors(e,this.center);const t=ef.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(ef,r/n),this.radius+=r}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):(U1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ef.copy(e.center).add(U1)),this.expandByPoint(ef.copy(e.center).sub(U1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let V7=0;const Js=new nn,O1=new Ei,Hc=new J,Bs=new du,tf=new du,hr=new J;class Wn extends Ia{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:V7++}),this.uuid=ga(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,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(l7(e)?vv:xv)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}
vendor: 16,354 bytes, line 5
5addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new pn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Js.makeRotationFromQuaternion(e),this.applyMatrix4(Js),this}rotateX(e){return Js.makeRotationX(e),this.applyMatrix4(Js),this}rotateY(e){return Js.makeRotationY(e),this.applyMatrix4(Js),this}rotateZ(e){return Js.makeRotationZ(e),this.applyMatrix4(Js),this}translate(e,t,n){return Js.makeTranslation(e,t,n),this.applyMatrix4(Js),this}scale(e,t,n){return Js.makeScale(e,t,n),this.applyMatrix4(Js),this}lookAt(e){return O1.lookAt(e),O1.updateMatrix(),this.applyMatrix4(O1.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Hc).negate(),this.translate(Hc.x,Hc.y,Hc.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Fn(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Oe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new du);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ke("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new J(-1/0,-1/0,-1/0),new J(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Bs.setFromBufferAttribute(s),this.morphTargetsRelative?(hr.addVectors(this.boundingBox.min,Bs.min),this.boundingBox.expandByPoint(hr),hr.addVectors(this.boundingBox.max,Bs.max),this.boundingBox.expandByPoint(hr)):(this.boundingBox.expandByPoint(Bs.min),this.boundingBox.expandByPoint(Bs.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ke('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 fl);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ke("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new J,1/0);return}if(e){const n=this.boundingSphere.center;if(Bs.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];tf.setFromBufferAttribute(a),this.morphTargetsRelative?(hr.addVectors(Bs.min,tf.min),Bs.expandByPoint(hr),hr.addVectors(Bs.max,tf.max),Bs.expandByPoint(hr)):(Bs.expandByPoint(tf.min),Bs.expandByPoint(tf.max))}Bs.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)hr.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(hr));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let u=0,d=a.count;u<d;u++)hr.fromBufferAttribute(a,u),l&&(Hc.fromBufferAttribute(e,u),hr.add(Hc)),r=Math.max(r,n.distanceToSquared(hr))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ke('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){ke("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Di(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let P=0;P<n.count;P++)a[P]=new J,l[P]=new J;const u=new J,d=new J,p=new J,g=new We,x=new We,y=new We,T=new J,S=new J;function M(P,I,$){u.fromBufferAttribute(n,P),d.fromBufferAttribute(n,I),p.fromBufferAttribute(n,$),g.fromBufferAttribute(s,P),x.fromBufferAttribute(s,I),y.fromBufferAttribute(s,$),d.sub(u),p.sub(u),x.sub(g),y.sub(g);const k=1/(x.x*y.y-y.x*x.y);isFinite(k)&&(T.copy(d).multiplyScalar(y.y).addScaledVector(p,-x.y).multiplyScalar(k),S.copy(p).multiplyScalar(x.x).addScaledVector(d,-y.x).multiplyScalar(k),a[P].add(T),a[I].add(T),a[$].add(T),l[P].add(S),l[I].add(S),l[$].add(S))}let R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let P=0,I=R.length;P<I;++P){const $=R[P],k=$.start,W=$.count;for(let j=k,Y=k+W;j<Y;j+=3)M(e.getX(j+0),e.getX(j+1),e.getX(j+2))}const E=new J,N=new J,U=new J,L=new J;function F(P){U.fromBufferAttribute(r,P),L.copy(U);const I=a[P];E.copy(I),E.sub(U.multiplyScalar(U.dot(I))).normalize(),N.crossVectors(L,I);const k=N.dot(l[P])<0?-1:1;o.setXYZW(P,E.x,E.y,E.z,k)}for(let P=0,I=R.length;P<I;++P){const $=R[P],k=$.start,W=$.count;for(let j=k,Y=k+W;j<Y;j+=3)F(e.getX(j+0)),F(e.getX(j+1)),F(e.getX(j+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 Di(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let g=0,x=n.count;g<x;g++)n.setXYZ(g,0,0,0);const r=new J,s=new J,o=new J,a=new J,l=new J,u=new J,d=new J,p=new J;if(e)for(let g=0,x=e.count;g<x;g+=3){const y=e.getX(g+0),T=e.getX(g+1),S=e.getX(g+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,T),o.fromBufferAttribute(t,S),d.subVectors(o,s),p.subVectors(r,s),d.cross(p),a.fromBufferAttribute(n,y),l.fromBufferAttribute(n,T),u.fromBufferAttribute(n,S),a.add(d),l.add(d),u.add(d),n.setXYZ(y,a.x,a.y,a.z),n.setXYZ(T,l.x,l.y,l.z),n.setXYZ(S,u.x,u.y,u.z)}else for(let g=0,x=t.count;g<x;g+=3)r.fromBufferAttribute(t,g+0),s.fromBufferAttribute(t,g+1),o.fromBufferAttribute(t,g+2),d.subVectors(o,s),p.subVectors(r,s),d.cross(p),n.setXYZ(g+0,d.x,d.y,d.z),n.setXYZ(g+1,d.x,d.y,d.z),n.setXYZ(g+2,d.x,d.y,d.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)hr.fromBufferAttribute(e,t),hr.normalize(),e.setXYZ(t,hr.x,hr.y,hr.z)}toNonIndexed(){function e(a,l){const u=a.array,d=a.itemSize,p=a.normalized,g=new u.constructor(l.length*d);let x=0,y=0;for(let T=0,S=l.length;T<S;T++){a.isInterleavedBufferAttribute?x=l[T]*a.data.stride+a.offset:x=l[T]*d;for(let M=0;M<d;M++)g[y++]=u[x++]}return new Di(g,d,p)}if(this.index===null)return Oe("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Wn,n=this.index.array,r=this.attributes;for(const a in r){const l=r[a],u=e(l,n);t.setAttribute(a,u)}const s=this.morphAttributes;for(const a in s){const l=[],u=s[a];for(let d=0,p=u.length;d<p;d++){const g=u[d],x=e(g,n);l.push(x)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const u=o[a];t.addGroup(u.start,u.count,u.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const u=n[l];e.data.attributes[l]=u.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const u=this.morphAttributes[l],d=[];for(let p=0,g=u.length;p<g;p++){const x=u[p];d.push(x.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,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=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const u in r){const d=r[u];this.setAttribute(u,d.clone(t))}const s=e.morphAttributes;for(const u in s){const d=[],p=s[u];for(let g=0,x=p.length;g<x;g++)d.push(p[g].clone(t));this.morphAttributes[u]=d}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let u=0,d=o.length;u<d;u++){const p=o[u];this.addGroup(p.start,p.count,p.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class yv{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=fA,this.updateRanges=[],this.version=0,this.uuid=ga()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];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=ga()),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=ga()),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 Qr=new J;class da{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}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++)Qr.fromBufferAttribute(this,t),Qr.applyMatrix4(e),this.setXYZ(t,Qr.x,Qr.y,Qr.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Qr.fromBufferAttribute(this,t),Qr.applyNormalMatrix(e),this.setXYZ(t,Qr.x,Qr.y,Qr.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Qr.fromBufferAttribute(this,t),Qr.transformDirection(e),this.setXYZ(t,Qr.x,Qr.y,Qr.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=ss(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=bn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=bn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=bn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=bn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=bn(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=ss(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ss(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ss(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ss(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),r=bn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),r=bn(r,this.array),s=bn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){cd("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Di(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 da(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){cd("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let q7=0;class Hr extends Ia{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:q7++}),this.uuid=ga(),this.name="",this.type="Material",this.blending=mr,this.side=cs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Gh,this.blendDst=Vh,this.blendEquation=Mr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new It(0,0,0),this.blendAlpha=0,this.depthFunc=ou,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=f_,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Vu,this.stencilZFail=Vu,this.stencilZPass=Vu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Oe(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Oe(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 17,492 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==mr&&(n.blending=this.blending),this.side!==cs&&(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!==Gh&&(n.blendSrc=this.blendSrc),this.blendDst!==Vh&&(n.blendDst=this.blendDst),this.blendEquation!==Mr&&(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!==ou&&(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!==f_&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Vu&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Vu&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Vu&&(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.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),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 r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,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 z7 extends Hr{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new It(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}}const Ha=new J,k1=new J,p0=new J,Cl=new J,G1=new J,m0=new J,V1=new J;class Bd{constructor(e=new J,t=new J(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,Ha)),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=Ha.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ha.copy(this.origin).addScaledVector(this.direction,t),Ha.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){k1.copy(e).add(t).multiplyScalar(.5),p0.copy(t).sub(e).normalize(),Cl.copy(this.origin).sub(k1);const s=e.distanceTo(t)*.5,o=-this.direction.dot(p0),a=Cl.dot(this.direction),l=-Cl.dot(p0),u=Cl.lengthSq(),d=Math.abs(1-o*o);let p,g,x,y;if(d>0)if(p=o*l-a,g=o*a-l,y=s*d,p>=0)if(g>=-y)if(g<=y){const T=1/d;p*=T,g*=T,x=p*(p+o*g+2*a)+g*(o*p+g+2*l)+u}else g=s,p=Math.max(0,-(o*g+a)),x=-p*p+g*(g+2*l)+u;else g=-s,p=Math.max(0,-(o*g+a)),x=-p*p+g*(g+2*l)+u;else g<=-y?(p=Math.max(0,-(-o*s+a)),g=p>0?-s:Math.min(Math.max(-s,-l),s),x=-p*p+g*(g+2*l)+u):g<=y?(p=0,g=Math.min(Math.max(-s,-l),s),x=g*(g+2*l)+u):(p=Math.max(0,-(o*s+a)),g=p>0?s:Math.min(Math.max(-s,-l),s),x=-p*p+g*(g+2*l)+u);else g=o>0?-s:s,p=Math.max(0,-(o*g+a)),x=-p*p+g*(g+2*l)+u;return n&&n.copy(this.origin).addScaledVector(this.direction,p),r&&r.copy(k1).addScaledVector(p0,g),x}intersectSphere(e,t){Ha.subVectors(e.center,this.origin);const n=Ha.dot(this.direction),r=Ha.dot(Ha)-n*n,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1: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,r,s,o,a,l;const u=1/this.direction.x,d=1/this.direction.y,p=1/this.direction.z,g=this.origin;return u>=0?(n=(e.min.x-g.x)*u,r=(e.max.x-g.x)*u):(n=(e.max.x-g.x)*u,r=(e.min.x-g.x)*u),d>=0?(s=(e.min.y-g.y)*d,o=(e.max.y-g.y)*d):(s=(e.max.y-g.y)*d,o=(e.min.y-g.y)*d),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),p>=0?(a=(e.min.z-g.z)*p,l=(e.max.z-g.z)*p):(a=(e.max.z-g.z)*p,l=(e.min.z-g.z)*p),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Ha)!==null}intersectTriangle(e,t,n,r,s){G1.subVectors(t,e),m0.subVectors(n,e),V1.crossVectors(G1,m0);let o=this.direction.dot(V1),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Cl.subVectors(this.origin,e);const l=a*this.direction.dot(m0.crossVectors(Cl,m0));if(l<0)return null;const u=a*this.direction.dot(G1.cross(Cl));if(u<0||l+u>o)return null;const d=-a*Cl.dot(V1);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class qs extends Hr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new It(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Nr,this.combine=Dd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const kb=new nn,Cu=new Bd,g0=new fl,Gb=new J,_0=new J,x0=new J,v0=new J,q1=new J,y0=new J,Vb=new J,b0=new J;class Qn extends Ei{constructor(e=new Wn,t=new qs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,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 r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){y0.set(0,0,0);for(let l=0,u=s.length;l<u;l++){const d=a[l],p=s[l];d!==0&&(q1.fromBufferAttribute(p,e),o?y0.addScaledVector(q1,d):y0.addScaledVector(q1.sub(t),d))}t.add(y0)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),g0.copy(n.boundingSphere),g0.applyMatrix4(s),Cu.copy(e.ray).recast(e.near),!(g0.containsPoint(Cu.origin)===!1&&(Cu.intersectSphere(g0,Gb)===null||Cu.origin.distanceToSquared(Gb)>(e.far-e.near)**2))&&(kb.copy(s).invert(),Cu.copy(e.ray).applyMatrix4(kb),!(n.boundingBox!==null&&Cu.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Cu)))}_computeIntersections(e,t,n){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,u=s.attributes.uv,d=s.attributes.uv1,p=s.attributes.normal,g=s.groups,x=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,T=g.length;y<T;y++){const S=g[y],M=o[S.materialIndex],R=Math.max(S.start,x.start),E=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let N=R,U=E;N<U;N+=3){const L=a.getX(N),F=a.getX(N+1),P=a.getX(N+2);r=S0(this,M,e,n,u,d,p,L,F,P),r&&(r.faceIndex=Math.floor(N/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{const y=Math.max(0,x.start),T=Math.min(a.count,x.start+x.count);for(let S=y,M=T;S<M;S+=3){const R=a.getX(S),E=a.getX(S+1),N=a.getX(S+2);
vendor: 1,224 bytes, line 5
5r=S0(this,o,e,n,u,d,p,R,E,N),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,T=g.length;y<T;y++){const S=g[y],M=o[S.materialIndex],R=Math.max(S.start,x.start),E=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let N=R,U=E;N<U;N+=3){const L=N,F=N+1,P=N+2;r=S0(this,M,e,n,u,d,p,L,F,P),r&&(r.faceIndex=Math.floor(N/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{const y=Math.max(0,x.start),T=Math.min(l.count,x.start+x.count);for(let S=y,M=T;S<M;S+=3){const R=S,E=S+1,N=S+2;r=S0(this,o,e,n,u,d,p,R,E,N),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}}function H7(i,e,t,n,r,s,o,a){let l;if(e.side===Xn?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===cs,a),l===null)return null;b0.copy(a),b0.applyMatrix4(i.matrixWorld);const u=t.ray.origin.distanceTo(b0);return u<t.near||u>t.far?null:{distance:u,point:b0.clone(),object:i}}function S0(i,e,t,n,r,s,o,a,l,u){i.getVertexPosition(a,_0),i.getVertexPosition(l,x0),i.getVertexPosition(u,v0);const d=H7(i,e,t,n,_0,x0,v0,Vb);if(d){const p=new J;Co.getBarycoord(Vb,_0,x0,v0,p),r&&(d.uv=Co.getInterpolatedAttribute(r,a,l,u,p,new We)),s&&(d.uv1=Co.getInterpolatedAttribute(s,a,l,u,p,new We)),o&&(
vendor: 14,469 bytes, line 5
5d.normal=Co.getInterpolatedAttribute(o,a,l,u,p,new J),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const g={a,b:l,c:u,normal:new J,materialIndex:0};Co.getNormal(_0,x0,v0,g.normal),d.face=g,d.barycoord=p}return d}class bv extends tr{constructor(e=null,t=1,n=1,r,s,o,a,l,u=jn,d=jn,p,g){super(null,o,a,l,u,d,r,s,p,g),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class nu extends Di{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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 z1=new J,W7=new J,$7=new pn;class oa{constructor(e=new J(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,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=z1.subVectors(n,t).cross(W7.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,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(z1),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||$7.getNormalMatrix(e),r=this.coplanarPoint(z1).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Nu=new fl,j7=new We(.5,.5),T0=new J;class IA{constructor(e=new oa,t=new oa,n=new oa,r=new oa,s=new oa,o=new oa){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),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=us,n=!1){const r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],u=s[3],d=s[4],p=s[5],g=s[6],x=s[7],y=s[8],T=s[9],S=s[10],M=s[11],R=s[12],E=s[13],N=s[14],U=s[15];if(r[0].setComponents(u-o,x-d,M-y,U-R).normalize(),r[1].setComponents(u+o,x+d,M+y,U+R).normalize(),r[2].setComponents(u+a,x+p,M+T,U+E).normalize(),r[3].setComponents(u-a,x-p,M-T,U-E).normalize(),n)r[4].setComponents(l,g,S,N).normalize(),r[5].setComponents(u-l,x-g,M-S,U-N).normalize();else if(r[4].setComponents(u-l,x-g,M-S,U-N).normalize(),t===us)r[5].setComponents(u+l,x+g,M+S,U+N).normalize();else if(t===co)r[5].setComponents(l,g,S,N).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(),Nu.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Nu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Nu)}intersectsSprite(e){Nu.center.set(0,0,0);const t=j7.distanceTo(e.center);return Nu.radius=.7071067811865476+t,Nu.applyMatrix4(e.matrixWorld),this.intersectsSphere(Nu)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(T0.x=r.normal.x>0?e.max.x:e.min.x,T0.y=r.normal.y>0?e.max.y:e.min.y,T0.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(T0)<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)}}const $o=new nn,jo=new IA;class Sv{constructor(){this.coordinateSystem=us}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if($o.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),jo.setFromProjectionMatrix($o,r.coordinateSystem,r.reversedDepth),jo.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if($o.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),jo.setFromProjectionMatrix($o,r.coordinateSystem,r.reversedDepth),jo.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if($o.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),jo.setFromProjectionMatrix($o,r.coordinateSystem,r.reversedDepth),jo.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if($o.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),jo.setFromProjectionMatrix($o,r.coordinateSystem,r.reversedDepth),jo.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const r=t.cameras[n];if($o.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),jo.setFromProjectionMatrix($o,r.coordinateSystem,r.reversedDepth),jo.containsPoint(e))return!0}return!1}clone(){return new Sv}}class BA extends Hr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new It(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 rm=new J,sm=new J,qb=new nn,nf=new Bd,M0=new fl,H1=new J,zb=new J;class ag extends Ei{constructor(e=new Wn,t=new BA){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)rm.fromBufferAttribute(t,r-1),sm.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=rm.distanceTo(sm);e.setAttribute("lineDistance",new Fn(n,1))}else Oe("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),M0.copy(n.boundingSphere),M0.applyMatrix4(r),M0.radius+=s,e.ray.intersectsSphere(M0)===!1)return;qb.copy(r).invert(),nf.copy(e.ray).applyMatrix4(qb);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,u=this.isLineSegments?2:1,d=n.index,g=n.attributes.position;if(d!==null){const x=Math.max(0,o.start),y=Math.min(d.count,o.start+o.count);for(let T=x,S=y-1;T<S;T+=u){const M=d.getX(T),R=d.getX(T+1),E=w0(this,e,nf,l,M,R,T);E&&t.push(E)}if(this.isLineLoop){const T=d.getX(y-1),S=d.getX(x),M=w0(this,e,nf,l,T,S,y-1);M&&t.push(M)}}else{const x=Math.max(0,o.start),y=Math.min(g.count,o.start+o.count);for(let T=x,S=y-1;T<S;T+=u){const M=w0(this,e,nf,l,T,T+1,T);M&&t.push(M)}if(this.isLineLoop){const T=w0(this,e,nf,l,y-1,x,y-1);T&&t.push(T)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function w0(i,e,t,n,r,s,o){const a=i.geometry.attributes.position;if(rm.fromBufferAttribute(a,r),sm.fromBufferAttribute(a,s),t.distanceSqToSegment(rm,sm,H1,zb)>n)return;H1.applyMatrix4(i.matrixWorld);const u=e.ray.origin.distanceTo(H1);if(!(u<e.near||u>e.far))return{distance:u,point:zb.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}const Hb=new J,Wb=new J;class oE extends ag{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 r=0,s=t.count;r<s;r+=2)Hb.fromBufferAttribute(t,r),Wb.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Hb.distanceTo(Wb);e.setAttribute("lineDistance",new Fn(n,1))}else Oe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class hd extends Hr{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new It(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 $b=new nn,d_=new Bd,E0=new fl,R0=new J;class p_ extends Ei{constructor(e=new Wn,t=new hd){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),E0.copy(n.boundingSphere),E0.applyMatrix4(r),E0.radius+=s,e.ray.intersectsSphere(E0)===!1)return;$b.copy(r).invert(),d_.copy(e.ray).applyMatrix4($b);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,u=n.index,p=n.attributes.position;if(u!==null){const g=Math.max(0,o.start),x=Math.min(u.count,o.start+o.count);for(let y=g,T=x;y<T;y++){const S=u.getX(y);R0.fromBufferAttribute(p,S),jb(R0,S,l,r,e,t,this)}}else{const g=Math.max(0,o.start),x=Math.min(p.count,o.start+o.count);for(let y=g,T=x;y<T;y++)R0.fromBufferAttribute(p,y),jb(R0,y,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function jb(i,e,t,n,r,s,o){const a=d_.distanceSqToPoint(i);if(a<t){const l=new J;d_.closestPointToPoint(i,l),l.applyMatrix4(n);const u=r.ray.origin.distanceTo(l);if(u<r.near||u>r.far)return;s.push({distance:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class Tv extends tr{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=jn,this.minFilter=jn,this.generateMipmaps=!1,this.needsUpdate=!0}}class FA extends tr{constructor(e=[],t=Fo,n,r,s,o,a,l,u,d){super(e,t,n,r,s,o,a,l,u,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class qr extends tr{constructor(e,t,n=ii,r,s,o,a=jn,l=jn,u,d=Rr,p=1){if(d!==Rr&&d!==as)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const g={width:e,height:t,depth:p};super(g,r,s,o,a,l,d,n,u),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new pv(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class aE extends qr{constructor(e,t=ii,n=Fo,r,s,o=jn,a=jn,l,u=Rr){const d={width:e,height:e,depth:1},p=[d,d,d,d,d,d];super(e,e,t,n,r,s,o,a,l,u),this.image=p,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class lE extends tr{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class pu extends Wn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],u=[],d=[],p=[];let g=0,x=0;y("z","y","x",-1,-1,n,t,e,o,s,0),y("z","y","x",1,-1,n,t,-e,o,s,1),y("x","z","y",1,1,e,n,t,r,o,2),y("x","z","y",1,-1,e,n,-t,r,o,3),y("x","y","z",1,-1,e,t,n,r,s,4),y("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Fn(u,3)),this.setAttribute("normal",new Fn(d,3)),this.setAttribute("uv",new Fn(p,2));function y(T,S,M,R,E,N,U,L,F,P,I){const $=N/F,k=U/P,W=N/2,j=U/2,Y=L/2,z=F+1,Q=P+1;let ee=0,fe=0;const le=new J;for(let Me=0;Me<Q;Me++){const Ce=Me*k-j;for(let Be=0;Be<z;Be++){const Ye=Be*$-W;le[T]=Ye*R,le[S]=Ce*E,le[M]=Y,u.push(le.x,le.y,le.z),le[T]=0,le[S]=0,le[M]=L>0?1:-1,d.push(le.x,le.y,le.z),p.push(Be/F),p.push(1-Me/P),ee+=1}}for(let Me=0;Me<P;Me++)for(let Ce=0;Ce<F;Ce++){const Be=g+Ce+z*Me,Ye=g+Ce+z*(Me+1),qt=g+(Ce+1)+z*(Me+1),bt=g+(Ce+1)+z*Me;l.push(Be,Ye,bt),l.push(Ye,qt,bt),fe+=6}a.addGroup(x,fe,I),x+=fe,g+=ee}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pu(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class lg extends Wn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radiu
vendor: 10,906 bytes, line 5
5s:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],u=new J,d=new We;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let p=0,g=3;p<=t;p++,g+=3){const x=n+p/t*r;u.x=e*Math.cos(x),u.y=e*Math.sin(x),o.push(u.x,u.y,u.z),a.push(0,0,1),d.x=(o[g]/e+1)/2,d.y=(o[g+1]/e+1)/2,l.push(d.x,d.y)}for(let p=1;p<=t;p++)s.push(p,p+1,0);this.setIndex(s),this.setAttribute("position",new Fn(o,3)),this.setAttribute("normal",new Fn(a,3)),this.setAttribute("uv",new Fn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lg(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ug extends Wn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const u=this;r=Math.floor(r),s=Math.floor(s);const d=[],p=[],g=[],x=[];let y=0;const T=[],S=n/2;let M=0;R(),o===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(d),this.setAttribute("position",new Fn(p,3)),this.setAttribute("normal",new Fn(g,3)),this.setAttribute("uv",new Fn(x,2));function R(){const N=new J,U=new J;let L=0;const F=(t-e)/n;for(let P=0;P<=s;P++){const I=[],$=P/s,k=$*(t-e)+e;for(let W=0;W<=r;W++){const j=W/r,Y=j*l+a,z=Math.sin(Y),Q=Math.cos(Y);U.x=k*z,U.y=-$*n+S,U.z=k*Q,p.push(U.x,U.y,U.z),N.set(z,F,Q).normalize(),g.push(N.x,N.y,N.z),x.push(j,1-$),I.push(y++)}T.push(I)}for(let P=0;P<r;P++)for(let I=0;I<s;I++){const $=T[I][P],k=T[I+1][P],W=T[I+1][P+1],j=T[I][P+1];(e>0||I!==0)&&(d.push($,k,j),L+=3),(t>0||I!==s-1)&&(d.push(k,W,j),L+=3)}u.addGroup(M,L,0),M+=L}function E(N){const U=y,L=new We,F=new J;let P=0;const I=N===!0?e:t,$=N===!0?1:-1;for(let W=1;W<=r;W++)p.push(0,S*$,0),g.push(0,$,0),x.push(.5,.5),y++;const k=y;for(let W=0;W<=r;W++){const Y=W/r*l+a,z=Math.cos(Y),Q=Math.sin(Y);F.x=I*Q,F.y=S*$,F.z=I*z,p.push(F.x,F.y,F.z),g.push(0,$,0),L.x=z*.5+.5,L.y=Q*.5*$+.5,x.push(L.x,L.y),y++}for(let W=0;W<r;W++){const j=U+W,Y=k+W;N===!0?d.push(Y,Y+1,j):d.push(Y+1,Y,j),P+=3}u.addGroup(M,P,N===!0?1:2),M+=P}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ug(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Vo{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Oe("Curve: .getPoint() not implemented.")}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,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,l=s-1,u;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),u=n[r]-o,u<0)a=r+1;else if(u>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);const d=n[r],g=n[r+1]-d,x=(o-d)/g;return(r+x)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new We:new J);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new J,r=[],s=[],o=[],a=new J,l=new nn;for(let x=0;x<=e;x++){const y=x/e;r[x]=this.getTangentAt(y,new J)}s[0]=new J,o[0]=new J;let u=Number.MAX_VALUE;const d=Math.abs(r[0].x),p=Math.abs(r[0].y),g=Math.abs(r[0].z);d<=u&&(u=d,n.set(1,0,0)),p<=u&&(u=p,n.set(0,1,0)),g<=u&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let x=1;x<=e;x++){if(s[x]=s[x-1].clone(),o[x]=o[x-1].clone(),a.crossVectors(r[x-1],r[x]),a.length()>Number.EPSILON){a.normalize();const y=Math.acos(cn(r[x-1].dot(r[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,y))}o[x].crossVectors(r[x],s[x])}if(t===!0){let x=Math.acos(cn(s[0].dot(s[e]),-1,1));x/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],x*y)),o[y].crossVectors(r[y],s[y])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Mv extends Vo{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new We){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),u=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const d=Math.cos(this.aRotation),p=Math.sin(this.aRotation),g=l-this.aX,x=u-this.aY;l=g*d-x*p+this.aX,u=g*p+x*d+this.aY}return n.set(l,u)}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 X7 extends Mv{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function wv(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,u){r(o,a,u*(a-s),u*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,u,d,p){let g=(o-s)/u-(a-s)/(u+d)+(a-o)/d,x=(a-o)/d-(l-o)/(d+p)+(l-a)/p;g*=d,x*=d,r(o,a,g,x)},calc:function(s){const o=s*s,a=o*s;return i+e*s+t*o+n*a}}}const C0=new J,W1=new wv,$1=new wv,j1=new wv;class Q7 extends Vo{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new J){const n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let u,d;this.closed||a>0?u=r[(a-1)%s]:(C0.subVectors(r[0],r[1]).add(r[0]),u=C0);const p=r[a%s],g=r[(a+1)%s];if(this.closed||a+2<s?d=r[(a+2)%s]:(C0.subVectors(r[s-1],r[s-2]).add(r[s-1]),d=C0),this.curveType==="centripetal"||this.curveType==="chordal"){const x=this.curveType==="chordal"?.5:.25;let y=Math.pow(u.distanceToSquared(p),x),T=Math.pow(p.distanceToSquared(g),x),S=Math.pow(g.distanceToSquared(d),x);T<1e-4&&(T=1),y<1e-4&&(y=T),S<1e-4&&(S=T),W1.initNonuniformCatmullRom(u.x,p.x,g.x,d.x,y,T,S),$1.initNonuniformCatmullRom(u.y,p.y,g.y,d.y,y,T,S),j1.initNonuniformCatmullRom(u.z,p.z,g.z,d.z,y,T,S)}else this.curveType==="catmullrom"&&(W1.initCatmullRom(u.x,p.x,g.x,d.x,this.tension),$1.initCatmullRom(u.y,p.y,g.y,d.y,this.tension),j1.initCatmullRom(u.z,p.z,g.z,d.z,this.tension));return n.set(W1.calc(l),$1.calc(l),j1.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.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 r=this.points[t];e.points.push(r.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 r=e.points[t];this.points.push(new J().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Xb(i,e,t,n,r){const s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function Y7(i,e){const t=1-i;return t*t*e}function K7(i,e){return 2*(1-i)*i*e}function Z7(i,e){return i*i*e}function kf(i,e,t,n){return Y7(i,e)+K7(i,t)+Z7(i,n)}function J7(i,e){const t=1-i;return t*t*t*e}function eD(i,e){const t=1-i;return 3*t*t*i*e}function tD(i,e){return 3*(1-i)*i*i*e}function nD(i,e){return i*i*i*e}function Gf(i,e,t,n,r){return J7(i,e)+eD(i,t)+tD(i,n)+nD(i,r)}class uE extends Vo{constructor(e=new We,t=new We,n=new We,r=new We){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new We){const n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Gf(e,r.x,s.x,o.x,a.x),Gf(e,r.y,s.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 cE extends Vo{constructor(e=new J,t=new J,n=new J,r=new J){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new J){const n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Gf(e,r.x,s.x,o.x,a.x),Gf(e,r.y,s.y,o.y,a.y),Gf(e,r.z,s.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 hE extends Vo{constructor(e=new We,t=new We){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new We){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: 8,525 bytes, line 5
5getTangent(e,t=new We){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 iD extends Vo{constructor(e=new J,t=new J){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new J){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 J){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 AE extends Vo{constructor(e=new We,t=new We,n=new We){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new We){const n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(kf(e,r.x,s.x,o.x),kf(e,r.y,s.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 fE extends Vo{constructor(e=new J,t=new J,n=new J){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new J){const n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(kf(e,r.x,s.x,o.x),kf(e,r.y,s.y,o.y),kf(e,r.z,s.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 dE extends Vo{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new We){const n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],u=r[o],d=r[o>r.length-2?r.length-1:o+1],p=r[o>r.length-3?r.length-1:o+2];return n.set(Xb(a,l.x,u.x,d.x,p.x),Xb(a,l.y,u.y,d.y,p.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new We().fromArray(r))}return this}}var om=Object.freeze({__proto__:null,ArcCurve:X7,CatmullRomCurve3:Q7,CubicBezierCurve:uE,CubicBezierCurve3:cE,EllipseCurve:Mv,LineCurve:hE,LineCurve3:iD,QuadraticBezierCurve:AE,QuadraticBezierCurve3:fE,SplineCurve:dE});class rD extends Vo{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 om[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,a=this.curves[s],l=a.getLength(),u=l===0?0:1-o/l;return a.getPointAt(u,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n<r;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 r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let u=0;u<l.length;u++){const d=l[u];n&&n.equals(d)||(t.push(d),n=d)}}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 r=e.curves[t];this.curves.push(r.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 r=this.curves[t];e.curves.push(r.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 r=e.curves[t];this.curves.push(new om[r.type]().fromJSON(r))}return this}}let m_=class extends rD{constructor(e){super(),this.type="Path",this.currentPoint=new We,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 hE(this.currentPoint.clone(),new We(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){const s=new AE(this.currentPoint.clone(),new We(e,t),new We(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){const a=new uE(this.currentPoint.clone(),new We(e,t),new We(n,r),new We(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new dE(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){const u=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+u,t+d,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){const u=new Mv(e,t,n,r,s,o,a,l);if(this.curves.length>0){const p=u.getPoint(0);p.equals(this.currentPoint)||this.lineTo(p.x,p.y)}this.curves.push(u);const d=u.getPoint(1);return this.currentPoint.copy(d),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 Gp extends m_{constructor(e){super(e),this.uuid=ga(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n<r;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 r=e.holes[t];this.holes.push(r.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 r=this.holes[t];e.holes.push(r.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 r=e.holes[t];this.holes.push(new m_().fromJSON(r))}return this}}function sD(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let s=pE(i,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,u;if(n&&(s=cD(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let d=a,p=l;for(let g=t;g<r;g+=t){const x=i[g],y=i[g+1];x<a&&(a=x),y<l&&(l=y),x>d&&(d=x),y>p&&(p=y)}u=Math.max(d-a,p-l),u=u!==0?32767/u:0}return Ad(s,o,t,a,l,u,0),o}function pE(i,e,t,n,r){let s;if(r===yD(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=Qb(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=Qb(o/n|0,i[o],i[o+1],s);return s&&dA(s,s.next)&&(dd(s),s=s.next),s}function fc(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(dA(t,t.next)||Oi(t.prev,t,t.next)===0)){if(dd(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ad(i,e,t,n,r,s,o){if(!i)return;!o&&s&&pD(i,n,r,s);let a=i;for(;i.prev!==i.next;){const l=i.prev,u=i.next;if(s?aD(i,n,r,s):oD(i)){e.push(l.i,i.i,u.i),dd(i),i=u.next,a=u.next;continue}if(i=u,i===a){o?o===1?(i=lD(fc(i),e),Ad(i,e,t,n,r,s,2)):o===2&&uD(i,e,t,n,r,s
vendor: 4,299 bytes, line 5
5):Ad(fc(i),e,t,n,r,s,1);break}}}function oD(i){const e=i.prev,t=i,n=i.next;if(Oi(e,t,n)>=0)return!1;const r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,u=n.y,d=Math.min(r,s,o),p=Math.min(a,l,u),g=Math.max(r,s,o),x=Math.max(a,l,u);let y=n.next;for(;y!==e;){if(y.x>=d&&y.x<=g&&y.y>=p&&y.y<=x&&Ef(r,a,s,l,o,u,y.x,y.y)&&Oi(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function aD(i,e,t,n){const r=i.prev,s=i,o=i.next;if(Oi(r,s,o)>=0)return!1;const a=r.x,l=s.x,u=o.x,d=r.y,p=s.y,g=o.y,x=Math.min(a,l,u),y=Math.min(d,p,g),T=Math.max(a,l,u),S=Math.max(d,p,g),M=g_(x,y,e,t,n),R=g_(T,S,e,t,n);let E=i.prevZ,N=i.nextZ;for(;E&&E.z>=M&&N&&N.z<=R;){if(E.x>=x&&E.x<=T&&E.y>=y&&E.y<=S&&E!==r&&E!==o&&Ef(a,d,l,p,u,g,E.x,E.y)&&Oi(E.prev,E,E.next)>=0||(E=E.prevZ,N.x>=x&&N.x<=T&&N.y>=y&&N.y<=S&&N!==r&&N!==o&&Ef(a,d,l,p,u,g,N.x,N.y)&&Oi(N.prev,N,N.next)>=0))return!1;N=N.nextZ}for(;E&&E.z>=M;){if(E.x>=x&&E.x<=T&&E.y>=y&&E.y<=S&&E!==r&&E!==o&&Ef(a,d,l,p,u,g,E.x,E.y)&&Oi(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;N&&N.z<=R;){if(N.x>=x&&N.x<=T&&N.y>=y&&N.y<=S&&N!==r&&N!==o&&Ef(a,d,l,p,u,g,N.x,N.y)&&Oi(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function lD(i,e){let t=i;do{const n=t.prev,r=t.next.next;!dA(n,r)&&gE(n,t,t.next,r)&&fd(n,r)&&fd(r,n)&&(e.push(n.i,t.i,r.i),dd(t),dd(t.next),t=i=r),t=t.next}while(t!==i);return fc(t)}function uD(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&_D(o,a)){let l=_E(o,a);o=fc(o,o.next),l=fc(l,l.next),Ad(o,e,t,n,r,s,0),Ad(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function cD(i,e,t,n){const r=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,u=pE(i,a,l,n,!1);u===u.next&&(u.steiner=!0),r.push(gD(u))}r.sort(hD);for(let s=0;s<r.length;s++)t=AD(r[s],t);return t}function hD(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function AD(i,e){const t=fD(i,e);if(!t)return e;const n=_E(t,i);return fc(n,n.next),fc(t,t.next)}function fD(i,e){let t=e;const n=i.x,r=i.y;let s=-1/0,o;if(dA(i,t))return t;do{if(dA(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const p=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=n&&p>s&&(s=p,o=t.x<t.next.x?t:t.next,p===n))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,l=o.x,u=o.y;let d=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&mE(r<u?n:s,r,l,u,r<u?s:n,r,t.x,t.y)){const p=Math.abs(r-t.y)/(n-t.x);fd(t,i)&&(p<d||p===d&&(t.x>o.x||t.x===o.x&&dD(o,t)))&&(o=t,d=p)}t=t.next}while(t!==a);return o}function dD(i,e){return Oi(i.prev,i,e.prev)<0&&Oi(e.next,i,i.next)<0}function pD(i,e,t,n){let r=i;do r.z===0&&(r.z=g_(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,mD(r)}function mD(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let u=0;u<t&&(a++,o=o.nextZ,!!o);u++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function g_(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function gD(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function mE(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function Ef(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&mE(i,e,t,n,r,s,o,a)}function _D(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!xD(i,e)&&(fd(i,e)&&fd(e,i)&&vD(i,e)&&(Oi(i.prev,i,e.prev)||Oi(i,e.prev,e))||dA(i,e)&&Oi(i.prev,i,i.next)>0&&Oi(e.prev,e,e.next)>0)}function Oi(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function dA(i,e){return i.x===e.x&&i.y===e.y}function gE(i,e,t,n){const r=P0(Oi(i,e,t)),s=P0(Oi(i,e,n)),o=P0(Oi(t,n,i)),a=P0(Oi(t,n,e));return!!(r!==s&&o!==a||r===0&&N0(i,t,e)||s===0&&N0(i,n,e)||o===0&&N0(t,i,n)||a===0&&N0(t,e,n))}function N0(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function P0(i){return i>0?1:i<0?-1:0}function xD(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&gE(t,t.next,i,e))return!0;t=t.next}
5while(t!==i);return!1}function fd(i,e){return Oi(i.prev,i,i.next)<0?Oi(i,e,i.next)>=0&&Oi(i,i.prev,e)>=0:Oi(i,e,i.prev)<0||Oi(i,i.next,e)<0}function vD(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function _E(i,e){const t=__(i.i,i.x,i.y),n=__(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Qb(i,e,t,n){const r=__(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function dd(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function __(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function yD(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}class bD{static triangulate(e,t,n=2){return sD(e,t,n)}}class $u{static area(e){const t=e.length;let n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return $u.area(e)<0}static triangulateShape(e,t){const n=[],r=[],s=[];Yb(e),Kb(n,e);let o=e.length;t.forEach(Yb);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,Kb(n,t[l]);const a=bD.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function Yb(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function Kb(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class Ev extends Wn{constructor(e=new Gp([new We(.5,.5),new We(-.5,.5),new We(-.5,-.5),new We(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const u=e[a];o(u)}this.setAttribute("position",new Fn(r,3)),this.setAttribute("uv",new Fn(s,2)),this.computeVertexNormals();function o(a){const l=[],u=t.curveSegments!==void 0?t.curveSegments:12,d=t.steps!==void 0?t.steps:1,p=t.depth!==void 0?t.depth:1;let g=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:x-.1,T=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3;const M=t.extrudePath,R=t.UVGenerator!==void 0?t.UVGenerator:SD;let E,N=!1,U,L,F,P;if(M){E=M.getSpacedPoints(d),N=!0,g=!1;const Ue=M.isCatmullRomCurve3?M.closed:!1;U=M.computeFrenetFrames(d,Ue),L=new J,F=new J,P=new J}g||(S=0,x=0,y=0,T=0);const I=a.extractPoints(u);let $=I.shape;const k=I.holes;if(!$u.isClockWise($)){$=$.reverse();for(let Ue=0,Je=k.length;Ue<Je;Ue++){const He=k[Ue];$u.isClockWise(He)&&(k[Ue]=He.reverse())}}function j(Ue){const He=10000000000000001e-36;let ot=Ue[0];for(let se=1;se<=Ue.length;se++){const Kt=se%Ue.length,yt=Ue[Kt],zt=yt.x-ot.x,at=yt.y-ot.y,te=zt*zt+at*at,V=Math.max(Math.abs(yt.x),Math.abs(yt.y),Math.abs(ot.x),Math.abs(ot.y)),de=He*V*V;if(te<=de){Ue.splice(Kt,1),se--;continue}ot=yt}}j($),k.forEach(j);const Y=k.length,z=$;for(let Ue=0;Ue<Y;Ue++){const Je=k[Ue];$=$.concat(Je)}function Q(Ue,Je,He){return Je||ke("ExtrudeGeometry: vec does not exist"),Ue.clone().addScaledVector(Je,He)}const ee=$.length;function fe(Ue,Je,He){let ot,se,Kt;const yt=Ue.x-Je.x,zt=Ue.y-Je.y,at=He.x-Ue.x,te=He.y-Ue.y,V=yt*yt+zt*zt,de=yt*te-zt*at;if(Math.abs(de)>Number.EPSILON){const Pe=Math.sqrt(V),$e=Math.sqrt(at*at+te*te),Le=Je.x-zt/Pe,Nt=Je.y+yt/Pe,ct=He.x-te/$e,Wt=He.y+at/$e,Zt=((ct-Le)*te-(Wt-Nt)*at)/(yt*te-zt*at);ot=Le+yt*Zt-Ue.x,se=Nt+zt*Zt-Ue.y;const nt=ot*ot+se*se;if(nt<=2)return new We(ot,se);Kt=Math.sqrt(nt/2)}else{let Pe=!1;yt>Number.EPSILON?at>Number.EPSILON&&(Pe=!0):yt<-Number.EPSILON?at<-Number.EPSILON&&(Pe=!0):Math.sign(zt)===Math.sign(te)&&(Pe=!0),Pe?(ot=-zt,se=yt,Kt=Math.sqrt(V)):(ot=yt,se=zt,Kt=Math.sqrt(V/2))}return new We(ot/Kt,se/Kt)}const le=[];for(let Ue=0,Je=z.length,He=Je-1,ot=Ue+1;Ue<Je;Ue++,He++,ot++)He===Je&&(He=0),ot===Je&&(ot=0),le[Ue]=fe(z[Ue],z[He],z[ot]);const Me=[];let Ce,Be=le.concat();for(let Ue=0,Je=Y;Ue<Je;Ue++){const He=k[Ue];Ce=[];for(let ot=0,se=He.length,Kt=se-1,yt=ot+1;ot<se;ot++,Kt++,yt++)Kt===se&&(Kt=0),yt===se&&(yt=0),Ce[ot]=fe(He[ot],He[Kt],He[yt]);Me.push(Ce),Be=Be.concat(Ce)}let Ye;if(S===0)Ye=$u.triangulateShape(z,k);else{const Ue=[],Je=[];for(let He=0;He<S;He++){const ot=He/S,se=x*Math.cos(ot*Math.PI/2),Kt=y*Math.sin(ot*Math.PI/2)+T;for(let yt=0,zt=z.length;yt<zt;yt++){const at=Q(z[yt],le[yt],Kt);St(at.x,at.y,-se),ot===0&&Ue.push(at)}for(let yt=0,zt=Y;yt<zt;yt++){const at=k[yt];Ce=Me[yt];const te=[];for(let V=0,de=at.length;V<de;V++){const Pe=Q(at[V],Ce[V],Kt);St(Pe.x,Pe.y,-se),ot===0&&te.push(Pe)}ot===0&&Je.push(te)}}Ye=$u.triangulateShape(Ue,Je)}const qt=Ye.length,bt=y+T;for(let Ue=0;Ue<ee;Ue++){const Je=g?Q($[Ue],Be[Ue],bt):$[Ue];N?(F.copy(U.normals[0]).multiplyScalar(Je.x),L.copy(U.binormals[0]).multiplyScalar(Je.y),P.copy(E[0]).add(F).add(L),St(P.x,P.y,P.z)):St(Je.x,Je.y,0)}for(let Ue=1;Ue<=d;Ue++)for(let Je=0;Je<ee;Je++){const He=g?Q($[Je],Be[Je],bt):$[Je];N?(F.copy(U.normals[Ue]).multiplyScalar(He.x),L.copy(U.binormals[Ue]).multiplyScalar(He.y),P.copy(E[Ue]).add(F).add(L),St(P.x,P.y,P.z)):St(He.x,He.y,p/d*Ue)}for(let Ue=S-1;Ue>=0;Ue--){const Je=Ue/S,He=x*Math.cos(Je*Math.PI/2),ot=y*Math.sin(Je*Math.PI/2)+T;for(let se=0,Kt=z.length;se<Kt;se++){const yt=Q(z[se],le[se],ot);St(yt.x,yt.y,p+He)}for(let se=0,Kt=k.length;se<Kt;se++){const yt=k[se];Ce=Me[se];for(let zt=0,at=yt.length;zt<at;zt++){const te=Q(yt[zt],Ce[zt],ot);N?St(te.x,te.y+E[d-1].y,E[d-1].x+He):St(te.x,te.y,p+He)}}}Re(),qe();function Re(){const Ue=r.length/3;if(g){let Je=0,He=ee*Je;for(let ot=0;ot<qt;ot++){const se=Ye[ot];mt(se[2]+He,se[1]+He,se[0]+He)}Je=d+S*2,He=ee*Je;for(let ot=0;ot<qt;ot++){const se=Ye[ot];mt(se[0]+He,se[1]+He,se[2]+He)}}else{for(let Je=0;Je<qt;Je++){const He=Ye[Je];mt(He[2],He[1],He[0])}for(let Je=0;Je<qt;Je++){const He=Ye[Je];mt(He[0]+ee*d,He[1]+ee*d,He[2]+ee*d)}}n.addGroup(Ue,r.length/3-Ue,0)}function qe(){const Ue=r.length/3;let Je=0;Ke(z,Je),Je+=z.length;for(let He=0,ot=k.length;He<ot;He++){const se=k[He];
vendor: 16,384 bytes, lines 5-9
5Ke(se,Je),Je+=se.length}n.addGroup(Ue,r.length/3-Ue,1)}function Ke(Ue,Je){let He=Ue.length;for(;--He>=0;){const ot=He;let se=He-1;se<0&&(se=Ue.length-1);for(let Kt=0,yt=d+S*2;Kt<yt;Kt++){const zt=ee*Kt,at=ee*(Kt+1),te=Je+ot+zt,V=Je+se+zt,de=Je+se+at,Pe=Je+ot+at;Tt(te,V,de,Pe)}}}function St(Ue,Je,He){l.push(Ue),l.push(Je),l.push(He)}function mt(Ue,Je,He){an(Ue),an(Je),an(He);const ot=r.length/3,se=R.generateTopUV(n,r,ot-3,ot-2,ot-1);Ut(se[0]),Ut(se[1]),Ut(se[2])}function Tt(Ue,Je,He,ot){an(Ue),an(Je),an(ot),an(Je),an(He),an(ot);const se=r.length/3,Kt=R.generateSideWallUV(n,r,se-6,se-3,se-2,se-1);Ut(Kt[0]),Ut(Kt[1]),Ut(Kt[3]),Ut(Kt[1]),Ut(Kt[2]),Ut(Kt[3])}function an(Ue){r.push(l[Ue*3+0]),r.push(l[Ue*3+1]),r.push(l[Ue*3+2])}function Ut(Ue){s.push(Ue.x),s.push(Ue.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 TD(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];n.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new om[r.type]().fromJSON(r)),new Ev(n,e.options)}}const SD={generateTopUV:function(i,e,t,n,r){const s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],u=e[r*3],d=e[r*3+1];return[new We(s,o),new We(a,l),new We(u,d)]},generateSideWallUV:function(i,e,t,n,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],u=e[n*3],d=e[n*3+1],p=e[n*3+2],g=e[r*3],x=e[r*3+1],y=e[r*3+2],T=e[s*3],S=e[s*3+1],M=e[s*3+2];return Math.abs(a-d)<Math.abs(o-u)?[new We(o,1-l),new We(u,1-p),new We(g,1-y),new We(T,1-M)]:[new We(a,1-l),new We(d,1-p),new We(x,1-y),new We(S,1-M)]}};function TD(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){const s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Fd extends Wn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),u=a+1,d=l+1,p=e/a,g=t/l,x=[],y=[],T=[],S=[];for(let M=0;M<d;M++){const R=M*g-o;for(let E=0;E<u;E++){const N=E*p-s;y.push(N,-R,0),T.push(0,0,1),S.push(E/a),S.push(1-M/l)}}for(let M=0;M<l;M++)for(let R=0;R<a;R++){const E=R+u*M,N=R+u*(M+1),U=R+1+u*(M+1),L=R+1+u*M;x.push(E,N,L),x.push(N,U,L)}this.setIndex(x),this.setAttribute("position",new Fn(y,3)),this.setAttribute("normal",new Fn(T,3)),this.setAttribute("uv",new Fn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fd(e.width,e.height,e.widthSegments,e.heightSegments)}}class Fa extends Wn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(o+a,Math.PI);let u=0;const d=[],p=new J,g=new J,x=[],y=[],T=[],S=[];for(let M=0;M<=n;M++){const R=[],E=M/n;let N=0;M===0&&o===0?N=.5/t:M===n&&l===Math.PI&&(N=-.5/t);for(let U=0;U<=t;U++){const L=U/t;p.x=-e*Math.cos(r+L*s)*Math.sin(o+E*a),p.y=e*Math.cos(o+E*a),p.z=e*Math.sin(r+L*s)*Math.sin(o+E*a),y.push(p.x,p.y,p.z),g.copy(p).normalize(),T.push(g.x,g.y,g.z),S.push(L+N,1-E),R.push(u++)}d.push(R)}for(let M=0;M<n;M++)for(let R=0;R<t;R++){const E=d[M][R+1],N=d[M][R],U=d[M+1][R],L=d[M+1][R+1];(M!==0||o>0)&&x.push(E,N,L),(M!==n-1||l<Math.PI)&&x.push(N,U,L)}this.setIndex(x),this.setAttribute("position",new Fn(y,3)),this.setAttribute("normal",new Fn(T,3)),this.setAttribute("uv",new Fn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fa(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Rv extends Wn{constructor(e=new fE(new J(-1,-1,0),new J(-1,1,0),new J(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new J,l=new J,u=new We;let d=new J;const p=[],g=[],x=[],y=[];T(),this.setIndex(y),this.setAttribute("position",new Fn(p,3)),this.setAttribute("normal",new Fn(g,3)),this.setAttribute("uv",new Fn(x,2));function T(){for(let E=0;E<t;E++)S(E);S(s===!1?t:0),R(),M()}function S(E){d=e.getPointAt(E/t,d);const N=o.normals[E],U=o.binormals[E];for(let L=0;L<=r;L++){const F=L/r*Math.PI*2,P=Math.sin(F),I=-Math.cos(F);l.x=I*N.x+P*U.x,l.y=I*N.y+P*U.y,l.z=I*N.z+P*U.z,l.normalize(),g.push(l.x,l.y,l.z),a.x=d.x+n*l.x,a.y=d.y+n*l.y,a.z=d.z+n*l.z,p.push(a.x,a.y,a.z)}}function M(){for(let E=1;E<=t;E++)for(let N=1;N<=r;N++){const U=(r+1)*(E-1)+(N-1),L=(r+1)*E+(N-1),F=(r+1)*E+N,P=(r+1)*(E-1)+N;y.push(U,L,P),y.push(L,F,P)}}function R(){for(let E=0;E<=t;E++)for(let N=0;N<=r;N++)u.x=E/t,u.y=N/r,x.push(u.x,u.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 Rv(new om[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class MD extends Wn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,r=new J,s=new J;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let u=0,d=l.length;u<d;++u){const p=l[u],g=p.start,x=p.count;for(let y=g,T=g+x;y<T;y+=3)for(let S=0;S<3;S++){const M=a.getX(y+S),R=a.getX(y+(S+1)%3);r.fromBufferAttribute(o,M),s.fromBufferAttribute(o,R),Zb(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let u=0;u<3;u++){const d=3*a+u,p=3*a+(u+1)%3;r.fromBufferAttribute(o,d),s.fromBufferAttribute(o,p),Zb(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Fn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Zb(i,e,t){const n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}class wD extends Hr{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new It(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}}function pA(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(Oe("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function Zr(i){const e={};for(let t=0;t<i.length;t++){const n=pA(i[t]);for(const r in n)e[r]=n[r]}return e}function ED(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function xE(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Yt.workingColorSpace}const Cv={clone:pA,merge:Zr};var RD=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,CD=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class ws extends Hr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=RD,this.fragmentShader=CD,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=pA(e.uniforms),this.uniformsGroups=ED(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.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={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 r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class ND extends ws{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class vE extends Hr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new It(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 It(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ma,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Nr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class PD extends vE{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 We(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return cn(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 It(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 It(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new It(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class yE extends Hr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new It(16777215),this.specular=new It(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new It(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ma,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Nr,this.combine=Dd,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionR
vendor: 5,347 bytes, line 9
9atio=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 DD extends Hr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new It(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new It(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ma,this.normalScale=new We(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 LD extends Hr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ma,this.normalScale=new We(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 dl extends Hr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new It(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new It(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ma,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Nr,this.combine=Dd,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,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 ID extends Hr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$P,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 BD extends Hr{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}}
9class FD extends Hr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new It(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ma,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class UD extends BA{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}}const X1={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(Jb(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!Jb(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function Jb(i){try{const e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class OD{constructor(e,t,n){const r=this;let s=!1,o=0,a=0,l;const u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(d){a++,s===!1&&r.onStart!==void 0&&r.onStart(d,o,a),s=!0},this.itemEnd=function(d){o++,r.onProgress!==void 0&&r.onProgress(d,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(d){r.onError!==void 0&&r.onError(d)},this.resolveURL=function(d){return l?l(d):d},this.setURLModifier=function(d){return l=d,this},this.addHandler=function(d,p){return u.push(d,p),this},this.removeHandler=function(d){const p=u.indexOf(d);return p!==-1&&u.splice(p,2),this},this.getHandler=function(d){for(let p=0,g=u.length;p<g;p+=2){const x=u[p],y=u[p+1];if(x.global&&(x.lastIndex=0),x.test(d))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const kD=new OD;class Nv{constructor(e){this.manager=e!==void 0?e:kD,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Nv.DEFAULT_MATERIAL_NAME="__DEFAULT";const Wc=new WeakMap;class GD extends Nv{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=X1.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let p=Wc.get(o);p===void 0&&(p=[],Wc.set(o,p)),p.push({onLoad:t,onError:r})}return o}const a=ud("img");function l(){d(),t&&t(this);const p=Wc.get(this)||[];for(let g=0;g<p.length;g++){const x=p[g];x.onLoad&&x.onLoad(this)}Wc.delete(this),s.manager.itemEnd(e)}function u(p){d(),r&&r(p),X1.remove(`image:${e}`);const g=Wc.get(this)||[];for(let x=0;x<g.length;x++){const y=g[x];y.onError&&y.onError(p)}Wc.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){a.removeEventListener("load",l,!1),a.removeEventListener("error",u,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",u,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),X1.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}
9class Pv extends Nv{constructor(e){super(e)}load(e,t,n,r){const s=new tr,o=new GD(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class xc extends Ei{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new It(e),this.intensity=t}dispose(){this.dispatchEvent({type:"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,t}}class VD extends xc{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ei.DEFAULT_UP),this.updateMatrix(),this.groundColor=new It(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const Q1=new nn,eS=new J,tS=new J;class Dv{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new We(512,512),this.mapType=yi,this.map=null,this.mapPass=null,this.matrix=new nn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new IA,this._frameExtents=new We(1,1),this._viewportCount=1,this._viewports=[new rn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;eS.setFromMatrixPosition(e.matrixWorld),t.position.copy(eS),tS.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(tS),t.updateMatrixWorld(),Q1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Q1,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===co||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Q1)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const D0=new J,L0=new ll,Xo=new J;class cg extends Ei{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new nn,this.projectionMatrix=new nn,this.projectionMatrixInverse=new nn,this.coordinateSystem=us,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}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.matrixWorld.decompose(D0,L0,Xo),Xo.x===1&&Xo.y===1&&Xo.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(D0,L0,Xo.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(D0,L0,Xo),Xo.x===1&&Xo.y===1&&Xo.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(D0,L0,Xo.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Nl=new J,nS=new We,iS=new We;class pr extends cg{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,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=Ac*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Uf*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,977 bytes, line 9
9getEffectiveFOV(){return Ac*2*Math.atan(Math.tan(Uf*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Nl.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Nl.x,Nl.y).multiplyScalar(-e/Nl.z),Nl.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Nl.x,Nl.y).multiplyScalar(-e/Nl.z)}getViewSize(e,t){return this.getViewBounds(e,nS,iS),t.subVectors(iS,nS)}setViewOffset(e,t,n,r,s,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=r,this.view.width=s,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(Uf*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,u=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/u,r*=o.width/l,n*=o.height/u}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),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}}class qD extends Dv{constructor(){super(new pr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Ac*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Lv extends xc{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ei.DEFAULT_UP),this.updateMatrix(),this.target=new Ei,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new qD}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.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.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class zD extends Dv{constructor(){super(new pr(90,1,.5,500)),this.isPointLightShadow=!0}}class HD extends xc{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new zD}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.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}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class Ud extends cg{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,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,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const u=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=u*this.view.offsetX,o=s+u*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}
vendor: 4,118 bytes, line 9
9this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class WD extends Dv{constructor(){super(new Ud(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class $D extends xc{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ei.DEFAULT_UP),this.updateMatrix(),this.target=new Ei,this.shadow=new WD}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class jD extends xc{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class XD extends xc{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}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 QD{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new J)}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,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),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 r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}}class YD extends xc{constructor(e=new QD,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class KD extends Wn{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}}const $c=-90,jc=1;
vendor: 5,688 bytes, line 9
9class bE extends Ei{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new pr($c,jc,e,t);r.layers=this.layers,this.add(r);const s=new pr($c,jc,e,t);s.layers=this.layers,this.add(s);const o=new pr($c,jc,e,t);o.layers=this.layers,this.add(o);const a=new pr($c,jc,e,t);a.layers=this.layers,this.add(a);const l=new pr($c,jc,e,t);l.layers=this.layers,this.add(l);const u=new pr($c,jc,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(const u of t)this.remove(u);if(e===us)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===co)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const u of t)this.add(u),u.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,u,d]=this.children,p=e.getRenderTarget(),g=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const T=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),n.texture.generateMipmaps=T,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(p,g,x),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}}class SE extends pr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class am extends yv{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}}const rS=new nn;class ZD{constructor(e,t,n=0,r=1/0){this.ray=new Bd(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new gv,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):ke("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return rS.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(rS),this}intersectObject(e,t=!0,n=[]){return x_(e,this,n,t),n.sort(sS),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)x_(e[r],this,n,t);return n.sort(sS),n}}function sS(i,e){return i.distance-e.distance}function x_(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let o=0,a=s.length;o<a;o++)x_(s[o],e,t,!0)}}class oS{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=cn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(cn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class hg{constructor(e,t,n,r){hg.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}}const aS=new J,I0=new J,Xc=new J,Qc=new J,Y1=new J,JD=new J,eL=new J;class tL{constructor(e=new J,t=new J){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){aS.subVectors(e,this.start),I0.subVectors(this.end,this.start);const n=I0.dot(I0);let s=I0.dot(aS)/n;return t&&(s=cn(s,0,1)),s}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}
vendor: 7,812 bytes, lines 9-13
9distanceSqToLine3(e,t=JD,n=eL){const r=10000000000000001e-32;let s,o;const a=this.start,l=e.start,u=this.end,d=e.end;Xc.subVectors(u,a),Qc.subVectors(d,l),Y1.subVectors(a,l);const p=Xc.dot(Xc),g=Qc.dot(Qc),x=Qc.dot(Y1);if(p<=r&&g<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(p<=r)s=0,o=x/g,o=cn(o,0,1);else{const y=Xc.dot(Y1);if(g<=r)o=0,s=cn(-y/p,0,1);else{const T=Xc.dot(Qc),S=p*g-T*T;S!==0?s=cn((T*x-y*g)/S,0,1):s=0,o=(T*s+x)/g,o<0?(o=0,s=cn(-y/p,0,1)):o>1&&(o=1,s=cn((T-y)/p,0,1))}}return t.copy(a).addScaledVector(Xc,s),n.copy(l).addScaledVector(Qc,o),t.distanceToSquared(n)}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)}}class nL{constructor(){this.type="ShapePath",this.color=new It,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new m_,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,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(M){const R=[];for(let E=0,N=M.length;E<N;E++){const U=M[E],L=new Gp;L.curves=U.curves,R.push(L)}return R}function n(M,R){const E=R.length;let N=!1;for(let U=E-1,L=0;L<E;U=L++){let F=R[U],P=R[L],I=P.x-F.x,$=P.y-F.y;if(Math.abs($)>Number.EPSILON){if($<0&&(F=R[L],I=-I,P=R[U],$=-$),M.y<F.y||M.y>P.y)continue;if(M.y===F.y){if(M.x===F.x)return!0}else{const k=$*(M.x-F.x)-I*(M.y-F.y);if(k===0)return!0;if(k<0)continue;N=!N}}else{if(M.y!==F.y)continue;if(P.x<=M.x&&M.x<=F.x||F.x<=M.x&&M.x<=P.x)return!0}}return N}const r=$u.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const u=[];if(s.length===1)return a=s[0],l=new Gp,l.curves=a.curves,u.push(l),u;let d=!r(s[0].getPoints());d=e?!d:d;const p=[],g=[];let x=[],y=0,T;g[y]=void 0,x[y]=[];for(let M=0,R=s.length;M<R;M++)a=s[M],T=a.getPoints(),o=r(T),o=e?!o:o,o?(!d&&g[y]&&y++,g[y]={s:new Gp,p:T},g[y].s.curves=a.curves,d&&y++,x[y]=[]):x[y].push({h:a,p:T[0]});if(!g[0])return t(s);if(g.length>1){let M=!1,R=0;for(let E=0,N=g.length;E<N;E++)p[E]=[];for(let E=0,N=g.length;E<N;E++){const U=x[E];for(let L=0;L<U.length;L++){const F=U[L];let P=!0;for(let I=0;I<g.length;I++)n(F.p,g[I].p)&&(E!==I&&R++,P?(P=!1,p[I].push(F)):M=!0);P&&p[E].push(F)}}R>0&&M===!1&&(x=p)}let S;for(let M=0,R=g.length;M<R;M++){l=g[M].s,u.push(l),S=x[M];for(let E=0,N=S.length;E<N;E++)l.holes.push(S[E].h)}return u}}class iL extends Ia{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Oe("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function v_(i,e,t,n){const r=rL(n);switch(t){case lv:return i*e;case Id:return i*e/r.components*r.byteLength;case PA:return i*e/r.components*r.byteLength;case ls:return i*e*2/r.components*r.byteLength;case DA:return i*e*2/r.components*r.byteLength;case Ld:return i*e*3/r.components*r.byteLength;case Wi:return i*e*4/r.components*r.byteLength;case LA:return i*e*4/r.components*r.byteLength;case Zl:case Jl:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case eu:case tu:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case rd:case od:return Math.max(i,16)*Math.max(e,8)/4;case id:case sd:return Math.max(i,8)*Math.max(e,8)/2;case qh:case zh:case Wh:case $h:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Hh:case cc:case jh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Xh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Qh:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Yh:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Kh:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case Zh:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Jh:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case eA:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case tA:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case nA:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case iA:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case rA:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case sA:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case oA:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case aA:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case lA:case h_:case A_:return Math.ceil(i/4)*Math.ceil(e/4)*16;case uA:case cA:return Math.ceil(i/4)*Math.ceil(e/4)*8;case hc:case hA:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function rL(i){switch(i){case yi:case ec:return{byteLength:1,components:1};case Do:case tc:case Mi:return{byteLength:2,components:1};case tg:case ng:return{byteLength:2,components:4};case ii:case dr:case zi:return{byteLength:4,components:1};case ig:case rg:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:NA}}));typeof window<"u"&&(window.__THREE__?Oe("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=NA);/** 10 * @license 11 * Copyright 2010-2026 Three.js Authors 12 * SPDX-License-Identifier: MIT 13 */function TE(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function sL(i){const e=new WeakMap;function t(a,l){const u=a.array,d=a.usage,p=u.byteLength,g=i.createBuffer();i.bindBuffer(l,g),i.bufferData(l,u,d),a.onUploadCallback();let x;if(u instanceof Float32Array)x=i.FLOAT;else if(typeof Float16Array<"u"&&u instanceof Float16Array)x=i.HALF_FLOAT;else if(u instanceof Uint16Array)a.isFloat16BufferAttribute?x=i.HALF_FLOAT:x=i.UNSIGNED_SHORT;else if(u instanceof Int16Array)x=i.SHORT;else if(u instanceof Uint32Array)x=i.UNSIGNED_INT;else if(u instanceof Int32Array)x=i.INT;else if(u instanceof Int8Array)x=i.BYTE;else if(u instanceof Uint8Array)x=i.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)x=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:g,type:x,bytesPerElement:u.BYTES_PER_ELEMENT,version:a.version,size:p}}function n(a,l,u){const d=l.array,p=l.updateRanges;if(i.bindBuffer(u,a),p.length===0)i.bufferSubData(u,0,d);else{p.sort((x,y)=>x.start-y.start);let g=0;for(let x=1;x<p.length;x++){const y=p[g],T=p[x];T.start<=y.start+y.count+1?y.count=Math.max(y.count,T.start+T.count-y.start):(++g,p[g]=T)}p.length=g+1;for(let x=0,y=p.length;x<y;x++){const T=p[x];i.bufferSubData(u,T.start*d.BYTES_PER_ELEMENT,d,T.start,T.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const d=e.get(a);(!d||d.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const u=e.get(a);if(u===void 0)e.set(a,t(a,l));else if(u.version<a.version){if(u.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");
13n(u.buffer,a,l),u.version=a.version}}return{get:r,remove:s,update:o}}var oL=`#ifdef USE_ALPHAHASH 14 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 15#endif`,aL=`#ifdef USE_ALPHAHASH 16 const float ALPHA_HASH_SCALE = 0.05; 17 float hash2D( vec2 value ) { 18 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 19 } 20 float hash3D( vec3 value ) { 21 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 22 } 23 float getAlphaHashThreshold( vec3 position ) { 24 float maxDeriv = max( 25 length( dFdx( position.xyz ) ), 26 length( dFdy( position.xyz ) ) 27 ); 28 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 29 vec2 pixScales = vec2( 30 exp2( floor( log2( pixScale ) ) ), 31 exp2( ceil( log2( pixScale ) ) ) 32 ); 33 vec2 alpha = vec2( 34 hash3D( floor( pixScales.x * position.xyz ) ), 35 hash3D( floor( pixScales.y * position.xyz ) ) 36 ); 37 float lerpFactor = fract( log2( pixScale ) ); 38 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 39 float a = min( lerpFactor, 1.0 - lerpFactor ); 40 vec3 cases = vec3( 41 x * x / ( 2.0 * a * ( 1.0 - a ) ), 42 ( x - 0.5 * a ) / ( 1.0 - a ), 43 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 44 ); 45 float threshold = ( x < ( 1.0 - a ) ) 46 ? ( ( x < a ) ? cases.x : cases.y ) 47 : cases.z; 48 return clamp( threshold , 1.0e-6, 1.0 ); 49 } 50#endif`,lL=`#ifdef USE_ALPHAMAP 51 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 52#endif`,uL=`#ifdef USE_ALPHAMAP 53 uniform sampler2D alphaMap; 54#endif`,cL=`#ifdef USE_ALPHATEST 55 #ifdef ALPHA_TO_COVERAGE 56 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 57 if ( diffuseColor.a == 0.0 ) discard; 58 #else 59 if ( diffuseColor.a < alphaTest ) discard; 60 #endif 61#endif`,hL=`#ifdef USE_ALPHATEST 62 uniform float alphaTest; 63#endif`,AL=`#ifdef USE_AOMAP 64 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 65 reflectedLight.indirectDiffuse *= ambientOcclusion; 66 #if defined( USE_CLEARCOAT ) 67 clearcoatSpecularIndirect *= ambientOcclusion; 68 #endif 69 #if defined( USE_SHEEN ) 70 sheenSpecularIndirect *= ambientOcclusion; 71 #endif 72 #if defined( USE_ENVMAP ) && defined( STANDARD ) 73 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 74 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 75 #endif 76#endif`,fL=`#ifdef USE_AOMAP 77 uniform sampler2D aoMap; 78 uniform float aoMapIntensity; 79#endif`,dL=`#ifdef USE_BATCHING 80 #if ! defined( GL_ANGLE_multi_draw ) 81 #define gl_DrawID _gl_DrawID 82 uniform int _gl_DrawID; 83 #endif 84 uniform highp sampler2D batchingTexture; 85 uniform highp usampler2D batchingIdTexture; 86 mat4 getBatchingMatrix( const in float i ) { 87 int size = textureSize( batchingTexture, 0 ).x; 88 int j = int( i ) * 4; 89 int x = j % size; 90 int y = j / size; 91 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 92 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 93 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 94 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 95 return mat4( v1, v2, v3, v4 ); 96 } 97 float getIndirectIndex( const in int i ) { 98 int size = textureSize( batchingIdTexture, 0 ).x; 99 int x = i % size; 100 int y = i / size; 101 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 102 } 103#endif 104#ifdef USE_BATCHING_COLOR 105 uniform sampler2D batchingColorTexture; 106 vec4 getBatchingColor( const in float i ) { 107 int size = textureSize( batchingColorTexture, 0 ).x; 108 int j = int( i ); 109 int x = j % size; 110 int y = j / size; 111 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ); 112 } 113#endif`,pL=`#ifdef USE_BATCHING 114 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 115#endif`,mL=`vec3 transformed = vec3( position ); 116#ifdef USE_ALPHAHASH 117 vPosition = vec3( position ); 118#endif`,gL=`vec3 objectNormal = vec3( normal ); 119#ifdef USE_TANGENT 120 vec3 objectTangent = vec3( tangent.xyz ); 121#endif`,_L=`float G_BlinnPhong_Implicit( ) { 122 return 0.25; 123} 124float D_BlinnPhong( const in float shininess, const in float dotNH ) { 125 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 126}
127vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 128 vec3 halfDir = normalize( lightDir + viewDir ); 129 float dotNH = saturate( dot( normal, halfDir ) ); 130 float dotVH = saturate( dot( viewDir, halfDir ) ); 131 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 132 float G = G_BlinnPhong_Implicit( ); 133 float D = D_BlinnPhong( shininess, dotNH ); 134 return F * ( G * D ); 135} // validated`,xL=`#ifdef USE_IRIDESCENCE 136 const mat3 XYZ_TO_REC709 = mat3( 137 3.2404542, -0.9692660, 0.0556434, 138 -1.5371385, 1.8760108, -0.2040259, 139 -0.4985314, 0.0415560, 1.0572252 140 ); 141 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 142 vec3 sqrtF0 = sqrt( fresnel0 ); 143 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 144 } 145 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 146 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 147 } 148 float IorToFresnel0( float transmittedIor, float incidentIor ) { 149 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 150 } 151 vec3 evalSensitivity( float OPD, vec3 shift ) { 152 float phase = 2.0 * PI * OPD * 1.0e-9; 153 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 154 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 155 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 156 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 157 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 ) ); 158 xyz /= 1.0685e-7; 159 vec3 rgb = XYZ_TO_REC709 * xyz; 160 return rgb; 161 } 162 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 163 vec3 I; 164 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 165 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 166 float cosTheta2Sq = 1.0 - sinTheta2Sq; 167 if ( cosTheta2Sq < 0.0 ) { 168 return vec3( 1.0 ); 169 } 170 float cosTheta2 = sqrt( cosTheta2Sq ); 171 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 172 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
173 float T121 = 1.0 - R12; 174 float phi12 = 0.0; 175 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 176 float phi21 = PI - phi12; 177 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 178 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 179 vec3 phi23 = vec3( 0.0 ); 180 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 181 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 182 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 183 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 184 vec3 phi = vec3( phi21 ) + phi23; 185 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 186 vec3 r123 = sqrt( R123 ); 187 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 188 vec3 C0 = R12 + Rs; 189 I = C0; 190 vec3 Cm = Rs - T121; 191 for ( int m = 1; m <= 2; ++ m ) { 192 Cm *= r123; 193 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 194 I += Cm * Sm; 195 } 196 return max( I, vec3( 0.0 ) ); 197 } 198#endif`,vL=`#ifdef USE_BUMPMAP 199 uniform sampler2D bumpMap; 200 uniform float bumpScale; 201 vec2 dHdxy_fwd() { 202 vec2 dSTdx = dFdx( vBumpMapUv ); 203 vec2 dSTdy = dFdy( vBumpMapUv ); 204 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 205 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 206 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 207 return vec2( dBx, dBy ); 208 } 209 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 210 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 211 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 212 vec3 vN = surf_norm; 213 vec3 R1 = cross( vSigmaY, vN ); 214 vec3 R2 = cross( vN, vSigmaX ); 215 float fDet = dot( vSigmaX, R1 ) * faceDirection; 216 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 217 return normalize( abs( fDet ) * surf_norm - vGrad ); 218 } 219#endif`,yL=`#if NUM_CLIPPING_PLANES > 0 220 vec4 plane; 221 #ifdef ALPHA_TO_COVERAGE 222 float distanceToPlane, distanceGradient; 223 float clipOpacity = 1.0; 224 #pragma unroll_loop_start 225 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 226 plane = clippingPlanes[ i ]; 227 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 228 distanceGradient = fwidth( distanceToPlane ) / 2.0; 229 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 230 if ( clipOpacity == 0.0 ) discard; 231 } 232 #pragma unroll_loop_end 233 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 234 float unionClipOpacity = 1.0; 235 #pragma unroll_loop_start 236 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 237 plane = clippingPlanes[ i ]; 238 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 239 distanceGradient = fwidth( distanceToPlane ) / 2.0; 240 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 241 } 242 #pragma unroll_loop_end 243 clipOpacity *= 1.0 - unionClipOpacity; 244 #endif 245 diffuseColor.a *= clipOpacity; 246 if ( diffuseColor.a == 0.0 ) discard; 247 #else 248 #pragma unroll_loop_start 249 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 250 plane = clippingPlanes[ i ]; 251 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 252 } 253 #pragma unroll_loop_end 254 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 255 bool clipped = true; 256 #pragma unroll_loop_start 257 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 258 plane = clippingPlanes[ i ]; 259 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 260 } 261 #pragma unroll_loop_end 262 if ( clipped ) discard; 263 #endif 264 #endif 265#endif`,bL=`#if NUM_CLIPPING_PLANES > 0 266 varying vec3 vClipPosition; 267 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 268#endif`,SL=`#if NUM_CLIPPING_PLANES > 0 269 varying vec3 vClipPosition; 270#endif`,TL=`#if NUM_CLIPPING_PLANES > 0 271 vClipPosition = - mvPosition.xyz; 272#endif`,ML=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 273 diffuseColor *= vColor; 274#endif`,wL=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 275 varying vec4 vColor; 276#endif`,EL=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 277 varying vec4 vColor; 278#endif`,RL=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 279 vColor = vec4( 1.0 ); 280#endif 281#ifdef USE_COLOR_ALPHA 282 vColor *= color; 283#elif defined( USE_COLOR ) 284 vColor.rgb *= color; 285#endif 286#ifdef USE_INSTANCING_COLOR 287 vColor.rgb *= instanceColor.rgb; 288#endif 289#ifdef USE_BATCHING_COLOR 290 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); 291#endif`,CL=`#define PI 3.141592653589793 292#define PI2 6.283185307179586 293#define PI_HALF 1.5707963267948966 294#define RECIPROCAL_PI 0.3183098861837907 295#define RECIPROCAL_PI2 0.15915494309189535 296#define EPSILON 1e-6 297#ifndef saturate 298#define saturate( a ) clamp( a, 0.0, 1.0 ) 299#endif 300#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 301float pow2( const in float x ) { return x*x; } 302vec3 pow2( const in vec3 x ) { return x*x; } 303float pow3( const in float x ) { return x*x*x; } 304float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 305float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 306float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 307highp float rand( const in vec2 uv ) { 308 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 309 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 310 return fract( sin( sn ) * c ); 311} 312#ifdef HIGH_PRECISION 313 float precisionSafeLength( vec3 v ) { return length( v ); } 314#else 315 float precisionSafeLength( vec3 v ) { 316 float maxComponent = max3( abs( v ) ); 317 return length( v / maxComponent ) * maxComponent; 318 } 319#endif 320struct IncidentLight { 321 vec3 color; 322 vec3 direction; 323 bool visible; 324}; 325struct ReflectedLight { 326 vec3 directDiffuse; 327 vec3 directSpecular; 328 vec3 indirectDiffuse; 329 vec3 indirectSpecular; 330}; 331#ifdef USE_ALPHAHASH 332 varying vec3 vPosition; 333#endif 334vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 335 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 336} 337vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 338 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 339} 340bool isPerspectiveMatrix( mat4 m ) { 341 return m[ 2 ][ 3 ] == - 1.0; 342} 343vec2 equirectUv( in vec3 dir ) { 344 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 345 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 346 return vec2( u, v ); 347}
348vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 349 return RECIPROCAL_PI * diffuseColor; 350} 351vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 352 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 353 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 354} 355float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 356 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 357 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 358} // validated`,NL=`#ifdef ENVMAP_TYPE_CUBE_UV 359 #define cubeUV_minMipLevel 4.0 360 #define cubeUV_minTileSize 16.0 361 float getFace( vec3 direction ) { 362 vec3 absDirection = abs( direction ); 363 float face = - 1.0; 364 if ( absDirection.x > absDirection.z ) { 365 if ( absDirection.x > absDirection.y ) 366 face = direction.x > 0.0 ? 0.0 : 3.0; 367 else 368 face = direction.y > 0.0 ? 1.0 : 4.0; 369 } else { 370 if ( absDirection.z > absDirection.y ) 371 face = direction.z > 0.0 ? 2.0 : 5.0; 372 else 373 face = direction.y > 0.0 ? 1.0 : 4.0; 374 } 375 return face; 376 } 377 vec2 getUV( vec3 direction, float face ) { 378 vec2 uv; 379 if ( face == 0.0 ) { 380 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 381 } else if ( face == 1.0 ) { 382 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 383 } else if ( face == 2.0 ) { 384 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 385 } else if ( face == 3.0 ) { 386 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 387 } else if ( face == 4.0 ) { 388 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 389 } else { 390 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 391 } 392 return 0.5 * ( uv + 1.0 ); 393 } 394 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 395 float face = getFace( direction ); 396 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 397 mipInt = max( mipInt, cubeUV_minMipLevel ); 398 float faceSize = exp2( mipInt ); 399 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 400 if ( face > 2.0 ) { 401 uv.y += faceSize; 402 face -= 3.0; 403 } 404 uv.x += face * faceSize; 405 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 406 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 407 uv.x *= CUBEUV_TEXEL_WIDTH; 408 uv.y *= CUBEUV_TEXEL_HEIGHT; 409 #ifdef texture2DGradEXT 410 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 411 #else 412 return texture2D( envMap, uv ).rgb; 413 #endif 414 } 415 #define cubeUV_r0 1.0 416 #define cubeUV_m0 - 2.0 417 #define cubeUV_r1 0.8 418 #define cubeUV_m1 - 1.0 419 #define cubeUV_r4 0.4 420 #define cubeUV_m4 2.0 421 #define cubeUV_r5 0.305 422 #define cubeUV_m5 3.0 423 #define cubeUV_r6 0.21 424 #define cubeUV_m6 4.0 425 float roughnessToMip( float roughness ) { 426 float mip = 0.0; 427 if ( roughness >= cubeUV_r1 ) { 428 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 429 } else if ( roughness >= cubeUV_r4 ) { 430 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 431 } else if ( roughness >= cubeUV_r5 ) { 432 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 433 } else if ( roughness >= cubeUV_r6 ) { 434 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 435 } else { 436 mip = - 2.0 * log2( 1.16 * roughness ); } 437 return mip; 438 } 439 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 440 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 441 float mipF = fract( mip ); 442 float mipInt = floor( mip ); 443 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 444 if ( mipF == 0.0 ) { 445 return vec4( color0, 1.0 ); 446 } else { 447 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 448 return vec4( mix( color0, color1, mipF ), 1.0 ); 449 } 450 } 451#endif`,PL=`vec3 transformedNormal = objectNormal; 452#ifdef USE_TANGENT 453 vec3 transformedTangent = objectTangent; 454#endif 455#ifdef USE_BATCHING 456 mat3 bm = mat3( batchingMatrix ); 457 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 458 transformedNormal = bm * transformedNormal; 459 #ifdef USE_TANGENT 460 transformedTangent = bm * transformedTangent; 461 #endif 462#endif 463#ifdef USE_INSTANCING 464 mat3 im = mat3( instanceMatrix ); 465 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 466 transformedNormal = im * transformedNormal; 467 #ifdef USE_TANGENT 468 transformedTangent = im * transformedTangent; 469 #endif 470#endif 471transformedNormal = normalMatrix * transformedNormal; 472#ifdef FLIP_SIDED 473 transformedNormal = - transformedNormal; 474#endif 475#ifdef USE_TANGENT 476 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 477 #ifdef FLIP_SIDED 478 transformedTangent = - transformedTangent; 479 #endif 480#endif`,DL=`#ifdef USE_DISPLACEMENTMAP 481 uniform sampler2D displacementMap; 482 uniform float displacementScale; 483 uniform float displacementBias; 484#endif`,LL=`#ifdef USE_DISPLACEMENTMAP 485 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
485placementBias ); 486#endif`,IL=`#ifdef USE_EMISSIVEMAP 487 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 488 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 489 emissiveColor = sRGBTransferEOTF( emissiveColor ); 490 #endif 491 totalEmissiveRadiance *= emissiveColor.rgb; 492#endif`,BL=`#ifdef USE_EMISSIVEMAP 493 uniform sampler2D emissiveMap; 494#endif`,FL="gl_FragColor = linearToOutputTexel( gl_FragColor );",UL=`vec4 LinearTransferOETF( in vec4 value ) { 495 return value; 496} 497vec4 sRGBTransferEOTF( in vec4 value ) { 498 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 499} 500vec4 sRGBTransferOETF( in vec4 value ) { 501 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 ); 502}`,OL=`#ifdef USE_ENVMAP 503 #ifdef ENV_WORLDPOS 504 vec3 cameraToFrag; 505 if ( isOrthographic ) { 506 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 507 } else { 508 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 509 } 510 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 511 #ifdef ENVMAP_MODE_REFLECTION 512 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 513 #else 514 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 515 #endif 516 #else 517 vec3 reflectVec = vReflect; 518 #endif 519 #ifdef ENVMAP_TYPE_CUBE 520 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 521 #ifdef ENVMAP_BLENDING_MULTIPLY 522 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 523 #elif defined( ENVMAP_BLENDING_MIX ) 524 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 525 #elif defined( ENVMAP_BLENDING_ADD ) 526 outgoingLight += envColor.xyz * specularStrength * reflectivity; 527 #endif 528 #endif 529#endif`,kL=`#ifdef USE_ENVMAP 530 uniform float envMapIntensity; 531 uniform float flipEnvMap; 532 uniform mat3 envMapRotation; 533 #ifdef ENVMAP_TYPE_CUBE 534 uniform samplerCube envMap; 535 #else 536 uniform sampler2D envMap; 537 #endif 538#endif`,GL=`#ifdef USE_ENVMAP 539 uniform float reflectivity; 540 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 541 #define ENV_WORLDPOS 542 #endif 543 #ifdef ENV_WORLDPOS 544 varying vec3 vWorldPosition; 545 uniform float refractionRatio; 546 #else 547 varying vec3 vReflect; 548 #endif 549#endif`,VL=`#ifdef USE_ENVMAP 550 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 551 #define ENV_WORLDPOS 552 #endif 553 #ifdef ENV_WORLDPOS 554 555 varying vec3 vWorldPosition; 556 #else 557 varying vec3 vReflect; 558 uniform float refractionRatio; 559 #endif 560#endif`,qL=`#ifdef USE_ENVMAP 561 #ifdef ENV_WORLDPOS 562 vWorldPosition = worldPosition.xyz; 563 #else 564 vec3 cameraToVertex; 565 if ( isOrthographic ) { 566 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 567 } else {
568 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 569 } 570 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 571 #ifdef ENVMAP_MODE_REFLECTION 572 vReflect = reflect( cameraToVertex, worldNormal ); 573 #else 574 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 575 #endif 576 #endif 577#endif`,zL=`#ifdef USE_FOG 578 vFogDepth = - mvPosition.z; 579#endif`,HL=`#ifdef USE_FOG 580 varying float vFogDepth; 581#endif`,WL=`#ifdef USE_FOG 582 #ifdef FOG_EXP2 583 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 584 #else 585 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 586 #endif 587 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 588#endif`,$L=`#ifdef USE_FOG 589 uniform vec3 fogColor; 590 varying float vFogDepth; 591 #ifdef FOG_EXP2 592 uniform float fogDensity; 593 #else 594 uniform float fogNear; 595 uniform float fogFar; 596 #endif 597#endif`,jL=`#ifdef USE_GRADIENTMAP 598 uniform sampler2D gradientMap; 599#endif 600vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 601 float dotNL = dot( normal, lightDirection ); 602 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 603 #ifdef USE_GRADIENTMAP 604 return vec3( texture2D( gradientMap, coord ).r ); 605 #else 606 vec2 fw = fwidth( coord ) * 0.5; 607 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 608 #endif 609}`,XL=`#ifdef USE_LIGHTMAP 610 uniform sampler2D lightMap; 611 uniform float lightMapIntensity; 612#endif`,QL=`LambertMaterial material; 613material.diffuseColor = diffuseColor.rgb; 614material.specularStrength = specularStrength;`,YL=`varying vec3 vViewPosition; 615struct LambertMaterial { 616 vec3 diffuseColor; 617 float specularStrength; 618}; 619void 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 ) { 620 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 621 vec3 irradiance = dotNL * directLight.color; 622 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 623} 624void 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 ) { 625 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 626} 627#define RE_Direct RE_Direct_Lambert 628#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,KL=`uniform bool receiveShadow; 629uniform vec3 ambientLightColor; 630#if defined( USE_LIGHT_PROBES ) 631 uniform vec3 lightProbe[ 9 ]; 632#endif 633vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 634 float x = normal.x, y = normal.y, z = normal.z; 635 vec3 result = shCoefficients[ 0 ] * 0.886227; 636 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 637 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 638 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 639 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 640 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 641 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 642 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 643 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 644 return result; 645} 646vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 647 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 648 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 649 return irradiance; 650} 651vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 652 vec3 irradiance = ambientLightColor; 653 return irradiance; 654} 655float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 656 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 657 if ( cutoffDistance > 0.0 ) { 658 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 659 } 660 return distanceFalloff; 661} 662float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 663 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 664} 665#if NUM_DIR_LIGHTS > 0 666 struct DirectionalLight { 667 vec3 direction; 668 vec3 color; 669 }; 670 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 671 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 672 light.color = directionalLight.color; 673 light.direction = directionalLight.direction; 674 light.visible = true; 675 } 676#endif 677#if NUM_POINT_LIGHTS > 0 678 struct PointLight { 679 vec3 position; 680 vec3 color; 681 float distance; 682 float decay; 683 }; 684 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 685 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 686 vec3 lVector = pointLight.position - geometryPosition; 687 light.direction = normalize( lVector ); 688 float lightDistance = length( lVector ); 689 light.color = pointLight.color; 690 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 691 light.visible = ( light.color != vec3( 0.0 ) ); 692 } 693#endif
694#if NUM_SPOT_LIGHTS > 0 695 struct SpotLight { 696 vec3 position; 697 vec3 direction; 698 vec3 color; 699 float distance; 700 float decay; 701 float coneCos; 702 float penumbraCos; 703 }; 704 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 705 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 706 vec3 lVector = spotLight.position - geometryPosition; 707 light.direction = normalize( lVector ); 708 float angleCos = dot( light.direction, spotLight.direction ); 709 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 710 if ( spotAttenuation > 0.0 ) { 711 float lightDistance = length( lVector ); 712 light.color = spotLight.color * spotAttenuation; 713 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 714 light.visible = ( light.color != vec3( 0.0 ) ); 715 } else { 716 light.color = vec3( 0.0 ); 717 light.visible = false; 718 } 719 } 720#endif 721#if NUM_RECT_AREA_LIGHTS > 0 722 struct RectAreaLight { 723 vec3 color; 724 vec3 position; 725 vec3 halfWidth; 726 vec3 halfHeight; 727 }; 728 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 729 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 730#endif 731#if NUM_HEMI_LIGHTS > 0 732 struct HemisphereLight { 733 vec3 direction; 734 vec3 skyColor; 735 vec3 groundColor; 736 }; 737 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 738 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 739 float dotNL = dot( normal, hemiLight.direction ); 740 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 741 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 742 return irradiance; 743 } 744#endif`,ZL=`#ifdef USE_ENVMAP 745 vec3 getIBLIrradiance( const in vec3 normal ) { 746 #ifdef ENVMAP_TYPE_CUBE_UV 747 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 748 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 749 return PI * envMapColor.rgb * envMapIntensity; 750 #else 751 return vec3( 0.0 ); 752 #endif 753 } 754 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 755 #ifdef ENVMAP_TYPE_CUBE_UV 756 vec3 reflectVec = reflect( - viewDir, normal ); 757 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); 758 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 759 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 760 return envMapColor.rgb * envMapIntensity; 761 #else 762 return vec3( 0.0 ); 763 #endif 764 } 765 #ifdef USE_ANISOTROPY 766 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 767 #ifdef ENVMAP_TYPE_CUBE_UV 768 vec3 bentNormal = cross( bitangent, viewDir ); 769 bentNormal = normalize( cross( bentNormal, bitangent ) ); 770 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 771 return getIBLRadiance( viewDir, bentNormal, roughness ); 772 #else 773 return vec3( 0.0 ); 774 #endif 775 } 776 #endif 777#endif`,JL=`ToonMaterial material; 778material.diffuseColor = diffuseColor.rgb;`,eI=`varying vec3 vViewPosition; 779struct ToonMaterial { 780 vec3 diffuseColor; 781}; 782void 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 ) { 783 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 784 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 785} 786void 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 ) { 787 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 788} 789#define RE_Direct RE_Direct_Toon 790#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,tI=`BlinnPhongMaterial material; 791material.diffuseColor = diffuseColor.rgb; 792material.specularColor = specular; 793material.specularShininess = shininess; 794material.specularStrength = specularStrength;`,nI=`varying vec3 vViewPosition; 795struct BlinnPhongMaterial { 796 vec3 diffuseColor; 797 vec3 specularColor; 798 float specularShininess; 799 float specularStrength; 800}; 801void 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 ) {
802 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 803 vec3 irradiance = dotNL * directLight.color; 804 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 805 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 806} 807void 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 ) { 808 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 809} 810#define RE_Direct RE_Direct_BlinnPhong 811#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,iI=`PhysicalMaterial material; 812material.diffuseColor = diffuseColor.rgb; 813material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 814material.metalness = metalnessFactor; 815vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 816float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 817material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 818material.roughness = min( material.roughness, 1.0 ); 819#ifdef IOR 820 material.ior = ior; 821 #ifdef USE_SPECULAR 822 float specularIntensityFactor = specularIntensity; 823 vec3 specularColorFactor = specularColor; 824 #ifdef USE_SPECULAR_COLORMAP 825 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 826 #endif 827 #ifdef USE_SPECULAR_INTENSITYMAP 828 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 829 #endif 830 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 831 #else 832 float specularIntensityFactor = 1.0; 833 vec3 specularColorFactor = vec3( 1.0 ); 834 material.specularF90 = 1.0; 835 #endif 836 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 837 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 838#else 839 material.specularColor = vec3( 0.04 ); 840 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 841 material.specularF90 = 1.0; 842#endif 843#ifdef USE_CLEARCOAT 844 material.clearcoat = clearcoat; 845 material.clearcoatRoughness = clearcoatRoughness; 846 material.clearcoatF0 = vec3( 0.04 ); 847 material.clearcoatF90 = 1.0; 848 #ifdef USE_CLEARCOATMAP 849 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 850 #endif 851 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 852 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 853 #endif 854 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 855 material.clearcoatRoughness += geometryRoughness; 856 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 857#endif 858#ifdef USE_DISPERSION 859 material.dispersion = dispersion; 860#endif 861#ifdef USE_IRIDESCENCE 862 material.iridescence = iridescence; 863 material.iridescenceIOR = iridescenceIOR; 864 #ifdef USE_IRIDESCENCEMAP 865 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 866 #endif 867 #ifdef USE_IRIDESCENCE_THICKNESSMAP 868 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 869 #else 870 material.iridescenceThickness = iridescenceThicknessMaximum; 871 #endif 872#endif 873#ifdef USE_SHEEN 874 material.sheenColor = sheenColor; 875 #ifdef USE_SHEEN_COLORMAP 876 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 877 #endif 878 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 879 #ifdef USE_SHEEN_ROUGHNESSMAP 880 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 881 #endif 882#endif 883#ifdef USE_ANISOTROPY 884 #ifdef USE_ANISOTROPYMAP 885 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 886 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 887 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 888 #else 889 vec2 anisotropyV = anisotropyVector; 890 #endif 891 material.anisotropy = length( anisotropyV ); 892 if( material.anisotropy == 0.0 ) { 893 anisotropyV = vec2( 1.0, 0.0 ); 894 } else { 895 anisotropyV /= material.anisotropy; 896 material.anisotropy = saturate( material.anisotropy ); 897 } 898 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
899 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 900 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 901#endif`,rI
vendor: 9,654 bytes, lines 901-1132
901=`uniform sampler2D dfgLUT; 902struct PhysicalMaterial { 903 vec3 diffuseColor; 904 vec3 diffuseContribution; 905 vec3 specularColor; 906 vec3 specularColorBlended; 907 float roughness; 908 float metalness; 909 float specularF90; 910 float dispersion; 911 #ifdef USE_CLEARCOAT 912 float clearcoat; 913 float clearcoatRoughness; 914 vec3 clearcoatF0; 915 float clearcoatF90; 916 #endif 917 #ifdef USE_IRIDESCENCE 918 float iridescence; 919 float iridescenceIOR; 920 float iridescenceThickness; 921 vec3 iridescenceFresnel; 922 vec3 iridescenceF0; 923 vec3 iridescenceFresnelDielectric; 924 vec3 iridescenceFresnelMetallic; 925 #endif 926 #ifdef USE_SHEEN 927 vec3 sheenColor; 928 float sheenRoughness; 929 #endif 930 #ifdef IOR 931 float ior; 932 #endif 933 #ifdef USE_TRANSMISSION 934 float transmission; 935 float transmissionAlpha; 936 float thickness; 937 float attenuationDistance; 938 vec3 attenuationColor; 939 #endif 940 #ifdef USE_ANISOTROPY 941 float anisotropy; 942 float alphaT; 943 vec3 anisotropyT; 944 vec3 anisotropyB; 945 #endif 946}; 947vec3 clearcoatSpecularDirect = vec3( 0.0 ); 948vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 949vec3 sheenSpecularDirect = vec3( 0.0 ); 950vec3 sheenSpecularIndirect = vec3(0.0 ); 951vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 952 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 953 float x2 = x * x; 954 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 955 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 956} 957float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 958 float a2 = pow2( alpha ); 959 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 960 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 961 return 0.5 / max( gv + gl, EPSILON ); 962} 963float D_GGX( const in float alpha, const in float dotNH ) { 964 float a2 = pow2( alpha ); 965 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 966 return RECIPROCAL_PI * a2 / pow2( denom ); 967} 968#ifdef USE_ANISOTROPY 969 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 ) { 970 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 971 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 972 float v = 0.5 / ( gv + gl ); 973 return v; 974 } 975 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 976 float a2 = alphaT * alphaB; 977 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 978 highp float v2 = dot( v, v ); 979 float w2 = a2 / v2; 980 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 981 } 982#endif 983#ifdef USE_CLEARCOAT 984 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 985 vec3 f0 = material.clearcoatF0; 986 float f90 = material.clearcoatF90; 987 float roughness = material.clearcoatRoughness; 988 float alpha = pow2( roughness ); 989 vec3 halfDir = normalize( lightDir + viewDir ); 990 float dotNL = saturate( dot( normal, lightDir ) ); 991 float dotNV = saturate( dot( normal, viewDir ) ); 992 float dotNH = saturate( dot( normal, halfDir ) ); 993 float dotVH = saturate( dot( viewDir, halfDir ) ); 994 vec3 F = F_Schlick( f0, f90, dotVH ); 995 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 996 float D = D_GGX( alpha, dotNH ); 997 return F * ( V * D ); 998 } 999#endif 1000vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1001 vec3 f0 = material.specularColorBlended; 1002 float f90 = material.specularF90; 1003 float roughness = material.roughness; 1004 float alpha = pow2( roughness ); 1005 vec3 halfDir = normalize( lightDir + viewDir ); 1006 float dotNL = saturate( dot( normal, lightDir ) ); 1007 float dotNV = saturate( dot( normal, viewDir ) ); 1008 float dotNH = saturate( dot( normal, halfDir ) ); 1009 float dotVH = saturate( dot( viewDir, halfDir ) ); 1010 vec3 F = F_Schlick( f0, f90, dotVH ); 1011 #ifdef USE_IRIDESCENCE 1012 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1013 #endif 1014 #ifdef USE_ANISOTROPY 1015 float dotTL = dot( material.anisotropyT, lightDir ); 1016 float dotTV = dot( material.anisotropyT, viewDir ); 1017 float dotTH = dot( material.anisotropyT, halfDir ); 1018 float dotBL = dot( material.anisotropyB, lightDir ); 1019 float dotBV = dot( material.anisotropyB, viewDir ); 1020 float dotBH = dot( material.anisotropyB, halfDir ); 1021 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1022 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1023 #else 1024 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1025 float D = D_GGX( alpha, dotNH ); 1026 #endif 1027 return F * ( V * D ); 1028} 1029vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1030 const float LUT_SIZE = 64.0; 1031 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1032 const float LUT_BIAS = 0.5 / LUT_SIZE; 1033 float dotNV = saturate( dot( N, V ) ); 1034 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1035 uv = uv * LUT_SCALE + LUT_BIAS; 1036 return uv; 1037} 1038float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1039 float l = length( f ); 1040 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1041} 1042vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1043 float x = dot( v1, v2 ); 1044 float y = abs( x ); 1045 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1046 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1047 float v = a / b; 1048 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1049 return cross( v1, v2 ) * theta_sintheta; 1050} 1051vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1052 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1053 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1054 vec3 lightNormal = cross( v1, v2 ); 1055 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1056 vec3 T1, T2; 1057 T1 = normalize( V - N * dot( V, N ) ); 1058 T2 = - cross( N, T1 ); 1059 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 1060 vec3 coords[ 4 ]; 1061 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1062 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1063 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1064 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1065 coords[ 0 ] = normalize( coords[ 0 ] ); 1066 coords[ 1 ] = normalize( coords[ 1 ] ); 1067 coords[ 2 ] = normalize( coords[ 2 ] ); 1068 coords[ 3 ] = normalize( coords[ 3 ] ); 1069 vec3 vectorFormFactor = vec3( 0.0 ); 1070 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1071 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1072 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1073 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1074 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1075 return vec3( result ); 1076} 1077#if defined( USE_SHEEN ) 1078float D_Charlie( float roughness, float dotNH ) { 1079 float alpha = pow2( roughness ); 1080 float invAlpha = 1.0 / alpha; 1081 float cos2h = dotNH * dotNH; 1082 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1083 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1084} 1085float V_Neubelt( float dotNV, float dotNL ) { 1086 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1087} 1088vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1089 vec3 halfDir = normalize( lightDir + viewDir ); 1090 float dotNL = saturate( dot( normal, lightDir ) ); 1091 float dotNV = saturate( dot( normal, viewDir ) ); 1092 float dotNH = saturate( dot( normal, halfDir ) ); 1093 float D = D_Charlie( sheenRoughness, dotNH ); 1094 float V = V_Neubelt( dotNV, dotNL ); 1095 return sheenColor * ( D * V ); 1096} 1097#endif 1098float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1099 float dotNV = saturate( dot( normal, viewDir ) ); 1100 float r2 = roughness * roughness; 1101 float rInv = 1.0 / ( roughness + 0.1 ); 1102 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 1103 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 1104 float DG = exp( a * dotNV + b ); 1105 return saturate( DG ); 1106} 1107vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1108 float dotNV = saturate( dot( normal, viewDir ) ); 1109 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1110 return specularColor * fab.x + specularF90 * fab.y; 1111} 1112#ifdef USE_IRIDESCENCE 1113void 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 ) { 1114#else 1115void 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 ) { 1116#endif 1117 float dotNV = saturate( dot( normal, viewDir ) ); 1118 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1119 #ifdef USE_IRIDESCENCE 1120 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1121 #else 1122 vec3 Fr = specularColor; 1123 #endif 1124 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1125 float Ess = fab.x + fab.y; 1126 float Ems = 1.0 - Ess; 1127 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1128 singleScatter += FssEss; 1129 multiScatter += Fms * Ems; 1130} 1131vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1132 vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1133-1262
1133 float dotNL = saturate( dot( normal, lightDir ) ); 1134 float dotNV = saturate( dot( normal, viewDir ) ); 1135 vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; 1136 vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; 1137 vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; 1138 vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; 1139 float Ess_V = dfgV.x + dfgV.y; 1140 float Ess_L = dfgL.x + dfgL.y; 1141 float Ems_V = 1.0 - Ess_V; 1142 float Ems_L = 1.0 - Ess_L; 1143 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; 1144 vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); 1145 float compensationFactor = Ems_V * Ems_L; 1146 vec3 multiScatter = Fms * compensationFactor; 1147 return singleScatter + multiScatter; 1148} 1149#if NUM_RECT_AREA_LIGHTS > 0 1150 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 ) { 1151 vec3 normal = geometryNormal; 1152 vec3 viewDir = geometryViewDir; 1153 vec3 position = geometryPosition; 1154 vec3 lightPos = rectAreaLight.position; 1155 vec3 halfWidth = rectAreaLight.halfWidth; 1156 vec3 halfHeight = rectAreaLight.halfHeight; 1157 vec3 lightColor = rectAreaLight.color; 1158 float roughness = material.roughness; 1159 vec3 rectCoords[ 4 ]; 1160 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1161 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1162 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1163 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1164 vec4 t1 = texture2D( ltc_1, uv ); 1165 vec4 t2 = texture2D( ltc_2, uv ); 1166 mat3 mInv = mat3( 1167 vec3( t1.x, 0, t1.y ), 1168 vec3( 0, 1, 0 ), 1169 vec3( t1.z, 0, t1.w ) 1170 ); 1171 vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); 1172 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1173 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1174 #ifdef USE_CLEARCOAT 1175 vec3 Ncc = geometryClearcoatNormal; 1176 vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); 1177 vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); 1178 vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); 1179 mat3 mInvClearcoat = mat3( 1180 vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), 1181 vec3( 0, 1, 0 ), 1182 vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) 1183 ); 1184 vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; 1185 clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); 1186 #endif 1187 } 1188#endif 1189void 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 ) { 1190 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1191 vec3 irradiance = dotNL * directLight.color; 1192 #ifdef USE_CLEARCOAT 1193 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1194 vec3 ccIrradiance = dotNLcc * directLight.color; 1195 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1196 #endif 1197 #ifdef USE_SHEEN 1198 1199 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1200 1201 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1202 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 1203 1204 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 1205 1206 irradiance *= sheenEnergyComp; 1207 1208 #endif 1209 reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); 1210 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); 1211} 1212void 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 ) { 1213 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); 1214 #ifdef USE_SHEEN 1215 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1216 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1217 diffuse *= sheenEnergyComp; 1218 #endif 1219 reflectedLight.indirectDiffuse += diffuse; 1220} 1221void 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) { 1222 #ifdef USE_CLEARCOAT 1223 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1224 #endif 1225 #ifdef USE_SHEEN 1226 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 1227 #endif 1228 vec3 singleScatteringDielectric = vec3( 0.0 ); 1229 vec3 multiScatteringDielectric = vec3( 0.0 ); 1230 vec3 singleScatteringMetallic = vec3( 0.0 ); 1231 vec3 multiScatteringMetallic = vec3( 0.0 ); 1232 #ifdef USE_IRIDESCENCE 1233 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1234 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1235 #else 1236 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1237 computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1238 #endif 1239 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 1240 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 1241 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 1242 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 1243 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1244 vec3 indirectSpecular = radiance * singleScattering; 1245 indirectSpecular += multiScattering * cosineWeightedIrradiance; 1246 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 1247 #ifdef USE_SHEEN 1248 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1249 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1250 indirectSpecular *= sheenEnergyComp; 1251 indirectDiffuse *= sheenEnergyComp; 1252 #endif 1253 reflectedLight.indirectSpecular += indirectSpecular; 1254 reflectedLight.indirectDiffuse += indirectDiffuse; 1255} 1256#define RE_Direct RE_Direct_Physical 1257#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1258#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1259#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1260float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1261 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1262}`,
1262sI=` 1263vec3 geometryPosition = - vViewPosition; 1264vec3 geometryNormal = normal; 1265vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1266vec3 geometryClearcoatNormal = vec3( 0.0 ); 1267#ifdef USE_CLEARCOAT 1268 geometryClearcoatNormal = clearcoatNormal; 1269#endif 1270#ifdef USE_IRIDESCENCE 1271 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1272 if ( material.iridescenceThickness == 0.0 ) { 1273 material.iridescence = 0.0; 1274 } else { 1275 material.iridescence = saturate( material.iridescence ); 1276 } 1277 if ( material.iridescence > 0.0 ) { 1278 material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1279 material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 1280 material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); 1281 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1282 } 1283#endif 1284IncidentLight directLight; 1285#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1286 PointLight pointLight; 1287 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1288 PointLightShadow pointLightShadow; 1289 #endif 1290 #pragma unroll_loop_start 1291 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1292 pointLight = pointLights[ i ]; 1293 getPointLightInfo( pointLight, geometryPosition, directLight ); 1294 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 1295 pointLightShadow = pointLightShadows[ i ]; 1296 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1297 #endif 1298 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1299 } 1300 #pragma unroll_loop_end 1301#endif 1302#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1303 SpotLight spotLight; 1304 vec4 spotColor; 1305 vec3 spotLightCoord; 1306 bool inSpotLightMap; 1307 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1308 SpotLightShadow spotLightShadow; 1309 #endif 1310 #pragma unroll_loop_start 1311 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1312 spotLight = spotLights[ i ]; 1313 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1314 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1315 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1316 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1317 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1318 #else 1319 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1320 #endif 1321 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1322 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1323 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1324 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1325 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1326 #endif 1327 #undef SPOT_LIGHT_MAP_INDEX 1328 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1329 spotLightShadow = spotLightShadows[ i ]; 1330 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1331 #endif 1332 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1333 } 1334 #pragma unroll_loop_end 1335#endif 1336#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1337 DirectionalLight directionalLight; 1338 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1339 DirectionalLightShadow directionalLightShadow; 1340 #endif 1341 #pragma unroll_loop_start 1342 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1343 directionalLight = directionalLights[ i ]; 1344 getDirectionalLightInfo( directionalLight, directLight ); 1345 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1346 directionalLightShadow = directionalLightShadows[ i ]; 1347 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1348 #endif 1349 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1350 } 1351 #pragma unroll_loop_end 1352#endif 1353#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1354 RectAreaLight rectAreaLight; 1355 #pragma unroll_loop_start 1356 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1357 rectAreaLight = rectAreaLights[ i ]; 1358 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1359 } 1360 #pragma unroll_loop_end 1361#endif 1362#if defined( RE_IndirectDiffuse ) 1363 vec3 iblIrradiance = vec3( 0.0 ); 1364 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1365 #if defined( USE_LIGHT_PROBES ) 1366 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1367 #endif 1368 #if ( NUM_HEMI_LIGHTS > 0 ) 1369 #pragma unroll_loop_start 1370 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1371 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1372 } 1373 #pragma unroll_loop_end 1374 #endif 1375#endif 1376#if defined( RE_IndirectSpecular ) 1377 vec3 radiance = vec3( 0.0 ); 1378 vec3 clearcoatRadiance = vec3( 0.0 ); 1379#endif`,oI=`#if defined( RE_IndirectDiffuse ) 1380 #ifdef USE_LIGHTMAP 1381 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1382 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1383 irradiance += lightMapIrradiance; 1384 #endif 1385 #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) 1386 #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) 1387 iblIrradiance += getIBLIrradiance( geometryNormal ); 1388 #endif 1389 #endif 1390#endif 1391#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1392 #ifdef USE_ANISOTROPY 1393 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1394 #else 1395 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1396 #endif 1397 #ifdef USE_CLEARCOAT 1398 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1399 #endif 1400#endif`,aI=`#if defined( RE_IndirectDiffuse ) 1401 #if defined( LAMBERT ) || defined( PHONG ) 1402 irradiance += iblIrradiance; 1403 #endif 1404 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1405#endif 1406#if defined( RE_IndirectSpecular ) 1407 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1408#endif`,lI=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1409 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1410#endif`,uI=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1411 uniform float logDepthBufFC; 1412 varying float vFragDepth; 1413 varying float vIsPerspective; 1414#endif`,cI=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1415 varying float vFragDepth; 1416 varying float vIsPerspective; 1417#endif`,hI=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1418 vFragDepth = 1.0 + gl_Position.w; 1419 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1420#endif`,AI=`#ifdef USE_MAP 1421 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1422 #ifdef DECODE_VIDEO_TEXTURE 1423 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1424 #endif 1425 diffuseColor *= sampledDiffuseColor; 1426#endif`,fI=`#ifdef USE_MAP 1427 uniform sampler2D map; 1428#endif`,dI=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1429 #if defined( USE_POINTS_UV ) 1430 vec2 uv = vUv; 1431 #else 1432 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1433 #endif 1434#endif 1435#ifdef USE_MAP 1436 diffuseColor *= texture2D( map, uv ); 1437#endif 1438#ifdef USE_ALPHAMAP 1439 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1440#endif`,pI=`#if defined( USE_POINTS_UV ) 1441 varying vec2 vUv; 1442#else 1443 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1444 uniform mat3 uvTransform; 1445 #endif 1446#endif 1447#ifdef USE_MAP 1448 uniform sampler2D map; 1449#endif 1450#ifdef USE_ALPHAMAP 1451 uniform sampler2D alphaMap; 1452#endif`,mI=`float metalnessFactor = metalness; 1453#ifdef USE_METALNESSMAP 1454 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1455 metalnessFactor *= texelMetalness.b; 1456#endif`,gI=`#ifdef USE_METALNESSMAP 1457 uniform sampler2D metalnessMap; 1458#endif`,_I=`#ifdef USE_INSTANCING_MORPH 1459 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1460 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1461 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1462 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1463 } 1464#endif`,xI=`#if defined( USE_MORPHCOLORS ) 1465 vColor *= morphTargetBaseInfluence; 1466 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1467 #if defined( USE_COLOR_ALPHA ) 1468 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1469 #elif defined( USE_COLOR ) 1470 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1471 #endif 1472 } 1473#endif`,vI=`#ifdef USE_MORPHNORMALS 1474 objectNormal *= morphTargetBaseInfluence; 1475 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1476 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1477 } 1478#endif`,yI=`#ifdef USE_MORPHTARGETS 1479 #ifndef USE_INSTANCING_MORPH 1480 uniform float morphTargetBaseInfluence; 1481 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1482 #endif 1483 uniform sampler2DArray morphTargetsTexture; 1484 uniform ivec2 morphTargetsTextureSize; 1485 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1486 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1487 int y = texelIndex / morphTargetsTextureSize.x; 1488 int x = texelIndex - y * morphTargetsTextureSize.x; 1489 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1490 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1491 } 1492#endif`,bI=`#ifdef USE_MORPHTARGETS 1493 transformed *= morphTargetBaseInfluence; 1494 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1495 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1496 } 1497#endif`,SI=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1498#ifdef FLAT_SHADED 1499 vec3 fdx = dFdx( vViewPosition ); 1500 vec3 fdy = dFdy( vViewPosition ); 1501 vec3 normal = normalize( cross( fdx, fdy ) ); 1502#else 1503 vec3 normal = normalize( vNormal ); 1504 #ifdef DOUBLE_SIDED 1505 normal *= faceDirection; 1506 #endif 1507#endif 1508#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1509 #ifdef USE_TANGENT 1510 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1511 #else 1512 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1513 #if defined( USE_NORMALMAP ) 1514 vNormalMapUv 1515 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1516 vClearcoatNormalMapUv 1517 #else 1518 vUv 1519 #endif 1520 ); 1521 #endif 1522 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1523 tbn[0] *= faceDirection; 1524 tbn[1] *= faceDirection; 1525 #endif 1526#endif 1527#ifdef USE_CLEARCOAT_NORMALMAP 1528 #ifdef USE_TANGENT 1529 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1530 #else 1531 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1532 #endif 1533 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1534 tbn2[0] *= faceDirection; 1535 tbn2[1] *= faceDirection; 1536 #endif 1537#endif 1538vec3 nonPerturbedNormal = normal;`,TI=`#ifdef USE_NORMALMAP_OBJECTSPACE 1539 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1540 #ifdef FLIP_SIDED 1541 normal = - normal; 1542 #endif 1543 #ifdef DOUBLE_SIDED 1544 normal = normal * faceDirection; 1545 #endif 1546 normal = normalize( normalMatrix * normal ); 1547#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1548 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1549 mapN.xy *= normalScale; 1550 normal = normalize( tbn * mapN ); 1551#elif defined( USE_BUMPMAP )
1552 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1553#endif`,MI=`#ifndef FLAT_SHADED 1554 varying vec3 vNormal; 1555 #ifdef USE_TANGENT 1556 varying vec3 vTangent; 1557 varying vec3 vBitangent; 1558 #endif 1559#endif`,wI=`#ifndef FLAT_SHADED 1560 varying vec3 vNormal; 1561 #ifdef USE_TANGENT 1562 varying vec3 vTangent; 1563 varying vec3 vBitangent; 1564 #endif 1565#endif`,EI=`#ifndef FLAT_SHADED 1566 vNormal = normalize( transformedNormal ); 1567 #ifdef USE_TANGENT 1568 vTangent = normalize( transformedTangent ); 1569 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1570 #endif 1571#endif`,RI=`#ifdef USE_NORMALMAP 1572 uniform sampler2D normalMap; 1573 uniform vec2 normalScale; 1574#endif 1575#ifdef USE_NORMALMAP_OBJECTSPACE 1576 uniform mat3 normalMatrix; 1577#endif 1578#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1579 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1580 vec3 q0 = dFdx( eye_pos.xyz ); 1581 vec3 q1 = dFdy( eye_pos.xyz ); 1582 vec2 st0 = dFdx( uv.st ); 1583 vec2 st1 = dFdy( uv.st ); 1584 vec3 N = surf_norm; 1585 vec3 q1perp = cross( q1, N ); 1586 vec3 q0perp = cross( N, q0 ); 1587 vec3 T = q1perp * st0.x + q0perp * st1.x; 1588 vec3 B = q1perp * st0.y + q0perp * st1.y; 1589 float det = max( dot( T, T ), dot( B, B ) ); 1590 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1591 return mat3( T * scale, B * scale, N ); 1592 } 1593#endif`,CI=`#ifdef USE_CLEARCOAT 1594 vec3 clearcoatNormal = nonPerturbedNormal; 1595#endif`,NI=`#ifdef USE_CLEARCOAT_NORMALMAP 1596 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1597 clearcoatMapN.xy *= clearcoatNormalScale; 1598 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1599#endif`,PI=`#ifdef USE_CLEARCOATMAP 1600 uniform sampler2D clearcoatMap; 1601#endif 1602#ifdef USE_CLEARCOAT_NORMALMAP 1603 uniform sampler2D clearcoatNormalMap; 1604 uniform vec2 clearcoatNormalScale; 1605#endif 1606#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1607 uniform sampler2D clearcoatRoughnessMap; 1608#endif`,DI=`#ifdef USE_IRIDESCENCEMAP 1609 uniform sampler2D iridescenceMap; 1610#endif 1611#ifdef USE_IRIDESCENCE_THICKNESSMAP 1612 uniform sampler2D iridescenceThicknessMap; 1613#endif`,LI=`#ifdef OPAQUE 1614diffuseColor.a = 1.0; 1615#endif 1616#ifdef USE_TRANSMISSION 1617diffuseColor.a *= material.transmissionAlpha; 1618#endif 1619gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,II=`vec3 packNormalToRGB( const in vec3 normal ) { 1620 return normalize( normal ) * 0.5 + 0.5; 1621} 1622vec3 unpackRGBToNormal( const in vec3 rgb ) { 1623 return 2.0 * rgb.xyz - 1.0; 1624} 1625const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1626const float Inv255 = 1. / 255.; 1627const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1628const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1629const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1630const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1631vec4 packDepthToRGBA( const in float v ) { 1632 if( v <= 0.0 ) 1633 return vec4( 0., 0., 0., 0. ); 1634 if( v >= 1.0 ) 1635 return vec4( 1., 1., 1., 1. ); 1636 float vuf; 1637 float af = modf( v * PackFactors.a, vuf ); 1638 float bf = modf( vuf * ShiftRight8, vuf ); 1639 float gf = modf( vuf * ShiftRight8, vuf ); 1640 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1641} 1642vec3 packDepthToRGB( const in float v ) { 1643 if( v <= 0.0 ) 1644 return vec3( 0., 0., 0. ); 1645 if( v >= 1.0 ) 1646 return vec3( 1., 1., 1. ); 1647 float vuf; 1648 float bf = modf( v * PackFactors.b, vuf ); 1649 float gf = modf( vuf * ShiftRight8, vuf ); 1650 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1651} 1652vec2 packDepthToRG( const in float v ) { 1653 if( v <= 0.0 ) 1654 return vec2( 0., 0. ); 1655 if( v >= 1.0 ) 1656 return vec2( 1., 1. ); 1657 float vuf; 1658 float gf = modf( v * 256., vuf ); 1659 return vec2( vuf * Inv255, gf ); 1660} 1661float unpackRGBAToDepth( const in vec4 v ) { 1662 return dot( v, UnpackFactors4 ); 1663} 1664float unpackRGBToDepth( const in vec3 v ) { 1665 return dot( v, UnpackFactors3 ); 1666} 1667float unpackRGToDepth( const in vec2 v ) { 1668 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1669} 1670vec4 pack2HalfToRGBA( const in vec2 v ) {
1671 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1672 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1673} 1674vec2 unpackRGBATo2Half( const in vec4 v ) { 1675 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1676} 1677float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1678 return ( viewZ + near ) / ( near - far ); 1679} 1680float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1681 #ifdef USE_REVERSED_DEPTH_BUFFER 1682 1683 return depth * ( far - near ) - far; 1684 #else 1685 return depth * ( near - far ) - near; 1686 #endif 1687} 1688float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1689 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1690} 1691float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1692 1693 #ifdef USE_REVERSED_DEPTH_BUFFER 1694 return ( near * far ) / ( ( near - far ) * depth - near ); 1695 #else 1696 return ( near * far ) / ( ( far - near ) * depth - far ); 1697 #endif 1698}`,BI=`#ifdef PREMULTIPLIED_ALPHA 1699 gl_FragColor.rgb *= gl_FragColor.a; 1700#endif`,FI=`vec4 mvPosition = vec4( transformed, 1.0 ); 1701#ifdef USE_BATCHING 1702 mvPosition = batchingMatrix * mvPosition; 1703#endif 1704#ifdef USE_INSTANCING 1705 mvPosition = instanceMatrix * mvPosition; 1706#endif 1707mvPosition = modelViewMatrix * mvPosition; 1708gl_Position = projectionMatrix * mvPosition;`,UI=`#ifdef DITHERING 1709 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1710#endif`,OI=`#ifdef DITHERING 1711 vec3 dithering( vec3 color ) { 1712 float grid_position = rand( gl_FragCoord.xy ); 1713 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1714 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1715 return color + dither_shift_RGB; 1716 } 1717#endif`,kI=`float roughnessFactor = roughness; 1718#ifdef USE_ROUGHNESSMAP 1719 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1720 roughnessFactor *= texelRoughness.g; 1721#endif`,GI=`#ifdef USE_ROUGHNESSMAP 1722 uniform sampler2D roughnessMap; 1723#endif`,VI=`#if NUM_SPOT_LIGHT_COORDS > 0 1724 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1725#endif 1726#if NUM_SPOT_LIGHT_MAPS > 0 1727 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1728#endif 1729#ifdef USE_SHADOWMAP 1730 #if NUM_DIR_LIGHT_SHADOWS > 0 1731 #if defined( SHADOWMAP_TYPE_PCF ) 1732 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1733 #else 1734 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1735 #endif 1736 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1737 struct DirectionalLightShadow { 1738 float shadowIntensity; 1739 float shadowBias; 1740 float shadowNormalBias; 1741 float shadowRadius; 1742 vec2 shadowMapSize; 1743 }; 1744 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1745 #endif 1746 #if NUM_SPOT_LIGHT_SHADOWS > 0 1747 #if defined( SHADOWMAP_TYPE_PCF ) 1748 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1749 #else 1750 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1751 #endif 1752 struct SpotLightShadow { 1753 float shadowIntensity; 1754 float shadowBias; 1755 float shadowNormalBias; 1756 float shadowRadius; 1757 vec2 shadowMapSize; 1758 }; 1759 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1760 #endif 1761 #if NUM_POINT_LIGHT_SHADOWS > 0 1762 #if defined( SHADOWMAP_TYPE_PCF ) 1763 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1764 #elif defined( SHADOWMAP_TYPE_BASIC ) 1765 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1766 #endif 1767 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1768 struct PointLightShadow { 1769 float shadowIntensity; 1770 float shadowBias; 1771 float shadowNormalBias; 1772 float shadowRadius; 1773 vec2 shadowMapSize; 1774 float shadowCameraNear; 1775 float shadowCameraFar; 1776 }; 1777 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1778 #endif 1779 #if defined( SHADOWMAP_TYPE_PCF ) 1780 float interleavedGradientNoise( vec2 position ) { 1781 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 1782 } 1783 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 1784 const float goldenAngle = 2.399963229728653; 1785 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 1786 float theta = float( sampleIndex ) * goldenAngle + phi; 1787 return vec2( cos( theta ), sin( theta ) ) * r; 1788 } 1789 #endif 1790 #if defined( SHADOWMAP_TYPE_PCF ) 1791 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1792 float shadow = 1.0; 1793 shadowCoord.xyz /= shadowCoord.w; 1794 shadowCoord.z += shadowBias; 1795 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1796 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1797 if ( frustumTest ) { 1798 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1799 float radius = shadowRadius * texelSize.x; 1800 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1801 shadow = ( 1802 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 1803 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 1804 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 1805 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 1806 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 1807 ) * 0.2; 1808 } 1809 return mix( 1.0, shadow, shadowIntensity ); 1810 } 1811 #elif defined( SHADOWMAP_TYPE_VSM ) 1812 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1813 float shadow = 1.0; 1814 shadowCoord.xyz /= shadowCoord.w; 1815 #ifdef USE_REVERSED_DEPTH_BUFFER 1816 shadowCoord.z -= shadowBias; 1817 #else 1818 shadowCoord.z += shadowBias; 1819 #endif 1820 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1821 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1822 if ( frustumTest ) { 1823 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 1824 float mean = distribution.x; 1825 float variance = distribution.y * distribution.y; 1826 #ifdef USE_REVERSED_DEPTH_BUFFER 1827 float hard_shadow = step( mean, shadowCoord.z ); 1828 #else 1829 float hard_shadow = step( shadowCoord.z, mean ); 1830 #endif 1831 1832 if ( hard_shadow == 1.0 ) { 1833 shadow = 1.0; 1834 } else { 1835 variance = max( variance, 0.0000001 ); 1836 float d = shadowCoord.z - mean; 1837 float p_max = variance / ( variance + d * d ); 1838 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 1839 shadow = max( hard_shadow, p_max ); 1840 } 1841 } 1842 return mix( 1.0, shadow, shadowIntensity ); 1843 } 1844 #else 1845 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1846 float shadow = 1.0; 1847 shadowCoord.xyz /= shadowCoord.w; 1848 #ifdef USE_REVERSED_DEPTH_BUFFER 1849 shadowCoord.z -= shadowBias; 1850 #else 1851 shadowCoord.z += shadowBias; 1852 #endif 1853 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1854 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1855 if ( frustumTest ) { 1856 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 1857 #ifdef USE_REVERSED_DEPTH_BUFFER 1858 shadow = step( depth, shadowCoord.z ); 1859 #else 1860 shadow = step( shadowCoord.z, depth ); 1861 #endif 1862 } 1863 return mix( 1.0, shadow, shadowIntensity ); 1864 } 1865 #endif 1866 #if NUM_POINT_LIGHT_SHADOWS > 0 1867 #if defined( SHADOWMAP_TYPE_PCF ) 1868 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1869 float shadow = 1.0; 1870 vec3 lightToPosition = shadowCoord.xyz; 1871 vec3 bd3D = normalize( lightToPosition ); 1872 vec3 absVec = abs( lightToPosition ); 1873 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1874 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1875 #ifdef USE_REVERSED_DEPTH_BUFFER 1876 float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1877 dp -= shadowBias; 1878 #else 1879 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1880 dp += shadowBias; 1881 #endif 1882 float texelSize = shadowRadius / shadowMapSize.x; 1883 vec3 absDir = abs( bd3D ); 1884 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 1885 tangent = normalize( cross( bd3D, tangent ) ); 1886 vec3 bitangent = cross( bd3D, tangent ); 1887 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1888 vec2 sample0 = vogelDiskSample( 0, 5, phi ); 1889 vec2 sample1 = vogelDiskSample( 1, 5, phi ); 1890 vec2 sample2 = vogelDiskSample( 2, 5, phi ); 1891 vec2 sample3 = vogelDiskSample( 3, 5, phi ); 1892 vec2 sample4 = vogelDiskSample( 4, 5, phi ); 1893 shadow = ( 1894 texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + 1895 texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + 1896 texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + 1897 texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + 1898 texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) 1899 ) * 0.2; 1900 } 1901 return mix( 1.0, shadow, shadowIntensity ); 1902 } 1903 #elif defined( SHADOWMAP_TYPE_BASIC ) 1904 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1905 float shadow = 1.0; 1906 vec3 lightToPosition = shadowCoord.xyz; 1907 vec3 absVec = abs( lightToPosition ); 1908 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1909 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1910 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1911 dp += shadowBias; 1912 vec3 bd3D = normalize( lightToPosition ); 1913 float depth = textureCube( shadowMap, bd3D ).r; 1914 #ifdef USE_REVERSED_DEPTH_BUFFER 1915 depth = 1.0 - depth; 1916 #endif 1917 shadow = step( dp, depth ); 1918 } 1919 return mix( 1.0, shadow, shadowIntensity ); 1920 } 1921 #endif 1922 #endif 1923#endif`,qI=`#if NUM_SPOT_LIGHT_COORDS > 0 1924 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1925 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1926#endif 1927#ifdef USE_SHADOWMAP 1928 #if NUM_DIR_LIGHT_SHADOWS > 0 1929 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1930 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1931 struct DirectionalLightShadow { 1932 float shadowIntensity; 1933 float shadowBias; 1934 float shadowNormalBias; 1935 float shadowRadius; 1936 vec2 shadowMapSize; 1937 }; 1938 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1939 #endif 1940 #if NUM_SPOT_LIGHT_SHADOWS > 0 1941 struct SpotLightShadow { 1942 float shadowIntensity; 1943 float shadowBias; 1944 float shadowNormalBias; 1945 float shadowRadius; 1946 vec2 shadowMapSize; 1947 }; 1948 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1949 #endif 1950 #if NUM_POINT_LIGHT_SHADOWS > 0 1951 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1952 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1953 struct PointLightShadow { 1954 float shadowIntensity; 1955 float shadowBias; 1956 float shadowNormalBias; 1957 float shadowRadius; 1958 vec2 shadowMapSize; 1959 float shadowCameraNear; 1960 float shadowCameraFar; 1961 }; 1962 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1963 #endif 1964#endif`,zI=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1965 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1966 vec4 shadowWorldPosition; 1967#endif 1968#if defined( USE_SHADOWMAP ) 1969 #if NUM_DIR_LIGHT_SHADOWS > 0 1970 #pragma unroll_loop_start 1971 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1972 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1973 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1974 } 1975 #pragma unroll_loop_end 1976 #endif 1977 #if NUM_POINT_LIGHT_SHADOWS > 0 1978 #pragma unroll_loop_start 1979 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1980 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1981 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1982 } 1983 #pragma unroll_loop_end 1984 #endif 1985#endif
1986#if NUM_SPOT_LIGHT_COORDS > 0 1987 #pragma unroll_loop_start 1988 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1989 shadowWorldPosition = worldPosition; 1990 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1991 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1992 #endif 1993 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1994 } 1995 #pragma unroll_loop_end 1996#endif`,HI=`float getShadowMask() { 1997 float shadow = 1.0; 1998 #ifdef USE_SHADOWMAP 1999 #if NUM_DIR_LIGHT_SHADOWS > 0 2000 DirectionalLightShadow directionalLight; 2001 #pragma unroll_loop_start 2002 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2003 directionalLight = directionalLightShadows[ i ]; 2004 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2005 } 2006 #pragma unroll_loop_end 2007 #endif 2008 #if NUM_SPOT_LIGHT_SHADOWS > 0 2009 SpotLightShadow spotLight; 2010 #pragma unroll_loop_start 2011 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2012 spotLight = spotLightShadows[ i ]; 2013 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2014 } 2015 #pragma unroll_loop_end 2016 #endif 2017 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 2018 PointLightShadow pointLight; 2019 #pragma unroll_loop_start 2020 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2021 pointLight = pointLightShadows[ i ]; 2022 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2023 } 2024 #pragma unroll_loop_end 2025 #endif 2026 #endif 2027 return shadow; 2028}`,WI=`#ifdef USE_SKINNING 2029 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2030 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2031 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2032 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2033#endif`,$I=`#ifdef USE_SKINNING 2034 uniform mat4 bindMatrix; 2035 uniform mat4 bindMatrixInverse; 2036 uniform highp sampler2D boneTexture; 2037 mat4 getBoneMatrix( const in float i ) { 2038 int size = textureSize( boneTexture, 0 ).x; 2039 int j = int( i ) * 4; 2040 int x = j % size; 2041 int y = j / size; 2042 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2043 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2044 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2045 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2046 return mat4( v1, v2, v3, v4 ); 2047 } 2048#endif`,jI=`#ifdef USE_SKINNING 2049 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2050 vec4 skinned = vec4( 0.0 ); 2051 skinned += boneMatX * skinVertex * skinWeight.x; 2052 skinned += boneMatY * skinVertex * skinWeight.y; 2053 skinned += boneMatZ * skinVertex * skinWeight.z; 2054 skinned += boneMatW * skinVertex * skinWeight.w; 2055 transformed = ( bindMatrixInverse * skinned ).xyz; 2056#endif`,XI=`#ifdef USE_SKINNING 2057 mat4 skinMatrix = mat4( 0.0 ); 2058 skinMatrix += skinWeight.x * boneMatX; 2059 skinMatrix += skinWeight.y * boneMatY; 2060 skinMatrix += skinWeight.z * boneMatZ; 2061 skinMatrix += skinWeight.w * boneMatW; 2062 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2063 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2064 #ifdef USE_TANGENT 2065 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2066 #endif 2067#endif`,QI=`float specularStrength; 2068#ifdef USE_SPECULARMAP 2069 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2070 specularStrength = texelSpecular.r; 2071#else 2072 specularStrength = 1.0; 2073#endif`,YI=`#ifdef USE_SPECULARMAP 2074 uniform sampler2D specularMap; 2075#endif`,KI=`#if defined( TONE_MAPPING ) 2076 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2077#endif`,ZI=`#ifndef saturate 2078#define saturate( a ) clamp( a, 0.0, 1.0 ) 2079#endif 2080uniform float toneMappingExposure; 2081vec3 LinearToneMapping( vec3 color ) { 2082 return saturate( toneMappingExposure * color ); 2083} 2084vec3 ReinhardToneMapping( vec3 color ) { 2085 color *= toneMappingExposure; 2086 return saturate( color / ( vec3( 1.0 ) + color ) ); 2087} 2088vec3 CineonToneMapping( vec3 color ) { 2089 color *= toneMappingExposure; 2090 color = max( vec3( 0.0 ), color - 0.004 ); 2091 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2092} 2093vec3 RRTAndODTFit( vec3 v ) { 2094 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2095 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2096 return a / b; 2097} 2098vec3 ACESFilmicToneMapping( vec3 color ) { 2099 const mat3 ACESInputMat = mat3( 2100 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2101 vec3( 0.04823, 0.01566, 0.83777 ) 2102 ); 2103 const mat3 ACESOutputMat = mat3( 2104 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2105 vec3( -0.07367, -0.00605, 1.07602 ) 2106 ); 2107 color *= toneMappingExposure / 0.6; 2108 color = ACESInputMat * color; 2109 color = RRTAndODTFit( color ); 2110 color = ACESOutputMat * color; 2111 return saturate( color ); 2112} 2113const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2114 vec3( 1.6605, - 0.1246, - 0.0182 ), 2115 vec3( - 0.5876, 1.1329, - 0.1006 ), 2116 vec3( - 0.0728, - 0.0083, 1.1187 ) 2117); 2118const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2119 vec3( 0.6274, 0.0691, 0.0164 ), 2120 vec3( 0.3293, 0.9195, 0.0880 ), 2121 vec3( 0.0433, 0.0113, 0.8956 ) 2122); 2123vec3 agxDefaultContrastApprox( vec3 x ) { 2124 vec3 x2 = x * x; 2125 vec3 x4 = x2 * x2; 2126 return + 15.5 * x4 * x2 2127 - 40.14 * x4 * x 2128 + 31.96 * x4 2129 - 6.868 * x2 * x 2130 + 0.4298 * x2 2131 + 0.1191 * x 2132 - 0.00232; 2133} 2134vec3 AgXToneMapping( vec3 color ) { 2135 const mat3 AgXInsetMatrix = mat3( 2136 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2137 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2138 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2139 );
2140 const mat3 AgXOutsetMatrix = mat3( 2141 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2142 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2143 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2144 ); 2145 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2146 color *= toneMappingExposure; 2147 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2148 color = AgXInsetMatrix * color; 2149 color = max( color, 1e-10 ); color = log2( color ); 2150 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2151 color = clamp( color, 0.0, 1.0 ); 2152 color = agxDefaultContrastApprox( color ); 2153 color = AgXOutsetMatrix * color; 2154 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2155 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2156 color = clamp( color, 0.0, 1.0 ); 2157 return color; 2158} 2159vec3 NeutralToneMapping( vec3 color ) { 2160 const float StartCompression = 0.8 - 0.04; 2161 const float Desaturation = 0.15; 2162 color *= toneMappingExposure; 2163 float x = min( color.r, min( color.g, color.b ) ); 2164 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2165 color -= offset; 2166 float peak = max( color.r, max( color.g, color.b ) ); 2167 if ( peak < StartCompression ) return color; 2168 float d = 1. - StartCompression; 2169 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2170 color *= newPeak / peak; 2171 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2172 return mix( color, vec3( newPeak ), g ); 2173} 2174vec3 CustomToneMapping( vec3 color ) { return color; }`,JI=`#ifdef USE_TRANSMISSION 2175 material.transmission = transmission; 2176 material.transmissionAlpha = 1.0; 2177 material.thickness = thickness; 2178 material.attenuationDistance = attenuationDistance; 2179 material.attenuationColor = attenuationColor; 2180 #ifdef USE_TRANSMISSIONMAP 2181 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2182 #endif 2183 #ifdef USE_THICKNESSMAP 2184 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2185 #endif 2186 vec3 pos = vWorldPosition; 2187 vec3 v = normalize( cameraPosition - pos ); 2188 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2189 vec4 transmitted = getIBLVolumeRefraction( 2190 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, 2191 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2192 material.attenuationColor, material.attenuationDistance ); 2193 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2194 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2195#endif`,eB=`#ifdef USE_TRANSMISSION 2196 uniform float transmission; 2197 uniform float thickness; 2198 uniform float attenuationDistance; 2199 uniform vec3 attenuationColor; 2200 #ifdef USE_TRANSMISSIONMAP 2201 uniform sampler2D transmissionMap; 2202 #endif 2203 #ifdef USE_THICKNESSMAP 2204 uniform sampler2D thicknessMap; 2205 #endif 2206 uniform vec2 transmissionSamplerSize; 2207 uniform sampler2D transmissionSamplerMap; 2208 uniform mat4 modelMatrix; 2209 uniform mat4 projectionMatrix; 2210 varying vec3 vWorldPosition; 2211 float w0( float a ) { 2212 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2213 } 2214 float w1( float a ) { 2215 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2216 } 2217 float w2( float a ){ 2218 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2219 } 2220 float w3( float a ) { 2221 return ( 1.0 / 6.0 ) * ( a * a * a ); 2222 } 2223 float g0( float a ) { 2224 return w0( a ) + w1( a ); 2225 } 2226 float g1( float a ) { 2227 return w2( a ) + w3( a ); 2228 } 2229 float h0( float a ) { 2230 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2231 } 2232 float h1( float a ) { 2233 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2234 } 2235 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2236 uv = uv * texelSize.zw + 0.5; 2237 vec2 iuv = floor( uv ); 2238 vec2 fuv = fract( uv ); 2239 float g0x = g0( fuv.x ); 2240 float g1x = g1( fuv.x ); 2241 float h0x = h0( fuv.x ); 2242 float h1x = h1( fuv.x ); 2243 float h0y = h0( fuv.y ); 2244 float h1y = h1( fuv.y ); 2245 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2246 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2247 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2248 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2249 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2250 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2251 } 2252 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2253 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2254 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2255 vec2 fLodSizeInv = 1.0 / fLodSize; 2256 vec2 cLodSizeInv = 1.0 / cLodSize; 2257 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2258 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2259 return mix( fSample, cSample, fract( lod ) ); 2260 } 2261 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2262 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2263 vec3 modelScale; 2264 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2265 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2266 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2267 return normalize( refractionVector ) * thickness * modelScale; 2268 } 2269 float applyIorToRoughness( const in float roughness, const in float ior ) { 2270 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2271 } 2272 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2273 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2274 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2275 } 2276 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2277 if ( isinf( attenuationDistance ) ) { 2278 return vec3( 1.0 ); 2279 } else { 2280 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2281 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2282 } 2283 } 2284 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2285 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2286 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2287 const in vec3 attenuationColor, const in float attenuationDistance ) { 2288 vec4 transmittedLight; 2289 vec3 transmittance; 2290 #ifdef USE_DISPERSION 2291 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2292 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2293 for ( int i = 0; i < 3; i ++ ) { 2294 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2295 vec3 refractedRayExit = position + transmissionRay; 2296 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2297 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2298 refractionCoords += 1.0; 2299 refractionCoords /= 2.0; 2300 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2301 transmittedLight[ i ] = transmissionSample[ i ]; 2302 transmittedLight.a += transmissionSample.a; 2303 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2304 } 2305 transmittedLight.a /= 3.0; 2306 #else 2307 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2308 vec3 refractedRayExit = position + transmissionRay; 2309 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2310 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2311 refractionCoords += 1.0; 2312 refractionCoords /= 2.0; 2313 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2314 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2315 #endif 2316 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2317 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2318 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2319 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2320 } 2321#endif`,tB=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2322 varying vec2 vUv; 2323#endif 2324#ifdef USE_MAP 2325 varying vec2 vMapUv; 2326#endif 2327#ifdef USE_ALPHAMAP
2328 varying vec2 vAlphaMapUv; 2329#endif 2330#ifdef USE_LIGHTMAP 2331 varying vec2 vLightMapUv; 2332#endif 2333#ifdef USE_AOMAP 2334 varying vec2 vAoMapUv; 2335#endif 2336#ifdef USE_BUMPMAP 2337 varying vec2 vBumpMapUv; 2338#endif 2339#ifdef USE_NORMALMAP 2340 varying vec2 vNormalMapUv; 2341#endif 2342#ifdef USE_EMISSIVEMAP 2343 varying vec2 vEmissiveMapUv; 2344#endif 2345#ifdef USE_METALNESSMAP 2346 varying vec2 vMetalnessMapUv; 2347#endif 2348#ifdef USE_ROUGHNESSMAP 2349 varying vec2 vRoughnessMapUv; 2350#endif 2351#ifdef USE_ANISOTROPYMAP 2352 varying vec2 vAnisotropyMapUv; 2353#endif 2354#ifdef USE_CLEARCOATMAP 2355 varying vec2 vClearcoatMapUv; 2356#endif 2357#ifdef USE_CLEARCOAT_NORMALMAP 2358 varying vec2 vClearcoatNormalMapUv; 2359#endif 2360#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2361 varying vec2 vClearcoatRoughnessMapUv; 2362#endif 2363#ifdef USE_IRIDESCENCEMAP 2364 varying vec2 vIridescenceMapUv; 2365#endif 2366#ifdef USE_IRIDESCENCE_THICKNESSMAP 2367 varying vec2 vIridescenceThicknessMapUv; 2368#endif 2369#ifdef USE_SHEEN_COLORMAP 2370 varying vec2 vSheenColorMapUv; 2371#endif 2372#ifdef USE_SHEEN_ROUGHNESSMAP 2373 varying vec2 vSheenRoughnessMapUv; 2374#endif 2375#ifdef USE_SPECULARMAP 2376 varying vec2 vSpecularMapUv; 2377#endif 2378#ifdef USE_SPECULAR_COLORMAP 2379 varying vec2 vSpecularColorMapUv; 2380#endif 2381#ifdef USE_SPECULAR_INTENSITYMAP 2382 varying vec2 vSpecularIntensityMapUv; 2383#endif 2384#ifdef USE_TRANSMISSIONMAP 2385 uniform mat3 transmissionMapTransform; 2386 varying vec2 vTransmissionMapUv; 2387#endif 2388#ifdef USE_THICKNESSMAP 2389 uniform mat3 thicknessMapTransform; 2390 varying vec2 vThicknessMapUv; 2391#endif`,nB=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2392 varying vec2 vUv; 2393#endif 2394#ifdef USE_MAP 2395 uniform mat3 mapTransform; 2396 varying vec2 vMapUv; 2397#endif 2398#ifdef USE_ALPHAMAP 2399 uniform mat3 alphaMapTransform; 2400 varying vec2 vAlphaMapUv; 2401#endif 2402#ifdef USE_LIGHTMAP 2403 uniform mat3 lightMapTransform; 2404 varying vec2 vLightMapUv; 2405#endif 2406#ifdef USE_AOMAP 2407 uniform mat3 aoMapTransform; 2408 varying vec2 vAoMapUv; 2409#endif 2410#ifdef USE_BUMPMAP 2411 uniform mat3 bumpMapTransform; 2412 varying vec2 vBumpMapUv; 2413#endif 2414#ifdef USE_NORMALMAP 2415 uniform mat3 normalMapTransform; 2416 varying vec2 vNormalMapUv; 2417#endif 2418#ifdef USE_DISPLACEMENTMAP 2419 uniform mat3 displacementMapTransform; 2420 varying vec2 vDisplacementMapUv; 2421#endif 2422#ifdef USE_EMISSIVEMAP 2423 uniform mat3 emissiveMapTransform; 2424 varying vec2 vEmissiveMapUv; 2425#endif 2426#ifdef USE_METALNESSMAP 2427 uniform mat3 metalnessMapTransform; 2428 varying vec2 vMetalnessMapUv; 2429#endif 2430#ifdef USE_ROUGHNESSMAP 2431 uniform mat3 roughnessMapTransform; 2432 varying vec2 vRoughnessMapUv; 2433#endif 2434#ifdef USE_ANISOTROPYMAP 2435 uniform mat3 anisotropyMapTransform; 2436 varying vec2 vAnisotropyMapUv; 2437#endif 2438#ifdef USE_CLEARCOATMAP 2439 uniform mat3 clearcoatMapTransform; 2440 varying vec2 vClearcoatMapUv; 2441#endif 2442#ifdef USE_CLEARCOAT_NORMALMAP 2443 uniform mat3 clearcoatNormalMapTransform; 2444 varying vec2 vClearcoatNormalMapUv; 2445#endif 2446#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2447 uniform mat3 clearcoatRoughnessMapTransform; 2448 varying vec2 vClearcoatRoughnessMapUv; 2449#endif 2450#ifdef USE_SHEEN_COLORMAP 2451 uniform mat3 sheenColorMapTransform; 2452 varying vec2 vSheenColorMapUv; 2453#endif 2454#ifdef USE_SHEEN_ROUGHNESSMAP 2455 uniform mat3 sheenRoughnessMapTransform; 2456 varying vec2 vSheenRoughnessMapUv; 2457#endif 2458#ifdef USE_IRIDESCENCEMAP 2459 uniform mat3 iridescenceMapTransform; 2460 varying vec2 vIridescenceMapUv; 2461#endif 2462#ifdef USE_IRIDESCENCE_THICKNESSMAP 2463 uniform mat3 iridescenceThicknessMapTransform; 2464 varying vec2 vIridescenceThicknessMapUv; 2465#endif 2466#ifdef USE_SPECULARMAP 2467 uniform mat3 specularMapTransform; 2468 varying vec2 vSpecularMapUv; 2469#endif 2470#ifdef USE_SPECULAR_COLORMAP 2471 uniform mat3 specularColorMapTransform; 2472 varying vec2 vSpecularColorMapUv; 2473#endif 2474#ifdef USE_SPECULAR_INTENSITYMAP 2475 uniform mat3 specularIntensityMapTransform; 2476 varying vec2 vSpecularIntensityMapUv; 2477#endif 2478#ifdef USE_TRANSMISSIONMAP 2479 uniform mat3 transmissionMapTransform; 2480 varying vec2 vTransmissionMapUv; 2481#endif 2482#ifdef USE_THICKNESSMAP 2483 uniform mat3 thicknessMapTransform; 2484 varying vec2 vThicknessMapUv; 2485#endif`,iB=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2486 vUv = vec3( uv, 1 ).xy; 2487#endif 2488#ifdef USE_MAP 2489 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2490#endif 2491#ifdef USE_ALPHAMAP 2492 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2493#endif 2494#ifdef USE_LIGHTMAP 2495 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2496#endif 2497#ifdef USE_AOMAP 2498 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2499#endif 2500#ifdef USE_BUMPMAP 2501 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2502#endif 2503#ifdef USE_NORMALMAP 2504 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2505#endif 2506#ifdef USE_DISPLACEMENTMAP 2507 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2508#endif 2509#ifdef USE_EMISSIVEMAP 2510 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2511#endif 2512#ifdef USE_METALNESSMAP 2513 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2514#endif 2515#ifdef USE_ROUGHNESSMAP 2516 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2517#endif 2518#ifdef USE_ANISOTROPYMAP 2519 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2520#endif 2521#ifdef USE_CLEARCOATMAP 2522 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2523#endif 2524#ifdef USE_CLEARCOAT_NORMALMAP 2525 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2526#endif 2527#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2528 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2529#endif
2530#ifdef USE_IRIDESCENCEMAP 2531 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2532#endif 2533#ifdef USE_IRIDESCENCE_THICKNESSMAP 2534 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2535#endif 2536#ifdef USE_SHEEN_COLORMAP 2537 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2538#endif 2539#ifdef USE_SHEEN_ROUGHNESSMAP 2540 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2541#endif 2542#ifdef USE_SPECULARMAP 2543 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2544#endif 2545#ifdef USE_SPECULAR_COLORMAP 2546 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2547#endif 2548#ifdef USE_SPECULAR_INTENSITYMAP 2549 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2550#endif 2551#ifdef USE_TRANSMISSIONMAP 2552 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2553#endif 2554#ifdef USE_THICKNESSMAP 2555 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2556#endif`,rB=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2557 vec4 worldPosition = vec4( transformed, 1.0 ); 2558 #ifdef USE_BATCHING 2559 worldPosition = batchingMatrix * worldPosition; 2560 #endif 2561 #ifdef USE_INSTANCING 2562 worldPosition = instanceMatrix * worldPosition; 2563 #endif 2564 worldPosition = modelMatrix * worldPosition; 2565#endif`;const sB=`varying vec2 vUv; 2566uniform mat3 uvTransform; 2567void main() { 2568 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2569 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2570}`,oB=`uniform sampler2D t2D; 2571uniform float backgroundIntensity; 2572varying vec2 vUv; 2573void main() { 2574 vec4 texColor = texture2D( t2D, vUv ); 2575 #ifdef DECODE_VIDEO_TEXTURE 2576 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 ); 2577 #endif 2578 texColor.rgb *= backgroundIntensity; 2579 gl_FragColor = texColor; 2580 #include <tonemapping_fragment> 2581 #include <colorspace_fragment> 2582}`,aB=`varying vec3 vWorldDirection; 2583#include <common> 2584void main() { 2585 vWorldDirection = transformDirection( position, modelMatrix ); 2586 #include <begin_vertex> 2587 #include <project_vertex> 2588 gl_Position.z = gl_Position.w; 2589}`,lB=`#ifdef ENVMAP_TYPE_CUBE 2590 uniform samplerCube envMap; 2591#elif defined( ENVMAP_TYPE_CUBE_UV ) 2592 uniform sampler2D envMap; 2593#endif 2594uniform float flipEnvMap; 2595uniform float backgroundBlurriness; 2596uniform float backgroundIntensity; 2597uniform mat3 backgroundRotation; 2598varying vec3 vWorldDirection; 2599#include <cube_uv_reflection_fragment> 2600void main() { 2601 #ifdef ENVMAP_TYPE_CUBE 2602 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2603 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2604 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2605 #else 2606 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2607 #endif 2608 texColor.rgb *= backgroundIntensity; 2609 gl_FragColor = texColor; 2610 #include <tonemapping_fragment> 2611 #include <colorspace_fragment> 2612}`,uB=`varying vec3 vWorldDirection; 2613#include <common> 2614void main() { 2615 vWorldDirection = transformDirection( position, modelMatrix ); 2616 #include <begin_vertex> 2617 #include <project_vertex> 2618 gl_Position.z = gl_Position.w; 2619}`,cB=`uniform samplerCube tCube; 2620uniform float tFlip; 2621uniform float opacity; 2622varying vec3 vWorldDirection; 2623void main() { 2624 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2625 gl_FragColor = texColor; 2626 gl_FragColor.a *= opacity; 2627 #include <tonemapping_fragment> 2628 #include <colorspace_fragment> 2629}`,hB=`#include <common> 2630#include <batching_pars_vertex> 2631#include <uv_pars_vertex> 2632#include <displacementmap_pars_vertex> 2633#include <morphtarget_pars_vertex> 2634#include <skinning_pars_vertex> 2635#include <logdepthbuf_pars_vertex> 2636#include <clipping_planes_pars_vertex> 2637varying vec2 vHighPrecisionZW; 2638void main() { 2639 #include <uv_vertex> 2640 #include <batching_vertex> 2641 #include <skinbase_vertex> 2642 #include <morphinstance_vertex> 2643 #ifdef USE_DISPLACEMENTMAP 2644 #include <beginnormal_vertex> 2645 #include <morphnormal_vertex> 2646 #include <skinnormal_vertex> 2647 #endif 2648 #include <begin_vertex> 2649 #include <morphtarget_vertex> 2650 #include <skinning_vertex> 2651 #include <displacementmap_vertex> 2652 #include <project_vertex> 2653 #include <logdepthbuf_vertex> 2654 #include <clipping_planes_vertex> 2655 vHighPrecisionZW = gl_Position.zw; 2656}`,AB=`#if DEPTH_PACKING == 3200 2657 uniform float opacity; 2658#endif 2659#include <common> 2660#include <packing> 2661#include <uv_pars_fragment> 2662#include <map_pars_fragment> 2663#include <alphamap_pars_fragment> 2664#include <alphatest_pars_fragment> 2665#include <alphahash_pars_fragment> 2666#include <logdepthbuf_pars_fragment> 2667#include <clipping_planes_pars_fragment> 2668varying vec2 vHighPrecisionZW; 2669void main() { 2670 vec4 diffuseColor = vec4( 1.0 ); 2671 #include <clipping_planes_fragment> 2672 #if DEPTH_PACKING == 3200 2673 diffuseColor.a = opacity; 2674 #endif 2675 #include <map_fragment> 2676 #include <alphamap_fragment> 2677 #include <alphatest_fragment> 2678 #include <alphahash_fragment> 2679 #include <logdepthbuf_fragment> 2680 #ifdef USE_REVERSED_DEPTH_BUFFER 2681 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2682 #else 2683 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2684 #endif 2685 #if DEPTH_PACKING == 3200 2686 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2687 #elif DEPTH_PACKING == 3201 2688 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2689 #elif DEPTH_PACKING == 3202 2690 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2691 #elif DEPTH_PACKING == 3203 2692 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2693 #endif 2694}`,fB=`#define DISTANCE 2695varying vec3 vWorldPosition; 2696#include <common> 2697#include <batching_pars_vertex> 2698#include <uv_pars_vertex> 2699#include <displacementmap_pars_vertex> 2700#include <morphtarget_pars_vertex> 2701#include <skinning_pars_vertex> 2702#include <clipping_planes_pars_vertex> 2703void main() { 2704 #include <uv_vertex> 2705 #include <batching_vertex> 2706 #include <skinbase_vertex> 2707 #include <morphinstance_vertex> 2708 #ifdef USE_DISPLACEMENTMAP 2709 #include <beginnormal_vertex> 2710 #include <morphnormal_vertex> 2711 #include <skinnormal_vertex> 2712 #endif 2713 #include <begin_vertex> 2714 #include <morphtarget_vertex> 2715 #include <skinning_vertex> 2716 #include <displacementmap_vertex> 2717 #include <project_vertex> 2718 #include <worldpos_vertex> 2719 #include <clipping_planes_vertex> 2720 vWorldPosition = worldPosition.xyz; 2721}`,dB=`#define DISTANCE 2722uniform vec3 referencePosition; 2723uniform float nearDistance; 2724uniform float farDistance; 2725varying vec3 vWorldPosition; 2726#include <common> 2727#include <uv_pars_fragment> 2728#include <map_pars_fragment> 2729#include <alphamap_pars_fragment> 2730#include <alphatest_pars_fragment> 2731#include <alphahash_pars_fragment> 2732#include <clipping_planes_pars_fragment> 2733void main () { 2734 vec4 diffuseColor = vec4( 1.0 ); 2735 #include <clipping_planes_fragment> 2736 #include <map_fragment> 2737 #include <alphamap_fragment> 2738 #include <alphatest_fragment> 2739 #include <alphahash_fragment> 2740 float dist = length( vWorldPosition - referencePosition ); 2741 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2742 dist = saturate( dist ); 2743 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 2744}`,pB=`varying vec3 vWorldDirection; 2745#include <common> 2746void main() { 2747 vWorldDirection = transformDirection( position, modelMatrix ); 2748 #include <begin_vertex> 2749 #include <project_vertex> 2750}`,mB=`uniform sampler2D tEquirect; 2751varying vec3 vWorldDirection; 2752#include <common> 2753void main() { 2754 vec3 direction = normalize( vWorldDirection ); 2755 vec2 sampleUV = equirectUv( direction ); 2756 gl_FragColor = texture2D( tEquirect, sampleUV ); 2757 #include <tonemapping_fragment> 2758 #include <colorspace_fragment> 2759}`,gB=`uniform float scale; 2760attribute float lineDistance; 2761varying float vLineDistance; 2762#include <common> 2763#include <uv_pars_vertex> 2764#include <color_pars_vertex> 2765#include <fog_pars_vertex> 2766#include <morphtarget_pars_vertex> 2767#include <logdepthbuf_pars_vertex> 2768#include <clipping_planes_pars_vertex> 2769void main() { 2770 vLineDistance = scale * lineDistance; 2771 #include <uv_vertex> 2772 #include <color_vertex> 2773 #include <morphinstance_vertex> 2774 #include <morphcolor_vertex> 2775 #include <begin_vertex> 2776 #include <morphtarget_vertex> 2777 #include <project_vertex> 2778 #include <logdepthbuf_vertex> 2779 #include <clipping_planes_vertex> 2780 #include <fog_vertex> 2781}`,_B=`uniform vec3 diffuse; 2782uniform float opacity; 2783uniform float dashSize; 2784uniform float totalSize; 2785varying float vLineDistance; 2786#include <common> 2787#include <color_pars_fragment> 2788#include <uv_pars_fragment> 2789#include <map_pars_fragment> 2790#include <fog_pars_fragment> 2791#include <logdepthbuf_pars_fragment> 2792#include <clipping_planes_pars_fragment> 2793void main() { 2794 vec4 diffuseColor = vec4( diffuse, opacity ); 2795 #include <clipping_planes_fragment> 2796 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2797 discard; 2798 } 2799 vec3 outgoingLight = vec3( 0.0 ); 2800 #include <logdepthbuf_fragment> 2801 #include <map_fragment> 2802 #include <color_fragment> 2803 outgoingLight = diffuseColor.rgb; 2804 #include <opaque_fragment> 2805 #include <tonemapping_fragment> 2806 #include <colorspace_fragment> 2807 #include <fog_fragment> 2808 #include <premultiplied_alpha_fragment> 2809}`,xB=`#include <common> 2810#include <batching_pars_vertex> 2811#include <uv_pars_vertex> 2812#include <envmap_pars_vertex> 2813#include <color_pars_vertex> 2814#include <fog_pars_vertex> 2815#include <morphtarget_pars_vertex> 2816#include <skinning_pars_vertex> 2817#include <logdepthbuf_pars_vertex> 2818#include <clipping_planes_pars_vertex> 2819void main() { 2820 #include <uv_vertex> 2821 #include <color_vertex> 2822 #include <morphinstance_vertex> 2823 #include <morphcolor_vertex> 2824 #include <batching_vertex> 2825 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2826 #include <beginnormal_vertex> 2827 #include <morphnormal_vertex> 2828 #include <skinbase_vertex> 2829 #include <skinnormal_vertex> 2830 #include <defaultnormal_vertex> 2831 #endif 2832 #include <begin_vertex> 2833 #include <morphtarget_vertex> 2834 #include <skinning_vertex> 2835 #include <project_vertex> 2836 #include <logdepthbuf_vertex> 2837 #include <clipping_planes_vertex> 2838 #include <worldpos_vertex> 2839 #include <envmap_vertex> 2840 #include <fog_vertex> 2841}`,vB=`uniform vec3 diffuse; 2842uniform float opacity; 2843#ifndef FLAT_SHADED 2844 varying vec3 vNormal; 2845#endif 2846#include <common> 2847#include <dithering_pars_fragment> 2848#include <color_pars_fragment> 2849#include <uv_pars_fragment> 2850#include <map_pars_fragment> 2851#include <alphamap_pars_fragment> 2852#include <alphatest_pars_fragment> 2853#include <alphahash_pars_fragment> 2854#include <aomap_pars_fragment> 2855#include <lightmap_pars_fragment> 2856#include <envmap_common_pars_fragment> 2857#include <envmap_pars_fragment> 2858#include <fog_pars_fragment> 2859#include <specularmap_pars_fragment> 2860#include <logdepthbuf_pars_fragment> 2861#include <clipping_planes_pars_fragment> 2862void main() { 2863 vec4 diffuseColor = vec4( diffuse, opacity ); 2864 #include <clipping_planes_fragment> 2865 #include <logdepthbuf_fragment> 2866 #include <map_fragment> 2867 #include <color_fragment> 2868 #include <alphamap_fragment> 2869 #include <alphatest_fragment> 2870 #include <alphahash_fragment> 2871 #include <specularmap_fragment> 2872 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2873 #ifdef USE_LIGHTMAP 2874 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2875 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2876 #else 2877 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2878 #endif 2879 #include <aomap_fragment> 2880 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2881 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2882 #include <envmap_fragment> 2883 #include <opaque_fragment> 2884 #include <tonemapping_fragment> 2885 #include <colorspace_fragment> 2886 #include <fog_fragment> 2887 #include <premultiplied_alpha_fragment> 2888 #include <dithering_fragment> 2889}`,yB=`#define LAMBERT 2890varying vec3 vViewPosition; 2891#include <common> 2892#include <batching_pars_vertex> 2893#include <uv_pars_vertex> 2894#include <displacementmap_pars_vertex> 2895#include <envmap_pars_vertex> 2896#include <color_pars_vertex> 2897#include <fog_pars_vertex> 2898#include <normal_pars_vertex> 2899#include <morphtarget_pars_vertex> 2900#include <skinning_pars_vertex> 2901#include <shadowmap_pars_vertex> 2902#include <logdepthbuf_pars_vertex> 2903#include <clipping_planes_pars_vertex> 2904void main() { 2905 #include <uv_vertex> 2906 #include <color_vertex> 2907 #include <morphinstance_vertex> 2908 #include <morphcolor_vertex> 2909 #include <batching_vertex> 2910 #include <beginnormal_vertex> 2911 #include <morphnormal_vertex> 2912 #include <skinbase_vertex> 2913 #include <skinnormal_vertex> 2914 #include <defaultnormal_vertex> 2915 #include <normal_vertex> 2916 #include <begin_vertex> 2917 #include <morphtarget_vertex> 2918 #include <skinning_vertex> 2919 #include <displacementmap_vertex> 2920 #include <project_vertex> 2921 #include <logdepthbuf_vertex> 2922 #include <clipping_planes_vertex> 2923 vViewPosition = - mvPosition.xyz; 2924 #include <worldpos_vertex> 2925 #include <envmap_vertex> 2926 #include <shadowmap_vertex> 2927 #include <fog_vertex> 2928}`,bB=`#define LAMBERT 2929uniform vec3 diffuse; 2930uniform vec3 emissive; 2931uniform float opacity; 2932#include <common> 2933#include <dithering_pars_fragment> 2934#include <color_pars_fragment> 2935#include <uv_pars_fragment> 2936#include <map_pars_fragment> 2937#include <alphamap_pars_fragment> 2938#include <alphatest_pars_fragment> 2939#include <alphahash_pars_fragment> 2940#include <aomap_pars_fragment> 2941#include <lightmap_pars_fragment> 2942#include <emissivemap_pars_fragment> 2943#include <cube_uv_reflection_fragment> 2944#include <envmap_common_pars_fragment> 2945#include <envmap_pars_fragment> 2946#include <envmap_physical_pars_fragment> 2947#include <fog_pars_fragment> 2948#include <bsdfs> 2949#include <lights_pars_begin> 2950#include <normal_pars_fragment> 2951#include <lights_lambert_pars_fragment> 2952#include <shadowmap_pars_fragment> 2953#include <bumpmap_pars_fragment> 2954#include <normalmap_pars_fragment> 2955#include <specularmap_pars_fragment> 2956#include <logdepthbuf_pars_fragment> 2957#include <clipping_planes_pars_fragment> 2958void main() { 2959 vec4 diffuseColor = vec4( diffuse, opacity ); 2960 #include <clipping_planes_fragment> 2961 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2962 vec3 totalEmissiveRadiance = emissive; 2963 #include <logdepthbuf_fragment> 2964 #include <map_fragment> 2965 #include <color_fragment> 2966 #include <alphamap_fragment> 2967 #include <alphatest_fragment> 2968 #include <alphahash_fragment> 2969 #include <specularmap_fragment> 2970 #include <normal_fragment_begin> 2971 #include <normal_fragment_maps> 2972 #include <emissivemap_fragment> 2973 #include <lights_lambert_fragment> 2974 #include <lights_fragment_begin> 2975 #include <lights_fragment_maps> 2976 #include <lights_fragment_end> 2977 #include <aomap_fragment> 2978 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2979 #include <envmap_fragment> 2980 #include <opaque_fragment> 2981 #include <tonemapping_fragment> 2982 #include <colorspace_fragment> 2983 #include <fog_fragment> 2984 #include <premultiplied_alpha_fragment> 2985 #include <dithering_fragment> 2986}`,SB=`#define MATCAP 2987varying vec3 vViewPosition; 2988#include <common> 2989#include <batching_pars_vertex> 2990#include <uv_pars_vertex> 2991#include <color_pars_vertex> 2992#include <displacementmap_pars_vertex> 2993#include <fog_pars_vertex> 2994#include <normal_pars_vertex> 2995#include <morphtarget_pars_vertex> 2996#include <skinning_pars_vertex> 2997#include <logdepthbuf_pars_vertex> 2998#include <clipping_planes_pars_vertex> 2999void main() { 3000 #include <uv_vertex> 3001 #include <color_vertex> 3002 #include <morphinstance_vertex> 3003 #include <morphcolor_vertex> 3004 #include <batching_vertex> 3005 #include <beginnormal_vertex> 3006 #include <morphnormal_vertex> 3007 #include <skinbase_vertex> 3008 #include <skinnormal_vertex> 3009 #include <defaultnormal_vertex> 3010 #include <normal_vertex> 3011 #include <begin_vertex> 3012 #include <morphtarget_vertex> 3013 #include <skinning_vertex> 3014 #include <displacementmap_vertex> 3015 #include <project_vertex> 3016 #include <logdepthbuf_vertex> 3017 #include <clipping_planes_vertex> 3018 #include <fog_vertex> 3019 vViewPosition = - mvPosition.xyz; 3020}`,TB=`#define MATCAP 3021uniform vec3 diffuse; 3022uniform float opacity; 3023uniform sampler2D matcap; 3024varying vec3 vViewPosition; 3025#include <common> 3026#include <dithering_pars_fragment> 3027#include <color_pars_fragment> 3028#include <uv_pars_fragment> 3029#include <map_pars_fragment> 3030#include <alphamap_pars_fragment> 3031#include <alphatest_pars_fragment> 3032#include <alphahash_pars_fragment> 3033#include <fog_pars_fragment> 3034#include <normal_pars_fragm
3034ent> 3035#include <bumpmap_pars_fragment> 3036#include <normalmap_pars_fragment> 3037#include <logdepthbuf_pars_fragment> 3038#include <clipping_planes_pars_fragment> 3039void main() { 3040 vec4 diffuseColor = vec4( diffuse, opacity ); 3041 #include <clipping_planes_fragment> 3042 #include <logdepthbuf_fragment> 3043 #include <map_fragment> 3044 #include <color_fragment> 3045 #include <alphamap_fragment> 3046 #include <alphatest_fragment> 3047 #include <alphahash_fragment> 3048 #include <normal_fragment_begin> 3049 #include <normal_fragment_maps> 3050 vec3 viewDir = normalize( vViewPosition ); 3051 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3052 vec3 y = cross( viewDir, x ); 3053 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3054 #ifdef USE_MATCAP 3055 vec4 matcapColor = texture2D( matcap, uv ); 3056 #else 3057 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3058 #endif 3059 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3060 #include <opaque_fragment> 3061 #include <tonemapping_fragment> 3062 #include <colorspace_fragment> 3063 #include <fog_fragment> 3064 #include <premultiplied_alpha_fragment> 3065 #include <dithering_fragment> 3066}`,MB=`#define NORMAL 3067#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3068 varying vec3 vViewPosition; 3069#endif 3070#include <common> 3071#include <batching_pars_vertex> 3072#include <uv_pars_vertex> 3073#include <displacementmap_pars_vertex> 3074#include <normal_pars_vertex> 3075#include <morphtarget_pars_vertex> 3076#include <skinning_pars_vertex> 3077#include <logdepthbuf_pars_vertex> 3078#include <clipping_planes_pars_vertex> 3079void main() { 3080 #include <uv_vertex> 3081 #include <batching_vertex> 3082 #include <beginnormal_vertex> 3083 #include <morphinstance_vertex> 3084 #include <morphnormal_vertex> 3085 #include <skinbase_vertex> 3086 #include <skinnormal_vertex> 3087 #include <defaultnormal_vertex> 3088 #include <normal_vertex> 3089 #include <begin_vertex> 3090 #include <morphtarget_vertex> 3091 #include <skinning_vertex> 3092 #include <displacementmap_vertex> 3093 #include <project_vertex> 3094 #include <logdepthbuf_vertex> 3095 #include <clipping_planes_vertex> 3096#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3097 vViewPosition = - mvPosition.xyz; 3098#endif 3099}`,wB=`#define NORMAL 3100uniform float opacity; 3101#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3102 varying vec3 vViewPosition; 3103#endif 3104#include <uv_pars_fragment> 3105#include <normal_pars_fragment> 3106#include <bumpmap_pars_fragment> 3107#include <normalmap_pars_fragment> 3108#include <logdepthbuf_pars_fragment> 3109#include <clipping_planes_pars_fragment> 3110void main() { 3111 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3112 #include <clipping_planes_fragment> 3113 #include <logdepthbuf_fragment> 3114 #include <normal_fragment_begin> 3115 #include <normal_fragment_maps> 3116 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 3117 #ifdef OPAQUE 3118 gl_FragColor.a = 1.0; 3119 #endif 3120}`,EB=`#define PHONG 3121varying vec3 vViewPosition; 3122#include <common> 3123#include <batching_pars_vertex> 3124#include <uv_pars_vertex> 3125#include <displacementmap_pars_vertex> 3126#include <envmap_pars_vertex> 3127#include <color_pars_vertex> 3128#include <fog_pars_vertex> 3129#include <normal_pars_vertex> 3130#include <morphtarget_pars_vertex> 3131#include <skinning_pars_vertex> 3132#include <shadowmap_pars_vertex> 3133#include <logdepthbuf_pars_vertex> 3134#include <clipping_planes_pars_vertex> 3135void main() { 3136 #include <uv_vertex> 3137 #include <color_vertex> 3138 #include <morphcolor_vertex> 3139 #include <batching_vertex> 3140 #include <beginnormal_vertex> 3141 #include <morphinstance_vertex> 3142 #include <morphnormal_vertex> 3143 #include <skinbase_vertex> 3144 #include <skinnormal_vertex> 3145 #include <defaultnormal_vertex> 3146 #include <normal_vertex> 3147 #include <begin_vertex> 3148 #include <morphtarget_vertex> 3149 #include <skinning_vertex> 3150 #include <displacementmap_vertex> 3151 #include <project_vertex> 3152 #include <logdepthbuf_vertex> 3153 #include <clipping_planes_vertex> 3154 vViewPosition = - mvPosition.xyz; 3155 #include <worldpos_vertex> 3156 #include <envmap_vertex> 3157 #include <shadowmap_vertex> 3158 #include <fog_vertex> 3159}`,RB=`#define PHONG 3160uniform vec3 diffuse; 3161uniform vec3 emissive; 3162uniform vec3 specular; 3163uniform float shininess; 3164uniform float opacity; 3165#include <common> 3166#include <dithering_pars_fragment> 3167#include <color_pars_fragment> 3168#include <uv_pars_fragment> 3169#include <map_pars_fragment> 3170#include <alphamap_pars_fragment> 3171#include <alphatest_pars_fragment> 3172#include <alphahash_pars_fragment> 3173#include <aomap_pars_fragment> 3174#include <lightmap_pars_fragment> 3175#include <emissivemap_pars_fragment> 3176#include <cube_uv_reflection_fragment> 3177#include <envmap_common_pars_fragment> 3178#include <envmap_pars_fragment> 3179#include <envmap_physical_pars_fragment> 3180#include <fog_pars_fragment> 3181#include <bsdfs> 3182#include <lights_pars_begin> 3183#include <normal_pars_fragment> 3184#include <lights_phong_pars_fragment> 3185#include <shadowmap_pars_fragment> 3186#include <bumpmap_pars_fragment> 3187#include <normalmap_pars_fragment> 3188#include <specularmap_pars_fragment> 3189#include <logdepthbuf_pars_fragment> 3190#include <clipping_planes_pars_fragment> 3191void main() { 3192 vec4 diffuseColor = vec4( diffuse, opacity ); 3193 #include <clipping_planes_fragment> 3194 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3195 vec3 totalEmissiveRadiance = emissive; 3196 #include <logdepthbuf_fragment> 3197 #include <map_fragment> 3198 #include <color_fragment> 3199 #include <alphamap_fragment> 3200 #include <alphatest_fragment> 3201 #include <alphahash_fragment> 3202 #include <specularmap_fragment> 3203 #include <normal_fragment_begin> 3204 #include <normal_fragment_maps> 3205 #include <emissivemap_fragment> 3206 #include <lights_phong_fragment> 3207 #include <lights_fragment_begin> 3208 #include <lights_fragment_maps> 3209 #include <lights_fragment_end> 3210 #include <aomap_fragment> 3211 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3212 #include <envmap_fragment> 3213 #include <opaque_fragment> 3214 #include <tonemapping_fragment> 3215 #include <colorspace_fragment> 3216 #include <fog_fragment> 3217 #include <premultiplied_alpha_fragment> 3218 #include <dithering_fragment> 3219}`,CB=`#define STANDARD 3220varying vec3 vViewPosition; 3221#ifdef USE_TRANSMISSION 3222 varying vec3 vWorldPosition; 3223#endif 3224#include <common> 3225#include <batching_pars_vertex> 3226#include <uv_pars_vertex> 3227#include <displacementmap_pars_vertex> 3228#include <color_pars_vertex> 3229#include <fog_pars_vertex> 3230#include <normal_pars_vertex> 3231#include <morphtarget_pars_vertex> 3232#include <skinning_pars_vertex> 3233#include <shadowmap_pars_vertex> 3234#include <logdepthbuf_pars_vertex> 3235#include <clipping_planes_pars_vertex> 3236void main() { 3237 #include <uv_vertex> 3238 #include <color_vertex> 3239 #include <morphinstance_vertex> 3240 #include <morphcolor_vertex> 3241 #include <batching_vertex> 3242 #include <beginnormal_vertex> 3243 #include <morphnormal_vertex> 3244 #include <skinbase_vertex> 3245 #include <skinnormal_vertex> 3246 #include <defaultnormal_vertex> 3247 #include <normal_vertex> 3248 #include <begin_vertex> 3249 #include <morphtarget_vertex> 3250 #include <skinning_vertex> 3251 #include <displacementmap_vertex> 3252 #include <project_vertex> 3253 #include <logdepthbuf_vertex> 3254 #include <clipping_planes_vertex> 3255 vViewPosition = - mvPosition.xyz; 3256 #include <worldpos_vertex> 3257 #include <shadowmap_vertex> 3258 #include <fog_vertex> 3259#ifdef USE_TRANSMISSION 3260 vWorldPosition = worldPosition.xyz; 3261#endif 3262}`,NB=`#define STANDARD 3263#ifdef PHYSICAL 3264 #define IOR 3265 #define USE_SPECULAR 3266#endif 3267uniform vec3 diffuse; 3268uniform vec3 emissive; 3269uniform float roughness; 3270uniform float metalness; 3271uniform float opacity; 3272#ifdef IOR 3273 uniform float ior; 3274#endif 3275#ifdef USE_SPECULAR 3276 uniform float specularIntensity; 3277 uniform vec3 specularColor; 3278 #ifdef USE_SPECULAR_COLORMAP 3279 uniform sampler2D specularColorMap; 3280 #endif 3281 #ifdef USE_SPECULAR_INTENSITYMAP 3282 uniform sampler2D specularIntensityMap; 3283 #endif 3284#endif 3285#ifdef USE_CLEARCOAT 3286 uniform float clearcoat; 3287 uniform float clearcoatRoughness; 3288#endif 3289#ifdef USE_DISPERSION 3290 uniform float dispersion; 3291#endif
3292#ifdef USE_IRIDESCENCE 3293 uniform float iridescence; 3294 uniform float iridescenceIOR; 3295 uniform float iridescenceThicknessMinimum; 3296 uniform float iridescenceThicknessMaximum; 3297#endif 3298#ifdef USE_SHEEN 3299 uniform vec3 sheenColor; 3300 uniform float sheenRoughness; 3301 #ifdef USE_SHEEN_COLORMAP 3302 uniform sampler2D sheenColorMap; 3303 #endif 3304 #ifdef USE_SHEEN_ROUGHNESSMAP 3305 uniform sampler2D sheenRoughnessMap; 3306 #endif 3307#endif 3308#ifdef USE_ANISOTROPY 3309 uniform vec2 anisotropyVector; 3310 #ifdef USE_ANISOTROPYMAP 3311 uniform sampler2D anisotropyMap; 3312 #endif 3313#endif 3314varying vec3 vViewPosition; 3315#include <common> 3316#include <dithering_pars_fragment> 3317#include <color_pars_fragment> 3318#include <uv_pars_fragment> 3319#include <map_pars_fragment> 3320#include <alphamap_pars_fragment> 3321#include <alphatest_pars_fragment> 3322#include <alphahash_pars_fragment> 3323#include <aomap_pars_fragment> 3324#include <lightmap_pars_fragment> 3325#include <emissivemap_pars_fragment> 3326#include <iridescence_fragment> 3327#include <cube_uv_reflection_fragment> 3328#include <envmap_common_pars_fragment> 3329#include <envmap_physical_pars_fragment> 3330#include <fog_pars_fragment> 3331#include <lights_pars_begin> 3332#include <normal_pars_fragment> 3333#include <lights_physical_pars_fragment> 3334#include <transmission_pars_fragment> 3335#include <shadowmap_pars_fragment> 3336#include <bumpmap_pars_fragment> 3337#include <normalmap_pars_fragment> 3338#include <clearcoat_pars_fragment> 3339#include <iridescence_pars_fragment> 3340#include <roughnessmap_pars_fragment> 3341#include <metalnessmap_pars_fragment> 3342#include <logdepthbuf_pars_fragment> 3343#include <clipping_planes_pars_fragment> 3344void main() { 3345 vec4 diffuseColor = vec4( diffuse, opacity ); 3346 #include <clipping_planes_fragment> 3347 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3348 vec3 totalEmissiveRadiance = emissive; 3349 #include <logdepthbuf_fragment> 3350 #include <map_fragment> 3351 #include <color_fragment> 3352 #include <alphamap_fragment> 3353 #include <alphatest_fragment> 3354 #include <alphahash_fragment> 3355 #include <roughnessmap_fragment> 3356 #include <metalnessmap_fragment> 3357 #include <normal_fragment_begin> 3358 #include <normal_fragment_maps> 3359 #include <clearcoat_normal_fragment_begin> 3360 #include <clearcoat_normal_fragment_maps> 3361 #include <emissivemap_fragment> 3362 #include <lights_physical_fragment> 3363 #include <lights_fragment_begin> 3364 #include <lights_fragment_maps> 3365 #include <lights_fragment_end> 3366 #include <aomap_fragment> 3367 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3368 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3369 #include <transmission_fragment> 3370 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3371 #ifdef USE_SHEEN 3372 3373 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 3374 3375 #endif 3376 #ifdef USE_CLEARCOAT 3377 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3378 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3379 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3380 #endif 3381 #include <opaque_fragment> 3382 #include <tonemapping_fragment> 3383 #include <colorspace_fragment> 3384 #include <fog_fragment> 3385 #include <premultiplied_alpha_fragment> 3386 #include <dithering_fragment> 3387}`,PB=`#define TOON 3388varying vec3 vViewPosition; 3389#include <common> 3390#include <batching_pars_vertex> 3391#include <uv_pars_vertex> 3392#include <displacementmap_pars_vertex> 3393#include <color_pars_vertex> 3394#include <fog_pars_vertex> 3395#include <normal_pars_vertex> 3396#include <morphtarget_pars_vertex> 3397#include <skinning_pars_vertex> 3398#include <shadowmap_pars_vertex> 3399#include <logdepthbuf_pars_vertex> 3400#include <clipping_planes_pars_vertex> 3401void main() { 3402 #include <uv_vertex> 3403 #include <color_vertex> 3404 #include <morphinstance_vertex> 3405 #include <morphcolor_vertex> 3406 #include <batching_vertex> 3407 #include <beginnormal_vertex> 3408 #include <morphnormal_vertex> 3409 #include <skinbase_vertex> 3410 #include <skinnormal_vertex> 3411 #include <defaultnormal_vertex> 3412 #include <normal_vertex> 3413 #include <begin_vertex> 3414 #include <morphtarget_vertex> 3415 #include <skinning_vertex> 3416 #include <displacementmap_vertex> 3417 #include <project_vertex> 3418 #include <logdepthbuf_vertex> 3419 #include <clipping_planes_vertex> 3420 vViewPosition = - mvPosition.xyz; 3421 #include <worldpos_vertex> 3422 #include <shadowmap_vertex> 3423 #include <fog_vertex> 3424}`,DB=`#define TOON 3425uniform vec3 diffuse; 3426uniform vec3 emissive; 3427uniform float opacity; 3428#include <common> 3429#include <dithering_pars_fragment> 3430#include <color_pars_fragment> 3431#include <uv_pars_fragment> 3432#include <map_pars_fragment> 3433#include <alphamap_pars_fragment> 3434#include <alphatest_pars_fragment> 3435#include <alphahash_pars_fragment> 3436#include <aomap_pars_fragment> 3437#include <lightmap_pars_fragment> 3438#include <emissivemap_pars_fragment> 3439#include <gradientmap_pars_fragment> 3440#include <fog_pars_fragment> 3441#include <bsdfs> 3442#include <lights_pars_begin> 3443#include <normal_pars_fragment> 3444#include <lights_toon_pars_fragment> 3445#include <shadowmap_pars_fragment> 3446#include <bumpmap_pars_fragment> 3447#include <normalmap_pars_fragment> 3448#include <logdepthbuf_pars_fragment> 3449#include <clipping_planes_pars_fragment> 3450void main() { 3451 vec4 diffuseColor = vec4( diffuse, opacity ); 3452 #include <clipping_planes_fragment> 3453 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3454 vec3 totalEmissiveRadiance = emissive; 3455 #include <logdepthbuf_fragment> 3456 #include <map_fragment> 3457 #include <color_fragment> 3458 #include <alphamap_fragment> 3459 #include <alphatest_fragment> 3460 #include <alphahash_fragment> 3461 #include <normal_fragment_begin> 3462 #include <normal_fragment_maps> 3463 #include <emissivemap_fragment> 3464 #include <lights_toon_fragment> 3465 #include <lights_fragment_begin> 3466 #include <lights_fragment_maps> 3467 #include <lights_fragment_end> 3468 #include <aomap_fragment> 3469 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3470 #include <opaque_fragment> 3471 #include <tonemapping_fragment> 3472 #include <colorspace_fragment> 3473 #include <fog_fragment> 3474 #include <premultiplied_alpha_fragment> 3475 #include <dithering_fragment> 3476}`,LB=`uniform float size; 3477uniform float scale; 3478#include <common> 3479#include <color_pars_vertex> 3480#include <fog_pars_vertex> 3481#include <morphtarget_pars_vertex> 3482#include <logdepthbuf_pars_vertex> 3483#include <clipping_planes_pars_vertex> 3484#ifdef USE_POINTS_UV 3485 varying vec2 vUv; 3486 uniform mat3 uvTransform; 3487#endif 3488void main() { 3489 #ifdef USE_POINTS_UV 3490 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3491 #endif 3492 #include <color_vertex> 3493 #include <morphinstance_vertex> 3494 #include <morphcolor_vertex> 3495 #include <begin_vertex> 3496 #include <morphtarget_vertex> 3497 #include <project_vertex> 3498 gl_PointSize = size; 3499 #ifdef USE_SIZEATTENUATION 3500 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3501 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3502 #endif 3503 #include <logdepthbuf_vertex> 3504 #include <clipping_planes_vertex> 3505 #include <worldpos_vertex> 3506 #include <fog_vertex> 3507}`,IB=`uniform vec3 diffuse; 3508uniform float opacity; 3509#include <common> 3510#include <color_pars_fragment> 3511#include <map_particle_pars_fragment> 3512#include <alphatest_pars_fragment> 3513#include <alphahash_pars_fragment> 3514#include <fog_pars_fragment> 3515#include <logdepthbuf_pars_fragment> 3516#include <clipping_planes_pars_fragment> 3517void main() { 3518 vec4 diffuseColor = vec4( diffuse, opacity ); 3519 #include <clipping_planes_fragment> 3520 vec3 outgoingLight = vec3( 0.0 ); 3521 #include <logdepthbuf_fragment> 3522 #include <map_particle_fragment> 3523 #include <color_fragment> 3524 #include <alphatest_fragment> 3525 #include <alphahash_fragment> 3526 outgoingLight = diffuseColor.rgb; 3527 #include <opaque_fragment> 3528 #include <tonemapping_fragment> 3529 #include <colorspace_fragment> 3530 #include <fog_fragment> 3531 #include <premultiplied_alpha_fragment> 3532}`,BB=`#include <common> 3533#include <batching_pars_vertex> 3534#include <fog_pars_vertex> 3535#include <morphtarget_pars_vertex> 3536#include <skinning_pars_vertex> 3537#include <logdepthbuf_pars_vertex> 3538#include <shadowmap_pars_vertex> 3539void main() { 3540 #include <batching_vertex> 3541 #include <beginnormal_vertex> 3542 #include <morphinstance_vertex> 3543 #include <morphnormal_vertex> 3544 #include <skinbase_vertex> 3545 #include <skinnormal_vertex> 3546 #include <defaultnormal_vertex> 3547 #include <begin_vertex> 3548 #include <morphtarget_vertex> 3549 #include <skinning_vertex> 3550 #include <project_vertex> 3551 #include <logdepthbuf_vertex> 3552 #include <worldpos_vertex> 3553 #include <shadowmap_vertex> 3554 #include <fog_vertex> 3555}`,FB=`uniform vec3 color; 3556uniform float opacity; 3557#include <common> 3558#include <fog_pars_fragment> 3559#include <bsdfs> 3560#include <lights_pars_begin> 3561#include <logdepthbuf_pars_fragment> 3562#include <shadowmap_pars_fragment> 3563#include <shadowmask_pars_fragment> 3564void main() { 3565 #include <logdepthbuf_fragment> 3566 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3567 #include <tonemapping_fragment> 3568 #include <colorspace_fragment> 3569 #include <fog_fragment> 3570 #include <premultiplied_alpha_fragment> 3571}`,UB=`uniform float rotation; 3572uniform vec2 center; 3573#include <common> 3574#include <uv_pars_vertex> 3575#include <fog_pars_vertex> 3576#include <logdepthbuf_pars_vertex> 3577#include <clipping_planes_pars_vertex> 3578void main() { 3579 #include <uv_vertex> 3580 vec4 mvPosition = modelViewMatrix[ 3 ]; 3581 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3582 #ifndef USE_SIZEATTENUATION 3583 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3584 if ( isPerspective ) scale *= - mvPosition.z; 3585 #endif 3586 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3587 vec2 rotatedPosition; 3588 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3589 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3590 mvPosition.xy += rotatedPosition; 3591 gl_Position = projectionMatrix * mvPosition; 3592 #include <logdepthbuf_vertex> 3593 #include <clipping_planes_vertex> 3594 #include <fog_vertex> 3595}`,OB=`uniform vec3 diffuse; 3596uniform float opacity; 3597#include <common> 3598#include <uv_pars_fragment> 3599#include <map_pars_fragment> 3600#include <alphamap_pars_fragment> 3601#include <alphatest_pars_fragment> 3602#include <alphahash_pars_fragment> 3603#include <fog_pars_fragment> 3604#include <logdepthbuf_pars_fragment> 3605#include <clipping_planes_pars_fragment> 3606void main() { 3607 vec4 diffuseColor = vec4( diffuse, opacity ); 3608 #include <clipping_planes_fragment> 3609 vec3 outgoingLight = vec3( 0.0 ); 3610 #include <logdepthbuf_fragment> 3611 #include <map_fragment> 3612 #include <alphamap_fragment> 3613 #include <alphatest_fragment> 3614 #include <alphahash_fragment> 3615 outgoingLight = diffuseColor.rgb; 3616 #include <opaque_fragment> 3617 #include <tonemapping_fragment> 3618 #include <colorspace_fragment> 3619 #include <fog_fragment> 3620}`,_n={alphahash_fragment:oL,alphahash_pars_fragment:aL,alphamap_fragment:lL,alphamap_pars_fragment:uL,alphatest_fragment:cL,alphatest_pars_fragment:hL,aomap_fragment:AL,aomap_pars_fragment:fL,batching_pars_vertex:dL,batching_vertex:pL,begin_vertex:mL,beginnormal_vertex:gL,bsdfs:_L,iridescence_fragment:xL,bumpmap_pars_fragment:vL,clipping_planes_fragment:yL,clipping_planes_pars_fragment:bL,clipping_planes_pars_vertex:SL,clipping_planes_vertex:TL,color_fragment:ML,color_pars_fragment:wL,color_pars_vertex:EL,color_vertex:RL,common:CL,cube_uv_reflection_fragment:NL,defaultnormal_vertex:PL,displacementmap_pars_vertex:DL,displacementmap_vertex:LL,emissivemap_fragment:IL,emissivemap_pars_fragment:BL,colorspace_fragment:FL,colorspace_pars_fragment:UL,envmap_fragment:OL,envmap_common_pars_fragment:kL,envmap_pars_fragment:GL,envmap_pars_vertex:VL,envmap_physical_pars_fragment:ZL,envmap_vertex:qL,fog_vertex:zL,fog_pars_vertex:HL,fog_fragment:WL,fog_pars_fragment:$L,gradientmap_pars_fragment:jL,lightmap_pars_fragment:XL,lights_lambert_fragment:QL,lights_lambert_pars_fragment:YL,lights_pars_begin:KL,lights_toon_fragment:JL,lights_toon_pars_fragment:eI,lights_phong_fragment:tI,lights_phong_pars_fragment:nI,lights_physical_fragment:iI,lights_physical_pars_fragment:rI,lights_fragment_begin:sI,lights_fragment_maps:oI,lights_fragment_end:aI,logdepthbuf_fragment:lI,logdepthbuf_pars_fragment:uI,logdepthbuf_pars_vertex:cI,logdepthbuf_vertex:hI,map_fragment:AI,map_pars_fragment:fI,map_particle_fragment:dI,map_particle_pars_fragment:pI,metalnessmap_fragment:mI,metalnessmap_pars_fragment:gI,morphinstance_vertex:_I,morphcolor_vertex:xI,morphnormal_vertex:vI,morphtarget_pars_vertex:yI,morphtarget_vertex:bI,normal_fragment_begin:SI,normal_fragment_maps:TI,normal_pars_fragment:MI,normal_pars_vertex:wI,normal_vertex:EI,normalmap_pars_fragment:RI,clearcoat_normal_fragment_begin:CI,clearcoat_normal_fragment_maps:NI,clearcoat_pars_fragment:PI,iridescence_pars_fragment:DI,opaque_fragment:LI,packing:II,premultiplied_alpha_fragment:BI,project_vertex:FI,dithering_fragment:UI,dithering_pars_fragment:OI,roughnessmap_fragment:kI,roughnessmap_pars_fragment:GI,shadowmap_pars_fragment:VI,shadowmap_pars_vertex:qI,shadowmap_vertex:zI,shadowmask_pars_fragment:HI,skinbase_vertex:WI,skinning_pars_vertex:$I,skinning_vertex:jI,skinnormal_vertex:XI,specularmap_fragment:QI,specularmap_pars_fragment:YI,tonemapping_fragment:KI,tonemapping_pars_fragment:ZI,transmission_fragment:JI,transmission_pars_fragment:eB,uv_pars_fragment:tB,uv_pars_vertex:nB,uv_vertex:iB,worldpos_vertex:rB,background_vert:sB,background_frag:oB,backgroundCube_vert:aB,backgroundCube_frag:lB,cube_vert:uB,cube_frag:cB,depth_vert:hB,depth_frag:AB,distance_vert:fB,distance_frag:dB,equirect_vert:pB,equirect_frag:mB,linedashed_vert:gB,linedashed_frag:_B,meshbasic_vert:xB,meshbasic_frag:vB,meshlambert_vert:yB,meshlambert_frag:bB,meshmatcap_vert:SB,meshmatcap_frag:TB,meshnormal_vert:MB,meshnormal_frag:wB,meshphong_vert:EB,meshphong_frag:RB,meshphysical_vert:CB,meshphysical_frag:NB,meshtoon_vert:PB,meshtoon_frag:DB,points_vert:LB,points_frag:IB,shadow_vert:BB,shadow_frag:FB,sprite_vert:UB,sprite_frag:OB},pt={common:{diffuse:{value:new It(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new pn},alphaMap:{value:null},alphaMapTransform:{value:new pn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new pn}},envmap:{envMap:{value:null},envMapRotation:{value:new pn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new pn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new pn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new pn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new pn},normalScale:{value:new We(1,1)}}
vendor: 6,715 bytes, line 3620
3620,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new pn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new pn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new pn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new pn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new It(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},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 It(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new pn},alphaTest:{value:0},uvTransform:{value:new pn}},sprite:{diffuse:{value:new It(16777215)},opacity:{value:1},center:{value:new We(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new pn},alphaMap:{value:null},alphaMapTransform:{value:new pn},alphaTest:{value:0}}},gs={basic:{uniforms:Zr([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.fog]),vertexShader:_n.meshbasic_vert,fragmentShader:_n.meshbasic_frag},lambert:{uniforms:Zr([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new It(0)},envMapIntensity:{value:1}}]),vertexShader:_n.meshlambert_vert,fragmentShader:_n.meshlambert_frag},phong:{uniforms:Zr([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new It(0)},specular:{value:new It(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:_n.meshphong_vert,fragmentShader:_n.meshphong_frag},standard:{uniforms:Zr([pt.common,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.roughnessmap,pt.metalnessmap,pt.fog,pt.lights,{emissive:{value:new It(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_n.meshphysical_vert,fragmentShader:_n.meshphysical_frag},toon:{uniforms:Zr([pt.common,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.gradientmap,pt.fog,pt.lights,{emissive:{value:new It(0)}}]),vertexShader:_n.meshtoon_vert,fragmentShader:_n.meshtoon_frag},matcap:{uniforms:Zr([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,{matcap:{value:null}}]),vertexShader:_n.meshmatcap_vert,fragmentShader:_n.meshmatcap_frag},points:{uniforms:Zr([pt.points,pt.fog]),vertexShader:_n.points_vert,fragmentShader:_n.points_frag},dashed:{uniforms:Zr([pt.common,pt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_n.linedashed_vert,fragmentShader:_n.linedashed_frag},depth:{uniforms:Zr([pt.common,pt.displacementmap]),vertexShader:_n.depth_vert,fragmentShader:_n.depth_frag},normal:{uniforms:Zr([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,{opacity:{value:1}}]),vertexShader:_n.meshnormal_vert,fragmentShader:_n.meshnormal_frag},sprite:{uniforms:Zr([pt.sprite,pt.fog]),vertexShader:_n.sprite_vert,fragmentShader:_n.sprite_frag},background:{uniforms:{uvTransform:{value:new pn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:_n.background_vert,fragmentShader:_n.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new pn}},vertexShader:_n.backgroundCube_vert,fragmentShader:_n.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_n.cube_vert,fragmentShader:_n.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_n.equirect_vert,fragmentShader:_n.equirect_frag},distance:{uniforms:Zr([pt.common,pt.displacementmap,{referencePosition:{value:new J},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_n.distance_vert,fragmentShader:_n.distance_frag},shadow:{uniforms:Zr([pt.lights,pt.fog,{color:{value:new It(0)},opacity:{value:1}}]),vertexShader:_n.shadow_vert,fragmentShader:_n.shadow_frag}};gs.physical={uniforms:Zr([gs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new pn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new pn},clearcoatNormalScale:{value:new We(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new pn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new pn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new pn},sheen:{value:0},sheenColor:{value:new It(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new pn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new pn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new pn},transmissionSamplerSize:{value:new We},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new pn},attenuationDistance:{value:0},attenuationColor:{value:new It(0)},specularColor:{value:new It(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new pn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new pn},anisotropyVector:{value:new We},anisotropyMap:{value:null},anisotropyMapTransform:{value:new pn}}]),vertexShader:_n.meshphysical_vert,fragmentShader:_n.meshphysical_frag};const B0={r:0,b:0,g:0}
vendor: 5,603 bytes, line 3620
3620,Pu=new Nr,kB=new nn;function GB(i,e,t,n,r,s){const o=new It(0);let a=r===!0?0:1,l,u,d=null,p=0,g=null;function x(R){let E=R.isScene===!0?R.background:null;if(E&&E.isTexture){const N=R.backgroundBlurriness>0;E=e.get(E,N)}return E}function y(R){let E=!1;const N=x(R);N===null?S(o,a):N&&N.isColor&&(S(N,1),E=!0);const U=i.xr.getEnvironmentBlendMode();U==="additive"?t.buffers.color.setClear(0,0,0,1,s):U==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||E)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function T(R,E){const N=x(E);N&&(N.isCubeTexture||N.mapping===ac)?(u===void 0&&(u=new Qn(new pu(1,1,1),new ws({name:"BackgroundCubeMaterial",uniforms:pA(gs.backgroundCube.uniforms),vertexShader:gs.backgroundCube.vertexShader,fragmentShader:gs.backgroundCube.fragmentShader,side:Xn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(U,L,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(u)),Pu.copy(E.backgroundRotation),Pu.x*=-1,Pu.y*=-1,Pu.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(Pu.y*=-1,Pu.z*=-1),u.material.uniforms.envMap.value=N,u.material.uniforms.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(kB.makeRotationFromEuler(Pu)),u.material.toneMapped=Yt.getTransfer(N.colorSpace)!==_t,(d!==N||p!==N.version||g!==i.toneMapping)&&(u.material.needsUpdate=!0,d=N,p=N.version,g=i.toneMapping),u.layers.enableAll(),R.unshift(u,u.geometry,u.material,0,0,null)):N&&N.isTexture&&(l===void 0&&(l=new Qn(new Fd(2,2),new ws({name:"BackgroundMaterial",uniforms:pA(gs.background.uniforms),vertexShader:gs.background.vertexShader,fragmentShader:gs.background.fragmentShader,side:cs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=N,l.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,l.material.toneMapped=Yt.getTransfer(N.colorSpace)!==_t,N.matrixAutoUpdate===!0&&N.updateMatrix(),l.material.uniforms.uvTransform.value.copy(N.matrix),(d!==N||p!==N.version||g!==i.toneMapping)&&(l.material.needsUpdate=!0,d=N,p=N.version,g=i.toneMapping),l.layers.enableAll(),R.unshift(l,l.geometry,l.material,0,0,null))}function S(R,E){R.getRGB(B0,xE(i)),t.buffers.color.setClear(B0.r,B0.g,B0.b,E,s)}function M(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(R,E=1){o.set(R),a=E,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(R){a=R,S(o,a)},render:y,addToRenderList:T,dispose:M}}function VB(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=g(null);let s=r,o=!1;function a(k,W,j,Y,z){let Q=!1;const ee=p(k,Y,j,W);s!==ee&&(s=ee,u(s.object)),Q=x(k,Y,j,z),Q&&y(k,Y,j,z),z!==null&&e.update(z,i.ELEMENT_ARRAY_BUFFER),(Q||o)&&(o=!1,N(k,W,j,Y),z!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(z).buffer))}function l(){return i.createVertexArray()}function u(k){return i.bindVertexArray(k)}function d(k){return i.deleteVertexArray(k)}function p(k,W,j,Y){const z=Y.wireframe===!0;let Q=n[W.id];Q===void 0&&(Q={},n[W.id]=Q);const ee=k.isInstancedMesh===!0?k.id:0;let fe=Q[ee];fe===void 0&&(fe={},Q[ee]=fe);let le=fe[j.id];le===void 0&&(le={},fe[j.id]=le);let Me=le[z];return Me===void 0&&(Me=g(l()),le[z]=Me),Me}function g(k){const W=[],j=[],Y=[];for(let z=0;z<t;z++)W[z]=0,j[z]=0,Y[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:W,enabledAttributes:j,attributeDivisors:Y,object:k,attributes:{},index:null}}function x(k,W,j,Y){const z=s.attributes,Q=W.attributes;let ee=0;const fe=j.getAttributes();for(const le in fe)if(fe[le].location>=0){const Ce=z[le];let Be=Q[le];if(Be===void 0&&(le==="instanceMatrix"&&k.instanceMatrix&&(Be=k.instanceMatrix),le==="instanceColor"&&k.instanceColor&&(Be=k.instanceColor)),Ce===void 0||Ce.attribute!==Be||Be&&Ce.data!==Be.data)return!0;ee++}return s.attributesNum!==ee||s.index!==Y}function y(k,W,j,Y){const z={},Q=W.attributes;let ee=0;const fe=j.getAttributes();for(const le in fe)if(fe[le].location>=0){let Ce=Q[le];Ce===void 0&&(le==="instanceMatrix"&&k.instanceMatrix&&(Ce=k.instanceMatrix),le==="instanceColor"&&k.instanceColor&&(Ce=k.instanceColor));const Be={};Be.attribute=Ce,Ce&&Ce.data&&(Be.data=Ce.data),z[le]=Be,ee++}s.attributes=z,s.attributesNum=ee,s.index=Y}function T(){const k=s.newAttributes;for(let W=0,j=k.length;W<j;W++)k[W]=0}function S(k){M(k,0)}function M(k,W){const j=s.newAttributes,Y=s.enabledAttributes,z=s.attributeDivisors;j[k]=1,Y[k]===0&&(i.enableVertexAttribArray(k),Y[k]=1),z[k]!==W&&(i.vertexAttribDivisor(k,W),z[k]=W)}function R(){const k=s.newAttributes,W=s.enabledAttributes;for(let j=0,Y=W.length;j<Y;j++)W[j]!==k[j]&&(i.disableVertexAttribArray(j),W[j]=0)}function E(k,W,j,Y,z,Q,ee){ee===!0?i.vertexAttribIPointer(k,W,j,z,Q):i.vertexAttribPointer(k,W,j,Y,z,Q)}function N(k,W,j,Y){T();const z=Y.attributes,Q=j.getAttributes(),ee=W.defaultAttributeValues;for(const fe in Q){const le=Q[fe];if(le.location>=0){let Me=z[fe];
3620if(Me===void 0&&(fe==="instanceMatrix"&&k.instanceMatrix&&(Me=k.instanceMatrix),fe==="instanceColor"&&k.instanceColor&&(Me=k.instanceColor)),Me!==void 0){const Ce=Me.normalized,Be=Me.itemSize,Ye=e.get(Me);if(Ye===void 0)continue;const qt=Ye.buffer,bt=Ye.type,Re=Ye.bytesPerElement,qe=bt===i.INT||bt===i.UNSIGNED_INT||Me.gpuType===dr;if(Me.isInterleavedBufferAttribute){const Ke=Me.data,St=Ke.stride,mt=Me.offset;if(Ke.isInstancedInterleavedBuffer){for(let Tt=0;Tt<le.locationSize;Tt++)M(le.location+Tt,Ke.meshPerAttribute);k.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=Ke.meshPerAttribute*Ke.count)}else for(let Tt=0;Tt<le.locationSize;Tt++)S(le.location+Tt);i.bindBuffer(i.ARRAY_BUFFER,qt);for(let Tt=0;Tt<le.locationSize;Tt++)E(le.location+Tt,Be/le.locationSize,bt,Ce,St*Re,(mt+Be/le.locationSize*Tt)*Re,qe)}else{if(Me.isInstancedBufferAttribute){for(let Ke=0;Ke<le.locationSize;Ke++)M(le.location+Ke,Me.meshPerAttribute);k.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=Me.meshPerAttribute*Me.count)}else for(let Ke=0;Ke<le.locationSize;Ke++)S(le.location+Ke);i.bindBuffer(i.ARRAY_BUFFER,qt);for(let Ke=0;Ke<le.locationSize;Ke++)E(le.location+Ke,Be/le.locationSize,bt,Ce,Be*Re,Be/le.locationSize*Ke*Re,qe)}}else if(ee!==void 0){const Ce=ee[fe];if(Ce!==void 0)switch(Ce.length){case 2:i.vertexAttrib2fv(le.location,Ce);break;case 3:i.vertexAttrib3fv(le.location,Ce);break;case 4:i.vertexAttrib4fv(le.location,Ce);break;default:i.vertexAttrib1fv(le.location,Ce)}}}}R()}function U(){I();for(const k in n){const W=n[k];for(const j in W){const Y=W[j];for(const z in Y){const Q=Y[z];for(const ee in Q)d(Q[ee].object),delete Q[ee];delete Y[z]}}delete n[k]}}function L(k){if(n[k.id]===void 0)return;const W=n[k.id];for(const j in W){const Y=W[j];for(const z in Y){const Q=Y[z];for(const ee in Q)d(Q[ee].object),delete Q[ee];delete Y[z]}}delete n[k.id]}function F(k){for(const W in n){const j=n[W];for(const Y in j){const z=j[Y];if(z[k.id]===void 0)continue;const Q=z[k.id];for(const ee in Q)d(Q[ee].object),delete Q[ee];delete z[k.id]}}}function P(k){for(const W in n){const j=n[W],Y=k.isInstancedMesh===!0?k.id:0,z=j[Y];if(z!==void 0){for(const Q in z){const ee=z[Q];for(const fe in ee)d(ee[fe].object),delete ee[fe];delete z[Q]}delete j[Y],Object.keys(j).length===0&&delete n[W]}}}function I(){$(),o=!0,s!==r&&(s=r,u(s.object))}function $(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:I,resetDefaultState:$,dispose:U,releaseStatesOfGeometry:L,releaseStatesOfObject:P,releaseStatesOfProgram:F,initAttributes:T,enableAttribute:S,disableUnusedAttributes:R}}function qB(i,e,t){let n;function r(u){n=u}function s(u,d){i.drawArrays(n,u,d),t.update(d,n,1)}function o(u,d,p){p!==0&&(i.drawArraysInstanced(n,u,d,p),t.update(d,n,p))}function a(u,d,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,u,0,d,0,p);let x=0;for(let y=0;y<p;y++)x+=d[y];t.update(x,n,1)}function l(u,d,p,g){if(p===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let y=0;y<u.length;y++)o(u[y],d[y],g[y]);
vendor: 13,057 bytes, lines 3620-3693
3620else{x.multiDrawArraysInstancedWEBGL(n,u,0,d,0,g,0,p);let y=0;for(let T=0;T<p;T++)y+=d[T]*g[T];t.update(y,n,1)}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function zB(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const F=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(F){return!(F!==Wi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(F){const P=F===Mi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==yi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==zi&&!P)}function l(F){if(F==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let u=t.precision!==void 0?t.precision:"highp";const d=l(u);d!==u&&(Oe("WebGLRenderer:",u,"not supported, using",d,"instead."),u=d);const p=t.logarithmicDepthBuffer===!0,g=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),x=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),T=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),M=i.getParameter(i.MAX_VERTEX_ATTRIBS),R=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),N=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),U=i.getParameter(i.MAX_SAMPLES),L=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:u,logarithmicDepthBuffer:p,reversedDepthBuffer:g,maxTextures:x,maxVertexTextures:y,maxTextureSize:T,maxCubemapSize:S,maxAttributes:M,maxVertexUniforms:R,maxVaryings:E,maxFragmentUniforms:N,maxSamples:U,samples:L}}function HB(i){const e=this;let t=null,n=0,r=!1,s=!1;const o=new oa,a=new pn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(p,g){const x=p.length!==0||g||n!==0||r;return r=g,n=p.length,x},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(p,g){t=d(p,g,0)},this.setState=function(p,g,x){const y=p.clippingPlanes,T=p.clipIntersection,S=p.clipShadows,M=i.get(p);if(!r||y===null||y.length===0||s&&!S)s?d(null):u();else{const R=s?0:n,E=R*4;let N=M.clippingState||null;l.value=N,N=d(y,g,E,x);for(let U=0;U!==E;++U)N[U]=t[U];M.clippingState=N,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=R}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(p,g,x,y){const T=p!==null?p.length:0;let S=null;if(T!==0){if(S=l.value,y!==!0||S===null){const M=x+T*4,R=g.matrixWorldInverse;a.getNormalMatrix(R),(S===null||S.length<M)&&(S=new Float32Array(M));for(let E=0,N=x;E!==T;++E,N+=4)o.copy(p[E]).applyMatrix4(R,a),o.normal.toArray(S,N),S[N+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=T,e.numIntersection=0,S}}const Xl=4,lS=[.125,.215,.35,.446,.526,.582],qu=20,WB=256,rf=new Ud,uS=new It;let K1=null,Z1=0,J1=0,e2=!1;const $B=new J;let cS=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){const{size:o=256,position:a=$B}=s;K1=this._renderer.getRenderTarget(),Z1=this._renderer.getActiveCubeFace(),J1=this._renderer.getActiveMipmapLevel(),e2=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=fS(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=AS(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(K1,Z1,J1),this._renderer.xr.enabled=e2,e.scissorTest=!1,Yc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Fo||e.mapping===Ra?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),K1=this._renderer.getRenderTarget(),Z1=this._renderer.getActiveCubeFace(),J1=this._renderer.getActiveMipmapLevel(),e2=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:li,minFilter:li,generateMipmaps:!1,type:Mi,format:Wi,colorSpace:au,depthBuffer:!1},r=hS(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=hS(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=jB(s)),this._blurMaterial=QB(s,e,t),this._ggxMaterial=XB(s,e,t)}return r}_compileMaterial(e){const t=new Qn(new Wn,e);this._renderer.compile(t,rf)}_sceneToCubeUV(e,t,n,r,s){const l=new pr(90,1,t,n),u=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],p=this._renderer,g=p.autoClear,x=p.toneMapping;p.getClearColor(uS),p.toneMapping=wr,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(r),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Qn(new pu,new qs({name:"PMREM.Background",side:Xn,depthWrite:!1,depthTest:!1})));const T=this._backgroundBox,S=T.material;let M=!1;const R=e.background;R?R.isColor&&(S.color.copy(R),e.background=null,M=!0):(S.color.copy(uS),M=!0);for(let E=0;E<6;E++){const N=E%3;N===0?(l.up.set(0,u[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+d[E],s.y,s.z)):N===1?(l.up.set(0,0,u[E]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+d[E],s.z)):(l.up.set(0,u[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+d[E]));const U=this._cubeSize;Yc(r,N*U,E>2?U:0,U,U),p.setRenderTarget(r),M&&p.render(T,l),p.render(e,l)}p.toneMapping=x,p.autoClear=g,e.background=R}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Fo||e.mapping===Ra;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=fS()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=AS());const s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;const a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Yc(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,rf)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;const l=o.uniforms,u=n/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),p=Math.sqrt(u*u-d*d),g=0+u*1.25,x=p*g,{_lodMax:y}=this,T=this._sizeLods[n],S=3*T*(n>y-Xl?n-y+Xl:0),M=4*(this._cubeSize-T);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=y-t,Yc(s,S,M,3*T,2*T),r.setRenderTarget(s),r.render(a,rf),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,Yc(e,S,M,3*T,2*T),r.setRenderTarget(e),r.render(a,rf)}_blur(e,t,n,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){const l=this._renderer,u=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ke("blur direction must be either latitudinal or longitudinal!");const d=3,p=this._lodMeshes[r];p.material=u;const g=u.uniforms,x=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*qu-1),T=s/y,S=isFinite(s)?1+Math.floor(d*T):qu;S>qu&&Oe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${qu}`);const M=[];let R=0;for(let F=0;F<qu;++F){const P=F/T,I=Math.exp(-P*P/2);M.push(I),F===0?R+=I:F<S&&(R+=2*I)}for(let F=0;F<M.length;F++)M[F]=M[F]/R;g.envMap.value=e.texture,g.samples.value=S,g.weights.value=M,g.latitudinal.value=o==="latitudinal",a&&(g.poleAxis.value=a);const{_lodMax:E}=this;g.dTheta.value=y,g.mipInt.value=E-n;const N=this._sizeLods[r],U=3*N*(r>E-Xl?r-E+Xl:0),L=4*(this._cubeSize-N);Yc(t,U,L,3*N,2*N),l.setRenderTarget(t),l.render(p,rf)}};function jB(i){const e=[],t=[],n=[];let r=i;const s=i-Xl+1+lS.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Xl?l=lS[o-i+Xl-1]:o===0&&(l=0),t.push(l);const u=1/(a-2),d=-u,p=1+u,g=[d,d,p,d,p,p,d,d,p,p,d,p],x=6,y=6,T=3,S=2,M=1,R=new Float32Array(T*y*x),E=new Float32Array(S*y*x),N=new Float32Array(M*y*x);for(let L=0;L<x;L++){const F=L%3*2/3-1,P=L>2?0:-1,I=[F,P,0,F+2/3,P,0,F+2/3,P+1,0,F,P,0,F+2/3,P+1,0,F,P+1,0];R.set(I,T*y*L),E.set(g,S*y*L);const $=[L,L,L,L,L,L];N.set($,M*y*L)}const U=new Wn;U.setAttribute("position",new Di(R,T)),U.setAttribute("uv",new Di(E,S)),U.setAttribute("faceIndex",new Di(N,M)),n.push(new Qn(U,null)),r>Xl&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function hS(i,e,t){const n=new _a(i,e,t);return n.texture.mapping=ac,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Yc(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function XB(i,e,t){return new ws({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:WB,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Ag(),fragmentShader:` 3621 3622 precision highp float; 3623 precision highp int; 3624 3625 varying vec3 vOutputDirection; 3626 3627 uniform sampler2D envMap; 3628 uniform float roughness; 3629 uniform float mipInt; 3630 3631 #define ENVMAP_TYPE_CUBE_UV 3632 #include <cube_uv_reflection_fragment> 3633 3634 #define PI 3.14159265359 3635 3636 // Van der Corput radical inverse 3637 float radicalInverse_VdC(uint bits) { 3638 bits = (bits << 16u) | (bits >> 16u); 3639 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 3640 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 3641 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 3642 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 3643 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 3644 } 3645 3646 // Hammersley sequence 3647 vec2 hammersley(uint i, uint N) { 3648 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 3649 } 3650 3651 // GGX VNDF importance sampling (Eric Heitz 2018) 3652 // "Sampling the GGX Distribution of Visible Normals" 3653 // https://jcgt.org/published/0007/04/01/ 3654 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 3655 float alpha = roughness * roughness; 3656 3657 // Section 4.1: Orthonormal basis 3658 vec3 T1 = vec3(1.0, 0.0, 0.0); 3659 vec3 T2 = cross(V, T1); 3660 3661 // Section 4.2: Parameterization of projected area 3662 float r = sqrt(Xi.x); 3663 float phi = 2.0 * PI * Xi.y; 3664 float t1 = r * cos(phi); 3665 float t2 = r * sin(phi); 3666 float s = 0.5 * (1.0 + V.z); 3667 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 3668 3669 // Section 4.3: Reprojection onto hemisphere 3670 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 3671 3672 // Section 3.4: Transform back to ellipsoid configuration 3673 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 3674 } 3675 3676 void main() { 3677 vec3 N = normalize(vOutputDirection); 3678 vec3 V = N; // Assume view direction equals normal for pre-filtering 3679 3680 vec3 prefilteredColor = vec3(0.0); 3681 float totalWeight = 0.0; 3682 3683 // For very low roughness, just sample the environment directly 3684 if (roughness < 0.001) { 3685 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 3686 return; 3687 } 3688 3689 // Tangent space basis for VNDF sampling 3690 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 3691 vec3 tangent = normalize(cross(up, N)); 3692 vec3 bitangent = cross(N, tangent); 3693
3694 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 3695 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 3696 3697 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 3698 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 3699 3700 // Transform H back to world space 3701 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 3702 vec3 L = normalize(2.0 * dot(V, H) * H - V); 3703 3704 float NdotL = max(dot(N, L), 0.0); 3705 3706 if(NdotL > 0.0) { 3707 // Sample environment at fixed mip level 3708 // VNDF importance sampling handles the distribution filtering 3709 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 3710 3711 // Weight by NdotL for the split-sum approximation 3712 // VNDF PDF naturally accounts for the visible microfacet distribution 3713 prefilteredColor += sampleColor * NdotL; 3714 totalWeight += NdotL; 3715 } 3716 } 3717 3718 if (totalWeight > 0.0) { 3719 prefilteredColor = prefilteredColor / totalWeight; 3720 } 3721 3722 gl_FragColor = vec4(prefilteredColor, 1.0); 3723 } 3724 `,blending:gr,depthTest:!1,depthWrite:!1})}function QB(i,e,t){const n=new Float32Array(qu),r=new J(0,1,0);return new ws({name:"SphericalGaussianBlur",defines:{n:qu,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ag(),fragmentShader:` 3725 3726 precision mediump float; 3727 precision mediump int; 3728 3729 varying vec3 vOutputDirection; 3730 3731 uniform sampler2D envMap; 3732 uniform int samples; 3733 uniform float weights[ n ]; 3734 uniform bool latitudinal; 3735 uniform float dTheta; 3736 uniform float mipInt; 3737 uniform vec3 poleAxis; 3738 3739 #define ENVMAP_TYPE_CUBE_UV 3740 #include <cube_uv_reflection_fragment> 3741 3742 vec3 getSample( float theta, vec3 axis ) { 3743 3744 float cosTheta = cos( theta ); 3745 // Rodrigues' axis-angle rotation 3746 vec3 sampleDirection = vOutputDirection * cosTheta 3747 + cross( axis, vOutputDirection ) * sin( theta ) 3748 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3749 3750 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3751 3752 } 3753 3754 void main() { 3755 3756 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3757 3758 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3759 3760 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3761 3762 } 3763 3764 axis = normalize( axis ); 3765 3766 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3767 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3768 3769 for ( int i = 1; i < n; i++ ) { 3770 3771 if ( i >= samples ) { 3772 3773 break; 3774 3775 } 3776 3777 float theta = dTheta * float( i ); 3778 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3779 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3780 3781 } 3782 3783 } 3784 `,blending:gr,depthTest:!1,depthWrite:!1})}function AS(){return new ws({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ag(),fragmentShader:` 3785 3786 precision mediump float; 3787 precision mediump int; 3788 3789 varying vec3 vOutputDirection; 3790 3791 uniform sampler2D envMap; 3792 3793 #include <common> 3794 3795 void main() { 3796 3797 vec3 outputDirection = normalize( vOutputDirection ); 3798 vec2 uv = equirectUv( outputDirection ); 3799 3800 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3801 3802 } 3803 `,blending:gr,depthTest:!1,depthWrite:!1})}function fS(){return new ws({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ag(),fragmentShader:` 3804 3805 precision mediump float; 3806 precision mediump int; 3807 3808 uniform float flipEnvMap; 3809 3810 varying vec3 vOutputDirection; 3811 3812 uniform samplerCube envMap; 3813 3814 void main() { 3815 3816 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3817 3818 } 3819 `,blending:gr,depthTest:!1,depthWrite:!1})}function Ag(){return` 3820 3821 precision mediump float; 3822 precision mediump int; 3823 3824 attribute float faceIndex; 3825 3826 varying vec3 vOutputDirection; 3827 3828 // RH coordinate system; PMREM face-indexing convention 3829 vec3 getDirection( vec2 uv, float face ) { 3830 3831 uv = 2.0 * uv - 1.0; 3832 3833 vec3 direction = vec3( uv, 1.0 ); 3834 3835 if ( face == 0.0 ) { 3836 3837 direction = direction.zyx; // ( 1, v, u ) pos x 3838 3839 } else if ( face == 1.0 ) { 3840 3841 direction = direction.xzy; 3842 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3843 3844 } else if ( face == 2.0 ) { 3845 3846 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3847 3848 } else if ( face == 3.0 ) { 3849 3850 direction = direction.zyx; 3851 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3852 3853 } else if ( face == 4.0 ) { 3854 3855 direction = direction.xzy; 3856 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3857 3858 } else if ( face == 5.0 ) { 3859 3860 direction.z *= -1.0; // ( u, v, -1 ) neg z 3861 3862 } 3863 3864 return direction; 3865 3866 } 3867 3868 void main() { 3869 3870 vOutputDirection = getDirection( uv, faceIndex ); 3871 gl_Position = vec4( position, 1.0 ); 3872 3873 } 3874 `}class ME extends _a{constructor(e=1,t={}
vendor: 25,956 bytes, lines 3874-3990
3874){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new FA(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}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:` 3875 3876 varying vec3 vWorldDirection; 3877 3878 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 3879 3880 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 3881 3882 } 3883 3884 void main() { 3885 3886 vWorldDirection = transformDirection( position, modelMatrix ); 3887 3888 #include <begin_vertex> 3889 #include <project_vertex> 3890 3891 } 3892 `,fragmentShader:` 3893 3894 uniform sampler2D tEquirect; 3895 3896 varying vec3 vWorldDirection; 3897 3898 #include <common> 3899 3900 void main() { 3901 3902 vec3 direction = normalize( vWorldDirection ); 3903 3904 vec2 sampleUV = equirectUv( direction ); 3905 3906 gl_FragColor = texture2D( tEquirect, sampleUV ); 3907 3908 } 3909 `},r=new pu(5,5,5),s=new ws({name:"CubemapFromEquirect",uniforms:pA(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Xn,blending:gr});s.uniforms.tEquirect.value=t;const o=new Qn(r,s),a=t.minFilter;return t.minFilter===vs&&(t.minFilter=li),new bE(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}}function YB(i){let e=new WeakMap,t=new WeakMap,n=null;function r(g,x=!1){return g==null?null:x?o(g):s(g)}function s(g){if(g&&g.isTexture){const x=g.mapping;if(x===Ch||x===Nh)if(e.has(g)){const y=e.get(g).texture;return a(y,g.mapping)}else{const y=g.image;if(y&&y.height>0){const T=new ME(y.height);return T.fromEquirectangularTexture(i,g),e.set(g,T),g.addEventListener("dispose",u),a(T.texture,g.mapping)}else return null}}return g}function o(g){if(g&&g.isTexture){const x=g.mapping,y=x===Ch||x===Nh,T=x===Fo||x===Ra;if(y||T){let S=t.get(g);const M=S!==void 0?S.texture.pmremVersion:0;if(g.isRenderTargetTexture&&g.pmremVersion!==M)return n===null&&(n=new cS(i)),S=y?n.fromEquirectangular(g,S):n.fromCubemap(g,S),S.texture.pmremVersion=g.pmremVersion,t.set(g,S),S.texture;if(S!==void 0)return S.texture;{const R=g.image;return y&&R&&R.height>0||T&&R&&l(R)?(n===null&&(n=new cS(i)),S=y?n.fromEquirectangular(g):n.fromCubemap(g),S.texture.pmremVersion=g.pmremVersion,t.set(g,S),g.addEventListener("dispose",d),S.texture):null}}}return g}function a(g,x){return x===Ch?g.mapping=Fo:x===Nh&&(g.mapping=Ra),g}function l(g){let x=0;const y=6;for(let T=0;T<y;T++)g[T]!==void 0&&x++;return x===y}function u(g){const x=g.target;x.removeEventListener("dispose",u);const y=e.get(x);y!==void 0&&(e.delete(x),y.dispose())}function d(g){const x=g.target;x.removeEventListener("dispose",d);const y=t.get(x);y!==void 0&&(t.delete(x),y.dispose())}function p(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:p}}function KB(i){const e={};function t(n){if(e[n]!==void 0)return e[n];const r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&zn("WebGLRenderer: "+n+" extension not supported."),r}}}function ZB(i,e,t,n){const r={},s=new WeakMap;function o(p){const g=p.target;g.index!==null&&e.remove(g.index);for(const y in g.attributes)e.remove(g.attributes[y]);g.removeEventListener("dispose",o),delete r[g.id];const x=s.get(g);x&&(e.remove(x),s.delete(g)),n.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,t.memory.geometries--}function a(p,g){return r[g.id]===!0||(g.addEventListener("dispose",o),r[g.id]=!0,t.memory.geometries++),g}function l(p){const g=p.attributes;for(const x in g)e.update(g[x],i.ARRAY_BUFFER)}function u(p){const g=[],x=p.index,y=p.attributes.position;let T=0;if(y===void 0)return;if(x!==null){const R=x.array;T=x.version;for(let E=0,N=R.length;E<N;E+=3){const U=R[E+0],L=R[E+1],F=R[E+2];g.push(U,L,L,F,F,U)}}else{const R=y.array;T=y.version;for(let E=0,N=R.length/3-1;E<N;E+=3){const U=E+0,L=E+1,F=E+2;g.push(U,L,L,F,F,U)}}const S=new(y.count>=65535?vv:xv)(g,1);S.version=T;const M=s.get(p);M&&e.remove(M),s.set(p,S)}function d(p){const g=s.get(p);if(g){const x=p.index;x!==null&&g.version<x.version&&u(p)}else u(p);return s.get(p)}return{get:a,update:l,getWireframeAttribute:d}}function JB(i,e,t){let n;function r(g){n=g}let s,o;function a(g){s=g.type,o=g.bytesPerElement}function l(g,x){i.drawElements(n,x,s,g*o),t.update(x,n,1)}function u(g,x,y){y!==0&&(i.drawElementsInstanced(n,x,s,g*o,y),t.update(x,n,y))}function d(g,x,y){if(y===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,x,0,s,g,0,y);let S=0;for(let M=0;M<y;M++)S+=x[M];t.update(S,n,1)}function p(g,x,y,T){if(y===0)return;const S=e.get("WEBGL_multi_draw");if(S===null)for(let M=0;M<g.length;M++)u(g[M]/o,x[M],T[M]);else{S.multiDrawElementsInstancedWEBGL(n,x,0,s,g,0,T,0,y);let M=0;for(let R=0;R<y;R++)M+=x[R]*T[R];t.update(M,n,1)}}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=u,this.renderMultiDraw=d,this.renderMultiDrawInstances=p}function eF(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:ke("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function tF(i,e,t){const n=new WeakMap,r=new rn;function s(o,a,l){const u=o.morphTargetInfluences,d=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,p=d!==void 0?d.length:0;let g=n.get(a);if(g===void 0||g.count!==p){let I=function(){F.dispose(),n.delete(a),a.removeEventListener("dispose",I)};g!==void 0&&g.texture.dispose();const x=a.morphAttributes.position!==void 0,y=a.morphAttributes.normal!==void 0,T=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],M=a.morphAttributes.normal||[],R=a.morphAttributes.color||[];let E=0;x===!0&&(E=1),y===!0&&(E=2),T===!0&&(E=3);let N=a.attributes.position.count*E,U=1;N>e.maxTextureSize&&(U=Math.ceil(N/e.maxTextureSize),N=e.maxTextureSize);const L=new Float32Array(N*U*4*p),F=new mv(L,N,U,p);F.type=zi,F.needsUpdate=!0;const P=E*4;for(let $=0;$<p;$++){const k=S[$],W=M[$],j=R[$],Y=N*U*4*$;for(let z=0;z<k.count;z++){const Q=z*P;x===!0&&(r.fromBufferAttribute(k,z),L[Y+Q+0]=r.x,L[Y+Q+1]=r.y,L[Y+Q+2]=r.z,L[Y+Q+3]=0),y===!0&&(r.fromBufferAttribute(W,z),L[Y+Q+4]=r.x,L[Y+Q+5]=r.y,L[Y+Q+6]=r.z,L[Y+Q+7]=0),T===!0&&(r.fromBufferAttribute(j,z),L[Y+Q+8]=r.x,L[Y+Q+9]=r.y,L[Y+Q+10]=r.z,L[Y+Q+11]=j.itemSize===4?r.w:1)}}g={count:p,texture:F,size:new We(N,U)},n.set(a,g),a.addEventListener("dispose",I)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let x=0;for(let T=0;T<u.length;T++)x+=u[T];const y=a.morphTargetsRelative?1:1-x;l.getUniforms().setValue(i,"morphTargetBaseInfluence",y),l.getUniforms().setValue(i,"morphTargetInfluences",u)}l.getUniforms().setValue(i,"morphTargetsTexture",g.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",g.size)}return{update:s}}function nF(i,e,t,n,r){let s=new WeakMap;function o(u){const d=r.render.frame,p=u.geometry,g=e.get(u,p);if(s.get(g)!==d&&(e.update(g),s.set(g,d)),u.isInstancedMesh&&(u.hasEventListener("dispose",l)===!1&&u.addEventListener("dispose",l),s.get(u)!==d&&(t.update(u.instanceMatrix,i.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,i.ARRAY_BUFFER),s.set(u,d))),u.isSkinnedMesh){const x=u.skeleton;s.get(x)!==d&&(x.update(),s.set(x,d))}return g}function a(){s=new WeakMap}function l(u){const d=u.target;d.removeEventListener("dispose",l),n.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:o,dispose:a}}const iF={[ev]:"LINEAR_TONE_MAPPING",[tv]:"REINHARD_TONE_MAPPING",[nv]:"CINEON_TONE_MAPPING",[iv]:"ACES_FILMIC_TONE_MAPPING",[rv]:"AGX_TONE_MAPPING",[sv]:"NEUTRAL_TONE_MAPPING",[Jw]:"CUSTOM_TONE_MAPPING"};function rF(i,e,t,n,r){const s=new _a(e,t,{type:i,depthBuffer:n,stencilBuffer:r}),o=new _a(e,t,{type:Mi,depthBuffer:!1,stencilBuffer:!1}),a=new Wn;a.setAttribute("position",new Fn([-1,3,0,-1,-1,0,3,-1,0],3)),a.setAttribute("uv",new Fn([0,2,0,0,2,0],2));const l=new ND({uniforms:{tDiffuse:{value:null}},vertexShader:` 3910 precision highp float; 3911 3912 uniform mat4 modelViewMatrix; 3913 uniform mat4 projectionMatrix; 3914 3915 attribute vec3 position; 3916 attribute vec2 uv; 3917 3918 varying vec2 vUv; 3919 3920 void main() { 3921 vUv = uv; 3922 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3923 }`,fragmentShader:` 3924 precision highp float; 3925 3926 uniform sampler2D tDiffuse; 3927 3928 varying vec2 vUv; 3929 3930 #include <tonemapping_pars_fragment> 3931 #include <colorspace_pars_fragment> 3932 3933 void main() { 3934 gl_FragColor = texture2D( tDiffuse, vUv ); 3935 3936 #ifdef LINEAR_TONE_MAPPING 3937 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 3938 #elif defined( REINHARD_TONE_MAPPING ) 3939 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 3940 #elif defined( CINEON_TONE_MAPPING ) 3941 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 3942 #elif defined( ACES_FILMIC_TONE_MAPPING ) 3943 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 3944 #elif defined( AGX_TONE_MAPPING ) 3945 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 3946 #elif defined( NEUTRAL_TONE_MAPPING ) 3947 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 3948 #elif defined( CUSTOM_TONE_MAPPING ) 3949 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 3950 #endif 3951 3952 #ifdef SRGB_TRANSFER 3953 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 3954 #endif 3955 }`,depthTest:!1,depthWrite:!1}),u=new Qn(a,l),d=new Ud(-1,1,1,-1,0,1);let p=null,g=null,x=!1,y,T=null,S=[],M=!1;this.setSize=function(R,E){s.setSize(R,E),o.setSize(R,E);for(let N=0;N<S.length;N++){const U=S[N];U.setSize&&U.setSize(R,E)}},this.setEffects=function(R){S=R,M=S.length>0&&S[0].isRenderPass===!0;const E=s.width,N=s.height;for(let U=0;U<S.length;U++){const L=S[U];L.setSize&&L.setSize(E,N)}},this.begin=function(R,E){if(x||R.toneMapping===wr&&S.length===0)return!1;if(T=E,E!==null){const N=E.width,U=E.height;(s.width!==N||s.height!==U)&&this.setSize(N,U)}return M===!1&&R.setRenderTarget(s),y=R.toneMapping,R.toneMapping=wr,!0},this.hasRenderPass=function(){return M},this.end=function(R,E){R.toneMapping=y,x=!0;let N=s,U=o;for(let L=0;L<S.length;L++){const F=S[L];if(F.enabled!==!1&&(F.render(R,U,N,E),F.needsSwap!==!1)){const P=N;N=U,U=P}}if(p!==R.outputColorSpace||g!==R.toneMapping){p=R.outputColorSpace,g=R.toneMapping,l.defines={},Yt.getTransfer(p)===_t&&(l.defines.SRGB_TRANSFER="");const L=iF[g];L&&(l.defines[L]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=N.texture,R.setRenderTarget(T),R.render(u,d),T=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){s.dispose(),o.dispose(),a.dispose(),l.dispose()}}const wE=new tr,y_=new qr(1,1),EE=new mv,RE=new N7,CE=new FA,dS=[],pS=[],mS=new Float32Array(16),gS=new Float32Array(9),_S=new Float32Array(4);function UA(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=dS[r];if(s===void 0&&(s=new Float32Array(r),dS[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function sr(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function or(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function fg(i,e){let t=pS[e];t===void 0&&(t=new Int32Array(e),pS[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function sF(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function oF(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sr(t,e))return;i.uniform2fv(this.addr,e),or(t,e)}}function aF(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.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)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(sr(t,e))return;i.uniform3fv(this.addr,e),or(t,e)}}function lF(i,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)&&(i.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(sr(t,e))return;i.uniform4fv(this.addr,e),or(t,e)}}function uF(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(sr(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),or(t,e)}else{if(sr(t,n))return;_S.set(n),i.uniformMatrix2fv(this.addr,!1,_S),or(t,n)}}function cF(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(sr(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),or(t,e)}else{if(sr(t,n))return;gS.set(n),i.uniformMatrix3fv(this.addr,!1,gS),or(t,n)}}function hF(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(sr(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),or(t,e)}else{if(sr(t,n))return;mS.set(n),i.uniformMatrix4fv(this.addr,!1,mS),or(t,n)}}function AF(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function fF(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sr(t,e))return;i.uniform2iv(this.addr,e),or(t,e)}}function dF(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(sr(t,e))return;i.uniform3iv(this.addr,e),or(t,e)}}function pF(i,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)&&(i.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(sr(t,e))return;i.uniform4iv(this.addr,e),or(t,e)}}function mF(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function gF(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sr(t,e))return;i.uniform2uiv(this.addr,e),or(t,e)}}function _F(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(sr(t,e))return;i.uniform3uiv(this.addr,e),or(t,e)}}function xF(i,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)&&(i.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(sr(t,e))return;i.uniform4uiv(this.addr,e),or(t,e)}}function vF(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(y_.compareFunction=t.isReversedDepthBuffer()?al:fu,s=y_):s=wE,t.setTexture2D(e||s,r)}function yF(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||RE,r)}function bF(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||CE,r)}function SF(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||EE,r)}function TF(i){switch(i){case 5126:return sF;case 35664:return oF;case 35665:return aF;case 35666:return lF;case 35674:return uF;case 35675:return cF;case 35676:return hF;case 5124:case 35670:return AF;case 35667:case 35671:return fF;case 35668:case 35672:return dF;case 35669:case 35673:return pF;case 5125:return mF;case 36294:return gF;case 36295:return _F;case 36296:return xF;case 35678:case 36198:case 36298:case 36306:case 35682:return vF;case 35679:case 36299:case 36307:return yF;case 35680:case 36300:case 36308:case 36293:return bF;case 36289:case 36303:case 36311:case 36292:return SF}}function MF(i,e){i.uniform1fv(this.addr,e)}function wF(i,e){const t=UA(e,this.size,2);i.uniform2fv(this.addr,t)}function EF(i,e){const t=UA(e,this.size,3);i.uniform3fv(this.addr,t)}function RF(i,e){const t=UA(e,this.size,4);i.uniform4fv(this.addr,t)}function CF(i,e){const t=UA(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function NF(i,e){const t=UA(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function PF(i,e){const t=UA(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function DF(i,e){i.uniform1iv(this.addr,e)}function LF(i,e){i.uniform2iv(this.addr,e)}function IF(i,e){i.uniform3iv(this.addr,e)}function BF(i,e){i.uniform4iv(this.addr,e)}function FF(i,e){i.uniform1uiv(this.addr,e)}function UF(i,e){i.uniform2uiv(this.addr,e)}function OF(i,e){i.uniform3uiv(this.addr,e)}function kF(i,e){i.uniform4uiv(this.addr,e)}function GF(i,e,t){const n=this.cache,r=e.length,s=fg(t,r);sr(n,s)||(i.uniform1iv(this.addr,s),or(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=y_:o=wE;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function VF(i,e,t){const n=this.cache,r=e.length,s=fg(t,r);sr(n,s)||(i.uniform1iv(this.addr,s),or(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||RE,s[o])}function qF(i,e,t){const n=this.cache,r=e.length,s=fg(t,r);sr(n,s)||(i.uniform1iv(this.addr,s),or(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||CE,s[o])}function zF(i,e,t){const n=this.cache,r=e.length,s=fg(t,r);sr(n,s)||(i.uniform1iv(this.addr,s),or(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||EE,s[o])}function HF(i){switch(i){case 5126:return MF;case 35664:return wF;case 35665:return EF;case 35666:return RF;case 35674:return CF;case 35675:return NF;case 35676:return PF;case 5124:case 35670:return DF;case 35667:case 35671:return LF;case 35668:case 35672:return IF;case 35669:case 35673:return BF;case 5125:return FF;case 36294:return UF;case 36295:return OF;case 36296:return kF;case 35678:case 36198:case 36298:case 36306:case 35682:return GF;case 35679:case 36299:case 36307:return VF;case 35680:case 36300:case 36308:case 36293:return qF;case 36289:case 36303:case 36311:case 36292:return zF}}class WF{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=TF(t.type)}}class $F{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=HF(t.type)}}class jF{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],n)}}}const t2=/(\w+)(\])?(\[|\.)?/g;function xS(i,e){i.seq.push(e),i.map[e.id]=e}function XF(i,e,t){const n=i.name,r=n.length;for(t2.lastIndex=0;;){const s=t2.exec(n),o=t2.lastIndex;let a=s[1];const l=s[2]==="]",u=s[3];if(l&&(a=a|0),u===void 0||u==="["&&o+2===r){xS(t,u===void 0?new WF(a,i,e):new $F(a,i,e));break}else{let p=t.map[a];p===void 0&&(p=new jF(a),xS(t,p)),t=p}}}class Vp{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){const a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);XF(a,l,this)}const r=[],s=[];for(const o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):s.push(o);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&n.push(o)}return n}}function vS(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const QF=37297;let YF=0;function KF(i,e){const t=i.split(` 3956`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(` 3957`)}const yS=new pn;function ZF(i){Yt._getMatrix(yS,Yt.workingColorSpace,i);const e=`mat3( ${yS.elements.map(t=>t.toFixed(4))} )`;switch(Yt.getTransfer(i)){case AA:return[e,"LinearTransferOETF"];case _t:return[e,"sRGBTransferOETF"];default:return Oe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function bS(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const a=parseInt(o[1]);return t.toUpperCase()+` 3958 3959`+s+` 3960 3961`+KF(i.getShaderSource(e),a)}else return s}function JF(i,e){const t=ZF(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3962`)}const e9={[ev]:"Linear",[tv]:"Reinhard",[nv]:"Cineon",[iv]:"ACESFilmic",[rv]:"AgX",[sv]:"Neutral",[Jw]:"Custom"};function t9(i,e){const t=e9[e];return t===void 0?(Oe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const F0=new J;function n9(){Yt.getLuminanceCoefficients(F0);const i=F0.x.toFixed(4),e=F0.y.toFixed(4),t=F0.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3963`)}function i9(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Rf).join(` 3964`)}function r9(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3965`)}function s9(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),o=s.name;let a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function Rf(i){return i!==""}function SS(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.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 TS(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const o9=/^[ \t]*#include +<([\w\d./]+)>/gm;function b_(i){return i.replace(o9,l9)}const a9=new Map;function l9(i,e){let t=_n[e];if(t===void 0){const n=a9.get(e);if(n!==void 0)t=_n[n],Oe('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return b_(t)}const u9=/#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 MS(i){return i.replace(u9,c9)}function c9(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function wS(i){let e=`precision ${i.precision} float; 3966 precision ${i.precision} int; 3967 precision ${i.precision} sampler2D; 3968 precision ${i.precision} samplerCube; 3969 precision ${i.precision} sampler3D; 3970 precision ${i.precision} sampler2DArray; 3971 precision ${i.precision} sampler2DShadow; 3972 precision ${i.precision} samplerCubeShadow; 3973 precision ${i.precision} sampler2DArrayShadow; 3974 precision ${i.precision} isampler2D; 3975 precision ${i.precision} isampler3D; 3976 precision ${i.precision} isamplerCube; 3977 precision ${i.precision} isampler2DArray; 3978 precision ${i.precision} usampler2D; 3979 precision ${i.precision} usampler3D; 3980 precision ${i.precision} usamplerCube; 3981 precision ${i.precision} usampler2DArray; 3982 `;return i.precision==="highp"?e+=` 3983#define HIGH_PRECISION`:i.precision==="mediump"?e+=` 3984#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` 3985#define LOW_PRECISION`),e}const h9={[Rh]:"SHADOWMAP_TYPE_PCF",[ha]:"SHADOWMAP_TYPE_VSM"};function A9(i){return h9[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const f9={[Fo]:"ENVMAP_TYPE_CUBE",[Ra]:"ENVMAP_TYPE_CUBE",[ac]:"ENVMAP_TYPE_CUBE_UV"};function d9(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":f9[i.envMapMode]||"ENVMAP_TYPE_CUBE"}const p9={[Ra]:"ENVMAP_MODE_REFRACTION"};function m9(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":p9[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}const g9={[Dd]:"ENVMAP_BLENDING_MULTIPLY",[Kw]:"ENVMAP_BLENDING_MIX",[Zw]:"ENVMAP_BLENDING_ADD"};function _9(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":g9[i.combine]||"ENVMAP_BLENDING_NONE"}function x9(i){const e=i.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 v9(i,e,t,n){const r=i.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=A9(t),u=d9(t),d=m9(t),p=_9(t),g=x9(t),x=i9(t),y=r9(s),T=r.createProgram();let S,M,R=t.glslVersion?"#version "+t.glslVersion+` 3986`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Rf).join(` 3987`),S.length>0&&(S+=` 3988`),M=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Rf).join(` 3989`),M.length>0&&(M+=` 3990`)):(S=[wS(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionCl
vendor: 5,787 bytes, lines 3990-3992
3990ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3991`].filter(Rf).join(` 3992`),M=[wS(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",t.envMap?"#define "+p:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.max
vendor: 12,746 bytes, lines 3992-4006
3992Mip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",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||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==wr?"#define TONE_MAPPING":"",t.toneMapping!==wr?_n.tonemapping_pars_fragment:"",t.toneMapping!==wr?t9("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",_n.colorspace_pars_fragment,JF("linearToOutputTexel",t.outputColorSpace),n9(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3993`].filter(Rf).join(` 3994`)),o=b_(o),o=SS(o,t),o=TS(o,t),a=b_(a),a=SS(a,t),a=TS(a,t),o=MS(o),a=MS(a),t.isRawShaderMaterial!==!0&&(R=`#version 300 es 3995`,S=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3996`)+` 3997`+S,M=["#define varying in",t.glslVersion===Mb?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Mb?"":"#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(` 3998`)+` 3999`+M);const E=R+S+o,N=R+M+a,U=vS(r,r.VERTEX_SHADER,E),L=vS(r,r.FRAGMENT_SHADER,N);r.attachShader(T,U),r.attachShader(T,L),t.index0AttributeName!==void 0?r.bindAttribLocation(T,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(T,0,"position"),r.linkProgram(T);function F(k){if(i.debug.checkShaderErrors){const W=r.getProgramInfoLog(T)||"",j=r.getShaderInfoLog(U)||"",Y=r.getShaderInfoLog(L)||"",z=W.trim(),Q=j.trim(),ee=Y.trim();let fe=!0,le=!0;if(r.getProgramParameter(T,r.LINK_STATUS)===!1)if(fe=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,T,U,L);else{const Me=bS(r,U,"vertex"),Ce=bS(r,L,"fragment");ke("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(T,r.VALIDATE_STATUS)+` 4000 4001Material Name: `+k.name+` 4002Material Type: `+k.type+` 4003 4004Program Info Log: `+z+` 4005`+Me+` 4006`+Ce)}else z!==""?Oe("WebGLProgram: Program Info Log:",z):(Q===""||ee==="")&&(le=!1);le&&(k.diagnostics={runnable:fe,programLog:z,vertexShader:{log:Q,prefix:S},fragmentShader:{log:ee,prefix:M}})}r.deleteShader(U),r.deleteShader(L),P=new Vp(r,T),I=s9(r,T)}let P;this.getUniforms=function(){return P===void 0&&F(this),P};let I;this.getAttributes=function(){return I===void 0&&F(this),I};let $=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return $===!1&&($=r.getProgramParameter(T,QF)),$},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(T),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=YF++,this.cacheKey=e,this.usedTimes=1,this.program=T,this.vertexShader=U,this.fragmentShader=L,this}let y9=0;class b9{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new S9(e),t.set(e,n)),n}}class S9{constructor(e){this.id=y9++,this.code=e,this.usedTimes=0}}function T9(i,e,t,n,r,s){const o=new gv,a=new b9,l=new Set,u=[],d=new Map,p=n.logarithmicDepthBuffer;let g=n.precision;const x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 y(P){return l.add(P),P===0?"uv":`uv${P}`}function T(P,I,$,k,W){const j=k.fog,Y=W.geometry,z=P.isMeshStandardMaterial||P.isMeshLambertMaterial||P.isMeshPhongMaterial?k.environment:null,Q=P.isMeshStandardMaterial||P.isMeshLambertMaterial&&!P.envMap||P.isMeshPhongMaterial&&!P.envMap,ee=e.get(P.envMap||z,Q),fe=ee&&ee.mapping===ac?ee.image.height:null,le=x[P.type];P.precision!==null&&(g=n.getMaxPrecision(P.precision),g!==P.precision&&Oe("WebGLProgram.getParameters:",P.precision,"not supported, using",g,"instead."));const Me=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,Ce=Me!==void 0?Me.length:0;let Be=0;Y.morphAttributes.position!==void 0&&(Be=1),Y.morphAttributes.normal!==void 0&&(Be=2),Y.morphAttributes.color!==void 0&&(Be=3);let Ye,qt,bt,Re;if(le){const qn=gs[le];Ye=qn.vertexShader,qt=qn.fragmentShader}else Ye=P.vertexShader,qt=P.fragmentShader,a.update(P),bt=a.getVertexShaderID(P),Re=a.getFragmentShaderID(P);const qe=i.getRenderTarget(),Ke=i.state.buffers.depth.getReversed(),St=W.isInstancedMesh===!0,mt=W.isBatchedMesh===!0,Tt=!!P.map,an=!!P.matcap,Ut=!!ee,Ue=!!P.aoMap,Je=!!P.lightMap,He=!!P.bumpMap,ot=!!P.normalMap,se=!!P.displacementMap,Kt=!!P.emissiveMap,yt=!!P.metalnessMap,zt=!!P.roughnessMap,at=P.anisotropy>0,te=P.clearcoat>0,V=P.dispersion>0,de=P.iridescence>0,Pe=P.sheen>0,$e=P.transmission>0,Le=at&&!!P.anisotropyMap,Nt=te&&!!P.clearcoatMap,ct=te&&!!P.clearcoatNormalMap,Wt=te&&!!P.clearcoatRoughnessMap,Zt=de&&!!P.iridescenceMap,nt=de&&!!P.iridescenceThicknessMap,lt=Pe&&!!P.sheenColorMap,Ot=Pe&&!!P.sheenRoughnessMap,kt=!!P.specularMap,wt=!!P.specularColorMap,Sn=!!P.specularIntensityMap,me=$e&&!!P.transmissionMap,ht=$e&&!!P.thicknessMap,ut=!!P.gradientMap,Pt=!!P.alphaMap,pe=P.alphaTest>0,Ie=!!P.alphaHash,Bt=!!P.extensions;let fn=wr;P.toneMapped&&(qe===null||qe.isXRRenderTarget===!0)&&(fn=i.toneMapping);const ci={shaderID:le,shaderType:P.type,shaderName:P.name,vertexShader:Ye,fragmentShader:qt,defines:P.defines,customVertexShaderID:bt,customFragmentShaderID:Re,isRawShaderMaterial:P.isRawShaderMaterial===!0,glslVersion:P.glslVersion,precision:g,batching:mt,batchingColor:mt&&W._colorsTexture!==null,instancing:St,instancingColor:St&&W.instanceColor!==null,instancingMorph:St&&W.morphTexture!==null,outputColorSpace:qe===null?i.outputColorSpace:qe.isXRRenderTarget===!0?qe.texture.colorSpace:au,alphaToCoverage:!!P.alphaToCoverage,map:Tt,matcap:an,envMap:Ut,envMapMode:Ut&&ee.mapping,envMapCubeUVHeight:fe,aoMap:Ue,lightMap:Je,bumpMap:He,normalMap:ot,displacementMap:se,emissiveMap:Kt,normalMapObjectSpace:ot&&P.normalMapType===eE,normalMapTangentSpace:ot&&P.normalMapType===ma,metalnessMap:yt,roughnessMap:zt,anisotropy:at,anisotropyMap:Le,clearcoat:te,clearcoatMap:Nt,clearcoatNormalMap:ct,clearcoatRoughnessMap:Wt,dispersion:V,iridescence:de,iridescenceMap:Zt,iridescenceThicknessMap:nt,sheen:Pe,sheenColorMap:lt,sheenRoughnessMap:Ot,specularMap:kt,specularColorMap:wt,specularIntensityMap:Sn,transmission:$e,transmissionMap:me,thicknessMap:ht,gradientMap:ut,opaque:P.transparent===!1&&P.blending===mr&&P.alphaToCoverage===!1,alphaMap:Pt,alphaTest:pe,alphaHash:Ie,combine:P.combine,mapUv:Tt&&y(P.map.channel),aoMapUv:Ue&&y(P.aoMap.channel),lightMapUv:Je&&y(P.lightMap.channel),bumpMapUv:He&&y(P.bumpMap.channel),normalMapUv:ot&&y(P.normalMap.channel),displacementMapUv:se&&y(P.displacementMap.channel),emissiveMapUv:Kt&&y(P.emissiveMap.channel),metalnessMapUv:yt&&y(P.metalnessMap.channel),roughnessMapUv:zt&&y(P.roughnessMap.channel),anisotropyMapUv:Le&&y(P.anisotropyMap.channel),clearcoatMapUv:Nt&&y(P.clearcoatMap.channel),clearcoatNormalMapUv:ct&&y(P.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Wt&&y(P.clearcoatRoughnessMap.channel),iridescenceMapUv:Zt&&y(P.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&y(P.iridescenceThicknessMap.channel),sheenColorMapUv:lt&&y(P.sheenColorMap.channel),sheenRoughnessMapUv:Ot&&y(P.sheenRoughnessMap.channel),specularMapUv:kt&&y(P.specularMap.channel),specularColorMapUv:wt&&y(P.specularColorMap.channel),specularIntensityMapUv:Sn&&y(P.specularIntensityMap.channel),transmissionMapUv:me&&y(P.transmissionMap.channel),thicknessMapUv:ht&&y(P.thicknessMap.channel),alphaMapUv:Pt&&y(P.alphaMap.channel),vertexTangents:!!Y.attributes.tangent&&(ot||at),vertexColors:P.vertexColors,vertexAlphas:P.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,pointsUvs:W.isPoints===!0&&!!Y.attributes.uv&&(Tt||Pt),fog:!!j,useFog:P.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:P.wireframe===!1&&(P.flatShading===!0||Y.attributes.normal===void 0&&ot===!1&&(P.isMeshLambertMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isMeshPhysicalMaterial)),sizeAttenuation:P.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:Ke,skinning:W.isSkinnedMesh===!0,morphTargets:Y.morphAttributes.position!==void 0,morphNormals:Y.morphAttributes.normal!==void 0,morphColors:Y.morphAttributes.color!==void 0,morphTargetsCount:Ce,morphTextureStride:Be,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:P.dithering,shadowMapEnabled:i.shadowMap.enabled&&$.length>0,shadowMapType:i.shadowMap.type,toneMapping:fn,decodeVideoTexture:Tt&&P.map.isVideoTexture===!0&&Yt.getTransfer(P.map.colorSpace)===_t,decodeVideoTextureEmissive:Kt&&P.emissiveMap.isVideoTexture===!0&&Yt.getTransfer(P.emissiveMap.colorSpace)===_t,premultipliedAlpha:P.premultipliedAlpha,doubleSided:P.side===Ui,flipSided:P.side===Xn,useDepthPacking:P.depthPacking>=0,depthPacking:P.depthPacking||0,index0AttributeName:P.index0AttributeName,extensionCl
vendor: 1,506 bytes, line 4006
4006ipCullDistance:Bt&&P.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Bt&&P.extensions.multiDraw===!0||mt)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:P.customProgramCacheKey()};return ci.vertexUv1s=l.has(1),ci.vertexUv2s=l.has(2),ci.vertexUv3s=l.has(3),l.clear(),ci}function S(P){const I=[];if(P.shaderID?I.push(P.shaderID):(I.push(P.customVertexShaderID),I.push(P.customFragmentShaderID)),P.defines!==void 0)for(const $ in P.defines)I.push($),I.push(P.defines[$]);return P.isRawShaderMaterial===!1&&(M(I,P),R(I,P),I.push(i.outputColorSpace)),I.push(P.customProgramCacheKey),I.join()}function M(P,I){P.push(I.precision),P.push(I.outputColorSpace),P.push(I.envMapMode),P.push(I.envMapCubeUVHeight),P.push(I.mapUv),P.push(I.alphaMapUv),P.push(I.lightMapUv),P.push(I.aoMapUv),P.push(I.bumpMapUv),P.push(I.normalMapUv),P.push(I.displacementMapUv),P.push(I.emissiveMapUv),P.push(I.metalnessMapUv),P.push(I.roughnessMapUv),P.push(I.anisotropyMapUv),P.push(I.clearcoatMapUv),P.push(I.clearcoatNormalMapUv),P.push(I.clearcoatRoughnessMapUv),P.push(I.iridescenceMapUv),P.push(I.iridescenceThicknessMapUv),P.push(I.sheenColorMapUv),P.push(I.sheenRoughnessMapUv),P.push(I.specularMapUv),P.push(I.specularColorMapUv),P.push(I.specularIntensityMapUv),P.push(I.transmissionMapUv),P.push(I.thicknessMapUv),P.push(I.combine),P.push(I.fogExp2),P.push(I.sizeAttenuation),P.push(I.morphTargetsCount),P.pu
vendor: 6,750 bytes, line 4006
4006sh(I.morphAttributeCount),P.push(I.numDirLights),P.push(I.numPointLights),P.push(I.numSpotLights),P.push(I.numSpotLightMaps),P.push(I.numHemiLights),P.push(I.numRectAreaLights),P.push(I.numDirLightShadows),P.push(I.numPointLightShadows),P.push(I.numSpotLightShadows),P.push(I.numSpotLightShadowsWithMaps),P.push(I.numLightProbes),P.push(I.shadowMapType),P.push(I.toneMapping),P.push(I.numClippingPlanes),P.push(I.numClipIntersection),P.push(I.depthPacking)}function R(P,I){o.disableAll(),I.instancing&&o.enable(0),I.instancingColor&&o.enable(1),I.instancingMorph&&o.enable(2),I.matcap&&o.enable(3),I.envMap&&o.enable(4),I.normalMapObjectSpace&&o.enable(5),I.normalMapTangentSpace&&o.enable(6),I.clearcoat&&o.enable(7),I.iridescence&&o.enable(8),I.alphaTest&&o.enable(9),I.vertexColors&&o.enable(10),I.vertexAlphas&&o.enable(11),I.vertexUv1s&&o.enable(12),I.vertexUv2s&&o.enable(13),I.vertexUv3s&&o.enable(14),I.vertexTangents&&o.enable(15),I.anisotropy&&o.enable(16),I.alphaHash&&o.enable(17),I.batching&&o.enable(18),I.dispersion&&o.enable(19),I.batchingColor&&o.enable(20),I.gradientMap&&o.enable(21),P.push(o.mask),o.disableAll(),I.fog&&o.enable(0),I.useFog&&o.enable(1),I.flatShading&&o.enable(2),I.logarithmicDepthBuffer&&o.enable(3),I.reversedDepthBuffer&&o.enable(4),I.skinning&&o.enable(5),I.morphTargets&&o.enable(6),I.morphNormals&&o.enable(7),I.morphColors&&o.enable(8),I.premultipliedAlpha&&o.enable(9),I.shadowMapEnabled&&o.enable(10),I.doubleSided&&o.enable(11),I.flipSided&&o.enable(12),I.useDepthPacking&&o.enable(13),I.dithering&&o.enable(14),I.transmission&&o.enable(15),I.sheen&&o.enable(16),I.opaque&&o.enable(17),I.pointsUvs&&o.enable(18),I.decodeVideoTexture&&o.enable(19),I.decodeVideoTextureEmissive&&o.enable(20),I.alphaToCoverage&&o.enable(21),P.push(o.mask)}function E(P){const I=x[P.type];let $;if(I){const k=gs[I];$=Cv.clone(k.uniforms)}else $=P.uniforms;return $}function N(P,I){let $=d.get(I);return $!==void 0?++$.usedTimes:($=new v9(i,I,P,r),u.push($),d.set(I,$)),$}function U(P){if(--P.usedTimes===0){const I=u.indexOf(P);u[I]=u[u.length-1],u.pop(),d.delete(P.cacheKey),P.destroy()}}function L(P){a.remove(P)}function F(){a.dispose()}return{getParameters:T,getProgramCacheKey:S,getUniforms:E,acquireProgram:N,releaseProgram:U,releaseShaderCache:L,programs:u,dispose:F}}function M9(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function w9(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function ES(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function RS(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(g){let x=0;return g.isInstancedMesh&&(x+=2),g.isSkinnedMesh&&(x+=1),x}function a(g,x,y,T,S,M){let R=i[e];return R===void 0?(R={id:g.id,object:g,geometry:x,material:y,materialVariant:o(g),groupOrder:T,renderOrder:g.renderOrder,z:S,group:M},i[e]=R):(R.id=g.id,R.object=g,R.geometry=x,R.material=y,R.materialVariant=o(g),R.groupOrder=T,R.renderOrder=g.renderOrder,R.z=S,R.group=M),e++,R}function l(g,x,y,T,S,M){const R=a(g,x,y,T,S,M);y.transmission>0?n.push(R):y.transparent===!0?r.push(R):t.push(R)}function u(g,x,y,T,S,M){const R=a(g,x,y,T,S,M);y.transmission>0?n.unshift(R):y.transparent===!0?r.unshift(R):t.unshift(R)}function d(g,x){t.length>1&&t.sort(g||w9),n.length>1&&n.sort(x||ES),r.length>1&&r.sort(x||ES)}function p(){for(let g=e,x=i.length;g<x;g++){const y=i[g];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:u,finish:p,sort:d}}function E9(){let i=new WeakMap;function e(n,r){const s=i.get(n);let o;return s===void 0?(o=new RS,i.set(n,[o])):r>=s.length?(o=new RS,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function R9(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new J,color:new It};break;case"SpotLight":t={position:new J,direction:new J,color:new It,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new J,color:new It,distance:0,decay:0};break;case"HemisphereLight":t={direction:new J,skyColor:new It,groundColor:new It};break;case"RectAreaLight":t={color:new It,position:new J,halfWidth:new J,halfHeight:new J};break}return i[e.id]=t,t}}}function C9(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let N9=0;function P9(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function D9(i){const e=new R9,t=C9(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)n.probe.push(new J);const r=new J,s=new nn,o=new nn;function a(u){let d=0,p=0,g=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let x=0,y=0,T=0,S=0,M=0,R=0,E=0,N=0,U=0,L=0,F=0;u.sort(P9);for(let I=0,$=u.length;I<$;I++){const k=u[I],W=k.color,j=k.intensity,Y=k.distance;let z=null;if(k.shadow&&k.shadow.map&&(k.shadow.map.texture.format===ls?z=k.shadow.map.texture:z=k.shadow.map.depthTexture||k.shadow.map.texture),k.isAmbientLight)d+=W.r*j,p+=W.g*j,g+=W.b*j;else if(k.isLightProbe){for(let Q=0;Q<9;Q++)n.probe[Q].addScaledVector(k.sh.coefficients[Q],j);F++}else if(k.isDirectionalLight){const Q=e.get(k);if(Q.color.copy(k.color).multiplyScalar(k.intensity),k.castShadow){const ee=k.shadow,fe=t.get(k);
vendor: 4,463 bytes, line 4006
4006fe.shadowIntensity=ee.intensity,fe.shadowBias=ee.bias,fe.shadowNormalBias=ee.normalBias,fe.shadowRadius=ee.radius,fe.shadowMapSize=ee.mapSize,n.directionalShadow[x]=fe,n.directionalShadowMap[x]=z,n.directionalShadowMatrix[x]=k.shadow.matrix,R++}n.directional[x]=Q,x++}else if(k.isSpotLight){const Q=e.get(k);Q.position.setFromMatrixPosition(k.matrixWorld),Q.color.copy(W).multiplyScalar(j),Q.distance=Y,Q.coneCos=Math.cos(k.angle),Q.penumbraCos=Math.cos(k.angle*(1-k.penumbra)),Q.decay=k.decay,n.spot[T]=Q;const ee=k.shadow;if(k.map&&(n.spotLightMap[U]=k.map,U++,ee.updateMatrices(k),k.castShadow&&L++),n.spotLightMatrix[T]=ee.matrix,k.castShadow){const fe=t.get(k);fe.shadowIntensity=ee.intensity,fe.shadowBias=ee.bias,fe.shadowNormalBias=ee.normalBias,fe.shadowRadius=ee.radius,fe.shadowMapSize=ee.mapSize,n.spotShadow[T]=fe,n.spotShadowMap[T]=z,N++}T++}else if(k.isRectAreaLight){const Q=e.get(k);Q.color.copy(W).multiplyScalar(j),Q.halfWidth.set(k.width*.5,0,0),Q.halfHeight.set(0,k.height*.5,0),n.rectArea[S]=Q,S++}else if(k.isPointLight){const Q=e.get(k);if(Q.color.copy(k.color).multiplyScalar(k.intensity),Q.distance=k.distance,Q.decay=k.decay,k.castShadow){const ee=k.shadow,fe=t.get(k);fe.shadowIntensity=ee.intensity,fe.shadowBias=ee.bias,fe.shadowNormalBias=ee.normalBias,fe.shadowRadius=ee.radius,fe.shadowMapSize=ee.mapSize,fe.shadowCameraNear=ee.camera.near,fe.shadowCameraFar=ee.camera.far,n.pointShadow[y]=fe,n.pointShadowMap[y]=z,n.pointShadowMatrix[y]=k.shadow.matrix,E++}n.point[y]=Q,y++}else if(k.isHemisphereLight){const Q=e.get(k);Q.skyColor.copy(k.color).multiplyScalar(j),Q.groundColor.copy(k.groundColor).multiplyScalar(j),n.hemi[M]=Q,M++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=pt.LTC_FLOAT_1,n.rectAreaLTC2=pt.LTC_FLOAT_2):(n.rectAreaLTC1=pt.LTC_HALF_1,n.rectAreaLTC2=pt.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=p,n.ambient[2]=g;const P=n.hash;(P.directionalLength!==x||P.pointLength!==y||P.spotLength!==T||P.rectAreaLength!==S||P.hemiLength!==M||P.numDirectionalShadows!==R||P.numPointShadows!==E||P.numSpotShadows!==N||P.numSpotMaps!==U||P.numLightProbes!==F)&&(n.directional.length=x,n.spot.length=T,n.rectArea.length=S,n.point.length=y,n.hemi.length=M,n.directionalShadow.length=R,n.directionalShadowMap.length=R,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=N,n.spotShadowMap.length=N,n.directionalShadowMatrix.length=R,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=N+U-L,n.spotLightMap.length=U,n.numSpotLightShadowsWithMaps=L,n.numLightProbes=F,P.directionalLength=x,P.pointLength=y,P.spotLength=T,P.rectAreaLength=S,P.hemiLength=M,P.numDirectionalShadows=R,P.numPointShadows=E,P.numSpotShadows=N,P.numSpotMaps=U,P.numLightProbes=F,n.version=N9++)}function l(u,d){let p=0,g=0,x=0,y=0,T=0;const S=d.matrixWorldInverse;for(let M=0,R=u.length;M<R;M++){const E=u[M];if(E.isDirectionalLight){const N=n.directional[p];N.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),N.direction.sub(r),N.direction.transformDirection(S),p++}else if(E.isSpotLight){const N=n.spot[x];N.position.setFromMatrixPosition(E.matrixWorld),N.position.applyMatrix4(S),N.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),N.direction.sub(r),N.direction.transformDirection(S),x++}else if(E.isRectAreaLight){const N=n.rectArea[y];N.position.setFromMatrixPosition(E.matrixWorld),N.position.applyMatrix4(S),o.identity(),s.copy(E.matrixWorld),s.premultiply(S),o.extractRotation(s),N.halfWidth.set(E.width*.5,0,0),N.halfHeight.set(0,E.height*.5,0),N.halfWidth.applyMatrix4(o),N.halfHeight.applyMatrix4(o),y++}else if(E.isPointLight){const N=n.point[g];N.position.setFromMatrixPosition(E.matrixWorld),N.position.applyMatrix4(S),g++}else if(E.isHemisphereLight){const N=n.hemi[T];N.direction.setFromMatrixPosition(E.matrixWorld),N.direction.transformDirection(S),T++}}}return{setup:a,setupView:l,state:n}}function CS(i){const e=new D9(i),t=[],n=[];function r(d){u.camera=d,t.length=0,n.length=0}function s(d){t.push(d)}function o(d){n.push(d)}function a(){e.setup(t)}function l(d){e.setupView(t,d)}const u={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:u,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function L9(i){let e=new WeakMap;function t(r,s=0){const o=e.get(r);let a;return o===void 0?(a=new CS(i),e.set(r,[a])):s>=o.length?(a=new CS(i),o.push(a)):a=o[s],a}
vendor: 4,113 bytes, lines 4006-4033
4006function n(){e=new WeakMap}return{get:t,dispose:n}}const I9=`void main() { 4007 gl_Position = vec4( position, 1.0 ); 4008}`,B9=`uniform sampler2D shadow_pass; 4009uniform vec2 resolution; 4010uniform float radius; 4011void main() { 4012 const float samples = float( VSM_SAMPLES ); 4013 float mean = 0.0; 4014 float squared_mean = 0.0; 4015 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 4016 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 4017 for ( float i = 0.0; i < samples; i ++ ) { 4018 float uvOffset = uvStart + i * uvStride; 4019 #ifdef HORIZONTAL_PASS 4020 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 4021 mean += distribution.x; 4022 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 4023 #else 4024 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 4025 mean += depth; 4026 squared_mean += depth * depth; 4027 #endif 4028 } 4029 mean = mean / samples; 4030 squared_mean = squared_mean / samples; 4031 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 4032 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 4033}`,F9=[new J(1,0,0),new J(-1,0,0),new J(0,1,0),new J(0,-1,0),new J(0,0,1),new J(0,0,-1)],U9=[new J(0,-1,0),new J(0,-1,0),new J(0,0,1),new J(0,0,-1),new J(0,-1,0),new J(0,-1,0)],NS=new nn,sf=new J,n2=new J;function O9(i,e,t){let n=new IA;const r=new We,s=new We,o=new rn,a=new ID,l=new BD,u={},d=t.maxTextureSize,p={[cs]:Xn,[Xn]:cs,[Ui]:Ui},g=new ws({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new We},radius:{value:4}},vertexShader:I9,fragmentShader:B9}),x=g.clone();x.defines.HORIZONTAL_PASS=1;const y=new Wn;y.setAttribute("position",new Di(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const T=new Qn(y,g),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Rh;let M=this.type;this.render=function(L,F,P){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||L.length===0)return;this.type===Xw&&(Oe("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Rh);const I=i.getRenderTarget(),$=i.getActiveCubeFace(),k=i.getActiveMipmapLevel(),W=i.state;W.setBlending(gr),W.buffers.depth.getReversed()===!0?W.buffers.color.setClear(0,0,0,0):W.buffers.color.setClear(1,1,1,1),W.buffers.depth.setTest(!0),W.setScissorTest(!1);const j=M!==this.type;j&&F.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach(z=>z.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,z=L.length;Y<z;Y++){const Q=L[Y],ee=Q.shadow;if(ee===void 0){Oe("WebGLShadowMap:",Q,"has no shadow.");continue}if(ee.autoUpdate===!1&&ee.needsUpdate===!1)continue;r.copy(ee.mapSize);const fe=ee.getFrameExtents();r.multiply(fe),s.copy(ee.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/fe.x),r.x=s.x*fe.x,ee.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/fe.y),r.y=s.y*fe.y,ee.mapSize.y=s.y));const le=i.state.buffers.depth.getReversed();if(ee.camera._reversedDepth=le,ee.map===null||j===!0){if(ee.map!==null&&(ee.map.depthTexture!==null&&(ee.map.depthTexture.dispose(),ee.map.depthTexture=null),ee.map.dispose()),this.type===ha){if(Q.isPointLight){Oe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ee.map=new _a(r.x,r.y,{format:ls,type:Mi,minFilter:li,magFilter:li,generateMipmaps:!1}),ee.map.texture.name=Q.name+".shadowMap",ee.map.depthTexture=new qr(r.x,r.y,zi),ee.map.depthTexture.name=Q.name+".shadowMapDepth",ee.map.depthTexture.format=Rr,ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=jn,ee.map.depthTexture.magFilter=jn}else Q.isPointLight?(ee.map=new ME(r.x),ee.map.depthTexture=new aE(r.x,ii)):(ee.map=new _a(r.x,r.y),ee.map.depthTexture=new qr(r.x,r.y,ii)),ee.map.depthTexture.name=Q.name+".shadowMap",ee.map.depthTexture.format=Rr,this.type===Rh?(ee.map.depthTexture.compareFunction=le?al:fu,ee.map.depthTexture.minFilter=li,ee.map.depthTexture.magFilter=li):(ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=jn,ee.map.depthTexture.magFilter=jn);ee.camera.updateProjectionMatrix()}
vendor: 58,035 bytes, lines 4033-4057
4033const Me=ee.map.isWebGLCubeRenderTarget?6:1;for(let Ce=0;Ce<Me;Ce++){if(ee.map.isWebGLCubeRenderTarget)i.setRenderTarget(ee.map,Ce),i.clear();else{Ce===0&&(i.setRenderTarget(ee.map),i.clear());const Be=ee.getViewport(Ce);o.set(s.x*Be.x,s.y*Be.y,s.x*Be.z,s.y*Be.w),W.viewport(o)}if(Q.isPointLight){const Be=ee.camera,Ye=ee.matrix,qt=Q.distance||Be.far;qt!==Be.far&&(Be.far=qt,Be.updateProjectionMatrix()),sf.setFromMatrixPosition(Q.matrixWorld),Be.position.copy(sf),n2.copy(Be.position),n2.add(F9[Ce]),Be.up.copy(U9[Ce]),Be.lookAt(n2),Be.updateMatrixWorld(),Ye.makeTranslation(-sf.x,-sf.y,-sf.z),NS.multiplyMatrices(Be.projectionMatrix,Be.matrixWorldInverse),ee._frustum.setFromProjectionMatrix(NS,Be.coordinateSystem,Be.reversedDepth)}else ee.updateMatrices(Q);n=ee.getFrustum(),N(F,P,ee.camera,Q,this.type)}ee.isPointLightShadow!==!0&&this.type===ha&&R(ee,P),ee.needsUpdate=!1}M=this.type,S.needsUpdate=!1,i.setRenderTarget(I,$,k)};function R(L,F){const P=e.update(T);g.defines.VSM_SAMPLES!==L.blurSamples&&(g.defines.VSM_SAMPLES=L.blurSamples,x.defines.VSM_SAMPLES=L.blurSamples,g.needsUpdate=!0,x.needsUpdate=!0),L.mapPass===null&&(L.mapPass=new _a(r.x,r.y,{format:ls,type:Mi})),g.uniforms.shadow_pass.value=L.map.depthTexture,g.uniforms.resolution.value=L.mapSize,g.uniforms.radius.value=L.radius,i.setRenderTarget(L.mapPass),i.clear(),i.renderBufferDirect(F,null,P,g,T,null),x.uniforms.shadow_pass.value=L.mapPass.texture,x.uniforms.resolution.value=L.mapSize,x.uniforms.radius.value=L.radius,i.setRenderTarget(L.map),i.clear(),i.renderBufferDirect(F,null,P,x,T,null)}function E(L,F,P,I){let $=null;const k=P.isPointLight===!0?L.customDistanceMaterial:L.customDepthMaterial;if(k!==void 0)$=k;else if($=P.isPointLight===!0?l:a,i.localClippingEnabled&&F.clipShadows===!0&&Array.isArray(F.clippingPlanes)&&F.clippingPlanes.length!==0||F.displacementMap&&F.displacementScale!==0||F.alphaMap&&F.alphaTest>0||F.map&&F.alphaTest>0||F.alphaToCoverage===!0){const W=$.uuid,j=F.uuid;let Y=u[W];Y===void 0&&(Y={},u[W]=Y);let z=Y[j];z===void 0&&(z=$.clone(),Y[j]=z,F.addEventListener("dispose",U)),$=z}if($.visible=F.visible,$.wireframe=F.wireframe,I===ha?$.side=F.shadowSide!==null?F.shadowSide:F.side:$.side=F.shadowSide!==null?F.shadowSide:p[F.side],$.alphaMap=F.alphaMap,$.alphaTest=F.alphaToCoverage===!0?.5:F.alphaTest,$.map=F.map,$.clipShadows=F.clipShadows,$.clippingPlanes=F.clippingPlanes,$.clipIntersection=F.clipIntersection,$.displacementMap=F.displacementMap,$.displacementScale=F.displacementScale,$.displacementBias=F.displacementBias,$.wireframeLinewidth=F.wireframeLinewidth,$.linewidth=F.linewidth,P.isPointLight===!0&&$.isMeshDistanceMaterial===!0){const W=i.properties.get($);W.light=P}return $}function N(L,F,P,I,$){if(L.visible===!1)return;if(L.layers.test(F.layers)&&(L.isMesh||L.isLine||L.isPoints)&&(L.castShadow||L.receiveShadow&&$===ha)&&(!L.frustumCulled||n.intersectsObject(L))){L.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,L.matrixWorld);const j=e.update(L),Y=L.material;if(Array.isArray(Y)){const z=j.groups;for(let Q=0,ee=z.length;Q<ee;Q++){const fe=z[Q],le=Y[fe.materialIndex];if(le&&le.visible){const Me=E(L,le,I,$);L.onBeforeShadow(i,L,F,P,j,Me,fe),i.renderBufferDirect(P,null,j,Me,L,fe),L.onAfterShadow(i,L,F,P,j,Me,fe)}}}else if(Y.visible){const z=E(L,Y,I,$);L.onBeforeShadow(i,L,F,P,j,z,null),i.renderBufferDirect(P,null,j,z,L,null),L.onAfterShadow(i,L,F,P,j,z,null)}}const W=L.children;for(let j=0,Y=W.length;j<Y;j++)N(W[j],F,P,I,$)}function U(L){L.target.removeEventListener("dispose",U);for(const P in u){const I=u[P],$=L.target.uuid;$ in I&&(I[$].dispose(),delete I[$])}}}function k9(i,e){function t(){let me=!1;const ht=new rn;let ut=null;const Pt=new rn(0,0,0,0);return{setMask:function(pe){ut!==pe&&!me&&(i.colorMask(pe,pe,pe,pe),ut=pe)},setLocked:function(pe){me=pe},setClear:function(pe,Ie,Bt,fn,ci){ci===!0&&(pe*=fn,Ie*=fn,Bt*=fn),ht.set(pe,Ie,Bt,fn),Pt.equals(ht)===!1&&(i.clearColor(pe,Ie,Bt,fn),Pt.copy(ht))},reset:function(){me=!1,ut=null,Pt.set(-1,0,0,0)}}}function n(){let me=!1,ht=!1,ut=null,Pt=null,pe=null;return{setReversed:function(Ie){if(ht!==Ie){const Bt=e.get("EXT_clip_control");Ie?Bt.clipControlEXT(Bt.LOWER_LEFT_EXT,Bt.ZERO_TO_ONE_EXT):Bt.clipControlEXT(Bt.LOWER_LEFT_EXT,Bt.NEGATIVE_ONE_TO_ONE_EXT),ht=Ie;const fn=pe;pe=null,this.setClear(fn)}},getReversed:function(){return ht},setTest:function(Ie){Ie?qe(i.DEPTH_TEST):Ke(i.DEPTH_TEST)},setMask:function(Ie){ut!==Ie&&!me&&(i.depthMask(Ie),ut=Ie)},setFunc:function(Ie){if(ht&&(Ie=fv[Ie]),Pt!==Ie){switch(Ie){case Yf:i.depthFunc(i.NEVER);break;case Kf:i.depthFunc(i.ALWAYS);break;case Zf:i.depthFunc(i.LESS);break;case ou:i.depthFunc(i.LEQUAL);break;case Jf:i.depthFunc(i.EQUAL);break;case ed:i.depthFunc(i.GEQUAL);break;case td:i.depthFunc(i.GREATER);break;case nd:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Pt=Ie}},setLocked:function(Ie){me=Ie},setClear:function(Ie){pe!==Ie&&(pe=Ie,ht&&(Ie=1-Ie),i.clearDepth(Ie))},reset:function(){me=!1,ut=null,Pt=null,pe=null,ht=!1}}}function r(){let me=!1,ht=null,ut=null,Pt=null,pe=null,Ie=null,Bt=null,fn=null,ci=null;return{setTest:function(qn){me||(qn?qe(i.STENCIL_TEST):Ke(i.STENCIL_TEST))},setMask:function(qn){ht!==qn&&!me&&(i.stencilMask(qn),ht=qn)},setFunc:function(qn,Xs,Qs){(ut!==qn||Pt!==Xs||pe!==Qs)&&(i.stencilFunc(qn,Xs,Qs),ut=qn,Pt=Xs,pe=Qs)},setOp:function(qn,Xs,Qs){(Ie!==qn||Bt!==Xs||fn!==Qs)&&(i.stencilOp(qn,Xs,Qs),Ie=qn,Bt=Xs,fn=Qs)},setLocked:function(qn){me=qn},setClear:function(qn){ci!==qn&&(i.clearStencil(qn),ci=qn)},reset:function(){me=!1,ht=null,ut=null,Pt=null,pe=null,Ie=null,Bt=null,fn=null,ci=null}}}const s=new t,o=new n,a=new r,l=new WeakMap,u=new WeakMap;let d={},p={},g=new WeakMap,x=[],y=null,T=!1,S=null,M=null,R=null,E=null,N=null,U=null,L=null,F=new It(0,0,0),P=0,I=!1,$=null,k=null,W=null,j=null,Y=null;const z=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Q=!1,ee=0;const fe=i.getParameter(i.VERSION);fe.indexOf("WebGL")!==-1?(ee=parseFloat(/^WebGL (\d)/.exec(fe)[1]),Q=ee>=1):fe.indexOf("OpenGL ES")!==-1&&(ee=parseFloat(/^OpenGL ES (\d)/.exec(fe)[1]),Q=ee>=2);let le=null,Me={};const Ce=i.getParameter(i.SCISSOR_BOX),Be=i.getParameter(i.VIEWPORT),Ye=new rn().fromArray(Ce),qt=new rn().fromArray(Be);function bt(me,ht,ut,Pt){const pe=new Uint8Array(4),Ie=i.createTexture();i.bindTexture(me,Ie),i.texParameteri(me,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(me,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Bt=0;Bt<ut;Bt++)me===i.TEXTURE_3D||me===i.TEXTURE_2D_ARRAY?i.texImage3D(ht,0,i.RGBA,1,1,Pt,0,i.RGBA,i.UNSIGNED_BYTE,pe):i.texImage2D(ht+Bt,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,pe);return Ie}const Re={};Re[i.TEXTURE_2D]=bt(i.TEXTURE_2D,i.TEXTURE_2D,1),Re[i.TEXTURE_CUBE_MAP]=bt(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Re[i.TEXTURE_2D_ARRAY]=bt(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Re[i.TEXTURE_3D]=bt(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),qe(i.DEPTH_TEST),o.setFunc(ou),He(!1),ot(c_),qe(i.CULL_FACE),Ue(gr);function qe(me){d[me]!==!0&&(i.enable(me),d[me]=!0)}function Ke(me){d[me]!==!1&&(i.disable(me),d[me]=!1)}function St(me,ht){return p[me]!==ht?(i.bindFramebuffer(me,ht),p[me]=ht,me===i.DRAW_FRAMEBUFFER&&(p[i.FRAMEBUFFER]=ht),me===i.FRAMEBUFFER&&(p[i.DRAW_FRAMEBUFFER]=ht),!0):!1}function mt(me,ht){let ut=x,Pt=!1;if(me){ut=g.get(ht),ut===void 0&&(ut=[],g.set(ht,ut));const pe=me.textures;if(ut.length!==pe.length||ut[0]!==i.COLOR_ATTACHMENT0){for(let Ie=0,Bt=pe.length;Ie<Bt;Ie++)ut[Ie]=i.COLOR_ATTACHMENT0+Ie;ut.length=pe.length,Pt=!0}}else ut[0]!==i.BACK&&(ut[0]=i.BACK,Pt=!0);Pt&&i.drawBuffers(ut)}function Tt(me){return y!==me?(i.useProgram(me),y=me,!0):!1}const an={[Mr]:i.FUNC_ADD,[Hx]:i.FUNC_SUBTRACT,[Wx]:i.FUNC_REVERSE_SUBTRACT};an[Qw]=i.MIN,an[Yw]=i.MAX;const Ut={[Xa]:i.ZERO,[$x]:i.ONE,[jx]:i.SRC_COLOR,[Gh]:i.SRC_ALPHA,[Jx]:i.SRC_ALPHA_SATURATE,[Kx]:i.DST_COLOR,[Qx]:i.DST_ALPHA,[Xx]:i.ONE_MINUS_SRC_COLOR,[Vh]:i.ONE_MINUS_SRC_ALPHA,[Zx]:i.ONE_MINUS_DST_COLOR,[Yx]:i.ONE_MINUS_DST_ALPHA,[OP]:i.CONSTANT_COLOR,[kP]:i.ONE_MINUS_CONSTANT_COLOR,[GP]:i.CONSTANT_ALPHA,[VP]:i.ONE_MINUS_CONSTANT_ALPHA};function Ue(me,ht,ut,Pt,pe,Ie,Bt,fn,ci,qn){if(me===gr){T===!0&&(Ke(i.BLEND),T=!1);return}if(T===!1&&(qe(i.BLEND),T=!0),me!==Ju){if(me!==S||qn!==I){if((M!==Mr||N!==Mr)&&(i.blendEquation(i.FUNC_ADD),M=Mr,N=Mr),qn)switch(me){case mr:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Aa:i.blendFunc(i.ONE,i.ONE);break;case $l:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case jl:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ke("WebGLState: Invalid blending: ",me);break}else switch(me){case mr:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Aa:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case $l:ke("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case jl:ke("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ke("WebGLState: Invalid blending: ",me);break}R=null,E=null,U=null,L=null,F.set(0,0,0),P=0,S=me,I=qn}return}pe=pe||ht,Ie=Ie||ut,Bt=Bt||Pt,(ht!==M||pe!==N)&&(i.blendEquationSeparate(an[ht],an[pe]),M=ht,N=pe),(ut!==R||Pt!==E||Ie!==U||Bt!==L)&&(i.blendFuncSeparate(Ut[ut],Ut[Pt],Ut[Ie],Ut[Bt]),R=ut,E=Pt,U=Ie,L=Bt),(fn.equals(F)===!1||ci!==P)&&(i.blendColor(fn.r,fn.g,fn.b,ci),F.copy(fn),P=ci),S=me,I=!1}function Je(me,ht){me.side===Ui?Ke(i.CULL_FACE):qe(i.CULL_FACE);let ut=me.side===Xn;ht&&(ut=!ut),He(ut),me.blending===mr&&me.transparent===!1?Ue(gr):Ue(me.blending,me.blendEquation,me.blendSrc,me.blendDst,me.blendEquationAlpha,me.blendSrcAlpha,me.blendDstAlpha,me.blendColor,me.blendAlpha,me.premultipliedAlpha),o.setFunc(me.depthFunc),o.setTest(me.depthTest),o.setMask(me.depthWrite),s.setMask(me.colorWrite);const Pt=me.stencilWrite;a.setTest(Pt),Pt&&(a.setMask(me.stencilWriteMask),a.setFunc(me.stencilFunc,me.stencilRef,me.stencilFuncMask),a.setOp(me.stencilFail,me.stencilZFail,me.stencilZPass)),Kt(me.polygonOffset,me.polygonOffsetFactor,me.polygonOffsetUnits),me.alphaToCoverage===!0?qe(i.SAMPLE_ALPHA_TO_COVERAGE):Ke(i.SAMPLE_ALPHA_TO_COVERAGE)}function He(me){$!==me&&(me?i.frontFace(i.CW):i.frontFace(i.CCW),$=me)}function ot(me){me!==$w?(qe(i.CULL_FACE),me!==k&&(me===c_?i.cullFace(i.BACK):me===jw?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Ke(i.CULL_FACE),k=me}function se(me){me!==W&&(Q&&i.lineWidth(me),W=me)}function Kt(me,ht,ut){me?(qe(i.POLYGON_OFFSET_FILL),(j!==ht||Y!==ut)&&(j=ht,Y=ut,o.getReversed()&&(ht=-ht),i.polygonOffset(ht,ut))):Ke(i.POLYGON_OFFSET_FILL)}function yt(me){me?qe(i.SCISSOR_TEST):Ke(i.SCISSOR_TEST)}function zt(me){me===void 0&&(me=i.TEXTURE0+z-1),le!==me&&(i.activeTexture(me),le=me)}function at(me,ht,ut){ut===void 0&&(le===null?ut=i.TEXTURE0+z-1:ut=le);let Pt=Me[ut];Pt===void 0&&(Pt={type:void 0,texture:void 0},Me[ut]=Pt),(Pt.type!==me||Pt.texture!==ht)&&(le!==ut&&(i.activeTexture(ut),le=ut),i.bindTexture(me,ht||Re[me]),Pt.type=me,Pt.texture=ht)}function te(){const me=Me[le];me!==void 0&&me.type!==void 0&&(i.bindTexture(me.type,null),me.type=void 0,me.texture=void 0)}function V(){try{i.compressedTexImage2D(...arguments)}catch(me){ke("WebGLState:",me)}}function de(){try{i.compressedTexImage3D(...arguments)}catch(me){ke("WebGLState:",me)}}function Pe(){try{i.texSubImage2D(...arguments)}catch(me){ke("WebGLState:",me)}}function $e(){try{i.texSubImage3D(...arguments)}catch(me){ke("WebGLState:",me)}}function Le(){try{i.compressedTexSubImage2D(...arguments)}catch(me){ke("WebGLState:",me)}}function Nt(){try{i.compressedTexSubImage3D(...arguments)}catch(me){ke("WebGLState:",me)}}function ct(){try{i.texStorage2D(...arguments)}catch(me){ke("WebGLState:",me)}}function Wt(){try{i.texStorage3D(...arguments)}catch(me){ke("WebGLState:",me)}}function Zt(){try{i.texImage2D(...arguments)}catch(me){ke("WebGLState:",me)}}function nt(){try{i.texImage3D(...arguments)}catch(me){ke("WebGLState:",me)}}function lt(me){Ye.equals(me)===!1&&(i.scissor(me.x,me.y,me.z,me.w),Ye.copy(me))}function Ot(me){qt.equals(me)===!1&&(i.viewport(me.x,me.y,me.z,me.w),qt.copy(me))}function kt(me,ht){let ut=u.get(ht);ut===void 0&&(ut=new WeakMap,u.set(ht,ut));let Pt=ut.get(me);Pt===void 0&&(Pt=i.getUniformBlockIndex(ht,me.name),ut.set(me,Pt))}function wt(me,ht){const Pt=u.get(ht).get(me);l.get(ht)!==Pt&&(i.uniformBlockBinding(ht,Pt,me.__bindingPointIndex),l.set(ht,Pt))}function Sn(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),d={},le=null,Me={},p={},g=new WeakMap,x=[],y=null,T=!1,S=null,M=null,R=null,E=null,N=null,U=null,L=null,F=new It(0,0,0),P=0,I=!1,$=null,k=null,W=null,j=null,Y=null,Ye.set(0,0,i.canvas.width,i.canvas.height),qt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:qe,disable:Ke,bindFramebuffer:St,drawBuffers:mt,useProgram:Tt,setBlending:Ue,setMaterial:Je,setFlipSided:He,setCullFace:ot,setLineWidth:se,setPolygonOffset:Kt,setScissorTest:yt,activeTexture:zt,bindTexture:at,unbindTexture:te,compressedTexImage2D:V,compressedTexImage3D:de,texImage2D:Zt,texImage3D:nt,updateUBOMapping:kt,uniformBlockBinding:wt,texStorage2D:ct,texStorage3D:Wt,texSubImage2D:Pe,texSubImage3D:$e,compressedTexSubImage2D:Le,compressedTexSubImage3D:Nt,scissor:lt,viewport:Ot,reset:Sn}}function G9(i,e,t,n,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),u=new We,d=new WeakMap;let p;const g=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(te,V){return x?new OffscreenCanvas(te,V):ud("canvas")}function T(te,V,de){let Pe=1;const $e=at(te);if(($e.width>de||$e.height>de)&&(Pe=de/Math.max($e.width,$e.height)),Pe<1)if(typeof HTMLImageElement<"u"&&te instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&te instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&te instanceof ImageBitmap||typeof VideoFrame<"u"&&te instanceof VideoFrame){const Le=Math.floor(Pe*$e.width),Nt=Math.floor(Pe*$e.height);p===void 0&&(p=y(Le,Nt));const ct=V?y(Le,Nt):p;return ct.width=Le,ct.height=Nt,ct.getContext("2d").drawImage(te,0,0,Le,Nt),Oe("WebGLRenderer: Texture has been resized from ("+$e.width+"x"+$e.height+") to ("+Le+"x"+Nt+")."),ct}else return"data"in te&&Oe("WebGLRenderer: Image in DataTexture is too big ("+$e.width+"x"+$e.height+")."),te;return te}function S(te){return te.generateMipmaps}function M(te){i.generateMipmap(te)}function R(te){return te.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:te.isWebGL3DRenderTarget?i.TEXTURE_3D:te.isWebGLArrayRenderTarget||te.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function E(te,V,de,Pe,$e=!1){if(te!==null){if(i[te]!==void 0)return i[te];Oe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+te+"'")}let Le=V;if(V===i.RED&&(de===i.FLOAT&&(Le=i.R32F),de===i.HALF_FLOAT&&(Le=i.R16F),de===i.UNSIGNED_BYTE&&(Le=i.R8)),V===i.RED_INTEGER&&(de===i.UNSIGNED_BYTE&&(Le=i.R8UI),de===i.UNSIGNED_SHORT&&(Le=i.R16UI),de===i.UNSIGNED_INT&&(Le=i.R32UI),de===i.BYTE&&(Le=i.R8I),de===i.SHORT&&(Le=i.R16I),de===i.INT&&(Le=i.R32I)),V===i.RG&&(de===i.FLOAT&&(Le=i.RG32F),de===i.HALF_FLOAT&&(Le=i.RG16F),de===i.UNSIGNED_BYTE&&(Le=i.RG8)),V===i.RG_INTEGER&&(de===i.UNSIGNED_BYTE&&(Le=i.RG8UI),de===i.UNSIGNED_SHORT&&(Le=i.RG16UI),de===i.UNSIGNED_INT&&(Le=i.RG32UI),de===i.BYTE&&(Le=i.RG8I),de===i.SHORT&&(Le=i.RG16I),de===i.INT&&(Le=i.RG32I)),V===i.RGB_INTEGER&&(de===i.UNSIGNED_BYTE&&(Le=i.RGB8UI),de===i.UNSIGNED_SHORT&&(Le=i.RGB16UI),de===i.UNSIGNED_INT&&(Le=i.RGB32UI),de===i.BYTE&&(Le=i.RGB8I),de===i.SHORT&&(Le=i.RGB16I),de===i.INT&&(Le=i.RGB32I)),V===i.RGBA_INTEGER&&(de===i.UNSIGNED_BYTE&&(Le=i.RGBA8UI),de===i.UNSIGNED_SHORT&&(Le=i.RGBA16UI),de===i.UNSIGNED_INT&&(Le=i.RGBA32UI),de===i.BYTE&&(Le=i.RGBA8I),de===i.SHORT&&(Le=i.RGBA16I),de===i.INT&&(Le=i.RGBA32I)),V===i.RGB&&(de===i.UNSIGNED_INT_5_9_9_9_REV&&(Le=i.RGB9_E5),de===i.UNSIGNED_INT_10F_11F_11F_REV&&(Le=i.R11F_G11F_B10F)),V===i.RGBA){const Nt=$e?AA:Yt.getTransfer(Pe);de===i.FLOAT&&(Le=i.RGBA32F),de===i.HALF_FLOAT&&(Le=i.RGBA16F),de===i.UNSIGNED_BYTE&&(Le=Nt===_t?i.SRGB8_ALPHA8:i.RGBA8),de===i.UNSIGNED_SHORT_4_4_4_4&&(Le=i.RGBA4),de===i.UNSIGNED_SHORT_5_5_5_1&&(Le=i.RGB5_A1)}return(Le===i.R16F||Le===i.R32F||Le===i.RG16F||Le===i.RG32F||Le===i.RGBA16F||Le===i.RGBA32F)&&e.get("EXT_color_buffer_float"),Le}function N(te,V){let de;return te?V===null||V===ii||V===Hs?de=i.DEPTH24_STENCIL8:V===zi?de=i.DEPTH32F_STENCIL8:V===Do&&(de=i.DEPTH24_STENCIL8,Oe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):V===null||V===ii||V===Hs?de=i.DEPTH_COMPONENT24:V===zi?de=i.DEPTH_COMPONENT32F:V===Do&&(de=i.DEPTH_COMPONENT16),de}function U(te,V){return S(te)===!0||te.isFramebufferTexture&&te.minFilter!==jn&&te.minFilter!==li?Math.log2(Math.max(V.width,V.height))+1:te.mipmaps!==void 0&&te.mipmaps.length>0?te.mipmaps.length:te.isCompressedTexture&&Array.isArray(te.image)?V.mipmaps.length:1}function L(te){const V=te.target;V.removeEventListener("dispose",L),P(V),V.isVideoTexture&&d.delete(V)}function F(te){const V=te.target;V.removeEventListener("dispose",F),$(V)}function P(te){const V=n.get(te);if(V.__webglInit===void 0)return;const de=te.source,Pe=g.get(de);if(Pe){const $e=Pe[V.__cacheKey];$e.usedTimes--,$e.usedTimes===0&&I(te),Object.keys(Pe).length===0&&g.delete(de)}n.remove(te)}function I(te){const V=n.get(te);i.deleteTexture(V.__webglTexture);const de=te.source,Pe=g.get(de);delete Pe[V.__cacheKey],o.memory.textures--}function $(te){const V=n.get(te);if(te.depthTexture&&(te.depthTexture.dispose(),n.remove(te.depthTexture)),te.isWebGLCubeRenderTarget)for(let Pe=0;Pe<6;Pe++){if(Array.isArray(V.__webglFramebuffer[Pe]))for(let $e=0;$e<V.__webglFramebuffer[Pe].length;$e++)i.deleteFramebuffer(V.__webglFramebuffer[Pe][$e]);else i.deleteFramebuffer(V.__webglFramebuffer[Pe]);V.__webglDepthbuffer&&i.deleteRenderbuffer(V.__webglDepthbuffer[Pe])}else{if(Array.isArray(V.__webglFramebuffer))for(let Pe=0;Pe<V.__webglFramebuffer.length;Pe++)i.deleteFramebuffer(V.__webglFramebuffer[Pe]);else i.deleteFramebuffer(V.__webglFramebuffer);if(V.__webglDepthbuffer&&i.deleteRenderbuffer(V.__webglDepthbuffer),V.__webglMultisampledFramebuffer&&i.deleteFramebuffer(V.__webglMultisampledFramebuffer),V.__webglColorRenderbuffer)for(let Pe=0;Pe<V.__webglColorRenderbuffer.length;Pe++)V.__webglColorRenderbuffer[Pe]&&i.deleteRenderbuffer(V.__webglColorRenderbuffer[Pe]);V.__webglDepthRenderbuffer&&i.deleteRenderbuffer(V.__webglDepthRenderbuffer)}const de=te.textures;for(let Pe=0,$e=de.length;Pe<$e;Pe++){const Le=n.get(de[Pe]);Le.__webglTexture&&(i.deleteTexture(Le.__webglTexture),o.memory.textures--),n.remove(de[Pe])}n.remove(te)}let k=0;function W(){k=0}function j(){const te=k;return te>=r.maxTextures&&Oe("WebGLTextures: Trying to use "+te+" texture units while this GPU supports only "+r.maxTextures),k+=1,te}function Y(te){const V=[];return V.push(te.wrapS),V.push(te.wrapT),V.push(te.wrapR||0),V.push(te.magFilter),V.push(te.minFilter),V.push(te.anisotropy),V.push(te.internalFormat),V.push(te.format),V.push(te.type),V.push(te.generateMipmaps),V.push(te.premultiplyAlpha),V.push(te.flipY),V.push(te.unpackAlignment),V.push(te.colorSpace),V.join()}function z(te,V){const de=n.get(te);if(te.isVideoTexture&&yt(te),te.isRenderTargetTexture===!1&&te.isExternalTexture!==!0&&te.version>0&&de.__version!==te.version){const Pe=te.image;if(Pe===null)Oe("WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)Oe("WebGLRenderer: Texture marked for update but image is incomplete");else{Re(de,te,V);return}}else te.isExternalTexture&&(de.__webglTexture=te.sourceTexture?te.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,de.__webglTexture,i.TEXTURE0+V)}function Q(te,V){const de=n.get(te);if(te.isRenderTargetTexture===!1&&te.version>0&&de.__version!==te.version){Re(de,te,V);return}else te.isExternalTexture&&(de.__webglTexture=te.sourceTexture?te.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,de.__webglTexture,i.TEXTURE0+V)}function ee(te,V){const de=n.get(te);if(te.isRenderTargetTexture===!1&&te.version>0&&de.__version!==te.version){Re(de,te,V);return}t.bindTexture(i.TEXTURE_3D,de.__webglTexture,i.TEXTURE0+V)}function fe(te,V){const de=n.get(te);if(te.isCubeDepthTexture!==!0&&te.version>0&&de.__version!==te.version){qe(de,te,V);return}t.bindTexture(i.TEXTURE_CUBE_MAP,de.__webglTexture,i.TEXTURE0+V)}const le={[lc]:i.REPEAT,[xs]:i.CLAMP_TO_EDGE,[uc]:i.MIRRORED_REPEAT},Me={[jn]:i.NEAREST,[av]:i.NEAREST_MIPMAP_NEAREST,[Ja]:i.NEAREST_MIPMAP_LINEAR,[li]:i.LINEAR,[Ph]:i.LINEAR_MIPMAP_NEAREST,[vs]:i.LINEAR_MIPMAP_LINEAR},Ce={[uv]:i.NEVER,[Av]:i.ALWAYS,[sg]:i.LESS,[fu]:i.LEQUAL,[cv]:i.EQUAL,[al]:i.GEQUAL,[ad]:i.GREATER,[hv]:i.NOTEQUAL};function Be(te,V){if(V.type===zi&&e.has("OES_texture_float_linear")===!1&&(V.magFilter===li||V.magFilter===Ph||V.magFilter===Ja||V.magFilter===vs||V.minFilter===li||V.minFilter===Ph||V.minFilter===Ja||V.minFilter===vs)&&Oe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(te,i.TEXTURE_WRAP_S,le[V.wrapS]),i.texParameteri(te,i.TEXTURE_WRAP_T,le[V.wrapT]),(te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY)&&i.texParameteri(te,i.TEXTURE_WRAP_R,le[V.wrapR]),i.texParameteri(te,i.TEXTURE_MAG_FILTER,Me[V.magFilter]),i.texParameteri(te,i.TEXTURE_MIN_FILTER,Me[V.minFilter]),V.compareFunction&&(i.texParameteri(te,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(te,i.TEXTURE_COMPARE_FUNC,Ce[V.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(V.magFilter===jn||V.minFilter!==Ja&&V.minFilter!==vs||V.type===zi&&e.has("OES_texture_float_linear")===!1)return;if(V.anisotropy>1||n.get(V).__currentAnisotropy){const de=e.get("EXT_texture_filter_anisotropic");i.texParameterf(te,de.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(V.anisotropy,r.getMaxAnisotropy())),n.get(V).__currentAnisotropy=V.anisotropy}}}function Ye(te,V){let de=!1;te.__webglInit===void 0&&(te.__webglInit=!0,V.addEventListener("dispose",L));const Pe=V.source;let $e=g.get(Pe);$e===void 0&&($e={},g.set(Pe,$e));const Le=Y(V);if(Le!==te.__cacheKey){$e[Le]===void 0&&($e[Le]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,de=!0),$e[Le].usedTimes++;const Nt=$e[te.__cacheKey];Nt!==void 0&&($e[te.__cacheKey].usedTimes--,Nt.usedTimes===0&&I(V)),te.__cacheKey=Le,te.__webglTexture=$e[Le].texture}return de}function qt(te,V,de){return Math.floor(Math.floor(te/de)/V)}function bt(te,V,de,Pe){const Le=te.updateRanges;if(Le.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,V.width,V.height,de,Pe,V.data);else{Le.sort((nt,lt)=>nt.start-lt.start);let Nt=0;for(let nt=1;nt<Le.length;nt++){const lt=Le[Nt],Ot=Le[nt],kt=lt.start+lt.count,wt=qt(Ot.start,V.width,4),Sn=qt(lt.start,V.width,4);Ot.start<=kt+1&&wt===Sn&&qt(Ot.start+Ot.count-1,V.width,4)===wt?lt.count=Math.max(lt.count,Ot.start+Ot.count-lt.start):(++Nt,Le[Nt]=Ot)}Le.length=Nt+1;const ct=i.getParameter(i.UNPACK_ROW_LENGTH),Wt=i.getParameter(i.UNPACK_SKIP_PIXELS),Zt=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,V.width);for(let nt=0,lt=Le.length;nt<lt;nt++){const Ot=Le[nt],kt=Math.floor(Ot.start/4),wt=Math.ceil(Ot.count/4),Sn=kt%V.width,me=Math.floor(kt/V.width),ht=wt,ut=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,Sn),i.pixelStorei(i.UNPACK_SKIP_ROWS,me),t.texSubImage2D(i.TEXTURE_2D,0,Sn,me,ht,ut,de,Pe,V.data)}te.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,ct),i.pixelStorei(i.UNPACK_SKIP_PIXELS,Wt),i.pixelStorei(i.UNPACK_SKIP_ROWS,Zt)}}function Re(te,V,de){let Pe=i.TEXTURE_2D;(V.isDataArrayTexture||V.isCompressedArrayTexture)&&(Pe=i.TEXTURE_2D_ARRAY),V.isData3DTexture&&(Pe=i.TEXTURE_3D);const $e=Ye(te,V),Le=V.source;t.bindTexture(Pe,te.__webglTexture,i.TEXTURE0+de);const Nt=n.get(Le);if(Le.version!==Nt.__version||$e===!0){t.activeTexture(i.TEXTURE0+de);const ct=Yt.getPrimaries(Yt.workingColorSpace),Wt=V.colorSpace===_s?null:Yt.getPrimaries(V.colorSpace),Zt=V.colorSpace===_s||ct===Wt?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,V.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,V.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,V.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Zt);let nt=T(V.image,!1,r.maxTextureSize);nt=zt(V,nt);const lt=s.convert(V.format,V.colorSpace),Ot=s.convert(V.type);let kt=E(V.internalFormat,lt,Ot,V.colorSpace,V.isVideoTexture);Be(Pe,V);let wt;const Sn=V.mipmaps,me=V.isVideoTexture!==!0,ht=Nt.__version===void 0||$e===!0,ut=Le.dataReady,Pt=U(V,nt);if(V.isDepthTexture)kt=N(V.format===as,V.type),ht&&(me?t.texStorage2D(i.TEXTURE_2D,1,kt,nt.width,nt.height):t.texImage2D(i.TEXTURE_2D,0,kt,nt.width,nt.height,0,lt,Ot,null));else if(V.isDataTexture)if(Sn.length>0){me&&ht&&t.texStorage2D(i.TEXTURE_2D,Pt,kt,Sn[0].width,Sn[0].height);for(let pe=0,Ie=Sn.length;pe<Ie;pe++)wt=Sn[pe],me?ut&&t.texSubImage2D(i.TEXTURE_2D,pe,0,0,wt.width,wt.height,lt,Ot,wt.data):t.texImage2D(i.TEXTURE_2D,pe,kt,wt.width,wt.height,0,lt,Ot,wt.data);V.generateMipmaps=!1}else me?(ht&&t.texStorage2D(i.TEXTURE_2D,Pt,kt,nt.width,nt.height),ut&&bt(V,nt,lt,Ot)):t.texImage2D(i.TEXTURE_2D,0,kt,nt.width,nt.height,0,lt,Ot,nt.data);else if(V.isCompressedTexture)if(V.isCompressedArrayTexture){me&&ht&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Pt,kt,Sn[0].width,Sn[0].height,nt.depth);for(let pe=0,Ie=Sn.length;pe<Ie;pe++)if(wt=Sn[pe],V.format!==Wi)if(lt!==null)if(me){if(ut)if(V.layerUpdates.size>0){const Bt=v_(wt.width,wt.height,V.format,V.type);for(const fn of V.layerUpdates){const ci=wt.data.subarray(fn*Bt/wt.data.BYTES_PER_ELEMENT,(fn+1)*Bt/wt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,pe,0,0,fn,wt.width,wt.height,1,lt,ci)}V.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,pe,0,0,0,wt.width,wt.height,nt.depth,lt,wt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,pe,kt,wt.width,wt.height,nt.depth,0,wt.data,0,0);else Oe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else me?ut&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,pe,0,0,0,wt.width,wt.height,nt.depth,lt,Ot,wt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,pe,kt,wt.width,wt.height,nt.depth,0,lt,Ot,wt.data)}else{me&&ht&&t.texStorage2D(i.TEXTURE_2D,Pt,kt,Sn[0].width,Sn[0].height);for(let pe=0,Ie=Sn.length;pe<Ie;pe++)wt=Sn[pe],V.format!==Wi?lt!==null?me?ut&&t.compressedTexSubImage2D(i.TEXTURE_2D,pe,0,0,wt.width,wt.height,lt,wt.data):t.compressedTexImage2D(i.TEXTURE_2D,pe,kt,wt.width,wt.height,0,wt.data):Oe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):me?ut&&t.texSubImage2D(i.TEXTURE_2D,pe,0,0,wt.width,wt.height,lt,Ot,wt.data):t.texImage2D(i.TEXTURE_2D,pe,kt,wt.width,wt.height,0,lt,Ot,wt.data)}else if(V.isDataArrayTexture)if(me){if(ht&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Pt,kt,nt.width,nt.height,nt.depth),ut)if(V.layerUpdates.size>0){const pe=v_(nt.width,nt.height,V.format,V.type);for(const Ie of V.layerUpdates){const Bt=nt.data.subarray(Ie*pe/nt.data.BYTES_PER_ELEMENT,(Ie+1)*pe/nt.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Ie,nt.width,nt.height,1,lt,Ot,Bt)}V.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,nt.width,nt.height,nt.depth,lt,Ot,nt.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,kt,nt.width,nt.height,nt.depth,0,lt,Ot,nt.data);else if(V.isData3DTexture)me?(ht&&t.texStorage3D(i.TEXTURE_3D,Pt,kt,nt.width,nt.height,nt.depth),ut&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,nt.width,nt.height,nt.depth,lt,Ot,nt.data)):t.texImage3D(i.TEXTURE_3D,0,kt,nt.width,nt.height,nt.depth,0,lt,Ot,nt.data);else if(V.isFramebufferTexture){if(ht)if(me)t.texStorage2D(i.TEXTURE_2D,Pt,kt,nt.width,nt.height);else{let pe=nt.width,Ie=nt.height;for(let Bt=0;Bt<Pt;Bt++)t.texImage2D(i.TEXTURE_2D,Bt,kt,pe,Ie,0,lt,Ot,null),pe>>=1,Ie>>=1}}else if(Sn.length>0){if(me&&ht){const pe=at(Sn[0]);t.texStorage2D(i.TEXTURE_2D,Pt,kt,pe.width,pe.height)}for(let pe=0,Ie=Sn.length;pe<Ie;pe++)wt=Sn[pe],me?ut&&t.texSubImage2D(i.TEXTURE_2D,pe,0,0,lt,Ot,wt):t.texImage2D(i.TEXTURE_2D,pe,kt,lt,Ot,wt);V.generateMipmaps=!1}else if(me){if(ht){const pe=at(nt);t.texStorage2D(i.TEXTURE_2D,Pt,kt,pe.width,pe.height)}ut&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,lt,Ot,nt)}else t.texImage2D(i.TEXTURE_2D,0,kt,lt,Ot,nt);S(V)&&M(Pe),Nt.__version=Le.version,V.onUpdate&&V.onUpdate(V)}te.__version=V.version}function qe(te,V,de){if(V.image.length!==6)return;const Pe=Ye(te,V),$e=V.source;t.bindTexture(i.TEXTURE_CUBE_MAP,te.__webglTexture,i.TEXTURE0+de);const Le=n.get($e);if($e.version!==Le.__version||Pe===!0){t.activeTexture(i.TEXTURE0+de);const Nt=Yt.getPrimaries(Yt.workingColorSpace),ct=V.colorSpace===_s?null:Yt.getPrimaries(V.colorSpace),Wt=V.colorSpace===_s||Nt===ct?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,V.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,V.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,V.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Wt);const Zt=V.isCompressedTexture||V.image[0].isCompressedTexture,nt=V.image[0]&&V.image[0].isDataTexture,lt=[];for(let Ie=0;Ie<6;Ie++)!Zt&&!nt?lt[Ie]=T(V.image[Ie],!0,r.maxCubemapSize):lt[Ie]=nt?V.image[Ie].image:V.image[Ie],lt[Ie]=zt(V,lt[Ie]);const Ot=lt[0],kt=s.convert(V.format,V.colorSpace),wt=s.convert(V.type),Sn=E(V.internalFormat,kt,wt,V.colorSpace),me=V.isVideoTexture!==!0,ht=Le.__version===void 0||Pe===!0,ut=$e.dataReady;let Pt=U(V,Ot);Be(i.TEXTURE_CUBE_MAP,V);let pe;if(Zt){me&&ht&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Pt,Sn,Ot.width,Ot.height);for(let Ie=0;Ie<6;Ie++){pe=lt[Ie].mipmaps;for(let Bt=0;Bt<pe.length;Bt++){const fn=pe[Bt];V.format!==Wi?kt!==null?me?ut&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,Bt,0,0,fn.width,fn.height,kt,fn.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,Bt,Sn,fn.width,fn.height,0,fn.data):Oe("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):me?ut&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,Bt,0,0,fn.width,fn.height,kt,wt,fn.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,Bt,Sn,fn.width,fn.height,0,kt,wt,fn.data)}}}else{if(pe=V.mipmaps,me&&ht){pe.length>0&&Pt++;const Ie=at(lt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Pt,Sn,Ie.width,Ie.height)}for(let Ie=0;Ie<6;Ie++)if(nt){me?ut&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,0,0,lt[Ie].width,lt[Ie].height,kt,wt,lt[Ie].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,Sn,lt[Ie].width,lt[Ie].height,0,kt,wt,lt[Ie].data);for(let Bt=0;Bt<pe.length;Bt++){const ci=pe[Bt].image[Ie].image;me?ut&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,Bt+1,0,0,ci.width,ci.height,kt,wt,ci.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,Bt+1,Sn,ci.width,ci.height,0,kt,wt,ci.data)}}else{me?ut&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,0,0,kt,wt,lt[Ie]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0,Sn,kt,wt,lt[Ie]);for(let Bt=0;Bt<pe.length;Bt++){const fn=pe[Bt];me?ut&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,Bt+1,0,0,kt,wt,fn.image[Ie]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,Bt+1,Sn,kt,wt,fn.image[Ie])}}}S(V)&&M(i.TEXTURE_CUBE_MAP),Le.__version=$e.version,V.onUpdate&&V.onUpdate(V)}te.__version=V.version}function Ke(te,V,de,Pe,$e,Le){const Nt=s.convert(de.format,de.colorSpace),ct=s.convert(de.type),Wt=E(de.internalFormat,Nt,ct,de.colorSpace),Zt=n.get(V),nt=n.get(de);if(nt.__renderTarget=V,!Zt.__hasExternalTextures){const lt=Math.max(1,V.width>>Le),Ot=Math.max(1,V.height>>Le);$e===i.TEXTURE_3D||$e===i.TEXTURE_2D_ARRAY?t.texImage3D($e,Le,Wt,lt,Ot,V.depth,0,Nt,ct,null):t.texImage2D($e,Le,Wt,lt,Ot,0,Nt,ct,null)}t.bindFramebuffer(i.FRAMEBUFFER,te),Kt(V)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Pe,$e,nt.__webglTexture,0,se(V)):($e===i.TEXTURE_2D||$e>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&$e<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Pe,$e,nt.__webglTexture,Le),t.bindFramebuffer(i.FRAMEBUFFER,null)}function St(te,V,de){if(i.bindRenderbuffer(i.RENDERBUFFER,te),V.depthBuffer){const Pe=V.depthTexture,$e=Pe&&Pe.isDepthTexture?Pe.type:null,Le=N(V.stencilBuffer,$e),Nt=V.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;Kt(V)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,se(V),Le,V.width,V.height):de?i.renderbufferStorageMultisample(i.RENDERBUFFER,se(V),Le,V.width,V.height):i.renderbufferStorage(i.RENDERBUFFER,Le,V.width,V.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Nt,i.RENDERBUFFER,te)}else{const Pe=V.textures;for(let $e=0;$e<Pe.length;$e++){const Le=Pe[$e],Nt=s.convert(Le.format,Le.colorSpace),ct=s.convert(Le.type),Wt=E(Le.internalFormat,Nt,ct,Le.colorSpace);Kt(V)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,se(V),Wt,V.width,V.height):de?i.renderbufferStorageMultisample(i.RENDERBUFFER,se(V),Wt,V.width,V.height):i.renderbufferStorage(i.RENDERBUFFER,Wt,V.width,V.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function mt(te,V,de){const Pe=V.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,te),!(V.depthTexture&&V.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const $e=n.get(V.depthTexture);if($e.__renderTarget=V,(!$e.__webglTexture||V.depthTexture.image.width!==V.width||V.depthTexture.image.height!==V.height)&&(V.depthTexture.image.width=V.width,V.depthTexture.image.height=V.height,V.depthTexture.needsUpdate=!0),Pe){if($e.__webglInit===void 0&&($e.__webglInit=!0,V.depthTexture.addEventListener("dispose",L)),$e.__webglTexture===void 0){$e.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,$e.__webglTexture),Be(i.TEXTURE_CUBE_MAP,V.depthTexture);const Zt=s.convert(V.depthTexture.format),nt=s.convert(V.depthTexture.type);let lt;V.depthTexture.format===Rr?lt=i.DEPTH_COMPONENT24:V.depthTexture.format===as&&(lt=i.DEPTH24_STENCIL8);for(let Ot=0;Ot<6;Ot++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ot,0,lt,V.width,V.height,0,Zt,nt,null)}}else z(V.depthTexture,0);const Le=$e.__webglTexture,Nt=se(V),ct=Pe?i.TEXTURE_CUBE_MAP_POSITIVE_X+de:i.TEXTURE_2D,Wt=V.depthTexture.format===as?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(V.depthTexture.format===Rr)Kt(V)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Wt,ct,Le,0,Nt):i.framebufferTexture2D(i.FRAMEBUFFER,Wt,ct,Le,0);else if(V.depthTexture.format===as)Kt(V)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Wt,ct,Le,0,Nt):i.framebufferTexture2D(i.FRAMEBUFFER,Wt,ct,Le,0);else throw new Error("Unknown depthTexture format")}function Tt(te){const V=n.get(te),de=te.isWebGLCubeRenderTarget===!0;if(V.__boundDepthTexture!==te.depthTexture){const Pe=te.depthTexture;if(V.__depthDisposeCallback&&V.__depthDisposeCallback(),Pe){const $e=()=>{delete V.__boundDepthTexture,delete V.__depthDisposeCallback,Pe.removeEventListener("dispose",$e)};Pe.addEventListener("dispose",$e),V.__depthDisposeCallback=$e}V.__boundDepthTexture=Pe}if(te.depthTexture&&!V.__autoAllocateDepthBuffer)if(de)for(let Pe=0;Pe<6;Pe++)mt(V.__webglFramebuffer[Pe],te,Pe);else{const Pe=te.texture.mipmaps;Pe&&Pe.length>0?mt(V.__webglFramebuffer[0],te,0):mt(V.__webglFramebuffer,te,0)}else if(de){V.__webglDepthbuffer=[];for(let Pe=0;Pe<6;Pe++)if(t.bindFramebuffer(i.FRAMEBUFFER,V.__webglFramebuffer[Pe]),V.__webglDepthbuffer[Pe]===void 0)V.__webglDepthbuffer[Pe]=i.createRenderbuffer(),St(V.__webglDepthbuffer[Pe],te,!1);else{const $e=te.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Le=V.__webglDepthbuffer[Pe];i.bindRenderbuffer(i.RENDERBUFFER,Le),i.framebufferRenderbuffer(i.FRAMEBUFFER,$e,i.RENDERBUFFER,Le)}}else{const Pe=te.texture.mipmaps;if(Pe&&Pe.length>0?t.bindFramebuffer(i.FRAMEBUFFER,V.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,V.__webglFramebuffer),V.__webglDepthbuffer===void 0)V.__webglDepthbuffer=i.createRenderbuffer(),St(V.__webglDepthbuffer,te,!1);else{const $e=te.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Le=V.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,Le),i.framebufferRenderbuffer(i.FRAMEBUFFER,$e,i.RENDERBUFFER,Le)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function an(te,V,de){const Pe=n.get(te);V!==void 0&&Ke(Pe.__webglFramebuffer,te,te.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),de!==void 0&&Tt(te)}function Ut(te){const V=te.texture,de=n.get(te),Pe=n.get(V);te.addEventListener("dispose",F);const $e=te.textures,Le=te.isWebGLCubeRenderTarget===!0,Nt=$e.length>1;if(Nt||(Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture()),Pe.__version=V.version,o.memory.textures++),Le){de.__webglFramebuffer=[];for(let ct=0;ct<6;ct++)if(V.mipmaps&&V.mipmaps.length>0){de.__webglFramebuffer[ct]=[];for(let Wt=0;Wt<V.mipmaps.length;Wt++)de.__webglFramebuffer[ct][Wt]=i.createFramebuffer()}else de.__webglFramebuffer[ct]=i.createFramebuffer()}else{if(V.mipmaps&&V.mipmaps.length>0){de.__webglFramebuffer=[];for(let ct=0;ct<V.mipmaps.length;ct++)de.__webglFramebuffer[ct]=i.createFramebuffer()}else de.__webglFramebuffer=i.createFramebuffer();if(Nt)for(let ct=0,Wt=$e.length;ct<Wt;ct++){const Zt=n.get($e[ct]);Zt.__webglTexture===void 0&&(Zt.__webglTexture=i.createTexture(),o.memory.textures++)}if(te.samples>0&&Kt(te)===!1){de.__webglMultisampledFramebuffer=i.createFramebuffer(),de.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,de.__webglMultisampledFramebuffer);for(let ct=0;ct<$e.length;ct++){const Wt=$e[ct];de.__webglColorRenderbuffer[ct]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,de.__webglColorRenderbuffer[ct]);const Zt=s.convert(Wt.format,Wt.colorSpace),nt=s.convert(Wt.type),lt=E(Wt.internalFormat,Zt,nt,Wt.colorSpace,te.isXRRenderTarget===!0),Ot=se(te);i.renderbufferStorageMultisample(i.RENDERBUFFER,Ot,lt,te.width,te.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ct,i.RENDERBUFFER,de.__webglColorRenderbuffer[ct])}i.bindRenderbuffer(i.RENDERBUFFER,null),te.depthBuffer&&(de.__webglDepthRenderbuffer=i.createRenderbuffer(),St(de.__webglDepthRenderbuffer,te,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(Le){t.bindTexture(i.TEXTURE_CUBE_MAP,Pe.__webglTexture),Be(i.TEXTURE_CUBE_MAP,V);for(let ct=0;ct<6;ct++)if(V.mipmaps&&V.mipmaps.length>0)for(let Wt=0;Wt<V.mipmaps.length;Wt++)Ke(de.__webglFramebuffer[ct][Wt],te,V,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Wt);else Ke(de.__webglFramebuffer[ct],te,V,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0);S(V)&&M(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Nt){for(let ct=0,Wt=$e.length;ct<Wt;ct++){const Zt=$e[ct],nt=n.get(Zt);let lt=i.TEXTURE_2D;(te.isWebGL3DRenderTarget||te.isWebGLArrayRenderTarget)&&(lt=te.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(lt,nt.__webglTexture),Be(lt,Zt),Ke(de.__webglFramebuffer,te,Zt,i.COLOR_ATTACHMENT0+ct,lt,0),S(Zt)&&M(lt)}t.unbindTexture()}else{let ct=i.TEXTURE_2D;if((te.isWebGL3DRenderTarget||te.isWebGLArrayRenderTarget)&&(ct=te.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ct,Pe.__webglTexture),Be(ct,V),V.mipmaps&&V.mipmaps.length>0)for(let Wt=0;Wt<V.mipmaps.length;Wt++)Ke(de.__webglFramebuffer[Wt],te,V,i.COLOR_ATTACHMENT0,ct,Wt);else Ke(de.__webglFramebuffer,te,V,i.COLOR_ATTACHMENT0,ct,0);S(V)&&M(ct),t.unbindTexture()}te.depthBuffer&&Tt(te)}function Ue(te){const V=te.textures;for(let de=0,Pe=V.length;de<Pe;de++){const $e=V[de];if(S($e)){const Le=R(te),Nt=n.get($e).__webglTexture;t.bindTexture(Le,Nt),M(Le),t.unbindTexture()}}}const Je=[],He=[];function ot(te){if(te.samples>0){if(Kt(te)===!1){const V=te.textures,de=te.width,Pe=te.height;let $e=i.COLOR_BUFFER_BIT;const Le=te.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Nt=n.get(te),ct=V.length>1;if(ct)for(let Zt=0;Zt<V.length;Zt++)t.bindFramebuffer(i.FRAMEBUFFER,Nt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Zt,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Nt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Zt,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Nt.__webglMultisampledFramebuffer);const Wt=te.texture.mipmaps;Wt&&Wt.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Nt.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Nt.__webglFramebuffer);for(let Zt=0;Zt<V.length;Zt++){if(te.resolveDepthBuffer&&(te.depthBuffer&&($e|=i.DEPTH_BUFFER_BIT),te.stencilBuffer&&te.resolveStencilBuffer&&($e|=i.STENCIL_BUFFER_BIT)),ct){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Nt.__webglColorRenderbuffer[Zt]);const nt=n.get(V[Zt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,nt,0)}i.blitFramebuffer(0,0,de,Pe,0,0,de,Pe,$e,i.NEAREST),l===!0&&(Je.length=0,He.length=0,Je.push(i.COLOR_ATTACHMENT0+Zt),te.depthBuffer&&te.resolveDepthBuffer===!1&&(Je.push(Le),He.push(Le),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,He)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,Je))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ct)for(let Zt=0;Zt<V.length;Zt++){t.bindFramebuffer(i.FRAMEBUFFER,Nt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Zt,i.RENDERBUFFER,Nt.__webglColorRenderbuffer[Zt]);const nt=n.get(V[Zt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Nt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Zt,i.TEXTURE_2D,nt,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Nt.__webglMultisampledFramebuffer)}else if(te.depthBuffer&&te.resolveDepthBuffer===!1&&l){const V=te.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[V])}}}function se(te){return Math.min(r.maxSamples,te.samples)}function Kt(te){const V=n.get(te);return te.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&V.__useRenderToTexture!==!1}function yt(te){const V=o.render.frame;d.get(te)!==V&&(d.set(te,V),te.update())}function zt(te,V){const de=te.colorSpace,Pe=te.format,$e=te.type;return te.isCompressedTexture===!0||te.isVideoTexture===!0||de!==au&&de!==_s&&(Yt.getTransfer(de)===_t?(Pe!==Wi||$e!==yi)&&Oe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ke("WebGLTextures: Unsupported texture color space:",de)),V}function at(te){return typeof HTMLImageElement<"u"&&te instanceof HTMLImageElement?(u.width=te.naturalWidth||te.width,u.height=te.naturalHeight||te.height):typeof VideoFrame<"u"&&te instanceof VideoFrame?(u.width=te.displayWidth,u.height=te.displayHeight):(u.width=te.width,u.height=te.height),u}this.allocateTextureUnit=j,this.resetTextureUnits=W,this.setTexture2D=z,this.setTexture2DArray=Q,this.setTexture3D=ee,this.setTextureCube=fe,this.rebindTextures=an,this.setupRenderTarget=Ut,this.updateRenderTargetMipmap=Ue,this.updateMultisampleRenderTarget=ot,this.setupDepthRenderbuffer=Tt,this.setupFrameBufferTexture=Ke,this.useMultisampledRTT=Kt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function V9(i,e){function t(n,r=_s){let s;const o=Yt.getTransfer(r);if(n===yi)return i.UNSIGNED_BYTE;if(n===tg)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ng)return i.UNSIGNED_SHORT_5_5_5_1;if(n===ig)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===rg)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===ec)return i.BYTE;if(n===tc)return i.SHORT;if(n===Do)return i.UNSIGNED_SHORT;if(n===dr)return i.INT;if(n===ii)return i.UNSIGNED_INT;if(n===zi)return i.FLOAT;if(n===Mi)return i.HALF_FLOAT;if(n===lv)return i.ALPHA;if(n===Ld)return i.RGB;if(n===Wi)return i.RGBA;if(n===Rr)return i.DEPTH_COMPONENT;if(n===as)return i.DEPTH_STENCIL;if(n===Id)return i.RED;if(n===PA)return i.RED_INTEGER;if(n===ls)return i.RG;if(n===DA)return i.RG_INTEGER;if(n===LA)return i.RGBA_INTEGER;if(n===Zl||n===Jl||n===eu||n===tu)if(o===_t)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Zl)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Jl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===eu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===tu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Zl)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Jl)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===eu)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===tu)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===id||n===rd||n===sd||n===od)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===id)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===rd)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===sd)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===od)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===qh||n===zh||n===Hh||n===Wh||n===$h||n===cc||n===jh)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===qh||n===zh)return o===_t?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Hh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===Wh)return s.COMPRESSED_R11_EAC;if(n===$h)return s.COMPRESSED_SIGNED_R11_EAC;if(n===cc)return s.COMPRESSED_RG11_EAC;if(n===jh)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Xh||n===Qh||n===Yh||n===Kh||n===Zh||n===Jh||n===eA||n===tA||n===nA||n===iA||n===rA||n===sA||n===oA||n===aA)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Xh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Qh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Yh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Kh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Zh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Jh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===eA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===tA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===nA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===iA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===rA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===sA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===oA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===aA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===lA||n===h_||n===A_)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===lA)return o===_t?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===h_)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===A_)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===uA||n===cA||n===hc||n===hA)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===uA)return s.COMPRESSED_RED_RGTC1_EXT;if(n===cA)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===hc)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===hA)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Hs?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const q9=` 4034void main() { 4035 4036 gl_Position = vec4( position, 1.0 ); 4037 4038}`,z9=` 4039uniform sampler2DArray depthColor; 4040uniform float depthWidth; 4041uniform float depthHeight; 4042 4043void main() { 4044 4045 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 4046 4047 if ( coord.x >= 1.0 ) { 4048 4049 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 4050 4051 } else { 4052 4053 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 4054 4055 } 4056 4057}`;class H9{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new lE(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ws({vertexShader:q9,fragmentShader:z9,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Qn(new Fd(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class W9 extends Ia{constructor(e,t){super();const n=this;let r=null,s=1,o=null,a="local-floor",l=1,u=null,d=null,p=null,g=null,x=null,y=null;const T=typeof XRWebGLBinding<"u",S=new H9,M={},R=t.getContextAttributes();let E=null,N=null;const U=[],L=[],F=new We;let P=null;const I=new pr;I.viewport=new rn;const $=new pr;$.viewport=new rn;const k=[I,$],W=new SE;let j=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Re){let qe=U[Re];return qe===void 0&&(qe=new kp,U[Re]=qe),qe.getTargetRaySpace()},this.getControllerGrip=function(Re){let qe=U[Re];return qe===void 0&&(qe=new kp,U[Re]=qe),qe.getGripSpace()},this.getHand=function(Re){let qe=U[Re];return qe===void 0&&(qe=new kp,U[Re]=qe),qe.getHandSpace()};function z(Re){const qe=L.indexOf(Re.inputSource);if(qe===-1)return;const Ke=U[qe];Ke!==void 0&&(Ke.update(Re.inputSource,Re.frame,u||o),Ke.dispatchEvent({type:Re.type,data:Re.inputSource}))}function Q(){r.removeEventListener("select",z),r.removeEventListener("selectstart",z),r.removeEventListener("selectend",z),r.removeEventListener("squeeze",z),r.removeEventListener("squeezestart",z),r.removeEventListener("squeezeend",z),r.removeEventListener("end",Q),r.removeEventListener("inputsourceschange",ee);for(let Re=0;Re<U.length;Re++){const qe=L[Re];qe!==null&&(L[Re]=null,U[Re].disconnect(qe))}j=null,Y=null,S.reset();for(const Re in M)delete M[Re];e.setRenderTarget(E),x=null,g=null,p=null,r=null,N=null,bt.stop(),n.isPresenting=!1,e.setPixelRatio(P),e.setSize(F.width,F.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Re){s=Re,n.isPresenting===!0&&Oe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Re){a=Re,n.isPresenting===!0&&Oe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||o},this.setReferenceSpace=function(Re){u=Re},this.getBaseLayer=function(){return g!==null?g:x},this.getBinding=function(){return p===null&&T&&(p=new XRWebGLBinding(r,t)),p},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(Re){if(r=Re,r!==null){if(E=e.getRenderTarget(),r.addEventListener("select",z),r.addEventListener("selectstart",z),r.addEventListener("selectend",z),r.addEventListener("squeeze",z),r.addEventListener("squeezestart",z),r.addEventListener("squeezeend",z),r.addEventListener("end",Q),r.addEventListener("inputsourceschange",ee),R.xrCompatible!==!0&&await t.makeXRCompatible(),P=e.getPixelRatio(),e.getSize(F),T&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ke=null,St=null,mt=null;R.depth&&(mt=R.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ke=R.stencil?as:Rr,St=R.stencil?Hs:ii);const Tt={colorFormat:t.RGBA8,depthFormat:mt,scaleFactor:s};p=this.getBinding(),g=p.createProjectionLayer(Tt),r.updateRenderState({layers:[g]}),e.setPixelRatio(1),e.setSize(g.textureWidth,g.textureHeight,!1),N=new _a(g.textureWidth,g.textureHeight,{format:Wi,type:yi,depthTexture:new qr(g.textureWidth,g.textureHeight,St,void 0,void 0,void 0,void 0,void 0,void 0,Ke),stencilBuffer:R.stencil,colorSpace:e.outputColorSpace,samples:R.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}else{const Ke={antialias:R.antialias,alpha:!0,depth:R.depth,stencil:R.stencil,framebufferScaleFactor:s};x=new XRWebGLLayer(r,t,Ke),r.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),N=new _a(x.framebufferWidth,x.framebufferHeight,{format:Wi,type:yi,colorSpace:e.outputColorSpace,stencilBuffer:R.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}N.isXRRenderTarget=!0,this.setFoveation(l),u=null,o=await r.requestReferenceSpace(a),bt.setContext(r),bt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function ee(Re){for(let qe=0;qe<Re.removed.length;qe++){const Ke=Re.removed[qe],St=L.indexOf(Ke);St>=0&&(L[St]=null,U[St].disconnect(Ke))}for(let qe=0;qe<Re.added.length;qe++){const Ke=Re.added[qe];let St=L.indexOf(Ke);if(St===-1){for(let Tt=0;Tt<U.length;Tt++)if(Tt>=L.length){L.push(Ke),St=Tt;break}else if(L[Tt]===null){L[Tt]=Ke,St=Tt;break}if(St===-1)break}const mt=U[St];mt&&mt.connect(Ke)}}const fe=new J,le=new J;function Me(Re,qe,Ke){fe.setFromMatrixPosition(qe.matrixWorld),le.setFromMatrixPosition(Ke.matrixWorld);const St=fe.distanceTo(le),mt=qe.projectionMatrix.elements,Tt=Ke.projectionMatrix.elements,an=mt[14]/(mt[10]-1),Ut=mt[14]/(mt[10]+1),Ue=(mt[9]+1)/mt[5],Je=(mt[9]-1)/mt[5],He=(mt[8]-1)/mt[0],ot=(Tt[8]+1)/Tt[0],se=an*He,Kt=an*ot,yt=St/(-He+ot),zt=yt*-He;if(qe.matrixWorld.decompose(Re.position,Re.quaternion,Re.scale),Re.translateX(zt),Re.translateZ(yt),Re.matrixWorld.compose(Re.position,Re.quaternion,Re.scale),Re.matrixWorldInverse.copy(Re.matrixWorld).invert(),mt[10]===-1)Re.projectionMatrix.copy(qe.projectionMatrix),Re.projectionMatrixInverse.copy(qe.projectionMatrixInverse);else{const at=an+yt,te=Ut+yt,V=se-zt,de=Kt+(St-zt),Pe=Ue*Ut/te*at,$e=Je*Ut/te*at;Re.projectionMatrix.makePerspective(V,de,Pe,$e,at,te),Re.projectionMatrixInverse.copy(Re.projectionMatrix).invert()}}function Ce(Re,qe){qe===null?Re.matrixWorld.copy(Re.matrix):Re.matrixWorld.multiplyMatrices(qe.matrixWorld,Re.matrix),Re.matrixWorldInverse.copy(Re.matrixWorld).invert()}this.updateCamera=function(Re){if(r===null)return;let qe=Re.near,Ke=Re.far;S.texture!==null&&(S.depthNear>0&&(qe=S.depthNear),S.depthFar>0&&(Ke=S.depthFar)),W.near=$.near=I.near=qe,W.far=$.far=I.far=Ke,(j!==W.near||Y!==W.far)&&(r.updateRenderState({depthNear:W.near,depthFar:W.far}),j=W.near,Y=W.far),W.layers.mask=Re.layers.mask|6,I.layers.mask=W.layers.mask&-5,$.layers.mask=W.layers.mask&-3;const St=Re.parent,mt=W.cameras;Ce(W,St);for(let Tt=0;Tt<mt.length;Tt++)Ce(mt[Tt],St);mt.length===2?Me(W,I,$):W.projectionMatrix.copy(I.projectionMatrix),Be(Re,W,St)};function Be(Re,qe,Ke){Ke===null?Re.matrix.copy(qe.matrixWorld):(Re.matrix.copy(Ke.matrixWorld),Re.matrix.invert(),Re.matrix.multiply(qe.matrixWorld)),Re.matrix.decompose(Re.position,Re.quaternion,Re.scale),Re.updateMatrixWorld(!0),Re.projectionMatrix.copy(qe.projectionMatrix),Re.projectionMatrixInverse.copy(qe.projectionMatrixInverse),Re.isPerspectiveCamera&&(Re.fov=Ac*2*Math.atan(1/Re.projectionMatrix.elements[5]),Re.zoom=1)}this.getCamera=function(){return W},this.getFoveation=function(){if(!(g===null&&x===null))return l},this.setFoveation=function(Re){l=Re,g!==null&&(g.fixedFoveation=Re),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=Re)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(W)},this.getCameraTexture=function(Re){return M[Re]};let Ye=null;function qt(Re,qe){if(d=qe.getViewerPose(u||o),y=qe,d!==null){const Ke=d.views;x!==null&&(e.setRenderTargetFramebuffer(N,x.framebuffer),e.setRenderTarget(N));let St=!1;Ke.length!==W.cameras.length&&(W.cameras.length=0,St=!0);for(let Ut=0;Ut<Ke.length;Ut++){const Ue=Ke[Ut];let Je=null;if(x!==null)Je=x.getViewport(Ue);else{const ot=p.getViewSubImage(g,Ue);Je=ot.viewport,Ut===0&&(e.setRenderTargetTextures(N,ot.colorTexture,ot.depthStencilTexture),e.setRenderTarget(N))}let He=k[Ut];He===void 0&&(He=new pr,He.layers.enable(Ut),He.viewport=new rn,k[Ut]=He),He.matrix.fromArray(Ue.transform.matrix),He.matrix.decompose(He.position,He.quaternion,He.scale),He.projectionMatrix.fromArray(Ue.projectionMatrix),He.projectionMatrixInverse.copy(He.projectionMatrix).invert(),He.viewport.set(Je.x,Je.y,Je.width,Je.height),Ut===0&&(W.matrix.copy(He.matrix),W.matrix.decompose(W.position,W.quaternion,W.scale)),St===!0&&W.cameras.push(He)}const mt=r.enabledFeatures;if(mt&&mt.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&T){p=n.getBinding();const Ut=p.getDepthInformation(Ke[0]);Ut&&Ut.isValid&&Ut.texture&&S.init(Ut,r.renderState)}if(mt&&mt.includes("camera-access")&&T){e.state.unbindTexture(),p=n.getBinding();for(let Ut=0;Ut<Ke.length;Ut++){const Ue=Ke[Ut].camera;if(Ue){let Je=M[Ue];Je||(Je=new lE,M[Ue]=Je);const He=p.getCameraImage(Ue);Je.sourceTexture=He}}}}for(let Ke=0;Ke<U.length;Ke++){const St=L[Ke],mt=U[Ke];St!==null&&mt!==void 0&&mt.update(St,qe,u||o)}Ye&&Ye(Re,qe),qe.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:qe}),y=null}const bt=new TE;bt.setAnimationLoop(qt),this.setAnimationLoop=function(Re){Ye=Re},this.dispose=function(){}}}const Du=new Nr,$9=new nn;function j9(i,e){function t(S,M){S.matrixAutoUpdate===!0&&S.updateMatrix(),M.value.copy(S.matrix
vendor: 6,345 bytes, line 4057
4057)}function n(S,M){M.color.getRGB(S.fogColor.value,xE(i)),M.isFog?(S.fogNear.value=M.near,S.fogFar.value=M.far):M.isFogExp2&&(S.fogDensity.value=M.density)}function r(S,M,R,E,N){M.isMeshBasicMaterial?s(S,M):M.isMeshLambertMaterial?(s(S,M),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)):M.isMeshToonMaterial?(s(S,M),p(S,M)):M.isMeshPhongMaterial?(s(S,M),d(S,M),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)):M.isMeshStandardMaterial?(s(S,M),g(S,M),M.isMeshPhysicalMaterial&&x(S,M,N)):M.isMeshMatcapMaterial?(s(S,M),y(S,M)):M.isMeshDepthMaterial?s(S,M):M.isMeshDistanceMaterial?(s(S,M),T(S,M)):M.isMeshNormalMaterial?s(S,M):M.isLineBasicMaterial?(o(S,M),M.isLineDashedMaterial&&a(S,M)):M.isPointsMaterial?l(S,M,R,E):M.isSpriteMaterial?u(S,M):M.isShadowMaterial?(S.color.value.copy(M.color),S.opacity.value=M.opacity):M.isShaderMaterial&&(M.uniformsNeedUpdate=!1)}function s(S,M){S.opacity.value=M.opacity,M.color&&S.diffuse.value.copy(M.color),M.emissive&&S.emissive.value.copy(M.emissive).multiplyScalar(M.emissiveIntensity),M.map&&(S.map.value=M.map,t(M.map,S.mapTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,t(M.alphaMap,S.alphaMapTransform)),M.bumpMap&&(S.bumpMap.value=M.bumpMap,t(M.bumpMap,S.bumpMapTransform),S.bumpScale.value=M.bumpScale,M.side===Xn&&(S.bumpScale.value*=-1)),M.normalMap&&(S.normalMap.value=M.normalMap,t(M.normalMap,S.normalMapTransform),S.normalScale.value.copy(M.normalScale),M.side===Xn&&S.normalScale.value.negate()),M.displacementMap&&(S.displacementMap.value=M.displacementMap,t(M.displacementMap,S.displacementMapTransform),S.displacementScale.value=M.displacementScale,S.displacementBias.value=M.displacementBias),M.emissiveMap&&(S.emissiveMap.value=M.emissiveMap,t(M.emissiveMap,S.emissiveMapTransform)),M.specularMap&&(S.specularMap.value=M.specularMap,t(M.specularMap,S.specularMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest);const R=e.get(M),E=R.envMap,N=R.envMapRotation;E&&(S.envMap.value=E,Du.copy(N),Du.x*=-1,Du.y*=-1,Du.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Du.y*=-1,Du.z*=-1),S.envMapRotation.value.setFromMatrix4($9.makeRotationFromEuler(Du)),S.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=M.reflectivity,S.ior.value=M.ior,S.refractionRatio.value=M.refractionRatio),M.lightMap&&(S.lightMap.value=M.lightMap,S.lightMapIntensity.value=M.lightMapIntensity,t(M.lightMap,S.lightMapTransform)),M.aoMap&&(S.aoMap.value=M.aoMap,S.aoMapIntensity.value=M.aoMapIntensity,t(M.aoMap,S.aoMapTransform))}function o(S,M){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,M.map&&(S.map.value=M.map,t(M.map,S.mapTransform))}function a(S,M){S.dashSize.value=M.dashSize,S.totalSize.value=M.dashSize+M.gapSize,S.scale.value=M.scale}function l(S,M,R,E){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,S.size.value=M.size*R,S.scale.value=E*.5,M.map&&(S.map.value=M.map,t(M.map,S.uvTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,t(M.alphaMap,S.alphaMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest)}function u(S,M){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,S.rotation.value=M.rotation,M.map&&(S.map.value=M.map,t(M.map,S.mapTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,t(M.alphaMap,S.alphaMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest)}function d(S,M){S.specular.value.copy(M.specular),S.shininess.value=Math.max(M.shininess,1e-4)}function p(S,M){M.gradientMap&&(S.gradientMap.value=M.gradientMap)}function g(S,M){S.metalness.value=M.metalness,M.metalnessMap&&(S.metalnessMap.value=M.metalnessMap,t(M.metalnessMap,S.metalnessMapTransform)),S.roughness.value=M.roughness,M.roughnessMap&&(S.roughnessMap.value=M.roughnessMap,t(M.roughnessMap,S.roughnessMapTransform)),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)}function x(S,M,R){S.ior.value=M.ior,M.sheen>0&&(S.sheenColor.value.copy(M.sheenColor).multiplyScalar(M.sheen),S.sheenRoughness.value=M.sheenRoughness,M.sheenColorMap&&(S.sheenColorMap.value=M.sheenColorMap,t(M.sheenColorMap,S.sheenColorMapTransform)),M.sheenRoughnessMap&&(S.sheenRoughnessMap.value=M.sheenRoughnessMap,t(M.sheenRoughnessMap,S.sheenRoughnessMapTransform))),M.clearcoat>0&&(S.clearcoat.value=M.clearcoat,S.clearcoatRoughness.value=M.clearcoatRoughness,M.clearcoatMap&&(S.clearcoatMap.value=M.clearcoatMap,t(M.clearcoatMap,S.clearcoatMapTransform)),M.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=M.clearcoatRoughnessMap,t(M.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),M.clearcoatNormalMap&&(S.clearcoatNormalMap.value=M.clearcoatNormalMap,t(M.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(M.clearcoatNormalScale),M.side===Xn&&S.clearcoatNormalScale.value.negate())),M.dispersion>0&&(S.dispersion.value=M.dispersion),M.iridescence>0&&(S.iridescence.value=M.iridescence,S.iridescenceIOR.value=M.iridescenceIOR,S.iridescenceThicknessMinimum.value=M.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=M.iridescenceThicknessRange[1],M.iridescenceMap&&(S.iridescenceMap.value=M.iridescenceMap,t(M.iridescenceMap,S.iridescenceMapTransform)),M.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=M.iridescenceThicknessMap,t(M.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),M.transmission>0&&(S.transmission.value=M.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),M.transmissionMap&&(S.transmissionMap.value=M.transmissionMap,t(M.transmissionMap,S.transmissionMapTransform)),S.thickness.value=M.thickness,M.thicknessMap&&(S.thicknessMap.value=M.thicknessMap,t(M.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=M.attenuationDistance,S.attenuationColor.value.copy(M.attenuationColor)),M.anisotropy>0&&(S.anisotropyVector.value.set(M.anisotropy*Math.cos(M.anisotropyRotation),M.anisotropy*Math.sin(M.anisotropyRotation)),M.anisotropyMap&&(S.anisotropyMap.value=M.anisotropyMap,t(M.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=M.specularIntensity,S.specularColor.value.copy(M.specularColor),M.specularColorMap&&(S.specularColorMap.value=M.specularColorMap,t(M.specularColorMap,S.specularColorMapTransform)),M.specularIntensityMap&&(S.specularIntensityMap.value=M.specularIntensityMap,t(M.specularIntensityMap,S.specularIntensityMapTransform))}
vendor: 40,059 bytes, line 4057
4057function y(S,M){M.matcap&&(S.matcap.value=M.matcap)}function T(S,M){const R=e.get(M).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function X9(i,e,t,n){let r={},s={},o=[];const a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(R,E){const N=E.program;n.uniformBlockBinding(R,N)}function u(R,E){let N=r[R.id];N===void 0&&(y(R),N=d(R),r[R.id]=N,R.addEventListener("dispose",S));const U=E.program;n.updateUBOMapping(R,U);const L=e.render.frame;s[R.id]!==L&&(g(R),s[R.id]=L)}function d(R){const E=p();R.__bindingPointIndex=E;const N=i.createBuffer(),U=R.__size,L=R.usage;return i.bindBuffer(i.UNIFORM_BUFFER,N),i.bufferData(i.UNIFORM_BUFFER,U,L),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,N),N}function p(){for(let R=0;R<a;R++)if(o.indexOf(R)===-1)return o.push(R),R;return ke("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(R){const E=r[R.id],N=R.uniforms,U=R.__cache;i.bindBuffer(i.UNIFORM_BUFFER,E);for(let L=0,F=N.length;L<F;L++){const P=Array.isArray(N[L])?N[L]:[N[L]];for(let I=0,$=P.length;I<$;I++){const k=P[I];if(x(k,L,I,U)===!0){const W=k.__offset,j=Array.isArray(k.value)?k.value:[k.value];let Y=0;for(let z=0;z<j.length;z++){const Q=j[z],ee=T(Q);typeof Q=="number"||typeof Q=="boolean"?(k.__data[0]=Q,i.bufferSubData(i.UNIFORM_BUFFER,W+Y,k.__data)):Q.isMatrix3?(k.__data[0]=Q.elements[0],k.__data[1]=Q.elements[1],k.__data[2]=Q.elements[2],k.__data[3]=0,k.__data[4]=Q.elements[3],k.__data[5]=Q.elements[4],k.__data[6]=Q.elements[5],k.__data[7]=0,k.__data[8]=Q.elements[6],k.__data[9]=Q.elements[7],k.__data[10]=Q.elements[8],k.__data[11]=0):(Q.toArray(k.__data,Y),Y+=ee.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,W,k.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function x(R,E,N,U){const L=R.value,F=E+"_"+N;if(U[F]===void 0)return typeof L=="number"||typeof L=="boolean"?U[F]=L:U[F]=L.clone(),!0;{const P=U[F];if(typeof L=="number"||typeof L=="boolean"){if(P!==L)return U[F]=L,!0}else if(P.equals(L)===!1)return P.copy(L),!0}return!1}function y(R){const E=R.uniforms;let N=0;const U=16;for(let F=0,P=E.length;F<P;F++){const I=Array.isArray(E[F])?E[F]:[E[F]];for(let $=0,k=I.length;$<k;$++){const W=I[$],j=Array.isArray(W.value)?W.value:[W.value];for(let Y=0,z=j.length;Y<z;Y++){const Q=j[Y],ee=T(Q),fe=N%U,le=fe%ee.boundary,Me=fe+le;N+=le,Me!==0&&U-Me<ee.storage&&(N+=U-Me),W.__data=new Float32Array(ee.storage/Float32Array.BYTES_PER_ELEMENT),W.__offset=N,N+=ee.storage}}}const L=N%U;return L>0&&(N+=U-L),R.__size=N,R.__cache={},this}function T(R){const E={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(E.boundary=4,E.storage=4):R.isVector2?(E.boundary=8,E.storage=8):R.isVector3||R.isColor?(E.boundary=16,E.storage=12):R.isVector4?(E.boundary=16,E.storage=16):R.isMatrix3?(E.boundary=48,E.storage=48):R.isMatrix4?(E.boundary=64,E.storage=64):R.isTexture?Oe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Oe("WebGLRenderer: Unsupported uniform value type.",R),E}function S(R){const E=R.target;E.removeEventListener("dispose",S);const N=o.indexOf(E.__bindingPointIndex);o.splice(N,1),i.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function M(){for(const R in r)i.deleteBuffer(r[R]);o=[],r={},s={}}return{bind:l,update:u,dispose:M}}const Q9=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Qo=null;function Y9(){return Qo===null&&(Qo=new bv(Q9,16,16,ls,Mi),Qo.name="DFG_LUT",Qo.minFilter=li,Qo.magFilter=li,Qo.wrapS=xs,Qo.wrapT=xs,Qo.generateMipmaps=!1,Qo.needsUpdate=!0),Qo}class K9{constructor(e={}){const{canvas:t=nE(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:g=!1,outputBufferType:x=yi}=e;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=o;const T=x,S=new Set([LA,DA,PA]),M=new Set([yi,ii,Do,Hs,tg,ng]),R=new Uint32Array(4),E=new Int32Array(4);let N=null,U=null;const L=[],F=[];let P=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=wr,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const I=this;let $=!1;this._outputColorSpace=Tr;let k=0,W=0,j=null,Y=-1,z=null;const Q=new rn,ee=new rn;let fe=null;const le=new It(0);let Me=0,Ce=t.width,Be=t.height,Ye=1,qt=null,bt=null;const Re=new rn(0,0,Ce,Be),qe=new rn(0,0,Ce,Be);let Ke=!1;const St=new IA;let mt=!1,Tt=!1;const an=new nn,Ut=new J,Ue=new rn,Je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let He=!1;function ot(){return j===null?Ye:1}let se=n;function Kt(K,_e){return t.getContext(K,_e)}try{const K={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:u,powerPreference:d,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${NA}`),t.addEventListener("webglcontextlost",Bt,!1),t.addEventListener("webglcontextrestored",fn,!1),t.addEventListener("webglcontextcreationerror",ci,!1),se===null){const _e="webgl2";if(se=Kt(_e,K),se===null)throw Kt(_e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(K){throw ke("WebGLRenderer: "+K.message),K}let yt,zt,at,te,V,de,Pe,$e,Le,Nt,ct,Wt,Zt,nt,lt,Ot,kt,wt,Sn,me,ht,ut,Pt;function pe(){yt=new KB(se),yt.init(),ht=new V9(se,yt),zt=new zB(se,yt,e,ht),at=new k9(se,yt),zt.reversedDepthBuffer&&g&&at.buffers.depth.setReversed(!0),te=new eF(se),V=new M9,de=new G9(se,yt,at,V,zt,ht,te),Pe=new YB(I),$e=new sL(se),ut=new VB(se,$e),Le=new ZB(se,$e,te,ut),Nt=new nF(se,Le,$e,ut,te),wt=new tF(se,zt,de),lt=new HB(V),ct=new T9(I,Pe,yt,zt,ut,lt),Wt=new j9(I,V),Zt=new E9,nt=new L9(yt),kt=new GB(I,Pe,at,Nt,y,l),Ot=new O9(I,Nt,zt),Pt=new X9(se,te,zt,at),Sn=new qB(se,yt,te),me=new JB(se,yt,te),te.programs=ct.programs,I.capabilities=zt,I.extensions=yt,I.properties=V,I.renderLists=Zt,I.shadowMap=Ot,I.state=at,I.info=te}pe(),T!==yi&&(P=new rF(T,t.width,t.height,r,s));const Ie=new W9(I,se);this.xr=Ie,this.getContext=function(){return se},this.getContextAttributes=function(){return se.getContextAttributes()},this.forceContextLoss=function(){const K=yt.get("WEBGL_lose_context");K&&K.loseContext()},this.forceContextRestore=function(){const K=yt.get("WEBGL_lose_context");K&&K.restoreContext()},this.getPixelRatio=function(){return Ye},this.setPixelRatio=function(K){K!==void 0&&(Ye=K,this.setSize(Ce,Be,!1))},this.getSize=function(K){return K.set(Ce,Be)},this.setSize=function(K,_e,we=!0){if(Ie.isPresenting){Oe("WebGLRenderer: Can't change size while VR device is presenting.");return}Ce=K,Be=_e,t.width=Math.floor(K*Ye),t.height=Math.floor(_e*Ye),we===!0&&(t.style.width=K+"px",t.style.height=_e+"px"),P!==null&&P.setSize(t.width,t.height),this.setViewport(0,0,K,_e)},this.getDrawingBufferSize=function(K){return K.set(Ce*Ye,Be*Ye).floor()},this.setDrawingBufferSize=function(K,_e,we){Ce=K,Be=_e,Ye=we,t.width=Math.floor(K*we),t.height=Math.floor(_e*we),this.setViewport(0,0,K,_e)},this.setEffects=function(K){if(T===yi){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(K){for(let _e=0;_e<K.length;_e++)if(K[_e].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}P.setEffects(K||[])},this.getCurrentViewport=function(K){return K.copy(Q)},this.getViewport=function(K){return K.copy(Re)},this.setViewport=function(K,_e,we,Te){K.isVector4?Re.set(K.x,K.y,K.z,K.w):Re.set(K,_e,we,Te),at.viewport(Q.copy(Re).multiplyScalar(Ye).round())},this.getScissor=function(K){return K.copy(qe)},this.setScissor=function(K,_e,we,Te){K.isVector4?qe.set(K.x,K.y,K.z,K.w):qe.set(K,_e,we,Te),at.scissor(ee.copy(qe).multiplyScalar(Ye).round())},this.getScissorTest=function(){return Ke},this.setScissorTest=function(K){at.setScissorTest(Ke=K)},this.setOpaqueSort=function(K){qt=K},this.setTransparentSort=function(K){bt=K},this.getClearColor=function(K){return K.copy(kt.getClearColor())},this.setClearColor=function(){kt.setClearColor(...arguments)},this.getClearAlpha=function(){return kt.getClearAlpha()},this.setClearAlpha=function(){kt.setClearAlpha(...arguments)},this.clear=function(K=!0,_e=!0,we=!0){let Te=0;if(K){let be=!1;if(j!==null){const gt=j.texture.format;be=S.has(gt)}if(be){const gt=j.texture.type,Rt=M.has(gt),dt=kt.getClearColor(),Qe=kt.getClearAlpha(),q=dt.r,rt=dt.g,yn=dt.b;Rt?(R[0]=q,R[1]=rt,R[2]=yn,R[3]=Qe,se.clearBufferuiv(se.COLOR,0,R)):(E[0]=q,E[1]=rt,E[2]=yn,E[3]=Qe,se.clearBufferiv(se.COLOR,0,E))}else Te|=se.COLOR_BUFFER_BIT}_e&&(Te|=se.DEPTH_BUFFER_BIT),we&&(Te|=se.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Te!==0&&se.clear(Te)},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",Bt,!1),t.removeEventListener("webglcontextrestored",fn,!1),t.removeEventListener("webglcontextcreationerror",ci,!1),kt.dispose(),Zt.dispose(),nt.dispose(),V.dispose(),Pe.dispose(),Nt.dispose(),ut.dispose(),Pt.dispose(),ct.dispose(),Ie.dispose(),Ie.removeEventListener("sessionstart",qo),Ie.removeEventListener("sessionend",Se),Fe.stop()};function Bt(K){K.preventDefault(),cd("WebGLRenderer: Context Lost."),$=!0}function fn(){cd("WebGLRenderer: Context Restored."),$=!1;const K=te.autoReset,_e=Ot.enabled,we=Ot.autoUpdate,Te=Ot.needsUpdate,be=Ot.type;pe(),te.autoReset=K,Ot.enabled=_e,Ot.autoUpdate=we,Ot.needsUpdate=Te,Ot.type=be}function ci(K){ke("WebGLRenderer: A WebGL context could not be created. Reason: ",K.statusMessage)}function qn(K){const _e=K.target;_e.removeEventListener("dispose",qn),Xs(_e)}function Xs(K){Qs(K),V.remove(K)}function Qs(K){const _e=V.get(K).programs;_e!==void 0&&(_e.forEach(function(we){ct.releaseProgram(we)}),K.isShaderMaterial&&ct.releaseShaderCache(K))}this.renderBufferDirect=function(K,_e,we,Te,be,gt){_e===null&&(_e=Je);const Rt=be.isMesh&&be.matrixWorld.determinant()<0,dt=Ln(K,_e,we,Te,be);at.setMaterial(Te,Rt);let Qe=we.index,q=1;if(Te.wireframe===!0){if(Qe=Le.getWireframeAttribute(we),Qe===void 0)return;q=2}const rt=we.drawRange,yn=we.attributes.position;let $t=rt.start*q,Jn=(rt.start+rt.count)*q;gt!==null&&($t=Math.max($t,gt.start*q),Jn=Math.min(Jn,(gt.start+gt.count)*q)),Qe!==null?($t=Math.max($t,0),Jn=Math.min(Jn,Qe.count)):yn!=null&&($t=Math.max($t,0),Jn=Math.min(Jn,yn.count));const Bi=Jn-$t;if(Bi<0||Bi===1/0)return;ut.setup(be,Te,dt,we,Qe);let Ci,G=Sn;if(Qe!==null&&(Ci=$e.get(Qe),G=me,G.setIndex(Ci)),be.isMesh)Te.wireframe===!0?(at.setLineWidth(Te.wireframeLinewidth*ot()),G.setMode(se.LINES)):G.setMode(se.TRIANGLES);else if(be.isLine){let lr=Te.linewidth;lr===void 0&&(lr=1),at.setLineWidth(lr*ot()),be.isLineSegments?G.setMode(se.LINES):be.isLineLoop?G.setMode(se.LINE_LOOP):G.setMode(se.LINE_STRIP)}else be.isPoints?G.setMode(se.POINTS):be.isSprite&&G.setMode(se.TRIANGLES);if(be.isBatchedMesh)if(be._multiDrawInstances!==null)zn("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),G.renderMultiDrawInstances(be._multiDrawStarts,be._multiDrawCounts,be._multiDrawCount,be._multiDrawInstances);else if(yt.get("WEBGL_multi_draw"))G.renderMultiDraw(be._multiDrawStarts,be._multiDrawCounts,be._multiDrawCount);else{const lr=be._multiDrawStarts,Ht=be._multiDrawCounts,$r=be._multiDrawCount,Gn=Qe?$e.get(Qe).bytesPerElement:1,Ps=V.get(Te).currentProgram.getUniforms();for(let Ys=0;Ys<$r;Ys++)Ps.setValue(se,"_gl_DrawID",Ys),G.render(lr[Ys]/Gn,Ht[Ys])}else if(be.isInstancedMesh)G.renderInstances($t,Bi,be.count);else if(we.isInstancedBufferGeometry){const lr=we._maxInstanceCount!==void 0?we._maxInstanceCount:1/0,Ht=Math.min(we.instanceCount,lr);G.renderInstances($t,Bi,Ht)}else G.render($t,Bi)};function zA(K,_e,we){K.transparent===!0&&K.side===Ui&&K.forceSinglePass===!1?(K.side=Xn,K.needsUpdate=!0,Un(K,_e,we),K.side=cs,K.needsUpdate=!0,Un(K,_e,we),K.side=Ui):Un(K,_e,we)}this.compile=function(K,_e,we=null){we===null&&(we=K),U=nt.get(we),U.init(_e),F.push(U),we.traverseVisible(function(be){be.isLight&&be.layers.test(_e.layers)&&(U.pushLight(be),be.castShadow&&U.pushShadow(be))}),K!==we&&K.traverseVisible(function(be){be.isLight&&be.layers.test(_e.layers)&&(U.pushLight(be),be.castShadow&&U.pushShadow(be))}),U.setupLights();const Te=new Set;return K.traverse(function(be){if(!(be.isMesh||be.isPoints||be.isLine||be.isSprite))return;const gt=be.material;if(gt)if(Array.isArray(gt))for(let Rt=0;Rt<gt.length;Rt++){const dt=gt[Rt];zA(dt,we,be),Te.add(dt)}else zA(gt,we,be),Te.add(gt)}),U=F.pop(),Te},this.compileAsync=function(K,_e,we=null){const Te=this.compile(K,_e,we);return new Promise(be=>{function gt(){if(Te.forEach(function(Rt){V.get(Rt).currentProgram.isReady()&&Te.delete(Rt)}),Te.size===0){be(K);return}setTimeout(gt,10)}yt.get("KHR_parallel_shader_compile")!==null?gt():setTimeout(gt,10)})};let gl=null;function HA(K){gl&&gl(K)}function qo(){Fe.stop()}function Se(){Fe.start()}const Fe=new TE;Fe.setAnimationLoop(HA),typeof self<"u"&&Fe.setContext(self),this.setAnimationLoop=function(K){gl=K,Ie.setAnimationLoop(K),K===null?Fe.stop():Fe.start()},Ie.addEventListener("sessionstart",qo),Ie.addEventListener("sessionend",Se),this.render=function(K,_e){if(_e!==void 0&&_e.isCamera!==!0){ke("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if($===!0)return;const we=Ie.enabled===!0&&Ie.isPresenting===!0,Te=P!==null&&(j===null||we)&&P.begin(I,j);if(K.matrixWorldAutoUpdate===!0&&K.updateMatrixWorld(),_e.parent===null&&_e.matrixWorldAutoUpdate===!0&&_e.updateMatrixWorld(),Ie.enabled===!0&&Ie.isPresenting===!0&&(P===null||P.isCompositing()===!1)&&(Ie.cameraAutoUpdate===!0&&Ie.updateCamera(_e),_e=Ie.getCamera()),K.isScene===!0&&K.onBeforeRender(I,K,_e,j),U=nt.get(K,F.length),U.init(_e),F.push(U),an.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),St.setFromProjectionMatrix(an,us,_e.reversedDepth),Tt=this.localClippingEnabled,mt=lt.init(this.clippingPlanes,Tt),N=Zt.get(K,L.length),N.init(),L.push(N),Ie.enabled===!0&&Ie.isPresenting===!0){const Rt=I.xr.getDepthSensingMesh();Rt!==null&&At(Rt,_e,-1/0,I.sortObjects)}At(K,_e,0,I.sortObjects),N.finish(),I.sortObjects===!0&&N.sort(qt,bt),He=Ie.enabled===!1||Ie.isPresenting===!1||Ie.hasDepthSensing()===!1,He&&kt.addToRenderList(N,K),this.info.render.frame++,mt===!0&<.beginShadows();const be=U.state.shadowsArray;if(Ot.render(be,K,_e),mt===!0&<.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Te&&P.hasRenderPass())===!1){const Rt=N.opaque,dt=N.transmissive;if(U.setupLights(),_e.isArrayCamera){const Qe=_e.cameras;if(dt.length>0)for(let q=0,rt=Qe.length;q<rt;q++){const yn=Qe[q];A(Rt,dt,K,yn)}He&&kt.render(K);for(let q=0,rt=Qe.length;q<rt;q++){const yn=Qe[q];Ve(N,K,yn,yn.viewport)}}else dt.length>0&&A(Rt,dt,K,_e),He&&kt.render(K),Ve(N,K,_e)}j!==null&&W===0&&(de.updateMultisampleRenderTarget(j),de.updateRenderTargetMipmap(j)),Te&&P.end(I),K.isScene===!0&&K.onAfterRender(I,K,_e),ut.resetDefaultState(),Y=-1,z=null,F.pop(),F.length>0?(U=F[F.length-1],mt===!0&<.setGlobalState(I.clippingPlanes,U.state.camera)):U=null,L.pop(),L.length>0?N=L[L.length-1]:N=null};function At(K,_e,we,Te){if(K.visible===!1)return;if(K.layers.test(_e.layers)){if(K.isGroup)we=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(_e);else if(K.isLight)U.pushLight(K),K.castShadow&&U.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||St.intersectsSprite(K)){Te&&Ue.setFromMatrixPosition(K.matrixWorld).applyMatrix4(an);const Rt=Nt.update(K),dt=K.material;dt.visible&&N.push(K,Rt,dt,we,Ue.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||St.intersectsObject(K))){const Rt=Nt.update(K),dt=K.material;if(Te&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),Ue.copy(K.boundingSphere.center)):(Rt.boundingSphere===null&&Rt.computeBoundingSphere(),Ue.copy(Rt.boundingSphere.center)),Ue.applyMatrix4(K.matrixWorld).applyMatrix4(an)),Array.isArray(dt)){const Qe=Rt.groups;for(let q=0,rt=Qe.length;q<rt;q++){const yn=Qe[q],$t=dt[yn.materialIndex];$t&&$t.visible&&N.push(K,Rt,$t,we,Ue.z,yn)}}else dt.visible&&N.push(K,Rt,dt,we,Ue.z,null)}}const gt=K.children;for(let Rt=0,dt=gt.length;Rt<dt;Rt++)At(gt[Rt],_e,we,Te)}function Ve(K,_e,we,Te){const{opaque:be,transmissive:gt,transparent:Rt}=K;U.setupLightsView(we),mt===!0&<.setGlobalState(I.clippingPlanes,we),Te&&at.viewport(Q.copy(Te)),be.length>0&&H(be,_e,we),gt.length>0&&H(gt,_e,we),Rt.length>0&&H(Rt,_e,we),at.buffers.depth.setTest(!0),at.buffers.depth.setMask(!0),at.buffers.color.setMask(!0),at.setPolygonOffset(!1)}function A(K,_e,we,Te){if((we.isScene===!0?we.overrideMaterial:null)!==null)return;if(U.state.transmissionRenderTarget[Te.id]===void 0){const $t=yt.has("EXT_color_buffer_half_float")||yt.has("EXT_color_buffer_float");U.state.transmissionRenderTarget[Te.id]=new _a(1,1,{generateMipmaps:!0,type:$t?Mi:yi,minFilter:vs,samples:Math.max(4,zt.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Yt.workingColorSpace})}const gt=U.state.transmissionRenderTarget[Te.id],Rt=Te.viewport||Q;gt.setSize(Rt.z*I.transmissionResolutionScale,Rt.w*I.transmissionResolutionScale);const dt=I.getRenderTarget(),Qe=I.getActiveCubeFace(),q=I.getActiveMipmapLevel();I.setRenderTarget(gt),I.getClearColor(le),Me=I.getClearAlpha(),Me<1&&I.setClearColor(16777215,.5),I.clear(),He&&kt.render(we);const rt=I.toneMapping;I.toneMapping=wr;const yn=Te.viewport;if(Te.viewport!==void 0&&(Te.viewport=void 0),U.setupLightsView(Te),mt===!0&<.setGlobalState(I.clippingPlanes,Te),H(K,we,Te),de.updateMultisampleRenderTarget(gt),de.updateRenderTargetMipmap(gt),yt.has("WEBGL_multisampled_render_to_texture")===!1){let $t=!1;for(let Jn=0,Bi=_e.length;Jn<Bi;Jn++){const Ci=_e[Jn],{object:G,geometry:lr,material:Ht,group:$r}=Ci;if(Ht.side===Ui&&G.layers.test(Te.layers)){const Gn=Ht.side;Ht.side=Xn,Ht.needsUpdate=!0,Cn(G,we,Te,lr,Ht,$r),Ht.side=Gn,Ht.needsUpdate=!0,$t=!0}}$t===!0&&(de.updateMultisampleRenderTarget(gt),de.updateRenderTargetMipmap(gt))}I.setRenderTarget(dt,Qe,q),I.setClearColor(le,Me),yn!==void 0&&(Te.viewport=yn),I.toneMapping=rt}function H(K,_e,we){const Te=_e.isScene===!0?_e.overrideMaterial:null;for(let be=0,gt=K.length;be<gt;be++){const Rt=K[be],{object:dt,geometry:Qe,group:q}=Rt;let rt=Rt.material;rt.allowOverride===!0&&Te!==null&&(rt=Te),dt.layers.test(we.layers)&&Cn(dt,_e,we,Qe,rt,q)}}function Cn(K,_e,we,Te,be,gt){K.onBeforeRender(I,_e,we,Te,be,gt),K.modelViewMatrix.multiplyMatrices(we.matrixWorldInverse,K.matrixWorld),K.normalMatrix.getNormalMatrix(K.modelViewMatrix),be.onBeforeRender(I,_e,we,Te,K,gt),be.transparent===!0&&be.side===Ui&&be.forceSinglePass===!1?(be.side=Xn,be.needsUpdate=!0,I.renderBufferDirect(we,_e,Te,be,K,gt),be.side=cs,be.needsUpdate=!0,I.renderBufferDirect(we,_e,Te,be,K,gt),be.side=Ui):I.renderBufferDirect(we,_e,Te,be,K,gt),K.onAfterRender(I,_e,we,Te,be,gt)}function Un(K,_e,we){_e.isScene!==!0&&(_e=Je);const Te=V.get(K),be=U.state.lights,gt=U.state.shadowsArray,Rt=be.state.version,dt=ct.getParameters(K,be.state,gt,_e,we),Qe=ct.getProgramCacheKey(dt);let q=Te.programs;Te.environment=K.isMeshStandardMaterial||K.isMeshLambertMaterial||K.isMeshPhongMaterial?_e.environment:null,Te.fog=_e.fog;const rt=K.isMeshStandardMaterial||K.isMeshLambertMaterial&&!K.envMap||K.isMeshPhongMaterial&&!K.envMap;Te.envMap=Pe.get(K.envMap||Te.environment,rt),Te.envMapRotation=Te.environment!==null&&K.envMap===null?_e.environmentRotation:K.envMapRotation,q===void 0&&(K.addEventListener("dispose",qn),q=new Map,Te.programs=q);let yn=q.get(Qe);if(yn!==void 0){if(Te.currentProgram===yn&&Te.lightsStateVersion===Rt)return mn(K,dt),yn}else dt.uniforms=ct.getUniforms(K),K.onBeforeCompile(dt,I),yn=ct.acquireProgram(dt,Qe),q.set(Qe,yn),Te.uniforms=dt.uniforms;const $t=Te.uniforms;return(!K.isShaderMaterial&&!K.isRawShaderMaterial||K.clipping===!0)&&($t.clippingPlanes=lt.uniform),mn(K,dt),Te.needsLights=kn(K),Te.lightsStateVersion=Rt,Te.needsLights&&($t.ambientLightColor.value=be.state.ambient,$t.lightProbe.value=be.state.probe,$t.directionalLights.value=be.state.directional,$t.directionalLightShadows.value=be.state.directionalShadow,$t.spotLights.value=be.state.spot,$t.spotLightShadows.value=be.state.spotShadow,$t.rectAreaLights.value=be.state.rectArea,$t.ltc_1.value=be.state.rectAreaLTC1,$t.ltc_2.value=be.state.rectAreaLTC2,$t.pointLights.value=be.state.point,$t.pointLightShadows.value=be.state.pointShadow,$t.hemisphereLights.value=be.state.hemi,$t.directionalShadowMatrix.value=be.state.directionalShadowMatrix,$t.spotLightMatrix.value=be.state.spotLightMatrix,$t.spotLightMap.value=be.state.spotLightMap,$t.pointShadowMatrix.value=be.state.pointShadowMatrix),Te.currentProgram=yn,Te.uniformsList=null,yn}function ji(K){if(K.uniformsList===null){const _e=K.currentProgram.getUniforms();K.uniformsList=Vp.seqWithValue(_e.seq,K.uniforms)}return K.uniformsList}function mn(K,_e){const we=V.get(K);we.outputColorSpace=_e.outputColorSpace,we.batching=_e.batching,we.batchingColor=_e.batchingColor,we.instancing=_e.instancing,we.instancingColor=_e.instancingColor,we.instancingMorph=_e.instancingMorph,we.skinning=_e.skinning,we.morphTargets=_e.morphTargets,we.morphNormals=_e.morphNormals,we.morphColors=_e.morphColors,we.morphTargetsCount=_e.morphTargetsCount,we.numClippingPlanes=_e.numClippingPlanes,we.numIntersection=_e.numClipIntersection,we.vertexAlphas=_e.vertexAlphas,we.vertexTangents=_e.vertexTangents,we.toneMapping=_e.toneMapping}function Ln(K,_e,we,Te,be){_e.isScene!==!0&&(_e=Je),de.resetTextureUnits();const gt=_e.fog,Rt=Te.isMeshStandardMaterial||Te.isMeshLambertMaterial||Te.isMeshPhongMaterial?_e.environment:null,dt=j===null?I.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:au,Qe=Te.isMeshStandardMaterial||Te.isMeshLambertMaterial&&!Te.envMap||Te.isMeshPhongMaterial&&!Te.envMap,q=Pe.get(Te.envMap||Rt,Qe),rt=Te.vertexColors===!0&&!!we.attributes.color&&we.attributes.color.itemSize===4,yn=!!we.attributes.tangent&&(!!Te.normalMap||Te.anisotropy>0),$t=!!we.morphAttributes.position,Jn=!!we.morphAttributes.normal,Bi=!!we.morphAttributes.color;let Ci=wr;Te.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Ci=I.toneMapping);const G=we.morphAttributes.position||we.morphAttributes.normal||we.morphAttributes.color,lr=G!==void 0?G.length:0,Ht=V.get(Te),$r=U.state.lights;if(mt===!0&&(Tt===!0||K!==z)){const Ki=K===z&&Te.id===Y;lt.setState(Te,K,Ki)}let Gn=!1;Te.version===Ht.__version?(Ht.needsLights&&Ht.lightsStateVersion!==$r.state.version||Ht.outputColorSpace!==dt||be.isBatchedMesh&&Ht.batching===!1||!be.isBatchedMesh&&Ht.batching===!0||be.isBatchedMesh&&Ht.batchingColor===!0&&be.colorTexture===null||be.isBatchedMesh&&Ht.batchingColor===!1&&be.colorTexture!==null||be.isInstancedMesh&&Ht.instancing===!1||!be.isInstancedMesh&&Ht.instancing===!0||be.isSkinnedMesh&&Ht.skinning===!1||!be.isSkinnedMesh&&Ht.skinning===!0||be.isInstancedMesh&&Ht.instancingColor===!0&&be.instanceColor===null||be.isInstancedMesh&&Ht.instancingColor===!1&&be.instanceColor!==null||be.isInstancedMesh&&Ht.instancingMorph===!0&&be.morphTexture===null||be.isInstancedMesh&&Ht.instancingMorph===!1&&be.morphTexture!==null||Ht.envMap!==q||Te.fog===!0&&Ht.fog!==gt||Ht.numClippingPlanes!==void 0&&(Ht.numClippingPlanes!==lt.numPlanes||Ht.numIntersection!==lt.numIntersection)||Ht.vertexAlphas!==rt||Ht.vertexTangents!==yn||Ht.morphTargets!==$t||Ht.morphNormals!==Jn||Ht.morphColors!==Bi||Ht.toneMapping!==Ci||Ht.morphTargetsCount!==lr)&&(Gn=!0):(Gn=!0,Ht.__version=Te.version);let Ps=Ht.currentProgram;Gn===!0&&(Ps=Un(Te,_e,be));let Ys=!1,Ho=!1,Oa=!1;const ei=Ps.getUniforms(),hi=Ht.uniforms;if(at.useProgram(Ps.program)&&(Ys=!0,Ho=!0,Oa=!0),Te.id!==Y&&(Y=Te.id,Ho=!0),Ys||z!==K){at.buffers.depth.getReversed()&&K.reversedDepth!==!0&&(K._reversedDepth=!0,K.updateProjectionMatrix()),ei.setValue(se,"projectionMatrix",K.projectionMatrix),ei.setValue(se,"viewMatrix",K.matrixWorldInverse);const _o=ei.map.cameraPosition;_o!==void 0&&_o.setValue(se,Ut.setFromMatrixPosition(K.matrixWorld)),zt.logarithmicDepthBuffer&&ei.setValue(se,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),(Te.isMeshPhongMaterial||Te.isMeshToonMaterial||Te.isMeshLambertMaterial||Te.isMeshBasicMaterial||Te.isMeshStandardMaterial||Te.isShaderMaterial)&&ei.setValue(se,"isOrthographic",K.isOrthographicCamera===!0),z!==K&&(z=K,Ho=!0,Oa=!0)}if(Ht.needsLights&&($r.state.directionalShadowMap.length>0&&ei.setValue(se,"directionalShadowMap",$r.state.directionalShadowMap,de),$r.state.spotShadowMap.length>0&&ei.setValue(se,"spotShadowMap",$r.state.spotShadowMap,de),$r.state.pointShadowMap.length>0&&ei.setValue(se,"pointShadowMap",$r.state.pointShadowMap,de)),be.isSkinnedMesh){ei.setOptional(se,be,"bindMatrix"),ei.setOptional(se,be,"bindMatrixInverse");const Ki=be.skeleton;Ki&&(Ki.boneTexture===null&&Ki.computeBoneTexture(),ei.setValue(se,"boneTexture",Ki.boneTexture,de))}be.isBatchedMesh&&(ei.setOptional(se,be,"batchingTexture"),ei.setValue(se,"batchingTexture",be._matricesTexture,de),ei.setOptional(se,be,"batchingIdTexture"),ei.setValue(se,"batchingIdTexture",be._indirectTexture,de),ei.setOptional(se,be,"batchingColorTexture"),be._colorsTexture!==null&&ei.setValue(se,"batchingColorTexture",be._colorsTexture,de));const mi=we.morphAttributes;if((mi.position!==void 0||mi.normal!==void 0||mi.color!==void 0)&&wt.update(be,we,Ps),(Ho||Ht.receiveShadow!==be.receiveShadow)&&(Ht.receiveShadow=be.receiveShadow,ei.setValue(se,"receiveShadow",be.receiveShadow)),(Te.isMeshStandardMaterial||Te.isMeshLambertMaterial||Te.isMeshPhongMaterial)&&Te.envMap===null&&_e.environment!==null&&(hi.envMapIntensity.value=_e.environmentIntensity),hi.dfgLUT!==void 0&&(hi.dfgLUT.value=Y9()),Ho&&(ei.setValue(se,"toneMappingExposure",I.toneMappingExposure),Ht.needsLights&&zo(hi,Oa),gt&&Te.fog===!0&&Wt.refreshFogUniforms(hi,gt),Wt.refreshMaterialUniforms(hi,Te,Ye,Be,U.state.transmissionRenderTarget[K.id]),Vp.upload(se,ji(Ht),hi,de)),Te.isShaderMaterial&&Te.uniformsNeedUpdate===!0&&(Vp.upload(se,ji(Ht),hi,de),Te.uniformsNeedUpdate=!1),Te.isSpriteMaterial&&ei.setValue(se,"center",be.center),ei.setValue(se,"modelViewMatrix",be.modelViewMatrix),ei.setValue(se,"normalMatrix",be.normalMatrix),ei.setValue(se,"modelMatrix",be.matrixWorld),Te.isShaderMaterial||Te.isRawShaderMaterial){const Ki=Te.uniformsGroups;for(let _o=0,_l=Ki.length;_o<_l;_o++){const Ec=Ki[_o];Pt.update(Ec,Ps),Pt.bind(Ec,Ps)}}return Ps}function zo(K,_e){K.ambientLightColor.needsUpdate=_e,K.lightProbe.needsUpdate=_e,K.directionalLights.needsUpdate=_e,K.directionalLightShadows.needsUpdate=_e,K.pointLights.needsUpdate=_e,K.pointLightShadows.needsUpdate=_e,K.spotLights.needsUpdate=_e,K.spotLightShadows.needsUpdate=_e,K.rectAreaLights.needsUpdate=_e,K.hemisphereLights.needsUpdate=_e}function kn(K){return K.isMeshLambertMaterial||K.isMeshToonMaterial||K.isMeshPhongMaterial||K.isMeshStandardMaterial||K.isShadowMaterial||K.isShaderMaterial&&K.lights===!0}this.getActiveCubeFace=function(){return k},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return j},this.setRenderTargetTextures=function(K,_e,we){const Te=V.get(K);Te.__autoAllocateDepthBuffer=K.resolveDepthBuffer===!1,Te.__autoAllocateDepthBuffer===!1&&(Te.__useRenderToTexture=!1),V.get(K.texture).__webglTexture=_e,V.get(K.depthTexture).__webglTexture=Te.__autoAllocateDepthBuffer?void 0:we,Te.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(K,_e){const we=V.get(K);we.__webglFramebuffer=_e,we.__useDefaultFramebuffer=_e===void 0};const xn=se.createFramebuffer();this.setRenderTarget=function(K,_e=0,we=0){j=K,k=_e,W=we;let Te=null,be=!1,gt=!1;if(K){const dt=V.get(K);if(dt.__useDefaultFramebuffer!==void 0){at.bindFramebuffer(se.FRAMEBUFFER,dt.__webglFramebuffer),Q.copy(K.viewport),ee.copy(K.scissor),fe=K.scissorTest,at.viewport(Q),at.scissor(ee),at.setScissorTest(fe),Y=-1;return}else if(dt.__webglFramebuffer===void 0)de.setupRenderTarget(K);else if(dt.__hasExternalTextures)de.rebindTextures(K,V.get(K.texture).__webglTexture,V.get(K.depthTexture).__webglTexture);else if(K.depthBuffer){const rt=K.depthTexture;if(dt.__boundDepthTexture!==rt){if(rt!==null&&V.has(rt)&&(K.width!==rt.image.width||K.height!==rt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");de.setupDepthRenderbuffer(K)}}const Qe=K.texture;(Qe.isData3DTexture||Qe.isDataArrayTexture||Qe.isCompressedArrayTexture)&&(gt=!0);const q=V.get(K).__webglFramebuffer;K.isWebGLCubeRenderTarget?(Array.isArray(q[_e])?Te=q[_e][we]:Te=q[_e],be=!0):K.samples>0&&de.useMultisampledRTT(K)===!1?Te=V.get(K).__webglMultisampledFramebuffer:Array.isArray(q)?Te=q[we]:Te=q,Q.copy(K.viewport),ee.copy(K.scissor),fe=K.scissorTest}else Q.copy(Re).multiplyScalar(Ye).floor(),ee.copy(qe).multiplyScalar(Ye).floor(),fe=Ke;if(we!==0&&(Te=xn),at.bindFramebuffer(se.FRAMEBUFFER,Te)&&at.drawBuffers(K,Te),at.viewport(Q),at.scissor(ee),at.setScissorTest(fe),be){const dt=V.get(K.texture);se.framebufferTexture2D(se.FRAMEBUFFER,se.COLOR_ATTACHMENT0,se.TEXTURE_CUBE_MAP_POSITIVE_X+_e,dt.__webglTexture,we)}else if(gt){const dt=_e;for(let Qe=0;Qe<K.textures.length;Qe++){const q=V.get(K.textures[Qe]);se.framebufferTextureLayer(se.FRAMEBUFFER,se.COLOR_ATTACHMENT0+Qe,q.__webglTexture,we,dt)}}else if(K!==null&&we!==0){const dt=V.get(K.texture);se.framebufferTexture2D(se.FRAMEBUFFER,se.COLOR_ATTACHMENT0,se.TEXTURE_2D,dt.__webglTexture,we)}Y=-1},this.readRenderTargetPixels=function(K,_e,we,Te,be,gt,Rt,dt=0){if(!(K&&K.isWebGLRenderTarget)){ke("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Qe=V.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&Rt!==void 0&&(Qe=Qe[Rt]),Qe){at.bindFramebuffer(se.FRAMEBUFFER,Qe);try{const q=K.textures[dt],rt=q.format,yn=q.type;if(K.textures.length>1&&se.readBuffer(se.COLOR_ATTACHMENT0+dt),!zt.textureFormatReadable(rt)){ke("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!zt.textureTypeReadable(yn)){ke("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}_e>=0&&_e<=K.width-Te&&we>=0&&we<=K.height-be&&se.readPixels(_e,we,Te,be,ht.convert(rt),ht.convert(yn),gt)}finally{const q=j!==null?V.get(j).__webglFramebuffer:null;at.bindFramebuffer(se.FRAMEBUFFER,q)}}},this.readRenderTargetPixelsAsync=async function(K,_e,we,Te,be,gt,Rt,dt=0){if(!(K&&K.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Qe=V.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&Rt!==void 0&&(Qe=Qe[Rt]),Qe)if(_e>=0&&_e<=K.width-Te&&we>=0&&we<=K.height-be){at.bindFramebuffer(se.FRAMEBUFFER,Qe);const q=K.textures[dt],rt=q.format,yn=q.type;if(K.textures.length>1&&se.readBuffer(se.COLOR_ATTACHMENT0+dt),!zt.textureFormatReadable(rt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!zt.textureTypeReadable(yn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const $t=se.createBuffer();se.bindBuffer(se.PIXEL_PACK_BUFFER,$t),se.bufferData(se.PIXEL_PACK_BUFFER,gt.byteLength,se.STREAM_READ),se.readPixels(_e,we,Te,be,ht.convert(rt),ht.convert(yn),0);const Jn=j!==null?V.get(j).__webglFramebuffer:null;at.bindFramebuffer(se.FRAMEBUFFER,Jn);const Bi=se.fenceSync(se.SYNC_GPU_COMMANDS_COMPLETE,0);return se.flush(),await u7(se,Bi,4),se.bindBuffer(se.PIXEL_PACK_BUFFER,$t),se.getBufferSubData(se.PIXEL_PACK_BUFFER,0,gt),se.deleteBuffer($t),se.deleteSync(Bi),gt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(K,_e=null,we=0){const Te=Math.pow(2,-we),be=Math.floor(K.image.width*Te),gt=Math.floor(K.image.height*Te),Rt=_e!==null?_e.x:0,dt=_e!==null?_e.y:0;de.setTexture2D(K,0),se.copyTexSubImage2D(se.TEXTURE_2D,we,0,0,Rt,dt,be,gt),at.unbindTexture()};const fs=se.createFramebuffer(),wc=se.createFramebuffer();this.copyTextureToTexture=function(K,_e,we=null,Te=null,be=0,gt=0){let Rt,dt,Qe,q,rt,yn,$t,Jn,Bi;const Ci=K.isCompressedTexture?K.mipmaps[gt]:K.image;if(we!==null)Rt=we.max.x-we.min.x,dt=we.max.y-we.min.y,Qe=we.isBox3?we.max.z-we.min.z:1,q=we.min.x,rt=we.min.y,yn=we.isBox3?we.min.z:0;else{const hi=Math.pow(2,-be);Rt=Math.floor(Ci.width*hi),dt=Math.floor(Ci.height*hi),K.isDataArrayTexture?Qe=Ci.depth:K.isData3DTexture?Qe=Math.floor(Ci.depth*hi):Qe=1,q=0,rt=0,yn=0}Te!==null?($t=Te.x,Jn=Te.y,Bi=Te.z):($t=0,Jn=0,Bi=0);const G=ht.convert(_e.format),lr=ht.convert(_e.type);let Ht;_e.isData3DTexture?(de.setTexture3D(_e,0),Ht=se.TEXTURE_3D):_e.isDataArrayTexture||_e.isCompressedArrayTexture?(de.setTexture2DArray(_e,0),Ht=se.TEXTURE_2D_ARRAY):(de.setTexture2D(_e,0),Ht=se.TEXTURE_2D),se.pixelStorei(se.UNPACK_FLIP_Y_WEBGL,_e.flipY),se.pixelStorei(se.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_e.premultiplyAlpha),se.pixelStorei(se.UNPACK_ALIGNMENT,_e.unpackAlignment);const $r=se.getParameter(se.UNPACK_ROW_LENGTH),Gn=se.getParameter(se.UNPACK_IMAGE_HEIGHT),Ps=se.getParameter(se.UNPACK_SKIP_PIXELS),Ys=se.getParameter(se.UNPACK_SKIP_ROWS),Ho=se.getParameter(se.UNPACK_SKIP_IMAGES);se.pixelStorei(se.UNPACK_ROW_LENGTH,Ci.width),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,Ci.height),se.pixelStorei(se.UNPACK_SKIP_PIXELS,q),se.pixelStorei(se.UNPACK_SKIP_ROWS,rt),se.pixelStorei(se.UNPACK_SKIP_IMAGES,yn);const Oa=K.isDataArrayTexture||K.isData3DTexture,ei=_e.isDataArrayTexture||_e.isData3DTexture;if(K.isDepthTexture){const hi=V.get(K),mi=V.get(_e),Ki=V.get(hi.__renderTarget),_o=V.get(mi.__renderTarget);at.bindFramebuffer(se.READ_FRAMEBUFFER,Ki.__webglFramebuffer),at.bindFramebuffer(se.DRAW_FRAMEBUFFER,_o.__webglFramebuffer);for(let _l=0;_l<Qe;_l++)Oa&&(se.framebufferTextureLayer(se.READ_FRAMEBUFFER,se.COLOR_ATTACHMENT0,V.get(K).__webglTexture,be,yn+_l),se.framebufferTextureLayer(se.DRAW_FRAMEBUFFER,se.COLOR_ATTACHMENT0,V.get(_e).__webglTexture,gt,Bi+_l)),se.blitFramebuffer(q,rt,Rt,dt,$t,Jn,Rt,dt,se.DEPTH_BUFFER_BIT,se.NEAREST);at.bindFramebuffer(se.READ_FRAMEBUFFER,null),at.bindFramebuffer(se.DRAW_FRAMEBUFFER,null)}else if(be!==0||K.isRenderTargetTexture||V.has(K)){const hi=V.get(K),mi=V.get(_e);at.bindFramebuffer(se.READ_FRAMEBUFFER,fs),at.bindFramebuffer(se.DRAW_FRAMEBUFFER,wc);for(let Ki=0;Ki<Qe;Ki++)Oa?se.framebufferTextureLayer(se.READ_FRAMEBUFFER,se.COLOR_ATTACHMENT0,hi.__webglTexture,be,yn+Ki):se.framebufferTexture2D(se.READ_FRAMEBUFFER,se.COLOR_ATTACHMENT0,se.TEXTURE_2D,hi.__webglTexture,be),ei?se.framebufferTextureLayer(se.DRAW_FRAMEBUFFER,se.COLOR_ATTACHMENT0,mi.__webglTexture,gt,Bi+Ki):se.framebufferTexture2D(se.DRAW_FRAMEBUFFER,se.COLOR_ATTACHMENT0,se.TEXTURE_2D,mi.__webglTexture,gt),be!==0?se.blitFramebuffer(q,rt,Rt,dt,$t,Jn,Rt,dt,se.COLOR_BUFFER_BIT,se.NEAREST):ei?se.copyTexSubImage3D(Ht,gt,$t,Jn,Bi+Ki,q,rt,Rt,dt):se.copyTexSubImage2D(Ht,gt,$t,Jn,q,rt,Rt,dt);at.bindFramebuffer(se.READ_FRAMEBUFFER,null),at.bindFramebuffer(se.DRAW_FRAMEBUFFER,null)}else ei?K.isDataTexture||K.isData3DTexture?se.texSubImage3D(Ht,gt,$t,Jn,Bi,Rt,dt,Qe,G,lr,Ci.data):_e.isCompressedArrayTexture?se.compressedTexSubImage3D(Ht,gt,$t,Jn,Bi,Rt,dt,Qe,G,Ci.data):se.texSubImage3D(Ht,gt,$t,Jn,Bi,Rt,dt,Qe,G,lr,Ci):K.isDataTexture?se.texSubImage2D(se.TEXTURE_2D,gt,$t,Jn,Rt,dt,G,lr,Ci.data):K.isCompressedTexture?se.compressedTexSubImage2D(se.TEXTURE_2D,gt,$t,Jn,Ci.width,Ci.height,G,Ci.data):se.texSubImage2D(se.TEXTURE_2D,gt,$t,Jn,Rt,dt,G,lr,Ci);se.pixelStorei(se.UNPACK_ROW_LENGTH,$r),se.pixelStorei(se.UNPACK_IMAGE_HEIGHT,Gn),se.pixelStorei(se.UNPACK_SKIP_PIXELS,Ps),se.pixelStorei(se.UNPACK_SKIP_ROWS,Ys),se.pixelStorei(se.UNPACK_SKIP_IMAGES,Ho),gt===0&&_e.generateMipmaps&&se.generateMipmap(Ht),at.unbindTexture()},this.initRenderTarget=function(K){V.get(K).__webglFramebuffer===void 0&&de.setupRenderTarget(K)},this.initTexture=function(K){K.isCubeTexture?de.setTextureCube(K,0):K.isData3DTexture?de.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?de.setTexture2DArray(K,0):de.setTexture2D(K,0),at.unbindTexture()},this.resetState=function(){k=0,W=0,j=null,at.reset(),ut.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return us}get outputColorSpace(){return this._outputColorSpace}
4057set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Yt._getDrawingBufferColorSpace(e),t.unpackColorSpace=Yt._getUnpackColorSpace()}}function S_(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Z9=typeof global=="object"&&global&&global.Object===Object&&global,J9=typeof self=="object"&&self&&self.Object===Object&&self,NE=Z9||J9||Function("return this")(),i2=function(){return NE.Date.now()},eU=/\s/;function tU(i){for(var e=i.length;e--&&eU.test(i.charAt(e)););return e}var nU=/^\s+/;function iU(i){return i&&i.slice(0,tU(i)+1).replace(nU,"")}var lm=NE.Symbol,PE=Object.prototype,rU=PE.hasOwnProperty,sU=PE.toString,of=lm?lm.toStringTag:void 0;function oU(i){var e=rU.call(i,of),t=i[of];try{i[of]=void 0;var n=!0}catch{}var r=sU.call(i);return n&&(e?i[of]=t:delete i[of]),r}var aU=Object.prototype,lU=aU.toString;function uU(i){return lU.call(i)}var cU="[object Null]",hU="[object Undefined]",PS=lm?lm.toStringTag:void 0;function AU(i){return i==null?i===void 0?hU:cU:PS&&PS in Object(i)?oU(i):uU(i)}function fU(i){return i!=null&&typeof i=="object"}var dU="[object Symbol]";function pU(i){return typeof i=="symbol"||fU(i)&&AU(i)==dU}var DS=NaN,mU=/^[-+]0x[0-9a-f]+$/i,gU=/^0b[01]+$/i,_U=/^0o[0-7]+$/i,xU=parseInt;function LS(i){if(typeof i=="number")return i;if(pU(i))return DS;if(S_(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=S_(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=iU(i);var t=gU.test(i);return t||_U.test(i)?xU(i.slice(2),t?2:8):mU.test(i)?DS:+i}var vU="Expected a function",yU=Math.max,bU=Math.min;function SU(i,e,t){var n,r,s,o,a,l,u=0,d=!1,p=!1,g=!0;if(typeof i!="function")throw new TypeError(vU);e=LS(e)||0,S_(t)&&(d=!!t.leading,p="maxWait"in t,s=p?yU(LS(t.maxWait)||0,e):s,g="trailing"in t?!!t.trailing:g);function x(L){var F=n,P=r;return n=r=void 0,u=L,o=i.apply(P,F),o}function y(L){return u=L,a=setTimeout(M,e),d?x(L):o}function T(L){var F=L-l,P=L-u,I=e-F;return p?bU(I,s-P):I}function S(L){var F=L-l,P=L-u;return l===void 0||F>=e||F<0||p&&P>=s}function M(){var L=i2();if(S(L))return R(L);a=setTimeout(M,T(L))}function R(L){return a=void 0,g&&n?x(L):(n=r=void 0,o)}function E(){a!==void 0&&clearTimeout(a),u=0,n=l=r=a=void 0}function N(){return a===void 0?o:R(i2())}function U(){var L=i2(),F=S(L);if(n=arguments,r=this,l=L,F){if(a===void 0)return y(l);if(p)return clearTimeout(a),a=setTimeout(M,e),x(l)}return a===void 0&&(a=setTimeout(M,e)),o}return U.cancel=E,U.flush=N,U}function IS(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function TU(i){if(Array.isArray(i))return i}function MU(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function wU(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function EU(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(d){u=!0,r=d}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}function RU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 4058In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CU(i,e){return TU(i)||EU(i,e)||NU(i,e)||RU()}function NU(i,e){if(i){if(typeof i=="string")return IS(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?IS(i,e):void 0}}var PU=wU(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,o=s===void 0?!0:s,a=t.onChange,l=a===void 0?function(u,d){}:a;MU(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Wr(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,o=s===void 0?{}:s,a=i.aliases,l=a===void 0?{}:a,u=i.init,d=u===void 0?function(){}:u,p=i.update,g=p===void 0?function(){}:p,x=Object.keys(r).map(function(y){return new PU(y,r[y])});return function y(){for(var T=arguments.length,S=new Array(T),M=0;M<T;M++)S[M]=arguments[M];var R=!!(this instanceof y&&this.constructor),E=R?S.shift():void 0,N=S[0],U=N===void 0?{}:N,L=Object.assign({},t instanceof Function?t(U):t,{initialised:!1}),F={};function P(k){return I(k,U),$(),P}var I=function(W,j){d.call(P,W,L,j),L.initialised=!0},$=SU(function(){L.initialised&&(g.call(P,L,F),F={})},1);return x.forEach(function(k){P[k.name]=W(k);function W(j){var Y=j.name,z=j.triggerUpdate,Q=z===void 0?!1:z,ee=j.onChange,fe=ee===void 0?function(Ce,Be){}:ee,le=j.defaultVal,Me=le===void 0?null:le;return function(Ce){var Be=L[Y];
4058if(!arguments.length)return Be;var Ye=Ce===void 0?Me:Ce;return L[Y]=Ye,fe.call(P,Ye,L,Be),!F.hasOwnProperty(Y)&&(F[Y]=Be),Q&&$(),P}}}),Object.keys(o).forEach(function(k){P[k]=function(){for(var W,j=arguments.length,Y=new Array(j),z=0;z<j;z++)Y[z]=arguments[z];return(W=o[k]).call.apply(W,[P,L].concat(Y))}}),Object.entries(l).forEach(function(k){var W=CU(k,2),j=W[0],Y=W[1];return P[j]=P[Y]}),P.resetProps=function(){return x.forEach(function(k){P[k.name](k.defaultVal)}),P},P.resetProps(),L._rerender=$,R&&E&&P(E),P}}var Cr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Cr.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?Cr.Bounce.In(i*2)*.5:Cr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),Cf=function(){return performance.now()},DE=function(){function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,s=t;r<s.length;r++){var o=s[r];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},i.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var s=r[n];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},i.prototype.update=function(e,t){e===void 0&&(e=Cf()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],o=!t;s&&s.update(e,o)===!1&&!t&&this.remove(s)}n=Object.keys(this._tweensAddedDuringUpdate)}},i}(),yh={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=yh.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)}
4058,Bezier:function(i,e){for(var t=0,n=i.length-1,r=Math.pow,s=yh.Utils.Bernstein,o=0;o<=n;o++)t+=r(1-e,n-o)*r(e,o)*i[o]*s(n,o);return t},CatmullRom:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=yh.Utils.CatmullRom;return i[0]===i[t]?(e<0&&(r=Math.floor(n=t*(1+e))),s(i[(r-1+t)%t],i[r],i[(r+1)%t],i[(r+2)%t],n-r)):e<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):e>1?i[t]-(s(i[t],i[t],i[t-1],i[t-1],n-t)-i[t]):s(i[r?r-1:0],i[r],i[t<r+1?t:r+1],i[t<r+2?t:r+2],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i},Bernstein:function(i,e){var t=yh.Utils.Factorial;return t(i)/t(e)/t(i-e)},Factorial:function(){var i=[1];return function(e){var t=1;if(i[e])return i[e];for(var n=e;n>1;n--)t*=n;return i[e]=t,t}}(),CatmullRom:function(i,e,t,n,r){var s=(t-i)*.5,o=(n-e)*.5,a=r*r,l=r*a;return(2*e-2*t+s+o)*l+(-3*e+3*t-2*s-o)*a+s*r+e}}},DU=function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i}(),T_=new DE,$s=function(){function i(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Cr.Linear.None,this._interpolationFunction=yh.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=DU.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=T_,T_.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=Cf()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var o in n){var a=e[o],l=Array.isArray(a),u=l?"array":typeof a,d=!l&&Array.isArray(n[o]);if(!(u==="undefined"||u==="function")){if(d){var p=n[o];if(p.length===0)continue;for(var g=[a],x=0,y=p.length;x<y;x+=1){var T=this._handleRelativeValue(a,p[x]);if(isNaN(T)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(T)}d&&(n[o]=g)}if((u==="object"||l)&&a&&!d){t[o]=l?[]:{};var S=a;for(var M in S)t[o][M]=S[M];r[o]=l?[]:{};var p=n[o];if(!this._isDynamic){var R={};for(var M in p)R[M]=p[M];n[o]=p=R}this._setupProperties(S,t[o],p,r[o],s)}else(typeof t[o]>"u"||s)&&(t[o]=a),l||(t[o]*=1),d?r[o]=n[o].slice().reverse():r[o]=t[o]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(e){return e===void 0&&(e=Cf()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=Cf()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=Cr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=yh.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=Cf()),t===void 0&&(t=i.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,a=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),l=this._duration+this._repeat*a,u=function(){if(n._duration===0||o>l)return 1;var T=Math.trunc(o/a),S=o-T*a,M=Math.min(S/n._duration,1);return M===0&&o===n._duration?1:M},d=u(),p=this._easingFunction(d);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,p),this._onUpdateCallback&&this._onUpdateCallback(this._object,d),this._duration===0||o>=this._duration)if(this._repeat>
40580){var g=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var x=0,y=this._chainedTweens.length;x<y;x++)this._chainedTweens[x].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var o=t[s]||0,a=n[s],l=Array.isArray(e[s]),u=Array.isArray(a),d=!l&&u;d?e[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(e[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i.autoStartOnUpdate=!1,i}(),Ca=T_;Ca.getAll.bind(Ca);Ca.removeAll.bind(Ca);Ca.add.bind(Ca);Ca.remove.bind(Ca);Ca.update.bind(Ca);function LU(i){const e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return LE(this.cover(e,t,n),e,t,n,i)}function LE(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,o=i._root,a={data:r},l=i._x0,u=i._y0,d=i._z0,p=i._x1,g=i._y1,x=i._z1,y,T,S,M,R,E,N,U,L,F,P;if(!o)return i._root=a,i;for(;o.length;)if((N=e>=(y=(l+p)/2))?l=y:p=y,(U=t>=(T=(u+g)/2))?u=T:g=T,(L=n>=(S=(d+x)/2))?d=S:x=S,s=o,!(o=o[F=L<<2|U<<1|N]))return s[F]=a,i;if(M=+i._x.call(null,o.data),R=+i._y.call(null,o.data),E=+i._z.call(null,o.data),e===M&&t===R&&n===E)return a.next=o,s?s[F]=a:i._root=a,i;do s=s?s[F]=new Array(8):i._root=new Array(8),(N=e>=(y=(l+p)/2))?l=y:p=y,(U=t>=(T=(u+g)/2))?u=T:g=T,(L=n>=(S=(d+x)/2))?d=S:x=S;while((F=L<<2|U<<1|N)===(P=(E>=S)<<2|(R>=T)<<1|M>=y));return s[P]=o,s[F]=a,i}function IU(i){Array.isArray(i)||(i=Array.from(i));const e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e);let s=1/0,o=1/0,a=1/0,l=-1/0,u=-1/0,d=-1/0;for(let p=0,g,x,y,T;p<e;++p)isNaN(x=+this._x.call(null,g=i[p]))||isNaN(y=+this._y.call(null,g))||isNaN(T=+this._z.call(null,g))||(t[p]=x,n[p]=y,r[p]=T,x<s&&(s=x),x>l&&(l=x),y<o&&(o=y),y>u&&(u=y),T<a&&(a=T),T>d&&(d=T));if(s>l||o>u||a>d)return this;this.cover(s,o,a).cover(l,u,d);for(let p=0;p<e;++p)LE(this,t[p],n[p],r[p],i[p]);return this}function BU(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(i))+1,a=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var u=o-n||1,d=this._root,p,g;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(g=(t<s)<<2|(e<r)<<1|i<n,p=new Array(8),p[g]=d,d=p,u*=2,g){case 0:o=n+u,a=r+u,l=s+u;break;case 1:n=o-u,a=r+u,l=s+u;break;case 2:o=n+u,r=a-u,l=s+u;break;case 3:n=o-u,r=a-u,l=s+u;break;case 4:o=n+u,a=r+u,s=l-u;break;case 5:n=o-u,a=r+u,s=l-u;break;case 6:o=n+u,r=a-u,s=l-u;break;case 7:n=o-u,r=a-u,s=l-u;break}this._root&&this._root.length&&(this._root=d)}return this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this}function FU(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function UU(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function _i(i,e,t,n,r,s,o){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=o}function OU(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,u,d,p,g,x,y=this._x1,T=this._y1,S=this._z1,M=[],R=this._root,E,N;for(R&&M.push(new _i(R,s,o,a,y,T,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,y=i+n,T=e+n,S=t+n,n*=n);E=M.pop();)if(!(!(R=E.node)||(l=E.x0)>y||(u=E.y0)>T||(d=E.z0)>S||(p=E.x1)<s||(g=E.y1)<o||(x=E.z1)<a))if(R.length){var U=(l+p)/2,L=(u+g)/2,F=(d+x)/2;M.push(new _i(R[7],U,L,F,p,g,x),new _i(R[6],l,L,F,U,g,x),new _i(R[5],U,u,F,p,L,x),new _i(R[4],l,u,F,U,L,x),new _i(R[3],U,L,d,p,g,F),new _i(R[2],l,L,d,U,g,F),new _i(R[1],U,u,d,p,L,F),new _i(R[0],l,u,d,U,L,F)),(N=(t>=F)<<2|(e>=L)<<1|i>
4058=U)&&(E=M[M.length-1],M[M.length-1]=M[M.length-1-N],M[M.length-1-N]=E)}else{var P=i-+this._x.call(null,R.data),I=e-+this._y.call(null,R.data),$=t-+this._z.call(null,R.data),k=P*P+I*I+$*$;if(k<n){var W=Math.sqrt(n=k);s=i-W,o=e-W,a=t-W,y=i+W,T=e+W,S=t+W,r=R.data}}return r}const kU=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function GU(i,e,t,n){const r=[],s=i-n,o=e-n,a=t-n,l=i+n,u=e+n,d=t+n;return this.visit((p,g,x,y,T,S,M)=>{if(!p.length)do{const R=p.data;kU(i,e,t,this._x(R),this._y(R),this._z(R))<=n&&r.push(R)}while(p=p.next);return g>l||x>u||y>d||T<s||S<o||M<a}),r}function VU(i){if(isNaN(g=+this._x.call(null,i))||isNaN(x=+this._y.call(null,i))||isNaN(y=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,o=this._x0,a=this._y0,l=this._z0,u=this._x1,d=this._y1,p=this._z1,g,x,y,T,S,M,R,E,N,U,L;if(!t)return this;if(t.length)for(;;){if((R=g>=(T=(o+u)/2))?o=T:u=T,(E=x>=(S=(a+d)/2))?a=S:d=S,(N=y>=(M=(l+p)/2))?l=M:p=M,e=t,!(t=t[U=N<<2|E<<1|R]))return this;if(!t.length)break;(e[U+1&7]||e[U+2&7]||e[U+3&7]||e[U+4&7]||e[U+5&7]||e[U+6&7]||e[U+7&7])&&(n=e,L=U)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[U]=s:delete e[U],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[L]=t:this._root=t),this):(this._root=s,this)}function qU(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function zU(){return this._root}function HU(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function WU(i){var e=[],t,n=this._root,r,s,o,a,l,u,d;for(n&&e.push(new _i(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,o=t.y0,a=t.z0,l=t.x1,u=t.y1,d=t.z1)&&n.length){var p=(s+l)/2,g=(o+u)/2,x=(a+d)/2;(r=n[7])&&e.push(new _i(r,p,g,x,l,u,d)),(r=n[6])&&e.push(new _i(r,s,g,x,p,u,d)),(r=n[5])&&e.push(new _i(r,p,o,x,l,g,d)),(r=n[4])&&e.push(new _i(r,s,o,x,p,g,d)),(r=n[3])&&e.push(new _i(r,p,g,a,l,u,x)),(r=n[2])&&e.push(new _i(r,s,g,a,p,u,x)),(r=n[1])&&e.push(new _i(r,p,o,a,l,g,x)),(r=n[0])&&e.push(new _i(r,s,o,a,p,g,x))}return this}function $U(i){var e=[],t=[],n;for(this._root&&e.push(new _i(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,o=n.x0,a=n.y0,l=n.z0,u=n.x1,d=n.y1,p=n.z1,g=(o+u)/2,x=(a+d)/2,y=(l+p)/2;(s=r[0])&&e.push(new _i(s,o,a,l,g,x,y)),(s=r[1])&&e.push(new _i(s,g,a,l,u,x,y)),(s=r[2])&&e.push(new _i(s,o,x,l,g,d,y)),(s=r[3])&&e.push(new _i(s,g,x,l,u,d,y)),(s=r[4])&&e.push(new _i(s,o,a,y,g,x,p)),(s=r[5])&&e.push(new _i(s,g,a,y,u,x,p)),(s=r[6])&&e.push(new _i(s,o,x,y,g,d,p)),(s=r[7])&&e.push(new _i(s,g,x,y,u,d,p))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function jU(i){return i[0]}function XU(i){return arguments.length?(this._x=i,this):this._x}function QU(i){return i[1]}function YU(i){return arguments.length?(this._y=i,this):this._y}function KU(i){return i[2]}function ZU(i){return arguments.length?(this._z=i,this):this._z}function IE(i,e,t,n){var r=new Iv(e??jU,t??QU,n??KU,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function Iv(i,e,t,n,r,s,o,a,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this._root=void 0}function BS(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var Pr=IE.prototype=Iv.prototype;Pr.copy=function(){var i=new Iv(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=BS(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=BS(n));return i};Pr.add=LU;Pr.addAll=IU;Pr.cover=BU;Pr.data=FU;Pr.extent=UU;Pr.find=OU;Pr.findAllWithinRadius=GU;Pr.remove=VU;Pr.removeAll=qU;Pr.root=zU;Pr.size=HU;Pr.visit=WU;Pr.visitAfter=$U;Pr.x=XU;Pr.y=YU;Pr.z=ZU;function qp(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function JU(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function BE(i){let e,t,n;i.length!==2?(e=qp,t=(a,l)=>qp(i(a),l),n=(a,l)=>i(a)-l):(e=i===qp||i===JU?i:eO,t=i,n=i);function r(a,l,u=0,d=a.length){if(u<d){if(e(l,l)!==0)return d;do{const p=u+d>>>1;t(a[p],l)<0?u=p+1:d=p}while(u<d)}return u}function s(a,l,u=0,d=a.length){if(u<d){if(e(l,l)!==0)return d;do{const p=u+d>>>1;t(a[p],l)<=0?u=p+1:d=p}while(u<d)}return u}function o(a,l,u=0,d=a.length){const p=r(a,l,u,d-1);return p>u&&n(a[p-1],l)>-n(a[p],l)?p-1:p}return{left:r,center:o,right:s}}function eO(){return 0}function tO(i){return i===null?NaN:+i}const nO=BE(qp),FE=nO.right;BE(tO).center;function um(i,e){let t,n;if(e===void 0)for(const r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}class Lh{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const s=t[r],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t=this._n,n,r,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,r=e[--t],o=n+r,s=r-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=o+r,r==n-o&&(o=n))}return o}}const iO=Math.sqrt(50),rO=Math.sqrt(10),sO=Math.sqrt(2);function cm(i,e,t){const n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),o=s>=iO?10:s>=rO?5:s>=sO?2:1;let a,l,u;return r<0?(u=Math.pow(10,-r)/o,a=Math.round(i*u),l=Math.round(e*u),a/u<i&&++a,l/u>e&&--l,u=-u):(u=Math.pow(10,r)*o,a=Math.round(i/u),l=Math.round(e/u),a*u<i&&++a,l*u>e&&--l),l<a&&.5<=t&&t<2?cm(i,e,t*2):[a,l,u]}function oO(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];const n=e<i,[r,s,o]=n?cm(e,i,t):cm(i,e,t);if(!(s>=r))return[];const a=s-r+1,l=new Array(a);if(n)if(o<0)for(let u=0;u<a;++u)l[u]=(s-u)/-o;else for(let u=0;u<a;++u)l[u]=(s-u)*o;else if(o<0)for(let u=0;u<a;++u)l[u]=(r+u)/-o;else for(let u=0;u<a;++u)l[u]=(r+u)*o;return l}function M_(i,e,t){return e=+e,i=+i,t=+t,cm(i,e,t)[2]}function aO(i,e,t){e=+e,i=+i,t=+t;const n=e<i,r=n?M_(e,i,t):M_(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function lO(i,e){let t;for(const n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);return t}function uO(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*cO(i){for(const e of i)yield*e}function pd(i){return Array.from(cO(i))}function bh(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function hO(i,e){let t=0;for(let n of i)(n=+n)&&(t+=n);return t}function UE(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function Bv(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function OE(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function Od(){}var md=.7,hm=1/md,Ih="\\s*([+-]?\\d+)\\s*",gd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",AO=/^#([0-9a-f]{3,8})$/,fO=new RegExp(`^rgb\\(${Ih},${Ih},${Ih}\\)$`),dO=new RegExp(`^rgb\\(${xa},${xa},${xa}
4058\\)$`),pO=new RegExp(`^rgba\\(${Ih},${Ih},${Ih},${gd}\\)$`),mO=new RegExp(`^rgba\\(${xa},${xa},${xa},${gd}\\)$`),gO=new RegExp(`^hsl\\(${gd},${xa},${xa}\\)$`),_O=new RegExp(`^hsla\\(${gd},${xa},${xa},${gd}\\)$`),FS={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};Bv(Od,dc,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:US,formatHex:US,formatHex8:xO,formatHsl:vO,formatRgb:OS,toString:OS});function US(){return this.rgb().formatHex()}function xO(){return this.rgb().formatHex8()}function vO(){return kE(this).formatHsl()}function OS(){return this.rgb().formatRgb()}function dc(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=AO.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?kS(e):t===3?new bs(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?U0(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?U0(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=fO.exec(i))?new bs(e[1],e[2],e[3],1):(e=dO.exec(i))?new bs(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=pO.exec(i))?U0(e[1],e[2],e[3],e[4]):(e=mO.exec(i))?U0(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=gO.exec(i))?qS(e[1],e[2]/100,e[3]/100,1):(e=_O.exec(i))?qS(e[1],e[2]/100,e[3]/100,e[4]):FS.hasOwnProperty(i)?kS(FS[i]):i==="transparent"?new bs(NaN,NaN,NaN,0):null}function kS(i){return new bs(i>>16&255,i>>8&255,i&255,1)}function U0(i,e,t,n){return n<=0&&(i=e=t=NaN),new bs(i,e,t,n)}function yO(i){return i instanceof Od||(i=dc(i)),i?(i=i.rgb(),new bs(i.r,i.g,i.b,i.opacity)):new bs}function w_(i,e,t,n){return arguments.length===1?yO(i):new bs(i,e,t,n??1)}function bs(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}Bv(bs,w_,OE(Od,{brighter(i){return i=i==null?hm:Math.pow(hm,i),new bs(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?md:Math.pow(md,i),new bs(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new bs(nc(this.r),nc(this.g),nc(this.b),Am(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:GS,formatHex:GS,formatHex8:bO,formatRgb:VS,toString:VS}));function GS(){return`#${ju(this.r)}${ju(this.g)}${ju(this.b)}`}function bO(){return`#${ju(this.r)}${ju(this.g)}${ju(this.b)}${ju((isNaN(this.opacity)?1:this.opacity)*255)}`}function VS(){const i=Am(this.opacity);return`${i===1?"rgb(":"rgba("}${nc(this.r)}, ${nc(this.g)}, ${nc(this.b)}${i===1?")":`, ${i})`}`}function Am(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function nc(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function ju(i){return i=nc(i),(i<16?"0":"")+i.toString(16)}function qS(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new No(i,e,t,n)}function kE(i){if(i instanceof No)return new No(i.h,i.s,i.l,i.opacity);if(i instanceof Od||(i=dc(i)),!i)return new No;if(i instanceof No)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n
vendor: 4,533 bytes, line 4058
4058),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-n)/a+(t<n)*6:t===s?o=(n-e)/a+2:o=(e-t)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new No(o,a,l,i.opacity)}function SO(i,e,t,n){return arguments.length===1?kE(i):new No(i,e,t,n??1)}function No(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}Bv(No,SO,OE(Od,{brighter(i){return i=i==null?hm:Math.pow(hm,i),new No(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?md:Math.pow(md,i),new No(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new bs(r2(i>=240?i-240:i+120,r,n),r2(i,r,n),r2(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new No(zS(this.h),O0(this.s),O0(this.l),Am(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const i=Am(this.opacity);return`${i===1?"hsl(":"hsla("}${zS(this.h)}, ${O0(this.s)*100}%, ${O0(this.l)*100}%${i===1?")":`, ${i})`}`}}));function zS(i){return i=(i||0)%360,i<0?i+360:i}function O0(i){return Math.max(0,Math.min(1,i||0))}function r2(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}const Fv=i=>()=>i;function TO(i,e){return function(t){return i+t*e}}function MO(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function wO(i){return(i=+i)==1?GE:function(e,t){return t-e?MO(e,t,i):Fv(isNaN(e)?t:e)}}function GE(i,e){var t=e-i;return t?TO(i,t):Fv(isNaN(i)?e:i)}const HS=function i(e){var t=wO(e);function n(r,s){var o=t((r=w_(r)).r,(s=w_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),u=GE(r.opacity,s.opacity);return function(d){return r.r=o(d),r.g=a(d),r.b=l(d),r.opacity=u(d),r+""}}return n.gamma=i,n}(1);function VE(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function qE(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function EO(i,e){return(qE(e)?VE:zE)(i,e)}function zE(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),o;for(o=0;o<n;++o)r[o]=Uv(i[o],e[o]);for(;o<t;++o)s[o]=e[o];return function(a){for(o=0;o<n;++o)s[o]=r[o](a);return s}}function RO(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function _d(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function CO(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=Uv(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var E_=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,s2=new RegExp(E_.source,"g");function NO(i){return function(){return i}}function PO(i){return function(e){return i(e)+""}}function DO(i,e){var t=E_.lastIndex=s2.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=E_.exec(i))&&(r=s2.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:_d(n,r)})),t=s2.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?PO(l[0].x):NO(e):(e=l.length,function(u){for(var d=0,p;d<e;++d)a[(p=l[d]).i]=p.x(u);return a.join("")})}function Uv(i,e){var t=typeof e,n;return e==null||t==="boolean"?Fv(e):(t==="number"?_d:t==="string"?(n=dc(e))?(e=n,HS):DO:e instanceof dc?HS:e instanceof Date?RO:qE(e)?VE:Array.isArray(e)?zE:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?CO:_d)(i,e)}function LO(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function IO(i){return function(){return i}}function BO(i){return+i}var WS=[0,1];function Sh(i){return i}function R_(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:IO(isNaN(e)?NaN:.5)}function FO(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function UO(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=R_(r,n),s=t(o,s)):(n=R_(n,r),s=t(s,o)),function(a){return s(n(a))}}function OO(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),o=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++o<n;)r[o]=R_(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=FE(i,a,1,n)-1;return s[l](r[l](a))}}function kO(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function GO(){var i=WS,e=WS,t=Uv,n,r,s,o=Sh,a,l,u;function d(){var g=Math.min(i.length,e.length);return o!==Sh&&(o=FO(i[0],i[g-1])),a=g>2?OO:UO,l=u=null,p}
vendor: 4,692 bytes, line 4058
4058function p(g){return g==null||isNaN(g=+g)?s:(l||(l=a(i.map(n),e,t)))(n(o(g)))}return p.invert=function(g){return o(r((u||(u=a(e,i.map(n),_d)))(g)))},p.domain=function(g){return arguments.length?(i=Array.from(g,BO),d()):i.slice()},p.range=function(g){return arguments.length?(e=Array.from(g),d()):e.slice()},p.rangeRound=function(g){return e=Array.from(g),t=LO,d()},p.clamp=function(g){return arguments.length?(o=g?!0:Sh,d()):o!==Sh},p.interpolate=function(g){return arguments.length?(t=g,d()):t},p.unknown=function(g){return arguments.length?(s=g,p):s},function(g,x){return n=g,r=x,d()}}function VO(){return GO()(Sh,Sh)}function qO(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function fm(i,e){if((t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"))<0)return null;var t,n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function mA(i){return i=fm(Math.abs(i)),i?i[1]:NaN}function zO(i,e){return function(t,n){for(var r=t.length,s=[],o=0,a=i[0],l=0;r>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>n));)a=i[o=(o+1)%i.length];return s.reverse().join(e)}}function HO(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var WO=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function dm(i){if(!(e=WO.exec(i)))throw new Error("invalid format: "+i);var e;return new Ov({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}dm.prototype=Ov.prototype;function Ov(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}Ov.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function $O(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var HE;function jO(i,e){var t=fm(i,e);if(!t)return i+"";var n=t[0],r=t[1],s=r-(HE=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+fm(i,Math.max(0,e+s-1))[0]}function $S(i,e){var t=fm(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}const jS={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:qO,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>$S(i*100,e),r:$S,s:jO,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function XS(i){return i}var QS=Array.prototype.map,YS=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function XO(i){var e=i.grouping===void 0||i.thousands===void 0?XS:zO(QS.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?XS:HO(QS.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"â":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function u(p){p=dm(p);var g=p.fill,x=p.align,y=p.sign,T=p.symbol,S=p.zero,M=p.width,R=p.comma,E=p.precision,N=p.trim,U=p.type;U==="n"?(R=!0,U="g"):jS[U]||(E===void 0&&(E=12),N=!0,U="g"),(S||g==="0"&&x==="=")&&(S=!0,g="0",x="=");var L=T==="$"?t:T==="#"&&/[boxX]/.test(U)?"0"+U.toLowerCase():"",F=T==="$"?n:/[%p]/.test(U)?o:"",P=jS[U],I=/[defgprs%]/.test(U);E=E===void 0?6:/[gprs]/.test(U)?Math.max(1,Math.min(21,E)):Math.max(0,Math.min(20,E));function $(k){var W=L,j=F,Y,z,Q;if(U==="c")j=P(k)+j,k="";else{k=+k;var ee=k<0||1/k<0;if(k=isNaN(k)?l:P(Math.abs(k),E),N&&(k=$O(k)),ee&&+k==0&&y!=="+"&&(ee=!1),W=(ee?y==="("?y:a:y==="-"||y==="("?"":y)+W,j=(U==="s"?YS[8+HE/3]:"")+j+(ee&&y==="("?")":""),I){for(Y=-1,z=k.length;++Y<z;)if(Q=k.charCodeAt(Y),48>Q||Q>57){j=(Q===46?r+k.slice(Y+1):k.slice(Y))+j,k=k.slice(0,Y);break}}}R&&!S&&(k=e(k,1/0));var fe=W.length+k.length+j.length,le=fe<M?new Array(M-fe+1).join(g):"";switch(R&&S&&(k=e(le+k,le.length?M-j.length:1/0),le=""),x){case"<":k=W
4058+k+j+le;break;case"=":k=W+le+k+j;break;case"^":k=le.slice(0,fe=le.length>>1)+W+k+j+le.slice(fe);break;default:k=le+W+k+j;break}return s(k)}return $.toString=function(){return p+""},$}function d(p,g){var x=u((p=dm(p),p.type="f",p)),y=Math.max(-8,Math.min(8,Math.floor(mA(g)/3)))*3,T=Math.pow(10,-y),S=YS[8+y/3];return function(M){return x(T*M)+S}}return{format:u,formatPrefix:d}}var k0,WE,$E;QO({thousands:",",grouping:[3],currency:["$",""]});function QO(i){return k0=XO(i),WE=k0.format,$E=k0.formatPrefix,k0}function YO(i){return Math.max(0,-mA(Math.abs(i)))}function KO(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(mA(e)/3)))*3-mA(Math.abs(i)))}function ZO(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,mA(e)-mA(i))+1}function JO(i,e,t,n){var r=aO(i,e,t),s;switch(n=dm(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=KO(r,o))&&(n.precision=s),$E(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=ZO(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=YO(r))&&(n.precision=s-(n.type==="%")*2);break}}return WE(n)}function jE(i){var e=i.domain;return i.ticks=function(t){var n=e();return oO(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return JO(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,o=n[r],a=n[s],l,u,d=10;for(a<o&&(u=o,o=a,a=u,u=r,r=s,s=u);d-- >0;){if(u=M_(o,a,t),u===l)return n[r]=o,n[s]=a,e(n);if(u>0)o=Math.floor(o/u)*u,a=Math.ceil(a/u)*u;else if(u<0)o=Math.ceil(o*u)/u,a=Math.floor(a*u)/u;else break;l=u}return i},i}function ul(){var i=VO();return i.copy=function(){return kO(i,ul())},UE.apply(i,arguments),jE(i)}function XE(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[FE(n,l,0,t)]:s}function a(){var l=-1;for(n=new Array(t);++l<t;)n[l]=((l+1)*e-(l-t)*i)/(t+1);return o}return o.domain=function(l){return arguments.length?([i,e]=l,i=+i,e=+e,a()):[i,e]},o.range=function(l){return arguments.length?(t=(r=Array.from(l)).length-1,a()):r.slice()},o.invertExtent=function(l){var u=r.indexOf(l);return u<0?[NaN,NaN]:u<1?[i,n[0]]:u>=t?[n[t-1],e]:[n[u-1],n[u]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return XE().domain([i,e]).range(r).unknown(s)},UE.apply(jE(o),arguments)}function C_(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function ek(i){if(Array.isArray(i))return i}function tk(i){if(Array.isArray(i))return C_(i)}function Vf(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function nk(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ik(i,e,t){return e=pm(e),fk(i,YE()?Reflect.construct(e,[],pm(i).constructor):e.apply(i,t))}function QE(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function rk(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function wn(i,e){return i.get(Vf(i,e))}function Pl(i,e,t){QE(i,e),e.set(i,t)}function Dl(i,e,t){return i.set(Vf(i,e),t),t}function sk(i,e){QE(i,e),e.add(i)}function ok(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,ZE(n.key),n)}}function ak(i,e,t){return e&&ok(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Kc(i,e,t){return(e=ZE(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function pm(i){return pm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pm(i)}function lk(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&N_(i,e)}function YE(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(YE=function(){return!!i})()}function uk(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function ck(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(d){u=!0,r=d}
4058finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}function hk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 4059In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ak(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 4060In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fk(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nk(i)}function N_(i,e){return N_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},N_(i,e)}function zp(i,e){return ek(i)||ck(i,e)||JE(i,e)||hk()}function KE(i){return tk(i)||uk(i)||JE(i)||Ak()}function dk(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function ZE(i){var e=dk(i,"string");return typeof e=="symbol"?e:e+""}function JE(i,e){if(i){if(typeof i=="string")return C_(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?C_(i,e):void 0}}var e4=function(e){e instanceof Array?e.forEach(e4):(e.map&&e.map.dispose(),e.dispose())},t4=function(e){e.geometry&&e.geometry.dispose(),e.material&&e4(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(t4)},KS=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),t4(t)}};function n4(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function pk(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),r}}function Lu(i){return i*Math.PI/180}var i4=function(e){return 1-(qw(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},o2=function(e){return Math.max(0,Math.min(1,i4(e)))},ZS=function(e){return .5-qw.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},mk=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=ul().domain([1,0]).range([t,n]).clamp(!0),s=ul().domain([o2(t),o2(n)]).range([1,0]).clamp(!0),o=function(p){return s(o2(r(p)))},a=e.array,l=0,u=a.length;l<u;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},JS=function(e,t,n,r){var s=Math.pow(2,e),o=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),a=(90-r)/180;t&&(a=Math.max(0,Math.min(1,i4(a))));var l=Math.floor(a*s);return[o,l]},P_=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=[],l=Math.pow(2,e),u=360/l,d=180/l,p=s===void 0?l-1:s,g=o===void 0?l-1:o,x=n,y=Math.min(l-1,p);x<=y;x++)for(var T=r,S=Math.min(l-1,g);T<=S;T++){var M=T,R=d;if(t){M=T===0?T:ZS(T/l)*l;var E=T+1===l?T+1:ZS((T+1)/l)*l;R=(E-M)*180/l}var N=-180+(x+.5)*u,U=90-(M*180/l+R/2),L=R;a.push({x,y:T,lng:N,lat:U,latLen:L})}return a},gk=6,_k=7,xk=3,vk=90,aa=new WeakMap,Gl=new WeakMap,a2=new WeakMap,G0=new WeakMap,to=new WeakMap,mm=new WeakMap,Bh=new WeakMap,Iu=new WeakMap,V0=new WeakSet,yk=function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,o=r.minLevel,a=o===void 0?0:o,l=r.maxLevel,u=l===void 0?17:l,d=r.mercatorProjection,p=d===void 0?!0:d;return rk(this,e),n=ik(this,e),sk(n,V0),Pl(n,aa,void 0),Pl(n,Gl,void 0),Pl(n,a2,void 0),Pl(n,G0,void 0),Pl(n,to,{}),Pl(n,mm,void 0),Pl(n,Bh,void 0),Pl(n,Iu,void 0),Kc(n,"minLevel",void 0),Kc(n,"maxLevel",void 0),Kc(n,"thresholds",KE(new Array(30)).map(function(g,x){return 8/Math.pow(2,x)})),Kc(n,"curvatureResolution",5),Kc(n,"tileMargin",0),Kc(n,"clearTiles",function(){Object.values(wn(to,n)).forEac
4060h(function(g){g.forEach(function(x){x.obj&&(n.remove(x.obj),KS(x.obj),delete x.obj)})}),Dl(to,n,{})}),Dl(aa,n,t),n.tileUrl=s,Dl(Gl,n,p),n.minLevel=a,n.maxLevel=u,n.level=0,n.add(Dl(Iu,n,new Qn(new Fa(wn(aa,n)*.99,180,90),new qs({color:0})))),wn(Iu,n).visible=!1,wn(Iu,n).material.polygonOffset=!0,wn(Iu,n).material.polygonOffsetUnits=3,wn(Iu,n).material.polygonOffsetFactor=1,n}return lk(e,i),ak(e,[{key:"tileUrl",get:function(){return wn(a2,this)},set:function(n){Dl(a2,this,n),this.updatePov(wn(Bh,this))}},{key:"level",get:function(){return wn(G0,this)},set:function(n){var r,s=this;wn(to,this)[n]||Vf(V0,this,bk).call(this,n);var o=wn(G0,this);if(Dl(G0,this,n),!(n===o||o===void 0)){if(wn(Iu,this).visible=n>0,wn(to,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=wn(to,this)[o])===null||r===void 0||r.forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!1)})),o>n)for(var a=n+1;a<=o;a++)wn(to,this)[a]&&wn(to,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),KS(l.obj),delete l.obj)});Vf(V0,this,eT).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof cg))){Dl(Bh,this,n);var s;if(Dl(mm,this,function(d){if(!d.hullPnts){var p=360/Math.pow(2,r.level),g=d.lng,x=d.lat,y=d.latLen,T=g-p/2,S=g+p/2,M=x-y/2,R=x+y/2;d.hullPnts=[[x,g],[M,T],[R,T],[M,S],[R,S]].map(function(E){var N=zp(E,2),U=N[0],L=N[1];return n4(U,L,wn(aa,r))}).map(function(E){var N=E.x,U=E.y,L=E.z;return new J(N,U,L)})}return s||(s=new IA,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new nn().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),d.hullPnts.some(function(E){return s.containsPoint(E.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new J)),l=(a-wn(aa,this))/wn(aa,this),u=this.thresholds.findIndex(function(d){return d&&d<=l});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,u<0?this.thresholds.length:u)),Vf(V0,this,eT).call(this)}}}}])}(ys);function bk(i){var e=this;if(i>_k){wn(to,this)[i]=[];return}var t=wn(to,this)[i]=P_(i,wn(Gl,this));t.forEach(function(n){return n.centroid=n4(n.lat,n.lng,wn(aa,e))}),t.octree=IE().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function eT(){var i=this;if(!(!this.tileUrl||this.level===void 0||!wn(to,this).hasOwnProperty(this.level))&&!(!wn(mm,this)&&this.level>gk)){var e=wn(to,this)[this.level];if(wn(Bh,this)){var t=this.worldToLocal(wn(Bh,this).position.clone());if(e.octree){var n,r=this.worldToLocal(wn(Bh,this).position.clone()),s=(r.length()-wn(aa,this))*xk;e=(n=e.octree).findAllWithinRadius.apply(n,KE(r).concat([s]))}else{var o=pk(t),a=(o.r/wn(aa,this)-1)*vk,l=a/Math.cos(Lu(o.lat)),u=[o.lng-l,o.lng+l],d=[o.lat+a,o.lat-a],p=JS(this.level,wn(Gl,this),u[0],d[0]),g=zp(p,2),x=g[0],y=g[1],T=JS(this.level,wn(Gl,this),u[1],d[1]),S=zp(T,2),M=S[0],R=S[1];!e.record&&(e.record={});var E=e.record;if(!E.hasOwnProperty("".concat(Math.round((x+M)/2),"_").concat(Math.round((y+R)/2))))e=P_(this.level,wn(Gl,this),x,y,M,R).map(function(P){var I="".concat(P.x,"_").concat(P.y);return E.hasOwnProperty(I)?E[I]:(E[I]=P,e.push(P),P)});else{for(var N=[],U=x;U<=M;U++)for(var L=y;L<=R;L++){var F="".concat(U,"_").concat(L);E.hasOwnProperty(F)||(E[F]=P_(this.level,wn(Gl,this),U,L,U,L)[0],e.push(E[F])),N.push(E[F])}e=N}}}e.filter(function(P){return!P.obj}).filter(wn(mm,this)||function(){return!0}).forEach(function(P){var I=P.x,$=P.y,k=P.lng,W=P.lat,j=P.latLen,Y=360/Math.pow(2,i.level);if(!P.obj){var z=Y*(1-i.tileMargin),Q=j*(1-i.tileMargin),ee=Lu(k),fe=Lu(-W),le=new Qn(new Fa(wn(aa,i),Math.ceil(z/i.curvatureResolution),Math.ceil(Q/i.curvatureResolution),Lu(90-z/2)+ee,Lu(z),Lu(90-Q/2)+fe,Lu(Q)),new dl);if(wn(Gl,i)){var Me=[W+j/2,W-j/2].map(function(qt){return .5-qt/180}),Ce=zp(Me,2),Be=Ce[0],Ye=Ce[1];mk(le.geometry.attributes.uv,Be,Ye)}P.obj=le}P.loading||(P.loading=!0,new Pv().load(i.tileUrl(I,$,i.level),function(qt){var bt=P.obj;bt&&(qt.colorSpace=Tr,bt.material.map=qt,bt.material.color=null,bt.material.needsUpdate=!0,i.add(bt)),P.loading=!1}))})}}function Sk(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let s=r4(i,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,u;if(n&&(s=Rk(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let d=a,p=l;for(let g=t;g<r;g+=t){const x=i[g],y=i[g+1];x<a&&(a=x),y<l&&(l=y),x>d&&(d=x),y>p&&(p=y)}u=Math.max(d-a,p-l),u=u!==0?32767/u:0}return xd(s,o,t,a,l,u,0),o}function r4(i,e,t,n,r){let s;if(r===kk(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=tT(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=tT(o/n|0,i[o],i[o+1],s);return s&&gA(s,s.next)&&(yd(s),s=s.next),s}function pc(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(gA(t,t.next)||ki(t.prev,t,t.next)===0)){if(yd(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function xd(i,e,t,n,r,s,o){if(!i)return;!o&&s&&Lk(i,n,r,s);let a=i;for(;i.prev!==i.next;){const l=i.prev,u=i.next;if(s?Mk(i,n,r,s):Tk(i)){e.push(l.i,i.i,u.i),yd(i),i=u.next,a=u.next;continue}if(i=u,i===a){o?o===1?(i=wk(pc(i),e),xd(i,e,t,n,r,s,2)):o===2&&Ek(i,e,t,n,r,s
vendor: 4,299 bytes, line 4060
4060):xd(pc(i),e,t,n,r,s,1);break}}}function Tk(i){const e=i.prev,t=i,n=i.next;if(ki(e,t,n)>=0)return!1;const r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,u=n.y,d=Math.min(r,s,o),p=Math.min(a,l,u),g=Math.max(r,s,o),x=Math.max(a,l,u);let y=n.next;for(;y!==e;){if(y.x>=d&&y.x<=g&&y.y>=p&&y.y<=x&&Nf(r,a,s,l,o,u,y.x,y.y)&&ki(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function Mk(i,e,t,n){const r=i.prev,s=i,o=i.next;if(ki(r,s,o)>=0)return!1;const a=r.x,l=s.x,u=o.x,d=r.y,p=s.y,g=o.y,x=Math.min(a,l,u),y=Math.min(d,p,g),T=Math.max(a,l,u),S=Math.max(d,p,g),M=D_(x,y,e,t,n),R=D_(T,S,e,t,n);let E=i.prevZ,N=i.nextZ;for(;E&&E.z>=M&&N&&N.z<=R;){if(E.x>=x&&E.x<=T&&E.y>=y&&E.y<=S&&E!==r&&E!==o&&Nf(a,d,l,p,u,g,E.x,E.y)&&ki(E.prev,E,E.next)>=0||(E=E.prevZ,N.x>=x&&N.x<=T&&N.y>=y&&N.y<=S&&N!==r&&N!==o&&Nf(a,d,l,p,u,g,N.x,N.y)&&ki(N.prev,N,N.next)>=0))return!1;N=N.nextZ}for(;E&&E.z>=M;){if(E.x>=x&&E.x<=T&&E.y>=y&&E.y<=S&&E!==r&&E!==o&&Nf(a,d,l,p,u,g,E.x,E.y)&&ki(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;N&&N.z<=R;){if(N.x>=x&&N.x<=T&&N.y>=y&&N.y<=S&&N!==r&&N!==o&&Nf(a,d,l,p,u,g,N.x,N.y)&&ki(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function wk(i,e){let t=i;do{const n=t.prev,r=t.next.next;!gA(n,r)&&o4(n,t,t.next,r)&&vd(n,r)&&vd(r,n)&&(e.push(n.i,t.i,r.i),yd(t),yd(t.next),t=i=r),t=t.next}while(t!==i);return pc(t)}function Ek(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Fk(o,a)){let l=a4(o,a);o=pc(o,o.next),l=pc(l,l.next),xd(o,e,t,n,r,s,0),xd(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Rk(i,e,t,n){const r=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,u=r4(i,a,l,n,!1);u===u.next&&(u.steiner=!0),r.push(Bk(u))}r.sort(Ck);for(let s=0;s<r.length;s++)t=Nk(r[s],t);return t}function Ck(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Nk(i,e){const t=Pk(i,e);if(!t)return e;const n=a4(t,i);return pc(n,n.next),pc(t,t.next)}function Pk(i,e){let t=e;const n=i.x,r=i.y;let s=-1/0,o;if(gA(i,t))return t;do{if(gA(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const p=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=n&&p>s&&(s=p,o=t.x<t.next.x?t:t.next,p===n))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,l=o.x,u=o.y;let d=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&s4(r<u?n:s,r,l,u,r<u?s:n,r,t.x,t.y)){const p=Math.abs(r-t.y)/(n-t.x);vd(t,i)&&(p<d||p===d&&(t.x>o.x||t.x===o.x&&Dk(o,t)))&&(o=t,d=p)}t=t.next}while(t!==a);return o}function Dk(i,e){return ki(i.prev,i,e.prev)<0&&ki(e.next,i,i.next)<0}function Lk(i,e,t,n){let r=i;do r.z===0&&(r.z=D_(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,Ik(r)}function Ik(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let u=0;u<t&&(a++,o=o.nextZ,!!o);u++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function D_(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function Bk(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function s4(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function Nf(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&s4(i,e,t,n,r,s,o,a)}function Fk(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Uk(i,e)&&(vd(i,e)&&vd(e,i)&&Ok(i,e)&&(ki(i.prev,i,e.prev)||ki(i,e.prev,e))||gA(i,e)&&ki(i.prev,i,i.next)>0&&ki(e.prev,e,e.next)>0)}function ki(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function gA(i,e){return i.x===e.x&&i.y===e.y}function o4(i,e,t,n){const r=z0(ki(i,e,t)),s=z0(ki(i,e,n)),o=z0(ki(t,n,i)),a=z0(ki(t,n,e));return!!(r!==s&&o!==a||r===0&&q0(i,t,e)||s===0&&q0(i,n,e)||o===0&&q0(t,i,n)||a===0&&q0(t,e,n))}function q0(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function z0(i){return i>0?1:i<0?-1:0}function Uk(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&o4(t,t.next,i,e))return!0;t=t.next}
4060while(t!==i);return!1}function vd(i,e){return ki(i.prev,i,i.next)<0?ki(i,e,i.next)>=0&&ki(i,i.prev,e)>=0:ki(i,e,i.prev)<0||ki(i,i.next,e)<0}function Ok(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function a4(i,e){const t=L_(i.i,i.x,i.y),n=L_(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function tT(i,e,t,n){const r=L_(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function yd(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function L_(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function kk(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}function gm(i){const e=[],t=[],n=i[0][0].length;let r=0,s=0;for(const o of i){for(const a of o)for(let l=0;l<n;l++)e.push(a[l]);s&&(r+=s,t.push(r)),s=o.length}return{vertices:e,holes:t,dimensions:n}}function I_(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Gk(i){if(Array.isArray(i))return i}function Vk(i){if(Array.isArray(i))return I_(i)}function qk(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function zk(i,e,t){return e=_m(e),Zk(i,l4()?Reflect.construct(e,[],_m(i).constructor):e.apply(i,t))}function Hk(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Wk(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function $k(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=kv(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 4061In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function _m(i){return _m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_m(i)}function jk(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&B_(i,e)}function l4(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(l4=function(){return!!i})()}function Xk(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Qk(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(d){u=!0,r=d}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}function Yk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 4062In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kk(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 4063In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zk(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qk(i)}function B_(i,e){return B_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},B_(i,e)}function af(i,e){return Gk(i)||Qk(i,e)||kv(i,e)||Yk()}function Jk(i){return Vk(i)||Xk(i)||kv(i)||Kk()}function kv(i,e){if(i){if(typeof i=="string")return I_(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?I_(i,e):void 0}}var nT=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var o=zw(s,r)*180/Math.PI;if(o>t)for(var a=Hw(r,s),l=r.length>2||s.length>2?_d(r[2]||0,s[2]||0):null,u=l?function(g){return[].concat(Jk(a(g)),[l(g)])}:a,d=1/Math.ceil(o/t),p=d;p<1;)n.push(u(p)),p+=d}n.push(r=s)}),n},F_=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Wn,Float32BufferAttribute:Fn},eG=new F_.BufferGeometry().setAttribute?"setAttribute":"addAttribute",u4=function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;Hk(this,e),n=zk(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:d,MultiPoint:p,LineString:g,MultiLineString:x,Polygon:y,MultiPolygon:T}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],u=0;o.forEach(function(S){var M=a.length;lf({indices:a,vertices:l},S),n.addGroup(M,a.length-M,u++)}),a.length&&n.setIndex(a),l.length&&n[eG]("position",new F_.Float32BufferAttribute(l,3));function d(S,M){var R=l2(S[1],S[0],M+(S[2]||0)),E=[];return[{vertices:R,indices:E}]}function p(S,M){var R={vertices:[],indices:[]};return S.map(function(E){return d(E,M)}
4063).forEach(function(E){var N=af(E,1),U=N[0];lf(R,U)}),[R]}function g(S,M){for(var R=nT(S,s).map(function(P){var I=af(P,3),$=I[0],k=I[1],W=I[2],j=W===void 0?0:W;return l2(k,$,M+j)}),E=gm([R]),N=E.vertices,U=Math.round(N.length/3),L=[],F=1;F<U;F++)L.push(F-1,F);return[{vertices:N,indices:L}]}function x(S,M){var R={vertices:[],indices:[]};return S.map(function(E){return g(E,M)}).forEach(function(E){var N=af(E,1),U=N[0];lf(R,U)}),[R]}function y(S,M){for(var R=S.map(function(z){return nT(z,s).map(function(Q){var ee=af(Q,3),fe=ee[0],le=ee[1],Me=ee[2],Ce=Me===void 0?0:Me;return l2(le,fe,M+Ce)})}),E=gm(R),N=E.vertices,U=E.holes,L=U[0]||1/0,F=N.slice(0,L*3),P=N.slice(L*3),I=new Set(U),$=Math.round(N.length/3),k=[],W=[],j=1;j<$;j++)I.has(j)||(j<L?k.push(j-1,j):W.push(j-1-L,j-L));var Y=[{indices:k,vertices:F}];return U.length&&Y.push({indices:W,vertices:P}),Y}function T(S,M){var R={vertices:[],indices:[]},E={vertices:[],indices:[]};S.map(function(U){return y(U,M)}).forEach(function(U){var L=af(U,2),F=L[0],P=L[1];lf(R,F),P&&lf(E,P)});var N=[R];return E.vertices.length&&N.push(E),N}return n}return jk(e,i),Wk(e)}(F_.BufferGeometry);function lf(i,e){var t=Math.round(i.vertices.length/3);iT(i.vertices,e.vertices),iT(i.indices,e.indices.map(function(n){return n+t}))}function iT(i,e){var t=$k(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function l2(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var Ol=1e-6,Gv=Math.PI,rT=Gv/2,H0=180/Gv,Ql=Gv/180,U_=Math.abs,O_=Math.atan2,Xu=Math.cos,W0=Math.ceil,Eo=Math.sin,k_=Math.sqrt;function tG(i){return i>1?rT:i<-1?-rT:Math.asin(i)}function sT(i){return(i=Eo(i/2))*i}function gh(){}function xm(i,e){i&&aT.hasOwnProperty(i.type)&&aT[i.type](i,e)}var oT={Feature:function(i,e){xm(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)xm(t[n].geometry,e)}},aT={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){G_(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)G_(t[n],e,0)},Polygon:function(i,e){lT(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)lT(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)xm(t[n],e)}};function G_(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function lT(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)G_(i[t],e,1);e.polygonEnd()}function nG(i,e){i&&oT.hasOwnProperty(i.type)?oT[i.type](i,e):xm(i,e)}var V_,q_,Hp,Wp,_A={sphere:gh,point:gh,lineStart:iG,lineEnd:gh,polygonStart:gh,polygonEnd:gh};function iG(){_A.point=sG,_A.lineEnd=rG}function rG(){_A.point=_A.lineEnd=gh}function sG(i,e){i*=Ql,e*=Ql,q_=i,Hp=Eo(e),Wp=Xu(e),_A.point=oG}function oG(i,e){i*=Ql,e*=Ql;var t=Eo(e),n=Xu(e),r=U_(i-q_),s=Xu(r),o=Eo(r),a=n*o,l=Wp*t-Hp*n*s,u=Hp*t+Wp*n*s;V_.add(O_(k_(a*a+l*l),u)),q_=i,Hp=t,Wp=n}function aG(i){return V_=new Lh,nG(i,_A),+V_}var z_=[null,null],lG={type:"LineString",coordinates:z_};function uG(i,e){return z_[0]=i,z_[1]=e,aG(lG)}function uT(i,e,t){var n=bh(i,e-Ol,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function cT(i,e,t){var n=bh(i,e-Ol,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function cG(){var i,e,t,n,r,s,o,a,l=10,u=l,d=90,p=360,g,x,y,T,S=2.5;function M(){return{type:"MultiLineString",coordinates:R()}}function R(){return bh(W0(n/d)*d,t,d).map(y).concat(bh(W0(a/p)*p,o,p).map(T)).concat(bh(W0(e/l)*l,i,l).filter(function(E){return U_(E%d)>Ol}).map(g)).concat(bh(W0(s/u)*u,r,u).filter(function(E){return U_(E%p)>Ol}).map(x))}return M.lines=function(){return R().map(function(E){return{type:"LineString",coordinates:E}})},M.outline=function(){return{type:"Polygon",coordinates:[y(n).concat(T(o).slice(1),y(t).reverse().slice(1),T(a).reverse().slice(1))]}},M.extent=function(E){return arguments.length?M.extentMajor(E).extentMinor(E):M.extentMinor()},M.extentMajor=function(E){return arguments.length?(n=+E[0][0],t=+E[1][0],a=+E[0][1],o=+E[1][1],n>t&&(E=n,n=t,t=E),a>o&&(E=a,a=o,o=E),M.precision(S)):[[n,a],[t,o]]},M.extentMinor=function(E){return arguments.length?(e=+E[0][0],i=+E[1][0],s=+E[0][1],r=+E[1][1],e>i&&(E=e,e=i,i=E),s>r&&(E=s,s=r,r=E),M.precision(S)):[[e,s],[i,r]]},M.step=function(E){return arguments.length?M.stepMajor(E).stepMinor(E):M.stepMinor()},M.stepMajor=function(E){return arguments.length?(d=+E[0],p=+E[1],M):[d,p]},M.stepMinor=function(E){return arguments.length?(l=+E[0],u=+E[1],M):[l,u]},M.precision=function(E){return arguments.length?(S=+E,g=uT(s,r,90
4063),x=cT(e,i,S),y=uT(a,o,90),T=cT(n,t,S),M):S},M.extentMajor([[-180,-90+Ol],[180,90-Ol]]).extentMinor([[-180,-80-Ol],[180,80+Ol]])}function hG(){return cG()()}function AG(i,e){var t=i[0]*Ql,n=i[1]*Ql,r=e[0]*Ql,s=e[1]*Ql,o=Xu(n),a=Eo(n),l=Xu(s),u=Eo(s),d=o*Xu(t),p=o*Eo(t),g=l*Xu(r),x=l*Eo(r),y=2*tG(k_(sT(s-n)+o*l*sT(r-t))),T=Eo(y),S=y?function(M){var R=Eo(M*=y)/T,E=Eo(y-M)/T,N=E*d+R*g,U=E*p+R*x,L=E*a+R*u;return[O_(U,N)*H0,O_(L,k_(N*N+U*U))*H0]}:function(){return[t*H0,n*H0]};return S.distance=y,S}function fG(i,e,t=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(o){if(o.normalized||o.isInterleavedBufferAttribute){const a=new Float32Array(o.count*o.itemSize);for(let l=0,u=0;l<o.count;l++)a[u++]=o.getX(l),a[u++]=o.getY(l),o.itemSize>2&&(a[u++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}const r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new Di(s,4)),i!==r&&i.copy(r),i}function dG(i,e=!1){const t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Wn;let u=0;for(let d=0;d<i.length;++d){const p=i[d];let g=0;if(t!==(p.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const x in p.attributes){if(!n.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+'. All geometries must have compatible attributes; make sure "'+x+'" attribute exists among all geometries, or in none of them.'),null;s[x]===void 0&&(s[x]=[]),s[x].push(p.attributes[x]),g++}if(g!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". Make sure all geometries have the same number of attributes."),null;if(a!==p.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const x in p.morphAttributes){if(!r.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". .morphAttributes must be consistent throughout all geometries."),null;o[x]===void 0&&(o[x]=[]),o[x].push(p.morphAttributes[x])}if(e){let x;if(t)x=p.index.count;else if(p.attributes.position!==void 0)x=p.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". The geometry must have either an index or a position attribute"),null;l.addGroup(u,x,d),u+=x}}if(t){let d=0;const p=[];for(let g=0;g<i.length;++g){const x=i[g].index;for(let y=0;y<x.count;++y)p.push(x.getX(y)+d);d+=i[g].attributes.position.count}l.setIndex(p)}for(const d in s){const p=H_(s[d]);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+d+" attribute."),null;l.setAttribute(d,p)}for(const d in o){const p=o[d][0].length;if(p===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[d]=[];for(let g=0;g<p;++g){const x=[];for(let T=0;T<o[d].length;++T)x.push(o[d][T][g]);const y=H_(x);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+d+" morphAttribute."),null;l.morphAttributes[d].push(y)}}return l}function H_(i){let e,t,n,r=-1,s=0;for(let u=0;u<i.length;++u){const d=i[u];if(e===void 0&&(e=d.array.constructor),e!==d.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=d.itemSize),t!==d.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=d.normalized),n!==d.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=d.gpuType),r!==d.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=d.count*t}const o=new e(s),a=new Di(o,t,n);let l=0;for(let u=0;u<i.length;++u){const d=i[u];if(d.isInterleavedBufferAttribute){const p=l/t;for(let g=0,x=d.count;g<x;g++)for(let y=0;y<t;y++){const T=d.getComponent(g,y);a.setComponent(g+p,y,T)}}else o.set(d.array,l);l+=d.count*t}return r!==void 0&&(a.gpuType=r),a}function pG(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?vm(i):i.isInstancedBufferAttribute?new nu().copy(i):new Di().copy(i)}function mG(i){let e,t=0,n=0;for(let u=0,d=i.length;u<d;++u){const p=i[u];
vendor: 1,709 bytes, line 4063
4063if(e===void 0&&(e=p.array.constructor),e!==p.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=p.array.length,n+=p.itemSize}const r=new yv(new e(t),n);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let u=0,d=i.length;u<d;u++){const p=i[u],g=p.itemSize,x=p.count,y=new da(r,g,s,p.normalized);o.push(y),s+=g;for(let T=0;T<x;T++)for(let S=0;S<g;S++)y[l[S]](T,p[a[S]](T))}return o}function vm(i){const e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n);let o;i.isInstancedInterleavedBufferAttribute?o=new nu(s,n,r,i.meshPerAttribute):o=new Di(s,n,r);for(let a=0;a<t;a++)o.setX(a,i.getX(a)),n>=2&&o.setY(a,i.getY(a)),n>=3&&o.setZ(a,i.getZ(a)),n>=4&&o.setW(a,i.getW(a));return o}function gG(i){const e=i.attributes,t=i.morphTargets,n=new Map;for(const r in e){const s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,vm(s)),e[r]=n.get(s))}for(const r in t){const s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,vm(s)),t[r]=n.get(s))}}function _G(i){let e=0;for(const n in i.attributes){const r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}const t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function xG(i,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count;let o=0;const a=Object.keys(i.attributes),l={},u={},d=[],p=["getX","getY","getZ","getW"],g=["setX","setY","setZ","setW"];for(let R=0,E=a.length;R<E;R++){const N=a[R],U=i.attributes[N];l[N]=new U.constructor(new U.array.constructor(U.count*U.itemSize),U.itemSize,U.normalized);const L=i.morphAttributes[N];
4063L&&(u[N]||(u[N]=[]),L.forEach((F,P)=>{const I=new F.array.constructor(F.count*F.itemSize);u[N][P]=new F.constructor(I,F.itemSize,F.normalized)}))}const x=e*.5,y=Math.log10(1/e),T=Math.pow(10,y),S=x*T;for(let R=0;R<s;R++){const E=n?n.getX(R):R;let N="";for(let U=0,L=a.length;U<L;U++){const F=a[U],P=i.getAttribute(F),I=P.itemSize;for(let $=0;$<I;$++)N+=`${~~(P[p[$]](E)*T+S)},`}if(N in t)d.push(t[N]);else{for(let U=0,L=a.length;U<L;U++){const F=a[U],P=i.getAttribute(F),I=i.morphAttributes[F],$=P.itemSize,k=l[F],W=u[F];for(let j=0;j<$;j++){const Y=p[j],z=g[j];if(k[z](o,P[Y](E)),I)for(let Q=0,ee=I.length;Q<ee;Q++)W[Q][z](o,I[Q][Y](E))}}t[N]=o,d.push(o),o++}}const M=i.clone();for(const R in i.attributes){const E=l[R];if(M.setAttribute(R,new E.constructor(E.array.slice(0,o*E.itemSize),E.itemSize,E.normalized)),R in u)for(let N=0;N<u[R].length;N++){const U=u[R][N];M.morphAttributes[R][N]=new U.constructor(U.array.slice(0,o*U.itemSize),U.itemSize,U.normalized)}}return M.setIndex(d),M}function vG(i,e){if(e===HP)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===Tb||e===WP){let t=i.getIndex();if(t===null){const o=[],a=i.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}const n=t.count-2,r=[];if(e===Tb)for(let o=1;o<=n;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function yG(i){const e=new J,t=new J,n=new J,r=new J,s=new J,o=new J,a=new J,l=new J,u=new J;function d(le,Me,Ce,Be,Ye,qt,bt,Re){e.fromBufferAttribute(Me,Ye),t.fromBufferAttribute(Me,qt),n.fromBufferAttribute(Me,bt);const qe=le.morphTargetInfluences;if(Ce&&qe){a.set(0,0,0),l.set(0,0,0),u.set(0,0,0);for(let Ke=0,St=Ce.length;Ke<St;Ke++){const mt=qe[Ke],Tt=Ce[Ke];mt!==0&&(r.fromBufferAttribute(Tt,Ye),s.fromBufferAttribute(Tt,qt),o.fromBufferAttribute(Tt,bt),Be?(a.addScaledVector(r,mt),l.addScaledVector(s,mt),u.addScaledVector(o,mt)):(a.addScaledVector(r.sub(e),mt),l.addScaledVector(s.sub(t),mt),u.addScaledVector(o.sub(n),mt)))}e.add(a),t.add(l),n.add(u)}le.isSkinnedMesh&&(le.applyBoneTransform(Ye,e),le.applyBoneTransform(qt,t),le.applyBoneTransform(bt,n)),Re[Ye*3+0]=e.x,Re[Ye*3+1]=e.y,Re[Ye*3+2]=e.z,Re[qt*3+0]=t.x,Re[qt*3+1]=t.y,Re[qt*3+2]=t.z,Re[bt*3+0]=n.x,Re[bt*3+1]=n.y,Re[bt*3+2]=n.z}const p=i.geometry,g=i.material;let x,y,T;const S=p.index,M=p.attributes.position,R=p.morphAttributes.position,E=p.morphTargetsRelative,N=p.attributes.normal,U=p.morphAttributes.position,L=p.groups,F=p.drawRange;let P,I,$,k,W,j,Y;const z=new Float32Array(M.count*M.itemSize),Q=new Float32Array(N.count*N.itemSize);if(S!==null)if(Array.isArray(g))for(P=0,$=L.length;P<$;P++)for(W=L[P],j=Math.max(W.start,F.start),Y=Math.min(W.start+W.count,F.start+F.count),I=j,k=Y;I<k;I+=3)x=S.getX(I),y=S.getX(I+1),T=S.getX(I+2),d(i,M,R,E,x,y,T,z),d(i,N,U,E,x,y,T,Q);else for(j=Math.max(0,F.start),Y=Math.min(S.count,F.start+F.count),P=j,$=Y;P<$;P+=3)x=S.getX(P),y=S.getX(P+1),T=S.getX(P+2),d(i,M,R,E,x,y,T,z),d(i,N,U,E,x,y,T,Q);else if(Array.isArray(g))for(P=0,$=L.length;P<$;P++)for(W=L[P],j=Math.max(W.start,F.start),Y=Math.min(W.start+W.count,F.start+F.count),I=j,k=Y;I<k;I+=3)x=I,y=I+1,T=I+2,d(i,M,R,E,x,y,T,z),d(i,N,U,E,x,y,T,Q);else for(j=Math.max(0,F.start),Y=Math.min(M.count,F.start+F.count),P=j,$=Y;P<$;P+=3)x=P,y=P+1,T=P+2,d(i,M,R,E,x,y,T,z),d(i,N,U,E,x,y,T,Q);const ee=new Fn(z,3),fe=new Fn(Q,3);return{positionAttribute:M,normalAttribute:N,morphedPositionAttribute:ee,morphedNormalAttribute:fe}}function bG(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),i.getIndex()===null){const o=i.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);i.setIndex(a)}const t=i.getIndex(),n=[];for(let o=0;o<e.length;o++){const a=e[o],l=a.start,u=l+a.count;for(let d=l;d<u;d++)n.push(t.getX(d))}i.dispose(),i.setIndex(n);let r=0;for(let o=0;o<e.length;o++){const a=e[o];a.start=r,r+=a.count}let s=e[0];i.groups=[s];for(let o=1;o<e.length;o++){const a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,i.groups.push(s))}return i}function SG(i,e=Math.PI/3){const t=Math.cos(e),n=(1+1e-10)*100,r=[new J,new J,new J],s=new J,o=new J,a=new J,l=new J;function u(T){const S=~~(T.x*n),M=~~(T.y*n),R=~~(T.z*n);return`${S},${M},${R}`}const d=i.index?i.toNonIndexed():i,p=d.attributes.position,g={};for(let T=0,S=p.count/3;T<S;T++){const M=3*T,R=r[0].fromBufferAttribute(p,M+0),E=r[1].fromBufferAttribute(p,M+1),N=r[2].fromBufferAttribute(p,M+2);s.subVectors(N,E),o.subVectors(R,E);const U=new J().crossVectors(s,o).normalize();for(let L=0;L<3;L++){const F=r[L],P=u(F);P in g||(g[P]=[]),g[P].push(U)}}const x=new Float32Array(p.count*3),y=new Di(x,3,!1);for(let T=0,S=p.count/3;T<S;T++){const M=3*T,R=r[0].fromBufferAttribute(p,M+0),E=r[1].fromBufferAttribute(p,M+1),N=r[2].fromBufferAttribute(p,M+2);s.subVectors(N,E),o.subVectors(R,E),a.crossVectors(s,o).normalize();for(let U=0;U<3;U++){const L=r[U],F=u(L),P=g[F];l.set(0,0,0);for(let I=0,$=P.length;I<$;I++){const k=P[I];a.dot(k)>t&&l.add(k)}l.normalize(),y.setXYZ(M+U,l.x,l.y,l.z)}}return d.setAttribute("normal",y),d}const Vv=Object.freeze(Object.defineProperty({__proto__:null,computeMikkTSpaceTangents:fG,computeMorphedAttributes:yG,deepCloneAttribute:pG,deinterleaveAttribute:vm,deinterleaveGeometry:gG,estimateBytesUsed:_G,interleaveAttributes:mG,mergeAttributes:H_,mergeGeometries:dG,mergeGroups:bG,mergeVertices:xG,toCreasedNormals:SG,toTrianglesDrawMode:vG},Symbol.toStringTag,{value:"Module"}));var Xe=function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}};function ym(i){"@babel/helpers - typeof";return ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ym(i)}var TG=/^\s+/,MG=/\s+$/;function Qt(i,e){if(i=i||"",e=e||{},i instanceof Qt)return i;if(!(this instanceof Qt))return new Qt(i,e);var t=wG(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}Qt.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,o,a;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=c4(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=AT(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=AT(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=hT(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=hT(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return fT(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return NG(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Ni(this._r,255)*100)+"%",g:Math.round(Ni(this._g,255)*100)+"%",b:Math.round(Ni(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ni(this._r,255)*100)+"%, "+Math.round(Ni(this._g,255)*100)+"%, "+Math.round(Ni(this._b,255)*100)+"%)":"rgba("+Math.round(Ni(this._r,255)*100)+"%, "+Math.round(Ni(this._g,255)*100)+"%, "+Math.round(Ni(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:qG[fT(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+dT(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=Qt(e);n="#"+dT(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return Qt(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(IG,arguments)},brighten:function(){return this._applyModification(BG,arguments)},darken:function(){return this._applyModification(FG,arguments)},desaturate:function(){return this._applyModification(PG,arguments)},saturate:function(){return this._applyModification(DG,arguments)},greyscale:function(){return this._applyModification(LG,arguments)},spin:function(){return this._applyModification(UG,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(GG,arguments)},complement:function(){return this._applyCombination(OG,arguments)},monochromatic:function(){return this._applyCombination(VG,arguments)},splitcomplement:function(){return this._applyCombination(kG,arguments)},triad:function(){return this._applyCombination(pT,[3])},tetrad:function(){return this._applyCombination(pT,[4])}};Qt.fromRatio=function(i,e){if(ym(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=Pf(i[n]));i=t}return Qt(i,e)};function wG(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,o=!1,a=!1;return typeof i=="string"&&(i=$G(i)),ym(i)=="object"&&(Wa(i.r)&&Wa(i.g)&&Wa(i.b)?(e=EG(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Wa(i.h)&&Wa(i.s)&&Wa(i.v)?(n=Pf(i.s),r=Pf(i.v),e=CG(i.h,n,r),o=!0,a="hsv"):Wa(i.h)&&Wa(i.s)&&Wa(i.l)&&(n=Pf(i.s),s=Pf(i.l),e=RG(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=c4(t),{ok:o,format:i.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function EG(i,e,t){return{r:Ni(i,255)*255,g:Ni(e,255)*255,b:Ni(t,255)*255}}function hT(i,e,t){i=Ni(i,255),e=Ni(e,255),t=Ni(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=(n+r)/2;if(n==r)s=o=0;else{var l=n-r;switch(o=a>.5?l/(2-n-r):l/(n+r),n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function RG(i,e,t){var n,r,s;i=Ni(i,360),e=Ni(e,100),t=Ni(t,100);function o(u,d,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?u+(d-u)*6*p:p<1/2?d:p<2/3?u+(d-u)*(2/3-p)*6:u}if(e===0)n=r=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;n=o(l,a,i+1/3),r=o(l,a,i),s=o(l,a,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function AT(i,e,t){i=Ni(i,255),e=Ni(e,255),t=Ni(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=n,l=n-r;if(o=n===0?0:l/n,n==r)s=0;else{switch(n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function CG(i,e,t){i=Ni(i,360)*6,e=Ni(e,100),t=Ni(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),o=t*(1-r*e),a=t*(1-(1-r)*e),l=n%6,u=[t,o,s,s,a,t][l],d=[a,t,t,o,s,s][l],p=[s,s,a,t,t,o][l];return{r:u*255,g:d*255,b:p*255}}function fT(i,e,t,n){var r=[Lo(Math.round(i).toString(16)),Lo(Math.round(e).toString(16)),Lo(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function NG(i,e,t,n,r){var s=[Lo(Math.round(i).toString(16)),Lo(Math.round(e).toString(16)),Lo(Math.round(t).toString(16)),Lo(h4(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function dT(i,e,t,n){var r=[Lo(h4(n)),Lo(Math.round(i).toString(16)),Lo(Math.round(e).toString(16)),Lo(Math.round(t).toString(16))];return r.join("")}Qt.equals=function(i,e){return!i||!e?!1:Qt(i).toRgbString()==Qt(e).toRgbString()};Qt.random=function(){return Qt.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function PG(i,e){e=e===0?0:e||10;var t=Qt(i).toHsl();return t.s-=e/100,t.s=dg(t.s),Qt(t)}function DG(i,e){e=e===0?0:e||10;var t=Qt(i).toHsl();return t.s+=e/100,t.s=dg(t.s),Qt(t)}function LG(i){return Qt(i).desaturate(100)}function IG(i,e){e=e===0?0:e||10;var t=Qt(i).toHsl();return t.l+=e/100,t.l=dg(t.l),Qt(t)}function BG(i,e){e=e===0?0:e||10;var t=Qt(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),Qt(t)}function FG(i,e){e=e===0?0:e||10;var t=Qt(i).toHsl();return t.l-=e/100,t.l=dg(t.l),Qt(t)}function UG(i,e){var t=Qt(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,Qt(t)}function OG(i){var e=Qt(i).toHsl();return e.h=(e.h+180)%360,Qt(e)}function pT(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=Qt(i).toHsl(),n=[Qt(i)],r=360/e,s=1;s<e;s++)n.push(Qt({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function kG(i){var e=Qt(i).toHsl(),t=e.h;return[Qt(i),Qt({h:(t+72)%360,s:e.s,l:e.l}),Qt({h:(t+216)%360,s:e.s,l:e.l})]}function GG(i,e,t){e=e||6,t=t||30;var n=Qt(i).toHsl(),r=360/t,s=[Qt(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(Qt(n));return s}function VG(i,e){e=e||6;for(var t=Qt(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(Qt({h:n,s:r,v:s})),s=(s+a)%1;return o}Qt.mix=function(i,e,t){t=t===0?0:t||50;var n=Qt(i).toRgb(),r=Qt(e).toRgb(),s=t/100,o={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return Qt(o)};Qt.readability=function(i,e){var t=Qt(i),n=Qt(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};Qt.isReadable=function(i,e,t){var n=Qt.readability(i,e),r,s;switch(s=!1,r=jG(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};Qt.mostReadable=function(i,e,t){var n=null,r=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;
4063for(var u=0;u<e.length;u++)s=Qt.readability(i,e[u]),s>r&&(r=s,n=Qt(e[u]));return Qt.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,Qt.mostReadable(i,["#fff","#000"],t))};var W_=Qt.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee9
40630",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},qG=Qt.hexNames=zG(W_);function zG(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function c4(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Ni(i,e){HG(i)&&(i="100%");var t=WG(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function dg(i){return Math.min(1,Math.max(0,i))}function Us(i){return parseInt(i,16)}function HG(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function WG(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Lo(i){return i.length==1?"0"+i:""+i}function Pf(i){return i<=1&&(i=i*100+"%"),i}function h4(i){return Math.round(parseFloat(i)*255).toString(16)}function mT(i){return Us(i)/255}var wo=function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"
4063+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Wa(i){return!!wo.CSS_UNIT.exec(i)}function $G(i){i=i.replace(TG,"").replace(MG,"").toLowerCase();var e=!1;if(W_[i])i=W_[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=wo.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=wo.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=wo.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=wo.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=wo.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=wo.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=wo.hex8.exec(i))?{r:Us(t[1]),g:Us(t[2]),b:Us(t[3]),a:mT(t[4]),format:e?"name":"hex8"}:(t=wo.hex6.exec(i))?{r:Us(t[1]),g:Us(t[2]),b:Us(t[3]),format:e?"name":"hex"}:(t=wo.hex4.exec(i))?{r:Us(t[1]+""+t[1]),g:Us(t[2]+""+t[2]),b:Us(t[3]+""+t[3]),a:mT(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=wo.hex3.exec(i))?{r:Us(t[1]+""+t[1]),g:Us(t[2]+""+t[2]),b:Us(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function jG(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function $_(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function XG(i){if(Array.isArray(i))return i}function QG(i){if(Array.isArray(i))return $_(i)}function A4(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function YG(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function KG(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Fr(i,e){return i.get(A4(i,e))}function Zc(i,e,t){YG(i,e),e.set(i,t)}function $0(i,e,t){return i.set(A4(i,e),t),t}function ZG(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,aV(n.key),n)}}function JG(i,e,t){return e&&ZG(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function eV(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function tV(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(d){u=!0,r=d}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}function nV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 4064In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iV(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 4065In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rV(i,e){return XG(i)||tV(i,e)||f4(i,e)||nV()}function sV(i){return QG(i)||eV(i)||f4(i)||iV()}function oV(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function aV(i){var e=oV(i,"string");return typeof e=="symbol"?e:e+""}function f4(i,e){if(i){if(typeof i=="string")return $_(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?$_(i,e):void 0}}var Jc=new WeakMap,uf=new WeakMap,eh=new WeakMap,u2=new WeakMap,c2=new WeakMap,h2=new WeakMap,lV=function(){function i(){KG(this,i),Zc(this,Jc,new Map),Zc(this,uf,new Map),Zc(this,eh,function(e){return e}),Zc(this,u2,function(){return{}}),Zc(this,c2,function(){}),Zc(this,h2,function(){})}return JG(i,[{key:"getObj",value:function(t){return Fr(Jc,this).get(Fr(eh,this).call(this,t))}},{key:"getData",value:function(t){return Fr(uf,this).get(t)}},{key:"entries",value:function(){return sV(Fr(uf,this).entries()).map(function(t){var n=rV(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return $0(eh,this,Xe(t)),this}},{key:"onCreateObj",value:function(t){return $0(u2,this,t),this}}
4065,{key:"onUpdateObj",value:function(t){return $0(c2,this,t),this}},{key:"onRemoveObj",value:function(t){return $0(h2,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!Fr(Jc,n).has(Fr(eh,n).call(n,s))}).forEach(function(s){var o=Fr(u2,n).call(n,s);Fr(Jc,n).set(Fr(eh,n).call(n,s),o),Fr(uf,n).set(o,s)});var r=new Map(t.map(function(s){return[Fr(eh,n).call(n,s),s]}));return Fr(Jc,this).forEach(function(s,o){r.has(o)?Fr(c2,n).call(n,s,r.get(o)):(Fr(h2,n).call(n,s,o),Fr(Jc,n).delete(o),Fr(uf,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}(),d4={exports:{}};(function(i,e){(function(t,n){i.exports=n()})(LP,function(){return function(t){function n(s){if(r[s])return r[s].exports;var o=r[s]={exports:{},id:s,loaded:!1};return t[s].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){var s=r(1),o=function(){function a(l,u,d){l===void 0&&(l=NaN),u===void 0&&(u=NaN),d===void 0&&(d=!1),this._minFPS=u,this._maxFPS=l,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new s.default,this._onPause=new s.default,this._onTick=new s.default,this._onTickOncePerFrame=new s.default,d||this.resume()}return a.prototype.updateOnce=function(l){l(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},a.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},a.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},a.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(a.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"timeScale",{get:function(){return this._timeScale},set:function(l){this._timeScale!==l&&(this._timeScale=l)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),a.prototype.animateOnce=function(){var l=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return l.onFrame()})},a.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},a.prototype.update=function(l,u){u===void 0&&(u=!0),this._currentTick++,this._currentTime+=l,this._tickDeltaTime=l,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),u&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},a.prototype.getTimer=function(){return Date.now()},a}();Object.defineProperty(n,"__esModule",{value:!0}),n.default=o},function(t,n,r){(function(s,o){t.exports=o()})(this,function(){return function(s){function o(l){if(a[l])return a[l].exports;var u=a[l]={exports:{},id:l,loaded:!1};return s[l].call(u.exports,u,u.exports,o),u.loaded=!0,u.exports}var a={};return o.m=s,o.c=a,o.p="",o(0)}([function(s,o){var a=function(){function l(){this.functions=[]}return l.prototype.add=function(u){return this.functions.indexOf(u)===-1&&(this.functions.push(u),!0)},l.prototype.remove=function(u){var d=this.functions.indexOf(u);return d>-1&&(this.functions.splice(d,1),!0)},l.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},l.prototype.dispatch=function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];var p=this.functions.concat();p.forEach(function(g){g.apply(void 0,u)})},Object.defineProperty(l.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),l}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=a}])})}])})})(d4);var uV=d4.exports;const xA=IP(uV),il=11102230246251565e-32,Ur=134217729,cV=(3+8*il)*il;function A2(i,e,t,n,r){let s,o,a,l,u=e[0],d=n[0],p=0,g=0;d>
vendor: 8,896 bytes, line 4065
4065u==d>-u?(s=u,u=e[++p]):(s=d,d=n[++g]);let x=0;if(p<i&&g<t)for(d>u==d>-u?(o=u+s,a=s-(o-u),u=e[++p]):(o=d+s,a=s-(o-d),d=n[++g]),s=o,a!==0&&(r[x++]=a);p<i&&g<t;)d>u==d>-u?(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=e[++p]):(o=s+d,l=o-s,a=s-(o-l)+(d-l),d=n[++g]),s=o,a!==0&&(r[x++]=a);for(;p<i;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=e[++p],s=o,a!==0&&(r[x++]=a);for(;g<t;)o=s+d,l=o-s,a=s-(o-l)+(d-l),d=n[++g],s=o,a!==0&&(r[x++]=a);return(s!==0||x===0)&&(r[x++]=s),x}function hV(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function kd(i){return new Float64Array(i)}const AV=(3+16*il)*il,fV=(2+12*il)*il,dV=(9+64*il)*il*il,th=kd(4),gT=kd(8),_T=kd(12),xT=kd(16),Yr=kd(4);function pV(i,e,t,n,r,s,o){let a,l,u,d,p,g,x,y,T,S,M,R,E,N,U,L,F,P;const I=i-r,$=t-r,k=e-s,W=n-s;N=I*W,g=Ur*I,x=g-(g-I),y=I-x,g=Ur*W,T=g-(g-W),S=W-T,U=y*S-(N-x*T-y*T-x*S),L=k*$,g=Ur*k,x=g-(g-k),y=k-x,g=Ur*$,T=g-(g-$),S=$-T,F=y*S-(L-x*T-y*T-x*S),M=U-F,p=U-M,th[0]=U-(M+p)+(p-F),R=N+M,p=R-N,E=N-(R-p)+(M-p),M=E-L,p=E-M,th[1]=E-(M+p)+(p-L),P=R+M,p=P-R,th[2]=R-(P-p)+(M-p),th[3]=P;let j=hV(4,th),Y=fV*o;if(j>=Y||-j>=Y||(p=i-I,a=i-(I+p)+(p-r),p=t-$,u=t-($+p)+(p-r),p=e-k,l=e-(k+p)+(p-s),p=n-W,d=n-(W+p)+(p-s),a===0&&l===0&&u===0&&d===0)||(Y=dV*o+cV*Math.abs(j),j+=I*d+W*a-(k*u+$*l),j>=Y||-j>=Y))return j;N=a*W,g=Ur*a,x=g-(g-a),y=a-x,g=Ur*W,T=g-(g-W),S=W-T,U=y*S-(N-x*T-y*T-x*S),L=l*$,g=Ur*l,x=g-(g-l),y=l-x,g=Ur*$,T=g-(g-$),S=$-T,F=y*S-(L-x*T-y*T-x*S),M=U-F,p=U-M,Yr[0]=U-(M+p)+(p-F),R=N+M,p=R-N,E=N-(R-p)+(M-p),M=E-L,p=E-M,Yr[1]=E-(M+p)+(p-L),P=R+M,p=P-R,Yr[2]=R-(P-p)+(M-p),Yr[3]=P;const z=A2(4,th,4,Yr,gT);N=I*d,g=Ur*I,x=g-(g-I),y=I-x,g=Ur*d,T=g-(g-d),S=d-T,U=y*S-(N-x*T-y*T-x*S),L=k*u,g=Ur*k,x=g-(g-k),y=k-x,g=Ur*u,T=g-(g-u),S=u-T,F=y*S-(L-x*T-y*T-x*S),M=U-F,p=U-M,Yr[0]=U-(M+p)+(p-F),R=N+M,p=R-N,E=N-(R-p)+(M-p),M=E-L,p=E-M,Yr[1]=E-(M+p)+(p-L),P=R+M,p=P-R,Yr[2]=R-(P-p)+(M-p),Yr[3]=P;const Q=A2(z,gT,4,Yr,_T);N=a*d,g=Ur*a,x=g-(g-a),y=a-x,g=Ur*d,T=g-(g-d),S=d-T,U=y*S-(N-x*T-y*T-x*S),L=l*u,g=Ur*l,x=g-(g-l),y=l-x,g=Ur*u,T=g-(g-u),S=u-T,F=y*S-(L-x*T-y*T-x*S),M=U-F,p=U-M,Yr[0]=U-(M+p)+(p-F),R=N+M,p=R-N,E=N-(R-p)+(M-p),M=E-L,p=E-M,Yr[1]=E-(M+p)+(p-L),P=R+M,p=P-R,Yr[2]=R-(P-p)+(M-p),Yr[3]=P;const ee=A2(Q,_T,4,Yr,xT);return xT[ee-1]}function j0(i,e,t,n,r,s){const o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,u=Math.abs(o+a);return Math.abs(l)>=AV*u?l:-pV(i,e,t,n,r,s,u)}const vT=Math.pow(2,-52),X0=new Uint32Array(512);class bd{static from(e,t=vV,n=yV){const r=e.length,s=new Float64Array(r*2);for(let o=0;o<r;o++){const a=e[o];s[2*o]=t(a),s[2*o+1]=n(a)}return new bd(s)}constructor(e){const t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,o=e.length>>1;let a=1/0,l=1/0,u=-1/0,d=-1/0;for(let I=0;I<o;I++){const $=e[2*I],k=e[2*I+1];$<a&&(a=$),k<l&&(l=k),$>u&&(u=$),k>d&&(d=k),this._ids[I]=I}const p=(a+u)/2,g=(l+d)/2;let x,y,T;for(let I=0,$=1/0;I<o;I++){const k=f2(p,g,e[2*I],e[2*I+1]);k<$&&(x=I,$=k)}const S=e[2*x],M=e[2*x+1];for(let I=0,$=1/0;I<o;I++){if(I===x)continue;const k=f2(S,M,e[2*I],e[2*I+1]);k<$&&k>0&&(y=I,$=k)}let R=e[2*y],E=e[2*y+1],N=1/0;for(let I=0;I<o;I++){if(I===x||I===y)continue;const $=_V(S,M,R,E,e[2*I],e[2*I+1]);$<N&&(T=I,N=$)}let U=e[2*T],L=e[2*T+1];if(N===1/0){for(let k=0;k<o;k++)this._dists[k]=e[2*k]-e[0]||e[2*k+1]-e[1];Th(this._ids,this._dists,0,o-1);const I=new Uint32Array(o);let $=0;for(let k=0,W=-1/0;k<o;k++){const j=this._ids[k],Y=this._dists[j];Y>W&&(I[$++]=j,W=Y)}this.hull=I.subarray(0,$),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(j0(S,M,R,E,U,L)<0){const I=y,$=R,k=E;y=T,R=U,E=L,T=I,U=$,L=k}const F=xV(S,M,R,E,U,L);this._cx=F.x,this._cy=F.y;for(let I=0;I<o;I++)this._dists[I]=f2(e[2*I],e[2*I+1],F.x,F.y);Th(this._ids,this._dists,0,o-1),this._hullStart=x;let P=3;n[x]=t[T]=y,n[y]=t[x]=T,n[T]=t[y]=x,r[x]=0,r[y]=1,r[T]=2,s.fill(-1),s[this._hashKey(S,M)]=x,s[this._hashKey(R,E)]=y,s[this._hashKey(U,L)]=T,this.trianglesLen=0,this._addTriangle(x,y,T,-1,-1,-1);for(let I=0,$,k;I<this._ids.length;I++){const W=this._ids[I],j=e[2*W],Y=e[2*W+1];if(I>0&&Math.abs(j-$)<=vT&&Math.abs(Y-k)<=vT||($=j,k=Y,W===x||W===y||W===T))continue;let z=0;for(let Me=0,Ce=this._hashKey(j,Y);Me<this._hashSize&&(z=s[(Ce+Me)%this._hashSize],!(z!==-1&&z!==n[z]));Me++);z=t[z];let Q=z,ee;for(;ee=n[Q],j0(j,Y,e[2*Q],e[2*Q+1],e[2*ee],e[2*ee+1])>=0;)if(Q=ee,Q===z){Q=-1;break}if(Q===-1)continue;let fe=this._addTriangle(Q,W,n[Q],-1,-1,r[Q]);r[W]=this._legalize(fe+2),r[Q]=fe,P++;let le=n[Q];for(;ee=n[le],j0(j,Y,e[2*le],e[2*le+1],e[2*ee],e[2*ee+1])<0;)fe=this._addTriangle(le,W,ee,r[W],-1,r[le]),r[W]=this._legalize(fe+2),n[le]=le,P--,le=ee;if(Q===z)for(;ee=t[Q],j0(j,Y,e[2*ee],e[2*ee+1],e[2*Q],e[2*Q+1])<0;)fe=this._addTriangle(ee,W,Q,-1,r[Q],r[ee]),this._legalize(fe+2),r[ee]=fe,n[Q]=Q,P--,Q=ee;this._hullStart=t[W]=Q,n[Q]=t[le]=W,n[W]=le,s[this._hashKey(j,Y)]=W,s[this._hashKey(e[2*Q],e[2*Q+1])]=Q}this.hull=new Uint32Array(P);for(let I=0,$=this._hullStart;I<P;I++)this.hull[I]=$,$=n[$];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(mV(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let s=0,o=0;for(;;){const a=n[e],l=e-e%3;if(o=l+(e+2)%3,a===-1){if(s===0)break;e=X0[--s];continue}const u=a-a%3,d=l+(e+1)%3,p=u+(a+2)%3,g=t[o],x=t[e],y=t[d],T=t[p];if(gV(r[2*g],r[2*g+1],r[2*x],r[2*x+1],r[2*y],r[2*y+1],r[2*T],r[2*T+1])){t[e]=T,t[a]=g;const M=n[p];if(M===-1){let E=this._hullStart;do{if(this._hullTri[E]===p){this._hullTri[E]=e;break}E=this._hullPrev[E]}while(E!==this._hullStart)}this._link(e,M),this._link(a,n[o]),this._link(o,p);const R=u+(a+1)%3;s<X0.length&&(X0[s++]=R)}else{if(s===0)break;e=X0[--s]}}return o}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,o){const a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,s),this._link(a+2,o),this.trianglesLen+=3,a}}function mV(i,e){const t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function f2(i,e,t,n){const r=i-t,s=e-n;return r*r+s*s}function gV(i,e,t,n,r,s,o,a){const l=i-o,u=e-a,d=t-o,p=n-a,g=r-o,x=s-a,y=l*l+u*u,T=d*d+p*p,S=g*g+x*x;return l*(p*S-T*x)-u*(d*S-T*g)+y*(d*x-p*g)<0}function _V(i,e,t,n,r,s){const o=t-i,a=n-e,l=r-i,u=s-e,d=o*o+a*a,p=l*l+u*u,g=.5/(o*u-a*l),x=(u*d-a*p)*g,y=(o*p-l*d)*g;return x*x+y*y}function xV(i,e,t,n,r,s){const o=t-i,a=n-e,l=r-i,u=s-e,d=o*o+a*a,p=l*l+u*u,g=.5/(o*u-a*l),x=i+(u*d-a*p)*g,y=e+(o*p-l*d)*g;return{x,y}}function Th(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){const s=i[r],o=e[s];let a=r-1;for(;a>=t&&e[i[a]]>o;)i[a+1]=i[a--];i[a+1]=s}else{const r=t+n>>1;let s=t+1,o=n;cf(i,r,s),e[i[t]]>e[i[n]]&&cf(i,t,n),e[i[s]]>e[i[n]]&&cf(i,s,n),e[i[t]]>e[i[s]]&&cf(i,t,s);const a=i[s],l=e[a];for(;;){do s++;while(e[i[s]]<l);do o--;while(e[i[o]]>l);if(o<s)break;cf(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(Th(i,e,s,n),Th(i,e,t,o-1)):(Th(i,e,t,o-1),Th(i,e,s,n))}}function cf(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}function vV(i){return i[0]}function yV(i){return i[1]}const rl=11102230246251565e-32,Or=134217729,bV=(3+8*rl)*rl;function d2(i,e,t,n,r){let s,o,a,l,u=e[0],d=n[0],p=0,g=0;d>u==d>-u?(s=u,u=e[++p]):(s=d,d=n[++g]);let x=0;if(p<i&&g<t)for(d>u==d>-u?(o=u+s,a=s-(o-u),u=e[++p]):(o=d+s,a=s-(o-d),d=n[++g]),s=o,a!==0&&(r[x++]=a);p<i&&g<t;)d>u==d>-u?(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=e[++p]):(o=s+d,l=o-s,a=s-(o-l)+(d-l),d=n[++g]),s=o,a!==0&&(r[x++]=a);for(;p<i;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=e[++p],s=o,a!==0&&(r[x++]=a);for(;g<t;)o=s+d,l=o-s,a=s-(o-l)+(d-l),d=n[++g],s=o,a!==0&&(r[x++]=a);return(s!==0||x===0)&&(r[x++]=s),x}function SV(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function Gd(i){return new Float64Array(i)}const TV=(3+16*rl)*rl,MV=(2+12*rl)*rl,wV=(9+64*rl)*rl*rl,nh=Gd(4),yT=Gd(8),bT=Gd(12),ST=Gd(16),Kr=Gd(4);function EV(i,e,t,n,r,s,o){let a,l,u,d,p,g,x,y,T,S,M,R,E,N,U,L,F,P;const I=i-r,$=t-r,k=e-s,W=n-s;N=I*W,g=Or*I,x=g-(g-I),y=I-x,g=Or*W,T=g-(g-W),S=W-T,U=y*S-(N-x*T-y*T-x*S),L=k*$,g=Or*k,x=g-(g-k),y=k-x,g=Or*$,T=g-(g-$),S=$-T,F=y*S-(L-x*T-y*T-x*S),M=U-F,p=U-M,nh[0]=U-(M+p)+(p-F),R=N+M,p=R-N,E=N-(R-p)+(M-p),M=E-L,p=E-M,nh[1]=E-(M+p)+(p-L),P=R+M,p=P-R,nh[2]=R-(P-p)+(M-p),nh[3]=P;let j=SV(4,nh),Y=MV*o;if(j>=Y||-j>=Y||(p=i-I,a=i-(I+p)+(p-r),p=t-$,u=t-($+p)+(p-r),p=e-k,l=e-(k+p)+(p-s),p=n-W,d=n-(W+p)+(p-s),a===0&&l===0&&u===0&&d===0)||(Y=wV*o+bV*Math.abs(j),j+=I*d+W*a-(k*u+$*l),j>=Y||-j>=Y))return j;
vendor: 1,532 bytes, line 4065
4065N=a*W,g=Or*a,x=g-(g-a),y=a-x,g=Or*W,T=g-(g-W),S=W-T,U=y*S-(N-x*T-y*T-x*S),L=l*$,g=Or*l,x=g-(g-l),y=l-x,g=Or*$,T=g-(g-$),S=$-T,F=y*S-(L-x*T-y*T-x*S),M=U-F,p=U-M,Kr[0]=U-(M+p)+(p-F),R=N+M,p=R-N,E=N-(R-p)+(M-p),M=E-L,p=E-M,Kr[1]=E-(M+p)+(p-L),P=R+M,p=P-R,Kr[2]=R-(P-p)+(M-p),Kr[3]=P;const z=d2(4,nh,4,Kr,yT);N=I*d,g=Or*I,x=g-(g-I),y=I-x,g=Or*d,T=g-(g-d),S=d-T,U=y*S-(N-x*T-y*T-x*S),L=k*u,g=Or*k,x=g-(g-k),y=k-x,g=Or*u,T=g-(g-u),S=u-T,F=y*S-(L-x*T-y*T-x*S),M=U-F,p=U-M,Kr[0]=U-(M+p)+(p-F),R=N+M,p=R-N,E=N-(R-p)+(M-p),M=E-L,p=E-M,Kr[1]=E-(M+p)+(p-L),P=R+M,p=P-R,Kr[2]=R-(P-p)+(M-p),Kr[3]=P;const Q=d2(z,yT,4,Kr,bT);N=a*d,g=Or*a,x=g-(g-a),y=a-x,g=Or*d,T=g-(g-d),S=d-T,U=y*S-(N-x*T-y*T-x*S),L=l*u,g=Or*l,x=g-(g-l),y=l-x,g=Or*u,T=g-(g-u),S=u-T,F=y*S-(L-x*T-y*T-x*S),M=U-F,p=U-M,Kr[0]=U-(M+p)+(p-F),R=N+M,p=R-N,E=N-(R-p)+(M-p),M=E-L,p=E-M,Kr[1]=E-(M+p)+(p-L),P=R+M,p=P-R,Kr[2]=R-(P-p)+(M-p),Kr[3]=P;const ee=d2(Q,bT,4,Kr,ST);return ST[ee-1]}function RV(i,e,t,n,r,s){const o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,u=Math.abs(o+a);return Math.abs(l)>=TV*u?l:-EV(i,e,t,n,r,s,u)}function CV(i,e){var t,n,r=0,s,o,a,l,u,d,p,g=i[0],x=i[1],y=e.length;for(t=0;t<y;t++){n=0;var T=e[t],S=T.length-1;if(d=T[0],d[0]!==T[S][0]&&d[1]!==T[S][1])throw new Error("First and last coordinates in a ring must be the same");for(o=d[0]-g,a=d[1]-x,n;n<S;n++){if(p=T[n+1],l=p[0]-g,u=p[1]-x,a===0&&u===0){if(l<=0&&o>=0||o<=0&&l>=0)return 0}else if(u>=0&&a<=0||u<=0&&a>=0){if(s=RV(o,l,a,u,0,0),s===0)return 0;(s>0&&u>0&&a<=0||s<0&&u<=0&&a>0)&&r++}d=p,a=u,o=l}}return r%2!==0}
4065function NV(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function PV(i){return i.type==="Feature"?i.geometry:i}function DV(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");const n=NV(i),r=PV(e),s=r.type,o=e.bbox;let a=r.coordinates;if(o&&LV(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var u=0;u<a.length;++u){const d=CV(n,a[u]);if(d===0)return!t.ignoreBoundary;d&&(l=!0)}return l}function LV(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var IV=DV;const TT=1e-6;class Qu{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;const r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>TT||Math.abs(this._y1-s)>TT)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class j_{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class BV{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this;let s,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let T=0,S=0,M=n.length,R,E;T<M;T+=3,S+=2){const N=n[T]*2,U=n[T+1]*2,L=n[T+2]*2,F=e[N],P=e[N+1],I=e[U],$=e[U+1],k=e[L],W=e[L+1],j=I-F,Y=$-P,z=k-F,Q=W-P,ee=(j*Q-Y*z)*2;if(Math.abs(ee)<1e-9){if(s===void 0){s=o=0;for(const le of t)s+=e[le*2],o+=e[le*2+1];s/=t.length,o/=t.length}const fe=1e9*Math.sign((s-F)*Q-(o-P)*z);R=(F+k)/2-fe*Q,E=(P+W)/2+fe*z}else{const fe=1/ee,le=j*j+Y*Y,Me=z*z+Q*Q;R=F+(Q*le-Y*Me)*fe,E=P+(j*Me-z*le)*fe}a[S]=R,a[S+1]=E}let l=t[t.length-1],u,d=l*4,p,g=e[2*l],x,y=e[2*l+1];r.fill(0);for(let T=0;T<t.length;++T)l=t[T],u=d,p=g,x=y,d=l*4,g=e[2*l],y=e[2*l+1],r[u+2]=r[d]=x-y,r[u+3]=r[d+1]=g-p}render(e){const t=e==null?e=new Qu:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:o,vectors:a}=this;if(s.length<=1)return null;for(let d=0,p=n.length;d<p;++d){const g=n[d];if(g<d)continue;const x=Math.floor(d/3)*2,y=Math.floor(g/3)*2,T=o[x],S=o[x+1],M=o[y],R=o[y+1];this._renderSegment(T,S,M,R,e)}let l,u=s[s.length-1];for(let d=0;d<s.length;++d){l=u,u=s[d];const p=Math.floor(r[u]/3)*2,g=o[p],x=o[p+1],y=l*4,T=this._project(g,x,a[y+2],a[y+3]);T&&this._renderSegment(g,x,T[0],T[1],e)}return t&&t.value()}renderBounds(e){const t=e==null?e=new Qu:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){const n=t==null?t=new Qu:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let o=2;o<s;o+=2)(r[o]!==r[o-2]||r[o+1]!==r[o-1])&&t.lineTo(r[o],r[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){const r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){const t=new j_;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let o;const a=this._regioncode(e,t),l=this._regioncode(n,r);a===0&&l===0?(s.moveTo(e,t),s.lineTo(n,r)):(o=this._clipSegment(e,t,n,r,a,l))&&(s.moveTo(o[0],o[1]),s.lineTo(o[2],o[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){const t=this._clip(e);if(t)for(const n of this.delaunay.neighbors(e)){const r=this._clip(n);if(r){e:for(let s=0,o=t.length;s<o;s+=2)for(let a=0,l=r.length;a<l;a+=2)if(t[s]===r[a]&&t[s+1]===r[a+1]&&t[(s+2)%o]===r[(a+l-2)%l]&&t[(s+3)%o]===r[(a+l-1)%l]){yield n;break e}}}}_cell(e){const{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,o=n[e];if(o===-1)return null;const a=[];let l=o;do{const u=Math.floor(l/3);if(a.push(t[u*2],t[u*2+1]),l=l%3===2?l-2:l+1,s[l]!==e)break;l=r[l]}while(l!==o&&l!==-1);return a}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const t=this._cell(e);if(t===null)return null;const{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){const n=t.length;let r=null,s,o,a=t[n-2],l=t[n-1],u,d=this._regioncode(a,l),p,g=0;for(let x=0;x<n;x+=2)if(s=a,o=l,a=t[x],l=t[x+1],u=d,d=this._regioncode(a,l),u===0&&d===0)p=g,g=0,r?r.push(a,l):r=[a,l];else{let y,T,S,M,R;if(u===0){if((y=this._clipSegment(s,o,a,l,u,d))===null)continue;[T,S,M,R]=y}else{if((y=this._clipSegment(a,l,s,o,d,u))===null)continue;
vendor: 16,017 bytes, line 4065
4065[M,R,T,S]=y,p=g,g=this._edgecode(T,S),p&&g&&this._edge(e,p,g,r,r.length),r?r.push(T,S):r=[T,S]}p=g,g=this._edgecode(M,R),p&&g&&this._edge(e,p,g,r,r.length),r?r.push(M,R):r=[M,R]}if(r)p=g,g=this._edgecode(r[0],r[1]),p&&g&&this._edge(e,p,g,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,o){const a=s<o;for(a&&([e,t,n,r,s,o]=[n,r,e,t,o,s]);;){if(s===0&&o===0)return a?[n,r,e,t]:[e,t,n,r];if(s&o)return null;let l,u,d=s||o;d&8?(l=e+(n-e)*(this.ymax-t)/(r-t),u=this.ymax):d&4?(l=e+(n-e)*(this.ymin-t)/(r-t),u=this.ymin):d&2?(u=t+(r-t)*(this.xmax-e)/(n-e),l=this.xmax):(u=t+(r-t)*(this.xmin-e)/(n-e),l=this.xmin),s?(e=l,t=u,s=this._regioncode(e,t)):(n=l,r=u,o=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,o){let a=Array.from(t),l;if((l=this._project(a[0],a[1],n,r))&&a.unshift(l[0],l[1]),(l=this._project(a[a.length-2],a[a.length-1],s,o))&&a.push(l[0],l[1]),a=this._clipFinite(e,a))for(let u=0,d=a.length,p,g=this._edgecode(a[d-2],a[d-1]);u<d;u+=2)p=g,g=this._edgecode(a[u],a[u+1]),p&&g&&(u=this._edge(e,p,g,a,u),d=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,r,s){for(;t!==n;){let o,a;switch(t){case 5:t=4;continue;case 4:t=6,o=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,o=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,o=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,o=this.xmin,a=this.ymin;break}(r[s]!==o||r[s+1]!==a)&&this.contains(e,o,a)&&(r.splice(s,0,o,a),s+=2)}return s}_project(e,t,n,r){let s=1/0,o,a,l;if(r<0){if(t<=this.ymin)return null;(o=(this.ymin-t)/r)<s&&(l=this.ymin,a=e+(s=o)*n)}else if(r>0){if(t>=this.ymax)return null;(o=(this.ymax-t)/r)<s&&(l=this.ymax,a=e+(s=o)*n)}if(n>0){if(e>=this.xmax)return null;(o=(this.xmax-e)/n)<s&&(a=this.xmax,l=t+(s=o)*r)}else if(n<0){if(e<=this.xmin)return null;(o=(this.xmin-e)/n)<s&&(a=this.xmin,l=t+(s=o)*r)}return[a,l]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){const n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}}const FV=2*Math.PI,ih=Math.pow;function UV(i){return i[0]}function OV(i){return i[1]}function kV(i){const{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){const r=2*e[n],s=2*e[n+1],o=2*e[n+2];if((t[o]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[o+1]-t[r+1])>1e-10)return!1}return!0}function GV(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}class qv{static from(e,t=UV,n=OV,r){return new qv("length"in e?VV(e,t,n,r):Float64Array.from(qV(e,t,n,r)))}constructor(e){this._delaunator=new bd(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&kV(e)){this.collinear=Int32Array.from({length:t.length/2},(g,x)=>x).sort((g,x)=>t[2*g]-t[2*x]||t[2*g+1]-t[2*x+1]);const l=this.collinear[0],u=this.collinear[this.collinear.length-1],d=[t[2*l],t[2*l+1],t[2*u],t[2*u+1]],p=1e-8*Math.hypot(d[3]-d[1],d[2]-d[0]);for(let g=0,x=t.length/2;g<x;++g){const y=GV(t[2*g],t[2*g+1],p);t[2*g]=y[0],t[2*g+1]=y[1]}this._delaunator=new bd(t)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let l=0,u=n.length;l<u;++l){const d=s[l%3===2?l-2:l+1];(n[l]===-1||o[d]===-1)&&(o[d]=l)}for(let l=0,u=r.length;l<u;++l)a[r[l]]=l;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new BV(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:o,collinear:a}=this;if(a){const p=a.indexOf(e);p>0&&(yield a[p-1]),p<a.length-1&&(yield a[p+1]);return}const l=t[e];if(l===-1)return;let u=l,d=-1;do{if(yield d=o[u],u=u%3===2?u-2:u+1,o[u]!==e)return;if(u=s[u],u===-1){const p=n[(r[e]+1)%n.length];p!==d&&(yield p);return}}while(u!==l)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;const r=n;let s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){const{inedges:r,hull:s,_hullIndex:o,halfedges:a,triangles:l,points:u}=this;if(r[e]===-1||!u.length)return(e+1)%(u.length>>1);let d=e,p=ih(t-u[e*2],2)+ih(n-u[e*2+1],2);const g=r[e];let x=g;do{let y=l[x];const T=ih(t-u[y*2],2)+ih(n-u[y*2+1],2);if(T<p&&(p=T,d=y),x=x%3===2?x-2:x+1,l[x]!==e)break;if(x=a[x],x===-1){if(x=s[(o[e]+1)%s.length],x!==y&&ih(t-u[x*2],2)+ih(n-u[x*2+1],2)<p)return x;break}}while(x!==g);return d}render(e){const t=e==null?e=new Qu:void 0,{points:n,halfedges:r,triangles:s}=this;for(let o=0,a=r.length;o<a;++o){const l=r[o];if(l<o)continue;const u=s[o]*2,d=s[l]*2;e.moveTo(n[u],n[u+1]),e.lineTo(n[d],n[d+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;const n=e==null?e=new Qu:void 0,{points:r}=this;for(let s=0,o=r.length;s<o;s+=2){const a=r[s],l=r[s+1];e.moveTo(a+t,l),e.arc(a,l,t,0,FV)}return n&&n.value()}renderHull(e){const t=e==null?e=new Qu:void 0,{hull:n,points:r}=this,s=n[0]*2,o=n.length;e.moveTo(r[s],r[s+1]);for(let a=1;a<o;++a){const l=2*n[a];e.lineTo(r[l],r[l+1])}return e.closePath(),t&&t.value()}hullPolygon(){const e=new j_;return this.renderHull(e),e.value()}renderTriangle(e,t){const n=t==null?t=new Qu:void 0,{points:r,triangles:s}=this,o=s[e*=3]*2,a=s[e+1]*2,l=s[e+2]*2;return t.moveTo(r[o],r[o+1]),t.lineTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){const t=new j_;return this.renderTriangle(e,t),t.value()}}function VV(i,e,t,n){const r=i.length,s=new Float64Array(r*2);for(let o=0;o<r;++o){const a=i[o];s[o*2]=e.call(n,a,o,i),s[o*2+1]=t.call(n,a,o,i)}return s}function*qV(i,e,t,n){let r=0;for(const s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}var xi=1e-6,X_=1e-12,Hn=Math.PI,so=Hn/2,MT=Hn/4,Uo=Hn*2,es=180/Hn,Vn=Hn/180,Gi=Math.abs,p4=Math.atan,cl=Math.atan2,Pn=Math.cos,Q_=Math.hypot,Dn=Math.sin,zV=Math.sign||function(i){return i>0?1:i<0?-1:0},vc=Math.sqrt;function HV(i){return i>1?0:i<-1?Hn:Math.acos(i)}function lu(i){return i>1?so:i<-1?-so:Math.asin(i)}function ro(){}function bm(i,e){i&&ET.hasOwnProperty(i.type)&&ET[i.type](i,e)}var wT={Feature:function(i,e){bm(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)bm(t[n].geometry,e)}},ET={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){Y_(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)Y_(t[n],e,0)},Polygon:function(i,e){RT(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)RT(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)bm(t[n],e)}};function Y_(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function RT(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)Y_(i[t],e,1);e.polygonEnd()}function zv(i,e){i&&wT.hasOwnProperty(i.type)?wT[i.type](i,e):bm(i,e)}function K_(i){return[cl(i[1],i[0]),lu(i[2])]}function vA(i){var e=i[0],t=i[1],n=Pn(t);return[n*Pn(e),n*Dn(e),Dn(t)]}function Q0(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Sm(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function p2(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function Y0(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function Z_(i){var e=vc(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Df,Tm,Mm,wm,Em,Rm,Cm,Nm,J_,ex,tx,m4,g4,ts,ns,is,Io={sphere:ro,point:Hv,lineStart:CT,lineEnd:NT,polygonStart:function(){Io.lineStart=jV,Io.lineEnd=XV},polygonEnd:function(){Io.lineStart=CT,Io.lineEnd=NT}};function Hv(i,e){i*=Vn,e*=Vn;var t=Pn(e);Vd(t*Pn(i),t*Dn(i),Dn(e))}function Vd(i,e,t){++Df,Mm+=(i-Mm)/Df,wm+=(e-wm)/Df,Em+=(t-Em)/Df}function CT(){Io.point=WV}function WV(i,e){i*=Vn,e*=Vn;var t=Pn(e);ts=t*Pn(i),ns=t*Dn(i),is=Dn(e),Io.point=$V,Vd(ts,ns,is)}function $V(i,e){i*=Vn,e*=Vn;var t=Pn(e),n=t*Pn(i),r=t*Dn(i),s=Dn(e),o=cl(vc((o=ns*s-is*r)*o+(o=is*n-ts*s)*o+(o=ts*r-ns*n)*o),ts*n+ns*r+is*s);Tm+=o,Rm+=o*(ts+(ts=n)),Cm+=o*(ns+(ns=r)),Nm+=o*(is+(is=s)),Vd(ts,ns,is)}function NT(){Io.point=Hv}function jV(){Io.point=QV}function XV(){_4(m4,g4),Io.point=Hv}function QV(i,e){m4=i,g4=e,i*=Vn,e*=Vn,Io.point=_4;var t=Pn(e);ts=t*Pn(i),ns=t*Dn(i),is=Dn(e),Vd(ts,ns,is)}function _4(i,e){i*=Vn,e*=Vn;var t=Pn(e),n=t*Pn(i),r=t*Dn(i),s=Dn(e),o=ns*s-is*r,a=is*n-ts*s,l=ts*r-ns*n,u=Q_(o,a,l),d=lu(u),p=u&&-d/u;J_.add(p*o),ex.add(p*a),tx.add(p*l),Tm+=d,Rm+=d*(ts+(ts=n)),Cm+=d*(ns+(ns=r)),Nm+=d*(is+(is=s)),Vd(ts,ns,is)}function PT(i){Df=Tm=Mm=wm=Em=Rm=Cm=Nm=0,J_=new Lh,ex=new Lh,tx=new Lh,zv(i,Io);var e=+J_,t=+ex,n=+tx,r=Q_(e,t,n);return r<X_&&(e=Rm,t=Cm,n=Nm,Tm<xi&&(e=Mm,t=wm,n=Em),r=Q_(e,t,n),r<X_)?[NaN,NaN]:[cl(t,e)*es,lu(n/r)*es]}function nx(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function ix(i,e){return Gi(i)>Hn&&(i-=Math.round(i/Uo)*Uo),[i,e]}ix.invert=ix;function x4(i,e,t){return(i%=Uo)?e||t?nx(LT(i),IT(e,t)):LT(i):e||t?IT(e,t):ix}function DT(i){return function(e,t){return e+=i,Gi(e)>Hn&&(e-=Math.round(e/Uo)*Uo),[e,t]}}function LT(i){var e=DT(i);return e.invert=DT(-i),e}function IT(i,e){var t=Pn(i),n=Dn(i),r=Pn(e),s=Dn(e);function o(a,l){var u=Pn(l),d=Pn(a)*u,p=Dn(a)*u,g=Dn(l),x=g*t+d*n;return[cl(p*r-x*s,d*t-g*n),lu(x*r+p*s)]}return o.invert=function(a,l){var u=Pn(l),d=Pn(a)*u,p=Dn(a)*u,g=Dn(l),x=g*r-p*s;return[cl(p*r+g*s,d*t+x*n),lu(x*t-d*n)]},o}function YV(i){i=x4(i[0]*Vn,i[1]*Vn,i.length>2?i[2]*Vn:0);function e(t){return t=i(t[0]*Vn,t[1]*Vn),t[0]*=es,t[1]*=es,t}return e.invert=function(t){return t=i.invert(t[0]*Vn,t[1]*Vn),t[0]*=es,t[1]*=es,t},e}function KV(i,e,t,n,r,s){if(t){var o=Pn(e),a=Dn(e),l=n*t;r==null?(r=e+n*Uo,s=e-l/2):(r=BT(o,r),s=BT(o,s),(n>0?r<s:r>s)&&(r+=n*Uo));for(var u,d=r;n>0?d>s:d<s;d-=l)u=K_([o,-a*Pn(d),-a*Dn(d)]),i.point(u[0],u[1])}}function BT(i,e){e=vA(e),e[0]-=i,Z_(e);var t=HV(-e[1]);return((-e[2]<0?-t:t)+Uo-xi)%Uo}function v4(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:ro,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function $p(i,e){return Gi(i[0]-e[0])<xi&&Gi(i[1]-e[1])<xi}function K0(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function y4(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(y){if(!((T=y.length-1)<=0)){var T,S=y[0],M=y[T],R;if($p(S,M)){if(!S[2]&&!M[2]){for(r.lineStart(),a=0;a<T;++a)r.point((S=y[a])[0],S[1]);r.lineEnd();return}M[0]+=2*xi}s.push(R=new K0(S,y,null,!0)),o.push(R.o=new K0(S,null,R,!1)),s.push(R=new K0(M,y,null,!1)),o.push(R.o=new K0(M,null,R,!0))}}),!!s.length){for(o.sort(e),FT(s),FT(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var u=s[0],d,p;;){for(var g=u,x=!0;g.v;)if((g=g.n)===u)return;d=g.z,r.lineStart();do{if(g.v=g.o.v=!0,g.e){if(x)for(a=0,l=d.length;a<l;++a)r.point((p=d[a])[0],p[1]);else n(g.x,g.n.x,1,r);g=g.n}else{if(x)for(d=g.p.z,a=d.length-1;a>=0;--a)r.point((p=d[a])[0],p[1]);else n(g.x,g.p.x,-1,r);g=g.p}g=g.o,d=g.z,x=!x}while(!g.v);r.lineEnd()}}}function FT(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function m2(i){return Gi(i[0])<=Hn?i[0]:zV(i[0])*((Gi(i[0])+Hn)%Uo-Hn)}function ZV(i,e){var t=m2(e),n=e[1],r=Dn(n),s=[Dn(t),-Pn(t),0],o=0,a=0,l=new Lh;r===1?n=so+xi:r===-1&&(n=-so-xi);for(var u=0,d=i.length;u<d;++u)if(g=(p=i[u]).length)for(var p,g,x=p[g-1],y=m2(x),T=x[1]/2+MT,S=Dn(T),M=Pn(T),R=0;R<g;++R,y=N,S=L,M=F,x=E){var E=p[R],N=m2(E),U=E[1]/2+MT,L=Dn(U),F=Pn(U),P=N-y,I=P>=0?1:-1,$=I*P,k=$>Hn,W=S*L;if(l.add(cl(W*I*Dn($),M*F+W*Pn($))),o+=k?P+I*Uo:P,k^y>=t^N>=t){var j=Sm(vA(x),vA(E));Z_(j);var Y=Sm(s,j);Z_(Y);var z=(k^P>=0?-1:1)*lu(Y[2]);(n>z||n===z&&(j[0]||j[1]))&&(a+=k^P>=0?1:-1)}}return(o<-xi||o<xi&&l<-X_)^a&1}function b4(i,e,t,n){return function(r){var s=e(r),o=v4(),a=e(o),l=!1,u,d,p,g={point:x,lineStart:T,lineEnd:S,polygonStart:function(){g.point=M,g.lineStart=R,g.lineEnd=E,d=[],u=[]},polygonEnd:function(){g.point=x,g.lineStart=T,g.lineEnd=S,d=pd(d);var N=ZV(u,n);d.length?(l||(r.polygonStart(),l=!0),y4(d,eq,N,t,r)):N&&(l||(r.polygonStart(),l=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),l&&(r.polygonEnd(),l=!1),d=u=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function x(N,U){i(N,U)&&r.point(N,U)}function y(N,U){s.point(N,U)}function T(){g.point=y,s.lineStart()}function S(){g.point=x,s.lineEnd()}function M(N,U){p.push([N,U]),a.point(N,U)}function R(){a.lineStart(),p=[]}function E(){M(p[0][0],p[0][1]),a.lineEnd();var N=a.clean(),U=o.result(),L,F=U.length,P,I,$;if(p.pop(),u.push(p),p=null,!!F){if(N&1){if(I=U[0],(P=I.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),L=0;L<P;++L)r.point(($=I[L])[0],$[1]);r.lineEnd()}return}F>1&&N&2&&U.push(U.pop().concat(U.shift())),d.push(U.filter(JV))}}return g}}function JV(i){return i.length>1}function eq(i,e){return((i=i.x)[0]<0?i[1]-so-xi:so-i[1])-((e=e.x)[0]<0?e[1]-so-xi:so-e[1])}const UT=b4(function(){return!0},tq,iq,[-Hn,-so]);function tq(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?Hn:-Hn,l=Gi(s-e);Gi(l-Hn)<xi?(i.point(e,t=(t+o)/2>0?so:-so),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=Hn&&(Gi(e-n)<xi&&(e-=n*xi),Gi(s-a)<xi&&(s-=a*xi),t=nq(e,t,s,o),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),r=0),i.point(e=s,t=o),n=a},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function nq(i,e,t,n){var r,s,o=Dn(i-t);return Gi(o)>xi?p4((Dn(e)*(s=Pn(n))*Dn(t)-Dn(n)*(r=Pn(e))*Dn(i))/(r*s*o)):(e+n)/2}function iq(i,e,t,n){var r;if(i==null)r=t*so,n.point(-Hn,r),n.point(0,r),n.point(Hn,r),n.point(Hn,0),n.point(Hn,-r),n.point(0,-r),n.point(-Hn,-r),n.point(-Hn,0),n.point(-Hn,r);else if(Gi(i[0]-e[0])>xi){var s=i[0]<e[0]?Hn:-Hn;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function rq(i){var e=Pn(i),t=2*Vn,n=e>0,r=Gi(e)>xi;function s(d,p,g,x){KV(x,i,t,g,d,p)}function o(d,p){return Pn(d)*Pn(p)>e}function a(d){var p,g,x,y,T;return{lineStart:function(){y=x=!1,T=1},point:function(S,M){var R=[S,M],E,N=o(S,M),U=n?N?0:u(S,M):N?u(S+(S<0?Hn:-Hn),M):0;if(!p&&(y=x=N)&&d.lineStart(),N!==x&&(E=l(p,R),(!E||$p(p,E)||$p(R,E))&&(R[2]=1)),N!==x)T=0,N?(d.lineStart(),E=l(R,p),d.point(E[0],E[1])):(E=l(p,R),d.point(E[0],E[1],2),d.lineEnd()),p=E;else if(r&&p&&n^N){var L;!(U&g)&&(L=l(R,p,!0))&&(T=0,n?(d.lineStart(),d.point(L[0][0],L[0][1]),d.point(L[1][0],L[1][1]),d.lineEnd()):(d.point(L[1][0],L[1][1]),d.lineEnd(),d.lineStart(),d.point(L[0][0],L[0][1],3)))}N&&(!p||!$p(p,R))&&d.point(R[0],R[1]),p=R,x=N,g=U},lineEnd:function(){x&&d.lineEnd(),p=null},clean:function(){return T|(y&&x)<<1}}}function l(d,p,g){var x=vA(d),y=vA(p),T=[1,0,0],S=Sm(x,y),M=Q0(S,S),R=S[0],E=M-R*R;if(!E)return!g&&d;var N=e*M/E,U=-e*R/E,L=Sm(T,S),F=Y0(T,N),P=Y0(S,U);p2(F,P);var I=L,$=Q0(F,I),k=Q0(I,I),W=$*$-k*(Q0(F,F)-1);if(!(W<0)){var j=vc(W),Y=Y0(I,(-$-j)/k);if(p2(Y,F),Y=K_(Y),!g)return Y;
vendor: 4,981 bytes, line 4065
4065var z=d[0],Q=p[0],ee=d[1],fe=p[1],le;Q<z&&(le=z,z=Q,Q=le);var Me=Q-z,Ce=Gi(Me-Hn)<xi,Be=Ce||Me<xi;if(!Ce&&fe<ee&&(le=ee,ee=fe,fe=le),Be?Ce?ee+fe>0^Y[1]<(Gi(Y[0]-z)<xi?ee:fe):ee<=Y[1]&&Y[1]<=fe:Me>Hn^(z<=Y[0]&&Y[0]<=Q)){var Ye=Y0(I,(-$+j)/k);return p2(Ye,F),[Y,K_(Ye)]}}}function u(d,p){var g=n?i:Hn-i,x=0;return d<-g?x|=1:d>g&&(x|=2),p<-g?x|=4:p>g&&(x|=8),x}return b4(o,a,s,n?[0,-i]:[-Hn,i-Hn])}function sq(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],u=e[1],d=0,p=1,g=l-o,x=u-a,y;if(y=t-o,!(!g&&y>0)){if(y/=g,g<0){if(y<d)return;y<p&&(p=y)}else if(g>0){if(y>p)return;y>d&&(d=y)}if(y=r-o,!(!g&&y<0)){if(y/=g,g<0){if(y>p)return;y>d&&(d=y)}else if(g>0){if(y<d)return;y<p&&(p=y)}if(y=n-a,!(!x&&y>0)){if(y/=x,x<0){if(y<d)return;y<p&&(p=y)}else if(x>0){if(y>p)return;y>d&&(d=y)}if(y=s-a,!(!x&&y<0)){if(y/=x,x<0){if(y>p)return;y>d&&(d=y)}else if(x>0){if(y<d)return;y<p&&(p=y)}return d>0&&(i[0]=o+d*g,i[1]=a+d*x),p<1&&(e[0]=o+p*g,e[1]=a+p*x),!0}}}}}var Lf=1e9,Z0=-Lf;function oq(i,e,t,n){function r(u,d){return i<=u&&u<=t&&e<=d&&d<=n}function s(u,d,p,g){var x=0,y=0;if(u==null||(x=o(u,p))!==(y=o(d,p))||l(u,d)<0^p>0)do g.point(x===0||x===3?i:t,x>1?n:e);while((x=(x+p+4)%4)!==y);else g.point(d[0],d[1])}function o(u,d){return Gi(u[0]-i)<xi?d>0?0:3:Gi(u[0]-t)<xi?d>0?2:1:Gi(u[1]-e)<xi?d>0?1:0:d>0?3:2}function a(u,d){return l(u.x,d.x)}function l(u,d){var p=o(u,1),g=o(d,1);return p!==g?p-g:p===0?d[1]-u[1]:p===1?u[0]-d[0]:p===2?u[1]-d[1]:d[0]-u[0]}return function(u){var d=u,p=v4(),g,x,y,T,S,M,R,E,N,U,L,F={point:P,lineStart:W,lineEnd:j,polygonStart:$,polygonEnd:k};function P(z,Q){r(z,Q)&&d.point(z,Q)}function I(){for(var z=0,Q=0,ee=x.length;Q<ee;++Q)for(var fe=x[Q],le=1,Me=fe.length,Ce=fe[0],Be,Ye,qt=Ce[0],bt=Ce[1];le<Me;++le)Be=qt,Ye=bt,Ce=fe[le],qt=Ce[0],bt=Ce[1],Ye<=n?bt>n&&(qt-Be)*(n-Ye)>(bt-Ye)*(i-Be)&&++z:bt<=n&&(qt-Be)*(n-Ye)<(bt-Ye)*(i-Be)&&--z;return z}function $(){d=p,g=[],x=[],L=!0}function k(){var z=I(),Q=L&&z,ee=(g=pd(g)).length;(Q||ee)&&(u.polygonStart(),Q&&(u.lineStart(),s(null,null,1,u),u.lineEnd()),ee&&y4(g,a,z,s,u),u.polygonEnd()),d=u,g=x=y=null}function W(){F.point=Y,x&&x.push(y=[]),U=!0,N=!1,R=E=NaN}function j(){g&&(Y(T,S),M&&N&&p.rejoin(),g.push(p.result())),F.point=P,N&&d.lineEnd()}function Y(z,Q){var ee=r(z,Q);if(x&&y.push([z,Q]),U)T=z,S=Q,M=ee,U=!1,ee&&(d.lineStart(),d.point(z,Q));else if(ee&&N)d.point(z,Q);else{var fe=[R=Math.max(Z0,Math.min(Lf,R)),E=Math.max(Z0,Math.min(Lf,E))],le=[z=Math.max(Z0,Math.min(Lf,z)),Q=Math.max(Z0,Math.min(Lf,Q))];sq(fe,le,i,e,t,n)?(N||(d.lineStart(),d.point(fe[0],fe[1])),d.point(le[0],le[1]),ee||d.lineEnd(),L=!1):ee&&(d.lineStart(),d.point(z,Q),L=!1)}R=z,E=Q,N=ee}return F}}var rx,sx,jp,Xp,yA={sphere:ro,point:ro,lineStart:aq,lineEnd:ro,polygonStart:ro,polygonEnd:ro};function aq(){yA.point=uq,yA.lineEnd=lq}function lq(){yA.point=yA.lineEnd=ro}function uq(i,e){i*=Vn,e*=Vn,sx=i,jp=Dn(e),Xp=Pn(e),yA.point=cq}function cq(i,e){i*=Vn,e*=Vn;var t=Dn(e),n=Pn(e),r=Gi(i-sx),s=Pn(r),o=Dn(r),a=n*o,l=Xp*t-jp*n*s,u=jp*t+Xp*n*s;rx.add(cl(vc(a*a+l*l),u)),sx=i,jp=t,Xp=n}function hq(i){return rx=new Lh,zv(i,yA),+rx}var ox=[null,null],Aq={type:"LineString",coordinates:ox};function OT(i,e){return ox[0]=i,ox[1]=e,hq(Aq)}const kT=i=>i;var bA=1/0,Pm=bA,Sd=-bA,Dm=Sd,GT={point:fq,lineStart:ro,lineEnd:ro,polygonStart:ro,polygonEnd:ro,result:function(){var i=[[bA,Pm],[Sd,Dm]];return Sd=Dm=-(Pm=bA=1/0),i}};function fq(i,e){i<bA&&(bA=i),i>Sd&&(Sd=i),e<Pm&&(Pm=e),e>Dm&&(Dm=e)}function Wv(i){return function(e){var t=new ax;for(var n in i)t[n]=i[n];return t.stream=e,t}}function ax(){}ax.prototype={constructor:ax,point:function(i,e){this.stream.point(i,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function $v(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),zv(t,i.stream(GT)),e(GT.result()),n!=null&&i.clipExtent(n),i}function S4(i,e,t){return $v(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;i.scale(150*o).translate([a,l])},t)}function dq(i,e,t){return S4(i,[[0,0],e],t)}function pq(i,e,t){return $v(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),o=(r-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];i.scale(150*s).translate([o,a])},t)}function mq(i,e,t){return $v(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([o,a])},t)}var VT=16,gq=Pn(30*Vn);function qT(i,e){return+e?xq(i,e):_q(i)}function _q(i){return Wv({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function xq(i,e){function t(n,r,s,o,a,l,u,d,p,g,x,y,T,S){var M=u-n,R=d-r,E=M*M+R*R;if(E>4*e&&T--){var N=o+g,U=a+x,L=l+y,F=vc(N*N+U*U+L*L),P=lu(L/=F),I=Gi(Gi(L)-1)<xi||Gi(s-p)<xi?(s+p)/2:cl(U,N),$=i(I,P),k=$[0],W=$[1],j=k-n,Y=W-r,z
vendor: 1,203 bytes, line 4065
4065=R*j-M*Y;(z*z/E>e||Gi((M*j+R*Y)/E-.5)>.3||o*g+a*x+l*y<gq)&&(t(n,r,s,o,a,l,k,W,I,N/=F,U/=F,L,T,S),S.point(k,W),t(k,W,I,N,U,L,u,d,p,g,x,y,T,S))}}return function(n){var r,s,o,a,l,u,d,p,g,x,y,T,S={point:M,lineStart:R,lineEnd:N,polygonStart:function(){n.polygonStart(),S.lineStart=U},polygonEnd:function(){n.polygonEnd(),S.lineStart=R}};function M(P,I){P=i(P,I),n.point(P[0],P[1])}function R(){p=NaN,S.point=E,n.lineStart()}function E(P,I){var $=vA([P,I]),k=i(P,I);t(p,g,d,x,y,T,p=k[0],g=k[1],d=P,x=$[0],y=$[1],T=$[2],VT,n),n.point(p,g)}function N(){S.point=M,n.lineEnd()}function U(){R(),S.point=L,S.lineEnd=F}function L(P,I){E(r=P,I),s=p,o=g,a=x,l=y,u=T,S.point=E}function F(){t(p,g,d,x,y,T,s,o,r,a,l,u,VT,n),S.lineEnd=N,N()}return S}}var vq=Wv({point:function(i,e){this.stream.point(i*Vn,e*Vn)}});function yq(i){return Wv({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function bq(i,e,t,n,r){function s(o,a){return o*=n,a*=r,[e+i*o,t-i*a]}return s.invert=function(o,a){return[(o-e)/i*n,(t-a)/i*r]},s}function zT(i,e,t,n,r,s){if(!s)return bq(i,e,t,n,r);var o=Pn(s),a=Dn(s),l=o*i,u=a*i,d=o/i,p=a/i,g=(a*t-o*e)/i,x=(a*e+o*t)/i;function y(T,S){return T*=n,S*=r,[l*T-u*S+e,t-u*T-l*S]}
4065return y.invert=function(T,S){return[n*(d*T-p*S+g),r*(x-p*T-d*S)]},y}function Sq(i){return Tq(function(){return i})()}function Tq(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,u=0,d,p=0,g=1,x=1,y=null,T=UT,S=null,M,R,E,N=kT,U=.5,L,F,P,I,$;function k(z){return P(z[0]*Vn,z[1]*Vn)}function W(z){return z=P.invert(z[0],z[1]),z&&[z[0]*es,z[1]*es]}k.stream=function(z){return I&&$===z?I:I=vq(yq(d)(T(L(N($=z)))))},k.preclip=function(z){return arguments.length?(T=z,y=void 0,Y()):T},k.postclip=function(z){return arguments.length?(N=z,S=M=R=E=null,Y()):N},k.clipAngle=function(z){return arguments.length?(T=+z?rq(y=z*Vn):(y=null,UT),Y()):y*es},k.clipExtent=function(z){return arguments.length?(N=z==null?(S=M=R=E=null,kT):oq(S=+z[0][0],M=+z[0][1],R=+z[1][0],E=+z[1][1]),Y()):S==null?null:[[S,M],[R,E]]},k.scale=function(z){return arguments.length?(t=+z,j()):t},k.translate=function(z){return arguments.length?(n=+z[0],r=+z[1],j()):[n,r]},k.center=function(z){return arguments.length?(s=z[0]%360*Vn,o=z[1]%360*Vn,j()):[s*es,o*es]},k.rotate=function(z){return arguments.length?(a=z[0]%360*Vn,l=z[1]%360*Vn,u=z.length>2?z[2]%360*Vn:0,j()):[a*es,l*es,u*es]},k.angle=function(z){return arguments.length?(p=z%360*Vn,j()):p*es},k.reflectX=function(z){return arguments.length?(g=z?-1:1,j()):g<0},k.reflectY=function(z){return arguments.length?(x=z?-1:1,j()):x<0},k.precision=function(z){return arguments.length?(L=qT(F,U=z*z),Y()):vc(U)},k.fitExtent=function(z,Q){return S4(k,z,Q)},k.fitSize=function(z,Q){return dq(k,z,Q)},k.fitWidth=function(z,Q){return pq(k,z,Q)},k.fitHeight=function(z,Q){return mq(k,z,Q)};function j(){var z=zT(t,0,0,g,x,p).apply(null,e(s,o)),Q=zT(t,n-z[0],r-z[1],g,x,p);return d=x4(a,l,u),F=nx(e,Q),P=nx(d,F),L=qT(F,U),Y()}function Y(){return I=$=null,k}return function(){return e=i.apply(this,arguments),k.invert=e.invert&&W,j()}}function Mq(i){return function(e,t){var n=vc(e*e+t*t),r=i(n),s=Dn(r),o=Pn(r);return[cl(e*s,n*o),lu(n&&t*s/n)]}}function T4(i,e){var t=Pn(e),n=1+Pn(i)*t;return[t*Dn(i)/n,Dn(e)/n]}T4.invert=Mq(function(i){return 2*p4(i)});function wq(){return Sq(T4).scale(250).clipAngle(142)}const jv=Math.PI,HT=jv/2,WT=180/jv,$T=jv/180,Eq=Math.atan2,jT=Math.cos,Rq=Math.max,Cq=Math.min,XT=Math.sin,Nq=Math.sign||function(i){return i>0?1:i<0?-1:0},M4=Math.sqrt;function Pq(i){return i>1?HT:i<-1?-HT:Math.asin(i)}function w4(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Gs(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function Lm(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Im(i){var e=M4(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function Xv(i){return[Eq(i[1],i[0])*WT,Pq(Rq(-1,Cq(1,i[2])))*WT]}function va(i){const e=i[0]*$T,t=i[1]*$T,n=jT(t);return[n*jT(e),n*XT(e),XT(t)]}function Qv(i){return i=i.map(e=>va(e)),w4(i[0],Gs(i[2],i[1]))}function Dq(i){const e=Iq(i),t=Fq(e),n=Bq(t,i),r=Oq(t,i.length),s=Lq(r,i),o=Uq(t,i),{polygons:a,centers:l}=kq(o,t,i),u=Gq(a),d=qq(t,i),p=Vq(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:u,hull:d,urquhart:p,find:s}}function Lq(i,e){function t(n,r){let s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];return s*s+o*o+a*a}return function(r,s,o){o===void 0&&(o=0);let a,l,u=o;const d=va([r,s]);do a=o,o=null,l=t(d,va(e[a])),i[a].forEach(p=>{let g=t(d,va(e[p]));if(g<l){l=g,o=p,u=p;return}});while(o!==null);return u}}function Iq(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);const t=YV(i[e]),n=wq().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);const r=[];let s=1;for(let p=0,g=i.length;p<g;p++){let x=i[p][0]**2+i[p][1]**2;!isFinite(x)||x>1e32?r.push(p):x>s&&(s=x)}const o=1e6*M4(s);r.forEach(p=>i[p]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);const a=qv.from(i);a.projection=n;const{triangles:l,halfedges:u,inedges:d}=a;for(let p=0,g=u.length;p<g;p++)if(u[p]<0){const x=p%3==2?p-2:p+1,y=p%3==0?p+2:p-1,T=u[x],S=u[y];u[T]=S,u[S]=T,u[x]=u[y]=-1,l[p]=l[x]=l[y]=e,d[l[T]]=T%3==0?T+2:T-1,d[l[S]]=S%3==0?S+2:S-1,p+=2-p%3}else l[p]>i.length-3-1&&(l[p]=e);return a}function Bq(i,e){const t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(Qv(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(um([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function Fq(i){const{triangles:e}=i;if(!e)return[];const t=[];for(let n=0,r=e.length/3;n<r;
4065n++){const s=e[3*n],o=e[3*n+1],a=e[3*n+2];s!==o&&o!==a&&t.push([s,a,o])}return t}function Uq(i,e){return i.map(t=>{const n=t.map(s=>e[s]).map(va),r=Lm(Lm(Gs(n[1],n[0]),Gs(n[2],n[1])),Gs(n[0],n[2]));return Xv(Im(r))})}function Oq(i,e){const t=[];return i.forEach(n=>{for(let r=0;r<3;r++){const s=n[r],o=n[(r+1)%3];t[s]=t[s]||[],t[s].push(o)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function kq(i,e,t){const n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){const a=va(t[0]),l=va(t[1]),u=Im(Lm(a,l)),d=Im(Gs(a,l)),p=Gs(u,d),g=[u,Gs(u,p),Gs(Gs(u,p),p),Gs(Gs(Gs(u,p),p),p)].map(Xv).map(o);return n.push(g),n.push(g.slice().reverse()),{polygons:n,centers:r}}}e.forEach((a,l)=>{for(let u=0;u<3;u++){const d=a[u],p=a[(u+1)%3],g=a[(u+2)%3];n[d]=n[d]||[],n[d].push([p,g,l,[d,p,g]])}});const s=n.map(a=>{const l=[a[0][2]];let u=a[0][1];for(let d=1;d<a.length;d++)for(let p=0;p<a.length;p++)if(a[p][0]==u){u=a[p][1],l.push(a[p][2]);break}if(l.length>2)return l;if(l.length==2){const d=QT(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),p=QT(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),g=o(d),x=o(p);return[l[0],x,l[1],g]}});function o(a){let l=-1;return r.slice(e.length,1/0).forEach((u,d)=>{u[0]===a[0]&&u[1]===a[1]&&(l=d+e.length)}),l<0&&(l=r.length,r.push(a)),l}return{polygons:s,centers:r}}function QT(i,e,t){i=va(i),e=va(e),t=va(t);const n=Nq(w4(Gs(e,i),t));return Xv(Im(Lm(i,e)).map(r=>n*r))}function Gq(i){const e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function Vq(i,e){return function(t){const n=new Map,r=new Map;return i.forEach((s,o)=>{const a=s.join("-");n.set(a,t[o]),r.set(a,!0)}),e.forEach(s=>{let o=0,a=-1;for(let l=0;l<3;l++){let u=um([s[l],s[(l+1)%3]]).join("-");n.get(u)>o&&(o=n.get(u),a=u)}r.set(a,!1)}),i.map(s=>r.get(s.join("-")))}}function qq(i,e){const t=new Set,n=[];i.map(a=>{if(!(Qv(a.map(l=>e[l>e.length?0:l]))>1e-12))for(let l=0;l<3;l++){let u=[a[l],a[(l+1)%3]],d=`${u[0]}-${u[1]}`;t.has(d)?t.delete(d):t.add(`${u[1]}-${u[0]}`)}});const r=new Map;let s;if(t.forEach(a=>{a=a.split("-").map(Number),r.set(a[0],a[1]),s=a[0]}),s===void 0)return n;let o=s;do{n.push(o);let a=r.get(o);r.set(o,-1),o=a}while(o>-1&&o!==s);return n}function zq(i){const e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){const n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=Dq(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return PT(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return PT(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;const n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(o=>e.delaunay.centers[o])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>Qv(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;const n=e.delaunay.edges.map(s=>OT(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,o)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[o],urquhart:!!r[o]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;const{centers:n,polygons:r}=e.delaunay,s=[];for(const o of r)if(o)for(let a=o.length,l=o[a-1],u=o[0],d=0;d<a;l=u,u=o[++d])u>l&&s.push([n[l],n[u]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||OT([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);const n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function lx(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Hq(i){if(Array.isArray(i))return i}function Wq(i){if(Array.isArray(i))return lx(i)}function $q(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function jq(i,e,t){return e=Bm(e),tz(i,E4()?Reflect.construct(e,[],Bm(i).constructor):e.apply(i,t))}function Xq(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Qq(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Bm(i){return Bm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Bm(i)}function Yq(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&ux(i,e)}function E4(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(E4=function(){return!!i})()}function Kq(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Zq(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(d){u=!0,r=d}
4065finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}function Jq(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 4066In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ez(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 4067In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tz(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $q(i)}function ux(i,e){return ux=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ux(i,e)}function la(i,e){return Hq(i)||Zq(i,e)||R4(i,e)||Jq()}function g2(i){return Wq(i)||Kq(i)||R4(i)||ez()}function R4(i,e){if(i){if(typeof i=="string")return lx(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?lx(i,e):void 0}}function nz(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=iz(i,n),s=pd(r),o=rz(i,n),a=[].concat(g2(s),g2(o)),l={type:"Polygon",coordinates:i},u=Ww(l),d=la(u,2),p=la(d[0],2),g=p[0],x=p[1],y=la(d[1],2),T=y[0],S=y[1],M=g>T||S>=89||x<=-89,R=[];if(M){var E=zq(a).triangles(),N=new Map(a.map(function(ee,fe){var le=la(ee,2),Me=le[0],Ce=le[1];return["".concat(Me,"-").concat(Ce),fe]}));E.features.forEach(function(ee){var fe,le=ee.geometry.coordinates[0].slice(0,3).reverse(),Me=[];if(le.forEach(function(Be){var Ye=la(Be,2),qt=Ye[0],bt=Ye[1],Re="".concat(qt,"-").concat(bt);N.has(Re)&&Me.push(N.get(Re))}),Me.length===3){if(Me.some(function(Be){return Be<s.length})){var Ce=ee.properties.circumcenter;if(!cx(Ce,l,M))return}(fe=R).push.apply(fe,Me)}})}else if(o.length)for(var I=bd.from(a),$=function(fe){var le,Me=[2,1,0].map(function(Ye){return I.triangles[fe+Ye]}),Ce=Me.map(function(Ye){return a[Ye]});if(Me.some(function(Ye){return Ye<s.length})){var Be=[0,1].map(function(Ye){return uO(Ce,function(qt){return qt[Ye]})});if(!cx(Be,l,M))return 1}(le=R).push.apply(le,g2(Me))},k=0,W=I.triangles.length;k<W;k+=3)$(k);else{var U=gm(r),L=U.vertices,F=U.holes,P=F===void 0?[]:F;R=Sk(L,P,2)}var j=ul(um(a,function(ee){return ee[0]}),[0,1]),Y=ul(um(a,function(ee){return ee[1]}),[0,1]),z=a.map(function(ee){var fe=la(ee,2),le=fe[0],Me=fe[1];return[j(le),Y(Me)]}),Q={points:a,indices:R,uvs:z};return{contour:r,triangles:Q}}function iz(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=zw(s,r)*180/Math.PI;if(o>e)for(var a=Hw(r,s),l=1/Math.ceil(o/e),u=l;u<1;)n.push(a(u)),u+=l}n.push(r=s)}),n})}function rz(i,e){var t={type:"Polygon",coordinates:i},n=Ww(t),r=la(n,2),s=la(r[0],2),o=s[0],a=s[1],l=la(r[1],2),u=l[0],d=l[1];if(Math.min(Math.abs(u-o),Math.abs(d-a))<e)return[];var p=o>u||d>=89||a<=-89;return sz(e,{minLng:o,maxLng:u,minLat:a,maxLat:d}).filter(function(g){return cx(g,t,p)})}function sz(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,o=Math.round(Math.pow(360/i,2)/Math.PI),a=(1+Math.sqrt(5))/2,l=function(M){return M/a*360%360-180},u=function(M){return Math.acos(2*M/o-1)/Math.PI*180-90},d=function(M){return o*(Math.cos((M+90)*Math.PI/180)+1)/2},p=[s!==void 0?Math.ceil(d(s)):0,r!==void 0?Math.floor(d(r)):o-1],g=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(S){return S<=n}:n===void 0?function(S){return S>=t}:n>=t?function(S){return S>=t&&S<=n}:function(S){return S>=t||S<=n},x=[],y=p[0];y<=p[1];y++){var T=l(y);g(T)&&x.push([T,u(y)])}return x}function cx(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?BP(e,i):IV(i,e)}var Qp=window.THREE?window.THREE:{BufferGeometry:Wn,Float32BufferAttribute:Fn},YT=new Qp.BufferGeometry().setAttribute?"setAttribute":"addAttribute",Yv=function(i){function e(t,n,r,s,o,a,l){var u;Xq(this,e),u=jq(this,e),u.type="ConicPolygonGeometry",u.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:o,includeSides:a,curvatureResolution:l},n=n||0,r=r||1,s=s!==void 0?s:!0,o=o!==void 0?o:!0,a=a!==void 0?a:!0,l=l||5;var d=nz(t,{resolution:l}),p=d.contour,g=d.triangles,x=pd(g.uvs),y=[],T=[],S=[],M=0,R=function(F){var P=Math.round(y.length/3),I=S.length;y=y.concat(F.vertices),T=T.concat(F.uvs),S=S.concat(P?F.indices.map(function($){return $+P}):F.indices),u.addGroup(I,S.length-I,M++)};a&&R(N()),s&&R(U(n,!1)),o&&R(U(r,!0)),u.setIndex(S),u[YT]("position",new Qp.Float32BufferAttribute(y,3)),u[YT]("uv",new Qp.Float32BufferAttribute(T,2)),u.computeVertexNormals();function E(L,F){var P=typeof F=="function"?F:function(){return F},I=L.map(function($){return $.map(function(k){var W=la(k,2),j=W[0],Y=W[1];return oz(Y,j,P(j,Y))})});return gm(I)}function N(){for(var L=E(p,n),F=L.vertices,P=L.holes,I=E(p,r),$=I.vertices,k=pd([$,F]),W=Math.round($.length/3),j=new Set(P),Y=0,z=[],Q=0;Q<W;Q++){var ee=Q+1;
4067if(ee===W)ee=Y;else if(j.has(ee)){var fe=ee;ee=Y,Y=fe}z.push(Q,Q+W,ee+W),z.push(ee+W,ee,Q)}for(var le=[],Me=1;Me>=0;Me--)for(var Ce=0;Ce<W;Ce+=1)le.push(Ce/(W-1),Me);return{indices:z,vertices:k,uvs:le}}function U(L){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:F?g.indices:g.indices.slice().reverse(),vertices:E([g.points],L).vertices,uvs:x}}return u}return Yq(e,i),Qq(e)}(Qp.BufferGeometry);function oz(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function hx(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function az(i){if(Array.isArray(i))return i}function lz(i){if(Array.isArray(i))return hx(i)}function uz(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function cz(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(d){u=!0,r=d}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}function hz(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 4068In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Az(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 4069In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fz(i,e){if(i==null)return{};var t,n,r=dz(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function dz(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function pz(i,e){return az(i)||cz(i,e)||C4(i,e)||hz()}function mz(i){return lz(i)||uz(i)||C4(i)||Az()}function gz(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function _z(i){var e=gz(i,"string");return typeof e=="symbol"?e:e+""}function C4(i,e){if(i){if(typeof i=="string")return hx(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?hx(i,e):void 0}}var xz=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(a){return{keyAccessor:a,isProp:!(a instanceof Function)}}),s=i.reduce(function(a,l){var u=a,d=l;return r.forEach(function(p,g){var x=p.keyAccessor,y=p.isProp,T;if(y){var S=d,M=S[x],R=fz(S,[x].map(_z));T=M,d=R}else T=x(d,g);g+1<r.length?(u.hasOwnProperty(T)||(u[T]={}),u=u[T]):t?(u.hasOwnProperty(T)||(u[T]=[]),u[T].push(d)):u[T]=d}),a},{});t instanceof Function&&function a(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;u===r.length?Object.keys(l).forEach(function(d){return l[d]=t(l[d])}):Object.values(l).forEach(function(d){return a(d,u+1)})}(s);var o=s;return n&&(o=[],function a(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];u.length===r.length?o.push({keys:u,vals:l}):Object.entries(l).forEach(function(d){var p=pz(d,2),g=p[0],x=p[1];return a(x,[].concat(mz(u),[g]))})}(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o},Bn=function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r="";function s(Se){return e.locateFile?e.locateFile(Se,r):r+Se}var o;typeof document<"u"&&document.currentScript&&(r=document.currentScript.src),r.indexOf("blob:")!==0?r=r.substr(0,r.lastIndexOf("/")+1):r="",o=function(Fe,At,Ve){var A=new XMLHttpRequest;A.open("GET",Fe,!0),A.responseType="arraybuffer",A.onload=function(){if(A.status==200||A.status==0&&A.response){At(A.response);return}var Cn=ht(Fe);if(Cn){At(Cn.buffer);return}Ve()},A.onerror=Ve,A.send(null)};var a=e.print||console.log.bind(console),l=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&e.arguments;var u=0,d=function(Se){u=Se},p=function(){return u},g=8;function x(Se,Fe,At,Ve){switch(At=At||"i8",At.charAt(At.length-1)==="*"&&(At="i32"),At){case"i1":W[Se>>0]=Fe;break;case"i8":W[Se>>0]=Fe;break;case"i16":Y[Se>>
40691]=Fe;break;case"i32":z[Se>>2]=Fe;break;case"i64":de=[Fe>>>0,(V=Fe,+Ut(V)>=1?V>0?(He(+Je(V/4294967296),4294967295)|0)>>>0:~~+Ue((V-+(~~V>>>0))/4294967296)>>>0:0)],z[Se>>2]=de[0],z[Se+4>>2]=de[1];break;case"float":Q[Se>>2]=Fe;break;case"double":ee[Se>>3]=Fe;break;default:qo("invalid type for setValue: "+At)}}function y(Se,Fe,At){switch(Fe=Fe||"i8",Fe.charAt(Fe.length-1)==="*"&&(Fe="i32"),Fe){case"i1":return W[Se>>0];case"i8":return W[Se>>0];case"i16":return Y[Se>>1];case"i32":return z[Se>>2];case"i64":return z[Se>>2];case"float":return Q[Se>>2];case"double":return ee[Se>>3];default:qo("invalid type for getValue: "+Fe)}return null}var T=!1;function S(Se,Fe){Se||qo("Assertion failed: "+Fe)}function M(Se){var Fe=e["_"+Se];return S(Fe,"Cannot call unknown function "+Se+", make sure it is exported"),Fe}function R(Se,Fe,At,Ve,A){var H={string:function(xn){var fs=0;if(xn!=null&&xn!==0){var wc=(xn.length<<2)+1;fs=Bt(wc),P(xn,fs,wc)}return fs},array:function(xn){var fs=Bt(xn.length);return I(xn,fs),fs}};function Cn(xn){return Fe==="string"?L(xn):Fe==="boolean"?!!xn:xn}var Un=M(Se),ji=[],mn=0;if(Ve)for(var Ln=0;Ln<Ve.length;Ln++){var zo=H[At[Ln]];zo?(mn===0&&(mn=ci()),ji[Ln]=zo(Ve[Ln])):ji[Ln]=Ve[Ln]}var kn=Un.apply(null,ji);return kn=Cn(kn),mn!==0&&fn(mn),kn}function E(Se,Fe,At,Ve){At=At||[];var A=At.every(function(Cn){return Cn==="number"}),H=Fe!=="string";return H&&A&&!Ve?M(Se):function(){return R(Se,Fe,At,arguments)}}var N=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function U(Se,Fe,At){for(var Ve=Fe+At,A=Fe;Se[A]&&!(A>=Ve);)++A;if(A-Fe>16&&Se.subarray&&N)return N.decode(Se.subarray(Fe,A));for(var H="";Fe<A;){var Cn=Se[Fe++];if(!(Cn&128)){H+=String.fromCharCode(Cn);continue}var Un=Se[Fe++]&63;if((Cn&224)==192){H+=String.fromCharCode((Cn&31)<<6|Un);continue}var ji=Se[Fe++]&63;if((Cn&240)==224?Cn=(Cn&15)<<12|Un<<6|ji:Cn=(Cn&7)<<18|Un<<12|ji<<6|Se[Fe++]&63,Cn<65536)H+=String.fromCharCode(Cn);else{var mn=Cn-65536;H+=String.fromCharCode(55296|mn>>10,56320|mn&1023)}}return H}function L(Se,Fe){return Se?U(j,Se,Fe):""}function F(Se,Fe,At,Ve){if(!(Ve>0))return 0;for(var A=At,H=At+Ve-1,Cn=0;Cn<Se.length;++Cn){var Un=Se.charCodeAt(Cn);if(Un>=55296&&Un<=57343){var ji=Se.charCodeAt(++Cn);Un=65536+((Un&1023)<<10)|ji&1023}if(Un<=127){if(At>=H)break;Fe[At++]=Un}else if(Un<=2047){if(At+1>=H)break;Fe[At++]=192|Un>>6,Fe[At++]=128|Un&63}else if(Un<=65535){if(At+2>=H)break;Fe[At++]=224|Un>>12,Fe[At++]=128|Un>>6&63,Fe[At++]=128|Un&63}else{if(At+3>=H)break;Fe[At++]=240|Un>>18,Fe[At++]=128|Un>>12&63,Fe[At++]=128|Un>>6&63,Fe[At++]=128|Un&63}}return Fe[At]=0,At-A}function P(Se,Fe,At){return F(Se,j,Fe,At)}typeof TextDecoder<"u"&&new TextDecoder("utf-16le");function I(Se,Fe){W.set(Se,Fe)}function $(Se,Fe){return Se%Fe>0&&(Se+=Fe-Se%Fe),Se}var k,W,j,Y,z,Q,ee;function fe(Se){k=Se,e.HEAP8=W=new Int8Array(Se),e.HEAP16=Y=new Int16Array(Se),e.HEAP32=z=new Int32Array(Se),e.HEAPU8=j=new Uint8Array(Se),e.HEAPU16=new Uint16Array(Se),e.HEAPU32=new Uint32Array(Se),e.HEAPF32=Q=new Float32Array(Se),e.HEAPF64=ee=new Float64Array(Se)}var le=5271536,Me=28624,Ce=e.TOTAL_MEMORY||33554432;e.buffer?k=e.buffer:k=new ArrayBuffer(Ce),Ce=k.byteLength,fe(k),z[Me>>2]=le;function Be(Se){for(;Se.length>0;){var Fe=Se.shift();if(typeof Fe=="function"){Fe();continue}var At=Fe.func;typeof At=="number"?Fe.arg===void 0?e.dynCall_v(At):e.dynCall_vi(At,Fe.arg):At(Fe.arg===void 0?null:Fe.arg)}}var Ye=[],qt=[],bt=[],Re=[];function qe(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Tt(e.preRun.shift());Be(Ye)}function Ke(){Be(qt)}function St(){Be(bt)}function mt(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)an(e.postRun.shift());Be(Re)}function Tt(Se){Ye.unshift(Se)}function an(Se){Re.unshift(Se)}var Ut=Math.abs,Ue=Math.ceil,Je=Math.floor,He=Math.min,ot=0,se=null;function Kt(Se){ot++,e.monitorRunDependencies&&e.monitorRunDependencies(ot)}function yt(Se){if(ot--,e.monitorRunDependencies&&e.monitorRunDependencies(ot),ot==0&&se){var Fe=se;se=null,Fe()}}e.preloadedImages={},e.preloadedAudios={};var zt=null,at="data:application/octet-stream;base64,";function te(Se){return String.prototype.startsWith?Se.startsWith(at):Se.indexOf(at)===0}var V,de;zt
vendor: 19,357 bytes, line 4069
4069="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE
vendor: 4,160 bytes, line 4069
40694AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA//////
vendor: 13,732 bytes, line 4069
4069///////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAA6B6FaUp9QQTPXMuL4myJBraiDfBwx9UBYJseitzTIQOL5if9jqZtAnXX+Z+ycb0C3pucbhRBCQG8wJBYqpRRAlWbDCzCY5z/eFWBUEve6P/+qo4Q50Y4/D9YM3iCcYT8fcA2QJSA0P4ADxu0qAAc/BNcGolVJ2j5d9FACqwquPh9z7MthtI9CSUSYJke/YUJQ/64OyjU0Qpi0+HCmFQdCm3GfIVdh2kHsJ11kAyauQYC3UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAquJYWJZl+D9jaeZNtj/zPwwdI9KqaeO/qGefXwdHdz+q4lhYlmX4P+OrlPMN3PI/DB0j0qpp47+7SQLV4VIEQKriWFiWZfg/r2kma3tz8T82eQmLqNIGwMRIWXMqSvo/fcCszPux9j+jara6ozTwP6hnn18HR3c/MSoKLequ8r+SabgA2nj0P7jBLbDOHO8/1Ym/ICfH4T+6lxjvlFXHv73m373LRPU/0vXyDVxo7T+ToKRHJXMAQF/33578aPE/pAyy64tD9T8+U/hCvyruPwxv8Y7YYwLAuXYr8NAiCEB4+LDK0Sn0P1Qeuy4j+eo/OMx50n7K7L+TrGB/nyf8v5ehC2fbYPM/aXMKexiT6z8mFRIMjg/zP7yUVwGGBNw/E6opHERf8z/z0wR2g9DqPw4pBpcOhvu/NbA29uWAA8DMaTExyXzyP02biiQ+Ruk/S8jz2/FKBEB1pzZnpbb9P7pQU4wLfPI//7ZcQXeG6D9CqEQvAYoIwDB2VB6sSgRAVyv8H5We8T+EHWF8XNPmPzB2wT8Nrrg/SEi+cX+w4L8of+GtdSDxP1sjk5AdouU/6ZjOVru13r8K0obqI6bxvwVbdNXyhfA/w5GG024n5z+rwmtMzP8BwLw9pSX49QXABe/2uQxP8D+b6wCzCvXkP7uGT87fK+Q/pz/JWw4coj+qoBf2J0nwP/yE3PUo0+I/vFJeHcaC+D96luSIqvntP/bf8sHUYu8/gZNN41mL4z9bhOqVOF4FwO6lmAh1hQhAbCVxbdhk7z+1C8NdDcfiPwG36x/0OQBAx0WJ76c2+D9nlSHXANfuP2HlfZ3gqOE/EwnVlVPg9r96+oHzEH//v5bXzdT1Auw/DM3GwLsA4D9p/8uoKcr+v+U9x5DQVAPAehjSdghb7D9sc1IetODgP8MVwwB1pu6/azPk6OGe978W8t/TUc3rP+0QMvYfP+A/RsG/QpSE8D+l3uwScxzgPwQaifgujuw/k1Vti1I43z8MAwLnSh0GQH5nYnwwZgJAiGUzWC5s6j8WyyI/BbLgPw4iUapGeQJAB3W+imnp/j9BLWR4ssrpP2t+gG5Pstk/cpBsfm6DCMCOpU9dOZsFQEv8nFypHeo/ehJ6i+6S2D9jqlGEmarLv7STC5TRiOa/bC+x8WZD6D9H3yUkWpDZP8gZvmCMuQLAreY19/eRBsCoPOc8UzzpP6KI/QV+y9g/t/MoboyWzT+Hv5q3Zu3Mvy2xROCT4uY/9gQitMMg1T9abAqhWMDkv1oLTavoUfG/PMUJP9CD5j+fHRX3t6fSPz7W2gk6bvs/WRnuHwqN9D8YFturGCTmP1EZczv0b9I/5t4exabB5D/1ESLh5fTEP9X2z6SYweQ/6lv3I2zT0D9zkRGNUNMAQKoSvc4EIfs/Xggt8wQI5T+mJHHg/w/SP4lhT/9t8vQ/DrZ/DbwH7D+XlhbYZrjkP34LIpFt6c4/lwfp8fLX9L+j96CTTf76v3WdNhEv9uM/d8c3o4lV0D/vFdCHVcsFwAHeDq0F1QhApbYqcZiN5D9KoilqByXLPwX0/diA0vq/0fo0GxnxAMBbaTkvlCzjP/RrFrWXrMs/UYTrky7jA0DB9f4FiZYAQEGAk/3QzeE/r/TeqE8t0D/OqjlsnPbvvz8RKU8JOfW/smSEbK/O4T8MzuyPm3DDP/rFtctq9gZAfb1EVEaSA0Dts5dVInnhP18SFMc79MM/7y34cw6LAMDFrRJsZO0DwC2KLvLSYuA/hx5wcUHewz+49SnK/4ruPyeS0PX9a+E/ZxaaLvvZ3z8WPu5T2QS8Pygo4RIvMqa/BJ0Kqsd0279cKW4ay8jdP3b05bmZ364/10/qtdxk2r+Bcz6CDMvpv54qOw+Amdw/qLV71pW7sT/YKc80nIPUP8OfIaBJ77G/LyTuD1un2z+diYu8efWzP1wU7ACkfwjAZroyPL1yBkAmv3lKJJbbPysKSE4W+p0/dIgqY79TA8ATLTOQ3tsGwJ2zweD/Xdg/XO/jXeFUaL8VW2qLFKfov1cA9Aa6XfK/tIa7YGgI2T+f3hu/sxqPv2nXdPpf3Pc/jkw8Jbda8j+tT/z8tGPVP1yBHpJd35k/KYvYOy1s8j/yz+kCQjPrP9+agH7x59g/PZfJ9aBhpr/rDKzvYBb+PwtkiaGCt/c/vb1mVr+f1T/JIHwHc8Govw7aeF6+9vG/Xv7kD6fp979isYioQYHVP7AIQZuSFrG/3z1AdUTnAUDN3XY9O7f9P0AdQ9ljYNQ/dJANJPTOrb8kLECUiiPlP4yF7UgmStA/9xGmXxCG1T9qZzix4W2zv2SGJRJVrPe/Fh9a2M/B/b8IexzFCoPSP9y1QFD2bLe/Q86cWLJe/b+mOOfYm78BwOTjkPAGE9E/8aPCUKu/ub9pPZyLCiUGwBA7Mev/BQlALOmrlRi+0j+AMJ/dKULBv7iLtL6a6QRAEMDV/yajAUDa62dE3crJP1P70RgBUbq/38hVnR6esT/s1tG10Z/Ov/zLwalHPss/dTS9NKTXx78nMcRzCIEHQAabxDsAmQRA0tyLK3gSyT+Aui7nOhDGv5Gs58z3WgHATN3forJuBMCAui7nOhDGP9Lciyt4Esm/WAJyHQ4c7z8UP5HFIs3iP3U0vTSk18c//MvBqUc+y7+cvv8HLg/Kvy1I/mHsI+K/U/vRGAFRuj/a62dE3crJv8p+WV8KlQjAuQ/nOP43B0CAMJ/dKULBPyzpq5UYvtK/ZoU+VoLh4L9etLlRUfvtv/GjwlCrv7k/5OOQ8AYT0b9DfT9FhufXPwUX8hJp+4u/3LVAUPZstz8IexzFCoPSv9+L609E5fQ/q9Fz7X2J7T9qZzix4W2zP/cRpl8QhtW/vtNilqGX+j8MOy7QJoL0P3SQDST0zq0/QB1D2WNg1L8IIjSvGNkDwGB8Jou2GAfAsAhBm5IWsT9isYioQYHVvyS9D3zb6uy/gnwRa7uM9L/JIHwHc8GoP729Zla/n9W/CsAHJZwmAEDEW6OYT1r6Pz2XyfWgYaY/35qAfvHn2L83Tdy4lS30vxf2/gZ0jPq/XIEekl3fmb+tT/z8tGPVvybPr2zJ1/+/K7mJ0ypVAsCf3hu/sxqPPwCGu2BoCNm/5oITrpZn+r+UDUyDP+n/v1zv413hVGg/nbPB4P9d2L9MlmkxNvgCQMtZlKE85v8/KwpIThb6nb8mv3lKJJbbv8+SZsTvOOc/pQCIIOYw0j+diYu8efWzvy8k7g9bp9u/kxYDa+pKtD9XlYvA8HnVv6i1e9aVu7G/nio7D4CZ3L/WR6rNh5EGwCkgQweBkghAdvTluZnfrr9cKW4ay8jdvxbjhr1f1QVAR5C0MzivAkAWPu5T2QS8v2cWmi772d+/cKj4lzLJCEBx2QJfYrMFQIcecHFB3sO/LYou8tJi4L+jr7lhO38BwIcI0Nb7xgTAXxIUxzv0w7/ts5dVInnhv0T+l8DZLfE/MP3FoFvS5D8MzuyPm3DDv7JkhGyvzuG/tzhzRIRc0b9Ovv3/0z7mv6/03qhPLdC/m4CT/dDN4b9dwjU5VCQBQBBJX1ntCv0/9GsWtZesy79baTkvlCzjv1mjYgEz++S/oW6KnOQW8b9KoilqByXLv6W2KnGYjeS/SmaKz3Vx9z+BZB5yxGHwP3fHN6OJVdC/dZ02ES/2478PuaBjLrXaP4/JU81pPaO/fgsikW3pzr+XlhbYZrjkv4tSn7YDbP0/f2LnFKlF9z+mJHHg/w/Sv14ILfMECOW/mfg4qYhR/b+OP+RQDCACwOpb9yNs09C/1fbPpJjB5L9pN2WOVZ3wv3hHy9nxIve/URlzO/Rv0r8YFturGCTmv1d1/KKR8QPA8gsy9qzSB8CfHRX3t6fSvzzFCT/Qg+a/EYStnrzV9r/2QJqI7Lb9v/YEIrTDINW/LbFE4JPi5r/7kQEs5fEDQHunnf4GeQBAooj9BX7L2L+oPOc8Uzzpv+ydYY2SSAfAL4HK6CRTB0BH3yUkWpDZv2wvsfFmQ+i/Ik0Yzruh6T8fM3LoGoDUP3oSeovukti/S/ycXKkd6r9rEv+7UWcHQCRIQe/GfwNAa36Abk+y2b9BLWR4ssrpv9KT87qa0bM/FTyktw823L8WyyI/BbLgv4hlM1gubOq/DizMp9Ki6r8b5ckdjVrzv5NVbYtSON+/BBqJ+C6O7L/dUBFqgyXYv00Wh18r7+q/7RAy9h8/4L8W8t/TUc3rv4RM5DKx3wDAfvWIj94aBcBsc1IetODgv3oY0nYIW+y/oGcTFF54AUDkJqS/FKX6PwzNxsC7AOC/ltfN1PUC7L+5Wrz/zHnzP6688w2rNOc/YeV9neCo4b9nlSHXANfuvw9RsxKjY/s/1V8GteXE8j+1C8NdDcfiv2wlcW3YZO+/IOywaA7Q8b9bFP+4Tg36v4GTTeNZi+O/9t/ywdRi77+tRc3yFR7eP2bkcHXJkLO//ITc9SjT4r+qoBf2J0nwv2YHKoswwfm/iQcLspCjAcCb6wCzCvXkvwXv9rkMT/C/YkuwYAMXBMApCNUai9kIwMORhtNuJ+e/BVt01fKF8L+ZqWEfvIjsP6h693QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBBcDdyQ2hlY2tlZABkaXJlY3RlZEVkZ2UuYwBkaXJlY3RlZEVkZ2VUb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpclt0bXBGaWprLmZhY2VdW2ZpamsuZmFjZV0gPT0gS0kAZmFjZWlqay5jAF9mYWNlSWprUGVudFRvQ2VsbEJvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9DZWxsQm91bmRhcnkAaDNJbmRleC5jAGNvbXBhY3RDZWxscwBsYXRMbmdUb0NlbGwAY2VsbFRvQ2hpbGRQb3MAdmFsaWRhdGVDaGlsZFBvcwBsYXRMbmcuYwBjZWxsQXJlYVJhZHMyAHBvbHlnb24tPm5leHQgPT0gTlVMTABsaW5rZWRHZW8uYwBhZGROZXdMaW5rZWRQb2x5Z29uAG5leHQgIT0gTlVMTABsb29wICE9IE5VTEwAYWRkTmV3TGlua2VkTG9vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";
4069var Pe=28640;function $e(Se){return Se}function Le(Se){var Fe=/\b__Z[\w\d_]+/g;return Se.replace(Fe,function(At){var Ve=At;return At===Ve?At:Ve+" ["+At+"]"})}function Nt(){var Se=new Error;if(!Se.stack){try{throw new Error(0)}catch(Fe){Se=Fe}if(!Se.stack)return"(no stack trace available)"}return Se.stack.toString()}function ct(){var Se=Nt();return e.extraStackTrace&&(Se+=` 4070`+e.extraStackTrace()),Le(Se)}function Wt(Se,Fe,At,Ve){qo("Assertion failed: "+L(Se)+", at: "+[Fe?L(Fe):"unknown filename",At,Ve?L(Ve):"unknown function"])}function Zt(){return W.length}function nt(Se,Fe,At){j.set(j.subarray(Fe,Fe+At),Se)}function lt(Se){return e.___errno_location&&(z[e.___errno_location()>>2]=Se),Se}function Ot(Se){qo("OOM")}function kt(Se){try{var Fe=new ArrayBuffer(Se);return Fe.byteLength!=Se?void 0:(new Int8Array(Fe).set(W),Ie(Fe),fe(Fe),1)}catch{}}function wt(Se){var Fe=Zt(),At=16777216,Ve=2147483648-At;if(Se>Ve)return!1;for(var A=16777216,H=Math.max(Fe,A);H<Se;)H<=536870912?H=$(2*H,At):H=Math.min($((3*H+2147483648)/4,At),Ve);var Cn=kt(H);return!!Cn}var Sn=typeof atob=="function"?atob:function(Se){var Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",At="",Ve,A,H,Cn,Un,ji,mn,Ln=0;Se=Se.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Cn=Fe.indexOf(Se.charAt(Ln++)),Un=Fe.indexOf(Se.charAt(Ln++)),ji=Fe.indexOf(Se.charAt(Ln++)),mn=Fe.indexOf(Se.charAt(Ln++)),Ve=Cn<<2|Un>>4,A=(Un&15)<<4|ji>>2,H=(ji&3)<<6|mn,At=At+String.fromCharCode(Ve),ji!==64&&(At=At+String.fromCharCode(A)),mn!==64&&(At=At+String.fromCharCode(H));while(Ln<Se.length);return At};function me(Se){try{for(var Fe=Sn(Se),At=new Uint8Array(Fe.length),Ve=0;Ve<Fe.length;++Ve)At[Ve]=Fe.charCodeAt(Ve);return At}catch{throw new Error("Converting base64 string to bytes failed.")}}function ht(Se){if(te(Se))return me(Se.slice(at.length))}var ut={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},Pt={a:qo,b:d,c:p,d:Wt,e:lt,f:Zt,g:nt,h:wt,i:Ot,j:$e,k:Le,l:kt,m:Nt,n:ct,o:Pe,p:Me},pe=function(Se,Fe,At){"almost asm";var Ve=new Se.Int8Array(At),A=new Se.Int32Array(At);new Se.Uint8Array(At),new Se.Float32Array(At);var H=new Se.Float64Array(At),Cn=Fe.o|0,Un=Fe.p|0,ji=Se.Math.floor,mn=Se.Math.abs,Ln=Se.Math.sqrt,zo=Se.Math.pow,kn=Se.Math.cos,xn=Se.Math.sin,fs=Se.Math.tan,wc=Se.Math.acos,K=Se.Math.asin,_e=Se.Math.atan,we=Se.Math.atan2,Te=Se.Math.
4070ceil,be=Se.Math.imul,gt=Se.Math.min,Rt=Se.Math.max,dt=Se.Math.clz32,Qe=Fe.b,q=Fe.c,rt=Fe.d,yn=Fe.e,$t=Fe.f,Jn=Fe.g,Bi=Fe.h,Ci=Fe.i,G=28656;function lr(h){return Ve=new Int8Array(h),A=new Int32Array(h),H=new Float64Array(h),At=h,!0}function Ht(h){h=h|0;var c=0;return c=G,G=G+h|0,G=G+15&-16,c|0}function $r(){return G|0}function Gn(h){h=h|0,G=h}function Ps(h,c){h=h|0,G=h}function Ys(h,c){h=h|0,c=c|0;var f=0,m=0,_=0;return(h|0)<0?(c=2,c|0):(h|0)>13780509?(c=n0(15,c)|0,c|0):(f=((h|0)<0)<<31>>31,_=cr(h|0,f|0,3,0)|0,m=q()|0,f=jt(h|0,f|0,1,0)|0,f=cr(_|0,m|0,f|0,q()|0)|0,f=jt(f|0,q()|0,1,0)|0,h=q()|0,A[c>>2]=f,A[c+4>>2]=h,c=0,c|0)}function Ho(h,c,f,m){return h=h|0,c=c|0,f=f|0,m=m|0,Oa(h,c,f,m,0)|0}function Oa(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0;if(C=G,G=G+16|0,b=C,!(ei(h,c,f,m,_)|0))return m=0,G=C,m|0;do if((f|0)>=0){if((f|0)>13780509){if(v=n0(15,b)|0,v|0)break;w=b,b=A[w>>2]|0,w=A[w+4>>2]|0}else v=((f|0)<0)<<31>>31,D=cr(f|0,v|0,3,0)|0,w=q()|0,v=jt(f|0,v|0,1,0)|0,v=cr(D|0,w|0,v|0,q()|0)|0,v=jt(v|0,q()|0,1,0)|0,w=q()|0,A[b>>2]=v,A[b+4>>2]=w,b=v;if(Sl(m|0,0,b<<3|0)|0,_|0){Sl(_|0,0,b<<2|0)|0,v=hi(h,c,f,m,_,b,w,0)|0;break}v=ps(b,4)|0,v?(D=hi(h,c,f,m,v,b,w,0)|0,Xt(v),v=D):v=13}else v=2;while(!1);return D=v,G=C,D|0}function ei(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0;if(he=G,G=G+16|0,ie=he,re=he+8|0,ne=ie,A[ne>>2]=h,A[ne+4>>2]=c,(f|0)<0)return re=2,G=he,re|0;if(v=m,A[v>>2]=h,A[v+4>>2]=c,v=(_|0)!=0,v&&(A[_>>2]=0),Ai(h,c)|0)return re=9,G=he,re|0;A[re>>2]=0;e:do if((f|0)>=1)if(v)for(O=1,D=0,X=0,ne=1,v=h;;){if(!(D|X)){if(v=mi(v,c,4,re,ie)|0,v|0)break e;if(c=ie,v=A[c>>2]|0,c=A[c+4>>2]|0,Ai(v,c)|0){v=9;break e}}if(v=mi(v,c,A[26800+(X<<2)>>2]|0,re,ie)|0,v|0)break e;if(c=ie,v=A[c>>2]|0,c=A[c+4>>2]|0,h=m+(O<<3)|0,A[h>>2]=v,A[h+4>>2]=c,A[_+(O<<2)>>2]=ne,h=D+1|0,b=(h|0)==(ne|0),w=X+1|0,C=(w|0)==6,Ai(v,c)|0){v=9;break e}if(ne=ne+(C&b&1)|0,(ne|0)>(f|0)){v=0;break}else O=O+1|0,D=b?0:h,X=b?C?0:w:X}else for(O=1,D=0,X=0,ne=1,v=h;;){if(!(D|X)){if(v=mi(v,c,4,re,ie)|0,v|0)break e;if(c=ie,v=A[c>>2]|0,c=A[c+4>>2]|0,Ai(v,c)|0){v=9;break e}}if(v=mi(v,c,A[26800+(X<<2)>>2]|0,re,ie)|0,v|0)break e;if(c=ie,v=A[c>>2]|0,c=A[c+4>>2]|0,h=m+(O<<3)|0,A[h>>2]=v,A[h+4>>2]=c,h=D+1|0,b=(h|0)==(ne|0),w=X+1|0,C=(w|0)==6,Ai(v,c)|0){v=9;break e}if(ne=ne+(C&b&1)|0,(ne|0)>(f|0)){v=0;break}else O=O+1|0,D=b?0:h,X=b?C?0:w:X}else v=0;while(!1);return re=v,G=he,re|0}function hi(h,c,f,m,_,v,b,w){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0,v=v|0,b=b|0,w=w|0;var C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0;if(he=G,G=G+16|0,ie=he+8|0,re=he,C=Lc(h|0,c|0,v|0,b|0)|0,O=q()|0,X=m+(C<<3)|0,ge=X,Ee=A[ge>>2]|0,ge=A[ge+4>>2]|0,D=(Ee|0)==(h|0)&(ge|0)==(c|0),!((Ee|0)==0&(ge|0)==0|D))do C=jt(C|0,O|0,1,0)|0,C=Dc(C|0,q()|0,v|0,b|0)|0,O=q()|0,X=m+(C<<3)|0,Ee=X,ge=A[Ee>>2]|0,Ee=A[Ee+4>>2]|0,D=(ge|0)==(h|0)&(Ee|0)==(c|0);while(!((ge|0)==0&(Ee|0)==0|D));if(C=_+(C<<2)|0,D&&(A[C>>2]|0)<=(w|0)||(Ee=X,A[Ee>>2]=h,A[Ee+4>>2]=c,A[C>>2]=w,(w|0)>=(f|0)))return Ee=0,G=he,Ee|0;switch(D=w+1|0,A[ie>>2]=0,C=mi(h,c,2,ie,re)|0,C|0){case 9:{ne=9;break}case 0:{C=re,C=hi(A[C>>2]|0,A[C+4>>2]|0,f,m,_,v,b,D)|0,C||(ne=9);break}}e:do if((ne|0)==9){switch(A[ie>>2]=0,C=mi(h,c,3,ie,re)|0,C|0){case 9:break;case 0:{if(C=re,C=hi(A[C>>2]|0,A[C+4>>2]|0,f,m,_,v,b,D)|0,C|0)break e;break}default:break e}switch(A[ie>>2]=0,C=mi(h,c,1,ie,re)|0,C|0){case 9:break;case 0:{if(C=re,C=hi(A[C>>2]|0,A[C+4>>2]|0,f,m,_,v,b,D)|0,C|0)break e;break}default:break e}switch(A[ie>>2]=0,C=mi(h,c,5,ie,re)|0,C|0){case 9:break;case 0:{if(C=re,C=hi(A[C>>2]|0,A[C+4>>2]|0,f,m,_,v,b,D)|0,C|0)break e;break}default:break e}switch(A[ie>>2]=0,C=mi(h,c,4,ie,re)|0,C|0){case 9:break;case 0:{if(C=re,C=hi(A[C>>2]|0,A[C+4>>2]|0,f,m,_,v,b,D)|0,C|0)break e;break}default:break e}switch(A[ie>>2]=0,C=mi(h,c,6,ie,re)|0,C|0){case 9:break;case 0:{if(C=re,C=hi(A[C>>2]|0,A[C+4>>2]|0,f,m,_,v,b,D)|0,C|0)break e;break}default:break e}return Ee=0,G=he,Ee|0}while(!1);return Ee=C,G=he,Ee|0}function mi(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0;if(f>>>0>6)return _=1,_|0;if(X=(A[m>>2]|0)%6|0,A[m>>2]=X,(X|0)>0){v=0;do f=Tu(f)|0,v=v+1|0;while((v|0)<(A[m>>2]|0))}if(X=ze(h|0,c|0,45)|0,q()|0,O=X&127,O>>>0>121)return _=5,_|0;C=ds(h,c)|0,v=ze(h|0,c|0,52)|0,q()|0,v=v&15;e:do if(!v)D=8;else{for(;;){if(b=(15-v|0)*3|0,w=ze(h|0,c|0,b|0)|0,q()|0,w=w&7,(w|0)==7){c=5;break}if(re=(Ks(v)|0)==0,v=v+-1|0,ne=et(7,0,b|0)|0,c=c&~(q()|0),ie=et(A[(re?432:16)+(w*28|0)+(f<<2)>>2]|0,0,b|0)|0,b=q()|0,f=A[(re?640:224)+(w*28|0)+(f<<2)>>2]|0,h=ie|h&~ne,c=b|c,!f){f=0;break e}if(!v){D=8;break e}}return c|0}while(!1);
4070(D|0)==8&&(re=A[848+(O*28|0)+(f<<2)>>2]|0,ie=et(re|0,0,45)|0,h=ie|h,c=q()|0|c&-1040385,f=A[4272+(O*28|0)+(f<<2)>>2]|0,(re&127|0)==127&&(re=et(A[848+(O*28|0)+20>>2]|0,0,45)|0,c=q()|0|c&-1040385,f=A[4272+(O*28|0)+20>>2]|0,h=Mu(re|h,c)|0,c=q()|0,A[m>>2]=(A[m>>2]|0)+1)),w=ze(h|0,c|0,45)|0,q()|0,w=w&127;e:do if(Si(w)|0){t:do if((ds(h,c)|0)==1){if((O|0)!=(w|0))if(F3(w,A[7696+(O*28|0)>>2]|0)|0){h=c1(h,c)|0,b=1,c=q()|0;break}else rt(27795,26864,533,26872);switch(C|0){case 3:{h=Mu(h,c)|0,c=q()|0,A[m>>2]=(A[m>>2]|0)+1,b=0;break t}case 5:{h=c1(h,c)|0,c=q()|0,A[m>>2]=(A[m>>2]|0)+5,b=0;break t}case 0:return re=9,re|0;default:return re=1,re|0}}else b=0;while(!1);if((f|0)>0){v=0;do h=u1(h,c)|0,c=q()|0,v=v+1|0;while((v|0)!=(f|0))}if((O|0)!=(w|0)){if(!(Kg(w)|0)){if((b|0)!=0|(ds(h,c)|0)!=5)break;A[m>>2]=(A[m>>2]|0)+1;break}switch(X&127){case 8:case 118:break e}(ds(h,c)|0)!=3&&(A[m>>2]=(A[m>>2]|0)+1)}}else if((f|0)>0){v=0;do h=Mu(h,c)|0,c=q()|0,v=v+1|0;while((v|0)!=(f|0))}while(!1);return A[m>>2]=((A[m>>2]|0)+f|0)%6|0,re=_,A[re>>2]=h,A[re+4>>2]=c,re=0,re|0}function Ki(h,c,f,m){return h=h|0,c=c|0,f=f|0,m=m|0,_o(h,c,f,m)|0?(Sl(m|0,0,f*48|0)|0,m=_l(h,c,f,m)|0,m|0):(m=0,m|0)}function _o(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0;if(re=G,G=G+16|0,ne=re,ie=re+8|0,X=ne,A[X>>2]=h,A[X+4>>2]=c,(f|0)<0)return ie=2,G=re,ie|0;if(!f)return ie=m,A[ie>>2]=h,A[ie+4>>2]=c,ie=0,G=re,ie|0;A[ie>>2]=0;e:do if(Ai(h,c)|0)h=9;else{_=0,X=h;do{if(h=mi(X,c,4,ie,ne)|0,h|0)break e;if(c=ne,X=A[c>>2]|0,c=A[c+4>>2]|0,_=_+1|0,Ai(X,c)|0){h=9;break e}}while((_|0)<(f|0));O=m,A[O>>2]=X,A[O+4>>2]=c,O=f+-1|0,D=0,h=1;do{if(_=26800+(D<<2)|0,(D|0)==5)for(b=A[_>>2]|0,v=0,_=h;;){if(h=ne,h=mi(A[h>>2]|0,A[h+4>>2]|0,b,ie,ne)|0,h|0)break e;if((v|0)!=(O|0))if(C=ne,w=A[C>>2]|0,C=A[C+4>>2]|0,h=m+(_<<3)|0,A[h>>2]=w,A[h+4>>2]=C,!(Ai(w,C)|0))h=_+1|0;else{h=9;break e}else h=_;if(v=v+1|0,(v|0)>=(f|0))break;_=h}else for(b=ne,C=A[_>>2]|0,w=0,_=h,v=A[b>>2]|0,b=A[b+4>>2]|0;;){if(h=mi(v,b,C,ie,ne)|0,h|0)break e;if(b=ne,v=A[b>>2]|0,b=A[b+4>>2]|0,h=m+(_<<3)|0,A[h>>2]=v,A[h+4>>2]=b,h=_+1|0,Ai(v,b)|0){h=9;break e}if(w=w+1|0,(w|0)>=(f|0))break;_=h}D=D+1|0}while(D>>>0<6);h=ne,h=(X|0)==(A[h>>2]|0)&&(c|0)==(A[h+4>>2]|0)?0:9}while(!1);return ie=h,G=re,ie|0}function _l(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0;if(X=G,G=G+16|0,b=X,!f)return A[m>>2]=h,A[m+4>>2]=c,m=0,G=X,m|0;do if((f|0)>=0){if((f|0)>13780509){if(_=n0(15,b)|0,_|0)break;v=b,_=A[v>>2]|0,v=A[v+4>>2]|0}else _=((f|0)<0)<<31>>31,O=cr(f|0,_|0,3,0)|0,v=q()|0,_=jt(f|0,_|0,1,0)|0,_=cr(O|0,v|0,_|0,q()|0)|0,_=jt(_|0,q()|0,1,0)|0,v=q()|0,O=b,A[O>>2]=_,A[O+4>>2]=v;if(D=ps(_,8)|0,!D)_=13;else{if(O=ps(_,4)|0,!O){Xt(D),_=13;break}if(_=hi(h,c,f,D,O,_,v,0)|0,_|0){Xt(D),Xt(O);break}if(c=A[b>>2]|0,b=A[b+4>>2]|0,(b|0)>0|(b|0)==0&c>>>0>0){_=0,w=0,C=0;do h=D+(w<<3)|0,v=A[h>>2]|0,h=A[h+4>>2]|0,!((v|0)==0&(h|0)==0)&&(A[O+(w<<2)>>2]|0)==(f|0)&&(ne=m+(_<<3)|0,A[ne>>2]=v,A[ne+4>>2]=h,_=_+1|0),w=jt(w|0,C|0,1,0)|0,C=q()|0;while((C|0)<(b|0)|(C|0)==(b|0)&w>>>0<c>>>0)}Xt(D),Xt(O),_=0}}else _=2;while(!1);return ne=_,G=X,ne|0}function Ec(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0;for(w=G,G=G+16|0,v=w,b=w+8|0,_=(Ai(h,c)|0)==0,_=_?1:2;;){if(A[b>>2]=0,D=(mi(h,c,_,b,v)|0)==0,C=v,D&((A[C>>2]|0)==(f|0)?(A[C+4>>2]|0)==(m|0):0)){h=4;break}if(_=_+1|0,_>>>0>=7){_=7,h=4;break}}return(h|0)==4?(G=w,_|0):0}function Z6(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0;if(w=G,G=G+48|0,_=w+16|0,v=w+8|0,b=w,f=YA(f)|0,f|0)return b=f,G=w,b|0;if(D=h,C=A[D+4>>2]|0,f=v,A[f>>2]=A[D>>2],A[f+4>>2]=C,lb(v,_),f=G3(_,c,b)|0,!f){if(c=A[v>>2]|0,v=A[h+8>>2]|0,(v|0)>0){_=A[h+12>>2]|0,f=0;do c=(A[_+(f<<3)>>2]|0)+c|0,f=f+1|0;while((f|0)<(v|0))}f=b,_=A[f>>2]|0,f=A[f+4>>2]|0,v=((c|0)<0)<<31>>31,(f|0)<(v|0)|(f|0)==(v|0)&_>>>0<c>>>0?(f=b,A[f>>2]=c,A[f+4>>2]=v,f=v):c=_,C=jt(c|0,f|0,12,0)|0,D=q()|0,f=b,A[f>>2]=C,A[f+4>>2]=D,f=m,A[f>>2]=C,A[f+4>>2]=D,f=0}return D=f,G=w,D|0}function I3(h,c,f,m,_,v,b){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0,v=v|0,b=b|0;var w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0,Gt=0,Et=0,An=0,dn=0,Tn=0,on=0,Vt=0,tt=0,vn=0,si=0,gn=0,oi=0,Xr=0,bb=0;if(si=G,G=G+64|0,on=si+48|0,Vt=si+32|0,tt=si+24|0,it=si+8|0,Gt=si,C=A[h>>2]|0,(C|0)<=0)return vn=0,G=si,vn|0;for(Et=h+4|0,An=on+8|0,dn=Vt+8|0,Tn=it+8|0,w=0,xe=0;;
4070){D=A[Et>>2]|0,ye=D+(xe<<4)|0,A[on>>2]=A[ye>>2],A[on+4>>2]=A[ye+4>>2],A[on+8>>2]=A[ye+8>>2],A[on+12>>2]=A[ye+12>>2],(xe|0)==(C+-1|0)?(A[Vt>>2]=A[D>>2],A[Vt+4>>2]=A[D+4>>2],A[Vt+8>>2]=A[D+8>>2],A[Vt+12>>2]=A[D+12>>2]):(ye=D+(xe+1<<4)|0,A[Vt>>2]=A[ye>>2],A[Vt+4>>2]=A[ye+4>>2],A[Vt+8>>2]=A[ye+8>>2],A[Vt+12>>2]=A[ye+12>>2]),C=cN(on,Vt,m,tt)|0;e:do if(C)D=0,w=C;else if(C=tt,D=A[C>>2]|0,C=A[C+4>>2]|0,(C|0)>0|(C|0)==0&D>>>0>0){Ee=0,ye=0;t:for(;;){if(oi=1/(+(D>>>0)+4294967296*+(C|0)),bb=+H[on>>3],C=ur(D|0,C|0,Ee|0,ye|0)|0,Xr=+(C>>>0)+4294967296*+(q()|0),gn=+(Ee>>>0)+4294967296*+(ye|0),H[it>>3]=oi*(bb*Xr)+oi*(+H[Vt>>3]*gn),H[Tn>>3]=oi*(+H[An>>3]*Xr)+oi*(+H[dn>>3]*gn),C=h1(it,m,Gt)|0,C|0){w=C;break}ge=Gt,he=A[ge>>2]|0,ge=A[ge+4>>2]|0,ne=Lc(he|0,ge|0,c|0,f|0)|0,O=q()|0,C=b+(ne<<3)|0,X=C,D=A[X>>2]|0,X=A[X+4>>2]|0;n:do if((D|0)==0&(X|0)==0)Ae=C,vn=16;else for(ie=0,re=0;;){if((ie|0)>(f|0)|(ie|0)==(f|0)&re>>>0>c>>>0){w=1;break t}if((D|0)==(he|0)&(X|0)==(ge|0))break n;if(C=jt(ne|0,O|0,1,0)|0,ne=Dc(C|0,q()|0,c|0,f|0)|0,O=q()|0,re=jt(re|0,ie|0,1,0)|0,ie=q()|0,C=b+(ne<<3)|0,X=C,D=A[X>>2]|0,X=A[X+4>>2]|0,(D|0)==0&(X|0)==0){Ae=C,vn=16;break}}while(!1);if((vn|0)==16&&(vn=0,!((he|0)==0&(ge|0)==0))&&(re=Ae,A[re>>2]=he,A[re+4>>2]=ge,re=v+(A[_>>2]<<3)|0,A[re>>2]=he,A[re+4>>2]=ge,re=_,re=jt(A[re>>2]|0,A[re+4>>2]|0,1,0)|0,he=q()|0,ge=_,A[ge>>2]=re,A[ge+4>>2]=he),Ee=jt(Ee|0,ye|0,1,0)|0,ye=q()|0,C=tt,D=A[C>>2]|0,C=A[C+4>>2]|0,!((C|0)>(ye|0)|(C|0)==(ye|0)&D>>>0>Ee>>>0)){D=1;break e}}D=0}else D=1;while(!1);if(xe=xe+1|0,!D){vn=21;break}if(C=A[h>>2]|0,(xe|0)>=(C|0)){w=0,vn=21;break}}return(vn|0)==21?(G=si,w|0):0}function J6(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0,Gt=0,Et=0,An=0,dn=0,Tn=0,on=0,Vt=0,tt=0,vn=0,si=0,gn=0,oi=0,Xr=0;if(Xr=G,G=G+112|0,vn=Xr+80|0,C=Xr+72|0,si=Xr,gn=Xr+56|0,_=YA(f)|0,_|0)return oi=_,G=Xr,oi|0;if(D=h+8|0,oi=Wo((A[D>>2]<<5)+32|0)|0,!oi)return oi=13,G=Xr,oi|0;if(_1(h,oi),_=YA(f)|0,!_){if(Vt=h,tt=A[Vt+4>>2]|0,_=C,A[_>>2]=A[Vt>>2],A[_+4>>2]=tt,lb(C,vn),_=G3(vn,c,si)|0,_)Vt=0,tt=0;else{if(_=A[C>>2]|0,v=A[D>>2]|0,(v|0)>0){b=A[h+12>>2]|0,f=0;do _=(A[b+(f<<3)>>2]|0)+_|0,f=f+1|0;while((f|0)!=(v|0));f=_}else f=_;_=si,v=A[_>>2]|0,_=A[_+4>>2]|0,b=((f|0)<0)<<31>>31,(_|0)<(b|0)|(_|0)==(b|0)&v>>>0<f>>>0?(_=si,A[_>>2]=f,A[_+4>>2]=b,_=b):f=v,Vt=jt(f|0,_|0,12,0)|0,tt=q()|0,_=si,A[_>>2]=Vt,A[_+4>>2]=tt,_=0}if(!_){if(f=ps(Vt,8)|0,!f)return Xt(oi),oi=13,G=Xr,oi|0;if(w=ps(Vt,8)|0,!w)return Xt(oi),Xt(f),oi=13,G=Xr,oi|0;Tn=vn,A[Tn>>2]=0,A[Tn+4>>2]=0,Tn=h,on=A[Tn+4>>2]|0,_=C,A[_>>2]=A[Tn>>2],A[_+4>>2]=on,_=I3(C,Vt,tt,c,vn,f,w)|0;e:do if(_)Xt(f),Xt(w),Xt(oi);else{t:do if((A[D>>2]|0)>0){for(b=h+12|0,v=0;_=I3((A[b>>2]|0)+(v<<3)|0,Vt,tt,c,vn,f,w)|0,v=v+1|0,!(_|0);)if((v|0)>=(A[D>>2]|0))break t;Xt(f),Xt(w),Xt(oi);break e}while(!1);(tt|0)>0|(tt|0)==0&Vt>>>0>0&&Sl(w|0,0,Vt<<3|0)|0,on=vn,Tn=A[on+4>>2]|0;t:do if((Tn|0)>0|(Tn|0)==0&(A[on>>2]|0)>>>0>0){Et=f,An=w,dn=f,Tn=w,on=f,_=f,Ae=f,it=w,Gt=w,f=w;n:for(;;){for(ge=0,Ee=0,ye=0,xe=0,v=0,b=0;;){w=si,C=w+56|0;do A[w>>2]=0,w=w+4|0;while((w|0)<(C|0));if(c=Et+(ge<<3)|0,D=A[c>>2]|0,c=A[c+4>>2]|0,ei(D,c,1,si,0)|0){w=si,C=w+56|0;do A[w>>2]=0,w=w+4|0;while((w|0)<(C|0));w=ps(7,4)|0,w|0&&(hi(D,c,1,si,w,7,0,0)|0,Xt(w))}for(he=0;;){re=si+(he<<3)|0,ie=A[re>>2]|0,re=A[re+4>>2]|0;i:do if((ie|0)==0&(re|0)==0)w=v,C=b;else{if(O=Lc(ie|0,re|0,Vt|0,tt|0)|0,D=q()|0,w=m+(O<<3)|0,c=w,C=A[c>>2]|0,c=A[c+4>>2]|0,!((C|0)==0&(c|0)==0)){X=0,ne=0;do{if((X|0)>(tt|0)|(X|0)==(tt|0)&ne>>>0>Vt>>>0)break n;if((C|0)==(ie|0)&(c|0)==(re|0)){w=v,C=b;break i}w=jt(O|0,D|0,1,0)|0,O=Dc(w|0,q()|0,Vt|0,tt|0)|0,D=q()|0,ne=jt(ne|0,X|0,1,0)|0,X=q()|0,w=m+(O<<3)|0,c=w,C=A[c>>2]|0,c=A[c+4>>2]|0}while(!((C|0)==0&(c|0)==0))}if((ie|0)==0&(re|0)==0){w=v,C=b;break}wu(ie,re,gn)|0,x1(h,oi,gn)|0&&(ne=jt(v|0,b|0,1,0)|0,b=q()|0,X=w,A[X>>2]=ie,A[X+4>>2]=re,v=An+(v<<3)|0,A[v>>2]=ie,A[v+4>>2]=re,v=ne),w=v,C=b}while(!1);if(he=he+1|0,he>>>0>=7)break;v=w,b=C}if(ge=jt(ge|0,Ee|0,1,0)|0,Ee=q()|0,ye=jt(ye|0,xe|0,1,0)|0,xe=q()|0,b=vn,v=A[b>>2]|0,b=A[b+4>>2]|0,(xe|0)<(b|0)|(xe|0)==(b|0)&ye>>>0<v>>>0)v=w,b=C;else break}if((b|0)>0|(b|0)==0&v>>>0>0){v=0,b=0;
4070do xe=Et+(v<<3)|0,A[xe>>2]=0,A[xe+4>>2]=0,v=jt(v|0,b|0,1,0)|0,b=q()|0,xe=vn,ye=A[xe+4>>2]|0;while((b|0)<(ye|0)|((b|0)==(ye|0)?v>>>0<(A[xe>>2]|0)>>>0:0))}if(xe=vn,A[xe>>2]=w,A[xe+4>>2]=C,(C|0)>0|(C|0)==0&w>>>0>0)he=f,ge=Gt,Ee=on,ye=it,xe=An,f=Ae,Gt=_,it=dn,Ae=he,_=ge,on=Tn,Tn=Ee,dn=ye,An=Et,Et=xe;else break t}Xt(dn),Xt(Tn),Xt(oi),_=1;break e}else _=w;while(!1);Xt(oi),Xt(f),Xt(_),_=0}while(!1);return oi=_,G=Xr,oi|0}}return Xt(oi),oi=_,G=Xr,oi|0}function eN(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;if(O=G,G=G+176|0,C=O,(c|0)<1)return db(f,0,0),D=0,G=O,D|0;for(w=h,w=ze(A[w>>2]|0,A[w+4>>2]|0,52)|0,q()|0,db(f,(c|0)>6?c:6,w&15),w=0;m=h+(w<<3)|0,m=Nc(A[m>>2]|0,A[m+4>>2]|0,C)|0,!(m|0);){if(m=A[C>>2]|0,(m|0)>0){b=0;do v=C+8+(b<<4)|0,b=b+1|0,m=C+8+(((b|0)%(m|0)|0)<<4)|0,_=CP(f,m,v)|0,_?gb(f,_)|0:RP(f,v,m)|0,m=A[C>>2]|0;while((b|0)<(m|0))}if(w=w+1|0,(w|0)>=(c|0)){m=0,D=13;break}}return(D|0)==13?(G=O,m|0):(pb(f),D=m,G=O,D|0)}function tN(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0;if(v=G,G=G+32|0,m=v,_=v+16|0,h=eN(h,c,_)|0,h|0)return f=h,G=v,f|0;if(A[f>>2]=0,A[f+4>>2]=0,A[f+8>>2]=0,h=mb(_)|0,h|0)do{c=rP(f)|0;do sP(c,h)|0,b=h+16|0,A[m>>2]=A[b>>2],A[m+4>>2]=A[b+4>>2],A[m+8>>2]=A[b+8>>2],A[m+12>>2]=A[b+12>>2],gb(_,h)|0,h=NP(_,m)|0;while(h|0);h=mb(_)|0}while(h|0);return pb(_),h=oP(f)|0,h?(rb(f),b=h,G=v,b|0):(b=0,G=v,b|0)}function Si(h){return h=h|0,h>>>0>121?(h=0,h|0):(h=A[7696+(h*28|0)+16>>2]|0,h|0)}function Kg(h){return h=h|0,(h|0)==4|(h|0)==117|0}function B3(h){return h=h|0,A[11120+((A[h>>2]|0)*216|0)+((A[h+4>>2]|0)*72|0)+((A[h+8>>2]|0)*24|0)+(A[h+12>>2]<<3)>>2]|0}function nN(h){return h=h|0,A[11120+((A[h>>2]|0)*216|0)+((A[h+4>>2]|0)*72|0)+((A[h+8>>2]|0)*24|0)+(A[h+12>>2]<<3)+4>>2]|0}function iN(h,c){h=h|0,c=c|0,h=7696+(h*28|0)|0,A[c>>2]=A[h>>2],A[c+4>>2]=A[h+4>>2],A[c+8>>2]=A[h+8>>2],A[c+12>>2]=A[h+12>>2]}function rN(h,c){h=h|0,c=c|0;var f=0,m=0;if(c>>>0>20)return c=-1,c|0;do if((A[11120+(c*216|0)>>2]|0)!=(h|0))if((A[11120+(c*216|0)+8>>2]|0)!=(h|0))if((A[11120+(c*216|0)+16>>2]|0)!=(h|0))if((A[11120+(c*216|0)+24>>2]|0)!=(h|0))if((A[11120+(c*216|0)+32>>2]|0)!=(h|0))if((A[11120+(c*216|0)+40>>2]|0)!=(h|0))if((A[11120+(c*216|0)+48>>2]|0)!=(h|0))if((A[11120+(c*216|0)+56>>2]|0)!=(h|0))if((A[11120+(c*216|0)+64>>2]|0)!=(h|0))if((A[11120+(c*216|0)+72>>2]|0)!=(h|0))if((A[11120+(c*216|0)+80>>2]|0)!=(h|0))if((A[11120+(c*216|0)+88>>2]|0)!=(h|0))if((A[11120+(c*216|0)+96>>2]|0)!=(h|0))if((A[11120+(c*216|0)+104>>2]|0)!=(h|0))if((A[11120+(c*216|0)+112>>2]|0)!=(h|0))if((A[11120+(c*216|0)+120>>2]|0)!=(h|0))if((A[11120+(c*216|0)+128>>2]|0)!=(h|0))if((A[11120+(c*216|0)+136>>2]|0)==(h|0))h=2,f=1,m=2;else{if((A[11120+(c*216|0)+144>>2]|0)==(h|0)){h=0,f=2,m=0;break}if((A[11120+(c*216|0)+152>>2]|0)==(h|0)){h=0,f=2,m=1;break}if((A[11120+(c*216|0)+160>>2]|0)==(h|0)){h=0,f=2,m=2;break}if((A[11120+(c*216|0)+168>>2]|0)==(h|0)){h=1,f=2,m=0;break}if((A[11120+(c*216|0)+176>>2]|0)==(h|0)){h=1,f=2,m=1;break}if((A[11120+(c*216|0)+184>>2]|0)==(h|0)){h=1,f=2,m=2;break}if((A[11120+(c*216|0)+192>>2]|0)==(h|0)){h=2,f=2,m=0;break}if((A[11120+(c*216|0)+200>>2]|0)==(h|0)){h=2,f=2,m=1;break}if((A[11120+(c*216|0)+208>>2]|0)==(h|0)){h=2,f=2,m=2;break}else h=-1;return h|0}else h=2,f=1,m=1;else h=2,f=1,m=0;else h=1,f=1,m=2;else h=1,f=1,m=1;else h=1,f=1,m=0;else h=0,f=1,m=2;else h=0,f=1,m=1;else h=0,f=1,m=0;else h=2,f=0,m=2;else h=2,f=0,m=1;else h=2,f=0,m=0;else h=1,f=0,m=2;else h=1,f=0,m=1;else h=1,f=0,m=0;else h=0,f=0,m=2;else h=0,f=0,m=1;else h=0,f=0,m=0;while(!1);return c=A[11120+(c*216|0)+(f*72|0)+(h*24|0)+(m<<3)+4>>2]|0,c|0}function F3(h,c){return h=h|0,c=c|0,(A[7696+(h*28|0)+20>>2]|0)==(c|0)?(c=1,c|0):(c=(A[7696+(h*28|0)+24>>2]|0)==(c|0),c|0)}function Zg(h,c){return h=h|0,c=c|0,A[848+(h*28|0)+(c<<2)>>2]|0}function Jg(h,c){return h=h|0,c=c|0,(A[848+(h*28|0)>>2]|0)==(c|0)?(c=0,c|0):(A[848+(h*28|0)+4>>2]|0)==(c|0)?(c=1,c|0):(A[848+(h*28|0)+8>>2]|0)==(c|0)?(c=2,c|0):(A[848+(h*28|0)+12>>2]|0)==(c|0)?(c=3,c|0):(A[848+(h*28|0)+16>>2]|0)==(c|0)?(c=4,c|0):(A[848+(h*28|0)+20>>2]|0)==(c|0)?(c=5,c|0):((A[848+(h*28|0)+24>>2]|0)==(c|0)?6:7)|0}function sN(){return 122}function oN(h){h=h|0;var c=0,f=0,m=0;c=0;do et(c|0,0,45)|0,m=q()|0|134225919,f=h+(c<<3)|0,A[f>>2]=-1,A[f+4>>2]=m,c=c+1|0;while((c|0)!=122);return 0}function aN(h){h=h|0;var c=0,f=0,m=0;return m=+H[h+16>>3],f=+H[h+24>>3],c=m-f,+(m<f?c+6.283185307179586:c)}function U3(h){return h=h|0,+H[h+16>>3]<+H[h+24>>3]|0}function lN(h){return h=h|0,+(+H[h>>3]-+H[h+8>>3])}function e1(h,c){h=h|0,c=c|0;var f=0,m=0,_=0;return f=+H[c>>3],!(f>=+H[h+8>>3])||!(f<=+H[h>>3])?(c=0,c|0):(m=+H[h+16>>3],f=+H[h+24>>3],_=+H[c+8>>3],c=_>=f,h=_<=m&1,m<f?c&&(h=1):c||(h=0),c=(h|0)!=0,c|0)}function t1(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;return+H[h>>3]<+H[c+8>>3]||+H[h+8>>3]>+H[c>>3]?(m=0,m|0):(v=+H[h+16>>3],f=h+24|0,O=+H[f>>3],b=v<O,m=c+16|0,D=+H[m>>3],_=c+24|0,C=+H[_>>3],w=D<C,c=O-D<C-v,h=b?w|c?1:2:0,c=w?b?1:c?2:1:0,v=+Ds(v,h),v<+Ds(+H[_>>3],c)||(O=+Ds(+H[f>>3],h),O>+Ds(+H[m>>
40703],c))?(w=0,w|0):(w=1,w|0))}function uN(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0;v=+H[h+16>>3],C=+H[h+24>>3],h=v<C,w=+H[c+16>>3],b=+H[c+24>>3],_=w<b,c=C-w<b-v,A[f>>2]=h?_|c?1:2:0,A[m>>2]=_?h?1:c?2:1:0}function O3(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;return+H[h>>3]<+H[c>>3]||+H[h+8>>3]>+H[c+8>>3]?(m=0,m|0):(m=h+16|0,C=+H[m>>3],v=+H[h+24>>3],b=C<v,f=c+16|0,O=+H[f>>3],_=c+24|0,D=+H[_>>3],w=O<D,c=v-O<D-C,h=b?w|c?1:2:0,c=w?b?1:c?2:1:0,v=+Ds(v,h),v<=+Ds(+H[_>>3],c)?(O=+Ds(+H[m>>3],h),w=O>=+Ds(+H[f>>3],c),w|0):(w=0,w|0))}function k3(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0;_=G,G=G+176|0,m=_,A[m>>2]=4,w=+H[c>>3],H[m+8>>3]=w,v=+H[c+16>>3],H[m+16>>3]=v,H[m+24>>3]=w,w=+H[c+24>>3],H[m+32>>3]=w,b=+H[c+8>>3],H[m+40>>3]=b,H[m+48>>3]=w,H[m+56>>3]=b,H[m+64>>3]=v,c=m+72|0,f=c+96|0;do A[c>>2]=0,c=c+4|0;while((c|0)<(f|0));Ic(h|0,m|0,168)|0,G=_}function G3(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0;re=G,G=G+288|0,O=re+264|0,X=re+96|0,D=re,w=D,C=w+96|0;do A[w>>2]=0,w=w+4|0;while((w|0)<(C|0));return c=f1(c,D)|0,c|0?(ie=c,G=re,ie|0):(C=D,D=A[C>>2]|0,C=A[C+4>>2]|0,wu(D,C,O)|0,Nc(D,C,X)|0,b=+XA(O,X+8|0),H[O>>3]=+H[h>>3],C=O+8|0,H[C>>3]=+H[h+16>>3],H[X>>3]=+H[h+8>>3],D=X+8|0,H[D>>3]=+H[h+24>>3],_=+XA(O,X),ge=+H[C>>3]-+H[D>>3],v=+mn(+ge),he=+H[O>>3]-+H[X>>3],m=+mn(+he),!(ge==0|he==0)&&(ge=+vb(+v,+m),ge=+Te(+(_*_/+s0(+(ge/+s0(+v,+m)),3)/(b*(b*2.59807621135)*.8))),H[Cn>>3]=ge,ne=~~ge>>>0,ie=+mn(ge)>=1?ge>0?~~+gt(+ji(ge/4294967296),4294967295)>>>0:~~+Te((ge-+(~~ge>>>0))/4294967296)>>>0:0,(A[Cn+4>>2]&2146435072|0)!=2146435072)?(X=(ne|0)==0&(ie|0)==0,c=f,A[c>>2]=X?1:ne,A[c+4>>2]=X?0:ie,c=0):c=1,ie=c,G=re,ie|0)}function cN(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0;D=G,G=G+288|0,b=D+264|0,w=D+96|0,C=D,_=C,v=_+96|0;do A[_>>2]=0,_=_+4|0;while((_|0)<(v|0));return f=f1(f,C)|0,f|0?(m=f,G=D,m|0):(f=C,_=A[f>>2]|0,f=A[f+4>>2]|0,wu(_,f,b)|0,Nc(_,f,w)|0,O=+XA(b,w+8|0),O=+Te(+(+XA(h,c)/(O*2))),H[Cn>>3]=O,f=~~O>>>0,_=+mn(O)>=1?O>0?~~+gt(+ji(O/4294967296),4294967295)>>>0:~~+Te((O-+(~~O>>>0))/4294967296)>>>0:0,(A[Cn+4>>2]&2146435072|0)==2146435072?(m=1,G=D,m|0):(C=(f|0)==0&(_|0)==0,A[m>>2]=C?1:f,A[m+4>>2]=C?0:_,m=0,G=D,m|0))}function hN(h,c){h=h|0,c=+c;var f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;v=h+16|0,b=+H[v>>3],f=h+24|0,_=+H[f>>3],m=b-_,m=b<_?m+6.283185307179586:m,D=+H[h>>3],w=h+8|0,C=+H[w>>3],O=D-C,m=(m*c-m)*.5,c=(O*c-O)*.5,D=D+c,H[h>>3]=D>1.5707963267948966?1.5707963267948966:D,c=C-c,H[w>>3]=c<-1.5707963267948966?-1.5707963267948966:c,c=b+m,c=c>3.141592653589793?c+-6.283185307179586:c,H[v>>3]=c<-3.141592653589793?c+6.283185307179586:c,c=_-m,c=c>3.141592653589793?c+-6.283185307179586:c,H[f>>3]=c<-3.141592653589793?c+6.283185307179586:c}function AN(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0,A[h>>2]=c,A[h+4>>2]=f,A[h+8>>2]=m}function fN(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0;X=c+8|0,A[X>>2]=0,C=+H[h>>3],b=+mn(+C),D=+H[h+8>>3],w=+mn(+D)*1.1547005383792515,b=b+w*.5,f=~~b,h=~~w,b=b-+(f|0),w=w-+(h|0);do if(b<.5)if(b<.3333333333333333)if(A[c>>2]=f,w<(b+1)*.5){A[c+4>>2]=h;break}else{h=h+1|0,A[c+4>>2]=h;break}else if(ne=1-b,h=(!(w<ne)&1)+h|0,A[c+4>>2]=h,ne<=w&w<b*2){f=f+1|0,A[c>>2]=f;break}else{A[c>>2]=f;break}else{if(!(b<.6666666666666666))if(f=f+1|0,A[c>>2]=f,w<b*.5){A[c+4>>2]=h;break}else{h=h+1|0,A[c+4>>2]=h;break}if(w<1-b){if(A[c+4>>2]=h,b*2+-1<w){A[c>>2]=f;break}}else h=h+1|0,A[c+4>>2]=h;f=f+1|0,A[c>>2]=f}while(!1);do if(C<0)if(h&1){O=(h+1|0)/2|0,O=ur(f|0,((f|0)<0)<<31>>31|0,O|0,((O|0)<0)<<31>>31|0)|0,f=~~(+(f|0)-((+(O>>>0)+4294967296*+(q()|0))*2+1)),A[c>>2]=f;break}else{O=(h|0)/2|0,O=ur(f|0,((f|0)<0)<<31>>31|0,O|0,((O|0)<0)<<31>>31|0)|0,f=~~(+(f|0)-(+(O>>>0)+4294967296*+(q()|0))*2),A[c>>2]=f;break}while(!1);O=c+4|0,D<0&&(f=f-((h<<1|1|0)/2|0)|0,A[c>>2]=f,h=0-h|0,A[O>>2]=h),m=h-f|0,(f|0)<0?(_=0-f|0,A[O>>2]=m,A[X>>2]=_,A[c>>2]=0,h=m,f=0):_=0,(h|0)<0&&(f=f-h|0,A[c>>2]=f,_=_-h|0,A[X>>2]=_,A[O>>2]=0,h=0),v=f-_|0,m=h-_|0,(_|0)<0&&(A[c>>2]=v,A[O>>2]=m,A[X>>2]=0,h=m,f=v,_=0),m=(h|0)<(f|0)?h:f,m=(_|0)<(m|0)?_:m,!((m|0)<=0)&&(A[c>>2]=f-m,A[O>>2]=h-m,A[X>>2]=_-m)}function Lr(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0;c=A[h>>2]|0,b=h+4|0,f=A[b>>2]|0,(c|0)<0&&(f=f-c|0,A[b>>2]=f,v=h+8|0,A[v>>2]=(A[v>>2]|0)-c,A[h>>2]=0,c=0),(f|0)<0?(c=c-f|0,A[h>>2]=c,v=h+8|0,_=(A[v>>2]|0)-f|0,A[v>>2]=_,A[b>>2]=0,f=0):(_=h+8|0,v=_,_=A[_>>2]|0),(_|0)<0&&(c=c-_|0,A[h>>2]=c,f=f-_|0,A[b>>2]=f,A[v>>2]=0,_=0),m=(f|0)<(c|0)?f:c,m=(_|0)<(m|0)?_:m,!((m|0)<=0)&&(A[h>>2]=c-m,A[b>>2]=f-m,A[v>>2]=_-m)}function bu(h,c){h=h|0,c=c|0;var f=0,m=0;m=A[h+8>>2]|0,f=+((A[h+4>>2]|0)-m|0),H[c>>3]=+((A[h>>2]|0)-m|0)-f*.5,H[c+8>>3]=f*.8660254037844386}function jr(h,c,f){h=h|0,c=c|0,f=f|0,A[f>>2]=(A[c>>2]|0)+(A[h>>2]|0),A[f+4>>2]=(A[c+4>>2]|0)+(A[h+4>>2]|0),A[f+8>>2]=(A[c+8>>2]|0)+(A[h+8>>2]|0)}function n1(h,c,f){h=h|0,c=c|0,f=f|0,A[f>>2]=(A[h>>2]|0)-(A[c>>2]|0),A[f+4>>2]=(A[h+4>>2]|0)-(A[c+4>>2]|0),A[f+8>>2]=(A[h+8>>2]|0)-(A[c+8>>2]|0)}function V3(h,c){h=h|0,c=c|0;var f=0,m=0;f=be(A[h>>2]|0,c)|0,A[h>>2]=f,f=h+4|0,m=be(A[f>>2]|0,c)|0,A[f>>
40702]=m,h=h+8|0,c=be(A[h>>2]|0,c)|0,A[h>>2]=c}function Zd(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;b=A[h>>2]|0,w=(b|0)<0,m=(A[h+4>>2]|0)-(w?b:0)|0,v=(m|0)<0,_=(v?0-m|0:0)+((A[h+8>>2]|0)-(w?b:0))|0,f=(_|0)<0,h=f?0:_,c=(v?0:m)-(f?_:0)|0,_=(w?0:b)-(v?m:0)-(f?_:0)|0,f=(c|0)<(_|0)?c:_,f=(h|0)<(f|0)?h:f,m=(f|0)>0,h=h-(m?f:0)|0,c=c-(m?f:0)|0;e:do switch(_-(m?f:0)|0){case 0:switch(c|0){case 0:return w=h|0?(h|0)==1?1:7:0,w|0;case 1:return w=h|0?(h|0)==1?3:7:2,w|0;default:break e}case 1:switch(c|0){case 0:return w=h|0?(h|0)==1?5:7:4,w|0;case 1:{if(!h)h=6;else break e;return h|0}default:break e}}while(!1);return w=7,w|0}function dN(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0;if(C=h+8|0,b=A[C>>2]|0,w=(A[h>>2]|0)-b|0,D=h+4|0,b=(A[D>>2]|0)-b|0,w>>>0>715827881|b>>>0>715827881){if(m=(w|0)>0,_=2147483647-w|0,v=-2147483648-w|0,(m?(_|0)<(w|0):(v|0)>(w|0))||(f=w<<1,m?(2147483647-f|0)<(w|0):(-2147483648-f|0)>(w|0))||((b|0)>0?(2147483647-b|0)<(b|0):(-2147483648-b|0)>(b|0))||(c=w*3|0,f=b<<1,(m?(_|0)<(f|0):(v|0)>(f|0))||((w|0)>-1?(c|-2147483648|0)>=(b|0):(c^-2147483648|0)<(b|0))))return D=1,D|0}else f=b<<1,c=w*3|0;return m=yl(+(c-b|0)*.14285714285714285)|0,A[h>>2]=m,_=yl(+(f+w|0)*.14285714285714285)|0,A[D>>2]=_,A[C>>2]=0,f=(_|0)<(m|0),c=f?m:_,f=f?_:m,(f|0)<0&&(((f|0)==-2147483648||((c|0)>0?(2147483647-c|0)<(f|0):(-2147483648-c|0)>(f|0)))&&rt(27795,26892,354,26903),((c|0)>-1?(c|-2147483648|0)>=(f|0):(c^-2147483648|0)<(f|0))&&rt(27795,26892,354,26903)),c=_-m|0,(m|0)<0?(f=0-m|0,A[D>>2]=c,A[C>>2]=f,A[h>>2]=0,m=0):(c=_,f=0),(c|0)<0&&(m=m-c|0,A[h>>2]=m,f=f-c|0,A[C>>2]=f,A[D>>2]=0,c=0),v=m-f|0,_=c-f|0,(f|0)<0?(A[h>>2]=v,A[D>>2]=_,A[C>>2]=0,c=_,_=v,f=0):_=m,m=(c|0)<(_|0)?c:_,m=(f|0)<(m|0)?f:m,(m|0)<=0?(D=0,D|0):(A[h>>2]=_-m,A[D>>2]=c-m,A[C>>2]=f-m,D=0,D|0)}function pN(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0,C=0;if(b=h+8|0,_=A[b>>2]|0,v=(A[h>>2]|0)-_|0,w=h+4|0,_=(A[w>>2]|0)-_|0,v>>>0>715827881|_>>>0>715827881){if(f=(v|0)>0,(f?(2147483647-v|0)<(v|0):(-2147483648-v|0)>(v|0))||(c=v<<1,m=(_|0)>0,m?(2147483647-_|0)<(_|0):(-2147483648-_|0)>(_|0)))return w=1,w|0;if(C=_<<1,(m?(2147483647-C|0)<(_|0):(-2147483648-C|0)>(_|0))||(f?(2147483647-c|0)<(_|0):(-2147483648-c|0)>(_|0))||(f=_*3|0,(_|0)>-1?(f|-2147483648|0)>=(v|0):(f^-2147483648|0)<(v|0)))return C=1,C|0}else f=_*3|0,c=v<<1;return m=yl(+(c+_|0)*.14285714285714285)|0,A[h>>2]=m,_=yl(+(f-v|0)*.14285714285714285)|0,A[w>>2]=_,A[b>>2]=0,f=(_|0)<(m|0),c=f?m:_,f=f?_:m,(f|0)<0&&(((f|0)==-2147483648||((c|0)>0?(2147483647-c|0)<(f|0):(-2147483648-c|0)>(f|0)))&&rt(27795,26892,402,26917),((c|0)>-1?(c|-2147483648|0)>=(f|0):(c^-2147483648|0)<(f|0))&&rt(27795,26892,402,26917)),c=_-m|0,(m|0)<0?(f=0-m|0,A[w>>2]=c,A[b>>2]=f,A[h>>2]=0,m=0):(c=_,f=0),(c|0)<0&&(m=m-c|0,A[h>>2]=m,f=f-c|0,A[b>>2]=f,A[w>>2]=0,c=0),v=m-f|0,_=c-f|0,(f|0)<0?(A[h>>2]=v,A[w>>2]=_,A[b>>2]=0,c=_,_=v,f=0):_=m,m=(c|0)<(_|0)?c:_,m=(f|0)<(m|0)?f:m,(m|0)<=0?(C=0,C|0):(A[h>>2]=_-m,A[w>>2]=c-m,A[b>>2]=f-m,C=0,C|0)}function mN(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;b=h+8|0,f=A[b>>2]|0,c=(A[h>>2]|0)-f|0,w=h+4|0,f=(A[w>>2]|0)-f|0,m=yl(+((c*3|0)-f|0)*.14285714285714285)|0,A[h>>2]=m,c=yl(+((f<<1)+c|0)*.14285714285714285)|0,A[w>>2]=c,A[b>>2]=0,f=c-m|0,(m|0)<0?(v=0-m|0,A[w>>2]=f,A[b>>2]=v,A[h>>2]=0,c=f,m=0,f=v):f=0,(c|0)<0&&(m=m-c|0,A[h>>2]=m,f=f-c|0,A[b>>2]=f,A[w>>2]=0,c=0),v=m-f|0,_=c-f|0,(f|0)<0?(A[h>>2]=v,A[w>>2]=_,A[b>>2]=0,c=_,_=v,f=0):_=m,m=(c|0)<(_|0)?c:_,m=(f|0)<(m|0)?f:m,!((m|0)<=0)&&(A[h>>2]=_-m,A[w>>2]=c-m,A[b>>2]=f-m)}function q3(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;b=h+8|0,f=A[b>>2]|0,c=(A[h>>2]|0)-f|0,w=h+4|0,f=(A[w>>2]|0)-f|0,m=yl(+((c<<1)+f|0)*.14285714285714285)|0,A[h>>2]=m,c=yl(+((f*3|0)-c|0)*.14285714285714285)|0,A[w>>2]=c,A[b>>2]=0,f=c-m|0,(m|0)<0?(v=0-m|0,A[w>>2]=f,A[b>>2]=v,A[h>>2]=0,c=f,m=0,f=v):f=0,(c|0)<0&&(m=m-c|0,A[h>>2]=m,f=f-c|0,A[b>>2]=f,A[w>>2]=0,c=0),v=m-f|0,_=c-f|0,(f|0)<0?(A[h>>2]=v,A[w>>2]=_,A[b>>2]=0,c=_,_=v,f=0):_=m,m=(c|0)<(_|0)?c:_,m=(f|0)<(m|0)?f:m,!((m|0)<=0)&&(A[h>>2]=_-m,A[w>>2]=c-m,A[b>>2]=f-m)}function Jd(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;c=A[h>>2]|0,b=h+4|0,f=A[b>>2]|0,w=h+8|0,m=A[w>>2]|0,_=f+(c*3|0)|0,A[h>>2]=_,f=m+(f*3|0)|0,A[b>>2]=f,c=(m*3|0)+c|0,A[w>>2]=c,m=f-_|0,(_|0)<0?(c=c-_|0,A[b>>2]=m,A[w>>2]=c,A[h>>2]=0,f=m,m=0):m=_,(f|0)<0&&(m=m-f|0,A[h>>2]=m,c=c-f|0,A[w>>2]=c,A[b>>2]=0,f=0),v=m-c|0,_=f-c|0,(c|0)<0?(A[h>>2]=v,A[b>>2]=_,A[w>>2]=0,m=v,c=0):_=f,f=(_|0)<(m|0)?_:m,f=(c|0)<(f|0)?c:f,!((f|0)<=0)&&(A[h>>2]=m-f,A[b>>2]=_-f,A[w>>2]=c-f)}function Su(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;_=A[h>>2]|0,b=h+4|0,c=A[b>>2]|0,w=h+8|0,f=A[w>>2]|0,m=(c*3|0)+_|0,_=f+(_*3|0)|0,A[h>>2]=_,A[b>>2]=m,c=(f*3|0)+c|0,A[w>>2]=c,f=m-_|0,(_|0)<0?(c=c-_|0,A[b>>2]=f,A[w>>2]=c,A[h>>2]=0,_=0):f=m,(f|0)<0&&(_=_-f|0,A[h>>2]=_,c=c-f|0,A[w>>2]=c,A[b>>2]=0,f=0),v=_-c|0,m=f-c|0,(c|0)<0?(A[h>>2]=v,A[b>>2]=m,A[w>>2]=0,_=v,c=0):m=f,f=(m|0)<(_|0)?m:_,f=(c|0)<(f|0)?c:f,!((f|0)<=0)&&(A[h>>2]=_-f,A[b>>2]=m-f,A[w>>2]=c-f)}function z3(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0;(c+-1|0)>>>0>=6||(_=(A[15440+(c*12|0)>>2]|0)+(A[h>>2]|0)|0,A[h>>2]=_,w=h+4|0,m=(A[15440+(c*12|0)+4>>2]|0)+(A[w>>2]|0)|0,A[w>>2]=m,b=h+8|0,c=(A[15440+(c*12|0)+8>>2]|0)+(A[b>>2]|0)|0,A[b>>2]=c,f=m-_|0,(_|0)<0?(c=c-_|0,A[w>>2]=f,A[b>>2]=c,A[h>>2]=0,m=0):(f=m,m=_),(f|0)<0&&(m=m-f|0,A[h>>2]=m,c=c-f|0,A[b>>2]=c,A[w>>2]=0,f=0),v=m-c|0,_=f-c|0,(c|0)<0?(A[h>>2]=v,A[w>>2]=_,A[b>>2]=0,m=v,c=0):_=f,f=(_|0)<(m|0)?_:m,f=(c|0)<(f|0)?c:f,!((f|0)<=0)&&(A[h>>2]=m-f,A[w>>2]=_-f,A[b>>2]=c-f))}function H3(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;_=A[h>>2]|0,b=h+4|0,c=A[b>>2]|0,w=h+8|0,f=A[w>>2]|0,m=c+_|0,_=f+_|0,A[h>>2]=_,A[b>>2]=m,c=f+c|0,A[w>>2]=c,f=m-_|0,(_|0)<0?(c=c-_|0,A[b>>2]=f,A[w>>2]=c,A[h>>2]=0,m=0):(f=m,m=_),(f|0)<0&&(m=m-f|0,A[h>>2]=m,c=c-f|0,A[w>>2]=c,A[b>>2]=0,f=0),v=m-c|0,_=f-c|0,(c|0)<0?(A[h>>2]=v,A[b>>2]=_,A[w>>2]=0,m=v,c=0):_=f,f=(_|0)<(m|0)?_:m,f=(c|0)<(f|0)?c:f,!((f|0)<=0)&&(A[h>>2]=m-f,A[b>>2]=_-f,A[w>>2]=c-f)}function e0(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;c=A[h>>2]|0,b=h+4|0,m=A[b>>2]|0,w=h+8|0,f=A[w>>2]|0,_=m+c|0,A[h>>2]=_,m=f+m|0,A[b>>2]=m,c=f+c|0,A[w>>2]=c,f=m-_|0,(_|0)<0?(c=c-_|0,A[b>>2]=f,A[w>>2]=c,A[h>>2]=0,m=0):(f=m,m=_),(f|0)<0&&(m=m-f|0,A[h>>2]=m,c=c-f|0,A[w>>2]=c,A[b>>2]=0,f=0),v=m-c|0,_=f-c|0,(c|0)<0?(A[h>>2]=v,A[b>>2]=_,A[w>>2]=0,m=v,c=0):_=f,f=(_|0)<(m|0)?_:m,f=(c|0)<(f|0)?c:f,!((f|0)<=0)&&(A[h>>2]=m-f,A[b>>2]=_-f,A[w>>2]=c-f)}function Tu(h){switch(h=h|0,h|0){case 1:{h=5;break}case 5:{h=4;break}case 4:{h=6;break}case 6:{h=2;break}case 2:{h=3;break}case 3:{h=1;break}}return h|0}function xl(h){switch(h=h|0,h|0){case 1:{h=3;break}case 3:{h=2;break}case 2:{h=6;break}case 6:{h=4;break}case 4:{h=5;break}case 5:{h=1;break}}return h|0}function W3(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;c=A[h>>2]|0,b=h+4|0,f=A[b>>2]|0,w=h+8|0,m=A[w>>2]|0,_=f+(c<<1)|0,A[h>>2]=_,f=m+(f<<1)|0,A[b>>2]=f,c=(m<<1)+c|0,A[w>>2]=c,m=f-_|0,(_|0)<0?(c=c-_|0,A[b>>2]=m,A[w>>2]=c,A[h>>2]=0,f=m,m=0):m=_,(f|0)<0&&(m=m-f|0,A[h>>2]=m,c=c-f|0,A[w>>2]=c,A[b>>2]=0,f=0),v=m-c|0,_=f-c|0,(c|0)<0?(A[h>>2]=v,A[b>>2]=_,A[w>>2]=0,m=v,c=0):_=f,f=(_|0)<(m|0)?_:m,f=(c|0)<(f|0)?c:f,!((f|0)<=0)&&(A[h>>2]=m-f,A[b>>2]=_-f,A[w>>2]=c-f)}function $3(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;_=A[h>>2]|0,b=h+4|0,c=A[b>>2]|0,w=h+8|0,f=A[w>>2]|0,m=(c<<1)+_|0,_=f+(_<<1)|0,A[h>>2]=_,A[b>>2]=m,c=(f<<1)+c|0,A[w>>2]=c,f=m-_|0,(_|0)<0?(c=c-_|0,A[b>>2]=f,A[w>>2]=c,A[h>>2]=0,_=0):f=m,(f|0)<0&&(_=_-f|0,A[h>>2]=_,c=c-f|0,A[w>>2]=c,A[b>>2]=0,f=0),v=_-c|0,m=f-c|0,(c|0)<0?(A[h>>2]=v,A[b>>2]=m,A[w>>2]=0,_=v,c=0):m=f,f=(m|0)<(_|0)?m:_,f=(c|0)<(f|0)?c:f,!((f|0)<=0)&&(A[h>>2]=_-f,A[b>>2]=m-f,A[w>>2]=c-f)}function i1(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0;return b=(A[h>>2]|0)-(A[c>>2]|0)|0,w=(b|0)<0,m=(A[h+4>>2]|0)-(A[c+4>>2]|0)-(w?b:0)|0,v=(m|0)<0,_=(w?0-b|0:0)+(A[h+8>>2]|0)-(A[c+8>>2]|0)+(v?0-m|0:0)|0,h=(_|0)<0,c=h?0:_,f=(v?0:m)-(h?_:0)|0,_=(w?0:b)-(v?m:0)-(h?_:0)|0,h=(f|0)<(_|0)?f:_,h=(c|0)<(h|0)?c:h,m=(h|0)>0,c=c-(m?h:0)|0,f=f-(m?h:0)|0,h=_-(m?h:0)|0,h=(h|0)>-1?h:0-h|0,f=(f|0)>-1?f:0-f|0,c=(c|0)>-1?c:0-c|0,c=(f|0)>(c|0)?f:c,((h|0)>(c|0)?h:c)|0}function gN(h,c){h=h|0,c=c|0;var f=0;f=A[h+8>>2]|0,A[c>>2]=(A[h>>2]|0)-f,A[c+4>>2]=(A[h+4>>2]|0)-f}function _N(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0;return m=A[h>>2]|0,A[c>>2]=m,_=A[h+4>>2]|0,b=c+4|0,A[b>>2]=_,w=c+8|0,A[w>>2]=0,f=(_|0)<(m|0),h=f?m:_,f=f?_:m,(f|0)<0&&((f|0)==-2147483648||((h|0)>0?(2147483647-h|0)<(f|0):(-2147483648-h|0)>(f|0))||((h|0)>-1?(h|-2147483648|0)>=(f|0):(h^-2147483648|0)<(f|0)))?(c=1,c|0):(h=_-m|0,(m|0)<0?(f=0-m|0,A[b>>2]=h,A[w>>2]=f,A[c>>2]=0,m=0):(h=_,f=0),(h|0)<0&&(m=m-h|0,A[c>>2]=m,f=f-h|0,A[w>>2]=f,A[b>>2]=0,h=0),v=m-f|0,_=h-f|0,(f|0)<0?(A[c>>2]=v,A[b>>2]=_,A[w>>2]=0,h=_,_=v,f=0):_=m,m=(h|0)<(_|0)?h:_,m=(f|0)<(m|0)?f:m,(m|0)<=0?(c=0,c|0):(A[c>>2]=_-m,A[b>>2]=h-m,A[w>>2]=f-m,c=0,c|0))}function j3(h){h=h|0;var c=0,f=0,m=0,_=0;c=h+8|0,_=A[c>>2]|0,f=_-(A[h>>2]|0)|0,A[h>>2]=f,m=h+4|0,h=(A[m>>2]|0)-_|0,A[m>>2]=h,A[c>>2]=0-(h+f)}function xN(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;f=A[h>>2]|0,c=0-f|0,A[h>>2]=c,b=h+8|0,A[b>>2]=0,w=h+4|0,m=A[w>>2]|0,_=m+f|0,(f|0)>0?(A[w>>2]=_,A[b>>2]=f,A[h>>2]=0,c=0,m=_):f=0,(m|0)<0?(v=c-m|0,A[h>>2]=v,f=f-m|0,A[b>>2]=f,A[w>>2]=0,_=v-f|0,c=0-f|0,(f|0)<0?(A[h>>2]=_,A[w>>2]=c,A[b>>
40702]=0,m=c,f=0):(m=0,_=v)):_=c,c=(m|0)<(_|0)?m:_,c=(f|0)<(c|0)?f:c,!((c|0)<=0)&&(A[h>>2]=_-c,A[w>>2]=m-c,A[b>>2]=f-c)}function vN(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0;if(X=G,G=G+64|0,O=X,w=X+56|0,!(!0&(c&2013265920|0)==134217728&(!0&(m&2013265920|0)==134217728)))return _=5,G=X,_|0;if((h|0)==(f|0)&(c|0)==(m|0))return A[_>>2]=0,_=0,G=X,_|0;if(b=ze(h|0,c|0,52)|0,q()|0,b=b&15,D=ze(f|0,m|0,52)|0,q()|0,(b|0)!=(D&15|0))return _=12,G=X,_|0;if(v=b+-1|0,b>>>0>1){l1(h,c,v,O)|0,l1(f,m,v,w)|0,D=O,C=A[D>>2]|0,D=A[D+4>>2]|0;e:do if((C|0)==(A[w>>2]|0)&&(D|0)==(A[w+4>>2]|0)){b=(b^15)*3|0,v=ze(h|0,c|0,b|0)|0,q()|0,v=v&7,b=ze(f|0,m|0,b|0)|0,q()|0,b=b&7;do if((v|0)==0|(b|0)==0)A[_>>2]=1,v=0;else if((v|0)==7)v=5;else{if((v|0)==1|(b|0)==1&&Ai(C,D)|0){v=5;break}if((A[15536+(v<<2)>>2]|0)!=(b|0)&&(A[15568+(v<<2)>>2]|0)!=(b|0))break e;A[_>>2]=1,v=0}while(!1);return _=v,G=X,_|0}while(!1)}v=O,b=v+56|0;do A[v>>2]=0,v=v+4|0;while((v|0)<(b|0));return Ho(h,c,1,O)|0,c=O,!((A[c>>2]|0)==(f|0)&&(A[c+4>>2]|0)==(m|0))&&(c=O+8|0,!((A[c>>2]|0)==(f|0)&&(A[c+4>>2]|0)==(m|0)))&&(c=O+16|0,!((A[c>>2]|0)==(f|0)&&(A[c+4>>2]|0)==(m|0)))&&(c=O+24|0,!((A[c>>2]|0)==(f|0)&&(A[c+4>>2]|0)==(m|0)))&&(c=O+32|0,!((A[c>>2]|0)==(f|0)&&(A[c+4>>2]|0)==(m|0)))&&(c=O+40|0,!((A[c>>2]|0)==(f|0)&&(A[c+4>>2]|0)==(m|0)))?(v=O+48|0,v=((A[v>>2]|0)==(f|0)?(A[v+4>>2]|0)==(m|0):0)&1):v=1,A[_>>2]=v,_=0,G=X,_|0}function yN(h,c,f,m,_){return h=h|0,c=c|0,f=f|0,m=m|0,_=_|0,f=Ec(h,c,f,m)|0,(f|0)==7?(_=11,_|0):(m=et(f|0,0,56)|0,c=c&-2130706433|(q()|0)|268435456,A[_>>2]=h|m,A[_+4>>2]=c,_=0,_|0)}function bN(h,c,f){return h=h|0,c=c|0,f=f|0,!0&(c&2013265920|0)==268435456?(A[f>>2]=h,A[f+4>>2]=c&-2130706433|134217728,f=0,f|0):(f=6,f|0)}function SN(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0;return _=G,G=G+16|0,m=_,A[m>>2]=0,!0&(c&2013265920|0)==268435456?(v=ze(h|0,c|0,56)|0,q()|0,m=mi(h,c&-2130706433|134217728,v&7,m,f)|0,G=_,m|0):(m=6,G=_,m|0)}function X3(h,c){h=h|0,c=c|0;var f=0;switch(f=ze(h|0,c|0,56)|0,q()|0,f&7){case 0:case 7:return f=0,f|0}return f=c&-2130706433|134217728,!(!0&(c&2013265920|0)==268435456)||!0&(c&117440512|0)==16777216&(Ai(h,f)|0)!=0?(f=0,f|0):(f=o1(h,f)|0,f|0)}function TN(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0;return _=G,G=G+16|0,m=_,!0&(c&2013265920|0)==268435456?(v=c&-2130706433|134217728,b=f,A[b>>2]=h,A[b+4>>2]=v,A[m>>2]=0,c=ze(h|0,c|0,56)|0,q()|0,m=mi(h,v,c&7,m,f+8|0)|0,G=_,m|0):(m=6,G=_,m|0)}function MN(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0;return _=(Ai(h,c)|0)==0,c=c&-2130706433,m=f,A[m>>2]=_?h:0,A[m+4>>2]=_?c|285212672:0,m=f+8|0,A[m>>2]=h,A[m+4>>2]=c|301989888,m=f+16|0,A[m>>2]=h,A[m+4>>2]=c|318767104,m=f+24|0,A[m>>2]=h,A[m+4>>2]=c|335544320,m=f+32|0,A[m>>2]=h,A[m+4>>2]=c|352321536,f=f+40|0,A[f>>2]=h,A[f+4>>2]=c|369098752,0}function t0(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0;return b=G,G=G+16|0,_=b,v=c&-2130706433|134217728,!0&(c&2013265920|0)==268435456?(m=ze(h|0,c|0,56)|0,q()|0,m=MP(h,v,m&7)|0,(m|0)==-1?(A[f>>2]=0,v=6,G=b,v|0):(Cc(h,v,_)|0&&rt(27795,26932,282,26947),c=ze(h|0,c|0,52)|0,q()|0,c=c&15,Ai(h,v)|0?r1(_,c,m,2,f):s1(_,c,m,2,f),v=0,G=b,v|0)):(v=6,G=b,v|0)}function wN(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0;m=G,G=G+16|0,_=m,EN(h,c,f,_),fN(_,f+4|0),G=m}function EN(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0;if(w=G,G=G+16|0,C=w,RN(h,f,C),v=+wc(+(1-+H[C>>3]*.5)),v<1e-16){A[m>>2]=0,A[m+4>>2]=0,A[m+8>>2]=0,A[m+12>>2]=0,G=w;return}if(C=A[f>>2]|0,_=+H[15920+(C*24|0)>>3],_=+jA(_-+jA(+XN(15600+(C<<4)|0,h))),Ks(c)|0?b=+jA(_+-.3334731722518321):b=_,_=+fs(+v)*2.618033988749896,(c|0)>0){h=0;do _=_*2.6457513110645907,h=h+1|0;while((h|0)!=(c|0))}v=+kn(+b)*_,H[m>>3]=v,b=+xn(+b)*_,H[m+8>>3]=b,G=w}function RN(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0;if(v=G,G=G+32|0,_=v,TP(h,_),A[c>>2]=0,H[f>>3]=5,m=+Zi(16400,_),m<+H[f>>3]&&(A[c>>2]=0,H[f>>3]=m),m=+Zi(16424,_),m<+H[f>>3]&&(A[c>>2]=1,H[f>>3]=m),m=+Zi(16448,_),m<+H[f>>3]&&(A[c>>2]=2,H[f>>3]=m),m=+Zi(16472,_),m<+H[f>>3]&&(A[c>>2]=3,H[f>>3]=m),m=+Zi(16496,_),m<+H[f>>3]&&(A[c>>2]=4,H[f>>3]=m),m=+Zi(16520,_),m<+H[f>>3]&&(A[c>>2]=5,H[f>>3]=m),m=+Zi(16544,_),m<+H[f>>3]&&(A[c>>2]=6,H[f>>3]=m),m=+Zi(16568,_),m<+H[f>>3]&&(A[c>>2]=7,H[f>>3]=m),m=+Zi(16592,_),m<+H[f>>3]&&(A[c>>2]=8,H[f>>3]=m),m=+Zi(16616,_),m<+H[f>>3]&&(A[c>>2]=9,H[f>>3]=m),m=+Zi(16640,_),m<+H[f>>3]&&(A[c>>2]=10,H[f>>3]=m),m=+Zi(16664,_),m<+H[f>>3]&&(A[c>>2]=11,H[f>>3]=m),m=+Zi(16688,_),m<+H[f>>3]&&(A[c>>2]=12,H[f>>3]=m),m=+Zi(16712,_),m<+H[f>>3]&&(A[c>>2]=13,H[f>>3]=m),m=+Zi(16736,_),m<+H[f>>3]&&(A[c>>2]=14,H[f>>3]=m),m=+Zi(16760,_),m<+H[f>>3]&&(A[c>>2]=15,H[f>>3]=m),m=+Zi(16784,_),m<+H[f>>3]&&(A[c>>2]=16,H[f>>3]=m),m=+Zi(16808,_),m<+H[f>>3]&&(A[c>>2]=17,H[f>>3]=m),m=+Zi(16832,_),m<+H[f>>3]&&(A[c>>2]=18,H[f>>3]=m),m=+Zi(16856,_),!(m<+H[f>>3])){G=v;return}A[c>>2]=19,H[f>>3]=m,G=v}function WA(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0;if(v=+SP(h),v<1e-16){c=15600+(c<<4)|0,A[_>>2]=A[c>>2],A[_+4>>2]=A[c+4>>2],A[_+8>>2]=A[c+8>>2],A[_+12>>2]=A[c+12>>
40702];return}if(b=+we(+ +H[h+8>>3],+ +H[h>>3]),(f|0)>0){h=0;do v=v*.37796447300922725,h=h+1|0;while((h|0)!=(f|0))}w=v*.3333333333333333,m?(f=(Ks(f)|0)==0,v=+_e(+((f?w:w*.37796447300922725)*.381966011250105))):(v=+_e(+(v*.381966011250105)),Ks(f)|0&&(b=+jA(b+.3334731722518321))),QN(15600+(c<<4)|0,+jA(+H[15920+(c*24|0)>>3]-b),v,_)}function CN(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0;m=G,G=G+16|0,_=m,bu(h+4|0,_),WA(_,A[h>>2]|0,c,0,f),G=m}function r1(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0,Gt=0,Et=0,An=0,dn=0,Tn=0,on=0,Vt=0,tt=0,vn=0,si=0,gn=0;if(vn=G,G=G+272|0,v=vn+256|0,ye=vn+240|0,on=vn,Vt=vn+224|0,tt=vn+208|0,xe=vn+176|0,Ae=vn+160|0,it=vn+192|0,Gt=vn+144|0,Et=vn+128|0,An=vn+112|0,dn=vn+96|0,Tn=vn+80|0,A[v>>2]=c,A[ye>>2]=A[h>>2],A[ye+4>>2]=A[h+4>>2],A[ye+8>>2]=A[h+8>>2],A[ye+12>>2]=A[h+12>>2],Q3(ye,v,on),A[_>>2]=0,ye=m+f+((m|0)==5&1)|0,(ye|0)<=(f|0)){G=vn;return}C=A[v>>2]|0,D=Vt+4|0,O=xe+4|0,X=f+5|0,ne=16880+(C<<2)|0,ie=16960+(C<<2)|0,re=Et+8|0,he=An+8|0,ge=dn+8|0,Ee=tt+4|0,w=f;e:for(;;){b=on+(((w|0)%5|0)<<4)|0,A[tt>>2]=A[b>>2],A[tt+4>>2]=A[b+4>>2],A[tt+8>>2]=A[b+8>>2],A[tt+12>>2]=A[b+12>>2];do;while((Rc(tt,C,0,1)|0)==2);if((w|0)>(f|0)&(Ks(c)|0)!=0){if(A[xe>>2]=A[tt>>2],A[xe+4>>2]=A[tt+4>>2],A[xe+8>>2]=A[tt+8>>2],A[xe+12>>2]=A[tt+12>>2],bu(D,Ae),m=A[xe>>2]|0,v=A[17040+(m*80|0)+(A[Vt>>2]<<2)>>2]|0,A[xe>>2]=A[18640+(m*80|0)+(v*20|0)>>2],b=A[18640+(m*80|0)+(v*20|0)+16>>2]|0,(b|0)>0){h=0;do H3(O),h=h+1|0;while((h|0)<(b|0))}switch(b=18640+(m*80|0)+(v*20|0)+4|0,A[it>>2]=A[b>>2],A[it+4>>2]=A[b+4>>2],A[it+8>>2]=A[b+8>>2],V3(it,(A[ne>>2]|0)*3|0),jr(O,it,O),Lr(O),bu(O,Gt),si=+(A[ie>>2]|0),H[Et>>3]=si*3,H[re>>3]=0,gn=si*-1.5,H[An>>3]=gn,H[he>>3]=si*2.598076211353316,H[dn>>3]=gn,H[ge>>3]=si*-2.598076211353316,A[17040+((A[xe>>2]|0)*80|0)+(A[tt>>2]<<2)>>2]|0){case 1:{h=An,m=Et;break}case 3:{h=dn,m=An;break}case 2:{h=Et,m=dn;break}default:{h=12;break e}}hb(Ae,Gt,m,h,Tn),WA(Tn,A[xe>>2]|0,C,1,_+8+(A[_>>2]<<4)|0),A[_>>2]=(A[_>>2]|0)+1}if((w|0)<(X|0)&&(bu(Ee,xe),WA(xe,A[tt>>2]|0,C,1,_+8+(A[_>>2]<<4)|0),A[_>>2]=(A[_>>2]|0)+1),A[Vt>>2]=A[tt>>2],A[Vt+4>>2]=A[tt+4>>2],A[Vt+8>>2]=A[tt+8>>2],A[Vt+12>>2]=A[tt+12>>2],w=w+1|0,(w|0)>=(ye|0)){h=3;break}}if((h|0)==3){G=vn;return}else(h|0)==12&&rt(26970,27017,572,27027)}function Q3(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0;C=G,G=G+128|0,m=C+64|0,_=C,v=m,b=20240,w=v+60|0;do A[v>>2]=A[b>>2],v=v+4|0,b=b+4|0;while((v|0)<(w|0));v=_,b=20304,w=v+60|0;do A[v>>2]=A[b>>2],v=v+4|0,b=b+4|0;while((v|0)<(w|0));w=(Ks(A[c>>2]|0)|0)==0,m=w?m:_,_=h+4|0,W3(_),$3(_),Ks(A[c>>2]|0)|0&&(Su(_),A[c>>2]=(A[c>>2]|0)+1),A[f>>2]=A[h>>2],c=f+4|0,jr(_,m,c),Lr(c),A[f+16>>2]=A[h>>2],c=f+20|0,jr(_,m+12|0,c),Lr(c),A[f+32>>2]=A[h>>2],c=f+36|0,jr(_,m+24|0,c),Lr(c),A[f+48>>2]=A[h>>2],c=f+52|0,jr(_,m+36|0,c),Lr(c),A[f+64>>2]=A[h>>2],f=f+68|0,jr(_,m+48|0,f),Lr(f),G=C}function Rc(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0;if(re=G,G=G+32|0,ne=re+12|0,w=re,ie=h+4|0,X=A[16960+(c<<2)>>2]|0,O=(m|0)!=0,X=O?X*3|0:X,_=A[ie>>2]|0,D=h+8|0,b=A[D>>2]|0,O){if(v=h+12|0,m=A[v>>2]|0,_=b+_+m|0,(_|0)==(X|0))return ie=1,G=re,ie|0;C=v}else C=h+12|0,m=A[C>>2]|0,_=b+_+m|0;if((_|0)<=(X|0))return ie=0,G=re,ie|0;do if((m|0)>0){if(m=A[h>>2]|0,(b|0)>0){v=18640+(m*80|0)+60|0,m=h;break}m=18640+(m*80|0)+40|0,f?(AN(ne,X,0,0),n1(ie,ne,w),e0(w),jr(w,ne,ie),v=m,m=h):(v=m,m=h)}else v=18640+((A[h>>2]|0)*80|0)+20|0,m=h;while(!1);if(A[m>>2]=A[v>>2],_=v+16|0,(A[_>>2]|0)>0){m=0;do H3(ie),m=m+1|0;while((m|0)<(A[_>>2]|0))}return h=v+4|0,A[ne>>2]=A[h>>2],A[ne+4>>2]=A[h+4>>2],A[ne+8>>2]=A[h+8>>2],c=A[16880+(c<<2)>>2]|0,V3(ne,O?c*3|0:c),jr(ie,ne,ie),Lr(ie),O?m=((A[D>>2]|0)+(A[ie>>2]|0)+(A[C>>2]|0)|0)==(X|0)?1:2:m=2,ie=m,G=re,ie|0}function NN(h,c){h=h|0,c=c|0;var f=0;do f=Rc(h,c,0,1)|0;while((f|0)==2);return f|0}function s1(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0,Gt=0,Et=0,An=0,dn=0,Tn=0,on=0;if(dn=G,G=G+240|0,v=dn+224|0,it=dn+208|0,Gt=dn,Et=dn+192|0,An=dn+176|0,ge=dn+160|0,Ee=dn+144|0,ye=dn+128|0,xe=dn+112|0,Ae=dn+96|0,A[v>>2]=c,A[it>>2]=A[h>>2],A[it+4>>2]=A[h+4>>2],A[it+8>>2]=A[h+8>>2],A[it+12>>2]=A[h+12>>2],Y3(it,v,Gt),A[_>>2]=0,he=m+f+((m|0)==6&1)|0,(he|0)<=(f|0)){G=dn;return}C=A[v>>2]|0,D=f+6|0,O=16960+(C<<2)|0,X=Ee+8|0,ne=ye+8|0,ie=xe+8|0,re=Et+4|0,b=0,w=f,m=-1;e:for(;;){if(v=(w|0)%6|0,h=Gt+(v<<4)|0,A[Et>>2]=A[h>>2],A[Et+4>>2]=A[h+4>>2],A[Et+8>>2]=A[h+8>>2],A[Et+12>>2]=A[h+12>>2],h=b,b=Rc(Et,C,0,1)|0,(w|0)>(f|0)&(Ks(c)|0)!=0&&(h|0)!=1&&(A[Et>>2]|0)!=(m|0)){switch(bu(Gt+(((v+5|0)%6|0)<<4)+4|0,An),bu(Gt+(v<<4)+4|0,ge),Tn=+(A[O>>2]|0),H[Ee>>3]=Tn*3,H[X>>3]=0,on=Tn*-1.5,H[ye>>3]=on,H[ne>>3]=Tn*2.598076211353316,H[xe>>3]=on,H[ie>>3]=Tn*-2.598076211353316,v=A[it>>2]|0,A[17040+(v*80|0)+(((m|0)==(v|0)?A[Et>>2]|0:m)<<2)>>2]|0){case 1:{h=ye,m=Ee;break}case 3:{h=xe,m=ye;break}case 2:{h=Ee,m=xe;break}default:{h=8;break e}}hb(An,ge,m,h,Ae),!(Ab(An,Ae)|0)&&!(Ab(ge,Ae)|0)&&(WA(Ae,A[it>>2]|0,C,1,_+8+(A[_>>2]<<4)|0),A[_>>2]=(A[_>>2]|0)+1)}if((w|0)<(D|0)&&(bu(re,An),WA(An,A[Et>>2]|0,C,1,_+8+(A[_>>2]<<4)|0),A[_>>2]=(A[_>>2]|0)+1),w=w+1|0,(w|0)>=(he|0)){h=3;break}else m=A[Et>>2]|0}if((h|0)==3){G=dn;return}else(h|0)==8&&rt(27054,27017,737,27099)}function Y3(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0;C=G,G=G+160|0,m=C+80|0,_=C,v=m,b=20368,w=v+72|0;do A[v>>2]=A[b>>2],v=v+4|0,b=b+4|0;while((v|0)<(w|0));v=_,b=20448,w=v+72|0;do A[v>>2]=A[b>>2],v=v+4|0,b=b+4|0;while((v|0)<(w|0));w=(Ks(A[c>>2]|0)|0)==0,m=w?m:_,_=h+4|0,W3(_),$3(_),Ks(A[c>>2]|0)|0&&(Su(_),A[c>>2]=(A[c>>2]|0)+1),A[f>>2]=A[h>>2],c=f+4|0,jr(_,m,c),Lr(c),A[f+16>>2]=A[h>>2],c=f+20|0,jr(_,m+12|0,c),Lr(c),A[f+32>>2]=A[h>>2],c=f+36|0,jr(_,m+24|0,c),Lr(c),A[f+48>>2]=A[h>>2],c=f+52|0,jr(_,m+36|0,c),Lr(c),A[f+64>>2]=A[h>>2],c=f+68|0,jr(_,m+48|0,c),Lr(c),A[f+80>>2]=A[h>>2],f=f+84|0,jr(_,m+60|0,f),Lr(f),G=C}function PN(h,c){return h=h|0,c=c|0,c=ze(h|0,c|0,52)|0,q()|0,c&15|0}function K3(h,c){return h=h|0,c=c|0,c=ze(h|0,c|0,45)|0,q()|0,c&127|0}function DN(h,c,f,m){return h=h|0,c=c|0,f=f|0,m=m|0,(f+-1|0)>>>0>14?(m=4,m|0):(f=ze(h|0,c|0,(15-f|0)*3|0)|0,q()|0,A[m>>2]=f&7,m=0,m|0)}function LN(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0;if(h>>>0>15)return m=4,m|0;if(c>>>0>121)return m=17,m|0;b=et(h|0,0,52)|0,_=q()|0,w=et(c|0,0,45)|0,_=_|(q()|0)|134225919;e:do if((h|0)>=1){for(w=1,b=(Ve[20528+c>>0]|0)!=0,v=-1;;){if(c=A[f+(w+-1<<2)>>2]|0,c>>>0>6){_=18,c=10;break}if(!((c|0)==0|b^1))if((c|0)==1){_=19,c=10;break}else b=0;if(D=(15-w|0)*3|0,C=et(7,0,D|0)|0,_=_&~(q()|0),c=et(c|0,((c|0)<0)<<31>>31|0,D|0)|0,v=c|v&~C,_=q()|0|_,(w|0)<(h|0))w=w+1|0;else break e}if((c|0)==10)return _|0}else v=-1;while(!1);return D=m,A[D>>2]=v,A[D+4>>2]=_,D=0,D|0}function o1(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0;return!(!0&(c&-16777216|0)==134217728)||(m=ze(h|0,c|0,52)|0,q()|0,m=m&15,f=ze(h|0,c|0,45)|0,q()|0,f=f&127,f>>>0>121)?(h=0,h|0):(b=(m^15)*3|0,_=ze(h|0,c|0,b|0)|0,b=et(_|0,q()|0,b|0)|0,_=q()|0,v=ur(-1227133514,-1171,b|0,_|0)|0,!((b&613566756&v|0)==0&(_&4681&(q()|0)|0)==0)||(b=(m*3|0)+19|0,v=et(~h|0,~c|0,b|0)|0,b=ze(v|0,q()|0,b|0)|0,!((m|0)==15|(b|0)==0&(q()|0)==0))?(b=0,b|0):!(Ve[20528+f>>0]|0)||(c=c&8191,(h|0)==0&(c|0)==0)?(b=1,b|0):(b=y1(h|0,c|0)|0,q()|0,((63-b|0)%3|0|0)!=0|0))}function IN(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0;return!0&(c&-16777216|0)==134217728&&(m=ze(h|0,c|0,52)|0,q()|0,m=m&15,f=ze(h|0,c|0,45)|0,q()|0,f=f&127,f>>>0<=121)&&(b=(m^15)*3|0,_=ze(h|0,c|0,b|0)|0,b=et(_|0,q()|0,b|0)|0,_=q()|0,v=ur(-1227133514,-1171,b|0,_|0)|0,(b&613566756&v|0)==0&(_&4681&(q()|0)|0)==0)&&(b=(m*3|0)+19|0,v=et(~h|0,~c|0,b|0)|0,b=ze(v|0,q()|0,b|0)|0,(m|0)==15|(b|0)==0&(q()|0)==0)&&(!(Ve[20528+f>>0]|0)||(f=c&8191,(h|0)==0&(f|0)==0)||(b=y1(h|0,f|0)|0,q()|0,(63-b|0)%3|0|0))||X3(h,c)|0?(b=1,b|0):(b=(fb(h,c)|0)!=0&1,b|0)}function a1(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0;if(_=et(c|0,0,52)|0,v=q()|0,f=et(f|0,0,45)|0,f=v|(q()|0)|134225919,(c|0)<1){v=-1,m=f,c=h,A[c>>2]=v,h=h+4|0,A[h>>2]=m;return}for(v=1,_=-1;b=(15-v|0)*3|0,w=et(7,0,b|0)|0,f=f&~(q()|0),b=et(m|0,0,b|0)|0,_=_&~w|b,f=f|(q()|0),(v|0)!=(c|0);)v=v+1|0;w=h,b=w,A[b>>2]=_,w=w+4|0,A[w>>2]=f}function l1(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0;if(v=ze(h|0,c|0,52)|0,q()|0,v=v&15,f>>>0>15)return m=4,m|0;if((v|0)<(f|0))return m=12,m|0;if((v|0)==(f|0))return A[m>>2]=h,A[m+4>>2]=c,m=0,m|0;if(_=et(f|0,0,52)|0,_=_|h,h=q()|0|c&-15728641,(v|0)>(f|0))do c=et(7,0,(14-f|0)*3|0)|0,f=f+1|0,_=c|_,h=q()|0|h;while((f|0)<(v|0));return A[m>>2]=_,A[m+4>>2]=h,m=0,m|0}function $A(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0;if(v=ze(h|0,c|0,52)|0,q()|0,v=v&15,!((f|0)<16&(v|0)<=(f|0)))return m=4,m|0;_=f-v|0,f=ze(h|0,c|0,45)|0,q()|0;e:do if(!(Si(f&127)|0))f=vl(7,0,_,((_|0)<0)<<31>>31)|0,_=q()|0;else{t:do if(v|0){for(f=1;b=et(7,0,(15-f|0)*3|0)|0,!!((b&h|0)==0&((q()|0)&c|0)==0);)if(f>>>0<v>>>0)f=f+1|0;else break t;f=vl(7,0,_,((_|0)<0)<<31>>31)|0,_=q()|0;break e}while(!1);f=vl(7,0,_,((_|0)<0)<<31>>31)|0,f=cr(f|0,q()|0,5,0)|0,f=jt(f|0,q()|0,-5,-1)|0,f=bl(f|0,q()|0,6,0)|0,f=jt(f|0,q()|0,1,0)|0,_=q()|0}while(!1);return b=m,A[b>>2]=f,A[b+4>>2]=_,b=0,b|0}function Ai(h,c){h=h|0,c=c|0;var f=0,m=0,_=0;if(_=ze(h|0,c|0,45)|0,q()|0,!(Si(_&127)|0))return _=0,_|0;_=ze(h|0,c|0,52)|0,q()|0,_=_&15;e:do if(!_)f=0;else for(m=1;;){if(f=ze(h|0,c|0,(15-m|0)*3|0)|0,q()|0,f=f&7,f|0)break e;if(m>>>0<_>>>0)m=m+1|0;else{f=0;break}}while(!1);return _=(f|0)==0&1,_|0}function BN(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0;if(b=G,G=G+16|0,v=b,d1(v,h,c,f),c=v,h=A[c>>2]|0,c=A[c+4>>2]|0,(h|0)==0&(c|0)==0)return G=b,0;_=0,f=0;do w=m+(_<<3)|0,A[w>>2]=h,A[w+4>>2]=c,_=jt(_|0,f|0,1,0)|0,f=q()|0,p1(v),w=v,h=A[w>>2]|0,c=A[w+4>>2]|0;while(!((h|0)==0&(c|0)==0));return G=b,0}function Z3(h,c,f,m){return h=h|0,c=c|0,f=f|0,m=m|0,(m|0)<(f|0)?(f=c,m=h,Qe(f|0),m|0):(f=et(-1,-1,((m-f|0)*3|0)+3|0)|0,m=et(~f|0,~(q()|0)|0,(15-m|0)*3|0)|0,f=~(q()|0)&c,m=~m&h,Qe(f|0),m|0)}function J3(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0;return _=ze(h|0,c|0,52)|0,q()|0,_=_&15,(f|0)<16&(_|0)<=(f|0)?((_|0)<(f|0)&&(_=et(-1,-1,((f+-1-_|0)*3|0)+3|0)|0,_=et(~_|0,~(q()|0)|0,(15-f|0)*3|0)|0,c=~(q()|0)&c,h=~_&h),_=et(f|0,0,52)|0,f=c&-15728641|(q()|0),A[m>>2]=h|_,A[m+4>>2]=f,m=0,m|0):(m=4,m|0)}function FN(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0,Gt=0,Et=0,An=0,dn=0,Tn=0,on=0,Vt=0,tt=0;if((f|0)==0&(m|0)==0)return tt=0,tt|0;if(_=h,v=A[_>>2]|0,_=A[_+4>>2]|0,!0&(_&15728640|0)==0){if(!((m|0)>0|(m|0)==0&f>>>0>0)||(tt=c,A[tt>>2]=v,A[tt+4>>2]=_,(f|0)==1&(m|0)==0))return tt=0,tt|0;_=1,v=0;do on=h+(_<<3)|0,Vt=A[on+4>>2]|0,tt=c+(_<<3)|0,A[tt>>2]=A[on>>2],A[tt+4>>2]=Vt,_=jt(_|0,v|0,1,0)|0,v=q()|0;while((v|0)<(m|0)|(v|0)==(m|0)&_>>>0<f>>>0);return _=0,_|0}if(Tn=f<<3,Vt=Wo(Tn)|0,!Vt)return tt=13,tt|0;if(Ic(Vt|0,h|0,Tn|0)|0,on=ps(f,8)|0,!on)return Xt(Vt),tt=13,tt|0;e:for(;;){_=Vt,D=A[_>>2]|0,_=A[_+4>>
40702]|0,An=ze(D|0,_|0,52)|0,q()|0,An=An&15,dn=An+-1|0,Et=(An|0)!=0,Gt=(m|0)>0|(m|0)==0&f>>>0>0;t:do if(Et&Gt){if(ye=et(dn|0,0,52)|0,xe=q()|0,dn>>>0>15){if(!((D|0)==0&(_|0)==0)){tt=16;break e}for(v=0,h=0;;){if(v=jt(v|0,h|0,1,0)|0,h=q()|0,!((h|0)<(m|0)|(h|0)==(m|0)&v>>>0<f>>>0))break t;if(b=Vt+(v<<3)|0,it=A[b>>2]|0,b=A[b+4>>2]|0,!((it|0)==0&(b|0)==0)){_=b,tt=16;break e}}}for(w=D,h=_,v=0,b=0;;){if(!((w|0)==0&(h|0)==0)){if(!(!0&(h&117440512|0)==0)){tt=21;break e}if(O=ze(w|0,h|0,52)|0,q()|0,O=O&15,(O|0)<(dn|0)){_=12,tt=27;break e}if((O|0)!=(dn|0)&&(w=w|ye,h=h&-15728641|xe,O>>>0>=An>>>0)){C=dn;do it=et(7,0,(14-C|0)*3|0)|0,C=C+1|0,w=it|w,h=q()|0|h;while(C>>>0<O>>>0)}if(ne=Lc(w|0,h|0,f|0,m|0)|0,ie=q()|0,C=on+(ne<<3)|0,O=C,X=A[O>>2]|0,O=A[O+4>>2]|0,!((X|0)==0&(O|0)==0)){ge=0,Ee=0;do{if((ge|0)>(m|0)|(ge|0)==(m|0)&Ee>>>0>f>>>0){tt=31;break e}if((X|0)==(w|0)&(O&-117440513|0)==(h|0)){re=ze(X|0,O|0,56)|0,q()|0,re=re&7,he=re+1|0,it=ze(X|0,O|0,45)|0,q()|0;n:do if(!(Si(it&127)|0))O=7;else{if(X=ze(X|0,O|0,52)|0,q()|0,X=X&15,!X){O=6;break}for(O=1;;){if(it=et(7,0,(15-O|0)*3|0)|0,!((it&w|0)==0&((q()|0)&h|0)==0)){O=7;break n}if(O>>>0<X>>>0)O=O+1|0;else{O=6;break}}}while(!1);if((re+2|0)>>>0>O>>>0){tt=41;break e}it=et(he|0,0,56)|0,h=q()|0|h&-117440513,Ae=C,A[Ae>>2]=0,A[Ae+4>>2]=0,w=it|w}else ne=jt(ne|0,ie|0,1,0)|0,ne=Dc(ne|0,q()|0,f|0,m|0)|0,ie=q()|0;Ee=jt(Ee|0,ge|0,1,0)|0,ge=q()|0,C=on+(ne<<3)|0,O=C,X=A[O>>2]|0,O=A[O+4>>2]|0}while(!((X|0)==0&(O|0)==0))}it=C,A[it>>2]=w,A[it+4>>2]=h}if(v=jt(v|0,b|0,1,0)|0,b=q()|0,!((b|0)<(m|0)|(b|0)==(m|0)&v>>>0<f>>>0))break t;h=Vt+(v<<3)|0,w=A[h>>2]|0,h=A[h+4>>2]|0}}while(!1);if(it=jt(f|0,m|0,5,0)|0,Ae=q()|0,Ae>>>0<0|(Ae|0)==0&it>>>0<11){tt=85;break}if(it=bl(f|0,m|0,6,0)|0,q()|0,it=ps(it,8)|0,!it){tt=48;break}do if(Gt){for(he=0,h=0,re=0,ge=0;;){if(O=on+(he<<3)|0,b=O,v=A[b>>2]|0,b=A[b+4>>2]|0,(v|0)==0&(b|0)==0)Ae=re;else{X=ze(v|0,b|0,56)|0,q()|0,X=X&7,w=X+1|0,ne=b&-117440513,Ae=ze(v|0,b|0,45)|0,q()|0;t:do if(Si(Ae&127)|0){if(ie=ze(v|0,b|0,52)|0,q()|0,ie=ie&15,ie|0)for(C=1;;){if(Ae=et(7,0,(15-C|0)*3|0)|0,!((v&Ae|0)==0&(ne&(q()|0)|0)==0))break t;if(C>>>0<ie>>>0)C=C+1|0;else break}b=et(w|0,0,56)|0,v=b|v,b=q()|0|ne,w=O,A[w>>2]=v,A[w+4>>2]=b,w=X+2|0}while(!1);(w|0)==7?(Ae=it+(h<<3)|0,A[Ae>>2]=v,A[Ae+4>>2]=b&-117440513,h=jt(h|0,re|0,1,0)|0,Ae=q()|0):Ae=re}if(he=jt(he|0,ge|0,1,0)|0,ge=q()|0,(ge|0)<(m|0)|(ge|0)==(m|0)&he>>>0<f>>>0)re=Ae;else break}if(Gt){if(Ee=dn>>>0>15,ye=et(dn|0,0,52)|0,xe=q()|0,!Et){for(v=0,C=0,w=0,b=0;(D|0)==0&(_|0)==0||(dn=c+(v<<3)|0,A[dn>>2]=D,A[dn+4>>2]=_,v=jt(v|0,C|0,1,0)|0,C=q()|0),w=jt(w|0,b|0,1,0)|0,b=q()|0,!!((b|0)<(m|0)|(b|0)==(m|0)&w>>>0<f>>>0);)_=Vt+(w<<3)|0,D=A[_>>2]|0,_=A[_+4>>2]|0;_=Ae;break}for(v=0,C=0,b=0,w=0;;){do if(!((D|0)==0&(_|0)==0)){if(ie=ze(D|0,_|0,52)|0,q()|0,ie=ie&15,Ee|(ie|0)<(dn|0)){tt=80;break e}if((ie|0)!=(dn|0)){if(O=D|ye,X=_&-15728641|xe,ie>>>0>=An>>>0){ne=dn;do Et=et(7,0,(14-ne|0)*3|0)|0,ne=ne+1|0,O=Et|O,X=q()|0|X;while(ne>>>0<ie>>>0)}}else O=D,X=_;re=Lc(O|0,X|0,f|0,m|0)|0,ne=0,ie=0,ge=q()|0;do{if((ne|0)>(m|0)|(ne|0)==(m|0)&ie>>>0>f>>>0){tt=81;break e}if(Et=on+(re<<3)|0,he=A[Et+4>>2]|0,(he&-117440513|0)==(X|0)&&(A[Et>>2]|0)==(O|0)){tt=65;break}Et=jt(re|0,ge|0,1,0)|0,re=Dc(Et|0,q()|0,f|0,m|0)|0,ge=q()|0,ie=jt(ie|0,ne|0,1,0)|0,ne=q()|0,Et=on+(re<<3)|0}while(!((A[Et>>2]|0)==(O|0)&&(A[Et+4>>2]|0)==(X|0)));if((tt|0)==65&&(tt=0,!0&(he&117440512|0)==100663296))break;Et=c+(v<<3)|0,A[Et>>2]=D,A[Et+4>>2]=_,v=jt(v|0,C|0,1,0)|0,C=q()|0}while(!1);if(b=jt(b|0,w|0,1,0)|0,w=q()|0,!((w|0)<(m|0)|(w|0)==(m|0)&b>>>0<f>>>0))break;_=Vt+(b<<3)|0,D=A[_>>2]|0,_=A[_+4>>2]|0}_=Ae}else v=0,_=Ae}else v=0,h=0,_=0;while(!1);if(Sl(on|0,0,Tn|0)|0,Ic(Vt|0,it|0,h<<3|0)|0,Xt(it),(h|0)==0&(_|0)==0){tt=89;break}else c=c+(v<<3)|0,m=_,f=h}if((tt|0)==16)!0&(_&117440512|0)==0?(_=4,tt=27):tt=21;else if((tt|0)==31)rt(27795,27122,620,27132);else{if((tt|0)==41)return Xt(Vt),Xt(on),tt=10,tt|0;if((tt|0)==48)return Xt(Vt),Xt(on),tt=13,tt|0;(tt|0)==80?rt(27795,27122,711,27132):(tt|0)==81?rt(27795,27122,723,27132):(tt|0)==85&&(Ic(c|0,Vt|0,f<<3|0)|0,tt=89)}return(tt|0)==21?(Xt(Vt),Xt(on),tt=5,tt|0):(tt|0)==27?(Xt(Vt),Xt(on),tt=_,tt|0):(tt|0)==89?(Xt(Vt),Xt(on),tt=0,tt|0):0}function UN(h,c,f,m,_,v,b){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0,v=v|0,b=b|0;var w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0;if(he=G,G=G+16|0,re=he,!((f|0)>0|(f|0)==0&c>>>0>0))return re=0,G=he,re|0;if((b|0)>=16)return re=12,G=he,re|0;ne=0,ie=0,X=0,w=0;e:for(;;){if(D=h+(ne<<3)|0,C=A[D>>2]|0,D=A[D+4>>2]|0,O=ze(C|0,D|0,52)|0,q()|0,(O&15|0)>(b|0)){w=12,C=11;break}if(d1(re,C,D,b),O=re,D=A[O>>2]|0,O=A[O+4>>2]|0,(D|0)==0&(O|0)==0)C=X;
4070else{C=X;do{if(!((w|0)<(v|0)|(w|0)==(v|0)&C>>>0<_>>>0)){C=10;break e}X=m+(C<<3)|0,A[X>>2]=D,A[X+4>>2]=O,C=jt(C|0,w|0,1,0)|0,w=q()|0,p1(re),X=re,D=A[X>>2]|0,O=A[X+4>>2]|0}while(!((D|0)==0&(O|0)==0))}if(ne=jt(ne|0,ie|0,1,0)|0,ie=q()|0,(ie|0)<(f|0)|(ie|0)==(f|0)&ne>>>0<c>>>0)X=C;else{w=0,C=11;break}}return(C|0)==10?(re=14,G=he,re|0):(C|0)==11?(G=he,w|0):0}function ON(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0;ne=G,G=G+16|0,X=ne;e:do if((f|0)>0|(f|0)==0&c>>>0>0){for(D=0,b=0,v=0,O=0;;){if(C=h+(D<<3)|0,w=A[C>>2]|0,C=A[C+4>>2]|0,!((w|0)==0&(C|0)==0)&&(C=($A(w,C,m,X)|0)==0,w=X,b=jt(A[w>>2]|0,A[w+4>>2]|0,b|0,v|0)|0,v=q()|0,!C)){v=12;break}if(D=jt(D|0,O|0,1,0)|0,O=q()|0,!((O|0)<(f|0)|(O|0)==(f|0)&D>>>0<c>>>0))break e}return G=ne,v|0}else b=0,v=0;while(!1);return A[_>>2]=b,A[_+4>>2]=v,_=0,G=ne,_|0}function kN(h,c){return h=h|0,c=c|0,c=ze(h|0,c|0,52)|0,q()|0,c&1|0}function ds(h,c){h=h|0,c=c|0;var f=0,m=0,_=0;if(_=ze(h|0,c|0,52)|0,q()|0,_=_&15,!_)return _=0,_|0;for(m=1;;){if(f=ze(h|0,c|0,(15-m|0)*3|0)|0,q()|0,f=f&7,f|0){m=5;break}if(m>>>0<_>>>0)m=m+1|0;else{f=0,m=5;break}}return(m|0)==5?f|0:0}function u1(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0;if(C=ze(h|0,c|0,52)|0,q()|0,C=C&15,!C)return w=c,C=h,Qe(w|0),C|0;for(w=1,f=0;;){v=(15-w|0)*3|0,m=et(7,0,v|0)|0,_=q()|0,b=ze(h|0,c|0,v|0)|0,q()|0,v=et(Tu(b&7)|0,0,v|0)|0,b=q()|0,h=v|h&~m,c=b|c&~_;e:do if(!f)if((v&m|0)==0&(b&_|0)==0)f=0;else if(m=ze(h|0,c|0,52)|0,q()|0,m=m&15,!m)f=1;else{f=1;t:for(;;){switch(b=ze(h|0,c|0,(15-f|0)*3|0)|0,q()|0,b&7){case 1:break t;case 0:break;default:{f=1;break e}}if(f>>>0<m>>>0)f=f+1|0;else{f=1;break e}}for(f=1;;)if(b=(15-f|0)*3|0,_=ze(h|0,c|0,b|0)|0,q()|0,v=et(7,0,b|0)|0,c=c&~(q()|0),b=et(Tu(_&7)|0,0,b|0)|0,h=h&~v|b,c=c|(q()|0),f>>>0<m>>>0)f=f+1|0;else{f=1;break}}while(!1);if(w>>>0<C>>>0)w=w+1|0;else break}return Qe(c|0),h|0}function Mu(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0;if(m=ze(h|0,c|0,52)|0,q()|0,m=m&15,!m)return f=c,m=h,Qe(f|0),m|0;for(f=1;v=(15-f|0)*3|0,b=ze(h|0,c|0,v|0)|0,q()|0,_=et(7,0,v|0)|0,c=c&~(q()|0),v=et(Tu(b&7)|0,0,v|0)|0,h=v|h&~_,c=q()|0|c,f>>>0<m>>>0;)f=f+1|0;return Qe(c|0),h|0}function GN(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0;if(C=ze(h|0,c|0,52)|0,q()|0,C=C&15,!C)return w=c,C=h,Qe(w|0),C|0;for(w=1,f=0;;){v=(15-w|0)*3|0,m=et(7,0,v|0)|0,_=q()|0,b=ze(h|0,c|0,v|0)|0,q()|0,v=et(xl(b&7)|0,0,v|0)|0,b=q()|0,h=v|h&~m,c=b|c&~_;e:do if(!f)if((v&m|0)==0&(b&_|0)==0)f=0;else if(m=ze(h|0,c|0,52)|0,q()|0,m=m&15,!m)f=1;else{f=1;t:for(;;){switch(b=ze(h|0,c|0,(15-f|0)*3|0)|0,q()|0,b&7){case 1:break t;case 0:break;default:{f=1;break e}}if(f>>>0<m>>>0)f=f+1|0;else{f=1;break e}}for(f=1;;)if(_=(15-f|0)*3|0,v=et(7,0,_|0)|0,b=c&~(q()|0),c=ze(h|0,c|0,_|0)|0,q()|0,c=et(xl(c&7)|0,0,_|0)|0,h=h&~v|c,c=b|(q()|0),f>>>0<m>>>0)f=f+1|0;else{f=1;break}}while(!1);if(w>>>0<C>>>0)w=w+1|0;else break}return Qe(c|0),h|0}function c1(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0;if(m=ze(h|0,c|0,52)|0,q()|0,m=m&15,!m)return f=c,m=h,Qe(f|0),m|0;for(f=1;b=(15-f|0)*3|0,v=et(7,0,b|0)|0,_=c&~(q()|0),c=ze(h|0,c|0,b|0)|0,q()|0,c=et(xl(c&7)|0,0,b|0)|0,h=c|h&~v,c=q()|0|_,f>>>0<m>>>0;)f=f+1|0;return Qe(c|0),h|0}function VN(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;if(C=G,G=G+64|0,w=C+40|0,m=C+24|0,_=C+12|0,v=C,et(c|0,0,52)|0,f=q()|0|134225919,!c)return(A[h+4>>2]|0)>2||(A[h+8>>2]|0)>2||(A[h+12>>2]|0)>2?(b=0,w=0,Qe(b|0),G=C,w|0):(et(B3(h)|0,0,45)|0,b=q()|0|f,w=-1,Qe(b|0),G=C,w|0);if(A[w>>2]=A[h>>2],A[w+4>>2]=A[h+4>>2],A[w+8>>2]=A[h+8>>2],A[w+12>>2]=A[h+12>>2],b=w+4|0,(c|0)>0)for(h=-1;A[m>>2]=A[b>>2],A[m+4>>2]=A[b+4>>2],A[m+8>>2]=A[b+8>>2],c&1?(mN(b),A[_>>2]=A[b>>2],A[_+4>>2]=A[b+4>>2],A[_+8>>2]=A[b+8>>2],Jd(_)):(q3(b),A[_>>2]=A[b>>2],A[_+4>>2]=A[b+4>>2],A[_+8>>2]=A[b+8>>2],Su(_)),n1(m,_,v),Lr(v),O=(15-c|0)*3|0,D=et(7,0,O|0)|0,f=f&~(q()|0),O=et(Zd(v)|0,0,O|0)|0,h=O|h&~D,f=q()|0|f,(c|0)>1;)c=c+-1|0;else h=-1;e:do if((A[b>>2]|0)<=2&&(A[w+8>>2]|0)<=2&&(A[w+12>>2]|0)<=2){if(m=B3(w)|0,c=et(m|0,0,45)|0,c=c|h,h=q()|0|f&-1040385,v=nN(w)|0,!(Si(m)|0)){if((v|0)<=0)break;for(_=0;;){if(m=ze(c|0,h|0,52)|0,q()|0,m=m&15,m)for(f=1;O=(15-f|0)*3|0,w=ze(c|0,h|0,O|0)|0,q()|0,D=et(7,0,O|0)|0,h=h&~(q()|0),O=et(Tu(w&7)|0,0,O|0)|0,c=c&~D|O,h=h|(q()|0),f>>>0<m>>>0;)f=f+1|0;if(_=_+1|0,(_|0)==(v|0))break e}}_=ze(c|0,h|0,52)|0,q()|0,_=_&15;t:do if(_){f=1;n:for(;;){switch(O=ze(c|0,h|0,(15-f|0)*3|0)|0,q()|0,O&7){case 1:break n;case 0:break;default:break t}if(f>>>0<_>>>0)f=f+1|0;else break t}if(F3(m,A[w>>2]|0)|0)for(f=1;w=(15-f|0)*3|0,D=et(7,0,w|0)|0,O=h&~(q()|0),h=ze(c|0,h|0,w|0)|0,q()|0,h=et(xl(h&7)|0,0,w|0)|0,c=c&~D|h,h=O|(q()|0),f>>>0<_>>>0;)f=f+1|0;else for(f=1;O=(15-f|0)*3|0,w=ze(c|0,h|0,O|0)|0,q()|0,D=et(7,0,O|0)|0,h=h&~(q()|0),O=et(Tu(w&7)|0,0,O|0)|0,c=c&~D|O,h=h|(q()|0),f>>>0<_>>>0;)f=f+1|0}while(!1);if((v|0)>0){f=0;do c=u1(c,h)|0,h=q()|0,f=f+1|0;while((f|0)!=(v|0))}}else c=0,h=0;while(!1);
4070return D=h,O=c,Qe(D|0),G=C,O|0}function Ks(h){return h=h|0,(h|0)%2|0|0}function h1(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0;return _=G,G=G+16|0,m=_,c>>>0>15?(m=4,G=_,m|0):(A[h+4>>2]&2146435072|0)==2146435072||(A[h+8+4>>2]&2146435072|0)==2146435072?(m=3,G=_,m|0):(wN(h,c,m),c=VN(m,c)|0,m=q()|0,A[f>>2]=c,A[f+4>>2]=m,(c|0)==0&(m|0)==0&&rt(27795,27122,1050,27145),m=0,G=_,m|0)}function A1(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0;if(_=f+4|0,v=ze(h|0,c|0,52)|0,q()|0,v=v&15,b=ze(h|0,c|0,45)|0,q()|0,m=(v|0)==0,Si(b&127)|0){if(m)return b=1,b|0;m=1}else{if(m)return b=0,b|0;!(A[_>>2]|0)&&!(A[f+8>>2]|0)?m=(A[f+12>>2]|0)!=0&1:m=1}for(f=1;f&1?Jd(_):Su(_),b=ze(h|0,c|0,(15-f|0)*3|0)|0,q()|0,z3(_,b&7),f>>>0<v>>>0;)f=f+1|0;return m|0}function Cc(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;if(O=G,G=G+16|0,C=O,D=ze(h|0,c|0,45)|0,q()|0,D=D&127,D>>>0>121)return A[f>>2]=0,A[f+4>>2]=0,A[f+8>>2]=0,A[f+12>>2]=0,D=5,G=O,D|0;e:do if(Si(D)|0&&(v=ze(h|0,c|0,52)|0,q()|0,v=v&15,(v|0)!=0)){m=1;t:for(;;){switch(w=ze(h|0,c|0,(15-m|0)*3|0)|0,q()|0,w&7){case 5:break t;case 0:break;default:{m=c;break e}}if(m>>>0<v>>>0)m=m+1|0;else{m=c;break e}}for(_=1,m=c;c=(15-_|0)*3|0,b=et(7,0,c|0)|0,w=m&~(q()|0),m=ze(h|0,m|0,c|0)|0,q()|0,m=et(xl(m&7)|0,0,c|0)|0,h=h&~b|m,m=w|(q()|0),_>>>0<v>>>0;)_=_+1|0}else m=c;while(!1);if(w=7696+(D*28|0)|0,A[f>>2]=A[w>>2],A[f+4>>2]=A[w+4>>2],A[f+8>>2]=A[w+8>>2],A[f+12>>2]=A[w+12>>2],!(A1(h,m,f)|0))return D=0,G=O,D|0;if(b=f+4|0,A[C>>2]=A[b>>2],A[C+4>>2]=A[b+4>>2],A[C+8>>2]=A[b+8>>2],v=ze(h|0,m|0,52)|0,q()|0,w=v&15,v&1?(Su(b),v=w+1|0):v=w,!(Si(D)|0))m=0;else{e:do if(!w)m=0;else for(c=1;;){if(_=ze(h|0,m|0,(15-c|0)*3|0)|0,q()|0,_=_&7,_|0){m=_;break e}if(c>>>0<w>>>0)c=c+1|0;else{m=0;break}}while(!1);m=(m|0)==4&1}if(!(Rc(f,v,m,0)|0))(v|0)!=(w|0)&&(A[b>>2]=A[C>>2],A[b+4>>2]=A[C+4>>2],A[b+8>>2]=A[C+8>>2]);else{if(Si(D)|0)do;while(Rc(f,v,0,0)|0);(v|0)!=(w|0)&&q3(b)}return D=0,G=O,D|0}function wu(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0;return v=G,G=G+16|0,m=v,_=Cc(h,c,m)|0,_|0?(G=v,_|0):(_=ze(h|0,c|0,52)|0,q()|0,CN(m,_&15,f),_=0,G=v,_|0)}function Nc(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0;if(b=G,G=G+16|0,v=b,m=Cc(h,c,v)|0,m|0)return v=m,G=b,v|0;m=ze(h|0,c|0,45)|0,q()|0,m=(Si(m&127)|0)==0,_=ze(h|0,c|0,52)|0,q()|0,_=_&15;e:do if(!m){if(_|0)for(m=1;;){if(w=et(7,0,(15-m|0)*3|0)|0,!((w&h|0)==0&((q()|0)&c|0)==0))break e;if(m>>>0<_>>>0)m=m+1|0;else break}return r1(v,_,0,5,f),w=0,G=b,w|0}while(!1);return s1(v,_,0,6,f),w=0,G=b,w|0}function qN(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0;if(_=ze(h|0,c|0,45)|0,q()|0,!(Si(_&127)|0))return _=2,A[f>>2]=_,0;if(_=ze(h|0,c|0,52)|0,q()|0,_=_&15,!_)return _=5,A[f>>2]=_,0;for(m=1;;){if(v=et(7,0,(15-m|0)*3|0)|0,!((v&h|0)==0&((q()|0)&c|0)==0)){m=2,h=6;break}if(m>>>0<_>>>0)m=m+1|0;else{m=5,h=6;break}}return(h|0)==6&&(A[f>>2]=m),0}function eb(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0;X=G,G=G+128|0,D=X+112|0,v=X+96|0,O=X,_=ze(h|0,c|0,52)|0,q()|0,w=_&15,A[D>>2]=w,b=ze(h|0,c|0,45)|0,q()|0,b=b&127;e:do if(Si(b)|0){if(w|0)for(m=1;;){if(C=et(7,0,(15-m|0)*3|0)|0,!((C&h|0)==0&((q()|0)&c|0)==0)){_=0;break e}if(m>>>0<w>>>0)m=m+1|0;else break}if(_&1)_=1;else return C=et(w+1|0,0,52)|0,O=q()|0|c&-15728641,D=et(7,0,(14-w|0)*3|0)|0,O=eb((C|h)&~D,O&~(q()|0),f)|0,G=X,O|0}else _=0;while(!1);if(m=Cc(h,c,v)|0,!m){_?(Q3(v,D,O),C=5):(Y3(v,D,O),C=6);e:do if(Si(b)|0)if(!w)h=5;else for(m=1;;){if(b=et(7,0,(15-m|0)*3|0)|0,!((b&h|0)==0&((q()|0)&c|0)==0)){h=2;break e}if(m>>>0<w>>>0)m=m+1|0;else{h=5;break}}else h=2;while(!1);Sl(f|0,-1,h<<2|0)|0;e:do if(_)for(v=0;;){if(b=O+(v<<4)|0,NN(b,A[D>>2]|0)|0,b=A[b>>2]|0,w=A[f>>2]|0,(w|0)==-1|(w|0)==(b|0))m=f;else{_=0;do{if(_=_+1|0,_>>>0>=h>>>0){m=1;break e}m=f+(_<<2)|0,w=A[m>>2]|0}while(!((w|0)==-1|(w|0)==(b|0)))}if(A[m>>2]=b,v=v+1|0,v>>>0>=C>>>0){m=0;break}}else for(v=0;;){if(b=O+(v<<4)|0,Rc(b,A[D>>2]|0,0,1)|0,b=A[b>>2]|0,w=A[f>>2]|0,(w|0)==-1|(w|0)==(b|0))m=f;else{_=0;do{if(_=_+1|0,_>>>0>=h>>>0){m=1;break e}m=f+(_<<2)|0,w=A[m>>2]|0}while(!((w|0)==-1|(w|0)==(b|0)))}if(A[m>>2]=b,v=v+1|0,v>>>0>=C>>>0){m=0;break}}while(!1)}return O=m,G=X,O|0}function zN(){return 12}function f1(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0;if(h>>>0>15)return w=4,w|0;if(et(h|0,0,52)|0,w=q()|0|134225919,!h){f=0,m=0;do Si(m)|0&&(et(m|0,0,45)|0,b=w|(q()|0),h=c+(f<<3)|0,A[h>>2]=-1,A[h+4>>2]=b,f=f+1|0),m=m+1|0;while((m|0)!=122);return f=0,f|0}f=0,b=0;do{if(Si(b)|0){for(et(b|0,0,45)|0,m=1,_=-1,v=w|(q()|0);C=et(7,0,(15-m|0)*3|0)|0,_=_&~C,v=v&~(q()|0),(m|0)!=(h|0);)m=m+1|0;C=c+(f<<3)|0,A[C>>2]=_,A[C+4>>2]=v,f=f+1|0}b=b+1|0}while((b|0)!=122);return f=0,f|0}function HN(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0;if(ye=G,G=G+16|0,ge=ye,Ee=ze(h|0,c|0,52)|0,q()|0,Ee=Ee&15,f>>>0>15)return Ee=4,G=ye,Ee|0;if((Ee|0)<(f|0))return Ee=12,G=ye,Ee|0;if((Ee|0)!=(f|0))if(v=et(f|0,0,52)|0,v=v|h,w=q()|0|c&-15728641,(Ee|0)>(f|0)){C=f;do he=et(7,0,(14-C|0)*3|0)|0,C=C+1|0,v=he|v,w=q()|0|w;while((C|0)<(Ee|0));he=v}else he=v;else he=h,w=c;re=ze(he|0,w|0,45)|0,q()|0;
4070e:do if(Si(re&127)|0){if(C=ze(he|0,w|0,52)|0,q()|0,C=C&15,C|0)for(v=1;;){if(re=et(7,0,(15-v|0)*3|0)|0,!((re&he|0)==0&((q()|0)&w|0)==0)){D=33;break e}if(v>>>0<C>>>0)v=v+1|0;else break}if(re=m,A[re>>2]=0,A[re+4>>2]=0,(Ee|0)>(f|0)){for(re=c&-15728641,ie=Ee;;){if(ne=ie,ie=ie+-1|0,ie>>>0>15|(Ee|0)<(ie|0)){D=19;break}if((Ee|0)!=(ie|0))if(v=et(ie|0,0,52)|0,v=v|h,C=q()|0|re,(Ee|0)<(ne|0))X=v;else{D=ie;do X=et(7,0,(14-D|0)*3|0)|0,D=D+1|0,v=X|v,C=q()|0|C;while((D|0)<(Ee|0));X=v}else X=h,C=c;if(O=ze(X|0,C|0,45)|0,q()|0,!(Si(O&127)|0))v=0;else{O=ze(X|0,C|0,52)|0,q()|0,O=O&15;t:do if(!O)v=0;else for(D=1;;){if(v=ze(X|0,C|0,(15-D|0)*3|0)|0,q()|0,v=v&7,v|0)break t;if(D>>>0<O>>>0)D=D+1|0;else{v=0;break}}while(!1);v=(v|0)==0&1}if(C=ze(h|0,c|0,(15-ne|0)*3|0)|0,q()|0,C=C&7,(C|0)==7){_=5,D=42;break}if(v=(v|0)!=0,(C|0)==1&v){_=5,D=42;break}if(X=C+(((C|0)!=0&v)<<31>>31)|0,X|0&&(D=Ee-ne|0,D=vl(7,0,D,((D|0)<0)<<31>>31)|0,O=q()|0,v?(v=cr(D|0,O|0,5,0)|0,v=jt(v|0,q()|0,-5,-1)|0,v=bl(v|0,q()|0,6,0)|0,v=jt(v|0,q()|0,1,0)|0,C=q()|0):(v=D,C=O),ne=X+-1|0,ne=cr(D|0,O|0,ne|0,((ne|0)<0)<<31>>31|0)|0,ne=jt(v|0,C|0,ne|0,q()|0)|0,X=q()|0,O=m,O=jt(ne|0,X|0,A[O>>2]|0,A[O+4>>2]|0)|0,X=q()|0,ne=m,A[ne>>2]=O,A[ne+4>>2]=X),(ie|0)<=(f|0)){D=37;break}}if((D|0)==19)rt(27795,27122,1367,27158);else if((D|0)==37){b=m,_=A[b+4>>2]|0,b=A[b>>2]|0;break}else if((D|0)==42)return G=ye,_|0}else _=0,b=0}else D=33;while(!1);e:do if((D|0)==33)if(re=m,A[re>>2]=0,A[re+4>>2]=0,(Ee|0)>(f|0)){for(v=Ee;;){if(_=ze(h|0,c|0,(15-v|0)*3|0)|0,q()|0,_=_&7,(_|0)==7){_=5;break}if(b=Ee-v|0,b=vl(7,0,b,((b|0)<0)<<31>>31)|0,_=cr(b|0,q()|0,_|0,0)|0,b=q()|0,re=m,b=jt(A[re>>2]|0,A[re+4>>2]|0,_|0,b|0)|0,_=q()|0,re=m,A[re>>2]=b,A[re+4>>2]=_,v=v+-1|0,(v|0)<=(f|0))break e}return G=ye,_|0}else _=0,b=0;while(!1);return $A(he,w,Ee,ge)|0&&rt(27795,27122,1327,27173),Ee=ge,ge=A[Ee+4>>2]|0,((_|0)>-1|(_|0)==-1&b>>>0>4294967295)&((ge|0)>(_|0)|((ge|0)==(_|0)?(A[Ee>>2]|0)>>>0>b>>>0:0))?(Ee=0,G=ye,Ee|0):(rt(27795,27122,1407,27158),0)}function WN(h,c,f,m,_,v){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0,v=v|0;var b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0;if(X=G,G=G+16|0,b=X,_>>>0>15)return v=4,G=X,v|0;if(w=ze(f|0,m|0,52)|0,q()|0,w=w&15,(w|0)>(_|0))return v=12,G=X,v|0;if($A(f,m,_,b)|0&&rt(27795,27122,1327,27173),O=b,D=A[O+4>>2]|0,!(((c|0)>-1|(c|0)==-1&h>>>0>4294967295)&((D|0)>(c|0)|((D|0)==(c|0)?(A[O>>2]|0)>>>0>h>>>0:0))))return v=2,G=X,v|0;O=_-w|0,_=et(_|0,0,52)|0,C=q()|0|m&-15728641,D=v,A[D>>2]=_|f,A[D+4>>2]=C,D=ze(f|0,m|0,45)|0,q()|0;e:do if(Si(D&127)|0){if(w|0)for(b=1;;){if(D=et(7,0,(15-b|0)*3|0)|0,!((D&f|0)==0&((q()|0)&m|0)==0))break e;if(b>>>0<w>>>0)b=b+1|0;else break}if((O|0)<1)return v=0,G=X,v|0;for(D=w^15,m=-1,C=1,b=1;;){w=O-C|0,w=vl(7,0,w,((w|0)<0)<<31>>31)|0,f=q()|0;do if(b)if(b=cr(w|0,f|0,5,0)|0,b=jt(b|0,q()|0,-5,-1)|0,b=bl(b|0,q()|0,6,0)|0,_=q()|0,(c|0)>(_|0)|(c|0)==(_|0)&h>>>0>b>>>0){c=jt(h|0,c|0,-1,-1)|0,c=ur(c|0,q()|0,b|0,_|0)|0,b=q()|0,ne=v,re=A[ne>>2]|0,ne=A[ne+4>>2]|0,he=(D+m|0)*3|0,ie=et(7,0,he|0)|0,ne=ne&~(q()|0),m=bl(c|0,b|0,w|0,f|0)|0,h=q()|0,_=jt(m|0,h|0,2,0)|0,he=et(_|0,q()|0,he|0)|0,ne=q()|0|ne,_=v,A[_>>2]=he|re&~ie,A[_+4>>2]=ne,h=cr(m|0,h|0,w|0,f|0)|0,h=ur(c|0,b|0,h|0,q()|0)|0,b=0,c=q()|0;break}else{he=v,ie=A[he>>2]|0,he=A[he+4>>2]|0,re=et(7,0,(D+m|0)*3|0)|0,he=he&~(q()|0),b=v,A[b>>2]=ie&~re,A[b+4>>2]=he,b=1;break}else ie=v,_=A[ie>>2]|0,ie=A[ie+4>>2]|0,m=(D+m|0)*3|0,ne=et(7,0,m|0)|0,ie=ie&~(q()|0),he=bl(h|0,c|0,w|0,f|0)|0,b=q()|0,m=et(he|0,b|0,m|0)|0,ie=q()|0|ie,re=v,A[re>>2]=m|_&~ne,A[re+4>>2]=ie,b=cr(he|0,b|0,w|0,f|0)|0,h=ur(h|0,c|0,b|0,q()|0)|0,b=0,c=q()|0;while(!1);if((O|0)>(C|0))m=~C,C=C+1|0;else{c=0;break}}return G=X,c|0}while(!1);if((O|0)<1)return he=0,G=X,he|0;for(_=w^15,b=1;;)if(re=O-b|0,re=vl(7,0,re,((re|0)<0)<<31>>31)|0,he=q()|0,C=v,f=A[C>>2]|0,C=A[C+4>>2]|0,w=(_-b|0)*3|0,m=et(7,0,w|0)|0,C=C&~(q()|0),ne=bl(h|0,c|0,re|0,he|0)|0,ie=q()|0,w=et(ne|0,ie|0,w|0)|0,C=q()|0|C,D=v,A[D>>2]=w|f&~m,A[D+4>>2]=C,he=cr(ne|0,ie|0,re|0,he|0)|0,h=ur(h|0,c|0,he|0,q()|0)|0,c=q()|0,(O|0)<=(b|0)){c=0;break}else b=b+1|0;return G=X,c|0}function d1(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0;_=ze(c|0,f|0,52)|0,q()|0,_=_&15,(c|0)==0&(f|0)==0|((m|0)>15|(_|0)>(m|0))?(v=-1,c=-1,f=0,_=0):(c=Z3(c,f,_+1|0,m)|0,b=(q()|0)&-15728641,f=et(m|0,0,52)|0,f=c|f,b=b|(q()|0),c=(Ai(f,b)|0)==0,v=_,c=c?-1:m,_=b),b=h,A[b>>2]=f,A[b+4>>2]=_,A[h+8>>2]=v,A[h+12>>2]=c}function tb(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0;if(_=ze(h|0,c|0,52)|0,q()|0,_=_&15,v=m+8|0,A[v>>2]=_,(h|0)==0&(c|0)==0|((f|0)>15|(_|0)>(f|0))){f=m,A[f>>2]=0,A[f+4>>2]=0,A[v>>2]=-1,A[m+12>>2]=-1;return}if(h=Z3(h,c,_+1|0,f)|0,v=(q()|0)&-15728641,_=et(f|0,0,52)|0,_=h|_,v=v|(q()|0),h=m,A[h>>2]=_,A[h+4>>2]=v,h=m+12|0,Ai(_,v)|0){A[h>>2]=f;return}else{A[h>>2]=-1;return}}function p1(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0;if(f=h,c=A[f>>2]|0,f=A[f+4>>2]|0,!((c|0)==0&(f|0)==0)&&(m=ze(c|0,f|0,52)|0,q()|0,m=m&15,w=et(1,0,(m^15)*3|0)|0,c=jt(w|0,q()|0,c|0,f|0)|0,f=q()|0,w=h,A[w>>2]=c,A[w+4>>2]=f,w=h+8|0,b=A[w>>2]|0,!((m|0)<(b|0)))){for(C=h+12|0,v=m;;){if((v|0)==(b|0)){m=5;break}if(D=(v|0)==(A[C>>2]|0),_=(15-v|0)*3|0,m=ze(c|0,f|0,_|0)|0,q()|0,m=m&7,D&((m|0)==1&!0)){m=7;break}if(!((m|0)==7&!0)){m=10;break}if(D=et(1,0,_|0)|0,c=jt(c|0,f|0,D|0,q()|0)|0,f=q()|0,D=h,A[D>
4070>2]=c,A[D+4>>2]=f,(v|0)>(b|0))v=v+-1|0;else{m=10;break}}if((m|0)==5){D=h,A[D>>2]=0,A[D+4>>2]=0,A[w>>2]=-1,A[C>>2]=-1;return}else if((m|0)==7){b=et(1,0,_|0)|0,b=jt(c|0,f|0,b|0,q()|0)|0,w=q()|0,D=h,A[D>>2]=b,A[D+4>>2]=w,A[C>>2]=v+-1;return}else if((m|0)==10)return}}function jA(h){h=+h;var c=0;return c=h<0?h+6.283185307179586:h,+(h>=6.283185307179586?c+-6.283185307179586:c)}function Pc(h,c){return h=h|0,c=c|0,+mn(+(+H[h>>3]-+H[c>>3]))<17453292519943298e-27?(c=+mn(+(+H[h+8>>3]-+H[c+8>>3]))<17453292519943298e-27,c|0):(c=0,c|0)}function Ds(h,c){switch(h=+h,c=c|0,c|0){case 1:{h=h<0?h+6.283185307179586:h;break}case 2:{h=h>0?h+-6.283185307179586:h;break}}return+h}function $N(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0;return _=+H[c>>3],m=+H[h>>3],v=+xn(+((_-m)*.5)),f=+xn(+((+H[c+8>>3]-+H[h+8>>3])*.5)),f=v*v+f*(+kn(+_)*+kn(+m)*f),+(+we(+ +Ln(+f),+ +Ln(+(1-f)))*2)}function XA(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0;return _=+H[c>>3],m=+H[h>>3],v=+xn(+((_-m)*.5)),f=+xn(+((+H[c+8>>3]-+H[h+8>>3])*.5)),f=v*v+f*(+kn(+_)*+kn(+m)*f),+(+we(+ +Ln(+f),+ +Ln(+(1-f)))*2*6371.007180918475)}function jN(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0;return _=+H[c>>3],m=+H[h>>3],v=+xn(+((_-m)*.5)),f=+xn(+((+H[c+8>>3]-+H[h+8>>3])*.5)),f=v*v+f*(+kn(+_)*+kn(+m)*f),+(+we(+ +Ln(+f),+ +Ln(+(1-f)))*2*6371.007180918475*1e3)}function XN(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0;return v=+H[c>>3],m=+kn(+v),_=+H[c+8>>3]-+H[h+8>>3],b=m*+xn(+_),f=+H[h>>3],+ +we(+b,+(+xn(+v)*+kn(+f)-+kn(+_)*(m*+xn(+f))))}function QN(h,c,f,m){h=h|0,c=+c,f=+f,m=m|0;var _=0,v=0,b=0,w=0;if(f<1e-16){A[m>>2]=A[h>>2],A[m+4>>2]=A[h+4>>2],A[m+8>>2]=A[h+8>>2],A[m+12>>2]=A[h+12>>2];return}v=c<0?c+6.283185307179586:c,v=c>=6.283185307179586?v+-6.283185307179586:v;do if(v<1e-16)c=+H[h>>3]+f,H[m>>3]=c,_=m;else{if(_=+mn(+(v+-3.141592653589793))<1e-16,c=+H[h>>3],_){c=c-f,H[m>>3]=c,_=m;break}if(b=+kn(+f),f=+xn(+f),c=b*+xn(+c)+ +kn(+v)*(f*+kn(+c)),c=c>1?1:c,c=+K(+(c<-1?-1:c)),H[m>>3]=c,+mn(+(c+-1.5707963267948966))<1e-16){H[m>>3]=1.5707963267948966,H[m+8>>3]=0;return}if(+mn(+(c+1.5707963267948966))<1e-16){H[m>>3]=-1.5707963267948966,H[m+8>>3]=0;return}if(w=1/+kn(+c),v=f*+xn(+v)*w,f=+H[h>>3],c=w*((b-+xn(+c)*+xn(+f))/+kn(+f)),b=v>1?1:v,c=c>1?1:c,c=+H[h+8>>3]+ +we(+(b<-1?-1:b),+(c<-1?-1:c)),c>3.141592653589793)do c=c+-6.283185307179586;while(c>3.141592653589793);if(c<-3.141592653589793)do c=c+6.283185307179586;while(c<-3.141592653589793);H[m+8>>3]=c;return}while(!1);if(+mn(+(c+-1.5707963267948966))<1e-16){H[_>>3]=1.5707963267948966,H[m+8>>3]=0;return}if(+mn(+(c+1.5707963267948966))<1e-16){H[_>>3]=-1.5707963267948966,H[m+8>>3]=0;return}if(c=+H[h+8>>3],c>3.141592653589793)do c=c+-6.283185307179586;while(c>3.141592653589793);if(c<-3.141592653589793)do c=c+6.283185307179586;while(c<-3.141592653589793);H[m+8>>3]=c}function nb(h,c){return h=h|0,c=c|0,h>>>0>15?(c=4,c|0):(H[c>>3]=+H[20656+(h<<3)>>3],c=0,c|0)}function YN(h,c){return h=h|0,c=c|0,h>>>0>15?(c=4,c|0):(H[c>>3]=+H[20784+(h<<3)>>3],c=0,c|0)}function KN(h,c){return h=h|0,c=c|0,h>>>0>15?(c=4,c|0):(H[c>>3]=+H[20912+(h<<3)>>3],c=0,c|0)}function ZN(h,c){return h=h|0,c=c|0,h>>>0>15?(c=4,c|0):(H[c>>3]=+H[21040+(h<<3)>>3],c=0,c|0)}function n0(h,c){h=h|0,c=c|0;var f=0;return h>>>0>15?(c=4,c|0):(f=vl(7,0,h,((h|0)<0)<<31>>31)|0,f=cr(f|0,q()|0,120,0)|0,h=q()|0,A[c>>2]=f|2,A[c+4>>2]=h,c=0,c|0)}function ib(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0;return ne=+H[c>>3],O=+H[h>>3],C=+xn(+((ne-O)*.5)),v=+H[c+8>>3],D=+H[h+8>>3],b=+xn(+((v-D)*.5)),w=+kn(+O),X=+kn(+ne),b=C*C+b*(X*w*b),b=+we(+ +Ln(+b),+ +Ln(+(1-b)))*2,C=+H[f>>3],ne=+xn(+((C-ne)*.5)),m=+H[f+8>>3],v=+xn(+((m-v)*.5)),_=+kn(+C),v=ne*ne+v*(X*_*v),v=+we(+ +Ln(+v),+ +Ln(+(1-v)))*2,C=+xn(+((O-C)*.5)),m=+xn(+((D-m)*.5)),m=C*C+m*(w*_*m),m=+we(+ +Ln(+m),+ +Ln(+(1-m)))*2,_=(b+v+m)*.5,+(+_e(+ +Ln(+(+fs(+(_*.5))*+fs(+((_-b)*.5))*+fs(+((_-v)*.5))*+fs(+((_-m)*.5)))))*4)}function m1(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0;if(w=G,G=G+192|0,v=w+168|0,b=w,_=wu(h,c,v)|0,_|0)return f=_,G=w,f|0;if(Nc(h,c,b)|0&&rt(27795,27190,415,27199),c=A[b>>2]|0,(c|0)>0){if(m=+ib(b+8|0,b+8+(((c|0)!=1&1)<<4)|0,v)+0,(c|0)!=1){h=1;do _=h,h=h+1|0,m=m+ +ib(b+8+(_<<4)|0,b+8+(((h|0)%(c|0)|0)<<4)|0,v);while((h|0)<(c|0))}}else m=0;return H[f>>3]=m,f=0,G=w,f|0}function JN(h,c,f){return h=h|0,c=c|0,f=f|0,h=m1(h,c,f)|0,h|0||(H[f>>3]=+H[f>>3]*6371.007180918475*6371.007180918475),h|0}function eP(h,c,f){return h=h|0,c=c|0,f=f|0,h=m1(h,c,f)|0,h|0||(H[f>>3]=+H[f>>3]*6371.007180918475*6371.007180918475*1e3*1e3),h|0}function tP(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;if(w=G,G=G+176|0,b=w,h=t0(h,c,b)|0,h|0)return b=h,G=w,b|0;if(H[f>>3]=0,h=A[b>>2]|0,(h|0)<=1)return b=0,G=w,b|0;c=h+-1|0,h=0,m=+H[b+8>>3],_=+H[b+16>>3],v=0;do h=h+1|0,D=m,m=+H[b+8+(h<<4)>>3],O=+xn(+((m-D)*.5)),C=_,_=+H[b+8+(h<<4)+8>>3],C=+xn(+((_-C)*.5)),C=O*O+C*(+kn(+m)*+kn(+D)*C),v=v+ +we(+ +Ln(+C),+ +Ln(+(1-C)))*2;while((h|0)<(c|0));return H[f>>3]=v,b=0,G=w,b|0}function nP(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;if(w=G,G=G+176|0,b=w,h=t0(h,c,b)|0,h|0)return b=h,v=+H[f>>3],v=v*6371.007180918475,H[f>>3]=v,G=w,b|0;if(H[f>>3]=0,h=A[b>>2]|0,(h|0)<=1)return b=0,v=0,v=v*6371.007180918475,H[f>>3]=v,G=w,b|0;c=h+-1|0,h=0,m=+H[b+8>>3],_=+H[b+16>>3],v=0;do h=h+1|0,D=m,m=+H[b+8+(h<<4)>>3],O=+xn(+((m-D)*.5)),C=_,_=+H[b+8+(h<<4)+8>>3],C=+xn(+((_-C)*.5)),C=O*O+C*(+kn(+D)*+kn(+m)*C),v=v+ +we(+ +Ln(+C),+ +Ln(+(1-C)))*2;while((h|0)!=(c|0));return H[f>>3]=v,b=0,O=v,O=O*6371.007180918475,H[f>>3]=O,G=w,b|0}function iP(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;if(w=G,G=G+176|0,b=w,h=t0(h,c,b)|0,h|0)return b=h,v=+H[f>>3],v=v*6371.007180918475,v=v*1e3,H[f>>3]=v,G=w,b|0;if(H[f>>3]=0,h=A[b>>2]|0,(h|0)<=1)return b=0,v=0,v=v*6371.007180918475,v=v*1e3,H[f>>3]=v,G=w,b|0;c=h+-1|0,h=0,m=+H[b+8>>3],_=+H[b+16>>3],v=0;do h=h+1|0,D=m,m=+H[b+8+(h<<4)>>3],O=+xn(+((m-D)*.5)),C=_,_=+H[b+8+(h<<4)+8>>3],C=+xn(+((_-C)*.5)),C=O*O+C*(+kn(+D)*+kn(+m)*C),v=v+ +we(+ +Ln(+C),+ +Ln(+(1-C)))*2;while((h|0)!=(c|0));return H[f>>3]=v,b=0,O=v,O=O*6371.007180918475,O=O*1e3,H[f>>3]=O,G=w,b|0}function rP(h){h=h|0;var c=0,f=0,m=0;return c=ps(1,12)|0,c||rt(27280,27235,49,27293),f=h+4|0,m=A[f>>2]|0,m|0?(m=m+8|0,A[m>>2]=c,A[f>>2]=c,c|0):(A[h>>2]|0&&rt(27310,27235,61,27333),m=h,A[m>>2]=c,A[f>>2]=c,c|0)}function sP(h,c){h=h|0,c=c|0;var f=0,m=0;return m=Wo(24)|0,m||rt(27347,27235,78,27361),A[m>>2]=A[c>>2],A[m+4>>2]=A[c+4>>2],A[m+8>>2]=A[c+8>>2],A[m+12>>2]=A[c+12>>
40702],A[m+16>>2]=0,c=h+4|0,f=A[c>>2]|0,f|0?(A[f+16>>2]=m,A[c>>2]=m,m|0):(A[h>>2]|0&&rt(27376,27235,82,27361),A[h>>2]=m,A[c>>2]=m,m|0)}function rb(h){h=h|0;var c=0,f=0,m=0,_=0;if(h)for(m=1;;){if(c=A[h>>2]|0,c|0)do{if(f=A[c>>2]|0,f|0)do _=f,f=A[f+16>>2]|0,Xt(_);while(f|0);_=c,c=A[c+8>>2]|0,Xt(_)}while(c|0);if(c=h,h=A[h+8>>2]|0,m||Xt(c),h)m=0;else break}}function oP(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0,Gt=0,Et=0,An=0,dn=0,Tn=0,on=0,Vt=0,tt=0,vn=0,si=0,gn=0;if(_=h+8|0,A[_>>2]|0)return gn=1,gn|0;if(m=A[h>>2]|0,!m)return gn=0,gn|0;c=m,f=0;do f=f+1|0,c=A[c+8>>2]|0;while(c|0);if(f>>>0<2)return gn=0,gn|0;vn=Wo(f<<2)|0,vn||rt(27396,27235,317,27415),tt=Wo(f<<5)|0,tt||rt(27437,27235,321,27415),A[h>>2]=0,Gt=h+4|0,A[Gt>>2]=0,A[_>>2]=0,f=0,Vt=0,it=0,X=0;e:for(;;){if(O=A[m>>2]|0,O){v=0,b=O;do{if(C=+H[b+8>>3],c=b,b=A[b+16>>2]|0,D=(b|0)==0,_=D?O:b,w=+H[_+8>>3],+mn(+(C-w))>3.141592653589793){gn=14;break}v=v+(w-C)*(+H[c>>3]+ +H[_>>3])}while(!D);if((gn|0)==14){gn=0,v=0,c=O;do Ae=+H[c+8>>3],on=c+16|0,Tn=A[on>>2]|0,Tn=Tn|0?Tn:O,xe=+H[Tn+8>>3],v=v+(+H[c>>3]+ +H[Tn>>3])*((xe<0?xe+6.283185307179586:xe)-(Ae<0?Ae+6.283185307179586:Ae)),c=A[(c|0?on:m)>>2]|0;while(c|0)}v>0?(A[vn+(Vt<<2)>>2]=m,Vt=Vt+1|0,_=it,c=X):gn=19}else gn=19;if((gn|0)==19){gn=0;do if(f){if(c=f+8|0,A[c>>2]|0){gn=21;break e}if(f=ps(1,12)|0,!f){gn=23;break e}A[c>>2]=f,_=f+4|0,b=f,c=X}else if(X){_=Gt,b=X+8|0,c=m,f=h;break}else if(A[h>>2]|0){gn=27;break e}else{_=Gt,b=h,c=m,f=h;break}while(!1);if(A[b>>2]=m,A[_>>2]=m,b=tt+(it<<5)|0,D=A[m>>2]|0,D){for(O=tt+(it<<5)+8|0,H[O>>3]=17976931348623157e292,X=tt+(it<<5)+24|0,H[X>>3]=17976931348623157e292,H[b>>3]=-17976931348623157e292,ne=tt+(it<<5)+16|0,H[ne>>3]=-17976931348623157e292,Ee=17976931348623157e292,ye=-17976931348623157e292,_=0,ie=D,C=17976931348623157e292,he=17976931348623157e292,ge=-17976931348623157e292,w=-17976931348623157e292;v=+H[ie>>3],Ae=+H[ie+8>>3],ie=A[ie+16>>2]|0,re=(ie|0)==0,xe=+H[(re?D:ie)+8>>3],v<C&&(H[O>>3]=v,C=v),Ae<he&&(H[X>>3]=Ae,he=Ae),v>ge?H[b>>3]=v:v=ge,Ae>w&&(H[ne>>3]=Ae,w=Ae),Ee=Ae>0&Ae<Ee?Ae:Ee,ye=Ae<0&Ae>ye?Ae:ye,_=_|+mn(+(Ae-xe))>3.141592653589793,!re;)ge=v;_&&(H[ne>>3]=ye,H[X>>3]=Ee)}else A[b>>2]=0,A[b+4>>2]=0,A[b+8>>2]=0,A[b+12>>2]=0,A[b+16>>2]=0,A[b+20>>2]=0,A[b+24>>2]=0,A[b+28>>2]=0;_=it+1|0}if(on=m+8|0,m=A[on>>2]|0,A[on>>2]=0,m)it=_,X=c;else{gn=45;break}}if((gn|0)==21)rt(27213,27235,35,27247);else if((gn|0)==23)rt(27267,27235,37,27247);else if((gn|0)==27)rt(27310,27235,61,27333);else if((gn|0)==45){e:do if((Vt|0)>0){for(on=(_|0)==0,dn=_<<2,Tn=(h|0)==0,An=0,c=0;;){if(Et=A[vn+(An<<2)>>2]|0,on)gn=73;else{if(it=Wo(dn)|0,!it){gn=50;break}if(Gt=Wo(dn)|0,!Gt){gn=52;break}t:do if(Tn)f=0;else{for(_=0,f=0,b=h;m=tt+(_<<5)|0,sb(A[b>>2]|0,m,A[Et>>2]|0)|0?(A[it+(f<<2)>>2]=b,A[Gt+(f<<2)>>2]=m,re=f+1|0):re=f,b=A[b+8>>2]|0,b;)_=_+1|0,f=re;if((re|0)>0)if(m=A[it>>2]|0,(re|0)==1)f=m;else for(ne=0,ie=-1,f=m,X=m;;){for(D=A[X>>2]|0,m=0,b=0;_=A[A[it+(b<<2)>>2]>>2]|0,(_|0)==(D|0)?O=m:O=m+((sb(_,A[Gt+(b<<2)>>2]|0,A[D>>2]|0)|0)&1)|0,b=b+1|0,(b|0)!=(re|0);)m=O;if(_=(O|0)>(ie|0),f=_?X:f,m=ne+1|0,(m|0)==(re|0))break t;ne=m,ie=_?O:ie,X=A[it+(m<<2)>>2]|0}else f=0}while(!1);if(Xt(it),Xt(Gt),f){if(_=f+4|0,m=A[_>>2]|0,m)f=m+8|0;else if(A[f>>2]|0){gn=70;break}A[f>>2]=Et,A[_>>2]=Et}else gn=73}if((gn|0)==73){if(gn=0,c=A[Et>>2]|0,c|0)do Gt=c,c=A[c+16>>2]|0,Xt(Gt);while(c|0);Xt(Et),c=1}if(An=An+1|0,(An|0)>=(Vt|0)){si=c;break e}}(gn|0)==50?rt(27452,27235,249,27471):(gn|0)==52?rt(27490,27235,252,27471):(gn|0)==70&&rt(27310,27235,61,27333)}else si=0;while(!1);return Xt(vn),Xt(tt),gn=si,gn|0}return 0}function sb(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;if(!(e1(c,f)|0)||(c=U3(c)|0,m=+H[f>>3],_=+H[f+8>>3],_=c&_<0?_+6.283185307179586:_,h=A[h>>2]|0,!h))return h=0,h|0;if(c){c=0,D=_,f=h;e:for(;;){for(;b=+H[f>>3],_=+H[f+8>>3],f=f+16|0,O=A[f>>2]|0,O=O|0?O:h,v=+H[O>>3],w=+H[O+8>>3],b>v?(C=b,b=w):(C=v,v=b,b=_,_=w),m=m==v|m==C?m+2220446049250313e-31:m,!!(m<v|m>C);)if(f=A[f>>2]|0,!f){f=22;break e}if(w=b<0?b+6.283185307179586:b,b=_<0?_+6.283185307179586:_,D=w==D|b==D?D+-2220446049250313e-31:D,C=w+(b-w)*((m-v)/(C-v)),(C<0?C+6.283185307179586:C)>D&&(c=c^1),f=A[f>>2]|0,!f){f=22;break}}if((f|0)==22)return c|0}else{c=0,D=_,f=h;e:for(;;){for(;b=+H[f>>3],_=+H[f+8>>3],f=f+16|0,O=A[f>>2]|0,O=O|0?O:h,v=+H[O>>3],w=+H[O+8>>3],b>
4070v?(C=b,b=w):(C=v,v=b,b=_,_=w),m=m==v|m==C?m+2220446049250313e-31:m,!!(m<v|m>C);)if(f=A[f>>2]|0,!f){f=22;break e}if(D=b==D|_==D?D+-2220446049250313e-31:D,b+(_-b)*((m-v)/(C-v))>D&&(c=c^1),f=A[f>>2]|0,!f){f=22;break}}if((f|0)==22)return c|0}return 0}function ka(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0;if(ye=G,G=G+32|0,Ee=ye+16|0,ge=ye,v=ze(h|0,c|0,52)|0,q()|0,v=v&15,ie=ze(f|0,m|0,52)|0,q()|0,(v|0)!=(ie&15|0))return Ee=12,G=ye,Ee|0;if(D=ze(h|0,c|0,45)|0,q()|0,D=D&127,O=ze(f|0,m|0,45)|0,q()|0,O=O&127,D>>>0>121|O>>>0>121)return Ee=5,G=ye,Ee|0;if(ie=(D|0)!=(O|0),ie){if(w=Jg(D,O)|0,(w|0)==7)return Ee=1,G=ye,Ee|0;C=Jg(O,D)|0,(C|0)==7?rt(27514,27538,161,27548):(re=w,b=C)}else re=0,b=0;X=Si(D)|0,ne=Si(O)|0,A[Ee>>2]=0,A[Ee+4>>2]=0,A[Ee+8>>2]=0,A[Ee+12>>2]=0;do if(re){if(O=A[4272+(D*28|0)+(re<<2)>>2]|0,w=(O|0)>0,ne)if(w){D=0,C=f,w=m;do C=GN(C,w)|0,w=q()|0,b=xl(b)|0,(b|0)==1&&(b=xl(1)|0),D=D+1|0;while((D|0)!=(O|0));O=b,D=C,C=w}else O=b,D=f,C=m;else if(w){D=0,C=f,w=m;do C=c1(C,w)|0,w=q()|0,b=xl(b)|0,D=D+1|0;while((D|0)!=(O|0));O=b,D=C,C=w}else O=b,D=f,C=m;if(A1(D,C,Ee)|0,ie||rt(27563,27538,191,27548),w=(X|0)!=0,b=(ne|0)!=0,w&b&&rt(27590,27538,192,27548),w){if(b=ds(h,c)|0,(b|0)==7){v=5;break}if(Ve[22e3+(b*7|0)+re>>0]|0){v=1;break}C=A[21168+(b*28|0)+(re<<2)>>2]|0,D=C}else if(b){if(b=ds(D,C)|0,(b|0)==7){v=5;break}if(Ve[22e3+(b*7|0)+O>>0]|0){v=1;break}D=0,C=A[21168+(O*28|0)+(b<<2)>>2]|0}else D=0,C=0;if((D|C|0)<0)v=5;else{if((C|0)>0){w=Ee+4|0,b=0;do e0(w),b=b+1|0;while((b|0)!=(C|0))}if(A[ge>>2]=0,A[ge+4>>2]=0,A[ge+8>>2]=0,z3(ge,re),v|0)for(;Ks(v)|0?Jd(ge):Su(ge),(v|0)>1;)v=v+-1|0;if((D|0)>0){v=0;do e0(ge),v=v+1|0;while((v|0)!=(D|0))}he=Ee+4|0,jr(he,ge,he),Lr(he),he=51}}else if(A1(f,m,Ee)|0,(X|0)!=0&(ne|0)!=0)if((O|0)!=(D|0)&&rt(27621,27538,261,27548),b=ds(h,c)|0,v=ds(f,m)|0,(b|0)==7|(v|0)==7)v=5;else if(Ve[22e3+(b*7|0)+v>>0]|0)v=1;else if(b=A[21168+(b*28|0)+(v<<2)>>2]|0,(b|0)>0){w=Ee+4|0,v=0;do e0(w),v=v+1|0;while((v|0)!=(b|0));he=51}else he=51;else he=51;while(!1);return(he|0)==51&&(v=Ee+4|0,A[_>>2]=A[v>>2],A[_+4>>2]=A[v+4>>2],A[_+8>>2]=A[v+8>>2],v=0),Ee=v,G=ye,Ee|0}function ob(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0;if(he=G,G=G+48|0,D=he+36|0,b=he+24|0,w=he+12|0,C=he,_=ze(h|0,c|0,52)|0,q()|0,_=_&15,ne=ze(h|0,c|0,45)|0,q()|0,ne=ne&127,ne>>>0>121)return m=5,G=he,m|0;if(O=Si(ne)|0,et(_|0,0,52)|0,ge=q()|0|134225919,v=m,A[v>>2]=-1,A[v+4>>2]=ge,!_)return _=Zd(f)|0,(_|0)==7||(_=Zg(ne,_)|0,(_|0)==127)?(ge=1,G=he,ge|0):(ie=et(_|0,0,45)|0,re=q()|0,ne=m,re=A[ne+4>>2]&-1040385|re,ge=m,A[ge>>2]=A[ne>>2]|ie,A[ge+4>>2]=re,ge=0,G=he,ge|0);for(A[D>>2]=A[f>>2],A[D+4>>2]=A[f+4>>2],A[D+8>>2]=A[f+8>>2],f=_;;){if(v=f,f=f+-1|0,A[b>>2]=A[D>>2],A[b+4>>2]=A[D+4>>2],A[b+8>>2]=A[D+8>>2],Ks(v)|0){if(_=dN(D)|0,_|0){f=13;break}A[w>>2]=A[D>>2],A[w+4>>2]=A[D+4>>2],A[w+8>>2]=A[D+8>>2],Jd(w)}else{if(_=pN(D)|0,_|0){f=13;break}A[w>>2]=A[D>>2],A[w+4>>2]=A[D+4>>2],A[w+8>>2]=A[D+8>>2],Su(w)}if(n1(b,w,C),Lr(C),_=m,ye=A[_>>2]|0,_=A[_+4>>2]|0,xe=(15-v|0)*3|0,Ee=et(7,0,xe|0)|0,_=_&~(q()|0),xe=et(Zd(C)|0,0,xe|0)|0,_=q()|0|_,ge=m,A[ge>>2]=xe|ye&~Ee,A[ge+4>>2]=_,(v|0)<=1){f=14;break}}e:do if((f|0)!=13&&(f|0)==14)if((A[D>>2]|0)<=1&&(A[D+4>>2]|0)<=1&&(A[D+8>>2]|0)<=1){f=Zd(D)|0,_=Zg(ne,f)|0,(_|0)==127?C=0:C=Si(_)|0;t:do if(f){if(O){if(_=ds(h,c)|0,(_|0)==7){_=5;break e}if(v=A[21376+(_*28|0)+(f<<2)>>2]|0,(v|0)>0){_=f,f=0;do _=Tu(_)|0,f=f+1|0;while((f|0)!=(v|0))}else _=f;if((_|0)==1){_=9;break e}f=Zg(ne,_)|0,(f|0)==127&&rt(27648,27538,411,27678),Si(f)|0?rt(27693,27538,412,27678):(re=f,ie=v,X=_)}else re=_,ie=0,X=f;if(w=A[4272+(ne*28|0)+(X<<2)>>2]|0,(w|0)<=-1&&rt(27724,27538,419,27678),!C){if((ie|0)<0){_=5;break e}if(ie|0){v=m,_=0,f=A[v>>2]|0,v=A[v+4>>2]|0;do f=Mu(f,v)|0,v=q()|0,xe=m,A[xe>>2]=f,A[xe+4>>2]=v,_=_+1|0;while((_|0)<(ie|0))}if((w|0)<=0){_=re,f=58;break}for(v=m,_=0,f=A[v>>2]|0,v=A[v+4>>2]|0;;)if(f=Mu(f,v)|0,v=q()|0,xe=m,A[xe>>2]=f,A[xe+4>>2]=v,_=_+1|0,(_|0)==(w|0)){_=re,f=58;break t}}if(b=Jg(re,ne)|0,(b|0)==7&&rt(27514,27538,428,27678),_=m,f=A[_>>2]|0,_=A[_+4>>2]|0,(w|0)>0){v=0;do f=Mu(f,_)|0,_=q()|0,xe=m,A[xe>>2]=f,A[xe+4>>2]=_,v=v+1|0;while((v|0)!=(w|0))}if(_=ds(f,_)|0,(_|0)==7&&rt(27795,27538,440,27678),f=Kg(re)|0,f=A[(f?21792:21584)+(b*28|0)+(_<<2)>>2]|0,(f|0)<0&&rt(27795,27538,454,27678),!f)_=re,f=58;else{b=m,_=0,v=A[b>>2]|0,b=A[b+4>>2]|0;do v=u1(v,b)|0,b=q()|0,xe=m,A[xe>>2]=v,A[xe+4>>2]=b,_=_+1|0;while((_|0)<(f|0));_=re,f=58}}else if((O|0)!=0&(C|0)!=0){if(f=ds(h,c)|0,v=m,v=ds(A[v>>2]|0,A[v+4>>2]|0)|0,(f|0)==7|(v|0)==7){_=5;break e}if(v=A[21376+(f*28|0)+(v<<2)>>2]|0,(v|0)<0){_=5;break e}if(!v)f=59;else{w=m,f=0,b=A[w>>2]|0,w=A[w+4>>2]|0;do b=Mu(b,w)|0,w=q()|0,xe=m,A[xe>>2]=b,A[xe+4>>2]=w,f=f+1|0;while((f|0)<(v|0));f=58}}else f=58;while(!1);
4070if((f|0)==58&&C&&(f=59),(f|0)==59&&(xe=m,(ds(A[xe>>2]|0,A[xe+4>>2]|0)|0)==1)){_=9;break}xe=m,Ee=A[xe>>2]|0,xe=A[xe+4>>2]&-1040385,ye=et(_|0,0,45)|0,xe=xe|(q()|0),_=m,A[_>>2]=Ee|ye,A[_+4>>2]=xe,_=0}else _=1;while(!1);return xe=_,G=he,xe|0}function aP(h,c,f,m,_,v){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0,v=v|0;var b=0,w=0;return w=G,G=G+16|0,b=w,_?h=15:(h=ka(h,c,f,m,b)|0,h||(gN(b,v),h=0)),G=w,h|0}function lP(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0;return b=G,G=G+16|0,v=b,m?f=15:(f=_N(f,v)|0,f||(f=ob(h,c,v,_)|0)),G=b,f|0}function uP(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0;return C=G,G=G+32|0,b=C+12|0,w=C,v=ka(h,c,h,c,b)|0,v|0?(w=v,G=C,w|0):(h=ka(h,c,f,m,w)|0,h|0?(w=h,G=C,w|0):(b=i1(b,w)|0,w=_,A[w>>2]=b,A[w+4>>2]=((b|0)<0)<<31>>31,w=0,G=C,w|0))}function cP(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0;return C=G,G=G+32|0,b=C+12|0,w=C,v=ka(h,c,h,c,b)|0,!v&&(v=ka(h,c,f,m,w)|0,!v)?(m=i1(b,w)|0,m=jt(m|0,((m|0)<0)<<31>>31|0,1,0)|0,b=q()|0,w=_,A[w>>2]=m,A[w+4>>2]=b,w=0,G=C,w|0):(w=v,G=C,w|0)}function hP(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0,Gt=0,Et=0,An=0;if(Et=G,G=G+48|0,it=Et+24|0,b=Et+12|0,Gt=Et,v=ka(h,c,h,c,it)|0,!v&&(v=ka(h,c,f,m,b)|0,!v)){xe=i1(it,b)|0,Ae=((xe|0)<0)<<31>>31,A[it>>2]=0,A[it+4>>2]=0,A[it+8>>2]=0,A[b>>2]=0,A[b+4>>2]=0,A[b+8>>2]=0,ka(h,c,h,c,it)|0&&rt(27795,27538,692,27747),ka(h,c,f,m,b)|0&&rt(27795,27538,697,27747),j3(it),j3(b),O=xe|0?1/+(xe|0):0,f=A[it>>2]|0,he=O*+((A[b>>2]|0)-f|0),ge=it+4|0,m=A[ge>>2]|0,Ee=O*+((A[b+4>>2]|0)-m|0),ye=it+8|0,v=A[ye>>2]|0,O=O*+((A[b+8>>2]|0)-v|0),A[Gt>>2]=f,X=Gt+4|0,A[X>>2]=m,ne=Gt+8|0,A[ne>>2]=v;e:do if((xe|0)<0)v=0;else for(ie=0,re=0;;){C=+(re>>>0)+4294967296*+(ie|0),An=he*C+ +(f|0),w=Ee*C+ +(m|0),C=O*C+ +(v|0),f=~~+o0(+An),b=~~+o0(+w),v=~~+o0(+C),An=+mn(+(+(f|0)-An)),w=+mn(+(+(b|0)-w)),C=+mn(+(+(v|0)-C));do if(An>w&An>C)f=0-(b+v)|0,m=b;else if(D=0-f|0,w>C){m=D-v|0;break}else{m=b,v=D-b|0;break}while(!1);if(A[Gt>>2]=f,A[X>>2]=m,A[ne>>2]=v,xN(Gt),v=ob(h,c,Gt,_+(re<<3)|0)|0,v|0)break e;if(!((ie|0)<(Ae|0)|(ie|0)==(Ae|0)&re>>>0<xe>>>0)){v=0;break e}f=jt(re|0,ie|0,1,0)|0,m=q()|0,ie=m,re=f,f=A[it>>2]|0,m=A[ge>>2]|0,v=A[ye>>2]|0}while(!1);return Gt=v,G=Et,Gt|0}return Gt=v,G=Et,Gt|0}function vl(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0;if((f|0)==0&(m|0)==0)return _=0,v=1,Qe(_|0),v|0;v=h,_=c,h=1,c=0;do b=(f&1|0)==0&!0,h=cr((b?1:v)|0,(b?0:_)|0,h|0,c|0)|0,c=q()|0,f=xb(f|0,m|0,1)|0,m=q()|0,v=cr(v|0,_|0,v|0,_|0)|0,_=q()|0;while(!((f|0)==0&(m|0)==0));return Qe(c|0),h|0}function g1(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0;w=G,G=G+16|0,v=w,b=ze(h|0,c|0,52)|0,q()|0,b=b&15;do if(b){if(_=wu(h,c,v)|0,!_){D=+H[v>>3],C=1/+kn(+D),O=+H[25968+(b<<3)>>3],H[f>>3]=D+O,H[f+8>>3]=D-O,D=+H[v+8>>3],C=O*C,H[f+16>>3]=C+D,H[f+24>>3]=D-C;break}return b=_,G=w,b|0}else{if(_=ze(h|0,c|0,45)|0,q()|0,_=_&127,_>>>0>121)return b=5,G=w,b|0;v=22064+(_<<5)|0,A[f>>2]=A[v>>2],A[f+4>>2]=A[v+4>>2],A[f+8>>2]=A[v+8>>2],A[f+12>>2]=A[v+12>>2],A[f+16>>2]=A[v+16>>2],A[f+20>>2]=A[v+20>>2],A[f+24>>2]=A[v+24>>2],A[f+28>>2]=A[v+28>>2];break}while(!1);return hN(f,m?1.4:1.1),m=26096+(b<<3)|0,(A[m>>2]|0)==(h|0)&&(A[m+4>>2]|0)==(c|0)&&(H[f>>3]=1.5707963267948966),b=26224+(b<<3)|0,(A[b>>2]|0)==(h|0)&&(A[b+4>>2]|0)==(c|0)&&(H[f+8>>3]=-1.5707963267948966),+H[f>>3]!=1.5707963267948966&&+H[f+8>>3]!=-1.5707963267948966?(b=0,G=w,b|0):(H[f+16>>3]=3.141592653589793,H[f+24>>3]=-3.141592653589793,b=0,G=w,b|0)}function AP(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0;D=G,G=G+48|0,b=D+32|0,v=D+40|0,w=D,a1(b,0,0,0),C=A[b>>2]|0,b=A[b+4>>2]|0;do if(f>>>0<=15){if(_=YA(m)|0,_|0){m=w,A[m>>2]=0,A[m+4>>2]=0,A[w+8>>2]=_,A[w+12>>2]=-1,m=w+16|0,C=w+29|0,A[m>>2]=0,A[m+4>>2]=0,A[m+8>>2]=0,Ve[m+12>>0]=0,Ve[C>>0]=Ve[v>>0]|0,Ve[C+1>>0]=Ve[v+1>>0]|0,Ve[C+2>>0]=Ve[v+2>>0]|0;break}if(_=ps((A[c+8>>2]|0)+1|0,32)|0,_){_1(c,_),O=w,A[O>>2]=C,A[O+4>>2]=b,A[w+8>>2]=0,A[w+12>>2]=f,A[w+16>>2]=m,A[w+20>>2]=c,A[w+24>>2]=_,Ve[w+28>>0]=0,C=w+29|0,Ve[C>>0]=Ve[v>>0]|0,Ve[C+1>>0]=Ve[v+1>>0]|0,Ve[C+2>>0]=Ve[v+2>>0]|0;break}else{m=w,A[m>>2]=0,A[m+4>>2]=0,A[w+8>>2]=13,A[w+12>>2]=-1,m=w+16|0,C=w+29|0,A[m>>2]=0,A[m+4>>2]=0,A[m+8>>2]=0,Ve[m+12>>0]=0,Ve[C>>0]=Ve[v>>0]|0,Ve[C+1>>0]=Ve[v+1>>0]|0,Ve[C+2>>0]=Ve[v+2>>0]|0;break}}else C=w,A[C>>2]=0,A[C+4>>2]=0,A[w+8>>2]=4,A[w+12>>2]=-1,C=w+16|0,O=w+29|0,A[C>>2]=0,A[C+4>>2]=0,A[C+8>>2]=0,Ve[C+12>>0]=0,Ve[O>>0]=Ve[v>>0]|0,Ve[O+1>>0]=Ve[v+1>>0]|0,Ve[O+2>>0]=Ve[v+2>>0]|0;while(!1);i0(w),A[h>>2]=A[w>>2],A[h+4>>2]=A[w+4>>2],A[h+8>>2]=A[w+8>>2],A[h+12>>2]=A[w+12>>2],A[h+16>>2]=A[w+16>>2],A[h+20>>2]=A[w+20>>2],A[h+24>>2]=A[w+24>>2],A[h+28>>2]=A[w+28>>2],G=D}function i0(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0;if(Ae=G,G=G+336|0,ie=Ae+168|0,re=Ae,m=h,f=A[m>>2]|0,m=A[m+4>>2]|0,(f|0)==0&(m|0)==0){G=Ae;return}if(c=h+28|0,Ve[c>>0]|0?(f=ab(f,m)|0,m=q()|0):Ve[c>>0]=1,xe=h+20|0,!(A[A[xe>>2]>>2]|0)){c=h+24|0,f=A[c>>2]|0,f|0&&Xt(f),ye=h,A[ye>>2]=0,A[ye+4>>2]=0,A[h+8>>2]=0,A[xe>>2]=0,A[h+12>>2]=-1,A[h+16>>2]=0,A[c>>2]=0,G=Ae;return}ye=h+16|0,c=A[ye>>2]|0,_=c&15;e:do if((f|0)==0&(m|0)==0)Ee=h+24|0;else{he=h+12|0,X=(_|0)==3,O=c&255,C=(_|1|0)==3,ne=h+24|0,D=(_+-1|0)>>>0<3,b=(_|2|0)==3,w=re+8|0;t:for(;;){if(v=ze(f|0,m|0,52)|0,q()|0,v=v&15,(v|0)==(A[he>>2]|0)){switch(O&15){case 0:case 2:case 3:{if(_=wu(f,m,ie)|0,_|0){ge=15;break t}if(x1(A[xe>>2]|0,A[ne>>2]|0,ie)|0){ge=19;break t}break}}if(C&&(_=A[(A[xe>>2]|0)+4>>2]|0,A[ie>>2]=A[_>>2],A[ie+4>>2]=A[_+4>>2],A[ie+8>>2]=A[_+8>>2],A[ie+12>>2]=A[_+12>>2],e1(26832,ie)|0)){if(h1(A[(A[xe>>2]|0)+4>>2]|0,v,re)|0){ge=25;break}if(_=re,(A[_>>2]|0)==(f|0)&&(A[_+4>>2]|0)==(m|0)){ge=29;break}}if(D){if(_=Nc(f,m,ie)|0,_|0){ge=32;break}if(g1(f,m,re,0)|0){ge=36;break}if(b&&ub(A[xe>>2]|0,A[ne>>2]|0,ie,re)|0){ge=42;break}if(C&&cb(A[xe>>2]|0,A[ne>>2]|0,ie,re)|0){ge=42;break}}if(X){if(c=g1(f,m,ie,1)|0,_=A[ne>>2]|0,c|0){ge=45;break}if(t1(_,ie)|0){if(k3(re,ie),O3(ie,A[ne>>2]|0)|0){ge=53;break}if(x1(A[xe>>2]|0,A[ne>>2]|0,w)|0){ge=53;break}if(cb(A[xe>>2]|0,A[ne>>
40702]|0,re,ie)|0){ge=53;break}}}}do if((v|0)<(A[he>>2]|0)){if(c=g1(f,m,ie,1)|0,_=A[ne>>2]|0,c|0){ge=58;break t}if(!(t1(_,ie)|0)){ge=73;break}if(O3(A[ne>>2]|0,ie)|0&&(k3(re,ie),ub(A[xe>>2]|0,A[ne>>2]|0,re,ie)|0)){ge=65;break t}if(f=J3(f,m,v+1|0,re)|0,f|0){ge=67;break t}m=re,f=A[m>>2]|0,m=A[m+4>>2]|0}else ge=73;while(!1);if((ge|0)==73&&(ge=0,f=ab(f,m)|0,m=q()|0),(f|0)==0&(m|0)==0){Ee=ne;break e}}switch(ge|0){case 15:{c=A[ne>>2]|0,c|0&&Xt(c),ge=h,A[ge>>2]=0,A[ge+4>>2]=0,A[xe>>2]=0,A[he>>2]=-1,A[ye>>2]=0,A[ne>>2]=0,A[h+8>>2]=_,ge=20;break}case 19:{A[h>>2]=f,A[h+4>>2]=m,ge=20;break}case 25:{rt(27795,27761,470,27772);break}case 29:{A[h>>2]=f,A[h+4>>2]=m,G=Ae;return}case 32:{c=A[ne>>2]|0,c|0&&Xt(c),Ee=h,A[Ee>>2]=0,A[Ee+4>>2]=0,A[xe>>2]=0,A[he>>2]=-1,A[ye>>2]=0,A[ne>>2]=0,A[h+8>>2]=_,G=Ae;return}case 36:{rt(27795,27761,493,27772);break}case 42:{A[h>>2]=f,A[h+4>>2]=m,G=Ae;return}case 45:{_|0&&Xt(_),ge=h,A[ge>>2]=0,A[ge+4>>2]=0,A[xe>>2]=0,A[he>>2]=-1,A[ye>>2]=0,A[ne>>2]=0,A[h+8>>2]=c,ge=55;break}case 53:{A[h>>2]=f,A[h+4>>2]=m,ge=55;break}case 58:{_|0&&Xt(_),ge=h,A[ge>>2]=0,A[ge+4>>2]=0,A[xe>>2]=0,A[he>>2]=-1,A[ye>>2]=0,A[ne>>2]=0,A[h+8>>2]=c,ge=71;break}case 65:{A[h>>2]=f,A[h+4>>2]=m,ge=71;break}case 67:{c=A[ne>>2]|0,c|0&&Xt(c),Ee=h,A[Ee>>2]=0,A[Ee+4>>2]=0,A[xe>>2]=0,A[he>>2]=-1,A[ye>>2]=0,A[ne>>2]=0,A[h+8>>2]=f,G=Ae;return}}if((ge|0)==20){G=Ae;return}else if((ge|0)==55){G=Ae;return}else if((ge|0)==71){G=Ae;return}}while(!1);c=A[Ee>>2]|0,c|0&&Xt(c),ge=h,A[ge>>2]=0,A[ge+4>>2]=0,A[h+8>>2]=0,A[xe>>2]=0,A[h+12>>2]=-1,A[ye>>2]=0,A[Ee>>2]=0,G=Ae}function ab(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0;X=G,G=G+16|0,O=X,m=ze(h|0,c|0,52)|0,q()|0,m=m&15,f=ze(h|0,c|0,45)|0,q()|0;do if(m){for(;f=et(m+4095|0,0,52)|0,_=q()|0|c&-15728641,v=(15-m|0)*3|0,b=et(7,0,v|0)|0,w=q()|0,f=f|h|b,_=_|w,C=ze(h|0,c|0,v|0)|0,q()|0,C=C&7,m=m+-1|0,!(C>>>0<6);)if(m)c=_,h=f;else{D=4;break}if((D|0)==4){f=ze(f|0,_|0,45)|0,q()|0;break}return O=(C|0)==0&(Ai(f,_)|0)!=0,O=et((O?2:1)+C|0,0,v|0)|0,D=q()|0|c&~w,O=O|h&~b,Qe(D|0),G=X,O|0}while(!1);return f=f&127,f>>>0>120?(D=0,O=0,Qe(D|0),G=X,O|0):(a1(O,0,f+1|0,0),D=A[O+4>>2]|0,O=A[O>>2]|0,Qe(D|0),G=X,O|0)}function fP(h,c,f,m,_,v){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0,v=v|0;var b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0;ge=G,G=G+160|0,X=ge+80|0,w=ge+64|0,ne=ge+112|0,he=ge,AP(X,h,c,f),D=X,d1(w,A[D>>2]|0,A[D+4>>2]|0,c),D=w,C=A[D>>2]|0,D=A[D+4>>2]|0,b=A[X+8>>2]|0,ie=ne+4|0,A[ie>>2]=A[X>>2],A[ie+4>>2]=A[X+4>>2],A[ie+8>>2]=A[X+8>>2],A[ie+12>>2]=A[X+12>>2],A[ie+16>>2]=A[X+16>>2],A[ie+20>>2]=A[X+20>>2],A[ie+24>>2]=A[X+24>>2],A[ie+28>>2]=A[X+28>>2],ie=he,A[ie>>2]=C,A[ie+4>>2]=D,ie=he+8|0,A[ie>>2]=b,h=he+12|0,c=ne,f=h+36|0;do A[h>>2]=A[c>>2],h=h+4|0,c=c+4|0;while((h|0)<(f|0));if(ne=he+48|0,A[ne>>2]=A[w>>2],A[ne+4>>2]=A[w+4>>2],A[ne+8>>2]=A[w+8>>2],A[ne+12>>2]=A[w+12>>2],(C|0)==0&(D|0)==0)return he=b,G=ge,he|0;f=he+16|0,O=he+24|0,X=he+28|0,b=0,w=0,c=C,h=D;do{if(!((b|0)<(_|0)|(b|0)==(_|0)&w>>>0<m>>>0)){re=4;break}if(D=w,w=jt(w|0,b|0,1,0)|0,b=q()|0,D=v+(D<<3)|0,A[D>>2]=c,A[D+4>>2]=h,p1(ne),h=ne,c=A[h>>2]|0,h=A[h+4>>2]|0,(c|0)==0&(h|0)==0){if(i0(f),c=f,h=A[c>>2]|0,c=A[c+4>>2]|0,(h|0)==0&(c|0)==0){re=10;break}tb(h,c,A[X>>2]|0,ne),h=ne,c=A[h>>2]|0,h=A[h+4>>2]|0}D=he,A[D>>2]=c,A[D+4>>2]=h}while(!((c|0)==0&(h|0)==0));return(re|0)==4?(h=he+40|0,c=A[h>>2]|0,c|0&&Xt(c),re=he+16|0,A[re>>2]=0,A[re+4>>2]=0,A[O>>2]=0,A[he+36>>2]=0,A[X>>2]=-1,A[he+32>>2]=0,A[h>>2]=0,tb(0,0,0,ne),A[he>>2]=0,A[he+4>>2]=0,A[ie>>2]=0,he=14,G=ge,he|0):((re|0)==10&&(A[he>>2]=0,A[he+4>>2]=0,A[ie>>2]=A[O>>2]),he=A[ie>>2]|0,G=ge,he|0)}function dP(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0;if(X=G,G=G+48|0,C=X+32|0,w=X+40|0,D=X,!(A[h>>2]|0))return O=m,A[O>>2]=0,A[O+4>>2]=0,O=0,G=X,O|0;a1(C,0,0,0),b=C,_=A[b>>2]|0,b=A[b+4>>2]|0;do if(c>>>0>15)O=D,A[O>>2]=0,A[O+4>>2]=0,A[D+8>>2]=4,A[D+12>>2]=-1,O=D+16|0,f=D+29|0,A[O>>2]=0,A[O+4>>2]=0,A[O+8>>2]=0,Ve[O+12>>0]=0,Ve[f>>0]=Ve[w>>0]|0,Ve[f+1>>0]=Ve[w+1>>0]|0,Ve[f+2>>0]=Ve[w+2>>0]|0,f=4,O=9;else{if(f=YA(f)|0,f|0){C=D,A[C>>2]=0,A[C+4>>2]=0,A[D+8>>2]=f,A[D+12>>2]=-1,C=D+16|0,O=D+29|0,A[C>>2]=0,A[C+4>>2]=0,A[C+8>>2]=0,Ve[C+12>>0]=0,Ve[O>>0]=Ve[w>>0]|0,Ve[O+1>>0]=Ve[w+1>>0]|0,Ve[O+2>>0]=Ve[w+2>>0]|0,O=9;break}if(f=ps((A[h+8>>2]|0)+1|0,32)|0,!f){O=D,A[O>>2]=0,A[O+4>>2]=0,A[D+8>>2]=13,A[D+12>>2]=-1,O=D+16|0,f=D+29|0,A[O>>2]=0,A[O+4>>2]=0,A[O+8>>2]=0,Ve[O+12>>0]=0,Ve[f>>0]=Ve[w>>0]|0,Ve[f+1>>0]=Ve[w+1>>0]|0,Ve[f+2>>0]=Ve[w+2>>0]|0,f=13,O=9;break}_1(h,f),ie=D,A[ie>>2]=_,A[ie+4>>2]=b,b=D+8|0,A[b>>2]=0,A[D+12>>2]=c,A[D+20>>2]=h,A[D+24>>2]=f,Ve[D+28>>0]=0,_=D+29|0,Ve[_>>0]=Ve[w>>0]|0,Ve[_+1>>0]=Ve[w+1>>0]|0,Ve[_+2>>0]=Ve[w+2>>0]|0,A[D+16>>2]=3,ne=+lN(f),ne=ne*+aN(f),v=+mn(+ +H[f>>3]),v=ne/+kn(+ +s0(+v,+ +mn(+ +H[f+8>>3])))*6371.007180918475*6371.007180918475,_=D+12|0,f=A[_>>2]|0;e:do if((f|0)>0)do{if(nb(f+-1|0,C)|0,!(v/+H[C>>3]>10))break e;ie=A[_>>2]|0,f=ie+-1|0,A[_>>2]=f}while((ie|0)>1);while(!1);if(i0(D),_=m,A[_>>2]=0,A[_+4>>2]=0,_=D,f=A[_>>2]|0,_=A[_+4>>2]|0,!((f|0)==0&(_|0)==0))do $A(f,_,c,C)|0,w=C,h=m,w=jt(A[h>>2]|0,A[h+4>>2]|0,A[w>>2]|0,A[w+4>>2]|0)|0,h=q()|0,ie=m,A[ie>>2]=w,A[ie+4>>2]=h,i0(D),ie=D,f=A[ie>>2]|0,_=A[ie+4>>2]|0;while(!((f|0)==0&(_|0)==0));f=A[b>>2]|0}while(!1);return ie=f,G=X,ie|0}function QA(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0;if(!(e1(c,f)|0)||(c=U3(c)|0,m=+H[f>>3],_=+H[f+8>>3],_=c&_<0?_+6.283185307179586:_,ne=A[h>>2]|0,(ne|0)<=0))return ne=0,ne|0;if(X=A[h+4>>2]|0,c){c=0,O=_,f=-1,h=0;e:for(;;){for(D=h;b=+H[X+(D<<4)>>3],_=+H[X+(D<<4)+8>>3],h=(f+2|0)%(ne|0)|0,v=+H[X+(h<<4)>>3],w=+H[X+(h<<4)+8>>3],b>
4070v?(C=b,b=w):(C=v,v=b,b=_,_=w),m=m==v|m==C?m+2220446049250313e-31:m,!!(m<v|m>C);)if(f=D+1|0,(f|0)>=(ne|0)){f=22;break e}else h=D,D=f,f=h;if(w=b<0?b+6.283185307179586:b,b=_<0?_+6.283185307179586:_,O=w==O|b==O?O+-2220446049250313e-31:O,C=w+(b-w)*((m-v)/(C-v)),(C<0?C+6.283185307179586:C)>O&&(c=c^1),h=D+1|0,(h|0)>=(ne|0)){f=22;break}else f=D}if((f|0)==22)return c|0}else{c=0,O=_,f=-1,h=0;e:for(;;){for(D=h;b=+H[X+(D<<4)>>3],_=+H[X+(D<<4)+8>>3],h=(f+2|0)%(ne|0)|0,v=+H[X+(h<<4)>>3],w=+H[X+(h<<4)+8>>3],b>v?(C=b,b=w):(C=v,v=b,b=_,_=w),m=m==v|m==C?m+2220446049250313e-31:m,!!(m<v|m>C);)if(f=D+1|0,(f|0)>=(ne|0)){f=22;break e}else h=D,D=f,f=h;if(O=b==O|_==O?O+-2220446049250313e-31:O,b+(_-b)*((m-v)/(C-v))>O&&(c=c^1),h=D+1|0,(h|0)>=(ne|0)){f=22;break}else f=D}if((f|0)==22)return c|0}return 0}function lb(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0;if(re=A[h>>2]|0,!re){A[c>>2]=0,A[c+4>>2]=0,A[c+8>>2]=0,A[c+12>>2]=0,A[c+16>>2]=0,A[c+20>>2]=0,A[c+24>>2]=0,A[c+28>>2]=0;return}if(he=c+8|0,H[he>>3]=17976931348623157e292,ge=c+24|0,H[ge>>3]=17976931348623157e292,H[c>>3]=-17976931348623157e292,Ee=c+16|0,H[Ee>>3]=-17976931348623157e292,!((re|0)<=0)){for(ne=A[h+4>>2]|0,D=17976931348623157e292,O=-17976931348623157e292,X=0,h=-1,v=17976931348623157e292,b=17976931348623157e292,C=-17976931348623157e292,m=-17976931348623157e292,ie=0;f=+H[ne+(ie<<4)>>3],w=+H[ne+(ie<<4)+8>>3],h=h+2|0,_=+H[ne+(((h|0)==(re|0)?0:h)<<4)+8>>3],f<v&&(H[he>>3]=f,v=f),w<b&&(H[ge>>3]=w,b=w),f>C?H[c>>3]=f:f=C,w>m&&(H[Ee>>3]=w,m=w),D=w>0&w<D?w:D,O=w<0&w>O?w:O,X=X|+mn(+(w-_))>3.141592653589793,h=ie+1|0,(h|0)!=(re|0);)ye=ie,C=f,ie=h,h=ye;X&&(H[Ee>>3]=O,H[ge>>3]=D)}}function YA(h){return h=h|0,(h>>>0<4?0:15)|0}function _1(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0,Gt=0,Et=0;if(re=A[h>>2]|0,re){if(he=c+8|0,H[he>>3]=17976931348623157e292,ge=c+24|0,H[ge>>3]=17976931348623157e292,H[c>>3]=-17976931348623157e292,Ee=c+16|0,H[Ee>>3]=-17976931348623157e292,(re|0)>0){for(_=A[h+4>>2]|0,ne=17976931348623157e292,ie=-17976931348623157e292,m=0,f=-1,C=17976931348623157e292,D=17976931348623157e292,X=-17976931348623157e292,b=-17976931348623157e292,ye=0;v=+H[_+(ye<<4)>>3],O=+H[_+(ye<<4)+8>>3],Gt=f+2|0,w=+H[_+(((Gt|0)==(re|0)?0:Gt)<<4)+8>>3],v<C&&(H[he>>3]=v,C=v),O<D&&(H[ge>>3]=O,D=O),v>X?H[c>>3]=v:v=X,O>b&&(H[Ee>>3]=O,b=O),ne=O>0&O<ne?O:ne,ie=O<0&O>ie?O:ie,m=m|+mn(+(O-w))>3.141592653589793,f=ye+1|0,(f|0)!=(re|0);)Gt=ye,X=v,ye=f,f=Gt;m&&(H[Ee>>3]=ie,H[ge>>3]=ne)}}else A[c>>2]=0,A[c+4>>2]=0,A[c+8>>2]=0,A[c+12>>2]=0,A[c+16>>2]=0,A[c+20>>2]=0,A[c+24>>2]=0,A[c+28>>2]=0;if(Gt=h+8|0,f=A[Gt>>2]|0,!((f|0)<=0)){it=h+12|0,Ae=0;do if(_=A[it>>2]|0,m=Ae,Ae=Ae+1|0,ge=c+(Ae<<5)|0,Ee=A[_+(m<<3)>>2]|0,Ee){if(ye=c+(Ae<<5)+8|0,H[ye>>3]=17976931348623157e292,h=c+(Ae<<5)+24|0,H[h>>3]=17976931348623157e292,H[ge>>3]=-17976931348623157e292,xe=c+(Ae<<5)+16|0,H[xe>>3]=-17976931348623157e292,(Ee|0)>0){for(re=A[_+(m<<3)+4>>2]|0,ne=17976931348623157e292,ie=-17976931348623157e292,_=0,m=-1,he=0,C=17976931348623157e292,D=17976931348623157e292,O=-17976931348623157e292,b=-17976931348623157e292;v=+H[re+(he<<4)>>3],X=+H[re+(he<<4)+8>>3],m=m+2|0,w=+H[re+(((m|0)==(Ee|0)?0:m)<<4)+8>>3],v<C&&(H[ye>>3]=v,C=v),X<D&&(H[h>>3]=X,D=X),v>O?H[ge>>3]=v:v=O,X>b&&(H[xe>>3]=X,b=X),ne=X>0&X<ne?X:ne,ie=X<0&X>ie?X:ie,_=_|+mn(+(X-w))>3.141592653589793,m=he+1|0,(m|0)!=(Ee|0);)Et=he,he=m,O=v,m=Et;_&&(H[xe>>3]=ie,H[h>>3]=ne)}}else A[ge>>2]=0,A[ge+4>>2]=0,A[ge+8>>2]=0,A[ge+12>>2]=0,A[ge+16>>2]=0,A[ge+20>>2]=0,A[ge+24>>2]=0,A[ge+28>>2]=0,f=A[Gt>>2]|0;while((Ae|0)<(f|0))}}function x1(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0;if(!(QA(h,c,f)|0))return _=0,_|0;if(_=h+8|0,(A[_>>2]|0)<=0)return _=1,_|0;for(m=h+12|0,h=0;;){if(v=h,h=h+1|0,QA((A[m>>2]|0)+(v<<3)|0,c+(h<<5)|0,f)|0){h=0,m=6;break}if((h|0)>=(A[_>>2]|0)){h=1,m=6;break}}return(m|0)==6?h|0:0}function ub(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0;if(D=G,G=G+16|0,w=D,b=f+8|0,!(QA(h,c,b)|0))return C=0,G=D,C|0;C=h+8|0;e:do if((A[C>>2]|0)>0){for(v=h+12|0,_=0;;){if(O=_,_=_+1|0,QA((A[v>>2]|0)+(O<<3)|0,c+(_<<5)|0,b)|0){_=0;break}if((_|0)>=(A[C>>2]|0))break e}return G=D,_|0}while(!1);if(r0(h,c,f,m)|0)return O=0,G=D,O|0;A[w>>2]=A[f>>2],A[w+4>>2]=b,_=A[C>>2]|0;e:do if((_|0)>0)for(h=h+12|0,b=0,v=_;;){if(_=A[h>>2]|0,(A[_+(b<<3)>>2]|0)>0){if(QA(w,m,A[_+(b<<3)+4>>2]|0)|0){_=0;break e}if(_=b+1|0,r0((A[h>>2]|0)+(b<<3)|0,c+(_<<5)|0,f,m)|0){_=0;break e}v=A[C>>2]|0}else _=b+1|0;if((_|0)<(v|0))b=_;else{_=1;break}}else _=1;while(!1);return O=_,G=D,O|0}function r0(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0,Gt=0,Et=0,An=0;if(Gt=G,G=G+176|0,ye=Gt+172|0,_=Gt+168|0,xe=Gt,!(t1(c,m)|0))return h=0,G=Gt,h|0;if(uN(c,m,ye,_),Ic(xe|0,f|0,168)|0,(A[f>>2]|0)>0){c=0;do Et=xe+8+(c<<4)+8|0,Ee=+Ds(+H[Et>>3],A[_>>2]|0),H[Et>>3]=Ee,c=c+1|0;while((c|0)<(A[f>>2]|0))}he=+H[m>>3],ge=+H[m+8>>3],Ee=+Ds(+H[m+16>>3],A[_>>2]|0),ie=+Ds(+H[m+24>>3],A[_>>2]|0);e:do if((A[h>>2]|0)>0){if(m=h+4|0,_=A[xe>>2]|0,(_|0)<=0){for(c=0;;)if(c=c+1|0,(c|0)>=(A[h>>2]|0)){c=0;break e}}for(f=0;;){if(c=A[m>>2]|0,ne=+H[c+(f<<4)>>3],re=+Ds(+H[c+(f<<4)+8>>3],A[ye>>2]|0),c=A[m>>2]|0,f=f+1|0,Et=(f|0)%(A[h>>2]|0)|0,v=+H[c+(Et<<4)>>3],b=+Ds(+H[c+(Et<<4)+8>>3],A[ye>>2]|0),!(ne>=he)|!(v>=he)&&!(ne<=ge)|!(v<=ge)&&!(re<=ie)|!(b<=ie)&&!(re>=Ee)|!(b>=Ee)){X=v-ne,D=b-re,c=0;do if(An=c,c=c+1|0,Et=(c|0)==(_|0)?0:c,v=+H[xe+8+(An<<4)+8>>3],b=+H[xe+8+(Et<<4)+8>>3]-v,w=+H[xe+8+(An<<4)>>3],C=+H[xe+8+(Et<<4)>>3]-w,O=X*b-D*C,O!=0&&(Ae=re-v,it=ne-w,C=(Ae*C-b*it)/O,!(C<0|C>1))&&(O=(X*Ae-D*it)/O,O>=0&O<=1)){c=1;break e}while((c|0)<(_|0))}if((f|0)>=(A[h>>2]|0)){c=0;break}}}else c=0;while(!1);return An=c,G=Gt,An|0}function cb(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0;if(r0(h,c,f,m)|0)return v=1,v|0;if(v=h+8|0,(A[v>>2]|0)<=0)return v=0,v|0;for(_=h+12|0,h=0;;){if(b=h,h=h+1|0,r0((A[_>>2]|0)+(b<<3)|0,c+(h<<5)|0,f,m)|0){h=1,_=6;break}if((h|0)>=(A[v>>2]|0)){h=0,_=6;break}}return(_|0)==6?h|0:0}function pP(){return 8}function mP(){return 16}function gP(){return 168}function _P(){return 8}function xP(){return 16}function vP(){return 12}function yP(){return 8}function bP(h){return h=h|0,+(+((A[h>>2]|0)>>>0)+4294967296*+(A[h+4>>2]|0))}function SP(h){h=h|0;var c=0,f=0;return f=+H[h>>3],c=+H[h+8>>3],+ +Ln(+(f*f+c*c))}function hb(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0;D=+H[h>>3],C=+H[c>>3]-D,w=+H[h+8>>3],b=+H[c+8>>3]-w,X=+H[f>>3],v=+H[m>>3]-X,ne=+H[f+8>>3],O=+H[m+8>>3]-ne,v=(v*(w-ne)-(D-X)*O)/(C*O-b*v),H[_>>3]=D+C*v,H[_+8>>3]=w+b*v}function Ab(h,c){return h=h|0,c=c|0,+mn(+(+H[h>>
40703]-+H[c>>3]))<11920928955078125e-23?(c=+mn(+(+H[h+8>>3]-+H[c+8>>3]))<11920928955078125e-23,c|0):(c=0,c|0)}function Zi(h,c){h=h|0,c=c|0;var f=0,m=0,_=0;return _=+H[h>>3]-+H[c>>3],m=+H[h+8>>3]-+H[c+8>>3],f=+H[h+16>>3]-+H[c+16>>3],+(_*_+m*m+f*f)}function TP(h,c){h=h|0,c=c|0;var f=0,m=0,_=0;f=+H[h>>3],m=+kn(+f),f=+xn(+f),H[c+16>>3]=f,f=+H[h+8>>3],_=m*+kn(+f),H[c>>3]=_,f=m*+xn(+f),H[c+8>>3]=f}function MP(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0;if(v=G,G=G+16|0,_=v,m=Ai(h,c)|0,(f+-1|0)>>>0>5||(m=(m|0)!=0,(f|0)==1&m))return _=-1,G=v,_|0;do if(KA(h,c,_)|0)m=-1;else if(m){m=((A[26352+(f<<2)>>2]|0)+5-(A[_>>2]|0)|0)%5|0;break}else{m=((A[26384+(f<<2)>>2]|0)+6-(A[_>>2]|0)|0)%6|0;break}while(!1);return _=m,G=v,_|0}function KA(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0;if(O=G,G=G+32|0,w=O+16|0,C=O,m=Cc(h,c,w)|0,m|0)return f=m,G=O,f|0;v=K3(h,c)|0,D=ds(h,c)|0,iN(v,C),m=rN(v,A[w>>2]|0)|0;do if(Si(v)|0){do switch(v|0){case 4:{_=0;break}case 14:{_=1;break}case 24:{_=2;break}case 38:{_=3;break}case 49:{_=4;break}case 58:{_=5;break}case 63:{_=6;break}case 72:{_=7;break}case 83:{_=8;break}case 97:{_=9;break}case 107:{_=10;break}case 117:{_=11;break}default:rt(27795,27797,75,27806)}while(!1);if(b=A[26416+(_*24|0)+8>>2]|0,c=A[26416+(_*24|0)+16>>2]|0,h=A[w>>2]|0,(h|0)!=(A[C>>2]|0)&&(C=Kg(v)|0,h=A[w>>2]|0,C|(h|0)==(c|0)&&(m=(m+1|0)%6|0)),(D|0)==3&(h|0)==(c|0)){m=(m+5|0)%6|0;break}(D|0)==5&(h|0)==(b|0)&&(m=(m+1|0)%6|0)}while(!1);return A[f>>2]=m,f=0,G=O,f|0}function Zs(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0;if(xe=G,G=G+32|0,ye=xe+24|0,ge=xe+20|0,re=xe+8|0,ie=xe+16|0,ne=xe,C=(Ai(h,c)|0)==0,C=C?6:5,O=ze(h|0,c|0,52)|0,q()|0,O=O&15,C>>>0<=f>>>0)return m=2,G=xe,m|0;X=(O|0)==0,!X&&(he=et(7,0,(O^15)*3|0)|0,(he&h|0)==0&((q()|0)&c|0)==0)?_=f:v=4;e:do if((v|0)==4){if(_=(Ai(h,c)|0)!=0,((_?4:5)|0)<(f|0)||KA(h,c,ye)|0||(v=(A[ye>>2]|0)+f|0,_?_=26704+(((v|0)%5|0)<<2)|0:_=26736+(((v|0)%6|0)<<2)|0,he=A[_>>2]|0,(he|0)==7))return m=1,G=xe,m|0;A[ge>>2]=0,_=mi(h,c,he,ge,re)|0;do if(!_){if(w=re,D=A[w>>2]|0,w=A[w+4>>2]|0,b=w>>>0<c>>>0|(w|0)==(c|0)&D>>>0<h>>>0,v=b?D:h,b=b?w:c,!X&&(X=et(7,0,(O^15)*3|0)|0,(D&X|0)==0&(w&(q()|0)|0)==0))_=f;else{if(w=(f+-1+C|0)%(C|0)|0,_=Ai(h,c)|0,(w|0)<0&&rt(27795,27797,248,27822),C=(_|0)!=0,((C?4:5)|0)<(w|0)&&rt(27795,27797,248,27822),KA(h,c,ye)|0&&rt(27795,27797,248,27822),_=(A[ye>>2]|0)+w|0,C?_=26704+(((_|0)%5|0)<<2)|0:_=26736+(((_|0)%6|0)<<2)|0,w=A[_>>2]|0,(w|0)==7&&rt(27795,27797,248,27822),A[ie>>2]=0,_=mi(h,c,w,ie,ne)|0,_|0)break;D=ne,C=A[D>>2]|0,D=A[D+4>>2]|0;do if(D>>>0<b>>>0|(D|0)==(b|0)&C>>>0<v>>>0){if(Ai(C,D)|0?v=Ec(C,D,h,c)|0:v=A[26800+((((A[ie>>2]|0)+(A[26768+(w<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,_=Ai(C,D)|0,(v+-1|0)>>>0>5){_=-1,v=C,b=D;break}if(_=(_|0)!=0,(v|0)==1&_){_=-1,v=C,b=D;break}do if(KA(C,D,ye)|0)_=-1;else if(_){_=((A[26352+(v<<2)>>2]|0)+5-(A[ye>>2]|0)|0)%5|0;break}else{_=((A[26384+(v<<2)>>2]|0)+6-(A[ye>>2]|0)|0)%6|0;break}while(!1);v=C,b=D}else _=f;while(!1);w=re,D=A[w>>2]|0,w=A[w+4>>2]|0}if((v|0)==(D|0)&(b|0)==(w|0)){if(C=(Ai(D,w)|0)!=0,C?h=Ec(D,w,h,c)|0:h=A[26800+((((A[ge>>2]|0)+(A[26768+(he<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,_=Ai(D,w)|0,(h+-1|0)>>>0<=5&&(Ee=(_|0)!=0,!((h|0)==1&Ee)))do if(KA(D,w,ye)|0)_=-1;else if(Ee){_=((A[26352+(h<<2)>>2]|0)+5-(A[ye>>2]|0)|0)%5|0;break}else{_=((A[26384+(h<<2)>>2]|0)+6-(A[ye>>2]|0)|0)%6|0;break}while(!1);else _=-1;_=_+1|0,_=(_|0)==6|C&(_|0)==5?0:_}c=b,h=v;break e}while(!1);return m=_,G=xe,m|0}while(!1);return Ee=et(_|0,0,56)|0,ye=q()|0|c&-2130706433|536870912,A[m>>2]=Ee|h,A[m+4>>2]=ye,m=0,G=xe,m|0}function wP(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0;return v=(Ai(h,c)|0)==0,m=Zs(h,c,0,f)|0,_=(m|0)==0,v?!_||(m=Zs(h,c,1,f+8|0)|0,m|0)||(m=Zs(h,c,2,f+16|0)|0,m|0)||(m=Zs(h,c,3,f+24|0)|0,m|0)||(m=Zs(h,c,4,f+32|0)|0,m)?(v=m,v|0):Zs(h,c,5,f+40|0)|0:!_||(m=Zs(h,c,1,f+8|0)|0,m|0)||(m=Zs(h,c,2,f+16|0)|0,m|0)||(m=Zs(h,c,3,f+24|0)|0,m|0)||(m=Zs(h,c,4,f+32|0)|0,m|0)?(v=m,v|0):(v=f+40|0,A[v>>2]=0,A[v+4>>2]=0,v=0,v|0)}function EP(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0,w=0,C=0;return C=G,G=G+192|0,_=C,v=C+168|0,b=ze(h|0,c|0,56)|0,q()|0,b=b&7,w=c&-2130706433|134217728,m=Cc(h,w,v)|0,m|0?(w=m,G=C,w|0):(c=ze(h|0,c|0,52)|0,q()|0,c=c&15,Ai(h,w)|0?r1(v,c,b,1,_):s1(v,c,b,1,_),w=_+8|0,A[f>>2]=A[w>>2],A[f+4>>2]=A[w+4>>2],A[f+8>>2]=A[w+8>>2],A[f+12>>2]=A[w+12>>2],w=0,G=C,w|0)}function fb(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0;return _=G,G=G+16|0,f=_,!(!0&(c&2013265920|0)==536870912)||(m=c&-2130706433|134217728,!(o1(h,m)|0))?(m=0,G=_,m|0):(v=ze(h|0,c|0,56)|0,q()|0,v=(Zs(h,m,v&7,f)|0)==0,m=f,m=v&((A[m>>2]|0)==(h|0)?(A[m+4>>2]|0)==(c|0):0)&1,G=_,m|0)}function db(h,c,f){h=h|0,c=c|0,f=f|0;var m=0;(c|0)>0?(m=ps(c,4)|0,A[h>>2]=m,m||rt(27835,27858,40,27872)):A[h>>2]=0,A[h+4>>2]=c,A[h+8>>2]=0,A[h+12>>2]=f}function pb(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0;_=h+4|0,v=h+12|0,b=h+8|0;e:for(;;){for(f=A[_>>2]|0,c=0;;){if((c|0)>=(f|0))break e;if(m=A[h>>2]|0,w=A[m+(c<<2)>>2]|0,!w)c=c+1|0;else break}c=m+(~~(+mn(+(+zo(10,+ +(15-(A[v>>2]|0)|0))*(+H[w>>3]+ +H[w+8>>3])))%+(f|0))>>>0<<2)|0,f=A[c>>2]|0;t:do if(f|0){if(m=w+32|0,(f|0)==(w|0))A[c>>2]=A[m>>2];else{if(f=f+32|0,c=A[f>>2]|0,!c)break;for(;(c|0)!=(w|0);)if(f=c+32|0,c=A[f>>2]|0,!c)break t;A[f>>2]=A[m>>2]}Xt(w),A[b>>2]=(A[b>>2]|0)+-1}while(!1)}Xt(A[h>>2]|0)}function mb(h){h=h|0;var c=0,f=0,m=0;for(m=A[h+4>>2]|0,f=0;;){if((f|0)>=(m|0)){c=0,f=4;break}if(c=A[(A[h>>2]|0)+(f<<2)>>2]|0,!c)f=f+1|0;else{f=4;break}}return(f|0)==4?c|0:0}function gb(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0;if(f=~~(+mn(+(+zo(10,+ +(15-(A[h+12>>
40702]|0)|0))*(+H[c>>3]+ +H[c+8>>3])))%+(A[h+4>>2]|0))>>>0,f=(A[h>>2]|0)+(f<<2)|0,m=A[f>>2]|0,!m)return v=1,v|0;v=c+32|0;do if((m|0)!=(c|0)){if(f=A[m+32>>2]|0,!f)return v=1,v|0;for(_=f;;){if((_|0)==(c|0)){_=8;break}if(f=A[_+32>>2]|0,f)m=_,_=f;else{f=1,_=10;break}}if((_|0)==8){A[m+32>>2]=A[v>>2];break}else if((_|0)==10)return f|0}else A[f>>2]=A[v>>2];while(!1);return Xt(c),v=h+8|0,A[v>>2]=(A[v>>2]|0)+-1,v=0,v|0}function RP(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0;v=Wo(40)|0,v||rt(27888,27858,98,27901),A[v>>2]=A[c>>2],A[v+4>>2]=A[c+4>>2],A[v+8>>2]=A[c+8>>2],A[v+12>>2]=A[c+12>>2],_=v+16|0,A[_>>2]=A[f>>2],A[_+4>>2]=A[f+4>>2],A[_+8>>2]=A[f+8>>2],A[_+12>>2]=A[f+12>>2],A[v+32>>2]=0,_=~~(+mn(+(+zo(10,+ +(15-(A[h+12>>2]|0)|0))*(+H[c>>3]+ +H[c+8>>3])))%+(A[h+4>>2]|0))>>>0,_=(A[h>>2]|0)+(_<<2)|0,m=A[_>>2]|0;do if(!m)A[_>>2]=v;else{for(;!(Pc(m,c)|0&&Pc(m+16|0,f)|0);)if(_=A[m+32>>2]|0,m=_|0?_:m,!(A[m+32>>2]|0)){b=10;break}if((b|0)==10){A[m+32>>2]=v;break}return Xt(v),b=m,b|0}while(!1);return b=h+8|0,A[b>>2]=(A[b>>2]|0)+1,b=v,b|0}function CP(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0;if(_=~~(+mn(+(+zo(10,+ +(15-(A[h+12>>2]|0)|0))*(+H[c>>3]+ +H[c+8>>3])))%+(A[h+4>>2]|0))>>>0,_=A[(A[h>>2]|0)+(_<<2)>>2]|0,!_)return f=0,f|0;if(!f){for(h=_;;){if(Pc(h,c)|0){m=10;break}if(h=A[h+32>>2]|0,!h){h=0,m=10;break}}if((m|0)==10)return h|0}for(h=_;;){if(Pc(h,c)|0&&Pc(h+16|0,f)|0){m=10;break}if(h=A[h+32>>2]|0,!h){h=0,m=10;break}}return(m|0)==10?h|0:0}function NP(h,c){h=h|0,c=c|0;var f=0;if(f=~~(+mn(+(+zo(10,+ +(15-(A[h+12>>2]|0)|0))*(+H[c>>3]+ +H[c+8>>3])))%+(A[h+4>>2]|0))>>>0,h=A[(A[h>>2]|0)+(f<<2)>>2]|0,!h)return f=0,f|0;for(;;){if(Pc(h,c)|0){c=5;break}if(h=A[h+32>>2]|0,!h){h=0,c=5;break}}return(c|0)==5?h|0:0}function PP(){return 27920}function yl(h){return h=+h,~~+yb(+h)|0}function Wo(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0,he=0,ge=0,Ee=0,ye=0,xe=0,Ae=0,it=0;it=G,G=G+16|0,ne=it;do if(h>>>0<245){if(D=h>>>0<11?16:h+11&-8,h=D>>>3,X=A[6981]|0,f=X>>>h,f&3|0)return c=(f&1^1)+h|0,h=27964+(c<<1<<2)|0,f=h+8|0,m=A[f>>2]|0,_=m+8|0,v=A[_>>2]|0,(v|0)==(h|0)?A[6981]=X&~(1<<c):(A[v+12>>2]=h,A[f>>2]=v),Ae=c<<3,A[m+4>>2]=Ae|3,Ae=m+Ae+4|0,A[Ae>>2]=A[Ae>>2]|1,Ae=_,G=it,Ae|0;if(O=A[6983]|0,D>>>0>O>>>0){if(f|0)return c=2<<h,c=f<<h&(c|0-c),c=(c&0-c)+-1|0,w=c>>>12&16,c=c>>>w,f=c>>>5&8,c=c>>>f,v=c>>>2&4,c=c>>>v,h=c>>>1&2,c=c>>>h,m=c>>>1&1,m=(f|w|v|h|m)+(c>>>m)|0,c=27964+(m<<1<<2)|0,h=c+8|0,v=A[h>>2]|0,w=v+8|0,f=A[w>>2]|0,(f|0)==(c|0)?(h=X&~(1<<m),A[6981]=h):(A[f+12>>2]=c,A[h>>2]=f,h=X),Ae=m<<3,b=Ae-D|0,A[v+4>>2]=D|3,_=v+D|0,A[_+4>>2]=b|1,A[v+Ae>>2]=b,O|0&&(m=A[6986]|0,c=O>>>3,f=27964+(c<<1<<2)|0,c=1<<c,h&c?(h=f+8|0,c=A[h>>2]|0):(A[6981]=h|c,c=f,h=f+8|0),A[h>>2]=m,A[c+12>>2]=m,A[m+8>>2]=c,A[m+12>>2]=f),A[6983]=b,A[6986]=_,Ae=w,G=it,Ae|0;if(v=A[6982]|0,v){for(f=(v&0-v)+-1|0,_=f>>>12&16,f=f>>>_,m=f>>>5&8,f=f>>>m,b=f>>>2&4,f=f>>>b,w=f>>>1&2,f=f>>>w,C=f>>>1&1,C=A[28228+((m|_|b|w|C)+(f>>>C)<<2)>>2]|0,f=C,w=C,C=(A[C+4>>2]&-8)-D|0;h=A[f+16>>2]|0,!(!h&&(h=A[f+20>>2]|0,!h));)b=(A[h+4>>2]&-8)-D|0,_=b>>>0<C>>>0,f=h,w=_?h:w,C=_?b:C;if(b=w+D|0,b>>>0>w>>>0){_=A[w+24>>2]|0,c=A[w+12>>2]|0;do if((c|0)==(w|0)){if(h=w+20|0,c=A[h>>2]|0,!c&&(h=w+16|0,c=A[h>>2]|0,!c)){f=0;break}for(;;)if(m=c+20|0,f=A[m>>2]|0,f)c=f,h=m;else if(m=c+16|0,f=A[m>>2]|0,f)c=f,h=m;else break;A[h>>2]=0,f=c}else f=A[w+8>>2]|0,A[f+12>>2]=c,A[c+8>>2]=f,f=c;while(!1);do if(_|0){if(c=A[w+28>>2]|0,h=28228+(c<<2)|0,(w|0)==(A[h>>2]|0)){if(A[h>>2]=f,!f){A[6982]=v&~(1<<c);break}}else if(Ae=_+16|0,A[((A[Ae>>2]|0)==(w|0)?Ae:_+20|0)>>2]=f,!f)break;A[f+24>>2]=_,c=A[w+16>>2]|0,c|0&&(A[f+16>>2]=c,A[c+24>>2]=f),c=A[w+20>>2]|0,c|0&&(A[f+20>>2]=c,A[c+24>>2]=f)}while(!1);return C>>>0<16?(Ae=C+D|0,A[w+4>>2]=Ae|3,Ae=w+Ae+4|0,A[Ae>>2]=A[Ae>>2]|1):(A[w+4>>2]=D|3,A[b+4>>2]=C|1,A[b+C>>2]=C,O|0&&(m=A[6986]|0,c=O>>>3,f=27964+(c<<1<<2)|0,c=1<<c,c&X?(h=f+8|0,c=A[h>>2]|0):(A[6981]=c|X,c=f,h=f+8|0),A[h>>2]=m,A[c+12>>2]=m,A[m+8>>2]=c,A[m+12>>2]=f),A[6983]=C,A[6986]=b),Ae=w+8|0,G=it,Ae|0}else X=D}else X=D}else X=D}else if(h>>>0<=4294967231)if(h=h+11|0,D=h&-8,m=A[6982]|0,m){_=0-D|0,h=h>>>8,h?D>>>0>16777215?C=31:(X=(h+1048320|0)>>>16&8,he=h<<X,w=(he+520192|0)>>>16&4,he=he<<w,C=(he+245760|0)>>>16&2,C=14-(w|X|C)+(he<<C>>>15)|0,C=D>>>(C+7|0)&1|C<<1):C=0,f=A[28228+(C<<2)>>2]|0;e:do if(!f)f=0,h=0,he=61;else for(h=0,w=D<<((C|0)==31?0:25-(C>>>1)|0),v=0;;){if(b=(A[f+4>>2]&-8)-D|0,b>>>0<_>>>0)if(b)h=f,_=b;else{h=f,_=0,he=65;break e}if(he=A[f+20>>2]|0,f=A[f+16+(w>>>31<<2)>>2]|0,v=(he|0)==0|(he|0)==(f|0)?v:he,f)w=w<<1;else{f=v,he=61;break}}while(!1);if((he|0)==61){if((f|0)==0&(h|0)==0){if(h=2<<C,h=(h|0-h)&m,!h){X=D;break}X=(h&0-h)+-1|0,b=X>>>12&16,X=X>>>b,v=X>>>5&8,X=X>>>v,w=X>>>2&4,X=X>>>w,C=X>>>1&2,X=X>>>C,f=X>>>1&1,h=0,f=A[28228+((v|b|w|C|f)+(X>>>f)<<2)>>2]|0}f?he=65:(w=h,b=_)}if((he|0)==65)for(v=f;;)if(X=(A[v+4>>2]&-8)-D|0,f=X>>>0<_>>>0,_=f?X:_,h=f?v:h,f=A[v+16>>2]|0,f||(f=A[v+20>>2]|0),f)v=f;else{w=h,b=_;break}if(w|0&&b>>>0<((A[6983]|0)-D|0)>>>0&&(O=w+D|0,O>>>0>w>>>0)){v=A[w+24>>2]|0,c=A[w+12>>2]|0;do if((c|0)==(w|0)){if(h=w+20|0,c=A[h>>2]|0,!c&&(h=w+16|0,c=A[h>>2]|0,!c)){c=0;break}for(;;)if(_=c+20|0,f=A[_>>2]|0,f)c=f,h=_;else if(_=c+16|0,f=A[_>>2]|0,f)c=f,h=_;else break;A[h>>2]=0}else Ae=A[w+8>>2]|0,A[Ae+12>>2]=c,A[c+8>>2]=Ae;while(!1);do if(v){if(h=A[w+28>>2]|0,f=28228+(h<<2)|0,(w|0)==(A[f>>2]|0)){if(A[f>>2]=c,!c){m=m&~(1<<h),A[6982]=m;break}}else if(Ae=v+16|0,A[((A[Ae>>2]|0)==(w|0)?Ae:v+20|0)>>2]=c,!c)break;A[c+24>>2]=v,h=A[w+16>>2]|0,h|0&&(A[c+16>>2]=h,A[h+24>>2]=c),h=A[w+20>>2]|0,h&&(A[c+20>>2]=h,A[h+24>>2]=c)}while(!1);e:do if(b>>>0<16)Ae=b+D|0,A[w+4>>2]=Ae|3,Ae=w+Ae+4|0,A[Ae>>2]=A[Ae>>2]|1;else{if(A[w+4>>2]=D|3,A[O+4>>2]=b|1,A[O+b>>2]=b,c=b>>>3,b>>>0<256){f=27964+(c<<1<<2)|0,h=A[6981]|0,c=1<<c,h&c?(h=f+8|0,c=A[h>>2]|0):(A[6981]=h|c,c=f,h=f+8|0),A[h>>2]=O,A[c+12>>2]=O,A[O+8>>2]=c,A[O+12>>2]=f;break}if(c=b>>>8,c?b>>>0>16777215?f=31:(xe=(c+1048320|0)>>>16&8,Ae=c<<xe,ye=(Ae+520192|0)>>>16&4,Ae=Ae<<ye,f=(Ae+245760|0)>>>16&2,f=14-(ye|xe|f)+(Ae<<f>>>15)|0,f=b>>>(f+7|0)&1|f<<1):f=0,c=28228+(f<<2)|0,A[O+28>>2]=f,h=O+16|0,A[h+4>>2]=0,A[h>>2]=0,h=1<<f,!(m&h)){A[6982]=m|h,A[c>>2]=O,A[O+24>>2]=c,A[O+12>>2]=O,A[O+8>>2]=O;break}c=A[c>>2]|0;t:do if((A[c+4>>2]&-8|0)!=(b|0)){for(m=b<<((f|0)==31?0:25-(f>>>1)|0);f=c+16+(m>>>31<<2)|0,h=A[f>>2]|0,!!h;)if((A[h+4>>2]&-8|0)==(b|0)){c=h;break t}
4070else m=m<<1,c=h;A[f>>2]=O,A[O+24>>2]=c,A[O+12>>2]=O,A[O+8>>2]=O;break e}while(!1);xe=c+8|0,Ae=A[xe>>2]|0,A[Ae+12>>2]=O,A[xe>>2]=O,A[O+8>>2]=Ae,A[O+12>>2]=c,A[O+24>>2]=0}while(!1);return Ae=w+8|0,G=it,Ae|0}else X=D}else X=D;else X=-1;while(!1);if(f=A[6983]|0,f>>>0>=X>>>0)return c=f-X|0,h=A[6986]|0,c>>>0>15?(Ae=h+X|0,A[6986]=Ae,A[6983]=c,A[Ae+4>>2]=c|1,A[h+f>>2]=c,A[h+4>>2]=X|3):(A[6983]=0,A[6986]=0,A[h+4>>2]=f|3,Ae=h+f+4|0,A[Ae>>2]=A[Ae>>2]|1),Ae=h+8|0,G=it,Ae|0;if(b=A[6984]|0,b>>>0>X>>>0)return ye=b-X|0,A[6984]=ye,Ae=A[6987]|0,xe=Ae+X|0,A[6987]=xe,A[xe+4>>2]=ye|1,A[Ae+4>>2]=X|3,Ae=Ae+8|0,G=it,Ae|0;if(A[7099]|0?h=A[7101]|0:(A[7101]=4096,A[7100]=4096,A[7102]=-1,A[7103]=-1,A[7104]=0,A[7092]=0,A[7099]=ne&-16^1431655768,h=4096),w=X+48|0,C=X+47|0,v=h+C|0,_=0-h|0,D=v&_,D>>>0<=X>>>0||(h=A[7091]|0,h|0&&(O=A[7089]|0,ne=O+D|0,ne>>>0<=O>>>0|ne>>>0>h>>>0)))return Ae=0,G=it,Ae|0;e:do if(A[7092]&4)c=0,he=143;else{f=A[6987]|0;t:do if(f){for(m=28372;ne=A[m>>2]|0,!(ne>>>0<=f>>>0&&(ne+(A[m+4>>2]|0)|0)>>>0>f>>>0);)if(h=A[m+8>>2]|0,h)m=h;else{he=128;break t}if(c=v-b&_,c>>>0<2147483647)if(h=Tl(c|0)|0,(h|0)==((A[m>>2]|0)+(A[m+4>>2]|0)|0)){if((h|0)!=-1){b=c,v=h,he=145;break e}}else m=h,he=136;else c=0}else he=128;while(!1);do if((he|0)==128)if(f=Tl(0)|0,(f|0)!=-1&&(c=f,ie=A[7100]|0,re=ie+-1|0,c=(re&c|0?(re+c&0-ie)-c|0:0)+D|0,ie=A[7089]|0,re=c+ie|0,c>>>0>X>>>0&c>>>0<2147483647)){if(ne=A[7091]|0,ne|0&&re>>>0<=ie>>>0|re>>>0>ne>>>0){c=0;break}if(h=Tl(c|0)|0,(h|0)==(f|0)){b=c,v=f,he=145;break e}else m=h,he=136}else c=0;while(!1);do if((he|0)==136){if(f=0-c|0,!(w>>>0>c>>>0&(c>>>0<2147483647&(m|0)!=-1)))if((m|0)==-1){c=0;break}else{b=c,v=m,he=145;break e}if(h=A[7101]|0,h=C-c+h&0-h,h>>>0>=2147483647){b=c,v=m,he=145;break e}if((Tl(h|0)|0)==-1){Tl(f|0)|0,c=0;break}else{b=h+c|0,v=m,he=145;break e}}while(!1);A[7092]=A[7092]|4,he=143}while(!1);if((he|0)==143&&D>>>0<2147483647&&(ye=Tl(D|0)|0,re=Tl(0)|0,ge=re-ye|0,Ee=ge>>>0>(X+40|0)>>>0,!((ye|0)==-1|Ee^1|ye>>>0<re>>>0&((ye|0)!=-1&(re|0)!=-1)^1))&&(b=Ee?ge:c,v=ye,he=145),(he|0)==145){c=(A[7089]|0)+b|0,A[7089]=c,c>>>0>(A[7090]|0)>>>0&&(A[7090]=c),C=A[6987]|0;e:do if(C){for(c=28372;;){if(h=A[c>>2]|0,f=A[c+4>>2]|0,(v|0)==(h+f|0)){he=154;break}if(m=A[c+8>>2]|0,m)c=m;else break}if((he|0)==154&&(xe=c+4|0,(A[c+12>>2]&8|0)==0)&&v>>>0>C>>>0&h>>>0<=C>>>0){A[xe>>2]=f+b,Ae=(A[6984]|0)+b|0,ye=C+8|0,ye=ye&7|0?0-ye&7:0,xe=C+ye|0,ye=Ae-ye|0,A[6987]=xe,A[6984]=ye,A[xe+4>>2]=ye|1,A[C+Ae+4>>2]=40,A[6988]=A[7103];break}for(v>>>0<(A[6985]|0)>>>0&&(A[6985]=v),f=v+b|0,c=28372;;){if((A[c>>2]|0)==(f|0)){he=162;break}if(h=A[c+8>>2]|0,h)c=h;else break}if((he|0)==162&&!(A[c+12>>2]&8|0)){A[c>>2]=v,O=c+4|0,A[O>>2]=(A[O>>2]|0)+b,O=v+8|0,O=v+(O&7|0?0-O&7:0)|0,c=f+8|0,c=f+(c&7|0?0-c&7:0)|0,D=O+X|0,w=c-O-X|0,A[O+4>>2]=X|3;t:do if((C|0)==(c|0))Ae=(A[6984]|0)+w|0,A[6984]=Ae,A[6987]=D,A[D+4>>2]=Ae|1;else{if((A[6986]|0)==(c|0)){Ae=(A[6983]|0)+w|0,A[6983]=Ae,A[6986]=D,A[D+4>>2]=Ae|1,A[D+Ae>>2]=Ae;break}if(h=A[c+4>>2]|0,(h&3|0)==1){b=h&-8,m=h>>>3;n:do if(h>>>0<256)if(h=A[c+8>>2]|0,f=A[c+12>>2]|0,(f|0)==(h|0)){A[6981]=A[6981]&~(1<<m);break}else{A[h+12>>2]=f,A[f+8>>2]=h;break}else{v=A[c+24>>2]|0,h=A[c+12>>2]|0;do if((h|0)==(c|0)){if(f=c+16|0,m=f+4|0,h=A[m>>2]|0,h)f=m;else if(h=A[f>>2]|0,!h){h=0;break}for(;;)if(_=h+20|0,m=A[_>>2]|0,m)h=m,f=_;else if(_=h+16|0,m=A[_>>2]|0,m)h=m,f=_;else break;A[f>>2]=0}else Ae=A[c+8>>2]|0,A[Ae+12>>2]=h,A[h+8>>2]=Ae;while(!1);if(!v)break;f=A[c+28>>2]|0,m=28228+(f<<2)|0;do if((A[m>>2]|0)!=(c|0)){if(Ae=v+16|0,A[((A[Ae>>2]|0)==(c|0)?Ae:v+20|0)>>2]=h,!h)break n}else{if(A[m>>2]=h,h|0)break;A[6982]=A[6982]&~(1<<f);break n}while(!1);if(A[h+24>>2]=v,f=c+16|0,m=A[f>>2]|0,m|0&&(A[h+16>>2]=m,A[m+24>>2]=h),f=A[f+4>>2]|0,!f)break;A[h+20>>2]=f,A[f+24>>2]=h}while(!1);c=c+b|0,_=b+w|0}else _=w;if(c=c+4|0,A[c>>2]=A[c>>2]&-2,A[D+4>>2]=_|1,A[D+_>>2]=_,c=_>>>3,_>>>0<256){f=27964+(c<<1<<2)|0,h=A[6981]|0,c=1<<c,h&c?(h=f+8|0,c=A[h>>2]|0):(A[6981]=h|c,c=f,h=f+8|0),A[h>>2]=D,A[c+12>>2]=D,A[D+8>>2]=c,A[D+12>>2]=f;break}c=_>>>8;do if(!c)m=0;else{if(_>>>0>16777215){m=31;break}xe=(c+1048320|0)>>>16&8,Ae=c<<xe,ye=(Ae+520192|0)>>>16&4,Ae=Ae<<ye,m=(Ae+245760|0)>>>16&2,m=14-(ye|xe|m)+(Ae<<m>>>15)|0,m=_>>>(m+7|0)&1|m<<1}while(!1);if(c=28228+(m<<2)|0,A[D+28>>2]=m,h=D+16|0,A[h+4>>2]=0,A[h>>2]=0,h=A[6982]|0,f=1<<m,!(h&f)){A[6982]=h|f,A[c>>2]=D,A[D+24>>2]=c,A[D+12>>2]=D,A[D+8>>2]=D;break}c=A[c>>2]|0;n:do if((A[c+4>>2]&-8|0)!=(_|0)){for(m=_<<((m|0)==31?0:25-(m>>>1)|0);f=c+16+(m>>>31<<2)|0,h=A[f>>2]|0,!!h;)if((A[h+4>>2]&-8|0)==(_|0)){c=h;break n}
4070else m=m<<1,c=h;A[f>>2]=D,A[D+24>>2]=c,A[D+12>>2]=D,A[D+8>>2]=D;break t}while(!1);xe=c+8|0,Ae=A[xe>>2]|0,A[Ae+12>>2]=D,A[xe>>2]=D,A[D+8>>2]=Ae,A[D+12>>2]=c,A[D+24>>2]=0}while(!1);return Ae=O+8|0,G=it,Ae|0}for(c=28372;h=A[c>>2]|0,!(h>>>0<=C>>>0&&(Ae=h+(A[c+4>>2]|0)|0,Ae>>>0>C>>>0));)c=A[c+8>>2]|0;_=Ae+-47|0,h=_+8|0,h=_+(h&7|0?0-h&7:0)|0,_=C+16|0,h=h>>>0<_>>>0?C:h,c=h+8|0,f=b+-40|0,ye=v+8|0,ye=ye&7|0?0-ye&7:0,xe=v+ye|0,ye=f-ye|0,A[6987]=xe,A[6984]=ye,A[xe+4>>2]=ye|1,A[v+f+4>>2]=40,A[6988]=A[7103],f=h+4|0,A[f>>2]=27,A[c>>2]=A[7093],A[c+4>>2]=A[7094],A[c+8>>2]=A[7095],A[c+12>>2]=A[7096],A[7093]=v,A[7094]=b,A[7096]=0,A[7095]=c,c=h+24|0;do xe=c,c=c+4|0,A[c>>2]=7;while((xe+8|0)>>>0<Ae>>>0);if((h|0)!=(C|0)){if(v=h-C|0,A[f>>2]=A[f>>2]&-2,A[C+4>>2]=v|1,A[h>>2]=v,c=v>>>3,v>>>0<256){f=27964+(c<<1<<2)|0,h=A[6981]|0,c=1<<c,h&c?(h=f+8|0,c=A[h>>2]|0):(A[6981]=h|c,c=f,h=f+8|0),A[h>>2]=C,A[c+12>>2]=C,A[C+8>>2]=c,A[C+12>>2]=f;break}if(c=v>>>8,c?v>>>0>16777215?m=31:(xe=(c+1048320|0)>>>16&8,Ae=c<<xe,ye=(Ae+520192|0)>>>16&4,Ae=Ae<<ye,m=(Ae+245760|0)>>>16&2,m=14-(ye|xe|m)+(Ae<<m>>>15)|0,m=v>>>(m+7|0)&1|m<<1):m=0,f=28228+(m<<2)|0,A[C+28>>2]=m,A[C+20>>2]=0,A[_>>2]=0,c=A[6982]|0,h=1<<m,!(c&h)){A[6982]=c|h,A[f>>2]=C,A[C+24>>2]=f,A[C+12>>2]=C,A[C+8>>2]=C;break}c=A[f>>2]|0;t:do if((A[c+4>>2]&-8|0)!=(v|0)){for(m=v<<((m|0)==31?0:25-(m>>>1)|0);f=c+16+(m>>>31<<2)|0,h=A[f>>2]|0,!!h;)if((A[h+4>>2]&-8|0)==(v|0)){c=h;break t}else m=m<<1,c=h;A[f>>2]=C,A[C+24>>2]=c,A[C+12>>2]=C,A[C+8>>2]=C;break e}while(!1);xe=c+8|0,Ae=A[xe>>2]|0,A[Ae+12>>2]=C,A[xe>>2]=C,A[C+8>>2]=Ae,A[C+12>>2]=c,A[C+24>>2]=0}}else Ae=A[6985]|0,(Ae|0)==0|v>>>0<Ae>>>0&&(A[6985]=v),A[7093]=v,A[7094]=b,A[7096]=0,A[6990]=A[7099],A[6989]=-1,A[6994]=27964,A[6993]=27964,A[6996]=27972,A[6995]=27972,A[6998]=27980,A[6997]=27980,A[7e3]=27988,A[6999]=27988,A[7002]=27996,A[7001]=27996,A[7004]=28004,A[7003]=28004,A[7006]=28012,A[7005]=28012,A[7008]=28020,A[7007]=28020,A[7010]=28028,A[7009]=28028,A[7012]=28036,A[7011]=28036,A[7014]=28044,A[7013]=28044,A[7016]=28052,A[7015]=28052,A[7018]=28060,A[7017]=28060,A[7020]=28068,A[7019]=28068,A[7022]=28076,A[7021]=28076,A[7024]=28084,A[7023]=28084,A[7026]=28092,A[7025]=28092,A[7028]=28100,A[7027]=28100,A[7030]=28108,A[7029]=28108,A[7032]=28116,A[7031]=28116,A[7034]=28124,A[7033]=28124,A[7036]=28132,A[7035]=28132,A[7038]=28140,A[7037]=28140,A[7040]=28148,A[7039]=28148,A[7042]=28156,A[7041]=28156,A[7044]=28164,A[7043]=28164,A[7046]=28172,A[7045]=28172,A[7048]=28180,A[7047]=28180,A[7050]=28188,A[7049]=28188,A[7052]=28196,A[7051]=28196,A[7054]=28204,A[7053]=28204,A[7056]=28212,A[7055]=28212,Ae=b+-40|0,ye=v+8|0,ye=ye&7|0?0-ye&7:0,xe=v+ye|0,ye=Ae-ye|0,A[6987]=xe,A[6984]=ye,A[xe+4>>2]=ye|1,A[v+Ae+4>>2]=40,A[6988]=A[7103];while(!1);if(c=A[6984]|0,c>>>0>X>>>0)return ye=c-X|0,A[6984]=ye,Ae=A[6987]|0,xe=Ae+X|0,A[6987]=xe,A[xe+4>>2]=ye|1,A[Ae+4>>2]=X|3,Ae=Ae+8|0,G=it,Ae|0}return Ae=PP()|0,A[Ae>>2]=12,Ae=0,G=it,Ae|0}function Xt(h){h=h|0;var c=0,f=0,m=0,_=0,v=0,b=0,w=0,C=0;if(h){f=h+-8|0,_=A[6985]|0,h=A[h+-4>>2]|0,c=h&-8,C=f+c|0;do if(h&1)w=f,b=f;else{if(m=A[f>>2]|0,!(h&3)||(b=f+(0-m)|0,v=m+c|0,b>>>0<_>>>0))return;if((A[6986]|0)==(b|0)){if(h=C+4|0,c=A[h>>2]|0,(c&3|0)!=3){w=b,c=v;break}A[6983]=v,A[h>>2]=c&-2,A[b+4>>2]=v|1,A[b+v>>2]=v;return}if(f=m>>>3,m>>>0<256)if(h=A[b+8>>2]|0,c=A[b+12>>2]|0,(c|0)==(h|0)){A[6981]=A[6981]&~(1<<f),w=b,c=v;break}else{A[h+12>>2]=c,A[c+8>>2]=h,w=b,c=v;break}_=A[b+24>>2]|0,h=A[b+12>>2]|0;do if((h|0)==(b|0)){if(c=b+16|0,f=c+4|0,h=A[f>>2]|0,h)c=f;else if(h=A[c>>2]|0,!h){h=0;break}for(;;)if(m=h+20|0,f=A[m>>2]|0,f)h=f,c=m;else if(m=h+16|0,f=A[m>>2]|0,f)h=f,c=m;else break;A[c>>2]=0}else w=A[b+8>>2]|0,A[w+12>>2]=h,A[h+8>>2]=w;while(!1);if(_){if(c=A[b+28>>2]|0,f=28228+(c<<2)|0,(A[f>>2]|0)==(b|0)){if(A[f>>2]=h,!h){A[6982]=A[6982]&~(1<<c),w=b,c=v;break}}else if(w=_+16|0,A[((A[w>>2]|0)==(b|0)?w:_+20|0)>>2]=h,!h){w=b,c=v;break}A[h+24>>2]=_,c=b+16|0,f=A[c>>2]|0,f|0&&(A[h+16>>2]=f,A[f+24>>2]=h),c=A[c+4>>2]|0,c?(A[h+20>>2]=c,A[c+24>>2]=h,w=b,c=v):(w=b,c=v)}else w=b,c=v}while(!1);if(!(b>>>0>=C>>>0)&&(h=C+4|0,m=A[h>>2]|0,!!(m&1))){if(m&2)A[h>>2]=m&-2,A[w+4>>2]=c|1,A[b+c>>2]=c,_=c;else{if((A[6987]|0)==(C|0)){if(C=(A[6984]|0)+c|0,A[6984]=C,A[6987
4070]=w,A[w+4>>2]=C|1,(w|0)!=(A[6986]|0))return;A[6986]=0,A[6983]=0;return}if((A[6986]|0)==(C|0)){C=(A[6983]|0)+c|0,A[6983]=C,A[6986]=b,A[w+4>>2]=C|1,A[b+C>>2]=C;return}_=(m&-8)+c|0,f=m>>>3;do if(m>>>0<256)if(c=A[C+8>>2]|0,h=A[C+12>>2]|0,(h|0)==(c|0)){A[6981]=A[6981]&~(1<<f);break}else{A[c+12>>2]=h,A[h+8>>2]=c;break}else{v=A[C+24>>2]|0,h=A[C+12>>2]|0;do if((h|0)==(C|0)){if(c=C+16|0,f=c+4|0,h=A[f>>2]|0,h)c=f;else if(h=A[c>>2]|0,!h){f=0;break}for(;;)if(m=h+20|0,f=A[m>>2]|0,f)h=f,c=m;else if(m=h+16|0,f=A[m>>2]|0,f)h=f,c=m;else break;A[c>>2]=0,f=h}else f=A[C+8>>2]|0,A[f+12>>2]=h,A[h+8>>2]=f,f=h;while(!1);if(v|0){if(h=A[C+28>>2]|0,c=28228+(h<<2)|0,(A[c>>2]|0)==(C|0)){if(A[c>>2]=f,!f){A[6982]=A[6982]&~(1<<h);break}}else if(m=v+16|0,A[((A[m>>2]|0)==(C|0)?m:v+20|0)>>2]=f,!f)break;A[f+24>>2]=v,h=C+16|0,c=A[h>>2]|0,c|0&&(A[f+16>>2]=c,A[c+24>>2]=f),h=A[h+4>>2]|0,h|0&&(A[f+20>>2]=h,A[h+24>>2]=f)}}while(!1);if(A[w+4>>2]=_|1,A[b+_>>2]=_,(w|0)==(A[6986]|0)){A[6983]=_;return}}if(h=_>>>3,_>>>0<256){f=27964+(h<<1<<2)|0,c=A[6981]|0,h=1<<h,c&h?(c=f+8|0,h=A[c>>2]|0):(A[6981]=c|h,h=f,c=f+8|0),A[c>>2]=w,A[h+12>>2]=w,A[w+8>>2]=h,A[w+12>>2]=f;return}h=_>>>8,h?_>>>0>16777215?m=31:(b=(h+1048320|0)>>>16&8,C=h<<b,v=(C+520192|0)>>>16&4,C=C<<v,m=(C+245760|0)>>>16&2,m=14-(v|b|m)+(C<<m>>>15)|0,m=_>>>(m+7|0)&1|m<<1):m=0,h=28228+(m<<2)|0,A[w+28>>2]=m,A[w+20>>2]=0,A[w+16>>2]=0,c=A[6982]|0,f=1<<m;e:do if(!(c&f))A[6982]=c|f,A[h>>2]=w,A[w+24>>2]=h,A[w+12>>2]=w,A[w+8>>2]=w;else{h=A[h>>2]|0;t:do if((A[h+4>>2]&-8|0)!=(_|0)){for(m=_<<((m|0)==31?0:25-(m>>>1)|0);f=h+16+(m>>>31<<2)|0,c=A[f>>2]|0,!!c;)if((A[c+4>>2]&-8|0)==(_|0)){h=c;break t}else m=m<<1,h=c;A[f>>2]=w,A[w+24>>2]=h,A[w+12>>2]=w,A[w+8>>2]=w;break e}while(!1);b=h+8|0,C=A[b>>2]|0,A[C+12>>2]=w,A[b>>2]=w,A[w+8>>2]=C,A[w+12>>2]=h,A[w+24>>2]=0}while(!1);if(C=(A[6989]|0)+-1|0,A[6989]=C,!(C|0)){for(h=28380;h=A[h>>2]|0,h;)h=h+8|0;A[6989]=-1}}}}function ps(h,c){h=h|0,c=c|0;var f=0;return h?(f=be(c,h)|0,(c|h)>>>0>65535&&(f=((f>>>0)/(h>>>0)|0|0)==(c|0)?f:-1)):f=0,h=Wo(f)|0,!h||!(A[h+-4>>2]&3)||Sl(h|0,0,f|0)|0,h|0}function jt(h,c,f,m){return h=h|0,c=c|0,f=f|0,m=m|0,f=h+f>>>0,Qe(c+m+(f>>>0<h>>>0|0)>>>0|0),f|0|0}function ur(h,c,f,m){return h=h|0,c=c|0,f=f|0,m=m|0,m=c-m-(f>>>0>h>>>0|0)>>>0,Qe(m|0),h-f>>>0|0|0}function _b(h){return h=h|0,(h?31-(dt(h^h-1)|0)|0:32)|0}function v1(h,c,f,m,_){h=h|0,c=c|0,f=f|0,m=m|0,_=_|0;var v=0,b=0,w=0,C=0,D=0,O=0,X=0,ne=0,ie=0,re=0;if(O=h,C=c,D=C,b=f,ne=m,w=ne,!D)return v=(_|0)!=0,w?v?(A[_>>2]=h|0,A[_+4>>2]=c&0,ne=0,_=0,Qe(ne|0),_|0):(ne=0,_=0,Qe(ne|0),_|0):(v&&(A[_>>2]=(O>>>0)%(b>>>0),A[_+4>>2]=0),ne=0,_=(O>>>0)/(b>>>0)>>>0,Qe(ne|0),_|0);v=(w|0)==0;do if(b){if(!v){if(v=(dt(w|0)|0)-(dt(D|0)|0)|0,v>>>0<=31){X=v+1|0,w=31-v|0,c=v-31>>31,b=X,h=O>>>(X>>>0)&c|D<<w,c=D>>>(X>>>0)&c,v=0,w=O<<w;break}return _?(A[_>>2]=h|0,A[_+4>>2]=C|c&0,ne=0,_=0,Qe(ne|0),_|0):(ne=0,_=0,Qe(ne|0),_|0)}if(v=b-1|0,v&b|0){w=(dt(b|0)|0)+33-(dt(D|0)|0)|0,re=64-w|0,X=32-w|0,C=X>>31,ie=w-32|0,c=ie>>31,b=w,h=X-1>>31&D>>>(ie>>>0)|(D<<X|O>>>(w>>>0))&c,c=c&D>>>(w>>>0),v=O<<re&C,w=(D<<re|O>>>(ie>>>0))&C|O<<X&w-33>>31;break}return _|0&&(A[_>>2]=v&O,A[_+4>>2]=0),(b|0)==1?(ie=C|c&0,re=h|0|0,Qe(ie|0),re|0):(re=_b(b|0)|0,ie=D>>>(re>>>0)|0,re=D<<32-re|O>>>(re>>>0)|0,Qe(ie|0),re|0)}else{if(v)return _|0&&(A[_>>2]=(D>>>0)%(b>>>0),A[_+4>>2]=0),ie=0,re=(D>>>0)/(b>>>0)>>>0,Qe(ie|0),re|0;if(!O)return _|0&&(A[_>>2]=0,A[_+4>>2]=(D>>>0)%(w>>>0)),ie=0,re=(D>>>0)/(w>>>0)>>>0,Qe(ie|0),re|0;if(v=w-1|0,!(v&w))return _|0&&(A[_>>2]=h|0,A[_+4>>2]=v&D|c&0),ie=0,re=D>>>((_b(w|0)|0)>>>0),Qe(ie|0),re|0;if(v=(dt(w|0)|0)-(dt(D|0)|0)|0,v>>>0<=30){c=v+1|0,w=31-v|0,b=c,h=D<<w|O>>>(c>>>0),c=D>>>(c>>>0),v=0,w=O<<w;break}return _?(A[_>>2]=h|0,A[_+4>>2]=C|c&0,ie=0,re=0,Qe(ie|0),re|0):(ie=0,re=0,Qe(ie|0),re|0)}while(!1);if(!b)D=w,C=0,w=0;else{X=f|0|0,O=ne|m&0,D=jt(X|0,O|0,-1,-1)|0,f=q()|0,C=w,w=0;do m=C,C=v>>>31|C<<1,v=w|v<<1,m=h<<1|m>>>31|0,ne=h>>>31|c<<1|0,ur(D|0,f|0,m|0,ne|0)|0,re=q()|0,ie=re>>31|((re|0)<0?-1:0)<<1,w=ie&1,h=ur(m|0,ne|0,ie&X|0,(((re|0)<0?-1:0)>>31|((re|0)<0?-1:0)<<1)&O|0)|0,c=q()|0,b=b-1|0;while(b|0);D=C,C=0}return b=0,_|0&&(A[_>>2]=h,A[_+4>>2]=c),ie=(v|0)>>>31|(D|b)<<1|(b<<1|v>>>31)&0|C,re=(v<<1|0)&-2|w,Qe(ie|0),re|0}function bl(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0;return D=c>>31|((c|0)<0?-1:0)<<1,C=((c|0)<0?-1:0)>>31|((c|0)<0?-1:0)<<1,v=m>>31|((m|0)<0?-1:0)<<1,_=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,w=ur(D^h|0,C^c|0,D|0,C|0)|0,b=q()|0,h=v^D,c=_^C,ur((v1(w,b,ur(v^f|0,_^m|0,v|0,_|0)|0,q()|0,0)|0)^h|0,(q()|0)^c|0,h|0,c|0)|0}function DP(h,c){h=h|0,c=c|0;var f=0,m=0,_=0,v=0;return v=h&65535,_=c&65535,f=be(_,v)|0,m=h>>>16,h=(f>>>16)+(be(_,m)|0)|0,_=c>>>16,c=be(_,v)|0,Qe((h>>>16)+(be(_,m)|0)+(((h&65535)+c|0)>>>16)|0),h+c<<16|f&65535|0|0}function cr(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0;return _=h,v=f,f=DP(_,v)|0,h=q()|0,Qe((be(c,v)|0)+(be(m,_)|0)+h|h&0|0),f|0|0|0}function Dc(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0,b=0,w=0,C=0,D=0;return _=G,G=G+16|0,w=_|0,b=c>>31|((c|0)<0?-1:0)<<1,v=((c|0)<0?-1:0)>>31|((c|0)<0?-1:0)<<1,D=m>>31|((m|0)<0?-1:0)<<1,C=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,h=ur(b^h|0,v^c|0,b|0,v|0)|0,c=q()|0,v1(h,c,ur(D^f|0,C^m|0,D|0,C|0)|0,q()|0,w)|0,m=ur(A[w>>2]^b|0,A[w+4>>2]^v|0,b|0,v|0)|0,f=q()|0,G=_,Qe(f|0),m|0}function Lc(h,c,f,m){h=h|0,c=c|0,f=f|0,m=m|0;var _=0,v=0;return v=G,G=G+16|0,_=v|0,v1(h,c,f,m,_)|0,G=v,Qe(A[_+4>>2]|0),A[_>>2]|0|0}function xb(h,c,f){return h=h|0,c=c|0,f=f|0,(f|0)<32?(Qe(c>>f|0),h>>>f|(c&(1<<f)-1)<<32-f):(Qe(((c|0)<0?-1:0)|0),c>>f-32|0)}function ze(h,c,f){return h=h|0,c=c|0,f=f|0,(f|0)<32?(Qe(c>>>f|0),h>>>f|(c&(1<<f)-1)<<32-f):(Qe(0),c>>>f-32|0)}function et(h,c,f){return h=h|0,c=c|0,f=f|0,(f|0)<32?(Qe(c<<f|(h&(1<<f)-1<<32-f)>>>32-f|0),h<<f):(Qe(h<<f-32|0),0)}function y1(h,c,f){return h=h|0,c=c|0,c=dt(c)|0,(c|0)==32&&(c=c+(dt(h)|0)|0),Qe(0),c|0}function vb(h,c){return h=+h,c=+c,h!=h?+c:c!=c?+h:+Rt(+h,+c)}function s0(h,c){return h=+h,c=+c,h!=h?+c:c!=c?+h:+gt(+h,+c)}function o0(h){return h=+h,h>
4070=0?+ji(h+.5):+Te(h-.5)}function Ic(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0;if((f|0)>=8192)return Jn(h|0,c|0,f|0)|0,h|0;if(v=h|0,_=h+f|0,(h&3)==(c&3)){for(;h&3;){if(!f)return v|0;Ve[h>>0]=Ve[c>>0]|0,h=h+1|0,c=c+1|0,f=f-1|0}for(f=_&-4|0,m=f-64|0;(h|0)<=(m|0);)A[h>>2]=A[c>>2],A[h+4>>2]=A[c+4>>2],A[h+8>>2]=A[c+8>>2],A[h+12>>2]=A[c+12>>2],A[h+16>>2]=A[c+16>>2],A[h+20>>2]=A[c+20>>2],A[h+24>>2]=A[c+24>>2],A[h+28>>2]=A[c+28>>2],A[h+32>>2]=A[c+32>>2],A[h+36>>2]=A[c+36>>2],A[h+40>>2]=A[c+40>>2],A[h+44>>2]=A[c+44>>2],A[h+48>>2]=A[c+48>>2],A[h+52>>2]=A[c+52>>2],A[h+56>>2]=A[c+56>>2],A[h+60>>2]=A[c+60>>2],h=h+64|0,c=c+64|0;for(;(h|0)<(f|0);)A[h>>2]=A[c>>2],h=h+4|0,c=c+4|0}else for(f=_-4|0;(h|0)<(f|0);)Ve[h>>0]=Ve[c>>0]|0,Ve[h+1>>0]=Ve[c+1>>0]|0,Ve[h+2>>0]=Ve[c+2>>0]|0,Ve[h+3>>0]=Ve[c+3>>0]|0,h=h+4|0,c=c+4|0;for(;(h|0)<(_|0);)Ve[h>>0]=Ve[c>>0]|0,h=h+1|0,c=c+1|0;return v|0}function Sl(h,c,f){h=h|0,c=c|0,f=f|0;var m=0,_=0,v=0,b=0;if(v=h+f|0,c=c&255,(f|0)>=67){for(;h&3;)Ve[h>>0]=c,h=h+1|0;for(m=v&-4|0,b=c|c<<8|c<<16|c<<24,_=m-64|0;(h|0)<=(_|0);)A[h>>2]=b,A[h+4>>2]=b,A[h+8>>2]=b,A[h+12>>2]=b,A[h+16>>2]=b,A[h+20>>2]=b,A[h+24>>2]=b,A[h+28>>2]=b,A[h+32>>2]=b,A[h+36>>2]=b,A[h+40>>2]=b,A[h+44>>2]=b,A[h+48>>2]=b,A[h+52>>2]=b,A[h+56>>2]=b,A[h+60>>2]=b,h=h+64|0;for(;(h|0)<(m|0);)A[h>>2]=b,h=h+4|0}for(;(h|0)<(v|0);)Ve[h>>0]=c,h=h+1|0;return v-f|0}function yb(h){return h=+h,h>=0?+ji(h+.5):+Te(h-.5)}function Tl(h){h=h|0;var c=0,f=0,m=0;return m=$t()|0,f=A[Un>>2]|0,c=f+h|0,(h|0)>0&(c|0)<(f|0)|(c|0)<0?(Ci(c|0)|0,yn(12),-1):(c|0)>(m|0)&&!(Bi(c|0)|0)?(yn(12),-1):(A[Un>>2]=c,f|0)}return{___divdi3:bl,___muldi3:cr,___remdi3:Dc,___uremdi3:Lc,_areNeighborCells:vN,_bitshift64Ashr:xb,_bitshift64Lshr:ze,_bitshift64Shl:et,_calloc:ps,_cellAreaKm2:JN,_cellAreaM2:eP,_cellAreaRads2:m1,_cellToBoundary:Nc,_cellToCenterChild:J3,_cellToChildPos:HN,_cellToChildren:BN,_cellToChildrenSize:$A,_cellToLatLng:wu,_cellToLocalIj:aP,_cellToParent:l1,_cellToVertex:Zs,_cellToVertexes:wP,_cellsToDirectedEdge:yN,_cellsToLinkedMultiPolygon:tN,_childPosToCell:WN,_compactCells:FN,_constructCell:LN,_destroyLinkedMultiPolygon:rb,_directedEdgeToBoundary:t0,_directedEdgeToCells:TN,_edgeLengthKm:nP,_edgeLengthM:iP,_edgeLengthRads:tP,_emscripten_replace_memory:lr,_free:Xt,_getBaseCellNumber:K3,_getDirectedEdgeDestination:SN,_getDirectedEdgeOrigin:bN,_getHexagonAreaAvgKm2:nb,_getHexagonAreaAvgM2:YN,_getHexagonEdgeLengthAvgKm:KN,_getHexagonEdgeLengthAvgM:ZN,_getIcosahedronFaces:eb,_getIndexDigit:DN,_getNumCells:n0,_getPentagons:f1,_getRes0Cells:oN,_getResolution:PN,_greatCircleDistanceKm:XA,_greatCircleDistanceM:jN,_greatCircleDistanceRads:$N,_gridDisk:Ho,_gridDiskDistances:Oa,_gridDistance:uP,_gridPathCells:hP,_gridPathCellsSize:cP,_gridRing:Ki,_gridRingUnsafe:_o,_i64Add:jt,_i64Subtract:ur,_isPentagon:Ai,_isResClassIII:kN,_isValidCell:o1,_isValidDirectedEdge:X3,_isValidIndex:IN,_isValidVertex:fb,_latLngToCell:h1,_llvm_ctlz_i64:y1,_llvm_maxnum_f64:vb,_llvm_minnum_f64:s0,_llvm_round_f64:o0,_localIjToCell:lP,_malloc:Wo,_maxFaceCount:qN,_maxGridDiskSize:Ys,_maxPolygonToCellsSize:Z6,_maxPolygonToCellsSizeExperimental:dP,_memcpy:Ic,_memset:Sl,_originToDirectedEdges:MN,_pentagonCount:zN,_polygonToCells:J6,_polygonToCellsExperimental:fP,_readInt64AsDoubleFromPointer:bP,_res0CellCount:sN,_round:yb,_sbrk:Tl,_sizeOfCellBoundary:gP,_sizeOfCoordIJ:yP,_sizeOfGeoLoop:_P,_sizeOfGeoPolygon:xP,_sizeOfH3Index:pP,_sizeOfLatLng:mP,_sizeOfLinkedGeoPolygon:vP,_uncompactCells:UN,_uncompactCellsSize:ON,_vertexToLatLng:EP,establishStackSpace:Ps,stackAlloc:Ht,stackRestore:Gn,stackSave:$r}}(ut,Pt,k);e.___divdi3=pe.___divdi3,e.___muldi3=pe.___muldi3,e.___remdi3=pe.___remdi3,e.___uremdi3=pe.___uremdi3,e._areNeighborCells=pe._areNeighborCells,e._bitshift64Ashr=pe._bitshift64Ashr,e._bitshift64Lshr=pe._bitshift64Lshr,e._bitshift64Shl=pe._bitshift64Shl,e._calloc=pe._calloc,e._cellAreaKm2=pe._cellAreaKm2,e._cellAreaM2=pe._cellAreaM2,e._cellAreaRads2=pe._cellAreaRads2,e._cellToBoundary=pe._cellToBoundary,e._cellToCenterChild=pe._cellToCenterChild,e._cellToChildPos=pe._cellToChildPos,e._cellToChildren=pe._cellToChildren,e._cellToChildrenSize=pe._cellToChildrenSize,e._cellToLatLng=pe._cellToLatLng,e._cellToLocalIj=pe._cellToLocalIj,e._cellToParent=pe._cellToParent,e._cellToVertex=pe._cellToVertex,e._cellToVertexes=pe._cellToVertexes,e._cellsToDirectedEdge=pe._cellsToDirectedEdge,e._cellsToLinkedMultiPolygon=pe._cellsToLinkedMultiPolygon,e._childPosToCell=pe._childPosToCell,e._compactCells=pe._compactCells,e._constructCell=pe._constructCell,e._destroyLinkedMultiPolygon=pe._destroyLinkedMultiPolygon,e._directedEdgeToBoundary=pe._directedEdgeToBoundary,e._directedEdgeToCells=pe._directedEdgeToCells,e._edgeLengthKm=pe._edgeLengthKm,e._edgeLengthM=pe._edgeLengthM,e._edgeLengthRads=pe._edgeLengthRads;var Ie=e._emscripten_replace_memory=pe._emscripten_replace_memory;e._free=pe._free,e._getBaseCellNumber=pe._getBaseCellNumber,e._getDirectedEdgeDestination=pe._getDirectedEdgeDestination,e._getDirectedEdgeOrigin=pe._getDirectedEdgeOrigin,e._getHexagonAreaAvgKm2=pe._getHexagonAreaAvgKm2,e._getHexagonAreaAvgM2=pe._getHexagonAreaAvgM2,e._getHexagonEdgeLengthAvgKm=pe._getHexagonEdgeLengthAvgKm,e._getHexagonEdgeLengthAvgM=pe._getHexagonEdgeLengthAvgM,e._getIcosahedronFaces=pe._getIcosahedronFaces,e._getIndexDigit=pe._getIndexDigit,e._getNumCells=pe._getNumCells,e._getPentagons=pe._getPentagons,e._getRes0Cells=pe._getRes0Cells,e._getResolution=pe._getResolution,e._greatCircleDistanceKm=pe._greatCircleDistanceKm,e._greatCircleDistanceM=pe._greatCircleDistanceM,e._greatCircleDistanceRads=pe._greatCircleDistanceRads,e._gridDisk=pe._gridDisk,e._gridDiskDistances=pe._gridDiskDistances,e._gridDistance=pe._gridDistance,e._gridPathCells=pe._gridPathCells,e._gridPathCellsSize=pe._gridPathCellsSize,e._gridRing=pe._gridRing,e._gridRingUnsafe=pe._gridRingUnsafe,e._i64Add=pe._i64Add,e._i64Subtract=pe._i64Subtract,e._isPentagon=pe._isPentagon,e._isResClassIII=pe._isResClassIII,e._isValidCell=pe._isValidCell,e._isValidDirectedEdge=pe._isValidDirectedEdge,e._isValidIndex=pe._isValidIndex,e._isValidVertex=pe._isValidVertex,e._latLngToCell=pe._latLngToCell,e._llvm_ctlz_i64=pe._llvm_ctlz_i64,e._llvm_maxnum_f64=pe._llvm_maxnum_f64,e._llvm_minnum_f64=pe._llvm_minnum_f64,e._llvm_round_f64=pe._llvm_round_f64,e._localIjToCell=pe._localIjToCell,e._malloc=pe._malloc,e._maxFaceCount=pe._maxFaceCount,e._maxGridDiskSize=pe._maxGridDiskSize,e._maxPolygonToCellsSize=pe._maxPolygonToCellsSize,e._maxPolygonToCellsSizeExperimental=pe._maxPolygonToCellsSizeExperimental,e._memcpy=pe._memcpy,e._memset=pe._memset,e._originToDirectedEdges=pe._originToDirectedEdges,e._pentagonCount=pe._pentagonCount,e._polygonToCells=pe._polygonToCells,e._polygonToCellsExperimental=pe._polygonToCellsExperimental,e._readInt64AsDoubleFromPointer=pe._readInt64AsDoubleFromPointer,e._res0CellCount=pe._res0CellCount,e._round=pe._round,e._sbrk=pe._sbrk,e._sizeOfCellBoundary=pe._sizeOfCellBoundary,e._sizeOfCoordIJ=pe._sizeOfCoordIJ,e._sizeOfGeoLoop=pe._sizeOfGeoLoop,e._sizeOfGeoPolygon=pe._sizeOfGeoPolygon,e._sizeOfH3Index=pe._sizeOfH3Index,e._sizeOfLatLng=pe._sizeOfLatLng,e._sizeOfLinkedGeoPolygon=pe._sizeOfLinkedGeoPolygon,e._uncompactCells=pe._uncompactCells,e._uncompactCellsSize=pe._uncompactCellsSize,e._vertexToLatLng=pe._vertexToLatLng,e.establishStackSpace=pe.establishStackSpace;var Bt=e.stackAlloc=pe.stackAlloc,fn=e.stackRestore=pe.stackRestore,ci=e.stackSave=pe.stackSave;if(e.asm=pe,e.cwrap=E,e.setValue=x,e.getValue=y,zt){te(zt)||(zt=s(zt));{Kt();var qn=function(Se){Se.byteLength&&(Se=new Uint8Array(Se)),j.set(Se,g),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,yt()},Xs=function(){o(zt,qn,function(){throw"could not load memory initializer "+zt})},Qs=ht(zt);if(Qs)qn(Qs.buffer);else if(e.memoryInitializerRequest){var zA=function(){var Se=e.memoryInitializerRequest,Fe=Se.response;if(Se.status!==200&&Se.status!==0){var At=ht(e.memoryInitializerRequestURL);if(At)Fe=At.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Se.status+", retrying "+zt),Xs();return}}qn(Fe)};e.memoryInitializerRequest.response?setTimeout(zA,0):e.memoryInitializerRequest.addEventListener("load",zA)}else Xs()}}var gl;se=function Se(){gl||HA(),gl||(se=Se)};function HA(Se){if(ot>0||(qe(),ot>0))return;function Fe(){gl||(gl=!0,!T&&(Ke(),St(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),mt()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),Fe()},1)):Fe()}e.run=HA;function qo(Se){throw e.onAbort&&e.onAbort(Se),Se+="",a(Se),l(Se),T=!0,"abort("+Se+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=qo,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return HA(),i}(typeof Bn=="object"?Bn:{}),en="number",Jt=en,rh=en,ln=en,un=en,Ar=en,Mt=en,vz=[["sizeOfH3Index",en],["sizeOfLatLng",en],["sizeOfCellBoundary",en],["sizeOfGeoLoop",en],["sizeOfGeoPolygon",en],["sizeOfLinkedGeoPolygon",en],["sizeOfCoordIJ",en],["readInt64AsDoubleFromPointer",en],["isValidCell",rh,[ln,un]],["isValidIndex",rh,[ln,un]],["latLngToCell",Jt,[en,en,Ar,Mt]],["cellToLatLng",Jt,[ln,un,Mt]],["cellToBoundary",Jt,[ln,un,Mt]],["maxGridDiskSize",Jt,[en,Mt]],["gridDisk",Jt,[ln,un,en,Mt]],["gridDiskDistances",Jt,[ln,un,en,Mt,Mt]],["gridRing",Jt,[ln,un,en,Mt]],["gridRingUnsafe",Jt,[ln,un,en,Mt]],["maxPolygonToCellsSize",Jt,[Mt,Ar,en,Mt]],["polygonToCells",Jt,[Mt,Ar,en,Mt]],["maxPolygonToCellsSizeExperimental",Jt,[Mt,Ar,en,Mt]],["polygonToCellsExperimental",Jt,[Mt,Ar,en,en,en,Mt]],["cellsToLinkedMultiPolygon",Jt,[Mt,en,Mt]],["destroyLinkedMultiPolygon",null,[Mt]],["compactCells",Jt,[Mt,Mt,en,en]],["uncompactCells",Jt,[Mt,en,en,Mt,en,Ar]],["uncompactCellsSize",Jt,[Mt,en,en,Ar,Mt]],["isPentagon",rh,[ln,un]],["isResClassIII",rh,[ln,un]],["getBaseCellNumber",en,[ln,un]],["getResolution",en,[ln,un]],["getIndexDigit",en,[ln,un,en]],["constructCell",Jt,[en,en,Mt,Mt]],["maxFaceCount",Jt,[ln,un,Mt]],["getIcosahedronFaces",Jt,[ln,un,Mt]],["cellToParent",Jt,[ln,un,Ar,Mt]],["cellToChildren",Jt,[ln,un,Ar,Mt]],["cellToCenterChild",Jt,[ln,un,Ar,Mt]],["cellToChildrenSize",Jt,[ln,un,Ar,Mt]],["cellToChildPos",Jt,[ln,un,Ar,Mt]],["childPosToCell",Jt,[en,en,ln,un,Ar,Mt]],["areNeighborCells",Jt,[ln,un,ln,un,Mt]],["cellsToDirectedEdge",Jt,[ln,un,ln,un,Mt]],["getDirectedEdgeOrigin",Jt,[ln,un,Mt]],["getDirectedEdgeDestination",Jt,[ln,un,Mt]],["isValidDirectedEdge",rh,[ln,un]],["directedEdgeToCells",Jt,[ln,un,Mt]],["originToDirectedEdges",Jt,[ln,un,Mt]],["directedEdgeToBoundary",Jt,[ln,un,Mt]],["gridDistance",Jt,[ln,un,ln,un,Mt]],["gridPathCells",Jt,[ln,un,ln,un,Mt]],["gridPathCellsSize",Jt,[ln,un,ln,un,Mt]],["cellToLocalIj",Jt,[ln,un,ln,un,en,Mt]],["localIjToCell",Jt,[ln,un,Mt,en,Mt]],["getHexagonAreaAvgM2",Jt,[Ar,Mt]],["getHexagonAreaAvgKm2",Jt,[Ar,Mt]],["getHexagonEdgeLengthAvgM",Jt,[Ar,Mt]],["getHexagonEdgeLengthAvgKm",Jt,[Ar,Mt]],["greatCircleDistanceM",en,[Mt,Mt]],["greatCircleDistanceKm",en,[Mt,Mt]],["greatCircleDistanceRads",en,[Mt,Mt]],["cellAreaM2",Jt,[ln,un,Mt]],["cellAreaKm2",Jt,[ln,un,Mt]],["cellAreaRads2",Jt,[ln,un,Mt]],["edgeLengthM",Jt,[ln,un,Mt]],["edgeLengthKm",Jt,[ln,un,Mt]],["edgeLengthRads",Jt,[ln,un,Mt]],["getNumCells",Jt,[Ar,Mt]],["getRes0Cells",Jt,[Mt]],["res0CellCount",en],["getPentagons",Jt,[en,Mt]],["pentagonCount",en],["cellToVertex",Jt,[ln,un,en,Mt]],["cellToVertexes",Jt,[ln,un,Mt]],["vertexToLatLng",Jt,[ln,un,Mt]],["isValidVertex",rh,[ln,un]]],yz=0,bz=1,Sz=2,Tz=3,N4=4,Mz=5,wz=6,Ez=7,Rz=8,Cz=9,Nz=10,Pz=11,Dz=12,Lz=13,Iz=14,Bz=15,Fz=16,Uz=17,Oz=18,kz=19,Yi={};Yi[yz]="Success";Yi[bz]="The operation failed but a more specific error is not available";Yi[Sz]="Argument was outside of acceptable range";Yi[Tz]="Latitude or longitude arguments were outside of acceptable range";Yi[N4]="Resolution argument was outside of acceptable range";
4070Yi[Mz]="Cell argument was not valid";Yi[wz]="Directed edge argument was not valid";Yi[Ez]="Undirected edge argument was not valid";Yi[Rz]="Vertex argument was not valid";Yi[Cz]="Pentagon distortion was encountered";Yi[Nz]="Duplicate input";Yi[Pz]="Cell arguments were not neighbors";Yi[Dz]="Cell arguments had incompatible resolutions";Yi[Lz]="Memory allocation failed";Yi[Iz]="Bounds of provided memory were insufficient";Yi[Bz]="Mode or flags argument was not valid";Yi[Fz]="Index argument was not valid";Yi[Uz]="Base cell number was outside of acceptable range";Yi[Oz]="Child indexing digits invalid";Yi[kz]="Child indexing digits refer to a deleted subsequence";var Gz=1e3,P4=1001,D4=1002,pg={};pg[Gz]="Unknown unit";pg[P4]="Array length out of bounds";pg[D4]="Got unexpected null value for H3 index";var Vz="Unknown error";function L4(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||Vz)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function I4(i,e){var t=arguments.length===2?{value:e}:{};return L4(Yi,i,t)}function B4(i,e){var t=arguments.length===2?{value:e}:{};return L4(pg,i,t)}function Td(i){if(i!==0)throw I4(i)}var Es={};vz.forEach(function(e){Es[e[0]]=Bn.cwrap.apply(Bn,e)});var Mh=16,Md=4,SA=8,qz=8,Fm=Es.sizeOfH3Index(),Kv=Es.sizeOfLatLng(),zz=Es.sizeOfCellBoundary(),Hz=Es.sizeOfGeoPolygon(),qf=Es.sizeOfGeoLoop();Es.sizeOfLinkedGeoPolygon();Es.sizeOfCoordIJ();function Wz(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw I4(N4,i);return i}function $z(i){if(!i)throw B4(D4);return i}var jz=Math.pow(2,32)-1;function Xz(i){if(i>jz)throw B4(P4,i);return i}var Qz=/[^0-9a-fA-F]/;function F4(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||Qz.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),Mh),t=parseInt(i.substring(i.length-8),Mh);return[t,e]}function KT(i){if(i>=0)return i.toString(Mh);i=i&2147483647;var e=U4(8,i.toString(Mh)),t=(parseInt(e[0],Mh)+8).toString(Mh);return e=t+e.substring(1),e}function Yz(i,e){return KT(e)+U4(8,KT(i))}function U4(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}function ZT(i,e,t){for(var n=i.length,r=Bn._calloc(n,Kv),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)Bn.HEAPF64.set([i[a/2][s],i[a/2][o]].map(V4),r/SA+a);return Bn.HEAPU32.set([n,r],e/Md),e}function Kz(i,e){var t=i.length-1,n=Bn._calloc(Hz),r=0,s=r+qf,o=s+Md;ZT(i[0],n+r,e);var a;if(t>0){a=Bn._calloc(t,qf);for(var l=0;l<t;l++)ZT(i[l+1],a+qf*l,e)}return Bn.setValue(n+s,t,"i32"),Bn.setValue(n+o,a,"i32"),n}function Zz(i){var e=0,t=e+qf,n=t+Md,r=Md;Bn._free(Bn.getValue(i+e+r,"i8*"));var s=Bn.getValue(i+t,"i32");if(s>0){for(var o=Bn.getValue(i+n,"i32"),a=0;a<s;a++)Bn._free(Bn.getValue(o+qf*a+r,"i8*"));Bn._free(o)}Bn._free(i)}function O4(i,e){e===void 0&&(e=0);var t=Bn.getValue(i+Fm*e,"i32"),n=Bn.getValue(i+Fm*e+Md,"i32");return n?Yz(t,n):null}function Jz(i){return Es.readInt64AsDoubleFromPointer(i)}function eH(i,e){for(var t=[],n=0;n<e;n++){var r=O4(i,n);r!==null&&t.push(r)}return t}function Um(i){return sH(Bn.getValue(i,"double"))}function tH(i){return[Um(i),Um(i+SA)]}function nH(i){return[Um(i+SA),Um(i)]}function iH(i,e,t){for(var n=Bn.getValue(i,"i32"),r=i+SA,s=[],o=nH,a=0;a<n*2;a+=2)s.push(o(r+SA*a));return s.push(s[0]),s}function rH(i,e,t){var n=Bn._malloc(Kv);Bn.HEAPF64.set([i,e].map(V4),n/SA);var r=Bn._malloc(Fm);try{return Td(Es.latLngToCell(n,t,r)),$z(O4(r))}finally{Bn._free(r),Bn._free(n)}}function k4(i){var e=Bn._malloc(Kv),t=F4(i),n=t[0],r=t[1];try{return Td(Es.cellToLatLng(n,r,e)),tH(e)}finally{Bn._free(e)}}function G4(i,e){var t=Bn._malloc(zz),n=F4(i),r=n[0],s=n[1];try{return Td(Es.cellToBoundary(r,s,t)),iH(t,e,e)}finally{Bn._free(t)}}function JT(i,e,t){if(Wz(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=Kz(n,t),s=Bn._malloc(qz);try{Td(Es.maxPolygonToCellsSize(r,e,0,s));var o=Xz(Jz(s)),a=Bn._calloc(o,Fm);try{return Td(Es.polygonToCells(r,e,0,a)),eH(a,o)}finally{Bn._free(a)}}finally{Bn._free(s),Zz(r)}}function V4(i){return i*Math.PI/180}function sH(i){return i*180/Math.PI}function oH(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+
4070Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}/** 4071 * @license 4072 * Copyright 2010-2026 Three.js Authors 4073 * SPDX-License-Identifier: MIT 4074 */const aH=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],_2=new WeakMap;class lH{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=aH,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){const t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){const{geometry:n,material:r,object:s}=e;if(t={material:this.getMaterialData(r),geometry:{id:n.id,attributes:this.getAttributesData(n.attributes),indexId:n.index?n.index.id:null,indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:s.matrixWorld.clone()},s.center&&(t.center=s.center.clone()),s.morphTargetInfluences&&(t.morphTargetInfluences=s.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){const{width:o,height:a}=e.context;t.bufferWidth=o,t.bufferHeight=a}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const n in e){const r=e[n];t[n]={id:r.id,version:r.version}}return t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:r.version}:t[n]=r.clone():t[n]=r)}return t}equals(e,t){const{object:n,material:r,geometry:s}=e,o=this.getRenderObjectData(e);if(o.worldMatrix.equals(n.matrixWorld)!==!0)return o.worldMatrix.copy(n.matrixWorld),!1;const a=o.material;for(const R in a){const E=a[R],N=r[R];if(E.equals!==void 0){if(E.equals(N)===!1)return E.copy(N),!1}else if(N.isTexture===!0){if(E.id!==N.id||E.version!==N.version)return E.id=N.id,E.version=N.version,!1}else if(E!==N)return a[R]=N,!1}if(a.transmission>0){const{width:R,height:E}=e.context;if(o.bufferWidth!==R||o.bufferHeight!==E)return o.bufferWidth=R,o.bufferHeight=E,!1}const l=o.geometry,u=s.attributes,d=l.attributes,p=Object.keys(d),g=Object.keys(u);
4074if(l.id!==s.id)return l.id=s.id,!1;if(p.length!==g.length)return o.geometry.attributes=this.getAttributesData(u),!1;for(const R of p){const E=d[R],N=u[R];if(N===void 0)return delete d[R],!1;if(E.id!==N.id||E.version!==N.version)return E.id=N.id,E.version=N.version,!1}const x=s.index,y=l.indexId,T=l.indexVersion,S=x?x.id:null,M=x?x.version:null;if(y!==S||T!==M)return l.indexId=S,l.indexVersion=M,!1;if(l.drawRange.start!==s.drawRange.start||l.drawRange.count!==s.drawRange.count)return l.drawRange.start=s.drawRange.start,l.drawRange.count=s.drawRange.count,!1;if(o.morphTargetInfluences){let R=!1;for(let E=0;E<o.morphTargetInfluences.length;E++)o.morphTargetInfluences[E]!==n.morphTargetInfluences[E]&&(o.morphTargetInfluences[E]=n.morphTargetInfluences[E],R=!0);if(R)return!1}if(o.lights){for(let R=0;R<t.length;R++)if(o.lights[R].map!==t[R].map)return!1}return o.center&&o.center.equals(n.center)===!1?(o.center.copy(n.center),!0):(e.bundle!==null&&(o.version=e.bundle.version),!0)}getLightsData(e){const t=[];for(const n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){if(_2.has(e)){const r=_2.get(e);if(r.renderId===t)return r.lightsData}const n=this.getLightsData(e.getLights());return _2.set(e,{renderId:t,lightsData:n}),n}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;const{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;const r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||s)return!1;const o=this.getLights(e.lightsNode,n);return this.equals(e,o)!==!0}}const uH=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function cH(i){const e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(` 4075`).map(t=>{const n=t.match(e);if(!n)return null;const r=n[1]||n[2]||"",s=n[3].split("?")[0],o=parseInt(n[4],10),a=parseInt(n[5],10),l=s.split("/").pop();return{fn:r,file:l,line:o,column:a}}).filter(t=>t&&!uH.some(n=>n.test(t.file)))}class $i{constructor(e=null){this.isStackTrace=!0,this.stack=cH(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";const e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;const t=this.stack.map(n=>{const r=`${n.file}:${n.line}:${n.column}`;return n.fn?` at ${n.fn} (${r})`:` at ${r}`}).join(` 4076`);return`${e} 4077${t}`}}function Zv(i,e=0){let t=3735928559^e,n=1103547991^e;if(i instanceof Array)for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}const OA=i=>Zv(i),qd=i=>Zv(i),zf=(...i)=>Zv(i),hH=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),eM=new WeakMap;function q4(i){return hH.get(i)}function Om(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function z4(i){if(/float|int|uint/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;ke(`TSL: Unsupported type: ${i}`,new $i)}function AH(i){if(/float|int|uint/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;ke(`TSL: Unsupported type: ${i}`,new $i)}function fH(i){if(/float|int|uint/.test(i))return 4;if(/vec2/.test(i))return 8;if(/vec3/.test(i)||/vec4/.test(i))return 16;if(/mat2/.test(i))return 8;if(/mat3/.test(i)||/mat4/.test(i))return 16;ke(`TSL: Unsupported type: ${i}`,new $i)}function Yl(i){if(i==null)return null;const e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function Jv(i,...e){const t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new It(...e):t==="vec2"?new We(...e):t==="vec3"?new J(...e):t==="vec4"?new rn(...e):t==="mat2"?new hg(...e):t==="mat3"?new pn(...e):t==="mat4"?new nn(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?pH(e[0]):null}function H4(i){let e=eM.get(i);return e===void 0&&(e={},eM.set(i,e)),e}function dH(i){let e="";const t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function pH(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}const If={VERTEX:"vertex",FRAGMENT:"fragment"},tn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},mH={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Er={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},W4=["fragment","vertex"],Ax=["setup","analyze","generate"],fx=[...W4,"compute"],yc=["x","y","z","w"],gH={analyze:"setup",generate:"analyze"};let _H=0;class vt extends Ia{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=tn.NONE,this.updateBeforeType=tn.NONE,this.updateAfterType=tn.NONE,this.uuid=og.generateUUID(),this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:_H++}),this.stackTrace=null,vt.captureStackTrace===!0&&(this.stackTrace=new $i)}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,tn.FRAME)}
4077onRenderUpdate(e){return this.onUpdate(e,tn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,tn.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){const t=[];e.add(this);for(const n of Object.getOwnPropertyNames(this)){const r=this[n];if(!(n.startsWith("_")===!0||e.has(r))){if(Array.isArray(r)===!0)for(let s=0;s<r.length;s++){const o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(const s in r){if(s.startsWith("_")===!0)continue;const o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);const n=[];for(const{property:r,childNode:s}of this._getChildren(t))n.push(OA(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=zf(qd(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}getArrayCount(){return null}setup(e){const t=e.getNodeProperties(this);let n=0;for(const r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e,t=null){const n=e.increaseUsage(this);if(this.parents===!0){const r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(n===1){const r=e.getNodeProperties(this);for(const s of Object.values(r))s&&s.isNode===!0&&s.build(e,this)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){Oe("Abstract function.")}updateAfter(){Oe("Abstract function.")}update(){Oe("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){const l=this._beforeNodes;this._beforeNodes=null;for(const u of l)u.build(e,t);this._beforeNodes=l}const r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;const s=gH[e.buildStage];if(s&&r.buildStages[s]!==!0){const l=e.getBuildStage();e.setBuildStage(s),this.build(e),e.setBuildStage(l)}e.addChain(this);let o=null;const a=e.getBuildStage();if(a==="setup"){e.addNode(this),this.updateReference(e);const l=e.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(e)||l.outputNode||null;for(const u of Object.values(l))if(u&&u.isNode===!0){if(u.parents===!0){const d=e.getNodeProperties(u);d.parents=d.parents||[],d.parents.push(this)}u.build(e)}e.addSequentialNode(this)}o=l.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){const u=this.getNodeType(e),d=e.getDataFromNode(this);o=d.snippet,o===void 0?d.generated===void 0?(d.generated=!0,o=this.generate(e)||"",d.snippet=o):(Oe("Node: Recursion detected.",this),o="/* Recursion detected. */"):d.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,u,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(ke(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:r,index:s,childNode:o}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=o.toJSON(e.meta).uuid):n[r]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const r=[];for(const s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){const r={};for(const s in e.inputNodes[n]){const o=e.inputNodes[n][s];r[s]=t[o]}this[n]=r}else{const r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){const{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){const l=[];for(const u in a){const d=a[u];delete d.metadata,l.push(d)}return l}if(r){const a=o(e.textures),l=o(e.images),u=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),u.length>0&&(s.nodes=u)}return s}}vt.captureStackTrace=!1;class bc extends vt{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){const t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${r} ]`}}class $4 extends vt{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}}class qi extends vt{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){const o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode(`${l} = ${o}`,this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}}class xH extends qi{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}
4077getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),r=e.getTypeLength(n),s=this.nodes,o=e.getComponentType(n),a=[];let l=0;for(const d of s){if(l>=r){ke(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let p=d.getNodeType(e),g=e.getTypeLength(p),x;if(l+g>r&&(ke(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),g=r-l,p=e.getTypeFromLength(g)),l+=g,x=d.build(e,p),e.getComponentType(p)!==o){const T=e.getTypeFromLength(g,o);x=e.format(x,p,T)}a.push(x)}const u=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(u,n,t)}}const vH=yc.join("");class j4 extends vt{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(yc.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){const n=this.node,r=e.getTypeLength(n.getNodeType(e));let s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const l=n.build(e,o);this.components.length===r&&this.components===vH.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format(`${l}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class yH extends qi{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,o),l=r.build(e,a),u=t.build(e,s),d=e.getTypeLength(s),p=[];for(let g=0;g<d;g++){const x=yc[g];x===n[0]?(p.push(l),g+=n.length-1):p.push(u+"."+x)}return`${e.getType(s)}( ${p.join(", ")} )`}}class bH extends qi{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:n}=this,r=this.getNodeType(e),s=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+s,this);const l=e.getTypeLength(r),u=[];let d=0;for(let p=0;p<l;p++){const g=yc[p];g===t[d]?(u.push("1.0 - "+(a+"."+g)),d++):u.push(a+"."+g)}return`${e.getType(r)}( ${u.join(", ")} )`}}class ey extends vt{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?Yl(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Yl(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=dH(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?Jv(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){Oe("Abstract function.")}}const tM=/float|u?int/;class mo extends ey{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const n=this.getNodeType(e);return tM.test(n)&&tM.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}}class SH extends vt{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}getNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";const n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){Oe(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);const n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}}let uu=null;const dx=new Map;function Ne(i,e){if(dx.has(i)){Oe(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);dx.set(i,e),i!=="assign"&&(vt.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},vt.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}const TH=i=>
4077i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),nM=i=>TH(i).split("").sort().join("");vt.prototype.assign=function(...i){if(this.isStackNode!==!0)return uu!==null?uu.assign(this,...i):ke("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new $i),this;{const e=dx.get("assign");return this.addToStack(e(...i))}};vt.prototype.toVarIntent=function(){return this};vt.prototype.get=function(i){return new SH(this,i)};const Hf={};function J0(i,e,t){Hf[i]=Hf[e]=Hf[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new j4(this,i),this._cache[i]=o),o},set(o){this[i].assign(xt(o))}};const n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();vt.prototype["set"+n]=vt.prototype["set"+r]=vt.prototype["set"+s]=function(o){const a=nM(i);return new yH(this,a,xt(o))},vt.prototype["flip"+n]=vt.prototype["flip"+r]=vt.prototype["flip"+s]=function(){const o=nM(i);return new bH(this,o)}}const Yo=["x","y","z","w"],Ko=["r","g","b","a"],Zo=["s","t","p","q"];for(let i=0;i<4;i++){let e=Yo[i],t=Ko[i],n=Zo[i];J0(e,t,n);for(let r=0;r<4;r++){e=Yo[i]+Yo[r],t=Ko[i]+Ko[r],n=Zo[i]+Zo[r],J0(e,t,n);for(let s=0;s<4;s++){e=Yo[i]+Yo[r]+Yo[s],t=Ko[i]+Ko[r]+Ko[s],n=Zo[i]+Zo[r]+Zo[s],J0(e,t,n);for(let o=0;o<4;o++)e=Yo[i]+Yo[r]+Yo[s]+Yo[o],t=Ko[i]+Ko[r]+Ko[s]+Ko[o],n=Zo[i]+Zo[r]+Zo[s]+Zo[o],J0(e,t,n)}}}for(let i=0;i<32;i++)Hf[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new bc(this,new mo(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(xt(e))}};Object.defineProperties(vt.prototype,Hf);const iM=new WeakMap,MH=function(i,e=null){const t=Yl(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?xt(px(i,e)):t==="shader"?i.isFn?i:ce(i):i},wH=function(i,e=null){for(const t in i)i[t]=xt(i[t],e);return i},EH=function(i,e=null){const t=i.length;for(let n=0;n<t;n++)i[n]=xt(i[n],e);return i},X4=function(i,e=null,t=null,n=null){function r(d){return n!==null?(d=xt(Object.assign(d,n)),n.intent===!0&&(d=d.toVarIntent())):d=xt(d),d}let s,o=e,a,l;function u(d){let p;return o?p=/[a-z]/i.test(o)?o+"()":o:p=i.type,a!==void 0&&d.length<a?(ke(`TSL: "${p}" parameter length is less than minimum required.`,new $i),d.concat(new Array(a-d.length).fill(0))):l!==void 0&&d.length>l?(ke(`TSL: "${p}" parameter length exceeds limit.`,new $i),d.slice(0,l)):d}return e===null?s=(...d)=>r(new i(...ic(u(d)))):t!==null?(t=xt(t),s=(...d)=>r(new i(e,...ic(u(d)),t))):s=(...d)=>r(new i(e,...ic(u(d)))),s.setParameterLength=(...d)=>(d.length===1?a=l=d[0]:d.length===2&&([a,l]=d),s),s.setName=d=>(o=d,s),s},RH=function(i,...e){return new i(...ic(e))};class CH extends vt{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",o=s||"default";if(r[o])return r[o];const a=e.subBuildFn,l=e.fnCall;e.subBuildFn=s,e.fnCall=this;let u=null;if(t.layout){let d=iM.get(e.constructor);d===void 0&&(d=new WeakMap,iM.set(e.constructor,d));let p=d.get(t);p===void 0&&(p=xt(e.buildFunctionNode(t)),d.set(t,p)),e.addInclude(p);const g=n?NH(n):null;u=xt(p.call(g))}else{const d=new Proxy(e,{get:(T,S,M)=>{let R;return Symbol.iterator===S?R=function*(){yield void 0}:R=Reflect.get(T,S,M),R}}),p=n?PH(n):null,g=Array.isArray(n)?n.length>0:n!==null,x=t.jsFunc,y=g||x.length>1?x(p,d):x(d);u=xt(y)}return e.subBuildFn=a,e.fnCall=l,t.once&&(r[o]=u),u}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){const t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null;const r=e.getBuildStage(),s=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),l=e.fnCall;if(e.fnCall=this,r==="setup"){const u=e.getSubBuildProperty("initialized",this);if(s[u]!==!0&&(s[u]=!0,s[o]=this.getOutputNode(e),s[o].build(e),this.shaderNode.subBuilds))for(const d of e.chaining){const p=e.getDataFromNode(d,"any");p.subBuilds=p.subBuilds||new Set;for(const g of this.shaderNode.subBuilds)p.subBuilds.add(g)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}}function NH(i){let e;return _g(i),i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)?e=[...i]:e=i[0],e}function PH(i){let e=0;return _g(i),new Proxy(i,{get:(t,n,r)=>{let s;if(n==="length")return s=i.length,s;if(Symbol.iterator===n)s=function*(){for(const o of i)yield xt(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){const o=i[0];o[n]===void 0?s=o[e++]:s=Reflect.get(o,n,r)}else i[0]instanceof vt&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);
4077s=xt(s)}return s}})}class DH extends vt{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new CH(this,e)}setup(){return this.call()}}const LH=[!1,!0],IH=[0,1,2,3],BH=[-1,-2],Q4=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],ty=new Map;for(const i of LH)ty.set(i,new mo(i));const ny=new Map;for(const i of IH)ny.set(i,new mo(i,"uint"));const iy=new Map([...ny].map(i=>new mo(i.value,"int")));for(const i of BH)iy.set(i,new mo(i,"int"));const mg=new Map([...iy].map(i=>new mo(i.value)));for(const i of Q4)mg.set(i,new mo(i));for(const i of Q4)mg.set(-i,new mo(-i));const gg={bool:ty,uint:ny,ints:iy,float:mg},rM=new Map([...ty,...mg]),px=(i,e)=>rM.has(i)?rM.get(i):i.isNode===!0?i:new mo(i,e),nr=function(i,e=null){return(...t)=>{for(const r of t)if(r===void 0)return ke(`TSL: Invalid parameter for the type "${i}".`,new $i),new mo(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>{const s=typeof r;return s!=="object"&&s!=="function"}))&&(t=[Jv(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return Bf(e.get(t[0]));if(t.length===1){const r=px(t[0],i);return r.nodeType===i?Bf(r):Bf(new $4(r,i))}const n=t.map(r=>px(r));return Bf(new xH(n,i))}},wd=i=>typeof i=="object"&&i!==null?i.value:i,Y4=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function wh(i,e){return new DH(i,e)}const xt=(i,e=null)=>MH(i,e),Bf=(i,e=null)=>xt(i,e).toVarIntent(),_g=(i,e=null)=>new wH(i,e),ic=(i,e=null)=>new EH(i,e),hn=(i,e=null,t=null,n=null)=>new X4(i,e,t,n),st=(i,...e)=>new RH(i,...e),Ze=(i,e=null,t=null,n={})=>new X4(i,e,t,{...n,intent:!0});let FH=0;class UH extends vt{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:ke("TSL: Invalid layout type.",new $i),t=null)),this.shaderNode=new wh(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){const n={name:"fn"+FH++,type:t,inputs:[]};for(const r in e)r!=="return"&&n.inputs.push({name:r,type:e[r]});e=n}return this.shaderNode.setLayout(e),this}getNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){const t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){const t=this.getNodeType(e);return ke('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}}function ce(i,e=null){const t=new UH(i,e);return new Proxy(()=>{},{apply(n,r,s){return t.call(...s)},get(n,r,s){return Reflect.get(t,r,s)},set(n,r,s,o){return Reflect.set(t,r,s,o)}})}const Ed=i=>{uu=i},ry=()=>uu,Ft=(...i)=>uu.If(...i),OH=(...i)=>uu.Switch(...i);function xg(i){return uu&&uu.addToStack(i),i}Ne("toStack",xg);const K4=new nr("color"),Z=new nr("float",gg.float),oe=new nr("int",gg.ints),Ge=new nr("uint",gg.uint),ho=new nr("bool",gg.bool),je=new nr("vec2"),er=new nr("ivec2"),sy=new nr("uvec2"),Z4=new nr("bvec2"),ae=new nr("vec3"),oy=new nr("ivec3"),Sc=new nr("uvec3"),ay=new nr("bvec3"),Lt=new nr("vec4"),ly=new nr("ivec4"),uy=new nr("uvec4"),J4=new nr("bvec4"),vg=new nr("mat2"),_r=new nr("mat3"),iu=new nr("mat4"),kH=(i="")=>new mo(i,"string"),GH=i=>new mo(i,"ArrayBuffer");Ne("toColor",K4);Ne("toFloat",Z);Ne("toInt",oe);Ne("toUint",Ge);Ne("toBool",ho);Ne("toVec2",je);Ne("toIVec2",er);Ne("toUVec2",sy);Ne("toBVec2",Z4);Ne("toVec3",ae);Ne("toIVec3",oy);Ne("toUVec3",Sc);Ne("toBVec3",ay);Ne("toVec4",Lt);Ne("toIVec4",ly);Ne("toUVec4",uy);Ne("toBVec4",J4);Ne("toMat2",vg);Ne("toMat3",_r);Ne("toMat4",iu);const eR=hn(bc).setParameterLength(2),tR=(i,e)=>new $4(xt(i),e),VH=(i,e)=>new j4(xt(i),e);Ne("element",eR);Ne("convert",tR);const qH=i=>(Oe("TSL: append() has been renamed to Stack().",new $i),xg(i));Ne("append",i=>(Oe("TSL: .append() has been renamed to .toStack().",new $i),xg(i)));class $n extends vt{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0,this.global=!0}
vendor: 2,168 bytes, line 4077
4077customCacheKey(){return OA(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const sl=(i,e)=>new $n(i,e),Rd=(i,e)=>new $n(i,e,!0),Kn=st($n,"vec4","DiffuseColor"),zu=st($n,"vec3","DiffuseContribution"),mx=st($n,"vec3","EmissiveColor"),ua=st($n,"float","Roughness"),el=st($n,"float","Metalness"),km=st($n,"float","Clearcoat"),Fh=st($n,"float","ClearcoatRoughness"),Os=st($n,"vec3","Sheen"),Vl=st($n,"float","SheenRoughness"),yg=st($n,"float","Iridescence"),Gm=st($n,"float","IridescenceIOR"),Vm=st($n,"float","IridescenceThickness"),qm=st($n,"float","AlphaT"),kl=st($n,"float","Anisotropy"),Wf=st($n,"vec3","AnisotropyT"),rc=st($n,"vec3","AnisotropyB"),cu=st($n,"color","SpecularColor"),Yu=st($n,"color","SpecularColorBlended"),Ku=st($n,"float","SpecularF90"),zm=st($n,"float","Shininess"),Uh=st($n,"vec4","Output"),Yp=st($n,"float","dashSize"),gx=st($n,"float","gapSize"),zH=st($n,"float","pointWidth"),$f=st($n,"float","IOR"),Hm=st($n,"float","Transmission"),cy=st($n,"float","Thickness"),hy=st($n,"float","AttenuationDistance"),Ay=st($n,"color","AttenuationColor"),fy=st($n,"float","Dispersion");class nR extends vt{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.shared=t,this.order=n,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const iR=i=>new nR(i),bg=(i,e=0)=>new nR(i,!0,e),rR=bg("frame"),Dt=bg("render"),dy=iR("object");class zd extends ey{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=dy}setName(e){return this.name=e,this}label(e){return Oe('TSL: "label()" has been deprecated. Use "setName()" instead.',new $i),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}
4077onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{const r=e(n,this);r!==void 0&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){const n=this.getNodeType(e),r=this.getUniformHash(e);let s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);const o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.nodeName),l=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let u=l;if(n==="bool"){const d=e.getDataFromNode(this);let p=d.propertyName;if(p===void 0){const g=e.getVarFromNode(this,null,"bool");p=e.getPropertyName(g),d.propertyName=p,u=e.format(l,o,n),e.addLineFlowCode(`${p} = ${u}`,this)}u=p}return e.format(u,n,t)}}const Ct=(i,e)=>{const t=Y4(e||i);if(t===i&&(i=Jv(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new zd(i,t)};class sM extends qi{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}getNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const sR=(...i)=>{let e;if(i.length===1){const t=i[0];e=new sM(null,t.length,t)}else{const t=i[0],n=i[1];e=new sM(t,n)}return xt(e)};Ne("toArray",(i,e)=>sR(Array(e).fill(i)));class HH extends qi{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return yc.join("").slice(0,n)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:n}=this,r=t.getScope(),s=e.getDataFromNode(r);s.assign=!0;const o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:n,sourceNode:r}=e.getNodeProperties(this),s=this.needsSplitAssign(e),o=n.build(e),a=n.getNodeType(e),l=r.build(e,a),u=r.getNodeType(e),d=e.getDataFromNode(this);let p;if(d.initialized===!0)t!=="void"&&(p=o);else if(s){const g=e.getVarFromNode(this,null,a),x=e.getPropertyName(g);e.addLineFlowCode(`${x} = ${l}`,this);const y=n.node,S=y.node.context({assign:!0}).build(e);for(let M=0;M<y.components.length;M++){const R=y.components[M];e.addLineFlowCode(`${S}.${R} = ${x}[ ${M} ]`,this)}t!=="void"&&(p=o)}else p=`${o} = ${l}`,(t==="void"||u==="void")&&(e.addLineFlowCode(p,this),t!=="void"&&(p=o));return d.initialized=!0,e.format(p,a,t)}}const oR=hn(HH).setParameterLength(2);Ne("assign",oR);class WH extends qi{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){const t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,o=(l,u)=>{const d=u.type,p=d==="pointer";let g;return p?g="&"+l.build(e):g=l.build(e,d),g};if(Array.isArray(s)){if(s.length>r.length)ke("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),s.length=r.length;else if(s.length<r.length)for(ke("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(Z(0));for(let l=0;l<s.length;l++)t.push(o(s[l],r[l]))}else for(const l of r){const u=s[l.name];u!==void 0?t.push(o(u,l)):(ke(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(Z(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const aR=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?ic(e):_g(e[0]),new WH(xt(i),e));Ne("call",aR);const $H={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class Li extends qi{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new Li(e,t,n);for(let o=0;o<r.length-1;o++)s=new Li(e,s,r[o]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod($H[this.op],t)}getNodeType(e,t=null){const n=this.op,r=this.aNode,s=this.bNode,o=r.getNodeType(e),a=s?s.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="!"||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){const l=Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?`bvec${l}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;
4077if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){const n=this.op,{aNode:r,bNode:s}=this,o=this.getNodeType(e,t);let a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=s?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(a)?l=a:e.isVector(l)?a=l:a!==l&&(a=l="float"):n===">>"||n==="<<"?(a=o,l=e.changeComponentType(l,"uint")):n==="%"?(a=o,l=e.isInteger(a)&&e.isInteger(l)?l:a):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;const u=r.build(e,a),d=s?s.build(e,l):null,p=e.getFunctionOperator(n);if(t!=="void"){const g=e.renderer.coordinateSystem===us;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return g?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${u}, ${d} )`,o,t):e.format(`( ${u} ${n} ${d} )`,o,t):e.format(`( ${u} ${n} ${d} )`,o,t);if(n==="%")return e.isInteger(l)?e.format(`( ${u} % ${d} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${u}, ${d} )`,o,t);if(n==="!"||n==="~")return e.format(`(${n}${u})`,a,t);if(p)return e.format(`${p}( ${u}, ${d} )`,o,t);if(e.isMatrix(a)&&l==="float")return e.format(`( ${d} ${n} ${u} )`,o,t);if(a==="float"&&e.isMatrix(l))return e.format(`${u} ${n} ${d}`,o,t);{let x=`( ${u} ${n} ${d} )`;return!g&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(x=`all${x}`),e.format(x,o,t)}}else if(a!=="void")return p?e.format(`${p}( ${u}, ${d} )`,o,t):e.isMatrix(a)&&l==="float"?e.format(`${d} ${n} ${u}`,o,t):e.format(`${u} ${n} ${d}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Qi=Ze(Li,"+").setParameterLength(2,1/0).setName("add"),Rn=Ze(Li,"-").setParameterLength(2,1/0).setName("sub"),sn=Ze(Li,"*").setParameterLength(2,1/0).setName("mul"),js=Ze(Li,"/").setParameterLength(2,1/0).setName("div"),Hd=Ze(Li,"%").setParameterLength(2).setName("mod"),lR=Ze(Li,"==").setParameterLength(2).setName("equal"),uR=Ze(Li,"!=").setParameterLength(2).setName("notEqual"),cR=Ze(Li,"<").setParameterLength(2).setName("lessThan"),py=Ze(Li,">").setParameterLength(2).setName("greaterThan"),hR=Ze(Li,"<=").setParameterLength(2).setName("lessThanEqual"),AR=Ze(Li,">=").setParameterLength(2).setName("greaterThanEqual"),fR=Ze(Li,"&&").setParameterLength(2,1/0).setName("and"),dR=Ze(Li,"||").setParameterLength(2,1/0).setName("or"),pR=Ze(Li,"!").setParameterLength(1).setName("not"),mR=Ze(Li,"^^").setParameterLength(2).setName("xor"),gR=Ze(Li,"&").setParameterLength(2).setName("bitAnd"),_R=Ze(Li,"~").setParameterLength(1).setName("bitNot"),xR=Ze(Li,"|").setParameterLength(2).setName("bitOr"),vR=Ze(Li,"^").setParameterLength(2).setName("bitXor"),yR=Ze(Li,"<<").setParameterLength(2).setName("shiftLeft"),bR=Ze(Li,">>").setParameterLength(2).setName("shiftRight"),SR=ce(([i])=>(i.addAssign(1),i)),TR=ce(([i])=>(i.subAssign(1),i)),MR=ce(([i])=>{const e=oe(i).toConst();return i.addAssign(1),e}),wR=ce(([i])=>{const e=oe(i).toConst();return i.subAssign(1),e});Ne("add",Qi);Ne("sub",Rn);Ne("mul",sn);Ne("div",js);Ne("mod",Hd);Ne("equal",lR);Ne("notEqual",uR);Ne("lessThan",cR);Ne("greaterThan",py);Ne("lessThanEqual",hR);Ne("greaterThanEqual",AR);Ne("and",fR);Ne("or",dR);Ne("not",pR);Ne("xor",mR);Ne("bitAnd",gR);Ne("bitNot",_R);Ne("bitOr",xR);Ne("bitXor",vR);Ne("shiftLeft",yR);Ne("shiftRight",bR);Ne("incrementBefore",SR);Ne("decrementBefore",TR);Ne("increment",MR);Ne("decrement",wR);const ER=(i,e)=>(Oe('TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.',new $i),Hd(oe(i),oe(e)));Ne("modInt",ER);class ve extends qi{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===ve.MAX||e===ve.MIN)&&arguments.length>3){let s=new ve(e,t,n);for(let o=2;o<arguments.length-1;o++)s=new ve(e,s,arguments[o]);t=s,n=arguments[arguments.length-1],r=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=r,this.isMathNode=!0}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?n:a>s?r:t}getNodeType(e){const t=this.method;return t===ve.LENGTH||t===ve.DISTANCE||t===ve.DOT?"float":t===ve.CROSS?"vec3":t===ve.ALL||t===ve.ANY?"bool":t===ve.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:n,method:r}=this;let s=null;if(r===ve.ONE_MINUS)s=Rn(1,t);else if(r===ve.RECIPROCAL)s=js(1,t);else if(r===ve.DIFFERENCE)s=di(Rn(t,n));else if(r===ve.TRANSFORM_DIRECTION){let o=t,a=n;e.isMatrix(o.getNodeType(e))?a=Lt(ae(a),0):o=Lt(ae(o),0);const l=sn(o,a).xyz;s=Ms(l)}return s!==null?s:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method;const s=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,l=this.bNode,u=this.cNode,d=e.renderer.coordinateSystem;if(r===ve.NEGATE)return e.format("( - "+a.build(e,o)+" )",s,t);{const p=[];return r===ve.CROSS?p.push(a.build(e,s),l.build(e,s)):d===us&&r===ve.STEP?p.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):d===us&&(r===ve.MIN||r===ve.MAX)?p.push(a.build(e,o),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":o)):r===ve.REFRACT?p.push(a.build(e,o),l.build(e,o),u.build(e,"float")):r===ve.MIX?p.push(a.build(e,o),l.build(e,o),u.build(e,e.getTypeLength(u.getNodeType(e))===1?"float":o)):(d===co&&r===ve.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===ve.DFDX||r===ve.DFDY)&&(Oe(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),p.push(a.build(e,o)),l!==null&&p.push(l.build(e,o)),u!==null&&p.push(u.build(e,o))
4077),e.format(`${e.getMethod(r,s)}( ${p.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}ve.ALL="all";ve.ANY="any";ve.RADIANS="radians";ve.DEGREES="degrees";ve.EXP="exp";ve.EXP2="exp2";ve.LOG="log";ve.LOG2="log2";ve.SQRT="sqrt";ve.INVERSE_SQRT="inversesqrt";ve.FLOOR="floor";ve.CEIL="ceil";ve.NORMALIZE="normalize";ve.FRACT="fract";ve.SIN="sin";ve.COS="cos";ve.TAN="tan";ve.ASIN="asin";ve.ACOS="acos";ve.ATAN="atan";ve.ABS="abs";ve.SIGN="sign";ve.LENGTH="length";ve.NEGATE="negate";ve.ONE_MINUS="oneMinus";ve.DFDX="dFdx";ve.DFDY="dFdy";ve.ROUND="round";ve.RECIPROCAL="reciprocal";ve.TRUNC="trunc";ve.FWIDTH="fwidth";ve.TRANSPOSE="transpose";ve.DETERMINANT="determinant";ve.INVERSE="inverse";ve.EQUALS="equals";ve.MIN="min";ve.MAX="max";ve.STEP="step";ve.REFLECT="reflect";ve.DISTANCE="distance";ve.DIFFERENCE="difference";ve.DOT="dot";ve.CROSS="cross";ve.POW="pow";ve.TRANSFORM_DIRECTION="transformDirection";ve.MIX="mix";ve.CLAMP="clamp";ve.REFRACT="refract";ve.SMOOTHSTEP="smoothstep";ve.FACEFORWARD="faceforward";const my=Z(1e-6),jH=Z(1e6),Wm=Z(Math.PI),XH=Z(Math.PI*2),QH=Z(Math.PI*2),YH=Z(Math.PI*.5),RR=Ze(ve,ve.ALL).setParameterLength(1),CR=Ze(ve,ve.ANY).setParameterLength(1),NR=Ze(ve,ve.RADIANS).setParameterLength(1),PR=Ze(ve,ve.DEGREES).setParameterLength(1),gy=Ze(ve,ve.EXP).setParameterLength(1),TA=Ze(ve,ve.EXP2).setParameterLength(1),Sg=Ze(ve,ve.LOG).setParameterLength(1),ya=Ze(ve,ve.LOG2).setParameterLength(1),hs=Ze(ve,ve.SQRT).setParameterLength(1),_y=Ze(ve,ve.INVERSE_SQRT).setParameterLength(1),ba=Ze(ve,ve.FLOOR).setParameterLength(1),Tg=Ze(ve,ve.CEIL).setParameterLength(1),Ms=Ze(ve,ve.NORMALIZE).setParameterLength(1),Oo=Ze(ve,ve.FRACT).setParameterLength(1),rs=Ze(ve,ve.SIN).setParameterLength(1),Ro=Ze(ve,ve.COS).setParameterLength(1),DR=Ze(ve,ve.TAN).setParameterLength(1),LR=Ze(ve,ve.ASIN).setParameterLength(1),xy=Ze(ve,ve.ACOS).setParameterLength(1),vy=Ze(ve,ve.ATAN).setParameterLength(1,2),di=Ze(ve,ve.ABS).setParameterLength(1),yy=Ze(ve,ve.SIGN).setParameterLength(1),Sa=Ze(ve,ve.LENGTH).setParameterLength(1),by=Ze(ve,ve.NEGATE).setParameterLength(1),IR=Ze(ve,ve.ONE_MINUS).setParameterLength(1),Sy=Ze(ve,ve.DFDX).setParameterLength(1),Ty=Ze(ve,ve.DFDY).setParameterLength(1),BR=Ze(ve,ve.ROUND).setParameterLength(1),FR=Ze(ve,ve.RECIPROCAL).setParameterLength(1),My=Ze(ve,ve.TRUNC).setParameterLength(1),wy=Ze(ve,ve.FWIDTH).setParameterLength(1),UR=Ze(ve,ve.TRANSPOSE).setParameterLength(1),OR=Ze(ve,ve.DETERMINANT).setParameterLength(1),kR=Ze(ve,ve.INVERSE).setParameterLength(1),Rs=Ze(ve,ve.MIN).setParameterLength(2,1/0),Ii=Ze(ve,ve.MAX).setParameterLength(2,1/0),mc=Ze(ve,ve.STEP).setParameterLength(2),GR=Ze(ve,ve.REFLECT).setParameterLength(2),VR=Ze(ve,ve.DISTANCE).setParameterLength(2),qR=Ze(ve,ve.DIFFERENCE).setParameterLength(2),Ao=Ze(ve,ve.DOT).setParameterLength(2),hl=Ze(ve,ve.CROSS).setParameterLength(2),oo=Ze(ve,ve.POW).setParameterLength(2),Ey=i=>sn(i,i),zR=i=>sn(i,i,i),Ry=i=>sn(i,i,i,i),HR=Ze(ve,ve.TRANSFORM_DIRECTION).setParameterLength(2),WR=i=>sn(yy(i),oo(di(i),1/3)),Cy=i=>Ao(i,i),Mn=Ze(ve,ve.MIX).setParameterLength(3),ko=(i,e=0,t=1)=>new ve(ve.CLAMP,xt(i),xt(e),xt(t)),Mg=i=>ko(i),Ny=Ze(ve,ve.REFRACT).setParameterLength(3),Go=Ze(ve,ve.SMOOTHSTEP).setParameterLength(3),Py=Ze(ve,ve.FACEFORWARD).setParameterLength(3),$R=ce(([i])=>{const n=43758.5453,r=Ao(i.xy,je(12.9898,78.233)),s=Hd(r,Wm);return Oo(rs(s).mul(n))}),jR=(i,e,t)=>Mn(e,t,i),XR=(i,e,t)=>Go(e,t,i),QR=(i,e)=>mc(e,i),KH=Py,ZH=_y;Ne("all",RR);Ne("any",CR);Ne("radians",NR);Ne("degrees",PR);Ne("exp",gy);Ne("exp2",TA);Ne("log",Sg);Ne("log2",ya);Ne("sqrt",hs);Ne("inverseSqrt",_y);Ne("floor",ba);Ne("ceil",Tg);Ne("normalize",Ms);Ne("fract",Oo);Ne("sin",rs);Ne("cos",Ro);Ne("tan",DR);Ne("asin",LR);Ne("acos",xy);Ne("atan",vy);Ne("abs",di);Ne("sign",yy);Ne("length",Sa);Ne("lengthSq",Cy);Ne("negate",by);Ne("oneMinus",IR);Ne("dFdx",Sy);Ne("dFdy",Ty);Ne("round",BR);Ne("reciprocal",FR);Ne("trunc",My);Ne("fwidth",wy);Ne("min",Rs);Ne("max",Ii);Ne("step",QR);Ne("reflect",GR);Ne("distance",VR);Ne("dot",Ao);Ne("cross",hl);Ne("pow",oo);Ne("pow2",Ey);Ne("pow3",zR);Ne("pow4",Ry);Ne("transformDirection",HR);Ne("mix",jR);Ne("clamp",ko);Ne("refract",Ny);Ne("smoothstep",XR);Ne("faceForward",Py);Ne("difference",qR);Ne("saturate",Mg);Ne("cbrt",WR);Ne("transpose",UR);Ne("determinant",OR);Ne("inverse",kR);Ne("rand",$R);class JH extends vt{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}
4077getNodeType(e){const{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);const r=t.getNodeType(e);if(n!==null){const s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){const t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);const o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?n:n.context({nodeBlock:n}),a.elseNode=r?o?r:r.context({nodeBlock:r}):null}generate(e,t){const n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;const{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=e.currentFunctionNode,u=t!=="void",d=u?sl(n).build(e):"";r.nodeProperty=d;const p=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){const y=o.build(e,n),T=a.build(e,n),S=e.getTernary(p,y,T);return e.format(S,n,t)}e.addFlowCode(` 4078${e.tab}if ( ${p} ) { 4079 4080`).addFlowTab();let x=o.build(e,n);if(x&&(u?x=d+" = "+x+";":(x="return "+x+";",l===null&&(Oe("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),x="// "+x))),e.removeFlowTab().addFlowCode(e.tab+" "+x+` 4081 4082`+e.tab+"}"),a!==null){e.addFlowCode(` else { 4083 4084`).addFlowTab();let y=a.build(e,n);y&&(u?y=d+" = "+y+";":(y="return "+y+";",l===null&&(Oe("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),y="// "+y))),e.removeFlowTab().addFlowCode(e.tab+" "+y+` 4085 4086`+e.tab+`} 4087 4088`)}else e.addFlowCode(` 4089 4090`);return e.format(d,n,t)}}const Vr=hn(JH).setParameterLength(2,3);Ne("select",Vr);class YR extends vt{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){const e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){const n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}}const pl=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new YR(t,e)},KR=i=>pl(i,{uniformFlow:!0}),Dy=(i,e)=>pl(i,{nodeName:e});function ZR(i,e,t=null){return pl(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function JR(i,e=null){return pl(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function eC(i,e){return Oe('TSL: "label()" has been deprecated. Use "setName()" instead.'),Dy(i,e)}Ne("context",pl);Ne("label",eC);Ne("uniformFlow",KR);Ne("setName",Dy);Ne("builtinShadowContext",(i,e,t)=>ZR(e,t,i));Ne("builtinAOContext",(i,e)=>JR(e,i));class Kp extends vt{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}getNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){const t=e[0];if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let n=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){const o=t.getDataFromNode(this);o.forceDeclaration=!0,n=!0}const r=t.getBaseStack();n?r.addToStackBefore(this):r.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}
4090generate(e){const{node:t,name:n,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0;let a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);const u=this.getNodeType(e);if(u=="void")return this.isIntent(e)!==!0&&ke('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);const d=e.getVectorType(u),p=t.build(e,d),g=e.getVarFromNode(this,n,d,void 0,l),x=e.getPropertyName(g);let y=x;if(l)if(o)y=a?`const ${x}`:`let ${x}`;else{const T=t.getArrayCount(e);y=`const ${e.getVar(g.type,x,T)}`}return e.addLineFlowCode(`${y} = ${p}`,this),x}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}}const Ly=hn(Kp),tC=(i,e=null)=>Ly(i,e).toStack(),nC=(i,e=null)=>Ly(i,e,!0).toStack(),iC=i=>Ly(i).setIntent(!0).toStack();Ne("toVar",tC);Ne("toConst",nC);Ne("toVarIntent",iC);class eW extends vt{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}getNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);const t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);const n=this.node.build(e,...t);return e.removeSubBuild(),n}}const sc=(i,e,t=null)=>new eW(xt(i),e,t);class tW extends vt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=sc(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let n=t.varying;if(n===void 0){const r=this.name,s=this.getNodeType(e),o=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,s,o,a),t.node=sc(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(If.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(If.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){const s=this.getNodeType(e),o=e.getPropertyName(r,If.VERTEX);e.flowNodeFromShaderStage(If.VERTEX,n.node,s,o),n[t]=o}return e.getPropertyName(r)}}const mu=hn(tW).setParameterLength(1,2),rC=i=>mu(i);Ne("toVarying",mu);Ne("toVertexStage",rC);const sC=ce(([i])=>{const e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Mn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),oC=ce(([i])=>{const e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Mn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Iy="WorkingColorSpace",nW="OutputColorSpace";class By extends qi{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===Iy?Yt.workingColorSpace:t===nW?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target);let s=t;return Yt.enabled===!1||n===r||!n||!r||(Yt.getTransfer(n)===_t&&(s=Lt(sC(s.rgb),s.a)),Yt.getPrimaries(n)!==Yt.getPrimaries(r)&&(s=Lt(_r(Yt._getMatrix(new pn,n,r)).mul(s.rgb),s.a)),Yt.getTransfer(r)===_t&&(s=Lt(oC(s.rgb),s.a))),s}}const aC=(i,e)=>new By(xt(i),Iy,e),wg=(i,e)=>new By(xt(i),e,Iy),iW=(i,e,t)=>new By(xt(i),e,t);Ne("workingToColorSpace",aC);Ne("colorSpaceToWorking",wg);let rW=class extends bc{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}};class lC extends vt{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=tn.OBJECT}setGroup(e){return this.group=e,this}element(e){return new rW(this,xt(e))}setNodeType(e){const t=Ct(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateV
4090alue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const sW=(i,e,t)=>new lC(i,e,t);class oW extends lC{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Dt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}}const uC=(i,e,t=null)=>new oW(i,e,t);class aW extends qi{static get type(){return"ToneMappingNode"}constructor(e,t=hC,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return zf(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){const t=this.colorNode||e.context.color,n=this._toneMapping;if(n===wr)return t;let r=null;const s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Lt(s(t.rgb,this.exposureNode),t.a):(ke("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}}const cC=(i,e,t)=>new aW(i,xt(e),xt(t)),hC=uC("toneMappingExposure","float");Ne("toneMapping",(i,e,t)=>cC(e,t,i));const oM=new WeakMap;function aM(i,e){let t=oM.get(i);return t===void 0&&(t=new yv(i,e),oM.set(i,t)),t}class Ll extends ey{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=fA,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(this.bufferStride===0&&this.bufferOffset===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;const t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,s=this.bufferStride||n,o=this.bufferOffset;let a;r.isInterleavedBuffer===!0?a=r:r.isBufferAttribute===!0?a=aM(r.array,s):a=aM(r,s);const l=new da(a,n,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),r=e.getPropertyName(n);let s=null;return e.shaderStage==="vertex"||e.shaderStage==="compute"?(this.name=r,s=r):s=mu(this).build(e,t),s}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}function Eg(i,e=null,t=0,n=0,r=fA,s=!1){return e==="mat3"||e===null&&i.itemSize===9?_r(new Ll(i,"vec3",9,0).setUsage(r).setInstanced(s),new Ll(i,"vec3",9,3).setUsage(r).setInstanced(s),new Ll(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?iu(new Ll(i,"vec4",16,0).setUsage(r).setInstanced(s),new Ll(i,"vec4",16,4).setUsage(r).setInstanced(s),new Ll(i,"vec4",16,8).setUsage(r).setInstanced(s),new Ll(i,"vec4",16,12).setUsage(r).setInstanced(s)):new Ll(i,e,t,n).setUsage(r)}const Fy=(i,e=null,t=0,n=0)=>Eg(i,e,t,n),lW=(i,e=null,t=0,n=0)=>Eg(i,e,t,n,ld),$m=(i,e=null,t=0,n=0)=>Eg(i,e,t,n,fA,!0),_x=(i,e=null,t=0,n=0)=>Eg(i,e,t,n,ld,!0);Ne("toAttribute",i=>Fy(i.value));class uW extends vt{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.version=1,this.name="",this.updateBeforeType=tn.OBJECT,this.onInitFunction=null}setCount(e){return this.count=e,this}getCount(){return this.count}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return Oe('TSL: "label()" has been deprecated. Use "setName()" instead.',new $i),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){const t=this.computeNode.build(e);if(t){const n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:n}=e;if(n==="compute"){const r=this.computeNode.build(e,"void");r!==""&&e.addLineFlowCode(r,this)}else{const s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}}const Uy=(i,e=[64])=>{(e.length===0||e.length>3)&&ke("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new $i);for(let t=0;t<e.length;t++){const n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&ke(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new $i)}for(;e.length<3;)e.push(1);return new uW(xt(i),e)},AC=(i,e,t)=>Uy(i,t).setCount(e);Ne("compute",AC);Ne("computeKernel",Uy);class cW extends vt{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}getNodeType(e){const t=e.getCache(),n=e.getCacheFromNode(this,this.parent);
4090e.setCache(n);const r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){const n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const s=this.node.build(e,...t);return e.setCache(n),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}}const Oh=i=>new cW(xt(i));function fC(i,e=!0){return Oe('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),Oh(i).setParent(e)}Ne("cache",fC);Ne("isolate",Oh);class hW extends vt{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const dC=hn(hW).setParameterLength(2);Ne("bypass",dC);class pC extends vt{static get type(){return"RemapNode"}constructor(e,t,n,r=Z(0),s=Z(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=r,this.outHighNode=s,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:n,outLowNode:r,outHighNode:s,doClamp:o}=this;let a=e.sub(t).div(n.sub(t));return o===!0&&(a=a.clamp()),a.mul(s.sub(r)).add(r)}}const mC=hn(pC,null,null,{doClamp:!1}).setParameterLength(3,5),gC=hn(pC).setParameterLength(3,5);Ne("remap",mC);Ne("remapClamp",gC);class Zp extends vt{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(r,n,t)}}const zs=hn(Zp).setParameterLength(1,2),_C=i=>(i?Vr(i,zs("discard")):zs("discard")).toStack(),AW=()=>zs("return").toStack();Ne("discard",_C);class fW extends qi{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;const n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||wr,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||_s;return n!==wr&&(t=t.toneMapping(n)),r!==_s&&r!==Yt.workingColorSpace&&(t=t.workingToColorSpace(r)),t}}const xC=(i,e=null,t=null)=>new fW(xt(i),e,t);Ne("renderOutput",xC);class dW extends qi{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}getNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){const t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{const r="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(r.length);let o="";o+="// #"+r+`# 4091`,o+=e.flow.code.replace(/^\t/mg,"")+` 4092`,o+="/* ... */ "+n+` /* ... */ 4093`,o+="// #"+s+`# 4094`,cd(o)}return n}}const vC=(i,e=null)=>new dW(xt(i),e).toStack();Ne("debug",vC);class yC{constructor(){this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}}class pW extends vt{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=tn.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}getNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==yC&&zn('TSL: ".toInspector()" is only available with WebGPU.'),t}}function bC(i,e="",t=null){return i=xt(i),i.before(new pW(i,e,t))}Ne("toInspector",bC);function mW(i){Oe("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}class SC extends vt{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(t===null){const n=this.getAttributeName(e);
4094if(e.hasGeometryAttribute(n)){const r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){const s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,n):mu(this).build(e,n)}else return Oe(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const Al=(i,e=null)=>new SC(i,e),ri=(i=0)=>Al("uv"+(i>0?i:""),"vec2");class gW extends vt{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}}const ru=hn(gW).setParameterLength(1,2);class _W extends zd{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=tn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){const{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}}const Oy=hn(_W).setParameterLength(1);class TC extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}}const ky=new tr;class Na extends zd{static get type(){return"TextureNode"}constructor(e=ky,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=tn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return this.value.isDepthTexture===!0?"float":this.value.type===ii?"uvec4":this.value.type===dr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return ri(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Ct(this.value.matrix)),this._matrixUniform.mul(ae(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Ct(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(oe(ru(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const n=this.value;if(!n||n.isTexture!==!0)throw new TC("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);const r=ce(()=>{let l=this.uvNode;return(l===null||e.context.forceUVContext===!0)&&e.context.getUV&&(l=e.context.getUV(this,e)),l||(l=this.getDefaultUV()),this.updateMatrix===!0&&(l=this.getTransformedUV(l)),l=this.setupUV(e,l),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?tn.OBJECT:tn.NONE,l})();let s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let o=null,a=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(tl.TEXTURE_COMPARE))o=this.compareNode;else{const l=n.compareFunction;l===null||l===sg||l===fu||l===ad||l===al?a=this.compareNode:(o=this.compareNode,zn('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=o,t.compareStepNode=a,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,s,o,a,l,u){const d=this.value;let p;return s?p=e.generateTextureBias(d,t,n,s,o,u):l?p=e.generateTextureGrad(d,t,n,l,o,u):a?p=e.generateTextureCompare(d,t,n,a,o,u):this.sampler===!1?p=e.generateTextureLoad(d,t,n,r,o,u):r?p=e.generateTextureLevel(d,t,n,r,o,u):p=e.generateTexture(d,t,n,o,u),p}generate(e,t){const n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(/^sampler/.test(t))return s+"_sampler";if(e.isReference(t))return s;{const o=e.getDataFromNode(this),a=this.getNodeType(e);let l=o.propertyName;if(l===void 0){const{uvNode:d,levelNode:p,biasNode:g,compareNode:x,compareStepNode:y,depthNode:T,gradNode:S,offsetNode:M}=r,R=this.generateUV(e,d),E=p?p.build(e,"float"):null,N=g?g.build(e,"float"):null,U=T?T.build(e,"int"):null,L=x?x.build(e,"float"):null,F=y?y.build(e,"float"):null,P=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,I=M?this.generateOffset(e,M):null,$=e.getVarFromNode(this);l=e.getPropertyName($);let k=this.generateSnippet(e,s,R,E,N,U,L,P,I);if(F!==null){const W=n.compareFunction;W===ad||W===al?k=mc(zs(k,a),zs(F,"float")).build(e,a):k=mc(zs(F,"float"),zs(k,a)).build(e,a)}e.addLineFlowCode(`${l} = ${k}`,this),o.snippet=k,o.propertyName=l}let u=l;return e.needsToWorkingColorSpace(n)&&(u=wg(zs(u,a),n.colorSpace).setup(e).build(e,a)),e.format(u,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){const t=this.clone();return t.uvNode=xt(e),t.referenceNode=this.getBase(),xt(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=xt(e).mul(Oy(t)),t.referenceNode=this.getBase();const n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===jn||n.magFilter===jn)&&(Oe("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),xt(t)}level(e){const t=this.clone();return t.levelNode=xt(e),t.referenceNode=this.getBase(),xt(t)}size(e){return ru(this,e)}bias(e){const t=this.clone();return t.biasNode=xt(e),t.referenceNode=this.getBase(),xt(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=xt(e),t.referenceNode=this.getBase(),xt(t)}grad(e,t){const n=this.clone();return n.gradNode=[xt(e),xt(t)],n.referenceNode=this.getBase(),xt(n)}depth(e){const t=this.clone();return t.depthNode=xt(e),t.referenceNode=this.getBase(),xt(t)}offset(e){const t=this.clone();return t.offsetNode=xt(e),t.referenceNode=this.getBase(),xt(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();const n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}const xW=hn(Na).setParameterLength(1,4).setName("texture"),On=(i=ky,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=xt(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=xt(e)),t!==null&&(r.levelNode=xt(t)),n!==null&&(r.biasNode=xt(n))):r=xW(i,e,t,n),r},vW=(i=ky)=>On(i),Fi=(...i)=>On(...i).setSampler(!1),yW=(i,e,t)=>On(i,e).level(t),bW=i=>(i.isNode===!0?i:On(i)).convert("sampler"),SW=i=>(i.isNode===!0?i:On(i)).convert("samplerComparison");class Gy extends zd{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const Wd=(i,e,t)=>new Gy(i,e,t);class TW extends bc{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),n=this.getNodeType(),r=this.node.getPaddedType();return e.format(t,r,n)}}class MW extends Gy{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Yl(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=tn.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){const{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;r<e.length;r++){const s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){const s=r*4,o=e[r];t[s]=o.r,t[s+1]=o.g,t[s+2]=o.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){const s=r*4,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+3]=o.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){const s=r*16,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+4]=o.elements[3],t[s+5]=o.elements[4],t[s+6]=o.elements[5],t[s+8]=o.elements[6],t[s+9]=o.elements[7],t[s+10]=o.elements[8],t[s+1
40945]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){const s=r*16,o=e[r];for(let a=0;a<o.elements.length;a++)t[s+a]=o.elements[a]}else for(let r=0;r<e.length;r++){const s=r*4,o=e[r];t[s]=o.x,t[s+1]=o.y,t[s+2]=o.z||0,t[s+3]=o.w||0}}setup(e){const t=this.array.length,n=this.elementType;let r=Float32Array;const s=this.paddedType,o=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*o),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new TW(this,xt(e))}}const Gr=(i,e)=>new MW(i,e);class wW extends vt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const ml=hn(wW).setParameterLength(1);let hf,Af;class gi extends vt{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}getNodeType(){return this.scope===gi.DPR?"float":this.scope===gi.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=tn.NONE;return(this.scope===gi.SIZE||this.scope===gi.VIEWPORT||this.scope===gi.DPR)&&(e=tn.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===gi.VIEWPORT?t!==null?Af.copy(t.viewport):(e.getViewport(Af),Af.multiplyScalar(e.getPixelRatio())):this.scope===gi.DPR?this._output.value=e.getPixelRatio():t!==null?(hf.width=t.width,hf.height=t.height):e.getDrawingBufferSize(hf)}setup(){const e=this.scope;let t=null;return e===gi.SIZE?t=Ct(hf||(hf=new We)):e===gi.VIEWPORT?t=Ct(Af||(Af=new rn)):e===gi.DPR?t=Ct(1):t=je(Tc.div(gc)),this._output=t,t}generate(e){if(this.scope===gi.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(gc).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}gi.COORDINATE="coordinate";gi.VIEWPORT="viewport";gi.SIZE="size";gi.UV="uv";gi.DPR="dpr";const MC=st(gi,gi.DPR),Ta=st(gi,gi.UV),gc=st(gi,gi.SIZE),Tc=st(gi,gi.COORDINATE),Vy=st(gi,gi.VIEWPORT),qy=Vy.zw,wC=Tc.sub(Vy.xy),EW=wC.div(qy),RW=ce(()=>(Oe('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new $i),gc),"vec2").once()();let x2=null,ep=null,v2=null,tp=null,y2=null,np=null,b2=null,ip=null,S2=null,rp=null,T2=null,sp=null,M2=null,op=null;const gu=Ct(0,"uint").setName("u_cameraIndex").setGroup(bg("cameraIndex")).toVarying("v_cameraIndex"),ql=Ct("float").setName("cameraNear").setGroup(Dt).onRenderUpdate(({camera:i})=>i.near),zl=Ct("float").setName("cameraFar").setGroup(Dt).onRenderUpdate(({camera:i})=>i.far),ol=ce(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){const t=[];for(const n of i.cameras)t.push(n.projectionMatrix);ep===null?ep=Gr(t).setGroup(Dt).setName("cameraProjectionMatrices"):ep.array=t,e=ep.element(i.isMultiViewCamera?ml("gl_ViewID_OVR"):gu).toConst("cameraProjectionMatrix")}else x2===null&&(x2=Ct(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Dt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=x2;return e}).once()(),EC=ce(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){const t=[];for(const n of i.cameras)t.push(n.projectionMatrixInverse);tp===null?tp=Gr(t).setGroup(Dt).setName("cameraProjectionMatricesInverse"):tp.array=t,e=tp.element(i.isMultiViewCamera?ml("gl_ViewID_OVR"):gu).toConst("cameraProjectionMatrixInverse")}else v2===null&&(v2=Ct(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Dt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=v2;return e}).once()(),go=ce(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){const t=[];for(const n of i.cameras)t.push(n.matrixWorldInverse);np===null?np=Gr(t).setGroup(Dt).setName("cameraViewMatrices"):np.array=t,e=np.element(i.isMultiViewCamera?ml("gl_ViewID_OVR"):gu).toConst("cameraViewMatrix")}else y2===null&&(y2=Ct(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Dt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=y2;return e}).once()(),CW=ce(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){const t=[];for(const n of i.cameras)t.push(n.matrixWorld);ip===null?ip=Gr(t).setGroup(Dt).setName("cameraWorldMatrices"):ip.array=t,e=ip.element
4094(i.isMultiViewCamera?ml("gl_ViewID_OVR"):gu).toConst("cameraWorldMatrix")}else b2===null&&(b2=Ct(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Dt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=b2;return e}).once()(),NW=ce(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){const t=[];for(const n of i.cameras)t.push(n.normalMatrix);rp===null?rp=Gr(t).setGroup(Dt).setName("cameraNormalMatrices"):rp.array=t,e=rp.element(i.isMultiViewCamera?ml("gl_ViewID_OVR"):gu).toConst("cameraNormalMatrix")}else S2===null&&(S2=Ct(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Dt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=S2;return e}).once()(),RC=ce(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){const t=[];for(let n=0,r=i.cameras.length;n<r;n++)t.push(new J);sp===null?sp=Gr(t).setGroup(Dt).setName("cameraPositions").onRenderUpdate(({camera:n},r)=>{const s=n.cameras,o=r.array;for(let a=0,l=s.length;a<l;a++)o[a].setFromMatrixPosition(s[a].matrixWorld)}):sp.array=t,e=sp.element(i.isMultiViewCamera?ml("gl_ViewID_OVR"):gu).toConst("cameraPosition")}else T2===null&&(T2=Ct(new J).setName("cameraPosition").setGroup(Dt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=T2;return e}).once()(),PW=ce(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){const t=[];for(const n of i.cameras)t.push(n.viewport);op===null?op=Gr(t,"vec4").setGroup(Dt).setName("cameraViewports"):op.array=t,e=op.element(gu).toConst("cameraViewport")}else M2===null&&(M2=Lt(0,0,gc.x,gc.y).toConst("cameraViewport")),e=M2;return e}).once()(),lM=new fl;class En extends vt{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=tn.OBJECT,this.uniformNode=new zd(null)}getNodeType(){const e=this.scope;if(e===En.WORLD_MATRIX)return"mat4";if(e===En.POSITION||e===En.VIEW_POSITION||e===En.DIRECTION||e===En.SCALE)return"vec3";if(e===En.RADIUS)return"float"}update(e){const t=this.object3d,n=this.uniformNode,r=this.scope;if(r===En.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===En.POSITION)n.value=n.value||new J,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===En.SCALE)n.value=n.value||new J,n.value.setFromMatrixScale(t.matrixWorld);else if(r===En.DIRECTION)n.value=n.value||new J,t.getWorldDirection(n.value);else if(r===En.VIEW_POSITION){const s=e.camera;n.value=n.value||new J,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}else if(r===En.RADIUS){const s=e.object.geometry;s.boundingSphere===null&&s.computeBoundingSphere(),lM.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=lM.radius}}generate(e){const t=this.scope;return t===En.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===En.POSITION||t===En.VIEW_POSITION||t===En.DIRECTION||t===En.SCALE?this.uniformNode.nodeType="vec3":t===En.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}En.WORLD_MATRIX="worldMatrix";En.POSITION="position";En.SCALE="scale";En.VIEW_POSITION="viewPosition";En.DIRECTION="direction";En.RADIUS="radius";const DW=hn(En,En.DIRECTION).setParameterLength(1),LW=hn(En,En.WORLD_MATRIX).setParameterLength(1),IW=hn(En,En.POSITION).setParameterLength(1),BW=hn(En,En.SCALE).setParameterLength(1),FW=hn(En,En.VIEW_POSITION).setParameterLength(1),UW=hn(En,En.RADIUS).setParameterLength(1);class fo extends En{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const OW=st(fo,fo.DIRECTION),ao=st(fo,fo.WORLD_MATRIX),kW=st(fo,fo.POSITION),GW=st(fo,fo.SCALE),VW=st(fo,fo.VIEW_POSITION),qW=st(fo,fo.RADIUS),CC=Ct(new pn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),zW=Ct(new nn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),_u=ce(i=>i.context.modelViewMatrix||NC).once()().toVar("modelViewMatrix"),NC=go.mul(ao),xx=ce(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Ct("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),vx=ce(i=>
4094{const e=i.context.isHighPrecisionModelViewMatrix;return Ct("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),PC=ce(i=>i.shaderStage!=="fragment"?(zn("TSL: `clipSpace` is only available in fragment stage."),Lt()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),$d=Al("position","vec3"),Pi=$d.toVarying("positionLocal"),MA=$d.toVarying("positionPrevious"),Ma=ce(i=>ao.mul(Pi).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),zy=ce(()=>Pi.transformDirection(ao).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),Hi=ce(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){const e=EC.mul(PC);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),ai=ce(i=>{let e;return i.camera.isOrthographicCamera?e=ae(0,0,1):e=Hi.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])();class HW extends vt{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";const{material:t}=e;return t.side===Xn?"false":e.getFrontFacing()}}const DC=st(HW),Hy=Z(DC).mul(2).sub(1),kA=ce(([i],{material:e})=>{const t=e.side;return t===Xn?i=i.mul(-1):t===Ui&&(i=i.mul(Hy)),i}),Rg=Al("normal","vec3"),Cs=ce(i=>i.geometry.hasAttribute("normal")===!1?(Oe('TSL: Vertex attribute "normal" not found on geometry.'),ae(0,1,0)):Rg,"vec3").once()().toVar("normalLocal"),LC=Hi.dFdx().cross(Hi.dFdy()).normalize().toVar("normalFlat"),wA=ce(i=>{let e;return i.isFlatShading()?e=LC:e=Wy(Cs).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),IC=ce(i=>{let e=wA.transformDirection(go);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),In=ce(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=wA,i.isFlatShading()!==!0&&(e=kA(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),xu=In.transformDirection(go).toVar("normalWorld"),Hl=ce(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=In:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),BC=ce(([i,e=ao])=>{const t=_r(e),n=i.div(ae(t[0].dot(t[0]),t[1].dot(t[1]),t[2].dot(t[2])));return t.mul(n).xyz}),Wy=ce(([i],e)=>{const t=e.context.modelNormalViewMatrix;if(t)return t.transformDirection(i);const n=CC.mul(i);return go.transformDirection(n)}),WW=ce(()=>(Oe('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),In)).once(["NORMAL","VERTEX"])(),$W=ce(()=>(Oe('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),xu)).once(["NORMAL","VERTEX"])(),jW=ce(()=>(Oe('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),Hl)).once(["NORMAL","VERTEX"])(),uM=new Nr,w2=new nn,FC=Ct(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),Jp=Ct(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),$y=Ct(new nn).onReference(function(i){return i.material}).onObjectUpdate(function({material:i,scene:e}){const t=e.environment!==null&&i.envMap===null?e.environmentRotation:i.envMapRotation;return t?(uM.copy(t),w2.makeRotationFromEuler(uM)):w2.identity(),w2}),UC=ai.negate().reflect(In),OC=ai.negate().refract(In,FC),kC=UC.transformDirection(go).toVar("reflectVector"),GC=OC.transformDirection(go).toVar("reflectVector"),VC=new FA;class XW extends Na{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===Fo?kC:e.mapping===Ra?GC:(ke('CubeTextureNode: Mapping "%s" not supported.',e.mapping),ae(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===co?ae(t.x,t.y.negate(),t.z):t:((e.renderer.coordinateSystem===co||!n.isRenderTargetTexture)&&(t=ae(t.x.negate(),t.yz)),$y.mul(t))}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}}const jy=hn(XW).setParameterLength(1,4).setName("cubeTexture"),os=(i=VC,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=xt(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=xt(e)),t!==null&&(r.levelNode=xt(t)),n!==null&&(r.biasNode=xt(n))):r=jy(i,e,t,n),r},QW=(i=VC)=>jy(i);class YW extends bc{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}}class Cg extends vt{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=tn.OBJECT}element(e){return new YW(this,xt(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Oe('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=Wd(null,e,this.count):Array.isArray(this.getValueFromReference())?t=Gr(null,e):e==="texture"?t=On(null):e==="cubeTexture"?t=
4094os(null):t=Ct(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const vi=(i,e,t)=>new Cg(i,e,t),yx=(i,e,t,n)=>new Cg(i,e,n,t);class KW extends Cg{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}}const Ka=(i,e,t=null)=>new KW(i,e,t),qC=ri(),ZW=Hi.dFdx(),JW=Hi.dFdy(),zC=qC.dFdx(),HC=qC.dFdy(),WC=In,$C=JW.cross(WC),jC=WC.cross(ZW),bx=$C.mul(zC.x).add(jC.mul(HC.x)),Sx=$C.mul(zC.y).add(jC.mul(HC.y)),cM=bx.dot(bx).max(Sx.dot(Sx)),XC=cM.equal(0).select(0,cM.inverseSqrt()),e$=bx.mul(XC).toVar("tangentViewFrame"),t$=Sx.mul(XC).toVar("bitangentViewFrame"),Ng=Al("tangent","vec4"),EA=Ng.xyz.toVar("tangentLocal"),Pg=ce(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=_u.mul(Lt(EA,0)).xyz.toVarying("v_tangentView").normalize():e=e$,i.isFlatShading()!==!0&&(e=kA(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),QC=Pg.transformDirection(go).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),Dg=ce(([i,e],t)=>{let n=i.mul(Ng.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),n$=Dg(Rg.cross(Ng),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),i$=Dg(Cs.cross(EA),"v_bitangentLocal").normalize().toVar("bitangentLocal"),YC=ce(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Dg(In.cross(Pg),"v_bitangentView").normalize():e=t$,i.isFlatShading()!==!0&&(e=kA(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),r$=Dg(xu.cross(QC),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Zu=_r(Pg,YC,In).toVar("TBNViewMatrix"),KC=ai.mul(Zu),s$=(i,e)=>i.sub(KC.mul(e)),ZC=ce(()=>{let i=rc.cross(ai);return i=i.cross(rc).normalize(),i=Mn(i,In,kl.mul(ua.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),JC=i=>xt(i).mul(.5).add(.5),o$=i=>xt(i).mul(2).sub(1),Tx=i=>ae(i,hs(Mg(Z(1).sub(Ao(i,i)))));class a$ extends qi{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=ma,this.unpackNormalMode=b1}setup(e){const{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this;let s=this.node.mul(2).sub(1);if(t===ma?r===tE?s=Tx(s.xy):r===jP?s=Tx(s.yw):r!==b1&&console.error(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==b1&&console.error(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=kA(a)),s=ae(s.xy.mul(a),s.z)}let o=null;return t===eE?o=Wy(s):t===ma?o=Zu.mul(s).normalize():(ke(`NodeMaterial: Unsupported normal map type: ${t}`),o=In),o}}const Mx=hn(a$).setParameterLength(1,2),l$=ce(({textureNode:i,bumpScale:e})=>{const t=r=>i.isolate().context({getUV:s=>r(s.uvNode||ri()),forceUVContext:!0}),n=Z(t(r=>r));return je(Z(t(r=>r.add(r.dFdx()))).sub(n),Z(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),u$=ce(i=>{const{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),u=r.dot(a).mul(Hy),d=u.sign().mul(n.x.mul(a).add(n.y.mul(l)));return u.abs().mul(t).sub(d).normalize()});class c$ extends qi{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=this.scaleNode!==null?this.scaleNode:1,t=l$({textureNode:this.textureNode,bumpScale:e});return u$({surf_pos:Hi,surf_norm:In,dHdxy:t})}}const Xy=hn(c$).setParameterLength(1,2),hM=new Map;class De extends vt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=hM.get(e);return n===void 0&&(n=Ka(e,t),hM.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){const t=e.context.material,n=this.scope;let r=null;if(n===De.COLOR){const s=t.color!==void 0?this.getColor(n):ae();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===De.OPACITY){const s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===De.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=Z(1);else if(n===De.SPECULAR_INTENSITY){const s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===De.SPECULAR_COLOR){const s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===De.ROUGHNESS){const s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===De.METALNESS){const s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===De.EMISSIVE){const s=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(n)):r=o}else if(n===De.NORMAL)t.normalMap?(r=Mx(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==ls||t.normalMap.format==hc||t.normalMap.format==cc)&&(r.unpackNormalMode=tE)):t.bumpMap?r=Xy(this.getTexture("bump").r,this.getFloat("bumpScale")):r=In;else if(n===De.CLEARCOAT){const s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===De.CLEARCOAT_ROUGHNESS){const s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===De.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=Mx(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=In;else if(n===De.SHEEN){const s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===De.SHEEN_ROUGHNESS){const s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(1e-4,1)}else if(n===De.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const s=this.getTexture(n);r=vg(_h.x,_h.y,_h.y.negate(),_h.x).mul(s.rg.mul(2).sub(je(1)).normalize().mul(s.b))}else r=_h;else if(n===De.IRIDESCENCE_THICKNESS){const s=vi("1","float",t.iridescenceThicknessRange);
4094if(t.iridescenceThicknessMap){const o=vi("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(n).g).add(o)}else r=s}else if(n===De.TRANSMISSION){const s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===De.THICKNESS){const s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===De.IOR)r=this.getFloat(n);else if(n===De.LIGHT_MAP)r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity"));else if(n===De.AO)r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(n===De.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):Z(0);else{const s=this.getNodeType(e);r=this.getCache(n,s)}return r}}De.ALPHA_TEST="alphaTest";De.COLOR="color";De.OPACITY="opacity";De.SHININESS="shininess";De.SPECULAR="specular";De.SPECULAR_STRENGTH="specularStrength";De.SPECULAR_INTENSITY="specularIntensity";De.SPECULAR_COLOR="specularColor";De.REFLECTIVITY="reflectivity";De.ROUGHNESS="roughness";De.METALNESS="metalness";De.NORMAL="normal";De.CLEARCOAT="clearcoat";De.CLEARCOAT_ROUGHNESS="clearcoatRoughness";De.CLEARCOAT_NORMAL="clearcoatNormal";De.EMISSIVE="emissive";De.ROTATION="rotation";De.SHEEN="sheen";De.SHEEN_ROUGHNESS="sheenRoughness";De.ANISOTROPY="anisotropy";De.IRIDESCENCE="iridescence";De.IRIDESCENCE_IOR="iridescenceIOR";De.IRIDESCENCE_THICKNESS="iridescenceThickness";De.IOR="ior";De.TRANSMISSION="transmission";De.THICKNESS="thickness";De.ATTENUATION_DISTANCE="attenuationDistance";De.ATTENUATION_COLOR="attenuationColor";De.LINE_SCALE="scale";De.LINE_DASH_SIZE="dashSize";De.LINE_GAP_SIZE="gapSize";De.LINE_WIDTH="linewidth";De.LINE_DASH_OFFSET="dashOffset";De.POINT_SIZE="size";De.DISPERSION="dispersion";De.LIGHT_MAP="light";De.AO="ao";const e8=st(De,De.ALPHA_TEST),t8=st(De,De.COLOR),n8=st(De,De.SHININESS),i8=st(De,De.EMISSIVE),Qy=st(De,De.OPACITY),r8=st(De,De.SPECULAR),wx=st(De,De.SPECULAR_INTENSITY),s8=st(De,De.SPECULAR_COLOR),jf=st(De,De.SPECULAR_STRENGTH),em=st(De,De.REFLECTIVITY),o8=st(De,De.ROUGHNESS),a8=st(De,De.METALNESS),l8=st(De,De.NORMAL),u8=st(De,De.CLEARCOAT),c8=st(De,De.CLEARCOAT_ROUGHNESS),h8=st(De,De.CLEARCOAT_NORMAL),A8=st(De,De.ROTATION),f8=st(De,De.SHEEN),d8=st(De,De.SHEEN_ROUGHNESS),p8=st(De,De.ANISOTROPY),m8=st(De,De.IRIDESCENCE),g8=st(De,De.IRIDESCENCE_IOR),_8=st(De,De.IRIDESCENCE_THICKNESS),x8=st(De,De.TRANSMISSION),v8=st(De,De.THICKNESS),y8=st(De,De.IOR),b8=st(De,De.ATTENUATION_DISTANCE),S8=st(De,De.ATTENUATION_COLOR),T8=st(De,De.LINE_SCALE),M8=st(De,De.LINE_DASH_SIZE),w8=st(De,De.LINE_GAP_SIZE),h$=st(De,De.LINE_WIDTH),E8=st(De,De.LINE_DASH_OFFSET),R8=st(De,De.POINT_SIZE),C8=st(De,De.DISPERSION),Yy=st(De,De.LIGHT_MAP),N8=st(De,De.AO),_h=Ct(new We).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),P8=ce(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class A$ extends bc{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){const n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const r=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){const s=this.getNodeType(e);n=e.format(n,s,t)}return n}}const f$=hn(A$).setParameterLength(2);class d$ extends Gy{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,s=null;t&&t.isStruct?(r="struct",s=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=q4(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Er.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(this.bufferCount===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return f$(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Er.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=Fy(this.value),this._varying=mu(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}}const su=(i,e=null,t=0)=>new d$(i,e,t);class Ti extends vt{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),n=this.scope;let r;if(n===Ti.VERTEX)r=e.getVertexIndex();else if(n===Ti.INSTANCE)r=e.getInstanceIndex();else if(n===Ti.DRAW)r=e.getDrawIndex();else if(n===Ti.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();
4094else if(n===Ti.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===Ti.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=mu(this).build(e,t),s}}Ti.VERTEX="vertex";Ti.INSTANCE="instance";Ti.SUBGROUP="subgroup";Ti.INVOCATION_LOCAL="invocationLocal";Ti.INVOCATION_SUBGROUP="invocationSubgroup";Ti.DRAW="draw";const D8=st(Ti,Ti.VERTEX),wa=st(Ti,Ti.INSTANCE),p$=st(Ti,Ti.SUBGROUP),m$=st(Ti,Ti.INVOCATION_SUBGROUP),g$=st(Ti,Ti.INVOCATION_LOCAL),L8=st(Ti,Ti.DRAW);class I8 extends vt{static get type(){return"InstanceNode"}constructor(e,t,n=null){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=n,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=tn.FRAME,this.buffer=null,this.bufferColor=null,this.previousInstanceMatrixNode=null}get isStorageMatrix(){const{instanceMatrix:e}=this;return e&&e.isStorageInstancedBufferAttribute===!0}get isStorageColor(){const{instanceColor:e}=this;return e&&e.isStorageInstancedBufferAttribute===!0}setup(e){let{instanceMatrixNode:t,instanceColorNode:n}=this;t===null&&(t=this._createInstanceMatrixNode(!0,e),this.instanceMatrixNode=t);const{instanceColor:r,isStorageColor:s}=this;if(r&&n===null){if(s)n=su(r,"vec3",Math.max(r.count,1)).element(wa);else{const a=new nu(r.array,3),l=r.usage===ld?_x:$m;this.bufferColor=a,n=ae(l(a,"vec3",3,0))}this.instanceColorNode=n}const o=t.mul(Pi).xyz;if(Pi.assign(o),e.needsPreviousData()&&MA.assign(this.getPreviousInstancedPosition(e)),e.hasGeometryAttribute("normal")){const a=BC(Cs,t);Cs.assign(a)}this.instanceColorNode!==null&&Rd("vec3","vInstanceColor").assign(this.instanceColorNode)}update(e){this.buffer!==null&&this.isStorageMatrix!==!0&&(this.buffer.clearUpdateRanges(),this.buffer.updateRanges.push(...this.instanceMatrix.updateRanges),this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version)),this.instanceColor&&this.bufferColor!==null&&this.isStorageColor!==!0&&(this.bufferColor.clearUpdateRanges(),this.bufferColor.updateRanges.push(...this.instanceColor.updateRanges),this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)),this.previousInstanceMatrixNode!==null&&e.object.previousInstanceMatrix.array.set(this.instanceMatrix.array)}getPreviousInstancedPosition(e){const t=e.object;return this.previousInstanceMatrixNode===null&&(t.previousInstanceMatrix=this.instanceMatrix.clone(),this.previousInstanceMatrixNode=this._createInstanceMatrixNode(!1,e)),this.previousInstanceMatrixNode.mul(MA).xyz}_createInstanceMatrixNode(e,t){let n;const{instanceMatrix:r}=this,{count:s}=r;if(this.isStorageMatrix)n=su(r,"mat4",Math.max(s,1)).element(wa);else if(s*16*4<=t.getUniformBufferLimit())n=Wd(r.array,"mat4",Math.max(s,1)).element(wa);else{const a=new am(r.array,16,1);e===!0&&(this.buffer=a);const l=r.usage===ld?_x:$m,u=[l(a,"vec4",16,0),l(a,"vec4",16,4),l(a,"vec4",16,8),l(a,"vec4",16,12)];n=iu(...u)}return n}}const _$=hn(I8).setParameterLength(2,3);class x$ extends I8{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:n,instanceColor:r}=e;super(t,n,r),this.instancedMesh=e}}const B8=hn(x$).setParameterLength(1);class v$ extends vt{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){this.batchingIdNode===null&&(e.getDrawIndex()===null?this.batchingIdNode=wa:this.batchingIdNode=L8);const n=ce(([y])=>{const T=oe(ru(Fi(this.batchMesh._indirectTexture),0).x).toConst(),S=oe(y).mod(T).toConst(),M=oe(y).div(T).toConst();return Fi(this.batchMesh._indirectTexture,er(S,M)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(oe(this.batchingIdNode)),r=this.batchMesh._matricesTexture,s=oe(ru(Fi(r),0).x).toConst(),o=Z(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),u=iu(Fi(r,er(a,l)),Fi(r,er(a.add(1),l)),Fi(r,er(a.add(2),l)),Fi(r,er(a.add(3),l))),d=this.batchMesh._colorsTexture;if(d!==null){const T=ce(([S])=>{const M=oe(ru(Fi(d),0).x).toConst(),R=S,E=R.mod(M).toConst(),N=R.div(M).toConst();return Fi(d,er(E,N)).rgb}
4094).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(n);Rd("vec3","vBatchColor").assign(T)}const p=_r(u);Pi.assign(u.mul(Pi));const g=Cs.div(ae(p[0].dot(p[0]),p[1].dot(p[1]),p[2].dot(p[2]))),x=p.mul(g).xyz;Cs.assign(x),e.hasGeometryAttribute("tangent")&&EA.mulAssign(p)}}const F8=hn(v$).setParameterLength(1),AM=new WeakMap;class U8 extends vt{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=tn.OBJECT,this.skinIndexNode=Al("skinIndex","uvec4"),this.skinWeightNode=Al("skinWeight","vec4"),this.bindMatrixNode=vi("bindMatrix","mat4"),this.bindMatrixInverseNode=vi("bindMatrixInverse","mat4"),this.boneMatricesNode=yx("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=Pi,this.toPositionNode=Pi,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){const{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:s,bindMatrixInverseNode:o}=this,a=e.element(n.x),l=e.element(n.y),u=e.element(n.z),d=e.element(n.w),p=s.mul(t),g=Qi(a.mul(r.x).mul(p),l.mul(r.y).mul(p),u.mul(r.z).mul(p),d.mul(r.w).mul(p));return o.mul(g).xyz}getSkinnedNormalAndTangent(e=this.boneMatricesNode,t=Cs,n=EA){const{skinIndexNode:r,skinWeightNode:s,bindMatrixNode:o,bindMatrixInverseNode:a}=this,l=e.element(r.x),u=e.element(r.y),d=e.element(r.z),p=e.element(r.w);let g=Qi(s.x.mul(l),s.y.mul(u),s.z.mul(d),s.w.mul(p));g=a.mul(g).mul(o);const x=g.transformDirection(t).xyz,y=g.transformDirection(n).xyz;return{skinNormal:x,skinTangent:y}}getPreviousSkinnedPosition(e){const t=e.object;return this.previousBoneMatricesNode===null&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=yx("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,MA)}setup(e){e.needsPreviousData()&&MA.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){const{skinNormal:n,skinTangent:r}=this.getSkinnedNormalAndTangent();Cs.assign(n),e.hasGeometryAttribute("tangent")&&EA.assign(r)}return t}generate(e,t){if(t!=="void")return super.generate(e,t)}update(e){const t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;AM.get(t)!==e.frameId&&(AM.set(t,e.frameId),this.previousBoneMatricesNode!==null&&(t.previousBoneMatrices===null&&(t.previousBoneMatrices=new Float32Array(t.boneMatrices)),t.previousBoneMatrices.set(t.boneMatrices)),t.update())}}const O8=i=>new U8(i),y$=(i,e=null)=>{const t=new U8(i);return t.positionNode=su(new nu(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(wa).toVar(),t.skinIndexNode=su(new nu(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(wa).toVar(),t.skinWeightNode=su(new nu(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(wa).toVar(),t.bindMatrixNode=Ct(i.bindMatrix,"mat4"),t.bindMatrixInverseNode=Ct(i.bindMatrixInverse,"mat4"),t.boneMatricesNode=Wd(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),t.toPositionNode=e,xt(t)};class b$ extends vt{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){const t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;const n={};for(let a=0,l=this.params.length-1;a<l;a++){const u=this.params[a],d=u.isNode!==!0&&u.name||this.getVarName(a),p=u.isNode!==!0&&u.type||"int";n[d]=zs(d,p)}const r=e.addStack(),s=this.params[this.params.length-1](n);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=r;const o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){const a=ce(this.params[0].update)(n);t.updateNode=a.context({nodeLoop:a})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){const t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){const t=this.getProperties(e),n=this.params,r=t.stackNode;for(let o=0,a=n.length-1;o<a;o++){const l=n[o];let u=!1,d=null,p=null,g=null,x=null,y=null,T=null;l.isNode?l.getNodeType(e)==="bool"?(u=!0,x="bool",p=l.build(e,x)):(x="int",g=this.getVarName(o),d="0",p=l.build(e,x),y="<"):(x=l.type||"int",g=l.name||this.getVarName(o),d=l.start,p=l.end,y=l.condition,T=l.update,typeof d=="number"?d=e.generateConst(x,d):d&&d.isNode&&(d=d.build(e,x)),typeof p=="number"?p=e.generateConst(x,p):p&&p.isNode&&(p=p.build(e,x)),d!==void 0&&p===void 0?(d=d+" - 1",p="0",y=">="):p!==void 0&&d===void 0&&(d="0",y="<"),y===void 0&&(Number(d)>Number(p)?y=">=":y="<"));let S;if(u)S=`while ( ${p} )`;else{const M={start:d,end:p},R=M.start,E=M.end;let N;const U=()=>y.includes("<")?"+=":"-=";if(T!=null)switch(typeof T){case"function":N=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":N=g+" "+U()+" "+e.generateConst(x,T);break;case"string":N=g+" "+T;break;default:T.isNode?N=g+" "+U()+" "+T.build(e):(ke("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),N="break /* invalid update */")}else x==="int"||x==="uint"?T=y.includes("<")?"++":"--":T=U()+" 1.",N=g+" "+T;
4094const L=e.getVar(x,g)+" = "+R,F=g+" "+y+" "+E;S=`for ( ${L}; ${F}; ${N} )`}e.addFlowCode((o===0?` 4095`:"")+e.tab+S+` { 4096 4097`).addFlowTab()}const s=r.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode(` 4098`+e.tab+s);for(let o=0,a=this.params.length-1;o<a;o++)e.addFlowCode((o===0?"":e.tab)+`} 4099 4100`).removeFlowTab();e.addFlowTab()}}const Zn=(...i)=>new b$(ic(i,"int")).toStack(),S$=()=>zs("continue").toStack(),k8=()=>zs("break").toStack(),E2=new WeakMap,Fs=new rn,fM=ce(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{const o=oe(D8).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return Fi(i,er(l,a)).depth(r).xyz.mul(e)});function T$(i){const e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0;let o=E2.get(i);if(o===void 0||o.count!==s){let M=function(){T.dispose(),E2.delete(i),i.removeEventListener("dispose",M)};o!==void 0&&o.texture.dispose();const a=i.morphAttributes.position||[],l=i.morphAttributes.normal||[],u=i.morphAttributes.color||[];let d=0;e===!0&&(d=1),t===!0&&(d=2),n===!0&&(d=3);let p=i.attributes.position.count*d,g=1;const x=4096;p>x&&(g=Math.ceil(p/x),p=x);const y=new Float32Array(p*g*4*s),T=new mv(y,p,g,s);T.type=zi,T.needsUpdate=!0;const S=d*4;for(let R=0;R<s;R++){const E=a[R],N=l[R],U=u[R],L=p*g*4*R;for(let F=0;F<E.count;F++){const P=F*S;e===!0&&(Fs.fromBufferAttribute(E,F),y[L+P+0]=Fs.x,y[L+P+1]=Fs.y,y[L+P+2]=Fs.z,y[L+P+3]=0),t===!0&&(Fs.fromBufferAttribute(N,F),y[L+P+4]=Fs.x,y[L+P+5]=Fs.y,y[L+P+6]=Fs.z,y[L+P+7]=0),n===!0&&(Fs.fromBufferAttribute(U,F),y[L+P+8]=Fs.x,y[L+P+9]=Fs.y,y[L+P+10]=Fs.z,y[L+P+11]=U.itemSize===4?Fs.w:1)}}o={count:s,texture:T,stride:d,size:new We(p,g)},E2.set(i,o),i.addEventListener("dispose",M)}return o}class M$ extends vt{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=Ct(1),this.updateType=tn.OBJECT}setup(e){const{geometry:t}=e,n=t.morphAttributes.position!==void 0,r=t.hasAttribute("normal")&&t.morphAttributes.normal!==void 0,s=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,o=s!==void 0?s.length:0,{texture:a,stride:l,size:u}=T$(t);n===!0&&Pi.mulAssign(this.morphBaseInfluence),r===!0&&Cs.mulAssign(this.morphBaseInfluence);const d=oe(u.width);Zn(o,({i:p})=>{const g=Z(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?g.assign(Fi(this.mesh.morphTexture,er(oe(p).add(1),oe(wa))).r):g.assign(vi("morphTargetInfluences","float").element(p).toVar()),Ft(g.notEqual(0),()=>{n===!0&&Pi.addAssign(fM({bufferMap:a,influence:g,stride:l,width:d,depth:p,offset:oe(0)})),r===!0&&Cs.addAssign(fM({bufferMap:a,influence:g,stride:l,width:d,depth:p,offset:oe(1)}))})})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((t,n)=>t+n,0)}}const G8=hn(M$).setParameterLength(1);class GA extends vt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class w$ extends GA{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class E$ extends YR{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,r=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=r,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n=ae().toVar("directDiffuse"),r=ae().toVar("directSpecular"),s=ae().toVar("indirectDiffuse"),o=ae().toVar("indirectSpecular"),a={directDiffuse:n,directSpecular:r,indirectDiffuse:s,indirectSpecular:o};return{radiance:ae().toVar("radiance"),irradiance:ae().toVar("irradiance"),iblIrradiance:ae().toVar("iblIrradiance"),ambientOcclusion:Z(1).toVar("ambientOcclusion"),reflectedLight:a,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const V8=hn(E$);class R$ extends GA{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}
4100setup(e){e.context.irradiance.addAssign(this.node)}}const sh=new We;class Lg extends Na{static get type(){return"ViewportTextureNode"}constructor(e=Ta,t=null,n=null){let r=null;n===null?(r=new Tv,r.minFilter=vs,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=tn.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){const r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){const t=e.renderer.getRenderTarget();return this.value=this.getTextureForReference(t),this.value}updateBefore(e){const t=e.renderer,n=t.getRenderTarget();n===null?t.getDrawingBufferSize(sh):sh.set(n.width,n.height);const r=this.getTextureForReference(n);(r.image.width!==sh.width||r.image.height!==sh.height)&&(r.image.width=sh.width,r.image.height=sh.height,r.needsUpdate=!0);const s=r.generateMipmaps;r.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(r),r.generateMipmaps=s}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const C$=hn(Lg).setParameterLength(0,3),Ky=hn(Lg,null,null,{generateMipmaps:!0}).setParameterLength(0,3),N$=Ky(),q8=(i=Ta,e=null)=>N$.sample(i,e);let ap=null;class P$ extends Lg{static get type(){return"ViewportDepthTextureNode"}constructor(e=Ta,t=null){ap===null&&(ap=new qr),super(e,t,ap)}getTextureForReference(){return ap}}const Zy=hn(P$).setParameterLength(0,2);class Ss extends vt{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===Ss.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let r=null;if(t===Ss.DEPTH_BASE)n!==null&&(r=H8().assign(n));else if(t===Ss.DEPTH)e.isPerspectiveCamera?r=Jy(Hi.z,ql,zl):r=kh(Hi.z,ql,zl);else if(t===Ss.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){const s=e3(n,ql,zl);r=kh(s,ql,zl)}else r=n;else r=kh(Hi.z,ql,zl);return r}}Ss.DEPTH_BASE="depthBase";Ss.DEPTH="depth";Ss.LINEAR_DEPTH="linearDepth";const kh=(i,e,t)=>i.add(e).div(e.sub(t)),D$=(i,e,t)=>i.add(t).div(t.sub(e)),L$=ce(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),Jy=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),z8=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),e3=ce(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(i).sub(e)):e.mul(t).div(t.sub(e).mul(i).sub(t))),t3=(i,e,t)=>{e=e.max(1e-6).toVar();const n=ya(i.negate().div(e)),r=ya(t.div(e));return n.div(r)},I$=(i,e,t)=>{const n=i.mul(Sg(t.div(e)));return Z(Math.E).pow(n).mul(e).negate()},H8=hn(Ss,Ss.DEPTH_BASE),n3=st(Ss,Ss.DEPTH),jm=hn(Ss,Ss.LINEAR_DEPTH).setParameterLength(0,1),B$=jm(Zy());n3.assign=i=>H8(i);class uo extends vt{static get type(){return"ClippingNode"}constructor(e=uo.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===uo.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===uo.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return ce(()=>{const n=Z().toVar("distanceToPlane"),r=Z().toVar("distanceToGradient"),s=Z(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){const l=Gr(t).setGroup(Dt);Zn(o,({i:u})=>{const d=l.element(u);n.assign(Hi.dot(d.xyz).negate().add(d.w)),r.assign(n.fwidth().div(2)),s.mulAssign(Go(r.negate(),r,n))})}const a=e.length;if(a>0){const l=Gr(e).setGroup(Dt),u=Z(1).toVar("intersectionClipOpacity");Zn(a,({i:d})=>{const p=l.element(d);n.assign(Hi.dot(p.xyz).negate().add(p.w)),r.assign(n.fwidth().div(2)),u.mulAssign(Go(r.negate(),r,n).oneMinus())}),s.mulAssign(u.oneMinus())}Kn.a.mulAssign(s),Kn.a.equal(0).discard()})()}setupDefault(e,t){return ce(()=>{const n=t.length;if(this.hardwareClipping===!1&&n>0){const s=Gr(t).setGroup(Dt);Zn(n,({i:o})=>
4100{const a=s.element(o);Hi.dot(a.xyz).greaterThan(a.w).discard()})}const r=e.length;if(r>0){const s=Gr(e).setGroup(Dt),o=ho(!0).toVar("clipped");Zn(r,({i:a})=>{const l=s.element(a);o.assign(Hi.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){const n=e.length;return t.enableHardwareClipping(n),ce(()=>{const r=Gr(e).setGroup(Dt),s=ml(t.getClipDistance());Zn(n,({i:o})=>{const a=r.element(o),l=Hi.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}}uo.ALPHA_TO_COVERAGE="alphaToCoverage";uo.DEFAULT="default";uo.HARDWARE="hardware";const F$=()=>new uo,U$=()=>new uo(uo.ALPHA_TO_COVERAGE),O$=()=>new uo(uo.HARDWARE),k$=.05,dM=ce(([i])=>Oo(sn(1e4,rs(sn(17,i.x).add(sn(.1,i.y)))).mul(Qi(.1,di(rs(sn(13,i.y).add(i.x))))))),pM=ce(([i])=>dM(je(dM(i.xy),i.z))),G$=ce(([i])=>{const e=Ii(Sa(Sy(i.xyz)),Sa(Ty(i.xyz))),t=Z(1).div(Z(k$).mul(e)).toVar("pixScale"),n=je(TA(ba(ya(t))),TA(Tg(ya(t)))),r=je(pM(ba(n.x.mul(i.xyz))),pM(ba(n.y.mul(i.xyz)))),s=Oo(ya(t)),o=Qi(sn(s.oneMinus(),r.x),sn(s,r.y)),a=Rs(s,s.oneMinus()),l=ae(o.mul(o).div(sn(2,a).mul(Rn(1,a))),o.sub(sn(.5,a)).div(Rn(1,a)),Rn(1,Rn(1,o).mul(Rn(1,o)).div(sn(2,a).mul(Rn(1,a))))),u=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return ko(u,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class V$ extends SC{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e),n=e.hasGeometryAttribute(t);let r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new rn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const W8=(i=0)=>new V$(i),q$=ce(([i,e])=>Rs(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),z$=ce(([i,e])=>Rs(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),H$=ce(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),W$=ce(([i,e])=>Mn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),mc(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),$$=ce(([i,e])=>{const t=e.a.add(i.a.mul(e.a.oneMinus()));return Lt(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),$8=ce(([i])=>Lt(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),j$=ce(([i])=>(Ft(i.a.equal(0),()=>Lt(0)),Lt(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"});class Vi extends Hr{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){const e=[];for(const t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;const n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){const e=[];for(const{property:t,childNode:n}of this._getNodeChildren())e.push(OA(t.slice(0,-4)),n.getCacheKey());return this.type+qd(e)}build(e){this.setup(e)}setupObserver(e){return new lH(e)}setup(e){e.context.setupNormal=()=>sc(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,n=t.getRenderTarget();t.contextNode.isContextNode===!0?e.context={...e.context,...t.contextNode.getFlowContextData()}:ke('NodeMaterial: "renderer.contextNode" must be an instance of `context()`.'),this.contextNode!==null&&(this.contextNode.isContextNode===!0?e.context={...e.context,...this.contextNode.getFlowContextData()}:ke('NodeMaterial: "material.contextNode" must be an instance of `context()`.')),e.addStack();const r=this.setupVertex(e),s=sc(this.vertexNode||r,"VERTEX");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o;const a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupVariants(e);const l=this.setupLighting(e);a!==null&&e.stack.addToStack(a);const u=Lt(l,Kn.a).max(0);o=this.setupOutput(e,u),Uh.assign(o);const d=this.outputNode!==null;if(d&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){const p=t.getMRT(),g=this.mrtNode;p!==null?(d&&Uh.assign(o),o=p,g!==null&&(o=p.merge(g))):g!==null&&(o=g)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=Lt(l)),o=this.setupOutput(e,l)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{unionPlanes:t,intersectionPlanes:n}=e.clippingContext;let r=null;if(t.length>0||n.length>0){const s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?r=U$():e.stack.addToStack(F$())}return r}setupHardwareClipping(e){if(this.hardwareClipping=!1,e.clippingContext===null)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(O$()),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:n}=e;let r=this.depthNode;if(r===null){const s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=t3(Hi.z,ql,zl):r=kh(Hi.z,ql,zl))}r!==null&&n3.assign(r).toStack()}setupPositionView(){return _u.mul(Pi).xyz}setupModelViewProjection(){return ol.mul(Hi)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),P8}setupPosition(e){const{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&G8(t).toStack(),t.isSkinnedMesh===!0&&O8(t).toStack(),this.displacementMap){const r=Ka("displacementMap","texture"),s=Ka("displacementScale","float"),o=Ka("displacementBias","float");Pi.addAssign(Cs.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&F8(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&B8(t).toStack(),this.positionNode!==null&&Pi.assign(sc(this.positionNode,"POSITION","vec3")),Pi}setupDiffuseColor(e){const{object:t,geometry:n}=e;this.maskNode!==null&&ho(this.maskNode).not().discard();let r=this.colorNode?Lt(this.colorNode):t8;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(W8())),t.instanceColor&&(r=Rd("vec3","vInstanceColor").mul(r)),t.isBatchedMesh&&t._
4100colorsTexture&&(r=Rd("vec3","vBatchColor").mul(r)),Kn.assign(r);const s=this.opacityNode?Z(this.opacityNode):Qy;Kn.a.assign(Kn.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?Z(this.alphaTestNode):e8,this.alphaToCoverage===!0?(Kn.a=Go(o,o.add(wy(Kn.a)),Kn.a),Kn.a.lessThanEqual(0).discard()):Kn.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Kn.a.lessThan(G$(Pi)).discard(),e.isOpaque()&&Kn.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?ae(0):Kn.rgb}setupNormal(){return this.normalNode?ae(this.normalNode):l8}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Ka("envMap","cubeTexture"):Ka("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new R$(Yy)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const r=this.setupLightMap(e);r&&r.isLightingNode&&t.push(r);let s=this.aoNode;s===null&&e.material.aoMap&&(s=N8),e.context.getAO&&(s=e.context.getAO(s,e)),s&&t.push(new w$(s));let o=this.lightsNode||e.lightsNode;return t.length>0&&(o=e.renderer.lighting.createNode([...o.getLights(),...t])),o}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,a=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null;let l=this.setupOutgoingLight(e);if(a&&a.getScope().hasLights){const u=this.setupLightingModel(e)||null;l=V8(a,u,n,r)}else n!==null&&(l=ae(r!==null?Mn(l,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(mx.assign(ae(s||i8)),l=l.add(mx)),l}setupFog(e,t){const n=e.fogNode;return n&&(Uh.assign(t),t=Lt(n.toVar())),t}setupPremultipliedAlpha(e,t){return $8(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const n in e){const r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});const n=Hr.prototype.toJSON.call(this,e);n.inputNodes={};for(const{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.aoNode=e.aoNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.maskNode=e.maskNode,this.maskShadowNode=e.maskShadowNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,this.contextNode=e.contextNode,super.copy(e)}}const X$=new BA;class Q$ extends Vi{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(X$),this.setValues(e)}}const Y$=new UD;class K$ extends Vi{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Y$),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?Z(this.offsetNode):E8,t=this.dashScaleNode?Z(this.dashScaleNode):T8,n=this.dashSizeNode?Z(this.dashSizeNode):M8,r=this.gapSizeNode?Z(this.gapSizeNode):w8;Yp.assign(n),gx.assign(r);const s=mu(Al("lineDistance").mul(t));(e?s.add(e):s).mod(Yp.add(gx)).greaterThan(Yp).discard()}}const Z$=new LD;class J$ extends Vi{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Z$),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?Z(this.opacityNode):Qy;Kn.assign(wg(Lt(JC(In),e),Tr))}}const i3=ce(([i=zy])=>{const e=i.z.atan(i.x).mul(1/(Math.PI*2)).add(.5),t=i.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return je(e,t)});
vendor: 6,375 bytes, line 4100
4100class j8 extends Ba{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new FA(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,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 s=new pu(5,5,5),o=i3(zy),a=new Vi;a.colorNode=On(t,o,0),a.side=Xn,a.blending=gr;const l=new Qn(s,a),u=new _v;u.add(l),t.minFilter===vs&&(t.minFilter=li);const d=new bE(1,10,this),p=e.getMRT();return e.setMRT(null),d.update(e,u),e.setMRT(p),t.minFilter=n,t.currentGenerateMipmaps=r,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}}const Xf=new WeakMap;class ej extends qi{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=os(null);const t=new FA;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=tn.RENDER}updateBefore(e){const{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){const s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){const o=s.mapping;if(o===Ch||o===Nh){if(Xf.has(s)){const a=Xf.get(s);mM(a,s.mapping),this._cubeTexture=a}else{const a=s.image;if(tj(a)){const l=new j8(a.height);l.fromEquirectangularTexture(t,s),mM(l.texture,s.mapping),this._cubeTexture=l.texture,Xf.set(s,l.texture),s.addEventListener("dispose",X8)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function tj(i){return i==null?!1:i.height>0}function X8(i){const e=i.target;e.removeEventListener("dispose",X8);const t=Xf.get(e);t!==void 0&&(Xf.delete(e),t.dispose())}function mM(i,e){e===Ch?i.mapping=Fo:e===Nh&&(i.mapping=Ra)}const Q8=hn(ej).setParameterLength(1);class r3 extends GA{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Q8(this.envNode)}}class nj extends GA{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=Z(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class Ig{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class Y8 extends Ig{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Lt(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Lt(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Kn.rgb)}finish(e){const{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case Dd:r.rgb.assign(Mn(r.rgb,r.rgb.mul(s.rgb),jf.mul(em)));break;case Kw:r.rgb.assign(Mn(r.rgb,s.rgb,jf.mul(em)));break;case Zw:r.rgb.addAssign(s.rgb.mul(jf.mul(em)));break;default:Oe("BasicLightingModel: Unsupported .combine value:",t.combine);break}}}const ij=new qs;class rj extends Vi{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(ij),this.setValues(e)}setupNormal(){return kA(wA)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new r3(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new nj(Yy)),t}setupOutgoingLight(){return Kn.rgb}setupLightingModel(){return new Y8}}const RA=ce(({f0:i,f90:e,dotVH:t})=>{const n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),_c=ce(i=>i.diffuseColor.mul(1/Math.PI)),sj=()=>Z(.25),oj=ce(({dotNH:i})=>zm.mul(Z(.5)).add(1).mul(Z(1/Math.PI)).mul(i.pow(zm))),aj=ce(({lightDirection:i})=>{const e=i.add(ai).normalize(),t=In.dot(e).clamp(),n=ai.dot(e).clamp(),r=RA({f0:cu,f90:1,dotVH:n}),s=sj(),o=oj({dotNH:t});return r.mul(s).mul(o)});class K8 extends Y8{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const s=In.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(_c({diffuseColor:Kn.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(aj({lightDirection:e})).mul(jf))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(_c({diffuseColor:Kn}))),r.indirectDiffuse.mulAssign(t)}}const lj=new dl;class uj extends Vi{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(lj),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new r3(t):null}setupLightingModel(){return new K8(!1)}}const cj=new yE;class hj extends Vi{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(cj),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new r3(t):null}setupLightingModel(){return new K8}setupVariants(){const e=(this.shininessNode?Z(this.shininessNode):n8).max(1e-4);zm.assign(e);const t=this.specularNode||r8;cu.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const Z8=ce(i=>{if(i.geometry.hasAttribute("normal")===!1)return Z(0);const e=wA.dFdx().abs().max(wA.dFdy().abs());return e.x.max(e.y).max(e.z)}),s3=ce(i=>{const{roughness:e}=i,t=Z8();let n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),J8=ce(({alpha:i,dotNL:e,dotNV:t})=>{const n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return js(.5,r.add(s).max(my))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),Aj=ce(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{const l=a.mul(ae(i.mul(t),e.mul(n),o).length()),u=o.mul(ae(i.mul(r),e.mul(s),a).length());return js(.5,l.add(u))}
4100).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),e5=ce(({alpha:i,dotNH:e})=>{const t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),fj=Z(1/Math.PI),dj=ce(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{const s=i.mul(e),o=ae(e.mul(n),i.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return fj.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),o3=ce(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=In,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{const l=n.pow2(),u=i.add(ai).normalize(),d=s.dot(i).clamp(),p=s.dot(ai).clamp(),g=s.dot(u).clamp(),x=ai.dot(u).clamp();let y=RA({f0:e,f90:t,dotVH:x}),T,S;if(wd(o)&&(y=yg.mix(y,r)),wd(a)){const M=Wf.dot(i),R=Wf.dot(ai),E=Wf.dot(u),N=rc.dot(i),U=rc.dot(ai),L=rc.dot(u);T=Aj({alphaT:qm,alphaB:l,dotTV:R,dotBV:U,dotTL:M,dotBL:N,dotNV:p,dotNL:d}),S=dj({alphaT:qm,alphaB:l,dotNH:g,dotTH:E,dotBH:L})}else T=J8({alpha:l,dotNL:d,dotNV:p}),S=e5({alpha:l,dotNH:g});return y.mul(T).mul(S)}),pj=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,
vendor: 3,208 bytes, line 4100
410014942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Jo=null;const Cd=ce(({roughness:i,dotNV:e})=>{Jo===null&&(Jo=new bv(pj,16,16,ls,Mi),Jo.name="DFG_LUT",Jo.minFilter=li,Jo.magFilter=li,Jo.wrapS=xs,Jo.wrapT=xs,Jo.generateMipmaps=!1,Jo.needsUpdate=!0);const t=je(i,e);return On(Jo,t).rg}),mj=ce(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{const a=o3({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=In.dot(i).clamp(),u=In.dot(ai).clamp(),d=Cd({roughness:n,dotNV:u}),p=Cd({roughness:n,dotNV:l}),g=e.mul(d.x).add(t.mul(d.y)),x=e.mul(p.x).add(t.mul(p.y)),y=d.x.add(d.y),T=p.x.add(p.y),S=Z(1).sub(y),M=Z(1).sub(T),R=e.add(e.oneMinus().mul(.047619)),E=g.mul(x).mul(R).div(Z(1).sub(S.mul(M).mul(R).mul(R)).add(my)),N=S.mul(M),U=E.mul(N);return a.add(U)}),t5=ce(i=>{const{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=Cd({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),Ex=ce(({f:i,f90:e,dotVH:t})=>{const n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(ae(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),gj=ce(({roughness:i,dotNH:e})=>{const t=i.pow2(),n=Z(1).div(t),s=e.pow2().oneMinus().max(.0078125);return Z(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}
vendor: 4,278 bytes, line 4100
4100).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),_j=ce(({dotNV:i,dotNL:e})=>Z(1).div(Z(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),xj=ce(({lightDirection:i})=>{const e=i.add(ai).normalize(),t=In.dot(i).clamp(),n=In.dot(ai).clamp(),r=In.dot(e).clamp(),s=gj({roughness:Vl,dotNH:r}),o=_j({dotNV:n,dotNL:t});return Os.mul(s).mul(o)}),gM=ce(({N:i,V:e,roughness:t})=>{const s=.0078125,o=i.dot(e).saturate(),a=je(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(s)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),vj=ce(({f:i})=>{const e=i.length();return Ii(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),lp=ce(({v1:i,v2:e})=>{const t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=r.div(s),a=t.greaterThan(0).select(o,Ii(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return i.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),R2=ce(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:o,p3:a})=>{const l=s.sub(r).toVar(),u=a.sub(r).toVar(),d=l.cross(u),p=ae().toVar();return Ft(d.dot(t.sub(r)).greaterThanEqual(0),()=>{const g=e.sub(i.mul(e.dot(i))).normalize(),x=i.cross(g).negate(),y=n.mul(_r(g,x,i).transpose()).toVar(),T=y.mul(r.sub(t)).normalize().toVar(),S=y.mul(s.sub(t)).normalize().toVar(),M=y.mul(o.sub(t)).normalize().toVar(),R=y.mul(a.sub(t)).normalize().toVar(),E=ae(0).toVar();E.addAssign(lp({v1:T,v2:S})),E.addAssign(lp({v1:S,v2:M})),E.addAssign(lp({v1:M,v2:R})),E.addAssign(lp({v1:R,v2:T})),p.assign(ae(vj({f:E})))}),p}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Bg=1/6,n5=i=>sn(Bg,sn(i,sn(i,i.negate().add(3)).sub(3)).add(1)),Rx=i=>sn(Bg,sn(i,sn(i,sn(3,i).sub(6))).add(4)),i5=i=>sn(Bg,sn(i,sn(i,sn(-3,i).add(3)).add(3)).add(1)),Cx=i=>sn(Bg,oo(i,3)),_M=i=>n5(i).add(Rx(i)),xM=i=>i5(i).add(Cx(i)),vM=i=>Qi(-1,Rx(i).div(n5(i).add(Rx(i)))),yM=i=>Qi(1,Cx(i).div(i5(i).add(Cx(i)))),bM=(i,e,t)=>{const n=i.uvNode,r=sn(n,e.zw).add(.5),s=ba(r),o=Oo(r),a=_M(o.x),l=xM(o.x),u=vM(o.x),d=yM(o.x),p=vM(o.y),g=yM(o.y),x=je(s.x.add(u),s.y.add(p)).sub(.5).mul(e.xy),y=je(s.x.add(d),s.y.add(p)).sub(.5).mul(e.xy),T=je(s.x.add(u),s.y.add(g)).sub(.5).mul(e.xy),S=je(s.x.add(d),s.y.add(g)).sub(.5).mul(e.xy),M=_M(o.y).mul(Qi(a.mul(i.sample(x).level(t)),l.mul(i.sample(y).level(t)))),R=xM(o.y).mul(Qi(a.mul(i.sample(T).level(t)),l.mul(i.sample(S).level(t))));return M.add(R)},a3=ce(([i,e])=>{const t=je(i.size(oe(e))),n=je(i.size(oe(e.add(1)))),r=js(1,t),s=js(1,n),o=bM(i,Lt(r,t),ba(e)),a=bM(i,Lt(s,n),Tg(e));return Oo(e).mix(o,a)}),yj=ce(([i,e])=>{const t=e.mul(Oy(i));return a3(i,t)}),SM=ce(([i,e,t,n,r])=>{const s=ae(Ny(e.negate(),Ms(i),js(1,n))),o=ae(Sa(r[0].xyz),Sa(r[1].xyz),Sa(r[2].xyz));return Ms(s).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),bj=ce(([i,e])=>i.mul(ko(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),Sj=Ky(),Tj=q8(),TM=ce(([i,e,t],{material:n})=>{const s=(n.side===Xn?Sj:Tj).sample(i),o=ya(gc.x).mul(bj(e,t));return a3(s,o)}),MM=ce(([i,e,t])=>(Ft(t.notEqual(0),()=>{const n=Sg(e).negate().div(t);return gy(n.negate().mul(i))}),ae(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Mj=ce(([i,e,t,n,r,s,o,a,l,u,d,p,g,x,y])=>{let T,S;if(y){T=Lt().toVar(),S=ae().toVar();const U=d.sub(1).mul(y.mul(.025)),L=ae(d.sub(U),d,d.add(U));Zn({start:0,end:3},({i:F})=>
4100{const P=L.element(F),I=SM(i,e,p,P,a),$=o.add(I),k=u.mul(l.mul(Lt($,1))),W=je(k.xy.div(k.w)).toVar();W.addAssign(1),W.divAssign(2),W.assign(je(W.x,W.y.oneMinus()));const j=TM(W,t,P);T.element(F).assign(j.element(F)),T.a.addAssign(j.a),S.element(F).assign(n.element(F).mul(MM(Sa(I),g,x).element(F)))}),T.a.divAssign(3)}else{const U=SM(i,e,p,d,a),L=o.add(U),F=u.mul(l.mul(Lt(L,1))),P=je(F.xy.div(F.w)).toVar();P.addAssign(1),P.divAssign(2),P.assign(je(P.x,P.y.oneMinus())),T=TM(P,t,d),S=n.mul(MM(Sa(U),g,x))}const M=S.rgb.mul(T.rgb),R=i.dot(e).clamp(),E=ae(t5({dotNV:R,specularColor:r,specularF90:s,roughness:t})),N=S.r.add(S.g,S.b).div(3);return Lt(E.oneMinus().mul(M),T.a.oneMinus().mul(N).oneMinus())}),wj=_r(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Ej=i=>{const e=i.sqrt();return ae(1).add(e).div(ae(1).sub(e))},wM=(i,e)=>i.sub(e).div(i.add(e)).pow2(),Rj=(i,e)=>{const t=i.mul(2*Math.PI*1e-9),n=ae(54856e-17,44201e-17,52481e-17),r=ae(1681e3,1795300,2208400),s=ae(43278e5,93046e5,66121e5),o=Z(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp());let a=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return a=ae(a.x.add(o),a.y,a.z).div(10685e-11),wj.mul(a)},EM=ce(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{const s=Mn(i,e,Go(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();Ft(a.lessThan(0),()=>ae(1));const l=a.sqrt(),u=wM(s,i),d=RA({f0:u,f90:1,dotVH:t}),p=d.oneMinus(),g=s.lessThan(i).select(Math.PI,0),x=Z(Math.PI).sub(g),y=Ej(r.clamp(0,.9999)),T=wM(y,s.toVec3()),S=RA({f0:T,f90:1,dotVH:l}),M=ae(y.x.lessThan(s).select(Math.PI,0),y.y.lessThan(s).select(Math.PI,0),y.z.lessThan(s).select(Math.PI,0)),R=s.mul(n,l,2),E=ae(x).add(M),N=d.mul(S).clamp(1e-5,.9999),U=N.sqrt(),L=p.pow2().mul(S).div(ae(1).sub(N)),P=d.add(L).toVar(),I=L.sub(p).toVar();return Zn({start:1,end:2,condition:"<=",name:"m"},({m:$})=>{I.mulAssign(U);const k=Rj(Z($).mul(R),Z($).mul(E)).mul(2);P.addAssign(I.mul(k))}),P.max(ae(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),ff=ce(({normal:i,viewDir:e,roughness:t})=>{const n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=Z(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=Z(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),df=ae(.04),up=Z(1);class r5 extends Ig{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=ae().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=ae().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=ae().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=ae().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=ae().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=In.dot(ai).clamp(),n=EM({outsideIOR:Z(1),eta2:Gm,cosTheta1:t,thinFilmThickness:Vm,baseF0:cu}),r=EM({outsideIOR:Z(1),eta2:Gm,cosTheta1:t,thinFilmThickness:Vm,baseF0:Kn.rgb});this.iridescenceFresnel=Mn(n,r,el),this.iridescenceF0Dielectric=Ex({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=Ex({f:r,f90:1,dotVH:t}),this.iridescenceF0=Mn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,el)}if(this.transmission===!0){const t=Ma,n=RC.sub(Ma).normalize(),r=xu,s=e.context;s.backdrop=Mj(r,n,ua,zu,Yu,Ku,t,ao,go,ol,$f,cy,Ay,hy,this.dispersion?fy:null),s.backdropAlpha=Hm,Kn.a.mulAssign(Mn(1,s.backdrop.a,Hm))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){const o=In.dot(ai).clamp(),a=Cd({roughness:ua,dotNV:o}),l=s?yg.mix(r,s):r,u=l.mul(a.x).add(n.mul(a.y)),p=a.x.add(a.y).oneMinus(),g=l.add(l.oneMinus().mul(.047619)),x=u.mul(g).div(p.mul(g).oneMinus());e.addAssign(u),t.addAssign(x.mul(p))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const s=In.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(xj({lightDirection:e})));const o=ff({normal:In,viewDir:ai,roughness:Vl}),a=ff({normal:In,viewDir:e,roughness:Vl}),l=Os.r.max(Os.g).max(Os.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){const a=Hl.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(o3({lightDirection:e,f0:df,f90:up,roughness:Fh,normalView:Hl})))}n.directDiffuse.addAssign(s.mul(_c({diffuseColor:zu}))),n.directSpecular.addAssign(s.mul(mj({lightDirection:e,f0:Yu,f90:1,roughness:ua,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:o,ltc_2:a}){const l=t.add(n).sub(r),u=t.sub(n).sub(r),d=t.sub(n).add(r),p=t.add(n).add(r),g=In,x=ai,y=Hi.toVar(),T=gM({N:g,V:x,roughness:ua}),S=o.sample(T).toVar(),M=a.sample(T).toVar(),R=_r(ae(S.x,0,S.y),ae(0,1,0),ae(S.z,0,S.w)).toVar(),E=Yu.mul(M.x).add(Ku.sub(Yu).mul(M.y)).toVar();if(s.directSpecular.addAssign(e.mul(E).mul(R2({N:g,V:x,P:y,mInv:R,p0:l,p1:u,p2:d,p3:p}))),s.directDiffuse.addAssign(e.mul(zu).mul(R2({N:g,V:x,P:y,mInv:_r(1,0,0,0,1,0,0,0,1),p0:l,p1:u,p2:d,p3:p}))),this.clearcoat===!0){const N=Hl,U=gM({N,V:x,roughness:Fh}),L=o.sample(U),F=a.sample(U),P=_r(ae(L.x,0,L.y),ae(0,1,0),ae(L.z,0,L.w)),I=df.mul(F.x).add(up.sub(df).mul(F.y));this.clearcoatSpecularDirect.addAssign(e.mul(I).mul(R2({N,V:x,P:y,mInv:P,p0:l,p1:u,p2:d,p3:p})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:n}=e.context,r=t.mul(_c({diffuseColor:zu})).toVar();if(this.sheen===!0){const s=ff({normal:In,viewDir:ai,roughness:Vl}),o=Os.r.max(Os.g).max(Os.b).mul(s).oneMinus();r.mulAssign(o)}n.indirectDiffuse.addAssign(r)}indirectSpecular(e){const{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(Os,ff({normal:In,viewDir:ai,roughness:Vl}))),this.clearcoat===!0){const S=Hl.dot(ai).clamp(),M=t5({dotNV:S,specularColor:df,specularF90:up,roughness:Fh});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(M))}const s=ae().toVar("singleScatteringDielectric"),o=ae().toVar("multiScatteringDielectric"),a=ae().toVar("singleScatteringMetallic"),l=ae().toVar("multiScatteringMetallic");this.computeMultiscattering(s,o,Ku,cu,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Ku,Kn.rgb,this.iridescenceF0Metallic);const u=Mn(s,a,el),d=Mn(o,l,el),p=s.add(o),g=zu.mul(p.oneMinus()),x=n.mul(1/Math.PI),y=t.mul(u).add(d.mul(x)).toVar(),T=g.mul(x).toVar();if(this.sheen===!0){const S=ff({normal:In,viewDir:ai,roughness:Vl}),M=Os.r.max(Os.g).max(Os.b).mul(S).oneMinus();y.mulAssign(M),T.mulAssign(M)}
vendor: 4,323 bytes, line 4100
4100r.indirectSpecular.addAssign(y),r.indirectDiffuse.addAssign(T)}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:n}=e.context,s=In.dot(ai).clamp().add(t),o=ua.mul(-16).oneMinus().negate().exp2(),a=t.sub(s.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(a)}finish({context:e}){const{outgoingLight:t}=e;if(this.clearcoat===!0){const n=Hl.dot(ai).clamp(),r=RA({dotVH:n,f0:df,f90:up}),s=t.mul(km.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(km));t.assign(s)}if(this.sheen===!0){const n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}}const RM=Z(1),Nx=Z(-2),cp=Z(.8),C2=Z(-1),hp=Z(.4),N2=Z(2),Ap=Z(.305),P2=Z(3),CM=Z(.21),Cj=Z(4),NM=Z(4),Nj=Z(16),Pj=ce(([i])=>{const e=ae(di(i)).toVar(),t=Z(-1).toVar();return Ft(e.x.greaterThan(e.z),()=>{Ft(e.x.greaterThan(e.y),()=>{t.assign(Vr(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(Vr(i.y.greaterThan(0),1,4))})}).Else(()=>{Ft(e.z.greaterThan(e.y),()=>{t.assign(Vr(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(Vr(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),Dj=ce(([i,e])=>{const t=je().toVar();return Ft(e.equal(0),()=>{t.assign(je(i.z,i.y).div(di(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(je(i.x.negate(),i.z.negate()).div(di(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(je(i.x.negate(),i.y).div(di(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(je(i.z.negate(),i.y).div(di(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(je(i.x.negate(),i.z).div(di(i.y)))}).Else(()=>{t.assign(je(i.x,i.y).div(di(i.z)))}),sn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),Lj=ce(([i])=>{const e=Z(0).toVar();return Ft(i.greaterThanEqual(cp),()=>{e.assign(RM.sub(i).mul(C2.sub(Nx)).div(RM.sub(cp)).add(Nx))}).ElseIf(i.greaterThanEqual(hp),()=>{e.assign(cp.sub(i).mul(N2.sub(C2)).div(cp.sub(hp)).add(C2))}).ElseIf(i.greaterThanEqual(Ap),()=>{e.assign(hp.sub(i).mul(P2.sub(N2)).div(hp.sub(Ap)).add(N2))}).ElseIf(i.greaterThanEqual(CM),()=>{e.assign(Ap.sub(i).mul(Cj.sub(P2)).div(Ap.sub(CM)).add(P2))}).Else(()=>{e.assign(Z(-2).mul(ya(sn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),s5=ce(([i,e])=>{const t=i.toVar();t.assign(sn(2,t).sub(1));const n=ae(t,1).toVar();return Ft(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),o5=ce(([i,e,t,n,r,s])=>{const o=Z(t),a=ae(e),l=ko(Lj(o),Nx,s),u=Oo(l),d=ba(l),p=ae(Nd(i,a,d,n,r,s)).toVar();return Ft(u.notEqual(0),()=>{const g=ae(Nd(i,a,d.add(1),n,r,s)).toVar();p.assign(Mn(p,g,u))}),p}),Nd=ce(([i,e,t,n,r,s])=>{const o=Z(t).toVar(),a=ae(e),l=Z(Pj(a)).toVar(),u=Z(Ii(NM.sub(o),0)).toVar();o.assign(Ii(o,NM));const d=Z(TA(o)).toVar(),p=je(Dj(a,l).mul(d.sub(2)).add(1)).toVar();return Ft(l.greaterThan(2),()=>{p.y.addAssign(d),l.subAssign(3)}),p.x.addAssign(l.mul(d)),p.x.addAssign(u.mul(sn(3,Nj))),p.y.addAssign(sn(4,TA(s).sub(d))),p.x.mulAssign(n),p.y.mulAssign(r),i.sample(p).grad(je(),je())}),D2=ce(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{const l=Ro(n),u=t.mul(l).add(r.cross(t).mul(rs(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return Nd(i,u,e,s,o,a)}),a5=ce(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:p})=>{const g=ae(Vr(e,t,hl(t,n))).toVar();Ft(g.equal(ae(0)),()=>{g.assign(ae(n.z,0,n.x.negate()))}),g.assign(Ms(g));const x=ae().toVar();return x.addAssign(r.element(0).mul(D2({theta:0,axis:g,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:p}))),Zn({start:oe(1),end:i},({i:y})=>{Ft(y.greaterThanEqual(s),()=>{k8()});
vendor: 6,494 bytes, line 4100
4100const T=Z(o.mul(Z(y))).toVar();x.addAssign(r.element(y).mul(D2({theta:T.mul(-1),axis:g,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:p}))),x.addAssign(r.element(y).mul(D2({theta:T,axis:g,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:p})))}),Lt(x,1)}),Ij=ce(([i])=>{const e=Ge(i).toVar();return e.assign(e.shiftLeft(Ge(16)).bitOr(e.shiftRight(Ge(16)))),e.assign(e.bitAnd(Ge(1431655765)).shiftLeft(Ge(1)).bitOr(e.bitAnd(Ge(2863311530)).shiftRight(Ge(1)))),e.assign(e.bitAnd(Ge(858993459)).shiftLeft(Ge(2)).bitOr(e.bitAnd(Ge(3435973836)).shiftRight(Ge(2)))),e.assign(e.bitAnd(Ge(252645135)).shiftLeft(Ge(4)).bitOr(e.bitAnd(Ge(4042322160)).shiftRight(Ge(4)))),e.assign(e.bitAnd(Ge(16711935)).shiftLeft(Ge(8)).bitOr(e.bitAnd(Ge(4278255360)).shiftRight(Ge(8)))),Z(e).mul(23283064365386963e-26)}),Bj=ce(([i,e])=>je(Z(i).div(Z(e)),Ij(i))),Fj=ce(([i,e,t])=>{const n=t.mul(t).toConst(),r=ae(1,0,0).toConst(),s=hl(e,r).toConst(),o=hs(i.x).toConst(),a=sn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(Ro(a)).toConst(),u=o.mul(rs(a)).toVar(),d=sn(.5,e.z.add(1)).toConst();u.assign(d.oneMinus().mul(hs(l.mul(l).oneMinus())).add(d.mul(u)));const p=r.mul(l).add(s.mul(u)).add(e.mul(hs(Ii(0,l.mul(l).add(u.mul(u)).oneMinus()))));return Ms(ae(n.mul(p.x),n.mul(p.y),Ii(0,p.z)))}),l5=ce(({roughness:i,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{const l=ae(n).toVar(),u=ae(0).toVar(),d=Z(0).toVar();return Ft(i.lessThan(.001),()=>{u.assign(Nd(t,l,e,s,o,a))}).Else(()=>{const p=Vr(di(l.z).lessThan(.999),ae(0,0,1),ae(1,0,0)),g=Ms(hl(p,l)).toVar(),x=hl(l,g).toVar();Zn({start:Ge(0),end:r},({i:y})=>{const T=Bj(y,r),S=Fj(T,ae(0,0,1),i),M=Ms(g.mul(S.x).add(x.mul(S.y)).add(l.mul(S.z))),R=Ms(M.mul(Ao(l,M).mul(2)).sub(l)),E=Ii(Ao(l,R),0);Ft(E.greaterThan(0),()=>{const N=Nd(t,R,e,s,o,a);u.addAssign(N.mul(E)),d.addAssign(E)})}),Ft(d.greaterThan(0),()=>{u.assign(u.div(d))})}),Lt(u,1)}),Kl=4,PM=[.125,.215,.35,.446,.526,.582],Hu=20,Uj=512,pf=new Ud(-1,1,1,-1,0,1),Oj=new pr(90,1),DM=new It;let L2=null,I2=0,B2=0;const kj=new J,Xm=new WeakMap,Gj=[3,1,5,0,4,2],F2=s5(ri(),Al("faceIndex")).normalize(),Fg=ae(F2.x,F2.y,F2.z);class Vj{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s={}){const{size:o=256,position:a=kj,renderTarget:l=null}=s;if(this._setSize(o),this._hasInitialized===!1){Oe('PMREMGenerator: ".fromScene()" called before the backend is initialized. Try using "await renderer.init()" instead.');const d=l||this._allocateTarget();return s.renderTarget=d,this.fromSceneAsync(e,t,n,r,s),d}L2=this._renderer.getRenderTarget(),I2=this._renderer.getActiveCubeFace(),B2=this._renderer.getActiveMipmapLevel();const u=l||this._allocateTarget();return u.depthBuffer=!0,this._init(u),this._sceneToCubeUV(e,n,r,u,a),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}async fromSceneAsync(e,t=0,n=.1,r=100,s={}){return zn('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1){Oe('PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using "await renderer.init()" instead.'),this._setSizeFromTexture(e);const n=t||this._allocateTarget();return this.fromEquirectangularAsync(e,n),n}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return zn('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1){Oe("PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const n=t||this._allocateTarget();return this.fromCubemapAsync(e,t),n}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return zn('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=IM(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=BM(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===Fo||e.mapping===Ra?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(L2,I2,B2),e.scissorTest=!1,oh(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),L2=this._renderer.getRenderTarget(),I2=this._renderer.getActiveCubeFace(),B2=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTarget();return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize;return LM(e,t)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=LM(e.width,e.height);const{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=qj(t)),this._blurMaterial=zj(t,e.width,e.height),this._ggxMaterial=Hj(t,e.width,e.height)}}async _compileMaterial(e){const t=new Qn(new Wn,e);await this._renderer.compile(t,pf)}
4100_sceneToCubeUV(e,t,n,r,s){const o=Oj;o.near=t,o.far=n;const a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],u=this._renderer,d=u.autoClear;u.getClearColor(DM),u.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Qn(new pu,new qs({name:"PMREM.Background",side:Xn,depthWrite:!1,depthTest:!1})));const p=this._backgroundBox,g=p.material;let x=!1;const y=e.background;y?y.isColor&&(g.color.copy(y),e.background=null,x=!0):(g.color.copy(DM),x=!0),u.setRenderTarget(r),u.clear(),x&&u.render(p,o);for(let T=0;T<6;T++){const S=T%3;S===0?(o.up.set(0,a[T],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x+l[T],s.y,s.z)):S===1?(o.up.set(0,0,a[T]),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y+l[T],s.z)):(o.up.set(0,a[T],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y,s.z+l[T]));const M=this._cubeSize;oh(r,S*M,T>2?M:0,M,M),u.render(e,o)}u.autoClear=d,e.background=y}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Fo||e.mapping===Ra;r?this._cubemapMaterial===null&&(this._cubemapMaterial=IM(e)):this._equirectMaterial===null&&(this._equirectMaterial=BM(e));const s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;const o=this._lodMeshes[0];o.material=s;const a=this._cubeSize;oh(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,pf)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;const l=Xm.get(o),u=n/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),p=Math.sqrt(u*u-d*d),g=0+u*1.25,x=p*g,{_lodMax:y}=this,T=this._sizeLods[n],S=3*T*(n>y-Kl?n-y+Kl:0),M=4*(this._cubeSize-T);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=y-t,oh(s,S,M,3*T,2*T),r.setRenderTarget(s),r.render(a,pf),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,oh(e,S,M,3*T,2*T),r.setRenderTarget(e),r.render(a,pf)}_blur(e,t,n,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){const l=this._renderer,u=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ke("blur direction must be either latitudinal or longitudinal!");const d=3,p=this._lodMeshes[r];p.material=u;const g=Xm.get(u),x=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*Hu-1),T=s/y,S=isFinite(s)?1+Math.floor(d*T):Hu;S>Hu&&Oe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Hu}`);const M=[];let R=0;for(let F=0;F<Hu;++F){const P=F/T,I=Math.exp(-P*P/2);M.push(I),F===0?R+=I:F<S&&(R+=2*I)}for(let F=0;F<M.length;F++)M[F]=M[F]/R;e.texture.frame=(e.texture.frame||0)+1,g.envMap.value=e.texture,g.samples.value=S,g.weights.array=M,g.latitudinal.value=o==="latitudinal"?1:0,a&&(g.poleAxis.value=a);const{_lodMax:E}=this;g.dTheta.value=y,g.mipInt.value=E-n;const N=this._sizeLods[r],U=3*N*(r>E-Kl?r-E+Kl:0),L=4*(this._cubeSize-N);oh(t,U,L,3*N,2*N),l.setRenderTarget(t),l.render(p,pf)}}function qj(i){const e=[],t=[],n=[];let r=i;const s=i-Kl+1+PM.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Kl?l=PM[o-i+Kl-1]:o===0&&(l=0),t.push(l);const u=1/(a-2),d=-u,p=1+u,g=[d,d,p,d,p,p,d,d,p,p,d,p],x=6,y=6,T=3,S=2,M=1,R=new Float32Array(T*y*x),E=new Float32Array(S*y*x),N=new Float32Array(M*y*x);for(let L=0;L<x;L++){const F=L%3*2/3-1,P=L>2?0:-1,I=[F,P,0,F+2/3,P,0,F+2/3,P+1,0,F,P,0,F+2/3,P+1,0,F,P+1,0],$=Gj[L];R.set(I,T*y*$),E.set(g,S*y*$);const k=[$,$,$,$,$,$];N.set(k,M*y*$)}const U=new Wn;U.setAttribute("position",new Di(R,T)),U.setAttribute("uv",new Di(E,S)),U.setAttribute("faceIndex",new Di(N,M)),n.push(new Qn(U,null)),r>Kl&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function LM(i,e){const t={magFilter:li,minFilter:li,generateMipmaps:!1,type:Mi,format:Wi,colorSpace:au},n=new Ba(i,e,t);return n.texture.mapping=ac,n.texture.name="PMREM.cubeUv",n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function oh(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Ug(i){const e=new Vi;return e.depthTest=!1,e.depthWrite=!1,e.blending=gr,e.name=`PMREM_${i}`,e}function zj(i,e,t){const n=Gr(new Array(Hu).fill(0)),r=Ct(new J(0,1,0)),s=Ct(0),o=Z(Hu),a=Ct(0),l=Ct(1),u=On(),d=Ct(0),p=Z(1/e),g=Z(1/t),x=Z(i),y={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:Fg,dTheta:s,samples:l,envMap:u,mipInt:d,CUBEUV_TEXEL_WIDTH:p,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:x},T=Ug("blur");return T.fragmentNode=a5({...y,latitudinal:a.equal(1)}),Xm.set(T,y),T}function Hj(i,e,t){const n=On(),r=Ct(0),s=Ct(0),o=Z(1/e),a=Z(1/t),l=Z(i),u={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,
4100CUBEUV_MAX_MIP:l},d=Ug("ggx");return d.fragmentNode=l5({...u,N_immutable:Fg,GGX_SAMPLES:Ge(Uj)}),Xm.set(d,u),d}function IM(i){const e=Ug("cubemap");return e.fragmentNode=os(i,Fg),e}function BM(i){const e=Ug("equirect");return e.fragmentNode=On(i,i3(Fg),0),e}const FM=new WeakMap;function Wj(i){const e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:t,maxMip:e}}function $j(i,e,t){const n=jj(e);let r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){const o=i.image;if(i.isCubeTexture)if(Qj(o))r=t.fromCubemap(i,r);else return null;else if(Yj(o))r=t.fromEquirectangular(i,r);else return null;r.pmremVersion=i.pmremVersion,n.set(i,r)}return r.texture}function jj(i){let e=FM.get(i);return e===void 0&&(e=new WeakMap,FM.set(i,e)),e}class Xj extends qi{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;const r=new tr;r.isRenderTargetTexture=!0,this._texture=On(r),this._width=Ct(0),this._height=Ct(0),this._maxMip=Ct(0),this.updateBeforeType=tn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=Wj(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem;const n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(r.isPMREMTexture===!0?t=r:t=$j(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new Vj(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=$y.mul(ae(t.x,t.y.negate(),t.z));let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),o5(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}}function Qj(i){if(i==null)return!1;let e=0;const t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function Yj(i){return i==null?!1:i.height>0}const l3=hn(Xj).setParameterLength(1,3),UM=new WeakMap;class Kj extends GA{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){const p=n.isTextureNode?n.value:t[n.property],g=this._getPMREMNodeCache(e.renderer);let x=g.get(p);x===void 0&&(x=l3(p),g.set(p,x)),n=x}const s=t.useAnisotropy===!0||t.anisotropy>0?ZC:In,o=n.context(OM(ua,s)).mul(Jp),a=n.context(Zj(xu)).mul(Math.PI).mul(Jp),l=Oh(o),u=Oh(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(u);const d=e.context.lightingModel.clearcoatRadiance;if(d){const p=n.context(OM(Fh,Hl)).mul(Jp),g=Oh(p);d.addAssign(g)}}_getPMREMNodeCache(e){let t=UM.get(e);return t===void 0&&(t=new WeakMap,UM.set(e,t)),t}}const OM=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=ai.negate().reflect(e),t=Ry(i).mix(t,e).normalize(),t=t.transformDirection(go)),t),getTextureLevel:()=>i}},Zj=i=>({getUV:()=>i,getTextureLevel:()=>Z(1)}),Jj=new vE;class u5 extends Vi{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(Jj),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new Kj(t):null}setupLightingModel(){return new r5}setupSpecular(){const e=Mn(ae(.04),Kn.rgb,el);cu.assign(ae(.04)),Yu.assign(e),Ku.assign(1)}setupVariants(){const e=this.metalnessNode?Z(this.metalnessNode):a8;el.assign(e);let t=this.roughnessNode?Z(this.roughnessNode):o8;t=s3({roughness:t}),ua.assign(t),this.setupSpecular(),zu.assign(Kn.rgb.mul(e.oneMinus()))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const eX=new PD;class tX extends u5{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(eX),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){const e=this.iorNode?Z(this.iorNode):y8;$f.assign(e),cu.assign(Rs(Ey($f.sub(1).div($f.add(1))).mul(s8),ae(1)).mul(wx)),Yu.assign(Mn(cu,Kn.rgb,el)),Ku.assign(Mn(wx,1,el))}setupLightingModel(){return new r5(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?Z(this.clearcoatNode):u8,n=this.clearcoatRoughnessNode?Z(this.clearcoatRoughnessNode):c8;km.assign(t),Fh.assign(s3({roughness:n}))}if(this.useSheen){const t=this.sheenNode?ae(this.sheenNode):f8,n=this.sheenRoughnessNode?Z(this.sheenRoughnessNode):d8;Os.assign(t),Vl.assign(n)}if(this.useIridescence){const t=this.iridescenceNode?Z(this.iridescenceNode):m8,n=this.iridescenceIORNode?Z(this.iridescenceIORNode):g8,r=this.iridescenceThicknessNode?Z(this.iridescenceThicknessNode):_8;yg.assign(t),Gm.assign(n),Vm.assign(r)}if(this.useAnisotropy){const t=(this.anisotropyNode?je(this.anisotropyNode):p8).toVar();kl.assign(t.length()),Ft(kl.equal(0),()=>{t.assign(je(1,0))}).Else(()=>{t.divAssign(je(kl)),kl.assign(kl.saturate())}),qm.assign(kl.pow2().mix(ua.pow2(),1)),Wf.assign(Zu[0].mul(t.x).add(Zu[1].mul(t.y))),rc.assign(Zu[1].mul(t.x).sub(Zu[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?Z(this.transmissionNode):x8,n=this.thicknessNode?Z(this.thicknessNode):v8,r=this.attenuationDistanceNode?Z(this.attenuationDistanceNode):b8,s=this.attenuationColorNode?ae(this.attenuationColorNode):S8;if(Hm.assign(t),cy.assign(n),hy.assign(r),Ay.assign(s),this.useDispersion){const o=this.dispersionNode?Z(this.dispersionNode):C8;fy.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?ae(this.clearcoatNormalNode):h8}setup(e){e.context.setupClearcoatNormal=()=>sc(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.iorNode=e.iorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dis
4100persionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}const nX=ce(({normal:i,lightDirection:e,builder:t})=>{const n=i.dot(e),r=je(n.mul(.5).add(.5),0);if(t.material.gradientMap){const s=Ka("gradientMap","texture").context({getUV:()=>r});return ae(s.r)}else{const s=r.fwidth().mul(.5);return Mn(ae(.7),ae(1),Go(Z(.7).sub(s.x),Z(.7).add(s.x),r.x))}});class iX extends Ig{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){const s=nX({normal:Rg,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(_c({diffuseColor:Kn.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(_c({diffuseColor:Kn}))),r.indirectDiffuse.mulAssign(t)}}const rX=new DD;class sX extends Vi{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(rX),this.setValues(e)}setupLightingModel(){return new iX}}const c5=ce(()=>{const i=ae(ai.z,0,ai.x.negate()).normalize(),e=ai.cross(i);return je(i.dot(In),e.dot(In)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),oX=new FD;class aX extends Vi{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(oX),this.setValues(e)}setupVariants(e){const t=c5;let n;e.material.matcap?n=Ka("matcap","texture").context({getUV:()=>t}):n=ae(Mn(.2,.8,t.y)),Kn.rgb.mulAssign(n.rgb)}}class lX extends qi{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){const s=t.cos(),o=t.sin();return vg(s,o,o.negate(),s).mul(n)}else{const s=t,o=iu(Lt(1,0,0,0),Lt(0,Ro(s.x),rs(s.x).negate(),0),Lt(0,rs(s.x),Ro(s.x),0),Lt(0,0,0,1)),a=iu(Lt(Ro(s.y),0,rs(s.y),0),Lt(0,1,0,0),Lt(rs(s.y).negate(),0,Ro(s.y),0),Lt(0,0,0,1)),l=iu(Lt(Ro(s.z),rs(s.z).negate(),0,0),Lt(rs(s.z),Ro(s.z),0,0),Lt(0,0,1,0),Lt(0,0,0,1));return o.mul(a).mul(l).mul(Lt(n,1)).xyz}}}const jd=hn(lX).setParameterLength(2),uX=new z7;class h5 extends Vi{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(uX),this.setValues(e)}setupPositionView(e){const{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=_u.mul(ae(r||0));let u=je(ao[0].xyz.length(),ao[1].xyz.length());o!==null&&(u=u.mul(je(o))),n.isPerspectiveCamera&&a===!1&&(u=u.mul(l.z.negate()));let d=$d.xy;if(t.center&&t.center.isVector2===!0){const x=sW("center","vec2",t);d=d.sub(x.sub(.5))}d=d.mul(u);const p=Z(s||A8),g=jd(d,p);return Lt(l.xy.add(g),l.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}const cX=new hd,hX=new We;class AX extends h5{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(cX),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return _u.mul(ae(e||Pi)).xyz}setupVertexSprite(e){const{material:t,camera:n}=e,{rotationNode:r,scaleNode:s,sizeNode:o,sizeAttenuation:a}=this;let l=super.setupVertex(e);if(t.isNodeMaterial!==!0)return l;let u=o!==null?je(o):R8;u=u.mul(MC),n.isPerspectiveCamera&&a===!0&&(u=u.mul(fX.div(Hi.z.negate()))),s&&s.isNode&&(u=u.mul(je(s)));let d=$d.xy;if(r&&r.isNode){const p=Z(r);d=jd(d,p)}return d=d.mul(u),d=d.div(qy.div(2)),d=d.mul(l.w),l=l.add(Lt(d,0,0)),l}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const fX=Ct(1).onFrameUpdate(function({renderer:i}){const e=i.getSize(hX);this.value=.5*e.y});class dX extends Ig{constructor(){super(),this.shadowNode=Z(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Kn.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Kn.rgb)}}const pX=new wD;class mX extends Vi{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(pX),this.setValues(e)}setupLightingModel(){return new dX}}sl("vec3");sl("vec3");sl("vec3");class gX{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){const e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(
4100),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class hu{constructor(){this.weakMaps={}}_getWeakMap(e){const t=e.length;let n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let r=0;r<e.length-1;r++){const s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}}let _X=0;function xX(i){const e=Object.keys(i);let t=Object.getPrototypeOf(i);for(;t;){const n=Object.getOwnPropertyDescriptors(t);for(const r in n)if(n[r]!==void 0){const s=n[r];s&&typeof s.get=="function"&&e.push(r)}t=Object.getPrototypeOf(t)}return e}class vX{constructor(e,t,n,r,s,o,a,l,u,d){this.id=_X++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=o,this.camera=a,this.lightsNode=l,this.context=u,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=d,this.clippingContextCacheKey=d!==null?d.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.material.hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(const t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,s={};for(const o of e){let a;if(o.node&&o.node.attribute?a=o.node.attribute:(a=t.getAttribute(o.name),s[o.name]=a.id),a===void 0)continue;n.push(a);const l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.attributesId=s,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:n,group:r,drawRange:s}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),l=a!==null;let u=1;if(n.isInstancedBufferGeometry===!0?u=n.instanceCount:e.count!==void 0&&(u=Math.max(0,e.count)),u===0)return null;if(o.instanceCount=u,e.isBatchedMesh===!0)return o;let d=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(d=2);let p=s.start*d,g=(s.start+s.count)*d;r!==null&&(p=Math.max(p,r.start*d),g=Math.min(g,(r.start+r.count)*d));const x=n.attributes.position;let y=1/0;l?y=a.count:x!=null&&(y=x.count),p=Math.max(p,0),g=Math.min(g,y);const T=g-p;
4100return T<0||T===1/0?null:(o.vertexCount=T,o.firstVertex=p,o)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const n of Object.keys(e.attributes).sort()){const r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(const n of Object.keys(e.morphAttributes).sort()){const r=e.morphAttributes[n];t+="morph-"+n+",";for(let s=0,o=r.length;s<o;s++){const a=r[s];t+=a.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){const{object:e,material:t,renderer:n}=this;let r=t.customProgramCacheKey();for(const s of xX(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;const o=t[s];let a;if(o!==null){const l=typeof o;l==="number"?a=o!==0?"1":"0":l==="object"?(a="{",o.isTexture&&(a+=o.mapping,n.backend.isWebGPUBackend===!0&&(a+=o.magFilter,a+=o.minFilter,a+=o.wrapS,a+=o.wrapT,a+=o.wrapR)),a+="}"):a=String(o)}else a=String(o);r+=a+","}return r+=this.clippingContextCacheKey+",",e.geometry&&(r+=this.getGeometryCacheKey()),e.skeleton&&(r+=e.skeleton.bones.length+","),e.isBatchedMesh&&(r+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(r+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1||Array.isArray(e.morphTargetInfluences))&&(r+=e.uuid+","),r+=this.context.id+",",r+=e.receiveShadow+",",OA(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){const e=this.attributesId;for(const t in e){const n=this.geometry.getAttribute(t);if(n===void 0||e[t]!==n.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=zf(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=zf(e,1)),e=zf(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}const ea=[];class yX{constructor(e,t,n,r,s,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=o,this.chainMaps={}}get(e,t,n,r,s,o,a,l){const u=this.getChainMap(l);ea[0]=e,ea[1]=t,ea[2]=o,ea[3]=s;let d=u.get(ea);return d===void 0?(d=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),u.set(ea,d)):(d.camera=r,d.updateClipping(a),d.needsGeometryUpdate&&d.setGeometry(e.geometry),(d.version!==t.version||d.needsUpdate)&&(d.initialCacheKey!==d.getCacheKey()?(d.dispose(),d=this.get(e,t,n,r,s,o,a,l)):d.version=t.version)),ea[0]=null,ea[1]=null,ea[2]=null,ea[3]=null,d}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new hu)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,u,d,p){const g=this.getChainMap(p),x=new vX(e,t,n,r,s,o,a,l,u,d);return x.onDispose=()=>{this.pipelines.delete(x),this.bindings.deleteForRender(x),this.nodes.delete(x),g.delete(x.getChainArray())},x}}class vu{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const lo={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},Wl=16,bX=211,SX=212;class TX extends vu{constructor(e){super(),this.backend=e}delete(e){const t=super.delete(e);return t!==null&&this.backend.destroyAttribute(e),t}update(e,t){const n=this.get(e);if(n.version===void 0)t===lo.VERTEX?this.backend.createAttribute(e):t===lo.INDEX?this.backend.createIndexAttribute(e):t===lo.STORAGE?this.backend.createStorageAttribute(e):t===lo.INDIRECT&&this.backend.createIndirectStorageAttribute(e),n.version=this._getBufferAttribute(e).version;else{const r=this._getBufferAttribute(e);(n.version<r.version||r.usage===ld)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}function A5(i){return i.index!==null?i.index.version:i.attributes.position.version}function f5(i){return i.index!==null?i.index.id:i.attributes.position.id}function kM(i){const e=[],t=i.index,n=i.attributes.position;if(t!==null){const s=t.array;for(let o=0,a=s.length;o<a;o+=3){const l=s[o+0],u=s[o+1],d=s[o+2];e.push(l,u,u,d,d,l)}}else{const s=n.array;for(let o=0,a=s.length/3-1;o<a;o+=3){const l=o+0,u=o+1,d=o+2;e.push(l,u,u,d,d,l)}}const r=new(n.count>=65535?vv:xv)(e,1);return r.version=A5(i),r.__id=f5(i),r}class MX extends vu{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){const t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){const t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;const r=()=>{this.info.memory.geometries--;const s=t.index,o=e.getAttributes();s!==null&&this.attributes.delete(s);for(const l of o)this.attributes.delete(l);const a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){const t=e.getAttributes();for(const s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,lo.STORAGE):this.updateAttribute(s,lo.VERTEX);const n=this.getIndex(e);n!==null&&this.updateAttribute(n,lo.INDEX);const r=e.geometry.indirect;r!==null&&this.updateAttribute(r,lo.INDIRECT)}updateAttribute(e,t){const n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){const{geometry:t,material:n}=e;let r=t.index;if(n.wireframe===!0){const s=this.wireframes;let o=s.get(t);o===void 0?(o=kM(t),s.set(t,o)):(o.version!==A5(t)||o.__id!==f5(t))&&(this.attributes.delete(o),o=kM(t),s.set(t,o)),r=o}return r}dispose(){for(const[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}}class wX{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={geometries:0,textures:0}}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):ke("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0,this.memory.geometries=0,this.memory.textures=0}}class d5{constructor(e){this.cacheKey=e,this.usedTimes=0}}class EX extends d5{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}}class RX extends d5{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let CX=0;class U2{constructor(e,t,n,r=null,s=null){this.id=CX++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}}class NX extends vu{constructor(e,t){super(),this.backend=e,this.nodes=t,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){const s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);const o=this.nodes.getForCompute(e);let a=this.programs.compute.get(o.computeShader);a===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),a=new U2(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,a),n.createProgram(a));const l=this._getComputeCacheKey(e,a);let u=this.caches.get(l);u===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),u=this._getComputePipeline(e,a,l,t)),u.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=u}return r.pipeline}getForRender(e,t=null){const{backend:n}=this,r=this.get(e);
4100if(this._needsRenderUpdate(e)){const s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);const o=e.getNodeBuilderState(),a=e.material?e.material.name:"";let l=this.programs.vertex.get(o.vertexShader);l===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),l=new U2(o.vertexShader,"vertex",a),this.programs.vertex.set(o.vertexShader,l),n.createProgram(l));let u=this.programs.fragment.get(o.fragmentShader);u===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),u=new U2(o.fragmentShader,"fragment",a),this.programs.fragment.set(o.fragmentShader,u),n.createProgram(u));const d=this._getRenderCacheKey(e,l,u);let p=this.caches.get(d);p===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),p=this._getRenderPipeline(e,l,u,d,t)):e.pipeline=p,p.usedTimes++,l.usedTimes++,u.usedTimes++,r.pipeline=p}return r.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new RX(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let o=this.caches.get(r);return o===void 0&&(o=new EX(r,t,n),this.caches.set(r,o),e.pipeline=o,this.backend.createRenderPipeline(e,s)),o}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,n=e.stage;this.programs[n].delete(t)}_needsComputeUpdate(e){const t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}}class PX extends vu{constructor(e,t,n,r,s,o){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const n of t){const r=this.get(n);r.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),r.bindGroup=n)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const n of t){const r=this.get(n);r.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),r.bindGroup=n)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const n of t)this.backend.deleteBindGroupData(n),this.delete(n)}deleteForRender(e){const t=e.getBindings();for(const n of t)this.backend.deleteBindGroupData(n),this.delete(n)}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isSampler)this.textures.updateSampler(t.texture);else if(t.isStorageBuffer){const n=t.attribute,r=n.isIndirectStorageBufferAttribute?lo.INDIRECT:lo.STORAGE;this.attributes.update(n,r)}}_update(e,t){const{backend:n}=this;let r=!1,s=!0,o=0,a=0;for(const l of e.bindings)if(this.nodes.updateGroup(l)!==!1){if(l.isStorageBuffer){const d=l.attribute,p=d.isIndirectStorageBufferAttribute?lo.INDIRECT:lo.STORAGE,g=n.get(l);this.attributes.update(d,p),g.attribute!==d&&(g.attribute=d,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){const d=l.update(),p=l.texture,g=this.textures.get(p);if(d&&(this.textures.updateTexture(p),l.generation!==g.generation&&(l.generation=g.generation,r=!0),g.bindGroups.add(e)),n.get(p).externalTexture!==void 0||g.isDefaultTexture?s=!1:(o=o*10+p.id,a+=p.version),p.isStorageTexture===!0&&p.mipmapsAutoUpdate===!0){const y=this.get(p);l.store===!0?y.needsMipmap=!0:this.textures.needsMipmaps(p)&&y.needsMipmap===!0&&(this.backend.generateMipmaps(p),y.needsMipmap=!1)}}
4100else if(l.isSampler&&l.update()){const p=this.textures.updateSampler(l.texture);l.samplerKey!==p&&(l.samplerKey=p,r=!0)}l.isBuffer&&l.updateRanges.length>0&&l.clearUpdateRanges()}r===!0&&this.backend.updateBindings(e,t,s?o:0,a)}}function DX(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?i.z-e.z:i.id-e.id}function GM(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function VM(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===Ui&&i.forceSinglePass===!1}class LX{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,n),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,o,a){let l=this.renderItems[this.renderItemsIndex];return l===void 0?(l={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:o,clippingContext:a},this.renderItems[this.renderItemsIndex]=l):(l.id=e.id,l.object=e,l.geometry=t,l.material=n,l.groupOrder=r,l.renderOrder=e.renderOrder,l.z=s,l.group=o,l.clippingContext=a),this.renderItemsIndex++,l}push(e,t,n,r,s,o,a){const l=this.getNextRenderItem(e,t,n,r,s,o,a);e.occlusionTest===!0&&this.occlusionQueryCount++,n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(VM(n)&&this.transparentDoublePass.push(l),this.transparent.push(l)):this.opaque.push(l)}unshift(e,t,n,r,s,o,a){const l=this.getNextRenderItem(e,t,n,r,s,o,a);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(VM(n)&&this.transparentDoublePass.unshift(l),this.transparent.unshift(l)):this.opaque.unshift(l)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||DX),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||GM),this.transparent.length>1&&this.transparent.sort(t||GM)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){const n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}}}const ah=[];class IX{constructor(e){this.lighting=e,this.lists=new hu}get(e,t){const n=this.lists;ah[0]=e,ah[1]=t;let r=n.get(ah);return r===void 0&&(r=new LX(this.lighting,e,t),n.set(ah,r)),ah[0]=null,ah[1]=null,r}dispose(){this.lists=new hu}}let BX=0;class FX{constructor(){this.id=BX++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new rn,this.scissor=!1,this.scissorValue=new rn,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return p5(this)}}function p5(i){const{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(const s of e)r.push(s.id);return qd(r)}class UX{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,n=0){let r;if(e===null)r="default";else{const l=e.texture.format,u=e.texture.type;r=`${e.textures.length}:${l}:${u}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}const s=t!==null?t.id:"default",o=r+"-"+s+"-"+n;let a=this._renderContexts[o];return a===void 0&&(a=new FX,a.mrt=t,this._renderContexts[o]=a),e!==null&&(a.sampleCount=e.samples===0?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}}const OX=new J;class kX extends vu{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n}updateRenderTarget(e,t=0){const n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,a=this.getSize(o[0]),l=a.width>>t,u=a.height>>t;let d=e.depthTexture||s[t];const p=e.depthBuffer===!0||e.stencilBuffer===!0;let g=!1;
4100d===void 0&&p&&(d=new qr,d.format=e.stencilBuffer?as:Rr,d.type=e.stencilBuffer?Hs:ii,d.image.width=l,d.image.height=u,d.image.depth=a.depth,d.renderTarget=e,d.isArrayTexture=e.multiview===!0&&a.depth>1,s[t]=d),(n.width!==a.width||a.height!==n.height)&&(g=!0,d&&(d.needsUpdate=!0,d.image.width=l,d.image.height=u,d.image.depth=d.isArrayTexture?d.image.depth:1)),n.width=a.width,n.height=a.height,n.textures=o,n.depthTexture=d||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(g=!0,d&&(d.needsUpdate=!0),n.sampleCount=r);const x={sampleCount:r};if(e.isXRRenderTarget!==!0){for(let y=0;y<o.length;y++){const T=o[y];g&&(T.needsUpdate=!0),this.updateTexture(T,x)}d&&this.updateTexture(d,x)}n.initialized!==!0&&(n.initialized=!0,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){const n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;const r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){const u=this.renderer.getRenderTarget();u?e.type=u.texture.type:e.type=yi}const{width:o,height:a,depth:l}=this.getSize(e);if(t.width=o,t.height=a,t.depth=l,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),n.generation=e.version;else if(e.version>0){const u=e.image;if(u===void 0)Oe("Renderer: Texture marked for update but image is undefined.");else if(u.complete===!1)Oe("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const p=[];for(const g of e.images)p.push(g);t.images=p}else t.image=u;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);const d=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!d&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,n.bindGroups=new Set,this.info.memory.textures++,e.isVideoTexture&&Yt.enabled===!0&&Yt.getTransfer(e.colorSpace)!==_t&&Oe("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=OX){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.mipmaps.length>0?r=e.mipmaps.length:e.isCompressedTexture===!0?r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){const t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let s=0;s<n.length;s++)this._destroyTexture(n[s]);r&&this._destroyTexture(r),this.delete(e),this.backend.delete(e)}}_destroyTexture(e){if(this.has(e)===!0){const t=this.get(e);e.removeEventListener("dispose",t.onDispose);const n=t.isDefaultTexture;if(this.backend.destroyTexture(e,n),t.bindGroups)for(const r of t.bindGroups){const s=this.backend.get(r);s.groups=void 0,s.versions=void 0}this.delete(e),this.info.memory.textures--}}}class u3 extends It{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}}class m5 extends $n{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){const n=this.getNodeType(e),r=e.getStructTypeNode(n);let s;return r!==null?s=r.getMemberType(e,t):(ke(`TSL: Member "${t}" not found in struct "${n}".`,new $i),s="float"),s}getHash(){return this.uuid}generate(){return this.name}}const GX=(i,e)=>new m5(i,e);class VX extends vt{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this.isStackNode=!0}getElementType(e){return this.hasOutput(e)?this.outputNode.getElementType(e):"void"}getNodeType(e){return this.hasOutput(e)?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.hasOutput(e)?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=this.nodes.length){return e.isNode!==!0?(ke("TSL: Invalid node added to stack.",new $i),this):(this.nodes.splice(t,0,e),this)}addToStackBefore(e){const t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){const n=new wh(t);return this._currentCond=Vr(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){const n=new wh(t),r=Vr(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new wh(e),this}Switch(e){return this._expressionNode=xt(e),this}Case(...e){const t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(xt(e[a])));else ke("TSL: Invalid parameter length. Case() requires at least two parameters.",new $i);const n=e[e.length-1],r=new wh(n);let s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);const o=Vr(s,r);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t["node"+n++]=r);return t.outputNode||null}hasOutput(e){return this.outputNode&&this.outputNode.isNode&&this.outputNode.getNodeType(e)!=="void"}build(e,...t){const n=ry(),r=e.buildStage;Ed(this),e.setActiveStack(this);const s=u=>{if(this._currentNode=u,!(u.isVarNode&&u.isIntent(e)&&u.isAssign(e)!==!0)){if
4100(r==="setup")u.build(e);else if(r==="analyze")u.build(e,this);else if(r==="generate"){const d=e.getDataFromNode(u,"any").stages,p=d&&d[e.shaderStage];if(u.isVarNode&&p&&p.length===1&&p[0]&&p[0].isStackNode)return;u.build(e,"void")}}},o=[...this.nodes];for(const u of o)s(u);this._currentNode=null;const a=this.nodes.filter(u=>o.indexOf(u)===-1);for(const u of a)s(u);let l;return this.hasOutput(e)?l=this.outputNode.build(e,...t):l=super.build(e,...t),Ed(n),e.removeActiveStack(this),l}}const tm=hn(VX).setParameterLength(0,1);function qX(i){return Object.entries(i).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}class zX extends vt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=qX(e),this.name=t,this.isStructLayoutNode=!0}getLength(){const e=Float32Array.BYTES_PER_ELEMENT;let t=1,n=0;for(const r of this.membersLayout){const s=r.type,o=AH(s),a=fH(s)/e;t=Math.max(t,a);const u=n%t%a;u!==0&&(n+=a-u),n+=o}return Math.ceil(n/t)*t}getMemberType(e,t){const n=this.membersLayout.find(r=>r.name===t);return n?n.type:"void"}getNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class HX extends vt{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}getNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){const e=super._getChildren(),t=e.find(n=>n.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){const t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}const WX=(i,e=null)=>{const t=new zX(i,e),n=(...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};const o=Object.keys(i);for(let a=0;a<r.length;a++)s[o[a]]=r[a]}else s=r[0];return new HX(t,s)};return n.layout=t,n.isStruct=!0,n};class g5 extends vt{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}getNodeType(){return"OutputType"}generate(e){const t=e.getDataFromNode(this);if(t.membersLayout===void 0){const o=this.members,a=[];for(let l=0;l<o.length;l++){const u="m"+l,d=o[l].getNodeType(e);a.push({name:u,type:d,index:l})}t.membersLayout=a,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}const n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let o=0;o<r.length;o++){const a=r[o].build(e);e.addLineFlowCode(`${s}m${o} = ${a}`,this)}return n}}const $X=hn(g5);class _5{constructor(e=mr){this.blending=e,this.blendSrc=Gh,this.blendDst=Vh,this.blendEquation=Mr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,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.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}}const jX=new _5(gr),XX=new _5(zx);function x5(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}class QX extends g5{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:XX},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||jX}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){const t={...this.outputNodes,...e.outputNodes},n={...this.blendModes,...e.blendModes},r=v5(t);return r.blendings=n,r}setup(e){const t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(const o in t){const a=x5(s,o);r[a]=Lt(t[o])}return this.members=r,super.setup(e)}}const v5=hn(QX);class Xd extends qi{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}getNodeType(e){if(this.inputType!==null){const t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){const t=this.getNodeType(e);let n="";if(this.inputType!==null){const r=this.valueNode.getNodeType(e);n=e.getTypeLength(r)===1?this.inputType:e.changeComponentType(r,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}}const y5=Ze(Xd).setParameterLength(2),YX=i=>new Xd(i,"int","float"),b5=i=>new Xd(i,"uint","float"),KX=i=>new Xd(i,"float","int"),ZX=i=>new Xd(i,"float","uint"),fp={};class Ws extends ve{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(y5(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return Ge;case"int":return oe;case"uvec2":return sy;case"uvec3":return Sc;case"uvec4":return uy;case"ivec2":return er;case"ivec3":return oy;case"ivec4":return ly}}_createTrailingZerosBaseLayout(e,t){const n=this._returnDataNode(t);return ce(([s])=>{const o=Ge(0);this._resolveElementType(s,o,t);const a=Z(o.bitAnd(by(o))),u=b5(a).shiftRight(23).sub(127);return n(u)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){const n=this._returnDataNode(t);return ce(([s])=>{Ft(s.equal(Ge(0)),()=>Ge(32));const o=Ge(0),a=Ge(0);return this._resolveElementType(s,o,t),Ft(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),Ft(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),Ft(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),Ft(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),Ft(o.shiftRight(31).equal(0),()=>{a.addAssign(1)}),n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){const n=this._returnDataNode(t);return ce(([s])=>{const o=Ge(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(Ge(1)).bitAnd(Ge(1431655765)))),o.assign(o.bitAnd(Ge(858993459)).add(o.shiftRight(Ge(2)).bitAnd(Ge(858993459))));const a=o.add(o.shiftRight(Ge(4))).bitAnd(Ge(252645135)).mul(Ge(16843009)).shiftRight(Ge(24));return n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,r){const s=this._returnDataNode(t);return ce(([a])=>{if(n===1)return s(r(a));{const l=s(0),u=["x","y","z","w"];for(let d=0;d<n;d++){const p=u[d];l[p].assign(r(a[p]))}return l}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){const{method:t,aNode:n}=this,{renderer:r}=e;if(r.backend.isWebGPUBackend)return super.setup(e);const s=this.getInputType(e),o=e.getElementType(s),a=e.getTypeLength(s),l=`${t}_base_${o}`,u=`${t}_${s}`;let d=fp[l];if(d===void 0){switch(t){case Ws.COUNT_LEADING_ZEROS:{d=this._createLeadingZerosBaseLayout(l,o);break}case Ws.COUNT_TRAILING_ZEROS:{d=this._createTrailingZerosBaseLayout(l,o);break}case Ws.COUNT_ONE_BITS:{d=this._createOneBitsBaseLayout(l,o);break}}fp[l]=d}let p=fp[u];return p===void 0&&(p=this._createMainLayout(u,s,a,d),fp[u]=p),ce(()=>p(n))()}}Ws.COUNT_TRAILING_ZEROS="countTrailingZeros";Ws.COUNT_LEADING_ZEROS="countLeadingZeros";Ws.COUNT_ONE_BITS="countOneBits";const JX=Ze(Ws,Ws.COUNT_TRAILING_ZEROS).setParameterLength(1),eQ=Ze(Ws,Ws.COUNT_LEADING_ZEROS).setParameterLength(1),tQ=Ze(Ws,Ws.COUNT_ONE_BITS).setParameterLength(1),nQ=ce(([i])=>{const e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);
vendor: 1,815 bytes, line 4100
4100return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),Px=(i,e)=>oo(sn(4,i.mul(Rn(1,i))),e),iQ=(i,e)=>i.lessThan(.5)?Px(i.mul(2),e).div(2):Rn(1,Px(sn(Rn(1,i),2),e).div(2)),rQ=(i,e,t)=>oo(js(oo(i,e),Qi(oo(i,e),oo(Rn(1,i),t))),1/e),sQ=(i,e)=>rs(Wm.mul(e.mul(i).sub(1))).div(Wm.mul(e.mul(i).sub(1)));class c3 extends qi{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}getNodeType(){return"uint"}generate(e){const t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}}const oQ=Ze(c3,"snorm").setParameterLength(1),aQ=Ze(c3,"unorm").setParameterLength(1),lQ=Ze(c3,"float16").setParameterLength(1);class h3 extends qi{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}getNodeType(){return"vec2"}generate(e){const t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}}const uQ=Ze(h3,"snorm").setParameterLength(1),cQ=Ze(h3,"unorm").setParameterLength(1),hQ=Ze(h3,"float16").setParameterLength(1),Qa=ce(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),AQ=ce(([i])=>ae(Qa(i.z.add(Qa(i.y.mul(1)))),Qa(i.z.add(Qa(i.x.mul(1)))),Qa(i.y.add(Qa(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),fQ=ce(([i,e,t])=>{const n=ae(i).toVar(),r=Z(1.4).toVar(),s=Z(0).toVar(),o=ae(n).toVar();return Zn({start:Z(0),end:Z(3),type:"float",condition:"<="},()=>{const a=ae(AQ(o.mul(2))).toVar();n.addAssign(a.add(t.mul(Z(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);const l=Z(Qa(n.z.add(Qa(n.x.add(Qa(n.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}
4100).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class dQ extends vt{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}getNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){const t=this.parametersNodes;let n=this._candidateFn;if(n===null){let r=null,s=-1;for(const o of this.functionNodes){const l=o.shaderNode.layout;if(l===null)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const u=l.inputs;if(t.length===u.length){let d=0;for(let p=0;p<t.length;p++){const g=t[p],x=u[p];g.getNodeType(e)===x.type&&d++}d>s&&(r=o,s=d)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}const pQ=hn(dQ),Dr=i=>(...e)=>pQ(i,...e),VA=Ct(0).setGroup(Dt).onRenderUpdate(i=>i.time),mQ=Ct(0).setGroup(Dt).onRenderUpdate(i=>i.deltaTime),S5=Ct(0,"uint").setGroup(Dt).onRenderUpdate(i=>i.frameId),gQ=(i=VA)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),_Q=(i=VA)=>i.fract().round(),xQ=(i=VA)=>i.add(.5).fract().mul(2).sub(1).abs(),vQ=(i=VA)=>i.fract();function yQ(i,e=null){return pl(e,{getUV:typeof i=="function"?i:()=>i})}const bQ=ce(([i,e,t=je(.5)])=>jd(i.sub(t),e).add(t)),SQ=ce(([i,e,t=je(.5)])=>{const n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),TQ=ce(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=ao.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=ao;const r=go.mul(n);return wd(e)&&(r[0][0]=ao[0].length(),r[0][1]=0,r[0][2]=0),wd(t)&&(r[1][0]=0,r[1][1]=ao[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,ol.mul(r).mul(Pi)}),MQ=ce(([i=null])=>{const e=jm();return jm(Zy(i)).sub(e).lessThan(0).select(Ta,i)}),wQ=ce(([i,e=ri(),t=Z(0)])=>{const n=i.x,r=i.y,s=t.mod(n.mul(r)).floor(),o=s.mod(n),a=r.sub(s.add(1).div(n).ceil()),l=i.reciprocal(),u=je(o,a);return e.add(u).mul(l)}),T5=ce(([i,e=null,t=null,n=Z(1),r=Pi,s=Cs])=>{let o=s.abs().normalize();o=o.div(o.dot(ae(1)));const a=r.yz.mul(n),l=r.zx.mul(n),u=r.xy.mul(n),d=i.value,p=e!==null?e.value:d,g=t!==null?t.value:d,x=On(d,a).mul(o.x),y=On(p,l).mul(o.y),T=On(g,u).mul(o.z);return Qi(x,y,T)}),EQ=(...i)=>T5(...i),lh=new oa,Bu=new J,uh=new J,O2=new J,mf=new nn,dp=new J(0,0,-1),ta=new rn,gf=new J,pp=new J,_f=new rn,mp=new We,Qm=new Ba,RQ=Ta.flipX();Qm.depthTexture=new qr(1,1);let gp=!1;class A3 extends Na{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||Qm.texture,RQ),this._reflectorBaseNode=e.reflector||new CQ(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new A3({defaultTexture:Qm.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class CQ extends vt{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:n=new Ei,resolutionScale:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1,samples:l=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(zn('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=o,this.depth=a,this.samples=l,this.updateBeforeType=o?tn.RENDER:tn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const n=this.resolutionScale;t.getDrawingBufferSize(mp),e.setSize(Math.round(mp.width*n),Math.round(mp.height*n))}setup(e){return this._updateResolution(Qm,e.renderer),super.setup(e)}dispose(){super.dispose();
4100for(const e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Ba(0,0,{type:Mi,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=qP,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new qr),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&gp)return!1;gp=!0;const{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(mp),this._updateResolution(l,r),uh.setFromMatrixPosition(o.matrixWorld),O2.setFromMatrixPosition(n.matrixWorld),mf.extractRotation(o.matrixWorld),Bu.set(0,0,1),Bu.applyMatrix4(mf),gf.subVectors(uh,O2);const u=gf.dot(Bu)>0;let d=!1;if(u===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){gp=!1;return}d=!0}gf.reflect(Bu).negate(),gf.add(uh),mf.extractRotation(n.matrixWorld),dp.set(0,0,-1),dp.applyMatrix4(mf),dp.add(O2),pp.subVectors(uh,dp),pp.reflect(Bu).negate(),pp.add(uh),a.coordinateSystem=n.coordinateSystem,a.position.copy(gf),a.up.set(0,1,0),a.up.applyMatrix4(mf),a.up.reflect(Bu),a.lookAt(pp),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),lh.setFromNormalAndCoplanarPoint(Bu,uh),lh.applyMatrix4(a.matrixWorldInverse),ta.set(lh.normal.x,lh.normal.y,lh.normal.z,lh.constant);const p=a.projectionMatrix;_f.x=(Math.sign(ta.x)+p.elements[8])/p.elements[0],_f.y=(Math.sign(ta.y)+p.elements[9])/p.elements[5],_f.z=-1,_f.w=(1+p.elements[10])/p.elements[14],ta.multiplyScalar(1/ta.dot(_f));const g=0;p.elements[2]=ta.x,p.elements[6]=ta.y,p.elements[10]=r.coordinateSystem===co?ta.z-g:ta.z+1-g,p.elements[14]=ta.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;const x=r.getRenderTarget(),y=r.getMRT(),T=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0;const S=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",d?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=S,r.setMRT(y),r.setRenderTarget(x),r.autoClear=T,s.visible=!0,gp=!1,this.forceUpdate=!1}get resolution(){return zn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){zn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const NQ=i=>new A3(i),k2=new Ud(-1,1,1,-1,0,1);class PQ extends Wn{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Fn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Fn(t,2))}}const DQ=new PQ;class Og extends Qn{constructor(e=null){super(DQ,e),this.camera=k2,this.isQuadMesh=!0}async renderAsync(e){zn('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,k2)}render(e){e.render(this,k2)}}const LQ=new We;class IQ extends Na{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Mi}){const s=new Ba(t,n,r);super(s.texture,ri()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.pixelRatio=1,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new Og(new Vi),this.updateBeforeType=tn.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const n=e*this.pixelRatio,r=t*this.pixelRatio;this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;if(this.textureNeedsUpdate=!1,this.autoResize===!0){const r=e.getPixelRatio(),s=e.getSize(LQ),o=Math.floor(s.width*r),a=Math.floor(s.height*r);(o!==this.renderTarget.width||a!==this.renderTarget.height)&&(this.renderTarget.setSize(o,a),this.textureNeedsUpdate=!0)}let t="RTT";this.node.name&&(t=this.node.name+" [ "+t+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=t;const n=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(n)}clone(){const e=new Na(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const M5=(i,...e)=>new IQ(xt(i),...e),BQ=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():M5(i,...e),xh=ce(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===co?(i=je(i.x,i.y.oneMinus()).mul(2).sub(1),r=Lt(ae(i,e),1)):r=Lt(ae(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);const s=Lt(t.mul(r));return s.xyz.div(s.w)}),FQ=ce(([i,e])=>{const t=e.mul(Lt(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return je(n.x,n.y.oneMinus())}),UQ=ce(([i,e,t])=>{const n=ru(Fi(e)),r=er(i.mul(n)).toVar(),s=Fi(e,r).toVar(),o=Fi(e,r.sub(er(2,0))).toVar(),a=Fi(e,r.sub(er(1,0))).toVar(),l=Fi(e,r.add(er(1,0))).toVar(),u=Fi(e,r.add(er(2,0))).toVar(),d=Fi(e,r.add(er(0,2))).toVar(),p=Fi(e,r.add(er(0,1))).toVar(),g=Fi(e,r.sub(er(0,1))).toVar(),x=Fi(e,r.sub(er(0,2))).toVar(),y=di(Rn(Z(2).mul(a).sub(o),s)).toVar(),T=di(Rn(Z(2).mul(l).sub(u),s)).toVar(),S=di(Rn(Z(2).mul(p).sub(d),s)).toVar(),M=di(Rn(Z(2).mul(g).sub(x),s)).toVar(),R=xh(i,s,t).toVar(),E=y.lessThan(T).select(R.sub(xh(i.sub(je(Z(1).div(n.x),0)),a,t)),R.negate().add(xh(i.add(je(Z(1).div(n.x),0)),l,t))),N=S.lessThan(M).select(R.sub(xh(i.add(je(0,Z(1).div(n.y))),p,t)),R.negate().add(xh(i.sub(je(0,Z(1).div(n.y))),g,t)));return Ms(hl(E,N))}),f3=ce(([i])=>Oo(Z(52.9829189).mul(Oo(Ao(i,je(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Po=ce(([i,e,t])=>{const n=Z(2.399963229728653),r=hs(Z(i).add(.5).div(Z(e))),s=Z(i).mul(n).add(t);return je(Ro(s),rs(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]});class OQ extends vt{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(ri())}sample(e){return this.callback(e)}}const kQ=(i,e=null)=>new OQ(i,xt(e));class Ts extends vt{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===Ts.OBJECT?this.updateType=tn.OBJECT:e===Ts.MATERIAL?this.updateType=tn.RENDER:e===Ts.BEFORE_OBJECT?this.updateBeforeType=tn.OBJECT:e===Ts.BEFORE_MATERIAL&&(this.updateBeforeType=tn.RENDER)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}}Ts.OBJECT="object";Ts.MATERIAL="material";Ts.BEFORE_OBJECT="beforeObject";Ts.BEFORE_MATERIAL="beforeMaterial";const kg=(i,e)=>new Ts(i,e).toStack(),GQ=i=>kg(Ts.OBJECT,i),VQ=i=>kg(Ts.MATERIAL,i),qQ=i=>kg(Ts.BEFORE_OBJECT,i),zQ=i=>kg(Ts.BEFORE_MATERIAL,i);
4100class nm extends nu{constructor(e,t,n=Float32Array){const r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}}class HQ extends Di{constructor(e,t,n=Float32Array){const r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}}const WQ=(i,e="float")=>{let t,n;e.isStruct===!0?(t=e.layout.getLength(),n=Om("float")):(t=z4(e),n=Om(e));const r=new HQ(i,t,n);return su(r,e,i)},$Q=(i,e="float")=>{let t,n;e.isStruct===!0?(t=e.layout.getLength(),n=Om("float")):(t=z4(e),n=Om(e));const r=new nm(i,t,n);return su(r,e,r.count)};class jQ extends vt{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const XQ=st(jQ),xf=new Nr,G2=new nn,w5=Ct(0).setGroup(Dt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),Dx=Ct(1).setGroup(Dt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),E5=Ct(new nn).setGroup(Dt).onRenderUpdate(({scene:i})=>{const e=i.background;return e!==null&&e.isTexture&&e.mapping!==ov?(xf.copy(i.backgroundRotation),xf.x*=-1,xf.y*=-1,xf.z*=-1,G2.makeRotationFromEuler(xf)):G2.identity(),G2});class QQ extends Na{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Er.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}
4100setMipLevel(e){return this.mipLevel=e,this}generate(e,t){let n;return this.storeNode!==null?n=this.generateStore(e):n=super.generate(e,t),n}generateSnippet(e,t,n,r,s,o,a,l,u){const d=this.value;return e.generateStorageTextureLoad(d,t,n,r,o,u)}toReadWrite(){return this.setAccess(Er.READ_WRITE)}toReadOnly(){return this.setAccess(Er.READ_ONLY)}toWriteOnly(){return this.setAccess(Er.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:s}=t,o=super.generate(e,"property"),a=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),l=r.build(e,"vec4"),u=s?s.build(e,"int"):null,d=e.generateTextureStore(e,o,a,u,l);e.addLineFlowCode(d,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}}const R5=hn(QQ).setParameterLength(1,3),YQ=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?(n=i.clone(),n.uvNode=e,n.storeNode=t):n=R5(i,e,t),t!==null&&n.toStack(),n},KQ=ce(({texture:i,uv:e})=>{const n=ae().toVar();return Ft(e.x.lessThan(1e-4),()=>{n.assign(ae(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(ae(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(ae(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(ae(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(ae(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(ae(0,0,-1))}).Else(()=>{const s=i.sample(e.add(ae(-.01,0,0))).r.sub(i.sample(e.add(ae(.01,0,0))).r),o=i.sample(e.add(ae(0,-.01,0))).r.sub(i.sample(e.add(ae(0,.01,0))).r),a=i.sample(e.add(ae(0,0,-.01))).r.sub(i.sample(e.add(ae(0,0,.01))).r);n.assign(ae(s,o,a))}),n.normalize()});class ZQ extends Na{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return ae(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return KQ({texture:this,uv:e})}}const Gg=hn(ZQ).setParameterLength(1,3),JQ=(...i)=>Gg(...i).setSampler(!1),eY=(i,e,t)=>Gg(i,e).level(t);class tY extends Cg{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}}const nY=(i,e,t)=>new tY(i,e,t),qM=new WeakMap;class iY extends qi{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=tn.OBJECT,this.updateAfterType=tn.OBJECT,this.previousModelWorldMatrix=Ct(new nn),this.previousProjectionMatrix=Ct(new nn).setGroup(Dt),this.previousCameraViewMatrix=Ct(new nn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){const r=zM(n);this.previousModelWorldMatrix.value.copy(r);const s=C5(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new nn,s.previousCameraViewMatrix=new nn,s.currentProjectionMatrix=new nn,s.currentCameraViewMatrix=new nn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){zM(e).copy(e.matrixWorld)}setup(){const e=this.projectionMatrix===null?ol:Ct(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(_u).mul(Pi),r=this.previousProjectionMatrix.mul(t).mul(MA),s=n.xy.div(n.w),o=r.xy.div(r.w);return Rn(s,o)}}function C5(i){let e=qM.get(i);return e===void 0&&(e={},qM.set(i,e)),e}function zM(i,e=0){const t=C5(i);let n=t[e];return n===void 0&&(t[e]=n=new nn,t[e].copy(i.matrixWorld)),n}const rY=st(iY),sY=ce(([i])=>d3(i.rgb)),oY=ce(([i,e=Z(1)])=>e.mix(d3(i.rgb),i.rgb)),aY=ce(([i,e=Z(1)])=>{const t=Qi(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Mn(i.rgb,n,r)}),lY=ce(([i,e=Z(1)])=>{const t=ae(.57735,.57735,.57735),n=e.cos();return ae(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(Ao(t,i.rgb).mul(n.oneMinus())))))}),d3=(i,e=ae(Yt.getLuminanceCoefficients(new J)))=>Ao(i,e),uY=ce(([i,e=ae(1),t=ae(0),n=ae(1),r=Z(1),s=ae(Yt.getLuminanceCoefficients(new J,au))])=>{const o=i.rgb.dot(ae(s)),a=Ii(i.rgb.mul(e).add(t),0).toVar(),l=a.pow(n).toVar();return Ft(a.r.greaterThan(0),()=>{a.r.assign(l.r)}
4100),Ft(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),Ft(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r))),Lt(a.rgb,i.a)}),cY=ce(([i,e])=>i.mul(e).floor().div(e));let _p=null;class hY extends Lg{static get type(){return"ViewportSharedTextureNode"}constructor(e=Ta,t=null){_p===null&&(_p=new Tv),super(e,t,_p)}getTextureForReference(){return _p}updateReference(){return this}}const AY=hn(hY).setParameterLength(0,2),xp=new We;class N5 extends Na{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){const t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class HM extends N5{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){const e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}class Pa extends qi{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._pixelRatio=1,this._width=1,this._height=1;const s=new qr;s.isRenderTargetTexture=!0,s.name="depth";const o=new Ba(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Mi,...r});o.texture.name="output",o.depthTexture=s,this.renderTarget=o,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:o.texture,depth:s},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Ct(0),this._cameraFar=Ct(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=tn.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return Oe("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return Oe("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new HM(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new HM(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=e3(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=kh(s,n,r)}return t}async compileAsync(e){const t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),this.scope===Pa.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n}=this;let r,s;
4100const o=t.getOutputRenderTarget();o&&o.isXRRenderTarget===!0?(s=1,r=t.xr.getCamera(),t.xr.updateCamera(r),xp.set(o.width,o.height)):(r=this.camera,s=t.getPixelRatio(),t.getSize(xp)),this._pixelRatio=s,this.setSize(xp.width,xp.height);const a=t.getRenderTarget(),l=t.getMRT(),u=t.autoClear,d=t.transparent,p=t.opaque,g=r.layers.mask,x=t.contextNode,y=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(const S in this._previousTextures)this.toggleTexture(S);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:pl({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);const T=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=T,n.overrideMaterial=y,t.setRenderTarget(a),t.setMRT(l),t.autoClear=u,t.transparent=d,t.opaque=p,t.contextNode=x,r.layers.mask=g}setSize(e,t){this._width=e,this._height=t;const n=Math.floor(this._width*this._pixelRatio*this._resolutionScale),r=Math.floor(this._height*this._pixelRatio*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null&&this.renderTarget.scissor.copy(this._scissor),this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport)}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new rn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r),this._scissor.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new rn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r),this._viewport.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}Pa.COLOR="color";Pa.DEPTH="depth";const fY=(i,e,t)=>new Pa(Pa.COLOR,i,e,t),dY=(i,e)=>new N5(i,e),pY=(i,e,t)=>new Pa(Pa.DEPTH,i,e,t);class mY extends Pa{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Pa.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,u,d,p)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){const g=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,g,u,d,p)}t.renderObject(r,s,o,a,l,u,d,p)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new Vi;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=Xn;const t=Cs.negate(),n=ol.mul(_u),r=Z(1),s=n.mul(Lt(Pi,1)),o=n.mul(Lt(Pi.add(t),1)),a=Ms(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Lt(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const gY=(i,e,t=new It(0,0,0),n=.003,r=1)=>new mY(i,e,xt(t),xt(n),xt(r)),P5=ce(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),D5=ce(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),L5=ce(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);const t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),_Y=ce(([i])=>{const e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),I5=ce(([i,e])=>{const t=_r(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=_r(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=_Y(i),i=n.mul(i),i.clamp()}
4100).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),xY=_r(ae(1.6605,-.1246,-.0182),ae(-.5876,1.1329,-.1006),ae(-.0728,-.0083,1.1187)),vY=_r(ae(.6274,.0691,.0164),ae(.3293,.9195,.088),ae(.0433,.0113,.8956)),yY=ce(([i])=>{const e=ae(i).toVar(),t=ae(e.mul(e)).toVar(),n=ae(t.mul(t)).toVar();return Z(15.5).mul(n.mul(t)).sub(sn(40.14,n.mul(e))).add(sn(31.96,n).sub(sn(6.868,t.mul(e))).add(sn(.4298,t).add(sn(.1191,e).sub(.00232))))}),B5=ce(([i,e])=>{const t=ae(i).toVar(),n=_r(ae(.856627153315983,.137318972929847,.11189821299995),ae(.0951212405381588,.761241990602591,.0767994186031903),ae(.0482516061458583,.101439036467562,.811302368396859)),r=_r(ae(1.1271005818144368,-.1413297634984383,-.14132976349843826),ae(-.11060664309660323,1.157823702216272,-.11060664309660294),ae(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=Z(-12.47393),o=Z(4.026069);return t.mulAssign(e),t.assign(vY.mul(t)),t.assign(n.mul(t)),t.assign(Ii(t,1e-10)),t.assign(ya(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(ko(t,0,1)),t.assign(yY(t)),t.assign(r.mul(t)),t.assign(oo(Ii(ae(0),t),ae(2.2))),t.assign(xY.mul(t)),t.assign(ko(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),F5=ce(([i,e])=>{const t=Z(.76),n=Z(.15);i=i.mul(e);const r=Rs(i.r,Rs(i.g,i.b)),s=Vr(r.lessThan(.08),r.sub(sn(6.25,r.mul(r))),.04);i.subAssign(s);const o=Ii(i.r,Ii(i.g,i.b));Ft(o.lessThan(t),()=>i);const a=Rn(1,t),l=Rn(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));const u=Rn(1,js(1,n.mul(o.sub(l)).add(1)));return Mn(i,ae(l),u)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class rr extends vt{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.build(e);const n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const Vg=hn(rr).setParameterLength(1,3),bY=(i,e)=>Vg(i,e,"js"),SY=(i,e)=>Vg(i,e,"wgsl"),TY=(i,e)=>Vg(i,e,"glsl");class U5 extends rr{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){const n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);const n=this.getNodeFunction(e),r=n.name,s=n.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);const a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+` 4101`,t==="property"?a:e.format(`${a}()`,s,t)}}const O5=(i,e=[],t="")=>{for(let s=0;s<e.length;s++){const o=e[s];typeof o=="function"&&(e[s]=o.functionNode)}const n=new U5(i,e,t),r=(...s)=>n.call(...s);return r.functionNode=n,r},MY=(i,e)=>O5(i,e,"glsl"),wY=(i,e)=>O5(i,e,"wgsl");function p3(i){let e;const t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Hi.z).negate()}const k5=ce(([i,e],t)=>{const n=p3(t);return Go(i,e,n)}),G5=ce(([i],e)=>{const t=p3(e);return i.mul(i,t,t).negate().exp().oneMinus()}),EY=ce(([i,e],t)=>{const n=p3(t),s=e.sub(Ma.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),Lx=ce(([i,e])=>Lt(e.toFloat().mix(Uh.rgb,i.toVec3()),Uh.a));let Fu=null,Uu=null;class RY extends vt{static get type(){return"RangeNode"}constructor(e=Z(),t=Z()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(Yl(t.value)),s=e.getTypeLength(Yl(n.value));return r>s?r:s}
4101getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new TC('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){const t=e.object;let n=null;if(t.count>1){const r=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),o=r.value,a=s.value,l=e.getTypeLength(Yl(o)),u=e.getTypeLength(Yl(a));Fu=Fu||new rn,Uu=Uu||new rn,Fu.setScalar(0),Uu.setScalar(0),l===1?Fu.setScalar(o):o.isColor?Fu.set(o.r,o.g,o.b,1):Fu.set(o.x,o.y,o.z||0,o.w||0),u===1?Uu.setScalar(a):a.isColor?Uu.set(a.r,a.g,a.b,1):Uu.set(a.x,a.y,a.z||0,a.w||0);const d=4,p=d*t.count,g=new Float32Array(p);for(let T=0;T<p;T++){const S=T%d,M=Fu.getComponent(S),R=Uu.getComponent(S);g[T]=og.lerp(M,R,Math.random())}const x=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=Wd(g,"vec4",t.count).element(wa).convert(x);else{const T=new nu(g,4);e.geometry.setAttribute("__range"+this.id,T),n=$m(T).convert(x)}}else n=Z(0);return n}}const CY=hn(RY).setParameterLength(2);class NY extends vt{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}getNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){const n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(Oe(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}}const Qd=(i,e)=>new NY(i,e),PY=Qd("numWorkgroups","uvec3"),DY=Qd("workgroupId","uvec3"),LY=Qd("globalId","uvec3"),IY=Qd("localId","uvec3"),BY=Qd("subgroupSize","uint");class FY extends vt{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 4102`):e.addLineFlowCode(`${t}Barrier()`,this)}}const m3=hn(FY),UY=()=>m3("workgroup").toStack(),OY=()=>m3("storage").toStack(),kY=()=>m3("texture").toStack();class GY extends bc{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const r=e.context.assign;if(n=super.generate(e),r!==!0){const s=this.getNodeType(e);n=e.format(n,s,t)}return n}}class VY extends vt{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return Oe('TSL: "label()" has been deprecated. Use "setName()" instead.',new $i),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new GY(this,e)}generate(e){const t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const qY=(i,e)=>new VY("Workgroup",i,e);class ar extends vt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=e.getNodeProperties(this),n=t.parents,r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.pointerNode,l=this.valueNode,u=[];u.push(`&${a.build(e,o)}`),l!==null&&u.push(l.build(e,o));const d=`${e.getMethod(r,s)}( ${u.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(d,this);else return t.constNode===void 0&&(t.constNode=zs(d,s).toConst()),t.constNode.build(e)}}ar.ATOMIC_LOAD="atomicLoad";ar.ATOMIC_STORE="atomicStore";ar.ATOMIC_ADD="atomicAdd";ar.ATOMIC_SUB="atomicSub";ar.ATOMIC_MAX="atomicMax";ar.ATOMIC_MIN="atomicMin";ar.ATOMIC_AND="atomicAnd";ar.ATOMIC_OR="atomicOr";ar.ATOMIC_XOR="atomicXor";const zY=hn(ar),Ua=(i,e,t)=>zY(i,e,t).toStack(),HY=i=>Ua(ar.ATOMIC_LOAD,i,null),WY=(i,e)=>Ua(ar.ATOMIC_STORE,i,e),$Y=(i,e)=>Ua(ar.ATOMIC_ADD,i,e),jY=(i,e)=>Ua(ar.ATOMIC_SUB,i,e),XY=(i,e)=>Ua(ar.ATOMIC_MAX,i,e),QY=(i,e)=>Ua(ar.ATOMIC_MIN,i,e),YY=(i,e)=>Ua(ar.ATOMIC_AND,i,e),KY=(i,e)=>Ua(ar.ATOMIC_OR,i,e),ZY=(i,e)=>Ua(ar.ATOMIC_XOR,i,e);class ft extends qi{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){const t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n);return r>s?t:n}getNodeType(e){const t=this.method;return t===ft.SUBGROUP_ELECT?"bool":t===ft.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const n=this.method,r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=[];if(n===ft.SUBGROUP_BROADCAST||n===ft.SUBGROUP_SHUFFLE||n===ft.QUAD_BROADCAST){const d=a.getNodeType(e);l.push(o.build(e,r),a.build(e,d==="float"?"int":r))}else n===ft.SUBGROUP_SHUFFLE_XOR||n===ft.SUBGROUP_SHUFFLE_DOWN||n===ft.SUBGROUP_SHUFFLE_UP?l.push(o.build(e,r),a.build(e,"uint")):(o!==null&&l.push(o.build(e,s)),a!==null&&l.push(a.build(e,s)));const u=l.length===0?"()":`( ${l.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${u}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}ft.SUBGROUP_ELECT="subgroupElect";ft.SUBGROUP_BALLOT="subgroupBallot";ft.SUBGROUP_ADD="subgroupAdd";
4102ft.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";ft.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";ft.SUBGROUP_MUL="subgroupMul";ft.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";ft.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";ft.SUBGROUP_AND="subgroupAnd";ft.SUBGROUP_OR="subgroupOr";ft.SUBGROUP_XOR="subgroupXor";ft.SUBGROUP_MIN="subgroupMin";ft.SUBGROUP_MAX="subgroupMax";ft.SUBGROUP_ALL="subgroupAll";ft.SUBGROUP_ANY="subgroupAny";ft.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";ft.QUAD_SWAP_X="quadSwapX";ft.QUAD_SWAP_Y="quadSwapY";ft.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";ft.SUBGROUP_BROADCAST="subgroupBroadcast";ft.SUBGROUP_SHUFFLE="subgroupShuffle";ft.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";ft.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";ft.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";ft.QUAD_BROADCAST="quadBroadcast";const JY=Ze(ft,ft.SUBGROUP_ELECT).setParameterLength(0),eK=Ze(ft,ft.SUBGROUP_BALLOT).setParameterLength(1),tK=Ze(ft,ft.SUBGROUP_ADD).setParameterLength(1),nK=Ze(ft,ft.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),iK=Ze(ft,ft.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),rK=Ze(ft,ft.SUBGROUP_MUL).setParameterLength(1),sK=Ze(ft,ft.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),oK=Ze(ft,ft.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),aK=Ze(ft,ft.SUBGROUP_AND).setParameterLength(1),lK=Ze(ft,ft.SUBGROUP_OR).setParameterLength(1),uK=Ze(ft,ft.SUBGROUP_XOR).setParameterLength(1),cK=Ze(ft,ft.SUBGROUP_MIN).setParameterLength(1),hK=Ze(ft,ft.SUBGROUP_MAX).setParameterLength(1),AK=Ze(ft,ft.SUBGROUP_ALL).setParameterLength(0),fK=Ze(ft,ft.SUBGROUP_ANY).setParameterLength(0),dK=Ze(ft,ft.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),pK=Ze(ft,ft.QUAD_SWAP_X).setParameterLength(1),mK=Ze(ft,ft.QUAD_SWAP_Y).setParameterLength(1),gK=Ze(ft,ft.QUAD_SWAP_DIAGONAL).setParameterLength(1),_K=Ze(ft,ft.SUBGROUP_BROADCAST).setParameterLength(2),xK=Ze(ft,ft.SUBGROUP_SHUFFLE).setParameterLength(2),vK=Ze(ft,ft.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),yK=Ze(ft,ft.SUBGROUP_SHUFFLE_UP).setParameterLength(2),bK=Ze(ft,ft.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),SK=Ze(ft,ft.QUAD_BROADCAST).setParameterLength(1);let vp;function qg(i){vp=vp||new WeakMap;let e=vp.get(i);return e===void 0&&vp.set(i,e={}),e}function zg(i){const e=qg(i);return e.shadowMatrix||(e.shadowMatrix=Ct("mat4").setGroup(Dt).onRenderUpdate(t=>((i.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(i.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(i.shadow.camera.coordinateSystem=t.camera.coordinateSystem,i.shadow.camera.updateProjectionMatrix()),i.shadow.updateMatrices(i)),i.shadow.matrix)))}function V5(i,e=Ma){const t=zg(i).mul(e);return t.xyz.div(t.w)}function g3(i){const e=qg(i);return e.position||(e.position=Ct(new J).setGroup(Dt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function q5(i){const e=qg(i);return e.targetPosition||(e.targetPosition=Ct(new J).setGroup(Dt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function _3(i){const e=qg(i);return e.viewPosition||(e.viewPosition=Ct(new J).setGroup(Dt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new J,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const x3=i=>go.transformDirection(g3(i).sub(q5(i))),TK=i=>i.sort((e,t)=>e.id-t.id),MK=(i,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},V2=new WeakMap,vf=[];class v3 extends vt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=sl("vec3","totalDiffuse"),this.totalSpecularNode=sl("vec3","totalSpecular"),this.outgoingLightNode=sl("vec3","outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=this._lights;for(let n=0;n<e.length;n++){const r=e[n];if(vf.push(r.id),vf.push(r.castShadow?1:0),r.isSpotLight===!0){const s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;vf.push(s,o)}}const t=qd(vf);return vf.length=0,t}getHash(e){if(this._lightNodesHash===null){this._lightNodes===null&&this.setupLightsNode(e);const t=[];for(const n of this._lightNodes)t.push(n.getHash());this._lightNodesHash="lights-"+t.join(",")}return this._lightNodesHash}analyze(e){const t=e.getNodeProperties(this);for(const n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){const t=[],n=this._lightNodes,r=TK(this._lights),s=e.renderer.library;for(const o of r)if(o.isNode)t.push(xt(o));else{let a=null;if(n!==null&&(a=MK(o.id,n)),a===null){const l=s.getLightNodeClass(o.constructor);if(l===null){Oe(`LightsNode.setupNodeLights: Light node not found for ${o.constructor.name}`);continue}let u=null;V2.has(o)?u=V2.get(o):(u=new l(o),V2.set(o,u)),t.push(u)}}this._lightNodes=t}setupDirectLight(e,t,n){const{lightingModel:r,reflectedLight:s}=e.context;r.direct({...n,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,n){const{lightingModel:r,reflectedLight:s}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(const n of t)n.build(e)}getLightNodes(e){return this._lightNodes===null&&this.setupLightsNode(e),this._lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode;const r=e.context,s=r.lightingModel,o=e.getNodeProperties(this);if(s){const{totalDiffuseNode:a,totalSpecularNode:l}=this;r.outgoingLight=n;const u=e.addStack();o.nodes=u.nodes,s.start(e);const{backdrop:d,backdropAlpha:p}=r,{directDiffuse:g,directSpecular:x,indirectDiffuse:y,indirectSpecular:T}=r.reflectedLight;let S=g.add(y);d!==null&&(p!==null?S=ae(p.mix(S,d)):S=ae(d)),a.assign(S),l.assign(x.add(T)),n.assign(a.add(l)),s.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}const wK=(i=[])=>new v3().setLights(i);class EK extends vt{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=tn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){y3.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Ma)}}const y3=sl("vec3","shadowPositionWorld");function RK(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace
4102=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new It),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function CK(i,e){return e=RK(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function NK(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function PK(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function DK(i,e){return e=PK(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function LK(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function IK(i,e,t){return t=CK(i,t),t=DK(e,t),t}function BK(i,e,t){NK(i,t),LK(e,t)}const Ym=new WeakMap,z5=ce(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=On(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),H5=ce(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{const r=(d,p)=>{let g=On(i,d);return i.isArrayTexture&&(g=g.depth(n)),g.compare(p)},s=vi("mapSize","vec2",t).setGroup(Dt),o=vi("radius","float",t).setGroup(Dt),a=je(1).div(s),l=o.mul(a.x),u=f3(Tc.xy).mul(6.28318530718);return Qi(r(e.xy.add(Po(0,5,u).mul(l)),e.z),r(e.xy.add(Po(1,5,u).mul(l)),e.z),r(e.xy.add(Po(2,5,u).mul(l)),e.z),r(e.xy.add(Po(3,5,u).mul(l)),e.z),r(e.xy.add(Po(4,5,u).mul(l)),e.z)).mul(1/5)}),W5=ce(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{const r=(p,g)=>{let x=On(i,p);return i.isArrayTexture&&(x=x.depth(n)),x.compare(g)},s=vi("mapSize","vec2",t).setGroup(Dt),o=je(1).div(s),a=o.x,l=o.y,u=e.xy,d=Oo(u.mul(s).add(.5));return u.subAssign(d.mul(o)),Qi(r(u,e.z),r(u.add(je(a,0)),e.z),r(u.add(je(0,l)),e.z),r(u.add(o),e.z),Mn(r(u.add(je(a.negate(),0)),e.z),r(u.add(je(a.mul(2),0)),e.z),d.x),Mn(r(u.add(je(a.negate(),l)),e.z),r(u.add(je(a.mul(2),l)),e.z),d.x),Mn(r(u.add(je(0,l.negate())),e.z),r(u.add(je(0,l.mul(2))),e.z),d.y),Mn(r(u.add(je(a,l.negate())),e.z),r(u.add(je(a,l.mul(2))),e.z),d.y),Mn(Mn(r(u.add(je(a.negate(),l.negate())),e.z),r(u.add(je(a.mul(2),l.negate())),e.z),d.x),Mn(r(u.add(je(a.negate(),l.mul(2))),e.z),r(u.add(je(a.mul(2),l.mul(2))),e.z),d.x),d.y)).mul(1/9)}),$5=ce(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=On(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;const s=r.x,o=Ii(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?mc(s,e.z):mc(e.z,s),l=Z(1).toVar();return Ft(a.notEqual(1),()=>{const u=e.z.sub(s);let d=o.div(o.add(u.mul(u)));d=ko(Rn(d,.3).div(.65)),l.assign(Ii(a,d))}),l}),j5=i=>{let e=Ym.get(i);return e===void 0&&(e=new Vi,e.colorNode=Lt(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=gr,e.fog=!1,Ym.set(i,e)),e},X5=i=>{const e=Ym.get(i);e!==void 0&&(e.dispose(),Ym.delete(i))},WM=new hu,ch=[],Q5=(i,e,t,n)=>{ch[0]=i,ch[1]=e;let r=WM.get(ch);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,u,d,...p)=>{(s.castShadow===!0||s.receiveShadow&&t===ha)&&(n&&(H4(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,d),i.renderObject(s,o,a,l,u,d,...p),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,d))},r.shadowType=t,r.useVelocity=n,WM.set(ch,r)),ch[0]=null,ch[1]=null,r},FK=ce(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{const s=Z(0).toVar("meanVertical"),o=Z(0).toVar("squareMeanVertical"),a=i.lessThanEqual(Z(1)).select(Z(0),Z(2).div(i.sub(1))),l=i.lessThanEqual(Z(1)).select(Z(0),Z(-1));Zn({start:oe(0),end:oe(i),type:"int",condition:"<"},({i:d})=>{const p=l.add(Z(d).mul(a));let g=n.sample(Qi(Tc.xy,je(0,p).mul(e)).div(t));n.value.isArrayTexture&&(g=g.depth(r)),g=g.x,s.addAssign(g),o.addAssign(g.mul(g))}),s.divAssign(i),o.divAssign(i);const u=hs(o.sub(s.mul(s)).max(0));return je(s,u)}),UK=ce(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{const s=Z(0).toVar("meanHorizontal"),o=Z(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(Z(1)).select(Z(0),Z(2).div(i.sub(1))),l=i.lessThanEqual(Z(1)).select(Z(0),Z(-1));Zn({start:oe(0),end:oe(i),type:"int",condition:"<"},({i:d})=>{const p=l.add(Z(d).mul(a));
4102let g=n.sample(Qi(Tc.xy,je(p,0).mul(e)).div(t));n.value.isArrayTexture&&(g=g.depth(r)),s.addAssign(g.x),o.addAssign(Qi(g.y.mul(g.y),g.x.mul(g.x)))}),s.divAssign(i),o.divAssign(i);const u=hs(o.sub(s.mul(s)).max(0));return je(s,u)}),OK=[z5,H5,W5,$5];let q2;const yp=new Og;class Y5 extends EK{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o}){const a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o});return a.select(l,Z(1))}setupShadowCoord(e,t){const{shadow:n}=this,{renderer:r}=e,s=n.biasNode||vi("bias","float",n).setGroup(Dt);let o=t,a;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z;else{const l=o.w;o=o.xy.div(l);const u=vi("near","float",n.camera).setGroup(Dt),d=vi("far","float",n.camera).setGroup(Dt);a=t3(l.negate(),u,d)}return o=ae(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return OK[e]}setupRenderTarget(e,t){const n=new qr(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?al:fu;const r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){const{renderer:t,camera:n}=e,{light:r,shadow:s}=this,{depthTexture:o,shadowMap:a}=this.setupRenderTarget(s,e),l=t.shadowMap.type,u=t.hasCompatibility(tl.TEXTURE_COMPARE);if((l===Rh||l===Xw)&&u?(o.minFilter=li,o.magFilter=li):(o.minFilter=jn,o.magFilter=jn),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===ha&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ls,type:Mi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ls,type:Mi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ls,type:Mi,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ls,type:Mi,depthBuffer:!1}));let N=On(o);o.isArrayTexture&&(N=N.depth(this.depthLayer));let U=On(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(U=U.depth(this.depthLayer));const L=vi("blurSamples","float",s).setGroup(Dt),F=vi("radius","float",s).setGroup(Dt),P=vi("mapSize","vec2",s).setGroup(Dt);let I=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Vi);I.fragmentNode=FK({samples:L,radius:F,size:P,shadowPass:N,depthLayer:this.depthLayer}).context(e.getSharedContext()),I.name="VSMVertical",I=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Vi),I.fragmentNode=UK({samples:L,radius:F,size:P,shadowPass:U,depthLayer:this.depthLayer}).context(e.getSharedContext()),I.name="VSMHorizontal"}const d=vi("intensity","float",s).setGroup(Dt),p=vi("normalBias","float",s).setGroup(Dt),g=zg(r).mul(y3.add(xu.mul(p))),x=this.setupShadowCoord(e,g),y=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(y===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const T=l===ha&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,S=this.setupShadowFilter(e,{filterFn:y,shadowTexture:a.texture,depthTexture:T,shadowCoord:x,shadow:s,depthLayer:this.depthLayer});let M;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?M=os(a.texture,x.xyz):(M=On(a.texture,x),o.isArrayTexture&&(M=M.depth(this.depthLayer))));let R;M?R=Mn(1,S.rgb.mix(M,1),d.mul(M.a)).toVar():R=Mn(1,S,d).toVar(),this.shadowMap=a,this.shadow.map=a;const E=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return M&&R.toInspector(`${E} / Color`,()=>this.shadowMap.texture.isCubeTexture?os(this.shadowMap.texture):On(this.shadowMap.texture)),R.toInspector(`${E} / Depth`,()=>this.shadowMap.texture.isCubeTexture?os(this.shadowMap.texture).r.oneMinus():Fi(this.shadowMap.depthTexture,ri().mul(ru(On(this.shadowMap.depthTexture)))).r.oneMinus())}setup(e){if(e.renderer.shadowMap.enabled!==!1)return ce(()=>{const t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){const{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);const a=o.name;o.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,s.render(o,t.camera),o.name=a}updateShadow(e){const{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,u=t.depthTexture.version;this._depthVersionCached=u;const d=r.camera.layers.mask;r.camera.layers.mask&4294967294||(r.camera.layers.mask=a.layers.mask);const p=s.getRenderObjectFunction(),g=s.getMRT(),x=g?g.has("velocity"):!1;q2=IK(s,o,q2),o.overrideMaterial=j5(n),s.setRenderObjectFunction(Q5(s,r,l,x)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(p),l===ha&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=d,BK(s,o,q2)}vsmPass(e){const{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),yp.material=this.vsmMaterialVertical,yp.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),yp.material=this.vsmMaterialHorizontal,yp.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,X5(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){const{shadow:t}=this;let n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const K5=(i,e)=>new Y5(i,e),kK=new It,$M=new nn,yf=new J,z2=new J,GK=[new J(1,0,0),new J(-1,0,0),new J(0,-1,0),new J(0,1,0),new J(0,0,1),new J(0,0,-1)],VK=[new J(0,-1,0),new J(0,-1,0),new J(0,0,-1),new J(0,0,1),new J(0,-1,0),new J(0,-1,0)],qK=[new J(1,0,0),new J(-1,0,0),new J(0,1,0),new J(0,-1,0),new J(0,0,1),new J(0,0,-1)],zK=[new J(0,-1,0),new J(0,-1,0),new J(0,0,1),new J(0,0,-1),new J(0,-1,0),new J(0,-1,0)],Z5=ce(({depthTexture:i,bd3D:e,dp:t})=>
4102os(i,e).compare(t)),J5=ce(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{const r=vi("radius","float",n).setGroup(Dt),s=vi("mapSize","vec2",n).setGroup(Dt),o=r.div(s.x),a=di(e),l=Ms(hl(e,a.x.greaterThan(a.z).select(ae(0,1,0),ae(1,0,0)))),u=hl(e,l),d=f3(Tc.xy).mul(6.28318530718),p=Po(0,5,d),g=Po(1,5,d),x=Po(2,5,d),y=Po(3,5,d),T=Po(4,5,d);return os(i,e.add(l.mul(p.x).add(u.mul(p.y)).mul(o))).compare(t).add(os(i,e.add(l.mul(g.x).add(u.mul(g.y)).mul(o))).compare(t)).add(os(i,e.add(l.mul(x.x).add(u.mul(x.y)).mul(o))).compare(t)).add(os(i,e.add(l.mul(y.x).add(u.mul(y.y)).mul(o))).compare(t)).add(os(i,e.add(l.mul(T.x).add(u.mul(T.y)).mul(o))).compare(t)).mul(1/5)}),HK=ce(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n},r)=>{const s=t.xyz.toConst(),o=s.abs().toConst(),a=o.x.max(o.y).max(o.z),l=Ct("float").setGroup(Dt).onRenderUpdate(()=>n.camera.near),u=Ct("float").setGroup(Dt).onRenderUpdate(()=>n.camera.far),d=vi("bias","float",n).setGroup(Dt),p=Z(1).toVar();return Ft(a.sub(u).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let g;r.renderer.reversedDepthBuffer?(g=z8(a.negate(),l,u),g.subAssign(d)):(g=Jy(a.negate(),l,u),g.addAssign(d));const x=s.normalize();p.assign(i({depthTexture:e,bd3D:x,dp:g,shadow:n}))}),p});class WK extends Y5{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===UP?Z5:J5}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return HK({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){const n=new aE(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?al:fu;const r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name="PointShadowMap",r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){const{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e,a=t.camera,l=t.matrix,u=s.coordinateSystem===co,d=u?GK:qK,p=u?VK:zK;n.setSize(t.mapSize.width,t.mapSize.width);const g=s.autoClear,x=s.getClearColor(kK),y=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let T=0;T<6;T++){s.setRenderTarget(n,T),s.clear();const S=r.distance||a.far;S!==a.far&&(a.far=S,a.updateProjectionMatrix()),yf.setFromMatrixPosition(r.matrixWorld),a.position.copy(yf),z2.copy(a.position),z2.add(d[T]),a.up.copy(p[T]),a.lookAt(z2),a.updateMatrixWorld(),l.makeTranslation(-yf.x,-yf.y,-yf.z),$M.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix($M,a.coordinateSystem,a.reversedDepth);const M=o.name;o.name=`Point Light Shadow [ ${r.name||"ID: "+r.id} ] - Face ${T+1}`,s.render(o,a),o.name=M}s.autoClear=g,s.setClearColor(x,y)}}const e6=(i,e)=>new WK(i,e);class Mc extends GA{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new It,this.colorNode=e&&e.colorNode||Ct(this.color).setGroup(Dt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=tn.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return _3(this.light).sub(e.context.positionView||Hi)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return K5(this.light)}setupShadow(e){const{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){const r=this.light.shadow.shadowNode;let s;r!==void 0?s=xt(r):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dis
vendor: 6,269 bytes, line 4102
4102pose(),this.shadowNode=null,this.shadowColorNode=null);const t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const b3=ce(({lightDistance:i,cutoffDistance:e,decayExponent:t})=>{const n=i.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(i.div(e).pow4().oneMinus().clamp().pow2()),n)}),t6=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{const r=e.normalize(),s=e.length(),o=b3({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}};class $K extends Mc{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Ct(0).setGroup(Dt),this.decayExponentNode=Ct(2).setGroup(Dt)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return e6(this.light)}setupDirect(e){return t6({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const jK=ce(([i=ri()])=>{const e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),XK=ce(([i=ri()],{renderer:e,material:t})=>{const n=Cy(i.mul(2).sub(1));let r;if(t.alphaToCoverage&&e.currentSamples>0){const s=Z(n.fwidth()).toVar();r=Go(s.oneMinus(),s.add(1),n).oneMinus()}else r=Vr(n.greaterThan(1),0,1);return r}),Qf=ce(([i,e,t])=>{const n=Z(t).toVar(),r=Z(e).toVar(),s=ho(i).toVar();return Vr(s,r,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),Km=ce(([i,e])=>{const t=ho(e).toVar(),n=Z(i).toVar();return Vr(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Xi=ce(([i])=>{const e=Z(i).toVar();return oe(ba(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Ri=ce(([i,e])=>{const t=Z(i).toVar();return e.assign(Xi(t)),t.sub(Z(e))}),QK=ce(([i,e,t,n,r,s])=>{const o=Z(s).toVar(),a=Z(r).toVar(),l=Z(n).toVar(),u=Z(t).toVar(),d=Z(e).toVar(),p=Z(i).toVar(),g=Z(Rn(1,a)).toVar();return Rn(1,o).mul(p.mul(g).add(d.mul(a))).add(o.mul(u.mul(g).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),YK=ce(([i,e,t,n,r,s])=>{const o=Z(s).toVar(),a=Z(r).toVar(),l=ae(n).toVar(),u=ae(t).toVar(),d=ae(e).toVar(),p=ae(i).toVar(),g=Z(Rn(1,a)).toVar();return Rn(1,o).mul(p.mul(g).add(d.mul(a))).add(o.mul(u.mul(g).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),n6=Dr([QK,YK]),KK=ce(([i,e,t,n,r,s,o,a,l,u,d])=>{const p=Z(d).toVar(),g=Z(u).toVar(),x=Z(l).toVar(),y=Z(a).toVar(),T=Z(o).toVar(),S=Z(s).toVar(),M=Z(r).toVar(),R=Z(n).toVar(),E=Z(t).toVar(),N=Z(e).toVar(),U=Z(i).toVar(),L=Z(Rn(1,x)).toVar(),F=Z(Rn(1,g)).toVar();return Z(Rn(1,p)).toVar().mul(F.mul(U.mul(L).add(N.mul(x))).add(g.mul(E.mul(L).add(R.mul(x))))).add(p.mul(F.mul(M.mul(L).add(S.mul(x))).add(g.mul(T.mul(L).add(y.mul(x))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),ZK=ce(([i,e,t,n,r,s,o,a,l,u,d])=>{const p=Z(d).toVar(),g=Z(u).toVar(),x=Z(l).toVar(),y=ae(a).toVar(),T=ae(o).toVar(),S=ae(s).toVar(),M=ae(r).toVar(),R=ae(n).toVar(),E=ae(t).toVar(),N=ae(e).toVar(),U=ae(i).toVar(),L=Z(Rn(1,x)).toVar(),F=Z(Rn(1,g)).toVar();return Z(Rn(1,p)).toVar().mul(F.mul(U.mul(L).add(N.mul(x))).add(g.mul(E.mul(L).add(R.mul(x))))).add(p.mul(F.mul(M.mul(L).add(S.mul(x))).add(g.mul(T.mul(L).add(y.mul(x))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),i6=Dr([KK,ZK]),JK=ce(([i,e,t])=>{const n=Z(t).toVar(),r=Z(e).toVar(),s=Ge(i).toVar(),o=Ge(s.bitAnd(Ge(7))).toVar(),a=Z(Qf(o.lessThan(Ge(4)),r,n)).toVar(),l=Z(sn(2,Qf(o.lessThan(Ge(4)),n,r))).toVar();return Km(a,ho(o.bitAnd(Ge(1)))).add(Km(l,ho(o.bitAnd(Ge(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),eZ=ce(([i,e,t,n])=>{const r=Z(n).toVar(),s=Z(t).toVar(),o=Z(e).toVar(),a=Ge(i).toVar(),l=Ge(a.bitAnd(Ge(15))).toVar(),u=Z(Qf(l.lessThan(Ge(8)),o,s)).toVar(),d=Z(Qf(l.lessThan(Ge(4)),s,Qf(l.equal(Ge(12)).or(l.equal(Ge(14))),o,r))).toVar();return Km(u,ho(l.bitAnd(Ge(1)))).add(Km(d,ho(l.bitAnd(Ge(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),fr=Dr([JK,eZ]),tZ=ce(([i,e,t])=>{const n=Z(t).toVar(),r=Z(e).toVar(),s=Sc(i).toVar();return ae(fr(s.x,r,n),fr(s.y,r,n),fr(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),nZ=ce(([i,e,t,n])=>{const r=Z(n).toVar(),s=Z(t).toVar(),o=Z(e).toVar(),a=Sc(i).toVar();return ae(fr(a.x,o,s,r),fr(a.y,o,s,r),fr(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),no=Dr([tZ,nZ]),iZ=ce(([i])=>{const e=Z(i).toVar();return sn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),rZ=ce(([i])=>{const e=Z(i).toVar();return sn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),sZ=ce(([i])=>{const e=ae(i).toVar();return sn(.6616,e)}
vendor: 13,114 bytes, line 4102
4102).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),r6=Dr([iZ,sZ]),oZ=ce(([i])=>{const e=ae(i).toVar();return sn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),s6=Dr([rZ,oZ]),Vs=ce(([i,e])=>{const t=oe(e).toVar(),n=Ge(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(oe(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),o6=ce(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(Vs(t,oe(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Vs(i,oe(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Vs(e,oe(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(Vs(t,oe(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Vs(i,oe(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Vs(e,oe(4))),e.addAssign(i)}),Yd=ce(([i,e,t])=>{const n=Ge(t).toVar(),r=Ge(e).toVar(),s=Ge(i).toVar();return n.bitXorAssign(r),n.subAssign(Vs(r,oe(14))),s.bitXorAssign(n),s.subAssign(Vs(n,oe(11))),r.bitXorAssign(s),r.subAssign(Vs(s,oe(25))),n.bitXorAssign(r),n.subAssign(Vs(r,oe(16))),s.bitXorAssign(n),s.subAssign(Vs(n,oe(4))),r.bitXorAssign(s),r.subAssign(Vs(s,oe(14))),n.bitXorAssign(r),n.subAssign(Vs(r,oe(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),zr=ce(([i])=>{const e=Ge(i).toVar();return Z(e).div(Z(Ge(oe(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),Ea=ce(([i])=>{const e=Z(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),aZ=ce(([i])=>{const e=oe(i).toVar(),t=Ge(Ge(1)).toVar(),n=Ge(Ge(oe(3735928559)).add(t.shiftLeft(Ge(2))).add(Ge(13))).toVar();return Yd(n.add(Ge(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),lZ=ce(([i,e])=>{const t=oe(e).toVar(),n=oe(i).toVar(),r=Ge(Ge(2)).toVar(),s=Ge().toVar(),o=Ge().toVar(),a=Ge().toVar();return s.assign(o.assign(a.assign(Ge(oe(3735928559)).add(r.shiftLeft(Ge(2))).add(Ge(13))))),s.addAssign(Ge(n)),o.addAssign(Ge(t)),Yd(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),uZ=ce(([i,e,t])=>{const n=oe(t).toVar(),r=oe(e).toVar(),s=oe(i).toVar(),o=Ge(Ge(3)).toVar(),a=Ge().toVar(),l=Ge().toVar(),u=Ge().toVar();return a.assign(l.assign(u.assign(Ge(oe(3735928559)).add(o.shiftLeft(Ge(2))).add(Ge(13))))),a.addAssign(Ge(s)),l.addAssign(Ge(r)),u.addAssign(Ge(n)),Yd(a,l,u)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),cZ=ce(([i,e,t,n])=>{const r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=oe(i).toVar(),l=Ge(Ge(4)).toVar(),u=Ge().toVar(),d=Ge().toVar(),p=Ge().toVar();return u.assign(d.assign(p.assign(Ge(oe(3735928559)).add(l.shiftLeft(Ge(2))).add(Ge(13))))),u.addAssign(Ge(a)),d.addAssign(Ge(o)),p.addAssign(Ge(s)),o6(u,d,p),u.addAssign(Ge(r)),Yd(u,d,p)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),hZ=ce(([i,e,t,n,r])=>{const s=oe(r).toVar(),o=oe(n).toVar(),a=oe(t).toVar(),l=oe(e).toVar(),u=oe(i).toVar(),d=Ge(Ge(5)).toVar(),p=Ge().toVar(),g=Ge().toVar(),x=Ge().toVar();return p.assign(g.assign(x.assign(Ge(oe(3735928559)).add(d.shiftLeft(Ge(2))).add(Ge(13))))),p.addAssign(Ge(u)),g.addAssign(Ge(l)),x.addAssign(Ge(a)),o6(p,g,x),p.addAssign(Ge(o)),g.addAssign(Ge(s)),Yd(p,g,x)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),ni=Dr([aZ,lZ,uZ,cZ,hZ]),AZ=ce(([i,e])=>{const t=oe(e).toVar(),n=oe(i).toVar(),r=Ge(ni(n,t)).toVar(),s=Sc().toVar();return s.x.assign(r.bitAnd(oe(255))),s.y.assign(r.shiftRight(oe(8)).bitAnd(oe(255))),s.z.assign(r.shiftRight(oe(16)).bitAnd(oe(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),fZ=ce(([i,e,t])=>{const n=oe(t).toVar(),r=oe(e).toVar(),s=oe(i).toVar(),o=Ge(ni(s,r,n)).toVar(),a=Sc().toVar();return a.x.assign(o.bitAnd(oe(255))),a.y.assign(o.shiftRight(oe(8)).bitAnd(oe(255))),a.z.assign(o.shiftRight(oe(16)).bitAnd(oe(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),io=Dr([AZ,fZ]),dZ=ce(([i])=>{const e=je(i).toVar(),t=oe().toVar(),n=oe().toVar(),r=Z(Ri(e.x,t)).toVar(),s=Z(Ri(e.y,n)).toVar(),o=Z(Ea(r)).toVar(),a=Z(Ea(s)).toVar(),l=Z(n6(fr(ni(t,n),r,s),fr(ni(t.add(oe(1)),n),r.sub(1),s),fr(ni(t,n.add(oe(1))),r,s.sub(1)),fr(ni(t.add(oe(1)),n.add(oe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return r6(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),pZ=ce(([i])=>{const e=ae(i).toVar(),t=oe().toVar(),n=oe().toVar(),r=oe().toVar(),s=Z(Ri(e.x,t)).toVar(),o=Z(Ri(e.y,n)).toVar(),a=Z(Ri(e.z,r)).toVar(),l=Z(Ea(s)).toVar(),u=Z(Ea(o)).toVar(),d=Z(Ea(a)).toVar(),p=Z(i6(fr(ni(t,n,r),s,o,a),fr(ni(t.add(oe(1)),n,r),s.sub(1),o,a),fr(ni(t,n.add(oe(1)),r),s,o.sub(1),a),fr(ni(t.add(oe(1)),n.add(oe(1)),r),s.sub(1),o.sub(1),a),fr(ni(t,n,r.add(oe(1))),s,o,a.sub(1)),fr(ni(t.add(oe(1)),n,r.add(oe(1))),s.sub(1),o,a.sub(1)),fr(ni(t,n.add(oe(1)),r.add(oe(1))),s,o.sub(1),a.sub(1)),fr(ni(t.add(oe(1)),n.add(oe(1)),r.add(oe(1))),s.sub(1),o.sub(1),a.sub(1)),l,u,d)).toVar();return s6(p)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),S3=Dr([dZ,pZ]),mZ=ce(([i])=>{const e=je(i).toVar(),t=oe().toVar(),n=oe().toVar(),r=Z(Ri(e.x,t)).toVar(),s=Z(Ri(e.y,n)).toVar(),o=Z(Ea(r)).toVar(),a=Z(Ea(s)).toVar(),l=ae(n6(no(io(t,n),r,s),no(io(t.add(oe(1)),n),r.sub(1),s),no(io(t,n.add(oe(1))),r,s.sub(1)),no(io(t.add(oe(1)),n.add(oe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return r6(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),gZ=ce(([i])=>{const e=ae(i).toVar(),t=oe().toVar(),n=oe().toVar(),r=oe().toVar(),s=Z(Ri(e.x,t)).toVar(),o=Z(Ri(e.y,n)).toVar(),a=Z(Ri(e.z,r)).toVar(),l=Z(Ea(s)).toVar(),u=Z(Ea(o)).toVar(),d=Z(Ea(a)).toVar(),p=ae(i6(no(io(t,n,r),s,o,a),no(io(t.add(oe(1)),n,r),s.sub(1),o,a),no(io(t,n.add(oe(1)),r),s,o.sub(1),a),no(io(t.add(oe(1)),n.add(oe(1)),r),s.sub(1),o.sub(1),a),no(io(t,n,r.add(oe(1))),s,o,a.sub(1)),no(io(t.add(oe(1)),n,r.add(oe(1))),s.sub(1),o,a.sub(1)),no(io(t,n.add(oe(1)),r.add(oe(1))),s,o.sub(1),a.sub(1)),no(io(t.add(oe(1)),n.add(oe(1)),r.add(oe(1))),s.sub(1),o.sub(1),a.sub(1)),l,u,d)).toVar();return s6(p)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Kd=Dr([mZ,gZ]),_Z=ce(([i])=>{const e=Z(i).toVar(),t=oe(Xi(e)).toVar();return zr(ni(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),xZ=ce(([i])=>{const e=je(i).toVar(),t=oe(Xi(e.x)).toVar(),n=oe(Xi(e.y)).toVar();return zr(ni(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),vZ=ce(([i])=>{const e=ae(i).toVar(),t=oe(Xi(e.x)).toVar(),n=oe(Xi(e.y)).toVar(),r=oe(Xi(e.z)).toVar();return zr(ni(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),yZ=ce(([i])=>{const e=Lt(i).toVar(),t=oe(Xi(e.x)).toVar(),n=oe(Xi(e.y)).toVar(),r=oe(Xi(e.z)).toVar(),s=oe(Xi(e.w)).toVar();return zr(ni(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),bZ=Dr([_Z,xZ,vZ,yZ]),SZ=ce(([i])=>{const e=Z(i).toVar(),t=oe(Xi(e)).toVar();return ae(zr(ni(t,oe(0))),zr(ni(t,oe(1))),zr(ni(t,oe(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),TZ=ce(([i])=>{const e=je(i).toVar(),t=oe(Xi(e.x)).toVar(),n=oe(Xi(e.y)).toVar();return ae(zr(ni(t,n,oe(0))),zr(ni(t,n,oe(1))),zr(ni(t,n,oe(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),MZ=ce(([i])=>{const e=ae(i).toVar(),t=oe(Xi(e.x)).toVar(),n=oe(Xi(e.y)).toVar(),r=oe(Xi(e.z)).toVar();return ae(zr(ni(t,n,r,oe(0))),zr(ni(t,n,r,oe(1))),zr(ni(t,n,r,oe(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),wZ=ce(([i])=>{const e=Lt(i).toVar(),t=oe(Xi(e.x)).toVar(),n=oe(Xi(e.y)).toVar(),r=oe(Xi(e.z)).toVar(),s=oe(Xi(e.w)).toVar();return ae(zr(ni(t,n,r,s,oe(0))),zr(ni(t,n,r,s,oe(1))),zr(ni(t,n,r,s,oe(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),Hg=Dr([SZ,TZ,MZ,wZ]),Zm=ce(([i,e,t,n])=>{const r=Z(n).toVar(),s=Z(t).toVar(),o=oe(e).toVar(),a=ae(i).toVar(),l=Z(0).toVar(),u=Z(1).toVar();return Zn(o,()=>{l.addAssign(u.mul(S3(a))),u.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Wg=ce(([i,e,t,n])=>{const r=Z(n).toVar(),s=Z(t).toVar(),o=oe(e).toVar(),a=ae(i).toVar(),l=ae(0).toVar(),u=Z(1).toVar();return Zn(o,()=>{l.addAssign(u.mul(Kd(a))),u.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),EZ=ce(([i,e,t,n])=>{const r=Z(n).toVar(),s=Z(t).toVar(),o=oe(e).toVar(),a=ae(i).toVar();return je(Zm(a,o,s,r),Zm(a.add(ae(oe(19),oe(193),oe(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),RZ=ce(([i,e,t,n])=>{const r=Z(n).toVar(),s=Z(t).toVar(),o=oe(e).toVar(),a=ae(i).toVar(),l=ae(Wg(a,o,s,r)).toVar(),u=Z(Zm(a.add(ae(oe(19),oe(193),oe(17))),o,s,r)).toVar();return Lt(l,u)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),CZ=ce(([i,e,t,n,r,s,o])=>{const a=oe(o).toVar(),l=Z(s).toVar(),u=oe(r).toVar(),d=oe(n).toVar(),p=oe(t).toVar(),g=oe(e).toVar(),x=je(i).toVar(),y=ae(Hg(je(g.add(d),p.add(u)))).toVar(),T=je(y.x,y.y).toVar();T.subAssign(.5),T.mulAssign(l),T.addAssign(.5);const S=je(je(Z(g),Z(p)).add(T)).toVar(),M=je(S.sub(x)).toVar();return Ft(a.equal(oe(2)),()=>di(M.x).add(di(M.y))),Ft(a.equal(oe(3)),()=>Ii(di(M.x),di(M.y))),Ao(M,M)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),NZ=ce(([i,e,t,n,r,s,o,a,l])=>{const u=oe(l).toVar(),d=Z(a).toVar(),p=oe(o).toVar(),g=oe(s).toVar(),x=oe(r).toVar(),y=oe(n).toVar(),T=oe(t).toVar(),S=oe(e).toVar(),M=ae(i).toVar(),R=ae(Hg(ae(S.add(x),T.add(g),y.add(p)))).toVar();R.subAssign(.5),R.mulAssign(d),R.addAssign(.5);const E=ae(ae(Z(S),Z(T),Z(y)).add(R)).toVar(),N=ae(E.sub(M)).toVar();return Ft(u.equal(oe(2)),()=>di(N.x).add(di(N.y)).add(di(N.z))),Ft(u.equal(oe(3)),()=>Ii(di(N.x),di(N.y),di(N.z))),Ao(N,N)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),qA=Dr([CZ,NZ]),PZ=ce(([i,e,t])=>{const n=oe(t).toVar(),r=Z(e).toVar(),s=je(i).toVar(),o=oe().toVar(),a=oe().toVar(),l=je(Ri(s.x,o),Ri(s.y,a)).toVar(),u=Z(1e6).toVar();return Zn({start:-1,end:oe(1),name:"x",condition:"<="},({x:d})=>{Zn({start:-1,end:oe(1),name:"y",condition:"<="},({y:p})=>{const g=Z(qA(l,d,p,o,a,r,n)).toVar();u.assign(Rs(u,g))})}),Ft(n.equal(oe(0)),()=>{u.assign(hs(u))}),u}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),DZ=ce(([i,e,t])=>{const n=oe(t).toVar(),r=Z(e).toVar(),s=je(i).toVar(),o=oe().toVar(),a=oe().toVar(),l=je(Ri(s.x,o),Ri(s.y,a)).toVar(),u=je(1e6,1e6).toVar();return Zn({start:-1,end:oe(1),name:"x",condition:"<="},({x:d})=>{Zn({start:-1,end:oe(1),name:"y",condition:"<="},({y:p})=>{const g=Z(qA(l,d,p,o,a,r,n)).toVar();Ft(g.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(g)}).ElseIf(g.lessThan(u.y),()=>{u.y.assign(g)})})}),Ft(n.equal(oe(0)),()=>{u.assign(hs(u))}),u}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),LZ=ce(([i,e,t])=>{const n=oe(t).toVar(),r=Z(e).toVar(),s=je(i).toVar(),o=oe().toVar(),a=oe().toVar(),l=je(Ri(s.x,o),Ri(s.y,a)).toVar(),u=ae(1e6,1e6,1e6).toVar();return Zn({start:-1,end:oe(1),name:"x",condition:"<="},({x:d})=>{Zn({start:-1,end:oe(1),name:"y",condition:"<="},({y:p})=>{const g=Z(qA(l,d,p,o,a,r,n)).toVar();Ft(g.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(g)}).ElseIf(g.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(g)}).ElseIf(g.lessThan(u.z),()=>{u.z.assign(g)})})}),Ft(n.equal(oe(0)),()=>{u.assign(hs(u))}),u}
vendor: 4,604 bytes, line 4102
4102).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),IZ=ce(([i,e,t])=>{const n=oe(t).toVar(),r=Z(e).toVar(),s=ae(i).toVar(),o=oe().toVar(),a=oe().toVar(),l=oe().toVar(),u=ae(Ri(s.x,o),Ri(s.y,a),Ri(s.z,l)).toVar(),d=Z(1e6).toVar();return Zn({start:-1,end:oe(1),name:"x",condition:"<="},({x:p})=>{Zn({start:-1,end:oe(1),name:"y",condition:"<="},({y:g})=>{Zn({start:-1,end:oe(1),name:"z",condition:"<="},({z:x})=>{const y=Z(qA(u,p,g,x,o,a,l,r,n)).toVar();d.assign(Rs(d,y))})})}),Ft(n.equal(oe(0)),()=>{d.assign(hs(d))}),d}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),BZ=Dr([PZ,IZ]),FZ=ce(([i,e,t])=>{const n=oe(t).toVar(),r=Z(e).toVar(),s=ae(i).toVar(),o=oe().toVar(),a=oe().toVar(),l=oe().toVar(),u=ae(Ri(s.x,o),Ri(s.y,a),Ri(s.z,l)).toVar(),d=je(1e6,1e6).toVar();return Zn({start:-1,end:oe(1),name:"x",condition:"<="},({x:p})=>{Zn({start:-1,end:oe(1),name:"y",condition:"<="},({y:g})=>{Zn({start:-1,end:oe(1),name:"z",condition:"<="},({z:x})=>{const y=Z(qA(u,p,g,x,o,a,l,r,n)).toVar();Ft(y.lessThan(d.x),()=>{d.y.assign(d.x),d.x.assign(y)}).ElseIf(y.lessThan(d.y),()=>{d.y.assign(y)})})})}),Ft(n.equal(oe(0)),()=>{d.assign(hs(d))}),d}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),UZ=Dr([DZ,FZ]),OZ=ce(([i,e,t])=>{const n=oe(t).toVar(),r=Z(e).toVar(),s=ae(i).toVar(),o=oe().toVar(),a=oe().toVar(),l=oe().toVar(),u=ae(Ri(s.x,o),Ri(s.y,a),Ri(s.z,l)).toVar(),d=ae(1e6,1e6,1e6).toVar();return Zn({start:-1,end:oe(1),name:"x",condition:"<="},({x:p})=>{Zn({start:-1,end:oe(1),name:"y",condition:"<="},({y:g})=>{Zn({start:-1,end:oe(1),name:"z",condition:"<="},({z:x})=>{const y=Z(qA(u,p,g,x,o,a,l,r,n)).toVar();Ft(y.lessThan(d.x),()=>{d.z.assign(d.y),d.y.assign(d.x),d.x.assign(y)}).ElseIf(y.lessThan(d.y),()=>{d.z.assign(d.y),d.y.assign(y)}).ElseIf(y.lessThan(d.z),()=>{d.z.assign(y)})})})}),Ft(n.equal(oe(0)),()=>{d.assign(hs(d))}),d}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),T3=Dr([LZ,OZ]),kZ=ce(([i,e,t,n,r,s,o,a,l,u,d])=>{const p=oe(i).toVar(),g=je(e).toVar(),x=je(t).toVar(),y=je(n).toVar(),T=Z(r).toVar(),S=Z(s).toVar(),M=Z(o).toVar(),R=ho(a).toVar(),E=oe(l).toVar(),N=Z(u).toVar(),U=Z(d).toVar(),L=g.mul(x).add(y),F=Z(0).toVar();return Ft(p.equal(oe(0)),()=>{F.assign(Kd(L))}),Ft(p.equal(oe(1)),()=>{F.assign(Hg(L))}),Ft(p.equal(oe(2)),()=>{F.assign(T3(L,T,oe(0)))}),Ft(p.equal(oe(3)),()=>{F.assign(Wg(ae(L,0),E,N,U))}),F.assign(F.mul(M.sub(S)).add(S)),Ft(R,()=>{F.assign(ko(F,S,M))}),F}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),GZ=ce(([i,e,t,n,r,s,o,a,l,u,d])=>{const p=oe(i).toVar(),g=ae(e).toVar(),x=ae(t).toVar(),y=ae(n).toVar(),T=Z(r).toVar(),S=Z(s).toVar(),M=Z(o).toVar(),R=ho(a).toVar(),E=oe(l).toVar(),N=Z(u).toVar(),U=Z(d).toVar(),L=g.mul(x).add(y),F=Z(0).toVar();return Ft(p.equal(oe(0)),()=>{F.assign(Kd(L))}),Ft(p.equal(oe(1)),()=>{F.assign(Hg(L))}),Ft(p.equal(oe(2)),()=>{F.assign(T3(L,T,oe(0)))}),Ft(p.equal(oe(3)),()=>{F.assign(Wg(L,E,N,U))}),F.assign(F.mul(M.sub(S)).add(S)),Ft(R,()=>{F.assign(ko(F,S,M))}),F}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),VZ=ce(([i])=>{const e=i.y,t=i.z,n=ae().toVar();return Ft(e.lessThan(1e-4),()=>{n.assign(ae(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(ba(r)).mul(6).toVar();const s=oe(My(r)),o=r.sub(Z(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),u=t.mul(e.mul(o.oneMinus()).oneMinus());Ft(s.equal(oe(0)),()=>{n.assign(ae(t,u,a))}).ElseIf(s.equal(oe(1)),()=>{n.assign(ae(l,t,a))}).ElseIf(s.equal(oe(2)),()=>{n.assign(ae(a,t,u))}).ElseIf(s.equal(oe(3)),()=>{n.assign(ae(a,l,t))}).ElseIf(s.equal(oe(4)),()=>{n.assign(ae(u,a,t))}).Else(()=>{n.assign(ae(t,a,l))})}),n}
4102).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),qZ=ce(([i])=>{const e=ae(i).toVar(),t=Z(e.x).toVar(),n=Z(e.y).toVar(),r=Z(e.z).toVar(),s=Z(Rs(t,Rs(n,r))).toVar(),o=Z(Ii(t,Ii(n,r))).toVar(),a=Z(o.sub(s)).toVar(),l=Z().toVar(),u=Z().toVar(),d=Z().toVar();return d.assign(o),Ft(o.greaterThan(0),()=>{u.assign(a.div(o))}).Else(()=>{u.assign(0)}),Ft(u.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{Ft(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(Qi(2,r.sub(t).div(a)))}).Else(()=>{l.assign(Qi(4,t.sub(n).div(a)))}),l.mulAssign(1/6),Ft(l.lessThan(0),()=>{l.addAssign(1)})}),ae(l,u,d)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),zZ=ce(([i])=>{const e=ae(i).toVar(),t=ay(py(e,ae(.04045))).toVar(),n=ae(e.div(12.92)).toVar(),r=ae(oo(Ii(e.add(ae(.055)),ae(0)).div(1.055),ae(2.4))).toVar();return Mn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),a6=(i,e)=>{i=Z(i),e=Z(e);const t=je(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Go(i.sub(t),i.add(t),e)},l6=(i,e,t,n)=>Mn(i,e,t[n].clamp()),HZ=(i,e,t=ri())=>l6(i,e,t,"x"),WZ=(i,e,t=ri())=>l6(i,e,t,"y"),$Z=(i,e,t,n,r=ri())=>{const s=r.x.clamp(),o=r.y.clamp(),a=Mn(i,e,s),l=Mn(t,n,s);return Mn(a,l,o)},u6=(i,e,t,n,r)=>Mn(i,e,a6(t,n[r])),jZ=(i,e,t,n=ri())=>u6(i,e,t,n,"x"),XZ=(i,e,t,n=ri())=>u6(i,e,t,n,"y"),QZ=(i=1,e=0,t=ri())=>t.mul(i).add(e),YZ=(i,e=1)=>(i=Z(i),i.abs().pow(e).mul(i.sign())),KZ=(i,e=1,t=.5)=>Z(i).sub(t).mul(e).add(t),ZZ=(i=ri(),e=1,t=0)=>S3(i.convert("vec2|vec3")).mul(e).add(t),JZ=(i=ri(),e=1,t=0)=>Kd(i.convert("vec2|vec3")).mul(e).add(t),eJ=(i=ri(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Lt(Kd(i),S3(i.add(je(19,73)))).mul(e).add(t)),tJ=(i,e=ri(),t=je(1,1),n=je(0,0),r=1,s=0,o=1,a=!1,l=1,u=2,d=.5)=>kZ(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,u,d),nJ=(i,e=ri(),t=je(1,1),n=je(0,0),r=1,s=0,o=1,a=!1,l=1,u=2,d=.5)=>GZ(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,u,d),iJ=(i=ri(),e=1)=>BZ(i.convert("vec2|vec3"),e,oe(1)),rJ=(i=ri(),e=1)=>UZ(i.convert("vec2|vec3"),e,oe(1)),sJ=(i=ri(),e=1)=>T3(i.convert("vec2|vec3"),e,oe(1)),oJ=(i=ri())=>bZ(i.convert("vec2|vec3")),aJ=(i=ri(),e=3,t=2,n=.5,r=1)=>Zm(i,oe(e),t,n).mul(r),lJ=(i=ri(),e=3,t=2,n=.5,r=1)=>EZ(i,oe(e),t,n).mul(r),uJ=(i=ri(),e=3,t=2,n=.5,r=1)=>Wg(i,oe(e),t,n).mul(r),cJ=(i=ri(),e=3,t=2,n=.5,r=1)=>RZ(i,oe(e),t,n).mul(r),hJ=(i,e=Z(0))=>Qi(i,e),AJ=(i,e=Z(0))=>Rn(i,e),fJ=(i,e=Z(1))=>sn(i,e),dJ=(i,e=Z(1))=>js(i,e),pJ=(i,e=Z(1))=>Hd(i,e),mJ=(i,e=Z(1))=>oo(i,e),gJ=(i=Z(0),e=Z(1))=>vy(i,e),_J=()=>VA,xJ=()=>S5,vJ=(i,e=Z(1))=>Rn(e,i),yJ=(i,e,t,n)=>i.greaterThan(e).mix(t,n),bJ=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),SJ=(i,e,t,n)=>i.equal(e).mix(t,n),TJ=(i,e=null)=>{if(typeof e=="string"){const t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return i.element(t[n])}if(typeof e=="number")return i.element(e);if(typeof e=="string"&&e.length===1){const t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return i.element(t[e])}return i},MJ=(i,e=je(.5,.5),t=je(1,1),n=Z(0),r=je(0,0))=>{let s=i;if(e&&(s=s.sub(e)),t&&(s=s.mul(t)),n){const o=n.mul(Math.PI/180),a=o.cos(),l=o.sin();s=je(s.x.mul(a).sub(s.y.mul(l)),s.x.mul(l).add(s.y.mul(a)))}return e&&(s=s.add(e)),r&&(s=s.add(r)),s},wJ=(i,e)=>{i=je(i),e=Z(e);const t=e.mul(Math.PI/180);return jd(i,t)},EJ=(i,e,t)=>{i=ae(i),e=Z(e),t=ae(t);const n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=Z(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},RJ=(i,e)=>(i=ae(i),e=Z(e),Xy(i,e)),CJ=ce(([i,e,t])=>{const n=Ms(i).toVar(),r=Rn(Z(.5).mul(e.sub(t)),Ma).div(n).toVar(),s=Rn(Z(-.5).mul(e.sub(t)),Ma).div(n).toVar(),o=ae().toVar();o.x=n.x.greaterThan(Z(0)).select(r.x,s.x),o.y=n.y.greaterThan(Z(0)).select(r.y,s.y),o.z=n.z.greaterThan(Z(0)).select(r.z,s.z);const a=Rs(o.x,o.y,o.z).toVar();return Ma.add(n.mul(a)).toVar().sub(t)}),c6=ce(([i,e])=>{const t=i.x,n=i.y,r=i.z;let s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(sn(t,t).sub(sn(n,n)))),s});var B=Object.freeze({__proto__:null,BRDF_GGX:o3,BRDF_Lambert:_c,BasicPointShadowFilter:Z5,BasicShadowFilter:z5,Break:k8,Const:nC,Continue:S$,DFGLUT:Cd,D_GGX:e5,Discard:_C,EPSILON:my,F_Schlick:RA,Fn:ce,HALF_PI:YH,INFINITY:jH,If:Ft,Loop:Zn,NodeAccess:Er,NodeShaderStage:If,NodeType:mH,Node
4102UpdateType:tn,OnBeforeMaterialUpdate:zQ,OnBeforeObjectUpdate:qQ,OnMaterialUpdate:VQ,OnObjectUpdate:GQ,PCFShadowFilter:H5,PCFSoftShadowFilter:W5,PI:Wm,PI2:XH,PointShadowFilter:J5,Return:AW,Schlick_to_F0:Ex,ShaderNode:wh,Stack:xg,Switch:OH,TBNViewMatrix:Zu,TWO_PI:QH,VSMShadowFilter:$5,V_GGX_SmithCorrelated:J8,Var:tC,VarIntent:iC,abs:di,acesFilmicToneMapping:I5,acos:xy,add:Qi,addMethodChaining:Ne,addNodeElement:mW,agxToneMapping:B5,all:RR,alphaT:qm,and:fR,anisotropy:kl,anisotropyB:rc,anisotropyT:Wf,any:CR,append:qH,array:sR,arrayBuffer:GH,asin:LR,assign:oR,atan:vy,atomicAdd:$Y,atomicAnd:YY,atomicFunc:Ua,atomicLoad:HY,atomicMax:XY,atomicMin:QY,atomicOr:KY,atomicStore:WY,atomicSub:jY,atomicXor:ZY,attenuationColor:Ay,attenuationDistance:hy,attribute:Al,attributeArray:WQ,backgroundBlurriness:w5,backgroundIntensity:Dx,backgroundRotation:E5,batch:F8,bentNormalView:ZC,billboarding:TQ,bitAnd:gR,bitNot:_R,bitOr:xR,bitXor:vR,bitangentGeometry:n$,bitangentLocal:i$,bitangentView:YC,bitangentWorld:r$,bitcast:y5,blendBurn:q$,blendColor:$$,blendDodge:z$,blendOverlay:W$,blendScreen:H$,blur:a5,bool:ho,buffer:Wd,bufferAttribute:Fy,builtin:ml,builtinAOContext:JR,builtinShadowContext:ZR,bumpMap:Xy,bvec2:Z4,bvec3:ay,bvec4:J4,bypass:dC,cache:fC,call:aR,cameraFar:zl,cameraIndex:gu,cameraNear:ql,cameraNormalMatrix:NW,cameraPosition:RC,cameraProjectionMatrix:ol,cameraProjectionMatrixInverse:EC,cameraViewMatrix:go,cameraViewport:PW,cameraWorldMatrix:CW,cbrt:WR,cdl:uY,ceil:Tg,checker:jK,cineonToneMapping:L5,clamp:ko,clearcoat:km,clearcoatNormalView:Hl,clearcoatRoughness:Fh,clipSpace:PC,code:Vg,color:K4,colorSpaceToWorking:wg,colorToDirection:o$,compute:AC,computeKernel:Uy,computeSkinning:y$,context:pl,convert:tR,convertColorSpace:iW,convertToTexture:BQ,cos:Ro,countLeadingZeros:eQ,countOneBits:tQ,countTrailingZeros:JX,cross:hl,cubeTexture:os,cubeTextureBase:jy,dFdx:Sy,dFdy:Ty,dashSize:Yp,debug:vC,decrement:wR,decrementBefore:TR,defaultBuildStages:Ax,defaultShaderStages:W4,defined:wd,degrees:PR,deltaTime:mQ,densityFogFactor:G5,depth:n3,depthPass:pY,determinant:OR,difference:qR,diffuseColor:Kn,diffuseContribution:zu,directPointLight:t6,directionToColor:JC,directionToFaceDirection:kA,dispersion:fy,disposeShadowMaterial:X5,distance:VR,div:js,dot:Ao,drawIndex:L8,dynamicBufferAttribute:lW,element:eR,emissive:mx,equal:lR,equirectUV:i3,exp:gy,exp2:TA,exponentialHeightFogFactor:EY,expression:zs,faceDirection:Hy,faceForward:Py,faceforward:KH,float:Z,floatBitsToInt:YX,floatBitsToUint:b5,floor:ba,fog:Lx,fract:Oo,frameGroup:rR,frameId:S5,frontFacing:DC,fwidth:wy,gain:iQ,gapSize:gx,getConstNodeType:Y4,getCurrentStack:ry,getDirection:s5,getDistanceAttenuation:b3,getGeometryRoughness:Z8,getNormalFromDepth:UQ,getParallaxCorrectNormal:CJ,getRoughness:s3,getScreenPosition:FQ,getShIrradianceAt:c6,getShadowMaterial:j5,getShadowRenderObjectFunction:Q5,getTextureIndex:x5,getViewPosition:xh,ggxConvolution:l5,globalId:LY,glsl:TY,glslFn:MY,grayscale:sY,greaterThan:py,greaterThanEqual:AR,hash:nQ,highpModelNormalViewMatrix:vx,highpModelViewMatrix:xx,hue:lY,increment:MR,incrementBefore:SR,inspector:bC,instance:_$,instanceIndex:wa,instancedArray:$Q,instancedBufferAttribute:$m,instancedDynamicBufferAttribute:_x,instancedMesh:B8,int:oe,intBitsToFloat:KX,interleavedGradientNoise:f3,inverse:kR,inverseSqrt:_y,inversesqrt:ZH,invocationLocalIndex:g$,invocationSubgroupIndex:m$,ior:$f,iridescence:yg,iridescenceIOR:Gm,iridescenceThickness:Vm,isolate:Oh,ivec2:er,ivec3:oy,ivec4:ly,js:bY,label:eC,length:Sa,lengthSq:Cy,lessThan:cR,lessThanEqual:hR,lightPosition:g3,lightProjectionUV:V5,lightShadowMatrix:zg,lightTargetDirection:x3,lightTargetPosition:q5,lightViewPosition:_3,lightingContext:V8,lights:wK,linearDepth:jm,linearToneMapping:P5,localId:IY,log:Sg,log2:ya,logarithmicDepthToViewZ:I$,luminance:d3,mat2:vg,mat3:_r,mat4:iu,matcapUV:c5,materialAO:N8,materialAlphaTest:e8,materialAnisotropy:p8,materialAnisotropyVector:_h,materialAttenuationColor:S8,materialAttenuationDistance:b8,materialClearcoat:u8,materialClearcoatNormal:h8,materialClearcoatRoughness:c8,materialColor:t8,materialDispersion:C8,materialEmissive:i8,materialEnvIntensity:Jp,materialEnvRotation:$y,materialIOR:y8,materialIridescence:m8,materialIridescenceIOR:g8,materialIridescenceThickness:_8,materialLightMap:Yy,materialLineDashOffset:E8,materialLineDashSize:M8,materialLineGapSize:w8,materialLineScale:T8,materialLineWidth:h$,materialMetalness:a8,materialNormal:l8,materialOpacity:Qy,materialPointSize:R8,materialReference:Ka,materialReflectivity:em,materialRefractionRatio:FC,materialRotation:A8,materialRoughness:o8,materialSheen:f8,materialSheenRoughness:d8,materialShininess:n8,materialSpecular:r8,materialSpecularColor:s8,materialSpecularIntensity:wx,materialSpecularStrength:jf,materialThickness:v8,materialTransmission:x8,max:Ii,maxMipLevel:Oy,mediumpModelViewMatrix:NC,metalness:el,min:Rs,mix:Mn,mixElement:jR,mod:Hd,modInt:ER,modelDirection:OW,modelNormalMatrix:CC,modelPosition:kW,modelRadius:qW,modelScale:GW,modelViewMatrix:_u,modelViewPosition:VW,modelViewProjection:P8,modelWorldMatrix:ao,modelWorldMatrixInverse:zW,morphReference:G8,mrt:v5,mul:sn,mx_aastep:a6,mx_add:hJ,mx_atan2:gJ,mx_cell_noise_float:oJ,mx_contrast:KZ,mx_divide:dJ,mx_fractal_noise_float:aJ,mx_fractal_noise_vec2:lJ,mx_fractal_noise_vec3:uJ,mx_fractal_noise_vec4:cJ,mx_frame:xJ,mx_heighttonormal:RJ,mx_hsvtorgb:VZ,mx_ifequal:SJ,mx_ifgreater:yJ,mx_ifgreatereq:bJ,mx_
4102invert:vJ,mx_modulo:pJ,mx_multiply:fJ,mx_noise_float:ZZ,mx_noise_vec3:JZ,mx_noise_vec4:eJ,mx_place2d:MJ,mx_power:mJ,mx_ramp4:$Z,mx_ramplr:HZ,mx_ramptb:WZ,mx_rgbtohsv:qZ,mx_rotate2d:wJ,mx_rotate3d:EJ,mx_safepower:YZ,mx_separate:TJ,mx_splitlr:jZ,mx_splittb:XZ,mx_srgb_texture_to_lin_rec709:zZ,mx_subtract:AJ,mx_timer:_J,mx_transform_uv:QZ,mx_unifiednoise2d:tJ,mx_unifiednoise3d:nJ,mx_worley_noise_float:iJ,mx_worley_noise_vec2:rJ,mx_worley_noise_vec3:sJ,negate:by,neutralToneMapping:F5,nodeArray:ic,nodeImmutable:st,nodeObject:xt,nodeObjectIntent:Bf,nodeObjects:_g,nodeProxy:hn,nodeProxyIntent:Ze,normalFlat:LC,normalGeometry:Rg,normalLocal:Cs,normalMap:Mx,normalView:In,normalViewGeometry:wA,normalWorld:xu,normalWorldGeometry:IC,normalize:Ms,not:pR,notEqual:uR,numWorkgroups:PY,objectDirection:DW,objectGroup:dy,objectPosition:IW,objectRadius:UW,objectScale:BW,objectViewPosition:FW,objectWorldMatrix:LW,oneMinus:IR,or:dR,orthographicDepthToViewZ:L$,oscSawtooth:vQ,oscSine:gQ,oscSquare:_Q,oscTriangle:xQ,output:Uh,outputStruct:$X,overloadingFn:Dr,packHalf2x16:lQ,packSnorm2x16:oQ,packUnorm2x16:aQ,parabola:Px,parallaxDirection:KC,parallaxUV:s$,parameter:GX,pass:fY,passTexture:dY,pcurve:rQ,perspectiveDepthToViewZ:e3,pmremTexture:l3,pointShadow:e6,pointUV:XQ,pointWidth:zH,positionGeometry:$d,positionLocal:Pi,positionPrevious:MA,positionView:Hi,positionViewDirection:ai,positionWorld:Ma,positionWorldDirection:zy,posterize:cY,pow:oo,pow2:Ey,pow3:zR,pow4:Ry,premultiplyAlpha:$8,property:sl,quadBroadcast:SK,quadSwapDiagonal:gK,quadSwapX:pK,quadSwapY:mK,radians:NR,rand:$R,range:CY,rangeFogFactor:k5,reciprocal:FR,reference:vi,referenceBuffer:yx,reflect:GR,reflectVector:kC,reflectView:UC,reflector:NQ,refract:Ny,refractVector:GC,refractView:OC,reinhardToneMapping:D5,remap:mC,remapClamp:gC,renderGroup:Dt,renderOutput:xC,rendererReference:uC,replaceDefaultUV:yQ,rotate:jd,rotateUV:bQ,roughness:ua,round:BR,rtt:M5,sRGBTransferEOTF:sC,sRGBTransferOETF:oC,sample:kQ,sampler:bW,samplerComparison:SW,saturate:Mg,saturation:oY,screenCoordinate:Tc,screenDPR:MC,screenSize:gc,screenUV:Ta,select:Vr,setCurrentStack:Ed,setName:Dy,shaderStages:fx,shadow:K5,shadowPositionWorld:y3,shapeCircle:XK,sharedUniformGroup:bg,sheen:Os,sheenRoughness:Vl,shiftLeft:yR,shiftRight:bR,shininess:zm,sign:yy,sin:rs,sinc:sQ,skinning:O8,smoothstep:Go,smoothstepElement:XR,specularColor:cu,specularColorBlended:Yu,specularF90:Ku,spherizeUV:SQ,split:VH,spritesheetUV:wQ,sqrt:hs,stack:tm,step:mc,stepElement:QR,storage:su,storageBarrier:OY,storageTexture:R5,string:kH,struct:WX,sub:Rn,subBuild:sc,subgroupAdd:tK,subgroupAll:AK,subgroupAnd:aK,subgroupAny:fK,subgroupBallot:eK,subgroupBroadcast:_K,subgroupBroadcastFirst:dK,subgroupElect:JY,subgroupExclusiveAdd:iK,subgroupExclusiveMul:oK,subgroupInclusiveAdd:nK,subgroupInclusiveMul:sK,subgroupIndex:p$,subgroupMax:hK,subgroupMin:cK,subgroupMul:rK,subgroupOr:lK,subgroupShuffle:xK,subgroupShuffleDown:bK,subgroupShuffleUp:yK,subgroupShuffleXor:vK,subgroupSize:BY,subgroupXor:uK,tan:DR,tangentGeometry:Ng,tangentLocal:EA,tangentView:Pg,tangentWorld:QC,texture:On,texture3D:Gg,texture3DLevel:eY,texture3DLoad:JQ,textureBarrier:kY,textureBicubic:yj,textureBicubicLevel:a3,textureCubeUV:o5,textureLevel:yW,textureLoad:Fi,textureSize:ru,textureStore:YQ,thickness:cy,time:VA,toneMapping:cC,toneMappingExposure:hC,toonOutlinePass:gY,transformDirection:HR,transformNormal:BC,transformNormalToView:Wy,transformedClearcoatNormalView:jW,transformedNormalView:WW,transformedNormalWorld:$W,transmission:Hm,transpose:UR,triNoise3D:fQ,triplanarTexture:EQ,triplanarTextures:T5,trunc:My,uint:Ge,uintBitsToFloat:ZX,uniform:Ct,uniformArray:Gr,uniformCubeTexture:QW,uniformFlow:KR,uniformGroup:iR,uniformTexture:vW,unpackHalf2x16:hQ,unpackNormal:Tx,unpackSnorm2x16:uQ,unpackUnorm2x16:cQ,unpremultiplyAlpha:j$,userData:nY,uv:ri,uvec2:sy,uvec3:Sc,uvec4:uy,varying:mu,varyingProperty:Rd,vec2:je,vec3:ae,vec4:Lt,vectorComponents:yc,velocity:rY,vertexColor:W8,vertexIndex:D8,vertexStage:rC,vibrance:aY,viewZToLogarithmicDepth:t3,viewZToOrthographicDepth:kh,viewZToPerspectiveDepth:Jy,viewZToReversedOrthographicDepth:D$,viewZToReversedPerspectiveDepth:z8,viewport:Vy,viewportCoordinate:wC,viewportDepthTexture:Zy,viewportLinearDepth:B$,viewportMipTexture:Ky,viewportOpaqueMipTexture:q8,viewportResolution:RW,viewportSafeUV:MQ,viewportSharedTexture:AY,viewportSize:qy,viewportTexture:C$,viewportUV:EW,vogelDiskSample:Po,wgsl:SY,wgslFn:wY,workgroupArray:qY,workgroupBarrier:UY,workgroupId:DY,workingToColorSpace:aC,xor:mR});const bo=new u3;class NJ extends vu{constructor(e,t){super(),this.renderer=e,this.nodes=t}
4102update(e,t,n){const r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background;let o=!1;if(s===null)r._clearColor.getRGB(bo),bo.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(bo),bo.a=1,o=!0;else if(s.isNode===!0){const l=this.get(e),u=s;bo.copy(r._clearColor);let d=l.backgroundMesh;if(d===void 0){let E=function(){s.removeEventListener("dispose",E),d.material.dispose(),d.geometry.dispose()};const g=Lt(u).mul(Dx).context({getUV:()=>E5.mul(IC),getTextureLevel:()=>w5}),x=ol.element(3).element(3).equal(1),y=js(1,ol.element(1).element(1)).mul(3),T=x.select(Pi.mul(y),Pi),S=_u.mul(Lt(T,0));let M=ol.mul(Lt(S.xyz,1));M=M.setZ(M.w);const R=new Vi;R.name="Background.material",R.side=Xn,R.depthTest=!1,R.depthWrite=!1,R.allowOverride=!1,R.fog=!1,R.lights=!1,R.vertexNode=M,R.colorNode=g,l.backgroundMeshNode=g,l.backgroundMesh=d=new Qn(new Fa(1,32,32),R),d.frustumCulled=!1,d.name="Background.mesh",s.addEventListener("dispose",E)}const p=u.getCacheKey();l.backgroundCacheKey!==p&&(l.backgroundMeshNode.node=Lt(u).mul(Dx),l.backgroundMeshNode.needsUpdate=!0,d.material.needsUpdate=!0,l.backgroundCacheKey=p),t.unshift(d,d.geometry,d.material,0,0,null,null)}else ke("Renderer: Unsupported background configuration.",s);const a=r.xr.getEnvironmentBlendMode();if(a==="additive"?bo.set(0,0,0,1):a==="alpha-blend"&&bo.set(0,0,0,0),r.autoClear===!0||o===!0){const l=n.clearColorValue;l.r=bo.r,l.g=bo.g,l.b=bo.b,l.a=bo.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r.getClearDepth(),n.stencilClearValue=r.getClearStencil(),n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}}let PJ=0;class Ix{constructor(e="",t=[],n=0){this.name=e,this.bindings=t,this.index=n,this.id=PJ++}}class DJ{constructor(e,t,n,r,s,o,a,l,u,d=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=d,this.nodeAttributes=r,this.bindings=s,this.updateNodes=o,this.updateBeforeNodes=a,this.updateAfterNodes=l,this.observer=u,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){const r=new Ix(t.name,[],t.index);e.push(r);for(const s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}}class jM{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class LJ{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class h6{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}}class IJ extends h6{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}}class BJ{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let FJ=0;class H2{constructor(e=null){this.id=FJ++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class UJ{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class yu{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}}class OJ extends yu{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class kJ extends yu{constructor(e,t=new We){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class GJ extends yu{constructor(e,t=new J){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class VJ extends yu{constructor(e,t=new rn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class qJ extends yu{constructor(e,t=new It){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class zJ extends yu{constructor(e,t=new hg){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class HJ extends yu{constructor(e,t=new pn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class WJ extends yu{constructor(e,t=new nn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class $J extends OJ{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class jJ extends kJ{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class XJ extends GJ{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class QJ extends VJ{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class YJ extends qJ{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class KJ extends zJ{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class ZJ extends HJ{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class JJ extends WJ{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}let eee=0;const XM=new WeakMap,tee=new WeakMap,nee=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),bp=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0"));class A6{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=tm(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new H2,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:eee++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}
4102isOpaque(){const e=this.material;return e.transparent===!1&&e.blending===mr&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new Ba(e,t,n)}createCubeRenderTarget(e,t){return new j8(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){const n=t[0].groupNode;let r=n.shared;if(r)for(let o=1;o<t.length;o++)n!==t[o].groupNode&&(r=!1);let s;if(r){let o="";for(const d of t)if(d.isNodeUniformsGroup){d.uniforms.sort((p,g)=>p.nodeUniform.node.id-g.nodeUniform.node.id);for(const p of d.uniforms)o+=p.nodeUniform.node.id}else o+=d.nodeUniform.id;const a=this.renderer._currentRenderContext||this.renderer;let l=XM.get(a);l===void 0&&(l=new Map,XM.set(a,l));const u=OA(o);s=l.get(u),s===void 0&&(s=new Ix(e,t,this.bindingsIndexes[e].group),l.set(u,s))}else s=new Ix(e,t,this.bindingsIndexes[e].group);return s}getBindGroupArray(e,t){const n=this.bindings[t];let r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){const t={},n=this.bindings;for(const r of fx)for(const s in n[r]){const o=n[r][s],a=t[s]||(t[s]=[]);for(const l of o)a.includes(l)===!1&&a.push(l)}e=[];for(const r in t){const s=t[r],o=this._getBindGroup(r,s);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){const n=e[t];this.bindingsIndexes[n.name].group=t,n.index=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.includes(e)===!1&&(this.nodes.push(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){const t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();(t!==tn.NONE||n!==tn.NONE)&&this.sequentialNodes.includes(e)===!1&&this.sequentialNodes.push(e)}buildUpdateNodes(){for(const e of this.nodes)e.getUpdateType()!==tn.NONE&&this.updateNodes.push(e);for(const e of this.sequentialNodes){const t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==tn.NONE&&this.updateBeforeNodes.push(e),n!==tn.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===li||e.magFilter===Ph||e.magFilter===Ja||e.magFilter===vs||e.minFilter===li||e.minFilter===Ph||e.minFilter===Ja||e.minFilter===vs}getUniformBufferLimit(){return 16384}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){const t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){const e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){const n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new H2(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){Oe("Abstract function.")}getInstanceIndex(){Oe("Abstract function.")}getDrawIndex(){Oe("Abstract function.")}getFrontFacing(){Oe("Abstract function.")}getFragCoord(){Oe("Abstract function.")}isFlipY(){return!1}increaseUsage(e){const t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,t.usageCount}generateTexture(){Oe("Abstract function.")}generateTextureLod(){Oe("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let r=this.generateArrayDeclaration(e,t)+"( ";for(let s=0;s<t;s++){const o=n?n[s]:null;o!==null?r+=o.build(this,e):r+=this.generateConst(e),s<t-1&&(r+=", ")}return r+=" )",r}generateStruct(e,t,n=null){const r=[];for(const s of t){const{name:o,type:a}=s;n&&n[o]&&n[o].isNode?r.push(n[o].build(this,a)):r.push(this.generateConst(a))}return e+"( "+r.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new It:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new We:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new J:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new rn)),e==="float")return bp(t);
4102if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${bp(t.r)}, ${bp(t.g)}, ${bp(t.b)} )`;const n=this.getTypeLength(e),r=this.getComponentType(e),s=o=>this.generateConst(r,o);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){const n=this.attributes;for(const s of n)if(s.name===e)return s;const r=new jM(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===dr)return"int";if(t===ii)return"uint"}return"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=q4(e);const r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return nee.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const n=t.array,r=e.itemSize,s=e.normalized;let o;return!(e instanceof sE)&&s!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(r,o)}getTypeLength(e){const t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=tm(this.stack);const e=ry();return this.stacks.push(e),Ed(this.stack),this.stack}removeStack(){const e=this.stack;for(const t of e.nodes){const n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,Ed(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={});let s=r[t];const o=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(o);return a&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[a]||(s.subBuildsCache[a]={}),s.subBuilds=o),s}getNodeProperties(e,t="any"){const n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const n=this.getDataFromNode(e,"vertex");let r=n.bufferAttribute;if(r===void 0){const s=this.uniforms.index++;r=new jM("nodeAttribute"+s,t,e),this.bufferAttributes.push(r),n.bufferAttribute=r}return r}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){const s=this.getDataFromNode(e,r,this.globalCache);let o=s.structType;if(o===void 0){const a=this.structs.index++;n===null&&(n="StructType"+a),o=new UJ(n,t),this.structs[r].push(o),this.types[r][n]=e,s.structType=o}return o}getOutputStructTypeFromNode(e,t){const n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){const s=this.getDataFromNode(e,n,this.globalCache);let o=s.uniform;if(o===void 0){const a=this.uniforms.index++;o=new LJ(r||"nodeUniform"+a,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),s.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,s=!1){const o=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",o.subBuilds);let l=o[a];if(l===void 0){const u=s?"_const":"_var",d=this.vars[r]||(this.vars[r]=[]),p=this.vars[u]||(this.vars[u]=0);t===null&&(t=(s?"nodeConst":"nodeVar")+p,this.vars[u]++),a!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));const g=e.getArrayCount(this);l=new h6(t,n,s,g),s||d.push(l),this.registerDeclaration(l),o[a]=l}return l}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(const t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,s=null){const o=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",o.subBuilds);let l=o[a];if(l===void 0){const u=this.varyings,d=u.length;t===null&&(t="nodeVarying"+d),a!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),l=new IJ(t,n,r,s),u.push(l),this.registerDeclaration(l),o[a]=l}return l}registerDeclaration(e){const t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=this.getPropertyName(e);let s=1,o=r;for(;n[o]!==void 0;)o=r+"_"+s++;s>1&&(e.name=o,Oe(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${o}'.`)),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){const r=this.getDataFromNode(e);let s=r.code;if(s===void 0){const o=this.codes[n]||(this.codes[n]=[]),a=o.length;s=new BJ("nodeCode"+a,t),o.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e);let s=!0,o=t;for(;o;){if(r.get(o)===!0){s=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(s)for(const a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){const r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),o=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`; 4103`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=new U5,n=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=n,t}flowShaderNode(e){const t=e.layout,n={[Symbol.iterator](){let o=0;const a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};
4103for(const o of t.inputs)n[o.name]=new m5(o.type,o.name);e.layout=null;const r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowBuildStage(e,t,n=null){const r=this.getBuildStage();this.setBuildStage(t);const s=e.build(this,n);return this.setBuildStage(r),s}flowStagesNode(e,t=null){const n=this.flow,r=this.vars,s=this.declarations,o=this.cache,a=this.buildStage,l=this.stack,u={code:""};this.flow=u,this.vars={},this.declarations={},this.cache=new H2,this.stack=tm();for(const d of Ax)this.setBuildStage(d),u.result=e.build(this,t);return u.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=s,this.cache=o,this.stack=l,this.setBuildStage(a),u}getFunctionOperator(){return null}buildFunctionCode(){Oe("Abstract function.")}flowChildNode(e,t=null){const n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){const s=this.tab,o=this.cache,a=this.shaderStage,l=this.context;this.setShaderStage(e);const u={...this.context};delete u.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=u;let d=null;if(this.buildStage==="generate"){const p=this.flowChildNode(t,n);r!==null&&(p.code+=`${this.tab+r} = ${p.result}; 4104`),this.flowCode[e]=this.flowCode[e]+p.code,d=p}else d=t.build(this);return this.setShaderStage(a),this.cache=o,this.tab=s,this.context=l,d}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){Oe("Abstract function.")}getVaryings(){Oe("Abstract function.")}getVar(e,t,n=null){return`${n!==null?this.generateArrayDeclaration(e,n):this.getType(e)} ${t}`}getVars(e){let t="";const n=this.vars[e];if(n!==void 0)for(const r of n)t+=`${this.getVar(r.type,r.name)}; `;return t}getUniforms(){Oe("Abstract function.")}getCodes(e){const t=this.codes[e];let n="";if(t!==void 0)for(const r of t)n+=r.code+` 4105`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){Oe("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;const n=this.subBuildLayers;for(let r=t.length-1;r>=0;r--){const s=t[r];if(n.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let r;return n?r=e?n+"_"+e:n:r=e,r}build(){const{object:e,material:t,renderer:n}=this;if(t!==null){let r=n.library.fromMaterial(t);r===null&&(ke(`NodeMaterial: Material "${t.type}" is not compatible.`),r=new Vi),r.build(this)}else this.addFlow("compute",e);for(const r of Ax){this.setBuildStage(r),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(const s of fx){this.setShaderStage(s);const o=this.flowNodes[s];for(const a of o)r==="generate"?this.flowNode(a):a.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=tee.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){const n=this.getSharedDataFromNode(e);let r=n.cache;if(r===void 0){if(t==="float"||t==="int"||t==="uint")r=new $J(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new jJ(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new XJ(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new QJ(e);else if(t==="color")r=new YJ(e);else if(t==="mat2")r=new KJ(e);else if(t==="mat3")r=new ZJ(e);else if(t==="mat4")r=new JJ(e);else throw new Error(`Uniform "${t}" not implemented.`);n.cache=r}return r}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;const r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:r===9&&s===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),n)):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${NA} - Node System 4106`}needsPreviousData(){const e=this.renderer.getMRT();return e&&e.has("velocity")||H4(this.object).useVelocity===!0}}class QM{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===tn.FRAME){const r=this._getMaps(this.updateBeforeMap,n);if(r.frameId!==this.frameId){const s=r.frameId;r.frameId=this.frameId,e.updateBefore(this)===!1&&(r.frameId=s)}}else if(t===tn.RENDER){const r=this._getMaps(this.updateBeforeMap,n);if(r.renderId!==this.renderId){const s=r.renderId;r.renderId=this.renderId,e.updateBefore(this)===!1&&(r.renderId=s)}}else t===tn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===tn.FRAME){const r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===tn.RENDER){const r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===tn.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===tn.FRAME){const r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===tn.RENDER){const r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===tn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class M3{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qual
4106ifier=r,this.isConst=s}}M3.isNodeFunctionInput=!0;class iee extends Mc{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class ree extends Mc{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:x3(this.light),lightColor:e}}}class see extends Mc{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=g3(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Ct(new It).setGroup(Dt)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,o=xu.dot(r).mul(.5).add(.5),a=Mn(n,t,o);e.context.irradiance.addAssign(a)}}class w3 extends Mc{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Ct(0).setGroup(Dt),this.penumbraCosNode=Ct(0).setGroup(Dt),this.cutoffDistanceNode=Ct(0).setGroup(Dt),this.decayExponentNode=Ct(0).setGroup(Dt),this.colorNode=Ct(this.color).setGroup(Dt)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){const{coneCosNode:n,penumbraCosNode:r}=this;return Go(n,r,t)}getLightCoord(e){const t=e.getNodeProperties(this);let n=t.projectionUV;return n===void 0&&(n=V5(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:s}=this,o=this.getLightVector(e),a=o.normalize(),l=a.dot(x3(s)),u=this.getSpotAttenuation(e,l),d=o.length(),p=b3({lightDistance:d,cutoffDistance:n,decayExponent:r});let g=t.mul(u).mul(p),x,y;return s.colorNode?(y=this.getLightCoord(e),x=s.colorNode(y)):s.map&&(y=this.getLightCoord(e),x=On(s.map,y.xy).onRenderUpdate(()=>s.map)),x&&(g=y.mul(2).sub(1).abs().lessThan(1).all().select(g.mul(x),g)),{lightColor:g,lightDirection:a}}}class oee extends w3{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){const n=this.light.iesMap;let r=null;if(n&&n.isTexture===!0){const s=t.acos().mul(1/Math.PI);r=On(n,je(s,0),0).r}else r=super.getSpotAttenuation(t);return r}}class aee extends Mc{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new J);this.lightProbe=Gr(t)}update(e){const{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){const t=c6(xu,this.lightProbe);e.context.irradiance.addAssign(t)}}const lee=ce(([i,e])=>{const t=i.abs().sub(e);return Sa(Ii(t,0)).add(Rs(Ii(t.x,t.y),0))});class uee extends w3{static get type(){return"ProjectorLightNode"}update(e){super.update(e);const t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=Z(0),n=this.penumbraCosNode,r=zg(this.light).mul(e.context.positionWorld||Ma);return Ft(r.w.greaterThan(0),()=>{const s=r.xyz.div(r.w),o=lee(s.xy.sub(je(.5)),je(.5)),a=js(-1,Rn(1,xy(n)).sub(1));t.assign(Mg(o.mul(-2).mul(a)))}),t}}const W2=new nn,Sp=new nn;let bf=null;class cee extends Mc{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Ct(new J).setGroup(Dt),this.halfWidth=Ct(new J).setGroup(Dt),this.updateType=tn.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;Sp.identity(),W2.copy(t.matrixWorld),W2.premultiply(n),Sp.extractRotation(W2),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(Sp),this.halfHeight.value.applyMatrix4(Sp)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=On(bf.LTC_FLOAT_1),n=On(bf.LTC_FLOAT_2)):(t=On(bf.LTC_HA
4106LF_1),n=On(bf.LTC_HALF_2));const{colorNode:r,light:s}=this,o=_3(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){bf=e}}class f6{parseFunction(){Oe("Abstract function.")}}class E3{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Oe("Abstract function.")}}E3.isNodeFunction=!0;const hee=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,Aee=/[a-z_0-9]+/ig,YM="#pragma main",fee=i=>{i=i.trim();const e=i.indexOf(YM),t=e!==-1?i.slice(e+YM.length):i,n=t.match(hee);if(n!==null&&n.length===5){const r=n[4],s=[];let o=null;for(;(o=Aee.exec(r))!==null;)s.push(o);const a=[];let l=0;for(;l<s.length;){const y=s[l][0]==="const";y===!0&&l++;let T=s[l][0];T==="in"||T==="out"||T==="inout"?l++:T="";const S=s[l++][0];let M=Number.parseInt(s[l][0]);Number.isNaN(M)===!1?l++:M=null;const R=s[l++][0];a.push(new M3(S,R,M,T,y))}const u=t.substring(n[0].length),d=n[3]!==void 0?n[3]:"",p=n[2],g=n[1]!==void 0?n[1]:"",x=e!==-1?i.slice(0,e):"";return{type:p,inputs:a,name:d,precision:g,inputsCode:r,blockCode:u,headerCode:x}}else throw new Error("FunctionNode: Function is not a GLSL code.")};class dee extends E3{constructor(e){const{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=fee(e);super(t,n,r,s),this.inputsCode=o,this.blockCode=a,this.headerCode=l}getCode(e=this.name){let t;const n=this.blockCode;if(n!==""){const{type:r,inputsCode:s,headerCode:o,precision:a}=this;let l=`${r} ${e} ( ${s.trim()} )`;a!==""&&(l=`${a} ${l}`),t=o+l+n}else t="";return t}}class pee extends f6{parseFunction(e){return new dee(e)}}const KM=new WeakMap,eo=[],Il=[];class mee extends vu{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new QM,this.nodeBuilderCache=new Map,this.callHashCache=new hu,this.groupsData=new hu,this.cacheLib={}}updateGroup(e){const t=e.groupNode,n=t.name;if(n===dy.name)return!0;if(n===Dt.name){const s=this.get(e),o=this.nodeFrame.renderId;return s.renderId!==o?(s.renderId=o,!0):!1}if(n===rR.name){const s=this.get(e),o=this.nodeFrame.frameId;return s.frameId!==o?(s.frameId=o,!0):!1}eo[0]=t,eo[1]=e;let r=this.groupsData.get(eo);return r===void 0&&this.groupsData.set(eo,r={}),eo[0]=null,eo[1]=null,r.version!==t.version?(r.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}getForRender(e){const t=this.get(e);let n=t.nodeBuilderState;if(n===void 0){const{nodeBuilderCache:r}=this,s=this.getForRenderCacheKey(e);if(n=r.get(s),n===void 0){const o=l=>{const u=this.backend.createNodeBuilder(e.object,this.renderer);return u.scene=e.scene,u.material=l,u.camera=e.camera,u.context.material=l,u.lightsNode=e.lightsNode,u.environmentNode=this.getEnvironmentNode(e.scene),u.fogNode=this.getFogNode(e.scene),u.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&u.enableMultiview(),u};let a=o(e.material);try{a.build()}catch(l){a=o(new Vi),a.build();let u=l.stackTrace;!u&&l.stack&&(u=new $i(l.stack)),ke("TSL: "+l,u)}n=this._createNodeBuilderState(a),r.set(s,n)}n.usedTimes++,t.nodeBuilderState=n}return n}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e))}return super.delete(e)}getForCompute(e){const t=this.get(e);let n=t.nodeBuilderState;if(n===void 0){const r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n}return n}_createNodeBuilderState(e){return new DJ(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.transforms)}getEnvironmentNode(e){this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{const n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}
4106getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{const n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){eo[0]=e,eo[1]=t;const n=this.renderer.info.calls,r=this.callHashCache.get(eo)||{};if(r.callId!==n){const s=this.getEnvironmentNode(e),o=this.getFogNode(e);t&&Il.push(t.getCacheKey(!0)),s&&Il.push(s.getCacheKey()),o&&Il.push(o.getCacheKey()),Il.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Il.push(this.renderer.shadowMap.enabled?1:0),Il.push(this.renderer.shadowMap.type),r.callId=n,r.cacheKey=qd(Il),this.callHashCache.set(eo,r),Il.length=0}return eo[0]=null,eo[1]=null,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),n=e.background;if(n){const r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){const s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===Ch||n.mapping===Nh||n.mapping===ac){if(e.backgroundBlurriness>0||n.mapping===ac)return l3(n);{let o;return n.isCubeTexture===!0?o=os(n):o=On(n),Q8(o)}}else{if(n.isTexture===!0)return On(n,Ta.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&ke("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){const s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let o=s.get(t);return(o===void 0||r)&&(o=n(),s.set(t,o)),o}updateFog(e){const t=this.get(e),n=e.fog;if(n){if(t.fog!==n){const r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){const s=vi("color","color",n).setGroup(Dt),o=vi("density","float",n).setGroup(Dt);return Lx(s,G5(o))}else if(n.isFog){const s=vi("color","color",n).setGroup(Dt),o=vi("near","float",n).setGroup(Dt),a=vi("far","float",n).setGroup(Dt);return Lx(s,k5(o,a))}else ke("Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),n=e.environment;if(n){if(t.environment!==n){const r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return os(n);if(n.isTexture===!0)return On(n);ke("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){const o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=r,o.material=s,o}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}hasOutputChange(e){return KM.get(e)!==this.getOutputCacheKey()}getOutputNode(e){const t=this.renderer,n=this.getOutputCacheKey(),r=e.isArrayTexture?Gg(e,ae(Ta,ml("gl_ViewID_OVR"))).renderOutput(t.toneMapping,t.currentColorSpace):On(e,Ta).renderOutput(t.toneMapping,t.currentColorSpace);return KM.set(e,n),r}updateBefore(e){const t=e.getNodeBuilderState();for(const n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){const t=e.getNodeBuilderState();for(const n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){const t=this.getNodeFrame(),n=this.getForCompute(e);for(const r of n.updateNodes)t.updateNode(r)}updateForRender(e){const t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(const r of n.updateNodes)t.updateNode(r)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new QM,this.nodeBuilderCache=new Map,this.cacheLib={}}}const $2=new oa;class Jm{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new pn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,n){const r=e.length;for(let s=0;s<r;s++){$2.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);const o=t[n+s],a=$2.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=$2.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix=t.matrixWorldInverse,this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);const r=t.clippingPlanes,s=r.length;let o,a;if(this.clipIntersection?(o=this.intersectionPlanes,a=e.intersectionPlanes.length):(o=this.unionPlanes,a=e.unionPlanes.length),o.length!==a+s){o.length=a+s;for(let l=0;l<s;l++)o[a+l]=new rn;n=!0}this.projectPlanes(r,o,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}
4106getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new Jm(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}}class gee{constructor(e,t){this.bundleGroup=e,this.camera=t}}const hh=[];class _ee{constructor(){this.bundles=new hu}get(e,t){const n=this.bundles;hh[0]=e,hh[1]=t;let r=n.get(hh);return r===void 0&&(r=new gee(e,t),n.set(hh,r)),hh[0]=null,hh[1]=null,r}dispose(){this.bundles=new hu}}class d6{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null;const n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(const r in e)t[r]=e[r]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){Oe(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){Oe(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`Base class ${t.name} is not a class.`);n.set(t,e)}}const xee=new v3,ZM=new WeakMap;class vee{createNode(e=[]){return new v3().setLights(e)}getNode(e){if(e.isQuadMesh)return xee;let t=ZM.get(e);return t===void 0&&(t=this.createNode(),ZM.set(e,t)),t}}class Ff extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}}const JM=new J,ew=new J;class yee extends Ia{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new pr,this._cameraL.viewport=new rn,this._cameraR=new pr,this._cameraR.viewport=new rn,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new SE,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._frameBufferTargets=null,this._createXRLayer=Eee.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSize=new We,this._onSessionEvent=Tee.bind(this),this._onSessionEnd=Mee.bind(this),this._onInputSourcesChange=wee.bind(this),this._onAnimationFrame=Ree.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){if(!(this._glProjLayer===null&&this._glBaseLayer===null))return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&Oe("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&Oe("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,r,s,o,a,l={}){const u=new Fd(e,t),d=new Ff(s,o,{format:Wi,type:yi,depthTexture:new qr(s,o,l.stencil?Hs:ii,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?as:Rr),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});d._autoAllocateDepthBuffer=!0;const p=new qs({color:16777215,side:cs});p.map=d.texture,p.map.offset.y=1,p.map.repeat.y=-1;const g=new Qn(u,p);g.position.copy(n),g.quaternion.copy(r);const x={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:g,material:p,rendercall:a,renderTarget:d};if(this._layers.push(x),this._session!==null){x.plane.material=new qs({color:16777215,side:cs}),x.plane.material.blending=Ju,x.plane.material.blendEquation=Mr,x.plane.material.blendSrc=Xa,x.plane.material.blendDst=Xa,x.xrlayer=this._createXRLayer(x);const y=this._session.renderState.layers;y.unshift(x.xrlayer),this._session.updateRenderState({layers:y})}else d.isXRRenderTarget=!1;return g}createCylinderLayer(e,t,n,r,s,o,a,l,u={}){const d=new ug(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),p=new Ff(o,a,{format:Wi,type:yi,depthTexture:new qr(o,a,u.stencil?Hs:ii,void 0,void 0,void 0,void 0,void 0,void 0,u.stencil?as:Rr),stencilBuffer:u.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});p._autoAllocateDepthBuffer=!0;const g=new qs({color:16777215,side:Xn});g.map=p.texture,g.map.offset.y=1,g.map.repeat.y=-1;const x=new Qn(d,g);x.position.copy(r),x.quaternion.copy(s);
4106const y={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:x,material:g,rendercall:l,renderTarget:p};if(this._layers.push(y),this._session!==null){y.plane.material=new qs({color:16777215,side:Xn}),y.plane.material.blending=Ju,y.plane.material.blendEquation=Mr,y.plane.material.blendSrc=Xa,y.plane.material.blendDst=Xa,y.xrlayer=this._createXRLayer(y);const T=this._session.renderState.layers;T.unshift(y.xrlayer),this._session.updateRenderState({layers:T})}else p.isXRRenderTarget=!1;return x}renderLayers(){const e=new J,t=new ll,n=this._renderer,r=this.isPresenting,s=n.getOutputRenderTarget(),o=n._frameBufferTarget;this.isPresenting=!1;const a=new We;n.getSize(a);const l=n._quad;for(const u of this._layers)if(u.renderTarget.isXRRenderTarget=this._session!==null,u.renderTarget._hasExternalTextures=u.renderTarget.isXRRenderTarget,u.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){u.xrlayer.transform=new XRRigidTransform(u.plane.getWorldPosition(e),u.plane.getWorldQuaternion(t));const d=this._glBinding.getSubImage(u.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(u.renderTarget,d.colorTexture,void 0),n._setXRLayerSize(u.renderTarget.width,u.renderTarget.height),n.setOutputRenderTarget(u.renderTarget),n.setRenderTarget(null),n._frameBufferTarget=null,this._frameBufferTargets||(this._frameBufferTargets=new WeakMap);const{frameBufferTarget:p,quad:g}=this._frameBufferTargets.get(u.renderTarget)||{frameBufferTarget:null,quad:null};p?(n._frameBufferTarget=p,n._quad=g):(n._quad=new Og(new Vi),this._frameBufferTargets.set(u.renderTarget,{frameBufferTarget:n._getFrameBufferTarget(),quad:n._quad})),u.rendercall(),n._frameBufferTarget=null}else n.setRenderTarget(u.renderTarget),u.rendercall();n.setRenderTarget(null),n.setOutputRenderTarget(s),n._frameBufferTarget=o,n._setXRLayerSize(a.x,a.y),n._quad=l,this.isPresenting=r}getSession(){return this._session}async setSession(e){const t=this._renderer,n=t.backend;this._gl=t.getContext();const r=this._gl,s=r.getContextAttributes();if(this._session=e,e!==null){if(n.isWebGPUBackend===!0)throw new Error('THREE.XRManager: XR is currently not supported with a WebGPU backend. Use WebGL by passing "{ forceWebGL: true }" to the constructor of the renderer.');if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),await n.makeXRCompatible(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._supportsLayers===!0){let o=null,a=null,l=null;t.depth&&(l=t.stencil?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24,o=t.stencil?as:Rr,a=t.stencil?Hs:ii);const u={colorFormat:r.RGBA8,depthFormat:l,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(u.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();const d=this._glBinding.createProjectionLayer(u),p=[d];this._glProjLayer=d,t.setPixelRatio(1),t._setXRLayerSize(d.textureWidth,d.textureHeight);const g=this._useMultiview?2:1,x=new qr(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,o,g);if(this._xrRenderTarget=new Ff(d.textureWidth,d.textureHeight,{format:Wi,type:yi,colorSpace:t.outputColorSpace,depthTexture:x,stencilBuffer:t.stencil,samples:s.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(const y of this._layers)y.plane.material=new qs({color:16777215,side:y.type==="cylinder"?Xn:cs}),y.plane.material.blending=Ju,y.plane.material.blendEquation=Mr,y.plane.material.blendSrc=Xa,y.plane.material.blendDst=Xa,y.xrlayer=this._createXRLayer(y),p.unshift(y.xrlayer);e.updateRenderState({layers:p})}else{const o={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},a=new XRWebGLLayer(e,r,o);this._glBaseLayer=a,e.updateRenderState({baseLayer:a}),t.setPixelRatio(1),t._setXRLayerSize(a.framebufferWidth,a.framebufferHeight),this._xrRenderTarget=new Ff(a.framebufferWidth,a.framebufferHeight,{format:Wi,type:yi,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:a.ignoreDepthValues===!1,resolveStencilBuffer:a.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}this.setFoveation(this.getFoveation()),t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){const t=this._session;if(t===null)return;const n=e.near,r=e.far,s=this._cameraXR,o=this._cameraL,a=this._cameraR;s.near=a.near=o.near=n,s.far=a.far=o.far=r,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,o.layers.mask=s.layers.mask&-5,a.layers.mask=s.layers.mask&-3;const l=e.parent,u=s.cameras;tw(s,l);for(let d=0;d<u.length;d++)tw(u[d],l);u.length===2?bee(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),See(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new kp,this._controllers[e]=t),t}}function bee(i,e,t){JM.setFromMatrixPosition(e.matrixWorld),ew.setFromMatrixPosition(t.matrixWorld);const n=JM.distanceTo(ew),r=e.projectionMatrix.elements,s=t.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],d=(r[8]-1)/r[0],p=(s[8]+1)/s[0],g=o*d,x=o*p,y=n/(-d+p),T=y*-d;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(T),i.translateZ(y),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),r[10]===-1)i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const S=o+y,M=a+y,R=g-T,E=x+(n-T),N=l*a/M*S,U=u*a/M*S;i.projectionMatrix.makePerspective(R,E,N,U,S,M),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}
4106function tw(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function See(i,e,t){t===null?i.matrix.copy(e.matrixWorld):(i.matrix.copy(t.matrixWorld),i.matrix.invert(),i.matrix.multiply(e.matrixWorld)),i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse),i.isPerspectiveCamera&&(i.fov=Ac*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function Tee(i){const e=this._controllerInputSources.indexOf(i.inputSource);if(e===-1)return;const t=this._controllers[e];if(t!==void 0){const n=this.getReferenceSpace();t.update(i.inputSource,i.frame,n),t.dispatchEvent({type:i.type,data:i.inputSource})}}function Mee(){const i=this._session,e=this._renderer;i.removeEventListener("select",this._onSessionEvent),i.removeEventListener("selectstart",this._onSessionEvent),i.removeEventListener("selectend",this._onSessionEvent),i.removeEventListener("squeeze",this._onSessionEvent),i.removeEventListener("squeezestart",this._onSessionEvent),i.removeEventListener("squeezeend",this._onSessionEvent),i.removeEventListener("end",this._onSessionEnd),i.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){const n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,e._resetXRState(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(const t of this._layers)t.renderTarget=new Ff(t.pixelwidth,t.pixelheight,{format:Wi,type:yi,depthTexture:new qr(t.pixelwidth,t.pixelheight,t.stencilBuffer?Hs:ii,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?as:Rr),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function wee(i){const e=this._controllers,t=this._controllerInputSources;for(let n=0;n<i.removed.length;n++){const r=i.removed[n],s=t.indexOf(r);s>=0&&(t[s]=null,e[s].disconnect(r))}for(let n=0;n<i.added.length;n++){const r=i.added[n];let s=t.indexOf(r);if(s===-1){for(let a=0;a<e.length;a++)if(a>=t.length){t.push(r),s=a;break}else if(t[a]===null){t[a]=r,s=a;break}if(s===-1)break}const o=e[s];o&&o.connect(r)}}function Eee(i){return i.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(i.translation,i.quaternion),width:i.width/2,height:i.height/2,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(i.translation,i.quaternion),radius:i.radius,centralAngle:i.centralAngle,aspectRatio:i.aspectRatio,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1})}function Ree(i,e){if(e===void 0)return;const t=this._cameraXR,n=this._renderer,r=n.backend,s=this._glBaseLayer,o=this.getReferenceSpace(),a=e.getViewerPose(o);if(this._xrFrame=e,a!==null){const l=a.views;this._glBaseLayer!==null&&r.setXRTarget(s.framebuffer);let u=!1;l.length!==t.cameras.length&&(t.cameras.length=0,u=!0);for(let d=0;d<l.length;d++){const p=l[d];let g;if(this._supportsLayers===!0){const y=this._glBinding.getViewSubImage(this._glProjLayer,p);g=y.viewport,d===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,y.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:y.depthStencilTexture)}else g=s.getViewport(p);let x=this._cameras[d];x===void 0&&(x=new pr,x.layers.enable(d),x.viewport=new rn,this._cameras[d]=x),x.matrix.fromArray(p.transform.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale),x.projectionMatrix.fromArray(p.projectionMatrix),x.projectionMatrixInverse.copy(x.projectionMatrix).invert(),x.viewport.set(g.x,g.y,g.width,g.height),d===0&&(t.matrix.copy(x.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),u===!0&&t.cameras.push(x)}
4106n.setOutputRenderTarget(this._xrRenderTarget)}for(let l=0;l<this._controllers.length;l++){const u=this._controllerInputSources[l],d=this._controllers[l];u!==null&&d!==void 0&&d.update(u,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(i,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}class Cee extends Ia{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new rn(0,0,this._width,this._height),this._scissor=new rn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new Tv,this.depthTexture=new qr}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){const t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){const s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,o=1){const a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,r),a.minDepth=s,a.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}}const nw=new _v,Ah=new We,j2=new rn,X2=new IA,Q2=new Sv,Tp=new nn,$a=new rn,Nee={[cs]:Xn,[Xn]:cs,[Ui]:Ui};class Pee{constructor(e,t={}){this.isRenderer=!0;const{logarithmicDepthBuffer:n=!1,reversedDepthBuffer:r=!1,alpha:s=!0,depth:o=!0,stencil:a=!1,antialias:l=!1,samples:u=0,getFallback:d=null,outputBufferType:p=Mi,multiview:g=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=n,this.reversedDepthBuffer=r,this.outputColorSpace=Tr,this.toneMapping=wr,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new wX,this.contextNode=pl(),this.library=new d6,this.lighting=new vee,this._samples=u||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new Cee(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new yC,this._inspector.setRenderer(this),this._getFallback=d,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quad=new Og(new Vi),this._quad.name="Output Color Transform",this._quad.material.name="outputColorTransform",this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTarget=null;const x=this.alpha===!0?0:1;this._clearColor=new u3(0,0,0,x),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this._outputBufferType=p,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:Rh}
4106,this.xr=new yee(this,g),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(y,T,S)=>{await this.compileAsync(y,T);const M=this._renderLists.get(y,T),R=this._renderContexts.get(this._renderTarget,this._mrt),E=y.overrideMaterial||S.material,N=this._objects.get(S,E,y,T,M.lightsNode,R,R.clippingContext),{fragmentShader:U,vertexShader:L}=N.getNodeBuilderState();return{fragmentShader:U,vertexShader:L}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new mee(this,n),this._animation=new gX(this,this._nodes,this.info),this._attributes=new TX(n),this._background=new NJ(this,this._nodes),this._geometries=new MX(this._attributes,this.info),this._textures=new kX(this,n,this.info),this._pipelines=new NX(n,this._nodes),this._bindings=new PX(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new yX(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new IX(this.lighting),this._bundles=new _ee,this._renderContexts=new UX(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();const r=this._nodes.nodeFrame,s=r.renderId,o=this._currentRenderContext,a=this._currentRenderObjectFunction,l=this._handleObjectFunction,u=this._compilationPromises,d=e.isScene===!0?e:nw;n===null&&(n=e);const p=this._renderTarget,g=this._renderContexts.get(p,this._mrt),x=this._activeMipmapLevel,y=[];this._currentRenderContext=g,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=y,r.renderId++,r.update(
4106),g.depth=this.depth,g.stencil=this.stencil,g.clippingContext||(g.clippingContext=new Jm),g.clippingContext.updateGlobal(d,t),d.onBeforeRender(this,e,t,p);const T=this._renderLists.get(e,t);if(T.begin(),this._projectObject(e,t,0,T,g.clippingContext),n!==e&&n.traverseVisible(function(N){N.isLight&&N.layers.test(t.layers)&&T.pushLight(N)}),T.finish(),p!==null){this._textures.updateRenderTarget(p,x);const N=this._textures.get(p);g.textures=N.textures,g.depthTexture=N.depthTexture}else g.textures=null,g.depthTexture=null;n!==e?this._background.update(n,T,g):this._background.update(d,T,g);const S=T.opaque,M=T.transparent,R=T.transparentDoublePass,E=T.lightsNode;this.opaque===!0&&S.length>0&&this._renderObjects(S,t,d,E),this.transparent===!0&&M.length>0&&this._renderTransparents(M,R,t,d,E),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=u,await Promise.all(y)}async renderAsync(e,t){zn('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){ke("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){const t=this.contextNode.value;e===!0?(t.modelViewMatrix=xx,t.modelNormalViewMatrix=vx):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){const e=this.contextNode.value;return e.modelViewMatrix===xx&&e.modelNormalViewMatrix===vx}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return zn('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost: 4107 4108Message: ${e.message}`;e.reason&&(t+=` 4109Reason: ${e.reason}`),ke(t),this._isDeviceLost=!0}_renderBundle(e,t,n){const{bundleGroup:r,camera:s,renderList:o}=e,a=this._currentRenderContext,l=this._bundles.get(r,s),u=this.backend.get(l);u.renderContexts===void 0&&(u.renderContexts=new Set);const d=r.version!==u.version,p=u.renderContexts.has(a)===!1||d;if(u.renderContexts.add(a),p){this.backend.beginBundle(a),(u.renderObjects===void 0||d)&&(u.renderObjects=[]),this._currentRenderBundle=l;const{transparentDoublePass:g,transparent:x,opaque:y}=o;this.opaque===!0&&y.length>0&&this._renderObjects(y,s,t,n),this.transparent===!0&&x.length>0&&this._renderTransparents(x,g,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),u.version=r.version}else{const{renderObjects:g}=u;for(let x=0,y=g.length;x<y;x++){const T=g[x];this._nodes.needsRefresh(T)&&(this._nodes.updateBefore(T),this._nodes.updateForRender(T),this._bindings.updateForRender(T),this._nodes.updateAfter(T))}}this.backend.addBundle(a,l)}render(e,t){if(this._initialized===!1)throw new Error('Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_getFrameBufferTarget(){const{currentToneMapping:e,currentColorSpace:t}=this,n=e!==wr,r=t!==Yt.workingColorSpace;if(n===!1&&r===!1)return null;const{width:s,height:o}=this.getDrawingBufferSize(Ah),{depth:a,stencil:l}=this;let u=this._frameBufferTarget;u===null&&(u=new Ba(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:Wi,colorSpace:Yt.workingColorSpace,generateMipmaps:!1,minFilter:li,magFilter:li,samples:this.samples}),u.isPostProcessingRenderTarget=!0,this._frameBufferTarget=u);const d=this.getOutputRenderTarget();u.depthBuffer=a,u.stencilBuffer=l,d!==null?u.setSize(d.width,d.height,d.depth):u.setSize(s,o,1);const p=this._canvasTarget;return u.viewport.copy(p._viewport),u.scissor.copy(p._scissor),u.viewport.multiplyScalar(p._pixelRatio),u.scissor.multiplyScalar(p._pixelRatio),u.scissorTest=p._scissorTest,u.multiview=d!==null?d.multiview:!1,u.resolveDepthBuffer=d!==null?d.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=d!==null?d._autoAllocateDepthBuffer:!1,u}
4109_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;const r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,o=s.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,u=this._handleObjectFunction;this._callDepth++;const d=e.isScene===!0?e:nw,p=this._renderTarget||this._outputRenderTarget,g=this._activeCubeFace,x=this._activeMipmapLevel;let y;r!==null?(y=r,this.setRenderTarget(y)):y=p;const T=this._renderContexts.get(y,this._mrt,this._callDepth);this._currentRenderContext=T,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(T),this.inspector.beginRender(this.backend.getTimestampUID(T),e,t,y);const S=this.xr;if(S.isPresenting===!1){let Y=!1;if(this.reversedDepthBuffer===!0&&t.reversedDepth!==!0){if(t._reversedDepth=!0,t.isArrayCamera)for(const Q of t.cameras)Q._reversedDepth=!0;Y=!0}const z=this.coordinateSystem;if(t.coordinateSystem!==z){if(t.coordinateSystem=z,t.isArrayCamera)for(const Q of t.cameras)Q.coordinateSystem=z;Y=!0}if(Y===!0&&(t.updateProjectionMatrix(),t.isArrayCamera))for(const Q of t.cameras)Q.updateProjectionMatrix()}e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),S.enabled===!0&&S.isPresenting===!0&&(S.cameraAutoUpdate===!0&&S.updateCamera(t),t=S.getCamera());const M=this._canvasTarget;let R=M._viewport,E=M._scissor,N=M._pixelRatio;y!==null&&(R=y.viewport,E=y.scissor,N=1),this.getDrawingBufferSize(Ah),j2.set(0,0,Ah.width,Ah.height);const U=R.minDepth===void 0?0:R.minDepth,L=R.maxDepth===void 0?1:R.maxDepth;T.viewportValue.copy(R).multiplyScalar(N).floor(),T.viewportValue.width>>=x,T.viewportValue.height>>=x,T.viewportValue.minDepth=U,T.viewportValue.maxDepth=L,T.viewport=T.viewportValue.equals(j2)===!1,T.scissorValue.copy(E).multiplyScalar(N).floor(),T.scissor=M._scissorTest&&T.scissorValue.equals(j2)===!1,T.scissorValue.width>>=x,T.scissorValue.height>>=x,T.clippingContext||(T.clippingContext=new Jm),T.clippingContext.updateGlobal(d,t),d.onBeforeRender(this,e,t,y);const F=t.isArrayCamera?Q2:X2;t.isArrayCamera||(Tp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromProjectionMatrix(Tp,t.coordinateSystem,t.reversedDepth));const P=this._renderLists.get(e,t);if(P.begin(),this._projectObject(e,t,0,P,T.clippingContext),P.finish(),this.sortObjects===!0&&P.sort(this._opaqueSort,this._transparentSort),y!==null){this._textures.updateRenderTarget(y,x);const Y=this._textures.get(y);T.textures=Y.textures,T.depthTexture=Y.depthTexture,T.width=Y.width,T.height=Y.height,T.renderTarget=y,T.depth=y.depthBuffer,T.stencil=y.stencilBuffer}else T.textures=null,T.depthTexture=null,T.width=Ah.width,T.height=Ah.height,T.depth=this.depth,T.stencil=this.stencil;T.width>>=x,T.height>>=x,T.activeCubeFace=g,T.activeMipmapLevel=x,T.occlusionQueryCount=P.occlusionQueryCount,T.scissorValue.max($a.set(0,0,0,0)),T.scissorValue.x+T.scissorValue.width>T.width&&(T.scissorValue.width=Math.max(T.width-T.scissorValue.x,0)),T.scissorValue.y+T.scissorValue.height>T.height&&(T.scissorValue.height=Math.max(T.height-T.scissorValue.y,0)),this._background.update(d,P,T),T.camera=t,this.backend.beginRender(T);const{bundles:I,lightsNode:$,transparentDoublePass:k,transparent:W,opaque:j}=P;return I.length>0&&this._renderBundles(I,d,$),this.opaque===!0&&j.length>0&&this._renderObjects(j,t,d,$),this.transparent===!0&&W.length>0&&this._renderTransparents(W,k,t,d,$),this.backend.finishRender(T),s.renderId=o,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._handleObjectFunction=u,this._callDepth--,r!==null&&(this.setRenderTarget(p,g,x),this._renderOutput(y)),d.onAfterRender(this,e,t,y),this.inspector.finishRender(this.backend.getTimestampUID(T)),T}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){const t=this._quad;this._nodes.hasOutputChange(e.texture)&&(t.material.fragmentNode=this._nodes.getOutputNode(e.texture),t.material.needsUpdate=!0);const n=this.autoClear,r=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(t,t.camera,!1),this.autoClear=n,this.xr.enabled=r}getMaxAnisotropy(){return this.backend.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e){return await this.backend.getArrayBufferAsync(e)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}
4109setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before before using this method.');const r=this._renderTarget||this._getFrameBufferTarget();let s=null;if(r!==null){this._textures.updateRenderTarget(r);const o=this._textures.get(r);s=this._renderContexts.get(r),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;const a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel()}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){zn('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){zn('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){zn('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){zn('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){const e=this.currentToneMapping!==wr,t=this.currentColorSpace!==Yt.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:wr}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:Yt.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){this._initialized===!0&&(this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose(),this._frameBufferTarget!==null&&this._frameBufferTarget.dispose(),Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})),this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null),this._frameBufferTarget.dispose(),this._frameBufferTarget=null}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;
4109if(this._initialized===!1)return Oe("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);const n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);const s=this.backend,o=this._pipelines,a=this._bindings,l=this._nodes,u=Array.isArray(e)?e:[e];if(u[0]===void 0||u[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(const d of u){if(o.has(d)===!1){const x=()=>{d.removeEventListener("dispose",x),o.delete(d),a.deleteForCompute(d),l.delete(d)};d.addEventListener("dispose",x);const y=d.onInitFunction;y!==null&&y.call(d,{renderer:this})}l.updateForCompute(d),a.updateForCompute(d);const p=a.getForCompute(d),g=o.getForCompute(d,p);s.compute(e,d,p,g,t)}s.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return zn('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){zn('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateRenderTarget(e);const t=this._textures.get(e),n=this._renderContexts.get(e);n.textures=t.textures,n.depthTexture=t.depthTexture,n.width=t.width,n.height=t.height,n.renderTarget=e,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,this.backend.initRenderTarget(n)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=$a.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=$a.copy(t).floor();else{ke("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=$a.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s,o),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,s,o=0,a=0){return this.backend.copyTextureToBuffer(e.textures[o],t,n,r,s,a)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){const l=t.isArrayCamera?Q2:X2;if(!e.frustumCulled||l.intersectsSprite(e,t)){this.sortObjects===!0&&$a.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Tp);const{geometry:u,material:d}=e;d.visible&&r.push(e,u,d,n,$a.z,null,s)}}else if(e.isLineLoop)ke("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){const l=t.isArrayCamera?Q2:X2;if(!e.frustumCulled||l.intersectsObject(e,t)){const{geometry:u,material:d}=e;if(this.sortObjects===!0&&(u.boundingSphere===null&&u.computeBoundingSphere(),$a.copy(u.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(Tp)),Array.isArray(d)){const p=u.groups;for(let g=0,x=p.length;g<x;g++){const y=p[g],T=d[y.materialIndex];T&&T.visible&&r.push(e,u,T,n,$a.z,y,s)}}else d.visible&&r.push(e,u,d,n,$a.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){const l=r;r=this._renderLists.get(e,t),r.begin(),l.pushBundle({bundleGroup:e,camera:t,renderList:r}),r.finish()}const a=e.children;for(let l=0,u=a.length;l<u;l++)this._projectObject(a[l],t,n,r,s)}
4109_renderBundles(e,t,n){for(const r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(const{material:o}of t)o.side=Xn;this._renderObjects(t,n,r,s,"backSide");for(const{material:o}of t)o.side=cs;this._renderObjects(e,n,r,s);for(const{material:o}of t)o.side=Ui}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let o=0,a=e.length;o<a;o++){const{object:l,geometry:u,material:d,group:p,clippingContext:g}=e[o];this._currentRenderObjectFunction(l,n,t,u,d,p,r,g,s)}}_getShadowNodes(e){const t=e.version;let n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){const r=e.map!==null,s=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode,a=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode;let l=null,u=null,d=null;if(r||s||o||a){let p,g;if(o?(p=e.castShadowNode.rgb,g=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&zn("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(p=ae(0),g=Z(1)),r&&(g=g.mul(vi("map","texture",e).a)),s&&(g=g.mul(e.colorNode.a)),u=Lt(p,g),a){const x=e.maskShadowNode||e.maskNode;u=ce(([y])=>(x.not().discard(),y))(u)}}e.depthNode&&e.depthNode.isNode&&(d=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?l=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(l=e.positionNode),n={version:t,colorNode:u,depthNode:d,positionNode:l},this._cacheShadowNodes.set(e,n)}return n}renderObject(e,t,n,r,s,o,a,l=null,u=null){let d=!1,p,g,x,y;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){const T=t.overrideMaterial;if(d=!0,p=T.isNodeMaterial?T.colorNode:null,g=T.isNodeMaterial?T.depthNode:null,x=T.isNodeMaterial?T.positionNode:null,y=t.overrideMaterial.side,s.positionNode&&s.positionNode.isNode&&(T.positionNode=s.positionNode),T.alphaTest=s.alphaTest,T.alphaMap=s.alphaMap,T.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,T.isShadowPassMaterial){const{colorNode:S,depthNode:M,positionNode:R}=this._getShadowNodes(s);this.shadowMap.type===ha?T.side=s.shadowSide!==null?s.shadowSide:s.side:T.side=s.shadowSide!==null?s.shadowSide:Nee[s.side],S!==null&&(T.colorNode=S),M!==null&&(T.depthNode=M),R!==null&&(T.positionNode=R)}s=T}s.transparent===!0&&s.side===Ui&&s.forceSinglePass===!1?(s.side=Xn,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=cs,this._handleObjectFunction(e,s,t,n,a,o,l,u),s.side=Ui):this._handleObjectFunction(e,s,t,n,a,o,l,u),d&&(t.overrideMaterial.colorNode=p,t.overrideMaterial.depthNode=g,t.overrideMaterial.positionNode=x,t.overrideMaterial.side=y),e.onAfterRender(this,t,n,r,s,o)}hasCompatibility(e){return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,n,r,s,o,a,l){const u=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);u.drawRange=e.geometry.drawRange,u.group=o,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(u),u.bundle=this._currentRenderBundle.bundleGroup);const d=this._nodes.needsRefresh(u);d&&(this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u)),this._pipelines.updateForRender(u),this.backend.draw(u,this.info),d&&this._nodes.updateAfter(u)}_createObjectPipeline(e,t,n,r,s,o,a,l){const u=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);u.drawRange=e.geometry.drawRange,u.group=o,this._nodes.updateBefore(u),this._geometries.updateForRender(u),this._nodes.updateForRender(u),this._bindings.updateForRender(u),this._pipelines.getForRender(u,this._compilationPromises),this._nodes.updateAfter(u)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}}class p6{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}}function Dee(i){return i+(Wl-i%Wl)%Wl}class m6 extends p6{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return Dee(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}}class g6 extends m6{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let Lee=0;class _6 extends g6{constructor(e,t){super("UniformBuffer_"+Lee++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get buffer(){return this.nodeUniform.value}}class Iee extends g6{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map}addUniformUpdateRange(e){const t=e.index;if(this._updateRangeCache.has(t)!==!0){const n=this.updateRanges,r=e.offset,s=e.itemSize,o={start:r,count:s};n.push(o),this._updateRangeCache.set(t,o)}}clearUpdateRanges(){this._updateRangeCache.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){const t=this.byteLength;
4109e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){const e=this.bytesPerElement;let t=0;for(let n=0,r=this.uniforms.length;n<r;n++){const s=this.uniforms[n],o=s.boundary,a=s.itemSize*e,l=t%Wl,u=l%o,d=l+u;t+=u,d!==0&&Wl-d<a&&(t+=Wl-d),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/Wl)*Wl}update(){let e=!1;for(const t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);ke("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1;const n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s]!==r){const a=this._getBufferForType(o);a[s]=n[s]=r,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1;const n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){const a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1;const n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){const a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1;const n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+4]!==r.w){const a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,a[s+3]=n[s+3]=r.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1;const n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){const o=this.buffer;o[s+0]=n[s+0]=r.r,o[s+1]=n[s+1]=r.g,o[s+2]=n[s+2]=r.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1;const n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){const o=this.buffer;o[s+0]=n[s+0]=r[0],o[s+1]=n[s+1]=r[1],o[s+2]=n[s+2]=r[2],o[s+4]=n[s+4]=r[3],o[s+5]=n[s+5]=r[4],o[s+6]=n[s+6]=r[5],o[s+8]=n[s+8]=r[6],o[s+9]=n[s+9]=r[7],o[s+10]=n[s+10]=r[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1;const n=this.values,r=e.getValue().elements,s=e.offset;return Fee(n,r,s)===!1&&(this.buffer.set(r,s),Bee(n,r,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}}function Bee(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function Fee(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}let Uee=0;class x6 extends Iee{constructor(e,t){super(e),this.id=Uee++,this.groupNode=t,this.isNodeUniformsGroup=!0}}class v6 extends p6{constructor(e,t){super(e),this._texture=null,this._onTextureDispose=()=>{this.generation=null,this.version=-1},this.texture=t,this.version=t?t.version:-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture&&this._texture.removeEventListener("dispose",this._onTextureDispose),this._texture=e,this.generation=null,this.version=-1,this._texture&&this._texture.addEventListener("dispose",this._onTextureDispose))}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}clone(){const e=super.clone();return e._texture=null,e._onTextureDispose=()=>{e.generation=null,e.version=-1},e.texture=this.texture,e}}let Oee=0;class kee extends v6{constructor(e,t){super(e,t),this.id=Oee++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}}class $g extends kee{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update(
4109)}}class y6 extends $g{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}}class Bx extends $g{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}}const iw={bitcast_int_uint:new rr("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new rr("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }")},Gee={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},rw={low:"lowp",medium:"mediump",high:"highp"},sw={swizzleAssign:!0,storageBuffer:!1},ow={perspective:"smooth",linear:"noperspective"},aw={centroid:"centroid"},lw=` 4110precision highp float; 4111precision highp int; 4112precision highp sampler2D; 4113precision highp sampler3D; 4114precision highp samplerCube; 4115precision highp sampler2DArray; 4116 4117precision highp usampler2D; 4118precision highp usampler3D; 4119precision highp usamplerCube; 4120precision highp usampler2DArray; 4121 4122precision highp isampler2D; 4123precision highp isampler3D; 4124precision highp isamplerCube; 4125precision highp isampler2DArray; 4126 4127precision highp sampler2DShadow; 4128precision highp sampler2DArrayShadow; 4129precision highp samplerCubeShadow; 4130`;class Vee extends A6{constructor(e,t){super(e,t,new pee),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==_s}_include(e){const t=iw[e];return t.build(this),this.addInclude(t),t}getMethod(e){return iw[e]!==void 0&&this._include(e),Gee[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),r=[];for(const o of t.inputs)r.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) { 4131 4132 ${n.vars} 4133 4134${n.code} 4135 return ${n.result}; 4136 4137}`}setupPBO(e){const t=e.value;if(t.pbo===void 0){const n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,o=t.array.constructor.name.toLowerCase().includes("int");let a=o?PA:Id;s===2?a=o?DA:ls:s===3?a=o?zP:Ld:s===4&&(a=o?LA:Wi);const l={Float32Array:zi,Uint8Array:yi,Uint16Array:Do,Uint32Array:ii,Int8Array:ec,Int16Array:tc,Int32Array:dr,Uint8ClampedArray:yi},u=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s))));let d=Math.ceil(r/s/u);u*d*s<r&&d++;const p=u*d*s,g=new n.constructor(p);g.set(n,0),t.array=g;const x=new bv(t.array,u,d,a,l[t.array.constructor.name]||zi);x.needsUpdate=!0,x.isPBOTexture=!0;const y=new Na(x,null,null);y.setPrecision("high"),t.pboNode=y,t.pbo=y.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){const{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){const d=this.renderer.backend.get(r);d.pbo=r.pbo}const s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(s);this.increaseUsage(n);const a=n.build(this,"uint"),l=this.getDataFromNode(e);let u=l.propertyName;if(u===void 0){const d=this.getVarFromNode(e);u=this.getPropertyName(d);const p=this.getDataFromNode(t);let g=p.propertySizeName;g===void 0&&(g=u+"Size",this.getVarFromNode(t,g,"uint"),this.addLineFlowCode(`${g} = uint( textureSize( ${o}, 0 ).x )`,e),p.propertySizeName=g);const{itemSize:x}=r,y="."+yc.join("").slice(0,x),T=`ivec2(${a} % ${g}, ${a} / ${g})`,S=this.generateTextureLoad(null,o,T,"0",null,null);let M="vec4";r.pbo.type===ii?M="uvec4":r.pbo.type===dr&&(M="ivec4"),this.addLineFlowCode(`${u} = ${M}(${S})${y}`,e),l.propertyName=u}return u}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0");let a;return s?o?a=`texelFetchOffset( ${t}, ivec3( ${n}, ${s} ), ${r}, ${o} )`:a=`texelFetch( ${t}, ivec3( ${n}, ${s} ), ${r} )`:o?a=`texelFetchOffset( ${t}, ${n}, ${r}, ${o} )`:a=`texelFetch( ${t}, ${n}, ${r} )`,e!==null&&e.isDepthTexture&&(a+=".x"),a}
4137generateTexture(e,t,n,r,s){return r&&(n=`vec3( ${n}, ${r} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${n}, ${s} ).x`:`texture( ${t}, ${n} ).x`:s?`textureOffset( ${t}, ${n}, ${s} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureLodOffset( ${t}, ${n}, ${r}, ${o} )`:`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureOffset( ${t}, ${n}, ${o}, ${r} )`:`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureGradOffset( ${t}, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${r} ) )`:s?o?`textureOffset( ${t}, vec4( ${n}, ${s}, ${r} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${s}, ${r} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${r} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${r} ) )`;ke(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const r of n)t.push(`${this.getVar(r.type,r.name,r.count)};`);return t.join(` 4138 `)}getUniforms(e){const t=this.uniforms[e],n=[],r={};for(const o of t){let a=null,l=!1;if(o.type==="texture"||o.type==="texture3D"){const u=o.node.value;let d="";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===ii?d="u":u.type===dr&&(d="i")),o.type==="texture3D"&&u.isArrayTexture===!1?a=`${d}sampler3D ${o.name};`:u.compareFunction?u.isArrayTexture===!0?a=`sampler2DArrayShadow ${o.name};`:a=`sampler2DShadow ${o.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?a=`${d}sampler2DArray ${o.name};`:a=`${d}sampler2D ${o.name};`}else if(o.type==="cubeTexture")a=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")o.node.value.compareFunction?a=`samplerCubeShadow ${o.name};`:a=`samplerCube ${o.name};`;else if(o.type==="buffer"){const u=o.node,d=this.getType(u.bufferType),p=u.bufferCount,g=p>0?p:"";a=`${u.name} { 4139 ${d} ${o.name}[${g}]; 4140}; 4141`}else{const u=o.groupNode.name;if(r[u]===void 0){const d=this.uniformGroups[u];if(d!==void 0){const p=[];for(const g of d.uniforms){const x=g.getType(),y=this.getVectorType(x),T=g.nodeUniform.node.precision;let S=`${y} ${g.name};`;T!==null&&(S=rw[T]+" "+S),p.push(" "+S)}r[u]=p}}l=!0}if(!l){const u=o.node.precision;u!==null&&(a=rw[u]+" "+a),a="uniform "+a,n.push(a)}}let s="";for(const o in r){const a=r[o];s+=this._getGLSLUniformStruct(o,a.join(` 4142`))+` 4143`}return s+=n.join(` 4144`),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==dr){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);const r=n.array;r instanceof Uint32Array||r instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){const n=this.getAttributesArray();let r=0;for(const s of n)t+=`layout( location = ${r++} ) in ${s.type} ${s.name}; 4145`}return t}getStructMembers(e){const t=[];for(const n of e.members)t.push(` ${n.type} ${n.name};`);return t.join(` 4146`)}getStructs(e){const t=[],n=this.structs[e],r=[];for(const s of n)if(s.output)for(const o of s.members)r.push(`layout( location = ${o.index} ) out ${o.type} ${o.name};`);else{let o="struct "+s.name+` { 4147`;o+=this.getStructMembers(s),o+=` 4148}; 4149`,t.push(o)}return r.length===0&&r.push("layout( location = 0 ) out vec4 fragColor;"),` 4150`+r.join(` 4151`)+` 4152 4153`+t.join(` 4154`)}getVaryings(e){let t="";const n=this.varyings;if(e==="vertex"||e==="compute")for(const r of n){e==="compute"&&(r.needsInterpolation=!0);const s=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){const o=ow[r.interpolationType]||r.interpolationType,a=aw[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name}; 4155`}else{const o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}out ${s} ${r.name}; 4156`}else t+=`${s} ${r.name}; 4157`}else if(e==="fragment"){for(const r of n)if(r.needsInterpolation){const s=this.getType(r.type);if(r.interpolationType){const o=ow[r.interpolationType]||r.interpolationType,a=aw[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name}; 4158`}else{const o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}in ${s} ${r.name}; 4159`}}}for(const r of this.builtins[e])t+=`${r}; 4160`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((n,r)=>n*r,1)}u`}getSubgroupSize(){ke("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){ke("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){ke("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":null}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,n=this.shaderStage){const r=this.extensions[n]||(this.extensions[n]=new Map);r.has(e)===!1&&r.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if(e==="vertex"){const r=this.renderer.backend.extensions;this.object.isBatchedMesh&&r.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const n=this.extensions[e];if(n!==void 0)for(const{name:r,behavior:s}of n.values())t.push(`#extension ${r} : ${s}`);return t.join(` 4161`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=sw[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){const r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}sw[e]=t}return t}isFlipY(){return!0}getUniformBufferLimit(){const e=this.renderer.backend.gl;return e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE)}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}
4161enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let n=0;n<e.length;n++){const r=e[n],s=this.getPropertyName(r.attributeNode);s&&(t+=`${r.varyingName} = ${s}; 4162 `)}return t}_getGLSLUniformStruct(e,t){return` 4163layout( std140 ) uniform ${e} { 4164${t} 4165};`}_getGLSLVertexCode(e){return`#version 300 es 4166 4167${this.getSignature()} 4168 4169// extensions 4170${e.extensions} 4171 4172// precision 4173${lw} 4174 4175// uniforms 4176${e.uniforms} 4177 4178// varyings 4179${e.varyings} 4180 4181// attributes 4182${e.attributes} 4183 4184// codes 4185${e.codes} 4186 4187void main() { 4188 4189 // vars 4190 ${e.vars} 4191 4192 // transforms 4193 ${e.transforms} 4194 4195 // flow 4196 ${e.flow} 4197 4198 gl_PointSize = 1.0; 4199 4200} 4201`}_getGLSLFragmentCode(e){return`#version 300 es 4202 4203${this.getSignature()} 4204 4205// extensions 4206${e.extensions} 4207 4208// precision 4209${lw} 4210 4211// structs 4212${e.structs} 4213 4214// uniforms 4215${e.uniforms} 4216 4217// varyings 4218${e.varyings} 4219 4220// codes 4221${e.codes} 4222 4223void main() { 4224 4225 // vars 4226 ${e.vars} 4227 4228 // flow 4229 ${e.flow} 4230 4231} 4232`}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){let n=`// code 4233 4234`;n+=this.flowCode[t];const r=this.flowNodes[t],s=r[r.length-1];for(const a of r){const l=this.getFlowData(a),u=a.name;u&&(n.length>0&&(n+=` 4235`),n+=` // flow -> ${u} 4236 `),n+=`${l.code} 4237 `,a===s&&t!=="compute"&&(n+=`// result 4238 `,t==="vertex"?(n+="gl_Position = ",n+=`${l.result};`):t==="fragment"&&(a.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${l.result};`)))}const o=e[t];o.extensions=this.getExtensions(t),o.uniforms=this.getUniforms(t),o.attributes=this.getAttributes(t),o.varyings=this.getVaryings(t),o.vars=this.getVars(t),o.structs=this.getStructs(t),o.codes=this.getCodes(t),o.transforms=this.getTransforms(t),o.flow=n}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){const s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);let a=o.uniformGPU;if(a===void 0){const l=e.groupNode,u=l.name,d=this.getBindGroupArray(u,n);if(t==="texture")a=new $g(s.name,s.node,l),d.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new y6(s.name,s.node,l),d.push(a);else if(t==="texture3D")a=new Bx(s.name,s.node,l),d.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;const p=this.getSharedDataFromNode(e);let g=p.buffer;g===void 0&&(e.name=`NodeBuffer_${e.id}`,g=new _6(e,l),g.name=e.name,p.buffer=g),d.push(g),a=g}else{let p=this.uniformGroups[u];p===void 0?(p=new x6(u,l),this.uniformGroups[u]=p,d.push(p)):d.indexOf(p)===-1&&d.push(p),a=this.getNodeUniform(s,t);const g=a.name;p.uniforms.some(y=>y.name===g)||p.addUniform(a)}o.uniformGPU=a}return s}}let Y2=null,fh=null;class b6{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[fa.RENDER]:null,[fa.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){const t=this.get(e),n=this.renderer.info.frame;let r;e.isComputeNode===!0?r="c:"+this.renderer.info.compute.frameCalls:r="r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){const t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){const t=e.startsWith("c:")?fa.COMPUTE:fa.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}hasTimestamp(e){return this._getQueryPool(e).hasTimestamp(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){zn("WebGPURenderer: Timestamp tracking is disabled.");return}const t=this.timestampQueryPool[e];if(!t)return;const n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return Y2=Y2||new We,this.renderer.getDrawingBufferSize(Y2)}setScissorTest(){}getClearColor(){const e=this.renderer;return fh=fh||new u3,e.getClearColor(fh),fh.getRGB(fh),fh}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:nE(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${NA} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}}let qee=0;class zee{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}}class Hee{constructor(e){this.backend=e}createAttribute(e,t){const n=this.backend,{gl:r}=n,s=e.array,o=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,l=n.get(a);let u=l.bufferGPU;u===void 0&&(u=this._createBuffer(r,t,s,o),l.bufferGPU=u,l.bufferType=t,l.version=a.version);let d;if(s instanceof Float32Array)d=r.FLOAT;else if(typeof Float16Array<"u"&&s instanceof Float16Array)d=r.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?d=r.HALF_FLOAT:d=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)d=r.SHORT;else if(s instanceof Uint32Array)d=r.UNSIGNED_INT;else if(s instanceof Int32Array)d=r.INT;else if(s instanceof Int8Array)d=r.BYTE;else if(s instanceof Uint8Array)d=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)d=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let p={bufferGPU:u,bufferType:t,type:d,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:
4238d===r.INT||d===r.UNSIGNED_INT||e.gpuType===dr,id:qee++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const g=this._createBuffer(r,t,s,o);p=new zee(p,g)}n.set(e,p)}updateAttribute(e){const t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,o=t.get(s),a=o.bufferType,l=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,o.bufferGPU),l.length===0)n.bufferSubData(a,0,r);else{for(let u=0,d=l.length;u<d;u++){const p=l[u];n.bufferSubData(a,p.start*r.BYTES_PER_ELEMENT,r,p.start,p.count)}s.clearUpdateRanges()}n.bindBuffer(a,null),o.version=s.version}destroyAttribute(e){const t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);const r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e){const t=this.backend,{gl:n}=t,r=e.isInterleavedBufferAttribute?e.data:e,{bufferGPU:s}=t.get(r),o=e.array,a=o.byteLength;n.bindBuffer(n.COPY_READ_BUFFER,s);const l=n.createBuffer();n.bindBuffer(n.COPY_WRITE_BUFFER,l),n.bufferData(n.COPY_WRITE_BUFFER,a,n.STREAM_READ),n.copyBufferSubData(n.COPY_READ_BUFFER,n.COPY_WRITE_BUFFER,0,0,a),await t.utils._clientWaitAsync();const u=new e.array.constructor(o.length);return n.bindBuffer(n.COPY_WRITE_BUFFER,l),n.getBufferSubData(n.COPY_WRITE_BUFFER,0,u),n.deleteBuffer(l),n.bindBuffer(n.COPY_READ_BUFFER,null),n.bindBuffer(n.COPY_WRITE_BUFFER,null),u.buffer}_createBuffer(e,t,n,r){const s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}}let Sf,ja;class Wee{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){const e=this.gl;Sf={[Mr]:e.FUNC_ADD,[Hx]:e.FUNC_SUBTRACT,[Wx]:e.FUNC_REVERSE_SUBTRACT},ja={[Xa]:e.ZERO,[$x]:e.ONE,[jx]:e.SRC_COLOR,[Gh]:e.SRC_ALPHA,[Jx]:e.SRC_ALPHA_SATURATE,[Kx]:e.DST_COLOR,[Qx]:e.DST_ALPHA,[Xx]:e.ONE_MINUS_SRC_COLOR,[Vh]:e.ONE_MINUS_SRC_ALPHA,[Zx]:e.ONE_MINUS_DST_COLOR,[Yx]:e.ONE_MINUS_DST_ALPHA};const t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new rn().fromArray(t),this.currentViewport=new rn().fromArray(n),this._tempVec4=new rn}enable(e){const{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){const{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){const{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){const{gl:t}=this;e!==$w?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===c_?t.cullFace(t.BACK):e===jw?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){const{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,n){const r=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){zn("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let o=0;o<e.length;o++){const a=e[o];let l=null;if(t!==null){const u=t.getBlendMode(a.name);u.blending===zx?l=n:u.blending!==gr&&(l=u)}else l=n;l!==null?this._setMRTBlendingIndex(o,l):s.blendFuncSeparateiOES(o,r.ONE,r.ZERO,r.ONE,r.ZERO)}}_setMRTBlendingIndex(e,t){const{gl:n}=this,r=this.backend.drawBuffersIndexedExt,s=t.blending,o=t.blendSrc,a=t.blendDst,l=t.blendEquation,u=t.premultipliedAlpha;if(s===Ju){const d=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,p=t.blendDstAlpha!==null?t.blendDstAlpha:a,g=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Sf[l],Sf[g]),r.blendFuncSeparateiOES(e,ja[o],ja[a],ja[d],ja[p])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),u)switch(s){case mr:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Aa:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case $l:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case jl:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}else switch(s){case mr:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Aa:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case $l:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case jl:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,n,r,s,o,a,l){const{gl:u}=this;if(e===gr){this.currentBlendingEnabled===!0&&(this.disable(u.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(u.BLEND),this.currentBlendingEnabled=!0),e!==Ju){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==Mr||this.currentBlendEquationAlpha!==Mr)&&(u.blendEquation(u.FUNC_ADD),this.currentBlendEquation=Mr,this.currentBlendEquationAlpha=Mr),l)switch(e){case mr:u.blendFuncSeparate(u.ONE,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA);break;case Aa:u.blendFunc(u.ONE,u.ONE);break;case $l:u.blendFuncSeparate(u.ZERO,u.ONE_MINUS_SRC_COLOR,u.ZERO,u.ONE);break;case jl:u.blendFuncSeparate(u.DST_COLOR,u.ONE_MINUS_SRC_ALPHA,u.ZERO,u.ONE);break;default:ke("WebGLState: Invalid blending: ",e);break}else switch(e){case mr:u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA);break;case Aa:u.blendFuncSeparate(u.SRC_ALPHA,u.ONE,u.ONE,u.ONE);break;case $l:ke("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case jl:ke("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ke("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=l}return}s=s||t,o=o||n,a=a||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(u.blendEquationSeparate(Sf[t],Sf[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(u.blendFuncSeparate(ja[n],ja[r],ja[o],ja[a]),this.currentBlendSrc=n,this.currentBlendDst=r,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){const{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){const t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=fv[e]),this.currentDepthFunc!==e){const{gl:t}=this;switch(e){case Yf:t.depthFunc(t.NEVER);break;case Kf:t.depthFunc(t.ALWAYS);break;case Zf:t.depthFunc(t.LESS);break;case ou:t.depthFunc(t.LEQUAL);break;case Jf:t.depthFunc(t.EQUAL);break;case ed:t.depthFunc(t.GEQUAL);break;case td:t.depthFunc(t.GREATER);break;case nd:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,r){const s=this._tempVec4.set(e,t,n,r);if(this.currentScissor.equals(s)===!1){const{gl:o}=this;o.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,n,r){const s=this._tempVec4.set(e,t,n,r);if(this.currentViewport.equals(s)===!1){const{gl:o}=this;o.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){const t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){const{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){const{gl:r}=this;e.side===Ui?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===Xn;t&&(s=!s),this.setFlipSided(s),e.blending===mr&&e.transparent===!1?this.setBlending(gr):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);const o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let l=0;l<8;l++)l<n?this.enable(12288+l):this.disable(12288+l)}setPolygonOffset(e,t,n){const{gl:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){const n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){const e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){const{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){const{gl:n}=this;let r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));const o=e.textures;if(r.length!==o.length||r[0]!==n.COLOR_ATTACHMENT0){for(let a=0,l=o.length;a<l;a++)r[a]=n.COLOR_ATTACHMENT0+a;r.length=o.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){const{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){const{gl:r,currentTextureSlot:s,currentBoundTextures:o,maxTextures:a}=this;n===void 0&&(s===null?n=r.TEXTURE0+a-1:n=s);let l=o[n];l===void 0&&(l={type:void 0,texture:void 0},o[n]=l),(l.type!==e||l.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),l.type=e,l.texture=t)}bindBufferBase(e,t,n){const{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){const{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}}class $ee{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=_s){const{gl:n,extensions:r}=this;let s;const o=Yt.getTransfer(t);if(e===yi)return n.UNSIGNED_BYTE;if(e===tg)return n.UNSIGNED_SHORT_4_4_4_4;if(e===ng)return n.UNSIGNED_SHORT_5_5_5_1;if(e===ig)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===rg)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===ec)return n.BYTE;if(e===tc)return n.SHORT;if(e===Do)return n.UNSIGNED_SHORT;if(e===dr)return n.INT;if(e===ii)return n.UNSIGNED_INT;if(e===zi)return n.FLOAT;if(e===Mi)return n.HALF_FLOAT;if(e===lv)return n.ALPHA;if(e===Ld)return n.RGB;if(e===Wi)return n.RGBA;if(e===Rr)return n.DEPTH_COMPONENT;if(e===as)return n.DEPTH_STENCIL;if(e===Id)return n.RED;if(e===PA)return n.RED_INTEGER;if(e===ls)return n.RG;if(e===DA)return n.RG_INTEGER;if(e===LA)return n.RGBA_INTEGER;if(e===Zl||e===Jl||e===eu||e===tu)if(o===_t)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Zl)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Jl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===eu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===tu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Zl)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Jl)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===eu)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===tu)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===id||e===rd||e===sd||e===od)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===id)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===rd)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===sd)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===od)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===qh||e===zh||e===Hh||e===Wh||e===$h||e===cc||e===jh)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===qh||e===zh)return o===_t?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===Hh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;
4238if(e===Wh)return s.COMPRESSED_R11_EAC;if(e===$h)return s.COMPRESSED_SIGNED_R11_EAC;if(e===cc)return s.COMPRESSED_RG11_EAC;if(e===jh)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===Xh||e===Qh||e===Yh||e===Kh||e===Zh||e===Jh||e===eA||e===tA||e===nA||e===iA||e===rA||e===sA||e===oA||e===aA)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===Xh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===Qh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===Yh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===Kh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===Zh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===Jh)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===eA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===tA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===nA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===iA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===rA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===sA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===oA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===aA)return o===_t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===lA)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===lA)return o===_t?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(e===uA||e===cA||e===hc||e===hA)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===uA)return s.COMPRESSED_RED_RGTC1_EXT;if(e===cA)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===hc)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===hA)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===Hs?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){const{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,r)=>{function s(){const o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),r();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}}let uw=!1,Mp,K2,cw;class jee{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,uw===!1&&(this._init(),uw=!0)}_init(){const e=this.gl;Mp={[lc]:e.REPEAT,[xs]:e.CLAMP_TO_EDGE,[uc]:e.MIRRORED_REPEAT},K2={[jn]:e.NEAREST,[av]:e.NEAREST_MIPMAP_NEAREST,[Ja]:e.NEAREST_MIPMAP_LINEAR,[li]:e.LINEAR,[Ph]:e.LINEAR_MIPMAP_NEAREST,[vs]:e.LINEAR_MIPMAP_LINEAR},cw={[uv]:e.NEVER,[Av]:e.ALWAYS,[sg]:e.LESS,[fu]:e.LEQUAL,[cv]:e.EQUAL,[al]:e.GEQUAL,[ad]:e.GREATER,[hv]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s=!1){const{gl:o,extensions:a}=this;if(e!==null){if(o[e]!==void 0)return o[e];Oe("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let l=t;if(t===o.RED&&(n===o.FLOAT&&(l=o.R32F),n===o.HALF_FLOAT&&(l=o.R16F),n===o.UNSIGNED_BYTE&&(l=o.R8),n===o.UNSIGNED_SHORT&&(l=o.R16),n===o.UNSIGNED_INT&&(l=o.R32UI),n===o.BYTE&&(l=o.R8I),n===o.SHORT&&(l=o.R16I),n===o.INT&&(l=o.R32I)),t===o.RED_INTEGER&&(n===o.UNSIGNED_BYTE&&(l=o.R8UI),n===o.UNSIGNED_SHORT&&(l=o.R16UI),n===o.UNSIGNED_INT&&(l=o.R32UI),n===o.BYTE&&(l=o.R8I),n===o.SHORT&&(l=o.R16I),n===o.INT&&(l=o.R32I)),t===o.RG&&(n===o.FLOAT&&(l=o.RG32F),n===o.HALF_FLOAT&&(l=o.RG16F),n===o.UNSIGNED_BYTE&&(l=o.RG8),n===o.UNSIGNED_SHORT&&(l=o.RG16),n===o.UNSIGNED_INT&&(l=o.RG32UI
vendor: 1,440 bytes, line 4238
4238),n===o.BYTE&&(l=o.RG8I),n===o.SHORT&&(l=o.RG16I),n===o.INT&&(l=o.RG32I)),t===o.RG_INTEGER&&(n===o.UNSIGNED_BYTE&&(l=o.RG8UI),n===o.UNSIGNED_SHORT&&(l=o.RG16UI),n===o.UNSIGNED_INT&&(l=o.RG32UI),n===o.BYTE&&(l=o.RG8I),n===o.SHORT&&(l=o.RG16I),n===o.INT&&(l=o.RG32I)),t===o.RGB){const u=s?AA:Yt.getTransfer(r);n===o.FLOAT&&(l=o.RGB32F),n===o.HALF_FLOAT&&(l=o.RGB16F),n===o.UNSIGNED_BYTE&&(l=o.RGB8),n===o.UNSIGNED_SHORT&&(l=o.RGB16),n===o.UNSIGNED_INT&&(l=o.RGB32UI),n===o.BYTE&&(l=o.RGB8I),n===o.SHORT&&(l=o.RGB16I),n===o.INT&&(l=o.RGB32I),n===o.UNSIGNED_BYTE&&(l=u===_t?o.SRGB8:o.RGB8),n===o.UNSIGNED_SHORT_5_6_5&&(l=o.RGB565),n===o.UNSIGNED_SHORT_5_5_5_1&&(l=o.RGB5_A1),n===o.UNSIGNED_SHORT_4_4_4_4&&(l=o.RGB4),n===o.UNSIGNED_INT_5_9_9_9_REV&&(l=o.RGB9_E5),n===o.UNSIGNED_INT_10F_11F_11F_REV&&(l=o.R11F_G11F_B10F)}if(t===o.RGB_INTEGER&&(n===o.UNSIGNED_BYTE&&(l=o.RGB8UI),n===o.UNSIGNED_SHORT&&(l=o.RGB16UI),n===o.UNSIGNED_INT&&(l=o.RGB32UI),n===o.BYTE&&(l=o.RGB8I),n===o.SHORT&&(l=o.RGB16I),n===o.INT&&(l=o.RGB32I)),t===o.RGBA){const u=s?AA:Yt.getTransfer(r);n===o.FLOAT&&(l=o.RGBA32F),n===o.HALF_FLOAT&&(l=o.RGBA16F),n===o.UNSIGNED_BYTE&&(l=o.RGBA8),n===o.UNSIGNED_SHORT&&(l=o.RGBA16),n===o.UNSIGNED_INT&&(l=o.RGBA32UI),n===o.BYTE&&(l=o.RGBA8I),n===o.SHORT&&(l=o.RGBA16I),n===o.INT&&(l=o.RGBA32I),n===o.UNSIGNED_BYTE&&(l=u===_t?o.SRGB8_ALPHA8:o.RGBA8),n===o.UNSIGNED_SHORT_4_4_4_4&&(l=o.RGBA4),n===o.UNSIGNED_SHORT_5_5_5_1&&(l=o.RGB5_A1)}
4238return t===o.RGBA_INTEGER&&(n===o.UNSIGNED_BYTE&&(l=o.RGBA8UI),n===o.UNSIGNED_SHORT&&(l=o.RGBA16UI),n===o.UNSIGNED_INT&&(l=o.RGBA32UI),n===o.BYTE&&(l=o.RGBA8I),n===o.SHORT&&(l=o.RGBA16I),n===o.INT&&(l=o.RGBA32I)),t===o.DEPTH_COMPONENT&&(n===o.UNSIGNED_SHORT&&(l=o.DEPTH_COMPONENT16),n===o.UNSIGNED_INT&&(l=o.DEPTH_COMPONENT24),n===o.FLOAT&&(l=o.DEPTH_COMPONENT32F)),t===o.DEPTH_STENCIL&&n===o.UNSIGNED_INT_24_8&&(l=o.DEPTH24_STENCIL8),(l===o.R16F||l===o.R32F||l===o.RG16F||l===o.RG32F||l===o.RGBA16F||l===o.RGBA32F)&&a.get("EXT_color_buffer_float"),l}setTextureParameters(e,t){const{gl:n,extensions:r,backend:s}=this,o=Yt.getPrimaries(Yt.workingColorSpace),a=t.colorSpace===_s?null:Yt.getPrimaries(t.colorSpace),l=t.colorSpace===_s||o===a?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,l),n.texParameteri(e,n.TEXTURE_WRAP_S,Mp[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,Mp[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,Mp[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,K2[t.magFilter]);const u=t.mipmaps!==void 0&&t.mipmaps.length>0,d=t.minFilter===li&&u?vs:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,K2[d]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,cw[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===jn||t.minFilter!==Ja&&t.minFilter!==vs||t.type===zi&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){const p=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,p.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e);let o=r[s];o===void 0&&(o=t.createTexture(),n.state.bindTexture(s,o),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=o),n.set(e,{textureGPU:o,glTextureType:s})}createTexture(e,t){const{gl:n,backend:r}=this,{levels:s,width:o,height:a,depth:l}=t,u=r.utils.convert(e.format,e.colorSpace),d=r.utils.convert(e.type),p=this.getInternalFormat(e.internalFormat,u,d,e.colorSpace,e.isVideoTexture),g=n.createTexture(),x=this.getGLTextureType(e);r.state.bindTexture(x,g),this.setTextureParameters(x,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,s,p,o,a,l):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,s,p,o,a,l):e.isVideoTexture||n.texStorage2D(x,s,p,o,a),r.set(e,{textureGPU:g,glTextureType:x,glFormat:u,glType:d,glInternalFormat:p})}copyBufferToTexture(e,t){const{gl:n,backend:r}=this,{textureGPU:s,glTextureType:o,glFormat:a,glType:l}=r.get(t),{width:u,height:d}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(o,s),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(o,0,0,0,u,d,a,l,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){const{gl:n}=this,{width:r,height:s}=t,{textureGPU:o,glTextureType:a,glFormat:l,glType:u,glInternalFormat:d}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(a,o),this.setTextureParameters(a,e),e.isCompressedTexture){const p=e.mipmaps,g=t.image;for(let x=0;x<p.length;x++){const y=p[x];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,y.width,y.height,g.depth,l,y.data):Oe("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,y.width,y.height,g.depth,l,u,y.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,x,0,0,y.width,y.height,l,y.data):Oe("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){const p=t.images,g=e.mipmaps;for(let x=0;x<6;x++){const y=wp(p[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,r,s,l,u,y);for(let T=0;T<g.length;T++){const S=g[T],M=wp(S.images[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,T+1,0,0,M.width,M.height,l,u,M)}}}else if(e.isDataArrayTexture||e.isArrayTexture){const p=t.image;if(e.layerUpdates.size>0){const g=v_(p.width,p.height,e.format,e.type);for(const x of e.layerUpdates){const y=p.data.subarray(x*g/p.data.BYTES_PER_ELEMENT,(x+1)*g/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,x,p.width,p.height,1,l,u,y)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,l,u,p.data)}else if(e.isData3DTexture){const p=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,l,u,p.data)}
4238else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,d,l,u,t.image);else{const p=e.mipmaps;if(p.length>0)for(let g=0,x=p.length;g<x;g++){const y=p[g],T=wp(y);n.texSubImage2D(a,g,0,0,y.width,y.height,l,u,T)}else{const g=wp(t.image);n.texSubImage2D(a,0,0,0,r,s,l,u,g)}}}generateMipmaps(e){const{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){const{gl:t,backend:n}=this;if(e){const r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(const s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e,t=!1){const{gl:n,backend:r}=this,{textureGPU:s,renderTarget:o}=r.get(e);this.deallocateRenderBuffers(o),t===!1&&n.deleteTexture(s),r.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){const{gl:a,backend:l}=this,{state:u}=this.backend,{textureGPU:d,glTextureType:p,glType:g,glFormat:x}=l.get(t);u.bindTexture(p,d);let y,T,S,M,R,E,N,U,L;const F=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)y=n.max.x-n.min.x,T=n.max.y-n.min.y,S=n.isBox3?n.max.z-n.min.z:1,M=n.min.x,R=n.min.y,E=n.isBox3?n.min.z:0;else{const z=Math.pow(2,-s);y=Math.floor(F.width*z),T=Math.floor(F.height*z),e.isDataArrayTexture||e.isArrayTexture?S=F.depth:e.isData3DTexture?S=Math.floor(F.depth*z):S=1,M=0,R=0,E=0}r!==null?(N=r.x,U=r.y,L=r.z):(N=0,U=0,L=0),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),a.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);const P=a.getParameter(a.UNPACK_ROW_LENGTH),I=a.getParameter(a.UNPACK_IMAGE_HEIGHT),$=a.getParameter(a.UNPACK_SKIP_PIXELS),k=a.getParameter(a.UNPACK_SKIP_ROWS),W=a.getParameter(a.UNPACK_SKIP_IMAGES);a.pixelStorei(a.UNPACK_ROW_LENGTH,F.width),a.pixelStorei(a.UNPACK_IMAGE_HEIGHT,F.height),a.pixelStorei(a.UNPACK_SKIP_PIXELS,M),a.pixelStorei(a.UNPACK_SKIP_ROWS,R),a.pixelStorei(a.UNPACK_SKIP_IMAGES,E);const j=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,Y=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){const z=l.get(e),Q=l.get(t),ee=l.get(z.renderTarget),fe=l.get(Q.renderTarget),le=ee.framebuffers[z.cacheKey],Me=fe.framebuffers[Q.cacheKey];u.bindFramebuffer(a.READ_FRAMEBUFFER,le),u.bindFramebuffer(a.DRAW_FRAMEBUFFER,Me);for(let Ce=0;Ce<S;Ce++)j&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,z.textureGPU,s,E+Ce),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,d,o,L+Ce)),a.blitFramebuffer(M,R,y,T,N,U,y,T,a.DEPTH_BUFFER_BIT,a.NEAREST);u.bindFramebuffer(a.READ_FRAMEBUFFER,null),u.bindFramebuffer(a.DRAW_FRAMEBUFFER,null)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){const z=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer()),u.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),u.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let Q=0;Q<S;Q++)j?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,z.textureGPU,s,E+Q):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,z.textureGPU,s),Y?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,d,o,L+Q):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,d,o),s!==0?a.blitFramebuffer(M,R,y,T,N,U,y,T,a.COLOR_BUFFER_BIT,a.NEAREST):Y?a.copyTexSubImage3D(p,o,N,U,L+Q,M,R,y,T):a.copyTexSubImage2D(p,o,N,U,M,R,y,T);u.bindFramebuffer(a.READ_FRAMEBUFFER,null),u.bindFramebuffer(a.DRAW_FRAMEBUFFER,null)}else Y?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(p,o,N,U,L,y,T,S,x,g,F.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(p,o,N,U,L,y,T,S,x,F.data):a.texSubImage3D(p,o,N,U,L,y,T,S,x,g,F):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,N,U,y,T,x,g,F.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,N,U,F.width,F.height,x,F.data):a.texSubImage2D(a.TEXTURE_2D,o,N,U,y,T,x,g,F);a.pixelStorei(a.UNPACK_ROW_LENGTH,P),a.pixelStorei(a.UNPACK_IMAGE_HEIGHT,I),a.pixelStorei(a.UNPACK_SKIP_PIXELS,$),a.pixelStorei(a.UNPACK_SKIP_ROWS,k),a.pixelStorei(a.UNPACK_SKIP_IMAGES,W),o===0&&t.generateMipmaps&&a.generateMipmap(p),u.unbindTexture()}copyFramebufferToTexture(e,t,n){const{gl:r}=this,{state:s}=this.backend,{textureGPU:o}=this.backend.get(e),{x:a,y:l,z:u,w:d}=n,p=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,g=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(p){const x=a!==0||l!==0;let y,T;if(e.isDepthTexture===!0?(y=r.DEPTH_BUFFER_BIT,T=r.DEPTH_ATTACHMENT,t.stencil&&(y|=r.STENCIL_BUFFER_BIT)):(y=r.COLOR_BUFFER_BIT,T=r.COLOR_ATTACHMENT0),x){const S=this.backend.get(t.renderTarget),M=S.framebuffers[t.getCacheKey()],R=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,M),s.bindFramebuffer(r.READ_FRAMEBUFFER,R);const E=g-l-d;r.blitFramebuffer(a,E,a+u,E+d,a,E,a+u,E+d,y,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,M),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,E,u,d),s.unbindTexture()}else{const S=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,S),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,T,r.TEXTURE_2D,o,0),r.blitFramebuffer(0,0,u,d,0,0,u,d,y,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,g-d-l,u,d),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){const{gl:s}=this,o=t.renderTarget,{depthTexture:a,depthBuffer:l,stencilBuffer:u,width:d,height:p}=o;if(s.bindRenderbuffer(s.RENDERBUFFER,e),l&&!u){let g=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,g,d,p):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(g=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,g,d,p)):s.renderbufferStorage(s.RENDERBUFFER,g,d,p),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else l&&u&&(n>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,d,p):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,d,p),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,s,o){const{backend:a,gl:l}=this,{textureGPU:u,glFormat:d,glType:p}=this.backend.get(e),g=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,g);const x=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,x,u,0);const y=this._getTypedArrayType(p),T=this._getBytesPerTexel(p,d),M=r*s*T,R=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.bufferData(l.PIXEL_PACK_BUFFER,M,l.STREAM_READ),l.readPixels(t,n,r,s,d,p,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();const E=new y(M/y.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,E),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(g),E}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;
4238if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:n}=this;let r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}dispose(){const{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}}function wp(i){return i.isDataTexture?i.image.data:typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?i:i.data}class Xee{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class Qee{constructor(e){this.backend=e,this.maxAnisotropy=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){const n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}}const hw={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class Yee{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:n,mode:r,object:s,type:o,info:a,index:l}=this;l!==0?n.drawElements(r,t,o,e):n.drawArrays(r,e,t),a.update(s,t,1)}renderInstances(e,t,n){const{gl:r,mode:s,type:o,index:a,object:l,info:u}=this;n!==0&&(a!==0?r.drawElementsInstanced(s,t,o,e,n):r.drawArraysInstanced(s,e,t,n),u.update(l,t,n))}renderMultiDraw(e,t,n){const{extensions:r,mode:s,object:o,info:a}=this;if(n===0)return;const l=r.get("WEBGL_multi_draw");if(l===null)for(let u=0;u<n;u++)this.render(e[u],t[u]);else{this.index!==0?l.multiDrawElementsWEBGL(s,t,0,this.type,e,0,n):l.multiDrawArraysWEBGL(s,e,0,t,0,n);let u=0;for(let d=0;d<n;d++)u+=t[d];a.update(o,u,1)}}renderMultiDrawInstances(e,t,n,r){const{extensions:s,mode:o,object:a,info:l}=this;if(n===0)return;const u=s.get("WEBGL_multi_draw");if(u===null)for(let d=0;d<n;d++)this.renderInstances(e[d],t[d],r[d]);else{this.index!==0?u.multiDrawElementsInstancedWEBGL(o,t,0,this.type,e,0,r,0,n):u.multiDrawArraysInstancedWE
4238BGL(o,e,0,t,0,r,0,n);let d=0;for(let p=0;p<n;p++)d+=t[p]*r[p];l.update(a,d,1)}}}class S6{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(Oe(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestamp(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}}class Kee extends S6{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){Oe("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let r=0;r<this.maxQueries;r++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return zn(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;const n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(r){ke("Error in beginQuery:",r),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){ke("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{const e=new Map;for(const[s,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){const l=this.queries[o];e.set(s,this.resolveQuery(l))}if(e.size===0)return this.lastValue;const t={},n=[];for(const[s,o]of e){const a=s.match(/^(.*):f(\d+)$/),l=parseInt(a[2]);n.includes(l)===!1&&n.push(l),t[l]===void 0&&(t[l]=0);const u=await o;this.timestamps.set(s,u),t[l]+=u}const r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return ke("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,r=!1;const s=()=>{n&&(clearTimeout(n),n=null)},o=l=>{r||(r=!0,s(),t(l))},a=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(a,1);return}const d=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(d)/1e6)}catch(l){ke("Error checking query:",l),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(const e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class Aw extends b6{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function s(o){o.preventDefault();const a={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(a)}this._onContextLost=s,e.domElement.addEventListener("webglcontextlost",s,!1),this.gl=r,this.extensions=new Xee(this),this.capabilities=new Qee(this),this.attributeUtils=new Hee(this),this.textureUtils=new jee(this),this.bufferRenderer=new Yee(this),this.state=new Wee(this),this.utils=new $ee(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer===!0&&this.extensions.has("EXT_clip_control")&&this.state.setReversedDepth(!0)}get coordinateSystem(){return us}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){const r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),n!==null){const s=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:s}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&Oe("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new Kee(this.gl,e,2048));const n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){const{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{const{width:s,height:o}=this.getDrawingBufferSize();t.viewport(0,0,s,o)}if(e.scissor)this.updateScissor(e);else{const{width:s,height:o}=this.getDrawingBufferSize();t.scissor(0,0,s,o)}this.initTimestampQuery(fa.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);const r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:n}=this,r=this.get(e),s=r.previousContext;n.resetVertexState();const o=e.occlusionQueryCount;o>0&&(o>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const a=e.textures;if(a!==null)for(let l=0;l<a.length;l++){const u=a[l];u.generateMipmaps&&this.generateMipmaps(u)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{const{width:l,height:u}=this.getDrawingBufferSize();n.viewport(0,0,l,u)}if(s.scissor)this.updateScissor(s);else{const{width:l,height:u}=this.getDrawingBufferSize();n.scissor(0,0,l,u)}}this.prepareTimestampBuffer(fa.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){const t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){const s=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;const a=()=>{let l=0;for(let u=0;u<n.length;u++){const d=n[u];d!==null&&o.getQueryParameter(d,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(d,o.QUERY_RESULT)===0&&s.add(r[u]),n[u]=null,o.deleteQuery(d),l++)}l<n.length?requestAnimationFrame(a):t.occluded=s};a()}}isOccluded(e,t){const n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){const{state:t}=this,{x:n,y:r,width:s,height:o}=e.viewportValue;t.viewport(n,e.height-o-r,s,o)}updateScissor(e){const{state:t}=this,{x:n,y:r,width:s,height:o}=e.scissorValue;t.scissor(n,e.height-o-r,s,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){const e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,r=null,s=!0,o=!0){const{gl:a,renderer:l}=this;r===null&&(r={textures:null,clearColorValue:this.getClearColor()});let u=0;if(e&&(u|=a.COLOR_BUFFER_BIT),t&&(u|=a.DEPTH_BUFFER_BIT),n&&(u|=a.STENCIL_BUFFER_BIT),u!==0){let d;r.clearColorValue?d=r.clearColorValue:d=this.getClearColor();const p=l.getClearDepth(),g=l.getClearStencil();if(t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(d.r,d.g,d.b,d.a),a.clear(u);else{if(s&&this._setFramebuffer(r),e)for(let x=0;x<r.textures.length;
4238x++)x===0?a.clearBufferfv(a.COLOR,x,[d.r,d.g,d.b,d.a]):a.clearBufferfv(a.COLOR,x,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,p,g):t?a.clearBufferfv(a.DEPTH,0,[p]):n&&a.clearBufferiv(a.STENCIL,0,[g]),s&&o&&this._resolveRenderTarget(r)}}}beginCompute(e){const{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(fa.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,r,s=null){const{state:o,gl:a}=this;this.discard===!1&&(o.enable(a.RASTERIZER_DISCARD),this.discard=!0);const{programGPU:l,transformBuffers:u,attributes:d}=this.get(r),p=this._getVaoKey(d),g=this.vaoCache[p];g===void 0?this.vaoCache[p]=this._createVao(d):o.setVertexState(g),o.useProgram(l),this._bindUniforms(n);const x=this._getTransformFeedback(u);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,x),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(zn("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(zn("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),s=t.count),d[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,s):a.drawArrays(a.POINTS,0,s),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let y=0;y<u.length;y++){const T=u[y];T.pbo&&this.has(T.pbo)&&this.textureUtils.copyBufferToTexture(T.transformBuffer,T.pbo),T.switchBuffers()}}finishCompute(e){const{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer(fa.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}draw(e){const{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:o}=e,{programGPU:a}=this.get(n),{gl:l,state:u}=this,d=this.get(s),p=e.getDrawParameters();if(p===null)return;this._bindUniforms(e.getBindings());const g=t.isMesh&&t.matrixWorld.determinant()<0;u.setMaterial(r,g,o),s.mrt!==null&&s.textures!==null&&u.setMRTBlending(s.textures,s.mrt,r),u.useProgram(a);const x=e.getAttributes(),y=this.get(x);let T=y.vaoGPU;if(T===void 0){const P=this._getVaoKey(x);T=this.vaoCache[P],T===void 0&&(T=this._createVao(x),this.vaoCache[P]=T,y.vaoGPU=T)}const S=e.getIndex(),M=S!==null?this.get(S).bufferGPU:null;u.setVertexState(T,M);const R=d.lastOcclusionObject;if(R!==t&&R!==void 0){if(R!==null&&R.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),d.occlusionQueryIndex++),t.occlusionTest===!0){const P=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,P),d.occlusionQueries[d.occlusionQueryIndex]=P,d.occlusionQueryObjects[d.occlusionQueryIndex]=t}d.lastOcclusionObject=t}const E=this.bufferRenderer;t.isPoints?E.mode=l.POINTS:t.isLineSegments?E.mode=l.LINES:t.isLine?E.mode=l.LINE_STRIP:t.isLineLoop?E.mode=l.LINE_LOOP:r.wireframe===!0?(u.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),E.mode=l.LINES):E.mode=l.TRIANGLES;const{vertexCount:N,instanceCount:U}=p;let{firstVertex:L}=p;if(E.object=t,S!==null){L*=S.array.BYTES_PER_ELEMENT;const P=this.get(S);E.index=S.count,E.type=P.type}else E.index=0;const F=()=>{t.isBatchedMesh?t._multiDrawInstances!==null?(zn("WebGLBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),E.renderMultiDrawInstances(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount,t._multiDrawInstances)):this.hasFeature("WEBGL_multi_draw")?E.renderMultiDraw(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount):zn("WebGLBackend: WEBGL_multi_draw not supported."):U>1?E.renderInstances(L,N,U):E.render(L,N)};if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){const P=this.get(e.camera),I=e.camera.cameras,$=e.getBindingGroup("cameraIndex").bindings[0];if(P.indexesGPU===void 0||P.indexesGPU.length!==I.length){const Q=new Uint32Array([0,0,0,0]),ee=[];for(let fe=0,le=I.length;fe<le;fe++){const Me=l.createBuffer();Q[0]=fe,l.bindBuffer(l.UNIFORM_BUFFER,Me),l.bufferData(l.UNIFORM_BUFFER,Q,l.STATIC_DRAW),ee.push(Me)}P.indexesGPU=ee}const k=this.get($),W=this.renderer.getPixelRatio(),j=this._currentContext.renderTarget,Y=this._isRenderCameraDepthArray(this._currentContext),z=this._currentContext.activeCubeFace;if(Y){const Q=this.get(j.depthTexture);if(Q.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){Q.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;const{stencilBuffer:ee}=j;for(let fe=0,le=I.length;fe<le;fe++)this.renderer._activeCubeFace=fe,this._currentContext.activeCubeFace=fe,this._setFramebuffer(this._currentContext),this.clear(!1,!0,ee,this._currentContext,!1,!1);this.renderer._activeCubeFace=z,this._currentContext.activeCubeFace=z}}for(let Q=0,ee=I.length;Q<ee;Q++){const fe=I[Q];if(t.layers.test(fe.layers)){Y&&(this.renderer._activeCubeFace=Q,this._currentContext.activeCubeFace=Q,this._setFramebuffer(this._currentContext));const le=fe.viewport;if(le!==void 0){const Me=le.x*W,Ce=le.y*W,Be=le.width*W,Ye=le.height*W;u.viewport(Math.floor(Me),Math.floor(e.context.height-Ye-Ce),Math.floor(Be),Math.floor(Ye))}u.bindBufferBase(l.UNIFORM_BUFFER,k.index,P.indexesGPU[Q]),F()}this._currentContext.activeCubeFace=z,this.renderer._activeCubeFace=z}}else F()}
4238needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}updateSampler(){return""}createNodeBuilder(e,t){return new Vee(e,t)}createProgram(e){const t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){const n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:o}=r,a=n.createProgram(),l=this.get(s).shaderGPU,u=this.get(o).shaderGPU;if(n.attachShader(a,l),n.attachShader(a,u),n.linkProgram(a),this.set(r,{programGPU:a,fragmentShader:l,vertexShader:u}),t!==null&&this.parallel){const d=new Promise(p=>{const g=this.parallel,x=()=>{n.getProgramParameter(a,g.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),p()):requestAnimationFrame(x)};x()});t.push(d);return}this._completeCompile(e,r)}_handleSource(e,t){const n=e.split(` 4239`),r=[],s=Math.max(t-6,0),o=Math.min(t+6,n.length);for(let a=s;a<o;a++){const l=a+1;r.push(`${l===t?">":" "} ${l}: ${n[a]}`)}return r.join(` 4240`)}
4240_getShaderErrors(e,t,n){const r=e.getShaderParameter(t,e.COMPILE_STATUS),o=(e.getShaderInfoLog(t)||"").trim();if(r&&o==="")return"";const a=/ERROR: 0:(\d+)/.exec(o);if(a){const l=parseInt(a[1]);return n.toUpperCase()+` 4241 4242`+o+` 4243 4244`+this._handleSource(e.getShaderSource(t),l)}else return o}_logProgramError(e,t,n){if(this.renderer.debug.checkShaderErrors){const r=this.gl,o=(r.getProgramInfoLog(e)||"").trim();if(r.getProgramParameter(e,r.LINK_STATUS)===!1)if(typeof this.renderer.debug.onShaderError=="function")this.renderer.debug.onShaderError(r,e,n,t);else{const a=this._getShaderErrors(r,n,"vertex"),l=this._getShaderErrors(r,t,"fragment");ke("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(e,r.VALIDATE_STATUS)+` 4245 4246Program Info Log: `+o+` 4247`+a+` 4248`+l)}else o!==""&&Oe("WebGLProgram: Program Info Log:",o)}}_completeCompile(e,t){const{state:n,gl:r}=this,s=this.get(t),{programGPU:o,fragmentShader:a,vertexShader:l}=s;r.getProgramParameter(o,r.LINK_STATUS)===!1&&this._logProgramError(o,a,l),n.useProgram(o);const u=e.getBindings();this._setupBindings(u,o),this.set(t,{programGPU:o})}createComputePipeline(e,t){const{state:n,gl:r}=this,s={stage:"fragment",code:`#version 300 es 4249precision highp float; 4250void main() {}`};this.createProgram(s);const{computeProgram:o}=e,a=r.createProgram(),l=this.get(s).shaderGPU,u=this.get(o).shaderGPU,d=o.transforms,p=[],g=[];for(let S=0;S<d.length;S++){const M=d[S];p.push(M.varyingName),g.push(M.attributeNode)}r.attachShader(a,l),r.attachShader(a,u),r.transformFeedbackVaryings(a,p,r.SEPARATE_ATTRIBS),r.linkProgram(a),r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,u),n.useProgram(a),this._setupBindings(t,a);const x=o.attributes,y=[],T=[];for(let S=0;S<x.length;S++){const M=x[S].node.attribute;y.push(M),this.has(M)||this.attributeUtils.createAttribute(M,r.ARRAY_BUFFER)}for(let S=0;S<g.length;S++){const M=g[S].attribute;this.has(M)||this.attributeUtils.createAttribute(M,r.ARRAY_BUFFER);const R=this.get(M);T.push(R)}this.set(e,{programGPU:a,transformBuffers:T,attributes:y})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(const s of t){this.set(s,{textures:r,uniformBuffers:n});for(const o of s.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){const{gl:t}=this,n=this.get(e);let r=n.uniformBuffers,s=n.textures;for(const o of e.bindings){const a=this.get(o);if(o.isUniformsGroup||o.isUniformBuffer){const l=o.buffer;let{bufferGPU:u}=this.get(l);u===void 0?(u=t.createBuffer(),t.bindBuffer(t.UNIFORM_BUFFER,u),t.bufferData(t.UNIFORM_BUFFER,l.byteLength,t.DYNAMIC_DRAW),this.set(l,{bufferGPU:u})):t.bindBuffer(t.UNIFORM_BUFFER,u);const d=o.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,u),d.length===0)t.bufferData(t.UNIFORM_BUFFER,l,t.DYNAMIC_DRAW);else{const p=im(l),g=p?1:l.BYTES_PER_ELEMENT;for(let x=0,y=d.length;x<y;x++){const T=d[x],S=T.start*g,M=T.count*g,R=S*(p?l.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,R,l,S,M)}}a.index=r++,a.bufferGPU=u,this.set(o,a)}else if(o.isSampledTexture){const{textureGPU:l,glTextureType:u}=this.get(o.texture);a.index=s++,a.textureGPU=l,a.glTextureType=u,this.set(o,a)}}}updateBinding(e){const t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){const r=this.get(e).bufferGPU,s=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),o.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{const a=im(s),l=a?1:s.BYTES_PER_ELEMENT;for(let u=0,d=o.length;u<d;u++){const p=o[u],g=p.start*l,x=p.count*l,y=g*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,y,s,g,x)}}}}createIndexAttribute(e){const t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){const t=Object.keys(hw).filter(r=>hw[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}getMaxAnisotropy(){return this.capabilities.getMaxAnisotropy()}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}hasCompatibility(e){return e===tl.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){const{gl:t,state:n}=this;this._setFramebuffer(e),n.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){const{gl:t,state:n}=this;let r=null;if(e.textures!==null){const s=e.renderTarget,o=this.get(s),{samples:a,depthBuffer:l,stencilBuffer:u}=s,d=s.isCubeRenderTarget===!0,p=s.isRenderTarget3D===!0,g=s.depth>1,x=s.isXRRenderTarget===!0,y=x===!0&&s._hasExternalTextures===!0;let T=o.msaaFrameBuffer,S=o.depthRenderbuffer;const M=this.extensions.get("WEBGL_multisampled_render_to_texture"),R=this.extensions.get("OVR_multiview2"),E=this._useMultisampledExtension(s),N=p5(e);let U;if(d?(o.cubeFramebuffers||(o.cubeFramebuffers={}),U=o.cubeFramebuffers[N]):x&&y===!1?U=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),U=o.framebuffers[N]),U===void 0){U=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,U);const L=e.textures,F=[];if(d){o.cubeFramebuffers[N]=U;const{textureGPU:I}=this.get(L[0]),$=this.renderer._activeCubeFace,k=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+$,I,k
4250)}else{o.framebuffers[N]=U;for(let I=0;I<L.length;I++){const $=L[I],k=this.get($);k.renderTarget=e.renderTarget,k.cacheKey=N;const W=t.COLOR_ATTACHMENT0+I;if(s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,W,k.textureGPU,0,a,0,2);else if(p||g){const j=this.renderer._activeCubeFace,Y=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,W,k.textureGPU,Y,j)}else if(E)M.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,W,t.TEXTURE_2D,k.textureGPU,0,a);else{const j=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,W,t.TEXTURE_2D,k.textureGPU,j)}}}const P=u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){const I=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(I,e,0,E),o.xrDepthRenderbuffer=I,F.push(u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,I),t.framebufferRenderbuffer(t.FRAMEBUFFER,P,t.RENDERBUFFER,I)}else if(e.depthTexture!==null){F.push(u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);const I=this.get(e.depthTexture);if(I.renderTarget=e.renderTarget,I.cacheKey=N,s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,P,I.textureGPU,0,a,0,2);else if(y&&E)M.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,P,t.TEXTURE_2D,I.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){const $=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,P,I.textureGPU,0,$)}else if(e.depthTexture.isCubeTexture){const $=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,P,t.TEXTURE_CUBE_MAP_POSITIVE_X+$,I.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,P,t.TEXTURE_2D,I.textureGPU,0)}o.depthInvalidationArray=F}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,U);const F=this.renderer._activeCubeFace,P=this.get(e.depthTexture),I=u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,I,P.textureGPU,0,F)}if((x||E||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,U);const F=this.get(e.textures[0]);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,F.textureGPU,0,a,0,2):E?M.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0);const P=u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){const I=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,I),t.framebufferRenderbuffer(t.FRAMEBUFFER,P,t.RENDERBUFFER,I)}else{const I=this.get(e.depthTexture);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,P,I.textureGPU,0,a,0,2):E?M.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,P,t.TEXTURE_2D,I.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,P,t.TEXTURE_2D,I.textureGPU,0)}}}if(a>0&&E===!1&&!s.multiview){if(T===void 0){const L=[];T=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,T);const F=[],P=e.textures;for(let I=0;I<P.length;I++){F[I]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,F[I]),L.push(t.COLOR_ATTACHMENT0+I);const $=e.textures[I],k=this.get($);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,k.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+I,t.RENDERBUFFER,F[I])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=T,o.msaaRenderbuffers=F,l&&S===void 0){S=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(S,e,a),o.depthRenderbuffer=S;const I=u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;L.push(I)}o.invalidationArray=L}r=o.msaaFrameBuffer}else r=U;n.drawBuffers(e,U)}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){const r=this.get(e[n]);t+=":"+r.id}return t}_createVao(e){const{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let r=0;r<e.length;r++){const s=e[r],o=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(r);let a,l;s.isInterleavedBufferAttribute===!0?(a=s.data.stride*o.bytesPerElement,l=s.offset*o.bytesPerElement):(a=0,l=0),o.isInteger?t.vertexAttribIPointer(r,s.itemSize,o.type,a,l):t.vertexAttribPointer(r,s.itemSize,o.type,s.normalized,a,l),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;const{gl:r}=this;
4250n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){const o=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,o.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){const n=this.gl;for(const r of e)for(const s of r.bindings){const a=this.get(s).index;if(s.isUniformsGroup||s.isUniformBuffer){const l=n.getUniformBlockIndex(t,s.name);n.uniformBlockBinding(t,l,a)}else if(s.isSampledTexture){const l=n.getUniformLocation(t,s.name);n.uniform1i(l,a)}}}_bindUniforms(e){const{gl:t,state:n}=this;for(const r of e)for(const s of r.bindings){const o=this.get(s),a=o.index;s.isUniformsGroup||s.isUniformBuffer?n.bindBufferBase(t.UNIFORM_BUFFER,a,o.bufferGPU):s.isSampledTexture&&n.bindTexture(o.glTextureType,o.textureGPU,t.TEXTURE0+a)}}_resolveRenderTarget(e){const{gl:t,state:n}=this,r=e.renderTarget;if(e.textures!==null&&r){const s=this.get(r);if(r.samples>0&&this._useMultisampledExtension(r)===!1){const o=s.framebuffers[e.getCacheKey()];let a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));const l=s.msaaFrameBuffer,u=s.msaaRenderbuffers,d=e.textures,p=d.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,l),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),p)for(let g=0;g<d.length;g++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+g,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+g,t.TEXTURE_2D,null,0);for(let g=0;g<d.length;g++){if(p){const{textureGPU:x}=this.get(d[g]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,u[g]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0)}if(e.scissor){const{x,y,width:T,height:S}=e.scissorValue,M=e.height-S-y;t.blitFramebuffer(x,M,x+T,M+S,x,M,x+T,M+S,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(p)for(let g=0;g<d.length;g++){const{textureGPU:x}=this.get(d[g]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+g,t.RENDERBUFFER,u[g]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+g,t.TEXTURE_2D,x,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(r.resolveDepthBuffer===!1&&s.framebuffers){const o=s.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const Ep={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},pa=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},vr={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Jr={Store:"store"},Yn={Load:"load",Clear:"clear"},fw={CCW:"ccw",CW:"cw"},dw={None:"none",Back:"back"},eg={Uint16:"uint16",Uint32:"uint32"},ue={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},Z2={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},sa={Linear:"linear",Nearest:"nearest"},Nn={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},Ou={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},pw={None:0,All:15},Bl={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},J2={Storage:"storage",ReadOnlyStorage:"read-only-storage"},e_={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},mw={NonFiltering:"non-filtering",Comparison:"comparison"},ku={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},gw={TwoD:"2d",ThreeD:"3d"},kr={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},Zee={All:"all"},Rp={Vertex:"vertex",Instance:"instance"},Fx={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},_w={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"};class Jee extends v6{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update(
4250)}}class ete extends m6{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}}let tte=0;class nte extends ete{constructor(e,t){super("StorageBuffer_"+tte++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Er.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}}class ite extends vu{constructor(e){super(),this.device=e;const t=` 4251struct VarysStruct { 4252 @builtin( position ) Position: vec4f, 4253 @location( 0 ) vTex : vec2f, 4254 @location( 1 ) @interpolate(flat, either) vBaseArrayLayer: u32, 4255}; 4256 4257@group( 0 ) @binding ( 2 ) 4258var<uniform> flipY: u32; 4259 4260@vertex 4261fn mainVS( 4262 @builtin( vertex_index ) vertexIndex : u32, 4263 @builtin( instance_index ) instanceIndex : u32 ) -> VarysStruct { 4264 4265 var Varys : VarysStruct; 4266 4267 var pos = array( 4268 vec2f( -1, -1 ), 4269 vec2f( -1, 3 ), 4270 vec2f( 3, -1 ), 4271 ); 4272 4273 let p = pos[ vertexIndex ]; 4274 let mult = select( vec2f( 0.5, -0.5 ), vec2f( 0.5, 0.5 ), flipY != 0 ); 4275 Varys.vTex = p * mult + vec2f( 0.5 ); 4276 Varys.Position = vec4f( p, 0, 1 ); 4277 Varys.vBaseArrayLayer = instanceIndex; 4278 4279 return Varys; 4280 4281} 4282 4283@group( 0 ) @binding( 0 ) 4284var imgSampler : sampler; 4285 4286@group( 0 ) @binding( 1 ) 4287var img2d : texture_2d<f32>; 4288 4289@fragment 4290fn main_2d( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> { 4291 4292 return textureSample( img2d, imgSampler, Varys.vTex ); 4293 4294} 4295 4296@group( 0 ) @binding( 1 ) 4297var img2dArray : texture_2d_array<f32>; 4298 4299@fragment 4300fn main_2d_array( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> { 4301 4302 return textureSample( img2dArray, imgSampler, Varys.vTex, Varys.vBaseArrayLayer ); 4303 4304} 4305 4306const faceMat = array( 4307 mat3x3f( 0, 0, -2, 0, -2, 0, 1, 1, 1 ), // pos-x 4308 mat3x3f( 0, 0, 2, 0, -2, 0, -1, 1, -1 ), // neg-x 4309 mat3x3f( 2, 0, 0, 0, 0, 2, -1, 1, -1 ), // pos-y 4310 mat3x3f( 2, 0, 0, 0, 0, -2, -1, -1, 1 ), // neg-y 4311 mat3x3f( 2, 0, 0, 0, -2, 0, -1, 1, 1 ), // pos-z 4312 mat3x3f( -2, 0, 0, 0, -2, 0, 1, 1, -1 ), // neg-z 4313); 4314 4315@group( 0 ) @binding( 1 ) 4316var imgCube : texture_cube<f32>; 4317 4318@fragment 4319fn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> { 4320 4321 return textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) ); 4322 4323} 4324`;this.mipmapSampler=e.createSampler({minFilter:sa.Linear}),this.flipYSampler=e.createSampler({minFilter:sa.Nearest}),this.flipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),this.noFlipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM}),this.transferPipelines={},this.mipmapShaderModule=e.createShaderModule({label:"mipmap",code:t})}getTransferPipeline(e,t){t=t||"2d-array";const n=`${e}-${t}`;let r=this.transferPipelines[n];return r===void 0&&(r=this.device.createRenderPipeline({label:`mipmap-${e}-${t}`,vertex:{module:this.mipmapShaderModule},fragment:{module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},layout:"auto"}),this.transferPipelines[n]=r),r}flipY(e,t,n=0){const r=t.format,{width:s,height:o}=t.size,a=this.device.createTexture({size:{width:s,height:o},format:r,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),l=this.getTransferPipeline(r,e.textureBindingViewDimension),u=this.getTransferPipeline(r,a.textureBindingViewDimension),d=this.device.createCommandEncoder({}),p=(g,x,y,T,S,M)=>{const R=g.getBindGroupLayout(0),E=this.device.createBindGroup({layout:R,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:x.createView({dimension:x.textureBindingViewDimension||"2d-array",baseMipLevel:0,mipLevelCount:1})},{binding:2,resource:{buffer:M?this.flipUniformBuffer:this.noFlipUniformBuffer}}]}),N=d.beginRenderPass({colorAttachments:[{view:T.createView({dimension:"2d",baseMipLevel:0,mipLevelCount:1,baseArrayLayer:S,arrayLayerCount:1}),loadOp:Yn.Clear,storeOp:Jr.Store}]});N.setPipeline(g),N.setBindGroup(0,E),N.draw(3,1,0,y),N.end()};p(l,e,n,a,0,!1),p(u,a,0,e,n,!0),this.device.queue.submit([d.finish()]),a.destroy()}generateMipmaps(e,t=null){const n=this.get(e),r=n.layers||this._mipmapCreateBundles(e),s=t||this.device.createCommandEncoder({label:"mipmapEncoder"});this._mipmapRunBundles(s,r),t===null&&this.device.queue.submit([s.finish()]),n.layers=r}_mipmapCreateBundles(e){const t=e.textureBindingViewDimension||"2d-array",n=this.getTransferPipeline(e.format,t),r=n.getBindGroupLayout(0),s=[];for(let o=1;o<e.mipLevelCount;o++)for(let a=0;a<e.depthOrArrayLayers;a++){const l=this.device.createBindGroup({layout:r,entries:[{binding:0,resource:this.mipmapSampler},{binding:1,resource:e.createView({dimension:t,baseMipLevel:o-1,mipLevelCount:1})},{binding:2,resource:{buffer:this.noFlipUniformBuffer}}]}),u={colorAttachments:[{view:e.createView({dimension:"2d",baseMipLevel:o,mipLevelCount:1,baseArrayLayer:a,arrayLayerCount:1}),loadOp:Yn.Clear,storeOp:Jr.Store}]},d=this.device.createRenderBundleEncoder({colorFormats:[e.format]});d.setPipeline(n),d.setBindGroup(0,l),d.draw(3,1,0,a),s.push({renderBundles:[d.finish()],passDescriptor:u})}return s}_mipmapRunBundles(e,t){const n=t.length;for(let r=0;r<n;r++){const s=t[r],o=e.beginRenderPass(s.passDescriptor);o.executeBundles(s.renderBundles),o.end()}}}const rte={[uv]:"never",[sg]:"less",[cv]:"equal",[fu]:"less-equal",[ad]:"greater",[al]:"greater-equal",[Av]:"always",[hv]:"not-equal"},ste=[0,1,3,2,4,5];class ote{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){const t=this.backend,n=e.minFilter+"-"+e.magFilter+"-"+e.wrapS+"-"+e.wrapT+"-"+(e.wrapR||"0")+"-"+e.anisotropy+"-"+(e.compareFunction||0);let r=this._samplerCache.get(n);if(r===void 0){const o={addressModeU:this._convertAddressMode(e.wrapS),addressModeV:this._convertAddressMode(e.wrapT),addressModeW:this._convertAddressMode(e.wrapR),magFilter:this._convertFilterMode(e.magFilter),minFilter:this._convertFilterMode(e.minFilter),mipmapFilter:this._convertFilterMode(e.minFilter),maxAnisotropy:1};e.isDepthTexture&&e.compareFunction===null&&(o.magFilter=sa.Nearest,o.minFilter=sa.Nearest,o.mipmapFilter=sa.Nearest),o.magFilter===sa.Linear&&o.minFilter===sa.Linear&&o.mipmapFilter===sa.Linear&&(o.maxAnisotropy=e.anisotropy),e.isDepthTexture&&e.compareFunction!==null&&t.hasCompatibility(tl.TEXTURE_COMPARE)&&(o.compare=rte[e.compareFunction]),r={sampler:t.device.createSampler(o),usedTimes:0},this._samplerCache.set(n,r)}const s=t.get(e);if(s.sampler!==r.sampler){if(s.sampler!==void 0){const o=this._samplerCache.get(s.samplerKey);o.usedTimes--,o.usedTimes===0&&this._samplerCache.delete(s.samplerKey)}s.samplerKey=n,s.sampler=r.sampler,r.usedTimes++}
4324return n}createDefaultTexture(e){let t;const n=Ux(e);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){const n=this.backend,r=n.get(e);if(r.initialized)throw new Error("WebGPUTextureUtils: Texture already initialized.");if(e.isExternalTexture){r.texture=e.sourceTexture,r.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);const{width:s,height:o,depth:a,levels:l}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());const u=this._getDimension(e),d=e.internalFormat||t.format||Ux(e,n.device);r.format=d;const{samples:p,primarySamples:g,isMSAA:x}=n.utils.getTextureSampleData(e);let y=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(y|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&d!==ue.RGB9E5UFloat&&(y|=GPUTextureUsage.RENDER_ATTACHMENT);const T={label:e.name,size:{width:s,height:o,depthOrArrayLayers:a},mipLevelCount:l,sampleCount:g,dimension:u,format:d,usage:y};if(d===void 0){Oe("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(T.textureBindingViewDimension=kr.Cube);try{r.texture=n.device.createTexture(T)}catch{Oe("WebGPURenderer: Failed to create texture with descriptor:",T),this.createDefaultTexture(e);return}if(x){const S=Object.assign({},T);S.label=S.label+"-msaa",S.sampleCount=p,S.mipLevelCount=1,r.msaaTexture=n.device.createTexture(S)}r.initialized=!0,r.textureDescriptorGPU=T}destroyTexture(e,t=!1){const n=this.backend,r=n.get(e);r.texture!==void 0&&t===!1&&r.texture.destroy(),r.msaaTexture!==void 0&&r.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){const n=this.backend.get(e);this._generateMipmaps(n.texture,t)}getColorBuffer(){const e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:r}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,o=t.colorTexture,a=e.get(o);if(o.width===n&&o.height===r&&o.samples===s)return a.texture;let l=a.texture;return l&&l.destroy(),l=e.device.createTexture({label:"colorBuffer",size:{width:n,height:r,depthOrArrayLayers:1},sampleCount:e.utils.getSampleCount(e.renderer.currentSamples),format:e.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC}),o.source.width=n,o.source.height=r,o.samples=s,a.texture=l,l}getDepthBuffer(e=!0,t=!1){const n=this.backend,r=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),a=n.renderer.currentSamples,l=r.depthTexture;if(l.width===s&&l.height===o&&l.samples===a&&l.depth===e&&l.stencil===t)return n.get(l).texture;const u=n.get(l).texture;let d,p;if(t?(d=as,p=Hs):e&&(d=Rr,p=ii),u!==void 0){if(l.image.width===s&&l.image.height===o&&l.format===d&&l.type===p&&l.samples===a)return u;this.destroyTexture(l)}return l.name="depthBuffer",l.format=d,l.type=p,l.image.width=s,l.image.height=o,l.samples=a,this.createTexture(l,{width:s,height:o}),n.get(l).texture}updateTexture(e,t){const n=this.backend.get(e),r=e.mipmaps,{textureDescriptorGPU:s}=n;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(r.length>0)for(let o=0,a=r.length;o<a;o++){const l=r[o];this._copyBufferToTexture(l,n.texture,s,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,s);else if(r.length>0)for(let o=0,a=r.length;o<a;o++){const l=r[o];this._copyImageToTexture(l,n.texture,s,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,s,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,r,s,o){const a=this.backend.device,l=this.backend.get(e),u=l.texture,d=l.textureDescriptorGPU.format,p=this._getBytesPerTexel(d);let g=r*p;g=Math.ceil(g/256)*256;const x=a.createBuffer({size:(s-1)*g+r*p,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),y=a.createCommandEncoder();y.copyTextureToBuffer({texture:u,origin:{x:t,y:n,z:o}},{buffer:x,bytesPerRow:g},{width:r,height:s});const T=this._getTypedArrayType(d);a.queue.submit([y.finish()]),await x.mapAsync(GPUMapMode.READ);const S=x.getMappedRange();return new T(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){const n=new tr;n.minFilter=jn,n.magFilter=jn,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){const n=new FA;n.minFilter=jn,n.magFilter=jn,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){const r=e.images,s=e.mipmaps;for(let o=0;o<6;o++){const a=r[o],l=e.flipY===!0?ste[o]:o;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,e.flipY):this._copyImageToTexture(a,t,n,l,e.flipY,e.premultiplyAlpha);for(let u=0;u<s.length;u++){const p=s[u].images[o];p.isDataTexture?this._copyBufferToTexture(p.image,t,n,l,e.flipY,0,u+1):this._copyImageToTexture(p,t,n,l,e.flipY,e.premultiplyAlpha,u+1)}}}_copyImageToTexture(e,t,n,r,s,o,a=0){const l=this.backend.device,u=a>0?e.width:n.size.width,d=a>0?e.height:n.size.height;try{l.queue.copyExternalImageToTexture({source:e,flipY:s},{texture:t,mipLevel:a,origin:{x:0,y:0,z:r},premultipliedAlpha:o},{width:u,height:d,depthOrArrayLayers:1})}catch{}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new ite(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,s,o=0,a=0){const l=this.backend.device,u=e.data,d=this._getBytesPerTexel(n.format),p=e.width*d;l.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:r}},u,{offset:e.width*e.height*d*o,bytesPerRow:p},{width:e.width,height:e.height,depthOrArrayLayers:1}),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n){const r=this.backend.device,s=this._getBlockData(n.format),o=n.size.depthOrArrayLayers>1;for(let a=0;a<e.length;a++){const l=e[a],u=l.width,d=l.height,p=o?n.size.depthOrArrayLayers:1,g=Math.ceil(u/s.width)*s.byteLength,x=g*Math.ceil(d/s.height);for(let y=0;y<p;y++)r.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:y}},l.data,{offset:y*x,bytesPerRow:g,rowsPerImage:Math.ceil(d/s.height)},{width:Math.ceil(u/s.width)*s.width,height:Math.ceil(d/s.height)*s.height,depthOrArrayLayers:1})}}_getBlockData(e){if(e===ue.BC1RGBAUnorm||e===ue.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===ue.BC2RGBAUnorm||e===ue.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===ue.BC3RGBAUnorm||e===ue.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===ue.BC4RUnorm||e===ue.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===ue.BC5RGUnorm||e===ue.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===ue.BC6HRGBUFloat||e===ue.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===ue.BC7RGBAUnorm||e===ue.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===ue.ETC2RGB8Unorm||e===ue.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===ue.ETC2RGB8A1Unorm||e===ue.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===ue.ETC2RGBA8Unorm||e===ue.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===ue.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===ue.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===ue.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===ue.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===ue.ASTC4x4Unorm||e===ue.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===ue.ASTC5x4Unorm||e===ue.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===ue.ASTC5x5Unorm||e===ue.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===ue.ASTC6x5Unorm||e===ue.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===ue.ASTC6x6Unorm||e===ue.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===ue.ASTC8x5Unorm||e===ue.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===ue.ASTC8x6Unorm||e===ue.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===ue.ASTC8x8Unorm||e===ue.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===ue.ASTC10x5Unorm||e===ue.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===ue.ASTC10x6Unorm||e===ue.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===ue.ASTC10x8Unorm||e===ue.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===ue.ASTC10x10Unorm||e===ue.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===ue.ASTC12x10Unorm||e===ue.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===ue.ASTC12x12Unorm||e===ue.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=Z2.ClampToEdge;return e===lc?t=Z2.Repeat:e===uc&&(t=Z2.MirrorRepeat),t}_convertFilterMode(e){let t=sa.Linear;return(e===jn||e===av||e===Ja)&&(t=sa.Nearest),t}_getBytesPerTexel(e){if(e===ue.R8Unorm||e===ue.R8Snorm||e===ue.R8Uint||e===ue.R8Sint)return 1;if(e===ue.R16Uint||e===ue.R16Sint||e===ue.R16Float||e===ue.RG8Unorm||e===ue.RG8Snorm||e===ue.RG8Uint||e===ue.RG8Sint)return 2;if(e===ue.R32Uint||e===ue.R32Sint||e===ue.R32Float||e===ue.RG16Uint||e===ue.RG16Sint||e===ue.RG16Float||e===ue.RGBA8Unorm||e===ue.RGBA8UnormSRGB||e===ue.RGBA8Snorm||e===ue.RGBA8Uint||e===ue.RGBA8Sint||e===ue.BGRA8Unorm||e===ue.BGRA8UnormSRGB||e===ue.RGB9E5UFloat||e===ue.RGB10A2Unorm||e===ue.RG11B10UFloat||e===ue.Depth32Float||e===ue.Depth24Plus||e===ue.Depth24PlusStencil8||e===ue.Depth32FloatStencil8)return 4;if(e===ue.RG32Uint||e===ue.RG32Sint||e===ue.RG32Float||e===ue.RGBA16Uint||e===ue.RGBA16Sint||e===ue.RGBA16Float)return 8;if(e===ue.RGBA32Uint||e===ue.RGBA32Sint||e===ue.RGBA32Float)return 16}_getTypedArrayType(e){if(e===ue.R8Uint)return Uint8Array;
4324if(e===ue.R8Sint)return Int8Array;if(e===ue.R8Unorm)return Uint8Array;if(e===ue.R8Snorm)return Int8Array;if(e===ue.RG8Uint)return Uint8Array;if(e===ue.RG8Sint)return Int8Array;if(e===ue.RG8Unorm)return Uint8Array;if(e===ue.RG8Snorm)return Int8Array;if(e===ue.RGBA8Uint)return Uint8Array;if(e===ue.RGBA8Sint)return Int8Array;if(e===ue.RGBA8Unorm||e===ue.RGBA8UnormSRGB)return Uint8Array;if(e===ue.RGBA8Snorm)return Int8Array;if(e===ue.R16Uint)return Uint16Array;if(e===ue.R16Sint)return Int16Array;if(e===ue.RG16Uint)return Uint16Array;if(e===ue.RG16Sint)return Int16Array;if(e===ue.RGBA16Uint)return Uint16Array;if(e===ue.RGBA16Sint)return Int16Array;if(e===ue.R16Float||e===ue.RG16Float||e===ue.RGBA16Float)return Uint16Array;if(e===ue.R32Uint)return Uint32Array;if(e===ue.R32Sint)return Int32Array;if(e===ue.R32Float)return Float32Array;if(e===ue.RG32Uint)return Uint32Array;if(e===ue.RG32Sint)return Int32Array;if(e===ue.RG32Float)return Float32Array;if(e===ue.RGBA32Uint)return Uint32Array;if(e===ue.RGBA32Sint)return Int32Array;if(e===ue.RGBA32Float)return Float32Array;if(e===ue.BGRA8Unorm||e===ue.BGRA8UnormSRGB)return Uint8Array;
4324if(e===ue.RGB10A2Unorm||e===ue.RGB9E5UFloat||e===ue.RG11B10UFloat)return Uint32Array;if(e===ue.Depth32Float)return Float32Array;if(e===ue.Depth24Plus||e===ue.Depth24PlusStencil8)return Uint32Array;if(e===ue.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=gw.ThreeD:t=gw.TwoD,t}}function Ux(i,e=null){const t=i.format,n=i.type,r=i.colorSpace,s=Yt.getTransfer(r);let o;if(i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Zl:case Jl:o=s===_t?ue.BC1RGBAUnormSRGB:ue.BC1RGBAUnorm;break;case eu:o=s===_t?ue.BC2RGBAUnormSRGB:ue.BC2RGBAUnorm;break;case tu:o=s===_t?ue.BC3RGBAUnormSRGB:ue.BC3RGBAUnorm;break;case uA:o=ue.BC4RUnorm;break;case cA:o=ue.BC4RSnorm;break;case hc:o=ue.BC5RGUnorm;break;case hA:o=ue.BC5RGSnorm;break;case lA:o=s===_t?ue.BC7RGBAUnormSRGB:ue.BC7RGBAUnorm;break;case zh:case qh:o=s===_t?ue.ETC2RGB8UnormSRGB:ue.ETC2RGB8Unorm;break;case Hh:o=s===_t?ue.ETC2RGBA8UnormSRGB:ue.ETC2RGBA8Unorm;break;case Wh:o=ue.EACR11Unorm;break;case $h:o=ue.EACR11Snorm;break;case cc:o=ue.EACRG11Unorm;break;case jh:o=ue.EACRG11Snorm;break;case Xh:o=s===_t?ue.ASTC4x4UnormSRGB:ue.ASTC4x4Unorm;break;case Qh:o=s===_t?ue.ASTC5x4UnormSRGB:ue.ASTC5x4Unorm;break;case Yh:o=s===_t?ue.ASTC5x5UnormSRGB:ue.ASTC5x5Unorm;break;case Kh:o=s===_t?ue.ASTC6x5UnormSRGB:ue.ASTC6x5Unorm;break;case Zh:o=s===_t?ue.ASTC6x6UnormSRGB:ue.ASTC6x6Unorm;break;case Jh:o=s===_t?ue.ASTC8x5UnormSRGB:ue.ASTC8x5Unorm;break;case eA:o=s===_t?ue.ASTC8x6UnormSRGB:ue.ASTC8x6Unorm;break;case tA:o=s===_t?ue.ASTC8x8UnormSRGB:ue.ASTC8x8Unorm;break;case nA:o=s===_t?ue.ASTC10x5UnormSRGB:ue.ASTC10x5Unorm;break;case iA:o=s===_t?ue.ASTC10x6UnormSRGB:ue.ASTC10x6Unorm;break;case rA:o=s===_t?ue.ASTC10x8UnormSRGB:ue.ASTC10x8Unorm;break;case sA:o=s===_t?ue.ASTC10x10UnormSRGB:ue.ASTC10x10Unorm;break;case oA:o=s===_t?ue.ASTC12x10UnormSRGB:ue.ASTC12x10Unorm;break;case aA:o=s===_t?ue.ASTC12x12UnormSRGB:ue.ASTC12x12Unorm;break;case Wi:o=s===_t?ue.RGBA8UnormSRGB:ue.RGBA8Unorm;break;default:ke("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Wi:switch(n){case ec:o=ue.RGBA8Snorm;break;case tc:o=ue.RGBA16Sint;break;case Do:o=ue.RGBA16Uint;break;case ii:o=ue.RGBA32Uint;break;case dr:o=ue.RGBA32Sint;break;case yi:o=s===_t?ue.RGBA8UnormSRGB:ue.RGBA8Unorm;break;case Mi:o=ue.RGBA16Float;break;case zi:o=ue.RGBA32Float;break;default:ke("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Ld:switch(n){case ig:o=ue.RGB9E5UFloat;break;case rg:o=ue.RG11B10UFloat;break;default:ke("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Id:switch(n){case ec:o=ue.R8Snorm;break;case tc:o=ue.R16Sint;break;case Do:o=ue.R16Uint;break;case ii:o=ue.R32Uint;break;case dr:o=ue.R32Sint;break;case yi:o=ue.R8Unorm;break;case Mi:o=ue.R16Float;break;case zi:o=ue.R32Float;break;default:ke("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case ls:switch(n){case ec:o=ue.RG8Snorm;break;case tc:o=ue.RG16Sint;break;case Do:o=ue.RG16Uint;break;case ii:o=ue.RG32Uint;break;case dr:o=ue.RG32Sint;break;case yi:o=ue.RG8Unorm;break;case Mi:o=ue.RG16Float;break;case zi:o=ue.RG32Float;break;default:ke("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Rr:switch(n){case Do:o=ue.Depth16Unorm;break;case ii:o=ue.Depth24Plus;break;case zi:o=ue.Depth32Float;break;default:ke("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case as:switch(n){case Hs:o=ue.Depth24PlusStencil8;break;case zi:e&&e.features.has(Fx.Depth32FloatStencil8)===!1&&ke('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),o=ue.Depth32FloatStencil8;break;default:ke("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case PA:switch(n){case dr:o=ue.R32Sint;break;case ii:o=ue.R32Uint;break;default:ke("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case DA:switch(n){case dr:o=ue.RG32Sint;break;case ii:o=ue.RG32Uint;break;default:ke("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n
4324)}break;case LA:switch(n){case dr:o=ue.RGBA32Sint;break;case ii:o=ue.RGBA32Uint;break;default:ke("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:ke("WebGPURenderer: Unsupported texture format.",t)}return o}const ate=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,lte=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,xw={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},ute=i=>{i=i.trim();const e=i.match(ate);if(e!==null&&e.length===4){const t=e[2],n=[];let r=null;for(;(r=lte.exec(t))!==null;)n.push({name:r[1],type:r[2]});const s=[];for(let d=0;d<n.length;d++){const{name:p,type:g}=n[d];let x=g;x.startsWith("ptr")?x="pointer":(x.startsWith("texture")&&(x=g.split("<")[0]),x=xw[x]),s.push(new M3(x,p))}const o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:xw[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("FunctionNode: Function is not a WGSL code.")};class cte extends E3{constructor(e){const{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=ute(e);super(t,n,r),this.inputsCode=s,this.blockCode=o,this.outputType=a}getCode(e=this.name){const t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class hte extends f6{parseFunction(e){return new cte(e)}}const Ate={[Er.READ_ONLY]:"read",[Er.WRITE_ONLY]:"write",[Er.READ_WRITE]:"read_write"},vw={[lc]:"repeat",[xs]:"clamp",[uc]:"mirror"},t_={vertex:pa.VERTEX,fragment:pa.FRAGMENT,compute:pa.COMPUTE},yw={instance:!0,swizzleAssign:!1,storageBuffer:!0},fte={"^^":"tsl_xor"},dte={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},bw={},Tf={tsl_xor:new rr("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new rr("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new rr("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new rr("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new rr("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new rr("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new rr("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new rr("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new rr("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new rr("fn tsl_repeatWrapping_float( coord: f32 ) ->
4324 f32 { return fract( coord ); }"),mirrorWrapping_float:new rr("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new rr("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new rr(` 4325fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f { 4326 4327 let res = vec2f( iRes ); 4328 4329 let uvScaled = coord * res; 4330 let uvWrapping = ( ( uvScaled % res ) + res ) % res; 4331 4332 // https://www.shadertoy.com/view/WtyXRy 4333 4334 let uv = uvWrapping - 0.5; 4335 let iuv = floor( uv ); 4336 let f = fract( uv ); 4337 4338 let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level ); 4339 let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level ); 4340 let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level ); 4341 let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level ); 4342 4343 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y ); 4344 4345} 4346`),biquadraticTextureArray:new rr(` 4347fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f { 4348 4349 let res = vec2f( iRes ); 4350 4351 let uvScaled = coord * res; 4352 let uvWrapping = ( ( uvScaled % res ) + res ) % res; 4353 4354 // https://www.shadertoy.com/view/WtyXRy 4355 4356 let uv = uvWrapping - 0.5; 4357 let iuv = floor( uv ); 4358 let f = fract( uv ); 4359 4360 let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, layer, level ); 4361 let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, layer, level ); 4362 let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, layer, level ); 4363 let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, layer, level ); 4364 4365 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y ); 4366 4367} 4368`)},pte={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"};let T6="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(T6+=`diagnostic( off, derivative_uniformity ); 4369`);class mte extends A6{constructor(e,t){super(e,t,new hte),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map}_generateTextureSample(e,t,n,r,s,o=this.shaderStage){return o==="fragment"?r?s?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:s?`textureSample( ${t}, ${t}_sampler, ${n}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateWrapFunction(e){const t=`tsl_coord_${vw[e.wrapS]}S_${vw[e.wrapT]}_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}T`;let n=bw[t];if(n===void 0){const r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f";let o=`fn ${t}( coord : ${s} ) -> ${s} { 4370 4371 return ${s}( 4372`;const a=(l,u)=>{l===lc?(r.push(Tf.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${u} )`):l===xs?(r.push(Tf.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${u} )`):l===uc?(r.push(Tf.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${u} )`):(o+=` coord.${u}`,Oe(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`, 4373`,a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(o+=`, 4374`,a(e.wrapR,"z")),o+=` 4375 ); 4376 4377} 4378`,bw[t]=n=new rr(o,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){const r=this.getDataFromNode(e,this.shaderStage,this.globalCache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let o,a;const{primarySamples:l}=this.renderer.backend.utils.getTextureSampleData(e),u=l>1;e.is3DTexture||e.isData3DTexture?a="vec3<u32>":a="vec2<u32>",u||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,s=new Kp(new Zp(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new Kp(new Zp(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new Kp(new Zp("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r,s="0u",o){const a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s);return r&&(n=`${n} + vec2<f32>(${r}) / ${l}`),o?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${n} ), ${l}, u32( ${o} ), u32( ${s} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${s} ) )`)}generateTextureLod(e,t,n,r,s,o="0u"){if(e.isCubeTexture===!0){s&&(n=`${n} + vec3<f32>(${s})`);const x=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${x}( ${o} ) )`}const a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,o),u=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",d=u==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";s&&(n=`${n} + ${u}<f32>(${s}) / ${u}<f32>( ${l} )`);const p=`${u}<f32>( 0 )`,g=`${u}<f32>( ${l} - ${d} )`;return n=`${u}<u32>( clamp( floor( ${a}( ${n} ) * ${u}<f32>( ${l} ) ), ${p}, ${g} ) )`,this.generateTextureLoad(e,t,n,o,r,null)}generateStorageTextureLoad(e,t,n,r,s,o){o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s} )`:a=`textureLoad( ${t}, ${n} )`,a}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0u"),o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}
4378generateTextureStore(e,t,n,r,s){let o;return r?o=`textureStore( ${t}, ${n}, ${r}, ${s} )`:o=`textureStore( ${t}, ${n}, ${s} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(tl.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.isDataTexture===!0&&e.type===zi||this.isSampleCompare(e)===!1&&e.minFilter===jn&&e.magFilter===jn||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s,o=this.shaderStage){let a=null;return this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,s,"0",o):a=this._generateTextureSample(e,t,n,r,s,o),a}generateTextureGrad(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]} )`:o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;ke(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;ke(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateTextureBias(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;ke(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){const n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="cubeDepthTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=fte[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(Oe("WebGPURenderer: Atomic operations are only supported in compute shaders."),Er.READ_WRITE):Er.READ_ONLY:e.access}getStorageAccess(e,t){return Ate[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){const s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let a;const l=e.groupNode,u=l.name,d=this.getBindGroupArray(u,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let p=null;const g=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?p=new Bx(s.name,s.node,l,g):p=new $g(s.name,s.node,l,g):t==="cubeTexture"||t==="cubeDepthTexture"?p=new y6(s.name,s.node,l,g):t==="texture3D"&&(p=new Bx(s.name,s.node,l,g)),p.store=e.isStorageTextureNode===!0,p.mipLevel=p.store?e.mipLevel:0,p.setVisibility(t_[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&p.store===!1){const y=new Jee(`${s.name}_sampler`,s.node,l);y.setVisibility(t_[n]),d.push(y,p),a=[y,p]}else d.push(p),a=[p]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){const p=this.getSharedDataFromNode(e);let g=p.buffer;if(g===void 0){const x=t==="buffer"?_6:nte;g=new x(e,l),p.buffer=g}g.setVisibility(g.getVisibility()|t_[n]),d.push(g),a=g,s.name=r||"NodeBuffer_"+s.id}else{let p=this.uniformGroups[u];p===void 0&&(p=new x6(u,l),p.setVisibility(pa.VERTEX|pa.FRAGMENT|pa.COMPUTE),this.uniformGroups[u]=p),d.indexOf(p)===-1&&d.push(p),a=this.getNodeUniform(s,t);const g=a.name;p.uniforms.some(y=>y.name===g)||p.addUniform(a)}o.uniformGPU=a}return s}getBuiltin(e,t,n,r=this.shaderStage){const s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),r=[];
4378for(const o of t.inputs)r.push(o.name+" : "+this.getType(o.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} { 4379${n.vars} 4380${n.code} 4381`;return n.result&&(s+=` return ${n.result}; 4382`),s+=` 4383} 4384`,s}getInstanceIndex(){return this.shaderStage==="vertex"?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4<f32>")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],n=this.directives[e];if(n!==void 0)for(const r of n)t.push(`enable ${r};`);return t.join(` 4385`)}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array<f32, ${e} >`,"vertex")}getBuiltins(e){const t=[],n=this.builtins[e];if(n!==void 0)for(const{name:r,property:s,type:o}of n.values())t.push(`@builtin( ${r} ) ${s} : ${o}`);return t.join(`, 4386 `)}getScopedArray(e,t,n,r){return this.scopedArrays.has(e)===!1&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:n,bufferCount:r}),e}getScopedArrays(e){if(e!=="compute")return;const t=[];for(const{name:n,scope:r,bufferType:s,bufferCount:o}of this.scopedArrays.values()){const a=this.getType(s);t.push(`var<${r}> ${n}: array< ${a}, ${o} >;`)}return t.join(` 4387`)}getAttributes(e){const t=[];if(e==="compute"&&(this.getBuiltin("global_invocation_id","globalId","vec3<u32>","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3<u32>","attribute"),this.getBuiltin("local_invocation_id","localId","vec3<u32>","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3<u32>","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),e==="vertex"||e==="compute"){const n=this.getBuiltins("attribute");n&&t.push(n);const r=this.getAttributesArray();for(let s=0,o=r.length;s<o;s++){const a=r[s],l=a.name,u=this.getType(a.type);t.push(`@location( ${s} ) ${l} : ${u}`)}}return t.join(`, 4388 `)}getStructMembers(e){const t=[];for(const n of e.members){const r=e.output?"@location( "+n.index+" ) ":"";let s=this.getType(n.type);n.atomic&&(s="atomic< "+s+" >"),t.push(` ${r+n.name} : ${s}`)}return e.output&&t.push(` ${this.getBuiltins("output")}`),t.join(`, 4389`)}getStructs(e){let t="";const n=this.structs[e];if(n.length>0){const r=[];for(const s of n){let o=`struct ${s.name} { 4390`;o+=this.getStructMembers(s),o+=` 4391};`,r.push(o)}t=` 4392`+r.join(` 4393 4394`)+` 4395`}return t}getVar(e,t,n=null){let r=`var ${t} : `;return n!==null?r+=this.generateArrayDeclaration(e,n):r+=this.getType(e),r}getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const r of n)t.push(` ${this.getVar(r.type,r.name,r.count)};`);return` 4396${t.join(` 4397`)} 4398`}getVaryings(e){const t=[];if(e==="vertex"&&this.getBuiltin("position","builtinClipSpace","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){const s=this.varyings,o=this.vars[e];for(let a=0;a<s.length;a++){const l=s[a];if(l.needsInterpolation){let u=`@location( ${a} )`;if(l.interpolationType){const d=l.interpolationSampling!==null?`, ${l.interpolationSampling} )`:" )";u+=` @interpolate( ${l.interpolationType}${d}`}
4398else/^(int|uint|ivec|uvec)/.test(l.type)&&(u+=" @interpolate(flat, either)");t.push(`${u} ${l.name} : ${this.getType(l.type)}`)}else e==="vertex"&&o.includes(l)===!1&&o.push(l)}}const n=this.getBuiltins(e);n&&t.push(n);const r=t.join(`, 4399 `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}isCustomStruct(e){const t=e.value,n=e.node,r=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,s=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return r&&!s}getUniforms(e){const t=this.uniforms[e],n=[],r=[],s=[],o={};for(const l of t){const u=l.groupNode.name,d=this.bindingsIndexes[u];if(l.type==="texture"||l.type==="cubeTexture"||l.type==="cubeDepthTexture"||l.type==="storageTexture"||l.type==="texture3D"){const p=l.node.value;(p.isCubeTexture===!0||this.isUnfilterable(p)===!1&&l.node.isStorageTextureNode!==!0)&&(this.isSampleCompare(p)?n.push(`@binding( ${d.binding++} ) @group( ${d.group} ) var ${l.name}_sampler : sampler_comparison;`):n.push(`@binding( ${d.binding++} ) @group( ${d.group} ) var ${l.name}_sampler : sampler;`));let x,y="";const{primarySamples:T}=this.renderer.backend.utils.getTextureSampleData(p);if(T>1&&(y="_multisampled"),p.isCubeTexture===!0&&p.isDepthTexture===!0)x="texture_depth_cube";else if(p.isCubeTexture===!0)x="texture_cube<f32>";else if(p.isDepthTexture===!0)this.renderer.backend.compatibilityMode&&p.compareFunction===null?x=`texture${y}_2d<f32>`:x=`texture_depth${y}_2d${p.isArrayTexture===!0?"_array":""}`;else if(l.node.isStorageTextureNode===!0){const S=Ux(p),M=this.getStorageAccess(l.node,e),R=l.node.value.is3DTexture,E=l.node.value.isArrayTexture;x=`texture_storage_${R?"3d":`2d${E?"_array":""}`}<${S}, ${M}>`}else if(p.isArrayTexture===!0||p.isDataArrayTexture===!0||p.isCompressedArrayTexture===!0)x="texture_2d_array<f32>";else if(p.is3DTexture===!0||p.isData3DTexture===!0)x="texture_3d<f32>";else{const S=this.getComponentTypeFromTexture(p).charAt(0);x=`texture${y}_2d<${S}32>`}n.push(`@binding( ${d.binding++} ) @group( ${d.group} ) var ${l.name} : ${x};`)}else if(l.type==="buffer"||l.type==="storageBuffer"||l.type==="indirectStorageBuffer"){const p=l.node,g=this.getType(p.getNodeType(this)),x=p.bufferCount,y=x>0&&l.type==="buffer"?", "+x:"",T=p.isStorageBufferNode?`storage, ${this.getStorageAccess(p,e)}`:"uniform";if(this.isCustomStruct(l))r.push(`@binding( ${d.binding++} ) @group( ${d.group} ) var<${T}> ${l.name} : ${g};`);else{const M=` value : array< ${p.isAtomic?`atomic<${g}>`:`${g}`}${y} >`;r.push(this._getWGSLStructBinding(l.name,M,T,d.binding++,d.group))}}else{const p=l.groupNode.name;if(o[p]===void 0){const g=this.uniformGroups[p];if(g!==void 0){const x=[];for(const T of g.uniforms){const S=T.getType(),M=this.getType(this.getVectorType(S));x.push(` ${T.name} : ${M}`)}let y=this.uniformGroupsBindings[p];y===void 0&&(y={index:d.binding++,id:d.group},this.uniformGroupsBindings[p]=y),o[p]={index:y.index,id:y.id,snippets:x}}}}}for(const l in o){const u=o[l];s.push(this._getWGSLStructBinding(l,u.snippets.join(`, 4400`),"uniform",u.index,u.id))}return[...n,...r,...s].join(` 4401`)}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){this.shaderStage=t;const n=e[t];n.uniforms=this.getUniforms(t),n.attributes=this.getAttributes(t),n.varyings=this.getVaryings(t),n.structs=this.getStructs(t),n.vars=this.getVars(t),n.codes=this.getCodes(t),n.directives=this.getDirectives(t),n.scopedArrays=this.getScopedArrays(t);let r=`// code 4402 4403`;r+=this.flowCode[t];const s=this.flowNodes[t],o=s[s.length-1],a=o.outputNode,l=a!==void 0&&a.isOutputStructNode===!0;for(const u of s){const d=this.getFlowData(u),p=u.name;if(p&&(r.length>0&&(r+=` 4404`),r+=` // flow -> ${p} 4405`),r+=`${d.code} 4406 `,u===o&&t!=="compute"){if(r+=`// result 4407 4408 `,t==="vertex")r+=`varyings.builtinClipSpace = ${d.result};`;else if(t==="fragment")if(l)n.returnType=a.getNodeType(this),n.structs+="var<private> output : "+n.returnType+";",r+=`return ${d.result};`;else{let g=" @location(0) color: vec4<f32>";const x=this.getBuiltins("output");x&&(g+=`, 4409 `+x),n.returnType="OutputStruct",n.structs+=this._getWGSLStruct("OutputStruct",g),n.structs+=` 4410var<private> output : OutputStruct;`,r+=`output.color = ${d.result}; 4411 4412 return output;`}}}n.flow=r}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{const t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}
4412getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return dte[e]||e}isAvailable(e){let t=yw[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),yw[e]=t),t}getUniformBufferLimit(){return this.renderer.backend.device.limits.maxUniformBufferBindingSize}_getWGSLMethod(e){return Tf[e]!==void 0&&this._include(e),pte[e]}_include(e){const t=Tf[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()} 4413// directives 4414${e.directives} 4415 4416// structs 4417${e.structs} 4418 4419// uniforms 4420${e.uniforms} 4421 4422// varyings 4423${e.varyings} 4424var<private> varyings : VaryingsStruct; 4425 4426// codes 4427${e.codes} 4428 4429@vertex 4430fn main( ${e.attributes} ) -> VaryingsStruct { 4431 4432 // vars 4433 ${e.vars} 4434 4435 // flow 4436 ${e.flow} 4437 4438 return varyings; 4439 4440} 4441`}_getWGSLFragmentCode(e){return`${this.getSignature()} 4442// global 4443${T6} 4444 4445// structs 4446${e.structs} 4447 4448// uniforms 4449${e.uniforms} 4450 4451// codes 4452${e.codes} 4453 4454@fragment 4455fn main( ${e.varyings} ) -> ${e.returnType} { 4456 4457 // vars 4458 ${e.vars} 4459 4460 // flow 4461 ${e.flow} 4462 4463} 4464`}_getWGSLComputeCode(e,t){const[n,r,s]=t;
4464return`${this.getSignature()} 4465// directives 4466${e.directives} 4467 4468// system 4469var<private> instanceIndex : u32; 4470 4471// locals 4472${e.scopedArrays} 4473 4474// structs 4475${e.structs} 4476 4477// uniforms 4478${e.uniforms} 4479 4480// codes 4481${e.codes} 4482 4483@compute @workgroup_size( ${n}, ${r}, ${s} ) 4484fn main( ${e.attributes} ) { 4485 4486 // system 4487 instanceIndex = globalId.x 4488 + globalId.y * ( ${n} * numWorkgroups.x ) 4489 + globalId.z * ( ${n} * numWorkgroups.x ) * ( ${r} * numWorkgroups.y ); 4490 4491 // vars 4492 ${e.vars} 4493 4494 // flow 4495 ${e.flow} 4496 4497} 4498`}_getWGSLStruct(e,t){return` 4499struct ${e} { 4500${t} 4501};`}_getWGSLStructBinding(e,t,n,r=0,s=0){const o=e+"Struct";return`${this._getWGSLStruct(o,t)} 4502@binding( ${r} ) @group( ${s} ) 4503var<${n}> ${e} : ${o};`}}class gte{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?t=ue.Depth24PlusStencil8:t=ue.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const s=this.backend.renderer,o=s.getRenderTarget();t=o?o.samples:s.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return Ep.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Ep.LineList;if(e.isLine)return Ep.LineStrip;if(e.isMesh)return Ep.TriangleList}getSampleCount(e){return e>=4?4:1}
4503getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){const t=this.backend.parameters.outputType;if(t===void 0)return navigator.gpu.getPreferredCanvasFormat();if(t===yi)return ue.BGRA8Unorm;if(t===Mi)return ue.RGBA16Float;throw new Error("Unsupported output buffer type.")}}const M6=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&M6.set(Float16Array,["float16"]);const _te=new Map([[sE,["float16"]]]),xte=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class vte{constructor(e){this.backend=e}createAttribute(e,t){const n=this._getBufferAttribute(e),r=this.backend,s=r.get(n);let o=s.buffer;if(o===void 0){const a=r.device;let l=n.array;if(e.normalized===!1){if(l.constructor===Int16Array||l.constructor===Int8Array)l=new Int32Array(l);else if((l.constructor===Uint16Array||l.constructor===Uint8Array)&&(l=new Uint32Array(l),t&GPUBufferUsage.INDEX))for(let p=0;p<l.length;p++)l[p]===65535&&(l[p]=4294967295)}if(n.array=l,(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3){l=new l.constructor(n.count*4);for(let p=0;p<n.count;p++)l.set(n.array.subarray(p*3,p*3+3),p*4);n.itemSize=4,n.array=l,s._force3to4BytesAlignment=!0}const u=l.byteLength,d=u+(4-u%4)%4;o=a.createBuffer({label:n.name,size:d,usage:t,mappedAtCreation:!0}),new l.constructor(o.getMappedRange()).set(l),o.unmap(),s.buffer=o}}updateAttribute(e){const t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t),o=n.get(t).buffer;let a=t.array;if(s._force3to4BytesAlignment===!0){a=new a.constructor(t.count*4);for(let u=0;u<t.count;u++)a.set(t.array.subarray(u*3,u*3+3),u*4);t.array=a}const l=t.updateRanges;if(l.length===0)r.queue.writeBuffer(o,0,a,0);else{const u=im(a),d=u?1:a.BYTES_PER_ELEMENT;for(let p=0,g=l.length;p<g;p++){const x=l[p];let y,T;if(s._force3to4BytesAlignment===!0){const M=Math.floor(x.start/3),R=Math.ceil(x.count/3);y=M*4*d,T=R*4*d}else y=x.start*d,T=x.count*d;const S=y*(u?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,S,a,y,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){const t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){const s=t[r],o=s.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(s);let l=n.get(a);if(l===void 0){let p,g;s.isInterleavedBufferAttribute===!0?(p=s.data.stride*o,g=s.data.isInstancedInterleavedBuffer?Rp.Instance:Rp.Vertex):(p=s.itemSize*o,g=s.isInstancedBufferAttribute?Rp.Instance:Rp.Vertex),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(p=4),l={arrayStride:p,attributes:[],stepMode:g},n.set(a,l)}const u=this._getVertexFormat(s),d=s.isInterleavedBufferAttribute===!0?s.offset*o:0;l.attributes.push({shaderLocation:r,offset:d,format:u})}return Array.from(n.values())}destroyAttribute(e){const t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e){const t=this.backend,n=t.device,s=t.get(this._getBufferAttribute(e)).buffer,o=s.size,a=n.createBuffer({label:`${e.name}_readback`,size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),l=n.createCommandEncoder({label:`readback_encoder_${e.name}`});l.copyBufferToBuffer(s,0,a,0,o);const u=l.finish();n.queue.submit([u]),await a.mapAsync(GPUMapMode.READ);const d=a.getMappedRange(),p=new e.array.constructor(d.slice(0));return a.unmap(),p.buffer}_getVertexFormat(e){const{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor;let o;if(t===1)o=xte.get(r);else{const l=(_te.get(s)||M6.get(r))[n?1:0];if(l){const u=r.BYTES_PER_ELEMENT*t,p=Math.floor((u+3)/4)*4/r.BYTES_PER_ELEMENT;if(p%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${l}x${p}`}}return o||ke("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}class yte{constructor(e){this.layoutGPU=e,this.usedTimes=0}}class bte{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){const t=this.backend,n=t.device,r=t.get(e);if(r.layout)return r.layout.layoutGPU;const s=this._createLayoutEntries(e),o=OA(JSON.stringify(s));let a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new yte(n.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(o,a)),a.usedTimes++,r.layout=a,r.layoutKey=o,a.layoutGPU}createBindings(e,t,n,r=0){const{backend:s}=this,o=s.get(e),a=this.createBindingsLayout(e);let l;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===r&&(l=o.groups[n])),l===void 0&&(l=this.createBindGroup(e,a),n>0&&(o.groups[n]=l,o.versions[n]=r)),o.group=l}updateBinding(e){const t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(s,0,r,0);else{const a=im(r),l=a?1:r.BYTES_PER_ELEMENT;for(let u=0,d=o.length;u<d;u++){const p=o[u],g=p.start*l,x=p.count*l,y=g*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,y,r,g,x)}}}createBindGroupIndex(e,t){const r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0],a=r.createBuffer({label:"bindingCameraIndex_"+o,size:16,usage:s});r.queue.writeBuffer(a,0,e,0);const l=[{binding:0,resource:{buffer:a}}];return r.createBindGroup({label:"bindGroupCameraIndex_"+o,layout:t,entries:l})}createBindGroup(e,t){const n=this.backend,r=n.device;let s=0;const o=[];for(const a of e.bindings){if(a.isUniformBuffer){const l=n.get(a);if(l.buffer===void 0){const u=a.byteLength,d=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,p=[];a.visibility&pa.VERTEX&&p.push("vertex"),a.visibility&pa.FRAGMENT&&p.push("fragment"),a.visibility&pa.COMPUTE&&p.push("compute");const g=`(${p.join(",")})`,x=r.createBuffer({label:`bindingBuffer${a.id}_${a.name}_${g}`,size:u,usage:d});l.buffer=x}o.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){const l=n.get(a.attribute).buffer;o.push({binding:s,resource:{buffer:l}})}else if(a.isSampledTexture){const l=n.get(a.texture);let u;if(l.externalTexture!==void 0)u=r.importExternalTexture({source:l.externalTexture});else{const d=a.store?1:l.texture.mipLevelCount,p=a.store?a.mipLevel:0;let g=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(g+=`-${l.texture.depthOrArrayLayers}`),g+=`-${d}-${p}`,u=l[g],u===void 0){const x=Zee.All;let y;a.isSampledCubeTexture?y=kr.Cube:a.isSampledTexture3D?y=kr.ThreeD:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?y=kr.TwoDArray:y=kr.TwoD,u=l[g]=l.texture.createView({aspect:x,dimension:y,mipLevelCount:d,baseMipLevel:p})}}o.push({binding:s,resource:u})}else if(a.isSampler){const l=n.get(a.texture);o.push({binding:s,resource:l.sampler})}s++}return r.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:o})}_createLayoutEntries(e){const t=[];let n=0;for(const r of e.bindings){const s=this.backend,o={binding:n,visibility:r.visibility};if(r.isUniformBuffer||r.isStorageBuffer){const a={};r.isStorageBuffer&&(r.visibility&pa.COMPUTE&&(r.access===Er.READ_WRITE||r.access===Er.WRITE_ONLY)?a.type=J2.Storage:a.type=J2.ReadOnlyStorage),o.buffer=a}else if(r.isSampledTexture&&r.store){const a={};a.format=this.backend.get(r.texture).texture.format;const l=r.access;l===Er.READ_WRITE?a.access=e_.ReadWrite:l===Er.WRITE_ONLY?a.access=e_.WriteOnly:a.access=e_.ReadOnly,r.texture.isArrayTexture?a.viewDimension=kr.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=kr.ThreeD),o.storageTexture=a}else if(r.isSampledTexture){const a={},{primarySamples:l}=s.utils.getTextureSampleData(r.texture);if(l>1&&(a.multisampled=!0,r.texture.isDepthTexture||(a.sampleType=ku.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=ku.UnfilterableFloat:a.sampleType=ku.Depth;else if(r.texture.isDataTexture||r.texture.isDataArrayTexture||r.texture.isData3DTexture){const u=r.texture.type;u===dr?a.sampleType=ku.SInt:u===ii?a.sampleType=ku.UInt:u===zi&&(this.backend.hasFeature("float32-filterable")?a.sampleType=ku.Float:a.sampleType=ku.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=kr.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=kr.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=kr.ThreeD),o.texture=a}else if(r.isSampler){const a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&s.hasCompatibility(tl.TEXTURE_COMPARE)?a.type=mw.Comparison:a.type=mw.NonFiltering),o.sampler=a}else ke(`WebGPUBindingUtils: Unsupported binding "${r}".`);t.push(o),n++}return t}deleteBindGroupData(e){const{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}}class Ste{constructor(e){this.backend=e,this._activePipelines=new WeakMap}setPipeline(e,t){this._activePipelines.get(e)!==t&&(e.setPipeline(t),this._activePipelines.set(e,t))}
4503_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:n,material:r,geometry:s,pipeline:o}=e,{vertexProgram:a,fragmentProgram:l}=o,u=this.backend,d=u.device,p=u.utils,g=u.get(o),x=[];for(const j of e.getBindings()){const Y=u.get(j),{layoutGPU:z}=Y.layout;x.push(z)}const y=u.attributeUtils.createShaderVertexBuffers(e);let T;r.blending!==gr&&(r.blending!==mr||r.transparent!==!1)&&(T=this._getBlending(r));let S={};r.stencilWrite===!0&&(S={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});const M=this._getColorWriteMask(r),R=[];if(e.context.textures!==null){const j=e.context.textures,Y=e.context.mrt;for(let z=0;z<j.length;z++){const Q=j[z],ee=p.getTextureFormatGPU(Q);let fe;if(Y!==null)if(this.backend.compatibilityMode!==!0){const le=Y.getBlendMode(Q.name);le.blending===zx?fe=T:le.blending!==gr&&(fe=this._getBlending(le))}else zn("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),fe=T;else fe=T;R.push({format:ee,blend:fe,writeMask:M})}}else{const j=p.getCurrentColorFormat(e.context);R.push({format:j,blend:T,writeMask:M})}const E=u.get(a).module,N=u.get(l).module,U=this._getPrimitiveState(n,s,r),L=this._getDepthCompare(r),F=p.getCurrentDepthStencilFormat(e.context),P=this._getSampleCount(e.context),I={label:`renderPipeline_${r.name||r.type}_${r.id}`,vertex:Object.assign({},E,{buffers:y}),fragment:Object.assign({},N,{targets:R}),primitive:U,multisample:{count:P,alphaToCoverageEnabled:r.alphaToCoverage&&P>1},layout:d.createPipelineLayout({bindGroupLayouts:x})},$={},k=e.context.depth,W=e.context.stencil;if((k===!0||W===!0)&&(k===!0&&($.format=F,$.depthWriteEnabled=r.depthWrite,$.depthCompare=L),W===!0&&($.stencilFront=S,$.stencilBack=S,$.stencilReadMask=r.stencilFuncMask,$.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&($.depthBias=r.polygonOffsetUnits,$.depthBiasSlopeScale=r.polygonOffsetFactor,$.depthBiasClamp=0),I.depthStencil=$),d.pushErrorScope("validation"),t===null)g.pipeline=d.createRenderPipeline(I),d.popErrorScope().then(j=>{j!==null&&(g.error=!0,ke(j.message))});else{const j=new Promise(async Y=>{try{g.pipeline=await d.createRenderPipelineAsync(I)}catch{}const z=await d.popErrorScope();z!==null&&(g.error=!0,ke(z.message)),Y()});t.push(j)}}createBundleEncoder(e,t="renderBundleEncoder"){const n=this.backend,{utils:r,device:s}=n,o=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),l=this._getSampleCount(e),u={label:t,colorFormats:a,depthStencilFormat:o,sampleCount:l};return s.createRenderBundleEncoder(u)}createComputePipeline(e,t){const n=this.backend,r=n.device,s=n.get(e.computeProgram).module,o=n.get(e),a=[];for(const l of t){const u=n.get(l),{layoutGPU:d}=u.layout;a.push(d)}o.pipeline=r.createComputePipeline({compute:s,layout:r.createPipelineLayout({bindGroupLayouts:a})})}_getBlending(e){let t,n;const r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===Ju){const l=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,u=e.blendDstAlpha!==null?e.blendDstAlpha:o,d=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(l),dstFactor:this._getBlendFactor(u),operation:this._getBlendOperation(d)}}else{const l=e.premultipliedAlpha,u=(d,p,g,x)=>{t={srcFactor:d,dstFactor:p,operation:Ou.Add},n={srcFactor:g,dstFactor:x,operation:Ou.Add}};if(l)switch(r){case mr:u(Nn.One,Nn.OneMinusSrcAlpha,Nn.One,Nn.OneMinusSrcAlpha);break;case Aa:u(Nn.One,Nn.One,Nn.One,Nn.One);break;case $l:u(Nn.Zero,Nn.OneMinusSrc,Nn.Zero,Nn.One);break;case jl:u(Nn.Dst,Nn.OneMinusSrcAlpha,Nn.Zero,Nn.One);break}else switch(r){case mr:u(Nn.SrcAlpha,Nn.OneMinusSrcAlpha,Nn.One,Nn.OneMinusSrcAlpha);break;case Aa:u(Nn.SrcAlpha,Nn.One,Nn.One,Nn.One);break;case $l:ke(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case jl:ke(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};ke("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case Xa:t=Nn.Zero;break;case $x:t=Nn.One;break;case jx:t=Nn.Src;break;case Xx:t=Nn.OneMinusSrc;break;case Gh:t=Nn.SrcAlpha;break;case Vh:t=Nn.OneMinusSrcAlpha;break;case Kx:t=Nn.Dst;break;case Zx:t=Nn.OneMinusDst;break;case Qx:t=Nn.DstAlpha;break;case Yx:t=Nn.OneMinusDstAlpha;break;case Jx:t=Nn.SrcAlphaSaturated;break;case bX:t=Nn.Constant;break;case SX:t=Nn.OneMinusConstant;break;default:ke("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const n=e.stencilFunc;switch(n){case t7:t=vr.Never;break;case f_:t=vr.Always;break;case n7:t=vr.Less;break;case r7:t=vr.LessEqual;break;case i7:t=vr.Equal;break;case a7:t=vr.GreaterEqual;break;case s7:t=vr.Greater;break;case o7:t=vr.NotEqual;break;default:ke("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case Vu:t=Bl.Keep;break;case XP:t=Bl.Zero;break;case QP:t=Bl.Replace;break;case e7:t=Bl.Invert;break;case YP:t=Bl.IncrementClamp;break;case KP:t=Bl.DecrementClamp;break;case ZP:t=Bl.IncrementWrap;break;case JP:t=Bl.DecrementWrap;break;default:ke("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case Mr:t=Ou.Add;break;case Hx:t=Ou.Subtract;break;case Wx:t=Ou.ReverseSubtract;break;case Qw:t=Ou.Min;break;case Yw:t=Ou.Max;break;default:ke("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){const r={},s=this.backend.utils;
4503r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?eg.Uint16:eg.Uint32);let o=n.side===Xn;return e.isMesh&&e.matrixWorld.determinant()<0&&(o=!o),r.frontFace=o===!0?fw.CW:fw.CCW,r.cullMode=n.side===Ui?dw.None:dw.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?pw.All:pw.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=vr.Always;else{const n=this.backend.parameters.reversedDepthBuffer?fv[e.depthFunc]:e.depthFunc;switch(n){case Yf:t=vr.Never;break;case Kf:t=vr.Always;break;case Zf:t=vr.Less;break;case ou:t=vr.LessEqual;break;case Jf:t=vr.Equal;break;case ed:t=vr.GreaterEqual;break;case td:t=vr.Greater;break;case nd:t=vr.NotEqual;break;default:ke("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}}class Tte extends S6{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxQueries,label:`queryset_global_timestamp_${t}`});const r=this.maxQueries*8;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:r,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:r,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return zn(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();const r=this.device.createCommandEncoder();r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);const s=r.finish();if(this.device.queue.submit([s]),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;const o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},l=[];for(const[d,p]of e){const g=d.match(/^(.*):f(\d+)$/),x=parseInt(g[2]);l.includes(x)===!1&&l.push(x),a[x]===void 0&&(a[x]=0);const y=o[p],T=o[p+1],S=Number(T-y)/1e6;this.timestamps.set(d,S),a[x]+=S}const u=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=u,this.frames=l,u}catch(e){return ke("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){ke("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){ke("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}}class Mte extends b6{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new gte(this),this.attributeUtils=new vte(this),this.bindingUtils=new bte(this),this.pipelineUtils=new Ste(this),this.textureUtils=new ote(this),this.occludedResolveCache=new Map;const t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[tl.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);const t=this.parameters;let n;if(t.device===void 0){const r={powerPreference:t.powerPreference,featureLevel:"compatibility"},s=typeof navigator<"u"?await navigator.gpu.requestAdapter(r):null;if(s===null)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const o=Object.values(Fx),a=[];for(const u of o)s.features.has(u)&&a.push(u);const l={requiredFeatures:a,requiredLimits:t.requiredLimits};n=await s.requestDevice(l)}else n=t.device;this.compatibilityMode=!n.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),n.lost.then(r=>{if(r.reason==="destroyed")return;const s={api:"WebGPU",message:r.message||"Unknown reason",reason:r.reason||null,originalEvent:r};e.onDeviceLost(s)}),this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(Fx.TimestampQuery),this.updateSize()}get context(){const e=this.renderer.getCanvasTarget(),t=this.get(e);let n=t.context;if(n===void 0){const r=this.parameters;e.isDefaultCanvasTarget===!0&&r.context!==void 0?n=r.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${NA} webgpu`);const s=r.alpha?"premultiplied":"opaque",o=r.outputType===Mi?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasF
4503ormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return co}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){const e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples;let s=n.descriptor;if(s===void 0||n.samples!==r){s={colorAttachments:[{view:null}]},(e.depth===!0||e.stencil===!0)&&(s.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView()});const a=s.colorAttachments[0];r>0?a.view=this.textureUtils.getColorBuffer().createView():a.resolveTarget=void 0,n.descriptor=s,n.samples=r}const o=s.colorAttachments[0];return r>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){const n=e.renderTarget,r=this.get(n);let s=r.descriptors;(s===void 0||r.width!==n.width||r.height!==n.height||r.samples!==n.samples)&&(s={},r.descriptors=s);const o=e.getCacheKey();let a=s[o];if(a===void 0){const u=e.textures,d=[];let p;const g=this._isRenderCameraDepthArray(e);for(let x=0;x<u.length;x++){const y=this.get(u[x]),T={label:`colorAttachment_${x}`,baseMipLevel:e.activeMipmapLevel,mipLevelCount:1,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1,dimension:kr.TwoD};if(n.isRenderTarget3D)p=e.activeCubeFace,T.baseArrayLayer=0,T.dimension=kr.ThreeD,T.depthOrArrayLayers=u[x].image.depth;else if(n.isRenderTarget&&u[x].image.depth>1)if(g===!0){const S=e.camera.cameras;for(let M=0;M<S.length;M++){const R={...T,baseArrayLayer:M,arrayLayerCount:1,dimension:kr.TwoD},E=y.texture.createView(R);d.push({view:E,resolveTarget:void 0,depthSlice:void 0})}}else T.dimension=kr.TwoDArray,T.depthOrArrayLayers=u[x].image.depth;if(g!==!0){const S=y.texture.createView(T);let M,R;y.msaaTexture!==void 0?(M=y.msaaTexture.createView(),R=S):(M=S,R=void 0),d.push({view:M,resolveTarget:R,depthSlice:p})}}if(a={textureViews:d},e.depth){const x=this.get(e.depthTexture),y={};(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(y.dimension=kr.TwoD,y.arrayLayerCount=1,y.baseArrayLayer=e.activeCubeFace),a.depthStencilView=x.texture.createView(y)}s[o]=a,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace}const l={colorAttachments:[]};for(let u=0;u<a.textureViews.length;u++){const d=a.textureViews[u];let p={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(p=t.clearValue),l.colorAttachments.push({view:d.view,depthSlice:d.depthSlice,resolveTarget:d.resolveTarget,loadOp:t.loadOp||Yn.Load,storeOp:t.storeOp||Jr.Store,clearValue:p})}return a.depthStencilView&&(l.depthStencilAttachment={view:a.depthStencilView}),l}beginRender(e){const t=this.get(e),n=this.device,r=e.occlusionQueryCount;let s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,s=n.createQuerySet({type:"occlusion",count:r,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Yn.Load}),this.initTimestampQuery(fa.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=s;const a=o.depthStencilAttachment;if(e.textures!==null){const u=o.colorAttachments;for(let d=0;d<u.length;d++){const p=u[d];e.clearColor?(p.clearValue=d===0?e.clearColorValue:{r:0,g:0,b:0,a:1},p.loadOp=Yn.Clear):p.loadOp=Yn.Load,p.storeOp=Jr.Store}}else{const u=o.colorAttachments[0];e.clearColor?(u.clearValue=e.clearColorValue,u.loadOp=Yn.Clear):u.loadOp=Yn.Load,u.storeOp=Jr.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Yn.Clear):a.depthLoadOp=Yn.Load,a.depthStoreOp=Jr.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Yn.Clear):a.stencilLoadOp=Yn.Load,a.stencilStoreOp=Jr.Store);const l=n.createCommandEncoder({label:"renderContext_"+e.id});if(this._isRenderCameraDepthArray(e)===!0){const u=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==u.length?this._createDepthLayerDescriptors(e,t,o,u):this._updateDepthLayerDescriptors(e,t,u),t.bundleEncoders=[],t.bundleSets=[];for(let d=0;d<u.length;d++){const p=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+d),g={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(p),t.bundleSets.push(g)}t.currentPass=null}else{const u=l.beginRenderPass(o);t.currentPass=u,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}
4503t.descriptor=o,t.encoder=l,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createDepthLayerDescriptors(e,t,n,r){const s=n.depthStencilAttachment;t.layerDescriptors=[];const o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let a=0;a<r.length;a++){const l={...n,colorAttachments:[{...n.colorAttachments[0],view:n.colorAttachments[a].view}]};if(n.depthStencilAttachment){const u=a;o.viewCache[u]||(o.viewCache[u]=o.texture.createView({dimension:kr.TwoD,baseArrayLayer:a,arrayLayerCount:1})),l.depthStencilAttachment={view:o.viewCache[u],depthLoadOp:s.depthLoadOp||Yn.Clear,depthStoreOp:s.depthStoreOp||Jr.Store,depthClearValue:s.depthClearValue||1},e.stencil&&(l.depthStencilAttachment.stencilLoadOp=s.stencilLoadOp,l.depthStencilAttachment.stencilStoreOp=s.stencilStoreOp,l.depthStencilAttachment.stencilClearValue=s.stencilClearValue)}else l.depthStencilAttachment={...s};t.layerDescriptors.push(l)}}_updateDepthLayerDescriptors(e,t,n){for(let r=0;r<n.length;r++){const s=t.layerDescriptors[r];if(s.depthStencilAttachment){const o=s.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Yn.Clear):o.depthLoadOp=Yn.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Yn.Clear):o.stencilLoadOp=Yn.Load)}}}finishRender(e){const t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();const r=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){const s=[];for(let o=0;o<t.bundleEncoders.length;o++){const a=t.bundleEncoders[o];s.push(a.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<s.length){const a=t.layerDescriptors[o],l=r.beginRenderPass(a);if(e.viewport){const{x:u,y:d,width:p,height:g,minDepth:x,maxDepth:y}=e.viewportValue;l.setViewport(u,d,p,g,x,y)}if(e.scissor){const{x:u,y:d,width:p,height:g}=e.scissorValue;l.setScissorRect(u,d,p,g)}l.executeBundles([s[o]]),l.end()}}else t.currentPass&&t.currentPass.end();if(n>0){const s=n*8;let o=this.occludedResolveCache.get(s);o===void 0&&(o=this.device.createBuffer({size:s,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(s,o));const a=this.device.createBuffer({size:s,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,a,0,s),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),e.textures!==null){const s=e.textures;for(let o=0;o<s.length;o++){const a=s[o];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}isOccluded(e,t){const n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){const t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:r}=t;if(n&&r){const s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);const o=n.getMappedRange(),a=new BigUint64Array(o);for(let l=0;l<r.length;l++)a[l]===BigInt(0)&&s.add(r[l]);n.destroy(),t.occluded=s}}updateViewport(e){const{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o,minDepth:a,maxDepth:l}=e.viewportValue;t.setViewport(n,r,s,o,a,l)}updateScissor(e){const{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o}=e.scissorValue;t.setScissorRect(n,r,s,o)}getClearColor(){const e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,r=null){const s=this.device,o=this.renderer;let a=[],l,u,d,p;if(e){const y=this.getClearColor();u={r:y.r,g:y.g,b:y.b,a:y.a}}if(r===null){d=o.depth,p=o.stencil;const y=this._getDefaultRenderPassDescriptor();if(e){a=y.colorAttachments;const T=a[0];T.clearValue=u,T.loadOp=Yn.Clear,T.storeOp=Jr.Store}(d||p)&&(l=y.depthStencilAttachment)}else{d=r.depth,p=r.stencil;const y={loadOp:e?Yn.Clear:Yn.Load,clearValue:e?u:void 0};d&&(y.depthLoadOp=t?Yn.Clear:Yn.Load,y.depthClearValue=t?o.getClearDepth():void 0,y.depthStoreOp=Jr.Store),p&&(y.stencilLoadOp=n?Yn.Clear:Yn.Load,y.stencilClearValue=n?o.getClearStencil():void 0,y.stencilStoreOp=Jr.Store);const T=this._getRenderPassDescriptor(r,y);a=T.colorAttachments,l=T.depthStencilAttachment}d&&l&&(t?(l.depthLoadOp=Yn.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Jr.Store):(l.depthLoadOp=Yn.Load,l.depthStoreOp=Jr.Store)),p&&l&&(n?(l.stencilLoadOp=Yn.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Jr.Store):(l.stencilLoadOp=Yn.Load,l.stencilStoreOp=Jr.Store));const g=s.createCommandEncoder({label:"clear"});g.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),s.queue.submit([g.finish()])}beginCompute(e){const t=this.get(e),n={label:"computeGroup_"+e.id};this.initTimestampQuery(fa.COMPUTE,this.getTimestampUID(e),n),t.cmdEncoderGPU=this.device.createCommandEncoder({label:"computeGroup_"+e.id}),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(n)}compute(e,t,n,r,s=null){const o=this.get(t),{passEncoderGPU:a}=this.get(e),l=this.get(r).pipeline;this.pipelineUtils.setPipeline(a,l);for(let u=0,d=n.length;u<d;u++){const p=n[u],g=this.get(p);a.setBindGroup(u,g.group)}if(s===null&&(s=t.count),s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute){const u=this.get(s).buffer;a.dispatchWorkgroupsIndirect(u,0);return}if(typeof s=="number"){const u=s;if(o.dispatchSize===void 0||o.count!==u){o.dispatchSize=[0,1,1],o.count=u;const d=t.workgroupSize;let p=d[0];for(let y=1;y<d.length;y++)p*=d[y];const g=Math.ceil(u/p),x=this.device.limits.maxComputeWorkgroupsPerDimension;s=[g,1,1],g>x&&(s[0]=Math.min(g,x),s[1]=Math.ceil(g/x)),o.dispatchSize=s}s=o.dispatchSize}a.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}draw(e,t){const{object:n,material:r,context:s,pipeline:o}=e,a=e.getBindings(),l=this.get(s),u=this.get(o),d=u.pipeline;if(u.error===!0)return;const p=e.getIndex(),g=p!==null,x=e.getDrawParameters();if(x===null)return;const y=(S,M)=>{this.pipelineUtils.setPipeline(S,d),M.pipeline=d;const R=M.bindingGroups;for(let N=0,U=a.length;N<U;N++){const L=a[N],F=this.get(L);R[L.index]!==L.id&&(S.setBindGroup(L.index,F.group),R[L.index]=L.id)}if(g===!0&&M.index!==p){const N=this.get(p).buffer,U=p.array instanceof Uint16Array?eg.Uint16:eg.Uint32;S.setIndexBuffer(N,U),M.index=p}const E=e.getVertexBuffers();for(let N=0,U=E.length;N<U;N++){const L=E[N];if(M.attributes[N]!==L){const F=this.get(L).buffer;S.setVertexBuffer(N,F),M.attributes[N]=L}}s.stencil===!0&&r.stencilWrite===!0&&l.currentStencilRef!==r.stencilRef&&(S.setStencilReference(r.stencilRef),l.currentStencilRef=r.stencilRef)},T=(S,M)=>
4503{if(y(S,M),n.isBatchedMesh===!0){const R=n._multiDrawStarts,E=n._multiDrawCounts,N=n._multiDrawCount,U=n._multiDrawInstances;U!==null&&zn("WebGPUBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.");let L=g===!0?p.array.BYTES_PER_ELEMENT:1;r.wireframe&&(L=n.geometry.attributes.position.count>65535?4:2);for(let F=0;F<N;F++){const P=U?U[F]:1,I=P>1?0:F;g===!0?S.drawIndexed(E[F],P,R[F]/L,0,I):S.draw(E[F],P,R[F],I),t.update(n,E[F],P)}}else if(g===!0){const{vertexCount:R,instanceCount:E,firstVertex:N}=x,U=e.getIndirect();if(U!==null){const L=this.get(U).buffer,F=e.getIndirectOffset(),P=Array.isArray(F)?F:[F];for(let I=0;I<P.length;I++)S.drawIndexedIndirect(L,P[I])}else S.drawIndexed(R,E,N,0,0);t.update(n,R,E)}else{const{vertexCount:R,instanceCount:E,firstVertex:N}=x,U=e.getIndirect();if(U!==null){const L=this.get(U).buffer,F=e.getIndirectOffset(),P=Array.isArray(F)?F:[F];for(let I=0;I<P.length;I++)S.drawIndirect(L,P[I])}else S.draw(R,E,N,0);t.update(n,R,E)}};if(e.camera.isArrayCamera&&e.camera.cameras.length>0){const S=this.get(e.camera),M=e.camera.cameras,R=e.getBindingGroup("cameraIndex");if(S.indexesGPU===void 0||S.indexesGPU.length!==M.length){const N=this.get(R),U=[],L=new Uint32Array([0,0,0,0]);for(let F=0,P=M.length;F<P;F++){L[0]=F;const{layoutGPU:I}=N.layout,$=this.bindingUtils.createBindGroupIndex(L,I);U.push($)}S.indexesGPU=U}const E=this.renderer.getPixelRatio();for(let N=0,U=M.length;N<U;N++){const L=M[N];if(n.layers.test(L.layers)){const F=L.viewport;let P=l.currentPass,I=l.currentSets;if(l.bundleEncoders){const $=l.bundleEncoders[N],k=l.bundleSets[N];P=$,I=k}F&&P.setViewport(Math.floor(F.x*E),Math.floor(F.y*E),Math.floor(F.width*E),Math.floor(F.height*E),s.viewportValue.minDepth,s.viewportValue.maxDepth),R&&S.indexesGPU&&(P.setBindGroup(R.index,S.indexesGPU[N]),I.bindingGroups[R.index]=R.id),T(P,I)}}}else if(l.currentPass){if(l.occlusionQuerySet!==void 0){const S=l.lastOcclusionObject;S!==n&&(S!==null&&S.occlusionTest===!0&&(l.currentPass.endOcclusionQuery(),l.occlusionQueryIndex++),n.occlusionTest===!0&&(l.currentPass.beginOcclusionQuery(l.occlusionQueryIndex),l.occlusionQueryObjects[l.occlusionQueryIndex]=n),l.lastOcclusionObject=n)}T(l.currentPass,l.currentSets)}}needsRenderUpdate(e){const t=this.get(e),{object:n,material:r}=e,s=this.utils,o=s.getSampleCountRenderContext(e.context),a=s.getCurrentColorSpace(e.context),l=s.getCurrentColorFormat(e.context),u=s.getCurrentDepthStencilFormat(e.context),d=s.getPrimitiveTopology(n,r);let p=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==a||t.colorFormat!==l||t.depthStencilFormat!==u||t.primitiveTopology!==d||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleC
4503ount=o,t.colorSpace=a,t.colorFormat=l,t.depthStencilFormat=u,t.primitiveTopology=d,t.clippingContextCacheKey=e.clippingContextCacheKey,p=!0),p}getRenderCacheKey(e){const{object:t,material:n}=e,r=this.utils,s=e.context,o=t.isMesh&&t.matrixWorld.determinant()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new Tte(this.device,e,2048));const r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);n.timestampWrites={querySet:r.querySet,beginningOfPassWriteIndex:s,endOfPassWriteIndex:s+1}}createNodeBuilder(e,t){return new mte(e,t)}createProgram(e){const t=this.get(e);t.module={module:this.device.createShaderModule({code:e.code,label:e.stage+(e.name!==""?`_${e.name}`:"")}),entryPoint:"main"}}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){const t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){const n=this.get(e),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}getMaxAnisotropy(){return 16}hasFeature(e){return _w[e]!==void 0&&(e=_w[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let a=0,l=0,u=0,d=0,p=0,g=0,x=e.image.width,y=e.image.height,T=1;n!==null&&(n.isBox3===!0?(d=n.min.x,p=n.min.y,g=n.min.z,x=n.max.x-n.min.x,y=n.max.y-n.min.y,T=n.max.z-n.min.z):(d=n.min.x,p=n.min.y,x=n.max.x-n.min.x,y=n.max.y-n.min.y,T=1)),r!==null&&(a=r.x,l=r.y,u=r.z||0);const S=this.device.createCommandEncoder({label:"copyTextureToTexture_"+e.id+"_"+t.id}),M=this.get(e).texture,R=this.get(t).texture;S.copyTextureToTexture({texture:M,mipLevel:s,origin:{x:d,y:p,z:g}},{texture:R,mipLevel:o,origin:{x:a,y:l,z:u}},[x,y,T]),this.device.queue.submit([S.finish()]),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){const r=this.get(t);let s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();const o=this.get(e).texture;if(s.format!==o.format){ke("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,o.format);return}let a;if(r.currentPass?(r.currentPass.end(),a=r.encoder):a=this.device.createCommandEncoder({label:"copyFramebufferToTexture_"+e.id}),a.copyTextureToTexture({texture:s,origin:[n.x,n.y,0]},{texture:o},[n.z,n.w]),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,a),r.currentPass){const{descriptor:l}=r;for(let u=0;u<l.colorAttachments.length;u++)l.colorAttachments[u].loadOp=Yn.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Yn.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Yn.Load),r.currentPass=a.beginRenderPass(l),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}
4503else this.device.queue.submit([a.finish()])}hasCompatibility(e){return this._compatibility[tl.TEXTURE_COMPARE]!==void 0?this._compatibility[tl.TEXTURE_COMPARE]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(const e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(const e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}}class wte extends Lv{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class Ete extends Lv{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}}class Rte extends d6{constructor(){super(),this.addMaterial(hj,"MeshPhongMaterial"),this.addMaterial(u5,"MeshStandardMaterial"),this.addMaterial(tX,"MeshPhysicalMaterial"),this.addMaterial(sX,"MeshToonMaterial"),this.addMaterial(rj,"MeshBasicMaterial"),this.addMaterial(uj,"MeshLambertMaterial"),this.addMaterial(J$,"MeshNormalMaterial"),this.addMaterial(aX,"MeshMatcapMaterial"),this.addMaterial(Q$,"LineBasicMaterial"),this.addMaterial(K$,"LineDashedMaterial"),this.addMaterial(AX,"PointsMaterial"),this.addMaterial(h5,"SpriteMaterial"),this.addMaterial(mX,"ShadowMaterial"),this.addLight($K,HD),this.addLight(ree,$D),this.addLight(cee,XD),this.addLight(w3,Lv),this.addLight(iee,jD),this.addLight(see,VD),this.addLight(aee,YD),this.addLight(oee,wte),this.addLight(uee,Ete),this.addToneMapping(P5,ev),this.addToneMapping(D5,tv),this.addToneMapping(L5,nv),this.addToneMapping(I5,iv),this.addToneMapping(B5,rv),this.addToneMapping(F5,sv)}}class Cte extends Pee{constructor(e={}){let t;e.forceWebGL?t=Aw:(t=Mte,e.getFallback=()=>(Oe("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new Aw(e)));const n=new t(e);super(n,e),this.library=new Rte,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}/** 4504 * @license 4505 * Copyright 2010-2026 Three.js Authors 4506 * SPDX-License-Identifier: MIT 4507 */B.BRDF_GGX;B.BRDF_Lambert;B.BasicPointShadowFilter;B.BasicShadowFilter;B.Break;B.Const;B.Continue;B.DFGLUT;B.D_GGX;B.Discard;B.EPSILON;B.F_Schlick;const Nte=B.Fn;B.INFINITY;const Pte=B.If,Dte=B.Loop;B.NodeAccess;B.NodeShaderStage;B.NodeType;B.NodeUpdateType;B.PCFShadowFilter;B.PCFSoftShadowFilter;B.PI;B.PI2;B.TWO_PI;B.HALF_PI;B.PointShadowFilter;B.Return;B.Schlick_to_F0;B.ShaderNode;B.Stack;B.Switch;B.TBNViewMatrix;B.VSMShadowFilter;B.V_GGX_SmithCorrelated;B.Var;B.VarIntent;B.abs;B.acesFilmicToneMapping;B.acos;B.add;B.addMethodChaining;B.addNodeElement;B.agxToneMapping;B.all;B.alphaT;B.and;B.anisotropy;B.anisotropyB;B.anisotropyT;B.any;B.append;B.array;B.arrayBuffer;const Lte=B.asin;B.assign;B.atan;B.atomicAdd;B.atomicAnd;B.atomicFunc;B.atomicLoad;B.atomicMax;B.atomicMin;B.atomicOr;B.atomicStore;B.atomicSub;B.atomicXor;B.attenuationColor;B.attenuationDistance;B.attribute;B.attributeArray;B.backgroundBlurriness;B.backgroundIntensity;B.backgroundRotation;B.batch;B.bentNormalView;B.billboarding;B.bitAnd;B.bitNot;B.bitOr;B.bitXor;B.bitangentGeometry;B.bitangentLocal;B.bitangentView;B.bitangentWorld;B.bitcast;B.blendBurn;B.blendColor;B.blendDodge;B.blendOverlay;B.blendScreen;B.blur;B.bool;B.buffer;B.bufferAttribute;B.bumpMap;B.builtin;B.builtinAOContext;B.builtinShadowContext;B.bvec2;B.bvec3;B.bvec4;B.bypass;B.cache;B.call;B.cameraFar;B.cameraIndex;B.cameraNear;B.cameraNormalMatrix;B.cameraPosition;B.cameraProjectionMatrix;B.cameraProjectionMatrixInverse;B.cameraViewMatrix;B.cameraViewport;B.cameraWorldMatrix;B.cbrt;B.cdl;B.ceil;B.checker;B.cineonToneMapping;B.clamp;B.clearcoat;B.clearcoatNormalView;B.clearcoatRoughness;B.clipSpace;B.code;B.color;B.colorSpaceToWorking;B.colorToDirection;B.compute;B.computeKernel;B.computeSkinning;B.context;B.convert;B.convertColorSpace;B.convertToTexture;B.countLeadingZeros;B.countOneBits;B.countTrailingZeros;const Ite=B.cos;B.cross;B.cubeTexture;B.cubeTextureBase;B.dFdx;B.dFdy;B.dashSize;B.debug;B.decrement;B.decrementBefore;B.defaultBuildStages;B.defaultShaderStages;B.defined;B.degrees;B.deltaTime;B.densityFog;B.densityFogFactor;B.depth;B.depthPass;B.determinant;B.difference;B.diffuseColor;B.directPointLight;B.directionToColor;B.directionToFaceDirection;B.dispersion;B.distance;B.div;B.dot;B.drawIndex;B.dynamicBufferAttribute;B.element;B.emissive;B.equal;B.equirectUV;const Bte=B.exp;B.exp2;B.exponentialHeightFogFactor;B.expression;B.faceDirection;B.faceForward;B.faceforward;const Fte=B.float;B.floatBitsToInt;B.floatBitsToUint;B.floor;B.fog;B.fract;B.frameGroup;B.frameId;B.frontFacing;B.fwidth;B.gain;B.gapSize;B.getConstNodeType;B.getCurrentStack;B.getDirection;B.getDistanceAttenuation;B.getGeometryRoughness;B.getNormalFromDepth;B.interleavedGradientNoise;B.vogelDiskSample;B.getParallaxCorrectNormal;B.getRoughness;B.getScreenPosition;B.getShIrradianceAt;B.getShadowMaterial;B.getShadowRenderObjectFunction;B.getTextureIndex;B.getViewPosition;B.globalId;B.glsl;B.glslFn;B.grayscale;B.greaterThan;B.greaterThanEqual;B.hash;B.highpModelNormalViewMatrix;B.highpModelViewMatrix;B.hue;B.increment;B.incrementBefore;B.instance;const Ute=B.instanceIndex;B.instancedArray;B.instancedBufferAttribute;B.instancedDynamicBufferAttribute;B.instancedMesh;B.int;B.intBitsToFloat;B.inverse;B.inverseSqrt;B.inversesqrt;B.invocationLocalIndex;B.invocationSubgroupIndex;B.ior;B.iridescence;B.iridescenceIOR;B.iridescenceThickness;B.ivec2;B.ivec3;B.ivec4;B.js;B.label;B.length;B.lengthSq;B.lessThan;B.lessThanEqual;B.lightPosition;B.lightProjectionUV;B.lightShadowMatrix;B.lightTargetDirection;B.lightTargetPosition;B.lightViewPosition;B.lightingContext;B.lights;B.linearDepth;B.linearToneMapping;B.localId;B.log;B.log2;B.logarithmicDepthToViewZ;B.luminance;B.mat2;B.mat3;B.mat4;B.matcapUV;B.materialAO;B.materialAlphaTest;B.materialAnisotropy;B.materialAnisotropyVector;B.materialAttenuationColor;B.materialAttenuationDistance;B.materialClearcoat;B.materialClearcoatNormal;B.materialClearcoatRoughness;B.materialColor;B.materialDispersion;B.materialEmissive;B.materialEnvIntensity;B.materialEnvRotation;B.materialIOR;B.materialIridescence;B.materialIridescenceIOR;B.materialIridescenceThickness;B.materialLightMap;B.materialLineDashOffset;B.materialLineDashSize;B.materialLineGapSize;B.materialLineScale;B.materialLineWidth;B.materialMetalness;B.materialNormal;B.materialOpacity;B.materialPointSize;B.materialReference;B.materialReflectivity;B.materialRefractionRatio;B.materialRotation;B.materialRoughness;B.materialSheen;B.materialSheenRoughness;B.materialShininess;B.materialSpecular;B.materialSpecularColor;B.materialSpecularIntensity;B.materialSpecularStrength;B.materialThickness;B.materialTransmission;B.max;B.maxMipLevel;B.mediumpModelViewMatrix;B.metalness;B.min;B.mix;B.mixElement;B.mod;B.modInt;B.modelDirection;B.modelNormalMatrix;B.modelPosition;B.modelRadius;B.modelScale;B.modelViewMatrix;B.modelViewPosition;B.modelViewProjection;B.modelWorldMatrix;B.modelWorldMatrixInverse;B.morphReference;B.mrt;B.mul;B.mx_aastep;B.mx_add;B.mx_atan2;B.mx_cell_noise_float;B.mx_contrast;B.mx_divide;B.mx_fractal_noise_float;B.mx_fractal_noise_vec2;B.mx_fractal_noise_vec3;B.mx_fractal_noise_vec4;B.mx_frame;B.mx_heighttonormal;B.mx_hsvtorgb;B.mx_ifequal;B.mx_ifgreater;B.mx_ifgreatereq;B.mx_invert;B.mx_modulo;B.mx_multiply;B.mx_noise_float;B.mx_noise_vec3;B.mx_noise_vec4;B.mx_place2d;B.mx_power;B.mx_ramp4;B.mx_ramplr;B.mx_ramptb;B.mx_rgbtohsv;B.mx_rotate2d;B.mx_rotate3d;B.mx_safepower;B.mx_separate;B.mx_splitlr;B.mx_splittb;B.mx_srgb_texture_to_lin_rec709;B.mx_subtract;B.mx_timer;B.mx_transform_uv;B.mx_unifiednoise2d;B.mx_unifiednoise3d;B.mx_worley_noise_float;B.mx_worley_noise_vec2;B.mx_worley_noise_vec3;const Ote=B.negate;B.neutralToneMapping;B.nodeArray;B.nodeImmutable;B.nodeObject;B.nodeObjectIntent;B.nodeObjects;B.nodeProxy;B.nodeProxyIntent;B.normalFlat;B.normalGeometry;B.normalLocal;B.normalMap;B.normalView;B.normalViewGeometry;B.normalWorld;B.normalWorldGeometry;B.normalize;B.not;B.notEqual;B.numWorkgroups;B.objectDirection;B.objectGroup;B.objectPosition;B.objectRadius;B.objectScale;B.objectViewPosition;B.objectWorldMatrix;B.OnBeforeObjectUpdate;B.OnBeforeMaterialUpdate;B.OnObjectUpdate;B.OnMaterialUpdate;B.oneMinus;B.or;B.orthographicDepthToViewZ;B.oscSawtooth;B.oscSine;B.oscSquare;B.oscTriangle;B.output;B.outputStruct;B.overloadingFn;B.packHalf2x16;B.packSnorm2x16;B.packUnorm2x16;B.parabola;B.parallaxDirection;B.parallaxUV;B.parameter;B.pass;B.passTexture;B.pcurve;B.perspectiveDepthToViewZ;B.pmremTexture;B.pointShadow;B.pointUV;B.pointWidth;B.positionGeometry;B.positionLocal;B.positionPrevious;B.positionView;B.positionViewDirection;B.positionWorld;B.positionWorldDirection;B.posterize;B.pow;B.pow2;B.pow3;B.pow4;B.premultiplyAlpha;B.property;B.radians;B.rand;B.range;B.rangeFog;B.rangeFogFactor;B.reciprocal;B.reference;B.referenceBuffer;B.reflect;B.reflectVector;B.reflectView;B.reflector;B.refract;B.refractVector;B.refractView;B.reinhardToneMapping;B.remap;B.remapClamp;B.renderGroup;B.renderOutput;B.rendererReference;B.replaceDefaultUV;B.rotate;B.rotateUV;B.roughness;B.round;B.rtt;B.sRGBTransferEOTF;B.sRGBTransferOETF;B.sample;B.sampler;B.samplerComparison;B.saturate;B.saturation;B.screen;B.screenCoordinate;B.screenDPR;B.screenSize;B.screenUV;B.select;B.setCurrentStack;B.setName;B.shaderStages;B.shadow;B.shadowPositionWorld;B.shapeCircle;B.sharedUniformGroup;B.sheen;B.sheenRoughness;B.shiftLeft;B.shiftRight;B.shininess;B.sign;const kte=B.sin;B.sinc;B.skinning;B.smoothstep;B.smoothstepElement;B.specularColor;B.specularF90;B.spherizeUV;B.split;B.spritesheetUV;const Gte=B.sqrt;B.stack;B.step;B.stepElement;const Vte=B.storage;B.storageBarrier;B.storageTexture;B.string;B.struct;B.sub;B.subgroupAdd;B.subgroupAll;B.subgroupAnd;B.subgroupAny;B.subgroupBallot;B.subgroupBroadcast;B.subgroupBroadcastFirst;B.subBuild;B.subgroupElect;B.subgroupExclusiveAdd;B.subgroupExclusiveMul;B.subgroupInclusiveAdd;B.subgroupInclusiveMul;B.subgroupIndex;B.subgroupMax;B.subgroupMin;B.subgroupMul;B.subgroupOr;B.subgroupShuffle;B.subgroupShuffleDown;B.subgroupShuffleUp;B.subgroupShuffleXor;B.subgroupSize;B.subgroupXor;B.tan;B.tangentGeometry;B.tangentLocal;B.tangentView;B.tangentWorld;B.texture;B.texture3D;B.textureBarrier;B.textureBicubic;B.textureBicubicLevel;B.textureCubeUV;B.textureLoad;B.textureSize;B.textureLevel;B.textureStore;B.thickness;B.time;B.toneMapping;B.toneMappingExposure;B.toonOutlinePass;B.transformDirection;B.transformNormal;B.transformNormalToView;B.transformedClearcoatNormalView;B.transformedNormalView;B.transformedNormalWorld;B.transmission;B.transpose;B.triNoise3D;B.triplanarTexture;B.triplanarTextures;B.trunc;B.uint;B.uintBitsToFloat;const qte=B.uniform;B.uniformArray;B.uniformCubeTexture;B.uniformGroup;B.uniformFlow;B.uniformTexture;B.unpackHalf2x16;B.unpackSnorm2x16;B.unpackUnorm2x16;B.unpremultiplyAlpha;B.userData;B.uv;B.uvec2;B.uvec3;B.uvec4;B.varying;B.varyingProperty;B.vec2;B.vec3;B.vec4;B.vectorComponents;B.velocity;B.vertexColor;B.vertexIndex;B.vertexStage;B.vibrance;B.viewZToLogarithmicDepth;B.viewZToOrthographicDepth;B.viewZToPerspectiveDepth;B.viewZToReversedOrthographicDepth;B.viewZToReversedPerspectiveDepth;B.viewport;B.viewportCoordinate;B.viewportDepthTexture;B.viewportLinearDepth;B.viewportMipTexture;B.viewportOpaqueMipTexture;B.viewportResolution;B.viewportSafeUV;B.viewportSharedTexture;B.viewportSize;B.viewportTexture;B.viewportUV;B.wgsl;B.wgslFn;B.workgroupArray;B.workgroupBarrier;B.workgroupId;B.workingToColorSpace;B.xor;const Sw=new du,Cp=new J;class w6 extends KD{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new Fn(e,3)),this.setAttribute("uv",new Fn(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new am(t,6,1);return this.setAttribute("instanceStart",new da(n,3,0)),this.setAttribute("instanceEnd",new da(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new am(t,6,1);return this.setAttribute("instanceColorStart",new da(n,3,0)),this.setAttribute("instanceColorEnd",new da(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new MD(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new du);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Sw.setFromBufferAttribute(t),this.boundingBox.union(Sw))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new fl),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Cp.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Cp)),Cp.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(Cp));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}pt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new We(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};gs.line={uniforms:Cv.merge([pt.common,pt.fog,pt.line]),vertexShader:` 4508 #include <common> 4509 #include <color_pars_vertex> 4510 #include <fog_pars_vertex> 4511 #include <logdepthbuf_pars_vertex> 4512 #include <clipping_planes_pars_vertex> 4513 4514 uniform float linewidth; 4515 uniform vec2 resolution; 4516 4517 attribute vec3 instanceStart; 4518 attribute vec3 instanceEnd; 4519 4520 attribute vec3 instanceColorStart; 4521 attribute vec3 instanceColorEnd; 4522
4523 #ifdef WORLD_UNITS 4524 4525 varying vec4 worldPos; 4526 varying vec3 worldStart; 4527 varying vec3 worldEnd; 4528 4529 #ifdef USE_DASH 4530 4531 varying vec2 vUv; 4532 4533 #endif 4534 4535 #else 4536 4537 varying vec2 vUv; 4538 4539 #endif 4540 4541 #ifdef USE_DASH 4542 4543 uniform float dashScale; 4544 attribute float instanceDistanceStart; 4545 attribute float instanceDistanceEnd; 4546 varying float vLineDistance; 4547 4548 #endif 4549 4550 void trimSegment( const in vec4 start, inout vec4 end ) { 4551 4552 // trim end segment so it terminates between the camera plane and the near plane 4553 4554 // conservative estimate of the near plane 4555 float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column 4556 float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column 4557 float nearEstimate = - 0.5 * b / a; 4558 4559 float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); 4560 4561 end.xyz = mix( start.xyz, end.xyz, alpha ); 4562 4563 } 4564 4565 void main() { 4566 4567 #ifdef USE_COLOR 4568 4569 vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; 4570 4571 #endif 4572 4573 #ifdef USE_DASH 4574 4575 vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; 4576 vUv = uv; 4577 4578 #endif 4579 4580 float aspect = resolution.x / resolution.y; 4581 4582 // camera space 4583 vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); 4584 vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); 4585 4586 #ifdef WORLD_UNITS 4587 4588 worldStart = start.xyz; 4589 worldEnd = end.xyz; 4590 4591 #else 4592 4593 vUv = uv; 4594 4595 #endif 4596 4597 // special case for perspective projection, and segments that terminate either in, or behind, the camera plane 4598 // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space 4599 // but we need to perform ndc-space calculations in the shader, so we must address this issue directly 4600 // perhaps there is a more elegant solution -- WestLangley 4601 4602 bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column 4603 4604 if ( perspective ) { 4605 4606 if ( start.z < 0.0 && end.z >= 0.0 ) { 4607 4608 trimSegment( start, end ); 4609 4610 } else if ( end.z < 0.0 && start.z >= 0.0 ) { 4611 4612 trimSegment( end, start ); 4613 4614 } 4615 4616 } 4617 4618 // clip space 4619 vec4 clipStart = projectionMatrix * start; 4620 vec4 clipEnd = projectionMatrix * end; 4621 4622 // ndc space 4623 vec3 ndcStart = clipStart.xyz / clipStart.w; 4624 vec3 ndcEnd = clipEnd.xyz / clipEnd.w; 4625 4626 // direction 4627 vec2 dir = ndcEnd.xy - ndcStart.xy; 4628 4629 // account for clip-space aspect ratio 4630 dir.x *= aspect; 4631 dir = normalize( dir ); 4632 4633 #ifdef WORLD_UNITS 4634 4635 vec3 worldDir = normalize( end.xyz - start.xyz ); 4636 vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) ); 4637 vec3 worldUp = normalize( cross( worldDir, tmpFwd ) ); 4638 vec3 worldFwd = cross( worldDir, worldUp ); 4639 worldPos = position.y < 0.5 ? start: end; 4640 4641 // height offset 4642 float hw = linewidth * 0.5; 4643 worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp; 4644 4645 // don't extend the line if we're rendering dashes because we 4646 // won't be rendering the endcaps 4647 #ifndef USE_DASH 4648 4649 // cap extension 4650 worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir; 4651 4652 // add width to the box 4653 worldPos.xyz += worldFwd * hw; 4654 4655 // endcaps 4656 if ( position.y > 1.0 || position.y < 0.0 ) { 4657 4658 worldPos.xyz -= worldFwd * 2.0 * hw; 4659 4660 } 4661 4662 #endif 4663 4664 // project the worldpos 4665 vec4 clip = projectionMatrix * worldPos; 4666 4667 // shift the depth of the projected points so the line 4668 // segments overlap neatly 4669 vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; 4670 clip.z = clipPose.z * clip.w; 4671 4672 #else 4673 4674 vec2 offset = vec2( dir.y, - dir.x ); 4675 // undo aspect ratio adjustment 4676 dir.x /= aspect; 4677 offset.x /= aspect; 4678 4679 // sign flip 4680 if ( position.x < 0.0 ) offset *= - 1.0; 4681 4682 // endcaps 4683 if ( position.y < 0.0 ) { 4684 4685 offset += - dir; 4686 4687 } else if ( position.y > 1.0 ) { 4688 4689 offset += dir; 4690 4691 } 4692 4693 // adjust for linewidth 4694 offset *= linewidth; 4695 4696 // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... 4697 offset /= resolution.y; 4698 4699 // select end 4700 vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; 4701 4702 // back to clip space 4703 offset *= clip.w; 4704 4705 clip.xy += offset; 4706 4707 #endif 4708 4709 gl_Position = clip; 4710 4711 vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation 4712 4713 #include <logdepthbuf_vertex> 4714 #include <clipping_planes_vertex> 4715 #include <fog_vertex> 4716 4717 } 4718 `,fragmentShader:` 4719 uniform vec3 diffuse; 4720 uniform float opacity; 4721 uniform float linewidth; 4722 4723 #ifdef USE_DASH 4724 4725 uniform float dashOffset; 4726 uniform float dashSize; 4727 uniform float gapSize; 4728 4729 #endif 4730 4731 varying float vLineDistance; 4732 4733 #ifdef WORLD_UNITS 4734 4735 varying vec4 worldPos; 4736 varying vec3 worldStart; 4737 varying vec3 worldEnd; 4738 4739 #ifdef USE_DASH 4740 4741 varying vec2 vUv; 4742 4743 #endif 4744 4745 #else 4746 4747 varying vec2 vUv; 4748 4749 #endif 4750 4751 #include <common> 4752 #include <color_pars_fragment> 4753 #include <fog_pars_fragment> 4754 #include <logdepthbuf_pars_fragment> 4755 #include <clipping_planes_pars_fragment> 4756 4757 vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { 4758 4759 float mua; 4760 float mub; 4761 4762 vec3 p13 = p1 - p3; 4763 vec3 p43 = p4 - p3; 4764 4765 vec3 p21 = p2 - p1; 4766 4767 float d1343 = dot( p13, p43 );
4768 float d4321 = dot( p43, p21 ); 4769 float d1321 = dot( p13, p21 ); 4770 float d4343 = dot( p43, p43 ); 4771 float d2121 = dot( p21, p21 ); 4772 4773 float denom = d2121 * d4343 - d4321 * d4321; 4774 4775 float numer = d1343 * d4321 - d1321 * d4343; 4776 4777 mua = numer / denom; 4778 mua = clamp( mua, 0.0, 1.0 ); 4779 mub = ( d1343 + d4321 * ( mua ) ) / d4343; 4780 mub = clamp( mub, 0.0, 1.0 ); 4781 4782 return vec2( mua, mub ); 4783 4784 } 4785 4786 void main() { 4787 4788 float alpha = opacity; 4789 vec4 diffuseColor = vec4( diffuse, alpha ); 4790 4791 #include <clipping_planes_fragment> 4792 4793 #ifdef USE_DASH 4794 4795 if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps 4796 4797 if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX 4798 4799 #endif 4800 4801 #ifdef WORLD_UNITS 4802 4803 // Find the closest points on the view ray and the line segment 4804 vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; 4805 vec3 lineDir = worldEnd - worldStart; 4806 vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); 4807 4808 vec3 p1 = worldStart + lineDir * params.x; 4809 vec3 p2 = rayEnd * params.y; 4810 vec3 delta = p1 - p2; 4811 float len = length( delta ); 4812 float norm = len / linewidth; 4813 4814 #ifndef USE_DASH 4815 4816 #ifdef USE_ALPHA_TO_COVERAGE 4817 4818 float dnorm = fwidth( norm ); 4819 alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); 4820 4821 #else 4822 4823 if ( norm > 0.5 ) { 4824 4825 discard; 4826 4827 } 4828 4829 #endif 4830 4831 #endif 4832 4833 #else 4834 4835 #ifdef USE_ALPHA_TO_COVERAGE 4836 4837 // artifacts appear on some hardware if a derivative is taken within a conditional 4838 float a = vUv.x; 4839 float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; 4840 float len2 = a * a + b * b; 4841 float dlen = fwidth( len2 ); 4842 4843 if ( abs( vUv.y ) > 1.0 ) { 4844 4845 alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); 4846 4847 } 4848 4849 #else 4850 4851 if ( abs( vUv.y ) > 1.0 ) { 4852 4853 float a = vUv.x; 4854 float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; 4855 float len2 = a * a + b * b; 4856 4857 if ( len2 > 1.0 ) discard; 4858 4859 } 4860 4861 #endif 4862 4863 #endif 4864 4865 #include <logdepthbuf_fragment> 4866 #include <color_fragment> 4867 4868 gl_FragColor = vec4( diffuseColor.rgb, alpha ); 4869 4870 #include <tonemapping_fragment> 4871 #include <colorspace_fragment> 4872 #include <fog_fragment> 4873 #include <premultiplied_alpha_fragment> 4874 4875 } 4876 `};class R3 extends ws{constructor(e){super({type:"LineMaterial",uniforms:Cv.clone(gs.line.uniforms),vertexShader:gs.line.vertexShader,fragmentShader:gs.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const n_=new rn,Tw=new J,Mw=new J,yr=new rn,br=new rn,na=new rn,i_=new J,r_=new nn,Sr=new tL,ww=new J,Np=new du,Pp=new fl,ia=new rn;let ca,oc;function Ew(i,e,t){return ia.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),ia.multiplyScalar(1/ia.w),ia.x=oc/t.width,ia.y=oc/t.height,ia.applyMatrix4(i.projectionMatrixInverse),ia.multiplyScalar(1/ia.w),Math.abs(Math.max(ia.x,ia.y))}function zte(i,e){const t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){Sr.start.fromBufferAttribute(r,a),Sr.end.fromBufferAttribute(s,a),Sr.applyMatrix4(t);const u=new J,d=new J;ca.distanceSqToSegment(Sr.start,Sr.end,d,u),d.distanceTo(u)<oc*.5&&e.push({point:d,pointOnLine:u,distance:ca.origin.distanceTo(d),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function Hte(i,e,t){const n=e.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,u=a.attributes.instanceEnd,d=Math.min(a.instanceCount,l.count),p=-e.near;ca.at(1,na),na.w=1,na.applyMatrix4(e.matrixWorldInverse),na.applyMatrix4(n),na.multiplyScalar(1/na.w),na.x*=s.x/2,na.y*=s.y/2,na.z=0,i_.copy(na),r_.multiplyMatrices(e.matrixWorldInverse,o);for(let g=0,x=d;g<x;g++){if(yr.fromBufferAttribute(l,g),br.fromBufferAttribute(u,g),yr.w=1,br.w=1,yr.applyMatrix4(r_),br.applyM
4876atrix4(r_),yr.z>p&&br.z>p)continue;if(yr.z>p){const E=yr.z-br.z,N=(yr.z-p)/E;yr.lerp(br,N)}else if(br.z>p){const E=br.z-yr.z,N=(br.z-p)/E;br.lerp(yr,N)}yr.applyMatrix4(n),br.applyMatrix4(n),yr.multiplyScalar(1/yr.w),br.multiplyScalar(1/br.w),yr.x*=s.x/2,yr.y*=s.y/2,br.x*=s.x/2,br.y*=s.y/2,Sr.start.copy(yr),Sr.start.z=0,Sr.end.copy(br),Sr.end.z=0;const T=Sr.closestPointToPointParameter(i_,!0);Sr.at(T,ww);const S=og.lerp(yr.z,br.z,T),M=S>=-1&&S<=1,R=i_.distanceTo(ww)<oc*.5;if(M&&R){Sr.start.fromBufferAttribute(l,g),Sr.end.fromBufferAttribute(u,g),Sr.start.applyMatrix4(o),Sr.end.applyMatrix4(o);const E=new J,N=new J;ca.distanceSqToSegment(Sr.start,Sr.end,N,E),t.push({point:N,pointOnLine:E,distance:ca.origin.distanceTo(N),object:i,face:null,faceIndex:g,uv:null,uv1:null})}}}class Wte extends Qn{constructor(e=new w6,t=new R3({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)Tw.fromBufferAttribute(t,o),Mw.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Tw.distanceTo(Mw);const s=new am(r,2,1);return e.setAttribute("instanceDistanceStart",new da(s,1,0)),e.setAttribute("instanceDistanceEnd",new da(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,r=e.camera;r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;ca=e.ray;const o=this.matrixWorld,a=this.geometry,l=this.material;oc=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),Pp.copy(a.boundingSphere).applyMatrix4(o);let u;if(n)u=oc*.5;else{const p=Math.max(r.near,Pp.distanceToPoint(ca.origin));u=Ew(r,p,l.resolution)}if(Pp.radius+=u,ca.intersectsSphere(Pp)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),Np.copy(a.boundingBox).applyMatrix4(o);let d;if(n)d=oc*.5;else{const p=Math.max(r.near,Np.distanceToPoint(ca.origin));d=Ew(r,p,l.resolution)}Np.expandByScalar(d),ca.intersectsBox(Np)!==!1&&(n?zte(this,t):Hte(this,r,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(n_),this.material.uniforms.resolution.value.set(n_.z,n_.w))}}class E6 extends w6{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){const t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class $te extends Wte{constructor(e=new E6,t=new R3({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}class Rw extends Ev{constructor(e,t={}){const n=t.font;if(n===void 0)super();else{const r=n.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}}class jte{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){const r=[],s=Xte(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}}function Xte(i,e,t,n){const r=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[];let l=0,u=0;(n=="rtl"||n=="tb")&&r.reverse();for(let d=0;d<r.length;d++){const p=r[d];if(p===` 4877`)l=0,u-=o;else{const g=Qte(p,s,l,u,t);n=="tb"?(l=0,u+=t.ascender*s):l+=g.offsetX,a.push(g.path)}}return a}function Qte(i,e,t,n,r){const s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}const o=new nL;let a,l,u,d,p,g,x,y;if(s.o){const T=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let S=0,M=T.length;S<M;)switch(T[S++]){case"m":a=T[S++]*e+t,l=T[S++]*e+n,o.moveTo(a,l);break;case"l":a=T[S++]*e+t,l=T[S++]*e+n,o.lineTo(a,l);break;case"q":u=T[S++]*e+t,d=T[S++]*e+n,p=T[S++]*e+t,g=T[S++]*e+n,o.quadraticCurveTo(p,g,u,d);break;case"b":u=T[S++]*e+t,d=T[S++]*e+n,p=T[S++]*e+t,g=T[S++]*e+n,x=T[S++]*e+t,y=T[S++]*e+n,o.bezierCurveTo(p,g,x,y,u,d);break}}return{offsetX:s.ha*e,path:o}}
4877class Yte extends Ei{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new We(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}new J;new nn;new nn;new J;new J;function Ox(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Kte(i){if(Array.isArray(i))return i}function Zte(i){if(Array.isArray(i))return Ox(i)}function R6(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function Jte(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Cw(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(u){return void t(u)}a.done?e(l):Promise.resolve(l).then(n,r)}function ene(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Cw(s,n,r,o,a,"next",l)}function a(l){Cw(s,n,r,o,a,"throw",l)}o(void 0)})}}function jg(i,e,t){return e=CA(e),une(i,N3()?Reflect.construct(e,t||[],CA(i).constructor):e.apply(i,t))}function tne(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Xg(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Mf(i,e){return i.get(R6(i,e))}function s_(i,e,t){tne(i,e),e.set(i,t)}function o_(i,e,t){return i.set(R6(i,e),t),t}function C3(i,e,t){if(N3())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function nne(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,C6(n.key),n)}}function Qg(i,e,t){return e&&nne(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function xr(i,e,t){return(e=C6(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function kx(){return kx=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=cne(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},kx.apply(null,arguments)}function CA(i){return CA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},CA(i)}function Yg(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Vx(i,e)}function N3(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(N3=function(){return!!i})()}function ine(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function rne(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(d){u=!0,r=d}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}function sne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 4878In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function one(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 4879In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nw(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function ti(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
4879e%2?Nw(Object(t),!0).forEach(function(n){xr(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Nw(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function ane(i,e){if(i==null)return{};var t,n,r=lne(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function lne(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function une(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Jte(i)}function Gx(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(x,y,T,S){var M=y&&y.prototype instanceof a?y:a,R=Object.create(M.prototype);return ks(R,"_invoke",function(E,N,U){var L,F,P,I=0,$=U||[],k=!1,W={p:0,n:0,v:i,a:j,f:j.bind(i,4),d:function(Y,z){return L=Y,F=0,P=i,W.n=z,o}};function j(Y,z){for(F=Y,P=z,e=0;!k&&I&&!Q&&e<$.length;e++){var Q,ee=$[e],fe=W.p,le=ee[2];Y>3?(Q=le===z)&&(P=ee[(F=ee[4])?5:(F=3,3)],ee[4]=ee[5]=i):ee[0]<=fe&&((Q=Y<2&&fe<ee[1])?(F=0,W.v=z,W.n=ee[1]):fe<le&&(Q=Y<3||ee[0]>z||z>le)&&(ee[4]=Y,ee[5]=z,W.n=le,F=0))}if(Q||Y>1)return o;throw k=!0,z}return function(Y,z,Q){if(I>1)throw TypeError("Generator is already running");for(k&&z===1&&j(z,Q),F=z,P=Q;(e=F<2?i:P)||!k;){L||(F?F<3?(F>1&&(W.n=-1),j(F,P)):W.n=P:W.v=P);try{if(I=2,L){if(F||(Y="next"),e=L[Y]){if(!(e=e.call(L,P)))throw TypeError("iterator result is not an object");if(!e.done)return e;P=e.value,F<2&&(F=0)}else F===1&&(e=L.return)&&e.call(L),F<2&&(P=TypeError("The iterator does not provide a '"+Y+"' method"),F=1);L=i}else if((e=(k=W.n<0)?P:E.call(N,W))!==o)break}catch(ee){L=i,F=1,P=ee}finally{I=1}}return{value:e,done:k}}}(x,T,S),!0),R}var o={};function a(){}function l(){}function u(){}e=Object.getPrototypeOf;var d=[][n]?e(e([][n]())):(ks(e={},n,function(){return this}),e),p=u.prototype=a.prototype=Object.create(d);function g(x){return Object.setPrototypeOf?Object.setPrototypeOf(x,u):(x.__proto__=u,ks(x,r,"GeneratorFunction")),x.prototype=Object.create(p),x}return l.prototype=u,ks(p,"constructor",u),ks(u,"constructor",l),l.displayName="GeneratorFunction",ks(u,r,"GeneratorFunction"),ks(p),ks(p,r,"Generator"),ks(p,n,function(){return this}),ks(p,"toString",function(){return"[object Generator]"}),(Gx=function(){return{w:s,m:g}})()}function ks(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}ks=function(s,o,a,l){function u(d,p){ks(s,d,function(g){return this._invoke(d,p,g)})}o?r?r(s,o,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[o]=a:(u("next",0),u("throw",1),u("return",2))},ks(i,e,t,n)}function Vx(i,e){return Vx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Vx(i,e)}function wi(i,e){return Kte(i)||rne(i,e)||N6(i,e)||sne()}function cne(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=CA(i))!==null;);return i}function a_(i,e,t,n){var r=kx(CA(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function ui(i){return Zte(i)||ine(i)||N6(i)||one()}function hne(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function C6(i){var e=hne(i,"string");return typeof e=="symbol"?e:e+""}function N6(i,e){if(i){if(typeof i=="string")return Ox(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ox(i,e):void 0}}var P6=function(e){e instanceof Array?e.forEach(P6):(e.map&&e.map.dispose(),e.dispose())},P3=function(e){e.geometry&&e.geometry.dispose(),e.material&&P6(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEac
4879h(P3)},pi=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),P3(t)}};function As(i,e){var t=new e;return{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),u=1;u<a;u++)l[u-1]=arguments[u];var d=o[r].apply(o,l);return d===o?this:d}}}}var bi=100;function Pw(){return bi}function po(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=bi*(1+t),o=Math.sin(n);return{x:s*o*Math.cos(r),y:s*Math.cos(n),z:s*o*Math.sin(r)}}function D6(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),altitude:r/bi-1}}function Wu(i){return i*Math.PI/180}var Pd=window.THREE?window.THREE:{BackSide:Xn,BufferAttribute:Di,Color:It,Mesh:Qn,ShaderMaterial:ws},Ane=` 4880uniform float hollowRadius; 4881 4882varying vec3 vVertexWorldPosition; 4883varying vec3 vVertexNormal; 4884varying float vCameraDistanceToObjCenter; 4885varying float vVertexAngularDistanceToHollowRadius; 4886 4887void main() { 4888 vVertexNormal = normalize(normalMatrix * normal); 4889 vVertexWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz; 4890 4891 vec4 objCenterViewPosition = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0); 4892 vCameraDistanceToObjCenter = length(objCenterViewPosition); 4893 4894 float edgeAngle = atan(hollowRadius / vCameraDistanceToObjCenter); 4895 float vertexAngle = acos(dot(normalize(modelViewMatrix * vec4(position, 1.0)), normalize(objCenterViewPosition))); 4896 vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle; 4897 4898 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); 4899}`,fne=` 4900uniform vec3 color; 4901uniform float coefficient; 4902uniform float power; 4903uniform float hollowRadius; 4904 4905varying vec3 vVertexNormal; 4906varying vec3 vVertexWorldPosition; 4907varying float vCameraDistanceToObjCenter; 4908varying float vVertexAngularDistanceToHollowRadius; 4909 4910void main() { 4911 if (vCameraDistanceToObjCenter < hollowRadius) discard; // inside the hollowRadius 4912 if (vVertexAngularDistanceToHollowRadius < 0.0) discard; // frag position is within the hollow radius 4913 4914 vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition; 4915 vec3 viewCameraToVertex = (viewMatrix * vec4(worldCameraToVertex, 0.0)).xyz; 4916 viewCameraToVertex = normalize(viewCameraToVertex); 4917 float intensity = pow( 4918 coefficient + dot(vVertexNormal, viewCameraToVertex), 4919 power 4920 ); 4921 gl_FragColor = vec4(color, intensity); 4922}`;function dne(i,e,t,n){return new Pd.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:Ane,fragmentShader:fne,uniforms:{coefficient:{value:i},color:{value:new Pd.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function pne(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var o=i.attributes.normal.array[r],a=i.attributes.position.array[r];n[r]=a+o*e}return t.setAttribute("position",new Pd.BufferAttribute(n,3)),t}var mne=function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,o=s===void 0?"gold":s,a=r.size,l=a===void 0?2:a,u=r.coefficient,d=u===void 0?.5:u,p=r.power,g=p===void 0?1:p,x=r.hollowRadius,y=x===void 0?0:x,T=r.backside,S=T===void 0?!0:T;Xg(this,e),n=jg(this,e);var M=pne(t,l),R=dne(d,o,g,y);return S&&(R.side=Pd.BackSide),n.geometry=M,n.material=R,n}return Yg(e,i),Qg(e)}(Pd.Mesh),ra=window.THREE?window.THREE:{Color:It,Group:ys,LineBasicMaterial:BA,LineSegments:oE,Mesh:Qn,MeshPhongMaterial:yE,SphereGeometry:Fa,SRGBColorSpace:Tr,TextureLoader:Pv},L6=Wr({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){pi(e.globeObj),pi(e.tileEngine),pi(e.graticulesObj)}},stateInit:function(){var e=new ra.MeshPhongMaterial({color:0}),t=new ra.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new yk(bi),r=new ra.Group;
4922r.__globeObjType="globe",r.add(t),r.add(n);var s=new ra.LineSegments(new u4(hG(),bi,2),new ra.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){pi(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new ra.SphereGeometry(bi,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new ra.TextureLoader().load(e.globeImageUrl,function(a){a.colorSpace=ra.SRGBColorSpace,n.map=a,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new ra.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new ra.TextureLoader().load(e.bumpImageUrl,function(a){n.bumpMap=a,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),pi(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new mne(e.globeObj.geometry,{color:e.atmosphereColor,size:bi*e.atmosphereAltitude,hollowRadius:bi,coefficient:.1,power:3.5});o.visible=!!e.showAtmosphere,o.__globeObjType="atmosphere",e.scene.add(o)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),Da=function(e){return isNaN(e)?parseInt(Qt(e).toHex(),16):e},Bo=function(e){return e&&isNaN(e)?dc(e).opacity:1},Au=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,o=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(o){var a=o.slice(1),l=wi(a,4),u=l[0],d=l[1],p=l[2],g=l[3];r=new It("rgb(".concat(+u,",").concat(+d,",").concat(+p,")")),s=Math.min(+g,1)}else r=new It(e);n&&r.convertLinearToSRGB();var x=r.toArray();return t?[].concat(ui(x),[s]):x};function gne(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var Dw=window.THREE?window.THREE:{BufferAttribute:Di};function La(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new Dw.BufferAttribute(new t(i),e);for(var n=new Dw.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function _ne(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var l_=new WeakMap,Dp=new WeakMap,Lp=new WeakMap,Ns=function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a,u=r.removeDelay,d=u===void 0?0:u;return Xg(this,e),n=jg(this,e),xr(n,"scene",void 0),s_(n,l_,void 0),s_(n,Dp,void 0),s_(n,Lp,void 0),n.scene=t,o_(l_,n,o),o_(Dp,n,l),o_(Lp,n,d),n.onRemoveObj(function(){}),n}return Yg(e,i),Qg(e,[{key:"onCreateObj",value:function(n){var r=this;return a_(e,"onCreateObj",this)([function(s){var o=n(s);return s[Mf(Dp,r)]=o,o[Mf(l_,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return a_(e,"onRemoveObj",this)([function(s,o){var a=a_(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),pi(s),delete a[Mf(Dp,r)]};Mf(Lp,r)?setTimeout(l,Mf(Lp,r)):l()}]),this}}])}(lV),So=window.THREE?window.THREE:{BufferGeometry:Wn,CylinderGeometry:ug,Matrix4:nn,Mesh:Qn,MeshLambertMaterial:dl,Object3D:Ei,Vector3:J},Lw=Object.assign({},Vv),Iw=Lw.BufferGeometryUtils||Lw,I6=Wr({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;pi(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=Xe(e.pointLat),r=Xe(e.pointLng),s=Xe(e.pointAltitude),o=Xe(e.pointRadius),a=Xe(e.pointColor),l=new So.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new So.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new So.Matrix4().makeTranslation(0,0,-.5));var u=2*Math.PI*bi/360,d={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&pi(e.scene),e.dataMapper.scene=e.pointsMerge?new So.Object3D:e.scene,e.dataMapper.onCreateObj(x).onUpdateObj(y).digest(e.pointsData),e.pointsMerge){var p=e.pointsData.length?(
vendor: 4,123 bytes, lines 4922-5000
4922Iw.mergeGeometries||Iw.mergeBufferGeometries)(e.pointsData.map(function(T){var S=e.dataMapper.getObj(T),M=S.geometry.clone();S.updateMatrix(),M.applyMatrix4(S.matrix);var R=Au(a(T));return M.setAttribute("color",La(Array(M.getAttribute("position").count).fill(R),4)),M})):new So.BufferGeometry,g=new So.Mesh(p,new So.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));g.__globeObjType="points",g.__data=e.pointsData,e.dataMapper.clear(),pi(e.scene),e.scene.add(g)}function x(){var T=new So.Mesh(l);return T.__globeObjType="point",T}function y(T,S){var M=function(P){var I=T.__currentTargetD=P,$=I.r,k=I.alt,W=I.lat,j=I.lng;Object.assign(T.position,po(W,j));var Y=e.pointsMerge?new So.Vector3(0,0,0):e.scene.localToWorld(new So.Vector3(0,0,0));T.lookAt(Y),T.scale.x=T.scale.y=Math.min(30,$)*u,T.scale.z=Math.max(k*bi,.1)},R={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},E=T.__currentTargetD||Object.assign({},R,{alt:-.001});if(Object.keys(R).some(function(F){return E[F]!==R[F]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?M(R):e.tweenGroup.add(new $s(E).to(R,e.pointsTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(M).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var N=a(S),U=N?Bo(N):0,L=!!U;T.visible=L,L&&(d.hasOwnProperty(N)||(d[N]=new So.MeshLambertMaterial({color:Da(N),transparent:U<1,opacity:U})),T.material=d[N])}}}}),B6=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:` 4923 `.concat(_n.common,` 4924 `).concat(_n.logdepthbuf_pars_vertex,` 4925 4926 uniform float dashTranslate; 4927 4928 attribute vec4 color; 4929 varying vec4 vColor; 4930 4931 attribute float relDistance; 4932 varying float vRelDistance; 4933 4934 void main() { 4935 // pass through colors and distances 4936 vColor = color; 4937 vRelDistance = relDistance + dashTranslate; 4938 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); 4939 4940 `).concat(_n.logdepthbuf_vertex,` 4941 } 4942 `),fragmentShader:` 4943 `.concat(_n.logdepthbuf_pars_fragment,` 4944 4945 uniform float dashOffset; 4946 uniform float dashSize; 4947 uniform float gapSize; 4948 4949 varying vec4 vColor; 4950 varying float vRelDistance; 4951 4952 void main() { 4953 // ignore pixels in the gap 4954 if (vRelDistance < dashOffset) discard; 4955 if (mod(vRelDistance - dashOffset, dashSize + gapSize) > dashSize) discard; 4956 4957 // set px color: [r, g, b, a], interpolated between vertices 4958 gl_FragColor = vColor; 4959 4960 `).concat(_n.logdepthbuf_fragment,` 4961 } 4962 `)}},qx=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius; 4963varying float vSurfaceRadius; 4964varying vec3 vPos; 4965`+e.vertexShader).replace("void main() {",["void main() {","vSurfaceRadius = surfaceRadius;","vPos = position;"].join(` 4966`)),e.fragmentShader=(`uniform float uSurfaceRadius; 4967varying float vSurfaceRadius; 4968varying vec3 vPos; 4969`+e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join(` 4970`)),e},xne=function(e){return e.vertexShader=` 4971 attribute float r; 4972 4973 const float PI = 3.1415926535897932384626433832795; 4974 float toRad(in float a) { 4975 return a * PI / 180.0; 4976 } 4977 4978 vec3 Polar2Cartesian(in vec3 c) { // [lat, lng, r] 4979 float phi = toRad(90.0 - c.x); 4980 float theta = toRad(90.0 - c.y); 4981 float r = c.z; 4982 return vec3( // x,y,z 4983 r * sin(phi) * cos(theta), 4984 r * cos(phi), 4985 r * sin(phi) * sin(theta) 4986 ); 4987 } 4988 4989 vec2 Cartesian2Polar(in vec3 p) { 4990 float r = sqrt(p.x * p.x + p.y * p.y + p.z * p.z); 4991 float phi = acos(p.y / r); 4992 float theta = atan(p.z, p.x); 4993 return vec2( // lat,lng 4994 90.0 - phi * 180.0 / PI, 4995 90.0 - theta * 180.0 / PI - (theta < -PI / 2.0 ? 360.0 : 0.0) 4996 ); 4997 } 4998 `.concat(e.vertexShader.replace("}",` 4999 vec3 pos = Polar2Cartesian(vec3(Cartesian2Polar(position), r)); 5000 gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0
5000); 5001 } 5002 `),` 5003 `),e},D3=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},vne=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},yne=["stroke"],To=window.THREE?window.THREE:{BufferGeometry:Wn,CubicBezierCurve3:cE,Curve:Vo,Group:ys,Line:ag,Mesh:Qn,NormalBlending:mr,ShaderMaterial:ws,TubeGeometry:Rv,Vector3:J},bne=xA.default||xA,F6=Wr({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new bne,sharedMaterial:new To.ShaderMaterial(ti(ti({},B6()),{},{transparent:!0,blending:To.NormalBlending}))}},init:function(e,t){pi(e),t.scene=e,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new To.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=wi(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r,l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a})})},update:function(e){var t=Xe(e.arcStartLat),n=Xe(e.arcStartLng),r=Xe(e.arcStartAltitude),s=Xe(e.arcEndLat),o=Xe(e.arcEndLng),a=Xe(e.arcEndAltitude),l=Xe(e.arcAltitude),u=Xe(e.arcAltitudeAutoScale),d=Xe(e.arcStroke),p=Xe(e.arcColor),g=Xe(e.arcDashLength),x=Xe(e.arcDashGap),y=Xe(e.arcDashInitialGap),T=Xe(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(E,N){var U=d(N),L=U!=null;if(!E.children.length||L!==(E.children[0].type==="Mesh")){pi(E);var F=L?new To.Mesh:new To.Line(new To.BufferGeometry);F.material=e.sharedMaterial.clone(),E.add(F)}var P=E.children[0];Object.assign(P.material.uniforms,{dashSize:{value:g(N)},gapSize:{value:x(N)},dashOffset:{value:y(N)}});var I=T(N);P.__dashAnimateStep=I>0?1e3/I:0;var $=M(p(N),e.arcCurveResolution,L?e.arcCircularResolution+1:1),k=R(e.arcCurveResolution,L?e.arcCircularResolution+1:1,!0);P.geometry.setAttribute("color",$),P.geometry.setAttribute("relDistance",k);var W=function(Q){var ee=E.__currentTargetD=Q,fe=ee.stroke,le=ane(ee,yne),Me=S(le);L?(P.geometry&&P.geometry.dispose(),P.geometry=new To.TubeGeometry(Me,e.arcCurveResolution,fe/2,e.arcCircularResolution),P.geometry.setAttribute("color",$),P.geometry.setAttribute("relDistance",k)):P.geometry.setFromPoints(Me.getPoints(e.arcCurveResolution))},j={stroke:U,alt:l(N),altAutoScale:+u(N),startLat:+t(N),startLng:+n(N),startAlt:+r(N),endLat:+s(N),endLng:+o(N),endAlt:+a(N)},Y=E.__currentTargetD||Object.assign({},j,{altAutoScale:-.001});Object.keys(j).some(function(z){return Y[z]!==j[z]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?W(j):e.tweenGroup.add(new $s(Y).to(j,e.arcsTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(W).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(E){var N=E.alt,U=E.altAutoScale,L=E.startLat,F=E.startLng,P=E.startAlt,I=E.endLat,$=E.endLng,k=E.endAlt,W=function(Re){var qe=wi(Re,3),Ke=qe[0],St=qe[1],mt=qe[2],Tt=po(St,Ke,mt),an=Tt.x,Ut=Tt.y,Ue=Tt.z;return new To.Vector3(an,Ut,Ue)},j=[F,L],Y=[$,I],z=N;if(z==null&&(z=uG(j,Y)/2*U+Math.max(P,k)),z||P||k){var Q=AG(j,Y),ee=function(Re,qe){return qe+(qe-Re)*(Re<qe?.5:.25)},fe=[.25,.75].map(function(bt){return[].concat(ui(Q(bt)),[ee(bt<.5?P:k,z)])}),le=wi(fe,2),Me=le[0],Ce=le[1],Be=C3(To.CubicBezierCurve3,ui([[].concat(j,[P]),Me,Ce,[].concat(Y,[k])].map(W)));return Be}else{var Ye=.001;return qt.apply(void 0,ui([[].concat(j,[Ye]),[].concat(Y,[Ye])].map(W)))}function qt(bt,Re){var qe=bt.angleTo(Re),Ke=qe===0?function(){return bt.clone()}:function(mt){return new To.Vector3().addVectors(bt.clone().multiplyScalar(Math.sin((1-mt)*qe)),Re.clone().multiplyScalar(Math.sin(mt*qe))).divideScalar(Math.sin(qe))},St=new To.Curve;return St.getPoint=Ke,St}}function M(E,N){var U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,L=N+1,F;if(E instanceof Array||E instanceof Function){var P=E instanceof Array?ul(
5003).domain(E.map(function(z,Q){return Q/(E.length-1)})).range(E):E;F=function(Q){return Au(P(Q),!0,!0)}}else{var I=Au(E,!0,!0);F=function(){return I}}for(var $=[],k=0,W=L;k<W;k++)for(var j=F(k/(W-1)),Y=0;Y<U;Y++)$.push(j);return La($,4)}function R(E){for(var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,L=E+1,F=[],P=0,I=L;P<I;P++)for(var $=P/(I-1),k=0;k<N;k++)F.push($);return U&&F.reverse(),La(F,1)}}}),Fl=window.THREE?window.THREE:{BufferGeometry:Wn,DoubleSide:Ui,Mesh:Qn,MeshLambertMaterial:dl,Object3D:Ei},Bw=Object.assign({},Vv),Fw=Bw.BufferGeometryUtils||Bw,U6=Wr({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;pi(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=Xe(e.hexBinPointLat),r=Xe(e.hexBinPointLng),s=Xe(e.hexBinPointWeight),o=Xe(e.hexAltitude),a=Xe(e.hexTopColor),l=Xe(e.hexSideColor),u=Xe(e.hexMargin),d=xz(e.hexBinPointsData.map(function(R){return ti(ti({},R),{},{h3Idx:rH(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),p=Object.entries(d).map(function(R){var E=wi(R,2),N=E[0],U=E[1];return{h3Idx:N,points:U,sumWeight:U.reduce(function(L,F){return L+ +s(F)},0)}}),g={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&pi(e.scene),e.dataMapper.scene=e.hexBinMerge?new Fl.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(M).digest(p),e.hexBinMerge){var x=p.length?(Fw.mergeGeometries||Fw.mergeBufferGeometries)(p.map(function(R){var E=e.dataMapper.getObj(R),N=E.geometry.toNonIndexed();E.updateMatrix(),N.applyMatrix4(E.matrix);var U=Au(a(R)),L=Au(l(R)),F=N.getAttribute("position").count,P=N.groups[0].count;return N.setAttribute("color",La(ui(new Array(F)).map(function(I,$){return $>=P?U:L}),4)),N})):new Fl.BufferGeometry,y=new Fl.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:Fl.DoubleSide});y.onBeforeCompile=function(R){y.userData.shader=qx(R)};var T=new Fl.Mesh(x,y);T.__globeObjType="hexBinPoints",T.__data=p,e.dataMapper.clear(),pi(e.scene),e.scene.add(T)}function S(R){var E=new Fl.Mesh;E.__hexCenter=k4(R.h3Idx),E.__hexGeoJson=G4(R.h3Idx,!0).reverse();var N=E.__hexCenter[1];return E.__hexGeoJson.forEach(function(U){var L=U[0];Math.abs(N-L)>170&&(U[0]+=N>L?360:-360)}),E.__globeObjType="hexbin",E}function M(R,E){var N=function(ee,fe,le){return ee-(ee-fe)*le},U=Math.max(0,Math.min(1,+u(E))),L=wi(R.__hexCenter,2),F=L[0],P=L[1],I=U===0?R.__hexGeoJson:R.__hexGeoJson.map(function(Q){var ee=wi(Q,2),fe=ee[0],le=ee[1];return[[fe,P],[le,F]].map(function(Me){var Ce=wi(Me,2),Be=Ce[0],Ye=Ce[1];return N(Be,Ye,U)})}),$=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new Yv([I],0,bi,!1,!0,!0,$);var k={alt:+o(E)},W=function(ee){var fe=R.__currentTargetD=ee,le=fe.alt;R.scale.x=R.scale.y=R.scale.z=1+le;var Me=bi/(le+1);R.geometry.setAttribute("surfaceRadius",La(Array(R.geometry.getAttribute("position").count).fill(Me),1))},j=R.__currentTargetD||Object.assign({},k,{alt:-.001});if(Object.keys(k).some(function(Q){return j[Q]!==k[Q]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?W(k):e.tweenGroup.add(new $s(j).to(k,e.hexTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(W).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var Y=l(E),z=a(E);[Y,z].forEach(function(Q){if(!g.hasOwnProperty(Q)){var ee=Bo(Q);g[Q]=D3(new Fl.MeshLambertMaterial({color:Da(Q),transparent:ee<1,opacity:ee,side:Fl.DoubleSide}),qx)}}),R.material=[Y,z].map(function(Q){return g[Q]})}}}}),O6=function(e){return e*e},Za=function(e){return e*Math.PI/180};function Sne(i,e){var t=Math.sqrt,n=Math.cos,r=function(d){return O6(Math.sin(d/2))},s=Za(i[1]),o=Za(e[1]),a=Za(i[0]),l=Za(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var Tne=Math.sqrt(2*Math.PI);function Mne(i,e){return Math.exp(-O6(i/e)/2)/(e*Tne)}var wne=function(e){var t=wi(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.lngAccessor,l=a===void 0?function(S){return S[0]}:a,u=o.latAccessor,d=u===void 0?function(S){return S[1]}:u,p=o.weightAccessor,g=p===void 0?function(){return 1}:p,x=o.bandwidth,y=[n,r],T=x*Math.PI/180;return hO(s.map(function(S){var M=g(S);if(!M)return 0;var R=Sne(y,[l(S),d(S)]);return Mne(R,T)*M}))},Ene=function(){var i=ene(Gx().m(function e(t){var n,r,s,o,a,l,u,d,p,g,x,y,T,S,M,R,E,N,U,L,F,P,I,$,k,W,j,Y,z,Q,ee,fe,le,Me,Ce,Be,Ye,qt,bt,Re,qe=arguments,Ke,St,mt;return Gx().w(function(Tt){for(;;)switch(Tt.n){case 0:if(r=qe.length>1&&qe[1]!==void 0?qe[1]:[],s=qe.length>2&&qe[2]!==void 0?qe[2]:{},o=s.lngAccessor,a=o===void 0?function(an){return an[0]}:o,l=s.latAccessor,u=l===void 0?function(an){return an[1]}:l,d=s.weightAccessor,p=d===void 0?function(){return 1}:d,g=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Tt.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Tt.a(2,t.map(function(an){return wne(an,r,{lngAccessor:a,latAccessor:u,weightAccessor:p,bandwidth:g})}));case 1:return x=4,y=Nte,T=Pte,S=qte,M=Vte,R=Fte,E=Ute,N=Dte,U=Gte,L=kte,F=Ite,P=Lte,I=Bte,$=Ote,k=M(new nm(new Float32Array(t.flat().map(Za)),2),"vec2",t.length),W=M(new nm(new Float32Array(r.map(function(an){return[Za(a(an)),Za(u(an)),p(an)]}).flat()),3),"vec3",r.length),j=new nm(t.length,1),Y=M(j,"float",t.length),z=R(Math.PI),Q=U(z.mul(2)),ee=function(Ut){return Ut.mul(Ut)},fe=function(Ut){return ee(L(Ut.div(2)))},le=function(Ut,Ue){var Je=R(Ut[1]),He=R(Ue[1]),ot=R(Ut[0]),se=R(Ue[0]);return R(2).mul(P(U(fe(He.sub(Je)).add(F(Je).mul(F(He)).mul(fe(se.sub(ot)))))))},Me=function(Ut,Ue){return I($(ee(Ut.div(Ue)).div(2))).div(Ue.mul(Q))},Ce=S(Za(g)),Be=S(Za(g*x)),Ye=S(r.length),qt=y(function(){var an=k.element
5003(E),Ut=Y.element(E);Ut.assign(0),N(Ye,function(Ue){var Je=Ue.i,He=W.element(Je),ot=He.z;T(ot,function(){var se=le(He.xy,an.xy);T(se&&se.lessThan(Be),function(){Ut.addAssign(Me(se,Ce).mul(ot))})})})}),bt=qt().compute(t.length),Re=new Cte,Tt.n=2,Re.computeAsync(bt);case 2:return Ke=Array,St=Float32Array,Tt.n=3,Re.getArrayBufferAsync(j);case 3:return mt=Tt.v,Tt.a(2,Ke.from.call(Ke,new St(mt)))}},e)}));return function(t){return i.apply(this,arguments)}}(),Ip=window.THREE?window.THREE:{Mesh:Qn,MeshLambertMaterial:dl,SphereGeometry:Fa},Rne=3.5,Cne=.1,Uw=100,Nne=function(e){var t=dc(oH(e));return t.opacity=Math.cbrt(e),t.formatRgb()},k6=Wr({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return Nne}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;pi(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new Ip.Mesh(new Ip.SphereGeometry(bi),D3(new Ip.MeshLambertMaterial({vertexColors:!0,transparent:!0}),xne));return s.__globeObjType="heatmap",s})},update:function(e){var t=Xe(e.heatmapPoints),n=Xe(e.heatmapPointLat),r=Xe(e.heatmapPointLng),s=Xe(e.heatmapPointWeight),o=Xe(e.heatmapBandwidth),a=Xe(e.heatmapColorFn),l=Xe(e.heatmapColorSaturation),u=Xe(e.heatmapBaseAltitude),d=Xe(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(p,g){var x=o(g),y=a(g),T=l(g),S=u(g),M=d(g),R=t(g).map(function(F){var P=n(F),I=r(F),$=po(P,I),k=$.x,W=$.y,j=$.z;return{x:k,y:W,z:j,lat:P,lng:I,weight:s(F)}}),E=Math.max(Cne,x/Rne),N=Math.ceil(360/(E||-1));p.geometry.parameters.widthSegments!==N&&(p.geometry.dispose(),p.geometry=new Ip.SphereGeometry(bi,N,N/2));var U=_ne(p.geometry.getAttribute("position")),L=U.map(function(F){var P=wi(F,3),I=P[0],$=P[1],k=P[2],W=D6({x:I,y:$,z:k}),j=W.lng,Y=W.lat;return[j,Y]});Ene(L,R,{latAccessor:function(P){return P.lat},lngAccessor:function(P){return P.lng},weightAccessor:function(P){return P.weight},bandwidth:x}).then(function(F){var P=ui(new Array(Uw)).map(function(W,j){return Au(y(j/(Uw-1)))}),I=function(j){var Y=p.__currentTargetD=j,z=Y.kdeVals,Q=Y.topAlt,ee=Y.saturation,fe=lO(z.map(Math.abs))||1e-15,le=XE([0,fe/ee],P);p.geometry.setAttribute("color",La(z.map(function(Ce){return le(Math.abs(Ce))}),4));var Me=ul([0,fe],[bi*(1+S),bi*(1+(Q||S))]);p.geometry.setAttribute("r",La(z.map(Me)))},$={kdeVals:F,topAlt:M,saturation:T},k=p.__currentTargetD||Object.assign({}
5003,$,{kdeVals:F.map(function(){return 0}),topAlt:M&&S,saturation:.5});k.kdeVals.length!==F.length&&(k.kdeVals=F.slice()),Object.keys($).some(function(W){return k[W]!==$[W]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?I($):e.tweenGroup.add(new $s(k).to($,e.heatmapsTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(I).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),Ul=window.THREE?window.THREE:{DoubleSide:Ui,Group:ys,LineBasicMaterial:BA,LineSegments:oE,Mesh:Qn,MeshBasicMaterial:qs},G6=Wr({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;pi(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new Ul.Group;return s.__defaultSideMaterial=D3(new Ul.MeshBasicMaterial({side:Ul.DoubleSide,depthWrite:!0}),qx),s.__defaultCapMaterial=new Ul.MeshBasicMaterial({side:Ul.DoubleSide,depthWrite:!0}),s.add(new Ul.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new Ul.LineSegments(void 0,new Ul.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=Xe(e.polygonGeoJsonGeometry),n=Xe(e.polygonAltitude),r=Xe(e.polygonCapCurvatureResolution),s=Xe(e.polygonCapColor),o=Xe(e.polygonCapMaterial),a=Xe(e.polygonSideColor),l=Xe(e.polygonSideMaterial),u=Xe(e.polygonStrokeColor),d=[];e.polygonsData.forEach(function(p){var g={data:p,capColor:s(p),capMaterial:o(p),sideColor:a(p),sideMaterial:l(p),strokeColor:u(p),altitude:+n(p),capCurvatureResolution:+r(p)},x=t(p),y=p.__id||"".concat(Math.round(Math.random()*1e9));p.__id=y,x.type==="Polygon"?d.push(ti({id:"".concat(y,"_0"),coords:x.coordinates},g)):x.type==="MultiPolygon"?d.push.apply(d,ui(x.coordinates.map(function(T,S){return ti({id:"".concat(y,"_").concat(S),coords:T},g)}))):console.warn("Unsupported GeoJson geometry type: ".concat(x.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(p,g){var x=g.coords,y=g.capColor,T=g.capMaterial,S=g.sideColor,M=g.sideMaterial,R=g.strokeColor,E=g.altitude,N=g.capCurvatureResolution,U=wi(p.children,2),L=U[0],F=U[1],P=!!R;F.visible=P;var I=!!(y||T),$=!!(S||M);Pne(L.geometry.parameters||{},{polygonGeoJson:x,curvatureResolution:N,closedTop:I,includeSides:$})||(L.geometry&&L.geometry.dispose(),L.geometry=new Yv(x,0,bi,!1,I,$,N)),P&&(!F.geometry.parameters||F.geometry.parameters.geoJson.coordinates!==x||F.geometry.parameters.resolution!==N)&&(F.geometry&&F.geometry.dispose(),F.geometry=new u4({type:"Polygon",coordinates:x},bi,N));var k=$?0:-1,W=I?$?1:0:-1;if(k>=0&&(L.material[k]=M||p.__defaultSideMaterial),W>=0&&(L.material[W]=T||p.__defaultCapMaterial),[[!M&&S,k],[!T&&y,W]].forEach(function(fe){var le=wi(fe,2),Me=le[0],Ce=le[1];if(!(!Me||Ce<0)){var Be=L.material[Ce],Ye=Bo(Me);Be.color.set(Da(Me)),Be.transparent=Ye<1,Be.opacity=Ye}}),P){var j=F.material,Y=Bo(R);j.color.set(Da(R)),j.transparent=Y<1,j.opacity=Y}var z={alt:E},Q=function(le){var Me=p.__currentTargetD=le,Ce=Me.alt;L.scale.x=L.scale.y=L.scale.z=1+Ce,P&&(F.scale.x=F.scale.y=F.scale.z=1+Ce+1e-4),vne(p.__defaultSideMaterial,function(Be){return Be.uSurfaceRadius.value=bi/(Ce+1)})},ee=p.__currentTargetD||Object.assign({},z,{alt:-.001});Object.keys(z).some(function(fe){return ee[fe]!==z[fe]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||ee.alt===z.alt?Q(z):e.tweenGroup.add(new $s(ee).to(z,e.polygonsTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(Q).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(d)}});function Pne(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=wi(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var dh=window.THREE?window.THREE:{BufferGeometry:Wn,DoubleSide:Ui,Mesh:Qn,MeshLambertMaterial:dl,Vector3:J},Ow=Object.assign({},Vv),kw=Ow.BufferGeometryUtils||Ow,V6=Wr({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;pi(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new dh.Mesh(void 0,new dh.MeshLambertMaterial({side:dh.DoubleSide}));
5003return s.__globeObjType="hexPolygon",s})},update:function(e){var t=Xe(e.hexPolygonGeoJsonGeometry),n=Xe(e.hexPolygonColor),r=Xe(e.hexPolygonAltitude),s=Xe(e.hexPolygonResolution),o=Xe(e.hexPolygonMargin),a=Xe(e.hexPolygonUseDots),l=Xe(e.hexPolygonCurvatureResolution),u=Xe(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(d,p){var g=t(p),x=s(p),y=r(p),T=Math.max(0,Math.min(1,+o(p))),S=a(p),M=l(p),R=u(p),E=n(p),N=Bo(E);d.material.color.set(Da(E)),d.material.transparent=N<1,d.material.opacity=N;var U={alt:y,margin:T,curvatureResolution:M},L={geoJson:g,h3Res:x},F=d.__currentTargetD||Object.assign({},U,{alt:-.001}),P=d.__currentMemD||L;if(Object.keys(U).some(function(W){return F[W]!==U[W]})||Object.keys(L).some(function(W){return P[W]!==L[W]})){d.__currentMemD=L;var I=[];g.type==="Polygon"?JT(g.coordinates,x,!0).forEach(function(W){return I.push(W)}):g.type==="MultiPolygon"?g.coordinates.forEach(function(W){return JT(W,x,!0).forEach(function(j){return I.push(j)})}):console.warn("Unsupported GeoJson geometry type: ".concat(g.type,". Skipping geometry..."));var $=I.map(function(W){var j=k4(W),Y=G4(W,!0).reverse(),z=j[1];return Y.forEach(function(Q){var ee=Q[0];Math.abs(z-ee)>170&&(Q[0]+=z>ee?360:-360)}),{h3Idx:W,hexCenter:j,hexGeoJson:Y}}),k=function(j){var Y=d.__currentTargetD=j,z=Y.alt,Q=Y.margin,ee=Y.curvatureResolution;d.geometry&&d.geometry.dispose(),d.geometry=$.length?(kw.mergeGeometries||kw.mergeBufferGeometries)($.map(function(fe){var le=wi(fe.hexCenter,2),Me=le[0],Ce=le[1];if(S){var Be=po(Me,Ce,z),Ye=po(fe.hexGeoJson[0][1],fe.hexGeoJson[0][0],z),qt=.85*(1-Q)*new dh.Vector3(Be.x,Be.y,Be.z).distanceTo(new dh.Vector3(Ye.x,Ye.y,Ye.z)),bt=new lg(qt,R);return bt.rotateX(Wu(-Me)),bt.rotateY(Wu(Ce)),bt.translate(Be.x,Be.y,Be.z),bt}else{var Re=function(St,mt,Tt){return St-(St-mt)*Tt},qe=Q===0?fe.hexGeoJson:fe.hexGeoJson.map(function(Ke){var St=wi(Ke,2),mt=St[0],Tt=St[1];return[[mt,Ce],[Tt,Me]].map(function(an){var Ut=wi(an,2),Ue=Ut[0],Je=Ut[1];return Re(Ue,Je,Q)})});return new Yv([qe],bi,bi*(1+z),!1,!0,!1,ee)}})):new dh.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?k(U):e.tweenGroup.add(new $s(F).to(U,e.hexPolygonsTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(k).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),Dne=window.THREE?window.THREE:{Vector3:J};function Lne(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(ui(o),ui(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=EO.apply(void 0,ui([i,e].map(function(s){return s.map(function(o){var a=o.x,l=o.y,u=o.z;return[a,l,u]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(o){var a=wi(o,3),l=a[0],u=a[1],d=a[2];return new Dne.Vector3(l,u,d)})}}var Gu=window.THREE?window.THREE:{BufferGeometry:Wn,Color:It,Group:ys,Line:ag,NormalBlending:mr,ShaderMaterial:ws,Vector3:J},Ine=xA.default||xA,q6=Wr({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new Ine,sharedMaterial:new Gu.ShaderMaterial(ti(ti({},B6()),{},{transparent:!0,blending:Gu.NormalBlending}))}},init:function(e,t){pi(e),t.scene=e,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Gu.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=wi(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}
5003).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r;if(o.type==="Line"){var l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a}else if(o.type==="Line2"){for(var u=o.material.dashOffset-a,d=o.material.dashSize+o.material.gapSize;u<=-d;)u+=d;o.material.dashOffset=u}})})},update:function(e){var t=Xe(e.pathPoints),n=Xe(e.pathPointLat),r=Xe(e.pathPointLng),s=Xe(e.pathPointAlt),o=Xe(e.pathStroke),a=Xe(e.pathColor),l=Xe(e.pathDashLength),u=Xe(e.pathDashGap),d=Xe(e.pathDashInitialGap),p=Xe(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,M){var R=o(M),E=R!=null;if(!S.children.length||E===(S.children[0].type==="Line")){pi(S);var N=E?new $te(new E6,new R3):new Gu.Line(new Gu.BufferGeometry,e.sharedMaterial.clone());S.add(N)}var U=S.children[0],L=x(t(M),n,r,s,e.pathResolution),F=p(M);if(U.__dashAnimateStep=F>0?1e3/F:0,E){U.material.resolution=e.rendererSize;{var $=l(M),k=u(M),W=d(M);U.material.dashed=k>0,U.material.dashed?U.material.defines.USE_DASH="":delete U.material.defines.USE_DASH,U.material.dashed&&(U.material.dashScale=1/g(L),U.material.dashSize=$,U.material.gapSize=k,U.material.dashOffset=-W)}{var j=a(M);if(j instanceof Array){var Y=y(a(M),L.length-1,1,!1);U.geometry.setColors(Y.array),U.material.vertexColors=!0}else{var z=j,Q=Bo(z);U.material.color=new Gu.Color(Da(z)),U.material.transparent=Q<1,U.material.opacity=Q,U.material.vertexColors=!1}}U.material.needsUpdate=!0}else{Object.assign(U.material.uniforms,{dashSize:{value:l(M)},gapSize:{value:u(M)},dashOffset:{value:d(M)}});var P=y(a(M),L.length),I=T(L.length,1,!0);U.geometry.setAttribute("color",P),U.geometry.setAttribute("relDistance",I)}var ee=Lne(S.__currentTargetD&&S.__currentTargetD.points||[L[0]],L),fe=function(Be){var Ye=S.__currentTargetD=Be,qt=Ye.stroke,bt=Ye.interpolK,Re=S.__currentTargetD.points=ee(bt);if(E){var qe;U.geometry.setPositions((qe=[]).concat.apply(qe,ui(Re.map(function(Ke){var St=Ke.x,mt=Ke.y,Tt=Ke.z;return[St,mt,Tt]})))),U.material.linewidth=qt,U.material.dashed&&U.computeLineDistances()}else U.geometry.setFromPoints(Re),U.geometry.computeBoundingSphere()},le={stroke:R,interpolK:1},Me=Object.assign({},S.__currentTargetD||le,{interpolK:0});Object.keys(le).some(function(Ce){return Me[Ce]!==le[Ce]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?fe(le):e.tweenGroup.add(new $s(Me).to(le,e.pathTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(fe).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function g(S){var M=0,R;return S.forEach(function(E){R&&(M+=R.distanceTo(E)),R=E}),M}function x(S,M,R,E,N){var U=function(I,$,k){for(var W=[],j=1;j<=k;j++)W.push(I+($-I)*j/(k+1));return W},L=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,k=[],W=null;return I.forEach(function(j){if(W){for(;Math.abs(W[1]-j[1])>180;)W[1]+=360*(W[1]<j[1]?1:-1);var Y=Math.sqrt(Math.pow(j[0]-W[0],2)+Math.pow(j[1]-W[1],2));if(Y>$)for(var z=Math.floor(Y/$),Q=U(W[0],j[0],z),ee=U(W[1],j[1],z),fe=U(W[2],j[2],z),le=0,Me=Q.length;le<Me;le++)k.push([Q[le],ee[le],fe[le]])}k.push(W=j)}),k},F=function(I){var $=wi(I,3),k=$[0],W=$[1],j=$[2],Y=po(k,W,j),z=Y.x,Q=Y.y,ee=Y.z;return new Gu.Vector3(z,Q,ee)};return L(S.map(function(P){return[M(P),R(P),E(P)]}),N).map(F)}function y(S,M){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,E=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,N=M+1,U;if(S instanceof Array||S instanceof Function){var L=S instanceof Array?ul().domain(S.map(function(j,Y){return Y/(S.length-1)})).range(S):S;U=function(Y){return Au(L(Y),E,!0)}}else{var F=Au(S,E,!0);U=function(){return F}}for(var P=[],I=0,$=N;I<$;I++)for(var k=U(I/($-1)),W=0;W<R;W++)P.push(k);return La(P,E?4:3)}function T(S){for(var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,E=S+1,N=[],U=0,L=E;U<L;U++)for(var F=U/(L-1),P=0;P<M;P++)N.push(F);return R&&N.reverse(),La(N,1)}}}),Bp=window.THREE?window.THREE:{Euler:Nr,Mesh:Qn,MeshLambertMaterial:dl,SphereGeometry:Fa},z6=Wr({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new Bp.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;pi(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new Bp.Mesh;
vendor: 4,279 bytes, line 5003
5003return s.__globeObjType="tile",s})},update:function(e){var t=Xe(e.tileLat),n=Xe(e.tileLng),r=Xe(e.tileAltitude),s=Xe(e.tileWidth),o=Xe(e.tileHeight),a=Xe(e.tileUseGlobeProjection),l=Xe(e.tileMaterial),u=Xe(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(d,p){d.material=l(p);var g=a(p),x=u(p),y=function(R){var E=d.__currentTargetD=R,N=E.lat,U=E.lng,L=E.alt,F=E.width,P=E.height,I=ph(U),$=ph(-N);d.geometry&&d.geometry.dispose(),d.geometry=new Bp.SphereGeometry(bi*(1+L),Math.ceil(F/(x||-1)),Math.ceil(P/(x||-1)),ph(90-F/2)+(g?I:0),ph(F),ph(90-P/2)+(g?$:0),ph(P)),g||d.setRotationFromEuler(new Bp.Euler($,I,0,"YXZ"))},T={lat:+t(p),lng:+n(p),alt:+r(p),width:+s(p),height:+o(p)},S=d.__currentTargetD||Object.assign({},T,{width:0,height:0});Object.keys(T).some(function(M){return S[M]!==T[M]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?y(T):e.tweenGroup.add(new $s(S).to(T,e.tilesTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(y).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),ph=function(e){return e*Math.PI/180},wf=window.THREE?window.THREE:{BufferGeometry:Wn,Color:It,Points:p_,PointsMaterial:hd},H6=Wr({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){pi(e),t.scene=e,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new wf.Points(new wf.BufferGeometry,new wf.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=Xe(t.particlesList),o=Xe(t.particleLat),a=Xe(t.particleLng),l=Xe(t.particleAltitude);n.geometry.setAttribute("position",La(s(r).map(function(u){return Object.values(po(o(u),a(u),l(u)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(a){return t.hasOwnProperty(a)})&&e.dataMapper.digest(e.particlesData);var n=Xe(e.particlesColor),r=Xe(e.particlesSize),s=Xe(e.particlesSizeAttenuation),o=Xe(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=wi(a,2),u=l[0],d=l[1];if(d.material.size=r(u),d.material.sizeAttenuation=s(u),e.particlesTexture)d.material.color=new wf.Color(16777215),d.material.transparent=!1,d.material.alphaTest=.5,d.material.map=o(u);else{var p=n(u),g=Bo(p);d.material.color=new wf.Color(Da(p)),d.material.transparent=g<1,d.material.opacity=g,d.material.alphaTest=0}})}}),Bne=window.THREE?window.THREE:{BufferGeometry:Wn},Fne=function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;Xg(this,e),t=jg(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],o=0;o<=r;o++){var a=(o/r-.25)*Math.PI*2;s.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(s),t}return Yg(e,i),Qg(e)}(Bne.BufferGeometry),mh=window.THREE?window.THREE:{Color:It,Group:ys,Line:ag,LineBasicMaterial:BA,Vector3:J},Une=xA.default||xA,W6=Wr({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;pi(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new mh.Group;return s.__globeObjType="ring",s}),t.ticker=new Une,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=Xe(t.ringColor),a=Xe(t.ringAltitude),l=Xe(t.ringMaxRadius),u=Xe(t.ringPropagationSpeed),d=Xe(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(p){var g=wi(p,2),x=g[1];return x}
5003).forEach(function(p){var g=wi(p,2),x=g[0],y=g[1];if((y.__nextRingTime||0)<=s){var T=d(x)/1e3;y.__nextRingTime=s+(T<=0?1/0:T);var S=new mh.Line(new Fne(1,t.ringResolution),new mh.LineBasicMaterial),M=o(x),R=M instanceof Array||M instanceof Function,E;R?M instanceof Array?(E=ul().domain(M.map(function(k,W){return W/(M.length-1)})).range(M),S.material.transparent=M.some(function(k){return Bo(k)<1})):(E=M,S.material.transparent=!0):(S.material.color=new mh.Color(Da(M)),gne(S.material,Bo(M)));var N=bi*(1+a(x)),U=l(x),L=U*Math.PI/180,F=u(x),P=F<=0,I=function(W){var j=W.t,Y=(P?1-j:j)*L;if(S.scale.x=S.scale.y=N*Math.sin(Y),S.position.z=N*(1-Math.cos(Y)),R){var z=E(j);S.material.color=new mh.Color(Da(z)),S.material.transparent&&(S.material.opacity=Bo(z))}};if(F===0)I({t:0}),y.add(S);else{var $=Math.abs(U/F)*1e3;t.tweenGroup.add(new $s({t:0}).to({t:1},$).onUpdate(I).onStart(function(){return y.add(S)}).onComplete(function(){t.tweenGroup.remove(this),y.remove(S),P3(S)}).start())}}})}})},update:function(e){var t=Xe(e.ringLat),n=Xe(e.ringLng),r=Xe(e.ringAltitude),s=e.scene.localToWorld(new mh.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),u=n(a),d=r(a);Object.assign(o.position,po(l,u,d)),o.lookAt(s)}).digest(e.ringsData)}}),One={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},ο:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"¦":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "}
5003,"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},Τ:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},Î :{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},Î:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"²":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"â":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},Î:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},Æ:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},Ï:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"»":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"©":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},Ï:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "}
5003,"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"«":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"â":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},ÿ:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},µ:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},Î:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},Î:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"â":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},Î:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},Ï:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},Ψ:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "}
5003,"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},ι:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},Î:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},ε:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},Î:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"â°":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"â":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},Ï:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"¯":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},Î:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803
50031013 l 803 0 "},Î:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"â¦":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},ν:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"¶":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},β:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644
5003603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},Î:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},Î:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Î:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"â¢":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"Â¥":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},γ:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},α:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"Â":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},Χ:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"â ":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"°":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},Î:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "}," ":{x_min:0,x_max:0,ha:853},Ϋ:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"â":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},Î:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},Î:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},Ï
:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "}
5003,"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},Ï:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},ί:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},Î:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"¨":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"â¹":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"â":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},δ:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},Î:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 43
50036 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},Ï:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"´":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"±":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},Ï:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"§":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},Ω:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},Ï:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"â¢":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},ή:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},Î:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 28
50030 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"®":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},Î:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"³":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},Ï:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},ζ:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},θ:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},Î:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},Î:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 8
500310 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},Î:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Î:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},Ϊ:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"½":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},Ρ:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},ª:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"Î
":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},Φ:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"â":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},Σ:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"âº":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"£":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"¬":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},λ:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},Ï:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 43
50036 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},ξ:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},Î:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},ΰ:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},Î¥:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},μ:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},Ï:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"â":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"â":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},Ï:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257
5003-5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},Ï:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},ά:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "}
5003,"¤":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},κ:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"â¡":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},Ï:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},η:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},kne="normal",Gne=1189,Vne=-100,qne="normal",zne={yMin:-334,xMin:-111,yMax:1189,xMax:1672},Hne=1e3,Wne={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) Îagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"Îagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r 5004\r 5005Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r 5006\r 5007The above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r 5008\r 5009The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word "MgOpen", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r 5010\r 5011This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "MgOpen" name.\r 5012\r 5013The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r 5014\r 5015THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"Îagenta ltd",font_sub_family_name:"Regular"},$ne=-334,jne="Helvetiker",Xne=1522,Qne=50,Yne={glyphs:One,cssFontWeight:kne,ascender:Gne,underlinePosition:Vne,cssFontStyle:qne,boundingBox:zne,resolution:Hne,original_font_information:Wne,desce
vendor: 7,815 bytes, line 5015
5015nder:$ne,familyName:jne,lineHeight:Xne,underlineThickness:Qne},Mo=ti(ti({},window.THREE?window.THREE:{BoxGeometry:pu,CircleGeometry:lg,DoubleSide:Ui,Group:ys,Mesh:Qn,MeshLambertMaterial:dl,TextGeometry:Rw,Vector3:J}),{},{Font:jte,TextGeometry:Rw}),$6=Wr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:Yne,onChange:function(e,t){t.font=new Mo.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;pi(e),t.scene=e,t.tweenGroup=r;var s=new Mo.CircleGeometry(1,32);t.dataMapper=new Ns(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new Mo.MeshLambertMaterial;o.side=Ui;var a=new Mo.Group;a.add(new Mo.Mesh(s,o));var l=new Mo.Mesh(void 0,o);a.add(l);var u=new Mo.Mesh;return u.visible=!1,l.add(u),a.__globeObjType="label",a})},update:function(e){var t=Xe(e.labelLat),n=Xe(e.labelLng),r=Xe(e.labelAltitude),s=Xe(e.labelText),o=Xe(e.labelSize),a=Xe(e.labelRotation),l=Xe(e.labelColor),u=Xe(e.labelIncludeDot),d=Xe(e.labelDotRadius),p=Xe(e.labelDotOrientation),g=new Set(["right","top","bottom"]),x=2*Math.PI*bi/360;e.dataMapper.onUpdateObj(function(y,T){var S=wi(y.children,2),M=S[0],R=S[1],E=wi(R.children,1),N=E[0],U=l(T),L=Bo(U);R.material.color.set(Da(U)),R.material.transparent=L<1,R.material.opacity=L;var F=u(T),P=p(T);!F||!g.has(P)&&(P="bottom");var I=F?+d(T)*x:1e-12;M.scale.x=M.scale.y=I;var $=+o(T)*x;if(R.geometry&&R.geometry.dispose(),R.geometry=new Mo.TextGeometry(s(T),{font:e.font,size:$,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),N.geometry&&N.geometry.dispose(),R.geometry.computeBoundingBox(),N.geometry=C3(Mo.BoxGeometry,ui(new Mo.Vector3().subVectors(R.geometry.boundingBox.max,R.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),P!=="right"&&R.geometry.center(),F){var k=I+$/2;P==="right"&&(R.position.x=k),R.position.y={right:-$/2,top:k+$/2,bottom:-k-$/2}[P]}var W=function(Q){var ee=y.__currentTargetD=Q,fe=ee.lat,le=ee.lng,Me=ee.alt,Ce=ee.rot,Be=ee.scale;Object.assign(y.position,po(fe,le,Me)),y.lookAt(e.scene.localToWorld(new Mo.Vector3(0,0,0))),y.rotateY(Math.PI),y.rotateZ(-Ce*Math.PI/180),y.scale.x=y.scale.y=y.scale.z=Be},j={lat:+t(T),lng:+n(T),alt:+r(T),rot:+a(T),scale:1},Y=y.__currentTargetD||Object.assign({},j,{scale:1e-12});Object.keys(j).some(function(z){return Y[z]!==j[z]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?W(j):e.tweenGroup.add(new $s(Y).to(j,e.labelsTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(W).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),Kne=ti(ti({},window.THREE?window.THREE:{}),{},{CSS2DObject:Yte}),j6=Wr({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=wi(r,2),o=s[1];return o}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;pi(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=Xe(t.htmlElement)(s),a=new Kne.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=Xe(e.htmlLat),s=Xe(e.htmlLng),o=Xe(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var u=function(g){var x=a.__currentTargetD=g,y=x.alt,T=x.lat,S=x.lng;Object.assign(a.position,po(T,S,y)),n.updateObjVisibility(a)},d={lat:+r(l),lng:+s(l),alt:+o(l)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!a.__currentTargetD?u(d):e.tweenGroup.add(new $s(a.__currentTargetD).to(d,e.htmlTransitionDuration).easing(Cr.Quadratic.InOut).onUpdate(u).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),Fp=window.THREE?window.THREE:{Group:ys,Mesh:Qn,MeshLambertMaterial:dl,SphereGeometry:Fa},X6=Wr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new Fp.Mesh(new Fp.SphereGeometry(1,16,8),new Fp.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){pi(e),t.scene=e,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=Xe(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new Fp.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=Xe(e.objectLat),r=Xe(e.objectLng),s=Xe(e.objectAltitude),o=Xe(e.objectFacesSurface),a=Xe(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,u){var d=+n(u),p=+r(u),g=+s(u);Object.assign(l.position,po(d,p,g)),o(u)?l.setRotationFromEuler(new Nr(Wu(-d),Wu(p),0,"YXZ")):l.rotation.set(0,0,0);var x=l.children[0],y=a(u);y&&x.setRotationFromEuler(new Nr(Wu(y.x||0),Wu(y.y||0),Wu(y.z||0)))}).digest(e.objectsData)}}),Q6=Wr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){pi(e),t.scene=e,t.dataMapper=new Ns(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=Xe(t.customThreeObject)(n,bi);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||pi(e.scene);var n=Xe(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,bi)}).digest(e.customLayerData)}}),Up=window.THREE?window.THREE:{Camera:cg,Group:ys,Vector2:We,Vector3:J},Zne=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Y6=As("globeLayer",L6),Jne=Object.assign.apply(Object,ui(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return xr({},i,Y6.linkProp(i))}))),eie=Object.assign.apply(Object,ui(["globeMaterial","globeTileEngineClearCache"].map(function(i){return xr({},i,Y6.linkMethod(i))}))),tie=As("pointsLayer",I6),nie=Object.assign.apply(Object,ui(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return xr({},i,tie.linkProp(i))}))),iie=As("arcsLayer",F6),rie=Object.assign.apply(Object,ui(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return xr({},i,iie.linkProp(i))}))),sie=As("hexBinLayer",U6),oie=Object.assign.apply(Object,ui(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinRes
5015olution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return xr({},i,sie.linkProp(i))}))),aie=As("heatmapsLayer",k6),lie=Object.assign.apply(Object,ui(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return xr({},i,aie.linkProp(i))}))),uie=As("hexedPolygonsLayer",V6),cie=Object.assign.apply(Object,ui(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return xr({},i,uie.linkProp(i))}))),hie=As("polygonsLayer",G6),Aie=Object.assign.apply(Object,ui(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return xr({},i,hie.linkProp(i))}))),fie=As("pathsLayer",q6),die=Object.assign.apply(Object,ui(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return xr({},i,fie.linkProp(i))}))),pie=As("tilesLayer",z6),mie=Object.assign.apply(Object,ui(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return xr({},i,pie.linkProp(i))}))),gie=As("particlesLayer",H6),_ie=Object.assign.apply(Object,ui(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return xr({},i,gie.linkProp(i))}))),xie=As("ringsLayer",W6),vie=Object.assign.apply(Object,ui(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return xr({},i,xie.linkProp(i))}))),yie=As("labelsLayer",$6),bie=Object.assign.apply(Object,ui(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return xr({},i,yie.linkProp(i))}))),Sie=As("htmlElementsLayer",j6),Tie=Object.assign.apply(Object,ui(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return xr({},i,Sie.linkProp(i))}))),Mie=As("objectsLayer",X6),wie=Object.assign.apply(Object,ui(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return xr({},i,Mie.linkProp(i))}))),Eie=As("customLayer",Q6),Rie=Object.assign.apply(Object,ui(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return xr({},i,Eie.linkProp(i))}))),Cie=Wr({props:ti(ti(ti(ti(ti(ti(ti(ti(ti(ti(ti(ti(ti(ti(ti({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new Up.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},Jne),nie),rie),oie),lie),Aie),cie),die),mie),_ie),vie),bie),Tie),wie),Rie),methods:ti({getGlobeRadius:Pw,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return po.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return D6.apply(void 0,n)}
5015,setPointOfView:function(e,t){var n=t instanceof Up.Camera?t.position:t,r=Pw(),s=void 0;if(e.scene&&n){var o,a,l,u;s=function(p){o===void 0&&(o=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),a===void 0&&(a=o.length()),l===void 0&&(l=Math.sqrt(Math.pow(a,2)-Math.pow(r,2))),u===void 0&&(u=Math.acos(l/a));var g=o.distanceTo(p);if(g<l)return!1;var x=p.length(),y=Math.acos((Math.pow(a,2)+Math.pow(g,2)-Math.pow(x,2))/(2*a*g));return y<u}}e.layersThatNeedUpdatePov.forEach(function(d){return d.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(d){return d.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},eie),stateInit:function(){var e=new DE,t={tweenGroup:e},n={globeLayer:L6(t),pointsLayer:I6(t),arcsLayer:F6(t),hexBinLayer:U6(t),heatmapsLayer:k6(t),polygonsLayer:G6(t),hexedPolygonsLayer:V6(t),pathsLayer:q6(t),tilesLayer:z6(t),particlesLayer:H6(t),ringsLayer:W6(t),labelsLayer:$6(t),htmlElementsLayer:j6(t),objectsLayer:X6(t),customLayer:Q6(t)};return ti(ti({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,o=n.waitForGlobeReady,a=o===void 0?!0:o;pi(e),t.scene=e,t.scene.visible=!1,Zne.forEach(function(u){var d=new Up.Group;t.scene.add(d),t[u](d)});var l=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new $s({k:1e-6}).to({k:1},600).easing(Cr.Quadratic.Out).onUpdate(function(p){var g=p.k;return t.scene.scale.set(g,g,g)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var d=new Up.Vector3(0,1,0);t.tweenGroup.add(new $s({rot:Math.PI*2}).to({rot:0},1200).easing(Cr.Quintic.Out).onUpdate(function(p){var g=p.rot;return t.scene.setRotationFromAxisAngle(d,g)}).onComplete(function(){t.tweenGroup.remove(this)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(l):l(),this._animationCycle()},update:function(e){}});function Nie(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=function(r){function s(){var o;Xg(this,s);for(var a=arguments.length,l=new Array(a),u=0;u<a;u++)l[u]=arguments[u];return o=jg(this,s,[].concat(l)),o.__kapsuleInstance=C3(i,[].concat(ui(t?[o]:[]),l)),o}return Yg(s,r),Qg(s)}(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),n}var Pie=window.THREE?window.THREE:{Group:ys},Die=Nie(Cie,Pie.Group,!0);const Gw={type:"change"},L3={type:"start"},K6={type:"end"},Op=new Bd,Vw=new oa,Lie=Math.cos(70*og.DEG2RAD),ir=new J,ms=2*Math.PI,fi={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},u_=1e-6;class Iie extends iL{constructor(e,t=null){super(e,t),this.state=fi.NONE,this.target=new J,this.cursor=new J,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LE
5015FT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Eh.ROTATE,MIDDLE:Eh.DOLLY,RIGHT:Eh.PAN},this.touches={ONE:vh.ROTATE,TWO:vh.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new J,this._lastQuaternion=new ll,this._lastTargetPosition=new J,this._quat=new ll().setFromUnitVectors(e.up,new J(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new oS,this._sphericalDelta=new oS,this._scale=1,this._panOffset=new J,this._rotateStart=new We,this._rotateEnd=new We,this._rotateDelta=new We,this._panStart=new We,this._panEnd=new We,this._panDelta=new We,this._dollyStart=new We,this._dollyEnd=new We,this._dollyDelta=new We,this._dollyDirection=new J,this._mouse=new We,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Fie.bind(this),this._onPointerDown=Bie.bind(this),this._onPointerUp=Uie.bind(this),this._onContextMenu=Hie.bind(this),this._onMouseWheel=Gie.bind(this),this._onKeyDown=Vie.bind(this),this._onTouchStart=qie.bind(this),this._onTouchMove=zie.bind(this),this._onMouseDown=Oie.bind(this),this._onMouseMove=kie.bind(this),this._interceptControlDown=Wie.bind(this),this._interceptControlUp=$ie.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Gw),this.update(),this.state=fi.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const t=this.object.position;ir.copy(t).sub(this.target),ir.applyQuaternion(this._quat),this._spherical.setFromVector3(ir),this.autoRotate&&this.state===fi.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=ms:n>Math.PI&&(n-=ms),r<-Math.PI?r+=ms:r>Math.PI&&(r-=ms),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radiu
vendor: 14,293 bytes, line 5015
5015s=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ir.setFromSpherical(this._spherical),ir.applyQuaternion(this._quatInverse),t.copy(this.target).add(ir),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=ir.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new J(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const u=new J(this._mouse.x,this._mouse.y,0);u.unproject(this.object),this.object.position.sub(u).add(a),this.object.updateMatrixWorld(),o=ir.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Op.origin.copy(this.object.position),Op.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Op.direction))<Lie?this.object.lookAt(this.target):(Vw.setFromNormalAndCoplanarPoint(this.object.up,this.target),Op.intersectPlane(Vw,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>u_||8*(1-this._lastQuaternion.dot(this.object.quaternion))>u_||this._lastTargetPosition.distanceToSquared(this.target)>u_?(this.dispatchEvent(Gw),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?ms/60*this.autoRotateSpeed*e:ms/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ir.setFromMatrixColumn(t,0),ir.multiplyScalar(-e),this._panOffset.add(ir)}_panUp(e,t){this.screenSpacePanning===!0?ir.setFromMatrixColumn(t,1):(ir.setFromMatrixColumn(t,0),ir.crossVectors(this.object.up,ir)),ir.multiplyScalar(e),this._panOffset.add(ir)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;ir.copy(r).sub(this.target);let s=ir.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(ms*this._rotateDelta.x/t.clientHeight),this._rotateUp(ms*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(ms*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-ms*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(ms*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-ms*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(ms*this._rotateDelta.x/t.clientHeight),this._rotateUp(ms*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new We,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function Bie(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function Fie(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function Uie(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(K6),this.state=fi.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function Oie(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Eh.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=fi.DOLLY;break;case Eh.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=fi.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=fi.ROTATE}break;case Eh.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=fi.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=fi.PAN}break;default:this.state=fi.NONE}this.state!==fi.NONE&&this.dispatchEvent(L3)}function kie(i){switch(this.state){case fi.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case fi.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case fi.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function Gie(i){this.enabled===!1||this.enableZoom===!1||this.state!==fi.NONE||(i.preventDefault(),this.dispatchEvent(L3),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(K6))}function Vie(i){this.enabled!==!1&&this._handleKeyDown(i)}function qie(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case vh.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=fi.TOUCH_ROTATE;break;case vh.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=fi.TOUCH_PAN;break;default:this.state=fi.NONE}break;case 2:switch(this.touches.TWO){case vh.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=fi.TOUCH_DOLLY_PAN;break;case vh.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=fi.TOUCH_DOLLY_ROTATE;break;default:this.state=fi.NONE}break;default:this.state=fi.NONE}this.state!==fi.NONE&&this.dispatchEvent(L3)}function zie(i){switch(this._trackPointer(i),this.state){case fi.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case fi.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case fi.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case fi.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=fi.NONE}}function Hie(i){this.enabled!==!1&&i.preventDefault()}function Wie(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function $ie(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const Jie=()=>{const i=Sb.useRef(null);return Sb.useEffect(()=>{const e=i.current;if(!e)return;const t=e.clientWidth,n=e.clientHeight,r=new _v,s=new pr(60,t/n,.1,2e3);s.position.z=250;const o=new K9({alpha:!0,antialias:!0,powerPreference:"high-performance"});o.setSize(t,n),o.setPixelRatio(window.devicePixelRatio),o.setClearColor(0,0),o.outputColorSpace
5015=Tr,e.appendChild(o.domElement);const a=new Iie(s,o.domElement);a.enableDamping=!0,a.enableZoom=!0,a.enablePan=!1,a.enableRotate=!1;const l=new ZD,u=new We,d=new fl(new J(0,0,0),100),p=new Die;r.add(p),fetch("https://raw.githubusercontent.com/holtzy/D3-graph-gallery/master/DATA/world.geojson").then(P=>P.json()).then(P=>{p.polygonsData(P.features).polygonAltitude(.02).polygonCapColor(()=>"rgba(51,207,255,0.85)").polygonSideColor(()=>"rgba(0,150,255,0.5)").polygonStrokeColor(()=>"rgba(255,255,255,0.4)")}),p.globeMaterial(new qs({color:6740479,transparent:!0,opacity:.45})),r.add(new Qn(new Fa(101,64,64),new qs({color:6740479,transparent:!0,opacity:.25,side:Xn,depthWrite:!1})));const g=new Wn,x=[];for(let P=0;P<1200;P++){const I=110+Math.random()*10,$=Math.random()*Math.PI*2,k=Math.acos(Math.random()*2-1);x.push(I*Math.sin(k)*Math.cos($),I*Math.sin(k)*Math.sin($),I*Math.cos(k))}g.setAttribute("position",new Fn(x,3));const T=new Pv().load("https://threejs.org/examples/textures/sprites/circle.png"),S=new p_(g,new hd({color:666206,size:.7,map:T,transparent:!0,opacity:.75,depthWrite:!1,blending:Aa,alphaTest:.01}));r.add(S);const M=new Wn,R=[];for(let P=0;P<3e3;P++)R.push((Math.random()-.5)*2e3,(Math.random()-.5)*2e3,(Math.random()-.5)*2e3);M.setAttribute("position",new Fn(R,3)),r.add(new p_(M,new hd({color:16777215,size:1.2,transparent:!0,opacity:.8,depthWrite:!1,blending:Aa})));const E=window.matchMedia("(pointer: coarse)").matches,N=P=>{if(E)return;const I=o.domElement.getBoundingClientRect();u.x=(P.clientX-I.left)/I.width*2-1,u.y=-((P.clientY-I.top)/I.height)*2+1,l.setFromCamera(u,s),a.enableRotate=!!l.ray.intersectSphere(d,new J)};o.domElement.addEventListener("pointermove",N),E&&(o.domElement.style.touchAction="pan-y",a.enabled=!1);let U;const L=()=>{U=requestAnimationFrame(L),S.rotation.y+=25e-5,p.rotation.y+=4e-4,a.update(),o.render(r,s)};L();const F=()=>{const P=e.clientWidth,I=e.clientHeight;s.aspect=P/I,s.updateProjectionMatrix(),o.setSize(P,I)};return window.addEventListener("resize",F),()=>{cancelAnimationFrame(U),window.removeEventListener("resize",F),o.domElement.removeEventListener("pointermove",N),o.dispose(),e.contains(o.domElement)&&e.removeChild(o.domElement)}},[]),FP.jsx("div",{ref:i,className:"w-full h-[360px] lg:h-[490px] relative"})};export{Jie 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.