vendor: 8,059 bytes, line 1
1import{R as e,S as t,U as n,V as i,W as r,X as s,Y as a,Z as o,_ as l,a0 as u,a1 as c,a2 as h,a3 as d,a4 as p,a5 as m,a6 as f,i as g,a7 as _,a as y,T as v,E as x,a8 as b,a9 as T,aa as S,ab as M,ac as w,ad as E,ae as A,af as R,G as C,ag as N,ah as P,ai as I,aj as L,ak as D,al as O,am as U,an as F,ao as B}from"./B2wcfEwC.js";const V="180",q={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},z={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},k=0,G=1,H=2,j=100,W=101,X=102,$=200,Y=201,K=202,Z=203,J=204,Q=205,ee=206,te=207,ne=208,ie=209,re=210,se=211,ae=212,oe=213,le=214,ue=0,ce=1,he=2,de=3,pe=4,me=5,fe=6,ge=7,_e="attached",ye="detached",ve=300,xe=301,be=302,Te=303,Se=304,Me=306,we=1e3,Ee=1001,Ae=1002,Re=1003,Ce=1004,Ne=1005,Pe=1006,Ie=1007,Le=1008,De=1009,Oe=1010,Ue=1011,Fe=1012,Be=1013,Ve=1014,qe=1015,ze=1016,ke=1017,Ge=1018,He=1020,je=35902,We=35899,Xe=1021,$e=1022,Ye=1023,Ke=1026,Ze=1027,Je=1028,Qe=1029,et=1030,tt=1031,nt=1033,it=33776,rt=33777,st=33778,at=33779,ot=35840,lt=35841,ut=35842,ct=35843,ht=36196,dt=37492,pt=37496,mt=37808,ft=37809,gt=37810,_t=37811,yt=37812,vt=37813,xt=37814,bt=37815,Tt=37816,St=37817,Mt=37818,wt=37819,Et=37820,At=37821,Rt=36492,Ct=36494,Nt=36495,Pt=36283,It=36284,Lt=36285,Dt=36286,Ot=2300,Ut=2301,Ft=2302,Bt=2400,Vt=2401,qt=2402,zt=2500,kt=2501,Gt="",Ht="srgb",jt="srgb-linear",Wt="linear",Xt="srgb",$t=7680,Yt=519,Kt=512,Zt=513,Jt=514,Qt=515,en=516,tn=517,nn=518,rn=519,sn=35044,an=35048,on="300 es",ln=2e3,un=2001,cn={COMPUTE:"compute",RENDER:"render"};class hn{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return void 0!==n&&(void 0!==n[e]&&-1!==n[e].indexOf(t))}removeEventListener(e,t){const n=this._listeners;if(void 0===n)return;const i=n[e];if(void 0!==i){const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){const t=this._listeners;if(void 0===t)return;const n=t[e.type];if(void 0!==n){e.target=this;const t=n.slice(0);for(let n=0,i=t.length;n<i;n++)t[n].call(this,e);e.target=null}}}const dn=["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 pn=1234567;const mn=Math.PI/180,fn=180/Math.PI;function gn(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(dn[255&e]+dn[e>>8&255]+dn[e>>16&255]+dn[e>>24&255]+"-"+dn[255&t]+dn[t>>8&255]+"-"+dn[t>>16&15|64]+dn[t>>24&255]+"-"+dn[63&n|128]+dn[n>>8&255]+"-"+dn[n>>16&255]+dn[n>>24&255]+dn[255&i]+dn[i>>8&255]+dn[i>>16&255]+dn[i>>24&255]).toLowerCase()}function _n(e,t,n){return Math.max(t,Math.min(n,e))}function yn(e,t){return(e%t+t)%t}function vn(e,t,n){return(1-n)*e+n*t}function xn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function bn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const Tn={DEG2RAD:mn,RAD2DEG:fn,generateUUID:gn,clamp:_n,euclideanModulo:yn,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:vn,damp:function(e,t,n,i){return vn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(yn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(pn=e);let t=pn+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*mn},radToDeg:function(e){return e*fn},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),u=s((t+i)/2),c=a((t+i)/2),h=s((t-i)/2),d=a((t-i)/2),p=s((i-t)/2),m=a((i-t)/2);switch(r){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*m,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*m,o*u);break;case"ZYZ":e.set(l*m,l*p,o*c,o*u)}},normalize:bn,denormalize:xn};class Sn{constructor(e=0,t=0){Sn.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=_n(this.x,e.x,t.x),this.y=_n(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=_n(this.x,e,t),this.y=_n(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(_n(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}
vendor: 4,480 bytes, line 1
1round(){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(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(_n(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Mn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,a){let o=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3];const h=r[s+0],d=r[s+1],p=r[s+2],m=r[s+3];if(0===a)return e[t+0]=o,e[t+1]=l,e[t+2]=u,void(e[t+3]=c);if(1===a)return e[t+0]=h,e[t+1]=d,e[t+2]=p,void(e[t+3]=m);if(c!==m||o!==h||l!==d||u!==p){let e=1-a;const t=o*h+l*d+u*p+c*m,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*e+h*r,l=l*e+d*r,u=u*e+p*r,c=c*e+m*r,e===1-a){const e=1/Math.sqrt(o*o+l*l+u*u+c*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],u=n[i+3],c=r[s],h=r[s+1],d=r[s+2],p=r[s+3];return e[t]=a*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-a*d,e[t+2]=l*p+u*d+a*h-o*c,e[t+3]=u*p-a*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,s=e._order,a=Math.cos,o=Math.sin,l=a(n/2),u=a(i/2),c=a(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],a=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+a+c;if(h>0){const e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>a&&n>c){const e=2*Math.sqrt(1+n-a-c);this._w=(u-o)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(a>c){const e=2*Math.sqrt(1+a-n-c);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(o+u)/e}else{const e=2*Math.sqrt(1+c-n-a);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>
vendor: 6,068 bytes, line 1
1Math.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(_n(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,a=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+s*a+i*l-r*o,this._y=i*u+s*o+r*a-n*l,this._z=r*u+s*l+n*o-i*a,this._w=s*u-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(o),u=Math.atan2(l,a),c=Math.sin((1-t)*u)/l,h=Math.sin(t*u)/l;return this._w=s*c+this._w*h,this._x=n*c+this._x*h,this._y=i*c+this._y*h,this._z=r*c+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class wn{constructor(e=0,t=0,n=0){wn.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(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(An.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(An.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,a=e.z,o=e.w,l=2*(s*i-a*n),u=2*(a*t-r*i),c=2*(r*n-s*t);return this.x=t+o*l+s*c-a*u,this.y=n+o*u+a*l-r*c,this.z=i+o*c+r*u-s*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=_n(this.x,e.x,t.x),this.y=_n(this.y,e.y,t.y),this.z=_n(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=_n(this.x,e,t),this.y=_n(this.y,e,t),this.z=_n(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(_n(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}
vendor: 4,519 bytes, line 1
1round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,a=t.y,o=t.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return En.copy(this).projectOnVector(e),this.sub(En)}reflect(e){return this.sub(En.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(_n(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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=2*Math.random()-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 En=new wn,An=new Mn;class Rn{constructor(e,t,n,i,r,s,a,o,l){Rn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,a,o,l)}set(e,t,n,i,r,s,a,o,l){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=r,u[5]=o,u[6]=n,u[7]=s,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],_=i[1],y=i[4],v=i[7],x=i[2],b=i[5],T=i[8];return r[0]=s*m+a*_+o*x,r[3]=s*f+a*y+o*b,r[6]=s*g+a*v+o*T,r[1]=l*m+u*_+c*x,r[4]=l*f+u*y+c*b,r[7]=l*g+u*v+c*T,r[2]=h*m+d*_+p*x,r[5]=h*f+d*y+p*b,r[8]=h*g+d*v+p*T,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],u=e[8];
vendor: 4,593 bytes, line 1
1return t*s*u-t*a*l-n*r*u+n*a*o+i*r*l-i*s*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],c=u*s-a*l,h=a*o-u*r,d=l*r-s*o,p=t*c+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=c*m,e[1]=(i*l-u*n)*m,e[2]=(a*n-i*s)*m,e[3]=h*m,e[4]=(u*t-i*o)*m,e[5]=(i*r-a*t)*m,e[6]=d*m,e[7]=(n*o-l*t)*m,e[8]=(s*t-n*r)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+e,-i*l,i*o,-i*(-l*s+o*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Cn.makeScale(e,t)),this}rotate(e){return this.premultiply(Cn.makeRotation(-e)),this}translate(e,t){return this.premultiply(Cn.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const Cn=new Rn;function Nn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}const Pn={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function In(e,t){return new Pn[e](t)}function Ln(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Dn(){const e=Ln("canvas");return e.style.display="block",e}const On={};function Un(e){e in On||(On[e]=!0)}const Fn=(new Rn).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Bn=(new Rn).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Vn(){const e={enabled:!0,workingColorSpace:jt,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n?(this.spaces[t].transfer===Xt&&(e.r=zn(e.r),e.g=zn(e.g),e.b=zn(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Xt&&(e.r=kn(e.r),e.g=kn(e.g),e.b=kn(e.b)),e):e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===Gt?Wt:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return Un("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return Un("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return e.define({[jt]:{primaries:t,whitePoint:i,transfer:Wt,toXYZ:Fn,fromXYZ:Bn,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Ht},outputColorSpaceConfig:{drawingBufferColorSpace:Ht}},[Ht]:{primaries:t,whitePoint:i,transfer:Xt,toXYZ:Fn,fromXYZ:Bn,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Ht}}}),e}const qn=Vn();function zn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}
vendor: 1,092 bytes, line 1
1function kn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let Gn;class Hn{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{void 0===Gn&&(Gn=Ln("canvas")),Gn.width=e.width,Gn.height=e.height;const t=Gn.getContext("2d");e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Gn}return n.toDataURL(t)}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=Ln("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*zn(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*zn(t[e]/255
vendor: 4,220 bytes, line 1
1)):t[e]=zn(t[e]);return{data:t,width:e.width,height:e.height}}return e}}let jn=0;class Wn{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:jn++}),this.uuid=gn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(Xn(i[t].image)):e.push(Xn(i[t]))}else e=Xn(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function Xn(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?Hn.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:{}}let $n=0;const Yn=new wn;class Kn extends hn{constructor(e=Kn.DEFAULT_IMAGE,t=Kn.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,a=1023,o=1009,l=Kn.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$n++}),this.uuid=gn(),this.name="",this.source=new Wn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Sn(0,0),this.repeat=new Sn(1,1),this.center=new Sn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Rn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,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(Yn).x}get height(){return this.source.getSize(Yn).y}get depth(){return this.source.getSize(Yn).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(void 0===n)continue;const i=this[t];void 0!==i&&(i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n)}}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])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.t
vendor: 4,906 bytes, line 1
1ype,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!==ve)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case we:e.x=e.x-Math.floor(e.x);break;case Ee:e.x=e.x<0?0:1;break;case Ae:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case we:e.y=e.y-Math.floor(e.y);break;case Ee:e.y=e.y<0?0:1;break;case Ae:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}Kn.DEFAULT_IMAGE=null,Kn.DEFAULT_MAPPING=ve,Kn.DEFAULT_ANISOTROPY=1;class Zn{constructor(e=0,t=0,n=0,i=1){Zn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,a=.1,o=e.elements,l=o[0],u=o[4],c=o[8],h=o[1],d=o[5],p=o[9],m=o[2],f=o[6],g=o[10];if(Math.abs(u-h)<s&&Math.abs(c-m)<s&&Math.abs(p-f)<s){if(Math.abs(u+h)<a&&Math.abs(c+m)<a&&Math.abs(p+f)<a&&Math.abs(l+d+g-3)<a)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,o=(d+1)/2,_=(g+1)/2,y=(u+h)/4,v=(c+m)/4,x=(p+f)/4;return e>o&&e>_?e<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=y/n,r=v/n):o>_?o<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=y/i,r=x/i):_<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(_),n=v/r,i=x/r),this.set(n,i,r,t),this}let _=Math.sqrt((f-p)*(f-p)+(c-m)*(c-m)+(h-u)*(h-u));return Math.abs(_)<.001&&(_=1),this.x=(f-p)/_,this.y=(c-m)/_,this.z=(h-u)/_,this.w=Math.acos((l+d+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=_n(this.x,e.x,t.x),this.y=_n(this.y,e.y,t.y),this.z=_n(this.z,e.z,t.z),this.w=_n(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=_n(this.x,e,t),this.y=_n(this.y,e,t),this.z=_n(this.z,e,t),this.w=_n(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(_n(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}
vendor: 18,189 bytes, line 1
1round(){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 Jn extends hn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Pe,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 Zn(0,0,e,t),this.scissorTest=!1,this.viewport=new Zn(0,0,e,t);const i={width:e,height:t,depth:n.depth},r=new Kn(i);this.textures=[];const s=n.count;for(let a=0;a<s;a++)this.textures[a]=r.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:Pe,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(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){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isArrayTexture=this.textures[i].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 n=Object.assign({},e.textures[t].image);this.textures[t].source=new Wn(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Qn extends Jn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ei extends Kn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Re,this.minFilter=Re,this.wrapR=Ee,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class ti extends Kn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Re,this.minFilter=Re,this.wrapR=Ee,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ni{constructor(e=new wn(1/0,1/0,1/0),t=new wn(-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(ri.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(ri.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=ri.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(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,ri):ri.fromBufferAttribute(i,t),ri.applyMatrix4(e.matrixWorld),this.expandByPoint(ri);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),si.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),si.copy(n.boundingBox)),si.applyMatrix4(e.matrixWorld),this.union(si)}const i=e.children;for(let r=0,s=i.length;r<s;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ri),ri.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(di),pi.subVectors(this.max,di),ai.subVectors(e.a,di),oi.subVectors(e.b,di),li.subVectors(e.c,di),ui.subVectors(oi,ai),ci.subVectors(li,oi),hi.subVectors(ai,li);let t=[0,-ui.z,ui.y,0,-ci.z,ci.y,0,-hi.z,hi.y,ui.z,0,-ui.x,ci.z,0,-ci.x,hi.z,0,-hi.x,-ui.y,ui.x,0,-ci.y,ci.x,0,-hi.y,hi.x,0];return!!gi(t,ai,oi,li,pi)&&(t=[1,0,0,0,1,0,0,0,1],!!gi(t,ai,oi,li,pi)&&(mi.crossVectors(ui,ci),t=[mi.x,mi.y,mi.z],gi(t,ai,oi,li,pi)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ri).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(ri).length()),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()||(ii[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ii[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ii[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ii[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ii[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ii[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ii[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ii[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ii)),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 ii=[new wn,new wn,new wn,new wn,new wn,new wn,new wn,new wn],ri=new wn,si=new ni,ai=new wn,oi=new wn,li=new wn,ui=new wn,ci=new wn,hi=new wn,di=new wn,pi=new wn,mi=new wn,fi=new wn;function gi(e,t,n,i,r){for(let s=0,a=e.length-3;s<=a;s+=3){fi.fromArray(e,s);const a=r.x*Math.abs(fi.x)+r.y*Math.abs(fi.y)+r.z*Math.abs(fi.z),o=t.dot(fi),l=n.dot(fi),u=i.dot(fi);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>a)return!1}return!0}const _i=new ni,yi=new wn,vi=new wn;class xi{constructor(e=new wn,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;void 0!==t?n.copy(t):_i.setFromPoints(e).getCenter(n);let i=0;for(let r=0,s=e.length;r<s;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;yi.subVectors(e,this.center);const t=yi.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(yi,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(vi.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(yi.copy(e.center).add(vi)),this.expandByPoint(yi.copy(e.center).sub(vi))),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}}const bi=new wn,Ti=new wn,Si=new wn,Mi=new wn,wi=new wn,Ei=new wn,Ai=new wn;class Ri{constructor(e=new wn,t=new wn(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,bi)),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=bi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(bi.copy(this.origin).addScaledVector(this.direction,t),bi.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ti.copy(e).add(t).multiplyScalar(.5),Si.copy(t).sub(e).normalize(),Mi.copy(this.origin).sub(Ti);const r=.5*e.distanceTo(t),s=-this.direction.dot(Si),a=Mi.dot(this.direction),o=-Mi.dot(Si),l=Mi.lengthSq(),u=Math.abs(1-s*s);let c,h,d,p;if(u>0)if(c=s*o-a,h=s*a-o,p=r*u,c>=0)if(h>=-p)if(h<=p){const e=1/u;c*=e,h*=e,d=c*(c+s*h+2*a)+h*(s*c+h+2*o)+l}else h=r,c=Math.max(0,-(s*h+a)),d=-c*c+h*(h+2*o)+l;else h=-r,c=Math.max(0,-(s*h+a)),d=-c*c+h*(h+2*o)+l;else h<=-p?(c=Math.max(0,-(-s*r+a)),h=c>0?-r:Math.min(Math.max(-r,-o),r),d=-c*c+h*(h+2*o)+l):h<=p?(c=0,h=Math.min(Math.max(-r,-o),r),d=h*(h+2*o)+l):(c=Math.max(0,-(s*r+a)),h=c>0?r:Math.min(Math.max(-r,-o),r),d=-c*c+h*(h+2*o)+l);else h=s>0?-r:r,c=Math.max(0,-(s*h+a)),d=-c*c+h*(h+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,c),i&&i.copy(Ti).addScaledVector(Si,h),d}intersectSphere(e,t){bi.subVectors(e.center,this.origin);const n=bi.dot(this.direction),i=bi.dot(bi)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return o<0?null:a<0?this.at(o,t):this.at(a,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?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 null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,a,o;const l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,s=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,s=(e.min.y-h.y)*u),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),c>=0?(a=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(a=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o<i||i!=i)&&(i=o),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,bi)}intersectTriangle(e,t,n,i,r){wi.subVectors(t,e),Ei.subVectors(n,e),Ai.crossVectors(wi,Ei);let s,a=this.direction.dot(Ai);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Mi.subVectors(this.origin,e);const o=s*this.direction.dot(Ei.crossVectors(Mi,Ei));if(o<0)return null;const l=s*this.direction.dot(wi.cross(Mi));if(l<0)return null;if(o+l>a)return null;const u=-s*Mi.dot(Ai);return u<0?null:this.at(u/a,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ci{constructor(e,t,n,i,r,s,a,o,l,u,c,h,d,p,m,f){Ci.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,a,o,l,u,c,h,d,p,m,f)}set(e,t,n,i,r,s,a,o,l,u,c,h,d,p,m,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=m,g[15]=f,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 Ci).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Ni.setFromMatrixColumn(e,0).length(),r=1/Ni.setFromMatrixColumn(e,1).length(),s=1/Ni.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){const e=s*u,n=s*c,i=a*u,r=a*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-a*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*o}
vendor: 4,632 bytes, line 1
1else if("YXZ"===e.order){const e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e+r*a,t[4]=i*a-n,t[8]=s*l,t[1]=s*c,t[5]=s*u,t[9]=-a,t[2]=n*a-i,t[6]=r+e*a,t[10]=s*o}else if("ZXY"===e.order){const e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e-r*a,t[4]=-s*c,t[8]=i+n*a,t[1]=n+i*a,t[5]=s*u,t[9]=r-e*a,t[2]=-s*l,t[6]=a,t[10]=s*o}else if("ZYX"===e.order){const e=s*u,n=s*c,i=a*u,r=a*c;t[0]=o*u,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*c,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=a*o,t[10]=s*o}else if("YZX"===e.order){const e=s*o,n=s*l,i=a*o,r=a*l;t[0]=o*u,t[4]=r-e*c,t[8]=i*c+n,t[1]=c,t[5]=s*u,t[9]=-a*u,t[2]=-l*u,t[6]=n*c+i,t[10]=e-r*c}else if("XZY"===e.order){const e=s*o,n=s*l,i=a*o,r=a*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+r,t[5]=s*u,t[9]=n*c-i,t[2]=i*c-n,t[6]=a*u,t[10]=r*c+e}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(Ii,e,Li)}lookAt(e,t,n){const i=this.elements;return Ui.subVectors(e,t),0===Ui.lengthSq()&&(Ui.z=1),Ui.normalize(),Di.crossVectors(n,Ui),0===Di.lengthSq()&&(1===Math.abs(n.z)?Ui.x+=1e-4:Ui.z+=1e-4,Ui.normalize(),Di.crossVectors(n,Ui)),Di.normalize(),Oi.crossVectors(Ui,Di),i[0]=Di.x,i[4]=Oi.x,i[8]=Ui.x,i[1]=Di.y,i[5]=Oi.y,i[9]=Ui.y,i[2]=Di.z,i[6]=Oi.z,i[10]=Ui.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],_=n[3],y=n[7],v=n[11],x=n[15],b=i[0],T=i[4],S=i[8],M=i[12],w=i[1],E=i[5],A=i[9],R=i[13],C=i[2],N=i[6],P=i[10],I=i[14],L=i[3],D=i[7],O=i[11],U=i[15];return r[0]=s*b+a*w+o*C+l*L,r[4]=s*T+a*E+o*N+l*D,r[8]=s*S+a*A+o*P+l*O,r[12]=s*M+a*R+o*I+l*U,r[1]=u*b+c*w+h*C+d*L,r[5]=u*T+c*E+h*N+d*D,r[9]=u*S+c*A+h*P+d*O,r[13]=u*M+c*R+h*I+d*U,r[2]=p*b+m*w+f*C+g*L,r[6]=p*T+m*E+f*N+g*D,r[10]=p*S+m*A+f*P+g*O,r[14]=p*M+m*R+f*I+g*U,r[3]=_*b+y*w+v*C+x*L,r[7]=_*T+y*E+v*N+x*D,r[11]=_*S+y*A+v*P+x*O,r[15]=_*M+y*R+v*I+x*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],a=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+r*o*c-i*l*c-r*a*h+n*l*h+i*a*d-n*o*d)+e[7]*(+t*o*d-t*l*h+r*s*h-i*s*d+i*l*u-r*o*u)+e[11]*(+t*l*c-t*a*d-r*s*c+n*s*d+r*a*u-n*l*u)+e[15]*(-i*a*u-t*o*c+t*a*h+i*s*c-n*s*h+n*o*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],m=e[13],f=e[14],g=e[15],_=c*f*l-m*h*l+m*o*d-a*f*d-c*o*g+a*h*g,y=p*h*l-u*f*l-p*o*d+s*f*d+u*o*g-s*h*g,v=u*m*l-p*c*l+p*a*d-s*m*d-u*a*g+s*c*g,x=p*c*o-u*m*o-p*a*h+s*m*h+u*a*f-s*c*f,b=t*_+n*y+i*v+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/b;return e[0]=_*T,e[1]=(m*h*r-c*f*r-m*i*d+n*f*d+c*i*g-n*h*g)*T,e[2]=(a*f*r-m*o*r+m*i*l-n*f*l-a*i*g+n*o*g)*T,e[3]=(c*o*r-a*h*r-c*i*l+n*h*l+a*i*d-n*o*d)*T,e[4]=y*T,e[5]=(u*f*r-p*h*r+p*i*d-t*f*d-u*i*g+t*h*g)*T,e[6]=(p*o*r-s*f*r-p*i*l+t*f*l+s*i*g-t*o*g)*T,e[7]=(s*h*r-u*o*r+u*i*l-t*h*l-s*i*d+t*o*d)*T,e[8]=v*T,e[9]=(p*c*r-u*m*r-p*n*d+t*m*d+u*n*g-t*c*g)*T,e[10]=(s*m*r-p*a*r+p*n*l-t*m*l-s*n*g+t*a*g)*T,e[11]=(u*a*r-s*c*r-u*n*l+t*c*l+s*n*d-t*a*d)*T,e[12]=x*T,e[13]=(u*m*i-p*c*i+p*n*h-t*m*h-u*n*f+t*c*f)*T,e[14]=(p*a*i-s*m*i-p*n*o+t*m*o+s*n*f-t*a*f)*T,e[15]=(s*c*i-u*a*i+u*n*o-t*c*o-s*n*h+t*a*h)*T,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,a=e.
vendor: 18,530 bytes, line 1
1y,o=e.z,l=r*s,u=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,u*a+n,u*o-i*s,0,l*o-i*a,u*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,a=t._z,o=t._w,l=r+r,u=s+s,c=a+a,h=r*l,d=r*u,p=r*c,m=s*u,f=s*c,g=a*c,_=o*l,y=o*u,v=o*c,x=n.x,b=n.y,T=n.z;return i[0]=(1-(m+g))*x,i[1]=(d+v)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(d-v)*b,i[5]=(1-(h+g))*b,i[6]=(f+_)*b,i[7]=0,i[8]=(p+y)*T,i[9]=(f-_)*T,i[10]=(1-(h+m))*T,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Ni.set(i[0],i[1],i[2]).length();const s=Ni.set(i[4],i[5],i[6]).length(),a=Ni.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Pi.copy(this);const o=1/r,l=1/s,u=1/a;return Pi.elements[0]*=o,Pi.elements[1]*=o,Pi.elements[2]*=o,Pi.elements[4]*=l,Pi.elements[5]*=l,Pi.elements[6]*=l,Pi.elements[8]*=u,Pi.elements[9]*=u,Pi.elements[10]*=u,t.setFromRotationMatrix(Pi),n.x=r,n.y=s,n.z=a,this}makePerspective(e,t,n,i,r,s,a=2e3,o=!1){const l=this.elements,u=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let p,m;if(o)p=r/(s-r),m=s*r/(s-r);else if(a===ln)p=-(s+r)/(s-r),m=-2*s*r/(s-r);else{if(a!==un)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);p=-s/(s-r),m=-s*r/(s-r)}return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=c,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,r,s,a=2e3,o=!1){const l=this.elements,u=2/(t-e),c=2/(n-i),h=-(t+e)/(t-e),d=-(n+i)/(n-i);let p,m;if(o)p=1/(s-r),m=s/(s-r);else if(a===ln)p=-2/(s-r),m=-(s+r)/(s-r);else{if(a!==un)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=-1/(s-r),m=-r/(s-r)}return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=c,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Ni=new wn,Pi=new Ci,Ii=new wn(0,0,0),Li=new wn(1,1,1),Di=new wn,Oi=new wn,Ui=new wn,Fi=new Ci,Bi=new Mn;class Vi{constructor(e=0,t=0,n=0,i=Vi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],a=i[8],o=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(_n(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-_n(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(_n(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-_n(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(_n(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-_n(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,d),this._y=0)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Fi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Fi,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Bi.setFromEuler(this),this.setFromQuaternion(Bi,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],void 0!==e[3]&&(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}}Vi.DEFAULT_ORDER="XYZ";class qi{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return 0!==(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let zi=0;const ki=new wn,Gi=new Mn,Hi=new Ci,ji=new wn,Wi=new wn,Xi=new wn,$i=new Mn,Yi=new wn(1,0,0),Ki=new wn(0,1,0),Zi=new wn(0,0,1),Ji={type:"added"},Qi={type:"removed"},er={type:"childadded",child:null},tr={type:"childremoved",child:null};class nr extends hn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:zi++}),this.uuid=gn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nr.DEFAULT_UP.clone();const e=new wn,t=new Vi,n=new Mn,i=new wn(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ci},normalMatrix:{value:new Rn}}),this.matrix=new Ci,this.matrixWorld=new Ci,this.matrixAutoUpdate=nr.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=nr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new qi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Gi.setFromAxisAngle(e,t),this.quaternion.multiply(Gi),this}rotateOnWorldAxis(e,t){return Gi.setFromAxisAngle(e,t),this.quaternion.premultiply(Gi),this}rotateX(e){return this.rotateOnAxis(Yi,e)}rotateY(e){return this.rotateOnAxis(Ki,e)}rotateZ(e){return this.rotateOnAxis(Zi,e)}translateOnAxis(e,t){return ki.copy(e).applyQuaternion(this.quaternion),this.position.add(ki.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Yi,e)}translateY(e){return this.translateOnAxis(Ki,e)}translateZ(e){return this.translateOnAxis(Zi,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Hi.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ji.copy(e):ji.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Wi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Hi.lookAt(Wi,ji,this.up):Hi.lookAt(ji,Wi,this.up),this.quaternion.setFromRotationMatrix(Hi),i&&(Hi.extractRotation(i.matrixWorld),Gi.setFromRotationMatrix(Hi),this.quaternion.premultiply(Gi.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this||e&&e.isObject3D&&(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ji),er.child=e,this.dispatchEvent(er),er.child=null),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Qi),tr.child=e,this.dispatchEvent(tr),tr.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Hi.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Hi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Hi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ji),er.child=e,this.dispatchEvent(er),er.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Wi,e,Xi),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Wi,$i,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){t[n].updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++){e[t].updateWorldMatrix(!1,!0)}}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(e=>({...e})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(i.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=s(e.geometries),i=s(e.materials),r=s(e.textures),a=s(e.images),o=s(e.shapes),l=s(e.skeletons),u=s(e.animations),c=s(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let n=0;n<e.children.length;n++){const t=e.children[n];this.add(t.clone())}return this}}nr.DEFAULT_UP=new wn(0,1,0),nr.DEFAULT_MATRIX_AUTO_UPDATE=!0,nr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ir=new wn,rr=new wn,sr=new wn,ar=new wn,or=new wn,lr=new wn,ur=new wn,cr=new wn,hr=new wn,dr=new wn,pr=new Zn,mr=new Zn,fr=new Zn;class gr{constructor(e=new wn,t=new wn,n=new wn){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),ir.subVectors(e,t),i.cross(ir);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){ir.subVectors(i,t),rr.subVectors(n,t),sr.subVectors(e,t);const s=ir.dot(ir),a=ir.dot(rr),o=ir.dot(sr),l=rr.dot(rr),u=rr.dot(sr),c=s*l-a*a;if(0===c)return r.set(0,0,0),null;const h=1/c,d=(l*o-a*u)*h,p=(s*u-a*o)*h;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,ar)&&(ar.x>=0&&ar.y>=0&&ar.x+ar.y<=1)}static getInterpolation(e,t,n,i,r,s,a,o){return null===this.getBarycoord(e,t,n,i,ar)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,ar.x),o.addScaledVector(s,ar.y),o.addScaledVector(a,ar.z),o)}static getInterpolatedAttribute(e,t,n,i,r,s){return pr.setScalar(0),mr.setScalar(0),fr.setScalar(0),pr.fromBufferAttribute(e,t),mr.fromBufferAttribute(e,n),fr.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(pr,r.x),s.addScaledVector(mr,r.y),s.addScaledVector(fr,r.z),s}static isFrontFacing(e,t,n,i){return ir.subVectors(n,t),rr.subVectors(e,t),ir.cross(rr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ir.subVectors(this.c,this.b),rr.subVectors(this.a,this.b),.5*ir.cross(rr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return gr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return gr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return gr.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return gr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return gr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,a;
vendor: 7,465 bytes, line 1
1or.subVectors(i,n),lr.subVectors(r,n),cr.subVectors(e,n);const o=or.dot(cr),l=lr.dot(cr);if(o<=0&&l<=0)return t.copy(n);hr.subVectors(e,i);const u=or.dot(hr),c=lr.dot(hr);if(u>=0&&c<=u)return t.copy(i);const h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return s=o/(o-u),t.copy(n).addScaledVector(or,s);dr.subVectors(e,r);const d=or.dot(dr),p=lr.dot(dr);if(p>=0&&d<=p)return t.copy(r);const m=d*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),t.copy(n).addScaledVector(lr,a);const f=u*p-d*c;if(f<=0&&c-u>=0&&d-p>=0)return ur.subVectors(r,i),a=(c-u)/(c-u+(d-p)),t.copy(i).addScaledVector(ur,a);const g=1/(f+m+h);return s=m*g,a=h*g,t.copy(n).addScaledVector(or,s).addScaledVector(lr,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const _r={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},yr={h:0,s:0,l:0},vr={h:0,s:0,l:0};function xr(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class br{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(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ht){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,qn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=qn.workingColorSpace){return this.r=e,this.g=t,this.b=n,qn.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=qn.workingColorSpace){if(e=yn(e,1),t=_n(t,0,1),n=_n(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=xr(r,i,e+1/3),this.g=xr(r,i,e),this.b=xr(r,i,e-1/3)}return qn.colorSpaceToWorking(this,i),this}setStyle(e,t=Ht){function n(e){void 0!==e&&parseFloat(e)}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let e;const r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(e[4]),this.setRGB(Math.min(255,parseInt(e[1],10))/255,Math.min(255,parseInt(e[2],10))/255,Math.min(255,parseInt(e[3],10))/255,t);if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(e[4]),this.setRGB(Math.min(100,parseInt(e[1],10))/100,Math.min(100,parseInt(e[2],10))/100,Math.min(100,parseInt(e[3],10))/100,t);break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(e[4]),this.setHSL(parseFloat(e[1])/360,parseFloat(e[2])/100,parseFloat(e[3])/100,t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=i[1],n=e.length;if(3===n)return this.setRGB(parseInt(e.charAt(0),16)/15,parseInt(e.charAt(1),16)/15,parseInt(e.charAt(2),16)/15,t);if(6===n)return this.setHex(parseInt(e,16),t)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ht){const n=_r[e.toLowerCase()];return void 0!==n&&this.setHex(n,t),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=zn(e.r),this.g=zn(e.g),this.b=zn(e.b),this}copyLinearToSRGB(e){return this.r=kn(e.r),this.g=kn(e.g),this.b=kn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ht){return qn.workingToColorSpace(Tr.copy(this),e),65536*Math.round(_n(255*Tr.r,0,255))+256*Math.round(_n(255*Tr.g,0,255))+Math.round(_n(255*Tr.b,0,255))}getHexString(e=Ht){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=qn.workingColorSpace){qn.workingToColorSpace(Tr.copy(this),t);const n=Tr.r,i=Tr.g,r=Tr.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let o,l;const u=(a+s)/2;if(a===s)o=0,l=0;else{const e=s-a;switch(l=u<=.5?e/(s+a):e/(2-s-a),s){case n:o=(i-r)/e+(i<r?6:0);break;case i:o=(r-n)/e+2;break;case r:o=(n-i)/e+4}o/=6}return e.h=o,e.s=l,e.l=u,e}getRGB(e,t=qn.workingColorSpace){return qn.workingToColorSpace(Tr.copy(this),t),e.r=Tr.r,e.g=Tr.g,e.b=Tr.b,e}getStyle(e=Ht){qn.workingToColorSpace(Tr.copy(this),e);const t=Tr.r,n=Tr.g,i=Tr.b;return e!==Ht?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(yr),this.setHSL(yr.h+e,yr.s+t,yr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}
vendor: 2,578 bytes, line 1
1lerpColors(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(yr),e.getHSL(vr);const n=vn(yr.h,vr.h,t),i=vn(yr.s,vr.s,t),r=vn(yr.l,vr.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Tr=new br;br.NAMES=_r;let Sr=0;class Mr extends hn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Sr++}),this.uuid=gn(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=J,this.blendDst=Q,this.blendEquation=j,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new br(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Yt,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$t,this.stencilZFail=$t,this.stencilZPass=$t,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(void 0!==e)for(const t in e){const n=e[t];if(void 0===n)continue;const i=this[t];void 0!==i&&(i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}
vendor: 5,642 bytes, line 1
1if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(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),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(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),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(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,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==J&&(n.blendSrc=this.blendSrc),this.blendDst!==Q&&(n.blendDst=this.blendDst),this.blendEquation!==j&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&
vendor: 13,889 bytes, line 1
1(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Yt&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==$t&&(n.stencilFail=this.stencilFail),this.stencilZFail!==$t&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==$t&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}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(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class wr extends Mr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new br(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 Vi,this.combine=0,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 Er=Ar();function Ar(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const e=l-127;e<-27?(i[l]=0,i[256|l]=32768,r[l]=24,r[256|l]=24):e<-14?(i[l]=1024>>-e-14,i[256|l]=1024>>-e-14|32768,r[l]=-e-1,r[256|l]=-e-1):e<=15?(i[l]=e+15<<10,i[256|l]=e+15<<10|32768,r[l]=13,r[256|l]=13):e<128?(i[l]=31744,i[256|l]=64512,r[l]=24,r[256|l]=24):(i[l]=31744,i[256|l]=64512,r[l]=13,r[256|l]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let e=l<<13,t=0;for(;!(8388608&e);)e<<=1,t-=8388608;e&=-8388609,t+=947912704,s[l]=e|t}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)32!==l&&(o[l]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function Rr(e){Math.abs(e),e=_n(e,-65504,65504),Er.floatView[0]=e;const t=Er.uint32View[0],n=t>>23&511;return Er.baseTable[n]+((8388607&t)>>Er.shiftTable[n])}function Cr(e){const t=e>>10;return Er.uint32View[0]=Er.mantissaTable[Er.offsetTable[t]+(1023&e)]+Er.exponentTable[t],Er.floatView[0]}const Nr=new wn,Pr=new Sn;let Ir=0;class Lr{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:Ir++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=sn,this.updateRanges=[],this.gpuType=qe,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)Pr.fromBufferAttribute(this,t),Pr.applyMatrix3(e),this.setXY(t,Pr.x,Pr.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)Nr.fromBufferAttribute(this,t),Nr.applyMatrix3(e),this.setXYZ(t,Nr.x,Nr.y,Nr.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Nr.fromBufferAttribute(this,t),Nr.applyMatrix4(e),this.setXYZ(t,Nr.x,Nr.y,Nr.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Nr.fromBufferAttribute(this,t),Nr.applyNormalMatrix(e),this.setXYZ(t,Nr.x,Nr.y,Nr.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Nr.fromBufferAttribute(this,t),Nr.transformDirection(e),this.setXYZ(t,Nr.x,Nr.y,Nr.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=xn(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=xn(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=xn(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=xn(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=xn(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,i){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),i=bn(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),i=bn(i,this.array),r=bn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==sn&&(e.usage=this.usage),e}}class Dr extends Lr{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Or extends Lr{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Ur extends Lr{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Cr(this.array[e*this.itemSize]);return this.normalized&&(t=xn(t,this.array)),t}setX(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize]=Rr(t),this}getY(e){let t=Cr(this.array[e*this.itemSize+1]);return this.normalized&&(t=xn(t,this.array)),t}setY(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize+1]=Rr(t),this}getZ(e){let t=Cr(this.array[e*this.itemSize+2]);return this.normalized&&(t=xn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize+2]=Rr(t),this}getW(e){let t=Cr(this.array[e*this.itemSize+3]);return this.normalized&&(t=xn(t,this.array)),t}setW(e,t){return this.normalized&&(t=bn(t,this.array)),this.array[e*this.itemSize+3]=Rr(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]=Rr(t),this.array[e+1]=Rr(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),i=bn(i,this.array)),this.array[e+0]=Rr(t),this.array[e+1]=Rr(n),this.array[e+2]=Rr(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),i=bn(i,this.array),r=bn(r,this.array)),this.array[e+0]=Rr(t),this.array[e+1]=Rr(n),this.array[e+2]=Rr(i),this.array[e+3]=Rr(r),this}}class Fr extends Lr{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Br=0;const Vr=new Ci,qr=new nr,zr=new wn,kr=new ni,Gr=new ni,Hr=new wn;class jr extends hn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Br++}),this.uuid=gn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Nn(e)?Or:Dr)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new Rn).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return Vr.makeRotationFromQuaternion(e),this.applyMatrix4(Vr),this}rotateX(e){return Vr.makeRotationX(e),this.applyMatrix4(Vr),this}rotateY(e){return Vr.makeRotationY(e),this.applyMatrix4(Vr),this}rotateZ(e){return Vr.makeRotationZ(e),this.applyMatrix4(Vr),this}translate(e,t,n){return Vr.makeTranslation(e,t,n),this.applyMatrix4(Vr),this}scale(e,t,n){return Vr.makeScale(e,t,n),this.applyMatrix4(Vr),this}lookAt(e){return qr.lookAt(e),qr.updateMatrix(),this.applyMatrix4(qr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(zr).negate(),this.translate(zr.x,zr.y,zr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(void 0===t){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}this.setAttribute("position",new Fr(t,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const n=e[i];t.setXYZ(i,n.x,n.y,n.z||0)}e.length,t.count,t.needsUpdate=!0}return this}
vendor: 5,197 bytes, line 1
1computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new ni);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)this.boundingBox.set(new wn(-1/0,-1/0,-1/0),new wn(1/0,1/0,1/0));else{if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];kr.setFromBufferAttribute(n),this.morphTargetsRelative?(Hr.addVectors(this.boundingBox.min,kr.min),this.boundingBox.expandByPoint(Hr),Hr.addVectors(this.boundingBox.max,kr.max),this.boundingBox.expandByPoint(Hr)):(this.boundingBox.expandByPoint(kr.min),this.boundingBox.expandByPoint(kr.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new xi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)this.boundingSphere.set(new wn,1/0);else if(e){const n=this.boundingSphere.center;if(kr.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){const n=t[e];Gr.setFromBufferAttribute(n),this.morphTargetsRelative?(Hr.addVectors(kr.min,Gr.min),kr.expandByPoint(Hr),Hr.addVectors(kr.max,Gr.max),kr.expandByPoint(Hr)):(kr.expandByPoint(Gr.min),kr.expandByPoint(Gr.max))}kr.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)Hr.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(Hr));if(t)for(let r=0,s=t.length;r<s;r++){const s=t[r],a=this.morphTargetsRelative;for(let t=0,r=s.count;t<r;t++)Hr.fromBufferAttribute(s,t),a&&(zr.fromBufferAttribute(e,t),Hr.add(zr)),i=Math.max(i,n.distanceToSquared(Hr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return;const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Lr(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),a=[],o=[];for(let S=0;S<n.count;S++)a[S]=new wn,o[S]=new wn;const l=new wn,u=new wn,c=new wn,h=new Sn,d=new Sn,p=new Sn,m=new wn,f=new wn;function g(e,t,i){l.fromBufferAttribute(n,e),u.fromBufferAttribute(n,t),c.fromBufferAttribute(n,i),h.fromBufferAttribute(r,e),d.fromBufferAttribute(r,t),p.fromBufferAttribute(r,i),u.sub(l),c.sub(l),d.sub(h),p.sub(h);const s=1/(d.x*p.y-p.x*d.y);isFinite(s)&&(m.copy(u).multiplyScalar(p.y).addScaledVector(c,-d.y).multiplyScalar(s),f.copy(c).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(s),a[e].add(m),a[t].add(m),a[i].add(m),o[e].add(f),o[t].add(f),o[i].add(f))}let _=this.groups;0===_.length&&(_=[{start:0,count:e.count}]);for(let S=0,M=_.length;S<M;++S){const t=_[S],n=t.start;for(let i=n,r=n+t.count;i<r;i+=3)g(e.getX(i+0),e.getX(i+1),e.getX(i+2))}const y=new wn,v=new wn,x=new wn,b=new wn;function T(e){x.fromBufferAttribute(i,e),b.copy(x);const t=a[e];y.copy(t),y.sub(x.multiplyScalar(x.dot(t))).normalize(),v.crossVectors(b,t);const n=v.dot(o[e])<0?-1:1;s.setXYZW(e,y.x,y.y,y.z,n)}for(let S=0,M=_.length;S<M;++S){const t=_[S],n=t.start;for(let i=n,r=n+t.count;i<r;i+=3)T(e.getX(i+0)),T(e.getX(i+1)),T(e.getX(i+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new Lr(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new wn,r=new wn,s=new wn,a=new wn,o=new wn,l=new wn,u=new wn,c=new wn;if(e)for(let h=0,d=e.count;h<d;h+=3){const d=e.getX(h+0),p=e.getX(h+1),m=e.getX(h+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,p),s.fromBufferAttribute(t,m),u.subVectors(s,r),c.subVectors(i,r),u.cross(c),a.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,m),a.add(u),o.add(u),l.add(u),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let e=0,h=t.count;e<h;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),s.fromBufferAttribute(t,e+2),u.subVectors(s,r),c.subVectors(i,r),u.cross(c),n.setXYZ(e+0,u.x,u.y,u.z),n.setXYZ(e+1,u.x,u.y,u.z),n.setXYZ(e+2,u.x,u.y,u.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(e,t){const n=e.array,i=e.itemSize,r=e.normalized,s=new n.constructor(t.length*i);let a=0,o=0;for(let l=0,u=t.length;l<u;l++){a=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*i;for(let e=0;e<i;e++)s[o++]=n[a++]}return new Lr(s,i,r)}if(null===this.index)return this;const t=new jr,n=this.index.array,i=this.attributes;for(const a in i){const r=e(i[a],n);t.setAttribute(a,r)}const r=this.morphAttributes;for(const a in r){const i=[],s=r[a];for(let t=0,r=s.length;t<r;t++){const r=e(s[t],n);i.push(r)}t.morphAttributes[a]=i}t.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let a=0,o=s.length;a<o;a++){const e=s[a];t.addGroup(e.start,e.count,e.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 15,427 bytes, line 1
1if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const o in n){const t=n[o];e.data.attributes[o]=t.toJSON(e.data)}const i={};let r=!1;for(const o in this.morphAttributes){const t=this.morphAttributes[o],n=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];n.push(r.toJSON(e.data))}n.length>0&&(i[o]=n,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(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;null!==n&&this.setIndex(n.clone());const i=e.attributes;for(const l in i){const e=i[l];this.setAttribute(l,e.clone(t))}const r=e.morphAttributes;for(const l in r){const e=[],n=r[l];for(let i=0,r=n.length;i<r;i++)e.push(n[i].clone(t));this.morphAttributes[l]=e}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let l=0,u=s.length;l<u;l++){const e=s[l];this.addGroup(e.start,e.count,e.materialIndex)}const a=e.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Wr=new Ci,Xr=new Ri,$r=new xi,Yr=new wn,Kr=new wn,Zr=new wn,Jr=new wn,Qr=new wn,es=new wn,ts=new wn,ns=new wn;class is extends nr{constructor(e=new jr,t=new wr){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),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(r&&a){es.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=a[n],o=r[n];0!==i&&(Qr.fromBufferAttribute(o,e),s?es.addScaledVector(Qr,i):es.addScaledVector(Qr.sub(t),i))}t.add(es)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),$r.copy(n.boundingSphere),$r.applyMatrix4(r),Xr.copy(e.ray).recast(e.near),!1===$r.containsPoint(Xr.origin)){if(null===Xr.intersectSphere($r,Yr))return;if(Xr.origin.distanceToSquared(Yr)>(e.far-e.near)**2)return}Wr.copy(r).invert(),Xr.copy(e.ray).applyMatrix4(Wr),null!==n.boundingBox&&!1===Xr.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,Xr)}}_computeIntersections(e,t,n){let i;const r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,c=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(s))for(let p=0,m=h.length;p<m;p++){const r=h[p],o=s[r.materialIndex];for(let s=Math.max(r.start,d.start),h=Math.min(a.count,Math.min(r.start+r.count,d.start+d.count));s<h;s+=3){i=rs(this,o,e,n,l,u,c,a.getX(s),a.getX(s+1),a.getX(s+2)),i&&(i.faceIndex=Math.floor(s/3),i.face.materialIndex=r.materialIndex,t.push(i))}}else{for(let r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);r<o;r+=3){i=rs(this,s,e,n,l,u,c,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}else if(void 0!==o)if(Array.isArray(s))for(let p=0,m=h.length;p<m;p++){const r=h[p],a=s[r.materialIndex];for(let s=Math.max(r.start,d.start),h=Math.min(o.count,Math.min(r.start+r.count,d.start+d.count));s<h;s+=3){i=rs(this,a,e,n,l,u,c,s,s+1,s+2),i&&(i.faceIndex=Math.floor(s/3),i.face.materialIndex=r.materialIndex,t.push(i))}}else{for(let r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);r<a;r+=3){i=rs(this,s,e,n,l,u,c,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}}}function rs(e,t,n,i,r,s,a,o,l,u){e.getVertexPosition(o,Kr),e.getVertexPosition(l,Zr),e.getVertexPosition(u,Jr);const c=function(e,t,n,i,r,s,a,o){let l;if(l=1===t.side?i.intersectTriangle(a,s,r,!0,o):i.intersectTriangle(r,s,a,0===t.side,o),null===l)return null;ns.copy(o),ns.applyMatrix4(e.matrixWorld);const u=n.ray.origin.distanceTo(ns);return u<n.near||u>n.far?null:{distance:u,point:ns.clone(),object:e}}(e,t,n,i,Kr,Zr,Jr,ts);if(c){const e=new wn;gr.getBarycoord(ts,Kr,Zr,Jr,e),r&&(c.uv=gr.getInterpolatedAttribute(r,o,l,u,e,new Sn)),s&&(c.uv1=gr.getInterpolatedAttribute(s,o,l,u,e,new Sn)),a&&(c.normal=gr.getInterpolatedAttribute(a,o,l,u,e,new wn),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));const t={a:o,b:l,c:u,normal:new wn,materialIndex:0};gr.getNormal(Kr,Zr,Jr,t.normal),c.face=t,c.barycoord=e}return c}class ss extends jr{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],u=[],c=[];let h=0,d=0;function p(e,t,n,i,r,s,p,m,f,g,_){const y=s/f,v=p/g,x=s/2,b=p/2,T=m/2,S=f+1,M=g+1;let w=0,E=0;const A=new wn;for(let a=0;a<M;a++){const s=a*v-b;for(let o=0;o<S;o++){const h=o*y-x;A[e]=h*i,A[t]=s*r,A[n]=T,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=m>0?1:-1,u.push(A.x,A.y,A.z),c.push(o/f),c.push(1-a/g),w+=1}}for(let a=0;a<g;a++)for(let e=0;e<f;e++){const t=h+e+S*a,n=h+e+S*(a+1),i=h+(e+1)+S*(a+1),r=h+(e+1)+S*a;o.push(t,n,r),o.push(n,i,r),E+=6}a.addGroup(d,E,_),d+=E,h+=w}p("z","y","x",-1,-1,n,t,e,s,r,0),p("z","y","x",1,-1,n,t,-e,s,r,1),p("x","z","y",1,1,e,n,t,i,s,2),p("x","z","y",1,-1,e,n,-t,i,s,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new Fr(l,3)),this.setAttribute("normal",new Fr(u,3)),this.setAttribute("uv",new Fr(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ss(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function as(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?t[n][i]=null:t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function os(e){const t={};for(let n=0;n<e.length;n++){const i=as(e[n]);for(const e in i)t[e]=i[e]}return t}function ls(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:qn.workingColorSpace}const us={clone:as,merge:os};class cs extends Mr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",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,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=as(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)!0===this.extensions[i]&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class hs extends nr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ci,this.projectionMatrix=new Ci,this.projectionMatrixInverse=new Ci,this.coordinateSystem=ln,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.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const ds=new wn,ps=new Sn,ms=new Sn;class fs extends hs{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*fn*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*mn*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*fn*Math.atan(Math.tan(.5*mn*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){ds.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ds.x,ds.y).multiplyScalar(-e/ds.z),ds.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ds.x,ds.y).multiplyScalar(-e/ds.z)}getViewSize(e,t){return this.getViewBounds(e,ps,ms),t.subVectors(ms,ps)}setViewOffset(e,t,n,i,r,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*mn*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/a,i*=s.width/e,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const gs=-90;class _s extends nr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new fs(gs,1,e,t);i.layers=this.layers,this.add(i);const r=new fs(gs,1,e,t);r.layers=this.layers,this.add(r);const s=new fs(gs,1,e,t);s.layers=this.layers,this.add(s);const a=new fs(gs,1,e,t);a.layers=this.layers,this.add(a);const o=new fs(gs,1,e,t);o.layers=this.layers,this.add(o);const l=new fs(gs,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,a,o]=t;for(const l of t)this.remove(l);if(e===ln)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(e!==un)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,s,a,o,l,u]=this.children,c=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,s),e.setRenderTarget(n,2,i),e.render(t,a),e.setRenderTarget(n,3,i),e.render(t,o),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(c,h,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class ys extends Kn{constructor(e=[],t=301,n,i,r,s,a,o,l,u){super(e,t,n,i,r,s,a,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class vs extends Qn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new ys(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 18,298 bytes, line 1
1=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new ss(5,5,5),r=new cs({name:"CubemapFromEquirect",uniforms:as(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;const s=new is(i,r),a=t.minFilter;t.minFilter===Le&&(t.minFilter=Pe);return new _s(1,10,this).update(e,s),t.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const r=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(r)}}class xs extends nr{constructor(){super(),this.isGroup=!0,this.type="Group"}}const bs={type:"move"};class Ts{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new xs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new xs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new wn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new wn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new xs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new wn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new wn),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&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}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){s=!0;for(const s of e.hand.values()){const e=t.getJointPose(s,n),i=this._getHandJoint(l,s);null!==e&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,u=.005;l.inputState.pinching&&a>o+u?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&a<=o-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(bs)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new xs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Ss{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new br(e),this.density=t}clone(){return new Ss(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Ms{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new br(e),this.near=t,this.far=n}clone(){return new Ms(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class ws extends nr{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 Vi,this.environmentIntensity=1,this.environmentRotation=new Vi,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(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),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Es{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=sn,this.updateRanges=[],this.version=0,this.uuid=gn()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=gn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(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 void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=gn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(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 As=new wn;class Rs{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)As.fromBufferAttribute(this,t),As.applyMatrix4(e),this.setXYZ(t,As.x,As.y,As.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)As.fromBufferAttribute(this,t),As.applyNormalMatrix(e),this.setXYZ(t,As.x,As.y,As.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)As.fromBufferAttribute(this,t),As.transformDirection(e),this.setXYZ(t,As.x,As.y,As.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=xn(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=xn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=xn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=xn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=xn(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,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),i=bn(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=bn(t,this.array),n=bn(n,this.array),i=bn(i,this.array),r=bn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new Lr(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Rs(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Cs extends Mr{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new br(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Ns;const Ps=new wn,Is=new wn,Ls=new wn,Ds=new Sn,Os=new Sn,Us=new Ci,Fs=new wn,Bs=new wn,Vs=new wn,qs=new Sn,zs=new Sn,ks=new Sn;class Gs extends nr{constructor(e=new Cs){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Ns){Ns=new jr;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new Es(e,5);Ns.setIndex([0,1,2,0,2,3]),Ns.setAttribute("position",new Rs(t,3,0,!1)),Ns.setAttribute("uv",new Rs(t,2,3,!1))}this.geometry=Ns,this.material=e,this.center=new Sn(.5,.5),this.count=1}raycast(e,t){e.camera,Is.setFromMatrixScale(this.matrixWorld),Us.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ls.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Is.multiplyScalar(-Ls.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;Hs(Fs.set(-.5,-.5,0),Ls,s,Is,i,r),Hs(Bs.set(.5,-.5,0),Ls,s,Is,i,r),Hs(Vs.set(.5,.5,0),Ls,s,Is,i,r),qs.set(0,0),zs.set(1,0),ks.set(1,1);let a=e.ray.intersectTriangle(Fs,Bs,Vs,!1,Ps);if(null===a&&(Hs(Bs.set(-.5,.5,0),Ls,s,Is,i,r),zs.set(0,1),a=e.ray.intersectTriangle(Fs,Vs,Bs,!1,Ps),null===a))return;const o=e.ray.origin.distanceTo(Ps);o<e.near||o>e.far||t.push({distance:o,point:Ps.clone(),uv:gr.getInterpolation(Ps,Fs,Bs,Vs,qs,zs,ks,new Sn),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Hs(e,t,n,i,r,s){Ds.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(Os.x=s*Ds.x-r*Ds.y,Os.y=r*Ds.x+s*Ds.y):Os.copy(Ds),e.copy(t),e.x+=Os.x,e.y+=Os.y,e.applyMatrix4(Us)}const js=new wn,Ws=new wn;class Xs extends nr{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const e=t[n];this.addLevel(e.object.clone(),e.distance,e.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let i=t[n].distance;if(t[n].object.visible&&(i-=i*t[n].hysteresis),e<i)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){js.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(js);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){js.setFromMatrixPosition(e.matrixWorld),Ws.setFromMatrixPosition(this.matrixWorld);const n=js.distanceTo(Ws)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i<r;i++){let e=t[i].distance;if(t[i].object.visible&&(e-=e*t[i].hysteresis),!(n>=e))break;t[i-1].object.visible=!1,t[i].object.visible=!0}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const e=n[i];t.object.levels.push({object:e.object.uuid,distance:e.distance,hysteresis:e.hysteresis})}return t}}const $s=new wn,Ys=new Zn,Ks=new Zn,Zs=new wn,Js=new Ci,Qs=new wn,ea=new xi,ta=new Ci,na=new Ri;class ia extends is{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=_e,this.bindMatrix=new Ci,this.bindMatrixInverse=new Ci,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new ni),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Qs),this.boundingBox.expandByPoint(Qs)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new xi),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Qs),this.boundingSphere.expandByPoint(Qs)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),ea.copy(this.boundingSphere),ea.applyMatrix4(i),!1!==e.ray.intersectsSphere(ea)&&(ta.copy(i).invert(),na.copy(e.ray).applyMatrix4(ta),null!==this.boundingBox&&!1===na.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,na)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Zn,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===_e?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ye&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Ys.fromBufferAttribute(i.attributes.skinIndex,e),Ks.fromBufferAttribute(i.attributes.skinWeight,e),$s.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const e=Ks.getComponent(r);if(0!==e){const i=Ys.getComponent(r);Js.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(Zs.copy($s).applyMatrix4(Js),e)}}
vendor: 5,669 bytes, line 1
1return t.applyMatrix4(this.bindMatrixInverse)}}class ra extends nr{constructor(){super(),this.isBone=!0,this.type="Bone"}}class sa extends Kn{constructor(e=null,t=1,n=1,i,r,s,a,o,l=1003,u=1003,c,h){super(null,s,a,o,l,u,i,r,c,h),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const aa=new Ci,oa=new Ci;class la{constructor(e=[],t=[]){this.uuid=gn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new Ci)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new Ci;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,s=e.length;r<s;r++){const i=e[r]?e[r].matrixWorld:oa;aa.multiplyMatrices(i,t[r]),aa.toArray(n,16*r)}null!==i&&(i.needsUpdate=!0)}clone(){return new la(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new sa(t,e,e,Ye,qe);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let i=t[e.bones[n]];void 0===i&&(i=new ra),this.bones.push(i),this.boneInverses.push((new Ci).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const s=n[i];e.boneInverses.push(s.toArray())}return e}}class ua extends Lr{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ca=new Ci,ha=new Ci,da=[],pa=new ni,ma=new Ci,fa=new is,ga=new xi;class _a extends is{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ua(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,ma)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new ni),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ca),pa.copy(e.boundingBox).applyMatrix4(ca),this.boundingBox.union(pa)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new xi),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ca),ga.copy(e.boundingSphere).applyMatrix4(ca),this.boundingSphere.union(ga)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let s=0;s<n.length;s++)n[s]=i[r+s]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(fa.geometry=this.geometry,fa.material=this.material,void 0!==fa.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),ga.copy(this.boundingSphere),ga.applyMatrix4(n),!1!==e.ray.intersectsSphere(ga)))for(let r=0;r<i;r++){this.getMatrixAt(r,ca),ha.multiplyMatrices(n,ca),fa.matrixWorld=ha,fa.raycast(e,da);for(let e=0,n=da.length;e<n;e++){const n=da[e];n.instanceId=r,n.object=this,t.push(n)}da.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new ua(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new sa(new Float32Array(i*this.count),i,this.count,Je,qe));const r=this.morphTexture.source.data.data;let s=0;for(let l=0;l<n.length;l++)s+=n[l];const a=this.geometry.morphTargetsRelative?1:1-s,o=i*e;r[o]=a,r.set(n,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}const ya=new wn,va=new wn,xa=new Rn;
vendor: 4,251 bytes, line 1
1class ba{constructor(e=new wn(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=ya.subVectors(n,t).cross(va.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(ya),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||xa.getNormalMatrix(e),i=this.coplanarPoint(ya).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Ta=new xi,Sa=new Sn(.5,.5),Ma=new wn;class wa{constructor(e=new ba,t=new ba,n=new ba,i=new ba,r=new ba,s=new ba){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),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=2e3,n=!1){const i=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],u=r[4],c=r[5],h=r[6],d=r[7],p=r[8],m=r[9],f=r[10],g=r[11],_=r[12],y=r[13],v=r[14],x=r[15];if(i[0].setComponents(l-s,d-u,g-p,x-_).normalize(),i[1].setComponents(l+s,d+u,g+p,x+_).normalize(),i[2].setComponents(l+a,d+c,g+m,x+y).normalize(),i[3].setComponents(l-a,d-c,g-m,x-y).normalize(),n)i[4].setComponents(o,h,f,v).normalize(),i[5].setComponents(l-o,d-h,g-f,x-v).normalize();else if(i[4].setComponents(l-o,d-h,g-f,x-v).normalize(),t===ln)i[5].setComponents(l+o,d+h,g+f,x+v).normalize();else{if(t!==un)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);i[5].setComponents(o,h,f,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),Ta.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),Ta.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ta)}intersectsSprite(e){Ta.center.set(0,0,0);const t=Sa.distanceTo(e.center);return Ta.radius=.7071067811865476+t,Ta.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ta)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++){if(t[r].distanceToPoint(n)<i)return!1}return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Ma.x=i.normal.x>0?e.max.x:e.min.x,Ma.y=i.normal.y>0?e.max.y:e.min.y,Ma.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ma)<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 Ea=new Ci,Aa=new wa;class Ra{constructor(){this.coordinateSystem=ln}intersectsObject(e,t){if(!t.isArrayCamera||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ea.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Aa.setFromProjectionMatrix(Ea,i.coordinateSystem,i.reversedDepth),Aa.intersectsObject(e))return!0}return!1}
vendor: 8,071 bytes, line 1
1intersectsSprite(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ea.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Aa.setFromProjectionMatrix(Ea,i.coordinateSystem,i.reversedDepth),Aa.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ea.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Aa.setFromProjectionMatrix(Ea,i.coordinateSystem,i.reversedDepth),Aa.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ea.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Aa.setFromProjectionMatrix(Ea,i.coordinateSystem,i.reversedDepth),Aa.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Ea.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Aa.setFromProjectionMatrix(Ea,i.coordinateSystem,i.reversedDepth),Aa.containsPoint(e))return!0}return!1}clone(){return new Ra}}function Ca(e,t){return e-t}function Na(e,t){return e.z-t.z}function Pa(e,t){return t.z-e.z}class Ia{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const a=r[this.index];s.push(a),this.index++,a.start=e,a.count=t,a.z=n,a.index=i}reset(){this.list.length=0,this.index=0}}const La=new Ci,Da=new br(1,1,1),Oa=new wa,Ua=new Ra,Fa=new ni,Ba=new xi,Va=new wn,qa=new wn,za=new wn,ka=new Ia,Ga=new is,Ha=[];function ja(e,t,n=0){const i=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){const r=e.count;for(let s=0;s<r;s++)for(let r=0;r<i;r++)t.setComponent(s+n,r,e.getComponent(s,r))}else t.array.set(e.array,n*i);t.needsUpdate=!0}function Wa(e,t){if(e.constructor!==t.constructor){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++)t[i]=e[i]}else{const n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}class Xa extends is{constructor(e,t,n=2*t,i){super(new jr,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new sa(t,e,e,Ye,qe);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new sa(t,e,e,Qe,Ve);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new sa(t,e,e,Ye,qe);n.colorSpace=qn.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in e.attributes){const r=e.getAttribute(i),{array:s,itemSize:a,normalized:o}=r,l=new s.constructor(n*a),u=new Lr(l,a,o);t.setAttribute(i,u)}if(null!==e.getIndex()){const e=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Lr(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(Boolean(e.getIndex())!==Boolean(t.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new ni);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,La),this.getBoundingBoxAt(i,Fa).applyMatrix4(La),e.union(Fa)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new xi);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,La),this.getBoundingSphereAt(i,Ba).applyMatrix4(La),e.union(Ba)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const t={visible:!0,active:!0,geometryIndex:e};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Ca),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));const i=this._matricesTexture;La.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;const r=this._colorsTexture;return r&&(Da.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===t?e.getAttribute("position").count:t;const s=e.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===n?s.count:n),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let a;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Ca),a=this._availableGeometryIds.shift(),r[a]=i):(a=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(a,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,a}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=t.getIndex(),a=this._geometryInfo[e];if(i&&s.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const o=a.vertexStart,l=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const u in n.attributes){const e=t.getAttribute(u),i=n.getAttribute(u);ja(e,i,o);const r=e.itemSize;
1for(let t=e.count,n=l;t<n;t++){const e=o+t;for(let t=0;t<r;t++)i.setComponent(e,t,0)}i.needsUpdate=!0,i.addUpdateRange(o*r,l*r)}if(i){const e=a.indexStart,n=a.reservedIndexCount;a.indexCount=t.getIndex().count;for(let t=0;t<s.count;t++)r.setX(e+t,o+s.getX(t));for(let t=s.count,i=n;t<i;t++)r.setX(e+t,o);r.needsUpdate=!0,r.addUpdateRange(e,a.reservedIndexCount)}return a.start=i?a.indexStart:a.vertexStart,a.count=i?a.indexCount:a.vertexCount,a.boundingBox=null,null!==t.boundingBox&&(a.boundingBox=t.boundingBox.clone()),a.boundingSphere=null,null!==t.boundingSphere&&(a.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||!1===t[e].active)return this;const n=this._instanceInfo;for(let i=0,r=n.length;i<r;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((e,t)=>t).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),r=this.geometry;for(let s=0,a=n.length;s<a;s++){const a=i[s],o=n[a];if(!1!==o.active){if(null!==r.index){if(o.indexStart!==t){const{indexStart:n,vertexStart:i,reservedIndexCount:s}=o,a=r.index,l=a.array,u=e-i;for(let e=n;e<n+s;e++)l[e]=l[e]+u;a.array.copyWithin(t,n,n+s),a.addUpdateRange(t,s),o.indexStart=t}t+=o.reservedIndexCount}if(o.vertexStart!==e){const{vertexStart:t,reservedVertexCount:n}=o,i=r.attributes;for(const r in i){const s=i[r],{array:a,itemSize:o}=s;a.copyWithin(e*o,t*o,(t+n)*o),s.addUpdateRange(e*o,n*o)}o.vertexStart=e}e+=o.reservedVertexCount,o.start=r.index?o.indexStart:o.vertexStart,this._nextIndexStart=r.index?o.indexStart+o.reservedIndexCount:0,this._nextVertexStart=o.vertexStart+o.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingBox){const e=new ni,t=n.index,r=n.attributes.position;for(let n=i.start,s=i.start+i.count;n<s;n++){let i=n;t&&(i=t.getX(i)),e.expandByPoint(Va.fromBufferAttribute(r,i))}i.boundingBox=e}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingSphere){const t=new xi;this.getBoundingBoxAt(e,Fa),Fa.getCenter(t.center);const r=n.index,s=n.attributes.position;let a=0;for(let e=i.start,n=i.start+i.count;e<n;e++){let n=e;r&&(n=r.getX(n)),Va.fromBufferAttribute(s,n),a=Math.max(a,t.center.distanceToSquared(Va))}t.radius=Math.sqrt(a),i.boundingSphere=t}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,16*e),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,16*e)}setColorAt(e,t){return this.validateInstanceId(e),null===this._colorsTexture&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,4*e),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,4*e)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(Ca);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),r=new Int32Array(e);Wa(this._multiDrawCounts,i),Wa(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=e;const s=this._indirectTexture,a=this._matricesTexture,o=this._colorsTexture;s.dispose(),this._initIndirectTexture(),Wa(s.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),Wa(a.image.data,this._matricesTexture.image.data),o&&(o.dispose(),this._initColorsTexture(),Wa(o.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(e=>e.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index){if(Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`)}
vendor: 6,088 bytes, line 1
1const i=this.geometry;i.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new jr,this._initializeGeometry(i));const r=this.geometry;i.index&&Wa(i.index.array,r.index.array);for(const s in i.attributes)Wa(i.attributes[s].array,r.attributes[s].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,s=this.geometry;Ga.material=this.material,Ga.geometry.index=s.index,Ga.geometry.attributes=s.attributes,null===Ga.geometry.boundingBox&&(Ga.geometry.boundingBox=new ni),null===Ga.geometry.boundingSphere&&(Ga.geometry.boundingSphere=new xi);for(let a=0,o=n.length;a<o;a++){if(!n[a].visible||!n[a].active)continue;const s=n[a].geometryIndex,o=i[s];Ga.geometry.setDrawRange(o.start,o.count),this.getMatrixAt(a,Ga.matrixWorld).premultiply(r),this.getBoundingBoxAt(s,Ga.geometry.boundingBox),this.getBoundingSphereAt(s,Ga.geometry.boundingSphere),Ga.raycast(e,Ha);for(let e=0,n=Ha.length;e<n;e++){const n=Ha[e];n.object=this,n.batchId=a,t.push(n)}Ha.length=0}Ga.material=null,Ga.geometry.index=null,Ga.geometry.attributes={},Ga.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(e=>({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),a=null===s?1:s.array.BYTES_PER_ELEMENT,o=this._instanceInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,c=this._geometryInfo,h=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data,m=n.isArrayCamera?Ua:Oa;h&&!n.isArrayCamera&&(La.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Oa.setFromProjectionMatrix(La,n.coordinateSystem,n.reversedDepth));let f=0;if(this.sortObjects){La.copy(this.matrixWorld).invert(),Va.setFromMatrixPosition(n.matrixWorld).applyMatrix4(La),qa.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(La);for(let i=0,r=o.length;i<r;i++)if(o[i].visible&&o[i].active){const e=o[i].geometryIndex;this.getMatrixAt(i,La),this.getBoundingSphereAt(e,Ba).applyMatrix4(La);let t=!1;if(h&&(t=!m.intersectsSphere(Ba,n)),!t){const t=c[e],n=za.subVectors(Ba.center,Va).dot(qa);ka.push(t.start,t.count,n,i)}}const e=ka.list,t=this.customSort;null===t?e.sort(r.transparent?Pa:Na):t.call(this,e,n);for(let n=0,i=e.length;n<i;n++){const t=e[n];l[f]=t.start*a,u[f]=t.count,p[f]=t.index,f++}ka.reset()}else for(let g=0,_=o.length;g<_;g++)if(o[g].visible&&o[g].active){const e=o[g].geometryIndex;let t=!1;if(h&&(this.getMatrixAt(g,La),this.getBoundingSphereAt(e,Ba).applyMatrix4(La),t=!m.intersectsSphere(Ba,n)),!t){const t=c[e];l[f]=t.start*a,u[f]=t.count,p[f]=g,f++}}d.needsUpdate=!0,this._multiDrawCount=f,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,s){this.onBeforeRender(e,null,i,r,s)}}class $a extends Mr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new br(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 Ya=new wn,Ka=new wn,Za=new Ci,Ja=new Ri,Qa=new xi,eo=new wn,to=new wn;class no extends nr{constructor(e=new jr,t=new $a){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(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)Ya.fromBufferAttribute(t,e-1),Ka.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Ya.distanceTo(Ka);e.setAttribute("lineDistance",new Fr(n,1))}return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Qa.copy(n.boundingSphere),Qa.applyMatrix4(i),Qa.radius+=r,!1===e.ray.intersectsSphere(Qa))return;Za.copy(i).invert(),Ja.copy(e.ray).applyMatrix4(Za);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,u=n.index,c=n.attributes.position;if(null!==u){const n=Math.max(0,s.start),i=Math.min(u.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=u.getX(r),i=u.getX(r+1),s=io(this,e,Ja,o,n,i,r);
vendor: 5,522 bytes, line 1
1s&&t.push(s)}if(this.isLineLoop){const r=u.getX(i-1),s=u.getX(n),a=io(this,e,Ja,o,r,s,i-1);a&&t.push(a)}}else{const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=io(this,e,Ja,o,r,r+1,r);n&&t.push(n)}if(this.isLineLoop){const r=io(this,e,Ja,o,i-1,n,i-1);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function io(e,t,n,i,r,s,a){const o=e.geometry.attributes.position;Ya.fromBufferAttribute(o,r),Ka.fromBufferAttribute(o,s);if(n.distanceSqToSegment(Ya,Ka,eo,to)>i)return;eo.applyMatrix4(e.matrixWorld);const l=t.ray.origin.distanceTo(eo);return l<t.near||l>t.far?void 0:{distance:l,point:to.clone().applyMatrix4(e.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:e}}const ro=new wn,so=new wn;class ao extends no{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)ro.fromBufferAttribute(t,e),so.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+ro.distanceTo(so);e.setAttribute("lineDistance",new Fr(n,1))}return this}}class oo extends no{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class lo extends Mr{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new br(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 uo=new Ci,co=new Ri,ho=new xi,po=new wn;class mo extends nr{constructor(e=new jr,t=new lo){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ho.copy(n.boundingSphere),ho.applyMatrix4(i),ho.radius+=r,!1===e.ray.intersectsSphere(ho))return;uo.copy(i).invert(),co.copy(e.ray).applyMatrix4(uo);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=n.index,u=n.attributes.position;if(null!==l){for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);n<r;n++){const r=l.getX(n);po.fromBufferAttribute(u,r),fo(po,r,o,i,e,t,this)}}else{for(let n=Math.max(0,s.start),r=Math.min(u.count,s.start+s.count);n<r;n++)po.fromBufferAttribute(u,n),fo(po,n,o,i,e,t,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function fo(e,t,n,i,r,s,a){const o=co.distanceSqToPoint(e);if(o<n){const n=new wn;co.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}class go extends Kn{constructor(e,t,n,i,r=1006,s=1006,a,o,l){super(e,t,n,i,r,s,a,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const u=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}}class _o extends Kn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Re,this.minFilter=Re,this.generateMipmaps=!1,this.needsUpdate=!0}}class yo extends Kn{constructor(e,t,n,i,r,s,a,o,l,u,c,h){super(null,s,a,o,l,u,i,r,c,h),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class vo extends Kn{constructor(e,t,n=1014,i,r,s,a=1003,o=1003,l,u=1026,c=1){if(u!==Ke&&u!==Ze)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},i,r,s,a,o,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Wn(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class xo extends Kn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class bo extends jr{constructor(e=1,t=1,n=4,i=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
vendor: 3,783 bytes, line 1
1s:e,height:t,capSegments:n,radialSegments:i,heightSegments:r},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),r=Math.max(1,Math.floor(r));const s=[],a=[],o=[],l=[],u=t/2,c=Math.PI/2*e,h=t,d=2*c+h,p=2*n+r,m=i+1,f=new wn,g=new wn;for(let _=0;_<=p;_++){let y=0,v=0,x=0,b=0;if(_<=n){const t=_/n,i=t*Math.PI/2;v=-u-e*Math.cos(i),x=e*Math.sin(i),b=-e*Math.cos(i),y=t*c}else if(_<=n+r){const i=(_-n)/r;v=i*t-u,x=e,b=0,y=c+i*h}else{const t=(_-n-r)/n,i=t*Math.PI/2;v=u+e*Math.sin(i),x=e*Math.cos(i),b=e*Math.sin(i),y=c+h+t*c}const T=Math.max(0,Math.min(1,y/d));let S=0;0===_?S=.5/i:_===p&&(S=-.5/i);for(let e=0;e<=i;e++){const t=e/i,n=t*Math.PI*2,r=Math.sin(n),s=Math.cos(n);g.x=-x*s,g.y=v,g.z=x*r,a.push(g.x,g.y,g.z),f.set(-x*s,b,x*r),f.normalize(),o.push(f.x,f.y,f.z),l.push(t+S,T)}if(_>0){const e=(_-1)*m;for(let t=0;t<i;t++){const n=e+t,i=e+t+1,r=_*m+t,a=_*m+t+1;s.push(n,i,r),s.push(i,a,r)}}}this.setIndex(s),this.setAttribute("position",new Fr(a,3)),this.setAttribute("normal",new Fr(o,3)),this.setAttribute("uv",new Fr(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bo(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class To extends jr{constructor(e=1,t=32,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],s=[],a=[],o=[],l=new wn,u=new Sn;s.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let c=0,h=3;c<=t;c++,h+=3){const r=n+c/t*i;l.x=e*Math.cos(r),l.y=e*Math.sin(r),s.push(l.x,l.y,l.z),a.push(0,0,1),u.x=(s[h]/e+1)/2,u.y=(s[h+1]/e+1)/2,o.push(u.x,u.y)}for(let c=1;c<=t;c++)r.push(c,c+1,0);this.setIndex(r),this.setAttribute("position",new Fr(s,3)),this.setAttribute("normal",new Fr(a,3)),this.setAttribute("uv",new Fr(o,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new To(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class So extends jr{constructor(e=1,t=1,n=1,i=32,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};const l=this;i=Math.floor(i),r=Math.floor(r);const u=[],c=[],h=[],d=[];let p=0;const m=[],f=n/2;let g=0;function _(n){const r=p,s=new Sn,m=new wn;let _=0;const y=!0===n?e:t,v=!0===n?1:-1;for(let e=1;e<=i;e++)c.push(0,f*v,0),h.push(0,v,0),d.push(.5,.5),p++;const x=p;for(let e=0;e<=i;e++){const t=e/i*o+a,n=Math.cos(t),r=Math.sin(t);m.x=y*r,m.y=f*v,m.z=y*n,c.push(m.x,m.y,m.z),h.push(0,v,0),s.x=.5*n+.5,s.y=.5*r*v+.5,d.push(s.x,s.y),p++}for(let e=0;e<i;e++){const t=r+e,i=x+e;!0===n?u.push(i,i+1,t):u.push(i+1,i,t),_+=3}l.addGroup(g,_,!0===n?1:2),g+=_}!function(){const s=new wn,_=new wn;let y=0;const v=(t-e)/n;for(let l=0;l<=r;l++){const u=[],g=l/r,y=g*(t-e)+e;for(let e=0;e<=i;e++){const t=e/i,r=t*o+a,l=Math.sin(r),m=Math.cos(r);_.x=y*l,_.y=-g*n+f,_.z=y*m,c.push(_.x,_.y,_.z),s.set(l,v,m).normalize(),h.push(s.x,s.y,s.z),d.push(t,1-g),u.push(p++)}m.push(u)}for(let n=0;n<i;n++)for(let i=0;i<r;i++){const s=m[i][n],a=m[i+1][n],o=m[i+1][n+1],l=m[i][n+1];(e>0||0!==i)&&(u.push(s,a,l),y+=3),(t>0||i!==r-1)&&(u.push(a,o,l),y+=3)}l.addGroup(g,y,0),g+=y}(),!1===s&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new Fr(c,3)),this.setAttribute("normal",new Fr(h,3)),this.setAttribute("uv",new Fr(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new So(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Mo extends So{constructor(e=1,t=1,n=32,i=1,r=!1,s=0,a=2*Math.PI){super(0,e,t,n,i,r,s,a),this.type="C
1oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(e){return new Mo(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class wo extends jr{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function a(e,t,n,i){const r=i+1,s=[];for(let a=0;a<=r;a++){s[a]=[];const i=e.clone().lerp(n,a/r),o=t.clone().lerp(n,a/r),l=r-a;for(let e=0;e<=l;e++)s[a][e]=0===e&&a===r?i:i.clone().lerp(o,e/l)}for(let a=0;a<r;a++)for(let e=0;e<2*(r-a)-1;e++){const t=Math.floor(e/2);e%2==0?(o(s[a][t+1]),o(s[a+1][t]),o(s[a][t])):(o(s[a][t+1]),o(s[a+1][t+1]),o(s[a+1][t]))}}function o(e){r.push(e.x,e.y,e.z)}function l(t,n){const i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function u(e,t,n,i){i<0&&1===e.x&&(s[t]=e.x-1),0===n.x&&0===n.z&&(s[t]=i/2/Math.PI+.5)}function c(e){return Math.atan2(e.z,-e.x)}function h(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){const n=new wn,i=new wn,r=new wn;for(let s=0;s<t.length;s+=3)l(t[s+0],n),l(t[s+1],i),l(t[s+2],r),a(n,i,r,e)}(i),function(e){const t=new wn;for(let n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){const e=new wn;for(let t=0;t<r.length;t+=3){e.x=r[t+0],e.y=r[t+1],e.z=r[t+2];const n=c(e)/2/Math.PI+.5,i=h(e)/Math.PI+.5;s.push(n,1-i)}(function(){const e=new wn,t=new wn,n=new wn,i=new wn,a=new Sn,o=new Sn,l=new Sn;for(let h=0,d=0;h<r.length;h+=9,d+=6){e.set(r[h+0],r[h+1],r[h+2]),t.set(r[h+3],r[h+4],r[h+5]),n.set(r[h+6],r[h+7],r[h+8]),a.set(s[d+0],s[d+1]),o.set(s[d+2],s[d+3]),l.set(s[d+4],s[d+5]),i.copy(e).add(t).add(n).divideScalar(3);const p=c(i);u(a,d+0,e,p),u(o,d+2,t,p),u(l,d+4,n,p)}})(),function(){for(let e=0;e<s.length;e+=6){const t=s[e+0],n=s[e+2],i=s[e+4],r=Math.max(t,n,i),a=Math.min(t,n,i);r>.9&&a<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new Fr(r,3)),this.setAttribute("normal",new Fr(r.slice(),3)),this.setAttribute("uv",new Fr(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wo(e.vertices,e.indices,e.radius,e.details)}}class Eo extends wo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 10,686 bytes, line 1
119,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Eo(e.radius,e.detail)}}const Ao=new wn,Ro=new wn,Co=new wn,No=new gr;class Po extends jr{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(mn*t),s=e.getIndex(),a=e.getAttribute("position"),o=s?s.count:a.count,l=[0,0,0],u=["a","b","c"],c=new Array(3),h={},d=[];for(let e=0;e<o;e+=3){s?(l[0]=s.getX(e),l[1]=s.getX(e+1),l[2]=s.getX(e+2)):(l[0]=e,l[1]=e+1,l[2]=e+2);const{a:t,b:n,c:o}=No;if(t.fromBufferAttribute(a,l[0]),n.fromBufferAttribute(a,l[1]),o.fromBufferAttribute(a,l[2]),No.getNormal(Co),c[0]=`${Math.round(t.x*i)},${Math.round(t.y*i)},${Math.round(t.z*i)}`,c[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,c[2]=`${Math.round(o.x*i)},${Math.round(o.y*i)},${Math.round(o.z*i)}`,c[0]!==c[1]&&c[1]!==c[2]&&c[2]!==c[0])for(let e=0;e<3;e++){const t=(e+1)%3,n=c[e],i=c[t],s=No[u[e]],a=No[u[t]],o=`${n}_${i}`,p=`${i}_${n}`;p in h&&h[p]?(Co.dot(h[p].normal)<=r&&(d.push(s.x,s.y,s.z),d.push(a.x,a.y,a.z)),h[p]=null):o in h||(h[o]={index0:l[e],index1:l[t],normal:Co.clone()})}}for(const e in h)if(h[e]){const{index0:t,index1:n}=h[e];Ao.fromBufferAttribute(a,t),Ro.fromBufferAttribute(a,n),d.push(Ao.x,Ao.y,Ao.z),d.push(Ro.x,Ro.y,Ro.z)}this.setAttribute("position",new Fr(d,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Io{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let a,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const u=n[i];return(i+(s-u)/(n[i+1]-u))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=t||(s.isVector2?new Sn:new wn);return o.copy(a).sub(s).normalize(),o}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new wn,i=[],r=[],s=[],a=new wn,o=new Ci;for(let d=0;d<=e;d++){const t=d/e;i[d]=this.getTangentAt(t,new wn)}r[0]=new wn,s[0]=new wn;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),c=Math.abs(i[0].y),h=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),c<=l&&(l=c,n.set(0,1,0)),h<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let d=1;d<=e;d++){if(r[d]=r[d-1].clone(),s[d]=s[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const e=Math.acos(_n(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(o.makeRotationAxis(a,e))}s[d].crossVectors(i[d],r[d])}if(!0===t){let t=Math.acos(_n(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}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 Lo extends Io{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(e,t=new Sn){const n=t,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const a=this.aStartAngle+e*r;let o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=o-this.aX,i=l-this.aY;o=n*e-i*t+this.aX,l=n*t+i*e+this.aY}return n.set(o,l)}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 Do extends Lo{constructor(e,t,n,i,r,s){super(e,t,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}}function Oo(){let e=0,t=0,n=0,i=0;function r(r,s,a,o){e=r,t=a,n=-3*r+3*s-2*a-o,i=2*r-2*s+a+o}return{initCatmullRom:function(e,t,n,i,s){r(t,n,s*(n-e),s*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,s,a,o){let l=(t-e)/s-(n-e)/(s+a)+(n-t)/a,u=(n-t)/a-(i-t)/(a+o)+(i-n)/o;l*=a,u*=a,r(t,n,l,u)},calc:function(r){const s=r*r;return e+t*r+n*s+i*(s*r)}}}const Uo=new wn,Fo=new Oo,Bo=new Oo,Vo=new Oo;class qo extends Io{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new wn){const n=t,i=this.points,r=i.length,s=(r-(this.closed?0:1))*e;let a,o,l=Math.floor(s),u=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===u&&l===r-1&&(l=r-2,u=1),this.closed||l>0?a=i[(l-1)%r]:(Uo.subVectors(i[0],i[1]).add(i[0]),a=Uo);const c=i[l%r],h=i[(l+1)%r];if(this.closed||l+2<r?o=i[(l+2)%r]:(Uo.subVectors(i[r-1],i[r-2]).add(i[r-1]),o=Uo),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(a.distanceToSquared(c),e),n=Math.pow(c.distanceToSquared(h),e),i=Math.pow(h.distanceToSquared(o),e);n<1e-4&&(n=1),t<1e-4&&(t=n),i<1e-4&&(i=n),Fo.initNonuniformCatmullRom(a.x,c.x,h.x,o.x,t,n,i),Bo.initNonuniformCatmullRom(a.y,c.y,h.y,o.y,t,n,i),Vo.initNonuniformCatmullRom(a.z,c.z,h.z,o.z,t,n,i)}else"catmullrom"===this.curveType&&(Fo.initCatmullRom(a.x,c.x,h.x,o.x,this.tension),Bo.initCatmullRom(a.y,c.y,h.y,o.y,this.tension),Vo.initCatmullRom(a.z,c.z,h.z,o.z,this.tension));return n.set(Fo.calc(u),Bo.calc(u),Vo.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.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 n=this.points[t];e.points.push(n.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 n=e.points[t];this.points.push((new wn).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function zo(e,t,n,i,r){const s=.5*(i-t),a=.5*(r-n),o=e*e;return(2*n-2*i+s+a)*(e*o)+(-3*n+3*i-2*s-a)*o+s*e+n}function ko(e,t,n,i){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function Go(e,t,n,i,r){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}class Ho extends Io{constructor(e=new Sn,t=new Sn,n=new Sn,i=new Sn){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Sn){const n=t,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(Go(e,i.x,r.x,s.x,a.x),Go(e,i.y,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.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 jo extends Io{constructor(e=new wn,t=new wn,n=new wn,i=new wn){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new wn){const n=t,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(Go(e,i.x,r.x,s.x,a.x),Go(e,i.y,r.y,s.y,a.y),Go(e,i.z,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.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 Wo extends Io{constructor(e=new Sn,t=new Sn){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Sn){const n=t;return 1===e?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 Sn){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 Xo extends Io{constructor(e=new wn,t=new wn){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new wn){const n=t;return 1===e?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,056 bytes, line 1
1getTangent(e,t=new wn){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 $o extends Io{constructor(e=new Sn,t=new Sn,n=new Sn){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Sn){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(ko(e,i.x,r.x,s.x),ko(e,i.y,r.y,s.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 Yo extends Io{constructor(e=new wn,t=new wn,n=new wn){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new wn){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(ko(e,i.x,r.x,s.x),ko(e,i.y,r.y,s.y),ko(e,i.z,r.z,s.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 Ko extends Io{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Sn){const n=t,i=this.points,r=(i.length-1)*e,s=Math.floor(r),a=r-s,o=i[0===s?s:s-1],l=i[s],u=i[s>i.length-2?i.length-1:s+1],c=i[s>i.length-3?i.length-1:s+2];return n.set(zo(a,o.x,l.x,u.x,c.x),zo(a,o.y,l.y,u.y,c.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new Sn).fromArray(n))}return this}}var Zo=Object.freeze({__proto__:null,ArcCurve:Do,CatmullRomCurve3:qo,CubicBezierCurve:Ho,CubicBezierCurve3:jo,EllipseCurve:Lo,LineCurve:Wo,LineCurve3:Xo,QuadraticBezierCurve:$o,QuadraticBezierCurve3:Yo,SplineCurve:Ko});class Jo extends Io{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=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new Zo[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const e=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-e/a;return s.getPointAt(o,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],a=s.isEllipseCurve?2*e:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?e*s.points.length:e,o=s.getPoints(a);for(let e=0;e<o.length;e++){const i=o[e];n&&n.equals(i)||(t.push(i),n=i)}}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 n=e.curves[t];this.curves.push(n.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 n=this.curves[t];e.curves.push(n.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 n=e.curves[t];this.curves.push((new Zo[n.type]).fromJSON(n))}return this}}class Qo extends Jo{constructor(e){super(),this.type="Path",this.currentPoint=new Sn,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 Wo(this.currentPoint.clone(),new Sn(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new $o(this.currentPoint.clone(),new Sn(e,t),new Sn(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,s){const a=new Ho(this.currentPoint.clone(),new Sn(e,t),new Sn(n,i),new Sn(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Ko(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,s){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+a,t+o,n,i,r,s),this}absarc(e,t,n,i,r,s){return this.absellipse(e,t,n,n,i,r,s),this}ellipse(e,t,n,i,r,s,a,o){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,r,s,a,o),this}absellipse(e,t,n,i,r,s,a,o){const l=new Lo(e,t,n,i,r,s,a,o);if(this.curves.length>0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),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 el extends Qo{constructor(e){super(e),this.uuid=gn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push(n.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 n=this.holes[t];e.holes.push(n.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 n=e.holes[t];this.holes.push((new Qo).fromJSON(n))}return this}}function tl(e,t,n=2){const i=t&&t.length,r=i?t[0]*n:e.length;let s=nl(e,0,r,n,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,u;if(i&&(s=function(e,t,n,i){const r=[];for(let s=0,a=t.length;s<a;s++){const n=nl(e,t[s]*i,s<a-1?t[s+1]*i:e.length,i,!1);n===n.next&&(n.steiner=!0),r.push(pl(n))}r.sort(ul);for(let s=0;s<r.length;s++)n=cl(r[s],n);return n}(e,t,s,n)),e.length>80*n){o=1/0,l=1/0;let t=-1/0,i=-1/0;for(let s=n;s<r;s+=n){const n=e[s],r=e[s+1];n<o&&(o=n),r<l&&(l=r),n>t&&(t=n),r>i&&(i=r)}u=Math.max(t-o,i-l),u=0!==u?32767/u:0}return rl(s,a,n,o,l,u,0),a}function nl(e,t,n,i,r){let s;if(r===function(e,t,n,i){let r=0;for(let s=t,a=n-i;s<n;s+=i)r+=(e[a]-e[s])*(e[s+1]+e[a+1]),a=s;return r}(e,t,n,i)>0)for(let a=t;a<n;a+=i)s=Ml(a/i|0,e[a],e[a+1],s);else for(let a=n-i;a>=t;a-=i)s=Ml(a/i|0,e[a],e[a+1],s);return s&&yl(s,s.next)&&(wl(s),s=s.next),s}function il(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!yl(i,i.next)&&0!==_l(i.prev,i,i.next))i=i.next;else{if(wl(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function rl(e,t,n,i,r,s,a){if(!e)return;!a&&s&&function(e,t,n,i){let r=e;do{0===r.z&&(r.z=dl(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}
vendor: 4,213 bytes, line 1
1while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n=1;do{let i,r=e;e=null;let s=null;for(t=0;r;){t++;let a=r,o=0;for(let e=0;e<n&&(o++,a=a.nextZ,a);e++);let l=n;for(;o>0||l>0&&a;)0!==o&&(0===l||!a||r.z<=a.z)?(i=r,r=r.nextZ,o--):(i=a,a=a.nextZ,l--),s?s.nextZ=i:e=i,i.prevZ=s,s=i;r=a}s.nextZ=null,n*=2}while(t>1)}(r)}(e,i,r,s);let o=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(s?al(e,i,r,s):sl(e))t.push(l.i,e.i,u.i),wl(e),e=u.next,o=u.next;else if((e=u)===o){a?1===a?rl(e=ol(il(e),t),t,n,i,r,s,2):2===a&&ll(e,t,n,i,r,s):rl(il(e),t,n,i,r,s,1);break}}}function sl(e){const t=e.prev,n=e,i=e.next;if(_l(t,n,i)>=0)return!1;const r=t.x,s=n.x,a=i.x,o=t.y,l=n.y,u=i.y,c=Math.min(r,s,a),h=Math.min(o,l,u),d=Math.max(r,s,a),p=Math.max(o,l,u);let m=i.next;for(;m!==t;){if(m.x>=c&&m.x<=d&&m.y>=h&&m.y<=p&&fl(r,o,s,l,a,u,m.x,m.y)&&_l(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function al(e,t,n,i){const r=e.prev,s=e,a=e.next;if(_l(r,s,a)>=0)return!1;const o=r.x,l=s.x,u=a.x,c=r.y,h=s.y,d=a.y,p=Math.min(o,l,u),m=Math.min(c,h,d),f=Math.max(o,l,u),g=Math.max(c,h,d),_=dl(p,m,t,n,i),y=dl(f,g,t,n,i);let v=e.prevZ,x=e.nextZ;for(;v&&v.z>=_&&x&&x.z<=y;){if(v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==r&&v!==a&&fl(o,c,l,h,u,d,v.x,v.y)&&_l(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&fl(o,c,l,h,u,d,x.x,x.y)&&_l(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=_;){if(v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==r&&v!==a&&fl(o,c,l,h,u,d,v.x,v.y)&&_l(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&fl(o,c,l,h,u,d,x.x,x.y)&&_l(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function ol(e,t){let n=e;do{const i=n.prev,r=n.next.next;!yl(i,r)&&vl(i,n,n.next,r)&&Tl(i,r)&&Tl(r,i)&&(t.push(i.i,n.i,r.i),wl(n),wl(n.next),n=e=r),n=n.next}while(n!==e);return il(n)}function ll(e,t,n,i,r,s){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&gl(a,e)){let o=Sl(a,e);return a=il(a,a.next),o=il(o,o.next),rl(a,t,n,i,r,s,0),void rl(o,t,n,i,r,s,0)}e=e.next}a=a.next}while(a!==e)}function ul(e,t){let n=e.x-t.x;if(0===n&&(n=e.y-t.y,0===n)){n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}return n}function cl(e,t){const n=function(e,t){let n=t;const i=e.x,r=e.y;let s,a=-1/0;if(yl(e,n))return n;do{if(yl(e,n.next))return n.next;if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const e=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>a&&(a=e,s=n.x<n.next.x?n:n.next,e===i))return s}n=n.next}while(n!==t);if(!s)return null;const o=s,l=s.x,u=s.y;let c=1/0;n=s;do{if(i>=n.x&&n.x>=l&&i!==n.x&&ml(r<u?i:a,r,l,u,r<u?a:i,r,n.x,n.y)){const t=Math.abs(r-n.y)/(i-n.x);Tl(n,e)&&(t<c||t===c&&(n.x>s.x||n.x===s.x&&hl(s,n)))&&(s=n,c=t)}n=n.next}while(n!==o);return s}(e,t);if(!n)return t;const i=Sl(n,e);return il(i,i.next),il(n,n.next)}function hl(e,t){return _l(e.prev,e,t.prev)<0&&_l(t.next,e,e.next)<0}function dl(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function pl(e){let t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function ml(e,t,n,i,r,s,a,o){return(r-a)*(t-o)>=(e-a)*(s-o)&&(e-a)*(i-o)>=(n-a)*(t-o)&&(n-a)*(s-o)>=(r-a)*(i-o)}function fl(e,t,n,i,r,s,a,o){return!(e===a&&t===o)&&ml(e,t,n,i,r,s,a,o)}function gl(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&vl(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Tl(e,t)&&Tl(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(_l(e.prev,e,t.prev)||_l(e,t.prev,t))||yl(e,t)&&_l(e.prev,e,e.next)>0&&_l(t.prev,t,t.next)>0)}function _l(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function yl(e,t){return e.x===t.x&&e.y===t.y}function vl(e,t,n,i){const r=bl(_l(e,t,n)),s=bl(_l(e,t,i)),a=bl(_l(n,i,e)),o=bl(_l(n,i,t));return r!==s&&a!==o||(!(0!==r||!xl(e,n,t))||(!(0!==s||!xl(e,i,t))||(!(0!==a||!xl(n,e,i))||!(0!==o||!xl(n,t,i
vendor: 4,875 bytes, line 1
1)))))}function xl(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function bl(e){return e>0?1:e<0?-1:0}function Tl(e,t){return _l(e.prev,e,e.next)<0?_l(e,t,e.next)>=0&&_l(e,e.prev,t)>=0:_l(e,t,e.prev)<0||_l(e,e.next,t)<0}function Sl(e,t){const n=El(e.i,e.x,e.y),i=El(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Ml(e,t,n,i){const r=El(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function wl(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function El(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Al{static triangulate(e,t,n=2){return tl(e,t,n)}}class Rl{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n}static isClockWise(e){return Rl.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];Cl(e),Nl(n,e);let s=e.length;t.forEach(Cl);for(let o=0;o<t.length;o++)i.push(s),s+=t[o].length,Nl(n,t[o]);const a=Al.triangulate(n,i);for(let o=0;o<a.length;o+=3)r.push(a.slice(o,o+3));return r}}function Cl(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Nl(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class Pl extends jr{constructor(e=new el([new Sn(.5,.5),new Sn(-.5,.5),new Sn(-.5,-.5),new Sn(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let a=0,o=e.length;a<o;a++){s(e[a])}function s(e){const s=[],a=void 0!==t.curveSegments?t.curveSegments:12,o=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:1;let u=void 0===t.bevelEnabled||t.bevelEnabled,c=void 0!==t.bevelThickness?t.bevelThickness:.2,h=void 0!==t.bevelSize?t.bevelSize:c-.1,d=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3;const m=t.extrudePath,f=void 0!==t.UVGenerator?t.UVGenerator:Il;let g,_,y,v,x,b=!1;m&&(g=m.getSpacedPoints(o),b=!0,u=!1,_=m.computeFrenetFrames(o,!1),y=new wn,v=new wn,x=new wn),u||(p=0,c=0,h=0,d=0);const T=e.extractPoints(a);let S=T.shape;const M=T.holes;if(!Rl.isClockWise(S)){S=S.reverse();for(let e=0,t=M.length;e<t;e++){const t=M[e];Rl.isClockWise(t)&&(M[e]=t.reverse())}}function w(e){const t=1e-10*1e-10;let n=e[0];for(let i=1;i<=e.length;i++){const r=i%e.length,s=e[r],a=s.x-n.x,o=s.y-n.y,l=a*a+o*o,u=Math.max(Math.abs(s.x),Math.abs(s.y),Math.abs(n.x),Math.abs(n.y));l<=t*u*u?(e.splice(r,1),i--):n=s}}w(S),M.forEach(w);const E=M.length,A=S;for(let t=0;t<E;t++){const e=M[t];S=S.concat(e)}function R(e,t,n){return e.clone().addScaledVector(t,n)}const C=S.length;function N(e,t,n){let i,r,s;const a=e.x-t.x,o=e.y-t.y,l=n.x-e.x,u=n.y-e.y,c=a*a+o*o,h=a*u-o*l;if(Math.abs(h)>Number.EPSILON){const h=Math.sqrt(c),d=Math.sqrt(l*l+u*u),p=t.x-o/h,m=t.y+a/h,f=((n.x-u/d-p)*u-(n.y+l/d-m)*l)/(a*u-o*l);i=p+a*f-e.x,r=m+o*f-e.y;const g=i*i+r*r;if(g<=2)return new Sn(i,r);s=Math.sqrt(g/2)}else{let e=!1;a>Number.EPSILON?l>Number.EPSILON&&(e=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(i=-o,r=a,s=Math.sqrt(c)):(i=a,r=o,s=Math.sqrt(c/2))}return new Sn(i/s,r/s)}const P=[];for(let t=0,n=A.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),P[t]=N(A[t],A[i],A[r]);const I=[];let L,D,O=P.concat();for(let t=0,n=E;t<n;t++){const e=M[t];L=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),L[t]=N(e[t],e[i],e[r]);I.push(L),O=O.concat(L)}if(0===p)D=Rl.triangulateShape(A,M);else{const e=[],t=[];for(let n=0;n<p;n++){const i=n/p,r=c*Math.cos(i*Math.PI/2),s=h*Math.sin(i*Math.PI/2)+d;for(let t=0,n=A.length;t<n;t++){const n=R(A[t],P[t],s);V(n.x,n.y,-r),0===i&&e.push(n)}for(let e=0,n=E;e<n;e++){const n=M[e];L=I[e];const a=[];for(let e=0,t=n.length;e<t;e++){const t=R(n[e],L[e],s);V(t.x,t.y,-r),0===i&&a.push(t)}0===i&&t.push(a)}}D=Rl.triangulateShape(e,t)}const U=D.length,F=h+d;for(let t=0;t<C;t++){const e=u?R(S[t],O[t],F):S[t];b?(v.copy(_.normals[0]).multiplyScalar(e.x),y.copy(_.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(v).add(y),V(x.x,x.y,x.z)):V(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<C;e++){const n=u?R(S[e],O[e],F):S[e];b?(v.copy(_.normals[t]).multiplyScalar(n.x),y.copy(_.binormals[t]).multiplyScalar(n.y),x.copy(g[t]).add(v).add(y),V(x.x,x.y,x.z)):V(n.x,n.y,l/o*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=c*Math.cos(e*Math.PI/2),i=h*Math.sin(e*Math.PI/2)+d;for(let t=0,r=A.length;t<r;t++){const e=R(A[t],P[t],i);V(e.x,e.y,l+n)}for(let t=0,r=M.length;t<r;t++){const e=M[t];L=I[t];for(let t=0,r=e.length;t<r;t++){const r=R(e[t],L[t],i);b?V(r.x,r.y+g[o-1].y,g[o-1].x+n):V(r.x,r.y,l+n)}}}function B(e,t){let n=e.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=o+2*p;
vendor: 8,418 bytes, line 1
1e<n;e++){const n=C*e,s=C*(e+1);z(t+i+n,t+r+n,t+r+s,t+i+s)}}}function V(e,t,n){s.push(e),s.push(t),s.push(n)}function q(e,t,r){k(e),k(t),k(r);const s=i.length/3,a=f.generateTopUV(n,i,s-3,s-2,s-1);G(a[0]),G(a[1]),G(a[2])}function z(e,t,r,s){k(e),k(t),k(s),k(t),k(r),k(s);const a=i.length/3,o=f.generateSideWallUV(n,i,a-6,a-3,a-2,a-1);G(o[0]),G(o[1]),G(o[3]),G(o[1]),G(o[2]),G(o[3])}function k(e){i.push(s[3*e+0]),i.push(s[3*e+1]),i.push(s[3*e+2])}function G(e){r.push(e.x),r.push(e.y)}!function(){const e=i.length/3;if(u){let e=0,t=C*e;for(let n=0;n<U;n++){const e=D[n];q(e[2]+t,e[1]+t,e[0]+t)}e=o+2*p,t=C*e;for(let n=0;n<U;n++){const e=D[n];q(e[0]+t,e[1]+t,e[2]+t)}}else{for(let e=0;e<U;e++){const t=D[e];q(t[2],t[1],t[0])}for(let e=0;e<U;e++){const t=D[e];q(t[0]+C*o,t[1]+C*o,t[2]+C*o)}}n.addGroup(e,i.length/3-e,0)}(),function(){const e=i.length/3;let t=0;B(A,t),t+=A.length;for(let n=0,i=M.length;n<i;n++){const e=M[n];B(e,t),t+=e.length}n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new Fr(i,3)),this.setAttribute("uv",new Fr(r,2)),this.computeVertexNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let i=0,r=e.length;i<r;i++){const t=e[i];n.shapes.push(t.uuid)}else n.shapes.push(e.uuid);n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){const n=[];for(let r=0,s=e.shapes.length;r<s;r++){const i=t[e.shapes[r]];n.push(i)}const i=e.options.extrudePath;return void 0!==i&&(e.options.extrudePath=(new Zo[i.type]).fromJSON(i)),new Pl(n,e.options)}}const Il={generateTopUV:function(e,t,n,i,r){const s=t[3*n],a=t[3*n+1],o=t[3*i],l=t[3*i+1],u=t[3*r],c=t[3*r+1];return[new Sn(s,a),new Sn(o,l),new Sn(u,c)]},generateSideWallUV:function(e,t,n,i,r,s){const a=t[3*n],o=t[3*n+1],l=t[3*n+2],u=t[3*i],c=t[3*i+1],h=t[3*i+2],d=t[3*r],p=t[3*r+1],m=t[3*r+2],f=t[3*s],g=t[3*s+1],_=t[3*s+2];return Math.abs(o-c)<Math.abs(a-u)?[new Sn(a,1-l),new Sn(u,1-h),new Sn(d,1-m),new Sn(f,1-_)]:[new Sn(o,1-l),new Sn(c,1-h),new Sn(p,1-m),new Sn(g,1-_)]}};class Ll extends wo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ll(e.radius,e.detail)}}class Dl extends jr{constructor(e=[new Sn(0,-.5),new Sn(.5,0),new Sn(0,.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=_n(i,0,2*Math.PI);const r=[],s=[],a=[],o=[],l=[],u=1/t,c=new wn,h=new Sn,d=new wn,p=new wn,m=new wn;let f=0,g=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:f=e[_+1].x-e[_].x,g=e[_+1].y-e[_].y,d.x=1*g,d.y=-f,d.z=0*g,m.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(m.x,m.y,m.z);break;default:f=e[_+1].x-e[_].x,g=e[_+1].y-e[_].y,d.x=1*g,d.y=-f,d.z=0*g,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),o.push(d.x,d.y,d.z),m.copy(p)}for(let _=0;_<=t;_++){const r=n+_*u*i,d=Math.sin(r),p=Math.cos(r);for(let n=0;n<=e.length-1;n++){c.x=e[n].x*d,c.y=e[n].y,c.z=e[n].x*p,s.push(c.x,c.y,c.z),h.x=_/t,h.y=n/(e.length-1),a.push(h.x,h.y);const i=o[3*n+0]*d,r=o[3*n+1],u=o[3*n+0]*p;l.push(i,r,u)}}for(let _=0;_<t;_++)for(let t=0;t<e.length-1;t++){const n=t+_*e.length,i=n,s=n+e.length,a=n+e.length+1,o=n+1;r.push(i,s,o),r.push(a,o,s)}this.setIndex(r),this.setAttribute("position",new Fr(s,3)),this.setAttribute("uv",new Fr(a,2)),this.setAttribute("normal",new Fr(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Dl(e.points,e.segments,e.phiStart,e.phiLength)}}class Ol extends wo{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ol(e.radius,e.detail)}}class Ul extends jr{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,s=t/2,a=Math.floor(n),o=Math.floor(i),l=a+1,u=o+1,c=e/a,h=t/o,d=[],p=[],m=[],f=[];for(let g=0;g<u;g++){const e=g*h-s;for(let t=0;t<l;t++){const n=t*c-r;p.push(n,-e,0),m.push(0,0,1),f.push(t/a),f.push(1-g/o)}}for(let g=0;g<o;g++)for(let e=0;e<a;e++){const t=e+l*g,n=e+l*(g+1),i=e+1+l*(g+1),r=e+1+l*g;d.push(t,n,r),d.push(n,i,r)}this.setIndex(d),this.setAttribute("position",new Fr(p,3)),this.setAttribute("normal",new Fr(m,3)),this.setAttribute("uv",new Fr(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ul(e.width,e.height,e.widthSegments,e.heightSegments)}}class Fl extends jr{constructor(e=.5,t=1,n=32,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const a=[],o=[],l=[],u=[];let c=e;const h=(t-e)/(i=Math.max(1,i)),d=new wn,p=new Sn;for(let m=0;m<=i;m++){for(let e=0;e<=n;e++){const i=r+e/n*s;d.x=c*Math.cos(i),d.y=c*Math.sin(i),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,u.push(p.x,p.y)}c+=h}for(let m=0;m<i;m++){const e=m*(n+1);for(let t=0;t<n;t++){const i=t+e,r=i,s=i+n+1,o=i+n+2,l=i+1;a.push(r,s,l),a.push(s,o,l)}}this.setIndex(a),this.setAttribute("position",new Fr(o,3)),this.setAttribute("normal",new Fr(l,3)),this.setAttribute("uv",new Fr(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fl(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Bl extends jr{constructor(e=new el([new Sn(0,.5),new Sn(-.5,-.5),new Sn(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],s=[];let a=0,o=0;if(!1===Array.isArray(e))l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(a,o,u),a+=o,o=0;function l(e){const a=i.length/3,l=e.extractPoints(t);let u=l.shape;const c=l.holes;!1===Rl.isClockWise(u)&&(u=u.reverse());for(let t=0,n=c.length;t<n;t++){const e=c[t];!0===Rl.isClockWise(e)&&(c[t]=e.reverse())}const h=Rl.triangulateShape(u,c);for(let t=0,n=c.length;t<n;t++){const e=c[t];u=u.concat(e)}for(let t=0,n=u.length;t<n;t++){const e=u[t];i.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,i=h.length;t<i;t++){const e=h[t],i=e[0]+a,r=e[1]+a,s=e[2]+a;n.push(i,r,s),o+=3}}this.setIndex(n),this.setAttribute("position",new Fr(i,3)),this.setAttribute("normal",new Fr(r,3)),this.setAttribute("uv",new Fr(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,i=e.length;n<i;n++){const i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}return new Bl(n,e.curveSegments)}}class Vl extends jr{constructor(e=1,t=32,n=16,i=0,r=2*Math.PI,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const o=Math.min(s+a,Math.PI);let l=0;const u=[],c=new wn,h=new wn,d=[],p=[],m=[],f=[];for(let g=0;g<=n;g++){const d=[],_=g/n;let y=0;0===g&&0===s?y=.5/t:g===n&&o===Math.PI&&(y=-.5/t);for(let n=0;n<=t;n++){const o=n/t;c.x=-e*Math.cos(i+o*r)*Math.sin(s+_*a),c.y=e*Math.cos(s+_*a),c.z=e*Math.sin(i+o*r)*Math.sin(s+_*a),p.push(c.x,c.y,c.z),h.copy(c).normalize(),m.push(h.x,h.y,h.z),f.push(o+y,1-_),d.push(l++)}u.push(d)}for(let g=0;g<n;g++)for(let e=0;e<t;e++){const t=u[g][e+1],i=u[g][e],r=u[g+1][e],a=u[g+1][e+1];(0!==g||s>0)&&d.push(t,i,a),(g!==n-1||o<Math.PI)&&d.push(i,r,a)}this.setIndex(d),this.setAttribute("position",new Fr(p,3)),this.setAttribute("normal",new Fr(m,3)),this.setAttribute("uv",new Fr(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}
vendor: 4,594 bytes, line 1
1static fromJSON(e){return new Vl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class ql extends wo{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ql(e.radius,e.detail)}}class zl extends jr{constructor(e=1,t=.4,n=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],a=[],o=[],l=[],u=new wn,c=new wn,h=new wn;for(let d=0;d<=n;d++)for(let s=0;s<=i;s++){const p=s/i*r,m=d/n*Math.PI*2;c.x=(e+t*Math.cos(m))*Math.cos(p),c.y=(e+t*Math.cos(m))*Math.sin(p),c.z=t*Math.sin(m),a.push(c.x,c.y,c.z),u.x=e*Math.cos(p),u.y=e*Math.sin(p),h.subVectors(c,u).normalize(),o.push(h.x,h.y,h.z),l.push(s/i),l.push(d/n)}for(let d=1;d<=n;d++)for(let e=1;e<=i;e++){const t=(i+1)*d+e-1,n=(i+1)*(d-1)+e-1,r=(i+1)*(d-1)+e,a=(i+1)*d+e;s.push(t,n,a),s.push(n,r,a)}this.setIndex(s),this.setAttribute("position",new Fr(a,3)),this.setAttribute("normal",new Fr(o,3)),this.setAttribute("uv",new Fr(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zl(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class kl extends jr{constructor(e=1,t=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],l=[],u=[],c=new wn,h=new wn,d=new wn,p=new wn,m=new wn,f=new wn,g=new wn;for(let y=0;y<=n;++y){const a=y/n*r*Math.PI*2;_(a,r,s,e,d),_(a+.01,r,s,e,p),f.subVectors(p,d),g.addVectors(p,d),m.crossVectors(f,g),g.crossVectors(m,f),m.normalize(),g.normalize();for(let e=0;e<=i;++e){const r=e/i*Math.PI*2,s=-t*Math.cos(r),a=t*Math.sin(r);c.x=d.x+(s*g.x+a*m.x),c.y=d.y+(s*g.y+a*m.y),c.z=d.z+(s*g.z+a*m.z),o.push(c.x,c.y,c.z),h.subVectors(c,d).normalize(),l.push(h.x,h.y,h.z),u.push(y/n),u.push(e/i)}}for(let y=1;y<=n;y++)for(let e=1;e<=i;e++){const t=(i+1)*(y-1)+(e-1),n=(i+1)*y+(e-1),r=(i+1)*y+e,s=(i+1)*(y-1)+e;a.push(t,n,s),a.push(n,r,s)}function _(e,t,n,i,r){const s=Math.cos(e),a=Math.sin(e),o=n/t*e,l=Math.cos(o);r.x=i*(2+l)*.5*s,r.y=i*(2+l)*a*.5,r.z=i*Math.sin(o)*.5}this.setIndex(a),this.setAttribute("position",new Fr(o,3)),this.setAttribute("normal",new Fr(l,3)),this.setAttribute("uv",new Fr(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kl(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Gl extends jr{constructor(e=new Yo(new wn(-1,-1,0),new wn(-1,1,0),new wn(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const s=e.computeFrenetFrames(t,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const a=new wn,o=new wn,l=new Sn;let u=new wn;const c=[],h=[],d=[],p=[];function m(r){u=e.getPointAt(r/t,u);const l=s.normals[r],d=s.binormals[r];for(let e=0;e<=i;e++){const t=e/i*Math.PI*2,r=Math.sin(t),s=-Math.cos(t);o.x=s*l.x+r*d.x,o.y=s*l.y+r*d.y,o.z=s*l.z+r*d.z,o.normalize(),h.push(o.x,o.y,o.z),a.x=u.x+n*o.x,a.y=u.y+n*o.y,a.z=u.z+n*o.z,c.push(a.x,a.y,a.z)}}!function(){for(let e=0;e<t;e++)m(e);m(!1===r?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=i;n++)l.x=e/t,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),s=(i+1)*e+t,a=(i+1)*(e-1)+t;p.push(n,r,a),p.push(r,s,a)}}()}(),this.setIndex(p),this.setAttribute("position",new Fr(c,3)),this.setAttribute("normal",new Fr(h,3)),this.setAttribute("uv",new Fr(d,2))}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 Gl((new Zo[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Hl extends jr{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],n=new Set,i=new wn,r=new wn;if(null!==e.index){const s=e.attributes.position,a=e.index;let o=e.groups;0===o.length&&(o=[{start:0,count:a.count,materialIndex:0}]);for(let e=0,l=o.length;e<l;++e){const l=o[e],u=l.start;for(let e=u,o=u+l.count;e<o;e+=3)for(let l=0;l<3;l++){const o=a.getX(e+l),u=a.getX(e+(l+1)%3);i.fromBufferAttribute(s,o),r.fromBufferAttribute(s,u),!0===jl(i,r,n)&&(t.push(i.x,i.y,i.z),t.pu
vendor: 13,216 bytes, line 1
1sh(r.x,r.y,r.z))}}}else{const s=e.attributes.position;for(let e=0,a=s.count/3;e<a;e++)for(let o=0;o<3;o++){const a=3*e+o,l=3*e+(o+1)%3;i.fromBufferAttribute(s,a),r.fromBufferAttribute(s,l),!0===jl(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new Fr(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function jl(e,t,n){const i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var Wl=Object.freeze({__proto__:null,BoxGeometry:ss,CapsuleGeometry:bo,CircleGeometry:To,ConeGeometry:Mo,CylinderGeometry:So,DodecahedronGeometry:Eo,EdgesGeometry:Po,ExtrudeGeometry:Pl,IcosahedronGeometry:Ll,LatheGeometry:Dl,OctahedronGeometry:Ol,PlaneGeometry:Ul,PolyhedronGeometry:wo,RingGeometry:Fl,ShapeGeometry:Bl,SphereGeometry:Vl,TetrahedronGeometry:ql,TorusGeometry:zl,TorusKnotGeometry:kl,TubeGeometry:Gl,WireframeGeometry:Hl});class Xl extends Mr{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new br(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class $l extends cs{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Yl extends Mr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new br(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 br(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Sn(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 Vi,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 Kl extends Yl{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 Sn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return _n(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new br(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 br(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new br(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 Zl extends Mr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new br(16777215),this.specular=new br(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new br(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Sn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vi,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Jl extends Mr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new br(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new br(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Sn(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 Ql extends Mr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Sn(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 eu extends Mr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new br(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new br(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Sn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vi,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class tu extends Mr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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 nu extends Mr{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}}
vendor: 20,676 bytes, line 1
1class iu extends Mr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new br(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Sn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ru extends $a{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function su(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function au(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ou(e){const t=e.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(function(t,n){return e[t]-e[n]}),n}function lu(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[a++]=e[i+n]}return r}function uu(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(t.push(s.time),n.push(...a)),s=e[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(t.push(s.time),a.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(t.push(s.time),n.push(a)),s=e[r++]}while(void 0!==s)}class cu{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let s=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(n=2,r=a);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0;break n}break e}for(;n<s;){const i=n+s>>>1;e<t[i]?s=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let s=0;s!==i;++s)t[s]=n[r+s];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class hu extends cu{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Bt,endingEnd:Bt}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,s=e+1,a=i[r],o=i[s];if(void 0===a)switch(this.getSettings_().endingStart){case Vt:r=e,a=2*t-n;break;case qt:r=i.length-2,a=t+i[r]-i[r+1];break;default:r=e,a=n}if(void 0===o)switch(this.getSettings_().endingEnd){case Vt:s=e,o=2*n-t;break;case qt:s=1,o=n+i[1]-i[0];break;default:s=e-1,o=t}const l=.5*(n-t),u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(o-n),this._offsetPrev=r*u,this._offsetNext=s*u}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),m=p*p,f=m*p,g=-h*f+2*h*m-h*p,_=(1+h)*f+(-1.5-2*h)*m+(-.5+h)*p+1,y=(-1-d)*f+(1.5+d)*m+.5*p,v=d*f-d*m;for(let x=0;x!==a;++x)r[x]=g*s[u+x]+_*s[l+x]+y*s[o+x]+v*s[c+x];return r}}class du extends cu{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,u=(n-t)/(i-t),c=1-u;for(let h=0;h!==a;++h)r[h]=s[l+h]*c+s[o+h]*u;return r}}class pu extends cu{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class mu{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=su(t,this.TimeBufferType),this.values=su(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:su(e.times,Array),values:su(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new pu(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new du(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new hu(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ot:t=this.InterpolantFactoryMethodDiscrete;break;case Ut:t=this.InterpolantFactoryMethodLinear;break;case Ft:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ot;case this.InterpolantFactoryMethodLinear:return Ut;case this.InterpolantFactoryMethodSmooth:return Ft}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==s&&n[s]>t;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*e,s*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(e=!1);let s=null;for(let a=0;a!==r;a++){const t=n[a];if("number"==typeof t&&isNaN(t)){e=!1;break}if(null!==s&&s>t){e=!1;break}s=t}if(void 0!==i&&au(i))for(let a=0,o=i.length;a!==o;++a){const t=i[a];if(isNaN(t)){e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Ft,r=e.length-1;let s=1;for(let a=1;a<r;++a){let r=!1;const o=e[a];if(o!==e[a+1]&&(1!==a||o!==e[0]))if(i)r=!0;else{const e=a*n,i=e-n,s=e+n;for(let a=0;a!==n;++a){const n=t[e+a];if(n!==t[i+a]||n!==t[s+a]){r=!0;break}}}if(r){if(a!==s){e[s]=e[a];const i=a*n,r=s*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++s}}if(r>0){e[s]=e[r];for(let e=r*n,i=s*n,a=0;a!==n;++a)t[i+a]=t[e+a];++s}return s!==e.length?(this.times=e.slice(0,s),this.values=t.slice(0,s*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}mu.prototype.ValueTypeName="",mu.prototype.TimeBufferType=Float32Array,mu.prototype.ValueBufferType=Float32Array,mu.prototype.DefaultInterpolation=Ut;class fu extends mu{constructor(e,t,n){super(e,t,n)}}fu.prototype.ValueTypeName="bool",fu.prototype.ValueBufferType=Array,fu.prototype.DefaultInterpolation=Ot,fu.prototype.InterpolantFactoryMethodLinear=void 0,fu.prototype.InterpolantFactoryMethodSmooth=void 0;class gu extends mu{constructor(e,t,n,i){super(e,t,n,i)}}gu.prototype.ValueTypeName="color";class _u extends mu{constructor(e,t,n,i){super(e,t,n,i)}}_u.prototype.ValueTypeName="number";class yu extends cu{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-t)/(i-t);let l=e*a;for(let u=l+a;l!==u;l+=4)Mn.slerpFlat(r,0,s,l-a,s,l,o);return r}}class vu extends mu{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new yu(this.times,this.values,this.getValueSize(),e)}}vu.prototype.ValueTypeName="quaternion",vu.prototype.InterpolantFactoryMethodSmooth=void 0;class xu extends mu{constructor(e,t,n){super(e,t,n)}}xu.prototype.ValueTypeName="string",xu.prototype.ValueBufferType=Array,xu.prototype.DefaultInterpolation=Ot,xu.prototype.InterpolantFactoryMethodLinear=void 0,xu.prototype.InterpolantFactoryMethodSmooth=void 0;class bu extends mu{constructor(e,t,n,i){super(e,t,n,i)}}bu.prototype.ValueTypeName="vector";class Tu{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=gn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let s=0,a=n.length;s!==a;++s)t.push(Su(n[s]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,s=n.length;r!==s;++r)t.push(mu.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let a=0;a<r;a++){let e=[],o=[];e.push((a+r-1)%r,a,(a+1)%r),o.push(0,1,0);const l=ou(e);e=lu(e,1,l),o=lu(o,1,l),i||0!==e[0]||(e.push(r),o.push(o[0])),s.push(new _u(".morphTargetInfluences["+t[a].name+"]",e,o).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,o=e.length;a<o;a++){const t=e[a],n=t.name.match(r);if(n&&n.length>1){const e=n[1];let r=i[e];r||(i[e]=r=[]),r.push(t)}}const s=[];for(const a in i)s.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return s}static parseAnimation(e,t){if(!e)return null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],a=[];uu(n,s,a,i),0!==s.length&&r.push(new e(t,s,a))}},i=[],r=e.name||"default",s=e.fps||30,a=e.blendMode;let o=e.length||-1;const l=e.hierarchy||[];for(let u=0;u<l.length;u++){const e=l[u].keys;if(e&&0!==e.length)if(e[0].morphTargets){const t={};let n;for(n=0;n<e.length;n++)if(e[n].morphTargets)for(let i=0;i<e[n].morphTargets.length;i++)t[e[n].morphTargets[i]]=-1;for(const r in t){const t=[],s=[];for(let i=0;i!==e[n].morphTargets.length;++i){const i=e[n];t.push(i.time),s.push(i.morphTarget===r?1:0)}i.push(new _u(".morphTargetInfluence["+r+"]",t,s))}o=t.length*s}else{const r=".bones["+t[u].name+"]";n(bu,r+".position",e,"pos",i),n(vu,r+".quaternion",e,"rot",i),n(bu,r+".scale",e,"scl",i)}}if(0===i.length)return null;return new this(r,o,i,a)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Su(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return _u;case"vector":case"vector2":case"vector3":case"vector4":return bu;case"color":return gu;case"quaternion":return vu;case"bool":case"boolean":return fu;case"string":return xu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];uu(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const Mu={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class wu{constructor(e,t,n){const i=this;let r,s=!1,a=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.abortController=new AbortController,this.itemStart=function(e){o++,!1===s&&void 0!==i.onStart&&i.onStart(e,a,o),s=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const Eu=new wu;class Au{constructor(e){this.manager=void 0!==e?e:Eu,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Au.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ru={};class Cu extends Error{constructor(e,t){super(e),this.response=t}}class Nu extends Au{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Mu.get(`file:${e}`);if(void 0!==r)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==Ru[e])return void Ru[e].push({onLoad:t,onProgress:n,onError:i});Ru[e]=[],Ru[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(s).then(t=>{if(200===t.status||0===t.status){if(t.status,"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=Ru[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(e){!function t(){i.read().then(({done:i,value:r})=>{if(i)e.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}},t=>{e.error(t)})}()}});return new Response(l)}throw new Cu(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>(new DOMParser).parseFromString(e,a));case"json":return e.json();default:if(""===a)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(a),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{Mu.add(`file:${e}`,t);const n=Ru[e];delete Ru[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}}).catch(t=>{const n=Ru[e];if(void 0===n)throw this.manager.itemError(e),t;delete Ru[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const Pu=new WeakMap;class Iu extends Au{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=Mu.get(`image:${e}`);if(void 0!==s){if(!0===s.complete)r.manager.itemStart(e),setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0);else{let e=Pu.get(s);void 0===e&&(e=[],Pu.set(s,e)),e.push({onLoad:t,onError:i})}return s}const a=Ln("img");function o(){u(),t&&t(this);const n=Pu.get(this)||[];for(let e=0;e<n.length;e++){const t=n[e];t.onLoad&&t.onLoad(this)}Pu.delete(this),r.manager.itemEnd(e)}function l(t){u(),i&&i(t),Mu.remove(`image:${e}`);const n=Pu.get(this)||[];for(let e=0;e<n.length;e++){const i=n[e];i.onError&&i.onError(t)}Pu.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),Mu.add(`image:${e}`,a),r.manager.itemStart(e),a.src=e,a}}class Lu extends Au{constructor(e){super(e)}load(e,t,n,i){const r=new Kn,s=new Iu(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r}}class Du extends nr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new br(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(t.object.target=this.target.uuid),t}}class Ou extends Du{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(nr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new br(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Uu=new Ci,Fu=new wn,Bu=new wn;class Vu{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Sn(512,512),this.mapType=De,this.map=null,this.mapPass=null,this.matrix=new Ci,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new wa,this._frameExtents=new Sn(1,1),this._viewportCount=1,this._viewports=[new Zn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Fu.setFromMatrixPosition(e.matrixWorld),t.position.copy(Fu),Bu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Bu),t.updateMatrixWorld(),Uu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Uu,t.coordinateSystem,t.reversedDepth),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(Uu)}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.n
vendor: 4,126 bytes, line 1
1ormalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class qu extends Vu{constructor(){super(new fs(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=2*fn*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class zu extends Du{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(nr.DEFAULT_UP),this.updateMatrix(),this.target=new nr,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new qu}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const ku=new Ci,Gu=new wn,Hu=new wn;class ju extends Vu{constructor(){super(new fs(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Sn(4,2),this._viewportCount=6,this._viewports=[new Zn(2,1,1,1),new Zn(0,1,1,1),new Zn(3,1,1,1),new Zn(1,1,1,1),new Zn(3,0,1,1),new Zn(1,0,1,1)],this._cubeDirections=[new wn(1,0,0),new wn(-1,0,0),new wn(0,0,1),new wn(0,0,-1),new wn(0,1,0),new wn(0,-1,0)],this._cubeUps=[new wn(0,1,0),new wn(0,1,0),new wn(0,1,0),new wn(0,1,0),new wn(0,0,1),new wn(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Gu.setFromMatrixPosition(e.matrixWorld),n.position.copy(Gu),Hu.copy(n.position),Hu.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Hu),n.updateMatrixWorld(),i.makeTranslation(-Gu.x,-Gu.y,-Gu.z),ku.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ku,n.coordinateSystem,n.reversedDepth)}}class Wu extends Du{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new ju}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Xu extends hs{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,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=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,a=i+t,o=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,a-=t*this.view.offsetY,o=a-t*this.view.height}
vendor: 6,554 bytes, line 1
1this.projectionMatrix.makeOrthographic(r,s,a,o,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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class $u extends Vu{constructor(){super(new Xu(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Yu extends Du{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(nr.DEFAULT_UP),this.updateMatrix(),this.target=new nr,this.shadow=new $u}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Ku extends Du{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Zu extends Du{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Ju{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new wn)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScaledVector(s[1],.488603*i),t.addScaledVector(s[2],.488603*r),t.addScaledVector(s[3],.488603*n),t.addScaledVector(s[4],n*i*1.092548),t.addScaledVector(s[5],i*r*1.092548),t.addScaledVector(s[6],.315392*(3*r*r-1)),t.addScaledVector(s[7],n*r*1.092548),t.addScaledVector(s[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScaledVector(s[1],1.023328*i),t.addScaledVector(s[2],1.023328*r),t.addScaledVector(s[3],1.023328*n),t.addScaledVector(s[4],.858086*n*i),t.addScaledVector(s[5],.858086*i*r),t.addScaledVector(s[6],.743125*r*r-.247708),t.addScaledVector(s[7],.858086*n*r),t.addScaledVector(s[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Qu extends Du{constructor(e=new Ju,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class ec extends Au{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,s=new Nu(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(s){i&&i(s),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(e){return t[e],t[e]}const i=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new br).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(i.dispersion=e.dispersion),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(i.depthFunc=e.depthFunc),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(i.blendSrc=e.blendSrc),void 0!==e.blendDst&&(i.blendDst=e.blendDst),void 0!==e.blendEquation&&(i.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(i.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&
vendor: 2,369 bytes, line 1
1(i.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(i.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(i.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),void 0!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const r in e.uniforms){const t=e.uniforms[r];switch(i.uniforms[r]={},t.type){case"t":i.uniforms[r].value=n(t.value);break;case"c":i.uniforms[r].value=(new br).setHex(t.value);break;case"v2":i.uniforms[r].value=(new Sn).fromArray(t.value);break;case"v3":i.uniforms[r].value=(new wn).fromArray(t.value);break;case"v4":i.uniforms[r].value=(new Zn).fromArray(t.value);break;case"m3":i.uniforms[r].value=(new Rn).fromArray(t.value);break;
vendor: 4,846 bytes, line 1
1case"m4":i.uniforms[r].value=(new Ci).fromArray(t.value);break;default:i.uniforms[r].value=t.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=(new Sn).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapRotation&&i.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Sn).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return ec.createMaterialFromType(e)}static createMaterialFromType(e){return new{ShadowMaterial:Xl,SpriteMaterial:Cs,RawShaderMaterial:$l,ShaderMaterial:cs,PointsMaterial:lo,MeshPhysicalMaterial:Kl,MeshStandardMaterial:Yl,MeshPhongMaterial:Zl,MeshToonMaterial:Jl,MeshNormalMaterial:Ql,MeshLambertMaterial:eu,MeshDepthMaterial:tu,MeshDistanceMaterial:nu,MeshBasicMaterial:wr,MeshMatcapMaterial:iu,LineDashedMaterial:ru,LineBasicMaterial:$a,Material:Mr}[e]}}class tc{static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class nc extends jr{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class ic extends Au{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Nu(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(s){i&&i(s),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(e,i){if(void 0!==t[i])return t[i];const r=e.interleavedBuffers[i],s=function(e,t){if(void 0!==n[t])return n[t];const i=e.arrayBuffers,r=i[t],s=new Uint32Array(r).buffer;return n[t]=s,s}(e,r.buffer),a=In(r.type,s),o=new Es(a,r.stride);return o.uuid=r.uuid,t[i]=o,o}
1const r=e.isInstancedBufferGeometry?new nc:new jr,s=e.data.index;if(void 0!==s){const e=In(s.type,s.array);r.setIndex(new Lr(e,1))}const a=e.data.attributes;for(const c in a){const t=a[c];let n;if(t.isInterleavedBufferAttribute){const r=i(e.data,t.data);n=new Rs(r,t.itemSize,t.offset,t.normalized)}else{const e=In(t.type,t.array);n=new(t.isInstancedBufferAttribute?ua:Lr)(e,t.itemSize,t.normalized)}void 0!==t.name&&(n.name=t.name),void 0!==t.usage&&n.setUsage(t.usage),r.setAttribute(c,n)}const o=e.data.morphAttributes;if(o)for(const c in o){const t=o[c],n=[];for(let r=0,s=t.length;r<s;r++){const s=t[r];let a;if(s.isInterleavedBufferAttribute){const t=i(e.data,s.data);a=new Rs(t,s.itemSize,s.offset,s.normalized)}else{const e=In(s.type,s.array);a=new Lr(e,s.itemSize,s.normalized)}void 0!==s.name&&(a.name=s.name),n.push(a)}r.morphAttributes[c]=n}e.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let c=0,h=l.length;c!==h;++c){const e=l[c];r.addGroup(e.start,e.count,e.materialIndex)}const u=e.data.boundingSphere;return void 0!==u&&(r.boundingSphere=(new xi).fromJSON(u)),e.name&&(r.name=e.name),e.userData&&(r.userData=e.userData),r}}const rc={UVMapping:ve,CubeReflectionMapping:xe,CubeRefractionMapping:be,EquirectangularReflectionMapping:Te,EquirectangularRefractionMapping:Se,CubeUVReflectionMapping:Me},sc={RepeatWrapping:we,ClampToEdgeWrapping:Ee,MirroredRepeatWrapping:Ae},ac={NearestFilter:Re,NearestMipmapNearestFilter:Ce,NearestMipmapLinearFilter:Ne,LinearFilter:Pe,LinearMipmapNearestFilter:Ie,LinearMipmapLinearFilter:Le},oc=new WeakMap;class lc extends Au{constructor(e){super(e),this.isImageBitmapLoader=!0,this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=Mu.get(`image-bitmap:${e}`);if(void 0!==s)return r.manager.itemStart(e),s.then?void s.then(n=>{if(!0!==oc.has(s))return t&&t(n),r.manager.itemEnd(e),n;i&&i(oc.get(s)),r.manager.itemError(e),r.manager.itemEnd(e)}):(setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0),s);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const o=fetch(e,a).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(n){return Mu.add(`image-bitmap:${e}`,n),t&&t(n),r.manager.itemEnd(e),n}).catch(function(t){i&&i(t),oc.set(o,t),Mu.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});Mu.add(`image-bitmap:${e}`,o),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let uc;class cc{static getContext(){return void 0===uc&&(uc=new(window.AudioContext||window.webkitAudioContext)),uc}static setContext(e){uc=e}}const hc=new Ci,dc=new Ci,pc=new Ci;class mc extends fs{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class fc{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const gc=new wn,_c=new Mn,yc=new wn,vc=new wn,xc=new wn;class bc extends nr{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl
1=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return;if(!1===this.hasPlaybackControl)return;this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1!==this.hasPlaybackControl&&this.loop}setLoop(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),"buffer"!==e.sourceType||(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice()),this}clone(e){return new this.constructor(this.listener).copy(this,e)}}const Tc=new wn,Sc=new Mn,Mc=new wn,wc=new wn;class Ec{constructor(e,t,n){let i,r,s;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let s=this.cumulativeWeight;if(0===s){for(let e=0;e!==i;++e)n[r+e]=n[e];
vendor: 9,709 bytes, line 1
1s=t}else{s+=t;const e=t/s;this._mixBufferRegion(n,r,0,e,i)}this.cumulativeWeight=s}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const e=t*this._origIndex;this._mixBufferRegion(n,i,e,1-r,t)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let o=t,l=t+t;o!==l;++o)if(n[o]!==n[o+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,s=i;r!==s;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let s=0;s!==r;++s)e[t+s]=e[n+s]}_slerp(e,t,n,i){Mn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;Mn.multiplyQuaternionsFlat(e,s,e,t,e,n),Mn.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=t+a;e[r]=e[r]*s+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const Ac="\\[\\]\\.:\\/",Rc=new RegExp("["+Ac+"]","g"),Cc="[^"+Ac+"]",Nc="[^"+Ac.replace("\\.","")+"]",Pc=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Cc)+/(WCOD+)?/.source.replace("WCOD",Nc)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Cc)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Cc)+"$"),Ic=["material","materials","bones","map"];class Lc{constructor(e,t,n){this.path=t,this.parsedPath=n||Lc.parseTrackName(t),this.node=Lc.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Lc.Composite(e,t,n):new Lc(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Rc,"")}static parseTrackName(e){const t=Pc.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Ic.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const s=n(r.children);if(s)return s}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=Lc.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return;if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return;if(!e.material.materials)return;e=e.material.materials;break;case"bones":if(!e.skeleton)return;e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return;if(!e.material.map)return;e=e.material.map;break;default:if(void 0===e[n])return;e=e[n]}if(void 0!==i){if(void 0===e[i])return;e=e[i]}}const s=e[i];if(void 0===s){t.nodeName;return}let a=this.Versioning.None;this.targetObject=e,!0===e.isMaterial?a=this.Versioning.NeedsUpdate:!0===e.isObject3D&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return;if(!e.geometry.morphAttributes)return;void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(o=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Lc.Composite=class{constructor(e,t,n){const i=n||Lc.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Lc.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Lc.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Lc.prototype.GetterByBindingType=[Lc.prototype._getValue_direct,Lc.prototype._getValue_array,Lc.prototype._getValue_arrayElement,Lc.prototype._getValue_toArray],Lc.prototype.SetterByBindingTypeAndVersioning=[[Lc.prototype._setValue_direct,Lc.prototype._setValue_direct_setNeedsUpdate,Lc.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Lc.prototype._setValue_array,Lc.prototype._setValue_array_setNeedsUpdate,Lc.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Lc.prototype._setValue_arrayElement,Lc.prototype._setValue_arrayElement_setNeedsUpdate,Lc.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Lc.prototype._setValue_fromArray,Lc.prototype._setValue_fromArray_setNeedsUpdate,Lc.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Dc{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,a=new Array(s),o={endingStart:Bt,endingEnd:Bt};for(let l=0;l!==s;++l){const e=r[l].createInterpolant(null);a[l]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}
vendor: 3,777 bytes, line 1
1fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),!0===n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+n,l[0]=e/s,l[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;i<0||0===n?t=0:(this._startTime=null,t=n*i)}t*=this._updateTimeScale(e);const s=this._updateTime(t),a=this._updateWeight(e);if(a>0){const e=this._interpolants,t=this._propertyBindings;if(this.blendMode===kt)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(a);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,a)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=2202===n;if(0===e)return-1===r||!s||1&~r?i:t-i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===a){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&!(1&~r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Vt,i.endingEnd=Vt):(i.endingStart=e?this.zeroSlopeAtStart?Vt:Bt:qt,i.endingEnd=t?this.zeroSlopeAtEnd?Vt:Bt:qt)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=t,a[1]=r+e,o[1]=n,this}}const Oc=new Float32Array(1);let Uc=0;
vendor: 9,328 bytes, line 1
1class Fc extends Es{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 Bc=new Ci;class Vc{constructor(e,t,n=0,i=1/0){this.ray=new Ri(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new qi,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)}setFromXRController(e){return Bc.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Bc),this}intersectObject(e,t=!0,n=[]){return zc(e,this,n,t),n.sort(qc),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)zc(e[i],this,n,t);return n.sort(qc),n}}function qc(e,t){return e.distance-t.distance}function zc(e,t,n,i){let r=!0;if(e.layers.test(t.layers)){!1===e.raycast(t,n)&&(r=!1)}if(!0===r&&!0===i){const i=e.children;for(let e=0,r=i.length;e<r;e++)zc(i[e],t,n,!0)}}function kc(){!1===this._document.hidden&&this.reset()}class Gc{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(){const e=1e-6;return this.phi=_n(this.phi,e,Math.PI-e),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),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(_n(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Hc{constructor(e,t,n,i){Hc.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const jc=new Sn;const Wc=new wn,Xc=new wn,$c=new wn,Yc=new wn,Kc=new wn,Zc=new wn,Jc=new wn;class Qc{constructor(e=new wn,t=new wn){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){Wc.subVectors(e,this.start),Xc.subVectors(this.end,this.start);const n=Xc.dot(Xc);let i=Xc.dot(Wc)/n;return t&&(i=_n(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=Zc,n=Jc){const i=1e-8*1e-8;let r,s;const a=this.start,o=e.start,l=this.end,u=e.end;$c.subVectors(l,a),Yc.subVectors(u,o),Kc.subVectors(a,o);const c=$c.dot($c),h=Yc.dot(Yc),d=Yc.dot(Kc);if(c<=i&&h<=i)return t.copy(a),n.copy(o),t.sub(n),t.dot(t);if(c<=i)r=0,s=d/h,s=_n(s,0,1);else{const e=$c.dot(Kc);if(h<=i)s=0,r=_n(-e/c,0,1);else{const t=$c.dot(Yc),n=c*h-t*t;r=0!==n?_n((t*d-e*h)/n,0,1):0,s=(t*r+d)/h,s<0?(s=0,r=_n(-e/c,0,1)):s>1&&(s=1,r=_n((t-e)/c,0,1))}}return t.copy(a).add($c.multiplyScalar(r)),n.copy(o).add(Yc.multiplyScalar(s)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const eh=new wn;const th=new wn,nh=new Ci,ih=new Ci;function rh(e){const t=[];!0===e.isBone&&t.push(e);for(let n=0;n<e.children.length;n++)t.push(...rh(e.children[n]));return t}const sh=new wn,ah=new br,oh=new br;const lh=new wn,uh=new wn,ch=new wn;const hh=new wn,dh=new hs;function ph(e,t,n,i,r,s,a){hh.set(r,s,a).unproject(i);const o=t[e];if(void 0!==o){const e=n.getAttribute("position");for(let t=0,n=o.length;t<n;t++)e.setXYZ(o[t],hh.x,hh.y,hh.z)}}const mh=new ni;const fh=new wn;let gh,_h;class yh{constructor(){this.type="ShapePath",this.color=new br,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Qo,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e,t){const n=t.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=t[r],a=t[s],o=a.x-n.x,l=a.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[s],o=-o,a=t[r],l=-l),e.y<n.y||e.y>a.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(a.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=a.x)return!0}}return i}const n=Rl.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,a;const o=[];if(1===i.length)return s=i[0],a=new el,a.curves=s.curves,o.push(a),o;let l=!n(i[0].getPoints());l=e?!l:l;const u=[],c=[];let h,d,p=[],m=0;c[m]=void 0,p[m]=[];for(let f=0,g=i.length;f<g;f++)s=i[f],h=s.getPoints(),r=n(h),r=e?!r:r,r?(!l&&c[m]&&m++,c[m]={s:new el,p:h},c[m].s.curves=s.curves,l&&m++,p[m]=[]):p[m].push({h:s,p:h[0]});if(!c[0])return function(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n],r=new el;r.curves=i.curves,t.push(r)}return t}(i);if(c.length>1){let e=!1,n=0;for(let t=0,i=c.length;t<i;t++)u[t]=[];for(let i=0,r=c.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const a=r[s];let o=!0;for(let r=0;r<c.length;r++)t(a.p,c[r].p)&&(i!==r&&n++,o?(o=!1,u[r].push(a)):e=!0);o&&u[i].push(a)}}n>0&&!1===e&&(p=u)}for(let f=0,g=c.length;f<g;f++){a=c[f].s,o.push(a),d=p[f];for(let e=0,t=d.length;e<t;e++)a.holes.push(d[e].h)}return o}}class vh extends hn{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){void 0!==e&&(null!==this.domElement&&this.disconnect(),this.domElement=e)}disconnect(){}dispose(){}update(){}}function xh(e,t,n,i){const r=function(e){switch(e){case De:case Oe:return{byteLength:1,components:1};case Fe:case Ue:case ze:return{byteLength:2,components:1};case ke:case Ge:return{byteLength:2,components:4};case Ve:case Be:case qe:return{byteLength:4,components:1};case je:case We:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${e}.`)}(i);switch(n){case Xe:return e*t;case Je:case Qe:return e*t/r.components*r.byteLength;case et:case tt:return e*t*2/r.components*r.byteLength;case $e:return e*t*3/r.components*r.byteLength;case Ye:case nt:return e*t*4/r.components*r.byteLength;case it:case rt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case st:case at:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case lt:case ct:return Math.max(e,16)*Math.max(t,8)/4;case ot:case ut:return Math.max(e,8)*Math.max(t,8)/2;case ht:case dt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case pt:case mt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case ft:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case gt:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case _t:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case yt:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case vt:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case xt:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case bt:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case Tt:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case St:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Mt:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case wt:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case Et:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case At:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case Rt:case Ct:case Nt:return Math.ceil(e/4)*Math.ceil(t/4)*16;case Pt:case It:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Lt:case Dt:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function bh(){let e=null,t=!1,n=null,i=null;function r(t,s){n(t,s),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Th(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))}
vendor: 2,001 bytes, line 1
1,update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,s=i.byteLength,a=e.createBuffer();let o;if(e.bindBuffer(n,a),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)o=e.FLOAT;else if("undefined"!=typeof Float16Array&&i instanceof Float16Array)o=e.HALF_FLOAT;else if(i instanceof Uint16Array)o=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)o=e.SHORT;else if(i instanceof Uint32Array)o=e.UNSIGNED_INT;else if(i instanceof Int32Array)o=e.INT;else if(i instanceof Int8Array)o=e.BYTE;else if(i instanceof Uint8Array)o=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);o=e.UNSIGNED_BYTE}return{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.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.");!function(t,n,i){const r=n.array,s=n.updateRanges;if(e.bindBuffer(i,t),0===s.length)e.bufferSubData(i,0,r);else{s.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<s.length;e++){const n=s[t],i=s[e];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++t,s[t]=i)}s.length=t+1;for(let n=0,a=s.length;n<a;n++){const t=s[n];e.bufferSubData(i,t.start*r.BYTES_PER_ELEMENT,r,t.start,t.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:V}})),"undefined"!=typeof window&&(window.__THREE__||(window.__THREE__=V));const Sh
vendor: 24,872 bytes, line 1
1={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn 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 );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn 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 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t}
vendor: 5,673 bytes, line 1
1 else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}
vendor: 5,966 bytes, line 1
1\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid 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 ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;
vendor: 4,695 bytes, line 1
1\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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 ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alph
vendor: 11,921 bytes, line 1
1aB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid 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 ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid 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 ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
vendor: 8,486 bytes, line 1
1\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOG
1ARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
vendor: 4,661 bytes, line 1
1\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 25
vendor: 7,335 bytes, line 1
15.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\treturn step( depth, compare );\n\t\t#else\n\t\t\treturn step( compare, depth );\n\t\t#endif\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\tfloat hard_shadow = step( distribution.x, compare );\n\t\t#else\n\t\t\tfloat hard_shadow = step( compare, distribution.x );\n\t\t#endif\n\t\tif ( hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;
vendor: 11,346 bytes, line 1
1\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
vendor: 2,005 bytes, line 1
1\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);
vendor: 9,105 bytes, line 1
1\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;
vendor: 5,728 bytes, line 1
1\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
vendor: 25,681 bytes, line 1
1\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;
vendor: 11,562 bytes, line 1
1\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},
vendor: 766 bytes, line 1
1Mh={common:{diffuse:{value:new br(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Rn},alphaMap:{value:null},alphaMapTransform:{value:new Rn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Rn}},envmap:{envMap:{value:null},envMapRotation:{value:new Rn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Rn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Rn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Rn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Rn},normalScale:{value:new Sn(1,1)}}
vendor: 7,768 bytes, line 1
1,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Rn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Rn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Rn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Rn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new br(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new br(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Rn},alphaTest:{value:0},uvTransform:{value:new Rn}},sprite:{diffuse:{value:new br(16777215)},opacity:{value:1},center:{value:new Sn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Rn},alphaMap:{value:null},alphaMapTransform:{value:new Rn},alphaTest:{value:0}}},wh={basic:{uniforms:os([Mh.common,Mh.specularmap,Mh.envmap,Mh.aomap,Mh.lightmap,Mh.fog]),vertexShader:Sh.meshbasic_vert,fragmentShader:Sh.meshbasic_frag},lambert:{uniforms:os([Mh.common,Mh.specularmap,Mh.envmap,Mh.aomap,Mh.lightmap,Mh.emissivemap,Mh.bumpmap,Mh.normalmap,Mh.displacementmap,Mh.fog,Mh.lights,{emissive:{value:new br(0)}}]),vertexShader:Sh.meshlambert_vert,fragmentShader:Sh.meshlambert_frag},phong:{uniforms:os([Mh.common,Mh.specularmap,Mh.envmap,Mh.aomap,Mh.lightmap,Mh.emissivemap,Mh.bumpmap,Mh.normalmap,Mh.displacementmap,Mh.fog,Mh.lights,{emissive:{value:new br(0)},specular:{value:new br(1118481)},shininess:{value:30}}]),vertexShader:Sh.meshphong_vert,fragmentShader:Sh.meshphong_frag},standard:{uniforms:os([Mh.common,Mh.envmap,Mh.aomap,Mh.lightmap,Mh.emissivemap,Mh.bumpmap,Mh.normalmap,Mh.displacementmap,Mh.roughnessmap,Mh.metalnessmap,Mh.fog,Mh.lights,{emissive:{value:new br(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Sh.meshphysical_vert,fragmentShader:Sh.meshphysical_frag},toon:{uniforms:os([Mh.common,Mh.aomap,Mh.lightmap,Mh.emissivemap,Mh.bumpmap,Mh.normalmap,Mh.displacementmap,Mh.gradientmap,Mh.fog,Mh.lights,{emissive:{value:new br(0)}}]),vertexShader:Sh.meshtoon_vert,fragmentShader:Sh.meshtoon_frag},matcap:{uniforms:os([Mh.common,Mh.bumpmap,Mh.normalmap,Mh.displacementmap,Mh.fog,{matcap:{value:null}}]),vertexShader:Sh.meshmatcap_vert,fragmentShader:Sh.meshmatcap_frag},points:{uniforms:os([Mh.points,Mh.fog]),vertexShader:Sh.points_vert,fragmentShader:Sh.points_frag},dashed:{uniforms:os([Mh.common,Mh.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Sh.linedashed_vert,fragmentShader:Sh.linedashed_frag},depth:{uniforms:os([Mh.common,Mh.displacementmap]),vertexShader:Sh.depth_vert,fragmentShader:Sh.depth_frag},normal:{uniforms:os([Mh.common,Mh.bumpmap,Mh.normalmap,Mh.displacementmap,{opacity:{value:1}}]),vertexShader:Sh.meshnormal_vert,fragmentShader:Sh.meshnormal_frag},sprite:{uniforms:os([Mh.sprite,Mh.fog]),vertexShader:Sh.sprite_vert,fragmentShader:Sh.sprite_frag},background:{uniforms:{uvTransform:{value:new Rn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Sh.background_vert,fragmentShader:Sh.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Rn}},vertexShader:Sh.backgroundCube_vert,fragmentShader:Sh.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Sh.cube_vert,fragmentShader:Sh.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Sh.equirect_vert,fragmentShader:Sh.equirect_frag},distanceRGBA:{uniforms:os([Mh.common,Mh.displacementmap,{referencePosition:{value:new wn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Sh.distanceRGBA_vert,fragmentShader:Sh.distanceRGBA_frag},shadow:{uniforms:os([Mh.lights,Mh.fog,{color:{value:new br(0)},opacity:{value:1}}]),vertexShader:Sh.shadow_vert,fragmentShader:Sh.shadow_frag}};wh.physical={uniforms:os([wh.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Rn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Rn},clearcoatNormalScale:{value:new Sn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Rn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Rn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Rn},sheen:{value:0},sheenColor:{value:new br(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Rn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Rn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Rn},transmissionSamplerSize:{value:new Sn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Rn},attenuationDistance:{value:0},attenuationColor:{value:new br(0)},specularColor:{value:new br(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Rn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Rn},anisotropyVector:{value:new Sn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Rn}}]),vertexShader:Sh.meshphysical_vert,fragmentShader:Sh.meshphysical_frag};const Eh={r:0,b:0,g:0},Ah=new Vi,Rh=new Ci;function Ch(e,t,n,i,r,s,a){const o=new br(0);let l,u,c=!0===s?0:1,h=null,d=0,p=null;function m(e){let i=!0===e.isScene?e.background:null;if(i&&i.isTexture){i=(e.backgroundBlurriness>0?n:t).get(i)}return i}function f(t,n){t.getRGB(Eh,ls(e)),i.buffers.color.setClear(Eh.r,Eh.g,Eh.b,n,a)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),c=t,f(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,f(o,c)},render:function(t){let n=!1;const r=m(t);null===r?f(o,c):r&&r.isColor&&(f(r,1),n=!0);const s=e.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,a),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=m(n);i&&(i.isCubeTexture||i.mapping===Me)?(void 0===u&&(u=new is(new ss(1,1,1),new cs({name:"Backgroun
1dCubeMaterial",uniforms:as(wh.backgroundCube.uniforms),vertexShader:wh.backgroundCube.vertexShader,fragmentShader:wh.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Ah.copy(n.backgroundRotation),Ah.x*=-1,Ah.y*=-1,Ah.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Ah.y*=-1,Ah.z*=-1),u.material.uniforms.envMap.value=i,u.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Rh.makeRotationFromEuler(Ah)),u.material.toneMapped=qn.getTransfer(i.colorSpace)!==Xt,h===i&&d===i.version&&p===e.toneMapping||(u.material.needsUpdate=!0,h=i,d=i.version,p=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new is(new Ul(2,2),new cs({name:"BackgroundMaterial",uniforms:as(wh.background.uniforms),vertexShader:wh.background.vertexShader,fragmentShader:wh.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=qn.getTransfer(i.colorSpace)!==Xt,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),h===i&&d===i.version&&p===e.toneMapping||(l.material.needsUpdate=!0,h=i,d=i.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==u&&(u.geometry.dispose(),u.material.dispose(),u=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function Nh(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=u(null);let s=r,a=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function u(e){const t=[],i=[],r=[];for(let s=0;s<n;s++)t[s]=0,i[s]=0,r[s]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function c(){const e=s.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function h(e){d(e,0)}function d(t,n){const i=s.newAttributes,r=s.enabledAttributes,a=s.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),a[t]!==n&&(e.vertexAttribDivisor(t,n),a[t]=n)}function p(){const t=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function m(t,n,i,r,s,a,o){!0===o?e.vertexAttribIPointer(t,n,i,s,a):e.vertexAttribPointer(t,n,i,r,s,a)}function f(){g(),a=!0,s!==r&&(s=r,o(s.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,g){let _=!1;const y=function(t,n,r){const s=!0===r.wireframe;let a=i[t.id];void 0===a&&(a={},i[t.id]=a);let o=a[n.id];void 0===o&&(o={},a[n.id]=o);let l=o[s];void 0===l&&(l=u(e.createVertexArray()),o[s]=l);return l}(f,l,r);s!==y&&(s=y,o(s.object)),_=function(e,t,n,i){const r=s.attributes,a=t.attributes;let o=0;const l=n.getAttributes();for(const s in l){if(l[s].location>=0){const t=r[s];let n=a[s];if(void 0===n&&("instanceMatrix"===s&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===s&&e.instanceColor&&(n=e.instanceColor)),void 0===t)return!0;if(t.attribute!==n)return!0;if(n&&t.data!==n.data)return!0;o++}}return s.attributesNum!==o||s.index!==i}(n,f,l,g),_&&function(e,t,n,i){const r={},a=t.attributes;let o=0;const l=n.getAttributes();for(const s in l){if(l[s].location>=0){let t=a[s];void 0===t&&("instanceMatrix"===s&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===s&&e.instanceColor&&(t=e.instanceColor));const n={};n.attribute=t,t&&t.data&&(n.data=t.data),r[s]=n,o++}}s.attributes=r,s.attributesNum=o,s.index=i}(n,f,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(_||a)&&(a=!1,function(n,i,r,s){c();const a=s.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const u in o){const i=o[u];if(i.location>=0){let r=a[u];if(void 0===r&&("instanceMatrix"===u&&n.instanceMatrix&&(r=n.instanceMatrix),"instanceColor"===u&&n.instanceColor&&(r=n.instanceColor)),void 0!==r){const a=r.normalized,o=r.itemSize,l=t.get(r);if(void 0===l)continue;const u=l.buffer,c=l.type,p=l.bytesPerElement,f=c===e.INT||c===e.UNSIGNED_INT||r.gpuType===Be;if(r.isInterleavedBufferAttribute){const t=r.data,l=t.stride,g=r.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<i.locationSize;e++)d(i.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<i.locationSize;e++)h(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<i.locationSize;e++)m(i.location+e,o/i.locationSize,c,a,l*p,(g+o/i.locationSize*e)*p,f)}else{if(r.isInstancedBufferAttribute){for(let e=0;e<i.locationSize;e++)d(i.location+e,r.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=r.meshPerAttribute*r.count)}else for(let e=0;e<i.locationSize;e++)h(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<i.locationSize;e++)m(i.location+e,o/i.locationSize,c,a,o*p,o/i.locationSize*e*p,f)}}else if(void 0!==l){const t=l[u];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(i.location,t);break;case 3:e.vertexAttrib3fv(i.location,t);break;case 4:e.vertexAttrib4fv(i.location,t);break;default:e.vertexAttrib1fv(i.location,t)}}}}p()}(n,r,l,f),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){f();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const n in t){const e=t[n];for(const t in e)l(e[t].object),delete e[t];delete t[n]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:c,enableAttribute:h,disableUnusedAttributes:p}}function Ph(e,t,n){let i;function r(t,r,s){0!==s&&(e.drawArraysInstanced(i,t,r,s),n.update(r,i,s))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,s);let a=0;for(let t=0;t<s;t++)a+=r[t];n.update(a,i,1)},this.renderMultiDrawInstances=function(e,s,a,o){if(0===a)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],s[t],o[t]);
vendor: 20,907 bytes, line 1
1else{l.multiDrawArraysInstancedWEBGL(i,e,0,s,0,o,0,a);let t=0;for(let e=0;e<a;e++)t+=s[e]*o[e];n.update(t,i,1)}}}function Ih(e,t,n,i){let r;function s(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==n.precision?n.precision:"highp";const o=s(a);o!==a&&(a=o);const l=!0===n.logarithmicDepthBuffer,u=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control"),c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(t){return t===Ye||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===ze&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==De&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==qe&&!r)},precision:a,logarithmicDepthBuffer:l,reversedDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function Lh(e){const t=this;let n=null,i=0,r=!1,s=!1;const a=new ba,o=new Rn,l={value:null,needsUpdate:!1};function u(e,n,i,r){const s=null!==e?e.length:0;let u=null;if(0!==s){if(u=l.value,!0!==r||null===u){const t=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===u||u.length<t)&&(u=new Float32Array(t));for(let n=0,l=i;n!==s;++n,l+=4)a.copy(e[n]).applyMatrix4(r,o),a.normal.toArray(u,l),u[l+3]=a.constant}l.value=u,l.needsUpdate=!0}return t.numPlanes=s,t.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(a,o,c){const h=a.clippingPlanes,d=a.clipIntersection,p=a.clipShadows,m=e.get(a);if(!r||null===h||0===h.length||s&&!p)s?u(null):function(){l.value!==n&&(l.value=n,l.needsUpdate=i>0);t.numPlanes=i,t.numIntersection=0}();else{const e=s?0:i,t=4*e;let r=m.clippingState||null;l.value=r,r=u(h,o,t,c);for(let i=0;i!==t;++i)r[i]=n[i];m.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}}}function Dh(e){let t=new WeakMap;function n(e,t){return t===Te?e.mapping=xe:t===Se&&(e.mapping=be),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===Te||s===Se){if(t.has(r)){return n(t.get(r).texture,r.mapping)}{const s=r.image;if(s&&s.height>0){const a=new vs(s.height);return a.fromEquirectangularTexture(e,r),t.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}const Oh=[.125,.215,.35,.446,.526,.582],Uh=20,Fh=new Xu,Bh=new br;let Vh=null,qh=0,zh=0,kh=!1;const Gh=(1+Math.sqrt(5))/2,Hh=1/Gh,jh=[new wn(-Gh,Hh,0),new wn(Gh,Hh,0),new wn(-Hh,0,Gh),new wn(Hh,0,Gh),new wn(0,Gh,-Hh),new wn(0,Gh,Hh),new wn(-1,1,-1),new wn(1,1,-1),new wn(-1,1,1),new wn(1,1,1)],Wh=new wn;let Xh=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100,r={}){const{size:s=256,position:a=Wh}=r;Vh=this._renderer.getRenderTarget(),qh=this._renderer.getActiveCubeFace(),zh=this._renderer.getActiveMipmapLevel(),kh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,n,i,o,a),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Zh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Kh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Vh,qh,zh),this._renderer.xr.enabled=kh,e.scissorTest=!1,Yh(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===xe||e.mapping===be?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Vh=this._renderer.getRenderTarget(),qh=this._renderer.getActiveCubeFace(),zh=this._renderer.getActiveMipmapLevel(),kh=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:Pe,minFilter:Pe,generateMipmaps:!1,type:ze,format:Ye,colorSpace:jt,depthBuffer:!1},i=$h(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=$h(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],i=[];let r=e;const s=e-4+1+Oh.length;for(let a=0;a<s;a++){const s=Math.pow(2,r);n.push(s);let o=1/s;a>e-4?o=Oh[a-e+4-1]:0===a&&(o=0),i.push(o);const l=1/(s-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],d=6,p=6,m=3,f=2,g=1,_=new Float32Array(m*p*d),y=new Float32Array(f*p*d),v=new Float32Array(g*p*d);for(let e=0;e<d;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];_.set(i,m*p*e),y.set(h,f*p*e);const r=[e,e,e,e,e,e];v.set(r,g*p*e)}const x=new jr;x.setAttribute("position",new Lr(_,m)),x.setAttribute("uv",new Lr(y,f)),x.setAttribute("faceIndex",new Lr(v,g)),t.push(x),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(Uh),r=new wn(0,1,0),s=new cs({name:"SphericalGaussianBlur",defines:{n:Uh,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Jh(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return s}(i,e,t)}return i}_compileMaterial(e){const t=new is(this._lodPlanes[0],e);this._renderer.compile(t,Fh)}_sceneToCubeUV(e,t,n,i,r){const s=new fs(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(Bh),l.toneMapping=0,l.autoClear=!1;l.state.buffers.depth.getReversed()&&(l.setRenderTarget(i),l.clearDepth(),l.setRenderTarget(null));const h=new wr({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new is(new ss,h);let p=!1;const m=e.background;m?m.isColor&&(h.color.copy(m),e.background=null,p=!0):(h.color.copy(Bh),p=!0);for(let f=0;f<6;f++){const t=f%3;0===t?(s.up.set(0,a[f],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x+o[f],r.y,r.z)):1===t?(s.up.set(0,0,a[f]),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y+o[f],r.z)):(s.up.set(0,a[f],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y,r.z+o[f]));const n=this._cubeSize;Yh(i,t*n,f>2?n:0,n,n),l.setRenderTarget(i),p&&l.render(d,s),l.render(e,s)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=c,l.autoClear=u,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===xe||e.mapping===be;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Zh()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Kh());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new is(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const a=this._cubeSize;Yh(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,Fh)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let r=1;r<i;r++){const t=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),n=jh[(i-r-1)%jh.length];this._blur(e,r-1,r,t,n)}t.autoClear=n}_blur(e,t,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,a){const o=this._renderer,l=this._blurMaterial,u=new is(this._lodPlanes[i],l),c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,m=isFinite(r)?1+Math.floor(3*p):Uh,f=[];let g=0;for(let v=0;v<Uh;++v){const e=v/p,t=Math.exp(-e*e/2);f.push(t),0===v?g+=t:v<m&&(g+=2*t)}for(let v=0;v<f.length;v++)f[v]=f[v]/g;c.envMap.value=e.texture,c.samples.value=m,c.weights.value=f,c.latitudinal.value="latitudinal"===s,a&&(c.poleAxis.value=a);const{_lodMax:_}=this;c.dTheta.value=d,c.mipInt.value=_-n;const y=this._sizeLods[i];Yh(t,3*y*(i>_-4?i-_+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(t),o.render(u,Fh)}};function $h(e,t,n){const i=new Qn(e,t,n);return i.texture.mapping=Me,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Yh(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Kh(){return new cs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Jh(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Zh(){return new cs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Jh(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Jh(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Qh(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=s===Te||s===Se,o=s===xe||s===be;if(a||o){let s=t.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Xh(e)),s=a?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return a&&l&&l.height>0||o&&l&&function(e){let t=0;const n=6;for(let i=0;i<n;i++)void 0!==e[i]&&t++;return t===n}(l)?(null===n&&(n=new Xh(e)),s=a?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function ed(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&Un("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function td(e,t,n,i){const r={},s=new WeakMap;function a(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const n in o.attributes)t.remove(o.attributes[n]);o.removeEventListener("dispose",a),delete r[o.id];const l=s.get(o);l&&(t.remove(l),s.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){const n=[],i=e.index,r=e.attributes.position;let a=0;if(null!==i){const e=i.array;a=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],s=e[t+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const e=r.array;a=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const o=new(Nn(n)?Or:Dr)(n,1);o.version=a;const l=s.get(e);l&&t.remove(l),s.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",a),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const r in i)t.update(i[r],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){const t=s.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return s.get(e)}}}function nd(e,t,n){let i,r,s;function a(t,a,o){0!==o&&(e.drawElementsInstanced(i,a,r,t*s,o),n.update(a,i,o))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,s=e.bytesPerElement},this.render=function(t,a){e.drawElements(i,a,r,t*s),n.update(a,i,1)},this.renderInstances=a,this.renderMultiDraw=function(e,s,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,s,0,r,e,0,a);let o=0;for(let t=0;t<a;t++)o+=s[t];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,o,l,u){if(0===l)return;const c=t.get("WEBGL_multi_draw");if(null===c)for(let t=0;t<e.length;t++)a(e[t]/s,o[t],u[t]);else{c.multiDrawElementsInstancedWEBGL(i,o,0,r,e,0,u,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e]*u[e];n.update(t,i,1)}}}function id(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n}}}}function rd(e,t,n){const i=new WeakMap,r=new Zn;return{update:function(s,a,o){const l=s.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,c=void 0!==u?u.length:0;let h=i.get(a);if(void 0===h||h.count!==c){let e=function(){_.dispose(),i.delete(a),a.removeEventListener("dispose",e)};void 0!==h&&h.texture.dispose();const n=void 0!==a.morphAttributes.position,s=void 0!==a.morphAttributes.normal,o=void 0!==a.morphAttributes.color,l=a.morphAttributes.position||[],u=a.morphAttributes.normal||[],d=a.morphAttributes.color||[];let p=0;!0===n&&(p=1),!0===s&&(p=2),!0===o&&(p=3);let m=a.attributes.position.count*p,f=1;m>t.maxTextureSize&&(f=Math.ceil(m/t.maxTextureSize),m=t.maxTextureSize);const g=new Float32Array(m*f*4*c),_=new ei(g,m,f,c);_.type=qe,_.needsUpdate=!0;const y=4*p;for(let t=0;t<c;t++){const e=l[t],i=u[t],a=d[t],c=m*f*4*t;for(let t=0;t<e.count;t++){const l=t*y;!0===n&&(r.fromBufferAttribute(e,t),g[c+l+0]=r.x,g[c+l+1]=r.y,g[c+l+2]=r.z,g[c+l+3]=0),!0===s&&(r.fromBufferAttribute(i,t),g[c+l+4]=r.x,g[c+l+5]=r.y,g[c+l+6]=r.z,g[c+l+7]=0),!0===o&&(r.fromBufferAttribute(a,t),g[c+l+8]=r.x,g[c+l+9]=r.y,g[c+l+10]=r.z,g[c+l+11]=4===a.itemSize?r.w:1)}}h={count:c,texture:_,size:new Sn(m,f)},i.set(a,h),a.addEventListener("dispose",e)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)o.getUniforms().setValue(e,"morphTexture",s.morphTexture,n);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];const n=a.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",n),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",h.texture,n),o.getUniforms().setValue(e,"morphTargetsTextureSize",h.size)}}}function sd(e,t,n,i){let r=new WeakMap;function s(e){const t=e.target;t.removeEventListener("dispose",s),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(a){const o=i.render.frame,l=a.geometry,u=t.get(a,l);if(r.get(u)!==o&&(t.update(u),r.set(u,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",s)&&a.addEventListener("dispose",s),r.get(a)!==o&&(n.update(a.instanceMatrix,e.ARRAY_BUFFER),null!==a.instanceColor&&n.update(a.instanceColor,e.ARRAY_BUFFER),r.set(a,o))),a.isSkinnedMesh){const e=a.skeleton;
vendor: 4,612 bytes, line 1
1r.get(e)!==o&&(e.update(),r.set(e,o))}return u},dispose:function(){r=new WeakMap}}}const ad=new Kn,od=new vo(1,1),ld=new ei,ud=new ti,cd=new ys,hd=[],dd=[],pd=new Float32Array(16),md=new Float32Array(9),fd=new Float32Array(4);function gd(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let s=hd[r];if(void 0===s&&(s=new Float32Array(r),hd[r]=s),0!==t){i.toArray(s,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(s,r)}return s}function _d(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function yd(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function vd(e,t){let n=dd[t];void 0===n&&(n=new Int32Array(t),dd[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function xd(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function bd(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(_d(n,t))return;e.uniform2fv(this.addr,t),yd(n,t)}}function Td(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(_d(n,t))return;e.uniform3fv(this.addr,t),yd(n,t)}}function Sd(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(_d(n,t))return;e.uniform4fv(this.addr,t),yd(n,t)}}function Md(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(_d(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),yd(n,t)}else{if(_d(n,i))return;fd.set(i),e.uniformMatrix2fv(this.addr,!1,fd),yd(n,i)}}function wd(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(_d(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),yd(n,t)}else{if(_d(n,i))return;md.set(i),e.uniformMatrix3fv(this.addr,!1,md),yd(n,i)}}function Ed(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(_d(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),yd(n,t)}else{if(_d(n,i))return;pd.set(i),e.uniformMatrix4fv(this.addr,!1,pd),yd(n,i)}}function Ad(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Rd(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(_d(n,t))return;e.uniform2iv(this.addr,t),yd(n,t)}}function Cd(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(_d(n,t))return;e.uniform3iv(this.addr,t),yd(n,t)}}function Nd(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(_d(n,t))return;e.uniform4iv(this.addr,t),yd(n,t)}}function Pd(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Id(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(_d(n,t))return;e.uniform2uiv(this.addr,t),yd(n,t)}}function Ld(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(_d(n,t))return;e.uniform3uiv(this.addr,t),yd(n,t)}}function Dd(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(_d(n,t))return;e.uniform4uiv(this.addr,t),yd(n,t)}}function Od(e,t,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),this.type===e.SAMPLER_2D_SHADOW?(od.compareFunction=Qt,s=od):s=ad,n.setTexture2D(t||s,r)}function Ud(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||ud,r)}function Fd(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||cd,r)}function Bd(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||ld,r)}function Vd(e,t){e.uniform1fv(this.addr,t)}function qd(e,t){const n=gd(t,this.size,2);e.uniform2fv(this.addr,n)}function zd(e,t){const n=gd(t,this.size,3);e.uniform3fv(this.addr,n)}function kd(e,t){const n=gd(t,this.size,4);e.uniform4fv(this.addr,n)}function Gd(e,t){const n=gd(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Hd(e,t){const n=gd(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}
vendor: 10,178 bytes, line 1
1function jd(e,t){const n=gd(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Wd(e,t){e.uniform1iv(this.addr,t)}function Xd(e,t){e.uniform2iv(this.addr,t)}function $d(e,t){e.uniform3iv(this.addr,t)}function Yd(e,t){e.uniform4iv(this.addr,t)}function Kd(e,t){e.uniform1uiv(this.addr,t)}function Zd(e,t){e.uniform2uiv(this.addr,t)}function Jd(e,t){e.uniform3uiv(this.addr,t)}function Qd(e,t){e.uniform4uiv(this.addr,t)}function ep(e,t,n){const i=this.cache,r=t.length,s=vd(n,r);_d(i,s)||(e.uniform1iv(this.addr,s),yd(i,s));for(let a=0;a!==r;++a)n.setTexture2D(t[a]||ad,s[a])}function tp(e,t,n){const i=this.cache,r=t.length,s=vd(n,r);_d(i,s)||(e.uniform1iv(this.addr,s),yd(i,s));for(let a=0;a!==r;++a)n.setTexture3D(t[a]||ud,s[a])}function np(e,t,n){const i=this.cache,r=t.length,s=vd(n,r);_d(i,s)||(e.uniform1iv(this.addr,s),yd(i,s));for(let a=0;a!==r;++a)n.setTextureCube(t[a]||cd,s[a])}function ip(e,t,n){const i=this.cache,r=t.length,s=vd(n,r);_d(i,s)||(e.uniform1iv(this.addr,s),yd(i,s));for(let a=0;a!==r;++a)n.setTexture2DArray(t[a]||ld,s[a])}class rp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return xd;case 35664:return bd;case 35665:return Td;case 35666:return Sd;case 35674:return Md;case 35675:return wd;case 35676:return Ed;case 5124:case 35670:return Ad;case 35667:case 35671:return Rd;case 35668:case 35672:return Cd;case 35669:case 35673:return Nd;case 5125:return Pd;case 36294:return Id;case 36295:return Ld;case 36296:return Dd;case 35678:case 36198:case 36298:case 36306:case 35682:return Od;case 35679:case 36299:case 36307:return Ud;case 35680:case 36300:case 36308:case 36293:return Fd;case 36289:case 36303:case 36311:case 36292:return Bd}}(t.type)}}class sp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Vd;case 35664:return qd;case 35665:return zd;case 35666:return kd;case 35674:return Gd;case 35675:return Hd;case 35676:return jd;case 5124:case 35670:return Wd;case 35667:case 35671:return Xd;case 35668:case 35672:return $d;case 35669:case 35673:return Yd;case 5125:return Kd;case 36294:return Zd;case 36295:return Jd;case 36296:return Qd;case 35678:case 36198:case 36298:case 36306:case 35682:return ep;case 35679:case 36299:case 36307:return tp;case 35680:case 36300:case 36308:case 36293:return np;case 36289:case 36303:case 36311:case 36292:return ip}}(t.type)}}class ap{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(e,t[s.id],n)}}}const op=/(\w+)(\])?(\[|\.)?/g;function lp(e,t){e.seq.push(t),e.map[t.id]=t}function up(e,t,n){const i=e.name,r=i.length;for(op.lastIndex=0;;){const s=op.exec(i),a=op.lastIndex;let o=s[1];const l="]"===s[2],u=s[3];if(l&&(o|=0),void 0===u||"["===u&&a+2===r){lp(n,void 0===u?new rp(o,e,t):new sp(o,e,t));break}{let e=n.map[o];void 0===e&&(e=new ap(o),lp(n,e)),n=e}}}class cp{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);up(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){const s=t[r],a=n[s.id];!1!==a.needsUpdate&&s.setValue(e,a.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function hp(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let dp=0;const pp=new Rn;function mp(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=(e.getShaderInfoLog(t)||"").trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let a=r;a<s;a++){const e=a+1;i.push(`${e===t?">":" "} ${e}: ${n[a]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function fp(e,t){const n=function(e){qn._getMatrix(pp,qn.workingColorSpace,e);const t=`mat3( ${pp.elements.map(e=>e.toFixed(4))} )`;switch(qn.getTransfer(e)){case Wt:return[t,"LinearTransferOETF"];case Xt:return[t,"sRGBTransferOETF"];default:return[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function gp(e,t){let n;switch(t){case 1:default:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Cineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const _p=new wn;function yp(){qn.getLuminanceCoefficients(_p);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${_p.x.toFixed(4)}, ${_p.y.toFixed(4)}, ${_p.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function vp(e){return""!==e}function xp(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function bp(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Tp=/^[ \t]*#include +<([\w\d./]+)>/gm;function Sp(e){return e.replace(Tp,wp)}const Mp=new Map;function wp(e,t){let n=Sh[t];if(void 0===n){const e=Mp.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=Sh[e]}return Sp(n)}const Ep=/#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 Ap(e){return e.replace(Ep,Rp)}function Rp(e,t,n,i){let r="";for(let s=parseInt(t);s<parseInt(n);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Cp(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Np(e,t,n,i){const r=e.getContext(),s=n.defines;let a=n.vertexShader,o=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),u=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case xe:case be:t="ENVMAP_TYPE_CUBE";break;case Me:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),c=function(e){let t="ENVMAP_MODE_REFLECTION";e.envMap&&e.envMapMode===be&&(t="ENVMAP_MODE_REFRACTION");return t}(n),h=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),d=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(vp).join("\n")}(n),m=function(e){const t=[];for(const n in e){const i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(s),f=r.createProgram();let g,_,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(vp).join("\n"),g.length>0&&(g+="\n"),_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(vp).join("\n"),_.length>0&&(_+="\n")):(g=[Cp(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IR
1IDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.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","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(vp).join("\n"),_=[Cp(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alph
vendor: 4,308 bytes, line 1
1aToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Sh.tonemapping_pars_fragment:"",0!==n.toneMapping?gp("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Sh.colorspace_pars_fragment,fp("linearToOutputTexel",n.outputColorSpace),yp(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(vp).join("\n")),a=Sp(a),a=xp(a,n),a=bp(a,n),o=Sp(o),o=xp(o,n),o=bp(o,n),a=Ap(a),o=Ap(o),!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,_=["#define varying in",n.glslVersion===on?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===on?"":"#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("\n")+"\n"+_);const v=y+g+a,x=y+_+o,b=hp(r,r.VERTEX_SHADER,v),T=hp(r,r.FRAGMENT_SHADER,x);function S(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(f)||"",i=r.getShaderInfoLog(b)||"",s=r.getShaderInfoLog(T)||"",a=n.trim(),o=i.trim(),l=s.trim();let u=!0,c=!0;if(!1===r.getProgramParameter(f,r.LINK_STATUS))if(u=!1,"function"==typeof e.debug.onSha
vendor: 4,276 bytes, line 1
1derError)e.debug.onShaderError(r,f,b,T);else{mp(r,b,"vertex"),mp(r,T,"fragment")}else""!==a||""!==o&&""!==l||(c=!1);c&&(t.diagnostics={runnable:u,programLog:a,vertexShader:{log:o,prefix:g},fragmentShader:{log:l,prefix:_}})}r.deleteShader(b),r.deleteShader(T),M=new cp(r,f),w=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),s=i.name;let a=1;i.type===e.FLOAT_MAT2&&(a=2),i.type===e.FLOAT_MAT3&&(a=3),i.type===e.FLOAT_MAT4&&(a=4),n[s]={type:i.type,location:e.getAttribLocation(t,s),locationSize:a}}return n}(r,f)}let M,w;r.attachShader(f,b),r.attachShader(f,T),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),this.getUniforms=function(){return void 0===M&&S(this),M},this.getAttributes=function(){return void 0===w&&S(this),w};let E=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===E&&(E=r.getProgramParameter(f,37297)),E},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=dp++,this.cacheKey=t,this.usedTimes=1,this.program=f,this.vertexShader=b,this.fragmentShader=T,this}let Pp=0;class Ip{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(e);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,0===n.usedTimes&&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 void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new Lp(e),t.set(e,n)),n}}class Lp{constructor(e){this.id=Pp++,this.code=e,this.usedTimes=0}}function Dp(e,t,n,i,r,s,a){const o=new qi,l=new Ip,u=new Set,c=[],h=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(e){return u.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(s,o,c,g,_){const y=g.fog,v=_.geometry,x=s.isMeshStandardMaterial?g.environment:null,b=(s.isMeshStandardMaterial?n:t).get(s.envMap||x),T=b&&b.mapping===Me?b.image.height:null,S=m[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),s.precision);const M=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,w=void 0!==M?M.length:0;let E,A,R,C,N=0;if(void 0!==v.morphAttributes.position&&(N=1),void 0!==v.morphAttributes.normal&&(N=2),void 0!==v.morphAttributes.color&&(N=3),S){const e=wh[S];E=e.vertexShader,A=e.fragmentShader}else E=s.vertexShader,A=s.fragmentShader,l.update(s),R=l.getVertexShaderID(s),C=l.getFragmentShaderID(s);const P=e.getRenderTarget(),I=e.state.buffers.depth.getReversed(),L=!0===_.isInstancedMesh,D=!0===_.isBatchedMesh,O=!!s.map,U=!!s.matcap,F=!!b,B=!!s.aoMap,V=!!s.lightMap,q=!!s.bumpMap,z=!!s.normalMap,k=!!s.displacementMap,G=!!s.emissiveMap,H=!!s.metalnessMap,j=!!s.roughnessMap,W=s.anisotropy>0,X=s.clearcoat>0,$=s.dispersion>0,Y=s.iridescence>0,K=s.sheen>0,Z=s.transmission>0,J=W&&!!s.anisotropyMap,Q=X&&!!s.clearcoatMap,ee=X&&!!s.clearcoatNormalMap,te=X&&!!s.clearcoatRoughnessMap,ne=Y&&!!s.iridescenceMap,ie=Y&&!!s.iridescenceThicknessMap,re=K&&!!s.sheenColorMap,se=K&&!!s.sheenRoughnessMap,ae=!!s.specularMap,oe=!!s.specularColorMap,le=!!s.specularIntensityMap,ue=Z&&!!s.transmissionMap,ce=Z&&!!s.thicknessMap,he
vendor: 8,679 bytes, line 1
1=!!s.gradientMap,de=!!s.alphaMap,pe=s.alphaTest>0,me=!!s.alphaHash,fe=!!s.extensions;let ge=0;s.toneMapped&&(null!==P&&!0!==P.isXRRenderTarget||(ge=e.toneMapping));const _e={shaderID:S,shaderType:s.type,shaderName:s.name,vertexShader:E,fragmentShader:A,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:C,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,batching:D,batchingColor:D&&null!==_._colorsTexture,instancing:L,instancingColor:L&&null!==_.instanceColor,instancingMorph:L&&null!==_.morphTexture,supportsVertexTextures:d,outputColorSpace:null===P?e.outputColorSpace:!0===P.isXRRenderTarget?P.texture.colorSpace:jt,alphaToCoverage:!!s.alphaToCoverage,map:O,matcap:U,envMap:F,envMapMode:F&&b.mapping,envMapCubeUVHeight:T,aoMap:B,lightMap:V,bumpMap:q,normalMap:z,displacementMap:d&&k,emissiveMap:G,normalMapObjectSpace:z&&1===s.normalMapType,normalMapTangentSpace:z&&0===s.normalMapType,metalnessMap:H,roughnessMap:j,anisotropy:W,anisotropyMap:J,clearcoat:X,clearcoatMap:Q,clearcoatNormalMap:ee,clearcoatRoughnessMap:te,dispersion:$,iridescence:Y,iridescenceMap:ne,iridescenceThicknessMap:ie,sheen:K,sheenColorMap:re,sheenRoughnessMap:se,specularMap:ae,specularColorMap:oe,specularIntensityMap:le,transmission:Z,transmissionMap:ue,thicknessMap:ce,gradientMap:he,opaque:!1===s.transparent&&1===s.blending&&!1===s.alphaToCoverage,alphaMap:de,alphaTest:pe,alphaHash:me,combine:s.combine,mapUv:O&&f(s.map.channel),aoMapUv:B&&f(s.aoMap.channel),lightMapUv:V&&f(s.lightMap.channel),bumpMapUv:q&&f(s.bumpMap.channel),normalMapUv:z&&f(s.normalMap.channel),displacementMapUv:k&&f(s.displacementMap.channel),emissiveMapUv:G&&f(s.emissiveMap.channel),metalnessMapUv:H&&f(s.metalnessMap.channel),roughnessMapUv:j&&f(s.roughnessMap.channel),anisotropyMapUv:J&&f(s.anisotropyMap.channel),clearcoatMapUv:Q&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:ee&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:te&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:ne&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:re&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:se&&f(s.sheenRoughnessMap.channel),specularMapUv:ae&&f(s.specularMap.channel),specularColorMapUv:oe&&f(s.specularColorMap.channel),specularIntensityMapUv:le&&f(s.specularIntensityMap.channel),transmissionMapUv:ue&&f(s.transmissionMap.channel),thicknessMapUv:ce&&f(s.thicknessMap.channel),alphaMapUv:de&&f(s.alphaMap.channel),vertexTangents:!!v.attributes.tangent&&(z||W),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!v.attributes.color&&4===v.attributes.color.itemSize,pointsUvs:!0===_.isPoints&&!!v.attributes.uv&&(O||de),fog:!!y,useFog:!0===s.fog,fogExp2:!!y&&y.isFogExp2,flatShading:!0===s.flatShading&&!1===s.wireframe,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:I,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==v.morphAttributes.position,morphNormals:void 0!==v.morphAttributes.normal,morphColors:void 0!==v.morphAttributes.color,morphTargetsCount:w,morphTextureStride:N,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:ge,decodeVideoTexture:O&&!0===s.map.isVideoTexture&&qn.getTransfer(s.map.colorSpace)===Xt,decodeVideoTextureEmissive:G&&!0===s.emissiveMap.isVideoTexture&&qn.getTransfer(s.emissiveMap.colorSpace)===Xt,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:fe&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(fe&&!0===s.extensions.multiDraw||D)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return _e.vertexUv1s=u.has(1),_e.vertexUv2s=u.has(2),_e.vertexUv3s=u.has(3),u.clear(),_e},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){o.disableAll(),t.supportsVertexTextures&&o.enable(0);t.instancing&&o.enable(1);t.instancingColor&&o.enable(2);t.instancingMorph&&o.enable(3);t.matcap&&o.enable(4);t.envMap&&o.enable(5);t.normalMapObjectSpace&&o.enable(6);t.normalMapTangentSpace&&o.enable(7);t.clearcoat&&o.enable(8);t.iridescence&&o.enable(9);t.alphaTest&&o.enable(10);t.vertexColors&&o.enable(11);t.vertexAlphas&&o.enable(12);t.vertexUv1s&&o.enable(13);t.vertexUv2s&&o.enable(14);t.vertexUv3s&&o.enable(15);t.vertexTangents&&o.enable(16);t.anisotropy&&o.enable(17);t.alphaHash&&o.enable(18);t.batching&&o.enable(19);t.dispersion&&o.enable(20);t.batchingColor&&o.enable(21);t.gradientMap&&o.enable(22);e.push(o.mask),o.disableAll(),t.fog&&o.enable(0);t.useFog&&o.enable(1);t.flatShading&&o.enable(2);t.logarithmicDepthBuffer&&o.enable(3);t.reversedDepthBuffer&&o.enable(4);t.skinning&&o.enable(5);t.morphTargets&&o.enable(6);t.morphNormals&&o.enable(7);t.morphColors&&o.enable(8);t.premultipliedAlpha&&o.enable(9);t.shadowMapEnabled&&o.enable(10);t.doubleSided&&o.enable(11);t.flipSided&&o.enable(12);t.useDepthPacking&&o.enable(13);t.dithering&&o.enable(14);t.transmission&&o.enable(15);t.sheen&&o.enable(16);t.opaque&&o.enable(17);t.pointsUvs&&o.enable(18);t.decodeVideoTexture&&o.enable(19);t.decodeVideoTextureEmissive&&o.enable(20);t.alphaToCoverage&&o.enable(21);e.push(o.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=m[e.type];let n;if(t){const e=wh[t];n=us.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,r=c.length;e<r;e++){const t=c[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new Np(e,n,t,s),c.push(i)),i},releaseProgram:function(e){if(0===--e.usedTimes){const t=c.indexOf(e);c[t]=c[c.length-1],c.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:c,dispose:function(){l.dispose()}}}function Op(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function Up(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Fp(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Bp(){const e=[];let t=0;const n=[],i=[],r=[];function s(n,i,r,s,a,o){let l=e[t];
vendor: 4,543 bytes, line 1
1return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:a,group:o},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=a,l.group=o),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,a,o,l,u){const c=s(e,t,a,o,l,u);a.transmission>0?i.push(c):!0===a.transparent?r.push(c):n.push(c)},unshift:function(e,t,a,o,l,u){const c=s(e,t,a,o,l,u);a.transmission>0?i.unshift(c):!0===a.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||Up),i.length>1&&i.sort(t||Fp),r.length>1&&r.sort(t||Fp)}}}function Vp(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new Bp,e.set(t,[r])):n>=i.length?(r=new Bp,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function qp(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new wn,color:new br};break;case"SpotLight":n={position:new wn,direction:new wn,color:new br,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new wn,color:new br,distance:0,decay:0};break;case"HemisphereLight":n={direction:new wn,skyColor:new br,groundColor:new br};break;case"RectAreaLight":n={color:new br,position:new wn,halfWidth:new wn,halfHeight:new wn}}return e[t.id]=n,n}}}let zp=0;function kp(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Gp(e){const t=new qp,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Sn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Sn,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let o=0;o<9;o++)i.probe.push(new wn);const r=new wn,s=new Ci,a=new Ci;return{setup:function(r){let s=0,a=0,o=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,u=0,c=0,h=0,d=0,p=0,m=0,f=0,g=0,_=0,y=0;r.sort(kp);for(let e=0,x=r.length;e<x;e++){const v=r[e],x=v.color,b=v.intensity,T=v.distance,S=v.shadow&&v.shadow.map?v.shadow.map.texture:null;if(v.isAmbientLight)s+=x.r*b,a+=x.g*b,o+=x.b*b;else if(v.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(v.sh.coefficients[e],b);y++}else if(v.isDirectionalLight){const e=t.get(v);if(e.color.copy(v.color).multiplyScalar(v.intensity),v.castShadow){const e=v.shadow,t=n.get(v);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=S,i.directionalShadowMatrix[l]=v.shadow.matrix,p++}i.directional[l]=e,l++}else if(v.isSpotLight){const e=t.get(v);e.position.setFromMatrixPosition(v.matrixWorld),e.color.copy(x).multiplyScalar(b),e.distance=T,e.coneCos=Math.cos(v.angle),e.penumbraCos=Math.cos(v.angle*(1-v.penumbra)),e.decay=v.decay,i.spot[c]=e;const r=v.shadow;if(v.map&&(i.spotLightMap[g]=v.map,g++,r.updateMatrices(v),v.castShadow&&_++),i.spotLightMatrix[c]=r.matrix,v.castShadow){const e=n.get(v);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[c]=e,i.spotShadowMap[c]=S,f++}c++}else if(v.isRectAreaLight){const e=t.get(v);e.color.copy(x).multiplyScalar(b),e.halfWidth.set(.5*v.width,0,0),e.halfHeight.set(0,.5*v.height,0),i.rectArea[h]=e,h++}else if(v.isPointLight){const e=t.get(v);if(e.color.copy(v.color).multiplyScalar(v.intensity),e.distance=v.distance,e.decay=v.decay,v.castShadow){const e=v.shadow,t=n.get(v);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.n
vendor: 17,338 bytes, line 1
1ormalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,i.pointShadow[u]=t,i.pointShadowMap[u]=S,i.pointShadowMatrix[u]=v.shadow.matrix,m++}i.point[u]=e,u++}else if(v.isHemisphereLight){const e=t.get(v);e.skyColor.copy(v.color).multiplyScalar(b),e.groundColor.copy(v.groundColor).multiplyScalar(b),i.hemi[d]=e,d++}}h>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=Mh.LTC_FLOAT_1,i.rectAreaLTC2=Mh.LTC_FLOAT_2):(i.rectAreaLTC1=Mh.LTC_HALF_1,i.rectAreaLTC2=Mh.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=a,i.ambient[2]=o;const v=i.hash;v.directionalLength===l&&v.pointLength===u&&v.spotLength===c&&v.rectAreaLength===h&&v.hemiLength===d&&v.numDirectionalShadows===p&&v.numPointShadows===m&&v.numSpotShadows===f&&v.numSpotMaps===g&&v.numLightProbes===y||(i.directional.length=l,i.spot.length=c,i.rectArea.length=h,i.point.length=u,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=m,i.pointShadowMap.length=m,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=m,i.spotLightMatrix.length=f+g-_,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=_,i.numLightProbes=y,v.directionalLength=l,v.pointLength=u,v.spotLength=c,v.rectAreaLength=h,v.hemiLength=d,v.numDirectionalShadows=p,v.numPointShadows=m,v.numSpotShadows=f,v.numSpotMaps=g,v.numLightProbes=y,i.version=zp++)},setupView:function(e,t){let n=0,o=0,l=0,u=0,c=0;const h=t.matrixWorldInverse;for(let d=0,p=e.length;d<p;d++){const t=e[d];if(t.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(t.matrixWorld),r.setFromMatrixPosition(t.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(h),n++}else if(t.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(t.matrixWorld),e.position.applyMatrix4(h),e.direction.setFromMatrixPosition(t.matrixWorld),r.setFromMatrixPosition(t.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(h),l++}else if(t.isRectAreaLight){const e=i.rectArea[u];e.position.setFromMatrixPosition(t.matrixWorld),e.position.applyMatrix4(h),a.identity(),s.copy(t.matrixWorld),s.premultiply(h),a.extractRotation(s),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),e.halfWidth.applyMatrix4(a),e.halfHeight.applyMatrix4(a),u++}else if(t.isPointLight){const e=i.point[o];e.position.setFromMatrixPosition(t.matrixWorld),e.position.applyMatrix4(h),o++}else if(t.isHemisphereLight){const e=i.hemi[c];e.direction.setFromMatrixPosition(t.matrixWorld),e.direction.transformDirection(h),c++}}},state:i}}function Hp(e){const t=new Gp(e),n=[],i=[];const r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function jp(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let s;return void 0===r?(s=new Hp(e),t.set(n,[s])):i>=r.length?(s=new Hp(e),r.push(s)):s=r[i],s},dispose:function(){t=new WeakMap}}}function Wp(e,t,n){let i=new wa;const r=new Sn,s=new Sn,a=new Zn,o=new tu({depthPacking:3201}),l=new nu,u={},c=n.maxTextureSize,h={[k]:1,[G]:0,[H]:2},d=new cs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Sn},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const m=new jr;m.setAttribute("position",new Lr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new is(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;function y(n,i){const s=t.update(f);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Qn(r.x,r.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,s,d,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,s,p,f,null)}function v(t,n,i,r){let s=null;const a=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==a)s=a;else if(s=!0===i.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const e=s.uuid,t=n.uuid;let i=u[e];void 0===i&&(i={},u[e]=i);let r=i[t];void 0===r&&(r=s.clone(),i[t]=r,n.addEventListener("dispose",b)),s=r}if(s.visible=n.visible,s.wireframe=n.wireframe,s.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],s.alphaMap=n.alphaMap,s.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial){e.properties.get(s).light=i}return s}function x(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let u=0,c=t.length;u<c;u++){const c=t[u],h=l[c.materialIndex];if(h&&h.visible){const t=v(n,h,a,o);n.onBeforeShadow(e,n,r,s,i,t,c),e.renderBufferDirect(s,null,i,t,n,c),n.onAfterShadow(e,n,r,s,i,t,c)}}}else if(l.visible){const t=v(n,l,a,o);n.onBeforeShadow(e,n,r,s,i,t,null),e.renderBufferDirect(s,null,i,t,n,null),n.onAfterShadow(e,n,r,s,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)x(l[e],r,s,a,o)}function b(e){e.target.removeEventListener("dispose",b);for(const t in u){const n=u[t],i=e.target.uuid;if(i in n){n[i].dispose(),delete n[i]}}}this.render=function(t,n,o){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),u=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.state;d.setBlending(0),!0===d.buffers.depth.getReversed()?d.buffers.color.setClear(0,0,0,0):d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);const p=3!==_&&3===this.type,m=3===_&&3!==this.type;for(let f=0,g=t.length;f<g;f++){const l=t[f],u=l.shadow;if(void 0===u)continue;if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const h=u.getFrameExtents();if(r.multiply(h),s.copy(u.mapSize),(r.x>c||r.y>c)&&(r.x>c&&(s.x=Math.floor(c/h.x),r.x=s.x*h.x,u.mapSize.x=s.x),r.y>c&&(s.y=Math.floor(c/h.y),r.y=s.y*h.y,u.mapSize.y=s.y)),null===u.map||!0===p||!0===m){const e=3!==this.type?{minFilter:Re,magFilter:Re}:{};null!==u.map&&u.map.dispose(),u.map=new Qn(r.x,r.y,e),u.map.texture.name=l.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const g=u.getViewportCount();for(let e=0;e<g;e++){const t=u.getViewport(e);a.set(s.x*t.x,s.y*t.y,s.x*t.z,s.y*t.w),d.viewport(a),u.updateMatrices(l,e),i=u.getFrustum(),x(n,o,u.camera,l,this.type)}!0!==u.isPointLightShadow&&3===this.type&&y(u,o),u.needsUpdate=!1}_=this.type,g.needsUpdate=!1,e.setRenderTarget(l,u,h)}}const Xp={[ue]:1,[he]:6,[pe]:7,[de]:5,[ce]:0,[fe]:2,[ge]:4,[me]:3};function $p(e,t){const n=new function(){let t=!1;const n=new Zn;let i=null;const r=new Zn(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,s,a,o){!0===o&&(t*=a,i*=a,s*=a),n.set(t,i,s,a),!1===r.equals(n)&&(e.clearColor(t,i,s,a),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,s=null,a=null;return{setReversed:function(e){if(i!==e){const n=t.get("EXT_clip_control");e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),i=e;const r=a;a=null,this.setClear(r)}},getReversed:function(){return i},setTest:function(t){t?q(e.DEPTH_TEST):z(e.DEPTH_TEST)},setMask:function(t){r===t||n||(e.depthMask(t),r=t)},setFunc:function(t){if(i&&(t=Xp[t]),s!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}s=t}},setLocked:function(e){n=e},setClear:function(t){a!==t&&(i&&(t=1-t),e.clearDepth(t),a=t)},reset:function(){n=!1,r=null,s=null,a=null,i=!1}}},r=new function(){let t=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,u=null;return{setTest:function(n){t||(n?q(e.STENCIL_TEST):z(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,a){i===t&&r===n&&s===a||(e.stencilFunc(t,n,a),i=t,r=n,s=a)},setOp:function(t,n,i){a===t&&o===n&&l===i||(e.stencilOp(t,n,i),a=t,o=n,l=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,u=null}}},s=new WeakMap,a=new WeakMap;let o={},l={},u=new WeakMap,c=[],h=null,d=!1,p=null,m=null,f=null,g=null,_=null,y=null,v=null,x=new br(0,0,0),b=0,T=!1,S=null,M=null,w=null,E=null,A=null;const R=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let C=!1,N=0;const P=e.getParameter(e.VERSION);-1!==P.indexOf("WebGL")?(N=parseFloat(/^WebGL (\d)/.exec(P)[1]),C=N>=1):-1!==P.indexOf("OpenGL ES")&&(N=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),C=N>=2);let I=null,L={};const D=e.getParameter(e.SCISSOR_BOX),O=e.getParameter(e.VIEWPORT),U=(new Zn).fromArray(D),F=(new Zn).fromArray(O);function B(t,n,i,r){const s=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<i;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,s):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,s);return a}const V={};function q(t){!0!==o[t]&&(e.enable(t),o[t]=!0)}function z(t){!1!==o[t]&&(e.disable(t),o[t]=!1)}V[e.TEXTURE_2D]=B(e.TEXTURE_2D,e.TEXTURE_2D,1),V[e.TEXTURE_CUBE_MAP]=B(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),V[e.TEXTURE_2D_ARRAY]=B(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),V[e.TEXTURE_3D]=B(e.TEXTURE_3D,e.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),q(e.DEPTH_TEST),i.setFunc(3),ue(!1),ce(1),q(e.CULL_FACE),H(0);const k={[j]:e.FUNC_ADD,[W]:e.FUNC_SUBTRACT,[X]:e.FUNC_REVERSE_SUBTRACT};k[103]=e.MIN,k[104]=e.MAX;const G={[$]:e.ZERO,[Y]:e.ONE,[K]:e.SRC_COLOR,[J]:e.SRC_ALPHA,[re]:e.SRC_ALPHA_SATURATE,[ne]:e.DST_COLOR,[ee]:e.DST_ALPHA,[Z]:e.ONE_MINUS_SRC_COLOR,[Q]:e.ONE_MINUS_SRC_ALPHA,[ie]:e.ONE_MINUS_DST_COLOR,[te]:e.ONE_MINUS_DST_ALPHA,[se]:e.CONSTANT_COLOR,[ae]:e.ONE_MINUS_CONSTANT_COLOR,[oe]:e.CONSTANT_ALPHA,[le]:e.ONE_MINUS_CONSTANT_ALPHA};function H(t,n,i,r,s,a,o,l,u,c){if(0!==t){if(!1===d&&(q(e.BLEND),d=!0),5===t)s=s||n,a=a||i,o=o||r,n===m&&s===_||(e.blendEquationSeparate(k[n],k[s]),m=n,_=s),i===f&&r===g&&a===y&&o===v||(e.blendFuncSeparate(G[i],G[r],G[a],G[o]),f=i,g=r,y=a,v=o),!1!==l.equals(x)&&u===b||(e.blendColor(l.r,l.g,l.b,u),x.copy(l),b=u),p=t,T=!1;else if(t!==p||c!==T){if(m===j&&_===j||(e.blendEquation(e.FUNC_ADD),m=j,_=j),c)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE)}f=null,g=null,y=null,v=null,x.set(0,0,0),b=0,p=t,T=c}}else!0===d&&(z(e.BLEND),d=!1)}function ue(t){S!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),S=t)}function ce(t){0!==t?(q(e.CULL_FACE),t!==M&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):z(e.CULL_FACE),M=t}function he(t,n,i){t?(q(e.POLYGON_OFFSET_FILL),E===n&&A===i||(e.polygonOffset(n,i),E=n,A=i)):z(e.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:q,disable:z,bindFramebuffer:function(t,n){return l[t]!==n&&(e.bindFramebuffer(t,n),l[t]=n,t===e.DRAW_FRAMEBUFFER&&(l[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(l[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=c,r=!1;if(t){i=u.get(n),void 0===i&&(i=[],u.set(n,i));const s=t.textures;if(i.length!==s.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=s.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=s.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:H,setMaterial:function(t,s){2===t.side?z(e.CULL_FACE):q(e.CULL_FACE);let a=1===t.side;s&&(a=!a),ue(a),1===t.blending&&!1===t.transparent?H(0):H(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),i.setFunc(t.depthFunc),i.setTest(t.depthTest),i.setMask(t.depthWrite),n.setMask(t.colorWrite);const o=t.stencilWrite;r.setTest(o),o&&(r.setMask(t.stencilWriteMask),r.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),r.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),he(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?q(e.SAMPLE_ALPHA_TO_COVERAGE):z(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:ue,setCullFace:ce,setLineWidth:function(t){t!==w&&(C&&e.lineWidth(t),w=t)},setPolygonOffset:he,setScissorTest:function(t){t?q(e.SCISSOR_TEST):z(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+R-1),I!==t&&(e.activeTexture(t),I=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===I?e.TEXTURE0+R-1:I);let r=L[i];void 0===r&&(r={type:void 0,texture:void 0},L[i]=r),r.type===t&&r.texture===n||(I!==i&&(e.activeTexture(i),I=i),e.bindTexture(t,n||V[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=L[I];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D(...arguments)}catch(t){}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(t){}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(t){}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(t){}},updateUBOMapping:function(t,n){let i=a.get(n);void 0===i&&(i=new WeakMap,a.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=a.get(n).get(t);s.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),s.set(n,i))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(t){}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(t){}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(t){}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(t){}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(t){}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(t){}},scissor:function(t){!1===U.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),U.copy(t))},viewport:function(t){!1===F.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),F.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor
vendor: 2,448 bytes, line 1
1(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),i.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),o={},I=null,L={},l={},u=new WeakMap,c=[],h=null,d=!1,p=null,m=null,f=null,g=null,_=null,y=null,v=null,x=new br(0,0,0),b=0,T=!1,S=null,M=null,w=null,E=null,A=null,U.set(0,0,e.canvas.width,e.canvas.height),F.set(0,0,e.canvas.width,e.canvas.height),n.reset(),i.reset(),r.reset()}}}function Yp(e,t,n,i,r,s,a){const o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),u=new Sn,c=new WeakMap;let h;const d=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(H){}function m(e,t){return p?new OffscreenCanvas(e,t):Ln("canvas")}function f(e,t,n){let i=1;const r=G(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===h&&(h=m(n,s));const a=t?m(n,s):h;a.width=n,a.height=s;return a.getContext("2d").drawImage(e,0,0,n,s),a}return e}return e}function g(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function y(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function v(n,i,r,s,a=!1){if(null!==n&&void 0!==e[n])return e[n];let o=i;if(i===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(
vendor: 5,390 bytes, line 1
1o=e.R32I)),i===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RGB8UI),r===e.UNSIGNED_SHORT&&(o=e.RGB16UI),r===e.UNSIGNED_INT&&(o=e.RGB32UI),r===e.BYTE&&(o=e.RGB8I),r===e.SHORT&&(o=e.RGB16I),r===e.INT&&(o=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),r===e.UNSIGNED_INT&&(o=e.RGBA32UI),r===e.BYTE&&(o=e.RGBA8I),r===e.SHORT&&(o=e.RGBA16I),r===e.INT&&(o=e.RGBA32I)),i===e.RGB&&(r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),r===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),i===e.RGBA){const t=a?Wt:qn.getTransfer(s);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===Xt?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return o!==e.R16F&&o!==e.R32F&&o!==e.RG16F&&o!==e.RG32F&&o!==e.RGBA16F&&o!==e.RGBA32F||t.get("EXT_color_buffer_float"),o}function x(t,n){let i;return t?null===n||n===Ve||n===He?i=e.DEPTH24_STENCIL8:n===qe?i=e.DEPTH32F_STENCIL8:n===Fe&&(i=e.DEPTH24_STENCIL8):null===n||n===Ve||n===He?i=e.DEPTH_COMPONENT24:n===qe?i=e.DEPTH_COMPONENT32F:n===Fe&&(i=e.DEPTH_COMPONENT16),i}function b(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==Re&&e.minFilter!==Pe?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function T(e){const t=e.target;t.removeEventListener("dispose",T),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=d.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&M(e),0===Object.keys(r).length&&d.delete(n)}i.remove(e)}(t),t.isVideoTexture&&c.delete(t)}function S(t){const n=t.target;n.removeEventListener("dispose",S),function(t){const n=i.get(t);t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture));if(t.isWebGLCubeRenderTarget)for(let i=0;i<6;i++){if(Array.isArray(n.__webglFramebuffer[i]))for(let t=0;t<n.__webglFramebuffer[i].length;t++)e.deleteFramebuffer(n.__webglFramebuffer[i][t]);else e.deleteFramebuffer(n.__webglFramebuffer[i]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[i])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let s=0,o=r.length;s<o;s++){const t=i.get(r[s]);t.__webglTexture&&(e.deleteTexture(t.__webglTexture),a.memory.textures--),i.remove(r[s])}i.remove(t)}(n)}function M(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete d.get(r)[n.__cacheKey],a.memory.textures--}let w=0;function E(t,r){const s=i.get(t);if(t.isVideoTexture&&function(e){const t=a.render.frame;c.get(e)!==t&&(c.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&!0!==t.isExternalTexture&&t.version>0&&s.__version!==t.version){const e=t.image;if(null===e);else if(!1!==e.complete)return void L(s,t,r)}else t.isExternalTexture&&(s.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+r)}const A={[we]:e.REPEAT,[Ee]:e.CLAMP_TO_EDGE,[Ae]:e.MIRRORED_REPEAT},R={[Re]:e.NEAREST,[Ce]:e.NEAREST_MIPMAP_NEAREST,[Ne]:e.NEAREST_MIPMAP_LINEAR,[Pe]:e.LINEAR,[Ie]:e.LINEAR_MIPMAP_NEAREST,[Le]:e.LINEAR_MIPMAP_LINEAR},C={[Kt]:e.NEVER,[rn]:e.ALWAYS,[Zt]:e.LESS,[Qt]:e.LEQUAL,[Jt]:e.EQUAL,[nn]:e.GEQUAL,[en]:e.GREATER,[tn]:e.NOTEQUAL};function N(n,s){if(s.type===qe&&!1===t.has("OES_texture_float_linear")&&(s.magFilter===Pe||s.magFilter===Ie||s.magFilter===Ne||s.magFilter===Le||s.minFilter===Pe||s.minFilter===Ie||s.minFilter===Ne||s.minFilter),e.texParameteri(n,e.TEXTURE_WRAP_S,A[s.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,A[s.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,A[s.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,R[s.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,R[s.minFilter]),s.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,C[s.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(s.magFilter===Re)return;if(s.minFilter!==Ne&&s.minFilter!==Le)return;if(s.type===qe&&!1===t.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const a=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function P(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",T));const r=n.source;let s=d.get(r);void 0===s&&(s={},d.set(r,s));const o=function(e){const t=[];
vendor: 4,659 bytes, line 1
1return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===s[o]&&(s[o]={texture:e.createTexture(),usedTimes:0},a.memory.textures++,i=!0),s[o].usedTimes++;const r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&M(n)),t.__cacheKey=o,t.__webglTexture=s[o].texture}return i}function I(e,t,n){return Math.floor(Math.floor(e/n)/t)}function L(t,a,o){let l=e.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),a.isData3DTexture&&(l=e.TEXTURE_3D);const u=P(t,a),c=a.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);const h=i.get(c);if(c.version!==h.__version||!0===u){n.activeTexture(e.TEXTURE0+o);const t=qn.getPrimaries(qn.workingColorSpace),i=a.colorSpace===Gt?null:qn.getPrimaries(a.colorSpace),d=a.colorSpace===Gt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=f(a.image,!1,r.maxTextureSize);p=k(a,p);const m=s.convert(a.format,a.colorSpace),y=s.convert(a.type);let T,S=v(a.internalFormat,m,y,a.colorSpace,a.isVideoTexture);N(l,a);const M=a.mipmaps,w=!0!==a.isVideoTexture,E=void 0===h.__version||!0===u,A=c.dataReady,R=b(a,p);if(a.isDepthTexture)S=x(a.format===Ze,a.type),E&&(w?n.texStorage2D(e.TEXTURE_2D,1,S,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,S,p.width,p.height,0,m,y,null));else if(a.isDataTexture)if(M.length>0){w&&E&&n.texStorage2D(e.TEXTURE_2D,R,S,M[0].width,M[0].height);for(let t=0,i=M.length;t<i;t++)T=M[t],w?A&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,T.width,T.height,m,y,T.data):n.texImage2D(e.TEXTURE_2D,t,S,T.width,T.height,0,m,y,T.data);a.generateMipmaps=!1}else w?(E&&n.texStorage2D(e.TEXTURE_2D,R,S,p.width,p.height),A&&function(t,i,r,s){const a=t.updateRanges;if(0===a.length)n.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,r,s,i.data);else{a.sort((e,t)=>e.start-t.start);let o=0;for(let e=1;e<a.length;e++){const t=a[o],n=a[e],r=t.start+t.count,s=I(n.start,i.width,4),l=I(t.start,i.width,4);n.start<=r+1&&s===l&&I(n.start+n.count-1,i.width,4)===s?t.count=Math.max(t.count,n.start+n.count-t.start):(++o,a[o]=n)}a.length=o+1;const l=e.getParameter(e.UNPACK_ROW_LENGTH),u=e.getParameter(e.UNPACK_SKIP_PIXELS),c=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,i.width);for(let t=0,h=a.length;t<h;t++){const o=a[t],l=Math.floor(o.start/4),u=Math.ceil(o.count/4),c=l%i.width,h=Math.floor(l/i.width),d=u,p=1;e.pixelStorei(e.UNPACK_SKIP_PIXELS,c),e.pixelStorei(e.UNPACK_SKIP_ROWS,h),n.texSubImage2D(e.TEXTURE_2D,0,c,h,d,p,r,s,i.data)}t.clearUpdateRanges(),e.pixelStorei(e.UNPACK_ROW_LENGTH,l),e.pixelStorei(e.UNPACK_SKIP_PIXELS,u),e.pixelStorei(e.UNPACK_SKIP_ROWS,c)}}(a,p,m,y)):n.texImage2D(e.TEXTURE_2D,0,S,p.width,p.height,0,m,y,p.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){w&&E&&n.texStorage3D(e.TEXTURE_2D_ARRAY,R,S,M[0].width,M[0].height,p.depth);for(let t=0,i=M.length;t<i;t++)if(T=M[t],a.format!==Ye){if(null!==m)if(w){if(A)if(a.layerUpdates.size>0){const i=xh(T.width,T.height,a.format,a.type);for(const r of a.layerUpdates){const s=T.data.subarray(r*i/T.data.BYTES_PER_ELEMENT,(r+1)*i/T.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,r,T.width,T.height,1,m,s)}a.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,T.width,T.height,p.depth,m,T.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,T.width,T.height,p.depth,0,T.data,0,0)}else w?A&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,T.width,T.height,p.depth,m,y,T.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,S,T.width,T.height,p.depth,0,m,y,T.data)}else{w&&E&&n.texStorage2D(e.TEXTURE_2D,R,S,M[0].width,M[0].height);for(let t=0,i=M.length;t<i;t++)T=M[t],a.format!==Ye?null!==m&&(w?A&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,T.width,T.height,m,T.data):n.compressedTexImage2D(e.TEXTURE_2D,t,S,T.width,T.height,0,T.data)):w?A&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,T.width,T.height,m,y,T.data):n.texImage2D(e.TEXTURE_2D,t,S,T.width,T.height,0,m,y,T.data)}else if(a.isDataArrayTexture)if(w){if(E&&n.texStorage3D(e.TEXTURE_2D_ARRAY,R,S,p.width,p.height,p.depth),A)if(a.layerUpdates.size>0){const t=xh(p.width,p.height,a.format,a.type);for(const i of a.layerUpdates){const r=p.data.subarray(i*t/p.data.BYTES_PER_ELEMENT,(i+1)
vendor: 6,922 bytes, line 1
1*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,m,y,r)}a.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,y,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,m,y,p.data);else if(a.isData3DTexture)w?(E&&n.texStorage3D(e.TEXTURE_3D,R,S,p.width,p.height,p.depth),A&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,y,p.data)):n.texImage3D(e.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,m,y,p.data);else if(a.isFramebufferTexture){if(E)if(w)n.texStorage2D(e.TEXTURE_2D,R,S,p.width,p.height);else{let t=p.width,i=p.height;for(let r=0;r<R;r++)n.texImage2D(e.TEXTURE_2D,r,S,t,i,0,m,y,null),t>>=1,i>>=1}}else if(M.length>0){if(w&&E){const t=G(M[0]);n.texStorage2D(e.TEXTURE_2D,R,S,t.width,t.height)}for(let t=0,i=M.length;t<i;t++)T=M[t],w?A&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,m,y,T):n.texImage2D(e.TEXTURE_2D,t,S,m,y,T);a.generateMipmaps=!1}else if(w){if(E){const t=G(p);n.texStorage2D(e.TEXTURE_2D,R,S,t.width,t.height)}A&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,m,y,p)}else n.texImage2D(e.TEXTURE_2D,0,S,m,y,p);g(a)&&_(l),h.__version=c.version,a.onUpdate&&a.onUpdate(a)}t.__version=a.version}function D(t,r,a,l,u,c){const h=s.convert(a.format,a.colorSpace),d=s.convert(a.type),p=v(a.internalFormat,h,d,a.colorSpace),m=i.get(r),f=i.get(a);if(f.__renderTarget=r,!m.__hasExternalTextures){const t=Math.max(1,r.width>>c),i=Math.max(1,r.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,c,p,t,i,r.depth,0,h,d,null):n.texImage2D(u,c,p,t,i,0,h,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),z(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,u,f.__webglTexture,0,q(r)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,u,f.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function O(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,s=r&&r.isDepthTexture?r.type:null,a=x(n.stencilBuffer,s),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=q(n);z(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,a,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,a,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,a,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r<t.length;r++){const a=t[r],l=s.convert(a.format,a.colorSpace),u=s.convert(a.type),c=v(a.internalFormat,l,u,a.colorSpace),h=q(n);i&&!1===z(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,h,c,n.width,n.height):z(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,h,c,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,c,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function U(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const s=i.get(r.depthTexture);s.__renderTarget=r,s.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),E(r.depthTexture,0);const a=s.__webglTexture,l=q(r);if(r.depthTexture.format===Ke)z(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,l):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==Ze)throw new Error("Unknown depthTexture format");z(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,l):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}function F(t){const r=i.get(t),s=!0===t.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==t.depthTexture){const e=t.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),e){const t=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),r.__depthDisposeCallback=t}r.__boundDepthTexture=e}if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");const e=t.texture.mipmaps;e&&e.length>0?U(r.__webglFramebuffer[0],t):U(r.__webglFramebuffer,t)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=e.createRenderbuffer(),O(r.__webglDepthbuffer[i],t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,s)}}else{const i=t.texture.mipmaps;if(i&&i.length>0?n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=e.createRenderbuffer(),O(r.__webglDepthbuffer,t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,i)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}const B=[],V=[];function q(e){return Math.min(r.maxSamples,e.samples)}function z(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function k(e,t){const n=e.colorSpace;e.format,e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==jt&&n!==Gt&&qn.getTransfer(n),t}function G(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(u.width=e.naturalWidth||e.width,u.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(u.width=e.displayWidth,u.height=e.displayHeight):(u.width=e.width,u.height=e.height),u}this.allocateTextureUnit=function(){const e=w;return r.maxTextures,w+=1,e},this.resetTextureUnits=function(){w=0},this.setTexture2D=E,this.setTexture2DArray=function(t,r){const s=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&s.__version!==t.version?L(s,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){const s=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&s.__version!==t.version?L(s,t,r):n.bindTexture(e.TEXTURE_3D,s.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,a){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,a,o){if(6!==a.image.length)return;const l=P(t,a),u=a.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);const c=i.get(u);if(u.version!==c.__version||!0===l){n.activeTexture(e.TEXTURE0+o);const t=qn.getPrimaries(qn.workingColorSpace),i=a.colorSpace
vendor: 4,324 bytes, line 1
1===Gt?null:qn.getPrimaries(a.colorSpace),h=a.colorSpace===Gt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,h);const d=a.isCompressedTexture||a.image[0].isCompressedTexture,p=a.image[0]&&a.image[0].isDataTexture,m=[];for(let e=0;e<6;e++)m[e]=d||p?p?a.image[e].image:a.image[e]:f(a.image[e],!0,r.maxCubemapSize),m[e]=k(a,m[e]);const y=m[0],x=s.convert(a.format,a.colorSpace),T=s.convert(a.type),S=v(a.internalFormat,x,T,a.colorSpace),M=!0!==a.isVideoTexture,w=void 0===c.__version||!0===l,E=u.dataReady;let A,R=b(a,y);if(N(e.TEXTURE_CUBE_MAP,a),d){M&&w&&n.texStorage2D(e.TEXTURE_CUBE_MAP,R,S,y.width,y.height);for(let t=0;t<6;t++){A=m[t].mipmaps;for(let i=0;i<A.length;i++){const r=A[i];a.format!==Ye?null!==x&&(M?E&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,x,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,S,r.width,r.height,0,r.data)):M?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,x,T,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,S,r.width,r.height,0,x,T,r.data)}}}else{if(A=a.mipmaps,M&&w){A.length>0&&R++;const t=G(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,R,S,t.width,t.height)}for(let t=0;t<6;t++)if(p){M?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,x,T,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,S,m[t].width,m[t].height,0,x,T,m[t].data);for(let i=0;i<A.length;i++){const r=A[i].image[t].image;M?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,x,T,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,S,r.width,r.height,0,x,T,r.data)}}else{M?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,x,T,m[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,S,x,T,m[t]);for(let i=0;i<A.length;i++){const r=A[i];M?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,x,T,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,S,x,T,r.image[t])}}}g(a)&&_(e.TEXTURE_CUBE_MAP),c.__version=u.version,a.onUpdate&&a.onUpdate(a)}t.__version=a.version}(o,t,a):n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+a)},this.rebindTextures=function(t,n,r){const s=i.get(t);void 0!==n&&D(s.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&F(t)},this.setupRenderTarget=function(t){const r=t.texture,o=i.get(t),l=i.get(r);t.addEventListener("dispose",S);const u=t.textures,c=!0===t.isWebGLCubeRenderTarget,h=u.length>1;if(h||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,a.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)o.__webglFramebuffer[t][n]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(h)for(let t=0,n=u.length;t<n;t++){const n=i.get(u[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),a.memory.textures++)}if(t.samples>0&&!1===z(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<u.length;n++){const i=u[n];o.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),a=s.convert(i.type),l=v(i.internalFormat,r,a,i.colorSpace,!0===t.isXRRenderTarget),c=q(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,c,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,o.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),O(o.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),N(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;
vendor: 11,631 bytes, line 1
1i++)D(o.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else D(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&_(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(h){for(let r=0,s=u.length;r<s;r++){const s=u[r],a=i.get(s);let l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(l,a.__webglTexture),N(l,s),D(o.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0+r,l,0),g(s)&&_(l)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),N(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)D(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else D(o.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);g(r)&&_(i),n.unbindTexture()}t.depthBuffer&&F(t)},this.updateRenderTargetMipmap=function(e){const t=e.textures;for(let r=0,s=t.length;r<s;r++){const s=t[r];if(g(s)){const t=y(e),r=i.get(s).__webglTexture;n.bindTexture(t,r),_(t),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===z(t)){const r=t.textures,s=t.width,a=t.height;let o=e.COLOR_BUFFER_BIT;const u=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=i.get(t),h=r.length>1;if(h)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer);const d=t.texture.mipmaps;d&&d.length>0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),h){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,s,a,0,0,s,a,o,e.NEAREST),!0===l&&(B.length=0,V.length=0,B.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(B.push(u),V.push(u),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,V)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,B))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),h)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,c.__webglColorRenderbuffer[t]);const s=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,s,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=F,this.setupFrameBufferTexture=D,this.useMultisampledRTT=z}function Kp(e,t){return{convert:function(n,i=""){let r;const s=qn.getTransfer(i);if(n===De)return e.UNSIGNED_BYTE;if(n===ke)return e.UNSIGNED_SHORT_4_4_4_4;if(n===Ge)return e.UNSIGNED_SHORT_5_5_5_1;if(n===je)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===We)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===Oe)return e.BYTE;if(n===Ue)return e.SHORT;if(n===Fe)return e.UNSIGNED_SHORT;if(n===Be)return e.INT;if(n===Ve)return e.UNSIGNED_INT;if(n===qe)return e.FLOAT;if(n===ze)return e.HALF_FLOAT;if(n===Xe)return e.ALPHA;if(n===$e)return e.RGB;if(n===Ye)return e.RGBA;if(n===Ke)return e.DEPTH_COMPONENT;if(n===Ze)return e.DEPTH_STENCIL;if(n===Je)return e.RED;if(n===Qe)return e.RED_INTEGER;if(n===et)return e.RG;if(n===tt)return e.RG_INTEGER;if(n===nt)return e.RGBA_INTEGER;if(n===it||n===rt||n===st||n===at)if(s===Xt){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===it)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===rt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===st)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===at)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===it)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===rt)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===st)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===at)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===ot||n===lt||n===ut||n===ct){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===ot)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===lt)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ut)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ct)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===ht||n===dt||n===pt){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===ht||n===dt)return s===Xt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===pt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===mt||n===ft||n===gt||n===_t||n===yt||n===vt||n===xt||n===bt||n===Tt||n===St||n===Mt||n===wt||n===Et||n===At){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===mt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ft)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===gt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===_t)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===yt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===vt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===xt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===bt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Tt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===St)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Mt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===wt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Et)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===At)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Rt||n===Ct||n===Nt){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===Rt)return s===Xt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ct)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Nt)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===Pt||n===It||n===Lt||n===Dt){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===Pt)return r.COMPRESSED_RED_RGTC1_EXT;if(n===It)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Lt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Dt)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===He?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class Zp{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){const n=new xo(e.texture);e.depthNear===t.depthNear&&e.depthFar===t.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new cs({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new is(new Ul(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Jp extends hn{constructor(e,t){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=1,l=null,u=null,c=null,h=null,d=null,p=null;const m="undefined"!=typeof XRWebGLBinding,f=new Zp,g={},_=t.getContextAttributes();let y=null,v=null;const x=[],b=[],T=new Sn;let S=null;const M=new fs;M.viewport=new Zn;const w=new fs;w.viewport=new Zn;const E=[M,w],A=new mc;let R=null,C=null;function N(e){const t=b.indexOf(e.inputSource);if(-1===t)return;const n=x[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||s),n.dispatchEvent({type:e.type,data:e.inputSource}))}function P(){i.removeEventListener("select",N),i.removeEventListener("selectstart",N),i.removeEventListener("selectend",N),i.removeEventListener("squeeze",N),i.removeEventListener("squeezestart",N),i.removeEventListener("squeezeend",N),i.removeEventListener("end",P),i.removeEventListener("inputsourceschange",I);for(let e=0;e<x.length;e++){const t=b[e];null!==t&&(b[e]=null,x[e].disconnect(t))}R=null,C=null,f.reset();for(const e in g)delete g[e];e.setRenderTarget(y),d=null,h=null,c=null,i=null,v=null,F.stop(),n.isPresenting=!1,e.setPixelRatio(S),e.setSize(T.width,T.height,!1),n.dispatchEvent({type:"sessionend"})}function I(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=b.indexOf(n);i>=0&&(b[i]=null,x[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=b.indexOf(n);if(-1===i){for(let e=0;e<x.length;e++){if(e>=b.length){b.push(n),i=e;break}if(null===b[e]){b[e]=n,i=e;break}}if(-1===i)break}const r=x[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new Ts,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new Ts,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new Ts,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,n.isPresenting},this.setReferenceSpaceType=function(e){a=e,n.isPresenting},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return null===c&&m&&(c=new XRWebGLBinding(i,t)),c},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(u){if(i=u,null!==i){y=e.getRenderTarget(),i.addEventListener("select",N),i.addEventListener("selectstart",N),i.addEventListener("selectend",N),i.addEventListener("squeeze",N),i.addEventListener("squeezestart",N),i.addEventListener("squeezeend",N),i.addEventListener("end",P),i.addEventListener("inputsourceschange",I),!0!==_.xrCompatible&&await t.makeXRCompatible(),S=e.getPixelRatio(),e.getSize(T);if(m&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,s=null,a=null;_.depth&&(a=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=_.stencil?Ze:Ke,s=_.stencil?He:Ve);const o={colorFormat:t.RGBA8,depthFormat:a,scaleFactor:r};c=this.getBinding(),h=c.createProjectionLayer(o),i.updateRenderState({layers:[h]}
vendor: 18,859 bytes, line 1
1),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),v=new Qn(h.textureWidth,h.textureHeight,{format:Ye,type:De,depthTexture:new vo(h.textureWidth,h.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}else{const n={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),v=new Qn(d.framebufferWidth,d.framebufferHeight,{format:Ye,type:De,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await i.requestReferenceSpace(a),F.setContext(i),F.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};const L=new wn,D=new wn;function O(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===i)return;let t=e.near,n=e.far;null!==f.texture&&(f.depthNear>0&&(t=f.depthNear),f.depthFar>0&&(n=f.depthFar)),A.near=w.near=M.near=t,A.far=w.far=M.far=n,R===A.near&&C===A.far||(i.updateRenderState({depthNear:A.near,depthFar:A.far}),R=A.near,C=A.far),A.layers.mask=6|e.layers.mask,M.layers.mask=3&A.layers.mask,w.layers.mask=5&A.layers.mask;const r=e.parent,s=A.cameras;O(A,r);for(let i=0;i<s.length;i++)O(s[i],r);2===s.length?function(e,t,n){L.setFromMatrixPosition(t.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);const i=L.distanceTo(D),r=t.projectionMatrix.elements,s=n.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],c=(r[8]-1)/r[0],h=(s[8]+1)/s[0],d=a*c,p=a*h,m=i/(-c+h),f=m*-c;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===r[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{const t=a+m,n=o+m,r=d-f,s=p+(i-f),c=l*o/n*t,h=u*o/n*t;e.projectionMatrix.makePerspective(r,s,c,h,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(A,M,w):A.projectionMatrix.copy(M.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld));e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*fn*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,A,r)},this.getCamera=function(){return A},this.getFoveation=function(){if(null!==h||null!==d)return o},this.setFoveation=function(e){o=e,null!==h&&(h.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==f.texture},this.getDepthSensingMesh=function(){return f.getMesh(A)},this.getCameraTexture=function(e){return g[e]};let U=null;const F=new bh;F.setAnimationLoop(function(t,r){if(u=r.getViewerPose(l||s),p=r,null!==u){const t=u.views;null!==d&&(e.setRenderTargetFramebuffer(v,d.framebuffer),e.setRenderTarget(v));let r=!1;t.length!==A.cameras.length&&(A.cameras.length=0,r=!0);for(let n=0;n<t.length;n++){const i=t[n];let s=null;if(null!==d)s=d.getViewport(i);else{const t=c.getViewSubImage(h,i);s=t.viewport,0===n&&(e.setRenderTargetTextures(v,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(v))}let a=E[n];void 0===a&&(a=new fs,a.layers.enable(n),a.viewport=new Zn,E[n]=a),a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(i.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(s.x,s.y,s.width,s.height),0===n&&(A.matrix.copy(a.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),!0===r&&A.cameras.push(a)}const s=i.enabledFeatures;if(s&&s.includes("depth-sensing")&&"gpu-optimized"==i.depthUsage&&m){c=n.getBinding();const e=c.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&f.init(e,i.renderState)}if(s&&s.includes("camera-access")&&m){e.state.unbindTexture(),c=n.getBinding();for(let e=0;e<t.length;e++){const n=t[e].camera;if(n){let e=g[n];e||(e=new xo,g[n]=e);const t=c.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<x.length;e++){const t=b[e],n=x[e];null!==t&&void 0!==n&&n.update(t,r,l||s)}U&&U(t,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),p=null}),this.setAnimationLoop=function(e){U=e},this.dispose=function(){}}}const Qp=new Vi,em=new Ci;function tm(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),s=r.envMap,a=r.envMapRotation;s&&(e.envMap.value=s,Qp.copy(a),Qp.x*=-1,Qp.y*=-1,Qp.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(Qp.y*=-1,Qp.z*=-1),e.envMapRotation.value.setFromMatrix4(em.makeRotationFromEuler(Qp)),e.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,ls(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,s,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform));e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform));t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate()));t.dispersion>0&&(e.dispersion.value=t.dispersion);t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,o)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,s,a):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function nm(e,t,n,i){let r={},s={},a=[];const o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,s=t+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[s];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[s]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function u(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture,t}function c(t){const n=t.target;n.removeEventListener("dispose",c);const i=a.indexOf(n.__bindingPointIndex);a.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,h){let d=r[n.id];void 0===d&&(!function(e){const t=e.uniforms;let n=0;const i=16;for(let s=0,a=t.length;s<a;s++){const e=Array.isArray(t[s])?t[s]:[t[s]];for(let t=0,r=e.length;t<r;t++){const r=e[t],s=Array.isArray(r.value)?r.value:[r.value];for(let e=0,t=s.length;e<t;e++){const t=u(s[e]),a=n%i,o=a%t.boundary,l=a+o;n+=o,0!==l&&i-l<t.storage&&(n+=i-l),r.__data=new Float32Array(t.storage/Float32Array.BYTES_PER_ELEMENT),r.__offset=n,n+=t.storage}}}const r=n%i;r>0&&(n+=i-r);e.__size=n,e.__cache={}}(n),d=function(t){const n=function(){for(let e=0;e<o;e++)if(-1===a.indexOf(e))return a.push(e),e;return 0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,s=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,s),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",c));const p=h.program;i.updateUBOMapping(n,p);const m=t.render.frame;s[n.id]!==m&&(!function(t){const n=r[t.id],i=t.uniforms,s=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let r=0,a=i.length;r<a;r++){const t=Array.isArray(i[r])?i[r]:[i[r]];for(let n=0,i=t.length;n<i;n++){const i=t[n];if(!0===l(i,r,n,s)){const t=i.__offset,n=Array.isArray(i.value)?i.value:[i.value];let r=0;for(let s=0;s<n.length;s++){const a=n[s],o=u(a);"number"==typeof a||"boolean"==typeof a?(i.__data[0]=a,e.bufferSubData(e.UNIFORM_BUFFER,t+r,i.__data)):a.isMatrix3?(i.__data[0]=a.elements[0],i.__data[1]=a.elements[1],i.__data[2]=a.elements[2],i.__data[3]=0,i.__data[4]=a.elements[3],i.__data[5]=a.elements[4],i.__data[6]=a.elements[5],i.__data[7]=0,i.__data[8]=a.elements[6],i.__data[9]=a.elements[7],i.__data[10]=a.elements[8],i.__data[11]=0):(a.toArray(i.__data,r),r+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,i.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),s[n.id]=m)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);a=[],r={},s={}}}}class im{constructor(e={}){const{canvas:t=Dn(),context:n=null,depth:i=!0,stencil:r=!1,alpha:s=!1,antialias:a=!1,premultipliedAlpha:o=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:c=!1,reversedDepthBuffer:h=!1}=e;let d;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=s;const p=new Uint32Array(4),m=new Int32Array(4);let f=null,g=null;const _=[],y=[];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=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const v=this;let x=!1;this._outputColorSpace=Ht;let b=0,T=0,S=null,M=-1,w=null;const E=new Zn,A=new Zn;let R=null;const C=new br(0);let N=0,P=t.width,I=t.height,L=1,D=null,O=null;const U=new Zn(0,0,P,I),F=new Zn(0,0,P,I);let B=!1;const q=new wa;let z=!1,k=!1;const G=new Ci,H=new wn,j=new Zn,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let X=!1;function $(){return null===S?L:1}let Y,K,Z,J,Q,ee,te,ne,ie,re,se,ae,oe,le,ue,ce,he,de,pe,me,fe,ge,_e,ye,ve=n;function xe(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:c};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${V}`),t.addEventListener("webglcontextlost",Se,!1),t.addEventListener("webglcontextrestored",Me,!1),t.addEventListener("webglcontextcreationerror",we,!1),null===ve){const t="webgl2";if(ve=xe(t,e),null===ve)throw xe(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Ze){throw Ze}function be(){Y=new ed(ve),Y.init(),ge=new Kp(ve,Y),K=new Ih(ve,Y,e,ge),Z=new $p(ve,Y),K.reversedDepthBuffer&&h&&Z.buffers.depth.setReversed(!0),J=new id(ve),Q=new Op,ee=new Yp(ve,Y,Z,Q,K,ge,J),te=new Dh(v),ne=new Qh(v),ie=new Th(ve),_e=new Nh(ve,ie),re=new td(ve,ie,J,_e),se=new sd(ve,re,ie,J),pe=new rd(ve,K,ee),ce=new Lh(Q),ae=new Dp(v,te,ne,Y,K,_e,ce),oe=new tm(v,Q),le=new Vp,ue=new jp(Y),de=new Ch(v,te,ne,Z,se,d,o),he=new Wp(v,se,K),ye=new nm(ve,J,K,Z),me=new Ph(ve,Y,J),fe=new nd(ve,Y,J),J.programs=ae.programs,v.capabilities=K,v.extensions=Y,v.properties=Q,v.renderLists=le,v.shadowMap=he,v.state=Z,v.info=J}be();const Te=new Jp(v,ve);function Se(e){e.preventDefault(),x=!0}function Me(){x=!1;const e=J.autoReset,t=he.enabled,n=he.autoUpdate,i=he.needsUpdate,r=he.type;be(),J.autoReset=e,he.enabled=t,he.autoUpdate=n,he.needsUpdate=i,he.type=r}function we(e){}function Ee(e){const t=e.target;t.removeEventListener("dispose",Ee),function(e){(function(e){const t=Q.get(e).programs;void 0!==t&&(t.forEach(function(e){ae.releaseProgram(e)}),e.isShaderMaterial&&ae.releaseShaderCache(e))})(e),Q.remove(e)}(t)}function Ae(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,je(e,t,n),e.side=0,e.needsUpdate=!0,je(e,t,n),e.side=2):je(e,t,n)}this.xr=Te,this.getContext=function(){return ve},this.getContextAttributes=function(){return ve.getContextAttributes()},this.forceContextLoss=function(){const e=Y.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=Y.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(e){void 0!==e&&(L=e,this.setSize(P,I,!1))},this.getSize=function(e){return e.set(P,I)},this.setSize=function(e,n,i=!0){Te.isPresenting||(P=e,I=n,t.width=Math.floor(e*L),t.height=Math.floor(n*L),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(P*L,I*L).floor()},this.setDrawingBufferSize=function(e,n,i){P=e,I=n,L=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(U)},this.setViewport=function(e,t,n,i){e.isVector4?U.set(e.x,e.y,e.z,e.w):U.set(e,t,n,i),Z.viewport(E.copy(U).multiplyScalar(L).round())}
vendor: 2,974 bytes, line 1
1,this.getScissor=function(e){return e.copy(F)},this.setScissor=function(e,t,n,i){e.isVector4?F.set(e.x,e.y,e.z,e.w):F.set(e,t,n,i),Z.scissor(A.copy(F).multiplyScalar(L).round())},this.getScissorTest=function(){return B},this.setScissorTest=function(e){Z.setScissorTest(B=e)},this.setOpaqueSort=function(e){D=e},this.setTransparentSort=function(e){O=e},this.getClearColor=function(e){return e.copy(de.getClearColor())},this.setClearColor=function(){de.setClearColor(...arguments)},this.getClearAlpha=function(){return de.getClearAlpha()},this.setClearAlpha=function(){de.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==S){const t=S.texture.format;e=t===nt||t===tt||t===Qe}if(e){const e=S.texture.type,t=e===De||e===Ve||e===Fe||e===He||e===ke||e===Ge,n=de.getClearColor(),i=de.getClearAlpha(),r=n.r,s=n.g,a=n.b;t?(p[0]=r,p[1]=s,p[2]=a,p[3]=i,ve.clearBufferuiv(ve.COLOR,0,p)):(m[0]=r,m[1]=s,m[2]=a,m[3]=i,ve.clearBufferiv(ve.COLOR,0,m))}else i|=ve.COLOR_BUFFER_BIT}t&&(i|=ve.DEPTH_BUFFER_BIT),n&&(i|=ve.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ve.clear(i)},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",Se,!1),t.removeEventListener("webglcontextrestored",Me,!1),t.removeEventListener("webglcontextcreationerror",we,!1),de.dispose(),le.dispose(),ue.dispose(),Q.dispose(),te.dispose(),ne.dispose(),se.dispose(),_e.dispose(),ye.dispose(),ae.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Ce),Te.removeEventListener("sessionend",Ne),Pe.stop()},this.renderBufferDirect=function(e,t,n,i,r,s){null===t&&(t=W);const a=r.isMesh&&r.matrixWorld.determinant()<0,o=function(e,t,n,i,r){!0!==t.isScene&&(t=W);ee.resetTextureUnits();const s=t.fog,a=i.isMeshStandardMaterial?t.environment:null,o=null===S?v.outputColorSpace:!0===S.isXRRenderTarget?S.texture.colorSpace:jt,l=(i.isMeshStandardMaterial?ne:te).get(i.envMap||a),u=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let m=0;i.toneMapped&&(null!==S&&!0!==S.isXRRenderTarget||(m=v.toneMapping));const f=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=void 0!==f?f.length:0,y=Q.get(i),x=g.state.lights;if(!0===z&&(!0===k||e!==w)){const t=e===w&&i.id===M;ce.setState(i,e,t)}let b=!1;i.version===y.__version?y.needsLights&&y.lightsStateVersion!==x.state.version||y.outputColorSpace!==o||r.isBatchedMesh&&!1===y.batching?b=!0:r.isBatchedMesh||!0!==y.batching?r.isBatchedMesh&&!0===y.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===y.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===y.instancing?b=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&
vendor: 23,157 bytes, line 1
1!1===y.skinning?b=!0:r.isSkinnedMesh||!0!==y.skinning?r.isInstancedMesh&&!0===y.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===y.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===y.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===y.instancingMorph&&null!==r.morphTexture||y.envMap!==l||!0===i.fog&&y.fog!==s?b=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===ce.numPlanes&&y.numIntersection===ce.numIntersection?(y.vertexAlphas!==u||y.vertexTangents!==c||y.morphTargets!==h||y.morphNormals!==d||y.morphColors!==p||y.toneMapping!==m||y.morphTargetsCount!==_)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,y.__version=i.version);let T=y.currentProgram;!0===b&&(T=je(i,t,r));let E=!1,A=!1,R=!1;const C=T.getUniforms(),N=y.uniforms;Z.useProgram(T.program)&&(E=!0,A=!0,R=!0);i.id!==M&&(M=i.id,A=!0);if(E||w!==e){Z.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),C.setValue(ve,"projectionMatrix",e.projectionMatrix),C.setValue(ve,"viewMatrix",e.matrixWorldInverse);const t=C.map.cameraPosition;void 0!==t&&t.setValue(ve,H.setFromMatrixPosition(e.matrixWorld)),K.logarithmicDepthBuffer&&C.setValue(ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&C.setValue(ve,"isOrthographic",!0===e.isOrthographicCamera),w!==e&&(w=e,A=!0,R=!0)}if(r.isSkinnedMesh){C.setOptional(ve,r,"bindMatrix"),C.setOptional(ve,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),C.setValue(ve,"boneTexture",e.boneTexture,ee))}r.isBatchedMesh&&(C.setOptional(ve,r,"batchingTexture"),C.setValue(ve,"batchingTexture",r._matricesTexture,ee),C.setOptional(ve,r,"batchingIdTexture"),C.setValue(ve,"batchingIdTexture",r._indirectTexture,ee),C.setOptional(ve,r,"batchingColorTexture"),null!==r._colorsTexture&&C.setValue(ve,"batchingColorTexture",r._colorsTexture,ee));const P=n.morphAttributes;void 0===P.position&&void 0===P.normal&&void 0===P.color||pe.update(r,n,T);(A||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,C.setValue(ve,"receiveShadow",r.receiveShadow));i.isMeshGouraudMaterial&&null!==i.envMap&&(N.envMap.value=l,N.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(N.envMapIntensity.value=t.environmentIntensity);A&&(C.setValue(ve,"toneMappingExposure",v.toneMappingExposure),y.needsLights&&(O=R,(D=N).ambientLightColor.needsUpdate=O,D.lightProbe.needsUpdate=O,D.directionalLights.needsUpdate=O,D.directionalLightShadows.needsUpdate=O,D.pointLights.needsUpdate=O,D.pointLightShadows.needsUpdate=O,D.spotLights.needsUpdate=O,D.spotLightShadows.needsUpdate=O,D.rectAreaLights.needsUpdate=O,D.hemisphereLights.needsUpdate=O),s&&!0===i.fog&&oe.refreshFogUniforms(N,s),oe.refreshMaterialUniforms(N,i,L,I,g.state.transmissionRenderTarget[e.id]),cp.upload(ve,We(y),N,ee));var D,O;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(cp.upload(ve,We(y),N,ee),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&C.setValue(ve,"center",r.center);if(C.setValue(ve,"modelViewMatrix",r.modelViewMatrix),C.setValue(ve,"normalMatrix",r.normalMatrix),C.setValue(ve,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];ye.update(n,T),ye.bind(n,T)}}return T}(e,t,n,i,r);Z.setMaterial(i,a);let l=n.index,u=1;if(!0===i.wireframe){if(l=re.getWireframeAttribute(n),void 0===l)return;u=2}const c=n.drawRange,h=n.attributes.position;let d=c.start*u,p=(c.start+c.count)*u;null!==s&&(d=Math.max(d,s.start*u),p=Math.min(p,(s.start+s.count)*u)),null!==l?(d=Math.max(d,0),p=Math.min(p,l.count)):null!=h&&(d=Math.max(d,0),p=Math.min(p,h.count));const m=p-d;if(m<0||m===1/0)return;let f;_e.setup(r,i,o,n,l);let _=me;if(null!==l&&(f=ie.get(l),_=fe,_.setIndex(f)),r.isMesh)!0===i.wireframe?(Z.setLineWidth(i.wireframeLinewidth*$()),_.setMode(ve.LINES)):_.setMode(ve.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),Z.setLineWidth(e*$()),r.isLineSegments?_.setMode(ve.LINES):r.isLineLoop?_.setMode(ve.LINE_LOOP):_.setMode(ve.LINE_STRIP)}else r.isPoints?_.setMode(ve.POINTS):r.isSprite&&_.setMode(ve.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)Un("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),_.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(Y.get("WEBGL_multi_draw"))_.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,s=l?ie.get(l).bytesPerElement:1,a=Q.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)a.setValue(ve,"_gl_DrawID",i),_.render(e[i]/s,t[i])}else if(r.isInstancedMesh)_.renderInstances(d,m,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);_.renderInstances(d,m,t)}else _.render(d,m)},this.compile=function(e,t,n=null){null===n&&(n=e),g=ue.get(n),g.init(t),y.push(g),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(g.pushLight(e),e.castShadow&&g.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(g.pushLight(e),e.castShadow&&g.pushShadow(e))}),g.setupLights();const i=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const s=t[r];Ae(s,n,e),i.add(s)}else Ae(t,n,e),i.add(t)}),g=y.pop(),i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise(t=>{function n(){i.forEach(function(e){Q.get(e).currentProgram.isReady()&&i.delete(e)}),0!==i.size?setTimeout(n,10):t(e)}null!==Y.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let Re=null;function Ce(){Pe.stop()}function Ne(){Pe.start()}const Pe=new bh;function Ie(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||q.intersectsSprite(e)){i&&j.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=se.update(e),r=e.material;r.visible&&f.push(e,t,r,n,j.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||q.intersectsObject(e))){const t=se.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),j.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),j.copy(t.boundingSphere.center)),j.applyMatrix4(e.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const i=t.groups;for(let s=0,a=i.length;s<a;s++){const a=i[s],o=r[a.materialIndex];o&&o.visible&&f.push(e,t,o,n,j.z,a)}}else r.visible&&f.push(e,t,r,n,j.z,null)}const r=e.children;for(let s=0,a=r.length;s<a;s++)Ie(r[s],t,n,i)}function Oe(e,t,n,i){const r=e.opaque,s=e.transmissive,a=e.transparent;g.setupLightsView(n),!0===z&&ce.setGlobalState(v.clippingPlanes,n),i&&Z.viewport(E.copy(i)),r.length>0&&Be(r,t,n),s.length>0&&Be(s,t,n),a.length>0&&Be(a,t,n),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Ue(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===g.state.transmissionRenderTarget[i.id]&&(g.state.transmissionRenderTarget[i.id]=new Qn(1,1,{generateMipmaps:!0,type:Y.has("EXT_color_buffer_half_float")||Y.has("EXT_color_buffer_float")?ze:De,minFilter:Le,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:qn.workingColorSpace}));const s=g.state.transmissionRenderTarget[i.id],a=i.viewport||E;s.setSize(a.z*v.transmissionResolutionScale,a.w*v.transmissionResolutionScale);const o=v.getRenderTarget(),l=v.getActiveCubeFace(),u=v.getActiveMipmapLevel();v.setRenderTarget(s),v.getClearColor(C),N=v.getClearAlpha(),N<1&&v.setClearColor(16777215,.5),v.clear(),X&&de.render(n);const c=v.toneMapping;v.toneMapping=0;const h=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),g.setupLightsView(i),!0===z&&ce.setGlobalState(v.clippingPlanes,i),Be(e,n,i),ee.updateMultisampleRenderTarget(s),ee.updateRenderTargetMipmap(s),!1===Y.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,s=t.length;r<s;r++){const s=t[r],a=s.object,o=s.geometry,l=s.material,u=s.group;if(2===l.side&&a.layers.test(i.layers)){const t=l.side;l.side=1,l.needsUpdate=!0,qe(a,n,i,o,l,u),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(ee.updateMultisampleRenderTarget(s),ee.updateRenderTargetMipmap(s))}v.setRenderTarget(o,l,u),v.setClearColor(C,N),void 0!==h&&(i.viewport=h),v.toneMapping=c}function Be(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r<s;r++){const s=e[r],a=s.object,o=s.geometry,l=s.group;let u=s.material;!0===u.allowOverride&&null!==i&&(u=i),a.layers.test(n.layers)&&qe(a,t,n,o,u,l)}}function qe(e,t,n,i,r,s){e.onBeforeRender(v,t,n,i,r,s),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(v,t,n,i,e,s),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,s),r.side=0,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,s),r.side=2):v.renderBufferDirect(n,t,i,r,e,s),e.onAfterRender(v,t,n,i,r,s)}function je(e,t,n){!0!==t.isScene&&(t=W);const i=Q.get(e),r=g.state.lights,s=g.state.shadowsArray,a=r.state.version,o=ae.getParameters(e,r.state,s,t,n),l=ae.getProgramCacheKey(o);let u=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?ne:te).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===u&&(e.addEventListener("dispose",Ee),u=new Map,i.programs=u);let c=u.get(l);if(void 0!==c){if(i.currentProgram===c&&i.lightsStateVersion===a)return Xe(e,o),c}else o.uniforms=ae.getUniforms(e),e.onBeforeCompile(o,v),c=ae.acquireProgram(o,l),u.set(l,c),i.uniforms=o.uniforms;const h=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(h.clippingPlanes=ce.uniform),Xe(e,o),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=a,i.needsLights&&(h.ambientLightColor.value=r.state.ambient,h.lightProbe.value=r.state.probe,h.directionalLights.value=r.state.directional,h.directionalLightShadows.value=r.state.directionalShadow,h.spotLights.value=r.state.spot,h.spotLightShadows.value=r.state.spotShadow,h.rectAreaLights.value=r.state.rectArea,h.ltc_1.value=r.state.rectAreaLTC1,h.ltc_2.value=r.state.rectAreaLTC2,h.pointLights.value=r.state.point,h.pointLightShadows.value=r.state.pointShadow,h.hemisphereLights.value=r.state.hemi,h.directionalShadowMap.value=r.state.directionalShadowMap,h.directionalShadowMatrix.value=r.state.directionalShadowMatrix,h.spotShadowMap.value=r.state.spotShadowMap,h.spotLightMatrix.value=r.state.spotLightMatrix,h.spotLightMap.value=r.state.spotLightMap,h.pointShadowMap.value=r.state.pointShadowMap,h.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=c,i.uniformsList=null,c}function We(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=cp.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function Xe(e,t){const n=Q.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}Pe.setAnimationLoop(function(e){Re&&Re(e)}),"undefined"!=typeof self&&Pe.setContext(self),this.setAnimationLoop=function(e){Re=e,Te.setAnimationLoop(e),null===e?Pe.stop():Pe.start()},Te.addEventListener("sessionstart",Ce),Te.addEventListener("sessionend",Ne),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return;if(!0===x)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Te.enabled&&!0===Te.isPresenting&&(!0===Te.cameraAutoUpdate&&Te.updateCamera(t),t=Te.getCamera()),!0===e.isScene&&e.onBeforeRender(v,e,t,S),g=ue.get(e,y.length),g.init(t),y.push(g),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),q.setFromProjectionMatrix(G,ln,t.reversedDepth),k=this.localClippingEnabled,z=ce.init(this.clippingPlanes,k),f=le.get(e,_.length),f.init(),_.push(f),!0===Te.enabled&&!0===Te.isPresenting){const e=v.xr.getDepthSensingMesh();null!==e&&Ie(e,t,-1/0,v.sortObjects)}Ie(e,t,0,v.sortObjects),f.finish(),!0===v.sortObjects&&f.sort(D,O),X=!1===Te.enabled||!1===Te.isPresenting||!1===Te.hasDepthSensing(),X&&de.addToRenderList(f,e),this.info.render.frame++,!0===z&&ce.beginShadows();const n=g.state.shadowsArray;he.render(n,e,t),!0===z&&ce.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=f.opaque,r=f.transmissive;if(g.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,s=n.length;t<s;t++){Ue(i,r,e,n[t])}X&&de.render(e);for(let t=0,i=n.length;t<i;t++){const i=n[t];Oe(f,e,i,i.viewport)}}else r.length>0&&Ue(i,r,e,t),X&&de.render(e),Oe(f,e,t);null!==S&&0===T&&(ee.updateMultisampleRenderTarget(S),ee.updateRenderTargetMipmap(S)),!0===e.isScene&&e.onAfterRender(v,e,t),_e.resetDefaultState(),M=-1,w=null,y.pop(),y.length>0?(g=y[y.length-1],!0===z&&ce.setGlobalState(v.clippingPlanes,g.state.camera)):g=null,_.pop(),f=_.length>0?_[_.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return S},this.setRenderTargetTextures=function(e,t,n){const i=Q.get(e);i.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),Q.get(e.texture).__webglTexture=t,Q.get(e.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){const n=Q.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};const $e=ve.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){S=e,b=t,T=n;let i=!0,r=null,s=!1,a=!1;if(e){const o=Q.get(e);if(void 0!==o.__useDefaultFramebuffer)Z.bindFramebuffer(ve.FRAMEBUFFER,null),i=!1;else if(void 0===o.__webglFramebuffer)ee.setupRenderTarget(e);else if(o.__hasExternalTextures)ee.rebindTextures(e,Q.get(e.texture).__webglTexture,Q.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(o.__boundDepthTexture!==t){if(null!==t&&Q.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ee.setupDepthRenderbuffer(e)}}const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const u=Q.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(u[t])?u[t][n]:u[t],s=!0):r=e.samples>0&&!1===ee.useMultisampledRTT(e)?Q.get(e).__webglMultisampledFramebuffer:Array.isArray(u)?u[n]:u,E.copy(e.viewport),A.copy(e.scissor),R=e.scissorTest}else E.copy(U).multiplyScalar(L).floor(),A.copy(F).multiplyScalar(L).floor(),R=B;0!==n&&(r=$e);if(Z.bindFramebuffer(ve.FRAMEBUFFER,r)&&i&&Z.drawBuffers(e,r),Z.viewport(E),Z.scissor(A),Z.setScissorTest(R),s){const i=Q.get(e.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(a){const i=t;for(let t=0;t<e.textures.length;t++){const r=Q.get(e.textures[t]);ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0+t,r.__webglTexture,n,i)}}else if(null!==e&&0!==n){const t=Q.get(e.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,t.__webglTexture,n)}M=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,a,o=0){if(!e||!e.isWebGLRenderTarget)return;let l=Q.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(l=l[a]),l){Z.bindFramebuffer(ve.FRAMEBUFFER,l);try{const a=e.textures[o],l=a.format,u=a.type;if(!K.textureFormatReadable(l))return;if(!K.textureTypeReadable(u))return;t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&(e.textures.length>1&&ve.readBuffer(ve.COLOR_ATTACHMENT0+o),ve.readPixels(t,n,i,r,ge.convert(l),ge.convert(u),s))}finally{const e=null!==S?Q.get(S).__webglFramebuffer:null;Z.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,s,a,o=0){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=Q.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(l=l[a]),l){if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){Z.bindFramebuffer(ve.FRAMEBUFFER,l);const a=e.textures[o],u=a.format,c=a.type;if(!K.textureFormatReadable(u))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!K.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const h=ve.createBuffer();ve.bindBuffer(ve.PIXEL_PACK_BUFFER,h),ve.bufferData(ve.PIXEL_PACK_BUFFER,s.byteLength,ve.STREAM_READ),e.textures.length>1&&ve.readBuffer(ve.COLOR_ATTACHMENT0+o),ve.readPixels(t,n,i,r,ge.convert(u),ge.convert(c),0);const d=null!==S?Q.get(S).__webglFramebuffer:null;Z.bindFramebuffer(ve.FRAMEBUFFER,d);const p=ve.fenceSync(ve.SYNC_GPU_COMMANDS_COMPLETE,0);return ve.flush(),await function(e,t,n){return new Promise(function(i,r){setTimeout(function s(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}},n)})}(ve,p,4),ve.bindBuffer(ve.PIXEL_PACK_BUFFER,h),ve.getBufferSubData(ve.PIXEL_PACK_BUFFER,0,s),ve.deleteBuffer(h),ve.deleteSync(p),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i),a=null!==t?t.x:0,o=null!==t?t.y:0;ee.setTexture2D(e,0),ve.copyTexSubImage2D(ve.TEXTURE_2D,n,0,0,a,o,r,s),Z.unbindTexture()};const Ye=ve.createFramebuffer(),Ke=ve.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,i=null,r=0,s=null){let a,o,l,u,c,h,d,p,m;null===s&&(0!==r?(Un("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=r,r=0):s=0);const f=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==n)a=n.max.x-n.min.x,o=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,u=n.min.x,c=n.min.y,h=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-r);a=Math.floor(f.width*t),o=Math.floor(f.height*t),l=e.isDataArrayTexture?f.depth:e.isData3DTexture?Math.floor(f.depth*t):1,u=0,c=0,h=0}null!==i?(d=i.x,p=i.y,m=i.z):(d=0,p=0,m=0);const g=ge.convert(t.format),_=ge.convert(t.type);let y;t.isData3DTexture?(ee.setTexture3D(t,0),y=ve.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(ee.setTexture2DArray(t,0),y=ve.TEXTURE_2D_ARRAY):(ee.setTexture2D(t,0),y=ve.TEXTURE_2D),ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,t.unpackAlignment);const v=ve.getParameter(ve.UNPACK_ROW_LENGTH),x=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),b=ve.getParameter(ve.UNPACK_SKIP_PIXELS),T=ve.getParameter(ve.UNPACK_SKIP_ROWS),S=ve.getParameter(ve.UNPACK_SKIP_IMAGES);ve.pixelStorei(ve.UNPACK_ROW_LENGTH,f.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,f.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,u),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,c),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,h);const M=e.isDataArrayTexture||e.isData3DTexture,w=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=Q.get(e),i=Q.get(t),f=Q.get(n.__renderTarget),g=Q.get(i.__renderTarget);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,f.__webglFramebuffer),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let _=0;_<l;_++)M&&(ve.framebufferTextureLayer(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Q.get(e).__webglTexture,r,h+_),ve.framebufferTextureLayer(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Q.get(t).__webglTexture,s,m+_)),ve.blitFramebuffer(u,c,a,o,d,p,a,o,ve.DEPTH_BUFFER_BIT,ve.NEAREST);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,null),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,null)}else if(0!==r||e.isRenderTargetTexture||Q.has(e)){const n=Q.get(e),i=Q.get(t);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,Ye),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,Ke);for(let e=0;e<l;e++)M?ve.framebufferTextureLayer(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,n.__webglTexture,r,h+e):ve.framebufferTexture2D(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,n.__webglTexture,r),w?ve.framebufferTextureLayer(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,i.__webglTexture,s,m+e):ve.framebufferTexture2D(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,i.__webglTexture,s),0!==r?ve.blitFramebuffer(u,c,a,o,d,p,a,o,ve.COLOR_BUFFER_BIT,ve.NEAREST):w?ve.copyTexSubImage3D(y,s,d,p,m+e,u,c,a,o):ve.copyTexSubImage2D(y,s,d,p,u,c,a,o);Z.bindFramebuffer(ve.READ_FRAMEBUFFER,null),Z.bindFramebuffer(ve.DRAW_FRAMEBUFFER,null)}else w?e.isDataTexture||e.isData3DTexture?ve.texSubImage3D(y,s,d,p,m,a,o,l,g,_,f.data):t.isCompressedArrayTexture?ve.compressedTexSubImage3D(y,s,d,p,m,a,o,l,g,f.data):ve.texSubImage3D(y,s,d,p,m,a,o,l,g,_,f):e.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,s,d,p,a,o,g,_,f.data):e.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,s,d,p,f.width,f.height,g,f.data):ve.texSubImage2D(ve.TEXTURE_2D,s,d,p,a,o,g,_,f);ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,x),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,b),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,T),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,S),0===s&&t.generateMipmaps&&ve.generateMipmap(y),Z.unbindTexture()},this.initRenderTarget=function(e){void 0===Q.get(e).__webglFramebuffer&&ee.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?ee.setTextureCube(e,0):e.isData3DTexture?ee.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?ee.setTexture2DArray(e,0):ee.setTexture2D(e,0),Z.unbindTexture()},this.resetState=function(){b=0,T=0,S=null,Z.reset(),_e.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ln}get outputColorSpace(){return this._outputColorSpace}
vendor: 4,295 bytes, line 1
1set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=qn._getDrawingBufferColorSpace(e),t.unpackColorSpace=qn._getUnpackColorSpace()}}const rm=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:4,AddEquation:j,AddOperation:2,AdditiveAnimationBlendMode:kt,AdditiveBlending:2,AgXToneMapping:6,AlphaFormat:Xe,AlwaysCompare:rn,AlwaysDepth:1,AlwaysStencilFunc:Yt,AmbientLight:Ku,AnimationAction:Dc,AnimationClip:Tu,AnimationLoader:class extends Au{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Nu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(s){i&&i(s),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Tu.parse(e[n]);t.push(i)}return t}},AnimationMixer:class extends hn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,a=e._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let u=l[o];void 0===u&&(u={},l[o]=u);for(let c=0;c!==r;++c){const e=i[c],r=e.name;let l=u[r];if(void 0!==l)++l.referenceCount,s[c]=l;else{if(l=s[c],void 0!==l){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,o,r));continue}const i=t&&t._propertyBindings[c].binding.parsedPath;l=new Ec(Lc.create(n,r,i),e.ValueTypeName,e.getValueSize()),++l.referenceCount,this._addInactiveBinding(l,o,r),s[c]=l}a[c].resultBuffer=l.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0===n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let s=r[t];if(void 0===s)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{const t=s.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,s=this._actionsByClip,a=s[r],o=a.knownActions,l=o[o.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,o[u]=l,o.pop(),e._byClipCacheIndex=null;delete a.actionByRoot[(e._localRoot||this._root).uuid],0===o.length&&delete s[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const e=t[n];0===--e.referenceCount&&this._removeInactiveBinding(e)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[t];void 0===s&&(s={},i[t]=s),s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,a=s[i],o=t[t.length-1],l=e._cacheIndex;
vendor: 8,313 bytes, line 1
1o._cacheIndex=l,t[l]=o,t.pop(),delete a[r],0===Object.keys(a).length&&delete s[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&(n=new du(new Float32Array(2),new Float32Array(2),1,Oc),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let s="string"==typeof e?Tu.findByName(i,e):e;const a=null!==s?s.uuid:e,o=this._actionsByClip[a];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:zt),void 0!==o){const e=o.actionByRoot[r];if(void 0!==e&&e.blendMode===n)return e;l=o.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const u=new Dc(this,s,t,n);return this._bindAction(u,l),this._addInactiveAction(u,a,r),u}existingAction(e,t){const n=t||this._root,i=n.uuid,r="string"==typeof e?Tu.findByName(n,e):e,s=r?r.uuid:e,a=this._actionsByClip[s];return void 0!==a&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let l=0;l!==n;++l){t[l]._update(i,e,r,s)}const a=this._bindings,o=this._nActiveBindings;for(let l=0;l!==o;++l)a[l].apply(s);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const e=r.knownActions;for(let n=0,i=e.length;n!==i;++n){const i=e[n];this._deactivateAction(i);const r=i._cacheIndex,s=t[t.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,t[r]=s,t.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const r in n){const e=n[r].actionByRoot[t];void 0!==e&&(this._deactivateAction(e),this._removeInactiveAction(e))}const i=this._bindingsByRootAndName[t];if(void 0!==i)for(const r in i){const e=i[r];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}},AnimationObjectGroup:class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=gn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let a,o=e.length,l=this.nCachedObjects_;for(let u=0,c=arguments.length;u!==c;++u){const c=arguments[u],h=c.uuid;let d=t[h];if(void 0===d){d=o++,t[h]=d,e.push(c);for(let e=0,t=s;e!==t;++e)r[e].push(new Lc(c,n[e],i[e]))}else if(d<l){a=e[d];const o=--l,u=e[o];t[u.uuid]=d,e[d]=u,t[h]=o,e[o]=c;for(let e=0,t=s;e!==t;++e){const t=r[e],s=t[o];let a=t[d];t[d]=s,void 0===a&&(a=new Lc(c,n[e],i[e])),t[o]=a}}else e[d]}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s],o=a.uuid,l=t[o];if(void 0!==l&&l>=r){const s=r++,u=e[s];t[u.uuid]=l,e[l]=u,t[o]=s,e[s]=a;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[l];t[l]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=t[o];if(void 0!==l)if(delete t[o],l<r){const a=--r,o=e[a],u=--s,c=e[u];t[o.uuid]=l,e[l]=o,t[c.uuid]=a,e[a]=c,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[a],r=t[u];t[l]=i,t[a]=r,t.pop()}}else{const r=--s,a=e[r];r>0&&(t[a.uuid]=l),e[l]=a,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,a=this._parsedPaths,o=this._objects,l=o.length,u=this.nCachedObjects_,c=new Array(l);i=r.length,n[e]=i,s.push(e),a.push(t),r.push(c);for(let h=u,d=o.length;h!==d;++h){const n=o[h];c[h]=new Lc(n,e,t)}return c}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,o=s[a];t[e[a]]=n,s[n]=o,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}},AnimationUtils:class{static convertArray(e,t){return su(e,t)}static isTypedArray(e){return au(e)}static getKeyframeOrder(e){return ou(e)}static sortedArray(e,t,n){return lu(e,t,n)}static flattenJSON(e,t,n,i){uu(e,t,n,i)}static subclip(e,t,n,i,r=30){return function(e,t,n,i,r=30){const s=e.clone();s.name=t;const a=[];for(let l=0;l<s.tracks.length;++l){const e=s.tracks[l],t=e.getValueSize(),o=[],u=[];for(let s=0;s<e.times.length;++s){const a=e.times[s]*r;if(!(a<n||a>=i)){o.push(e.times[s]);for(let n=0;n<t;++n)u.push(e.values[s*t+n])}}0!==o.length&&(e.times=su(o,e.times.constructor),e.values=su(u,e.values.constructor),a.push(e))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}(e,t,n,i,r)}static makeClipAdditive(e,t=0,n=e,i=30){return function(e,t=0,n=e,i=30){i<=0&&(i=30);const r=n.tracks.length,s=t/i;for(let a=0;a<r;++a){const t=n.tracks[a],i=t.ValueTypeName;if("bool"===i||"string"===i)continue;const r=e.tracks.find(function(e){return e.name===t.name&&e.ValueTypeName===i});if(void 0===r)continue;let o=0;const l=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=l/3);let u=0;const c=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=c/3);const h=t.times.length-1;let d;if(s<=t.times[0]){const e=o,n=l-o;d=t.values.slice(e,n)}else if(s>=t.times[h]){const e=h*l+o,n=e+l-o;d=t.values.slice(e,n)}else{const e=t.createInterpolant(),n=o,i=l-o;e.evaluate(s),d=e.resultBuffer.slice(n,i)}"quaternion"===i&&(new Mn).fromArray(d).normalize().conjugate().toArray(d);const p=r.times.length;for(let e=0;e<p;++e){const t=e*c+u;if("quaternion"===i)Mn.multiplyQuaternionsFlat(r.values,t,d,0,r.values,t);else{const e=c-2*u;for(let n=0;n<e;++n)r.values[t+n]-=d[n]}}}return e.blendMode=kt,e}(e,t,n,i)}},ArcCurve:Do,ArrayCamera:mc,ArrowHelper:class extends nr{constructor(e=new wn(0,0,1),t=new wn(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===gh&&(gh=new jr,gh.setAttribute("position",new Fr([0,0,0,0,1,0],3)),_h=new Mo(.5,1,5,1),_h.translate(0,-.5,0)),this.position.copy(t),this.line=new no(gh,new $a({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new is(_h,new wr({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,s)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{fh.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(fh,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},AttachedBindMode:_e,Audio:bc,AudioAnalyser:class{constructor(e,t=2
1048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}},AudioContext:cc,AudioListener:class extends nr{constructor(){super(),this.type="AudioListener",this.context=cc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new fc}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(gc,_c,yc),vc.set(0,0,-1).applyQuaternion(_c),xc.set(0,1,0).applyQuaternion(_c),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(gc.x,e),t.positionY.linearRampToValueAtTime(gc.y,e),t.positionZ.linearRampToValueAtTime(gc.z,e),t.forwardX.linearRampToValueAtTime(vc.x,e),t.forwardY.linearRampToValueAtTime(vc.y,e),t.forwardZ.linearRampToValueAtTime(vc.z,e),t.upX.linearRampToValueAtTime(xc.x,e),t.upY.linearRampToValueAtTime(xc.y,e),t.upZ.linearRampToValueAtTime(xc.z,e)}
1else t.setPosition(gc.x,gc.y,gc.z),t.setOrientation(vc.x,vc.y,vc.z,xc.x,xc.y,xc.z)}},AudioLoader:class extends Au{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Nu(this.manager);function a(t){i&&i(t),r.manager.itemError(e)}s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(e){try{const n=e.slice(0);cc.getContext().decodeAudioData(n,function(e){t(e)}).catch(a)}catch(n){a(n)}},n,i)}},AxesHelper:class extends ao{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new jr;n.setAttribute("position",new Fr(t,3)),n.setAttribute("color",new Fr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new $a({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new br,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BackSide:1,BasicDepthPacking:3200,BasicShadowMap:0,BatchedMesh:Xa,Bone:ra,BooleanKeyframeTrack:fu,Box2:class{constructor(e=new Sn(1/0,1/0),t=new Sn(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=jc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,jc).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},Box3:ni,Box3Helper:class extends ao{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new jr;i.setIndex(new Lr(n,1)),i.setAttribute("position",new Fr([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new $a({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}},BoxGeometry:ss,BoxHelper:class extends ao{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new jr;r.setIndex(new Lr(n,1)),r.setAttribute("position",new Lr(i,3)),super(r,new $a({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&mh.setFromObject(this.object),mh.isEmpty())return;const e=mh.min,t=mh.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BufferAttribute:Lr,BufferGeometry:jr,BufferGeometryLoader:ic,ByteType:Oe,Cac
1he:Mu,Camera:hs,CameraHelper:class extends ao{constructor(e){const t=new jr,n=new $a({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function a(e,t){o(e),o(t)}function o(e){i.push(0,0,0),r.push(0,0,0),void 0===s[e]&&(s[e]=[]),s[e].push(i.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),t.setAttribute("position",new Fr(i,3)),t.setAttribute("color",new Fr(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new br(16755200),u=new br(16711680),c=new br(43775),h=new br(16777215),d=new br(3355443);this.setColors(l,u,c,h,d)}setColors(e,t,n,i,r){const s=this.geometry.getAttribute("color");return s.setXYZ(0,e.r,e.g,e.b),s.setXYZ(1,e.r,e.g,e.b),s.setXYZ(2,e.r,e.g,e.b),s.setXYZ(3,e.r,e.g,e.b),s.setXYZ(4,e.r,e.g,e.b),s.setXYZ(5,e.r,e.g,e.b),s.setXYZ(6,e.r,e.g,e.b),s.setXYZ(7,e.r,e.g,e.b),s.setXYZ(8,e.r,e.g,e.b),s.setXYZ(9,e.r,e.g,e.b),s.setXYZ(10,e.r,e.g,e.b),s.setXYZ(11,e.r,e.g,e.b),s.setXYZ(12,e.r,e.g,e.b),s.setXYZ(13,e.r,e.g,e.b),s.setXYZ(14,e.r,e.g,e.b),s.setXYZ(15,e.r,e.g,e.b),s.setXYZ(16,e.r,e.g,e.b),s.setXYZ(17,e.r,e.g,e.b),s.setXYZ(18,e.r,e.g,e.b),s.setXYZ(19,e.r,e.g,e.b),s.setXYZ(20,e.r,e.g,e.b),s.setXYZ(21,e.r,e.g,e.b),s.setXYZ(22,e.r,e.g,e.b),s.setXYZ(23,e.r,e.g,e.b),s.setXYZ(24,t.r,t.g,t.b),s.setXYZ(25,t.r,t.g,t.b),s.setXYZ(26,t.r,t.g,t.b),s.setXYZ(27,t.r,t.g,t.b),s.setXYZ(28,t.r,t.g,t.b),s.setXYZ(29,t.r,t.g,t.b),s.setXYZ(30,t.r,t.g,t.b),s.setXYZ(31,t.r,t.g,t.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap;let n,i;if(dh.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),!0===this.camera.reversedDepth)n=1,i=0;else if(this.camera.coordinateSystem===ln)n=-1,i=1;else{if(this.camera.coordinateSystem!==un)throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);n=0,i=1}ph("c",t,e,dh,0,0,n),ph("t",t,e,dh,0,0,i),ph("n1",t,e,dh,-1,-1,n),ph("n2",t,e,dh,1,-1,n),ph("n3",t,e,dh,-1,1,n),ph("n4",t,e,dh,1,1,n),ph("f1",t,e,dh,-1,-1,i),ph("f2",t,e,dh,1,-1,i),ph("f3",t,e,dh,-1,1,i),ph("f4",t,e,dh,1,1,i),ph("u1",t,e,dh,.7,1.1,n),ph("u2",t,e,dh,-.7,1.1,n),ph("u3",t,e,dh,0,2,n),ph("cf1",t,e,dh,-1,0,i),ph("cf2",t,e,dh,1,0,i),ph("cf3",t,e,dh,0,-1,i),ph("cf4",t,e,dh,0,1,i),ph("cn1",t,e,dh,-1,0,n),ph("cn2",t,e,dh,1,0,n),ph("cn3",t,e,dh,0,-1,n),ph("cn4",t,e,dh,0,1,n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CanvasTexture:class extends Kn{constructor(e,t,n,i,r,s,a,o,l){super(e,t,n,i,r,s,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},CapsuleGeometry:bo,CatmullRomCurve3:qo,CineonToneMapping:3,CircleGeometry:To,ClampToEdgeWrapping:Ee,Clock:fc,Color:br,ColorKeyframeTrack:gu,ColorManagement:qn,CompressedArrayTexture:class extends yo{constructor(e,t,n,i,r,s){super(e,t,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Ee,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},CompressedCubeTexture:class extends yo{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,xe),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}},CompressedTexture:yo,CompressedTextureLoader:class extends Au{constructor(e){super(e)}load(e,t,n,i){const r=this,s=[],a=new yo,o=new Nu(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let l=0;function u(u){o.load(e[u],function(e){const n=r.parse(e,!0);s[u]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(a.minFilter=Pe),a.image=s,a.format=n.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let c=0,h=e.length;c<h;++c)u(c);else o.load(e,function(e){const n=r.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){s[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)s[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),s[t].format=n.format,s[t].width=n.width,s[t].height=n.height}a.image=s}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=Pe),a.format=n.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}},ConeGeometry:Mo,ConstantAlphaFactor:213,ConstantColorFactor:211,Controls:vh,CubeCamera:_s,CubeReflectionMapping:xe,CubeRefractionMapping:be,CubeTexture:ys,CubeTextureLoader:class extends Au{constructor(e){super(e)}load(e,t,n,i){const r=new ys;
1r.colorSpace=Ht;const s=new Iu(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function o(n){s.load(e[n],function(e){r.images[n]=e,a++,6===a&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let l=0;l<e.length;++l)o(l);return r}},CubeUVReflectionMapping:Me,CubicBezierCurve:Ho,CubicBezierCurve3:jo,CubicInterpolant:hu,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:Io,CurvePath:Jo,CustomBlending:5,CustomToneMapping:5,CylinderGeometry:So,Cylindrical:class{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return(new this.constructor).copy(this)}},Data3DTexture:ti,DataArrayTexture:ei,DataTexture:sa,DataTextureLoader:class extends Au{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new sa,a=new Nu(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(e){let n;try{n=r.parse(e)}catch(a){if(void 0===i)return;i(a)}void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:Ee,s.wrapT=void 0!==n.wrapT?n.wrapT:Ee,s.magFilter=void 0!==n.magFilter?n.magFilter:Pe,s.minFilter=void 0!==n.minFilter?n.minFilter:Pe,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(s.colorSpace=n.colorSpace),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=Le),1===n.mipmapCount&&(s.minFilter=Pe),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,t&&t(s,n)},n,i),s}},DataUtils:class{static toHalfFloat(e){return Rr(e)}static fromHalfFloat(e){return Cr(e)}},DecrementStencilOp:7683,DecrementWrapStencilOp:34056,DefaultLoadingManager:Eu,DepthFormat:Ke,DepthStencilFormat:Ze,DepthTexture:vo,DetachedBindMode:ye,DirectionalLight:Yu,DirectionalLightHelper:class extends nr{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===t&&(t=1);let i=new jr;i.setAttribute("position",new Fr([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new $a({fog:!1,toneMapped:!1});this.lightPlane=new no(i,r),this.add(this.lightPlane),i=new jr,i.setAttribute("position",new Fr([0,0,0,0,0,1],3)),this.targetLine=new no(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),lh.setFromMatrixPosition(this.light.matrixWorld),uh.setFromMatrixPosition(this.light.target.matrixWorld),ch.subVectors(uh,lh),this.lightPlane.lookAt(uh),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(uh),this.targetLine.scale.z=ch.length()}},DiscreteInterpolant:pu,DodecahedronGeometry:Eo,DoubleSide:2,DstAlphaFactor:ee,DstColorFactor:ne,DynamicCopyUsage:35050,DynamicDrawUsage:an,DynamicReadUsage:35049,EdgesGeometry:Po,EllipseCurve:Lo,EqualCompare:Jt,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:Te,EquirectangularRefractionMapping:Se,Euler:Vi,EventDispatcher:hn,ExternalTexture:xo,ExtrudeGeometry:Pl,FileLoader:Nu,Float16BufferAttribute:Ur,Float32BufferAttribute:Fr,FloatType:qe,Fog:Ms,FogExp2:Ss,FramebufferTexture:_o,FrontSide:0,Frustum:wa,FrustumArray:Ra,GLBufferAttribute:class{constructor(e,t,n,i,r,s=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.normalized=s,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}},GLSL1:"100",GLSL3:on,GreaterCompare:en,GreaterDepth:6,GreaterEqualCompare:nn,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:class extends ao{constructor(e=10,t=10,n=4473924,i=8947848){n=new br(n),i=new br(i);const r=t/2,s=e/t,a=e/2,o=[],l=[];for(let c=0,h=0,d=-a;c<=t;c++,d+=s){o.push(-a,0,d,a,0,d),o.push(d,0,-a,d,0,a);const e=c===r?n:i;e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3}const u=new jr;u.setAttribute("position",new Fr(o,3)),u.setAttribute("color",new Fr(l,3));super(u,new $a({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},Group:xs,HalfFloatType:ze,HemisphereLight:Ou,HemisphereLightHelper:class extends nr{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Ol(t);i.rotateY(.5*Math.PI),this.material=new wr({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new Lr(s,3)),this.add(new is(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");ah.copy(this.light.color),oh.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const i=e<n/2?ah:oh;t.setXYZ(e,i.r,i.g,i.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(sh.setFromMatrixPosition(this.light.matrixWorld).negate())}},IcosahedronGeometry:Ll,ImageBitmapLoader:lc,ImageLoader:Iu,ImageUtils:Hn,IncrementStencilOp:7682,IncrementWrapStencilOp:34055,InstancedBufferAttribute:ua,InstancedBufferGeometry:nc,InstancedInterleavedBuffer:Fc,InstancedMesh:_a,Int16BufferAttribute:class extends Lr{constructor(e,t,n){super(new Int16Array(e),t,n)}},Int32BufferAttribute:class extends Lr{constructor(e,t,n){super(new Int32Array(e),t,n)}},Int8BufferAttribute:class extends Lr{constructor(e,t,n){super(new Int8Array(e),t,n)}},IntType:Be,InterleavedBuffer:Es,InterleavedBufferAttribute:Rs,Interpolant:cu,InterpolateDiscrete:Ot,InterpolateLinear:Ut,InterpolateSmooth:Ft,InterpolationSamplingMode:{NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},InterpolationSamplingType:{PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},InvertStencilOp:5386,KeepStencilOp:$t,KeyframeTrack:mu,LOD:Xs,LatheGeometry:Dl,Layers:qi,LessCompare:Zt,LessDepth:2,LessEqualCompare:Qt,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:Du,LightProbe:Qu,Line:no,Line3:Qc,LineBasicMaterial:$a,LineCurve:Wo,LineCurve3:Xo,LineDashedMaterial:ru,LineLoop:oo,LineSegments:ao,LinearFilter:Pe,LinearInterpolant:du,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:Le,LinearMipmapNearestFilter:Ie,LinearSRGBColorSpace:jt,LinearToneMapping:1,LinearTransfer:Wt,Loader:Au,LoaderUtils:tc,LoadingManager:wu,LoopOnce:2200,LoopPingPong:2202,LoopRepeat:2201,MOUSE:q,Material:Mr,MaterialLoader:ec,MathUtils:Tn,Matrix2:Hc,Matrix3:Rn,Matrix4:Ci,MaxEquation:104,Mesh:is,MeshBasicMaterial:wr,MeshDepthMaterial:tu,MeshDistanceMaterial:nu,MeshLambertMaterial:eu,MeshMatcapMaterial:iu,MeshNormalMaterial:Ql,MeshPhongMaterial:Zl,MeshPhysicalMaterial:Kl,MeshStandardMaterial:Yl,MeshToonMaterial:Jl,MinEquation:103,MirroredRepeatWrapping:Ae,MixOperation:1,MultiplyBlending:4,MultiplyOperation:0,NearestFilter:Re,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:Ne,NearestMipmapNearestFilter:Ce,NeutralToneMapping:7,NeverCompare:Kt,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:Gt,NoToneMapping:0,NormalAnimationBlendMode:zt,NormalBlending:1,NotEqualCompare:tn,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:_u,Object3D:nr,ObjectLoader:class extends Au{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===this.path?tc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const a=new Nu(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){let s=null;try{s=JSON.parse(n)}catch(o){return void(void 0!==i&&i(o))}const a=s.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(s,t):void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+e))},n,i)}async loadAsync(e,t){const n=""===this.path?tc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||n;const i=new Nu(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(e,t),s=JSON.parse(r),a=s.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(s)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=this.parseImages(e.images,function(){void 0!==t&&t(l)}),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,o,a,n),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),this.bindLightTargets(l),void 0!==t){let e=!1;for(const t in s)if(s[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),s=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,s),o=this.parseObject(e.object,i,a,s,t),l=this.parseSkeletons(e.skeletons,o);return this.bindSkeletons(o,l),this.bindLightTargets(o),o}parseShapes(e){const t={};if(void 0!==e)for(let n=0,i=e.length;n<i;n++){const i=(new el).fromJSON(e[n]);t[i.uuid]=i}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(e){e.isBone&&(i[e.uuid]=e)}),void 0!==e)for(let r=0,s=e.length;r<s;r++){const t=(new la).fromJSON(e[r],i);n[t.uuid]=t}return n}parseGeometries(e,t){const n={};if(void 0!==e){const i=new ic;for(let r=0,s=e.length;r<s;r++){let s;const a=e[r];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(a);break;default:a.type in Wl&&(s=Wl[a.type].fromJSON(a,t))}s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.userData&&(s.userData=a.userData),n[a.uuid]=s}}return n}parseMaterials(e,t){const n={},i={};if(void 0!==e){const r=new ec;r.setTextures(t);for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const i=e[n],r=Tu.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function s(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),r.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:In(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new wu(t);r=new Iu(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t<r;t++){const n=e[t],r=n.url;if(Array.isArray(r)){const e=[];for(let t=0,n=r.length;t<n;t++){const n=s(r[t]);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new sa(n.data,n.width,n.height)))}i[n.uuid]=new Wn(e)}else{const e=s(n.url);i[n.uuid]=new Wn(e)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(e){if("string"==typeof e){const n=e,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:t.resourcePath+n;return await i.loadAsync(r)}return e.data?{data:In(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){i=new Iu(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t<i;t++){const i=e[t],s=i.url;if(Array.isArray(s)){const e=[];for(let t=0,n=s.length;t<n;t++){const n=s[t],i=await r(n);null!==i&&(i instanceof HTMLImageElement?e.push(i):e.push(new sa(i.data,i.width,i.height)))}n[i.uuid]=new Wn(e)}else{const e=await r(i.url);n[i.uuid]=new Wn(e)}}}return n}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:t[e]}const i={};if(void 0!==e)for(let r=0,s=e.length;r<s;r++){const s=e[r];s.image,t[s.image];const a=t[s.image],o=a.data;let l;Array.isArray(o)?(l=new ys,6===o.length&&(l.needsUpdate=!0)):(l=o&&o.data?new sa:new Kn,o&&(l.needsUpdate=!0)),l.source=a,l.uuid=s.uuid,void 0!==s.name&&(l.name=s.name),void 0!==s.mapping&&(l.mapping=n(s.mapping,rc)),void 0!==s.channel&&(l.channel=s.channel),void 0!==s.offset&&l.offset.fromArray(s.offset),void 0!==s.repeat&&l.repeat.fromArray(s.repeat),void 0!==s.center&&l.center.fromArray(s.center),void 0!==s.rotation&&(l.rotation=s.rotation),void 0!==s.wrap&&(l.wrapS=n(s.wrap[0],sc),l.wrapT=n(s.wrap[1],sc)),void 0!==s.format&&(l.format=s.format),void 0!==s.internalFormat&&(l.internalFormat=s.internalFormat),void 0!==s.type&&(l.type=s.type),void 0!==s.colorSpace&&(l.colorSpace
1=s.colorSpace),void 0!==s.minFilter&&(l.minFilter=n(s.minFilter,ac)),void 0!==s.magFilter&&(l.magFilter=n(s.magFilter,ac)),void 0!==s.anisotropy&&(l.anisotropy=s.anisotropy),void 0!==s.flipY&&(l.flipY=s.flipY),void 0!==s.generateMipmaps&&(l.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(l.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(l.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(l.compareFunction=s.compareFunction),void 0!==s.userData&&(l.userData=s.userData),i[s.uuid]=l}return i}parseObject(e,t,n,i,r){let s,a,o;function l(e){return t[e],t[e]}function u(e){if(void 0!==e){if(Array.isArray(e)){const t=[];for(let i=0,r=e.length;i<r;i++){const r=e[i];n[r],t.push(n[r])}return t}return n[e],n[e]}}function c(e){return i[e],i[e]}switch(e.type){case"Scene":s=new ws,void 0!==e.background&&(Number.isInteger(e.background)?s.background=new br(e.background):s.background=c(e.background)),void 0!==e.environment&&(s.environment=c(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?s.fog=new Ms(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(s.fog=new Ss(e.fog.color,e.fog.density)),""!==e.fog.name&&(s.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(s.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(s.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&s.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(s.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&s.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":s=new fs(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(s.focus=e.focus),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.filmGauge&&(s.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(s.filmOffset=e.filmOffset),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new Xu(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"AmbientLight":s=new Ku(e.color,e.intensity);break;case"DirectionalLight":s=new Yu(e.color,e.intensity),s.target=e.target||"";break;case"PointLight":s=new Wu(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new Zu(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new zu(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),s.target=e.target||"";break;case"HemisphereLight":s=new Ou(e.color,e.groundColor,e.intensity);break;case"LightProbe":s=(new Qu).fromJSON(e);break;case"SkinnedMesh":a=l(e.geometry),o=u(e.material),s=new ia(a,o),void 0!==e.bindMode&&(s.bindMode=e.bindMode),void 0!==e.bindMatrix&&s.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(s.skeleton=e.skeleton);break;case"Mesh":a=l(e.geometry),o=u(e.material),s=new is(a,o);break;case"InstancedMesh":a=l(e.geometry),o=u(e.material);const t=e.count,n=e.instanceMatrix,i=e.instanceColor;s=new _a(a,o,t),s.instanceMatrix=new ua(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new ua(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":a=l(e.geometry),o=u(e.material),s=new Xa(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,o),s.geometry=a,s.perObjectFrustumCulled=e.perObjectFrustumCulled,s.sortObjects=e.sortObjects,s._drawRanges=e.drawRanges,s._reservedRanges=e.reservedRanges,s._geometryInfo=e.geometryInfo.map(e=>{let t=null,n=null;return void 0!==e.boundingBox&&(t=(new ni).fromJSON(e.boundingBox)),void 0!==e.boundingSphere&&(n=(new xi).fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:n}}),s._instanceInfo=e.instanceInfo,s._availableInstanceIds=e._availableInstanceIds,s._availableGeometryIds=e._availableGeometryIds,s._nextIndexStart=e.nextIndexStart,s._nextVertexStart=e.nextVertexStart,s._geometryCount=e.geometryCount,s._maxInstanceCount=e.maxInstanceCount,s._maxVertexCount=e.maxVertexCount,s._maxIndexCount=e.maxIndexCount,s._geometryInitialized=e.geometryInitialized,s._matricesTexture=c(e.matricesTexture.uuid),s._indirectTexture=c(e.indirectTexture.uuid),void 0!==e.colorsTexture&&(s._c
vendor: 15,657 bytes, line 1
1olorsTexture=c(e.colorsTexture.uuid)),void 0!==e.boundingSphere&&(s.boundingSphere=(new xi).fromJSON(e.boundingSphere)),void 0!==e.boundingBox&&(s.boundingBox=(new ni).fromJSON(e.boundingBox));break;case"LOD":s=new Xs;break;case"Line":s=new no(l(e.geometry),u(e.material));break;case"LineLoop":s=new oo(l(e.geometry),u(e.material));break;case"LineSegments":s=new ao(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":s=new mo(l(e.geometry),u(e.material));break;case"Sprite":s=new Gs(u(e.material));break;case"Group":s=new xs;break;case"Bone":s=new ra;break;default:s=new nr}if(s.uuid=e.uuid,void 0!==e.name&&(s.name=e.name),void 0!==e.matrix?(s.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(s.matrixAutoUpdate=e.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==e.position&&s.position.fromArray(e.position),void 0!==e.rotation&&s.rotation.fromArray(e.rotation),void 0!==e.quaternion&&s.quaternion.fromArray(e.quaternion),void 0!==e.scale&&s.scale.fromArray(e.scale)),void 0!==e.up&&s.up.fromArray(e.up),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(s.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(s.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(s.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&s.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(s.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(s.visible=e.visible),void 0!==e.frustumCulled&&(s.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(s.renderOrder=e.renderOrder),void 0!==e.userData&&(s.userData=e.userData),void 0!==e.layers&&(s.layers.mask=e.layers),void 0!==e.children){const a=e.children;for(let e=0;e<a.length;e++)s.add(this.parseObject(a[e],t,n,i,r))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];s.animations.push(r[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(s.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance,n.hysteresis)}}return s}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const n=t[e.skeleton];void 0===n||e.bind(n,e.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);t.target=void 0!==i?i:new nr}})}},ObjectSpaceNormalMap:1,OctahedronGeometry:Ol,OneFactor:Y,OneMinusConstantAlphaFactor:214,OneMinusConstantColorFactor:212,OneMinusDstAlphaFactor:te,OneMinusDstColorFactor:ie,OneMinusSrcAlphaFactor:Q,OneMinusSrcColorFactor:Z,OrthographicCamera:Xu,PCFShadowMap:1,PCFSoftShadowMap:2,PMREMGenerator:Xh,Path:Qo,PerspectiveCamera:fs,Plane:ba,PlaneGeometry:Ul,PlaneHelper:class extends no{constructor(e,t=1,n=16776960){const i=n,r=new jr;r.setAttribute("position",new Fr([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new $a({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const s=new jr;s.setAttribute("position",new Fr([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),this.add(new is(s,new wr({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},PointLight:Wu,PointLightHelper:class extends is{constructor(e,t,n){super(new Vl(t,4,2),new wr({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},Points:mo,PointsMaterial:lo,PolarGridHelper:class extends ao{constructor(e=10,t=16,n=8,i=64,r=4473924,s=8947848){r=new br(r),s=new br(s);const a=[],o=[];if(t>1)for(let u=0;u<t;u++){const n=u/t*(2*Math.PI),i=Math.sin(n)*e,l=Math.cos(n)*e;a.push(0,0,0),a.push(i,0,l);const c=1&u?r:s;o.push(c.r,c.g,c.b),o.push(c.r,c.g,c.b)}for(let u=0;u<n;u++){const t=1&u?r:s,l=e-e/n*u;for(let e=0;e<i;e++){let n=e/i*(2*Math.PI),r=Math.sin(n)*l,s=Math.cos(n)*l;a.push(r,0,s),o.push(t.r,t.g,t.b),n=(e+1)/i*(2*Math.PI),r=Math.sin(n)*l,s=Math.cos(n)*l,a.push(r,0,s),o.push(t.r,t.g,t.b)}}const l=new jr;l.setAttribute("position",new Fr(a,3)),l.setAttribute("color",new Fr(o,3));super(l,new $a({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},PolyhedronGeometry:wo,PositionalAudio:class extends bc{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Tc,Sc,Mc),wc.set(0,0,1).applyQuaternion(Sc);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Tc.x,e),t.positionY.linearRampToValueAtTime(Tc.y,e),t.positionZ.linearRampToValueAtTime(Tc.z,e),t.orientationX.linearRampToValueAtTime(wc.x,e),t.orientationY.linearRampToValueAtTime(wc.y,e),t.orientationZ.linearRampToValueAtTime(wc.z,e)}else t.setPosition(Tc.x,Tc.y,Tc.z),t.setOrientation(wc.x,wc.y,wc.z)}},PropertyBinding:Lc,PropertyMixer:Ec,QuadraticBezierCurve:$o,QuadraticBezierCurve3:Yo,Quaternion:Mn,QuaternionKeyframeTrack:vu,QuaternionLinearInterpolant:yu,RED_GREEN_RGTC2_Format:Lt,RED_RGTC1_Format:Pt,REVISION:V,RGBADepthPacking:3201,RGBAFormat:Ye,RGBAIntegerFormat:nt,RGBA_ASTC_10x10_Format:wt,RGBA_ASTC_10x5_Format:Tt,RGBA_ASTC_10x6_Format:St,RGBA_ASTC_10x8_Format:Mt,RGBA_ASTC_12x10_Format:Et,RGBA_ASTC_12x12_Format:At,RGBA_ASTC_4x4_Format:mt,RGBA_ASTC_5x4_Format:ft,RGBA_ASTC_5x5_Format:gt,RGBA_ASTC_6x5_Format:_t,RGBA_ASTC_6x6_Format:yt,RGBA_ASTC_8x5_Format:vt,RGBA_ASTC_8x6_Format:xt,RGBA_ASTC_8x8_Format:bt,RGBA_BPTC_Format:Rt,RGBA_ETC2_EAC_Format:pt,RGBA_PVRTC_2BPPV1_Format:ct,RGBA_PVRTC_4BPPV1_Format:ut,RGBA_S3TC_DXT1_Format:rt,RGBA_S3TC_DXT3_Format:st,RGBA_S3TC_DXT5_Format:at,RGBDepthPacking:3202,RGBFormat:$e,RGBIntegerFormat:1032,RGB_BPTC_SIGNED_Format:Ct,RGB_BPTC_UNSIGNED_Format:Nt,RGB_ETC1_Format:ht,RGB_ETC2_Format:dt,RGB_PVRTC_2BPPV1_Format:lt,RGB_PVRTC_4BPPV1_Format:ot,RGB_S3TC_DXT1_Format:it,RGDepthPacking:3203,RGFormat:et,RGIntegerFormat:tt,RawShaderMaterial:$l,Ray:Ri,Raycaster:Vc,RectAreaLight:Zu,RedFormat:Je,RedIntegerFormat:Qe,ReinhardToneMapping:2,RenderTarget:Jn,RenderTarget3D:class extends Jn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new ti(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}},RepeatWrapping:we,ReplaceStencilOp:7681,ReverseSubtractEquation:X,RingGeometry:Fl,SIGNED_RED_GREEN_RGTC2_Format:Dt,SIGNED_RED_RGTC1_Format:It,SRGBColorSpace:Ht,SRGBTransfer:Xt,Scene:ws,ShaderChunk:Sh,ShaderLib:wh,ShaderMaterial:cs,ShadowMaterial:Xl,Shape:el,ShapeGeometry:Bl,ShapePath:yh,ShapeUtils:Rl,ShortType:Ue,Skeleton:la,SkeletonHelper:class extends ao{constructor(e){const t=rh(e),n=new jr,i=[],r=[];for(let o=0;o<t.length;o++){const e=t[o];e.parent&&e.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(0,0,0),r.push(0,0,0))}n.setAttribute("position",new Fr(i,3)),n.setAttribute("color",new Fr(r,3));super(n,new $a({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const s=new br(255),a=new br(65280);this.setColors(s,a)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");ih.copy(this.root.matrixWorld).invert();for(let r=0,s=0;r<t.length;r++){const e=t[r];e.parent&&e.parent.isBone&&(nh.multiplyMatrices(ih,e.matrixWorld),th.setFromMatrixPosition(nh),i.setXYZ(s,th.x,th.y,th.z),nh.multiplyMatrices(ih,e.parent.matrixWorld),th.setFromMatrixPosition(nh),i.setXYZ(s+1,th.x,th.y,th.z),s+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const n=this.geometry.getAttribute("color");for(let i=0;i<n.count;i+=2)n.setXYZ(i,e.r,e.g,e.b),n.setXYZ(i+1,t.r,t.g,t.b);return n.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},SkinnedMesh:ia,Source:Wn,Sphere:xi,SphereGeometry:Vl,Spherical:Gc,SphericalHarmonics3:Ju,SplineCurve:Ko,SpotLight:zu,SpotLightHelper:class extends nr{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new jr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,a=1,o=32;s<o;s++,a++){const e=s/o*Math.PI*2,t=a/o*Math.PI*2;i.push(Math.cos(e),Math.sin(e),1,Math.cos(t),Math.sin(t),1)}n.setAttribute("position",new Fr(i,3));const r=new $a({fog:!1,toneMapped:!1});this.cone=new ao(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),eh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(eh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Sprite:Gs,SpriteMaterial:Cs,SrcAlphaFactor:J,SrcAlphaSaturateFactor:re,SrcColorFactor:K,StaticCopyUsage:35046,StaticDrawUsage:sn,StaticReadUsage:35045,StereoCamera:class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new fs,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new fs,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,pc.copy(e.projectionMatrix);const n=t.eyeSep/2,i=n*t.near/t.focus,r=t.near*Math.tan(mn*t.fov*.5)/t.zoom;let s,a;dc.elements[12]=-n,hc.elements[12]=n,s=-r*t.aspect+i,a=r*t.aspect+i,pc.elements[0]=2*t.near/(a-s),pc.elements[8]=(a+s)/(a-s),this.cameraL.projectionMatrix.copy(pc),s=-r*t.aspect-i,a=r*t.aspect-i,pc.elements[0]=2*t.near/(a-s),pc.elements[8]=(a+s)/(a-s),this.cameraR.projectionMatrix.copy(pc)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(dc),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(hc)}},StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:xu,SubtractEquation:W,SubtractiveBlending:3,TOUCH:z,TangentSpaceNormalMap:0,TetrahedronGeometry:ql,Texture:Kn,TextureLoader:Lu,TextureUtils:class{static contain(e,t){return function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}(e,t)}static cover(e,t){return function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}(e,t)}static fill(e){return function(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}(e)}static getByteLength(e,t,n,i){return xh(e,t,n,i)}},Timer:class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,void 0!==e.hidden&&(this._pageVisibilityHandler=kc.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==e?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}},TimestampQuery:cn,TorusGeometry:zl,TorusKnotGeometry:kl,Triangle:gr,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeGeometry:Gl,UVMapping:ve,Uint16BufferAttribute:Dr,Uint32BufferAttribute:Or,Uint8BufferAttribute:class extends Lr{constructor(e,t,n){super(new Uint8Array(e),t,n)}},Uint8ClampedBufferAttribute:class extends Lr{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},Uniform:class e{constructor(e){this.value=e}clone(){return new e(void 0===this.value.clone?this.value:this.value.clone())}},UniformsGroup:class extends hn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Uc++}),this.name="",this.usage=sn,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const e=Array.isArray(t[n])?t[n]:[t[n]];for(let t=0;t<e.length;t++)this.uniforms.push(e[t].clone())}return this}clone(){return(new this.constructor).copy(this)}},UniformsLib:Mh,UniformsUtils:us,UnsignedByteType:De,UnsignedInt101111Type:We,UnsignedInt248Type:He,UnsignedInt5999Type:je,UnsignedIntType:Ve,UnsignedShort4444Type:ke,UnsignedShort5551Type:Ge,UnsignedShortType:Fe,VSMShadowMap:3,Vector2:Sn,Vector3:wn,
1Vector4:Zn,VectorKeyframeTrack:bu,VideoFrameTexture:class extends go{constructor(e,t,n,i,r,s,a,o){super({},e,t,n,i,r,s,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}},VideoTexture:go,WebGL3DRenderTarget:class extends Qn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new ti(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}},WebGLArrayRenderTarget:class extends Qn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new ei(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}},WebGLCoordinateSystem:ln,WebGLCubeRenderTarget:vs,WebGLRenderTarget:Qn,WebGLRenderer:im,WebGLUtils:Kp,WebGPUCoordinateSystem:un,WebXRController:Ts,WireframeGeometry:Hl,WrapAroundEnding:qt,ZeroCurvatureEnding:Bt,ZeroFactor:$,ZeroSlopeEnding:Vt,ZeroStencilOp:0,createCanvasElement:Dn},Symbol.toStringTag,{value:"Module"}));function sm(e){let t,n,i,r=-1,s=0;for(let u=0;u<e.length;++u){const a=e[u];if(void 0===t&&(t=a.array.constructor),t!==a.array.constructor)return null;if(void 0===n&&(n=a.itemSize),n!==a.itemSize)return null;if(void 0===i&&(i=a.normalized),i!==a.normalized)return null;if(-1===r&&(r=a.gpuType),r!==a.gpuType)return null;s+=a.count*n}const a=new t(s),o=new Lr(a,n,i);let l=0;for(let u=0;u<e.length;++u){const t=e[u];if(t.isInterleavedBufferAttribute){const e=l/n;for(let i=0,r=t.count;i<r;i++)for(let s=0;s<n;s++){const n=t.getComponent(i,s);o.setComponent(i+e,s,n)}}else a.set(t.array,l);l+=t.count*n}return void 0!==r&&(o.gpuType=r),o}function am(e){const t=e.data.array.constructor,n=e.count,i=e.itemSize,r=e.normalized,s=new t(n*i);let a;a=e.isInstancedInterleavedBufferAttribute?new ua(s,i,r,e.meshPerAttribute):new Lr(s,i,r);for(let o=0;o<n;o++)a.setX(o,e.getX(o)),i>=2&&a.setY(o,e.getY(o)),i>=3&&a.setZ(o,e.getZ(o)),i>=4&&a.setW(o,e.getW(o));return a}function om(e,t){if(0===t)return e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const i=n.count-2,r=[];if(2===t)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length;const s=e.clone();return s.setIndex(r),s.clearGroups(),s}return e}const lm=Object.freeze(Object.defineProperty({__proto__:null,computeMikkTSpaceTangents:function(e,t,n=!0){if(!t||!t.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!e.hasAttribute("position")||!e.hasAttribute("normal")||!e.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function i(e){if(e.normalized||e.isInterleavedBufferAttribute){const t=new Float32Array(e.count*e.itemSize);for(let n=0,i=0;n<e.count;n++)t[i++]=e.getX(n),t[i++]=e.getY(n),e.itemSize>2&&(t[i++]=e.getZ(n));return t}return e.array instanceof Float32Array?e.array:new Float32Array(e.array)}const r=e.index?e.toNonIndexed():e,s=t.generateTangents(i(r.attributes.position),i(r.attributes.normal),i(r.attributes.uv));if(n)for(let a=3;a<s.length;a+=4)s[a]*=-1;return r.setAttribute("tangent",new Lr(s,4)),e!==r&&e.copy(r),e},computeMorphedAttributes:function(e){const t=new wn,n=new wn,i=new wn,r=new wn,s=new wn,a=new wn,o=new wn,l=new wn,u=new wn;function c(e,c,h,d,p,m,f,g){t.fromBufferAttribute(c,p),n.fromBufferAttribute(c,m),i.fromBufferAttribute(c,f);const _=e.morphTargetInfluences;if(h&&_){o.set(0,0,0),l.set(0,0,0),u.set(0,0,0);for(let e=0,c=h.length;e<c;e++){const c=_[e],g=h[e];0!==c&&(r.fromBufferAttribute(g,p),s.fromBufferAttribute(g,m),a.fromBufferAttribute(g,f),d?(o.addScaledVector(r,c),l.addScaledVector(s,c),u.addScaledVector(a,c)):(o.addScaledVector(r.sub(t),c),l.addScaledVector(s.sub(n),c),u.addScaledVector(a.sub(i),c)))}t.add(o),n.add(l),i.add(u)}e.isSkinnedMesh&&(e.applyBoneTransform(p,t),e.applyBoneTransform(m,n),e.applyBoneTransform(f,i)),g[3*p+0]=t.x,g[3*p+1]=t.y,g[3*p+2]=t.z,g[3*m+0]=n.x,g[3*m+1]=n.y,g[3*m+2]=n.z,g[3*f+0]=i.x,g[3*f+1]=i.y,g[3*f+2]=i.z}const h=e.geometry,d=e.material;let p,m,f;const g=h.index,_=h.attributes.position,y=h.morphAttributes.position,v=h.morphTargetsRelative,x=h.attributes.normal,b=h.morphAttributes.position,T=h.groups,S=h.drawRange;let M,w,E,A,R,C,N;const P=new Float32Array(_.count*_.itemSize),I=new Float32Array(x.count*x.itemSize);if(null!==g)if(Array.isArray(d))for(M=0,E=T.length;M<E;M++)for(R=T[M],C=Math.max(R.start,S.start),N=Math.min(R.start+R.count,S.start+S.count),w=C,A=N;w<A;w+=3)p=g.getX(w),m=g.getX(w+1),f=g.getX(w+2),c(e,_,y,v,p,m,f,P),c(e,x,b,v,p,m,f,I);else for(C=Math.max(0,S.start),N=Math.min(g.count,S.start+S.count),M=C,E=N;M<E;
1M+=3)p=g.getX(M),m=g.getX(M+1),f=g.getX(M+2),c(e,_,y,v,p,m,f,P),c(e,x,b,v,p,m,f,I);else if(Array.isArray(d))for(M=0,E=T.length;M<E;M++)for(R=T[M],C=Math.max(R.start,S.start),N=Math.min(R.start+R.count,S.start+S.count),w=C,A=N;w<A;w+=3)p=w,m=w+1,f=w+2,c(e,_,y,v,p,m,f,P),c(e,x,b,v,p,m,f,I);else for(C=Math.max(0,S.start),N=Math.min(_.count,S.start+S.count),M=C,E=N;M<E;M+=3)p=M,m=M+1,f=M+2,c(e,_,y,v,p,m,f,P),c(e,x,b,v,p,m,f,I);return{positionAttribute:_,normalAttribute:x,morphedPositionAttribute:new Fr(P,3),morphedNormalAttribute:new Fr(I,3)}},deepCloneAttribute:function(e){return e.isInstancedInterleavedBufferAttribute||e.isInterleavedBufferAttribute?am(e):e.isInstancedBufferAttribute?(new ua).copy(e):(new Lr).copy(e)},deinterleaveAttribute:am,deinterleaveGeometry:function(e){const t=e.attributes,n=e.morphTargets,i=new Map;for(const r in t){const e=t[r];e.isInterleavedBufferAttribute&&(i.has(e)||i.set(e,am(e)),t[r]=i.get(e))}for(const r in n){const e=n[r];e.isInterleavedBufferAttribute&&(i.has(e)||i.set(e,am(e)),n[r]=i.get(e))}},estimateBytesUsed:function(e){let t=0;for(const i in e.attributes){const n=e.getAttribute(i);t+=n.count*n.itemSize*n.array.BYTES_PER_ELEMENT}const n=e.getIndex();return t+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,t},interleaveAttributes:function(e){let t,n=0,i=0;for(let u=0,c=e.length;u<c;++u){const r=e[u];if(void 0===t&&(t=r.array.constructor),t!==r.array.constructor)return null;n+=r.array.length,i+=r.itemSize}const r=new Es(new t(n),i);let s=0;const a=[],o=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let u=0,c=e.length;u<c;u++){const t=e[u],n=t.itemSize,i=t.count,c=new Rs(r,n,s,t.normalized);a.push(c),s+=n;for(let e=0;e<i;e++)for(let i=0;i<n;i++)c[l[i]](e,t[o[i]](e))}return a},mergeAttributes:sm,mergeGeometries:function(e,t=!1){const n=null!==e[0].index,i=new Set(Object.keys(e[0].attributes)),r=new Set(Object.keys(e[0].morphAttributes)),s={},a={},o=e[0].morphTargetsRelative,l=new jr;let u=0;for(let c=0;c<e.length;++c){const h=e[c];let d=0;if(n!==(null!==h.index))return null;for(const e in h.attributes){if(!i.has(e))return null;void 0===s[e]&&(s[e]=[]),s[e].push(h.attributes[e]),d++}if(d!==i.size)return null;if(o!==h.morphTargetsRelative)return null;for(const e in h.morphAttributes){if(!r.has(e))return null;void 0===a[e]&&(a[e]=[]),a[e].push(h.morphAttributes[e])}if(t){let e;if(n)e=h.index.count;else{if(void 0===h.attributes.position)return null;e=h.attributes.position.count}l.addGroup(u,e,c),u+=e}}if(n){let t=0;const n=[];for(let i=0;i<e.length;++i){const r=e[i].index;for(let e=0;e<r.count;++e)n.push(r.getX(e)+t);t+=e[i].attributes.position.count}l.setIndex(n)}for(const c in s){const e=sm(s[c]);if(!e)return null;l.setAttribute(c,e)}for(const c in a){const e=a[c][0].length;if(0===e)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[c]=[];for(let t=0;t<e;++t){const e=[];for(let i=0;i<a[c].length;++i)e.push(a[c][i][t]);const n=sm(e);if(!n)return null;l.morphAttributes[c].push(n)}}return l},mergeGroups:function(e){if(0===e.groups.length)return e;let t=e.groups;if(t=t.sort((e,t)=>e.materialIndex!==t.materialIndex?e.materialIndex-t.materialIndex:e.start-t.start),null===e.getIndex()){const t=e.getAttribute("position"),n=[];for(let e=0;e<t.count;e+=3)n.push(e,e+1,e+2);e.setIndex(n)}const n=e.getIndex(),i=[];for(let a=0;a<t.length;a++){const e=t[a],r=e.start,s=r+e.count;for(let t=r;t<s;t++)i.push(n.getX(t))}e.dispose(),e.setIndex(i);let r=0;for(let a=0;a<t.length;a++){const e=t[a];e.start=r,r+=e.count}let s=t[0];e.groups=[s];for(let a=1;a<t.length;a++){const n=t[a];s.materialIndex===n.materialIndex?s.count+=n.count:(s=n,e.groups.push(s))}return e},mergeVertices:function(e,t=1e-4){t=Math.max(t,Number.EPSILON);const n={},i=e.getIndex(),r=e.getAttribute("position"),s=i?i.count:r.count;let a=0;const o=Object.keys(e.attributes),l={},u={},c=[],h=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let y=0,v=o.length;y<v;y++){const t=o[y],n=e.attributes[t];l[t]=new n.constructor(new n.array.constructor(n.count*n.itemSize),n.itemSize,n.normalized);const i=e.morphAttributes[t];
vendor: 2,525 bytes, line 1
1i&&(u[t]||(u[t]=[]),i.forEach((e,n)=>{const i=new e.array.constructor(e.count*e.itemSize);u[t][n]=new e.constructor(i,e.itemSize,e.normalized)}))}const p=.5*t,m=Math.log10(1/t),f=Math.pow(10,m),g=p*f;for(let y=0;y<s;y++){const t=i?i.getX(y):y;let r="";for(let n=0,i=o.length;n<i;n++){const i=o[n],s=e.getAttribute(i),a=s.itemSize;for(let e=0;e<a;e++)r+=~~(s[h[e]](t)*f+g)+","}if(r in n)c.push(n[r]);else{for(let n=0,i=o.length;n<i;n++){const i=o[n],r=e.getAttribute(i),s=e.morphAttributes[i],c=r.itemSize,p=l[i],m=u[i];for(let e=0;e<c;e++){const n=h[e],i=d[e];if(p[i](a,r[n](t)),s)for(let e=0,r=s.length;e<r;e++)m[e][i](a,s[e][n](t))}}n[r]=a,c.push(a),a++}}const _=e.clone();for(const y in e.attributes){const e=l[y];if(_.setAttribute(y,new e.constructor(e.array.slice(0,a*e.itemSize),e.itemSize,e.normalized)),y in u)for(let t=0;t<u[y].length;t++){const e=u[y][t];_.morphAttributes[y][t]=new e.constructor(e.array.slice(0,a*e.itemSize),e.itemSize,e.normalized)}}return _.setIndex(c),_},toCreasedNormals:function(e,t=Math.PI/3){const n=Math.cos(t),i=100*(1+1e-10),r=[new wn,new wn,new wn],s=new wn,a=new wn,o=new wn,l=new wn;function u(e){return`${~~(e.x*i)},${~~(e.y*i)},${~~(e.z*i)}`}const c=e.index?e.toNonIndexed():e,h=c.attributes.position,d={};for(let f=0,g=h.count/3;f<g;f++){const e=3*f,t=r[0].fromBufferAttribute(h,e+0),n=r[1].fromBufferAttribute(h,e+1),i=r[2].fromBufferAttribute(h,e+2);s.subVectors(i,n),a.subVectors(t,n);const o=(new wn).crossVectors(s,a).normalize();for(let s=0;s<3;s++){const e=u(r[s]);e in d||(d[e]=[]),d[e].push(o)}}const p=new Float32Array(3*h.count),m=new Lr(p,3,!1);for(let f=0,g=h.count/3;f<g;f++){const e=3*f,t=r[0].fromBufferAttribute(h,e+0),i=r[1].fromBufferAttribute(h,e+1),c=r[2].fromBufferAttribute(h,e+2);s.subVectors(c,i),a.subVectors(t,i),o.crossVectors(s,a).normalize();for(let s=0;s<3;s++){const t=d[u(r[s])];l.set(0,0,0);for(let e=0,i=t.length;e<i;e++){const i=t[e];o.dot(i)>n&&l.add(i)}l.normalize(),m.setXYZ(e+s,l.x,l.y,l.z)}}return c.setAttribute("normal",m),c},toTrianglesDrawMode:om},Symbol.toStringTag,{value:"Module"}));class um extends Au{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new fm(e)}),this.register(function(e){return new gm(e)}),this.register(function(e){return new wm(e)}),this.register(function(e){return new Em(e)}),this.register(function(e){return new Am(e)}),this.register(function(e){return new ym(e)}),this.register(function(e){return new vm(e)}
vendor: 13,178 bytes, line 1
1),this.register(function(e){return new xm(e)}),this.register(function(e){return new bm(e)}),this.register(function(e){return new mm(e)}),this.register(function(e){return new Tm(e)}),this.register(function(e){return new _m(e)}),this.register(function(e){return new Mm(e)}),this.register(function(e){return new Sm(e)}),this.register(function(e){return new dm(e)}),this.register(function(e){return new Rm(e)}),this.register(function(e){return new Cm(e)})}load(e,t,n,i){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const t=tc.extractUrlBase(e);s=tc.resolveURL(t,this.path)}else s=tc.extractUrlBase(e);this.manager.itemStart(e);const a=function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)},o=new Nu(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(n){try{r.parse(n,s,function(n){t(n),r.manager.itemEnd(e)},a)}catch(i){a(i)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const s={},a={},o=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer){if(o.decode(new Uint8Array(e,0,4))===Nm){try{s[hm.KHR_BINARY_GLTF]=new Lm(e)}catch(u){return void(i&&i(u))}r=JSON.parse(s[hm.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(e))}else r=e;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new af(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c<this.pluginCallbacks.length;c++){const e=this.pluginCallbacks[c](l);e.name,a[e.name]=e,s[e.name]=!0}if(r.extensionsUsed)for(let c=0;c<r.extensionsUsed.length;++c){const e=r.extensionsUsed[c],t=r.extensionsRequired||[];switch(e){case hm.KHR_MATERIALS_UNLIT:s[e]=new pm;break;case hm.KHR_DRACO_MESH_COMPRESSION:s[e]=new Dm(r,this.dracoLoader);break;case hm.KHR_TEXTURE_TRANSFORM:s[e]=new Om;break;case hm.KHR_MESH_QUANTIZATION:s[e]=new Um;break;default:t.indexOf(e)>=0&&a[e]}}l.setExtensions(s),l.setPlugins(a),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function cm(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const hm={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class dm{constructor(e){this.parser=e,this.name=hm.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let a;const o=new br(16777215);void 0!==s.color&&o.setRGB(s.color[0],s.color[1],s.color[2],jt);const l=void 0!==s.range?s.range:0;switch(s.type){case"directional":a=new Yu(o),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new Wu(o),a.distance=l;break;case"spot":a=new zu(o),a.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,a.angle=s.spot.outerConeAngle,a.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return a.position.set(0,0,0),Qm(a,s),void 0!==s.intensity&&(a.intensity=s.intensity),a.name=t.createUniqueName(s.name||"light_"+e),i=Promise.resolve(a),t.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then(function(e){return n._getNodeRef(t.cache,r,e)})}}class pm{constructor(){this.name=hm.KHR_MATERIALS_UNLIT}getMaterialType(){return wr}extendParams(e,t,n){const i=[];e.color=new br(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],jt),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,Ht))}return Promise.all(i)}}class mm{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class fm{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(t.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const e=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Sn(e,e)}return Promise.all(r)}}class gm{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class _m{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(t.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(n.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(t.iridescenceIOR=s.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(n.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class ym{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new br(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=i.extensions[this.name];if(void 0!==s.sheenColorFactor){const e=s.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],jt)}return void 0!==s.sheenRoughnessFactor&&(t.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",s.sheenColorTexture,Ht)),void 0!==s.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class vm{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(t.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class xm{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return t.attenuationColor=(new br).setRGB(a[0],a[1],a[2],jt),Promise.all(r)}}class bm{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class Tm{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return t.specularColor=(new br).setRGB(a[0],a[1],a[2],jt),void 0!==s.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",s.specularColorTexture,Ht)),Promise.all(r)}}class Sm{constructor(e){this.parser=e,this.name=hm.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return t.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(r)}}class Mm{constructor(e){this.parser=e,this.name=hm.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Kl:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.anisotropyStrength&&(t.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(t.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class wm{constructor(e){this.parser=e,this.name=hm.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=t.options.ktx2Loader;
vendor: 9,307 bytes, line 1
1if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,s)}}class Em{constructor(e){this.parser=e,this.name=hm.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const e=n.options.manager.getHandler(a.uri);null!==e&&(o=e)}return n.loadTextureImage(e,s.source,o)}}class Am{constructor(e){this.parser=e,this.name=hm.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const e=n.options.manager.getHandler(a.uri);null!==e&&(o=e)}return n.loadTextureImage(e,s.source,o)}}class Rm{constructor(e){this.name=hm.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(t){const n=e.byteOffset||0,i=e.byteLength||0,s=e.count,a=e.byteStride,o=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,a,o,e.mode,e.filter).then(function(e){return e.buffer}):r.ready.then(function(){const t=new ArrayBuffer(s*a);return r.decodeGltfBuffer(new Uint8Array(t),s,a,o,e.mode,e.filter),t})})}return null}}class Cm{constructor(e){this.name=hm.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const o of i.primitives)if(o.mode!==qm.TRIANGLES&&o.mode!==qm.TRIANGLE_STRIP&&o.mode!==qm.TRIANGLE_FAN&&void 0!==o.mode)return null;const r=n.extensions[this.name].attributes,s=[],a={};for(const o in r)s.push(this.parser.getDependency("accessor",r[o]).then(e=>(a[o]=e,a[o])));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then(e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const s of n){const e=new Ci,t=new wn,n=new Mn,o=new wn(1,1,1),l=new _a(s.geometry,s.material,i);for(let r=0;r<i;r++)a.TRANSLATION&&t.fromBufferAttribute(a.TRANSLATION,r),a.ROTATION&&n.fromBufferAttribute(a.ROTATION,r),a.SCALE&&o.fromBufferAttribute(a.SCALE,r),l.setMatrixAt(r,e.compose(t,n,o));for(const i in a)if("_COLOR_0"===i){const e=a[i];l.instanceColor=new ua(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==i&&"ROTATION"!==i&&"SCALE"!==i&&s.geometry.setAttribute(i,a[i]);nr.prototype.copy.call(l,s),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]}))}}const Nm="glTF",Pm=1313821514,Im=5130562;class Lm{constructor(e){this.name=hm.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Nm)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(e,12);let s=0;for(;s<i;){const t=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,i===Pm){const i=new Uint8Array(e,12+s,t);this.content=n.decode(i)}else if(i===Im){const n=12+s;this.body=e.slice(n,n+t)}s+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Dm{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=hm.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,a={},o={},l={};for(const u in s){const e=jm[u]||u.toLowerCase();a[e]=s[u]}for(const u in e.attributes){const t=jm[u]||u.toLowerCase();if(void 0!==s[u]){const i=n.accessors[e.attributes[u]],r=zm[i.componentType];l[t]=r.name,o[t]=!0===i.normalized}}return t.getDependency("bufferView",r).then(function(e){return new Promise(function(t,n){i.decodeDracoFile(e,function(e){for(const t in e.attributes){const n=e.attributes[t],i=o[t];void 0!==i&&(n.normalized=i)}t(e)},a,l,jt,n)})})}}class Om{constructor(){this.name=hm.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class Um{constructor(){this.name=hm.KHR_MESH_QUANTIZATION}}class Fm extends cu{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let s=0;s!==i;s++)t[s]=n[r+s];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=2*a,l=3*a,u=i-t,c=(n-t)/u,h=c*c,d=h*c,p=e*l,m=p-l,f=-2*d+3*h,g=d-h,_=1-f,y=g-h+c;for(let v=0;v!==a;v++){const e=s[m+v+a],t=s[m+v+o]*u,n=s[p+v+a],i=s[p+v]*u;r[v]=_*e+y*t+f*n+g*i}return r}}const Bm=new Mn;class Vm extends Fm{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return Bm.fromArray(r).normalize().toArray(r),r}}const qm={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},zm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},km={9728:Re,9729:Pe,9984:Ce,9985:Ie,9986:Ne,9987:Le},Gm={33071:Ee,33648:Ae,10497:we},Hm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jm={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Wm={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Xm={CUBICSPLINE:void 0,LINEAR:Ut,STEP:Ot},$m="OPAQUE",Ym="MASK",Km="BLEND";function Zm(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new Yl({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function Jm(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function Qm(e,t){void 0!==t.extras&&"object"==typeof t.extras&&Object.assign(e.userData,t.extras)}function ef(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}}}function tf(e){let t;const n=e.extensions&&e.extensions[hm.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+nf(n.attributes):e.indices+":"+nf(e.attributes)+":"+e.mode,void 0!==e.targets)for(let i=0,r=e.targets.length;i<r;i++)t+=":"+nf(e.targets[i]);return t}function nf(e){let t="";const n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function rf(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const sf=new Ci;class af{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new cm,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if("undefined"!=typeof navigator){const e=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);i=n&&t?parseInt(t[1],10):-1,r=e.indexOf("Firefox")>-1,s=r?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&s<98?this.textureLoader=new Lu(this.options.manager):this.textureLoader=new lc(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Nu(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()}
vendor: 6,521 bytes, line 1
1)).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){const s={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return Jm(r,s,i),Qm(s,i),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(s)})).then(function(){for(const e of s.scenes)e.updateMatrixWorld();e(s)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){const n=t[i].joints;for(let t=0,i=n.length;t<i;t++)e[n[t]].isBone=!0}for(let i=0,r=e.length;i<r;i++){const t=e[i];void 0!==t.mesh&&(this._addNodeRef(this.meshCache,t.mesh),void 0!==t.skin&&(n[t.mesh].isSkinnedMesh=!0)),void 0!==t.camera&&this._addNodeRef(this.cameraCache,t.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[i,s]of e.children.entries())r(s,t.children[i])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":i=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map(function(t,i){return n.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[hm.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(e,r){n.load(tc.resolveURL(t.uri,i.path),e,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){const n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=Hm[i.type],t=zm[i.componentType],n=!0===i.normalized,r=new t(i.count*e);return Promise.resolve(new Lr(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(e){const r=e[0],s=Hm[i.type],a=zm[i.componentType],o=a.BYTES_PER_ELEMENT,l=o*s,u=i.byteOffset||0,c=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,h=!0===i.normalized;let d,p;if(c&&c!==l){const e=Math.floor(u/c),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let l=t.cache.get(n);l||(d=new a(r,e*c,i.count*c/o),l=new Es(d,c/o),t.cache.add(n,l)),p=new Rs(l,s,u%c/o,h)}else d=null===r?new a(i.count*s):new a(r,u,i.count*s),p=new Lr(d,s,h);if(void 0!==i.sparse){const t=Hm.SCALAR,n=zm[i.sparse.indices.componentType],o=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,u=new n(e[1],o,i.sparse.count*t),c=new a(e[2],l,i.sparse.count*s);null!==r&&(p=new Lr(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,i=u.length;e<i;e++){const t=u[e];if(p.setX(t,c[e*s]),s>=2&&p.setY(t,c[e*s+1]),s>=3&&p.setZ(t,c[e*s+2]),s>=4&&p.setW(t,c[e*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=h}return p})}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let s=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(s=e)}return this.loadTextureImage(e,i,s)}loadTextureImage(e,t,n){const i=this,r=this.json,s=r.textures[e],a=r.images[t],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=s.name||a.name||"",""===t.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(t.name=a.uri);const n=(r.samplers||{})[s.sampler]||{};return t.magFilter=km[n.magFilter]||Pe,t.minFilter=km[n.minFilter]||Le,t.wrapS=Gm[n.wrapS]||we,t.wrapT=Gm[n.wrapT]||we,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==Re&&t.minFilter!==Pe,i.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){const n=this,i=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const s=i.images[e],a=self.URL||self.webkitURL;let o=s.uri||"",l=!1;if(void 0!==s.bufferView)o=n.getDependency("bufferView",s.bufferView).then(function(e){l=!0;const t=new Blob([e],{type:s.mimeType});return o=a.createObjectURL(t),o});else if(void 0===s.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(e){return new Promise(function(n,i){let s=n;!0===t.isImageBitmapLoader&&(s=function(e){const t=new Kn(e);t.needsUpdate=!0,n(t)}),t.load(tc.resolveURL(e,r.path),s,void 0,i)})}).then(function(e){var t;return!0===l&&a.revokeObjectURL(o),Qm(e,s),e.userData.mimeType=s.mimeType||((t=s.uri).search(/\.jpe?g($|\?)/i)>
vendor: 8,138 bytes, line 1
10||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw e});return this.sourceCache[e]=u,u}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[hm.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[hm.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=r.associations.get(s);s=r.extensions[hm.KHR_TEXTURE_TRANSFORM].extendTexture(s,e),r.associations.set(s,t)}}return void 0!==i&&(s.colorSpace=i),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,s=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new lo,Mr.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new $a,Mr.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||s){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),s&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),s&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Yl}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let s;const a={},o=[];if((r.extensions||{})[hm.KHR_MATERIALS_UNLIT]){const e=i[hm.KHR_MATERIALS_UNLIT];s=e.getMaterialType(),o.push(e.extendParams(a,r,t))}else{const n=r.pbrMetallicRoughness||{};if(a.color=new br(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;a.color.setRGB(e[0],e[1],e[2],jt),a.opacity=e[3]}void 0!==n.baseColorTexture&&o.push(t.assignTexture(a,"map",n.baseColorTexture,Ht)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(t.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),o.push(t.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),o.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)})))}!0===r.doubleSided&&(a.side=2);const l=r.alphaMode||$m;if(l===Km?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===Ym&&(a.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==wr&&(o.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new Sn(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;a.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&s!==wr&&(o.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(a.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==wr){const e=r.emissiveFactor;a.emissive=(new br).setRGB(e[0],e[1],e[2],jt)}return void 0!==r.emissiveTexture&&s!==wr&&o.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,Ht)),Promise.all(o).then(function(){const n=new s(a);return r.name&&(n.name=r.name),Qm(n,r),t.associations.set(n,{materials:e}),r.extensions&&Jm(i,n,r),n})}createUniqueName(e){const t=Lc.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[hm.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return of(n,e,t)})}const s=[];for(let a=0,o=e.length;a<o;a++){const n=e[a],o=tf(n),l=i[o];if(l)s.push(l.promise);else{let e;e=n.extensions&&n.extensions[hm.KHR_DRACO_MESH_COMPRESSION]?r(n):of(new jr,n,t),i[o]={primitive:n,promise:e},s.push(e)}}return Promise.all(s)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],s=r.primitives,a=[];for(let o=0,l=s.length;o<l;o++){const e=void 0===s[o].material?Zm(this.cache):this.getDependency("material",s[o].material);a.push(e)}return a.push(t.loadGeometries(s)),Promise.all(a).then(function(n){const a=n.slice(0,n.length-1),o=n[n.length-1],l=[];for(let c=0,h=o.length;c<h;c++){const n=o[c],u=s[c];let h;const d=a[c];if(u.mode===qm.TRIANGLES||u.mode===qm.TRIANGLE_STRIP||u.mode===qm.TRIANGLE_FAN||void 0===u.mode)h=!0===r.isSkinnedMesh?new ia(n,d):new is(n,d),!0===h.isSkinnedMesh&&h.normalizeSkinWeights(),u.mode===qm.TRIANGLE_STRIP?h.geometry=om(h.geometry,1):u.mode===qm.TRIANGLE_FAN&&(h.geometry=om(h.geometry,2));else if(u.mode===qm.LINES)h=new ao(n,d);else if(u.mode===qm.LINE_STRIP)h=new no(n,d);else if(u.mode===qm.LINE_LOOP)h=new oo(n,d);else{if(u.mode!==qm.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+u.mode);h=new mo(n,d)}Object.keys(h.geometry.morphAttributes).length>0&&ef(h,r),h.name=t.createUniqueName(r.name||"mesh_"+e),Qm(h,r),u.extensions&&Jm(i,h,u),t.assignFinalMaterial(h),l.push(h)}for(let i=0,r=l.length;i<r;i++)t.associations.set(l[i],{meshes:e,primitives:i});if(1===l.length)return r.extensions&&Jm(i,l[0],r),l[0];const u=new xs;r.extensions&&Jm(i,u,r),t.associations.set(u,{meshes:e});for(let e=0,t=l.length;e<t;e++)u.add(l[e]);return u})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new fs(Tn.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new Xu(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Qm(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(e){const t=e.pop(),n=e,i=[],r=[];for(let s=0,a=n.length;s<a;s++){const e=n[s];if(e){i.push(e);const n=new Ci;null!==t&&n.fromArray(t.array,16*s),r.push(n)}}return new la(i,r)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,s=[],a=[],o=[],l=[],u=[];for(let c=0,h=i.channels.length;c<h;c++){const e=i.channels[c],t=i.samplers[e.sampler],n=e.target,r=n.node,h=void 0!==i.parameters?i.parameters[t.input]:t.input,d=void 0!==i.parameters?i.parameters[t.output]:t.output;void 0!==n.node&&(s.push(this.getDependency("node",r)),a.push(this.getDependency("accessor",h)),o.push(this.getDependency("accessor",d)),l.push(t),u.push(n))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(u)]).then(function(e){const t=e[0],s=e[1],a=e[2],o=e[3],l=e[4],u=[];for(let i=0,r=t.length;i<r;i++){const e=t[i],r=s[i],c=a[i],h=o[i],d=l[i];if(void 0===e)continue;e.updateMatrix&&e.updateMatrix();const p=n._createAnimationTracks(e,r,c,h,d);if(p)for(let t=0;t<p.length;t++)u.push(p[t])}const c=new Tu(r,void 0,u);return Qm(c,i),c})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then(function(e){const t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})}loadNode(e){const t=this,n=this.json.nodes[e],i=t._loadNodeShallow(e),r=[],s=n.children||[];for(let o=0,l=s.length;o<l;o++)r.push(t.getDependency("node",s[o]));const a=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),a]).then(function(e){const t=e[0],n=e[1],i=e[2];null!==i&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(i,sf)});for(let r=0,s=n.length;r<s;r++)t.add(n[r]);return t})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];
vendor: 4,255 bytes, line 1
1const r=t.nodes[e],s=r.name?i.createUniqueName(r.name):"",a=[],o=i._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return o&&a.push(o),void 0!==r.camera&&a.push(i.getDependency("camera",r.camera).then(function(e){return i._getNodeRef(i.cameraCache,r.camera,e)})),i._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){a.push(e)}),this.nodeCache[e]=Promise.all(a).then(function(t){let a;if(a=!0===r.isBone?new ra:t.length>1?new xs:1===t.length?t[0]:new nr,a!==t[0])for(let e=0,n=t.length;e<n;e++)a.add(t[e]);if(r.name&&(a.userData.name=r.name,a.name=s),Qm(a,r),r.extensions&&Jm(n,a,r),void 0!==r.matrix){const e=new Ci;e.fromArray(r.matrix),a.applyMatrix4(e)}else void 0!==r.translation&&a.position.fromArray(r.translation),void 0!==r.rotation&&a.quaternion.fromArray(r.rotation),void 0!==r.scale&&a.scale.fromArray(r.scale);if(i.associations.has(a)){if(void 0!==r.mesh&&i.meshCache.refs[r.mesh]>1){const e=i.associations.get(a);i.associations.set(a,{...e})}}else i.associations.set(a,{});return i.associations.get(a).nodes=e,a}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new xs;n.name&&(r.name=i.createUniqueName(n.name)),Qm(r,n),n.extensions&&Jm(t,r,n);const s=n.nodes||[],a=[];for(let o=0,l=s.length;o<l;o++)a.push(i.getDependency("node",s[o]));return Promise.all(a).then(function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{const t=new Map;for(const[n,r]of i.associations)(n instanceof Mr||n instanceof Kn)&&t.set(n,r);return e.traverse(e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)}),t})(r),r})}_createAnimationTracks(e,t,n,i,r){const s=[],a=e.name?e.name:e.uuid,o=[];let l;switch(Wm[r.path]===Wm.weights?e.traverse(function(e){e.morphTargetInfluences&&o.push(e.name?e.name:e.uuid)}):o.push(a),Wm[r.path]){case Wm.weights:l=_u;break;case Wm.rotation:l=vu;break;case Wm.translation:case Wm.scale:l=bu;break;default:if(1===n.itemSize)l=_u;else l=bu}const u=void 0!==i.interpolation?Xm[i.interpolation]:Ut,c=this._getArrayFromAccessor(n);for(let h=0,d=o.length;h<d;h++){const e=new l(o[h]+"."+Wm[r.path],t.array,c,u);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(e),s.push(e)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=rf(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof vu?Vm:Fm)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function of(e,t,n){const i=t.attributes,r=[];function s(t,i){return n.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}for(const a in i){const t=jm[a]||a.toLowerCase();t in e.attributes||r.push(s(i[a],t))}if(void 0!==t.indices&&!e.index){const i=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});r.push(i)}return qn.workingColorSpace,Qm(e,t),function(e,t,n){const i=t.attributes,r=new ni;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],t=e.min,s=e.max;if(void 0===t||void 0===s)return;if(r.set(new wn(t[0],t[1],t[2]),new wn(s[0],s[1],s[2])),e.normalized){const t=rf(zm[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const s=t.targets;if(void 0!==s){const e=new wn,t=new wn;for(let i=0,r=s.length;i<r;i++){const r=s[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],s=i.min,a=i.max;if(void 0!==s&&void 0!==a){if(t.setX(Math.max(Math.abs(s[0]),Math.abs(a[0]))),t.setY(Math.max(Math.abs(s[1]),Math.abs(a[1]))),t.setZ(Math.max(Math.abs(s[2]),Math.abs(a[2]))),i.normalized){const e=rf(zm[i.componentType]);t.multiplyScalar(e)}e.max(t)}}}r.expandByVector(e)}e.boundingBox=r;const a=new xi;r.getCenter(a.center),a.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=a}(e,t,n),Promise.all(r).then(function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,s=!1;for(let u=0,c=t.length;u<c;u++){const e=t[u];if(void 0!==e.POSITION&&(i=!0),void 0!==e.NORMAL&&(r=!0),void 0!==e.COLOR_0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(e);const a=[],o=[],l=[];for(let u=0,c=t.length;u<c;u++){const c=t[u];
1if(i){const t=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;a.push(t)}if(r){const t=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal;o.push(t)}if(s){const t=void 0!==c.COLOR_0?n.getDependency("accessor",c.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(t){const n=t[0],a=t[1],o=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=a),s&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,t.targets,n):e})}const lf={type:"change"},uf={type:"start"},cf={type:"end"},hf=new Ri,df=new ba,pf=Math.cos(70*Tn.DEG2RAD),mf=new wn,ff=2*Math.PI,gf=-1,_f=0,yf=1,vf=2,xf=3,bf=4,Tf=5,Sf=6,Mf=1e-6;class wf extends vh{constructor(e,t=null){super(e,t),this.state=gf,this.target=new wn,this.cursor=new wn,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:q.ROTATE,MIDDLE:q.DOLLY,RIGHT:q.PAN},this.touches={ONE:z.ROTATE,TWO:z.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new wn,this._lastQuaternion=new Mn,this._lastTargetPosition=new wn,this._quat=(new Mn).setFromUnitVectors(e.up,new wn(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Gc,this._sphericalDelta=new Gc,this._scale=1,this._panOffset=new wn,this._rotateStart=new Sn,this._rotateEnd=new Sn,this._rotateDelta=new Sn,this._panStart=new Sn,this._panEnd=new Sn,this._panDelta=new Sn,this._dollyStart=new Sn,this._dollyEnd=new Sn,this._dollyDelta=new Sn,this._dollyDirection=new wn,this._mouse=new Sn,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Af.bind(this),this._onPointerDown=Ef.bind(this),this._onPointerUp=Rf.bind(this),this._onContextMenu=Of.bind(this),this._onMouseWheel=Pf.bind(this),this._onKeyDown=If.bind(this),this._onTouchStart=Lf.bind(this),this._onTouchMove=Df.bind(this),this._onMouseDown=Cf.bind(this),this._onMouseMove=Nf.bind(this),this._interceptControlDown=Uf.bind(this),this._interceptControlUp=Ff.bind(this),null!==this.domElement&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1});this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents();this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){null!==this._domElementKeyEvents&&(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(lf),this.update(),this.state=gf}update(e=null){const t=this.object.position;mf.copy(t).sub(this.target),mf.applyQuaternion(this._quat),this._spherical.setFromVector3(mf),this.autoRotate&&this.state===gf&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=ff:n>Math.PI&&(n-=ff),i<-Math.PI?i+=ff:i>Math.PI&&(i-=ff),this._spherical.theta=n<=i?Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radiu
vendor: 12,767 bytes, line 1
1s=this._clampDistance(this._spherical.radius);else{const e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=e!=this._spherical.radius}if(mf.setFromSpherical(this._spherical),mf.applyQuaternion(this._quatInverse),t.copy(this.target).add(mf),this.object.lookAt(this.target),!0===this.enableDamping?(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 e=null;if(this.object.isPerspectiveCamera){const t=mf.length();e=this._clampDistance(t*this._scale);const n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),r=!!n}else if(this.object.isOrthographicCamera){const t=new wn(this._mouse.x,this._mouse.y,0);t.unproject(this.object);const n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=n!==this.object.zoom;const i=new wn(this._mouse.x,this._mouse.y,0);i.unproject(this.object),this.object.position.sub(i).add(t),this.object.updateMatrixWorld(),e=mf.length()}else this.zoomToCursor=!1;null!==e&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(hf.origin.copy(this.object.position),hf.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(hf.direction))<pf?this.object.lookAt(this.target):(df.setFromNormalAndCoplanarPoint(this.object.up,this.target),hf.intersectPlane(df,this.target))))}else if(this.object.isOrthographicCamera){const e=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),e!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,!!(r||this._lastPosition.distanceToSquared(this.object.position)>Mf||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Mf||this._lastTargetPosition.distanceToSquared(this.target)>Mf)&&(this.dispatchEvent(lf),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0)}_getAutoRotationAngle(e){return null!==e?ff/60*this.autoRotateSpeed*e:ff/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(.01*e);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){mf.setFromMatrixColumn(t,0),mf.multiplyScalar(-e),this._panOffset.add(mf)}_panUp(e,t){!0===this.screenSpacePanning?mf.setFromMatrixColumn(t,1):(mf.setFromMatrixColumn(t,0),mf.crossVectors(this.object.up,mf)),mf.multiplyScalar(e),this._panOffset.add(mf)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;mf.copy(i).sub(this.target);let r=mf.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):this.enablePan=!1}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:this.enableZoom=!1}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:this.enableZoom=!1}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,r=t-n.top,s=n.width,a=n.height;this._mouse.x=i/s*2-1,this._mouse.y=-r/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(ff*this._rotateDelta.x/t.clientHeight),this._rotateUp(ff*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(ff*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(-ff*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(ff*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(-ff*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(1===this._pointers.length)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(1===this._pointers.length)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(1==this._pointers.length)this._rotateEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateEnd.set(n,i)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(ff*this._rotateDelta.x/t.clientHeight),this._rotateUp(ff*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(1===this._pointers.length)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const s=.5*(e.pageX+t.x),a=.5*(e.pageY+t.y);this._updateZoomParameters(s,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)return void this._pointers.splice(t,1)}_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];void 0===t&&(t=new Sn,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}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function Ef(e){!1!==this.enabled&&(0===this._pointers.length&&(this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),this._isTrackingPointer(e)||(this._addPointer(e),"touch"===e.pointerType?this._onTouchStart(e):this._onMouseDown(e)))}function Af(e){!1!==this.enabled&&("touch"===e.pointerType?this._onTouchMove(e):this._onMouseMove(e))}function Rf(e){switch(this._removePointer(e),this._pointers.length){case 0:this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(cf),this.state=gf;break;case 1:const t=this._pointers[0],n=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:n.x,pageY:n.y})}}function Cf(e){let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case q.DOLLY:if(!1===this.enableZoom)return;this._handleMouseDownDolly(e),this.state=yf;break;case q.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===this.enablePan)return;this._handleMouseDownPan(e),this.state=vf}else{if(!1===this.enableRotate)return;this._handleMouseDownRotate(e),this.state=_f}break;case q.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===this.enableRotate)return;this._handleMouseDownRotate(e),this.state=_f}else{if(!1===this.enablePan)return;this._handleMouseDownPan(e),this.state=vf}break;default:this.state=gf}this.state!==gf&&this.dispatchEvent(uf)}function Nf(e){switch(this.state){case _f:if(!1===this.enableRotate)return;this._handleMouseMoveRotate(e);break;case yf:if(!1===this.enableZoom)return;this._handleMouseMoveDolly(e);break;case vf:if(!1===this.enablePan)return;this._handleMouseMovePan(e)}}function Pf(e){!1!==this.enabled&&!1!==this.enableZoom&&this.state===gf&&(e.preventDefault(),this.dispatchEvent(uf),this._handleMouseWheel(this._customWheelEvent(e)),this.dispatchEvent(cf))}function If(e){!1!==this.enabled&&this._handleKeyDown(e)}function Lf(e){switch(this._trackPointer(e),this._pointers.length){case 1:switch(this.touches.ONE){case z.ROTATE:if(!1===this.enableRotate)return;this._handleTouchStartRotate(e),this.state=xf;break;case z.PAN:if(!1===this.enablePan)return;this._handleTouchStartPan(e),this.state=bf;break;default:this.state=gf}break;case 2:switch(this.touches.TWO){case z.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this._handleTouchStartDollyPan(e),this.state=Tf;break;case z.DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this._handleTouchStartDollyRotate(e),this.state=Sf;break;default:this.state=gf}break;default:this.state=gf}this.state!==gf&&this.dispatchEvent(uf)}function Df(e){switch(this._trackPointer(e),this.state){case xf:if(!1===this.enableRotate)return;this._handleTouchMoveRotate(e),this.update();break;case bf:if(!1===this.enablePan)return;this._handleTouchMovePan(e),this.update();break;case Tf:if(!1===this.enableZoom&&!1===this.enablePan)return;this._handleTouchMoveDollyPan(e),this.update();break;case Sf:if(!1===this.enableZoom&&!1===this.enableRotate)return;this._handleTouchMoveDollyRotate(e),this.update();break;default:this.state=gf}}function Of(e){!1!==this.enabled&&e.preventDefault()}
vendor: 19,790 bytes, line 1
1function Uf(e){if("Control"===e.key){this._controlActive=!0;this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}}function Ff(e){if("Control"===e.key){this._controlActive=!1;this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0})}}const Bf=new wn,Vf=new Ci,qf=new Ci,zf=new wn,kf=new wn;class Gf{constructor(e={}){const t=this;let n,i,r,s;const a={objects:new WeakMap},o=void 0!==e.element?e.element:document.createElement("div");function l(e){e.isCSS2DObject&&(e.element.style.display="none");for(let t=0,n=e.children.length;t<n;t++)l(e.children[t])}function u(e,n,i){if(!1!==e.visible){if(e.isCSS2DObject){Bf.setFromMatrixPosition(e.matrixWorld),Bf.applyMatrix4(qf);const l=Bf.z>=-1&&Bf.z<=1&&!0===e.layers.test(i.layers),u=e.element;u.style.display=!0===l?"":"none",!0===l&&(e.onBeforeRender(t,n,i),u.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Bf.x*r+r)+"px,"+(-Bf.y*s+s)+"px)",u.parentNode!==o&&o.appendChild(u),e.onAfterRender(t,n,i));const h={distanceToCameraSquared:c(i,e)};a.objects.set(e,h)}for(let t=0,r=e.children.length;t<r;t++)u(e.children[t],n,i)}else l(e)}function c(e,t){return zf.setFromMatrixPosition(e.matrixWorld),kf.setFromMatrixPosition(t.matrixWorld),zf.distanceToSquared(kf)}o.style.overflow="hidden",this.domElement=o,this.getSize=function(){return{width:n,height:i}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),Vf.copy(t.matrixWorldInverse),qf.multiplyMatrices(t.projectionMatrix,Vf),u(e,e,t),function(e){const t=function(e){const t=[];return e.traverseVisible(function(e){e.isCSS2DObject&&t.push(e)}),t}(e).sort(function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return a.objects.get(e).distanceToCameraSquared-a.objects.get(t).distanceToCameraSquared}),n=t.length;for(let i=0,r=t.length;i<r;i++)t[i].element.style.zIndex=n-i}(e)},this.setSize=function(e,t){n=e,i=t,r=n/2,s=i/2,o.style.width=e+"px",o.style.height=t+"px"}}}function Hf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function jf(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function Wf(e,t,n){return t=Qf(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,eg()?Reflect.construct(t,[],Qf(e).constructor):t.apply(e,n))}function Xf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function $f(e,t){return e.get(jf(e,t))}function Yf(e,t,n){Xf(e,t),t.set(e,n)}function Kf(e,t,n){return e.set(jf(e,t),n),n}function Zf(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,rg(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jf(e,t,n){return(t=rg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qf(e){return(Qf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eg(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(eg=function(){return!!e})()}function tg(e,t){return(tg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ng(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(l=(i=s.call(n)).done)&&(o.push(i.value),o.length!==t);l=!0);}catch(c){u=!0,r=c}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return o}}(e,t)||sg(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ig(e){return function(e){if(Array.isArray(e))return Hf(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||sg(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rg(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function sg(e,t){if(e){if("string"==typeof e)return Hf(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hf(e,t):void 0}}var ag=function(e){e instanceof Array?e.forEach(ag):(e.map&&e.map.dispose(),e.dispose())},og=function(e){e.geometry&&e.geometry.dispose(),e.material&&ag(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(og)},lg=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),og(t)}};function ug(e,t,n){var i=(90-e)*Math.PI/180,r=(90-t)*Math.PI/180;return{x:n*Math.sin(i)*Math.cos(r),y:n*Math.cos(i),z:n*Math.sin(i)*Math.sin(r)}}function cg(e){return e*Math.PI/180}var hg=function(e){return 1-(n(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},dg=function(e){return Math.max(0,Math.min(1,hg(e)))},pg=function(e){return.5-n.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},mg=function(e,t,n,i){var r=Math.pow(2,e),s=Math.max(0,Math.min(r-1,Math.floor((n+180)*r/360))),a=(90-i)/180;return t&&(a=Math.max(0,Math.min(1,hg(a)))),[s,Math.floor(a*r)]},fg=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,a=[],o=Math.pow(2,e),l=360/o,u=180/o,c=void 0===r?o-1:r,h=void 0===s?o-1:s,d=n,p=Math.min(o-1,c);d<=p;d++)for(var m=i,f=Math.min(o-1,h);m<=f;m++){var g=m,_=u;if(t)g=0===m?m:pg(m/o)*o,_=180*((m+1===o?m+1:pg((m+1)/o)*o)-g)/o;var y=(d+.5)*l-180,v=90-(180*g/o+_/2),x=_;a.push({x:d,y:m,lng:y,lat:v,latLen:x})}return a},gg=new WeakMap,_g=new WeakMap,yg=new WeakMap,vg=new WeakMap,xg=new WeakMap,bg=new WeakMap,Tg=new WeakMap,Sg=new WeakMap,Mg=new WeakSet,wg=function(){function e(t){var n,i,r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=s.tileUrl,o=s.minLevel,l=void 0===o?0:o,u=s.maxLevel,c=void 0===u?17:u,h=s.mercatorProjection,d=void 0===h||h;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n=Wf(this,e),Xf(i=n,r=Mg),r.add(i),Yf(n,gg,void 0),Yf(n,_g,void 0),Yf(n,yg,void 0),Yf(n,vg,void 0),Yf(n,xg,{}),Yf(n,bg,void 0),Yf(n,Tg,void 0),Yf(n,Sg,void 0),Jf(n,"minLevel",void 0),Jf(n,"maxLevel",void 0),Jf(n,"thresholds",ig(new Array(30)).map(function(e,t){return 8/Math.pow(2,t)})),Jf(n,"curvatureResolution",5),Jf(n,"tileMargin",0),Jf(n,"clearTiles",function(){Object.values($f(xg,n)).forEach(function(e){e.forEach(function(e){e.obj&&(n.remove(e.obj),lg(e.obj),delete e.obj)})}),Kf(xg,n,{})}),Kf(gg,n,t),n.tileUrl=a,Kf(_g,n,d),n.minLevel=l,n.maxLevel=c,n.level=0,n.add(Kf(Sg,n,new is(new Vl(.99*$f(gg,n),180,90),new wr({color:0})))),$f(Sg,n).visible=!1,$f(Sg,n).material.polygonOffset=!0,$f(Sg,n).material.polygonOffsetUnits=3,$f(Sg,n).material.polygonOffsetFactor=1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&tg(e,t)}(e,xs),Zf(e,[{key:"tileUrl",get:function(){return $f(yg,this)},set:function(e){Kf(yg,this,e),this.updatePov($f(Tg,this))}},{key:"level",get:function(){return $f(vg,this)},set:function(e){var t,n=this;$f(xg,this)[e]||jf(Mg,this,Eg).call(this,e);var i=$f(vg,this);if(Kf(vg,this,e),e!==i&&void 0!==i){if($f(Sg,this).visible=e>0,$f(xg,this)[e].forEach(function(e){return e.obj&&(e.obj.material.depthWrite=!0)}),i<e&&(null===(t=$f(xg,this)[i])||void 0===t||t.forEach(function(e){return e.obj&&(e.obj.material.depthWrite=!1)})),i>e)for(var r=e+1;r<=i;r++)$f(xg,this)[r]&&$f(xg,this)[r].forEach(function(e){e.obj&&(n.remove(e.obj),lg(e.obj),delete e.obj)});jf(Mg,this,Ag).call(this)}}},{key:"updatePov",value:function(e){var t,n=this;if(e&&e instanceof hs&&(Kf(Tg,this,e),Kf(bg,this,function(i){if(!i.hullPnts){var r=360/Math.pow(2,n.level),s=i.lng,a=i.lat,o=i.latLen,l=s-r/2,u=s+r/2,c=a-o/2,h=a+o/2;i.hullPnts=[[a,s],[c,l],[h,l],[c,u],[h,u]].map(function(e){var t=ng(e,2);return ug(t[0],t[1],$f(gg,n))}).map(function(e){var t=e.x,n=e.y,i=e.z;return new wn(t,n,i)})}return t||(t=new wa,e.updateMatrix(),e.updateMatrixWorld(),t.setFromProjectionMatrix((new Ci).multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse))),i.hullPnts.some(function(e){return t.containsPoint(e.clone().applyMatrix4(n.matrixWorld))})}),this.tileUrl)){var i=(e.position.clone().distanceTo(this.getWorldPosition(new wn))-$f(gg,this))/$f(gg,this),r=this.thresholds.findIndex(function(e){return e&&e<=i});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,r<0?this.thresholds.length:r)),jf(Mg,this,Ag).call(this)}}}])}();function Eg(t){var n=this;if(t>7)$f(xg,this)[t]=[];else{var i=$f(xg,this)[t]=fg(t,$f(_g,this));i.forEach(function(e){return e.centroid=ug(e.lat,e.lng,$f(gg,n))}),i.octree=e().x(function(e){return e.centroid.x}).y(function(e){return e.centroid.y}).z(function(e){return e.centroid.z}).addAll(i)}}function Ag(){var e=this;if(this.tileUrl&&void 0!==this.level&&$f(xg,this).hasOwnProperty(this.level)&&($f(bg,this)||!(this.level>6))){var n=$f(xg,this)[this.level];if($f(Tg,this)){var i=this.worldToLocal($f(Tg,this).position.clone());if(n.octree){var r,s=this.worldToLocal($f(Tg,this).position.clone()),a=3*(s.length()-$f(gg,this));n=(r=n.octree).findAllWithinRadius.apply(r,ig(s).concat([a]))}else{var o=function(e){var t=e.x,n=e.y,i=e.z,r=Math.sqrt(t*t+n*n+i*i),s=Math.acos(n/r),a=Math.atan2(i,t);return{lat:90-180*s/Math.PI,lng:90-180*a/Math.PI-(a<-Math.PI/2?360:0),r:r}}(i),l=90*(o.r/$f(gg,this)-1),u=l/Math.cos(cg(o.lat)),c=[o.lng-u,o.lng+u],h=[o.lat+l,o.lat-l],d=ng(mg(this.level,$f(_g,this),c[0],h[0]),2),p=d[0],m=d[1],f=ng(mg(this.level,$f(_g,this),c[1],h[1]),2),g=f[0],_=f[1];!n.record&&(n.record={});var y=n.record;if(y.hasOwnProperty("".concat(Math.round((p+g)/2),"_").concat(Math.round((m+_)/2)))){for(var v=[],x=p;x<=g;x++)for(var b=m;b<=_;b++){var T="".concat(x,"_").concat(b);y.hasOwnProperty(T)||(y[T]=fg(this.level,$f(_g,this),x,b,x,b)[0],n.push(y[T])),v.push(y[T])}n=v}else n=fg(this.level,$f(_g,this),p,m,g,_).map(function(e){var t="".concat(e.x,"_").concat(e.y);return y.hasOwnProperty(t)?y[t]:(y[t]=e,n.push(e),e)})}}n.filter(function(e){return!e.obj}).filter($f(bg,this)||function(){return!0}).forEach(function(n){var i=n.x,r=n.y,s=n.lng,a=n.lat,o=n.latLen,l=360/Math.pow(2,e.level);if(!n.obj){var u=l*(1-e.tileMargin),c=o*(1-e.tileMargin),h=cg(s),d=cg(-a),p=new is(new Vl($f(gg,e),Math.ceil(u/e.curvatureResolution),Math.ceil(c/e.curvatureResolution),cg(90-u/2)+h,cg(u),cg(90-c/2)+d,cg(c)),new eu);if($f(_g,e)){var m=ng([a+o/2,a-o/2].map(function(e){return.5-e/180}),2),f=m[0],g=m[1];!function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t().domain([1,0]).range([n,i]).clamp(!0),s=t().domain([dg(n),dg(i)]).range([1,0]).clamp(!0),a=function(e){return s(dg(r(e)))},o=e.array,l=0,u=o.length;l<u;l+=2)o[l+1]=a(o[l+1]);e.needsUpdate=!0}(p.geometry.attributes.uv,f,g)}n.obj=p}n.loading||(n.loading=!0,(new Lu).load(e.tileUrl(i,r,e.level),function(t){var i=n.obj;i&&(t.colorSpace=Ht,i.material.map=t,i.material.color=null,i.material.needsUpdate=!0,e.add(i)),n.loading=!1}))})}}function Rg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Cg(e,t,n){return t=Ng(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Pg()?Reflect.construct(t,[],Ng(e).constructor):t.apply(e,n))}function Ng(e){return(Ng=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Pg(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Pg=function(){return!!e})()}function Ig(e,t){return(Ig=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Lg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=s.call(n)).done)&&(o.push(i.value),o.length!==t);l=!0);}catch(c){u=!0,r=c}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return o}}(e,t)||Og(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dg(e){return function(e){if(Array.isArray(e))return Rg(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Og(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Og(e,t){if(e){if("string"==typeof e)return Rg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rg(e,t):void 0}}var Ug=function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=[],n=null;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(function(i){if(n){var o=180*r(i,n)/Math.PI;if(o>e)for(var l=s(n,i),u=n.length>2||i.length>2?a(n[2]||0,i[2]||0):null,c=u?function(e){return[].concat(Dg(l(e)),[u(e)])}:l,h=1/Math.ceil(o/e),d=h;d<1;)t.push(c(d)),d+=h}t.push(n=i)}),t},Fg="undefined"!=typeof window&&window.THREE?window.THREE:{BufferGeometry:jr,Float32BufferAttribute:Fr},Bg=(new Fg.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Vg=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Cg(this,e)).type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var a=({Point:c,MultiPoint:function(e,t){var n={vertices:[],indices:[]};return e.map(function(e){return c(e,t)}).forEach(function(e){var t=Lg(e,1)[0];qg(n,t)}),[n]},LineString:h,MultiLineString:function(e,t){var n={vertices:[],indices:[]};return e.map(function(e){return h(e,t)}).forEach(function(e){var t=Lg(e,1)[0];qg(n,t)}),[n]},Polygon:d,MultiPolygon:function(e,t){var n={vertices:[],indices:[]},i={vertices:[],indices:[]};e.map(function(e){return d(e,t)}).forEach(function(e){var t=Lg(e,2),r=t[0],s=t[1];qg(n,r),s&&qg(i,s)});var r=[n];return i.vertices.length&&r.push(i),r}}[t.type]||function(){return[]})(t.coordinates,r),o=[],l=[],u=0;function c(e,t){return[{vertices:kg(e[1],e[0],t+(e[2]||0)),indices:[]}]}function h(e,t){for(var n=Ug(e,s).map(function(e){var n=Lg(e,3),i=n[0],r=n[1],s=n[2];return kg(r,i,t+(void 0===s?0:s))}),r=i([n]).vertices,a=Math.round(r.length/3),o=[],l=1;l<a;l++)o.push(l-1,l);return[{vertices:r,indices:o}]}function d(e,t){for(var n=e.map(function(e){return Ug(e,s).map(function(e){var n=Lg(e,3),i=n[0],r=n[1],s=n[2];return kg(r,i,t+(void 0===s?0:s))})}),r=i(n),a=r.vertices,o=r.holes,l=o[0]||1/0,u=a.slice(0,3*l),c=a.slice(3*l),h=new Set(o),d=Math.round(a.length/3),p=[],m=[],f=1;f<d;f++)h.has(f)||(f<l?p.push(f-1,f):m.push(f-1-l,f-l));var g=[{indices:p,vertices:u}];return o.length&&g.push({indices:m,vertices:c}),g}return a.forEach(function(e){var t=o.length;qg({indices:o,vertices:l},e),n.addGroup(t,o.length-t,u++)}),o.length&&n.setIndex(o),l.length&&n[Bg]("position",new Fg.Float32BufferAttribute(l,3)),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ig(e,t)}(e,Fg.BufferGeometry),t=e,Object.defineProperty(t,"prototype",{writable:!1}),t;var t}();function qg(e,t){var n=Math.round(e.vertices.length/3);zg(e.vertices,t.vertices),zg(e.indices,t.indices.map(function(e){return e+n}))}function zg(e,t){var n,i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Og(e))||t){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw s}}}}(t);try{for(i.s();!(n=i.n()).done;){var r=n.value;e.push(r)}}catch(s){i.e(s)}finally{i.f()}}function kg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=(90-e)*Math.PI/180,r=(90-t)*Math.PI/180;return[n*Math.sin(i)*Math.cos(r),n*Math.cos(i),n*Math.sin(i)*Math.sin(r)]}function Gg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Hg(e,t,n){return t=jg(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Wg()?Reflect.construct(t,[],jg(e).constructor):t.apply(e,n))}function jg(e){return(jg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Wg(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Wg=function(){return!!e})()}function Xg(e,t){return(Xg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function $g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(l=(i=s.call(n)).done)&&(o.push(i.value),o.length!==t);l=!0);}catch(c){u=!0,r=c}
vendor: 8,043 bytes, line 1
1finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return o}}(e,t)||Kg(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yg(e){return function(e){if(Array.isArray(e))return Gg(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Kg(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kg(e,t){if(e){if("string"==typeof e)return Gg(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gg(e,t):void 0}}function Zg(e){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).resolution,a=void 0===n?1/0:n,p=function(e,t){return e.map(function(e){var n,i=[];return e.forEach(function(e){if(n){var a=180*r(e,n)/Math.PI;if(a>t)for(var o=s(n,e),l=1/Math.ceil(a/t),u=l;u<1;)i.push(o(u)),u+=l}i.push(n=e)}),i})}(e,a),m=o(p),g=function(e,t){var n={type:"Polygon",coordinates:e},i=l(n),r=$g(i,2),s=$g(r[0],2),a=s[0],o=s[1],u=$g(r[1],2),c=u[0],h=u[1];if(Math.min(Math.abs(c-a),Math.abs(h-o))<t)return[];var d=a>c||h>=89||o<=-89;return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minLng,i=t.maxLng,r=t.minLat,s=t.maxLat,a=Math.round(Math.pow(360/e,2)/Math.PI),o=(1+Math.sqrt(5))/2,l=function(e){return e/o*360%360-180},u=function(e){return Math.acos(2*e/a-1)/Math.PI*180-90},c=function(e){return a*(Math.cos((e+90)*Math.PI/180)+1)/2},h=[void 0!==s?Math.ceil(c(s)):0,void 0!==r?Math.floor(c(r)):a-1],d=void 0===n&&void 0===i?function(){return!0}:void 0===n?function(e){return e<=i}:void 0===i?function(e){return e>=n}:i>=n?function(e){return e>=n&&e<=i}:function(e){return e>=n||e<=i},p=[],m=h[0];m<=h[1];m++){var f=l(m);d(f)&&p.push([f,u(m)])}return p}(t,{minLng:a,maxLng:c,minLat:o,maxLat:h}).filter(function(e){return Jg(e,n,d)})}(e,a),_=[].concat(Yg(m),Yg(g)),y={type:"Polygon",coordinates:e},v=$g(l(y),2),x=$g(v[0],2),b=x[0],T=x[1],S=$g(v[1],2),M=S[0],w=S[1],E=b>M||w>=89||T<=-89,A=[];if(E){var R=u(_).triangles(),C=new Map(_.map(function(e,t){var n=$g(e,2),i=n[0],r=n[1];return["".concat(i,"-").concat(r),t]}));R.features.forEach(function(e){var t,n=e.geometry.coordinates[0].slice(0,3).reverse(),i=[];if(n.forEach(function(e){var t=$g(e,2),n=t[0],r=t[1],s="".concat(n,"-").concat(r);C.has(s)&&i.push(C.get(s))}),3===i.length){if(i.some(function(e){return e<m.length}))if(!Jg(e.properties.circumcenter,y,E))return;(t=A).push.apply(t,i)}})}else if(g.length)for(var N=h.from(_),P=function(e){var t,n=[2,1,0].map(function(t){return N.triangles[e+t]}),i=n.map(function(e){return _[e]});if(n.some(function(e){return e<m.length})&&!Jg([0,1].map(function(e){return f(i,function(t){return t[e]})}),y,E))return 1;(t=A).push.apply(t,Yg(n))},I=0,L=N.triangles.length;I<L;I+=3)P(I);else{var D=i(p),O=D.vertices,U=D.holes;A=c(O,void 0===U?[]:U,2)}var F=t(d(_,function(e){return e[0]}),[0,1]),B=t(d(_,function(e){return e[1]}),[0,1]),V=_.map(function(e){var t=$g(e,2),n=t[0],i=t[1];return[F(n),B(i)]});return{contour:p,triangles:{points:_,indices:A,uvs:V}}}function Jg(e,t){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?p(t,e):m(e,t)}var Qg=window.THREE?window.THREE:{BufferGeometry:jr,Float32BufferAttribute:Fr},e_=(new Qg.BufferGeometry).setAttribute?"setAttribute":"addAttribute",t_=function(){function e(t,n,r,s,a,l,u){var c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(c=Hg(this,e)).type="ConicPolygonGeometry",c.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:a,includeSides:l,curvatureResolution:u},n=n||0,r=r||1,s=void 0===s||s,a=void 0===a||a,l=void 0===l||l;var h=Zg(t,{resolution:u=u||5}),d=h.contour,p=h.triangles,m=o(p.uvs),f=[],g=[],_=[],y=0,v=function(e){var t=Math.round(f.length/3),n=_.length;f=f.concat(e.vertices),g=g.concat(e.uvs),_=_.concat(t?e.indices.map(function(e){return e+t}):e.indices),c.addGroup(n,_.length-n,y++)};function x(e,t){var n="function"==typeof t?t:function(){return t},r=e.map(function(e){return e.map(function(e){var t=$g(e,2),i=t[0],r=t[1];return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=(90-e)*Math.PI/180,r=(90-t)*Math.PI/180;return[n*Math.sin(i)*Math.cos(r),n*Math.cos(i),n*Math.sin(i)*Math.sin(r)]}(r,i,n(i,r))})});return i(r)}function b(e){return{indices:!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?p.indices:p.indices.slice().reverse(),vertices:x([p.points],e).vertices,uvs:m}}return l&&v(function(){for(var e=x(d,n),t=e.vertices,i=e.holes,s=x(d,r).vertices,a=o([s,t]),l=Math.round(s.length/3),u=new Set(i),c=0,h=[],p=0;p<l;p++){var m=p+1;if(m===l)m=c;else if(u.has(m)){var f=m;m=c,c=f}h.push(p,p+l,m+l),h.push(m+l,m,p)}for(var g=[],_=1;_>=0;_--)for(var y=0;y<l;y+=1)g.push(y/(l-1),_);return{indices:h,vertices:a,uvs:g}}()),s&&v(b(n,!1)),a&&v(b(r,!0)),c.setIndex(_),c[e_]("position",new Qg.Float32BufferAttribute(f,3)),c[e_]("uv",new Qg.Float32BufferAttribute(g,2)),c.computeVertexNormals(),c}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Xg(e,t)}(e,Qg.BufferGeometry),t=e,Object.defineProperty(t,"prototype",{writable:!1}),t;var t}();const n_=["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"],i_=new WeakMap;class r_{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=!0===e.object.isSkinnedMesh,this.refreshUniforms=n_,this.renderId=0}firstInitialization(e){return!1===this.renderObjects.has(e)&&(this.getRenderObjectData(e),!0)}needsVelocity(e){const t=e.getMRT();return null!==t&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(void 0===t){const{geometry:n,material:i,object:r}=e;if(t={material:this.getMaterialData(i),geometry:{id:n.id,attributes:this.getAttributesData(n.attributes),indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),null!==e.bundle&&(t.version=e.bundle.version),t.material.transmission>0){const{width:n,height:i}=e.context;t.bufferWidth=n,t.bufferHeight=i}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const n in e){const i=e[n];t[n]={version:i.version}}return t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return null!==e.renderer.overrideNodes.modelViewMatrix||null!==e.renderer.overrideNodes.modelNormalViewMatrix}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const i=e[n];null!=i&&("object"==typeof i&&void 0!==i.clone?!0===i.isTexture?t[
vendor: 1,511 bytes, line 1
1n]={id:i.id,version:i.version}:t[n]=i.clone():t[n]=i)}return t}equals(e,t){const{object:n,material:i,geometry:r}=e,s=this.getRenderObjectData(e);if(!0!==s.worldMatrix.equals(n.matrixWorld))return s.worldMatrix.copy(n.matrixWorld),!1;const a=s.material;for(const f in a){const e=a[f],t=i[f];if(void 0!==e.equals){if(!1===e.equals(t))return e.copy(t),!1}else if(!0===t.isTexture){if(e.id!==t.id||e.version!==t.version)return e.id=t.id,e.version=t.version,!1}else if(e!==t)return a[f]=t,!1}if(a.transmission>0){const{width:t,height:n}=e.context;if(s.bufferWidth!==t||s.bufferHeight!==n)return s.bufferWidth=t,s.bufferHeight=n,!1}const o=s.geometry,l=r.attributes,u=o.attributes,c=Object.keys(u),h=Object.keys(l);if(o.id!==r.id)return o.id=r.id,!1;if(c.length!==h.length)return s.geometry.attributes=this.getAttributesData(l),!1;for(const f of c){const e=u[f],t=l[f];if(void 0===t)return delete u[f],!1;if(e.version!==t.version)return e.version=t.version,!1}const d=r.index,p=o.indexVersion,m=d?d.version:null;if(p!==m)return o.indexVersion=m,!1;if(o.drawRange.start!==r.drawRange.start||o.drawRange.count!==r.drawRange.count)return o.drawRange.start=r.drawRange.start,o.drawRange.count=r.drawRange.count,!1;if(s.morphTargetInfluences){let e=!1;for(let t=0;t<s.morphTargetInfluences.length;t++)s.morphTargetInfluences[t]!==n.morphTargetInfluences[t]&&(e=!0);if(e)return!0}if(s.lights)for(let f=0;f<t.length;f++)if(s.lights[f].map!==t[f].map)return!1;return s.center&&!1===s.center.equals(n.center)?(s.center.copy(n.
1center),!0):(null!==e.bundle&&(s.version=e.bundle.version),!0)}getLightsData(e){const t=[];for(const n of e)!0===n.isSpotLight&&null!==n.map&&t.push({map:n.map.version});return t}getLights(e,t){if(i_.has(e)){const n=i_.get(e);if(n.renderId===t)return n.lightsData}const n=this.getLightsData(e.getLights());return i_.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 i=!0===e.object.static,r=null!==e.bundle&&!0===e.bundle.static&&this.getRenderObjectData(e).version===e.bundle.version;if(i||r)return!1;const s=this.getLights(e.lightsNode,n);return!0!==this.equals(e,s)}}function s_(e,t=0){let n=3735928559^t,i=1103547991^t;if(e instanceof Array)for(let r,s=0;s<e.length;s++)r=e[s],n=Math.imul(n^r,2654435761),i=Math.imul(i^r,1597334677);else for(let r,s=0;s<e.length;s++)r=e.charCodeAt(s),n=Math.imul(n^r,2654435761),i=Math.imul(i^r,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&i)+(n>>>0)}const a_=e=>s_(e),o_=e=>s_(e),l_=(...e)=>s_(e);function u_(e,t=!1){const n=[];!0===e.isNode&&n.push(e.id);for(const{property:i,childNode:r}of c_(e))n.push(s_(i.slice(0,-4)),r.getCacheKey(t));return s_(n)}function*c_(e,t=!1){for(const n of Object.getOwnPropertyNames(e)){if(!0===n.startsWith("_"))continue;const i=e[n];if(!0===Array.isArray(i))for(let e=0;e<i.length;e++){const r=i[e];r&&(!0===r.isNode||t&&"function"==typeof r.toJSON)&&(yield{property:n,index:e,childNode:r})}else if(i&&!0===i.isNode)yield{property:n,childNode:i};else if(i&&Object.getPrototypeOf(i)===Object.prototype)for(const e in i){if(!0===e.startsWith("_"))continue;const r=i[e];r&&(!0===r.isNode||t&&"function"==typeof r.toJSON)&&(yield{property:n,index:e,childNode:r})}}}const h_=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),d_=new WeakMap;function p_(e){return h_.get(e)}function m_(e){if(/[iu]?vec\d/.test(e))return e.startsWith("ivec")?Int32Array:e.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(e))return Float32Array;if(/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function f_(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?9:/mat4/.test(e)?16:void 0}function g_(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?12:/mat4/.test(e)?16:void 0}function __(e){return/float|int|uint/.test(e)?4:/vec2/.test(e)?8:/vec3/.test(e)||/vec4/.test(e)?16:/mat2/.test(e)?8:/mat3/.test(e)?48:/mat4/.test(e)?64:void 0}function y_(e){if(null==e)return null;const t=typeof e;return!0===e.isNode?"node":"number"===t?"float":"boolean"===t?"bool":"string"===t?"string":"function"===t?"shader":!0===e.isVector2?"vec2":!0===e.isVector3?"vec3":!0===e.isVector4?"vec4":!0===e.isMatrix2?"mat2":!0===e.isMatrix3?"mat3":!0===e.isMatrix4?"mat4":!0===e.isColor?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function v_(e,...t){const n=e?e.slice(-4):void 0;return 1===t.length&&("vec2"===n?t=[t[0],t[0]]:"vec3"===n?t=[t[0],t[0],t[0]]:"vec4"===n&&(t=[t[0],t[0],t[0],t[0]])),"color"===e?new br(...t):"vec2"===n?new Sn(...t):"vec3"===n?new wn(...t):"vec4"===n?new Zn(...t):"mat2"===n?new Hc(...t):"mat3"===n?new Rn(...t):"mat4"===n?new Ci(...t):"bool"===e?t[0]||!1:"float"===e||"int"===e||"uint"===e?t[0]||0:"string"===e?t[0]||"":"ArrayBuffer"===e?T_(t[0]):null}function x_(e){let t=d_.get(e);return void 0===t&&(t={},d_.set(e,t)),t}function b_(e){let t="";const n=new Uint8Array(e);for(let i=0;i<n.length;i++)t+=String.fromCharCode(n[i]);return btoa(t)}function T_(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0)).buffer}const S_={VERTEX:"vertex",FRAGMENT:"fragment"},M_={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},w_={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},E_=["fragment","vertex"],A_=["setup","analyze","generate"],R_=[...E_,"compute"],C_=["x","y","z","w"],N_={analyze:"setup",generate:"analyze"};let P_=0;class I_ extends hn{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=M_.NONE,this.updateBeforeType=M_.NONE,this.updateAfterType=M_.NONE,this.uuid=Tn.generateUUID(),this.version=0,this.global=!1,this.parents=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:P_++})}set needsUpdate(e){!0===e&&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,M_.FRAME)}
vendor: 25,647 bytes, line 1
1onRenderUpdate(e){return this.onUpdate(e,M_.RENDER)}onObjectUpdate(e){return this.onUpdate(e,M_.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of c_(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return!0!==(e=e||this.version!==this._cacheKeyVersion)&&null!==this._cacheKey||(this._cacheKey=l_(u_(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}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 i of this.getChildren())t["node"+n++]=i;return t.outputNode||null}analyze(e,t=null){const n=e.increaseUsage(this);if(!0===this.parents){const n=e.getDataFromNode(this,"any");n.stages=n.stages||{},n.stages[e.shaderStage]=n.stages[e.shaderStage]||[],n.stages[e.shaderStage].push(t)}if(1===n){const t=e.getNodeProperties(this);for(const n of Object.values(t))n&&!0===n.isNode&&n.build(e,this)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&!0===n.isNode)return n.build(e,t)}updateBefore(){}updateAfter(){}update(){}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);const i=e.getDataFromNode(this);i.buildStages=i.buildStages||{},i.buildStages[e.buildStage]=!0;const r=N_[e.buildStage];if(r&&!0!==i.buildStages[r]){const t=e.getBuildStage();e.setBuildStage(r),this.build(e),e.setBuildStage(t)}e.addNode(this),e.addChain(this);let s=null;const a=e.getBuildStage();if("setup"===a){this.updateReference(e);const t=e.getNodeProperties(this);if(!0!==t.initialized){t.initialized=!0,t.outputNode=this.setup(e)||t.outputNode||null;for(const n of Object.values(t))if(n&&!0===n.isNode){if(!0===n.parents){const t=e.getNodeProperties(n);t.parents=t.parents||[],t.parents.push(this)}n.build(e)}}s=t.outputNode}else if("analyze"===a)this.analyze(e,t);else if("generate"===a){if(1===this.generate.length){const n=this.getNodeType(e),i=e.getDataFromNode(this);s=i.snippet,void 0===s?void 0===i.generated?(i.generated=!0,s=this.generate(e)||"",i.snippet=s):s="/* Recursion detected. */":void 0!==i.flowCodes&&void 0!==e.context.nodeBlock&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),s=e.format(s,n,t)}else s=this.generate(e,t)||"";""===s&&null!==t&&"void"!==t&&"OutputType"!==t&&(s=e.generateConst(t))}return e.removeChain(this),e.addSequentialNode(this),s}getSerializeChildren(){return c_(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:i,index:r,childNode:s}of t)void 0!==r?(void 0===n[i]&&(n[i]=Number.isInteger(r)?[]:{}),n[i][r]=s.toJSON(e.meta).uuid):n[i]=s.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(void 0!==e.inputNodes){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const i=[];for(const r of e.inputNodes[n])i.push(t[r]);this[n]=i}else if("object"==typeof e.inputNodes[n]){const i={};for(const r in e.inputNodes[n]){const s=e.inputNodes[n][r];i[r]=t[s]}this[n]=i}else{const i=e.inputNodes[n];this[n]=t[i]}}}toJSON(e){const{uuid:t,type:n}=this,i=void 0===e||"string"==typeof e;i&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(void 0===r&&(r={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},!0!==i&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta),i){const t=s(e.textures),n=s(e.images),i=s(e.nodes);t.length>0&&(r.textures=t),n.length>0&&(r.images=n),i.length>0&&(r.nodes=i)}return r}}class L_ extends I_{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)}generate(e){const t=this.indexNode.getNodeType(e);return`${this.node.build(e)}[ ${this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint")} ]`}}class D_ extends I_{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 i of this.convertTo.split("|"))null!==n&&e.getTypeLength(t)!==e.getTypeLength(i)||(n=i);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,i=this.getNodeType(e),r=n.build(e,i);return e.format(r,i,t)}}class O_ extends I_{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("generate"===e.getBuildStage()){const n=e.getVectorType(this.getNodeType(e,t)),i=e.getDataFromNode(this);if(void 0!==i.propertyName)return e.format(i.propertyName,n,t);if("void"!==n&&"void"!==t&&this.hasDependencies(e)){const r=super.build(e,n),s=e.getVarFromNode(this,null,n),a=e.getPropertyName(s);return e.addLineFlowCode(`${a} = ${r}`,this),i.snippet=r,i.propertyName=a,e.format(i.propertyName,n,t)}}return super.build(e,t)}}class U_ extends O_{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return null!==this.nodeType?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),i=e.getTypeLength(n),r=this.nodes,s=e.getComponentType(n),a=[];let o=0;for(const u of r){if(o>=i)break;let t,n=u.getNodeType(e),r=e.getTypeLength(n);o+r>i&&(r=i-o,n=e.getTypeFromLength(r)),o+=r,t=u.build(e,n);if(e.getComponentType(n)!==s){const i=e.getTypeFromLength(r,s);t=e.format(t,n,i)}a.push(t)}const l=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(l,n,t)}}const F_=C_.join("");class B_ extends I_{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(C_.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,i=e.getTypeLength(n.getNodeType(e));let r=null;if(i>1){let s=null;this.getVectorLength()>=i&&(s=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const a=n.build(e,s);r=this.components.length===i&&this.components===F_.slice(0,this.components.length)?e.format(a,s,t):e.format(`${a}.${this.components}`,this.getNodeType(e),t)}else r=n.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class V_ extends O_{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:i}=this,r=this.getNodeType(e),s=e.getComponentType(i.getNodeType(e)),a=e.getTypeFromLength(n.length,s),o=i.build(e,a),l=t.build(e,r),u=e.getTypeLength(r),c=[];for(let h=0;h<u;h++){const e=C_[h];e===n[0]?(c.push(o),h+=n.length-1):c.push(l+"."+e)}return`${e.getType(r)}( ${c.join(", ")} )`}}class q_ extends O_{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,i=this.getNodeType(e),r=n.build(e),s=e.getVarFromNode(this),a=e.getPropertyName(s);e.addLineFlowCode(a+" = "+r,this);const o=e.getTypeLength(i),l=[];let u=0;for(let c=0;c<o;c++){const e=C_[c];e===t[u]?(l.push("1.0 - "+a+"."+e),u++):l.push(a+"."+e)}return`${e.getType(i)}( ${l.join(", ")} )`}}class z_ extends I_{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return null===this.nodeType?y_(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=y_(this.value),e.nodeType=this.nodeType,"ArrayBuffer"===e.valueType&&(e.value=b_(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?v_(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){}}const k_=/float|u?int/;class G_ extends z_{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 k_.test(n)&&k_.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}}class H_ extends I_{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return(!this.structNode.isMemberNode||!1!==this.structNode.hasMember(e))&&"void"!==this.structNode.getMemberType(e,this.property)}getNodeType(e){return!1===this.hasMember(e)?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(!1===this.hasMember(e))return"float";const n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(!1===this.hasMember(e)){const t=this.getNodeType(e);return e.generateConst(t)}return this.structNode.build(e)+"."+this.property}}let j_=null;const W_=new Map;function X_(e,t){if(!W_.has(e)){if("function"!=typeof t)throw new Error(`THREE.TSL: Node element ${e} is not a function`);W_.set(e,t),"assign"!==e&&(I_.prototype[e]=function(...e){return this.isStackNode?this.add(t(...e)):t(this,...e)},I_.prototype[e+"Assign"]=function(...e){return this.isStackNode?this.assign(e[0],t(...e)):this.assign(t(this,...e))})}}const $_=e=>(e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"))(e).split("").sort().join("");I_.prototype.assign=function(...e){if(!0!==this.isStackNode)return null!==j_&&j_.assign(this,...e),this;{const t=W_.get("assign");return this.add(t(...e))}},I_.prototype.toVarIntent=function(){return this},I_.prototype.get=function(e){return new H_(this,e)};const Y_={};function K_(e,t,n){Y_[e]=Y_[t]=Y_[n]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new B_(this,e),this._cache[e]=t),t},set(t){this[e].assign(Ty(t))}};const i=e.toUpperCase(),r=t.toUpperCase(),s=n.toUpperCase();I_.prototype["set"+i]=I_.prototype["set"+r]=I_.prototype["set"+s]=function(t){const n=$_(e);return new V_(this,n,Ty(t))},I_.prototype["flip"+i]=I_.prototype["flip"+r]=I_.prototype["flip"+s]=function(){const t=$_(e);return new q_(this,t)}}const Z_=["x","y","z","w"],J_=["r","g","b","a"],Q_=["s","t","p","q"];for(let Yj=0;Yj<4;Yj++){let e=Z_[Yj],t=J_[Yj],n=Q_[Yj];K_(e,t,n);for(let i=0;i<4;i++){e=Z_[Yj]+Z_[i],t=J_[Yj]+J_[i],n=Q_[Yj]+Q_[i],K_(e,t,n);for(let r=0;r<4;r++){e=Z_[Yj]+Z_[i]+Z_[r],t=J_[Yj]+J_[i]+J_[r],n=Q_[Yj]+Q_[i]+Q_[r],K_(e,t,n);for(let s=0;s<4;s++)e=Z_[Yj]+Z_[i]+Z_[r]+Z_[s],t=J_[Yj]+J_[i]+J_[r]+J_[s],n=Q_[Yj]+Q_[i]+Q_[r]+Q_[s],K_(e,t,n)}}}for(let Yj=0;Yj<32;Yj++)Y_[Yj]={get(){this._cache=this._cache||{};let e=this._cache[Yj];return void 0===e&&(e=new L_(this,new G_(Yj,"uint")),this._cache[Yj]=e),e},set(e){this[Yj].assign(Ty(e))}};Object.defineProperties(I_.prototype,Y_);const ey=new WeakMap,ty=function(e,t=null){for(const n in e)e[n]=Ty(e[n],t);return e},ny=function(e,t=null){const n=e.length;for(let i=0;i<n;i++)e[i]=Ty(e[i],t);return e},iy=function(e,t=null,n=null,i=null){function r(e){return null!==i?(e=Ty(Object.assign(e,i)),!0===i.intent&&(e=e.toVarIntent())):e=Ty(e),e}let s,a,o,l=t;function u(t){let n;return n=l?/[a-z]/i.test(l)?l+"()":l:e.type,void 0!==a&&t.length<a?t.concat(new Array(a-t.length).fill(0)):void 0!==o&&t.length>o?t.slice(0,o):t}return null===t?s=(...t)=>r(new e(...wy(u(t)))):null!==n?(n=Ty(n),s=(...i)=>r(new e(t,...wy(u(i)),n))):s=(...n)=>r(new e(t,...wy(u(n)))),s.setParameterLength=(...e)=>(1===e.length?a=o=e[0]:2===e.length&&([a,o]=e),s),s.setName=e=>(l=e,s),s},ry=function(e,...t){return Ty(new e(...wy(t)))};class sy extends I_{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:n}=this,i=e.getNodeProperties(t),r=e.getClosestSubBuild(t.subBuilds)||"",s=r||"default";if(i[s])return i[s];const a=e.subBuildFn;e.subBuildFn=r;let o=null;if(t.layout){let i=ey.get(e.constructor);void 0===i&&(i=new WeakMap,ey.set(e.constructor,i));let r=i.get(t);void 0===r&&(r=Ty(e.buildFunctionNode(t)),i.set(t,r)),e.addInclude(r);const s=n?function(e){let t;My(e);t=e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)?[...e]:e[0];return t}(n):null;o=Ty(r.call(s))}else{const i=new Proxy(e,{get:(e,t,n)=>{let i;return i=Symbol.iterator===t?function*(){yield}:Reflect.get(e,t,n),i}}),r=n?function(e){let t=0;return My(e),new Proxy(e,{get:(n,i,r)=>{let s;if("length"===i)return s=e.length,s;if(Symbol.iterator===i)s=function*(){for(const t of e)yield Ty(t)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){const n=e[0];s=void 0===n[i]?n[t++]:Reflect.get(n,i,r)}else e[0]instanceof I_&&(s=void 0===e[i]?e[t++]:Reflect.get(e,i,r));else s=Reflect.get(n,i,r);s=Ty(s)}return s}})}(n):null,s=Array.isArray(n)?n.length>0:null!==n,a=t.jsFunc,l=s||a.length>1?a(r,i):a(i);o=Ty(l)}return e.subBuildFn=a,t.once&&(i[s]=o),o}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 i=e.getBuildStage(),r=e.getNodeProperties(this),s=e.getSubBuildOutput(this),a=this.getOutputNode(e);if("setup"===i){const t=e.getSubBuildProperty("initialized",this);if(!0!==r[t]&&(r[t]=!0,r[s]=this.getOutputNode(e),r[s].build(e),this.shaderNode.subBuilds))for(const n of e.chaining){const t=e.getDataFromNode(n,"any");t.subBuilds=t.subBuilds||new Set;for(const e of this.shaderNode.subBuilds)t.subBuilds.add(e)}n=r[s]}else"analyze"===i?a.build(e,t):"generate"===i&&(n=a.build(e,t)||"");return n}}class ay extends I_{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return Ty(new sy(this,e))}setup(){return this.call()}}const oy=[!1,!0],ly=[0,1,2,3],uy=[-1,-2],cy=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],hy=new Map;for(const Yj of oy)hy.set(Yj,new G_(Yj));const dy=new Map;for(const Yj of ly)dy.set(Yj,new G_(Yj,"uint"));const py=new Map([...dy].map(e=>new G_(e.value,"int")));for(const Yj of uy)py.set(Yj,new G_(Yj,"int"));const my=new Map([...py].map(e=>new G_(e.value)));for(const Yj of cy)my.set(Yj,new G_(Yj));for(const Yj of cy)my.set(-Yj,new G_(-Yj));const fy={bool:hy,uint:dy,ints:py,float:my},gy=new Map([...hy,...my]),_y=(e,t)=>gy.has(e)?gy.get(e):!0===e.isNode?e:new G_(e,t),yy=function(e,t=null){return(...n)=>{for(const t of n)if(void 0===t)return Ty(new G_(0,e));if((0===n.length||!["bool","float","int","uint"].includes(e)&&n.every(e=>{const t=typeof e;return"object"!==t&&"function"!==t}))&&(n=[v_(e,...n)]),1===n.length&&null!==t&&t.has(n[0]))return Sy(t.get(n[0]));if(1===n.length){const t=_y(n[0],e);return t.nodeType===e?Sy(t):Sy(new D_(t,e))}const i=n.map(e=>_y(e));return Sy(new U_(i,e))}},vy=e=>"object"==typeof e&&null!==e?e.value:e,xy=e=>null!=e?e.nodeType||e.convertTo||("string"==typeof e?e:null):null;function by(e,t){return new ay(e,t)}const Ty=(e,t=null)=>function(e,t=null){const n=y_(e);return"node"===n?e:null===t&&("float"===n||"boolean"===n)||n&&"shader"!==n&&"string"!==n?Ty(_y(e,t)):"shader"===n?e.isFn?e:Py(e):e}(e,t),Sy=(e,t=null)=>Ty(e,t).toVarIntent(),My=(e,t=null)=>new ty(e,t),wy=(e,t=null)=>new ny(e,t),Ey=(e,t=null,n=null,i=null)=>new iy(e,t,n,i),Ay=(e,...t)=>new ry(e,...t),Ry=(e,t=null,n=null,i={})=>new iy(e,t,n,{intent:!0,...i});let Cy=0;class Ny extends I_{constructor(e,t=null){super();let n=null;null!==t&&("object"==typeof t?n=t.return:("string"==typeof t&&(n=t),t=null)),this.shaderNode=new by(e,n),null!==t&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if("object"!=typeof e.inputs){const n={name:"fn"+Cy++,type:t,inputs:[]};for(const t in e)"return"!==t&&n.inputs.push({name:t,type:e[t]});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"void"===this.shaderNode.nodeType&&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 e.generateConst(t)}}function Py(e,t=null){const n=new Ny(e,t);return new Proxy(()=>{},{apply:(e,t,i)=>n.call(...i),get:(e,t,i)=>Reflect.get(n,t,i),set:(e,t,i,r)=>Reflect.set(n,t,i,r)})}const Iy=e=>{j_=e},Ly=()=>j_,Dy=(...e)=>j_.If(...e);function Oy(e){return j_&&j_.add(e),e}X_("toStack",Oy);const Uy=new yy("color"),Fy=new yy("float",fy.float),By=new yy("int",fy.ints),Vy=new yy("uint",fy.uint),qy=new yy("bool",fy.bool),zy=new yy("vec2"),ky=new yy("ivec2"),Gy=new yy("uvec2"),Hy=new yy("bvec2"),jy=new yy("vec3"),Wy=new yy("ivec3"),Xy=new yy("uvec3"),$y=new yy("bvec3"),Yy=new yy("vec4"),Ky=new yy("ivec4"),Zy=new yy("uvec4"),Jy=new yy("bvec4"),Qy=new yy("mat2"),ev=new yy("mat3"),tv=new yy("mat4");X_("toColor",Uy),X_("toFloat",Fy),X_("toInt",By),X_("toUint",Vy),X_("toBool",qy),X_("toVec2",zy),X_("toIVec2",ky),X_("toUVec2",Gy),X_("toBVec2",Hy),X_("toVec3",jy),X_("toIVec3",Wy),X_("toUVec3",Xy),X_("toBVec3",$y),X_("toVec4",Yy),X_("toIVec4",Ky),X_("toUVec4",Zy),X_("toBVec4",Jy),X_("toMat2",Qy),X_("toMat3",ev),X_("toMat4",tv);const nv=Ey(L_).setParameterLength(2),iv=(e,t)=>Ty(new D_(Ty(e),t));X_("element",nv),X_("convert",iv);X_("append",e=>Oy(e));class rv extends I_{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}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return!0===this.varying?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const sv=(e,t)=>Ty(new rv(e,t)),av=(e,t)=>Ty(new rv(e,t,!0)),ov=Ay(rv,"vec4","DiffuseColor"),lv=Ay(rv,"vec3","EmissiveColor"),uv=Ay(rv,"float","Roughness"),cv=Ay(rv,"float","Metalness"),hv=Ay(rv,"float","Clearcoat"),dv=Ay(rv,"float","ClearcoatRoughness"),pv=Ay(rv,"vec3","Sheen"),mv=Ay(rv,"float","SheenRoughness"),fv=Ay(rv,"float","Iridescence"),gv=Ay(rv,"float","IridescenceIOR"),_v=Ay(rv,"float","IridescenceThickness"),yv=Ay(rv,"float","AlphaT"),vv=Ay(rv,"float","Anisotropy"),xv=Ay(rv,"vec3","AnisotropyT"),bv=Ay(rv,"vec3","AnisotropyB"),Tv=Ay(rv,"color","SpecularColor"),Sv=Ay(rv,"float","SpecularF90"),Mv=Ay(rv,"float","Shininess"),wv=Ay(rv,"vec4","Output"),Ev=Ay(rv,"float","dashSize"),Av=Ay(rv,"float","gapSize"),Rv=Ay(rv,"float","pointWidth"),Cv=Ay(rv,"float","IOR"),Nv=Ay(rv,"float","Transmission"),Pv=Ay(rv,"float","Thickness"),Iv=Ay(rv,"float","AttenuationDistance"),Lv=Ay(rv,"color","AttenuationColor"),Dv=Ay(rv,"float","Dispersion");class Ov extends I_{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 Uv=e=>new Ov(e),Fv=(e,t=0)=>new Ov(e,!0,t),Bv=Fv("frame"),Vv=Fv("render"),qv=Uv("object");class zv extends z_{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=qv}setName(e){return this.name=e,this}label(e){return this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(t=>{const n=e(t,this);void 0!==n&&(this.value=n)},t)}getInputType(e){let t=super.getInputType(e);return"bool"===t&&(t="uint"),t}generate(e,t){const n=this.getNodeType(e),i=this.getUniformHash(e);let r=e.getNodeFromHash(i);void 0===r&&(e.setHashNode(this,i),r=this);const s=r.getInputType(e),a=e.getUniformFromNode(r,s,e.shaderStage,this.name||e.context.nodeName),o=e.getPropertyName(a);void 0!==e.context.nodeName&&delete e.context.nodeName;let l=o;if("bool"===n){const t=e.getDataFromNode(this);let i=t.propertyName;if(void 0===i){const r=e.getVarFromNode(this,null,"bool");i=e.getPropertyName(r),t.propertyName=i,l=e.format(o,s,n),e.addLineFlowCode(`${i} = ${l}`,this)}l=i}return e.format(l,n,t)}}const kv=(e,t)=>{const n=xy(t||e);return n===e&&(e=v_(n)),e=e&&!0===e.isNode?e.node&&e.node.value||e.value:e,Ty(new zv(e,n))};class Gv extends O_{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 null===this.nodeType&&(this.nodeType=this.values[0].getNodeType(e)),this.nodeType}getElementType(e){return this.getNodeType(e)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const Hv=(...e)=>{let t;if(1===e.length){const n=e[0];t=new Gv(null,n.length,n)}else{const n=e[0],i=e[1];t=new Gv(n,i)}return Ty(t)};X_("toArray",(e,t)=>Hv(Array(t).fill(e)));class jv extends O_{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"void"!==t?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(!1===e.isAvailable("swizzleAssign")&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return C_.join("").slice(0,n)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:n}=this,i=t.getScope();e.getNodeProperties(i).assign=!0;const r=e.getNodeProperties(this);r.sourceNode=n,r.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:n,sourceNode:i}=e.getNodeProperties(this),r=this.needsSplitAssign(e),s=n.build(e),a=n.getNodeType(e),o=i.build(e,a),l=i.getNodeType(e),u=e.getDataFromNode(this);let c;if(!0===u.initialized)"void"!==t&&(c=s);else if(r){const i=e.getVarFromNode(this,null,a),r=e.getPropertyName(i);e.addLineFlowCode(`${r} = ${o}`,this);const l=n.node,u=l.node.context({assign:!0}).build(e);for(let t=0;t<l.components.length;t++){const n=l.components[t];e.addLineFlowCode(`${u}.${n} = ${r}[ ${t} ]`,this)}"void"!==t&&(c=s)}else c=`${s} = ${o}`,"void"!==t&&"void"!==l||(e.addLineFlowCode(c,this),"void"!==t&&(c=s));return u.initialized=!0,e.format(c,a,t)}}const Wv=Ey(jv).setParameterLength(2);X_("assign",Wv);class Xv extends O_{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,i=n.getInputs(e),r=this.parameters,s=(t,n)=>{const i=n.type;let r;return r="pointer"===i?"&"+t.build(e):t.build(e,i),r};if(Array.isArray(r)){if(r.length>i.length)r.length=i.length;else if(r.length<i.length)for(;r.length<i.length;)r.push(Fy(0));for(let e=0;e<r.length;e++)t.push(s(r[e],i[e]))}else for(const a of i){const e=r[a.name];void 0!==e?t.push(s(e,a)):t.push(s(Fy(0),a))}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const $v=(e,...t)=>(t=t.length>1||t[0]&&!0===t[0].isNode?wy(t):My(t[0]),Ty(new Xv(Ty(e),t)));X_("call",$v);const Yv={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class Kv extends O_{static get type(){return"OperatorNode"}constructor(e,t,n,...i){if(super(),i.length>0){let r=new Kv(e,t,n);for(let t=0;t<i.length-1;t++)r=new Kv(e,r,i[t]);t=r,n=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(Yv[this.op],t)}getNodeType(e,t=null){const n=this.op,i=this.aNode,r=this.bNode,s=i.getNodeType(e),a=r?r.getNodeType(e):null;if("void"===s||"void"===a)return t||"void";if("%"===n)return s;if("~"===n||"&"===n||"|"===n||"^"===n||">>"===n||"<<"===n)return e.getIntegerType(s);if("!"===n||"&&"===n||"||"===n||"^^"===n)return"bool";if("=="===n||"!="===n||"<"===n||">"===n||"<="===n||">="===n){const t=Math.max(e.getTypeLength(s),e.getTypeLength(a));return t>1?`bvec${t}`:"bool"}if(e.isMatrix(s)){if("float"===a)return s;if(e.isVector(a))return e.getVectorFromMatrix(s);if(e.isMatrix(a))return s}else if(e.isMatrix(a)){if("float"===s)return a;
vendor: 6,259 bytes, line 1
1if(e.isVector(s))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(s)?a:s}generate(e,t){const n=this.op,{aNode:i,bNode:r}=this,s=this.getNodeType(e,t);let a=null,o=null;"void"!==s?(a=i.getNodeType(e),o=r?r.getNodeType(e):null,"<"===n||">"===n||"<="===n||">="===n||"=="===n||"!="===n?e.isVector(a)?o=a:e.isVector(o)?a=o:a!==o&&(a=o="float"):">>"===n||"<<"===n?(a=s,o=e.changeComponentType(o,"uint")):"%"===n?(a=s,o=e.isInteger(a)&&e.isInteger(o)?o:a):e.isMatrix(a)?"float"===o?o="float":e.isVector(o)?o=e.getVectorFromMatrix(a):e.isMatrix(o)||(a=o=s):a=e.isMatrix(o)?"float"===a?"float":e.isVector(a)?e.getVectorFromMatrix(o):o=s:o=s):a=o=s;const l=i.build(e,a),u=r?r.build(e,o):null,c=e.getFunctionOperator(n);if("void"!==t){const i=e.renderer.coordinateSystem===ln;if("=="===n||"!="===n||"<"===n||">"===n||"<="===n||">="===n)return i&&e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${l}, ${u} )`,s,t):e.format(`( ${l} ${n} ${u} )`,s,t);if("%"===n)return e.isInteger(o)?e.format(`( ${l} % ${u} )`,s,t):e.format(`${this.getOperatorMethod(e,s)}( ${l}, ${u} )`,s,t);if("!"===n||"~"===n)return e.format(`(${n}${l})`,a,t);if(c)return e.format(`${c}( ${l}, ${u} )`,s,t);if(e.isMatrix(a)&&"float"===o)return e.format(`( ${u} ${n} ${l} )`,s,t);if("float"===a&&e.isMatrix(o))return e.format(`${l} ${n} ${u}`,s,t);{let r=`( ${l} ${n} ${u} )`;return!i&&"bool"===s&&e.isVector(a)&&e.isVector(o)&&(r=`all${r}`),e.format(r,s,t)}}if("void"!==a)return c?e.format(`${c}( ${l}, ${u} )`,s,t):e.isMatrix(a)&&"float"===o?e.format(`${u} ${n} ${l}`,s,t):e.format(`${l} ${n} ${u}`,s,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Zv=Ry(Kv,"+").setParameterLength(2,1/0).setName("add"),Jv=Ry(Kv,"-").setParameterLength(2,1/0).setName("sub"),Qv=Ry(Kv,"*").setParameterLength(2,1/0).setName("mul"),ex=Ry(Kv,"/").setParameterLength(2,1/0).setName("div"),tx=Ry(Kv,"%").setParameterLength(2).setName("mod"),nx=Ry(Kv,"==").setParameterLength(2).setName("equal"),ix=Ry(Kv,"!=").setParameterLength(2).setName("notEqual"),rx=Ry(Kv,"<").setParameterLength(2).setName("lessThan"),sx=Ry(Kv,">").setParameterLength(2).setName("greaterThan"),ax=Ry(Kv,"<=").setParameterLength(2).setName("lessThanEqual"),ox=Ry(Kv,">=").setParameterLength(2).setName("greaterThanEqual"),lx=Ry(Kv,"&&").setParameterLength(2,1/0).setName("and"),ux=Ry(Kv,"||").setParameterLength(2,1/0).setName("or"),cx=Ry(Kv,"!").setParameterLength(1).setName("not"),hx=Ry(Kv,"^^").setParameterLength(2).setName("xor"),dx=Ry(Kv,"&").setParameterLength(2).setName("bitAnd"),px=Ry(Kv,"~").setParameterLength(2).setName("bitNot"),mx=Ry(Kv,"|").setParameterLength(2).setName("bitOr"),fx=Ry(Kv,"^").setParameterLength(2).setName("bitXor"),gx=Ry(Kv,"<<").setParameterLength(2).setName("shiftLeft"),_x=Ry(Kv,">>").setParameterLength(2).setName("shiftRight"),yx=Py(([e])=>(e.addAssign(1),e)),vx=Py(([e])=>(e.subAssign(1),e)),xx=Py(([e])=>{const t=By(e).toConst();return e.addAssign(1),t}),bx=Py(([e])=>{const t=By(e).toConst();return e.subAssign(1),t});X_("add",Zv),X_("sub",Jv),X_("mul",Qv),X_("div",ex),X_("mod",tx),X_("equal",nx),X_("notEqual",ix),X_("lessThan",rx),X_("greaterThan",sx),X_("lessThanEqual",ax),X_("greaterThanEqual",ox),X_("and",lx),X_("or",ux),X_("not",cx),X_("xor",hx),X_("bitAnd",dx),X_("bitNot",px),X_("bitOr",mx),X_("bitXor",fx),X_("shiftLeft",gx),X_("shiftRight",_x),X_("incrementBefore",yx),X_("decrementBefore",vx),X_("increment",xx),X_("decrement",bx);const Tx=(e,t)=>tx(By(e),By(t));X_("modInt",Tx);class Sx extends O_{static get type(){return"MathNode"}constructor(e,t,n=null,i=null){if(super(),(e===Sx.MAX||e===Sx.MIN)&&arguments.length>3){let r=new Sx(e,t,n);for(let t=2;t<arguments.length-1;t++)r=new Sx(e,r,arguments[t]);t=r,n=arguments[arguments.length-1],i=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=i,this.isMathNode=!0}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(i)?0:e.getTypeLength(i);return r>s&&r>a?t:s>a?n:a>r?i:t}getNodeType(e){const t=this.method;return t===Sx.LENGTH||t===Sx.DISTANCE||t===Sx.DOT?"float":t===Sx.CROSS?"vec3":t===Sx.ALL||t===Sx.ANY?"bool":t===Sx.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:n,method:i}=this;let r=null;if(i===Sx.ONE_MINUS)r=Jv(1,t);else if(i===Sx.RECIPROCAL)r=ex(1,t);else if(i===Sx.DIFFERENCE)r=$x(Jv(t,n));else if(i===Sx.TRANSFORM_DIRECTION){let i=t,s=n;e.isMatrix(i.getNodeType(e))?s=Yy(jy(s),0):i=Yy(jy(i),0);const a=Qv(i,s).xyz;r=qx(a)}return null!==r?r:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let n=this.method;const i=this.getNodeType(e),r=this.getInputType(e),s=this.aNode,a=this.bNode,o=this.cNode,l=e.renderer.coordinateSystem;if(n===Sx.NEGATE)return e.format("( - "+s.build(e,r)+" )",i,t);{const u=[];return n===Sx.CROSS?u.push(s.build(e,i),a.build(e,i)):l===ln&&n===Sx.STEP?u.push(s.build(e,1===e.getTypeLength(s.getNodeType(e))?"float":r),a.build(e,r)):l!==ln||n!==Sx.MIN&&n!==Sx.MAX?n===Sx.REFRACT?u.push(s.build(e,r),a.build(e,r),o.build(e,"float")):n===Sx.MIX?u.push(s.build(e,r),a.build(e,r),o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":r)):(l===un&&n===Sx.ATAN&&null!==a&&(n="atan2"),"fragment"===e.shaderStage||n!==Sx.DFDX&&n!==Sx.DFDY||(n="/*"+n+"*/"),u.push(s.build(e,r)),null!==a&&u.push(a.build(e,r)),null!==o&&u.push(o.build(e,r))):u.push(s.build(e,r),a.build(e,1===e.getTypeLength(a.getNodeType(e))?"float":r)),e.format(`${e.getMethod(n,i)}( ${u.join(", ")} )`,i,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}Sx.ALL="all",Sx.ANY="any",Sx.RADIANS="radians",Sx.DEGREES="degrees",Sx.EXP="exp",Sx.EXP2="exp2",Sx.LOG="log",Sx.LOG2="log2",Sx.SQRT="sqrt",Sx.INVERSE_SQRT="inversesqrt",Sx.FLOOR="floor",Sx.CEIL="ceil",Sx.NORMALIZE="normalize",Sx.FRACT="fract",Sx.SIN="sin",Sx.COS="cos",Sx.TAN="tan",Sx.ASIN="asin",Sx.ACOS="acos",Sx.ATAN="atan",Sx.ABS="abs",Sx.SIGN="sign",Sx.LENGTH="length",Sx.NEGATE="negate",Sx.ONE_MINUS="oneMinus",Sx.DFDX="dFdx",Sx.DFDY="d
1Fdy",Sx.ROUND="round",Sx.RECIPROCAL="reciprocal",Sx.TRUNC="trunc",Sx.FWIDTH="fwidth",Sx.TRANSPOSE="transpose",Sx.DETERMINANT="determinant",Sx.INVERSE="inverse",Sx.EQUALS="equals",Sx.MIN="min",Sx.MAX="max",Sx.STEP="step",Sx.REFLECT="reflect",Sx.DISTANCE="distance",Sx.DIFFERENCE="difference",Sx.DOT="dot",Sx.CROSS="cross",Sx.POW="pow",Sx.TRANSFORM_DIRECTION="transformDirection",Sx.MIX="mix",Sx.CLAMP="clamp",Sx.REFRACT="refract",Sx.SMOOTHSTEP="smoothstep",Sx.FACEFORWARD="faceforward";const Mx=Fy(1e-6),wx=Fy(1e6),Ex=Fy(Math.PI),Ax=Fy(2*Math.PI),Rx=Ry(Sx,Sx.ALL).setParameterLength(1),Cx=Ry(Sx,Sx.ANY).setParameterLength(1),Nx=Ry(Sx,Sx.RADIANS).setParameterLength(1),Px=Ry(Sx,Sx.DEGREES).setParameterLength(1),Ix=Ry(Sx,Sx.EXP).setParameterLength(1),Lx=Ry(Sx,Sx.EXP2).setParameterLength(1),Dx=Ry(Sx,Sx.LOG).setParameterLength(1),Ox=Ry(Sx,Sx.LOG2).setParameterLength(1),Ux=Ry(Sx,Sx.SQRT).setParameterLength(1),Fx=Ry(Sx,Sx.INVERSE_SQRT).setParameterLength(1),Bx=Ry(Sx,Sx.FLOOR).setParameterLength(1),Vx=Ry(Sx,Sx.CEIL).setParameterLength(1),qx=Ry(Sx,Sx.NORMALIZE).setParameterLength(1),zx=Ry(Sx,Sx.FRACT).setParameterLength(1),kx=Ry(Sx,Sx.SIN).setParameterLength(1),Gx=Ry(Sx,Sx.COS).setParameterLength(1),Hx=Ry(Sx,Sx.TAN).setParameterLength(1),jx=Ry(Sx,Sx.ASIN).setParameterLength(1),Wx=Ry(Sx,Sx.ACOS).setParameterLength(1),Xx=Ry(Sx,Sx.ATAN).setParameterLength(1,2),$x=Ry(Sx,Sx.ABS).setParameterLength(1),Yx=Ry(Sx,Sx.SIGN).setParameterLength(1),Kx=Ry(Sx,Sx.LENGTH).setParameterLength(1),Zx=Ry(Sx,Sx.NEGATE).setParameterLength(1),Jx=Ry(Sx,Sx.ONE_MINUS).setParameterLength(1),Qx=Ry(Sx,Sx.DFDX).setParameterLength(1),eb=Ry(Sx,Sx.DFDY).setParameterLength(1),tb=Ry(Sx,Sx.ROUND).setParameterLength(1),nb=Ry(Sx,Sx.RECIPROCAL).setParameterLength(1),ib=Ry(Sx,Sx.TRUNC).setParameterLength(1),rb=Ry(Sx,Sx.FWIDTH).setParameterLength(1),sb=Ry(Sx,Sx.TRANSPOSE).setParameterLength(1),ab=Ry(Sx,Sx.DETERMINANT).setParameterLength(1),ob=Ry(Sx,Sx.INVERSE).setParameterLength(1),lb=(e,t)=>nx(e,t),ub=Ry(Sx,Sx.MIN).setParameterLength(2,1/0),cb=Ry(Sx,Sx.MAX).setParameterLength(2,1/0),hb=Ry(Sx,Sx.STEP).setParameterLength(2),db=Ry(Sx,Sx.REFLECT).setParameterLength(2),pb=Ry(Sx,Sx.DISTANCE).setParameterLength(2),mb=Ry(Sx,Sx.DIFFERENCE).setParameterLength(2),fb=Ry(Sx,Sx.DOT).setParameterLength(2),gb=Ry(Sx,Sx.CROSS).setParameterLength(2),_b=Ry(Sx,Sx.POW).setParameterLength(2),yb=e=>Qv(e,e),vb=e=>Qv(e,e,e),xb=e=>Qv(e,e,e,e),bb=Ry(Sx,Sx.TRANSFORM_DIRECTION).setParameterLength(2),Tb=e=>Qv(Yx(e),_b($x(e),1/3)),Sb=e=>fb(e,e),Mb=Ry(Sx,Sx.MIX).setParameterLength(3),wb=(e,t=0,n=1)=>Ty(new Sx(Sx.CLAMP,Ty(e),Ty(t),Ty(n))),Eb=e=>wb(e),Ab=Ry(Sx,Sx.REFRACT).setParameterLength(3),Rb=Ry(Sx,Sx.SMOOTHSTEP).setParameterLength(3),Cb=Ry(Sx,Sx.FACEFORWARD).setParameterLength(3),Nb=Py(([e])=>{const t=fb(e.xy,zy(12.9898,78.233)),n=tx(t,Ex);return zx(kx(n).mul(43758.5453))}),Pb=(e,t,n)=>Mb(t,n,e),Ib=(e,t,n)=>Rb(t,n,e),Lb=(e,t)=>hb(t,e),Db=(e,t)=>Xx(e,t),Ob=Cb,Ub=Fx;X_("all",Rx),X_("any",Cx),X_("equals",lb),X_("radians",Nx),X_("degrees",Px),X_("exp",Ix),X_("exp2",Lx),X_("log",Dx),X_("log2",Ox),X_("sqrt",Ux),X_("inverseSqrt",Fx),X_("floor",Bx),X_("ceil",Vx),X_("normalize",qx),X_("fract",zx),X_("sin",kx),X_("cos",Gx),X_("tan",Hx),X_("asin",jx),X_("acos",Wx),X_("atan",Xx),X_("abs",$x),X_("sign",Yx),X_("length",Kx),X_("lengthSq",Sb),X_("negate",Zx),X_("oneMinus",Jx),X_("dFdx",Qx),X_("dFdy",eb),X_("round",tb),X_("reciprocal",nb),X_("trunc",ib),X_("fwidth",rb),X_("atan2",Db),X_("min",ub),X_("max",cb),X_("step",Lb),X_("reflect",db),X_("distance",pb),X_("dot",fb),X_("cross",gb),X_("pow",_b),X_("pow2",yb),X_("pow3",vb),X_("pow4",xb),X_("transformDirection",bb),X_("mix",Pb),X_("clamp",wb),X_("refract",Ab),X_("smoothstep",Ib),X_("faceForward",Cb),X_("difference",mb),X_("saturate",Eb),X_("cbrt",Tb),X_("transpose",sb),X_("determinant",ab),X_("inverse",ob),X_("rand",Nb);class Fb extends I_{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(void 0===t)return e.flowBuildStage(this,"setup"),this.getNodeType(e);const i=t.getNodeType(e);if(null!==n){const t=n.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(i))return t}return i}
1setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),i=this.elseNode?this.elseNode.cache():null,r=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=r,null!==i&&(e.getDataFromNode(i).parentNodeBlock=r);const s=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=s?n:n.context({nodeBlock:n}),a.elseNode=i?s?i:i.context({nodeBlock:i}):null}generate(e,t){const n=this.getNodeType(e),i=e.getDataFromNode(this);if(void 0!==i.nodeProperty)return i.nodeProperty;const{condNode:r,ifNode:s,elseNode:a}=e.getNodeProperties(this),o=e.currentFunctionNode,l="void"!==t,u=l?sv(n).build(e):"";i.nodeProperty=u;const c=r.build(e,"bool");if(e.context.uniformFlow&&null!==a){const i=s.build(e,n),r=a.build(e,n),o=e.getTernary(c,i,r);return e.format(o,n,t)}e.addFlowCode(`\n${e.tab}if ( ${c} ) {\n\n`).addFlowTab();let h=s.build(e,n);if(h&&(l?h=u+" = "+h+";":(h="return "+h+";",null===o&&(h="// "+h))),e.removeFlowTab().addFlowCode(e.tab+"\t"+h+"\n\n"+e.tab+"}"),null!==a){e.addFlowCode(" else {\n\n").addFlowTab();let t=a.build(e,n);t&&(l?t=u+" = "+t+";":(t="return "+t+";",null===o&&(t="// "+t))),e.removeFlowTab().addFlowCode(e.tab+"\t"+t+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(u,n,t)}}const Bb=Ey(Fb).setParameterLength(2,3);X_("select",Bb);class Vb extends I_{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.getContext();e.setContext({...e.context,...this.value}),this.node.build(e),e.setContext(t)}setup(e){const t=e.getContext();e.setContext({...e.context,...this.value}),this.node.build(e),e.setContext(t)}generate(e,t){const n=e.getContext();e.setContext({...e.context,...this.value});const i=this.node.build(e,t);return e.setContext(n),i}}const qb=Ey(Vb).setParameterLength(1,2),zb=e=>qb(e,{uniformFlow:!0}),kb=(e,t)=>qb(e,{nodeName:t});function Gb(e,t){return kb(e,t)}X_("context",qb),X_("label",Gb),X_("uniformFlow",zb),X_("setName",kb);class Hb extends I_{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}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)}build(...e){if(!0===this.intent){if(!0!==e[0].getNodeProperties(this).assign)return this.node.build(...e)}return super.build(...e)}generate(e){const{node:t,name:n,readOnly:i}=this,{renderer:r}=e,s=!0===r.backend.isWebGPUBackend;let a=!1,o=!1;i&&(a=e.isDeterministic(t),o=s?i:a);const l=e.getVectorType(this.getNodeType(e)),u=t.build(e,l),c=e.getVarFromNode(this,n,l,void 0,o),h=e.getPropertyName(c);let d=h;if(o)if(s)d=a?`const ${h}`:`let ${h}`;else{const n=t.getArrayCount(e);d=`const ${e.getVar(c.type,h,n)}`}return e.addLineFlowCode(`${d} = ${u}`,this),h}}const jb=Ey(Hb),Wb=(e,t=null)=>jb(e,t).toStack(),Xb=(e,t=null)=>jb(e,t,!0).toStack(),$b=e=>null===Ly()?e:jb(e).setIntent(!0).toStack();X_("toVar",Wb),X_("toConst",Xb),X_("toVarIntent",$b);class Yb extends I_{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}getNodeType(e){if(null!==this.nodeType)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 Kb=(e,t,n=null)=>Ty(new Yb(Ty(e),t,n));class Zb extends I_{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,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(void 0===n){const i=this.name,r=this.getNodeType(e),s=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,i,r,s,a),t.node=Kb(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation="fragment"===e.shaderStage),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(S_.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(S_.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),i=this.setupVarying(e);if(void 0===n[t]){const r=this.getNodeType(e),s=e.getPropertyName(i,S_.VERTEX);e.flowNodeFromShaderStage(S_.VERTEX,n.node,r,s),n[t]=s}return e.getPropertyName(i)}}const Jb=Ey(Zb).setParameterLength(1,2),Qb=e=>Jb(e);X_("toVarying",Jb),X_("toVertexStage",Qb),X_("varying",(...e)=>Jb(...e)),X_("vertexStage",(...e)=>Jb(...e));const eT=Py(([e])=>{const t=e.mul(.9478672986).add(.0521327014).pow(2.4),n=e.mul(.0773993808),i=e.lessThanEqual(.04045);return Mb(t,n,i)}
vendor: 4,680 bytes, line 1
1).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),tT=Py(([e])=>{const t=e.pow(.41666).mul(1.055).sub(.055),n=e.mul(12.92),i=e.lessThanEqual(.0031308);return Mb(t,n,i)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),nT="WorkingColorSpace";class iT extends O_{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===nT?qn.workingColorSpace:"OutputColorSpace"===t?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),i=this.resolveColorSpace(e,this.target);let r=t;return!1!==qn.enabled&&n!==i&&n&&i?(qn.getTransfer(n)===Xt&&(r=Yy(eT(r.rgb),r.a)),qn.getPrimaries(n)!==qn.getPrimaries(i)&&(r=Yy(ev(qn._getMatrix(new Rn,n,i)).mul(r.rgb),r.a)),qn.getTransfer(i)===Xt&&(r=Yy(tT(r.rgb),r.a)),r):r}}const rT=(e,t)=>Ty(new iT(Ty(e),nT,t)),sT=(e,t)=>Ty(new iT(Ty(e),t,nT));X_("workingToColorSpace",rT),X_("colorSpaceToWorking",sT);let aT=class extends L_{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(),i=this.getNodeType();return e.format(t,n,i)}};class oT extends I_{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,i=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=i,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=M_.OBJECT}setGroup(e){return this.group=e,this}element(e){return Ty(new aT(this,Ty(e)))}setNodeType(e){const t=kv(null,e);null!==this.group&&t.setGroup(this.group),this.node=t}getNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let i=1;i<t.length;i++)n=n[t[i]];return n}updateReference(e){return this.reference=null!==this.object?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){null===this.node&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}class lT extends oT{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Vv)}updateReference(e){return this.reference=null!==this.renderer?this.renderer:e.renderer,this.reference}}const uT=(e,t,n=null)=>Ty(new lT(e,t,n));class cT extends O_{static get type(){return"ToneMappingNode"}constructor(e,t=dT,n=null){super("vec3"),this.toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return l_(this.toneMapping)}setup(e){const t=this.colorNode||e.context.color,n=this.toneMapping;if(0===n)return t;let i=null;const r=e.renderer.library.getToneMappingFunction(n);return i=null!==r?Yy(r(t.rgb,this.exposureNode),t.a):t,i}}const hT=(e,t,n)=>Ty(new cT(e,Ty(t),Ty(n))),dT=uT("toneMappingExposure","float");X_("toneMapping",(e,t,n)=>hT(t,n,e));class pT extends z_{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,i=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=i,this.usage=sn,this.instanced=!1,this.attribute=null,this.global=!0,e&&!0===e.isBufferAttribute&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(0===this.bufferStride&&0===this.bufferOffset){let t=e.globalCache.getData(this.value);return void 0===t&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return null===this.bufferType&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(null!==this.attribute)return;const t=this.getNodeType(e),n=this.value,i=e.getTypeLength(t),r=this.bufferStride||i,s=this.bufferOffset,a=!0===n.isInterleavedBuffer?n:new Es(n,r),o=new Rs(a,i,s);a.setUsage(this.usage),this.attribute=o,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),i=e.getPropertyName(n);let r=null;if("vertex"===e.shaderStage||"compute"===e.shaderStage)this.name=i,r=i;else{r=Jb(this).build(e,t)}return r}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&!0===this.attribute.isBufferAttribute&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}const mT=(e,t=null,n=0,i=0)=>Ty(new pT(e,t,n,i)),fT=(e,t=null,n=0,i=0)=>
vendor: 65,666 bytes, line 1
1mT(e,t,n,i).setUsage(an),gT=(e,t=null,n=0,i=0)=>mT(e,t,n,i).setInstanced(!0),_T=(e,t=null,n=0,i=0)=>fT(e,t,n,i).setInstanced(!0);X_("toAttribute",e=>mT(e.value));class yT extends I_{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=M_.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 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){e.getNodeProperties(this).outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:n}=e;if("compute"===n){const t=this.computeNode.build(e,"void");""!==t&&e.addLineFlowCode(t,this)}else{const n=e.getNodeProperties(this).outputComputeNode;if(n)return n.build(e,t)}}}const vT=(e,t=[64])=>{0===t.length||t.length;for(let n=0;n<t.length;n++){const e=t[n];"number"!=typeof e||e<=0||Number.isInteger(e)}for(;t.length<3;)t.push(1);return Ty(new yT(Ty(e),t))},xT=(e,t,n)=>vT(e,n).setCount(t);X_("compute",xT),X_("computeKernel",vT);class bT extends I_{static get type(){return"CacheNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isCacheNode=!0}getNodeType(e){const t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);const i=this.node.getNodeType(e);return e.setCache(t),i}build(e,...t){const n=e.getCache(),i=e.getCacheFromNode(this,this.parent);e.setCache(i);const r=this.node.build(e,...t);return e.setCache(n),r}}const TT=(e,t)=>Ty(new bT(Ty(e),t));X_("cache",TT);class ST extends I_{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 MT=Ey(ST).setParameterLength(2);X_("bypass",MT);class wT extends I_{static get type(){return"RemapNode"}constructor(e,t,n,i=Fy(0),r=Fy(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=i,this.outHighNode=r,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:n,outLowNode:i,outHighNode:r,doClamp:s}=this;let a=e.sub(t).div(n.sub(t));return!0===s&&(a=a.clamp()),a.mul(r.sub(i)).add(i)}}const ET=Ey(wT,null,null,{doClamp:!1}).setParameterLength(3,5),AT=Ey(wT).setParameterLength(3,5);X_("remap",ET),X_("remapClamp",AT);class RT extends I_{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const n=this.getNodeType(e),i=this.snippet;if("void"!==n)return e.format(i,n,t);e.addLineFlowCode(i,this)}}const CT=Ey(RT).setParameterLength(1,2),NT=e=>(e?Bb(e,CT("discard")):CT("discard")).toStack();X_("discard",NT);class PT extends O_{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setup({context:e}){let t=this.colorNode||e.color;const n=(null!==this.toneMapping?this.toneMapping:e.toneMapping)||0,i=(null!==this.outputColorSpace?this.outputColorSpace:e.outputColorSpace)||Gt;return 0!==n&&(t=t.toneMapping(n)),i!==Gt&&i!==qn.workingColorSpace&&(t=t.workingToColorSpace(i)),t}}const IT=(e,t=null,n=null)=>Ty(new PT(Ty(e),t,n));X_("renderOutput",IT);class LT extends O_{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),i="--- TSL debug - "+e.shaderStage+" shader ---",r="-".repeat(i.length);let s="";return s+="// #"+i+"#\n",s+=e.flow.code.replace(/^\t/gm,"")+"\n",s+="/* ... */ "+n+" /* ... */\n",s+="// #"+r+"#\n",null!==t&&t(e,s),n}}const DT=(e,t=null)=>Ty(new LT(Ty(e),t)).toStack();X_("debug",DT);class OT extends I_{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(null===t){const n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){const i=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(i)}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(!0===e.hasGeometryAttribute(t)){const i=e.geometry.getAttribute(t),r=e.getTypeFromAttribute(i),s=e.getAttribute(t,r);if("vertex"===e.shaderStage)return e.format(s.name,r,n);return Jb(this).build(e,n)}return 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 UT=(e,t=null)=>Ty(new OT(e,t)),FT=(e=0)=>UT("uv"+(e>0?e:""),"vec2");class BT extends I_{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"),i=null===this.levelNode?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${i} )`,this.getNodeType(e),t)}}const VT=Ey(BT).setParameterLength(1,2);class qT extends zv{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=M_.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&&void 0!==n.width){const{width:e,height:t}=n;this.value=Math.log2(Math.max(e,t))}}}const zT=Ey(qT).setParameterLength(1),kT=new Kn;class GT extends zv{static get type(){return"TextureNode"}constructor(e=kT,t=null,n=null,i=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=i,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=M_.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this.setUpdateMatrix(null===t)}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!0===this.value.isDepthTexture?"float":this.value.type===Ve?"uvec4":this.value.type===Be?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return FT(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return null===this._matrixUniform&&(this._matrixUniform=kv(this.value.matrix)),this._matrixUniform.mul(jy(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this.updateType=e?M_.OBJECT:M_.NONE,this}setupUV(e,t){const n=this.value;return e.isFlipY()&&(n.image instanceof ImageBitmap&&!0===n.flipY||!0===n.isRenderTargetTexture||!0===n.isFramebufferTexture||!0===n.isDepthTexture)&&(t=this.sampler?t.flipY():t.setY(By(VT(this,this.levelNode).y).sub(t.y).sub(1))),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const n=this.value;if(!n||!0!==n.isTexture)throw new Error("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().");let i=this.uvNode;null!==i&&!0!==e.context.forceUVContext||!e.context.getUV||(i=e.context.getUV(this,e)),i||(i=this.getDefaultUV()),!0===this.updateMatrix&&(i=this.getTransformedUV(i)),i=this.setupUV(e,i);let r=this.levelNode;null===r&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),t.uvNode=i,t.levelNode=r,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,!0===this.sampler?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,i,r,s,a,o,l){const u=this.value;let c;return c=i?e.generateTextureLevel(u,t,n,i,s,l):r?e.generateTextureBias(u,t,n,r,s,l):o?e.generateTextureGrad(u,t,n,o,s,l):a?e.generateTextureCompare(u,t,n,a,s,l):!1===this.sampler?e.generateTextureLoad(u,t,n,s,l):e.generateTexture(u,t,n,s,l),c}generate(e,t){const n=this.value,i=e.getNodeProperties(this),r=super.generate(e,"property");if(/^sampler/.test(t))return r+"_sampler";if(e.isReference(t))return r;{const s=e.getDataFromNode(this);let a=s.propertyName;if(void 0===a){const{uvNode:t,levelNode:n,biasNode:o,compareNode:l,depthNode:u,gradNode:c,offsetNode:h}=i,d=this.generateUV(e,t),p=n?n.build(e,"float"):null,m=o?o.build(e,"float"):null,f=u?u.build(e,"int"):null,g=l?l.build(e,"float"):null,_=c?[c[0].build(e,"vec2"),c[1].build(e,"vec2")]:null,y=h?this.generateOffset(e,h):null,v=e.getVarFromNode(this);a=e.getPropertyName(v);const x=this.generateSnippet(e,r,d,p,m,f,g,_,y);e.addLineFlowCode(`${a} = ${x}`,this),s.snippet=x,s.propertyName=a}let o=a;const l=this.getNodeType(e);return e.needsToWorkingColorSpace(n)&&(o=sT(CT(o,l),n.colorSpace).setup(e).build(e,l)),e.format(o,l,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){return this.sample(e)}sample(e){const t=this.clone();return t.uvNode=Ty(e),t.referenceNode=this.getBase(),Ty(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=Ty(e).mul(zT(t)),t.referenceNode=this.getBase();const n=t.value;return!1===t.generateMipmaps&&(n&&!1===n.generateMipmaps||n.minFilter===Re||n.magFilter===Re)&&(t.biasNode=null),Ty(t)}level(e){const t=this.clone();return t.levelNode=Ty(e),t.referenceNode=this.getBase(),Ty(t)}size(e){return VT(this,e)}bias(e){const t=this.clone();return t.biasNode=Ty(e),t.referenceNode=this.getBase(),Ty(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=Ty(e),t.referenceNode=this.getBase(),Ty(t)}grad(e,t){const n=this.clone();return n.gradNode=[Ty(e),Ty(t)],n.referenceNode=this.getBase(),Ty(n)}depth(e){const t=this.clone();return t.depthNode=Ty(e),t.referenceNode=this.getBase(),Ty(t)}offset(e){const t=this.clone();return t.offsetNode=Ty(e),t.referenceNode=this.getBase(),Ty(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;null!==t&&(t.value=e.matrix),!0===e.matrixAutoUpdate&&e.updateMatrix()}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 HT=Ey(GT).setParameterLength(1,4).setName("texture"),jT=(e=kT,t=null,n=null,i=null)=>{let r;return e&&!0===e.isTextureNode?(r=Ty(e.clone()),r.referenceNode=e.getBase(),null!==t&&(r.uvNode=Ty(t)),null!==n&&(r.levelNode=Ty(n)),null!==i&&(r.biasNode=Ty(i))):r=HT(e,t,n,i),r},WT=(...e)=>jT(...e).setSampler(!1);class XT extends zv{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const $T=(e,t,n)=>Ty(new XT(e,t,n));class YT extends L_{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),n=this.getNodeType(),i=this.node.getPaddedType();return e.format(t,i,n)}}class KT extends XT{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=null===t?y_(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=M_.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return"mat2"===e?t="mat2":!0===/mat/.test(e)?t="mat4":"i"===e.charAt(0)?t="ivec4":"u"===e.charAt(0)&&(t="uvec4"),t}update(){const{array:e,value:t}=this,n=this.elementType;if("float"===n||"int"===n||"uint"===n)for(let i=0;i<e.length;i++){t[4*i]=e[i]}else if("color"===n)for(let i=0;i<e.length;i++){const n=4*i,r=e[i];t[n]=r.r,t[n+1]=r.g,t[n+2]=r.b||0}else if("mat2"===n)for(let i=0;i<e.length;i++){const n=4*i,r=e[i];t[n]=r.elements[0],t[n+1]=r.elements[1],t[n+2]=r.elements[2],t[n+3]=r.elements[3]}else if("mat3"===n)for(let i=0;i<e.length;i++){const n=16*i,r=e[i];t[n]=r.elements[0],t[n+1]=r.elements[1],t[n+2]=r.elements[2],t[n+4]=r.elements[3],t[n+5]=r.elements[4],t[n+6]=r.elements[5],t[n+8]=r.elements[6],t[n+9]=r.elements[7],t[n+10]=r.elements[8],t[n+15]=1}else if("mat4"===n)for(let i=0;i<e.length;i++){const n=16*i,r=e[i];for(let e=0;e<r.elements.length;e++)t[n+e]=r.elements[e]}else for(let i=0;i<e.length;i++){const n=4*i,r=e[i];t[n]=r.x,t[n+1]=r.y,t[n+2]=r.z||0,t[n+3]=r.w||0}}setup(e){const t=this.array.length,n=this.elementType;let i=Float32Array;const r=this.paddedType,s=e.getTypeLength(r);return"i"===n.charAt(0)&&(i=Int32Array),"u"===n.charAt(0)&&(i=Uint32Array),this.value=new i(t*s),this.bufferCount=t,this.bufferType=r,super.setup(e)}element(e){return Ty(new YT(this,Ty(e)))}}const ZT=(e,t)=>Ty(new KT(e,t));const JT=Ey(class extends I_{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}).setParameterLength(1);let QT,eS;class tS extends I_{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}getNodeType(){return this.scope===tS.DPR?"float":this.scope===tS.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=M_.NONE;return this.scope!==tS.SIZE&&this.scope!==tS.VIEWPORT&&this.scope!==tS.DPR||(e=M_.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===tS.VIEWPORT?null!==t?eS.copy(t.viewport):(e.getViewport(eS),eS.multiplyScalar(e.getPixelRatio())):this.scope===tS.DPR?this._output.value=e.getPixelRatio():null!==t?(QT.width=t.width,QT.height=t.height):e.getDrawingBufferSize(QT)}setup(){const e=this.scope;let t=null;return t=e===tS.SIZE?kv(QT||(QT=new Sn)):e===tS.VIEWPORT?kv(eS||(eS=new Zn)):e===tS.DPR?kv(1):zy(sS.div(rS)),this._output=t,t}generate(e){if(this.scope===tS.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(rS).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}tS.COORDINATE="coordinate",tS.VIEWPORT="viewport",tS.SIZE="size",tS.UV="uv",tS.DPR="dpr";const nS=Ay(tS,tS.DPR),iS=Ay(tS,tS.UV),rS=Ay(tS,tS.SIZE),sS=Ay(tS,tS.COORDINATE),aS=Ay(tS,tS.VIEWPORT),oS=aS.zw,lS=sS.sub(aS.xy),uS=lS.div(oS),cS=Py(()=>rS,"vec2").once()(),hS=kv(0,"uint").setName("u_cameraIndex").setGroup(Fv("cameraIndex")).toVarying("v_cameraIndex"),dS=kv("float").setName("cameraNear").setGroup(Vv).onRenderUpdate(({camera:e})=>e.near),pS=kv("float").setName("cameraFar").setGroup(Vv).onRenderUpdate(({camera:e})=>e.far),mS=Py(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.projectionMatrix);t=ZT(n).setGroup(Vv).setName("cameraProjectionMatrices").element(e.isMultiViewCamera?JT("gl_ViewID_OVR"):hS).toConst("cameraProjectionMatrix")}else t=kv("mat4").setName("cameraProjectionMatrix").setGroup(Vv).onRenderUpdate(({camera:e})=>e.projectionMatrix);return t}).once()(),fS=Py(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.projectionMatrixInverse);t=ZT(n).setGroup(Vv).setName("cameraProjectionMatricesInverse").element(e.isMultiViewCamera?JT("gl_ViewID_OVR"):hS).toConst("cameraProjectionMatrixInverse")}else t=kv("mat4").setName("cameraProjectionMatrixInverse").setGroup(Vv).onRenderUpdate(({camera:e})=>e.projectionMatrixInverse);return t}).once()(),gS=Py(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.matrixWorldInverse);t=ZT(n).setGroup(Vv).setName("cameraViewMatrices").element(e.isMultiViewCamera?JT("gl_ViewID_OVR"):hS).toConst("cameraViewMatrix")}else t=kv("mat4").setName("cameraViewMatrix").setGroup(Vv).onRenderUpdate(({camera:e})=>e.matrixWorldInverse);return t}).once()(),_S=Py(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.matrixWorld);t=ZT(n).setGroup(Vv).setName("cameraWorldMatrices").element(e.isMultiViewCamera?JT("gl_ViewID_OVR"):hS).toConst("cameraWorldMatrix")}else t=kv("mat4").setName("cameraWorldMatrix").setGroup(Vv).onRenderUpdate(({camera:e})=>e.matrixWorld);return t}).once()(),yS=Py(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.normalMatrix);t=ZT(n).setGroup(Vv).setName("cameraNormalMatrices").element(e.isMultiViewCamera?JT("gl_ViewID_OVR"):hS).toConst("cameraNormalMatrix")}else t=kv("mat3").setName("cameraNormalMatrix").setGroup(Vv).onRenderUpdate(({camera:e})=>e.normalMatrix);return t}).once()(),vS=Py(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(let t=0,i=e.cameras.length;t<i;t++)n.push(new wn);t=ZT(n).setGroup(Vv).setName("cameraPositions").onRenderUpdate(({camera:e},t)=>{const n=e.cameras,i=t.array;for(let r=0,s=n.length;r<s;r++)i[r].setFromMatrixPosition(n[r].matrixWorld)}).element(e.isMultiViewCamera?JT("gl_ViewID_OVR"):hS).toConst("cameraPosition")}else t=kv(new wn).setName("cameraPosition").setGroup(Vv).onRenderUpdate(({camera:e},t)=>t.value.setFromMatrixPosition(e.matrixWorld));return t}).once()(),xS=Py(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.viewport);t=ZT(n,"vec4").setGroup(Vv).setName("cameraViewports").element(hS).toConst("cameraViewport")}else t=Yy(0,0,rS.x,rS.y).toConst("cameraViewport");return t}).once()(),bS=new xi;class TS extends I_{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=M_.OBJECT,this.uniformNode=new zv(null)}getNodeType(){const e=this.scope;return e===TS.WORLD_MATRIX?"mat4":e===TS.POSITION||e===TS.VIEW_POSITION||e===TS.DIRECTION||e===TS.SCALE?"vec3":e===TS.RADIUS?"float":void 0}update(e){const t=this.object3d,n=this.uniformNode,i=this.scope;if(i===TS.WORLD_MATRIX)n.value=t.matrixWorld;else if(i===TS.POSITION)n.value=n.value||new wn,n.value.setFromMatrixPosition(t.matrixWorld);else if(i===TS.SCALE)n.value=n.value||new wn,n.value.setFromMatrixScale(t.matrixWorld);else if(i===TS.DIRECTION)n.value=n.value||new wn,t.getWorldDirection(n.value);else if(i===TS.VIEW_POSITION){const i=e.camera;n.value=n.value||new wn,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(i.matrixWorldInverse)}else if(i===TS.RADIUS){const i=e.object.geometry;null===i.boundingSphere&&i.computeBoundingSphere(),bS.copy(i.boundingSphere).applyMatrix4(t.matrixWorld),n.value=bS.radius}}generate(e){const t=this.scope;return t===TS.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===TS.POSITION||t===TS.VIEW_POSITION||t===TS.DIRECTION||t===TS.SCALE?this.uniformNode.nodeType="vec3":t===TS.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}}TS.WORLD_MATRIX="worldMatrix",TS.POSITION="position",TS.SCALE="scale",TS.VIEW_POSITION="viewPosition",TS.DIRECTION="direction",TS.RADIUS="radius";const SS=Ey(TS,TS.DIRECTION).setParameterLength(1),MS=Ey(TS,TS.WORLD_MATRIX).setParameterLength(1),wS=Ey(TS,TS.POSITION).setParameterLength(1),ES=Ey(TS,TS.SCALE).setParameterLength(1),AS=Ey(TS,TS.VIEW_POSITION).setParameterLength(1),RS=Ey(TS,TS.RADIUS).setParameterLength(1);class CS extends TS{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const NS=Ay(CS,CS.DIRECTION),PS=Ay(CS,CS.WORLD_MATRIX),IS=Ay(CS,CS.POSITION),LS=Ay(CS,CS.SCALE),DS=Ay(CS,CS.VIEW_POSITION),OS=Ay(CS,CS.RADIUS),US=kv(new Rn).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),FS=kv(new Ci).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),BS=Py(e=>e.renderer.overrideNodes.modelViewMatrix||VS).once()().toVar("modelViewMatrix"),VS=gS.mul(PS),qS=Py(e=>(e.context.isHighPrecisionModelViewMatrix=!0,kv("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),zS=Py(e=>{const t=e.context.isHighPrecisionModelViewMatrix;return kv("mat3").onObjectUpdate(({object:e,camera:n})=>(!0!==t&&e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),kS=UT("position","vec3"),GS=kS.toVarying("positionLocal"),HS=kS.toVarying("positionPrevious"),jS=Py(e=>PS.mul(GS).xyz.toVarying(e.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),WS=Py(()=>GS.transformDirection(PS).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),XS=Py(e=>e.context.setupPositionView().toVarying("v_positionView"),"vec3").once(["POSITION"])(),$S=XS.negate().toVarying("v_positionViewDirection").normalize().toVar("positionViewDirection");class YS extends I_{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if("fragment"!==e.shaderStage)return"true";const{material:t}=e;return 1===t.side?"false":e.getFrontFacing()}}const KS=Ay(YS),ZS=Fy(KS).mul(2).sub(1),JS=Py(([e],{material:t})=>{const n=t.side;return 1===n?e=e.mul(-1):2===n&&(e=e.mul(ZS)),e}),QS=UT("normal","vec3"),eM=Py(e=>!1===e.geometry.hasAttribute("normal")?jy(0,1,0):QS,"vec3").once()().toVar("normalLocal"),tM=XS.dFdx().cross(XS.dFdy()).normalize().toVar("normalFlat"),nM=Py(e=>{let t;return t=!0===e.material.flatShading?tM:lM(eM).toVarying("v_normalViewGeometry").normalize(),t},"vec3").once()().toVar("normalViewGeometry"),iM=Py(e=>{let t=nM.transformDirection(gS);return!0!==e.material.flatShading&&(t=t.toVarying("v_normalWorldGeometry")),t.normalize().toVar("normalWorldGeometry")},"vec3").once()(),rM=Py(({subBuildFn:e,material:t,context:n})=>{let i;return"NORMAL"===e||"VERTEX"===e?(i=nM,!0!==t.flatShading&&(i=JS(i))):i=n.setupNormal().context({getUV:null}),i},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),sM=rM.transformDirection(gS).toVar("normalWorld"),aM=Py(({subBuildFn:e,context:t})=>{let n;return n="NORMAL"===e||"VERTEX"===e?rM:t.setupClearcoatNormal().context({getUV:null}),n},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),oM=Py(([e,t=PS])=>{const n=ev(t),i=e.div(jy(n[0].dot(n[0]),n[1].dot(n[1]),n[2].dot(n[2])));return n.mul(i).xyz}),lM=Py(([e],t)=>{const n=t.renderer.overrideNodes.modelNormalViewMatrix;if(null!==n)return n.transformDirection(e);const i=US.mul(e);return gS.transformDirection(i)}),uM=Py(()=>rM).once(["NORMAL","VERTEX"])(),cM=Py(()=>sM).once(["NORMAL","VERTEX"])(),hM=Py(()=>aM).once(["NORMAL","VERTEX"])(),dM=new Vi,pM=new Ci,mM=kv(0).onReference(({material:e})=>e).onObjectUpdate(({material:e})=>e.refractionRatio),fM=kv(1).onReference(({material:e})=>e).onObjectUpdate(function({material:e,scene:t}){return e.envMap?e.envMapIntensity:t.environmentIntensity}),gM=kv(new Ci).onReference(function(e){return e.material}).onObjectUpdate(function({material:e,scene:t}){const n=null!==t.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation;return n?(dM.copy(n),pM.makeRotationFromEuler(dM)):pM.identity(),pM}),_M=$S.negate().reflect(rM),yM=$S.negate().refract(rM,mM),vM=_M.transformDirection(gS).toVar("reflectVector"),xM=yM.transformDirection(gS).toVar("reflectVector"),bM=new ys;class TM extends GT{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,i=null){super(e,t,n,i),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===xe?vM:e.mapping===be?xM:jy(0,0,0)}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return e.renderer.coordinateSystem!==un&&n.isRenderTargetTexture||(t=jy(t.x.negate(),t.yz)),gM.mul(t)}generateUV(e,t){return t.build(e,"vec3")}}const SM=Ey(TM).setParameterLength(1,4).setName("cubeTexture"),MM=(e=bM,t=null,n=null,i=null)=>{let r;return e&&!0===e.isCubeTextureNode?(r=Ty(e.clone()),r.referenceNode=e,null!==t&&(r.uvNode=Ty(t)),null!==n&&(r.levelNode=Ty(n)),null!==i&&(r.biasNode=Ty(i))):r=SM(e,t,n,i),r};class wM extends L_{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(),i=this.getNodeType();return e.format(t,n,i)}}class EM extends I_{static get type(){return"ReferenceNode"}constructor(e,t,n=null,i=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=i,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=M_.OBJECT}element(e){return Ty(new wM(this,Ty(e)))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return this.setName(e)}setNodeType(e){let t=null;t=null!==this.count?$T(null,e,this.count):Array.isArray(this.getValueFromReference())?ZT(null,e):"texture"===e?jT(null):"cubeTexture"===e?MM(null):kv(null,e),null!==this.group&&t.setGroup(this.group),null!==this.name&&t.setName(this.name),this.node=t}getNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let i=1;i<t.length;i++)n=n[t[i]];return n}updateReference(e){return this.reference=null!==this.object?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){null===this.node&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const AM=(e,t,n)=>Ty(new EM(e,t,n)),RM=(e,t,n,i)=>Ty(new EM(e,t,i,n));class CM extends EM{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=null!==this.material?this.material:e.material,this.reference}}const NM=(e,t,n=null)=>Ty(new CM(e,t,n)),PM=FT(),IM=XS.dFdx(),LM=XS.dFdy(),DM=PM.dFdx(),OM=PM.dFdy(),UM=rM,FM=LM.cross(UM),BM=UM.cross(IM),VM=FM.mul(DM.x).add(BM.mul(OM.x)),qM=FM.mul(DM.y).add(BM.mul(OM.y)),zM=VM.dot(VM).max(qM.dot(qM)),kM=zM.equal(0).select(0,zM.inverseSqrt()),GM=VM.mul(kM).toVar("tangentViewFrame"),HM=qM.mul(kM).toVar("bitangentViewFrame"),jM=Py(e=>(!1===e.geometry.hasAttribute("tangent")&&e.geometry.computeTangents(),UT("tangent","vec4")))(),WM=jM.xyz.toVar("tangentLocal"),XM=Py(({subBuildFn:e,geometry:t,material:n})=>{let i;return i="VERTEX"===e||t.hasAttribute("tangent")?BS.mul(Yy(WM,0)).xyz.toVarying("v_tangentView").normalize():GM,!0!==n.flatShading&&(i=JS(i)),i},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),$M=XM.transformDirection(gS).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),YM=Py(([e,t],{subBuildFn:n,material:i})=>{let r=e.mul(jM.w).xyz;return"NORMAL"===n&&!0!==i.flatShading&&(r=r.toVarying(t)),r}).once(["NORMAL"]),KM=YM(QS.cross(jM),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),ZM=YM(eM.cross(WM),"v_bitangentLocal").normalize().toVar("bitangentLocal"),JM=Py(({subBuildFn:e,geometry:t,material:n})=>{let i;return i="VERTEX"===e||t.hasAttribute("tangent")?YM(rM.cross(XM),"v_bitangentView").normalize():HM,!0!==n.flatShading&&(i=JS(i)),i},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),QM=YM(sM.cross($M),"v_bitangentWorld").normalize().toVar("bitangentWorld"),ew=ev(XM,JM,rM).toVar("TBNViewMatrix"),tw=$S.mul(ew),nw=Py(()=>{let e=bv.cross($S);return e=e.cross(bv).normalize(),e=Mb(e,rM,vv.mul(uv.oneMinus()).oneMinus().pow2().pow2()).normalize(),e}).once()();class iw extends O_{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=0}setup({material:e}){const{normalMapType:t,scaleNode:n}=this;let i=this.node.mul(2).sub(1);if(null!==n){let t=n;!0===e.flatShading&&(t=JS(t)),i=jy(i.xy.mul(t),i.z)}let r=null;return r=1===t?lM(i):0===t?ew.mul(i).normalize():rM,r}}const rw=Ey(iw).setParameterLength(1,2),sw=Py(({textureNode:e,bumpScale:t})=>{const n=t=>e.cache().context({getUV:e=>t(e.uvNode||FT()),forceUVContext:!0}),i=Fy(n(e=>e));return zy(Fy(n(e=>e.add(e.dFdx()))).sub(i),Fy(n(e=>e.add(e.dFdy()))).sub(i)).mul(t)}),aw=Py(e=>{const{surf_pos:t,surf_norm:n,dHdxy:i}=e,r=t.dFdx().normalize(),s=n,a=t.dFdy().normalize().cross(s),o=s.cross(r),l=r.dot(a).mul(ZS),u=l.sign().mul(i.x.mul(a).add(i.y.mul(o)));return l.abs().mul(n).sub(u).normalize()});class ow extends O_{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=null!==this.scaleNode?this.scaleNode:1,t=sw({textureNode:this.textureNode,bumpScale:e});return aw({surf_pos:XS,surf_norm:rM,dHdxy:t})}}const lw=Ey(ow).setParameterLength(1,2),uw=new Map;class cw extends I_{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=uw.get(e);return void 0===n&&(n=NM(e,t),uw.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache("map"===e?"map":e+"Map","texture")}setup(e){const t=e.context.material,n=this.scope;let i=null;if(n===cw.COLOR){const e=void 0!==t.color?this.getColor(n):jy();i=t.map&&!0===t.map.isTexture?e.mul(this.getTexture("map")):e}else if(n===cw.OPACITY){const e=this.getFloat(n);i=t.alphaMap&&!0===t.alphaMap.isTexture?e.mul(this.getTexture("alpha")):e}else if(n===cw.SPECULAR_STRENGTH)i=t.specularMap&&!0===t.specularMap.isTexture?this.getTexture("specular").r:Fy(1);else if(n===cw.SPECULAR_INTENSITY){const e=this.getFloat(n);i=t.specularIntensityMap&&!0===t.specularIntensityMap.isTexture?e.mul(this.getTexture(n).a):e}else if(n===cw.SPECULAR_COLOR){const e=this.getColor(n);i=t.specularColorMap&&!0===t.specularColorMap.isTexture?e.mul(this.getTexture(n).rgb):e}else if(n===cw.ROUGHNESS){const e=this.getFloat(n);i=t.roughnessMap&&!0===t.roughnessMap.isTexture?e.mul(this.getTexture(n).g):e}else if(n===cw.METALNESS){const e=this.getFloat(n);i=t.metalnessMap&&!0===t.metalnessMap.isTexture?e.mul(this.getTexture(n).b):e}else if(n===cw.EMISSIVE){const e=this.getFloat("emissiveIntensity"),r=this.getColor(n).mul(e);i=t.emissiveMap&&!0===t.emissiveMap.isTexture?r.mul(this.getTexture(n)):r}else if(n===cw.NORMAL)t.normalMap?(i=rw(this.getTexture("normal"),this.getCache("normalScale","vec2")),i.normalMapType=t.normalMapType):i=t.bumpMap?lw(this.getTexture("bump").r,this.getFloat("bumpScale")):rM;else if(n===cw.CLEARCOAT){const e=this.getFloat(n);i=t.clearcoatMap&&!0===t.clearcoatMap.isTexture?e.mul(this.getTexture(n).r):e}else if(n===cw.CLEARCOAT_ROUGHNESS){const e=this.getFloat(n);i=t.clearcoatRoughnessMap&&!0===t.clearcoatRoughnessMap.isTexture?e.mul(this.getTexture(n).r):e}else if(n===cw.CLEARCOAT_NORMAL)i=t.clearcoatNormalMap?rw(this.getTexture(n),this.getCache(n+"Scale","vec2")):rM;else if(n===cw.SHEEN){const e=this.getColor("sheenColor").mul(this.getFloat("sheen"));i=t.sheenColorMap&&!0===t.sheenColorMap.isTexture?e.mul(this.getTexture("sheenColor").rgb):e}else if(n===cw.SHEEN_ROUGHNESS){const e=this.getFloat(n);i=t.sheenRoughnessMap&&!0===t.sheenRoughnessMap.isTexture?e.mul(this.getTexture(n).a):e,i=i.clamp(.07,1)}else if(n===cw.ANISOTROPY)if(t.anisotropyMap&&!0===t.anisotropyMap.isTexture){const e=this.getTexture(n);i=Qy($w.x,$w.y,$w.y.negate(),$w.x).mul(e.rg.mul(2).sub(zy(1)).normalize().mul(e.b))}else i=$w;else if(n===cw.IRIDESCENCE_THICKNESS){const e=AM("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const r=AM("0","float",t.iridescenceThicknessRange);i=e.sub(r).mul(this.getTexture(n).g).add(r)}else i=e}else if(n===cw.TRANSMISSION){const e=this.getFloat(n);i=t.transmissionMap?e.mul(this.getTexture(n).r):e}else if(n===cw.THICKNESS){const e=this.getFloat(n);i=t.thicknessMap?e.mul(this.getTexture(n).g):e}else if(n===cw.IOR)i=this.getFloat(n);else if(n===cw.LIGHT_MAP)i=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity"));else if(n===cw.AO)i=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(n===cw.LINE_DASH_OFFSET)i=t.dashOffset?this.getFloat(n):Fy(0);else{const t=this.getNodeType(e);i=this.getCache(n,t)}return i}}cw.ALPHA_TEST="alphaTest",cw.COLOR="color",cw.OPACITY="opacity",cw.SHININESS="shininess",cw.SPECULAR="specular",cw.SPECULAR_STRENGTH="specularStrength",cw.SPECULAR_INTENSITY="specularIntensity",cw.SPECULAR_COLOR="specularColor",cw.REFLECTIVITY="reflectivity",cw.ROUGHNESS="roughness",cw.METALNESS="metalness",cw.NORMAL="normal",cw.CLEARCOAT="clearcoat",cw.CLEARCOAT_ROUGHNESS="clearcoatRoughness",cw.CLEARCOAT_NORMAL="clearcoatNormal",cw.EMISSIVE="emissive",cw.ROTATION="rotation",cw.SHEEN="sheen",cw.SHEEN_ROUGHNESS="sheenRoughness",cw.ANISOTROPY="anisotropy",cw.IRIDESCENCE="iridescence",cw.IRIDESCENCE_IOR="iridescenceIOR",cw.IRIDESCENCE_THICKNESS="iridescenceThickness",cw.IOR="ior",cw.TRANSMISSION="transmission",cw.THICKNESS="thickness",cw.ATTENUATION_DISTANCE="attenuationDistance",cw.ATTENUATION_COLOR="attenuationColor",cw.LINE_SCALE="scale",cw.LINE_DASH_SIZE="dashSize",cw.LINE_GAP_SIZE="gapSize",cw.LINE_WIDTH="linewidth",cw.LINE_DASH_OFFSET="dashOffset",cw.POINT_SIZE="size",cw.DISPERSION="dispersion",cw.LIGHT_MAP="light",cw.AO="ao";const hw=Ay(cw,cw.ALPHA_TEST),dw=Ay(cw,cw.COLOR),pw=Ay(cw,cw.SHININESS),mw=Ay(cw,cw.EMISSIVE),fw=Ay(cw,cw.OPACITY),gw=Ay(cw,cw.SPECULAR),_w=Ay(cw,cw.SPECULAR_INTENSITY),yw=Ay(cw,cw.SPECULAR_COLOR),vw=Ay(cw,cw.SPECULAR_STRENGTH),xw=Ay(cw,cw.REFLECTIVITY),bw=Ay(cw,cw.ROUGHNESS),Tw=Ay(cw,cw.METALNESS),Sw=Ay(cw,cw.NORMAL),Mw=Ay(cw,cw.CLEARCOAT),ww=Ay(cw,cw.CLEARCOAT_ROUGHNESS),Ew=Ay(cw,cw.CLEARCOAT_NORMAL),Aw=Ay(cw,cw.ROTATION),Rw=Ay(cw,cw.SHEEN),Cw=Ay(cw,cw.SHEEN_ROUGHNESS),Nw=Ay(cw,cw.ANISOTROPY),Pw=Ay(cw,cw.IRIDESCENCE),Iw=Ay(cw,cw.IRIDESCENCE_IOR),Lw=Ay(cw,cw.IRIDESCENCE_THICKNESS),Dw=Ay(cw,cw.TRANSMISSION),Ow=Ay(cw,cw.THICKNESS),Uw=Ay(cw,cw.IOR),Fw=Ay(cw,cw.ATTENUATION_DISTANCE),Bw=Ay(cw,cw.ATTENUATION_COLOR),Vw=Ay(cw,cw.LINE_SCALE),qw=Ay(cw,cw.LINE_DASH_SIZE),zw=Ay(cw,cw.LINE_GAP_SIZE),kw=Ay(cw,cw.LINE_WIDTH),Gw=Ay(cw,cw.LINE_DASH_OFFSET),Hw=Ay(cw,cw.POINT_SIZE),jw=Ay(cw,cw.DISPERSION),Ww=Ay(cw,cw.LIGHT_MAP),Xw=Ay(cw,cw.AO),$w=kv(new Sn).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))}),Yw=Py(e=>e.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class Kw extends I_{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 i,r;if(n===Kw.VERTEX)i=e.getVertexIndex();else if(n===Kw.INSTANCE)i=e.getInstanceIndex();else if(n===Kw.DRAW)i=e.getDrawIndex();else if(n===Kw.INVOCATION_LOCAL)i=e.getInvocationLocalIndex();else if(n===Kw.INVOCATION_SUBGROUP)i=e.getInvocationSubgroupIndex();else{if(n!==Kw.SUBGROUP)throw new Error("THREE.IndexNode: Unknown scope: "+n);i=e.getSubgroupIndex()}if("vertex"===e.shaderStage||"compute"===e.shaderStage)r=i;else{r=Jb(this).build(e,t)}return r}}Kw.VERTEX="vertex",Kw.INSTANCE="instance",Kw.SUBGROUP="subgroup",Kw.INVOCATION_LOCAL="invocationLocal",Kw.INVOCATION_SUBGROUP="invocationSubgroup",Kw.DRAW="draw";const Zw=Ay(Kw,Kw.VERTEX),Jw=Ay(Kw,Kw.INSTANCE),Qw=Ay(Kw,Kw.SUBGROUP),eE=Ay(Kw,Kw.INVOCATION_SUBGROUP),tE=Ay(Kw,Kw.INVOCATION_LOCAL),nE=Ay(Kw,Kw.DRAW);class iE extends I_{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=M_.FRAME,this.buffer=null,this.bufferColor=null}setup(e){const{instanceMatrix:t,instanceColor:n}=this,{count:i}=t;let{instanceMatrixNode:r,instanceColorNode:s}=this;if(null===r){if(i<=1e3)r=$T(t.array,"mat4",Math.max(i,1)).element(Jw);else{const e=new Fc(t.array,16,1);this.buffer=e;const n=t.usage===an?_T:gT,i=[n(e,"vec4",16,0),n(e,"vec4",16,4),n(e,"vec4",16,8),n(e,"vec4",16,12)];r=tv(...i)}this.instanceMatrixNode=r}if(n&&null===s){const e=new ua(n.array,3),t=n.usage===an?_T:gT;this.bufferColor=e,s=jy(t(e,"vec3",3,0)),this.instanceColorNode=s}const a=r.mul(GS).xyz;if(GS.assign(a),e.hasGeometryAttribute("normal")){const e=oM(eM,r);eM.assign(e)}null!==this.instanceColorNode&&av("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){this.instanceMatrix.usage!==an&&null!==this.buffer&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version),this.instanceColor&&this.instanceColor.usage!==an&&null!==this.bufferColor&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)}}const rE=Ey(iE).setParameterLength(2,3);class sE extends iE{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:n,instanceColor:i}=e;super(t,n,i),this.instancedMesh=e}}const aE=Ey(sE).setParameterLength(1);class oE extends I_{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){null===this.batchingIdNode&&(null===e.getDrawIndex()?this.batchingIdNode=Jw:this.batchingIdNode=nE);const t=Py(([e])=>{const t=By(VT(WT(this.batchMesh._indirectTexture),0).x),n=By(e).mod(t),i=By(e).div(t);return WT(this.batchMesh._indirectTexture,ky(n,i)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(By(this.batchingIdNode)),n=this.batchMesh._matricesTexture,i=By(VT(WT(n),0).x),r=Fy(t).mul(4).toInt().toVar(),s=r.mod(i),a=r.div(i),o=tv(WT(n,ky(s,a)),WT(n,ky(s.add(1),a)),WT(n,ky(s.add(2),a)),WT(n,ky(s.add(3),a))),l=this.batchMesh._colorsTexture;if(null!==l){const e=Py(([e])=>{const t=By(VT(WT(l),0).x),n=e,i=n.mod(t),r=n.div(t);return WT(l,ky(i,r)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(t);av("vec3","vBatchColor").assign(e)}const u=ev(o);GS.assign(o.mul(GS));const c=eM.div(jy(u[0].dot(u[0]),u[1].dot(u[1]),u[2].dot(u[2]))),h=u.mul(c).xyz;eM.assign(h),e.hasGeometryAttribute("tangent")&&WM.mulAssign(u)}}const lE=Ey(oE).setParameterLength(1);class uE extends L_{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!1===e.isAvailable("storageBuffer")&&!0===this.node.isPBO&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const i=e.context.assign;if(n=!1===e.isAvailable("storageBuffer")?!0!==this.node.isPBO||!0===i||!this.node.value.isInstancedBufferAttribute&&"compute"===e.shaderStage?this.node.build(e):e.generatePBO(this):super.generate(e),!0!==i){const i=this.getNodeType(e);n=e.format(n,i,t)}return n}}const cE=Ey(uE).setParameterLength(2);class hE extends XT{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let i,r=null;t&&t.isStruct?(i="struct",r=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):null===t&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(i=p_(e.itemSize),n=e.count):i=t,super(e,i,n),this.isStorageBufferNode=!0,this.structTypeNode=r,this.access=w_.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,!0!==e.isStorageBufferAttribute&&!0!==e.isStorageInstancedBufferAttribute&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(0===this.bufferCount){let t=e.globalCache.getData(this.value);return void 0===t&&(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 cE(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(w_.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return null===this._attribute&&(this._attribute=mT(this.value),this._varying=Jb(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(null!==this.structTypeNode)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 null!==this.structTypeNode?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(null!==this.structTypeNode&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:n}=this.getAttributeData(),i=n.build(e);return e.registerTransform(i,t),i}}const dE=(e,t=null,n=0)=>Ty(new hE(e,t,n)),pE=new WeakMap;class mE extends I_{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=M_.OBJECT,this.skinIndexNode=UT("skinIndex","uvec4"),this.skinWeightNode=UT("skinWeight","vec4"),this.bindMatrixNode=AM("bindMatrix","mat4"),this.bindMatrixInverseNode=AM("bindMatrixInverse","mat4"),this.boneMatricesNode=RM("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=GS,this.toPositionNode=GS,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){const{skinIndexNode:n,skinWeightNode:i,bindMatrixNode:r,bindMatrixInverseNode:s}=this,a=e.element(n.x),o=e.element(n.y),l=e.element(n.z),u=e.element(n.w),c=r.mul(t),h=Zv(a.mul(i.x).mul(c),o.mul(i.y).mul(c),l.mul(i.z).mul(c),u.mul(i.w).mul(c));return s.mul(h).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=eM){const{skinIndexNode:n,skinWeightNode:i,bindMatrixNode:r,bindMatrixInverseNode:s}=this,a=e.element(n.x),o=e.element(n.y),l=e.element(n.z),u=e.element(n.w);let c=Zv(i.x.mul(a),i.y.mul(o),i.z.mul(l),i.w.mul(u));return c=s.mul(c).mul(r),c.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return null===this.previousBoneMatricesNode&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=RM("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,HS)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")||!0===x_(e.object).useVelocity}setup(e){this.needsPreviousBoneMatrices(e)&&HS.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){const t=this.getSkinnedNormal();eM.assign(t),e.hasGeometryAttribute("tangent")&&WM.assign(t)}return t}generate(e,t){if("void"!==t)return super.generate(e,t)}update(e){const t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;pE.get(t)!==e.frameId&&(pE.set(t,e.frameId),null!==this.previousBoneMatricesNode&&t.previousBoneMatrices.set(t.boneMatrices),t.update())}}const fE=e=>Ty(new mE(e));class gE extends I_{static get type(){return"LoopNode"}constructor(e=[]){super(),this.params=e}getVarName(e){return String.fromCharCode("i".charCodeAt(0)+e)}getProperties(e){const t=e.getNodeProperties(this);if(void 0!==t.stackNode)return t;const n={};for(let s=0,a=this.params.length-1;s<a;s++){const e=this.params[s],t=!0!==e.isNode&&e.name||this.getVarName(s),i=!0!==e.isNode&&e.type||"int";n[t]=CT(t,i)}const i=e.addStack();t.returnsNode=this.params[this.params.length-1](n,e),t.stackNode=i;const r=this.params[0];return!0!==r.isNode&&"function"==typeof r.update&&(t.updateNode=Py(this.params[0].update)(n)),e.removeStack(),t}getNodeType(e){const{returnsNode:t}=this.getProperties(e);return t?t.getNodeType(e):"void"}setup(e){this.getProperties(e)}generate(e){const t=this.getProperties(e),n=this.params,i=t.stackNode;for(let a=0,o=n.length-1;a<o;a++){const i=n[a];let r,s=!1,o=null,l=null,u=null,c=null,h=null,d=null;if(i.isNode?"bool"===i.getNodeType(e)?(s=!0,c="bool",l=i.build(e,c)):(c="int",u=this.getVarName(a),o="0",l=i.build(e,c),h="<"):(c=i.type||"int",u=i.name||this.getVarName(a),o=i.start,l=i.end,h=i.condition,d=i.update,"number"==typeof o?o=e.generateConst(c,o):o&&o.isNode&&(o=o.build(e,c)),"number"==typeof l?l=e.generateConst(c,l):l&&l.isNode&&(l=l.build(e,c)),void 0!==o&&void 0===l?(o+=" - 1",l="0",h=">="):void 0!==l&&void 0===o&&(o="0",h="<"),void 0===h&&(h=Number(o)>Number(l)?">=":"<")),s)r=`while ( ${l} )`;else{const n={start:o,end:l},i=n.start,s=n.end;let a;const p=()=>h.includes("<")?"+=":"-=";if(null!=d)switch(typeof d){case"function":a=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":a=u+" "+p()+" "+e.generateConst(c,d);break;case"string":a=u+" "+d;break;default:a=d.isNode?u+" "+p()+" "+d.build(e):"break /* invalid update */"}else d="int"===c||"uint"===c?h.includes("<")?"++":"--":p()+" 1.",a=u+" "+d;r=`for ( ${e.getVar(c,u)+" = "+i}; ${u+" "+h+" "+s}; ${a} )`}e.addFlowCode((0===a?"\n":"")+e.tab+r+" {\n\n").addFlowTab()}const r=i.build(e,"void"),s=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode("\n"+e.tab+r);for(let a=0,o=this.params.length-1;a<o;a++)e.addFlowCode((0===a?"":e.tab)+"}\n\n").removeFlowTab();return e.addFlowTab(),s}}const _E=(...e)=>Ty(new gE(wy(e,"int"))).toStack(),yE=()=>CT("break").toStack(),vE=new WeakMap,xE=new Zn,bE=Py(({bufferMap:e,influence:t,stride:n,width:i,depth:r,offset:s})=>{const a=By(Zw).mul(n).add(s),o=a.div(i),l=a.sub(o.mul(i));return WT(e,ky(l,o)).depth(r).xyz.mul(t)});class TE extends I_{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=kv(1),this.updateType=M_.OBJECT}setup(e){const{geometry:t}=e,n=void 0!==t.morphAttributes.position,i=t.hasAttribute("normal")&&void 0!==t.morphAttributes.normal,r=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,s=void 0!==r?r.length:0,{texture:a,stride:o,size:l}=function(e){const t=void 0!==e.morphAttributes.position,n=void 0!==e.morphAttributes.normal,i=void 0!==e.morphAttributes.color,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=void 0!==r?r.length:0;let a=vE.get(e);if(void 0===a||a.count!==s){let r=function(){f.dispose(),vE.delete(e),e.removeEventListener("dispose",r)};void 0!==a&&a.texture.dispose();const o=e.morphAttributes.position||[],l=e.morphAttributes.normal||[],u=e.morphAttributes.color||[];let c=0;!0===t&&(c=1),!0===n&&(c=2),!0===i&&(c=3);let h=e.attributes.position.count*c,d=1;const p=4096;h>p&&(d=Math.ceil(h/p),h=p);const m=new Float32Array(h*d*4*s),f=new ei(m,h,d,s);f.type=qe,f.needsUpdate=!0;const g=4*c;for(let e=0;e<s;e++){const r=o[e],s=l[e],a=u[e],c=h*d*4*e;for(let e=0;e<r.count;e++){const o=e*g;!0===t&&(xE.fromBufferAttribute(r,e),m[c+o+0]=xE.x,m[c+o+1]=xE.y,m[c+o+2]=xE.z,m[c+o+3]=0),!0===n&&(xE.fromBufferAttribute(s,e),m[c+o+4]=xE.x,m[c+o+5]=xE.y,m[c+o+6]=xE.z,m[c+o+7]=0),!0===i&&(xE.fromBufferAttribute(a,e),m[c+o+8]=xE.x,m[c+o+9]=xE.y,m[c+o+10]=xE.z,m[c+o+11]=4===a.itemSize?xE.w:1)}}a={count:s,texture:f,stride:c,size:new Sn(h,d)},vE.set(e,a),e.addEventListener("dispose",r)}return a}(t);!0===n&&GS.mulAssign(this.morphBaseInfluence),!0===i&&eM.mulAssign(this.morphBaseInfluence);const u=By(l.width);_E(s,({i:e})=>{const t=Fy(0).toVar();this.mesh.count>1&&null!==this.mesh.morphTexture&&void 0!==this.mesh.morphTexture?t.assign(WT(this.mesh.morphTexture,ky(By(e).add(1),By(Jw))).r):t.assign(AM("morphTargetInfluences","float").element(e).toVar()),Dy(t.notEqual(0),()=>{!0===n&&GS.addAssign(bE({bufferMap:a,influence:t,stride:o,width:u,depth:e,offset:By(0)})),!0===i&&eM.addAssign(bE({bufferMap:a,influence:t,stride:o,width:u,depth:e,offset:By(1)}))})})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((e,t)=>e+t,0)}}const SE=Ey(TE).setParameterLength(1);class ME extends I_{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class wE extends ME{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class EE extends Vb{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,i=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=i,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n={directDiffuse:jy().toVar("directDiffuse"),directSpecular:jy().toVar("directSpecular"),indirectDiffuse:jy().toVar("indirectDiffuse"),indirectSpecular:jy().toVar("indirectSpecular")};return{radiance:jy().toVar("radiance"),irradiance:jy().toVar("irradiance"),iblIrradiance:jy().toVar("iblIrradiance"),ambientOcclusion:Fy(1).toVar("ambientOcclusion"),reflectedLight:n,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 AE=Ey(EE);class RE extends ME{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}const CE=new Sn;class NE extends GT{static get type(){return"ViewportTextureNode"}constructor(e=iS,t=null,n=null){let i=null;null===n?(i=new _o,i.minFilter=Le,n=i):i=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=i,this.isOutputTextureNode=!0,this.updateBeforeType=M_.FRAME,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),null===e)return t;if(!1===n.has(e)){const i=t.clone();n.set(e,i)}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();null===n?t.getDrawingBufferSize(CE):CE.set(n.width,n.height);const i=this.getTextureForReference(n);i.image.width===CE.width&&i.image.height===CE.height||(i.image.width=CE.width,i.image.height=CE.height,i.needsUpdate=!0);const r=i.generateMipmaps;i.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(i),i.generateMipmaps=r}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const PE=Ey(NE).setParameterLength(0,3),IE=Ey(NE,null,null,{generateMipmaps:!0}).setParameterLength(0,3);let LE=null;class DE extends NE{static get type(){return"ViewportDepthTextureNode"}constructor(e=iS,t=null){null===LE&&(LE=new vo),super(e,t,LE)}getTextureForReference(){return LE}}const OE=Ey(DE).setParameterLength(0,2);class UE extends I_{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===UE.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let i=null;if(t===UE.DEPTH_BASE)null!==n&&(i=zE().assign(n));else if(t===UE.DEPTH)i=e.isPerspectiveCamera?BE(XS.z,dS,pS):FE(XS.z,dS,pS);else if(t===UE.LINEAR_DEPTH)if(null!==n)if(e.isPerspectiveCamera){const e=VE(n,dS,pS);i=FE(e,dS,pS)}else i=n;else i=FE(XS.z,dS,pS);return i}}UE.DEPTH_BASE="depthBase",UE.DEPTH="depth",UE.LINEAR_DEPTH="linearDepth";const FE=(e,t,n)=>e.add(t).div(t.sub(n)),BE=(e,t,n)=>t.add(e).mul(n).div(n.sub(t).mul(e)),VE=(e,t,n)=>t.mul(n).div(n.sub(t).mul(e).sub(n)),qE=(e,t,n)=>{t=t.max(1e-6).toVar();const i=Ox(e.negate().div(t)),r=Ox(n.div(t));return i.div(r)},zE=Ey(UE,UE.DEPTH_BASE),kE=Ay(UE,UE.DEPTH),GE=Ey(UE,UE.LINEAR_DEPTH).setParameterLength(0,1),HE=GE(OE());kE.assign=e=>zE(e);class jE extends I_{static get type(){return"ClippingNode"}constructor(e=jE.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:n,unionPlanes:i}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===jE.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,i):this.scope===jE.HARDWARE?this.setupHardwareClipping(i,e):this.setupDefault(n,i)}setupAlphaToCoverage(e,t){return Py(()=>{const n=Fy().toVar("distanceToPlane"),i=Fy().toVar("distanceToGradient"),r=Fy(1).toVar("clipOpacity"),s=t.length;if(!1===this.hardwareClipping&&s>0){const e=ZT(t).setGroup(Vv);_E(s,({i:t})=>{const s=e.element(t);n.assign(XS.dot(s.xyz).negate().add(s.w)),i.assign(n.fwidth().div(2)),r.mulAssign(Rb(i.negate(),i,n))})}const a=e.length;if(a>0){const t=ZT(e).setGroup(Vv),s=Fy(1).toVar("intersectionClipOpacity");_E(a,({i:e})=>{const r=t.element(e);n.assign(XS.dot(r.xyz).negate().add(r.w)),i.assign(n.fwidth().div(2)),s.mulAssign(Rb(i.negate(),i,n).oneMinus())}),r.mulAssign(s.oneMinus())}ov.a.mulAssign(r),ov.a.equal(0).discard()})()}setupDefault(e,t){return Py(()=>{const n=t.length;if(!1===this.hardwareClipping&&n>0){const e=ZT(t).setGroup(Vv);_E(n,({i:t})=>{const n=e.element(t);XS.dot(n.xyz).greaterThan(n.w).discard()})}const i=e.length;if(i>0){const t=ZT(e).setGroup(Vv),n=qy(!0).toVar("clipped");_E(i,({i:e})=>{const i=t.element(e);n.assign(XS.dot(i.xyz).greaterThan(i.w).and(n))}),n.discard()}})()}setupHardwareClipping(e,t){const n=e.length;return t.enableHardwareClipping(n),Py(()=>{const i=ZT(e).setGroup(Vv),r=JT(t.getClipDistance());_E(n,({i:e})=>{const t=i.element(e),n=XS.dot(t.xyz).sub(t.w).negate();r.element(e).assign(n)})})()}}jE.ALPHA_TO_COVERAGE="alphaToCoverage",jE.DEFAULT="default",jE.HARDWARE="hardware";const WE=Py(([e])=>zx(Qv(1e4,kx(Qv(17,e.x).add(Qv(.1,e.y)))).mul(Zv(.1,$x(kx(Qv(13,e.y).add(e.x))))))),XE=Py(([e])=>WE(zy(WE(e.xy),e.z))),$E=Py(([e])=>{const t=cb(Kx(Qx(e.xyz)),Kx(eb(e.xyz))),n=Fy(1).div(Fy(.05).mul(t)).toVar("pixScale"),i=zy(Lx(Bx(Ox(n))),Lx(Vx(Ox(n)))),r=zy(XE(Bx(i.x.mul(e.xyz))),XE(Bx(i.y.mul(e.xyz)))),s=zx(Ox(n)),a=Zv(Qv(s.oneMinus(),r.x),Qv(s,r.y)),o=ub(s,s.oneMinus()),l=jy(a.mul(a).div(Qv(2,o).mul(Jv(1,o))),a.sub(Qv(.5,o)).div(Jv(1,o)),Jv(1,Jv(1,a).mul(Jv(1,a)).div(Qv(2,o).mul(Jv(1,o))))),u=a.lessThan(o.oneMinus()).select(a.lessThan(o).select(l.x,l.y),l.z);return wb(u,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class YE extends OT{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);let n;return n=!0===e.hasGeometryAttribute(t)?super.generate(e):e.generateConst(this.nodeType,new Zn(1,1,1,1)),n}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const KE=(e=0)=>Ty(new YE(e)),ZE=Py(([e,t])=>ub(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),JE=Py(([e,t])=>ub(e.div(t.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),QE=Py(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),eA=Py(([e,t])=>Mb(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),hb(.5,e))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),tA=Py(([e,t])=>{const n=t.a.add(e.a.mul(t.a.oneMinus()));return Yy(t.rgb.mul(t.a).add(e.rgb.mul(e.a).mul(t.a.oneMinus())).div(n),n)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),nA=Py(([e])=>Yy(e.rgb.mul(e.a),e.a),{color:"vec4",return:"vec4"}),iA=Py(([e])=>(Dy(e.a.equal(0),()=>Yy(0)),Yy(e.rgb.div(e.a),e.a)),{color:"vec4",return:"vec4"});class rA extends Mr{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.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,Object.defineProperty(this,"shadowPositionNode",{get:()=>this.receivedShadowPositionNode,set:e=>{this.receivedShadowPositionNode=e}})}customProgramCacheKey(){return this.type+u_(this)}build(e){this.setup(e)}setupObserver(e){return new r_(e)}setup(e){e.context.setupNormal=()=>Kb(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,n=t.getRenderTarget();e.addStack();const i=Kb(this.setupVertex(e),"VERTEX"),r=this.vertexNode||i;let s;e.stack.outputNode=r,this.setupHardwareClipping(e),null!==this.geometryNode&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();const a=this.setupClipping(e);if(!0!==this.depthWrite&&!0!==this.depthTest||(null!==n?!0===n.depthBuffer&&this.setupDepth(e):!0===t.depth&&this.setupDepth(e)),null===this.fragmentNode){this.setupDiffuseColor(e),this.setupVariants(e);const i=this.setupLighting(e);null!==a&&e.stack.add(a);const r=Yy(i,ov.a).max(0);s=this.setupOutput(e,r),wv.assign(s);const o=null!==this.outputNode;if(o&&(s=this.outputNode),null!==n){const e=t.getMRT(),n=this.mrtNode;null!==e?(o&&wv.assign(s),s=e,null!==n&&(s=e.merge(n))):null!==n&&(s=n)}}else{let t=this.fragmentNode;!0!==t.isOutputStructNode&&(t=Yy(t)),s=this.setupOutput(e,t)}e.stack.outputNode=s,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(null===e.clippingContext)return null;const{unionPlanes:t,intersectionPlanes:n}=e.clippingContext;let i=null;if(t.length>0||n.length>0){const t=e.renderer.samples;this.alphaToCoverage&&t>1?i=Ty(new jE(jE.ALPHA_TO_COVERAGE)):e.stack.add(Ty(new jE))}return i}setupHardwareClipping(e){if(this.hardwareClipping=!1,null===e.clippingContext)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.add(Ty(new jE(jE.HARDWARE))),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:n}=e;let i=this.depthNode;if(null===i){const e=t.getMRT();e&&e.has("depth")?i=e.get("depth"):!0===t.logarithmicDepthBuffer&&(i=n.isPerspectiveCamera?qE(XS.z,dS,pS):FE(XS.z,dS,pS))}null!==i&&kE.assign(i).toStack()}setupPositionView(){return BS.mul(GS).xyz}setupModelViewProjection(){return mS.mul(XS)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),Yw}setupPosition(e){const{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&SE(t).toStack(),!0===t.isSkinnedMesh&&fE(t).toStack(),this.displacementMap){const e=NM("displacementMap","texture"),t=NM("displacementScale","float"),n=NM("displacementBias","float");GS.addAssign(eM.normalize().mul(e.x.mul(t).add(n)))}return t.isBatchedMesh&&lE(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&!0===t.instanceMatrix.isInstancedBufferAttribute&&aE(t).toStack(),null!==this.positionNode&&GS.assign(Kb(this.positionNode,"POSITION","vec3")),GS}setupDiffuseColor({object:e,geometry:t}){null!==this.maskNode&&qy(this.maskNode).not().discard();let n=this.colorNode?Yy(this.colorNode):dw;if(!0===this.vertexColors&&t.hasAttribute("color")&&(n=n.mul(KE())),e.instanceColor){n=av("vec3","vInstanceColor").mul(n)}if(e.isBatchedMesh&&e._colorsTexture){n=av("vec3","vBatchColor").mul(n)}ov.assign(n);const i=this.opacityNode?Fy(this.opacityNode):fw;ov.a.assign(ov.a.mul(i));let r=null;(null!==this.alphaTestNode||this.alphaTest>0)&&(r=null!==this.alphaTestNode?Fy(this.alphaTestNode):hw,ov.a.lessThanEqual(r).discard()),!0===this.alphaHash&&ov.a.lessThan($E(GS)).discard();!1===this.transparent&&1===this.blending&&!1===this.alphaToCoverage?ov.a.assign(1):null===r&&ov.a.lessThanEqual(0).discard()}setupVariants(){}setupOutgoingLight(){return!0===this.lights?jy(0):ov.rgb}setupNormal(){return this.normalNode?jy(this.normalNode):Sw}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?NM("envMap","cubeTexture"):NM("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new RE(Ww)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const i=this.setupLightMap(e);if(i&&i.isLightingNode&&t.push(i),null!==this.aoNode||e.material.aoMap){const e=null!==this.aoNode?this.aoNode:Xw;t.push(new wE(e))}let r=this.lightsNode||e.lightsNode;return t.length>0&&(r=e.renderer.lighting.createNode([...r.getLights(),...t])),r}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:i,emissiveNode:r}=this,s=!0===this.lights||null!==this.lightsNode?this.setupLights(e):null;let a=this.setupOutgoingLight(e);if(s&&s.getScope().hasLights){const t=this.setupLightingModel(e)||null;a=AE(s,t,n,i)}else null!==n&&(a=jy(null!==i?Mb(a,n,i):n));return(r&&!0===r.isNode||t.emissive&&!0===t.emissive.isColor)&&(lv.assign(jy(r||mw)),a=a.add(lv)),a}setupFog(e,t){const n=e.fogNode;return n&&(wv.assign(t),t=Yy(n.toVar())),t}setupPremultipliedAlpha(e,t){return nA(t)}setupOutput(e,t){return!0===this.fog&&(t=this.setupFog(e,t)),!0===this.premultipliedAlpha&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const n in e){const t=e[n];void 0===this[n]&&(this[n]=t,t&&t.clone&&(this[n]=t.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const n in t)void 0===Object.getOwnPropertyDescriptor(this.constructor.prototype,n)&&void 0!==t[n].get&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{},nodes:{}});const n=Mr.prototype.toJSON.call(this,e),i=c_(this);n.inputNodes={};for(const{property:s,childNode:a}of i)n.inputNodes[s]=a.toJSON(e).uuid;function r(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(t){const t=r(e.textures),i=r(e.images),s=r(e.nodes);t.length>0&&(n.textures=t),i.length>0&&(n.images=i),s.length>0&&(n.nodes=s)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,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.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,super.copy(e)}}const sA=new $a;class aA extends rA{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(sA),this.setValues(e)}}const oA=new ru;class lA extends rA{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(oA),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?Fy(this.offsetNode):Gw,t=this.dashScaleNode?Fy(this.dashScaleNode):Vw,n=this.dashSizeNode?Fy(this.dashSizeNode):qw,i=this.gapSizeNode?Fy(this.gapSizeNode):zw;Ev.assign(n),Av.assign(i);const r=Jb(UT("lineDistance").mul(t));(e?r.add(e):r).mod(Ev.add(Av)).greaterThan(Ev).discard()}}let uA=null;class cA extends NE{static get type(){return"ViewportSharedTextureNode"}constructor(e=iS,t=null){null===uA&&(uA=new _o),super(e,t,uA)}getTextureForReference(){return uA}updateReference(){return this}}const hA=Ey(cA).setParameterLength(0,2),dA=e=>Ty(e).mul(.5).add(.5),pA=new Ql;class mA extends rA{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(pA),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?Fy(this.opacityNode):fw;ov.assign(sT(Yy(dA(rM),e),Ht))}}const fA=Py(([e=WS])=>{const t=e.z.atan(e.x).mul(1/(2*Math.PI)).add(.5),n=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return zy(t,n)});class gA extends vs{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,i=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace
vendor: 6,335 bytes, line 1
1=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r=new ss(5,5,5),s=fA(WS),a=new rA;a.colorNode=jT(t,s,0),a.side=1,a.blending=0;const o=new is(r,a),l=new ws;l.add(o),t.minFilter===Le&&(t.minFilter=Pe);const u=new _s(1,10,this),c=e.getMRT();return e.setMRT(null),u.update(e,l),e.setMRT(c),t.minFilter=n,t.currentGenerateMipmaps=i,o.geometry.dispose(),o.material.dispose(),this}}const _A=new WeakMap;class yA extends O_{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=MM(null);const t=new ys;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=M_.RENDER}updateBefore(e){const{renderer:t,material:n}=e,i=this.envNode;if(i.isTextureNode||i.isMaterialReferenceNode){const e=i.isTextureNode?i.value:n[i.property];if(e&&e.isTexture){const n=e.mapping;if(n===Te||n===Se){if(_A.has(e)){const t=_A.get(e);xA(t,e.mapping),this._cubeTexture=t}else{const n=e.image;if(function(e){return null!=e&&e.height>0}(n)){const i=new gA(n.height);i.fromEquirectangularTexture(t,e),xA(i.texture,e.mapping),this._cubeTexture=i.texture,_A.set(e,i.texture),e.addEventListener("dispose",vA)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function vA(e){const t=e.target;t.removeEventListener("dispose",vA);const n=_A.get(t);void 0!==n&&(_A.delete(t),n.dispose())}function xA(e,t){t===Te?e.mapping=xe:t===Se&&(e.mapping=be)}const bA=Ey(yA).setParameterLength(1);class TA extends ME{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=bA(this.envNode)}}class SA extends ME{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=Fy(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class MA{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class wA extends MA{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,n=e.reflectedLight,i=e.irradianceLightMap;n.indirectDiffuse.assign(Yy(0)),i?n.indirectDiffuse.addAssign(i):n.indirectDiffuse.addAssign(Yy(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(ov.rgb)}finish(e){const{material:t,context:n}=e,i=n.outgoingLight,r=e.context.environment;if(r)switch(t.combine){case 0:i.rgb.assign(Mb(i.rgb,i.rgb.mul(r.rgb),vw.mul(xw)));break;case 1:i.rgb.assign(Mb(i.rgb,r.rgb,vw.mul(xw)));break;case 2:i.rgb.addAssign(r.rgb.mul(vw.mul(xw)))}}}const EA=new wr;class AA extends rA{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(EA),this.setValues(e)}setupNormal(){return JS(nM)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new TA(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new SA(Ww)),t}setupOutgoingLight(){return ov.rgb}setupLightingModel(){return new wA}}const RA=Py(({f0:e,f90:t,dotVH:n})=>{const i=n.mul(-5.55473).sub(6.98316).mul(n).exp2();return e.mul(i.oneMinus()).add(t.mul(i))}),CA=Py(e=>e.diffuseColor.mul(1/Math.PI)),NA=Py(({dotNH:e})=>Mv.mul(Fy(.5)).add(1).mul(Fy(1/Math.PI)).mul(e.pow(Mv))),PA=Py(({lightDirection:e})=>{const t=e.add($S).normalize(),n=rM.dot(t).clamp(),i=$S.dot(t).clamp(),r=RA({f0:Tv,f90:1,dotVH:i}),s=Fy(.25),a=NA({dotNH:n});return r.mul(s).mul(a)});class IA extends wA{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const i=rM.dot(e).clamp().mul(t);n.directDiffuse.addAssign(i.mul(CA({diffuseColor:ov.rgb}))),!0===this.specular&&n.directSpecular.addAssign(i.mul(PA({lightDirection:e})).mul(vw))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(n.mul(CA({diffuseColor:ov}))),i.indirectDiffuse.mulAssign(t)}}const LA=new eu;class DA extends rA{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(LA),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new TA(t):null}setupLightingModel(){return new IA(!1)}}const OA=new Zl;class UA extends rA{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(OA),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new TA(t):null}setupLightingModel(){return new IA}setupVariants(){const e=(this.shininessNode?Fy(this.shininessNode):pw).max(1e-4);Mv.assign(e);const t=this.specularNode||gw;Tv.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const FA=Py(e=>{if(!1===e.geometry.hasAttribute("normal"))return Fy(0);const t=nM.dFdx().abs().max(nM.dFdy().abs());return t.x.max(t.y).max(t.z)}),BA=Py(e=>{const{roughness:t}=e,n=FA();let i=t.max(.0525);return i=i.add(n),i=i.min(1),i}),VA=Py(({alpha:e,dotNL:t,dotNV:n})=>{const i=e.pow2(),r=t.mul(i.add(i.oneMinus().mul(n.pow2())).sqrt()),s=n.mul(i.add(i.oneMinus().mul(t.pow2())).sqrt());return ex(.5,r.add(s).max(Mx))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),qA=Py(({alphaT:e,alphaB:t,dotTV:n,dotBV:i,dotTL:r,dotBL:s,dotNV:a,dotNL:o})=>{const l=o.mul(jy(e.mul(n),t.mul(i),a).length()),u=a.mul(jy(e.mul(r),t.mul(s),o).length());return ex(.5,l.add(u)).saturate()}).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"}]}),zA=Py(({alpha:e,dotNH:t})=>{const n=e.pow2(),i=t.pow2().mul(n.oneMinus()).oneMinus();return n.div(i.pow2()).mul(1/Math.PI)}
1).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),kA=Fy(1/Math.PI),GA=Py(({alphaT:e,alphaB:t,dotNH:n,dotTH:i,dotBH:r})=>{const s=e.mul(t),a=jy(t.mul(i),e.mul(r),s.mul(n)),o=a.dot(a),l=s.div(o);return kA.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"}]}),HA=Py(({lightDirection:e,f0:t,f90:n,roughness:i,f:r,normalView:s=rM,USE_IRIDESCENCE:a,USE_ANISOTROPY:o})=>{const l=i.pow2(),u=e.add($S).normalize(),c=s.dot(e).clamp(),h=s.dot($S).clamp(),d=s.dot(u).clamp(),p=$S.dot(u).clamp();let m,f,g=RA({f0:t,f90:n,dotVH:p});if(vy(a)&&(g=fv.mix(g,r)),vy(o)){const t=xv.dot(e),n=xv.dot($S),i=xv.dot(u),r=bv.dot(e),s=bv.dot($S),a=bv.dot(u);m=qA({alphaT:yv,alphaB:l,dotTV:n,dotBV:s,dotTL:t,dotBL:r,dotNV:h,dotNL:c}),f=GA({alphaT:yv,alphaB:l,dotNH:d,dotTH:i,dotBH:a})}else m=VA({alpha:l,dotNL:c,dotNV:h}),f=zA({alpha:l,dotNH:d});return g.mul(m).mul(f)}),jA=Py(({roughness:e,dotNV:t})=>{const n=Yy(-1,-.0275,-.572,.022),i=Yy(1,.0425,1.04,-.04),r=e.mul(n).add(i),s=r.x.mul(r.x).min(t.mul(-9.28).exp2()).mul(r.x).add(r.y);return zy(-1.04,1.04).mul(s).add(r.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),WA=Py(e=>{const{dotNV:t,specularColor:n,specularF90:i,roughness:r}=e,s=jA({dotNV:t,roughness:r});return n.mul(s.x).add(i.mul(s.y))}),XA=Py(({f:e,f90:t,dotVH:n})=>{const i=n.oneMinus().saturate(),r=i.mul(i),s=i.mul(r,r).clamp(0,.9999);return e.sub(jy(t).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"}]}),$A=Py(({roughness:e,dotNH:t})=>{const n=e.pow2(),i=Fy(1).div(n),r=t.pow2().oneMinus().max(.0078125);return Fy(2).add(i).mul(r.pow(i.mul(.5))).div(2*Math.PI)}
vendor: 11,817 bytes, line 1
1).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),YA=Py(({dotNV:e,dotNL:t})=>Fy(1).div(Fy(4).mul(t.add(e).sub(t.mul(e))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),KA=Py(({lightDirection:e})=>{const t=e.add($S).normalize(),n=rM.dot(e).clamp(),i=rM.dot($S).clamp(),r=rM.dot(t).clamp(),s=$A({roughness:mv,dotNH:r}),a=YA({dotNV:i,dotNL:n});return pv.mul(s).mul(a)}),ZA=Py(({N:e,V:t,roughness:n})=>{const i=e.dot(t).saturate(),r=zy(n,i.oneMinus().sqrt());return r.assign(r.mul(.984375).add(.0078125)),r}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),JA=Py(({f:e})=>{const t=e.length();return cb(t.mul(t).add(e.z).div(t.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),QA=Py(({v1:e,v2:t})=>{const n=e.dot(t),i=n.abs().toVar(),r=i.mul(.0145206).add(.4965155).mul(i).add(.8543985).toVar(),s=i.add(4.1616724).mul(i).add(3.417594).toVar(),a=r.div(s),o=n.greaterThan(0).select(a,cb(n.mul(n).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return e.cross(t).mul(o)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),eR=Py(({N:e,V:t,P:n,mInv:i,p0:r,p1:s,p2:a,p3:o})=>{const l=s.sub(r).toVar(),u=o.sub(r).toVar(),c=l.cross(u),h=jy().toVar();return Dy(c.dot(n.sub(r)).greaterThanEqual(0),()=>{const l=t.sub(e.mul(t.dot(e))).normalize(),u=e.cross(l).negate(),c=i.mul(ev(l,u,e).transpose()).toVar(),d=c.mul(r.sub(n)).normalize().toVar(),p=c.mul(s.sub(n)).normalize().toVar(),m=c.mul(a.sub(n)).normalize().toVar(),f=c.mul(o.sub(n)).normalize().toVar(),g=jy(0).toVar();g.addAssign(QA({v1:d,v2:p})),g.addAssign(QA({v1:p,v2:m})),g.addAssign(QA({v1:m,v2:f})),g.addAssign(QA({v1:f,v2:d})),h.assign(jy(JA({f:g})))}),h}).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"}]}),tR=1/6,nR=e=>Qv(tR,Qv(e,Qv(e,e.negate().add(3)).sub(3)).add(1)),iR=e=>Qv(tR,Qv(e,Qv(e,Qv(3,e).sub(6))).add(4)),rR=e=>Qv(tR,Qv(e,Qv(e,Qv(-3,e).add(3)).add(3)).add(1)),sR=e=>Qv(tR,_b(e,3)),aR=e=>nR(e).add(iR(e)),oR=e=>rR(e).add(sR(e)),lR=e=>Zv(-1,iR(e).div(nR(e).add(iR(e)))),uR=e=>Zv(1,sR(e).div(rR(e).add(sR(e)))),cR=(e,t,n)=>{const i=e.uvNode,r=Qv(i,t.zw).add(.5),s=Bx(r),a=zx(r),o=aR(a.x),l=oR(a.x),u=lR(a.x),c=uR(a.x),h=lR(a.y),d=uR(a.y),p=zy(s.x.add(u),s.y.add(h)).sub(.5).mul(t.xy),m=zy(s.x.add(c),s.y.add(h)).sub(.5).mul(t.xy),f=zy(s.x.add(u),s.y.add(d)).sub(.5).mul(t.xy),g=zy(s.x.add(c),s.y.add(d)).sub(.5).mul(t.xy),_=aR(a.y).mul(Zv(o.mul(e.sample(p).level(n)),l.mul(e.sample(m).level(n)))),y=oR(a.y).mul(Zv(o.mul(e.sample(f).level(n)),l.mul(e.sample(g).level(n))));return _.add(y)},hR=Py(([e,t])=>{const n=zy(e.size(By(t))),i=zy(e.size(By(t.add(1)))),r=ex(1,n),s=ex(1,i),a=cR(e,Yy(r,n),Bx(t)),o=cR(e,Yy(s,i),Vx(t));return zx(t).mix(a,o)}),dR=Py(([e,t])=>{const n=t.mul(zT(e));return hR(e,n)}),pR=Py(([e,t,n,i,r])=>{const s=jy(Ab(t.negate(),qx(e),ex(1,i))),a=jy(Kx(r[0].xyz),Kx(r[1].xyz),Kx(r[2].xyz));return qx(s).mul(n.mul(a))}).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"}]}),mR=Py(([e,t])=>e.mul(wb(t.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),fR=IE(),gR=IE(),_R=Py(([e,t,n],{material:i})=>{const r=(1===i.side?fR:gR).sample(e),s=Ox(rS.x).mul(mR(t,n));return hR(r,s)}),yR=Py(([e,t,n])=>(Dy(n.notEqual(0),()=>{const i=Dx(t).negate().div(n);return Ix(i.negate().mul(e))}),jy(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),vR=Py(([e,t,n,i,r,s,a,o,l,u,c,h,d,p,m])=>{let f,g;if(m){f=Yy().toVar(),g=jy().toVar();const r=c.sub(1).mul(m.mul(.025)),s=jy(c.sub(r),c,c.add(r));_E({start:0,end:3},({i:r})=>{const c=s.element(r),m=pR(e,t,h,c,o),_=a.add(m),y=u.mul(l.mul(Yy(_,1))),v=zy(y.xy.div(y.w)).toVar();v.addAssign(1),v.divAssign(2),v.assign(zy(v.x,v.y.oneMinus()));const x=_R(v,n,c);f.element(r).assign(x.element(r)),f.a.addAssign(x.a),g.element(r).assign(i.element(r).mul(yR(Kx(m),d,p).element(r)))}),f.a.divAssign(3)}else{const r=pR(e,t,h,c,o),s=a.add(r),m=u.mul(l.mul(Yy(s,1))),_=zy(m.xy.div(m.w)).toVar();_.addAssign(1),_.divAssign(2),_.assign(zy(_.x,_.y.oneMinus())),f=_R(_,n,c),g=i.mul(yR(Kx(r),d,p))}const _=g.rgb.mul(f.rgb),y=e.dot(t).clamp(),v=jy(WA({dotNV:y,specularColor:r,specularF90:s,roughness:n})),x=g.r.add(g.g,g.b).div(3);return Yy(v.oneMinus().mul(_),f.a.oneMinus().mul(x).oneMinus())}),xR=ev(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),bR=(e,t)=>e.sub(t).div(e.add(t)).pow2(),TR=Py(({outsideIOR:e,eta2:t,cosTheta1:n,thinFilmThickness:i,baseF0:r})=>{const s=Mb(e,t,Rb(0,.03,i)),a=e.div(s).pow2().mul(n.pow2().oneMinus()).oneMinus();Dy(a.lessThan(0),()=>jy(1));const o=a.sqrt(),l=bR(s,e),u=RA({f0:l,f90:1,dotVH:n}),c=u.oneMinus(),h=s.lessThan(e).select(Math.PI,0),d=Fy(Math.PI).sub(h),p=(e=>{const t=e.sqrt();return jy(1).add(t).div(jy(1).sub(t))})(r.clamp(0,.9999)),m=bR(p,s.toVec3()),f=RA({f0:m,f90:1,dotVH:o}),g=jy(p.x.lessThan(s).select(Math.PI,0),p.y.lessThan(s).select(Math.PI,0),p.z.lessThan(s).select(Math.PI,0)),_=s.mul(i,o,2),y=jy(d).add(g),v=u.mul(f).clamp(1e-5,.9999),x=v.sqrt(),b=c.pow2().mul(f).div(jy(1).sub(v)),T=u.add(b).toVar(),S=b.sub(c).toVar();return _E({start:1,end:2,condition:"<=",name:"m"},({m:e})=>{S.mulAssign(x);const t=((e,t)=>{const n=e.mul(2*Math.PI*1e-9),i=jy(54856e-17,44201e-17,52481e-17),r=jy(1681e3,1795300,2208400),s=jy(43278e5,93046e5,66121e5),a=Fy(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(n.mul(2239900).add(t.x).cos()).mul(n.pow2().mul(-45282e5).exp());let o=i.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(n).add(t).cos()).mul(n.pow2().negate().mul(s).exp());return o=jy(o.x.add(a),o.y,o.z).div(1.0685e-7),xR.mul(o)})(Fy(e).mul(_),Fy(e).mul(y)).mul(2);T.addAssign(S.mul(t))}),T.max(jy(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"}]}),SR=Py(({normal:e,viewDir:t,roughness:n})=>{const i=e.dot(t).saturate(),r=n.pow2(),s=Bb(n.lessThan(.25),Fy(-339.2).mul(r).add(Fy(161.4).mul(n)).sub(25.9),Fy(-8.48).mul(r).add(Fy(14.3).mul(n)).sub(9.95)),a=Bb(n.lessThan(.25),Fy(44).mul(r).sub(Fy(23.7).mul(n)).add(3.26),Fy(1.97).mul(r).sub(Fy(3.27).mul(n)).add(.72));return Bb(n.lessThan(.25),0,Fy(.1).mul(n).sub(.025)).add(s.mul(i).add(a).exp()).mul(1/Math.PI).saturate()}),MR=jy(.04),wR=Fy(1);class ER extends MA{constructor(e=!1,t=!1,n=!1,i=!1,r=!1,s=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=i,this.transmission=r,this.dispersion=s,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null}start(e){if(!0===this.clearcoat&&(this.clearcoatRadiance=jy().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=jy().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=jy().toVar("clearcoatSpecularIndirect")),!0===this.sheen&&(this.sheenSpecularDirect=jy().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=jy().toVar("sheenSpecularIndirect")),!0===this.iridescence){const e=rM.dot($S).clamp();this.iridescenceFresnel=TR({outsideIOR:Fy(1),eta2:gv,cosTheta1:e,thinFilmThickness:_v,baseF0:Tv}),this.iridescenceF0=XA({f:this.iridescenceFresnel,f90:1,dotVH:e})}if(!0===this.transmission){const t=jS,n=vS.sub(jS).normalize(),i=sM,r=e.context;r.backdrop=vR(i,n,uv,ov,Tv,Sv,t,PS,gS,mS,Cv,Pv,Lv,Iv,this.dispersion?Dv:null),r.backdropAlpha=Nv,ov.a.mulAssign(Mb(1,r.backdrop.a,Nv))}super.start(e)}computeMultiscattering(e,t,n){const i=rM.dot($S).clamp(),r=jA({roughness:uv,dotNV:i}),s=(this.iridescenceF0?fv.mix(Tv,this.iridescenceF0):Tv).mul(r.x).add(n.mul(r.y)),a=r.x.add(r.y).oneMinus(),o=Tv.add(Tv.oneMinus().mul(.047619)),l=s.mul(o).div(a.mul(o).oneMinus());e.addAssign(s),t.addAssign(l.mul(a))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const i=rM.dot(e).clamp().mul(t);if(!0===this.sheen&&this.sheenSpecularDirect.addAssign(i.mul(KA({lightDirection:e}))),!0===this.clearcoat){const n=aM.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(n.mul(HA({lightDirection:e,f0:MR,f90:wR,roughness:dv,normalView:aM})))}n.directDiffuse.addAssign(i.mul(CA({diffuseColor:ov.rgb}))),n.directSpecular.addAssign(i.mul(HA({lightDirection:e,f0:Tv,f90:1,roughness:uv,iridescence:this.iridescence,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:i,reflectedLight:r,ltc_1:s,ltc_2:a}){const o=t.add(n).sub(i),l=t.sub(n).sub(i),u=t.sub(n).add(i),c=t.add(n).add(i),h=rM,d=$S,p=XS.toVar(),m=ZA({N:h,V:d,roughness:uv}),f=s.sample(m).toVar(),g=a.sample(m).toVar(),_=ev(jy(f.x,0,f.y),jy(0,1,0),jy(f.z,0,f.w)).toVar(),y=Tv.mul(g.x).add(Tv.oneMinus().mul(g.y)).toVar();r.directSpecular.addAssign(e.mul(y).mul(eR({N:h,V:d,P:p,mInv:_,p0:o,p1:l,p2:u,p3:c}))),r.directDiffuse.addAssign(e.mul(ov).mul(eR({N:h,V:d,P:p,mInv:ev(1,0,0,0,1,0,0,0,1),p0:o,p1:l,p2:u,p3:c})))}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:n}=e.context;n.indirectDiffuse.addAssign(t.mul(CA({diffuseColor:ov})))}indirectSpecular(e){const{radiance:t,iblIrradiance:n,reflectedLight:i}=e.context;if(!0===this.sheen&&this.sheenSpecularIndirect.addAssign(n.mul(pv,SR({normal:rM,viewDir:$S,roughness:mv}))),!0===this.clearcoat){const e=aM.dot($S).clamp(),t=WA({dotNV:e,specularColor:MR,specularF90:wR,roughness:dv});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(t))}const r=jy().toVar("singleScattering"),s=jy().toVar("multiScattering"),a=n.mul(1/Math.PI);this.computeMultiscattering(r,s,Sv);const o=r.add(s),l=ov.mul(o.r.max(o.g).max(o.b).oneMinus());i.indirectSpecular.addAssign(t.mul(r)),i.indirectSpecular.addAssign(s.mul(a)),i.indirectDiffuse.addAssign(l.mul(a))}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:n}=e.context,i=rM.dot($S).clamp().add(t),r=uv.mul(-16).oneMinus().negate().exp2(),s=t.sub(i.pow(r).oneMinus()).clamp();!0===this.clearcoat&&this.clearcoatSpecularIndirect.mulAssign(t),!0===this.sheen&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(s)}finish({context:e}){const{outgoingLight:t}=e;if(!0===this.clearcoat){const e=aM.dot($S).clamp(),n=RA({dotVH:e,f0:MR,f90:wR}),i=t.mul(hv.mul(n).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(hv));t.assign(i)}if(!0===this.sheen){const e=pv.r.max(pv.g).max(pv.b).mul(.157).oneMinus(),n=t.mul(e).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(n)}}}const AR=Fy(1),RR=Fy(-2),CR=Fy(.8),NR=Fy(-1),PR=Fy(.4),IR=Fy(2),LR=Fy(.305),DR=Fy(3),OR=Fy(.21),UR=Fy(4),FR=Fy(4),BR=Fy(16),VR=Py(([e])=>{const t=jy($x(e)).toVar(),n=Fy(-1).toVar();return Dy(t.x.greaterThan(t.z),()=>{Dy(t.x.greaterThan(t.y),()=>{n.assign(Bb(e.x.greaterThan(0),0,3))}).Else(()=>{n.assign(Bb(e.y.greaterThan(0),1,4))})}).Else(()=>{Dy(t.z.greaterThan(t.y),()=>{n.assign(Bb(e.z.greaterThan(0),2,5))}).Else(()=>{n.assign(Bb(e.y.greaterThan(0),1,4))})}),n}
vendor: 8,733 bytes, line 1
1).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),qR=Py(([e,t])=>{const n=zy().toVar();return Dy(t.equal(0),()=>{n.assign(zy(e.z,e.y).div($x(e.x)))}).ElseIf(t.equal(1),()=>{n.assign(zy(e.x.negate(),e.z.negate()).div($x(e.y)))}).ElseIf(t.equal(2),()=>{n.assign(zy(e.x.negate(),e.y).div($x(e.z)))}).ElseIf(t.equal(3),()=>{n.assign(zy(e.z.negate(),e.y).div($x(e.x)))}).ElseIf(t.equal(4),()=>{n.assign(zy(e.x.negate(),e.z).div($x(e.y)))}).Else(()=>{n.assign(zy(e.x,e.y).div($x(e.z)))}),Qv(.5,n.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),zR=Py(([e])=>{const t=Fy(0).toVar();return Dy(e.greaterThanEqual(CR),()=>{t.assign(AR.sub(e).mul(NR.sub(RR)).div(AR.sub(CR)).add(RR))}).ElseIf(e.greaterThanEqual(PR),()=>{t.assign(CR.sub(e).mul(IR.sub(NR)).div(CR.sub(PR)).add(NR))}).ElseIf(e.greaterThanEqual(LR),()=>{t.assign(PR.sub(e).mul(DR.sub(IR)).div(PR.sub(LR)).add(IR))}).ElseIf(e.greaterThanEqual(OR),()=>{t.assign(LR.sub(e).mul(UR.sub(DR)).div(LR.sub(OR)).add(DR))}).Else(()=>{t.assign(Fy(-2).mul(Ox(Qv(1.16,e))))}),t}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),kR=Py(([e,t])=>{const n=e.toVar();n.assign(Qv(2,n).sub(1));const i=jy(n,1).toVar();return Dy(t.equal(0),()=>{i.assign(i.zyx)}).ElseIf(t.equal(1),()=>{i.assign(i.xzy),i.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{i.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{i.assign(i.zyx),i.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{i.assign(i.xzy),i.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{i.z.mulAssign(-1)}),i}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),GR=Py(([e,t,n,i,r,s])=>{const a=Fy(n),o=jy(t),l=wb(zR(a),RR,s),u=zx(l),c=Bx(l),h=jy(HR(e,o,c,i,r,s)).toVar();return Dy(u.notEqual(0),()=>{const t=jy(HR(e,o,c.add(1),i,r,s)).toVar();h.assign(Mb(h,t,u))}),h}),HR=Py(([e,t,n,i,r,s])=>{const a=Fy(n).toVar(),o=jy(t),l=Fy(VR(o)).toVar(),u=Fy(cb(FR.sub(a),0)).toVar();a.assign(cb(a,FR));const c=Fy(Lx(a)).toVar(),h=zy(qR(o,l).mul(c.sub(2)).add(1)).toVar();return Dy(l.greaterThan(2),()=>{h.y.addAssign(c),l.subAssign(3)}),h.x.addAssign(l.mul(c)),h.x.addAssign(u.mul(Qv(3,BR))),h.y.addAssign(Qv(4,Lx(s).sub(c))),h.x.mulAssign(i),h.y.mulAssign(r),e.sample(h).grad(zy(),zy())}),jR=Py(({envMap:e,mipInt:t,outputDirection:n,theta:i,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const l=Gx(i),u=n.mul(l).add(r.cross(n).mul(kx(i))).add(r.mul(r.dot(n).mul(l.oneMinus())));return HR(e,u,t,s,a,o)}),WR=Py(({n:e,latitudinal:t,poleAxis:n,outputDirection:i,weights:r,samples:s,dTheta:a,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:c,CUBEUV_MAX_MIP:h})=>{const d=jy(Bb(t,n,gb(n,i))).toVar();Dy(d.equal(jy(0)),()=>{d.assign(jy(i.z,0,i.x.negate()))}),d.assign(qx(d));const p=jy().toVar();return p.addAssign(r.element(0).mul(jR({theta:0,axis:d,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:c,CUBEUV_MAX_MIP:h}))),_E({start:By(1),end:e},({i:e})=>{Dy(e.greaterThanEqual(s),()=>{yE()});const t=Fy(a.mul(Fy(e))).toVar();p.addAssign(r.element(e).mul(jR({theta:t.mul(-1),axis:d,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:c,CUBEUV_MAX_MIP:h}))),p.addAssign(r.element(e).mul(jR({theta:t,axis:d,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:c,CUBEUV_MAX_MIP:h})))}),Yy(p,1)}),XR=[.125,.215,.35,.446,.526,.582],$R=20,YR=new Xu(-1,1,1,-1,0,1),KR=new fs(90,1),ZR=new br;let JR=null,QR=0,eC=0;const tC=(1+Math.sqrt(5))/2,nC=1/tC,iC=[new wn(-tC,nC,0),new wn(tC,nC,0),new wn(-nC,0,tC),new wn(nC,0,tC),new wn(0,tC,-nC),new wn(0,tC,nC),new wn(-1,1,-1),new wn(1,1,-1),new wn(-1,1,1),new wn(1,1,1)],rC=new wn,sC=new WeakMap,aC=[3,1,5,0,4,2],oC=kR(FT(),UT("faceIndex")).normalize(),lC=jy(oC.x,oC.y,oC.z);class uC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,i=100,r={}){const{size:s=256,position:a=rC,renderTarget:o=null}=r;if(this._setSize(s),!1===this._hasInitialized){const s=o||this._allocateTarget();return r.renderTarget=s,this.fromSceneAsync(e,t,n,i,r),s}JR=this._renderer.getRenderTarget(),QR=this._renderer.getActiveCubeFace(),eC=this._renderer.getActiveMipmapLevel();const l=o||this._allocateTarget();return l.depthBuffer=!0,this._init(l),this._sceneToCubeUV(e,n,i,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}async fromSceneAsync(e,t=0,n=.1,i=100,r={}){return!1===this._hasInitialized&&await this._renderer.init(),this.fromScene(e,t,n,i,r)}fromEquirectangular(e,t=null){if(!1===this._hasInitialized){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!1===this._hasInitialized&&await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(!1===this._hasInitialized){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!1===this._hasInitialized&&await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=pC(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=mC(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===xe||e.mapping===be?this._setSize(0===e.image.length?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(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(JR,QR,eC),e.scissorTest=!1,hC(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),JR=this._renderer.getRenderTarget(),QR=this._renderer.getActiveCubeFace(),eC=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTarget();return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(){return cC(3*Math.max(this._cubeSize,112),4*this._cubeSize)}_init(e){if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=cC(e.width,e.height);const{_lodMax:t}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas,lodMeshes:this._lodMeshes}=function(e){const t=[],n=[],i=[],r=[];let s=e;const a=e-4+1+XR.length;for(let o=0;o<a;o++){const a=Math.pow(2,s);n.push(a);let l=1/a;o>e-4?l=XR[o-e+4-1]:0===o&&(l=0),i.push(l);const u=1/(a-2),c=-u,h=1+u,d=[c,c,h,c,h,h,c,c,h,h,c,h],p=6,m=6,f=3,g=2,_=1,y=new Float32Array(f*m*p),v=new Float32Array(g*m*p),x=new Float32Array(_*m*p);for(let e=0;e<p;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0],r=aC[e];y.set(i,f*m*r),v.set(d,g*m*r);const s=[r,r,r,r,r,r];x.set(s,_*m*r)}const b=new jr;b.setAttribute("position",new Lr(y,f)),b.setAttribute("uv",new Lr(v,g)),b.setAttribute("faceIndex",new Lr(x,_)),t.push(b),r.push(new is(b,null)),s>4&&s--}return{lodPlanes:t,sizeLods:n,sigmas:i,lodMeshes:r}}(t)),this._blurMaterial=function(e,t,n){const i=ZT(new Array($R).fill(0)),r=kv(new wn(0,1,0)),s=kv(0),a=Fy($R),o=kv(0),l=kv(1),u=jT(null),c=kv(0),h=Fy(1/t),d=Fy(1/n),p=Fy(e),m={n:a,latitudinal:o,weights:i,poleAxis:r,outputDirection:lC,dTheta:s,samples:l,envMap:u,mipInt:c,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:p},f=dC("blur");return f.fragmentNode=WR({...m,latitudinal:o.equal(1)}),sC.set(f,m),f}(t,e.width,e.height)}}async _compileMaterial(e){const t=new is(this._lodPlanes[0],e);await this._renderer.compile(t,YR)}_sceneToCubeUV(e,t,n,i,r){const s=KR;s.near=t,s.far=n;const a=[1,1,1,1,-1,1],o=[1,-1,1,-1,1,-1],l=this._renderer,u=l.autoClear;l.getClearColor(ZR),l.autoClear=!1;let c=this._backgroundBox;
vendor: 9,932 bytes, line 1
1if(null===c){const e=new wr({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1});c=new is(new ss,e)}let h=!1;const d=e.background;d?d.isColor&&(c.material.color.copy(d),e.background=null,h=!0):(c.material.color.copy(ZR),h=!0),l.setRenderTarget(i),l.clear(),h&&l.render(c,s);for(let p=0;p<6;p++){const t=p%3;0===t?(s.up.set(0,a[p],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x+o[p],r.y,r.z)):1===t?(s.up.set(0,0,a[p]),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y+o[p],r.z)):(s.up.set(0,a[p],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y,r.z+o[p]));const n=this._cubeSize;hC(i,t*n,p>2?n:0,n,n),l.render(e,s)}l.autoClear=u,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===xe||e.mapping===be;i?null===this._cubemapMaterial&&(this._cubemapMaterial=pC(e)):null===this._equirectMaterial&&(this._equirectMaterial=mC(e));const r=i?this._cubemapMaterial:this._equirectMaterial;r.fragmentNode.value=e;const s=this._lodMeshes[0];s.material=r;const a=this._cubeSize;hC(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,YR)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let r=1;r<i;r++){const t=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),n=iC[(i-r-1)%iC.length];this._blur(e,r-1,r,t,n)}t.autoClear=n}_blur(e,t,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,a){const o=this._renderer,l=this._blurMaterial,u=this._lodMeshes[i];u.material=l;const c=sC.get(l),h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,m=isFinite(r)?1+Math.floor(3*p):$R,f=[];let g=0;for(let v=0;v<$R;++v){const e=v/p,t=Math.exp(-e*e/2);f.push(t),0===v?g+=t:v<m&&(g+=2*t)}for(let v=0;v<f.length;v++)f[v]=f[v]/g;e.texture.frame=(e.texture.frame||0)+1,c.envMap.value=e.texture,c.samples.value=m,c.weights.array=f,c.latitudinal.value="latitudinal"===s?1:0,a&&(c.poleAxis.value=a);const{_lodMax:_}=this;c.dTheta.value=d,c.mipInt.value=_-n;const y=this._sizeLods[i];hC(t,3*y*(i>_-4?i-_+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(t),o.render(u,YR)}}function cC(e,t){const n=new Jn(e,t,{magFilter:Pe,minFilter:Pe,generateMipmaps:!1,type:ze,format:Ye,colorSpace:jt});return n.texture.mapping=Me,n.texture.name="PMREM.cubeUv",n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function hC(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function dC(e){const t=new rA;return t.depthTest=!1,t.depthWrite=!1,t.blending=0,t.name=`PMREM_${e}`,t}function pC(e){const t=dC("cubemap");return t.fragmentNode=MM(e,lC),t}function mC(e){const t=dC("equirect");return t.fragmentNode=jT(e,fA(lC),0),t}const fC=new WeakMap;function gC(e,t,n){const i=function(e){let t=fC.get(e);void 0===t&&(t=new WeakMap,fC.set(e,t));return t}(t);let r=i.get(e);if((void 0!==r?r.pmremVersion:-1)!==e.pmremVersion){const t=e.image;if(e.isCubeTexture){if(!function(e){if(null==e)return!1;let t=0;const n=6;for(let i=0;i<n;i++)void 0!==e[i]&&t++;return t===n}(t))return null;r=n.fromCubemap(e,r)}else{if(!function(e){return null!=e&&e.height>0}(t))return null;r=n.fromEquirectangular(e,r)}r.pmremVersion=e.pmremVersion,i.set(e,r)}return r.texture}class _C extends O_{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 i=new Kn;i.isRenderTargetTexture=!0,this._texture=jT(i),this._width=kv(0),this._height=kv(0),this._maxMip=kv(0),this.updateBeforeType=M_.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=function(e){const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}(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,i=this._value;n!==i.pmremVersion&&(t=!0===i.isPMREMTexture?i:gC(i,e.renderer,this._generator),null!==t&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){null===this._generator&&(this._generator=new uC(e.renderer)),this.updateBefore(e);let t=this.uvNode;null===t&&e.context.getUV&&(t=e.context.getUV(this)),t=gM.mul(jy(t.x,t.y.negate(),t.z));let n=this.levelNode;return null===n&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),GR(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),null!==this._generator&&this._generator.dispose()}}const yC=Ey(_C).setParameterLength(1,3),vC=new WeakMap;class xC extends ME{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 e=n.isTextureNode?n.value:t[n.property];let i=vC.get(e);void 0===i&&(i=yC(e),vC.set(e,i)),n=i}const i=!0===t.useAnisotropy||t.anisotropy>0?nw:rM,r=n.context(bC(uv,i)).mul(fM),s=n.context(TC(sM)).mul(Math.PI).mul(fM),a=TT(r),o=TT(s);e.context.radiance.addAssign(a),e.context.iblIrradiance.addAssign(o);const l=e.context.lightingModel.clearcoatRadiance;if(l){const e=n.context(bC(dv,aM)).mul(fM),t=TT(e);l.addAssign(t)}}}const bC=(e,t)=>{let n=null;return{getUV:()=>(null===n&&(n=$S.negate().reflect(t),n=e.mul(e).mix(n,t).normalize(),n=n.transformDirection(gS)),n),getTextureLevel:()=>e}},TC=e=>({getUV:()=>e,getTextureLevel:()=>Fy(1)}),SC=new Yl;class MC extends rA{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(SC),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return null===t&&e.environmentNode&&(t=e.environmentNode),t?new xC(t):null}setupLightingModel(){return new ER}setupSpecular(){const e=Mb(jy(.04),ov.rgb,cv);Tv.assign(e),Sv.assign(1)}setupVariants(){const e=this.metalnessNode?Fy(this.metalnessNode):Tw;cv.assign(e);let t=this.roughnessNode?Fy(this.roughnessNode):bw;t=BA({roughness:t}),uv.assign(t),this.setupSpecular(),ov.assign(Yy(ov.rgb.mul(e.oneMinus()),ov.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const wC=new Kl;class EC extends MC{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(wC),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||null!==this.clearcoatNode}get useIridescence(){return this.iridescence>0||null!==this.iridescenceNode}get useSheen(){return this.sheen>0||null!==this.sheenNode}get useAnisotropy(){return this.anisotropy>0||null!==this.anisotropyNode}get useTransmission(){return this.transmission>0||null!==this.transmissionNode}get useDispersion(){return this.dispersion>0||null!==this.dispersionNode}setupSpecular(){const e=this.iorNode?Fy(this.iorNode):Uw;Cv.assign(e),Tv.assign(Mb(ub(yb(Cv.sub(1).div(Cv.add(1))).mul(yw),jy(1)).mul(_w),ov.rgb,cv)),Sv.assign(Mb(_w,1,cv))}setupLightingModel(){return new ER(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const e=this.clearcoatNode?Fy(this.clearcoatNode):Mw,t=this.clearcoatRoughnessNode?Fy(this.clearcoatRoughnessNode):ww;hv.assign(e),dv.assign(BA({roughness:t}))}if(this.useSheen){const e=this.sheenNode?jy(this.sheenNode):Rw,t=this.sheenRoughnessNode?Fy(this.sheenRoughnessNode):Cw;pv.assign(e),mv.assign(t)}if(this.useIridescence){const e=this.iridescenceNode?Fy(this.iridescenceNode):Pw,t=this.iridescenceIORNode?Fy(this.iridescenceIORNode):Iw,n=this.iridescenceThicknessNode?Fy(this.iridescenceThicknessNode):Lw;fv.assign(e),gv.assign(t),_v.assign(n)}if(this.useAnisotropy){const e=(this.anisotropyNode?zy(this.anisotropyNode):Nw).toVar();vv.assign(e.length()),Dy(vv.equal(0),()=>{e.assign(zy(1,0))}).Else(()=>{e.divAssign(zy(vv)),vv.assign(vv.saturate())}),yv.assign(vv.pow2().mix(uv.pow2(),1)),xv.assign(ew[0].mul(e.x).add(ew[1].mul(e.y))),bv.assign(ew[1].mul(e.x).sub(ew[0].mul(e.y)))}if(this.useTransmission){const e=this.transmissionNode?Fy(this.transmissionNode):Dw,t=this.thicknessNode?Fy(this.thicknessNode):Ow,n=this.attenuationDistanceNode?Fy(this.attenuationDistanceNode):Fw,i=this.attenuationColorNode?jy(this.attenuationColorNode):Bw;if(Nv.assign(e),Pv.assign(t),Iv.assign(n),Lv.assign(i),this.useDispersion){const e=this.dispersionNode?Fy(this.dispersionNode):jw;Dv.assign(e)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?jy(this.clearcoatNormalNode):Ew}setup(e){e.context.setupClearcoatNormal=()=>Kb(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.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dis
vendor: 27,600 bytes, line 1
1persionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}const AC=Py(({normal:e,lightDirection:t,builder:n})=>{const i=e.dot(t),r=zy(i.mul(.5).add(.5),0);if(n.material.gradientMap){const e=NM("gradientMap","texture").context({getUV:()=>r});return jy(e.r)}{const e=r.fwidth().mul(.5);return Mb(jy(.7),jy(1),Rb(Fy(.7).sub(e.x),Fy(.7).add(e.x),r.x))}});class RC extends MA{direct({lightDirection:e,lightColor:t,reflectedLight:n},i){const r=AC({normal:QS,lightDirection:e,builder:i}).mul(t);n.directDiffuse.addAssign(r.mul(CA({diffuseColor:ov.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(n.mul(CA({diffuseColor:ov}))),i.indirectDiffuse.mulAssign(t)}}const CC=new Jl;class NC extends rA{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(CC),this.setValues(e)}setupLightingModel(){return new RC}}const PC=Py(()=>{const e=jy($S.z,0,$S.x.negate()).normalize(),t=$S.cross(e);return zy(e.dot(rM),t.dot(rM)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),IC=new iu;class LC extends rA{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(IC),this.setValues(e)}setupVariants(e){const t=PC;let n;n=e.material.matcap?NM("matcap","texture").context({getUV:()=>t}):jy(Mb(.2,.8,t.y)),ov.rgb.mulAssign(n.rgb)}}class DC extends O_{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("vec2"===this.getNodeType(e)){const e=t.cos(),i=t.sin();return Qy(e,i,i.negate(),e).mul(n)}{const e=t,i=tv(Yy(1,0,0,0),Yy(0,Gx(e.x),kx(e.x).negate(),0),Yy(0,kx(e.x),Gx(e.x),0),Yy(0,0,0,1)),r=tv(Yy(Gx(e.y),0,kx(e.y),0),Yy(0,1,0,0),Yy(kx(e.y).negate(),0,Gx(e.y),0),Yy(0,0,0,1)),s=tv(Yy(Gx(e.z),kx(e.z).negate(),0,0),Yy(kx(e.z),Gx(e.z),0,0),Yy(0,0,1,0),Yy(0,0,0,1));return i.mul(r).mul(s).mul(Yy(n,1)).xyz}}}const OC=Ey(DC).setParameterLength(2),UC=new Cs;class FC extends rA{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(UC),this.setValues(e)}setupPositionView(e){const{object:t,camera:n}=e,{positionNode:i,rotationNode:r,scaleNode:s,sizeAttenuation:a}=this,o=BS.mul(jy(i||0));let l=zy(PS[0].xyz.length(),PS[1].xyz.length());null!==s&&(l=l.mul(zy(s))),n.isPerspectiveCamera&&!1===a&&(l=l.mul(o.z.negate()));let u=kS.xy;if(t.center&&!0===t.center.isVector2){const e=((e,t,n)=>Ty(new oT(e,t,n)))("center","vec2",t);u=u.sub(e.sub(.5))}u=u.mul(l);const c=Fy(r||Aw),h=OC(u,c);return Yy(o.xy.add(h),o.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 BC=new lo,VC=new Sn;class qC extends FC{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(BC),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return BS.mul(jy(e||GS)).xyz}setupVertexSprite(e){const{material:t,camera:n}=e,{rotationNode:i,scaleNode:r,sizeNode:s,sizeAttenuation:a}=this;let o=super.setupVertex(e);if(!0!==t.isNodeMaterial)return o;let l=null!==s?zy(s):Hw;l=l.mul(nS),n.isPerspectiveCamera&&!0===a&&(l=l.mul(zC.div(XS.z.negate()))),r&&r.isNode&&(l=l.mul(zy(r)));let u=kS.xy;if(i&&i.isNode){const e=Fy(i);u=OC(u,e)}return u=u.mul(l),u=u.div(oS.div(2)),u=u.mul(o.w),o=o.add(Yy(u,0,0)),o}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 zC=kv(1).onFrameUpdate(function({renderer:e}){const t=e.getSize(VC);this.value=.5*t.y});class kC extends MA{constructor(){super(),this.shadowNode=Fy(1).toVar("shadowMask")}direct({lightNode:e}){null!==e.shadowNode&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){ov.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(ov.rgb)}}const GC=new Xl;class HC extends rA{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(GC),this.setValues(e)}setupLightingModel(){return new kC}}sv("vec3"),sv("vec3"),sv("vec3");class jC{constructor(e,t){this.nodes=e,this.info=t,this._context="undefined"!=typeof self?self:null,this._animationLoop=null,this._requestId=null}start(){const e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),!0===this.info.autoReset&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,null!==this._animationLoop&&this._animationLoop(t,n)};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 WC{constructor(){this.weakMap=new WeakMap}get(e){let t=this.weakMap;for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),void 0===t)return;return t.get(e[e.length-1])}set(e,t){let n=this.weakMap;for(let i=0;i<e.length-1;i++){const t=e[i];!1===n.has(t)&&n.set(t,new WeakMap),n=n.get(t)}return n.set(e[e.length-1],t),this}delete(e){let t=this.weakMap;for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),void 0===t)return!1;return t.delete(e[e.length-1])}}let XC=0;class $C{constructor(e,t,n,i,r,s,a,o,l,u){this.id=XC++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=i,this.material=r,this.scene=s,this.camera=a,this.lightsNode=o,this.context=l,this.geometry=i.geometry,this.version=r.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=u,this.clippingContextCacheKey=null!==u?u.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 null!==this.clippingContext&&this.clippingContext.cacheKey!==this.clippingContextCacheKey&&(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return!0===this.material.hardwareClipping?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)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(null!==this.attributes)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],i=new Set,r={};for(const s of e){let e;if(s.node&&s.node.attribute?e=s.node.attribute:(e=t.getAttribute(s.name),r[s.name]=e.version),void 0===e)continue;n.push(e);const a=e.isInterleavedBufferAttribute?e.data:e;i.add(a)}return this.attributes=n,this.attributesId=r,this.vertexBuffers=Array.from(i.values()),n}getVertexBuffers(){return null===this.vertexBuffers&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:n,group:i,drawRange:r}=this,s=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),o=null!==a;let l=1;if(!0===n.isInstancedBufferGeometry?l=n.instanceCount:void 0!==e.count&&(l=Math.max(0,e.count)),0===l)return null;if(s.instanceCount=l,!0===e.isBatchedMesh)return s;let u=1;!0!==t.wireframe||e.isPoints||e.isLineSegments||e.isLine||e.isLineLoop||(u=2);let c=r.start*u,h=(r.start+r.count)*u;null!==i&&(c=Math.max(c,i.start*u),h=Math.min(h,(i.start+i.count)*u));const d=n.attributes.position;let p=1/0;o?p=a.count:null!=d&&(p=d.count),c=Math.max(c,0),h=Math.min(h,p);const m=h-c;return m<0||m===1/0?null:(s.vertexCount=m,s.firstVertex=c,s)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const n of Object.keys(e.attributes).sort()){const i=e.attributes[n];t+=n+",",i.data&&(t+=i.data.stride+","),i.offset&&(t+=i.offset+","),i.itemSize&&(t+=i.itemSize+","),i.normalized&&(t+="n,")}for(const n of Object.keys(e.morphAttributes).sort()){const i=e.morphAttributes[n];t+="morph-"+n+",";for(let e=0,n=i.length;e<n;e++){t+=i[e].id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){const{object:e,material:t,renderer:n}=this;let i=t.customProgramCacheKey();for(const r of function(e){const t=Object.keys(e);let n=Object.getPrototypeOf(e);for(;n;){const e=Object.getOwnPropertyDescriptors(n);for(const n in e)if(void 0!==e[n]){const i=e[n];i&&"function"==typeof i.get&&t.push(n)}n=Object.getPrototypeOf(n)}return t}(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(r))continue;const e=t[r];let s;if(null!==e){const t=typeof e;"number"===t?s=0!==e?"1":"0":"object"===t?(s="{",e.isTexture&&(s+=e.mapping,!0===n.backend.isWebGPUBackend&&(s+=e.magFilter,s+=e.minFilter,s+=e.wrapS,s+=e.wrapT,s+=e.wrapR)),s+="}"):s=String(e)}else s=String(e);i+=s+","}return i+=this.clippingContextCacheKey+",",e.geometry&&(i+=this.getGeometryCacheKey()),e.skeleton&&(i+=e.skeleton.bones.length+","),e.isBatchedMesh&&(i+=e._matricesTexture.uuid+",",null!==e._colorsTexture&&(i+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(i+=e.uuid+","),i+=e.receiveShadow+",",a_(i)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(null!==this.attributes){const e=this.attributesId;for(const t in e){const n=this.geometry.getAttribute(t);if(void 0===n||e[t]!==n.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return!0!==this.material.isShadowPassMaterial&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=l_(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=l_(e,1)),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}const YC=[];class KC{constructor(e,t,n,i,r,s){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=i,this.bindings=r,this.info=s,this.chainMaps={}}get(e,t,n,i,r,s,a,o){const l=this.getChainMap(o);YC[0]=e,YC[1]=t,YC[2]=s,YC[3]=r;let u=l.get(YC);return void 0===u?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,i,r,s,a,o),l.set(YC,u)):(u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,i,r,s,a,o)):u.version=t.version)),YC.length=0,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new WC)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,i,r,s,a,o,l,u,c){const h=this.getChainMap(c),d=new $C(e,t,n,i,r,s,a,o,l,u);return d.onDispose=()=>{this.pipelines.delete(d),this.bindings.delete(d),this.nodes.delete(d),h.delete(d.getChainArray())},d}}class ZC{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return void 0===t&&(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 JC=1,QC=2,eN=3,tN=4,nN=16;class iN extends ZC{constructor(e){super(),this.backend=e}delete(e){const t=super.delete(e);return null!==t&&this.backend.destroyAttribute(e),t}update(e,t){const n=this.get(e);if(void 0===n.version)t===JC?this.backend.createAttribute(e):t===QC?this.backend.createIndexAttribute(e):t===eN?this.backend.createStorageAttribute(e):t===tN&&this.backend.createIndirectStorageAttribute(e),n.version=this._getBufferAttribute(e).version;else{const t=this._getBufferAttribute(e);(n.version<t.version||t.usage===an)&&(this.backend.updateAttribute(e),n.version=t.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}function rN(e){return null!==e.index?e.index.version:e.attributes.position.version}function sN(e){const t=[],n=e.index,i=e.attributes.position;if(null!==n){const e=n.array;for(let n=0,i=e.length;n<i;n+=3){const i=e[n+0],r=e[n+1],s=e[n+2];t.push(i,r,r,s,s,i)}}else{for(let e=0,n=i.array.length/3-1;e<n;e+=3){const n=e+0,i=e+1,r=e+2;t.push(n,i,i,r,r,n)}}const r=new(Nn(t)?Or:Dr)(t,1);return r.version=rN(e),r}class aN extends ZC{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap}has(e){const t=e.geometry;return super.has(t)&&!0===this.get(t).initialized}updateForRender(e){!1===this.has(e)&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){const t=e.geometry;this.get(t).initialized=!0,this.info.memory.geometries++;const n=()=>{this.info.memory.geometries--;const i=t.index,r=e.getAttributes();null!==i&&this.attributes.delete(i);for(const e of r)this.attributes.delete(e);const s=this.wireframes.get(t);void 0!==s&&this.attributes.delete(s),t.removeEventListener("dispose",n)};t.addEventListener("dispose",n)}updateAttributes(e){const t=e.getAttributes();for(const r of t)r.isStorageBufferAttribute||r.isStorageInstancedBufferAttribute?this.updateAttribute(r,eN):this.updateAttribute(r,JC);const n=this.getIndex(e);null!==n&&this.updateAttribute(n,QC);const i=e.geometry.indirect;null!==i&&this.updateAttribute(i,tN)}updateAttribute(e,t){const n=this.info.render.calls;e.isInterleavedBufferAttribute?void 0===this.attributeCall.get(e)?(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}getIndex(e){const{geometry:t,material:n}=e;let i=t.index;if(!0===n.wireframe){const e=this.wireframes;let n=e.get(t);void 0===n?(n=sN(t),e.set(t,n)):n.version!==rN(t)&&(this.attributes.delete(n),n=sN(t),e.set(t,n)),i=n}return i}}class oN{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))}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 lN{constructor(e){this.cacheKey=e,this.usedTimes=0}}class uN extends lN{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}}class cN extends lN{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let hN=0;class dN{constructor(e,t,n,i=null,r=null){this.id=hN++,this.code=e,this.stage=t,this.name=n,this.transforms=i,this.attributes=r,this.usedTimes=0}}class pN extends ZC{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,i=this.get(e);if(this._needsComputeUpdate(e)){const r=i.pipeline;r&&(r.usedTimes--,r.computeProgram.usedTimes--);const s=this.nodes.getForCompute(e);let a=this.programs.compute.get(s.computeShader);void 0===a&&(r&&0===r.computeProgram.usedTimes&&this._releaseProgram(r.computeProgram),a=new dN(s.computeShader,"compute",e.name,s.transforms,s.nodeAttributes),this.programs.compute.set(s.computeShader,a),n.createProgram(a));const o=this._getComputeCacheKey(e,a);let l=this.caches.get(o);void 0===l&&(r&&0===r.usedTimes&&this._releasePipeline(r),l=this._getComputePipeline(e,a,o,t)),l.usedTimes++,a.usedTimes++,i.version=e.version,i.pipeline=l}return i.pipeline}getForRender(e,t=null){const{backend:n}=this,i=this.get(e);if(this._needsRenderUpdate(e)){const r=i.pipeline;r&&(r.usedTimes--,r.vertexProgram.usedTimes--,r.fragmentProgram.usedTimes--);const s=e.getNodeBuilderState(),a=e.material?e.material.name:"";let o=this.programs.vertex.get(s.vertexShader);void 0===o&&(r&&0===r.vertexProgram.usedTimes&&this._releaseProgram(r.vertexProgram),o=new dN(s.vertexShader,"vertex",a),this.programs.vertex.set(s.vertexShader,o),n.createProgram(o));let l=this.programs.fragment.get(s.fragmentShader);void 0===l&&(r&&0===r.fragmentProgram.usedTimes&&this._releaseProgram(r.fragmentProgram),l=new dN(s.fragmentShader,"fragment",a),this.programs.fragment.set(s.fragmentShader,l),n.createProgram(l));const u=this._getRenderCacheKey(e,o,l);let c=this.caches.get(u);void 0===c?(r&&0===r.usedTimes&&this._releasePipeline(r),c=this._getRenderPipeline(e,o,l,u,t)):e.pipeline=c,c.usedTimes++,o.usedTimes++,l.usedTimes++,i.pipeline=c}return i.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,0===t.usedTimes&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,0===t.computeProgram.usedTimes&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,0===t.vertexProgram.usedTimes&&this._releaseProgram(t.vertexProgram),0===t.fragmentProgram.usedTimes&&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,i){n=n||this._getComputeCacheKey(e,t);let r=this.caches.get(n);return void 0===r&&(r=new cN(n,t),this.caches.set(n,r),this.backend.createComputePipeline(r,i)),r}_getRenderPipeline(e,t,n,i,r){i=i||this._getRenderCacheKey(e,t,n);let s=this.caches.get(i);return void 0===s&&(s=new uN(i,t,n),this.caches.set(i,s),e.pipeline=s,this.backend.createRenderPipeline(e,r)),s}_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 void 0===t.pipeline||t.version!==e.version}_needsRenderUpdate(e){return void 0===this.get(e).pipeline||this.backend.needsRenderUpdate(e)}}class mN extends ZC{constructor(e,t,n,i,r,s){super(),this.backend=e,this.textures=n,this.pipelines=r,this.attributes=i,this.nodes=t,this.info=s,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const n of t){const e=this.get(n);void 0===e.bindGroup&&(this._init(n),this.backend.createBindings(n,t,0),e.bindGroup=n)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const n of t){const e=this.get(n);void 0===e.bindGroup&&(this._init(n),this.backend.createBindings(n,t,0),e.bindGroup=n)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}_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.isStorageBuffer){const e=t.attribute,n=e.isIndirectStorageBufferAttribute?tN:eN;this.attributes.update(e,n)}}_update(e,t){const{backend:n}=this;let i=!1,r=!0,s=0,a=0;for(const o of e.bindings){if(o.isNodeUniformsGroup){if(!1===this.nodes.updateGroup(o))continue}if(o.isStorageBuffer){const e=o.attribute,t=e.isIndirectStorageBufferAttribute?tN:eN;this.attributes.update(e,t)}if(o.isUniformBuffer){o.update()&&n.updateBinding(o)}else if(o.isSampledTexture){const e=o.update(),t=o.texture,l=this.textures.get(t);e&&(this.textures.updateTexture(t),o.generation!==l.generation&&(o.generation=l.generation,i=!0,r=!1));if(void 0!==n.get(t).externalTexture||l.isDefaultTexture?r=!1:(s=10*s+t.id,a+=t.version),!0===t.isStorageTexture){const e=this.get(t);!0===o.store?e.needsMipmap=!0:this.textures.needsMipmaps(t)&&!0===e.needsMipmap&&(this.backend.generateMipmaps(t),e.needsMipmap=!1)}}else o.isSampler&&o.update()}!0===i&&this.backend.updateBindings(e,t,r?s:0,a)}}function fN(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function gN(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function _N(e){return(e.transmission>0||e.transmissionNode)&&2===e.side&&!1===e.forceSinglePass}class yN{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,i,r,s,a){let o=this.renderItems[this.renderItemsIndex];return void 0===o?(o={id:e.id,object:e,geometry:t,material:n,groupOrder:i,renderOrder:e.renderOrder,z:r,group:s,clippingContext:a},this.renderItems[this.renderItemsIndex]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=n,o.groupOrder=i,o.renderOrder=e.renderOrder,o.z=r,o.group=s,o.clippingContext=a),this.renderItemsIndex++,o}push(e,t,n,i,r,s,a){const o=this.getNextRenderItem(e,t,n,i,r,s,a);!0===e.occlusionTest&&this.occlusionQueryCount++,!0===n.transparent||n.transmission>0?(_N(n)&&this.transparentDoublePass.push(o),this.transparent.push(o)):this.opaque.push(o)}unshift(e,t,n,i,r,s,a){const o=this.getNextRenderItem(e,t,n,i,r,s,a);!0===n.transparent||n.transmission>0?(_N(n)&&this.transparentDoublePass.unshift(o),this.transparent.unshift(o)):this.opaque.unshift(o)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||fN),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||gN),this.transparent.length>1&&this.transparent.sort(t||gN)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){const t=this.renderItems[e];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.groupOrder=null,t.renderOrder=null,t.z=null,t.group=null,t.clippingContext=null}}}const vN=[];class xN{constructor(e){this.lighting=e,this.lists=new WC}get(e,t){const n=this.lists;vN[0]=e,vN[1]=t;let i=n.get(vN);return void 0===i&&(i=new yN(this.lighting,e,t),n.set(vN,i)),vN.length=0,i}dispose(){this.lists=new WC}}let bN=0;class TN{constructor(){this.id=bN++,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 Zn,this.scissor=!1,this.scissorValue=new Zn,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.isRenderContext=!0}getCacheKey(){return SN(this)}}function SN(e){const{textures:t,activeCubeFace:n,activeMipmapLevel:i}=e,r=[n,i];for(const s of t)r.push(s.id);return o_(r)}const MN=[],wN=new ws,EN=new hs;class AN{constructor(){this.chainMaps={}}get(e,t,n=null){let i;if(MN[0]=e,MN[1]=t,null===n)i="default";else{const e=n.texture.format;i=`${n.textures.length}:${e}:${n.samples}:${n.depthBuffer}:${n.stencilBuffer}`}const r=this._getChainMap(i);let s=r.get(MN);return void 0===s&&(s=new TN,r.set(MN,s)),MN.length=0,null!==n&&(s.sampleCount=0===n.samples?1:n.samples),s}getForClear(e=null){return this.get(wN,EN,e)}_getChainMap(e){return this.chainMaps[e]||(this.chainMaps[e]=new WC)}dispose(){this.chainMaps={}}}const RN=new wn;class CN extends ZC{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n}updateRenderTarget(e,t=0){const n=this.get(e),i=0===e.samples?1:e.samples,r=n.depthTextureMips||(n.depthTextureMips={}),s=e.textures,a=this.getSize(s[0]),o=a.width>>t,l=a.height>>t;let u=e.depthTexture||r[t];const c=!0===e.depthBuffer||!0===e.stencilBuffer;let h=!1;void 0===u&&c&&(u=new vo,u.format=e.stencilBuffer?Ze:Ke,u.type=e.stencilBuffer?He:Ve,u.image.width=o,u.image.height=l,u.image.depth=a.depth,u.isArrayTexture=!0===e.multiview&&a.depth>1,r[t]=u),n.width===a.width&&a.height===n.height||(h=!0,u&&(u.needsUpdate=!0,u.image.width=o,u.image.height=l,u.image.depth=u.isArrayTexture?u.image.depth:1)),n.width=a.width,n.height=a.height,n.textures=s,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==i&&(h=!0,u&&(u.needsUpdate=!0),n.sampleCount=i);const d={sampleCount:i};if(!0!==e.isXRRenderTarget){for(let e=0;e<s.length;e++){const t=s[e];h&&(t.needsUpdate=!0),this.updateTexture(t,d)}u&&this.updateTexture(u,d)}if(!0!==n.initialized){n.initialized=!0;const t=()=>{e.removeEventListener("dispose",t);for(let e=0;e<s.length;e++)this._destroyTexture(s[e]);u&&this._destroyTexture(u),this.delete(e),this.backend.delete(e)};e.addEventListener("dispose",t)}}updateTexture(e,t={}){const n=this.get(e);if(!0===n.initialized&&n.version===e.version)return;const i=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,r=this.backend;if(i&&!0===n.initialized&&(r.destroySampler(e),r.destroyTexture(e)),e.isFramebufferTexture){const t=this.renderer.getRenderTarget();e.type=t?t.texture.type:De}const{width:s,height:a,depth:o}=this.getSize(e);if(t.width=s,t.height=a,t.depth=o,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,s,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,i||!0===e.isStorageTexture||!0===e.isExternalTexture)r.createSampler(e),r.createTexture(e,t),n.generation=e.version;else{if(!0!==n.initialized&&r.createSampler(e),e.version>0){const i=e.image;if(void 0===i);else if(!1===i.complete);else{if(e.images){const n=[];for(const t of e.images)n.push(t);t.images=n}else t.image=i;void 0!==n.isDefaultTexture&&!0!==n.isDefaultTexture||(r.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),!0===e.s
1ource.dataReady&&r.updateTexture(e,t),t.needsMipmaps&&0===e.mipmaps.length&&r.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else r.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version}if(!0!==n.initialized){n.initialized=!0,n.generation=e.version,this.info.memory.textures++,e.isVideoTexture&&qn.getTransfer(e.colorSpace);const t=()=>{e.removeEventListener("dispose",t),this._destroyTexture(e)};e.addEventListener("dispose",t)}n.version=e.version}getSize(e,t=RN){let n=e.images?e.images[0]:e.image;return n?(void 0!==n.image&&(n=n.image),"undefined"!=typeof HTMLVideoElement&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):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 i;return i=e.mipmaps.length>0?e.mipmaps.length:!0===e.isCompressedTexture?1:Math.floor(Math.log2(Math.max(t,n)))+1,i}needsMipmaps(e){return!0===e.generateMipmaps||e.mipmaps.length>0}_destroyTexture(e){!0===this.has(e)&&(this.backend.destroySampler(e),this.backend.destroyTexture(e),this.delete(e),this.info.memory.textures--)}}class NN extends br{constructor(e,t,n,i=1){super(e,t,n),this.a=i}set(e,t,n,i=1){return this.a=i,super.set(e,t,n)}copy(e){return void 0!==e.a&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}}class PN extends rv{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}class IN extends I_{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this.isStackNode=!0}getNodeType(e){return this.hasOutput?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.hasOutput?this.outputNode.getMemberType(e,t):"void"}add(e){return!0!==e.isNode||this.nodes.push(e),this}If(e,t){const n=new by(t);return this._currentCond=Bb(e,n),this.add(this._currentCond)}ElseIf(e,t){const n=new by(t),i=Bb(e,n);return this._currentCond.elseNode=i,this._currentCond=i,this}Else(e){return this._currentCond.elseNode=new by(e),this}Switch(e){return this._expressionNode=Ty(e),this}Case(...e){const t=[];if(e.length>=2)for(let s=0;s<e.length-1;s++)t.push(this._expressionNode.equal(Ty(e[s])));const n=new by(e[e.length-1]);let i=t[0];for(let s=1;s<t.length;s++)i=i.or(t[s]);const r=Bb(i,n);return null===this._currentCond?(this._currentCond=r,this.add(this._currentCond)):(this._currentCond.elseNode=r,this._currentCond=r,this)}Default(e){return this.Else(e),this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const i of this.getChildren()){if(i.isVarNode&&!0===i.intent){if(!0!==e.getNodeProperties(i).assign)continue}t["node"+n++]=i}return t.outputNode||null}get hasOutput(){return this.outputNode&&this.outputNode.isNode}build(e,...t){const n=e.currentStack,i=Ly();Iy(this),e.currentStack=this;const r=e.buildStage;for(const a of this.nodes){if(a.isVarNode&&!0===a.intent){if(!0!==e.getNodeProperties(a).assign)continue}if("setup"===r)a.build(e);else if("analyze"===r)a.build(e,this);else if("generate"===r){const t=e.getDataFromNode(a,"any").stages,n=t&&t[e.shaderStage];if(a.isVarNode&&n&&1===n.length&&n[0]&&n[0].isStackNode)continue;a.build(e,"void")}}let s;return s=this.hasOutput?this.outputNode.build(e,...t):super.build(e,...t),Iy(i),e.currentStack=n,s}}const LN=Ey(IN).setParameterLength(0,1);class DN extends I_{static get type(){return"StructTypeNode"}constructor(e,t=null){var n;super("struct"),this.membersLayout=(n=e,Object.entries(n).map(([e,t])=>"string"==typeof t?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})),this.name=t,this.isStructLayoutNode=!0}getLength(){const e=Float32Array.BYTES_PER_ELEMENT;let t=0;for(const n of this.membersLayout){const i=n.type,r=g_(i)*e,s=t%8,a=s%__(i),o=s+a;t+=a,0!==o&&8-o<r&&(t+=8-o),t+=r}return 8*Math.ceil(t/8)/e}getMemberType(e,t){const n=this.membersLayout.find(e=>e.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 ON extends I_{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStru
vendor: 65,042 bytes, line 1
1ctNode=!0}getNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}generate(e){const t=e.getVarFromNode(this),n=t.type,i=e.getPropertyName(t);return e.addLineFlowCode(`${i} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}class UN extends I_{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}getNodeType(e){const t=e.getNodeProperties(this);if(void 0===t.membersLayout){const n=this.members,i=[];for(let t=0;t<n.length;t++){const r="m"+t,s=n[t].getNodeType(e);i.push({name:r,type:s,index:t})}t.membersLayout=i,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}return t.structType.name}generate(e){const t=e.getOutputStructName(),n=this.members,i=""!==t?t+".":"";for(let r=0;r<n.length;r++){const t=n[r].build(e);e.addLineFlowCode(`${i}m${r} = ${t}`,this)}return t}}const FN=Ey(UN);function BN(e,t){for(let n=0;n<e.length;n++)if(e[n].name===t)return n;return-1}class VN extends UN{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.isMRTNode=!0}has(e){return void 0!==this.outputNodes[e]}get(e){return this.outputNodes[e]}merge(e){const t={...this.outputNodes,...e.outputNodes};return qN(t)}setup(e){const t=this.outputNodes,n=[],i=e.renderer.getRenderTarget().textures;for(const r in t){n[BN(i,r)]=Yy(t[r])}return this.members=n,super.setup(e)}}const qN=Ey(VN);class zN extends O_{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(null!==this.inputType){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(null!==this.inputType){const t=this.valueNode.getNodeType(e);n=1===e.getTypeLength(t)?this.inputType:e.changeComponentType(t,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}}const kN=Ry(zN).setParameterLength(2),GN=Py(([e])=>{const t=e.toUint().mul(747796405).add(2891336453),n=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(277803737);return n.shiftRight(22).bitXor(n).toFloat().mul(1/2**32)}),HN=(e,t)=>_b(Qv(4,e.mul(Jv(1,e))),t),jN=Py(([e])=>e.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),WN=Py(([e])=>jy(jN(e.z.add(jN(e.y.mul(1)))),jN(e.z.add(jN(e.x.mul(1)))),jN(e.y.add(jN(e.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),XN=Py(([e,t,n])=>{const i=jy(e).toVar(),r=Fy(1.4).toVar(),s=Fy(0).toVar(),a=jy(i).toVar();return _E({start:Fy(0),end:Fy(3),type:"float",condition:"<="},()=>{const e=jy(WN(a.mul(2))).toVar();i.addAssign(e.add(n.mul(Fy(.1).mul(t)))),a.mulAssign(1.8),r.mulAssign(1.5),i.mulAssign(1.2);const o=Fy(jN(i.z.add(jN(i.x.add(jN(i.y)))))).toVar();s.addAssign(o.div(r)),a.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class $N extends I_{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFnCall=null,this.global=!0}getNodeType(){return this.functionNodes[0].shaderNode.layout.type}setup(e){const t=this.parametersNodes;let n=this._candidateFnCall;if(null===n){let i=null,r=-1;for(const n of this.functionNodes){const s=n.shaderNode.layout;if(null===s)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const a=s.inputs;if(t.length===a.length){let s=0;for(let n=0;n<t.length;n++){const i=t[n],r=a[n];i.getNodeType(e)===r.type?s++:s=0}s>r&&(i=n,r=s)}}this._candidateFnCall=n=i(...t)}return n}}const YN=Ey($N),KN=e=>(...t)=>YN(e,...t),ZN=kv(0).setGroup(Vv).onRenderUpdate(e=>e.time),JN=kv(0).setGroup(Vv).onRenderUpdate(e=>e.deltaTime),QN=kv(0,"uint").setGroup(Vv).onRenderUpdate(e=>e.frameId),eP=Py(([e,t,n=zy(.5)])=>OC(e.sub(n),t).add(n)),tP=Py(([e,t,n=zy(.5)])=>{const i=e.sub(n),r=i.dot(i),s=r.mul(r).mul(t);return e.add(i.mul(s))}),nP=Py(({position:e=null,horizontal:t=!0,vertical:n=!1})=>{let i;null!==e?(i=PS.toVar(),i[3][0]=e.x,i[3][1]=e.y,i[3][2]=e.z):i=PS;const r=gS.mul(i);return vy(t)&&(r[0][0]=PS[0].length(),r[0][1]=0,r[0][2]=0),vy(n)&&(r[1][0]=0,r[1][1]=PS[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,mS.mul(r).mul(GS)}),iP=Py(([e=null])=>{const t=GE();return GE(OE(e)).sub(t).lessThan(0).select(iS,e)});class rP extends I_{static get type(){return"SpriteSheetUVNode"}constructor(e,t=FT(),n=Fy(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:i,height:r}=n,s=e.mod(i.mul(r)).floor(),a=s.mod(i),o=r.sub(s.add(1).div(i).ceil()),l=n.reciprocal(),u=zy(a,o);return t.add(u).mul(l)}}const sP=Ey(rP).setParameterLength(3),aP=Py(([e,t=null,n=null,i=Fy(1),r=GS,s=eM])=>{let a=s.abs().normalize();a=a.div(a.dot(jy(1)));const o=r.yz.mul(i),l=r.zx.mul(i),u=r.xy.mul(i),c=e.value,h=null!==t?t.value:c,d=null!==n?n.value:c,p=jT(c,o).mul(a.x),m=jT(h,l).mul(a.y),f=jT(d,u).mul(a.z);return Zv(p,m,f)}),oP=new ba,lP=new wn,uP=new wn,cP=new wn,hP=new Ci,dP=new wn(0,0,-1),pP=new Zn,mP=new wn,fP=new wn,gP=new Zn,_P=new Sn,yP=new Jn,vP=iS.flipX();yP.depthTexture=new vo(1,1);let xP=!1;class bP extends GT{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||yP.texture,vP),this._reflectorBaseNode=e.reflector||new TP(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(null===this._depthNode){if(!0!==this._reflectorBaseNode.depth)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=Ty(new bP({defaultTexture:yP.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._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class TP extends I_{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:n=new nr,resolutionScale:i=1,generateMipmaps:r=!1,bounces:s=!0,depth:a=!1,samples:o=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=i,void 0!==t.resolution&&(Un('THREE.ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=r,this.bounces=s,this.depth=a,this.samples=o,this.updateBeforeType=s?M_.RENDER:M_.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const n=this.resolutionScale;t.getDrawingBufferSize(_P),e.setSize(Math.round(_P.width*n),Math.round(_P.height*n))}setup(e){return this._updateResolution(yP,e.renderer),super.setup(e)}dispose(){super.dispose();for(const e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return void 0===t&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return void 0===t&&(t=new Jn(0,0,{type:ze,samples:this.samples}),!0===this.generateMipmaps&&(t.texture.minFilter=1008,t.texture.generateMipmaps=!0),!0===this.depth&&(t.depthTexture=new vo),this.renderTargets.set(e,t)),t}updateBefore(e){if(!1===this.bounces&&xP)return!1;xP=!0;const{scene:t,camera:n,renderer:i,material:r}=e,{target:s}=this,a=this.getVirtualCamera(n),o=this.getRenderTarget(a);i.getDrawingBufferSize(_P),this._updateResolution(o,i),uP.setFromMatrixPosition(s.matrixWorld),cP.setFromMatrixPosition(n.matrixWorld),hP.extractRotation(s.matrixWorld),lP.set(0,0,1),lP.applyMatrix4(hP),mP.subVectors(uP,cP);let l=!1;if(!0===mP.dot(lP)>0&&!1===this.forceUpdate){if(!1===this.hasOutput)return void(xP=!1);l=!0}mP.reflect(lP).negate(),mP.add(uP),hP.extractRotation(n.matrixWorld),dP.set(0,0,-1),dP.applyMatrix4(hP),dP.add(cP),fP.subVectors(uP,dP),fP.reflect(lP).negate(),fP.add(uP),a.coordinateSystem=n.coordinateSystem,a.position.copy(mP),a.up.set(0,1,0),a.up.applyMatrix4(hP),a.up.reflect(lP),a.lookAt(fP),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),oP.setFromNormalAndCoplanarPoint(lP,uP),oP.applyMatrix4(a.matrixWorldInverse),pP.set(oP.normal.x,oP.normal.y,oP.normal.z,oP.constant);const u=a.projectionMatrix;gP.x=(Math.sign(pP.x)+u.elements[8])/u.elements[0],gP.y=(Math.sign(pP.y)+u.elements[9])/u.elements[5],gP.z=-1,gP.w=(1+u.elements[10])/u.elements[14],pP.multiplyScalar(1/pP.dot(gP));u.elements[2]=pP.x,u.elements[6]=pP.y,u.elements[10]=i.coordinateSystem===un?pP.z-0:pP.z+1-0,u.elements[14]=pP.w,this.textureNode.value=o.texture,!0===this.depth&&(this.textureNode.getDepthNode().value=o.depthTexture),r.visible=!1;const c=i.getRenderTarget(),h=i.getMRT(),d=i.autoClear;i.setMRT(null),i.setRenderTarget(o),i.autoClear=!0,l?(i.clear(),this.hasOutput=!1):(i.render(t,a),this.hasOutput=!0),i.setMRT(h),i.setRenderTarget(c),i.autoClear=d,r.visible=!0,xP=!1,this.forceUpdate=!1}get resolution(){return Un('THREE.ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Un('THREE.ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const SP=new Xu(-1,1,1,-1,0,1);class MP extends jr{constructor(e=!1){super();const t=!1===e?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Fr([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Fr(t,2))}}const wP=new MP;class EP extends is{constructor(e=null){super(wP,e),this.camera=SP,this.isQuadMesh=!0}async renderAsync(e){return e.renderAsync(this,SP)}render(e){e.render(this,SP)}}const AP=new Sn;class RP extends GT{static get type(){return"RTTNode"}constructor(e,t=null,n=null,i={type:ze}){const r=new Jn(t,n,i);super(r.texture,FT()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.pixelRatio=1,this.renderTarget=r,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new EP(new rA),this.updateBeforeType=M_.RENDER}get autoResize(){return null===this.width}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,i=t*this.pixelRatio;this.renderTarget.setSize(n,i),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(!1===this.textureNeedsUpdate&&!1===this.autoUpdate)return;if(this.textureNeedsUpdate=!1,!0===this.autoResize){const t=e.getPixelRatio(),n=e.getSize(AP),i=n.width*t,r=n.height*t;i===this.renderTarget.width&&r===this.renderTarget.height||(this.renderTarget.setSize(i,r),this.textureNeedsUpdate=!0)}this._quadMesh.material.fragmentNode=this._rttNode;const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new GT(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const CP=(e,...t)=>Ty(new RP(Ty(e),...t)),NP=Py(([e,t,n],i)=>{let r;i.renderer.coordinateSystem===un?(e=zy(e.x,e.y.oneMinus()).mul(2).sub(1),r=Yy(jy(e,t),1)):r=Yy(jy(e.x,e.y.oneMinus(),t).mul(2).sub(1),1);const s=Yy(n.mul(r));return s.xyz.div(s.w)}),PP=Py(([e,t])=>{const n=t.mul(Yy(e,1)),i=n.xy.div(n.w).mul(.5).add(.5).toVar();return zy(i.x,i.y.oneMinus())}),IP=Py(([e,t,n])=>{const i=VT(WT(t)),r=ky(e.mul(i)).toVar(),s=WT(t,r).toVar(),a=WT(t,r.sub(ky(2,0))).toVar(),o=WT(t,r.sub(ky(1,0))).toVar(),l=WT(t,r.add(ky(1,0))).toVar(),u=WT(t,r.add(ky(2,0))).toVar(),c=WT(t,r.add(ky(0,2))).toVar(),h=WT(t,r.add(ky(0,1))).toVar(),d=WT(t,r.sub(ky(0,1))).toVar(),p=WT(t,r.sub(ky(0,2))).toVar(),m=$x(Jv(Fy(2).mul(o).sub(a),s)).toVar(),f=$x(Jv(Fy(2).mul(l).sub(u),s)).toVar(),g=$x(Jv(Fy(2).mul(h).sub(c),s)).toVar(),_=$x(Jv(Fy(2).mul(d).sub(p),s)).toVar(),y=NP(e,s,n).toVar(),v=m.lessThan(f).select(y.sub(NP(e.sub(zy(Fy(1).div(i.x),0)),o,n)),y.negate().add(NP(e.add(zy(Fy(1).div(i.x),0)),l,n))),x=g.lessThan(_).select(y.sub(NP(e.add(zy(0,Fy(1).div(i.y))),h,n)),y.negate().add(NP(e.sub(zy(0,Fy(1).div(i.y))),d,n)));return qx(gb(v,x))});class LP extends I_{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(FT())}sample(e){return this.callback(e)}}class DP extends I_{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===DP.OBJECT?this.updateType=M_.OBJECT:e===DP.MATERIAL&&(this.updateType=M_.RENDER)}update(e){this.callback(e)}}DP.OBJECT="object",DP.MATERIAL="material";const OP=(e,t)=>Ty(new DP(e,t)).toStack();class UP extends ua{constructor(e,t,n=Float32Array){super(ArrayBuffer.isView(e)?e:new n(e*t),t),this.isStorageInstancedBufferAttribute=!0}}class FP extends Lr{constructor(e,t,n=Float32Array){super(ArrayBuffer.isView(e)?e:new n(e*t),t),this.isStorageBufferAttribute=!0}}class BP extends I_{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const VP=Ay(BP),qP=new Vi,zP=new Ci;class kP extends I_{static get type(){return"SceneNode"}constructor(e=kP.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,n=null!==this.scene?this.scene:e.scene;let i;return t===kP.BACKGROUND_BLURRINESS?i=AM("backgroundBlurriness","float",n):t===kP.BACKGROUND_INTENSITY?i=AM("backgroundIntensity","float",n):t===kP.BACKGROUND_ROTATION&&(i=kv("mat4").setName("backgroundRotation").setGroup(Vv).onRenderUpdate(()=>{const e=n.background;return null!==e&&e.isTexture&&e.mapping!==ve?(qP.copy(n.backgroundRotation),qP.x*=-1,qP.y*=-1,qP.z*=-1,zP.makeRotationFromEuler(qP)):zP.identity(),zP})),i}}kP.BACKGROUND_BLURRINESS="backgroundBlurriness",kP.BACKGROUND_INTENSITY="backgroundIntensity",kP.BACKGROUND_ROTATION="backgroundRotation";const GP=Ay(kP,kP.BACKGROUND_BLURRINESS),HP=Ay(kP,kP.BACKGROUND_INTENSITY),jP=Ay(kP,kP.BACKGROUND_ROTATION);class WP extends GT{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.isStorageTextureNode=!0,this.access=w_.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}generate(e,t){let n;return n=null!==this.storeNode?this.generateStore(e):super.generate(e,t),n}toReadWrite(){return this.setAccess(w_.READ_WRITE)}toReadOnly(){return this.setAccess(w_.READ_ONLY)}toWriteOnly(){return this.setAccess(w_.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:i,depthNode:r}=t,s=super.generate(e,"property"),a=n.build(e,!0===this.value.is3DTexture?"uvec3":"uvec2"),o=i.build(e,"vec4"),l=r?r.build(e,"int"):null,u=e.generateTextureStore(e,s,a,l,o);e.addLineFlowCode(u,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e}}const XP=Ey(WP).setParameterLength(1,3),$P=Py(({texture:e,uv:t})=>{const n=1e-4,i=jy().toVar();return Dy(t.x.lessThan(n),()=>{i.assign(jy(1,0,0))}).ElseIf(t.y.lessThan(n),()=>{i.assign(jy(0,1,0))}).ElseIf(t.z.lessThan(n),()=>{i.assign(jy(0,0,1))}).ElseIf(t.x.greaterThan(.9999),()=>{i.assign(jy(-1,0,0))}).ElseIf(t.y.greaterThan(.9999),()=>{i.assign(jy(0,-1,0))}).ElseIf(t.z.greaterThan(.9999),()=>{i.assign(jy(0,0,-1))}).Else(()=>{const n=.01,r=e.sample(t.add(jy(-.01,0,0))).r.sub(e.sample(t.add(jy(n,0,0))).r),s=e.sample(t.add(jy(0,-.01,0))).r.sub(e.sample(t.add(jy(0,n,0))).r),a=e.sample(t.add(jy(0,0,-.01))).r.sub(e.sample(t.add(jy(0,0,n))).r);i.assign(jy(r,s,a))}),i.normalize()});class YP extends GT{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return jy(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return!e.isFlipY()||!0!==n.isRenderTargetTexture&&!0!==n.isFramebufferTexture||(t=this.sampler?t.flipY():t.setY(By(VT(this,this.levelNode).y).sub(t.y).sub(1))),t}generateUV(e,t){return t.build(e,"vec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return $P({texture:this,uv:e})}}const KP=Ey(YP).setParameterLength(1,3);class ZP extends EM{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=null!==this.userData?this.userData:e.object.userData,this.reference}}const JP=new WeakMap;class QP extends O_{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=M_.OBJECT,this.updateAfterType=M_.OBJECT,this.previousModelWorldMatrix=kv(new Ci),this.previousProjectionMatrix=kv(new Ci).setGroup(Vv),this.previousCameraViewMatrix=kv(new Ci)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){const i=tI(n);this.previousModelWorldMatrix.value.copy(i);const r=eI(t);r.frameId!==e&&(r.frameId=e,void 0===r.previousProjectionMatrix?(r.previousProjectionMatrix=new Ci,r.previousCameraViewMatrix=new Ci,r.currentProjectionMatrix=new Ci,r.currentCameraViewMatrix=new Ci,r.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),r.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(r.previousProjectionMatrix.copy(r.currentProjectionMatrix),r.previousCameraViewMatrix.copy(r.currentCameraViewMatrix)),r.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),r.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(r.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(r.previousCameraViewMatrix))}updateAfter({object:e}){tI(e).copy(e.matrixWorld)}setup(){const e=null===this.projectionMatrix?mS:kv(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(BS).mul(GS),i=this.previousProjectionMatrix.mul(t).mul(HS),r=n.xy.div(n.w),s=i.xy.div(i.w);return Jv(r,s)}}function eI(e){let t=JP.get(e);return void 0===t&&(t={},JP.set(e,t)),t}function tI(e,t=0){const n=eI(e);let i=n[t];return void 0===i&&(n[t]=i=new Ci,n[t].copy(e.matrixWorld)),i}const nI=Ay(QP),iI=Py(([e])=>oI(e.rgb)),rI=Py(([e,t=Fy(1)])=>t.mix(oI(e.rgb),e.rgb)),sI=Py(([e,t=Fy(1)])=>{const n=Zv(e.r,e.g,e.b).div(3),i=e.r.max(e.g.max(e.b)),r=i.sub(n).mul(t).mul(-3);return Mb(e.rgb,i,r)}),aI=Py(([e,t=Fy(1)])=>{const n=jy(.57735,.57735,.57735),i=t.cos();return jy(e.rgb.mul(i).add(n.cross(e.rgb).mul(t.sin()).add(n.mul(fb(n,e.rgb).mul(i.oneMinus())))))}),oI=(e,t=jy(qn.getLuminanceCoefficients(new wn)))=>fb(e,t),lI=Py(([e,t=jy(1),n=jy(0),i=jy(1),r=Fy(1),s=jy(qn.getLuminanceCoefficients(new wn,jt))])=>{const a=e.rgb.dot(jy(s)),o=cb(e.rgb.mul(t).add(n),0).toVar(),l=o.pow(i).toVar();return Dy(o.r.greaterThan(0),()=>{o.r.assign(l.r)}),Dy(o.g.greaterThan(0),()=>{o.g.assign(l.g)}),Dy(o.b.greaterThan(0),()=>{o.b.assign(l.b)}),o.assign(a.add(o.sub(a).mul(r))),Yy(o.rgb,e.a)});class uI extends O_{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}const cI=Ey(uI).setParameterLength(2),hI=new Sn;class dI extends GT{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class pI extends dI{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n}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}}class mI extends O_{static get type(){return"PassNode"}constructor(e,t,n,i={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=i,this._pixelRatio=1,this._width=1,this._height=1;const r=new vo;r.isRenderTargetTexture=!0,r.name="depth";const s=new Jn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:ze,...i});s.texture.name="output",s.depthTexture=r,this.renderTarget=s,this._textures={output:s.texture,depth:r},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=kv(0),this._cameraFar=kv(0),this._mrt=null,this._layers=null,this._resolution=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=M_.FRAME,this.global=!0}setResolution(e){return this._resolution=e,this}getResolution(){return this._resolution}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];if(void 0===t){t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return void 0===t&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(void 0!==t){const n=this._textures[e],i=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[i]=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 void 0===t&&(t=Ty(new pI(this,e)),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return void 0===t&&(void 0===this._textureNodes[e]&&this.getTextureNode(e),t=Ty(new pI(this,e,!0)),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(void 0===t){const n=this._cameraNear,i=this._cameraFar;this._viewZNodes[e]=t=VE(this.getTextureNode(e),n,i)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(void 0===t){const n=this._cameraNear,i=this._cameraFar,r=this.getViewZNode(e);this._linearDepthNodes[e]=t=FE(r,n,i)}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=void 0===this.options.samples?e.samples:this.options.samples,this.renderTarget.texture.type=e.getColorBufferType(),this.scope===mI.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n}=this;let i,r;const s=t.getOutputRenderTarget();s&&!0===s.isXRRenderTarget?(r=1,i=t.xr.getCamera(),t.xr.updateCamera(i),hI.set(s.width,s.height)):(i=this.camera,r=t.getPixelRatio(),t.getSize(hI)),this._pixelRatio=r,this.setSize(hI.width,hI.height);const a=t.getRenderTarget(),o=t.getMRT(),l=i.layers.mask;this._cameraNear.value=i.near,this._cameraFar.value=i.far,null!==this._layers&&(i.layers.mask=this._layers.mask);for(const u in this._previousTextures)this.toggleTexture(u);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(n,i),t.setRenderTarget(a),t.setMRT(o),i.layers.mask=l}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio*this._resolution,i=this._height*this._pixelRatio*this._resolution;this.renderTarget.setSize(n,i),null!==this._scissor&&this.renderTarget.scissor.copy(this._scissor),null!==this._viewport&&this.renderTarget.viewport.copy(this._viewport)}setScissor(e,t,n,i){null===e?this._scissor=null:(null===this._scissor&&(this._scissor=new Zn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,i),this._scissor.multiplyScalar(this._pixelRatio*this._resolution).floor())}setViewport(e,t,n,i){null===e?this._viewport=null:(null===this._viewport&&(this._viewport=new Zn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,i),this._viewport.multiplyScalar(this._pixelRatio*this._resolution).floor())}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}mI.COLOR="color",mI.DEPTH="depth";class fI extends mI{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,i,r){super(mI.COLOR,e,t),this.colorNode=n,this.thicknessNode=i,this.alphaNode=r,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((e,n,i,r,s,a,o,l)=>{if((s.isMeshToonMaterial||s.isMeshToonNodeMaterial)&&!1===s.wireframe){const u=this._getOutlineMaterial(s);t.renderObject(e,n,i,r,u,a,o,l)}t.renderObject(e,n,i,r,s,a,o,l)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new rA;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=1;const t=eM.negate(),n=mS.mul(BS),i=Fy(1),r=n.mul(Yy(GS,1)),s=n.mul(Yy(GS.add(t),1)),a=qx(r.sub(s));return e.vertexNode=r.add(a.mul(this.thicknessNode).mul(r.w).mul(i)),e.colorNode=Yy(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return void 0===t&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const gI=Py(([e,t])=>e.mul(t).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),_I=Py(([e,t])=>(e=e.mul(t)).div(e.add(1)).clamp()).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),yI=Py(([e,t])=>{const n=(e=(e=e.mul(t)).sub(.004).max(0)).mul(e.mul(6.2).add(.5)),i=e.mul(e.mul(6.2).add(1.7)).add(.06);return n.div(i).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),vI=Py(([e])=>{const t=e.mul(e.add(.0245786)).sub(90537e-9),n=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(n)}),xI=Py(([e,t])=>{const n=ev(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),i=ev(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=n.mul(e),e=vI(e),(e=i.mul(e)).clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),bI=ev(jy(1.6605,-.1246,-.0182),jy(-.5876,1.1329,-.1006),jy(-.0728,-.0083,1.1187)),TI=ev(jy(.6274,.0691,.0164),jy(.3293,.9195,.088),jy(.0433,.0113,.8956)),SI=Py(([e])=>{const t=jy(e).toVar(),n=jy(t.mul(t)).toVar(),i=jy(n.mul(n)).toVar();return Fy(15.5).mul(i.mul(n)).sub(Qv(40.14,i.mul(t))).add(Qv(31.96,i).sub(Qv(6.868,n.mul(t))).add(Qv(.4298,n).add(Qv(.1191,t).sub(.00232))))}),MI=Py(([e,t])=>{const n=jy(e).toVar(),i=ev(jy(.856627153315983,.137318972929847,.11189821299995),jy(.0951212405381588,.761241990602591,.0767994186031903),jy(.0482516061458583,.101439036467562,.811302368396859)),r=ev(jy(1.1271005818144368,-.1413297634984383,-.14132976349843826),jy(-.11060664309660323,1.157823702216272,-.11060664309660294),jy(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=Fy(-12.47393),a=Fy(4.026069);return n.mulAssign(t),n.assign(TI.mul(n)),n.assign(i.mul(n)),n.assign(cb(n,1e-10)),n.assign(Ox(n)),n.assign(n.sub(s).div(a.sub(s))),n.assign(wb(n,0,1)),n.assign(SI(n)),n.assign(r.mul(n)),n.assign(_b(cb(jy(0),n),jy(2.2))),n.assign(bI.mul(n)),n.assign(wb(n,0,1)),n}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),wI=Py(([e,t])=>{const n=Fy(.76),i=Fy(.15);e=e.mul(t);const r=ub(e.r,ub(e.g,e.b)),s=Bb(r.lessThan(.08),r.sub(Qv(6.25,r.mul(r))),.04);e.subAssign(s);const a=cb(e.r,cb(e.g,e.b));Dy(a.lessThan(n),()=>e);const o=Jv(1,n),l=Jv(1,o.mul(o).div(a.add(o.sub(n))));e.mulAssign(l.div(a));const u=Jv(1,ex(1,i.mul(a.sub(l)).add(1)));return Mb(e,jy(l),u)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class EI extends I_{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 i of t)i.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 AI=Ey(EI).setParameterLength(1,3);class RI extends EI{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 void 0===n&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);const n=this.getNodeFunction(e),i=n.name,r=n.type,s=e.getCodeFromNode(this,r);""!==i&&(s.name=i);const a=e.getPropertyName(s),o=this.getNodeFunction(e).getCode(a);return s.code=o+"\n","property"===t?a:e.format(`${a}()`,r,t)}}const CI=(e,t=[],n="")=>{for(let s=0;s<t.length;s++){const e=t[s];"function"==typeof e&&(t[s]=e.functionNode)}const i=Ty(new RI(e,t,n)),r=(...e)=>i.call(...e);return r.functionNode=i,r};class NI extends I_{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new hn,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return null!==this.outputType}set value(e){this._value!==e&&(this._cache&&"URL"===this.inputType&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&null===this._cache&&"URL"===this.inputType&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&null!==e.value&&void 0!==e.value&&(("URL"===this.inputType||"String"===this.inputType)&&"string"==typeof e.value||"Number"===this.inputType&&"number"==typeof e.value||"Vector2"===this.inputType&&e.value.isVector2||"Vector3"===this.inputType&&e.value.isVector3||"Vector4"===this.inputType&&e.value.isVector4||"Color"===this.inputType&&e.value.isColor||"Matrix3"===this.inputType&&e.value.isMatrix3||"Matrix4"===this.inputType&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:Fy()}serialize(e){super.serialize(e),null!==this.value?"ArrayBuffer"===this.inputType?e.value=b_(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;null!==e.value&&(t="ArrayBuffer"===e.inputType?T_(e.value):"Texture"===e.inputType?e.meta.textures[e.value]:e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const PI=Ey(NI).setParameterLength(1);class II extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(null!==t){const i=t(...n);return this.set(e,i),i}}}class LI{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const DI=new II;class OI extends I_{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new II,this._output=PI(null),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const n=this._outputs;return void 0===n[e]?n[e]=PI(t):n[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):void 0===n[e]?(n[e]=PI(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const n=this.getObject()[e];if("function"==typeof n)return n(...t)}async callAsync(e,...t){const n=this.getObject()[e];if("function"==typeof n)return"AsyncFunction"===n.constructor.name?await n(...t):n(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){null!==e?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),null!==this._object)return this._object;const e=new LI(this),t=DI.get("THREE"),n=DI.get("TSL"),i=this.getMethod(),r=[e,this._local,DI,()=>this.refresh(),(e,t)=>this.setOutput(e,t),t,n];this._object=i(...r);const s=this._object.layout;if(s&&(!1===s.cache&&this._local.clear(),this._output.outputType=s.outputType||null,Array.isArray(s.elements)))for(const a of s.elements){const e=a.id||a.name;a.inputType&&(void 0===this.getParameter(e)&&this.setParameter(e,null),this.getParameter(e).inputType=a.inputType),a.outputType&&(void 0===this.getOutput(e)&&this.setOutput(e,null),this.getOutput(e).outputType=a.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const t in this.parameters){let e=this.parameters[t];e.isScriptableNode&&(e=e.getDefaultOutput()),e.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:Fy()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),null!==this._method)return this._method;const e=["layout","init","main","dispose"].join(", "),t="\nreturn { ...output, "+e+" };",n="var "+e+"; var output = {};\n"+this.codeNode.code+t;return this._method=new Function(...["parameters","local","global","refresh","setOutput","THREE","TSL"],n),this._method}dispose(){null!==this._method&&(this._object&&"function"==typeof this._object.dispose&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[a_(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return o_(t)}set needsUpdate(e){!0===e&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return null===this.codeNode||(!0===this._needsOutputUpdate&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value),this}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const UI=Ey(OI).setParameterLength(1,2);function FI(e){let t;const n=e.context.getViewZ;return void 0!==n&&(t=n(this)),(t||XS.z).negate()}const BI=Py(([e,t],n)=>{const i=FI(n);return Rb(e,t,i)}),VI=Py(([e],t)=>{const n=FI(t);return e.mul(e,n,n).negate().exp().oneMinus()}),qI=Py(([e,t])=>Yy(t.toFloat().mix(wv.rgb,e.toVec3()),wv.a));let zI=null,kI=null;class GI extends I_{static get type(){return"RangeNode"}constructor(e=Fy(),t=Fy()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(y_(this.minNode.value)),n=e.getTypeLength(y_(this.maxNode.value));return t>n?t:n}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let n=null;if(t.count>1){const i=this.minNode.value,r=this.maxNode.value,s=e.getTypeLength(y_(i)),a=e.getTypeLength(y_(r));zI=zI||new Zn,kI=kI||new Zn,zI.setScalar(0),kI.setScalar(0),1===s?zI.setScalar(i):i.isColor?zI.set(i.r,i.g,i.b,1):zI.set(i.x,i.y,i.z||0,i.w||0),1===a?kI.setScalar(r):r.isColor?kI.set(r.r,r.g,r.b,1):kI.set(r.x,r.y,r.z||0,r.w||0);const o=4,l=o*t.count,u=new Float32Array(l);for(let e=0;e<l;e++){const t=e%o,n=zI.getComponent(t),i=kI.getComponent(t);u[e]=Tn.lerp(n,i,Math.random())}const c=this.getNodeType(e);if(t.count<=4096)n=$T(u,"vec4",t.count).element(Jw).convert(c);else{const t=new ua(u,4);e.geometry.setAttribute("__range"+this.id,t),n=gT(t).convert(c)}}else n=Fy(0);return n}}const HI=Ey(GI).setParameterLength(2);class jI extends I_{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),i=this.getNodeType(e);return"compute"===e.shaderStage?e.format(n,i,t):e.generateConst(i)}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 WI=(e,t)=>Ty(new jI(e,t)),XI=WI("numWorkgroups","uvec3"),$I=WI("workgroupId","uvec3"),YI=WI("globalId","uvec3"),KI=WI("localId","uvec3"),ZI=WI("subgroupSize","uint");const JI=Ey(class extends I_{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;!0===n.backend.isWebGLBackend?e.addFlowCode(`\t// ${t}Barrier \n`):e.addLineFlowCode(`${t}Barrier()`,this)}});class QI extends L_{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const i=e.context.assign;if(n=super.generate(e),!0!==i){const i=this.getNodeType(e);n=e.format(n,i,t)}return n}}class eL extends I_{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 this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return Ty(new QI(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)}}class tL extends I_{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,i=this.method,r=this.getNodeType(e),s=this.getInputType(e),a=this.pointerNode,o=this.valueNode,l=[];l.push(`&${a.build(e,s)}`),null!==o&&l.push(o.build(e,s));const u=`${e.getMethod(i,r)}( ${l.join(", ")} )`;if(!(!!n&&(1===n.length&&!0===n[0].isStackNode)))return void 0===t.constNode&&(t.constNode=CT(u,r).toConst()),t.constNode.build(e);e.addLineFlowCode(u,this)}}tL.ATOMIC_LOAD="atomicLoad",tL.ATOMIC_STORE="atomicStore",tL.ATOMIC_ADD="atomicAdd",tL.ATOMIC_SUB="atomicSub",tL.ATOMIC_MAX="atomicMax",tL.ATOMIC_MIN="atomicMin",tL.ATOMIC_AND="atomicAnd",tL.ATOMIC_OR="atomicOr",tL.ATOMIC_XOR="atomicXor";const nL=Ey(tL),iL=(e,t,n)=>nL(e,t,n).toStack();class rL extends O_{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;return(e.isMatrix(t)?0:e.getTypeLength(t))>(e.isMatrix(n)?0:e.getTypeLength(n))?t:n}getNodeType(e){const t=this.method;return t===rL.SUBGROUP_ELECT?"bool":t===rL.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const n=this.method,i=this.getNodeType(e),r=this.getInputType(e),s=this.aNode,a=this.bNode,o=[];if(n===rL.SUBGROUP_BROADCAST||n===rL.SUBGROUP_SHUFFLE||n===rL.QUAD_BROADCAST){const t=a.getNodeType(e);o.push(s.build(e,i),a.build(e,"float"===t?"int":i))}else n===rL.SUBGROUP_SHUFFLE_XOR||n===rL.SUBGROUP_SHUFFLE_DOWN||n===rL.SUBGROUP_SHUFFLE_UP?o.push(s.build(e,i),a.build(e,"uint")):(null!==s&&o.push(s.build(e,r)),null!==a&&o.push(a.build(e,r)));const l=0===o.length?"()":`( ${o.join(", ")} )`;return e.format(`${e.getMethod(n,i)}${l}`,i,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}rL.SUBGROUP_ELECT="subgroupElect",rL.SUBGROUP_BALLOT="subgroupBallot",rL.SUBGROUP_ADD="subgroupAdd",rL.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd",rL.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd",rL.SUBGROUP_MUL="subgroupMul",rL.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul",rL.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul",rL.SUBGROUP_AND="subgroupAnd",rL.SUBGROUP_OR="subgroupOr",rL.SUBGROUP_XOR="subgroupXor",rL.SUBGROUP_MIN="subgroupMin",rL.SUBGROUP_MAX="subgroupMax",rL.SUBGROUP_ALL="subgroupAll",rL.SUBGROUP_ANY="subgroupAny",rL.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst",rL.QUAD_SWAP_X="quadSwapX",rL.QUAD_SWAP_Y="quadSwapY",rL.QUAD_SWAP_DIAGONAL="quadSwapDiagonal",rL.SUBGROUP_BROADCAST="subgroupBroadcast",rL.SUBGROUP_SHUFFLE="subgroupShuffle",rL.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor",rL.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp",rL.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown",rL.QUAD_BROADCAST="quadBroadcast";const sL=Ry(rL,rL.SUBGROUP_ELECT).setParameterLength(0),aL=Ry(rL,rL.SUBGROUP_BALLOT).setParameterLength(1),oL=Ry(rL,rL.SUBGROUP_ADD).setParameterLength(1),lL=Ry(rL,rL.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),uL=Ry(rL,rL.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),cL=Ry(rL,rL.SUBGROUP_MUL).setParameterLength(1),hL=Ry(rL,rL.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),dL=Ry(rL,rL.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),pL=Ry(rL,rL.SUBGROUP_AND).setParameterLength(1),mL=Ry(rL,rL.SUBGROUP_OR).setParameterLength(1),fL=Ry(rL,rL.SUBGROUP_XOR).setParameterLength(1),gL=Ry(rL,rL.SUBGROUP_MIN).setParameterLength(1),_L=Ry(rL,rL.SUBGROUP_MAX).setParameterLength(1),yL=Ry(rL,rL.SUBGROUP_ALL).setParameterLength(0),vL=Ry(rL,rL.SUBGROUP_ANY).setParameterLength(0),xL=Ry(rL,rL.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),bL=Ry(rL,rL.QUAD_SWAP_X).setParameterLength(1),TL=Ry(rL,rL.QUAD_SWAP_Y).setParameterLength(1),SL=Ry(rL,rL.QUAD_SWAP_DIAGONAL).setParameterLength(1),ML=Ry(rL,rL.SUBGROUP_BROADCAST).setParameterLength(2),wL=Ry(rL,rL.SUBGROUP_SHUFFLE).setParameterLength(2),EL=Ry(rL,rL.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),AL=Ry(rL,rL.SUBGROUP_SHUFFLE_UP).setParameterLength(2),RL=Ry(rL,rL.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),CL=Ry(rL,rL.QUAD_BROADCAST).setParameterLength(1);let NL;function PL(e){NL=NL||new WeakMap;let t=NL.get(e);return void 0===t&&NL.set(e,t={}),t}function IL(e){const t=PL(e);return t.shadowMatrix||(t.shadowMatrix=kv("mat4").setGroup(Vv).onRenderUpdate(t=>(!0===e.castShadow&&!1!==t.renderer.shadowMap.enabled||e.shadow.updateMatrices(e),e.shadow.matrix)))}function LL(e,t=jS){const n=IL(e).mul(t);return n.xyz.div(n.w)}function DL(e){const t=PL(e);return t.position||(t.position=kv(new wn).setGroup(Vv).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(e.matrixWorld)))}function OL(e){const t=PL(e);return t.targetPosition||(t.targetPosition=kv(new wn).setGroup(Vv).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(e.target.matrixWorld)))}function UL(e){const t=PL(e);return t.viewPosition||(t.viewPosition=kv(new wn).setGroup(Vv).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new wn,n.value.setFromMatrixPosition(e.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const FL=e=>gS.transformDirection(DL(e).sub(OL(e))),BL=(e,t)=>{for(const n of t)if(n.isAnalyticLightNode&&n.light.id===e)return n;return null},VL=new WeakMap,qL=[];class zL extends I_{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=sv("vec3","totalDiffuse"),this.totalSpecularNode=sv("vec3","totalSpecular"),this.outgoingLightNode=sv("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 t=e[n];if(qL.push(t.id),qL.push(t.castShadow?1:0),!0===t.isSpotLight){const e=null!==t.map?t.map.id:-1,n=t.colorNode?t.colorNode.getCacheKey():-1;qL.push(e,n)}}const t=o_(qL);return qL.length=0,t}getHash(e){if(null===this._lightNodesHash){null===this._lightNodes&&this.setupLightsNode(e);const t=[];for(const e of this._lightNodes)t.push(e.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,i=(e=>e.sort((e,t)=>e.id-t.id))(this._lights),r=e.renderer.library;for(const s of i)if(s.isNode)t.push(Ty(s));else{let e=null;if(null!==n&&(e=BL(s.id,n)),null===e){const e=r.getLightNodeClass(s.constructor);if(null===e)continue;let n=null;VL.has(s)?n=VL.get(s):(n=Ty(new e(s)),VL.set(s,n)),t.push(n)}}this._lightNodes=t}setupDirectLight(e,t,n){const{lightingModel:i,reflectedLight:r}=e.context;i.direct({...n,lightNode:t,reflectedLight:r},e)}setupDirectRectAreaLight(e,t,n){const{lightingModel:i,reflectedLight:r}=e.context;i.directRectArea({...n,lightNode:t,reflectedLight:r},e)}setupLights(e,t){for(const n of t)n.build(e)}getLightNodes(e){return null===this._lightNodes&&this.setupLightsNode(e),this._lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode;const i=e.context,r=i.lightingModel,s=e.getNodeProperties(this);if(r){const{totalDiffuseNode:t,totalSpecularNode:a}=this;i.outgoingLight=n;const o=e.addStack();s.nodes=o.nodes,r.start(e);const{backdrop:l,backdropAlpha:u}=i,{directDiffuse:c,directSpecular:h,indirectDiffuse:d,indirectSpecular:p}=i.reflectedLight;let m=c.add(d);null!==l&&(m=jy(null!==u?u.mix(m,l):l),i.material.transparent=!0),t.assign(m),a.assign(h.add(p)),n.assign(t.add(a)),r.finish(e),n=n.bypass(e.removeStack())}else s.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}}class kL extends I_{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=M_.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){GL.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||jS)}}const GL=sv("vec3","shadowPositionWorld");function HL(e,t){return t=function(e,t={}){return t.toneMapping=e.toneMapping,t.toneMappingExposure=e.toneMappingExposure,t.outputColorSpace=e.outputColorSpace,t.renderTarget=e.getRenderTarget(),t.activeCubeFace=e.getActiveCubeFace(),t.activeMipmapLevel=e.getActiveMipmapLevel(),t.renderObjectFunction=e.getRenderObjectFunction(),t.pixelRatio=e.getPixelRatio(),t.mrt=e.getMRT(),t.clearColor=e.getClearColor(t.clearColor||new br),t.clearAlpha=e.getClearAlpha(),t.autoClear=e.autoClear,t.scissorTest=e.getScissorTest(),t}(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}const jL=new WeakMap,WL=Py(({depthTexture:e,shadowCoord:t,depthLayer:n})=>{let i=jT(e,t.xy).setName("t_basic");return e.isArrayTexture&&(i=i.depth(n)),i.compare(t.z)}),XL=Py(({depthTexture:e,shadowCoord:t,shadow:n,depthLayer:i})=>{const r=(t,n)=>{let r=jT(e,t);return e.isArrayTexture&&(r=r.depth(i)),r.compare(n)},s=AM("mapSize","vec2",n).setGroup(Vv),a=AM("radius","float",n).setGroup(Vv),o=zy(1).div(s),l=o.x.negate().mul(a),u=o.y.negate().mul(a),c=o.x.mul(a),h=o.y.mul(a),d=l.div(2),p=u.div(2),m=c.div(2),f=h.div(2);return Zv(r(t.xy.add(zy(l,u)),t.z),r(t.xy.add(zy(0,u)),t.z),r(t.xy.add(zy(c,u)),t.z),r(t.xy.add(zy(d,p)),t.z),r(t.xy.add(zy(0,p)),t.z),r(t.xy.add(zy(m,p)),t.z),r(t.xy.add(zy(l,0)),t.z),r(t.xy.add(zy(d,0)),t.z),r(t.xy,t.z),r(t.xy.add(zy(m,0)),t.z),r(t.xy.add(zy(c,0)),t.z),r(t.xy.add(zy(d,f)),t.z),r(t.xy.add(zy(0,f)),t.z),r(t.xy.add(zy(m,f)),t.z),r(t.xy.add(zy(l,h)),t.z),r(t.xy.add(zy(0,h)),t.z),r(t.xy.add(zy(c,h)),t.z)).mul(1/17)}),$L=Py(({depthTexture:e,shadowCoord:t,shadow:n,depthLayer:i})=>{const r=(t,n)=>{let r=jT(e,t);return e.isArrayTexture&&(r=r.depth(i)),r.compare(n)},s=AM("mapSize","vec2",n).setGroup(Vv),a=zy(1).div(s),o=a.x,l=a.y,u=t.xy,c=zx(u.mul(s).add(.5));return u.subAssign(c.mul(a)),Zv(r(u,t.z),r(u.add(zy(o,0)),t.z),r(u.add(zy(0,l)),t.z),r(u.add(a),t.z),Mb(r(u.add(zy(o.negate(),0)),t.z),r(u.add(zy(o.mul(2),0)),t.z),c.x),Mb(r(u.add(zy(o.negate(),l)),t.z),r(u.add(zy(o.mul(2),l)),t.z),c.x),Mb(r(u.add(zy(0,l.negate())),t.z),r(u.add(zy(0,l.mul(2))),t.z),c.y),Mb(r(u.add(zy(o,l.negate())),t.z),r(u.add(zy(o,l.mul(2))),t.z),c.y),Mb(Mb(r(u.add(zy(o.negate(),l.negate())),t.z),r(u.add(zy(o.mul(2),l.negate())),t.z),c.x),Mb(r(u.add(zy(o.negate(),l.mul(2))),t.z),r(u.add(zy(o.mul(2),l.mul(2))),t.z),c.x),c.y)).mul(1/9)}),YL=Py(({depthTexture:e,shadowCoord:t,depthLayer:n})=>{const i=Fy(1).toVar();let r=jT(e).sample(t.xy);e.isArrayTexture&&(r=r.depth(n)),r=r.rg;const s=hb(t.z,r.x);return Dy(s.notEqual(Fy(1)),()=>{const e=t.z.sub(r.x),n=cb(0,r.y.mul(r.y));let a=n.div(n.add(e.mul(e)));a=wb(Jv(a,.3).div(.95-.3)),i.assign(wb(cb(s,a)))}),i}),KL=Py(([e,t,n])=>{let i=jS.sub(e).length();return i=i.sub(t).div(n.sub(t)),i=i.saturate(),i}),ZL=e=>{let t=jL.get(e);if(void 0===t){const n=e.isPointLight?(e=>{const t=e.shadow.camera,n=AM("near","float",t).setGroup(Vv),i=AM("far","float",t).setGroup(Vv),r=wS(e);return KL(r,n,i)})(e):null;t=new rA,t.colorNode=Yy(0,0,0,1),t.depthNode=n,t.isShadowPassMaterial=!0,t.name="ShadowMaterial",t.fog=!1,jL.set(e,t)}return t},JL=new WC,QL=[],eD=(e,t,n,i)=>{QL[0]=e,QL[1]=t;let r=JL.get(QL);return void 0!==r&&r.shadowType===n&&r.useVelocity===i||(r=(r,s,a,o,l,u,...c)=>{(!0===r.castShadow||r.receiveShadow&&3===n)&&(i&&(x_(r).useVelocity=!0),r.onBeforeShadow(e,r,a,t.camera,o,s.overrideMaterial,u),e.renderObject(r,s,a,o,l,u,...c),r.onAfterShadow(e,r,a,t.camera,o,s.overrideMaterial,u))},r.shadowType=n,r.useVelocity=i,JL.set(QL,r)),QL[0]=null,QL[1]=null,r},tD=Py(({samples:e,radius:t,size:n,shadowPass:i,depthLayer:r})=>{const s=Fy(0).toVar("meanVertical"),a=Fy(0).toVar("squareMeanVertical"),o=e.lessThanEqual(Fy(1)).select(Fy(0),Fy(2).div(e.sub(1))),l=e.lessThanEqual(Fy(1)).select(Fy(0),Fy(-1));_E({start:By(0),end:By(e),type:"int",condition:"<"},({i:e})=>{const u=l.add(Fy(e).mul(o));let c=i.sample(Zv(sS.xy,zy(0,u).mul(t)).div(n));i.value.isArrayTexture&&(c=c.depth(r)),c=c.x,s.addAssign(c),a.addAssign(c.mul(c))}),s.divAssign(e),a.divAssign(e);const u=Ux(a.sub(s.mul(s)));return zy(s,u)}),nD=Py(({samples:e,radius:t,size:n,shadowPass:i,depthLayer:r})=>{const s=Fy(0).toVar("meanHorizontal"),a=Fy(0).toVar("squareMeanHorizontal"),o=e.lessThanEqual(Fy(1)).select(Fy(0),Fy(2).div(e.sub(1))),l=e.lessThanEqual(Fy(1)).select(Fy(0),Fy(-1));_E({start:By(0),end:By(e),type:"int",condition:"<"},({i:e})=>{const u=l.add(Fy(e).mul(o));let c=i.sample(Zv(sS.xy,zy(u,0).mul(t)).div(n));i.value.isArrayTexture&&(c=c.depth(r)),s.addAssign(c.x),a.addAssign(Zv(c.y.mul(c.y),c.x.mul(c.x)))}),s.divAssign(e),a.divAssign(e);const u=Ux(a.sub(s.mul(s)));return zy(s,u)}),iD=[WL,XL,$L,YL];let rD;const sD=new EP;class aD extends kL{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._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:i,shadow:r,depthLayer:s}){const a=i.x.greaterThanEqual(0).and(i.x.lessThanEqual(1)).and(i.y.greaterThanEqual(0)).and(i.y.lessThanEqual(1)).and(i.z.lessThanEqual(1)),o=t({depthTexture:n,shadowCoord:i,shadow:r,depthLayer:s});return a.select(o,Fy(1))}setupShadowCoord(e,t){const{shadow:n}=this,{renderer:i}=e,r=AM("bias","float",n).setGroup(Vv);let s,a=t;if(n.camera.isOrthographicCamera||!0!==i.logarithmicDepthBuffer)a=a.xyz.div(a.w),s=a.z,i.coordinateSystem===un&&(s=s.mul(2).sub(1));else{const e=a.w;a=a.xy.div(e);const t=AM("near","float",n.camera).setGroup(Vv),i=AM("far","float",n.camera).setGroup(Vv);s=qE(e.negate(),t,i)}return a=jy(a.x,a.y.oneMinus(),s.add(r)),a}getShadowFilterFn(e){return iD[e]}setupRenderTarget(e,t){const n=new vo(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=Zt;const i=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return i.texture.name="ShadowMap",i.texture.type=e.mapType,i.depthTexture=n,{shadowMap:i,depthTexture:n}}setupShadow(e){const{renderer:t}=e,{light:n,shadow:i}=this,r=t.shadowMap.type,{depthTexture:s,shadowMap:a}=this.setupRenderTarget(i,e);if(i.camera.updateProjectionMatrix(),3===r&&!0!==i.isPointLightShadow){s.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:et,type:ze,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:et,type:ze,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:et,type:ze,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:et,type:ze,depthBuffer:!1}));let t=jT(s);s.isArrayTexture&&(t=t.depth(this.depthLayer));let n=jT(this.vsmShadowMapVertical.texture);s.isArrayTexture&&(n=n.depth(this.depthLayer));const r=AM("blurSamples","float",i).setGroup(Vv),o=AM("radius","float",i).setGroup(Vv),l=AM("mapSize","vec2",i).setGroup(Vv);let u=this.vsmMaterialVertical||(this.vsmMaterialVertical=new rA);u.fragmentNode=tD({samples:r,radius:o,size:l,shadowPass:t,depthLayer:this.depthLayer}).context(e.getSharedContext()),u.name="VSMVertical",u=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new rA),u.fragmentNode=nD({samples:r,radius:o,size:l,shadowPass:n,depthLayer:this.depthLayer}).context(e.getSharedContext()),u.name="VSMHorizontal"}const o=AM("intensity","float",i).setGroup(Vv),l=AM("normalBias","float",i).setGroup(Vv),u=IL(n).mul(GL.add(sM.mul(l))),c=this.setupShadowCoord(e,u),h=i.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(null===h)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const d=3===r&&!0!==i.isPointLightShadow?this.vsmShadowMapHorizontal.texture:s,p=this.setupShadowFilter(e,{filterFn:h,shadowTexture:a.texture,depthTexture:d,shadowCoord:c,shadow:i,depthLayer:this.depthLayer});let m=jT(a.texture,c);s.isArrayTexture&&(m=m.depth(this.depthLayer));const f=Mb(1,p.rgb.mix(m,1),o.mul(m.a)).toVar();return this.shadowMap=a,this.shadow.map=a,f}setup(e){if(!1!==e.renderer.shadowMap.enabled)return Py(()=>{let t=this._node;return this.setupShadowPosition(e),null===t&&(this._node=t=this.setupShadow(e)),e.material.shadowNode,e.material.receivedShadowNode&&(t=e.material.receivedShadowNode(t)),t})()}renderShadow(e){const{shadow:t,shadowMap:n,light:i}=this,{renderer:r,scene:s}=e;t.updateMatrices(i),n.setSize(t.mapSize.width,t.mapSize.height,n.depth),r.render(s,t.camera)}updateShadow(e){const{shadowMap:t,light:n,shadow:i}=this,{renderer:r,scene:s,camera:a}=e,o=r.shadowMap.type,l=t.depthTexture.version;this._depthVersionCached=l;const u=i.camera.layers.mask;4294967294&i.camera.layers.mask||(i.camera.layers.mask=a.layers.mask);const c=r.getRenderObjectFunction(),h=r.getMRT(),d=!!h&&h.has("velocity");rD=function(e,t,n){return n=function(e,t){return t=function(e,t={}){return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}(t,n=HL(e,n)),n}(r,s,rD),s.overrideMaterial=ZL(n),r.setRenderObjectFunction(eD(r,i,o,d)),r.setClearColor(0,0),r.setRenderTarget(t),this.renderShadow(e),r.setRenderObjectFunction(c),3===o&&!0!==i.isPointLightShadow&&this.vsmPass(r),i.camera.layers.mask=u,function(e,t,n){!function(e,t){e.toneMapping=t.toneMapping,e.toneMappingExposure=t.toneMappingExposure,e.outputColorSpace=t.outputColorSpace,e.setRenderTarget(t.renderTarget,t.activeCubeFace,t.activeMipmapLevel),e.setRenderObjectFunction(t.renderObjectFunction),e.setPixelRatio(t.pixelRatio),e.setMRT(t.mrt),e.setClearColor(t.clearColor,t.clearAlpha),e.autoClear=t.autoClear,e.setScissorTest(t.scissorTest)}(e,n),function(e,t){e.background=t.background,e.backgroundNode=t.backgroundNode,e.overrideMaterial=t.overrideMaterial}(t,n)}(r,s,rD)}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),sD.material=this.vsmMaterialVertical,sD.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),sD.material=this.vsmMaterialHorizontal,sD.render(e)}dispose(){this.shadowMap.dispose(),this.shadowMap=null,null!==this.vsmShadowMapVertical&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),null!==this.vsmShadowMapHorizontal&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null),super.dispose()}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 oD=(e,t)=>Ty(new aD(e,t)),lD=new br,uD=Py(([e,t])=>{const n=e.toVar(),i=$x(n),r=ex(1,cb(i.x,cb(i.y,i.z)));i.mulAssign(r),n.mulAssign(r.mul(t.mul(2).oneMinus()));const s=zy(n.xy).toVar(),a=t.mul(1.5).oneMinus();return Dy(i.z.greaterThanEqual(a),()=>{Dy(n.z.greaterThan(0),()=>{s.x.assign(Jv(4,n.x))})}).ElseIf(i.x.greaterThanEqual(a),()=>{const e=Yx(n.x);s.x.assign(n.z.mul(e).add(e.mul(2)))}).ElseIf(i.y.greaterThanEqual(a),()=>{const e=Yx(n.y);s.x.assign(n.x.add(e.mul(2)).add(2)),s.y.assign(n.z.mul(e).sub(2))}),zy(.125,.25).mul(s).add(zy(.375,.75)).flipY()}).setLayout({name:"cubeToUV",type:"vec2",inputs:[{name:"pos",type:"vec3"},{name:"texelSizeY",type:"float"}]}),cD=Py(({depthTexture:e,bd3D:t,dp:n,texelSize:i})=>jT(e,uD(t,i.y)).compare(n)),hD=Py(({depthTexture:e,bd3D:t,dp:n,texelSize:i,shadow:r})=>{const s=AM("radius","float",r).setGroup(Vv),a=zy(-1,1).mul(s).mul(i.y);return jT(e,uD(t.add(a.xyy),i.y)).compare(n).add(jT(e,uD(t.add(a.yyy),i.y)).compare(n)).add(jT(e,uD(t.add(a.xyx),i.y)).compare(n)).add(jT(e,uD(t.add(a.yyx),i.y)).compare(n)).add(jT(e,uD(t,i.y)).compare(n)).add(jT(e,uD(t.add(a.xxy),i.y)).compare(n)).add(jT(e,uD(t.add(a.yxy),i.y)).compare(n)).add(jT(e,uD(t.add(a.xxx),i.y)).compare(n)).add(jT(e,uD(t.add(a.yxx),i.y)).compare(n)).mul(1/9)}),dD=Py(({filterFn:e,depthTexture:t,shadowCoord:n,shadow:i})=>{const r=n.xyz.toVar(),s=r.length(),a=kv("float").setGroup(Vv).onRenderUpdate(()=>i.camera.near),o=kv("float").setGroup(Vv).onRenderUpdate(()=>i.camera.far),l=AM("bias","float",i).setGroup(Vv),u=kv(i.mapSize).setGroup(Vv),c=Fy(1).toVar();return Dy(s.sub(o).lessThanEqual(0).and(s.sub(a).greaterThanEqual(0)),()=>{const n=s.sub(a).div(o.sub(a)).toVar();n.addAssign(l);const h=r.normalize(),d=zy(1).div(u.mul(zy(4,2)));c.assign(e({depthTexture:t,bd3D:h,dp:n,texelSize:d,shadow:i}))}),c}),pD=new Zn,mD=new Sn,fD=new Sn;class gD extends aD{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return 0===e?cD:hD}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,shadowTexture:n,depthTexture:i,shadowCoord:r,shadow:s}){return dD({filterFn:t,shadowTexture:n,depthTexture:i,shadowCoord:r,shadow:s})}renderShadow(e){const{shadow:t,shadowMap:n,light:i}=this,{renderer:r,scene:s}=e,a=t.getFrameExtents();fD.copy(t.mapSize),fD.multiply(a),n.setSize(fD.width,fD.height),mD.copy(t.mapSize);const o=r.autoClear,l=r.getClearColor(lD),u=r.getClearAlpha();r.autoClear=!1,r.setClearColor(t.clearColor,t.clearAlpha),r.clear();const c=t.getViewportCount();for(let h=0;h<c;h++){const e=t.getViewport(h),a=mD.x*e.x,o=fD.y-mD.y-mD.y*e.y;pD.set(a,o,mD.x*e.z,mD.y*e.w),n.viewport.copy(pD),t.updateMatrices(i,h),r.render(s,t.camera)}r.autoClear=o,r.setClearColor(l,u)}}const _D=(e,t)=>Ty(new gD(e,t));class yD extends ME{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new br,this.colorNode=e&&e.colorNode||kv(this.color).setGroup(Vv),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=M_.FRAME}getHash(){return this.light.uuid}getLightVector(e){return UL(this.light).sub(e.context.positionView||XS)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return oD(this.light)}setupShadow(e){const{renderer:t}=e;if(!1===t.shadowMap.enabled)return;let n=this.shadowColorNode;if(null===n){const e=this.light.shadow.shadowNode;let t;t=void 0!==e?Ty(e):this.setupShadowNode(),this.shadowNode=t,this.shadowColorNode=n=this.colorNode.mul(t),this.baseColorNode=this.colorNode}this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):null!==this.shadowNode&&(this.shadowNode.dispose(),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 vD=Py(({lightDistance:e,cutoffDistance:t,decayExponent:n})=>{const i=e.pow(n).max(.01).reciprocal();return t.greaterThan(0).select(i.mul(e.div(t).pow4().oneMinus().clamp().pow2()),i)}),xD=({color:e,lightVector:t,cutoffDistance:n,decayExponent:i})=>{const r=t.normalize(),s=t.length(),a=vD({lightDistance:s,cutoffDistance:n,decayExponent:i});return{lightDirection:r,lightColor:e.mul(a)}};class bD extends yD{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=kv(0).setGroup(Vv),this.decayExponentNode=kv(2).setGroup(Vv)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return _D(this.light)}setupDirect(e){return xD({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const TD=Py(([e=FT()])=>{const t=e.mul(2),n=t.x.floor(),i=t.y.floor();return n.add(i).mod(2).sign()}),SD=Py(([e=FT()],{renderer:t,material:n})=>{const i=Sb(e.mul(2).sub(1));let r;if(n.alphaToCoverage&&t.samples>1){const e=Fy(i.fwidth()).toVar();r=Rb(e.oneMinus(),e.add(1),i).oneMinus()}else r=Bb(i.greaterThan(1),0,1);return r}),MD=Py(([e,t,n])=>{const i=Fy(n).toVar(),r=Fy(t).toVar(),s=qy(e).toVar();return Bb(s,r,i)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),wD=Py(([e,t])=>{const n=qy(t).toVar(),i=Fy(e).toVar();return Bb(n,i.negate(),i)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),ED=Py(([e])=>{const t=Fy(e).toVar();return By(Bx(t))}
vendor: 4,305 bytes, line 1
1).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),AD=Py(([e,t])=>{const n=Fy(e).toVar();return t.assign(ED(n)),n.sub(Fy(t))}),RD=KN([Py(([e,t,n,i,r,s])=>{const a=Fy(s).toVar(),o=Fy(r).toVar(),l=Fy(i).toVar(),u=Fy(n).toVar(),c=Fy(t).toVar(),h=Fy(e).toVar(),d=Fy(Jv(1,o)).toVar();return Jv(1,a).mul(h.mul(d).add(c.mul(o))).add(a.mul(u.mul(d).add(l.mul(o))))}).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"}]}),Py(([e,t,n,i,r,s])=>{const a=Fy(s).toVar(),o=Fy(r).toVar(),l=jy(i).toVar(),u=jy(n).toVar(),c=jy(t).toVar(),h=jy(e).toVar(),d=Fy(Jv(1,o)).toVar();return Jv(1,a).mul(h.mul(d).add(c.mul(o))).add(a.mul(u.mul(d).add(l.mul(o))))}).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"}]})]),CD=KN([Py(([e,t,n,i,r,s,a,o,l,u,c])=>{const h=Fy(c).toVar(),d=Fy(u).toVar(),p=Fy(l).toVar(),m=Fy(o).toVar(),f=Fy(a).toVar(),g=Fy(s).toVar(),_=Fy(r).toVar(),y=Fy(i).toVar(),v=Fy(n).toVar(),x=Fy(t).toVar(),b=Fy(e).toVar(),T=Fy(Jv(1,p)).toVar(),S=Fy(Jv(1,d)).toVar();return Fy(Jv(1,h)).toVar().mul(S.mul(b.mul(T).add(x.mul(p))).add(d.mul(v.mul(T).add(y.mul(p))))).add(h.mul(S.mul(_.mul(T).add(g.mul(p))).add(d.mul(f.mul(T).add(m.mul(p))))))}).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"}]}),Py(([e,t,n,i,r,s,a,o,l,u,c])=>{const h=Fy(c).toVar(),d=Fy(u).toVar(),p=Fy(l).toVar(),m=jy(o).toVar(),f=jy(a).toVar(),g=jy(s).toVar(),_=jy(r).toVar(),y=jy(i).toVar(),v=jy(n).toVar(),x=jy(t).toVar(),b=jy(e).toVar(),T=Fy(Jv(1,p)).toVar(),S=Fy(Jv(1,d)).toVar();return Fy(Jv(1,h)).toVar().mul(S.mul(b.mul(T).add(x.mul(p))).add(d.mul(v.mul(T).add(y.mul(p))))).add(h.mul(S.mul(_.mul(T).add(g.mul(p))).add(d.mul(f.mul(T).add(m.mul(p))))))}).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"}]})]),ND=KN([Py(([e,t,n])=>{const i=Fy(n).toVar(),r=Fy(t).toVar(),s=Vy(e).toVar(),a=Vy(s.bitAnd(Vy(7))).toVar(),o=Fy(MD(a.lessThan(Vy(4)),r,i)).toVar(),l=Fy(Qv(2,MD(a.lessThan(Vy(4)),i,r))).toVar();return wD(o,qy(a.bitAnd(Vy(1)))).add(wD(l,qy(a.bitAnd(Vy(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Py(([e,t,n,i])=>{const r=Fy(i).toVar(),s=Fy(n).toVar(),a=Fy(t).toVar(),o=Vy(e).toVar(),l=Vy(o.bitAnd(Vy(15))).toVar(),u=Fy(MD(l.lessThan(Vy(8)),a,s)).toVar(),c=Fy(MD(l.lessThan(Vy(4)),s,MD(l.equal(Vy(12)).or(l.equal(Vy(14))),a,r))).toVar();return wD(u,qy(l.bitAnd(Vy(1)))).add(wD(c,qy(l.bitAnd(Vy(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"}]})]),PD=KN([Py(([e,t,n])=>{const i=Fy(n).toVar(),r=Fy(t).toVar(),s=Xy(e).toVar();return jy(ND(s.x,r,i),ND(s.y,r,i),ND(s.z,r,i))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Py(([e,t,n,i])=>{const r=Fy(i).toVar(),s=Fy(n).toVar(),a=Fy(t).toVar(),o=Xy(e).toVar();return jy(ND(o.x,a,s,r),ND(o.y,a,s,r),ND(o.z,a,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"}]})]),ID=Py(([e])=>{const t=Fy(e).toVar();return Qv(.6616,t)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),LD=Py(([e])=>{const t=Fy(e).toVar();return Qv(.982,t)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),DD=KN([ID,Py(([e])=>{const t=jy(e).toVar();return Qv(.6616,t)}
vendor: 67,032 bytes, line 1
1).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),OD=KN([LD,Py(([e])=>{const t=jy(e).toVar();return Qv(.982,t)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),UD=Py(([e,t])=>{const n=By(t).toVar(),i=Vy(e).toVar();return i.shiftLeft(n).bitOr(i.shiftRight(By(32).sub(n)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),FD=Py(([e,t,n])=>{e.subAssign(n),e.bitXorAssign(UD(n,By(4))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(UD(e,By(6))),e.addAssign(n),n.subAssign(t),n.bitXorAssign(UD(t,By(8))),t.addAssign(e),e.subAssign(n),e.bitXorAssign(UD(n,By(16))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(UD(e,By(19))),e.addAssign(n),n.subAssign(t),n.bitXorAssign(UD(t,By(4))),t.addAssign(e)}),BD=Py(([e,t,n])=>{const i=Vy(n).toVar(),r=Vy(t).toVar(),s=Vy(e).toVar();return i.bitXorAssign(r),i.subAssign(UD(r,By(14))),s.bitXorAssign(i),s.subAssign(UD(i,By(11))),r.bitXorAssign(s),r.subAssign(UD(s,By(25))),i.bitXorAssign(r),i.subAssign(UD(r,By(16))),s.bitXorAssign(i),s.subAssign(UD(i,By(4))),r.bitXorAssign(s),r.subAssign(UD(s,By(14))),i.bitXorAssign(r),i.subAssign(UD(r,By(24))),i}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),VD=Py(([e])=>{const t=Vy(e).toVar();return Fy(t).div(Fy(Vy(By(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),qD=Py(([e])=>{const t=Fy(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),zD=KN([Py(([e])=>{const t=By(e).toVar(),n=Vy(Vy(1)).toVar(),i=Vy(Vy(By(3735928559)).add(n.shiftLeft(Vy(2))).add(Vy(13))).toVar();return BD(i.add(Vy(t)),i,i)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),Py(([e,t])=>{const n=By(t).toVar(),i=By(e).toVar(),r=Vy(Vy(2)).toVar(),s=Vy().toVar(),a=Vy().toVar(),o=Vy().toVar();return s.assign(a.assign(o.assign(Vy(By(3735928559)).add(r.shiftLeft(Vy(2))).add(Vy(13))))),s.addAssign(Vy(i)),a.addAssign(Vy(n)),BD(s,a,o)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Py(([e,t,n])=>{const i=By(n).toVar(),r=By(t).toVar(),s=By(e).toVar(),a=Vy(Vy(3)).toVar(),o=Vy().toVar(),l=Vy().toVar(),u=Vy().toVar();return o.assign(l.assign(u.assign(Vy(By(3735928559)).add(a.shiftLeft(Vy(2))).add(Vy(13))))),o.addAssign(Vy(s)),l.addAssign(Vy(r)),u.addAssign(Vy(i)),BD(o,l,u)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Py(([e,t,n,i])=>{const r=By(i).toVar(),s=By(n).toVar(),a=By(t).toVar(),o=By(e).toVar(),l=Vy(Vy(4)).toVar(),u=Vy().toVar(),c=Vy().toVar(),h=Vy().toVar();return u.assign(c.assign(h.assign(Vy(By(3735928559)).add(l.shiftLeft(Vy(2))).add(Vy(13))))),u.addAssign(Vy(o)),c.addAssign(Vy(a)),h.addAssign(Vy(s)),FD(u,c,h),u.addAssign(Vy(r)),BD(u,c,h)}).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"}]}),Py(([e,t,n,i,r])=>{const s=By(r).toVar(),a=By(i).toVar(),o=By(n).toVar(),l=By(t).toVar(),u=By(e).toVar(),c=Vy(Vy(5)).toVar(),h=Vy().toVar(),d=Vy().toVar(),p=Vy().toVar();return h.assign(d.assign(p.assign(Vy(By(3735928559)).add(c.shiftLeft(Vy(2))).add(Vy(13))))),h.addAssign(Vy(u)),d.addAssign(Vy(l)),p.addAssign(Vy(o)),FD(h,d,p),h.addAssign(Vy(a)),d.addAssign(Vy(s)),BD(h,d,p)}).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"}]})]),kD=KN([Py(([e,t])=>{const n=By(t).toVar(),i=By(e).toVar(),r=Vy(zD(i,n)).toVar(),s=Xy().toVar();return s.x.assign(r.bitAnd(By(255))),s.y.assign(r.shiftRight(By(8)).bitAnd(By(255))),s.z.assign(r.shiftRight(By(16)).bitAnd(By(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Py(([e,t,n])=>{const i=By(n).toVar(),r=By(t).toVar(),s=By(e).toVar(),a=Vy(zD(s,r,i)).toVar(),o=Xy().toVar();return o.x.assign(a.bitAnd(By(255))),o.y.assign(a.shiftRight(By(8)).bitAnd(By(255))),o.z.assign(a.shiftRight(By(16)).bitAnd(By(255))),o}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]})]),GD=KN([Py(([e])=>{const t=zy(e).toVar(),n=By().toVar(),i=By().toVar(),r=Fy(AD(t.x,n)).toVar(),s=Fy(AD(t.y,i)).toVar(),a=Fy(qD(r)).toVar(),o=Fy(qD(s)).toVar(),l=Fy(RD(ND(zD(n,i),r,s),ND(zD(n.add(By(1)),i),r.sub(1),s),ND(zD(n,i.add(By(1))),r,s.sub(1)),ND(zD(n.add(By(1)),i.add(By(1))),r.sub(1),s.sub(1)),a,o)).toVar();return DD(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),Py(([e])=>{const t=jy(e).toVar(),n=By().toVar(),i=By().toVar(),r=By().toVar(),s=Fy(AD(t.x,n)).toVar(),a=Fy(AD(t.y,i)).toVar(),o=Fy(AD(t.z,r)).toVar(),l=Fy(qD(s)).toVar(),u=Fy(qD(a)).toVar(),c=Fy(qD(o)).toVar(),h=Fy(CD(ND(zD(n,i,r),s,a,o),ND(zD(n.add(By(1)),i,r),s.sub(1),a,o),ND(zD(n,i.add(By(1)),r),s,a.sub(1),o),ND(zD(n.add(By(1)),i.add(By(1)),r),s.sub(1),a.sub(1),o),ND(zD(n,i,r.add(By(1))),s,a,o.sub(1)),ND(zD(n.add(By(1)),i,r.add(By(1))),s.sub(1),a,o.sub(1)),ND(zD(n,i.add(By(1)),r.add(By(1))),s,a.sub(1),o.sub(1)),ND(zD(n.add(By(1)),i.add(By(1)),r.add(By(1))),s.sub(1),a.sub(1),o.sub(1)),l,u,c)).toVar();return OD(h)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]})]),HD=KN([Py(([e])=>{const t=zy(e).toVar(),n=By().toVar(),i=By().toVar(),r=Fy(AD(t.x,n)).toVar(),s=Fy(AD(t.y,i)).toVar(),a=Fy(qD(r)).toVar(),o=Fy(qD(s)).toVar(),l=jy(RD(PD(kD(n,i),r,s),PD(kD(n.add(By(1)),i),r.sub(1),s),PD(kD(n,i.add(By(1))),r,s.sub(1)),PD(kD(n.add(By(1)),i.add(By(1))),r.sub(1),s.sub(1)),a,o)).toVar();return DD(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Py(([e])=>{const t=jy(e).toVar(),n=By().toVar(),i=By().toVar(),r=By().toVar(),s=Fy(AD(t.x,n)).toVar(),a=Fy(AD(t.y,i)).toVar(),o=Fy(AD(t.z,r)).toVar(),l=Fy(qD(s)).toVar(),u=Fy(qD(a)).toVar(),c=Fy(qD(o)).toVar(),h=jy(CD(PD(kD(n,i,r),s,a,o),PD(kD(n.add(By(1)),i,r),s.sub(1),a,o),PD(kD(n,i.add(By(1)),r),s,a.sub(1),o),PD(kD(n.add(By(1)),i.add(By(1)),r),s.sub(1),a.sub(1),o),PD(kD(n,i,r.add(By(1))),s,a,o.sub(1)),PD(kD(n.add(By(1)),i,r.add(By(1))),s.sub(1),a,o.sub(1)),PD(kD(n,i.add(By(1)),r.add(By(1))),s,a.sub(1),o.sub(1)),PD(kD(n.add(By(1)),i.add(By(1)),r.add(By(1))),s.sub(1),a.sub(1),o.sub(1)),l,u,c)).toVar();return OD(h)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]})]),jD=KN([Py(([e])=>{const t=Fy(e).toVar(),n=By(ED(t)).toVar();return VD(zD(n))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Py(([e])=>{const t=zy(e).toVar(),n=By(ED(t.x)).toVar(),i=By(ED(t.y)).toVar();return VD(zD(n,i))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Py(([e])=>{const t=jy(e).toVar(),n=By(ED(t.x)).toVar(),i=By(ED(t.y)).toVar(),r=By(ED(t.z)).toVar();return VD(zD(n,i,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Py(([e])=>{const t=Yy(e).toVar(),n=By(ED(t.x)).toVar(),i=By(ED(t.y)).toVar(),r=By(ED(t.z)).toVar(),s=By(ED(t.w)).toVar();return VD(zD(n,i,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]})]),WD=KN([Py(([e])=>{const t=Fy(e).toVar(),n=By(ED(t)).toVar();return jy(VD(zD(n,By(0))),VD(zD(n,By(1))),VD(zD(n,By(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),Py(([e])=>{const t=zy(e).toVar(),n=By(ED(t.x)).toVar(),i=By(ED(t.y)).toVar();return jy(VD(zD(n,i,By(0))),VD(zD(n,i,By(1))),VD(zD(n,i,By(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Py(([e])=>{const t=jy(e).toVar(),n=By(ED(t.x)).toVar(),i=By(ED(t.y)).toVar(),r=By(ED(t.z)).toVar();return jy(VD(zD(n,i,r,By(0))),VD(zD(n,i,r,By(1))),VD(zD(n,i,r,By(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Py(([e])=>{const t=Yy(e).toVar(),n=By(ED(t.x)).toVar(),i=By(ED(t.y)).toVar(),r=By(ED(t.z)).toVar(),s=By(ED(t.w)).toVar();return jy(VD(zD(n,i,r,s,By(0))),VD(zD(n,i,r,s,By(1))),VD(zD(n,i,r,s,By(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]})]),XD=Py(([e,t,n,i])=>{const r=Fy(i).toVar(),s=Fy(n).toVar(),a=By(t).toVar(),o=jy(e).toVar(),l=Fy(0).toVar(),u=Fy(1).toVar();return _E(a,()=>{l.addAssign(u.mul(GD(o))),u.mulAssign(r),o.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"}]}),$D=Py(([e,t,n,i])=>{const r=Fy(i).toVar(),s=Fy(n).toVar(),a=By(t).toVar(),o=jy(e).toVar(),l=jy(0).toVar(),u=Fy(1).toVar();return _E(a,()=>{l.addAssign(u.mul(HD(o))),u.mulAssign(r),o.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"}]}),YD=Py(([e,t,n,i])=>{const r=Fy(i).toVar(),s=Fy(n).toVar(),a=By(t).toVar(),o=jy(e).toVar();return zy(XD(o,a,s,r),XD(o.add(jy(By(19),By(193),By(17))),a,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"}]}),KD=Py(([e,t,n,i])=>{const r=Fy(i).toVar(),s=Fy(n).toVar(),a=By(t).toVar(),o=jy(e).toVar(),l=jy($D(o,a,s,r)).toVar(),u=Fy(XD(o.add(jy(By(19),By(193),By(17))),a,s,r)).toVar();return Yy(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"}]}),ZD=KN([Py(([e,t,n,i,r,s,a])=>{const o=By(a).toVar(),l=Fy(s).toVar(),u=By(r).toVar(),c=By(i).toVar(),h=By(n).toVar(),d=By(t).toVar(),p=zy(e).toVar(),m=jy(WD(zy(d.add(c),h.add(u)))).toVar(),f=zy(m.x,m.y).toVar();f.subAssign(.5),f.mulAssign(l),f.addAssign(.5);const g=zy(zy(Fy(d),Fy(h)).add(f)).toVar(),_=zy(g.sub(p)).toVar();return Dy(o.equal(By(2)),()=>$x(_.x).add($x(_.y))),Dy(o.equal(By(3)),()=>cb($x(_.x),$x(_.y))),fb(_,_)}).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"}]}),Py(([e,t,n,i,r,s,a,o,l])=>{const u=By(l).toVar(),c=Fy(o).toVar(),h=By(a).toVar(),d=By(s).toVar(),p=By(r).toVar(),m=By(i).toVar(),f=By(n).toVar(),g=By(t).toVar(),_=jy(e).toVar(),y=jy(WD(jy(g.add(p),f.add(d),m.add(h)))).toVar();y.subAssign(.5),y.mulAssign(c),y.addAssign(.5);const v=jy(jy(Fy(g),Fy(f),Fy(m)).add(y)).toVar(),x=jy(v.sub(_)).toVar();return Dy(u.equal(By(2)),()=>$x(x.x).add($x(x.y)).add($x(x.z))),Dy(u.equal(By(3)),()=>cb($x(x.x),$x(x.y),$x(x.z))),fb(x,x)}).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"}]})]),JD=Py(([e,t,n])=>{const i=By(n).toVar(),r=Fy(t).toVar(),s=zy(e).toVar(),a=By().toVar(),o=By().toVar(),l=zy(AD(s.x,a),AD(s.y,o)).toVar(),u=Fy(1e6).toVar();return _E({start:-1,end:By(1),name:"x",condition:"<="},({x:e})=>{_E({start:-1,end:By(1),name:"y",condition:"<="},({y:t})=>{const n=Fy(ZD(l,e,t,a,o,r,i)).toVar();u.assign(ub(u,n))})}),Dy(i.equal(By(0)),()=>{u.assign(Ux(u))}),u}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),QD=Py(([e,t,n])=>{const i=By(n).toVar(),r=Fy(t).toVar(),s=zy(e).toVar(),a=By().toVar(),o=By().toVar(),l=zy(AD(s.x,a),AD(s.y,o)).toVar(),u=zy(1e6,1e6).toVar();return _E({start:-1,end:By(1),name:"x",condition:"<="},({x:e})=>{_E({start:-1,end:By(1),name:"y",condition:"<="},({y:t})=>{const n=Fy(ZD(l,e,t,a,o,r,i)).toVar();Dy(n.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(n)}).ElseIf(n.lessThan(u.y),()=>{u.y.assign(n)})})}),Dy(i.equal(By(0)),()=>{u.assign(Ux(u))}),u}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),eO=Py(([e,t,n])=>{const i=By(n).toVar(),r=Fy(t).toVar(),s=zy(e).toVar(),a=By().toVar(),o=By().toVar(),l=zy(AD(s.x,a),AD(s.y,o)).toVar(),u=jy(1e6,1e6,1e6).toVar();return _E({start:-1,end:By(1),name:"x",condition:"<="},({x:e})=>{_E({start:-1,end:By(1),name:"y",condition:"<="},({y:t})=>{const n=Fy(ZD(l,e,t,a,o,r,i)).toVar();Dy(n.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(n)}).ElseIf(n.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(n)}).ElseIf(n.lessThan(u.z),()=>{u.z.assign(n)})})}),Dy(i.equal(By(0)),()=>{u.assign(Ux(u))}),u}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),tO=KN([JD,Py(([e,t,n])=>{const i=By(n).toVar(),r=Fy(t).toVar(),s=jy(e).toVar(),a=By().toVar(),o=By().toVar(),l=By().toVar(),u=jy(AD(s.x,a),AD(s.y,o),AD(s.z,l)).toVar(),c=Fy(1e6).toVar();return _E({start:-1,end:By(1),name:"x",condition:"<="},({x:e})=>{_E({start:-1,end:By(1),name:"y",condition:"<="},({y:t})=>{_E({start:-1,end:By(1),name:"z",condition:"<="},({z:n})=>{const s=Fy(ZD(u,e,t,n,a,o,l,r,i)).toVar();c.assign(ub(c,s))})})}),Dy(i.equal(By(0)),()=>{c.assign(Ux(c))}),c}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),nO=KN([QD,Py(([e,t,n])=>{const i=By(n).toVar(),r=Fy(t).toVar(),s=jy(e).toVar(),a=By().toVar(),o=By().toVar(),l=By().toVar(),u=jy(AD(s.x,a),AD(s.y,o),AD(s.z,l)).toVar(),c=zy(1e6,1e6).toVar();return _E({start:-1,end:By(1),name:"x",condition:"<="},({x:e})=>{_E({start:-1,end:By(1),name:"y",condition:"<="},({y:t})=>{_E({start:-1,end:By(1),name:"z",condition:"<="},({z:n})=>{const s=Fy(ZD(u,e,t,n,a,o,l,r,i)).toVar();Dy(s.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(s)}).ElseIf(s.lessThan(c.y),()=>{c.y.assign(s)})})})}),Dy(i.equal(By(0)),()=>{c.assign(Ux(c))}),c}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),iO=KN([eO,Py(([e,t,n])=>{const i=By(n).toVar(),r=Fy(t).toVar(),s=jy(e).toVar(),a=By().toVar(),o=By().toVar(),l=By().toVar(),u=jy(AD(s.x,a),AD(s.y,o),AD(s.z,l)).toVar(),c=jy(1e6,1e6,1e6).toVar();return _E({start:-1,end:By(1),name:"x",condition:"<="},({x:e})=>{_E({start:-1,end:By(1),name:"y",condition:"<="},({y:t})=>{_E({start:-1,end:By(1),name:"z",condition:"<="},({z:n})=>{const s=Fy(ZD(u,e,t,n,a,o,l,r,i)).toVar();Dy(s.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(s)}).ElseIf(s.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(s)}).ElseIf(s.lessThan(c.z),()=>{c.z.assign(s)})})})}),Dy(i.equal(By(0)),()=>{c.assign(Ux(c))}),c}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),rO=Py(([e,t,n,i,r,s,a,o,l,u,c])=>{const h=By(e).toVar(),d=zy(t).toVar(),p=zy(n).toVar(),m=zy(i).toVar(),f=Fy(r).toVar(),g=Fy(s).toVar(),_=Fy(a).toVar(),y=qy(o).toVar(),v=By(l).toVar(),x=Fy(u).toVar(),b=Fy(c).toVar(),T=d.mul(p).add(m),S=Fy(0).toVar();return Dy(h.equal(By(0)),()=>{S.assign(HD(T))}),Dy(h.equal(By(1)),()=>{S.assign(WD(T))}),Dy(h.equal(By(2)),()=>{S.assign(iO(T,f,By(0)))}),Dy(h.equal(By(3)),()=>{S.assign($D(jy(T,0),v,x,b))}),S.assign(S.mul(_.sub(g)).add(g)),Dy(y,()=>{S.assign(wb(S,g,_))}),S}).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"}]}),sO=Py(([e,t,n,i,r,s,a,o,l,u,c])=>{const h=By(e).toVar(),d=jy(t).toVar(),p=jy(n).toVar(),m=jy(i).toVar(),f=Fy(r).toVar(),g=Fy(s).toVar(),_=Fy(a).toVar(),y=qy(o).toVar(),v=By(l).toVar(),x=Fy(u).toVar(),b=Fy(c).toVar(),T=d.mul(p).add(m),S=Fy(0).toVar();return Dy(h.equal(By(0)),()=>{S.assign(HD(T))}),Dy(h.equal(By(1)),()=>{S.assign(WD(T))}),Dy(h.equal(By(2)),()=>{S.assign(iO(T,f,By(0)))}),Dy(h.equal(By(3)),()=>{S.assign($D(T,v,x,b))}),S.assign(S.mul(_.sub(g)).add(g)),Dy(y,()=>{S.assign(wb(S,g,_))}),S}).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"}]}),aO=Py(([e])=>{const t=e.y,n=e.z,i=jy().toVar();return Dy(t.lessThan(1e-4),()=>{i.assign(jy(n,n,n))}).Else(()=>{let r=e.x;r=r.sub(Bx(r)).mul(6).toVar();const s=By(ib(r)),a=r.sub(Fy(s)),o=n.mul(t.oneMinus()),l=n.mul(t.mul(a).oneMinus()),u=n.mul(t.mul(a.oneMinus()).oneMinus());Dy(s.equal(By(0)),()=>{i.assign(jy(n,u,o))}).ElseIf(s.equal(By(1)),()=>{i.assign(jy(l,n,o))}).ElseIf(s.equal(By(2)),()=>{i.assign(jy(o,n,u))}).ElseIf(s.equal(By(3)),()=>{i.assign(jy(o,l,n))}).ElseIf(s.equal(By(4)),()=>{i.assign(jy(u,o,n))}).Else(()=>{i.assign(jy(n,o,l))})}),i}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),oO=Py(([e])=>{const t=jy(e).toVar(),n=Fy(t.x).toVar(),i=Fy(t.y).toVar(),r=Fy(t.z).toVar(),s=Fy(ub(n,ub(i,r))).toVar(),a=Fy(cb(n,cb(i,r))).toVar(),o=Fy(a.sub(s)).toVar(),l=Fy().toVar(),u=Fy().toVar(),c=Fy().toVar();return c.assign(a),Dy(a.greaterThan(0),()=>{u.assign(o.div(a))}).Else(()=>{u.assign(0)}),Dy(u.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{Dy(n.greaterThanEqual(a),()=>{l.assign(i.sub(r).div(o))}).ElseIf(i.greaterThanEqual(a),()=>{l.assign(Zv(2,r.sub(n).div(o)))}).Else(()=>{l.assign(Zv(4,n.sub(i).div(o)))}),l.mulAssign(1/6),Dy(l.lessThan(0),()=>{l.addAssign(1)})}),jy(l,u,c)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),lO=Py(([e])=>{const t=jy(e).toVar(),n=$y(sx(t,jy(.04045))).toVar(),i=jy(t.div(12.92)).toVar(),r=jy(_b(cb(t.add(jy(.055)),jy(0)).div(1.055),jy(2.4))).toVar();return Mb(i,r,n)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),uO=(e,t)=>{e=Fy(e),t=Fy(t);const n=zy(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return Rb(e.sub(n),e.add(n),t)},cO=(e,t,n,i)=>Mb(e,t,n[i].clamp()),hO=(e,t,n,i,r)=>Mb(e,t,uO(n,i[r])),dO=Py(([e,t,n])=>{const i=qx(e).toVar(),r=Jv(Fy(.5).mul(t.sub(n)),jS).div(i).toVar(),s=Jv(Fy(-.5).mul(t.sub(n)),jS).div(i).toVar(),a=jy().toVar();a.x=i.x.greaterThan(Fy(0)).select(r.x,s.x),a.y=i.y.greaterThan(Fy(0)).select(r.y,s.y),a.z=i.z.greaterThan(Fy(0)).select(r.z,s.z);const o=ub(a.x,a.y,a.z).toVar();return jS.add(i.mul(o)).toVar().sub(n)}),pO=Py(([e,t])=>{const n=e.x,i=e.y,r=e.z;let s=t.element(0).mul(.886227);return s=s.add(t.element(1).mul(1.023328).mul(i)),s=s.add(t.element(2).mul(1.023328).mul(r)),s=s.add(t.element(3).mul(1.023328).mul(n)),s=s.add(t.element(4).mul(.858086).mul(n).mul(i)),s=s.add(t.element(5).mul(.858086).mul(i).mul(r)),s=s.add(t.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(t.element(7).mul(.858086).mul(n).mul(r)),s=s.add(t.element(8).mul(.429043).mul(Qv(n,n).sub(Qv(i,i)))),s});var mO=Object.freeze({__proto__:null,BRDF_GGX:HA,BRDF_Lambert:CA,BasicPointShadowFilter:cD,BasicShadowFilter:WL,Break:yE,Const:Xb,Continue:()=>CT("continue").toStack(),DFGApprox:jA,D_GGX:zA,Discard:NT,EPSILON:Mx,F_Schlick:RA,Fn:Py,INFINITY:wx,If:Dy,Loop:_E,NodeAccess:w_,NodeShaderStage:S_,NodeType:{BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},NodeUpdateType:M_,OnMaterialUpdate:e=>OP(DP.MATERIAL,e),OnObjectUpdate:e=>OP(DP.OBJECT,e),PCFShadowFilter:XL,PCFSoftShadowFilter:$L,PI:Ex,PI2:Ax,PointShadowFilter:hD,Return:()=>CT("return").toStack(),Schlick_to_F0:XA,ScriptableNodeResources:DI,ShaderNode:by,Stack:Oy,Switch:(...e)=>j_.Switch(...e),TBNViewMatrix:ew,VSMShadowFilter:YL,V_GGX_SmithCorrelated:VA,Var:Wb,VarIntent:$b,abs:$x,acesFilmicToneMapping:xI,acos:Wx,add:Zv,addMethodChaining:X_,addNodeElement:function(e){},agxToneMapping:MI,all:Rx,alphaT:yv,and:lx,anisotropy:vv,anisotropyB:bv,anisotropyT:xv,any:Cx,append:e=>Oy(e),array:Hv,arrayBuffer:e=>Ty(new G_(e,"ArrayBuffer")),asin:jx,assign:Wv,atan:Xx,atan2:Db,atomicAdd:(e,t)=>iL(tL.ATOMIC_ADD,e,t),atomicAnd:(e,t)=>iL(tL.ATOMIC_AND,e,t),atomicFunc:iL,atomicLoad:e=>iL(tL.ATOMIC_LOAD,e,null),atomicMax:(e,t)=>iL(tL.ATOMIC_MAX,e,t),atomicMin:(e,t)=>iL(tL.ATOMIC_MIN,e,t),atomicOr:(e,t)=>iL(tL.ATOMIC_OR,e,t),atomicStore:(e,t)=>iL(tL.ATOMIC_STORE,e,t),atomicSub:(e,t)=>iL(tL.ATOMIC_SUB,e,t),atomicXor:(e,t)=>iL(tL.ATOMIC_XOR,e,t),attenuationColor:Lv,attenuationDistance:Iv,attribute:UT,attributeArray:(e,t="float")=>{let n,i;!0===t.isStruct?(n=t.layout.getLength(),i=m_("float")):(n=f_(t),i=m_(t));const r=new FP(e,n,i);return dE(r,t,e)},backgroundBlurriness:GP,backgroundIntensity:HP,backgroundRotation:jP,batch:lE,bentNormalView:nw,billboarding:nP,bitAnd:dx,bitNot:px,bitOr:mx,bitXor:fx,bitangentGeometry:KM,bitangentLocal:ZM,bitangentView:JM,bitangentWorld:QM,bitcast:kN,blendBurn:ZE,blendColor:tA,blendDodge:JE,blendOverlay:eA,blendScreen:QE,blur:WR,bool:qy,buffer:$T,bufferAttribute:mT,builtin:JT,bumpMap:lw,burn:(...e)=>ZE(e),bvec2:Hy,bvec3:$y,bvec4:Jy,bypass:MT,cache:TT,call:$v,cameraFar:pS,cameraIndex:hS,cameraNear:dS,cameraNormalMatrix:yS,cameraPosition:vS,cameraProjectionMatrix:mS,cameraProjectionMatrixInverse:fS,cameraViewMatrix:gS,cameraViewport:xS,cameraWorldMatrix:_S,cbrt:Tb,cdl:lI,ceil:Vx,checker:TD,cineonToneMapping:yI,clamp:wb,clearcoat:hv,clearcoatNormalView:aM,clearcoatRoughness:dv,code:AI,color:Uy,colorSpaceToWorking:sT,colorToDirection:e=>Ty(e).mul(2).sub(1),compute:xT,computeKernel:vT,computeSkinning:(e,t=null)=>{const n=new mE(e);return n.positionNode=dE(new ua(e.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(Jw).toVar(),n.skinIndexNode=dE(new ua(new Uint32Array(e.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(Jw).toVar(),n.skinWeightNode=dE(new ua(e.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(Jw).toVar(),n.bindMatrixNode=kv(e.bindMatrix,"mat4"),n.bindMatrixInverseNode=kv(e.bindMatrixInverse,"mat4"),n.boneMatricesNode=$T(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length),n.toPositionNode=t,Ty(n)},context:qb,convert:iv,convertColorSpace:(e,t,n)=>Ty(new iT(Ty(e),t,n)),convertToTexture:(e,...t)=>e.isSampleNode||e.isTextureNode?e:e.isPassNode?e.getTextureNode():CP(e,...t),cos:Gx,cross:gb,cubeTexture:MM,cubeTextureBase:SM,cubeToUV:uD,dFdx:Qx,dFdy:eb,dashSize:Ev,debug:DT,decrement:bx,decrementBefore:vx,defaultBuildStages:A_,defaultShaderStages:E_,defined:vy,degrees:Px,deltaTime:JN,densityFog:function(e,t){return qI(e,VI(t))},densityFogFactor:VI,depth:kE,depthPass:(e,t,n)=>Ty(new mI(mI.DEPTH,e,t,n)),determinant:ab,difference:mb,diffuseColor:ov,directPointLight:xD,directionToColor:dA,directionToFaceDirection:JS,dispersion:Dv,distance:pb,div:ex,dodge:(...e)=>JE(e),dot:fb,drawIndex:nE,dynamicBufferAttribute:fT,element:nv,emissive:lv,equal:nx,equals:lb,equirectUV:fA,exp:Ix,exp2:Lx,expression:CT,faceDirection:ZS,faceForward:Cb,faceforward:Ob,float:Fy,floatBitsToInt:e=>new zN(e,"int","float"),floatBitsToUint:e=>new zN(e,"uint","float"),floor:Bx,fog:qI,fract:zx,frameGroup:Bv,frameId:QN,frontFacing:KS,fwidth:rb,gain:(e,t)=>e.lessThan(.5)?HN(e.mul(2),t).div(2):Jv(1,HN(Qv(Jv(1,e),2),t).div(2)),gapSize:Av,getConstNodeType:xy,getCurrentStack:Ly,getDirection:kR,getDistanceAttenuation:vD,getGeometryRoughness:FA,getNormalFromDepth:IP,getParallaxCorrectNormal:dO,getRoughness:BA,getScreenPosition:PP,getShIrradianceAt:pO,getShadowMaterial:ZL,getShadowRenderObjectFunction:eD,getTextureIndex:BN,getViewPosition:NP,globalId:YI,glsl:(e,t)=>AI(e,t,"glsl"),glslFn:(e,t)=>CI(e,t,"glsl"),grayscale:iI,greaterThan:sx,greaterThanEqual:ox,hash:GN,highpModelNormalViewMatrix:zS,highpModelViewMatrix:qS,hue:aI,increment:xx,incrementBefore:yx,instance:rE,instanceIndex:Jw,instancedArray:(e,t="float")=>{let n,i;!0===t.isStruct?(n=t.layout.getLength(),i=m_("float")):(n=f_(t),i=m_(t));const r=new UP(e,n,i);return dE(r,t,e)},instancedBufferAttribute:gT,instancedDynamicBufferAttribute:_T,instancedMesh:aE,int:By,intBitsToFloat:e=>new zN(e,"float","int"),inverse:ob,inverseSqrt:Fx,inversesqrt:Ub,invocationLocalIndex:tE,invocationSubgroupIndex:eE,ior:Cv,iridescence:fv,iridescenceIOR:gv,iridescenceThickness:_v,ivec2:ky,ivec3:Wy,ivec4:Ky,js:(e,t)=>AI(e,t,"js"),label:Gb,length:Kx,lengthSq:Sb,lessThan:rx,lessThanEqual:ax,lightPosition:DL,lightProjectionUV:LL,lightShadowMatrix:IL,lightTargetDirection:FL,lightTargetPosition:OL,lightViewPosition:UL,lightingContext:AE,lights:(e=[])=>Ty(new zL).setLights(e),linearDepth:GE,linearToneMapping:gI,localId:KI,log:Dx,log2:Ox,logarithmicDepthToViewZ:(e,t,n)=>{const i=e.mul(Dx(n.div(t)));return Fy(Math.E).pow(i).mul(t).negate()},luminance:oI,mat2:Qy,mat3:ev,mat4:tv,matcapUV:PC,materialAO:Xw,materialAlphaTest:hw,materialAnisotropy:Nw,materialAnisotropyVector:$w,materialAttenuationColor:Bw,materialAttenuationDistance:Fw,materialClearcoat:Mw,materialClearcoatNormal:Ew,materialClearcoatRoughness:ww,materialColor:dw,materialDispersion:jw,materialEmissive:mw,materialEnvIntensity:fM,materialEnvRotation:gM,materialIOR:Uw,materialIridescence:Pw,materialIridescenceIOR:Iw,materialIridescenceThickness:Lw,materialLightMap:Ww,materialLineDashOffset:Gw,materialLineDashSize:qw,materialLineGapSize:zw,materialLineScale:Vw,materialLineWidth:kw,materialMetalness:Tw,materialNormal:Sw,materialOpacity:fw,materialPointSize:Hw,materialReference:NM,materialReflectivity:xw,materialRefractionRatio:mM,materialRotation:Aw,materialRoughness:bw,materialSheen:Rw,materialSheenRoughness:Cw,materialShininess:pw,materialSpecular:gw,materialSpecularColor:yw,materialSpecularIntensity:_w,materialSpecularStrength:vw,materialThickness:Ow,materialTransmission:Dw,max:cb,maxMipLevel:zT,mediumpModelViewMatrix:VS,metalness:cv,min:ub,mix:Mb,mixElement:Pb,mod:tx,modInt:Tx,modelDirection:NS,modelNormalMatrix:US,modelPosition:IS,modelRadius:OS,modelScale:LS,modelViewMatrix:BS,modelViewPosition:DS,modelViewProjection:Yw,modelWorldMatrix:PS,modelWorldMatrixInverse:FS,morphReference:SE,mrt:qN,mul:Qv,mx_aastep:uO,mx_add:(e,t=Fy(0))=>Zv(e,t),mx_atan2:(e=Fy(0),t=Fy(1))=>Xx(e,t),mx_cell_noise_float:(e=FT())=>jD(e.convert("vec2|vec3")),mx_contrast:(e,t=1,n=.5)=>Fy(e).sub(n).mul(t).add(n),mx_divide:(e,t=Fy(1))=>ex(e,t),mx_fractal_noise_float:(e=FT(),t=3,n=2,i=.5,r=1)=>XD(e,By(t),n,i).mul(r),mx_fractal_noise_vec2:(e=FT(),t=3,n=2,i=.5,r=1)=>YD(e,By(t),n,i).mul(r),mx_fractal_noise_vec3:(e=FT(),t=3,n=2,i=.5,r=1)=>$D(e,By(t),n,i).mul(r),mx_fractal_noise_vec4:(e=FT(),t=3,n=2,i=.5,r=1)=>KD(e,By(t),n,i).mul(r),mx_frame:()=>QN,mx_heighttonormal:(e,t)=>(e=jy(e),t=Fy(t),lw(e,t)),mx_hsvtorgb:aO,mx_ifequal:(e,t,n,i)=>e.equal(t).mix(n,i),mx_ifgreater:(e,t,n,i)=>e.greaterThan(t).mix(n,i),mx_ifgreatereq:(e,t,n,i)=>e.greaterThanEqual(t).mix(n,i),mx_invert:(e,t=Fy(1))=>Jv(t,e),mx_modulo:(e,t=Fy(1))=>tx(e,t),mx_multiply:(e,t=Fy(1))=>Qv(e,t),mx_noise_float:(e=FT(),t=1,n=0)=>GD(e.convert("vec2|vec3")).mul(t).add(n),mx_noise_vec3:(e=FT(),t=1,n=0)=>HD(e.convert("vec2|vec3")).mul(t).add(n),mx_noise_vec4:(e=FT(),t=1,n=0)=>{e=e.convert("vec2|vec3");return Yy(HD(e),GD(e.add(zy(19,73)))).mul(t).add(n)},mx_place2d:(e,t=zy(.5,.5),n=zy(1,1),i=Fy(0),r=zy(0,0))=>{let s=e;if(t&&(s=s.sub(t)),n&&(s=s.mul(n)),i){const e=i.mul(Math.PI/180),t=e.cos(),n=e.sin();s=zy(s.x.mul(t).sub(s.y.mul(n)),s.x.mul(n).add(s.y.mul(t)))}return t&&(s=s.add(t)),r&&(s=s.add(r)),s},mx_power:(e,t=Fy(1))=>_b(e,t),mx_ramp4:(e,t,n,i,r=FT())=>{const s=r.x.clamp(),a=r.y.clamp(),o=Mb(e,t,s),l=Mb(n,i,s);return Mb(o,l,a)},mx_ramplr:(e,t,n=FT())=>cO(e,t,n,"x"),mx_ramptb:(e,t,n=FT())=>cO(e,t,n,"y"),mx_rgbtohsv:oO,mx_rotate2d:(e,t)=>{e=zy(e);const n=(t=Fy(t)).mul(Math.PI/180);return OC(e,n)},mx_rotate3d:(e,t,n)=>{e=jy(e),t=Fy(t),n=jy(n);const i=t.mul(Math.PI/180),r=n.normalize(),s=i.cos(),a=i.sin(),o=Fy(1).sub(s);return e.mul(s).add(r.cross(e).mul(a)).add(r.mul(r.dot(e)).mul(o))},mx_safepower:(e,t=1)=>(e=Fy(e)).abs().pow(t).mul(e.sign()),mx_separate:(e,t=null)=>{if("string"==typeof t){const n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},i=t.replace(/^out/,"").toLowerCase();if(void 0!==n[i])return e.element(n[i])}if("number"==typeof t)return e.element(t);if("string"==typeof t&&1===t.length){const n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(void 0!==n[t])return e.element(n[t])}return e},mx_splitlr:(e,t,n,i=FT())=>hO(e,t,n,i,"x"),mx_splittb:(e,t,n,i=FT())=>hO(e,t,n,i,"y"),mx_srgb_texture_to_lin_rec709:lO,mx_subtract:(e,t=Fy(0))=>Jv(e,t),mx_timer:()=>ZN,mx_transform_uv:(e=1,t=0,n=FT())=>n.mul(e).add(t),mx_unifiednoise2d:(e,t=FT(),n=zy(1,1),i=zy(0,0),r=1,s=0,a=1,o=!1,l=1,u=2,c=.5)=>rO(e,t.convert("vec2|vec3"),n,i,r,s,a,o,l,u,c),mx_unifiednoise3d:(e,t=FT(),n=zy(1,1),i=zy(0,0),r=1,s=0,a=1,o=!1,l=1,u=2,c=.5)=>sO(e,t.convert("vec2|vec3"),n,i,r,s,a,o,l,u,c),mx_worley_noise_float:(e=FT(),t=1)=>tO(e.convert("vec2|vec3"),t,By(1)),mx_worley_noise_vec2:(e=FT(),t=1)=>nO(e.convert("vec2|vec3"),t,By(1)),mx_worley_noise_vec3:(e=FT(),t=1)=>iO(e.convert("vec2|vec3"),t,By(1)),negate:Zx,neutralToneMapping:wI,nodeArray:wy,nodeImmutable:Ay,nodeObject:Ty,nodeObjectIntent:Sy,nodeObjects:My,nodeProxy:Ey,nodeProxyIntent:Ry,normalFlat:tM,normalGeometry:QS,normalLocal:eM,normalMap:rw,normalView:rM,normalViewGeometry:nM,normalWorld:sM,normalWorldGeometry:iM,normalize:qx,not:cx,notEqual:ix,numWorkgroups:XI,objectDirection:SS,objectGroup:qv,objectPosition:wS,objectRadius:RS,objectScale:ES,objectViewPosition:AS,objectWorldMatrix:MS,oneMinus:Jx,or:ux,orthographicDepthToViewZ:(e,t,n)=>t.sub(n).mul(e).sub(t),oscSawtooth:(e=ZN)=>e.fract(),oscSine:(e=ZN)=>e.add(.75).mul(2*Math.PI).sin().mul(.5).add(.5),oscSquare:(e=ZN)=>e.fract().round(),oscTriangle:(e=ZN)=>e.add(.5).fract().mul(2).sub(1).abs(),output:wv,outputStruct:FN,overlay:(...e)=>eA(e),overloadingFn:KN,parabola:HN,parallaxDirection:tw,parallaxUV:(e,t)=>e.sub(tw.mul(t)),parameter:(e,t)=>Ty(new PN(e,t)),pass:(e,t,n)=>Ty(new mI(mI.COLOR,e,t,n)),passTexture:(e,t)=>Ty(new dI(e,t)),pcurve:(e,t,n)=>_b(ex(_b(e,t),Zv(_b(e,t),_b(Jv(1,e),n))),1/t),perspectiveDepthToViewZ:VE,pmremTexture:yC,pointShadow:_D,pointUV:VP,pointWidth:Rv,positionGeometry:kS,positionLocal:GS,positionPrevious:HS,positionView:XS,positionViewDirection:$S,positionWorld:jS,positionWorldDirection:WS,posterize:cI,pow:_b,pow2:yb,pow3:vb,pow4:xb,premultiplyAlpha:nA,property:sv,quadBroadcast:CL,quadSwapDiagonal:SL,quadSwapX:bL,quadSwapY:TL,radians:Nx,rand:Nb,range:HI,rangeFog:function(e,t,n){return qI(e,BI(t,n))},rangeFogFactor:BI,reciprocal:nb,reference:AM,referenceBuffer:RM,reflect:db,reflectVector:vM,reflectView:_M,reflector:e=>Ty(new bP(e)),refract:Ab,refractVector:xM,refractView:yM,reinhardToneMapping:_I,remap:ET,remapClamp:AT,renderGroup:Vv,renderOutput:IT,rendererReference:uT,rotate:OC,rotateUV:eP,roughness:uv,round:tb,rtt:CP,sRGBTransferEOTF:eT,sRGBTransferOETF:tT,sample:(e,t=null)=>Ty(new LP(e,Ty(t))),sampler:e=>(!0===e.isNode?e:jT(e)).convert("sampler"),samplerComparison:e=>(!0===e.isNode?e:jT(e)).convert("samplerComparison"),saturate:Eb,saturation:rI,screen:(...e)=>QE(e),screenCoordinate:sS,screenDPR:nS,screenSize:rS,screenUV:iS,scriptable:UI,scriptableValue:PI,select:Bb,setCurrentStack:Iy,setName:kb,shaderStages:R_,shadow:oD,shadowPositionWorld:GL,shapeCircle:SD,sharedUniformGroup:Fv,sheen:pv,sheenRoughness:mv,shiftLeft:gx,shiftRight:_x,shininess:Mv,sign:Yx,sin:kx,sinc:(e,t)=>kx(Ex.mul(t.mul(e).sub(1))).div(Ex.mul(t.mul(e).sub(1))),skinning:fE,smoothstep:Rb,smoothstepElement:Ib,specularColor:Tv,specularF90:Sv,spherizeUV:tP,split:(e,t)=>Ty(new B_(Ty(e),t)),spritesheetUV:sP,sqrt:Ux,stack:LN,step:hb,stepElement:Lb,storage:dE,storageBarrier:()=>JI("storage").toStack(),storageObject:(e,t,n)=>dE(e,t,n).setPBO(!0),storageTexture:XP,string:(e="")=>Ty(new G_(e,"string")),struct:(e,t=null)=>{const n=new DN(e,t),i=(...t)=>{let i=null;if(t.length>0)if(t[0].isNode){i={};const n=Object.keys(e);for(let e=0;e<t.length;e++)i[n[e]]=t[e]}else i=t[0];return Ty(new ON(n,i))};return i.layout=n,i.isStruct=!0,i},sub:Jv,subBuild:Kb,subgroupAdd:oL,subgroupAll:yL,subgroupAnd:pL,subgroupAny:vL,subgroupBallot:aL,subgroupBroadcast:ML,subgroupBroadcastFirst:xL,subgroupElect:sL,subgroupExclusiveAdd:uL,subgroupExclusiveMul:dL,subgroupInclusiveAdd:lL,subgroupInclusiveMul:hL,subgroupIndex:Qw,subgroupMax:_L,subgroupMin:gL,subgroupMul:cL,subgroupOr:mL,subgroupShuffle:wL,subgroupShuffleDown:RL,subgroupShuffleUp:AL,subgroupShuffleXor:EL,subgroupSize:ZI,subgroupXor:fL,tan:Hx,tangentGeometry:jM,tangentLocal:WM,tangentView:XM,tangentWorld:$M,texture:jT,texture3D:KP,textureBarrier:()=>JI("texture").toStack(),textureBicubic:dR,textureBicubicLevel:hR,textureCubeUV:GR,textureLoad:WT,textureSize:VT,textureStore:(e,t,n)=>{const i=XP(e,t,n);return null!==n&&i.toStack(),i},thickness:Pv,time:ZN,toneMapping:hT,toneMappingExposure:dT,toonOutlinePass:(e,t,n=new br(0,0,0),i=.003,r=1)=>Ty(new fI(e,t,Ty(n),Ty(i),Ty(r))),transformDirection:bb,transformNormal:oM,transformNormalToView:lM,transformedClearcoatNormalView:hM,transformedNormalView:uM,transformedNormalWorld:cM,transmission:Nv,transpose:sb,triNoise3D:XN,triplanarTexture:(...e)=>aP(...e),triplanarTextures:aP,trunc:ib,uint:Vy,uintBitsToFloat:e=>new zN(e,"float","uint"),uniform:kv,uniformArray:ZT,uniformCubeTexture:(e=bM)=>SM(e),uniformFlow:zb,uniformGroup:Uv,uniformTexture:(e=kT)=>jT(e),unpremultiplyAlpha:iA,userData:(e,t,n)=>Ty(new ZP(e,t,n)),uv:FT,uvec2:Gy,uvec3:Xy,uvec4:Zy,varying:Jb,varyingProperty:av,vec2:zy,vec3:jy,vec4:Yy,vectorComponents:C_,velocity:nI,vertexColor:KE,vertexIndex:Zw,vertexStage:Qb,vibrance:sI,viewZToLogarithmicDepth:qE,viewZToOrthographicDepth:FE,viewZToPerspectiveDepth:BE,viewport:aS,viewportCoordinate:lS,viewportDepthTexture:OE,viewportLinearDepth:HE,viewportMipTexture:IE,viewportResolution:cS,viewportSafeUV:iP,viewportSharedTexture:hA,viewportSize:oS,viewportTexture:PE,viewportUV:uS,wgsl:(e,t)=>AI(e,t,"wgsl"),wgslFn:(e,t)=>CI(e,t,"wgsl"),workgroupArray:(e,t)=>Ty(new eL("Workgroup",e,t)),workgroupBarrier:()=>JI("workgroup").toStack(),workgroupId:$I,workingToColorSpace:rT,xor:hx});const fO=new NN;class gO extends ZC{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){const i=this.renderer,r=this.nodes.getBackgroundNode(e)||e.background;let s=!1;if(null===r)i._clearColor.getRGB(fO),fO.a=i._clearColor.a;else if(!0===r.isColor)r.getRGB(fO),fO.a=1,s=!0;else if(!0===r.isNode){const n=this.get(e),s=r;fO.copy(i._clearColor);let a=n.backgroundMesh;if(void 0===a){let e=function(){r.removeEventListener("dispose",e),a.material.dispose(),a.geometry.dispose()};const t=qb(Yy(s).mul(HP),{getUV:()=>jP.mul(iM),getTextureLevel:()=>GP});let i=Yw;i=i.setZ(i.w);const o=new rA;o.name="Background.material",o.side=1,o.depthTest=!1,o.depthWrite=!1,o.allowOverride=!1,o.fog=!1,o.lights=!1,o.vertexNode=i,o.colorNode=t,n.backgroundMeshNode=t,n.backgroundMesh=a=new is(new Vl(1,32,32),o),a.frustumCulled=!1,a.name="Background.mesh",a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},r.addEventListener("dispose",e)}const o=s.getCacheKey();n.backgroundCacheKey!==o&&(n.backgroundMeshNode.node=Yy(s).mul(HP),n.backgroundMeshNode.needsUpdate=!0,a.material.needsUpdate=!0,n.backgroundCacheKey=o),t.unshift(a,a.geometry,a.material,0,0,null,null)}const a=i.xr.getEnvironmentBlendMode();if("additive"===a?fO.set(0,0,0,1):"alpha-blend"===a&&fO.set(0,0,0,0),!0===i.autoClear||!0===s){const e=n.clearColorValue;e.r=fO.r,e.g=fO.g,e.b=fO.b,e.a=fO.a,!0!==i.backend.isWebGLBackend&&!0!==i.alpha||(e.r*=e.a,e.g*=e.a,e.b*=e.a),n.depthClearValue=i._clearDepth,n.stencilClearValue=i._clearStencil,n.clearColor=!0===i.autoClearColor,n.clearDepth=!0===i.autoClearDepth,n.clearStencil=!0===i.autoClearStencil}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}}let _O=0;class yO{constructor(e="",t=[],n=0,i=[]){this.name=e,this.bindings=t,this.index=n,this.bindingsReference=i,this.id=_O++}}class vO{constructor(e,t,n,i,r,s,a,o,l,u=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=u,this.nodeAttributes=i,this.bindings=r,this.updateNodes=s,this.updateBeforeNodes=a,this.updateAfterNodes=o,this.observer=l,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings){if(!0!==t.bindings[0].groupNode.shared){const n=new yO(t.name,[],t.index,t.bindingsReference);e.push(n);for(const e of t.bindings)n.bindings.push(e.clone())}else e.push(t)}return e}}class xO{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class bO{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 TO{constructor(e,t,n=!1,i=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=i}}class SO extends TO{constructor(e,t,n=null,i=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=i}}class MO{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let wO=0;class EO{constructor(e=null){this.id=wO++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return void 0===t&&null!==this.parent&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class AO{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class RO{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0}setValue(e){this.value=e}getValue(){return this.value}}class CO extends RO{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class NO extends RO{constructor(e,t=new Sn){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class PO extends RO{constructor(e,t=new wn){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class IO extends RO{constructor(e,t=new Zn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class LO extends RO{constructor(e,t=new br){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class DO extends RO{constructor(e,t=new Hc){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class OO extends RO{constructor(e,t=new Rn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class UO extends RO{constructor(e,t=new Ci){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class FO extends CO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class BO extends NO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class VO extends PO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class qO extends IO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class zO extends LO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class kO extends DO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class GO extends OO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class HO extends UO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}const jO=new WeakMap,WO=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),XO=e=>/e/g.test(e)?String(e).replace(/\+/g,""):(e=Number(e))+(e%1?"":".0");class $O{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=LN(),this.stacks=[],this.tab="\t",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new EO,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.currentStack=null,this.subBuildFn=null}getBindGroupsCache(){let e=jO.get(this.renderer);return void 0===e&&(e=new WC,jO.set(this.renderer,e)),e}createRenderTarget(e,t,n){return new Jn(e,t,n)}createCubeRenderTarget(e,t){return new gA(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){const n=this.getBindGroupsCache(),i=[];let r,s=!0;for(const a of t)i.push(a),s=s&&!0!==a.groupNode.shared;return s?(r=n.get(i),void 0===r&&(r=new yO(e,i,this.bindingsIndexes[e].group,i),n.set(i,r))):r=new yO(e,i,this.bindingsIndexes[e].group,i),r}getBindGroupArray(e,t){const n=this.bindings[t];let i=n[e];return void 0===i&&(void 0===this.bindingsIndexes[e]&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=i=[]),i}getBindings(){let e=this.bindGroups;if(null===e){const t={},n=this.bindings;for(const e of R_)for(const i in n[e]){const r=n[e][i];(t[i]||(t[i]=[])).push(...r)}e=[];for(const i in t){const n=t[i],r=this._getBindGroup(i,n);e.push(r)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((e,t)=>e.bindings[0].groupNode.order-t.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){!1===this.nodes.includes(e)&&(this.nodes.push(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){!1===this.sequentialNodes.includes(e)&&this.sequentialNodes.push(e)}buildUpdateNodes(){for(const e of this.nodes){e.getUpdateType()!==M_.NONE&&this.updateNodes.push(e)}for(const e of this.sequentialNodes){const t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==M_.NONE&&this.updateBeforeNodes.push(e),n!==M_.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Pe||e.magFilter===Ie||e.magFilter===Ne||e.magFilter===Le||e.minFilter===Pe||e.minFilter===Ie||e.minFilter===Ne||e.minFilter===Le}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}getSharedContext(){return this.context,this.context}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){const n=this.getDataFromNode(e);return void 0===n.cache&&(n.cache=new EO(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){}getInstanceIndex(){}getDrawIndex(){}getFrontFacing(){}getFragCoord(){}isFlipY(){return!1}increaseUsage(e){const t=this.getDataFromNode(e);return t.usageCount=void 0===t.usageCount?1:t.usageCount+1,t.usageCount}generateTexture(){}generateTextureLod(){}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let i=this.generateArrayDeclaration(e,t)+"( ";for(let r=0;r<t;r++){const s=n?n[r]:null;i+=null!==s?s.build(this,e):this.generateConst(e),r<t-1&&(i+=", ")}return i+=" )",i}generateStruct(e,t,n=null){const i=[];for(const r of t){const{name:e,type:t}=r;n&&n[e]&&n[e].isNode?i.push(n[e].build(this,t)):i.push(this.generateConst(t))}return e+"( "+i.join(", ")+" )"}generateConst(e,t=null){if(null===t&&("float"===e||"int"===e||"uint"===e?t=0:"bool"===e?t=!1:"color"===e?t=new br:"vec2"===e?t=new Sn:"vec3"===e?t=new wn:"vec4"===e&&(t=new Zn)),"float"===e)return XO(t);if("int"===e)return`${Math.round(t)}`;if("uint"===e)return t>=0?`${Math.round(t)}u`:"0u";if("bool"===e)return t?"true":"false";if("color"===e)return`${this.getType("vec3")}( ${XO(t.r)}, ${XO(t.g)}, ${XO(t.b)} )`;const n=this.getTypeLength(e),i=this.getComponentType(e),r=e=>this.generateConst(i,e);if(2===n)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)} )`;if(3===n)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)} )`;if(4===n&&"mat2"!==e)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)}, ${r(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(r).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return"color"===e?"vec3":e}hasGeometryAttribute(e){return this.geometry&&void 0!==this.geometry.getAttribute(e)}getAttribute(e,t){const n=this.attributes;for(const r of n)if(r.name===e)return r;const i=new xO(e,t);return this.registerDeclaration(i),n.push(i),i}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return"void"===e||"property"===e||"sampler"===e||"samplerComparison"===e||"texture"===e||"cubeTexture"===e||"storageTexture"===e||"depthTexture"===e||"texture3D"===e}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===Be)return"int";if(t===Ve)return"uint"}return"float"}getElementType(e){return"mat2"===e?"vec2":"mat3"===e?"vec3":"mat4"===e?"vec4":this.getComponentType(e)}getComponentType(e){if("float"===(e=this.getVectorType(e))||"bool"===e||"int"===e||"uint"===e)return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return null===t?null:"b"===t[1]?"bool":"i"===t[1]?"int":"u"===t[1]?"uint":"float"}getVectorType(e){return"color"===e?"vec3":"texture"===e||"cubeTexture"===e||"storageTexture"===e||"texture3D"===e?"vec4":e}getTypeFromLength(e,t="float"){if(1===e)return t;let n=p_(e);const i="float"===t?"":t[0];return!0===/mat2/.test(t)&&(n=n.replace("vec","mat")),i+n}getTypeFromArray(e){return WO.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,i=e.itemSize,r=e.normalized;let s;return e instanceof Ur||!0===r||(s=this.getTypeFromArray(n)),this.getTypeFromLength(i,s)}getTypeLength(e){const t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return null!==n?Number(n[1]):"float"===t||"bool"===t||"int"===t||"uint"===t?1:!0===/mat2/.test(e)?4:!0===/mat3/.test(e)?9:!0===/mat4/.test(e)?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"int"===t||"uint"===t?e:this.changeComponentType(e,"int")}addStack(){this.stack=LN(this.stack);const e=Ly();return this.stacks.push(e),Iy(this.stack),this.stack}removeStack(){const e=this.stack;return this.stack=e.parent,Iy(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){let i=(n=null===n?e.isGlobal(this)?this.globalCache:this.cache:n).getData(e);void 0===i&&(i={},n.setData(e,i)),void 0===i[t]&&(i[t]={});let r=i[t];const s=i.any?i.any.subBuilds:null,a=this.getClosestSubBuild(s);return a&&(void 0===r.subBuildsCache&&(r.subBuildsCache={}),r=r.subBuildsCache[a]||(r.subBuildsCache[a]={}),r.subBuilds=s),r}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);let i=n.bufferAttribute;if(void 0===i){const r=this.uniforms.index++;i=new xO("nodeAttribute"+r,t,e),this.bufferAttributes.push(i),n.bufferAttribute=i}return i}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,i=this.shaderStage){const r=this.getDataFromNode(e,i,this.globalCache);let s=r.structType;if(void 0===s){const a=this.structs.index++;null===n&&(n="StructType"+a),s=new AO(n,t),this.structs[i].push(s),this.types[i][n]=e,r.structType=s}return s}getOutputStructTypeFromNode(e,t){const n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,i=null){const r=this.getDataFromNode(e,n,this.globalCache);let s=r.uniform;if(void 0===s){const a=this.uniforms.index++;s=new bO(i||"nodeUniform"+a,t,e),this.uniforms[n].push(s),this.registerDeclaration(s),r.uniform=s}return s}getVarFromNode(e,t=null,n=e.getNodeType(this),i=this.shaderStage,r=!1){const s=this.getDataFromNode(e,i),a=this.getSubBuildProperty("variable",s.subBuilds);let o=s[a];if(void 0===o){const l=r?"_const":"_var",u=this.vars[i]||(this.vars[i]=[]),c=this.vars[l]||(this.vars[l]=0);null===t&&(t=(r?"nodeConst":"nodeVar")+c,this.vars[l]++),"variable"!==a&&(t=this.getSubBuildProperty(t,s.subBuilds));const h=e.getArrayCount(this);o=new TO(t,n,r,h),r||u.push(o),this.registerDeclaration(o),s[a]=o}return o}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode))&&(!e.cNode||this.isDeterministic(e.cNode));if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode));if(e.isArrayNode){if(null!==e.values)for(const t of e.values)if(!this.isDeterministic(t))return!1;return!0}return!!e.isConstNode}getVaryingFromNode(e,t=null,n=e.getNodeType(this),i=null,r=null){const s=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",s.subBuilds);let o=s[a];if(void 0===o){const e=this.varyings,l=e.length;null===t&&(t="nodeVarying"+l),"varying"!==a&&(t=this.getSubBuildProperty(t,s.subBuilds)),o=new SO(t,n,i,r),e.push(o),this.registerDeclaration(o),s[a]=o}return o}registerDeclaration(e){const t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),i=this.getPropertyName(e);let r=1,s=i;for(;void 0!==n[s];)s=i+"_"+r++;r>1&&(e.name=s),n[s]=e}getCodeFromNode(e,t,n=this.shaderStage){const i=this.getDataFromNode(e);let r=i.code;if(void 0===r){const e=this.codes[n]||(this.codes[n]=[]),s=e.length;r=new MO("nodeCode"+s,t),e.push(r),i.code=r}return r}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:i}=this.getDataFromNode(e);let r=!0,s=t;for(;s;){if(!0===i.get(s)){r=!1;break}s=this.getDataFromNode(s).parentNodeBlock}if(r)for(const a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){const i=this.getDataFromNode(e),r=i.flowCodes||(i.flowCodes=[]),s=i.flowCodeBlock||(i.flowCodeBlock=new WeakMap);r.push(t),s.set(n,!0)}addLineFlowCode(e,t=null){return""===e||(null!==t&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e+=";\n"),this.flow.code+=e),this}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+="\t",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){null!==this.currentFunctionNode&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=new RI,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 e=0;const t=Object.values(this);return{next:()=>({value:t[e],done:e++>=t.length})}}};for(const s of t.inputs)n[s.name]=new PN(s.type,s.name);e.layout=null;const i=e.call(n),r=this.flowStagesNode(i,t.type);return e.layout=t,r}flowBuildStage(e,t,n=null){const i=this.getBuildStage();this.setBuildStage(t);const r=e.build(this,n);return this.setBuildStage(i),r}flowStagesNode(e,t=null){const n=this.flow,i=this.vars,r=this.declarations,s=this.cache,a=this.buildStage,o=this.stack,l={code:""};this.flow=l,this.vars={},this.declarations={},this.cache=new EO,this.stack=LN();for(const u of A_)this.setBuildStage(u),l.result=e.build(this,t);return l.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=i,this.declarations=r,this.cache=s,this.stack=o,this.setBuildStage(a),l}getFunctionOperator(){return null}buildFunctionCode(){}flowChildNode(e,t=null){const n=this.flow,i={code:""};return this.flow=i,i.result=e.build(this,t),this.flow=n,i}flowNodeFromShaderStage(e,t,n=null,i=null){const r=this.tab,s=this.cache,a=this.shaderStage,o=this.context;this.setShaderStage(e);const l={...this.context};delete l.nodeBlock,this.cache=this.globalCache,this.tab="\t",this.context=l;let u=null;if("generate"===this.buildStage){const r=this.flowChildNode(t,n);null!==i&&(r.code+=`${this.tab+i} = ${r.result};\n`),this.flowCode[e]=this.flowCode[e]+r.code,u=r}else u=t.build(this);return this.setShaderStage(a),this.cache=s,this.tab=r,this.context=o,u}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){}getVaryings(){}getVar(e,t,n=null){return`${null!==n?this.generateArrayDeclaration(e,n):this.getType(e)} ${t}`}getVars(e){let t="";const n=this.vars[e];if(void 0!==n)for(const i of n)t+=`${this.getVar(i.type,i.name)}; `;return t}getUniforms(){}getCodes(e){const t=this.codes[e];let n="";if(void 0!==t)for(const i of t)n+=i.code+"\n";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(){}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(t=e&&e.isNode?e.isShaderCallNodeInternal?e.shaderNode.subBuilds:e.isStackNode?[e.subBuild]:this.getDataFromNode(e,"any").subBuilds:e instanceof Set?[...e]:e,!t)return null;const n=this.subBuildLayers;for(let i=t.length-1;i>=0;i--){const e=t[i];if(n.includes(e))return e}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n,i;return n=null!==t?this.getClosestSubBuild(t):this.subBuildFn,i=n?e?n+"_"+e:n:e,i}build(){const{object:e,material:t,renderer:n}=this;if(null!==t){let e=n.library.fromMaterial(t);null===e&&(e=new rA),e.build(this)}else this.addFlow("compute",e);for(const i of A_){this.setBuildStage(i),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const e of R_){this.setShaderStage(e);const t=this.flowNodes[e];for(const e of t)"generate"===i?this.flowNode(e):e.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getNodeUniform(e,t){if("float"===t||"int"===t||"uint"===t)return new FO(e);if("vec2"===t||"ivec2"===t||"uvec2"===t)return new BO(e);if("vec3"===t||"ivec3"===t||"uvec3"===t)return new VO(e);if("vec4"===t||"ivec4"===t||"uvec4"===t)return new qO(e);if("color"===t)return new zO(e);if("mat2"===t)return new kO(e);if("mat3"===t)return new GO(e);if("mat4"===t)return new HO(e);throw new Error(`Uniform "${t}" not declared.`)}format(e,t,n){if((t=this.getVectorType(t))===(n=this.getVectorType(n))||null===n||this.isReference(n))return e;const i=this.getTypeLength(t),r=this.getTypeLength(n);return 16===i&&9===r?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:9===i&&4===r?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:i>4||r>4||0===r?e:i===r?`${this.getType(n)}( ${e} )`:i>r?(e="bool"===n?`all( ${e} )`:`${e}.${"xyz".slice(0,r)}`,this.format(e,this.getTypeFromLength(r,this.getComponentType(t)),n)):4===r&&i>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:2===i?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(1===i&&r>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${V} - Node System\n`}}class YO{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 void 0===n&&(n={renderMap:new WeakMap,frameMap:new WeakMap},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===M_.FRAME){const{frameMap:t}=this._getMaps(this.updateBeforeMap,n);t.get(n)!==this.frameId&&!1!==e.updateBefore(this)&&t.set(n,this.frameId)}else if(t===M_.RENDER){const{renderMap:t}=this._getMaps(this.updateBeforeMap,n);t.get(n)!==this.renderId&&!1!==e.updateBefore(this)&&t.set(n,this.renderId)}else t===M_.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===M_.FRAME){const{frameMap:t}=this._getMaps(this.updateAfterMap,n);t.get(n)!==this.frameId&&!1!==e.updateAfter(this)&&t.set(n,this.frameId)}else if(t===M_.RENDER){const{renderMap:t}=this._getMaps(this.updateAfterMap,n);t.get(n)!==this.renderId&&!1!==e.updateAfter(this)&&t.set(n,this.renderId)}else t===M_.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===M_.FRAME){const{frameMap:t}=this._getMaps(this.updateMap,n);t.get(n)!==this.frameId&&!1!==e.update(this)&&t.set(n,this.frameId)}else if(t===M_.RENDER){const{renderMap:t}=this._getMaps(this.updateMap,n);t.get(n)!==this.renderId&&!1!==e.update(this)&&t.set(n,this.renderId)}else t===M_.OBJECT&&e.update(this)}update(){this.frameId++,void 0===this.lastTime&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class KO{constructor(e,t,n=null,i="",r=!1){this.type=e,this.name=t,this.count=n,this.qualifier=i,this.isConst=r}}KO.isNodeFunctionInput=!0;class ZO extends yD{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:FL(this.light),lightColor:e}}}const JO=new Ci,QO=new Ci;let eU=null;class tU extends yD{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=kv(new wn).setGroup(Vv),this.halfWidth=kv(new wn).setGroup(Vv),this.updateType=M_.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;QO.identity(),JO.copy(t.matrixWorld),JO.premultiply(n),QO.extractRotation(JO),this.halfWidth.value.set(.5*t.width,0,0),this.halfHeight.value.set(0,.5*t.height,0),this.halfWidth.value.applyMatrix4(QO),this.halfHeight.value.applyMatrix4(QO)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=jT(eU.LTC_FLOAT_1),n=jT(eU.LTC_FLOAT_2)):(t=jT(eU.LTC_HALF_1),n=jT(eU.LTC_HALF_2));const{colorNode:i,light:r}=this;return{lightColor:i,lightPosition:UL(r),halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){eU=e}}class nU extends yD{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=kv(0).setGroup(Vv),this.penumbraCosNode=kv(0).setGroup(Vv),this.cutoffDistanceNode=kv(0).setGroup(Vv),this.decayExponentNode=kv(0).setGroup(Vv),this.colorNode=kv(this.color).setGroup(Vv)}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:i}=this;return Rb(n,i,t)}getLightCoord(e){const t=e.getNodeProperties(this);let n=t.projectionUV;return void 0===n&&(n=LL(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:i,light:r}=this,s=this.getLightVector(e),a=s.normalize(),o=a.dot(FL(r)),l=this.getSpotAttenuation(e,o),u=s.length(),c=vD({lightDistance:u,cutoffDistance:n,decayExponent:i});let h,d,p=t.mul(l).mul(c);if(r.colorNode?(d=this.getLightCoord(e),h=r.colorNode(d)):r.map&&(d=this.getLightCoord(e),h=jT(r.map,d.xy).onRenderUpdate(()=>r.map)),h){p=d.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(h),p)}return{lightColor:p,lightDirection:a}}}class iU extends nU{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){const n=this.light.iesMap;let i=null;if(n&&!0===n.isTexture){const e=t.acos().mul(1/Math.PI);i=jT(n,zy(e,0),0).r}else i=super.getSpotAttenuation(t);return i}}const rU=Py(([e,t])=>{const n=e.abs().sub(t);return Kx(cb(n,0)).add(ub(cb(n.x,n.y),0))});class sU extends nU{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),null===t.aspect){let e=1;null!==t.map&&(e=t.map.width/t.map.height),t.shadow.aspect=e}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=Fy(0),n=this.penumbraCosNode,i=IL(this.light).mul(e.context.positionWorld||jS);return Dy(i.w.greaterThan(0),()=>{const e=i.xyz.div(i.w),r=rU(e.xy.sub(zy(.5)),zy(.5)),s=ex(-1,Jv(1,Wx(n)).sub(1));t.assign(Eb(r.mul(-2).mul(s)))}),t}}class aU extends yD{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class oU extends yD{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=DL(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=kv(new br).setGroup(Vv)}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:i}=this,r=sM.dot(i).mul(.5).add(.5),s=Mb(n,t,r);e.context.irradiance.addAssign(s)}}class lU extends yD{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new wn);this.lightProbe=ZT(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=pO(sM,this.lightProbe);e.context.irradiance.addAssign(t)}}class uU{parseFunction(){}}class cU{constructor(e,t,n="",i=""){this.type=e,this.inputs=t,this.name=n,this.precision=i}getCode(){}}cU.isNodeFunction=!0;const hU=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,dU=/[a-z_0-9]+/gi,pU="#pragma main";class mU extends cU{constructor(e){const{type:t,inputs:n,name:i,precision:r,inputsCode:s,blockCode:a,headerCode:o}=(e=>{const t=(e=e.trim()).indexOf(pU),n=-1!==t?e.slice(t+12):e,i=n.match(hU);if(null!==i&&5===i.length){const r=i[4],s=[];let a=null;for(;null!==(a=dU.exec(r));)s.push(a);const o=[];let l=0;for(;l<s.length;){const e="const"===s[l][0];!0===e&&l++;let t=s[l][0];"in"===t||"out"===t||"inout"===t?l++:t="";const n=s[l++][0];let i=Number.parseInt(s[l][0]);!1===Number.isNaN(i)?l++:i=null;const r=s[l++][0];o.push(new KO(n,r,i,t,e))}const u=n.substring(i[0].length),c=void 0!==i[3]?i[3]:"";return{type:i[2],inputs:o,name:c,precision:void 0!==i[1]?i[1]:"",inputsCode:r,blockCode:u,headerCode:-1!==t?e.slice(0,t):""}}throw new Error("FunctionNode: Function is not a GLSL code.")})(e);super(t,n,i,r),this.inputsCode=s,this.blockCode=a,this.headerCode=o}getCode(e=this.name){let t;const n=this.blockCode;if(""!==n){const{type:i,inputsCode:r,headerCode:s,precision:a}=this;let o=`${i} ${e} ( ${r.trim()} )`;""!==a&&(o=`${a} ${o}`),t=s+o+n}else t="";return t}}class fU extends uU{parseFunction(e){return new mU(e)}}const gU=new WeakMap,_U=[],yU=[];class vU extends ZC{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new YO,this.nodeBuilderCache=new Map,this.callHashCache=new WC,this.groupsData=new WC,this.cacheLib={}}updateGroup(e){const t=e.groupNode,n=t.name;if(n===qv.name)return!0;if(n===Vv.name){const t=this.get(e),n=this.nodeFrame.renderId;return t.renderId!==n&&(t.renderId=n,!0)}if(n===Bv.name){const t=this.get(e),n=this.nodeFrame.frameId;return t.frameId!==n&&(t.frameId=n,!0)}_U[0]=t,_U[1]=e;let i=this.groupsData.get(_U);return void 0===i&&this.groupsData.set(_U,i={}),_U.length=0,i.version!==t.version&&(i.version=t.version,!0)}getForRenderCacheKey(e){return e.initialCacheKey}getForRender(e){const t=this.get(e);let n=t.nodeBuilderState;if(void 0===n){const{nodeBuilderCache:i}=this,r=this.getForRenderCacheKey(e);if(n=i.get(r),void 0===n){const t=this.backend.createNodeBuilder(e.object,this.renderer);t.scene=e.scene,t.material=e.material,t.camera=e.camera,t.context.material=e.material,t.lightsNode=e.lightsNode,t.environmentNode=this.getEnvironmentNode(e.scene),t.fogNode=this.getFogNode(e.scene),t.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&t.enableMultiview(),t.build(),n=this._createNodeBuilderState(t),i.set(r,n)}n.usedTimes++,t.nodeBuilderState=n}return n}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;t.usedTimes--,0===t.usedTimes&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e))}return super.delete(e)}getForCompute(e){const t=this.get(e);let n=t.nodeBuilderState;if(void 0===n){const i=this.backend.createNodeBuilder(e,this.renderer);i.build(),n=this._createNodeBuilderState(i),t.nodeBuilderState=n}return n}_createNodeBuilderState(e){return new vO(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}
vendor: 5,292 bytes, line 1
1getBackgroundNode(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){_U[0]=e,_U[1]=t;const n=this.renderer.info.calls,i=this.callHashCache.get(_U)||{};if(i.callId!==n){const r=this.getEnvironmentNode(e),s=this.getFogNode(e);t&&yU.push(t.getCacheKey(!0)),r&&yU.push(r.getCacheKey()),s&&yU.push(s.getCacheKey()),yU.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),yU.push(this.renderer.shadowMap.enabled?1:0),i.callId=n,i.cacheKey=o_(yU),this.callHashCache.set(_U,i),yU.length=0}return _U.length=0,i.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),n=e.background;if(n){const i=0===e.backgroundBlurriness&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&0===t.backgroundBlurriness;if(t.background!==n||i){const r=this.getCacheNode("background",n,()=>{if(!0===n.isCubeTexture||n.mapping===Te||n.mapping===Se||n.mapping===Me){if(e.backgroundBlurriness>0||n.mapping===Me)return yC(n);{let e;return e=!0===n.isCubeTexture?MM(n):jT(n),bA(e)}}if(!0===n.isTexture)return jT(n,iS.flipY()).setUpdateMatrix(!0);n.isColor},i);t.backgroundNode=r,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,i=!1){const r=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let s=r.get(t);return(void 0===s||i)&&(s=n(),r.set(t,s)),s}updateFog(e){const t=this.get(e),n=e.fog;if(n){if(t.fog!==n){const e=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){const e=AM("color","color",n).setGroup(Vv),t=AM("density","float",n).setGroup(Vv);return qI(e,VI(t))}if(n.isFog){const e=AM("color","color",n).setGroup(Vv),t=AM("near","float",n).setGroup(Vv),i=AM("far","float",n).setGroup(Vv);return qI(e,BI(t,i))}});t.fogNode=e,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 e=this.getCacheNode("environment",n,()=>!0===n.isCubeTexture?MM(n):!0===n.isTexture?jT(n):void 0);t.environmentNode=e,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,i=null,r=null){const s=this.nodeFrame;return s.renderer=e,s.scene=t,s.object=n,s.camera=i,s.material=r,s}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 gU.get(e)!==this.getOutputCacheKey()}getOutputNode(e){const t=this.renderer,n=this.getOutputCacheKey(),i=e.isArrayTexture?KP(e,jy(iS,JT("gl_ViewID_OVR"))).renderOutput(t.toneMapping,t.currentColorSpace):jT(e,iS).renderOutput(t.toneMapping,t.currentColorSpace);return gU.set(e,n),i}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 i of n.updateNodes)t.updateNode(i)}updateForRender(e){const t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(const i of n.updateNodes)t.updateNode(i)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new YO,this.nodeBuilderCache=new Map,this.cacheLib={}}}const xU=new ba;class bU{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new Rn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,null!==e&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,n){const i=e.length;for(let r=0;r<i;r++){xU.copy(e[r]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);const i=t[n+r],s=xU.normal;i.x=-s.x,i.y=-s.y,i.z=-s.z,i.w=xU.constant}}updateGlobal(e,t){this.shadowPass=null!==e.overrideMaterial&&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 i=t.clippingPlanes,r=i.length;let s,a;if(this.clipIntersection?(s=this.intersectionPlanes,a=e.intersectionPlanes.length):(s=this.unionPlanes,a=e.unionPlanes.length),s.length!==a+r){s.length=a+r;for(let e=0;e<r;e++)s[a+e]=new Zn;n=!0}this.projectPlanes(i,s,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}
vendor: 30,816 bytes, line 1
1getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return void 0===t&&(t=new bU(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}}class TU{constructor(e,t){this.bundleGroup=e,this.camera=t}}const SU=[];class MU{constructor(){this.bundles=new WC}get(e,t){const n=this.bundles;SU[0]=e,SU[1]=t;let i=n.get(SU);return void 0===i&&(i=new TU(e,t),n.set(SU,i)),SU.length=0,i}dispose(){this.bundles=new WC}}class wU{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(null!==n){t=new n;for(const n in e)t[n]=e[n]}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)){if("function"!=typeof e)throw new Error(`Node class ${e.name} is not a class.`);if("function"==typeof t||"object"==typeof t)throw new Error(`Base class ${t} is not a class.`);n.set(t,e)}}addClass(e,t,n){if(!n.has(t)){if("function"!=typeof e)throw new Error(`Node class ${e.name} is not a class.`);if("function"!=typeof t)throw new Error(`Base class ${t.name} is not a class.`);n.set(t,e)}}}const EU=new zL,AU=[];class RU extends WC{constructor(){super()}createNode(e=[]){return(new zL).setLights(e)}getNode(e,t){if(e.isQuadMesh)return EU;AU[0]=e,AU[1]=t;let n=this.get(AU);return void 0===n&&(n=this.createNode(),this.set(AU,n)),AU.length=0,n}}class CU extends Jn{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 NU=new wn,PU=new wn;class IU extends hn{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new fs,this._cameraL.viewport=new Zn,this._cameraR=new fs,this._cameraR.viewport=new Zn,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new mc,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding="undefined"!=typeof XRWebGLBinding,this._frameBufferTargets=null,this._createXRLayer=FU.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSize=new Sn,this._onSessionEvent=DU.bind(this),this._onSessionEnd=OU.bind(this),this._onInputSourcesChange=UU.bind(this),this._onAnimationFrame=BU.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(null!==this._glProjLayer||null!==this._glBaseLayer)return this._foveation}setFoveation(e){this._foveation=e,null!==this._glProjLayer&&(this._glProjLayer.fixedFoveation=e),null!==this._glBaseLayer&&void 0!==this._glBaseLayer.fixedFoveation&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(null!==this._session)return this._session.environmentBlendMode}getBinding(){return null===this._glBinding&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,i,r,s,a,o={}){const l=new Ul(e,t),u=new CU(r,s,{format:Ye,type:De,depthTexture:new vo(r,s,o.stencil?He:Ve,void 0,void 0,void 0,void 0,void 0,void 0,o.stencil?Ze:Ke),stencilBuffer:o.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;const c=new wr({color:16777215,side:0});c.map=u.texture,c.map.offset.y=1,c.map.repeat.y=-1;const h=new is(l,c);h.position.copy(n),h.quaternion.copy(i);const d={type:"quad",width:e,height:t,translation:n,quaternion:i,pixelwidth:r,pixelheight:s,plane:h,material:c,rendercall:a,renderTarget:u};if(this._layers.push(d),null!==this._session){d.plane.material=new wr({color:16777215,side:0}),d.plane.material.blending=5,d.plane.material.blendEquation=j,d.plane.material.blendSrc=$,d.plane.material.blendDst=$,d.xrlayer=this._createXRLayer(d);const e=this._session.renderState.layers;e.unshift(d.xrlayer),this._session.updateRenderState({layers:e})}else u.isXRRenderTarget=!1;return h}createCylinderLayer(e,t,n,i,r,s,a,o,l={}){const u=new So(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),c=new CU(s,a,{format:Ye,type:De,depthTexture:new vo(s,a,l.stencil?He:Ve,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?Ze:Ke),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});c._autoAllocateDepthBuffer=!0;const h=new wr({color:16777215,side:1});h.map=c.texture,h.map.offset.y=1,h.map.repeat.y=-1;const d=new is(u,h);d.position.copy(i),d.quaternion.copy(r);const p={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:i,quaternion:r,pixelwidth:s,pixelheight:a,plane:d,material:h,rendercall:o,renderTarget:c};if(this._layers.push(p),null!==this._session){p.plane.material=new wr({color:16777215,side:1}),p.plane.material.blending=5,p.plane.material.blendEquation=j,p.plane.material.blendSrc=$,p.plane.material.blendDst=$,p.xrlayer=this._createXRLayer(p);const e=this._session.renderState.layers;e.unshift(p.xrlayer),this._session.updateRenderState({layers:e})}else c.isXRRenderTarget=!1;return d}renderLayers(){const e=new wn,t=new Mn,n=this._renderer,i=this.isPresenting,r=n.getOutputRenderTarget(),s=n._frameBufferTarget;this.isPresenting=!1;const a=new Sn;n.getSize(a);const o=n._quad;for(const l of this._layers)if(l.renderTarget.isXRRenderTarget=null!==this._session,l.renderTarget._hasExternalTextures=l.renderTarget.isXRRenderTarget,l.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){l.xrlayer.transform=new XRRigidTransform(l.plane.getWorldPosition(e),l.plane.getWorldQuaternion(t));const i=this._glBinding.getSubImage(l.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(l.renderTarget,i.colorTexture,void 0),n._setXRLayerSize(l.renderTarget.width,l.renderTarget.height),n.setOutputRenderTarget(l.renderTarget),n.setRenderTarget(null),n._frameBufferTarget=null,this._frameBufferTargets||(this._frameBufferTargets=new WeakMap);const{frameBufferTarget:r,quad:s}=this._frameBufferTargets.get(l.renderTarget)||{frameBufferTarget:null,quad:null};r?(n._frameBufferTarget=r,n._quad=s):(n._quad=new EP(new rA),this._frameBufferTargets.set(l.renderTarget,{frameBufferTarget:n._getFrameBufferTarget(),quad:n._quad})),l.rendercall(),n._frameBufferTarget=null}else n.setRenderTarget(l.renderTarget),l.rendercall();n.setRenderTarget(null),n.setOutputRenderTarget(r),n._frameBufferTarget=s,n._setXRLayerSize(a.x,a.y),n._quad=o,this.isPresenting=i}getSession(){return this._session}async setSession(e){const t=this._renderer,n=t.backend;this._gl=t.getContext();const i=this._gl,r=i.getContextAttributes();if(this._session=e,null!==e){if(!0===n.isWebGPUBackend)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(),!0===this._supportsLayers){let n=null,s=null,a=null;t.depth&&(a=t.stencil?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24,n=t.stencil?Ze:Ke,s=t.stencil?He:Ve);const o={colorFormat:i.RGBA8,depthFormat:a,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(o.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();const l=this._glBinding.createProjectionLayer(o),u=[l];this._glProjLayer=l,t.setPixelRatio(1),t._setXRLayerSize(l.textureWidth,l.textureHeight);const c=this._useMultiview?2:1,h=new vo(l.textureWidth,l.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n,c);if(this._xrRenderTarget=new CU(l.textureWidth,l.textureHeight,{format:Ye,type:De,colorSpace:t.outputColorSpace,depthTexture:h,stencilBuffer:t.stencil,samples:r.antialias?4:0,resolveDepthBuffer:!1===l.ignoreDepthValues,resolveStencilBuffer:!1===l.ignoreDepthValues,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 e of this._layers)e.plane.material=new wr({color:16777215,side:"cylinder"===e.type?1:0}),e.plane.material.blending=5,e.plane.material.blendEquation=j,e.plane.material.blendSrc=$,e.plane.material.blendDst=$,e.xrlayer=this._createXRLayer(e),u.unshift(e.xrlayer);e.updateRenderState({layers:u})}else{const n={antialias:t.samples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},r=new XRWebGLLayer(e,i,n);this._glBaseLayer=r,e.updateRenderState({baseLayer:r}),t.setPixelRatio(1),t._setXRLayerSize(r.framebufferWidth,r.framebufferHeight),this._xrRenderTarget=new CU(r.framebufferWidth,r.framebufferHeight,{format:Ye,type:De,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:!1===r.ignoreDepthValues,resolveStencilBuffer:!1===r.ignoreDepthValues}),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(null===t)return;const n=e.near,i=e.far,r=this._cameraXR,s=this._cameraL,a=this._cameraR;r.near=a.near=s.near=n,r.far=a.far=s.far=i,r.isMultiViewCamera=this._useMultiview,this._currentDepthNear===r.near&&this._currentDepthFar===r.far||(t.updateRenderState({depthNear:r.near,depthFar:r.far}),this._currentDepthNear=r.near,this._currentDepthFar=r.far),r.layers.mask=6|e.layers.mask,s.layers.mask=3&r.layers.mask,a.layers.mask=5&r.layers.mask;const o=e.parent,l=r.cameras;LU(r,o);for(let u=0;u<l.length;u++)LU(l[u],o);2===l.length?function(e,t,n){NU.setFromMatrixPosition(t.matrixWorld),PU.setFromMatrixPosition(n.matrixWorld);const i=NU.distanceTo(PU),r=t.projectionMatrix.elements,s=n.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],c=(r[8]-1)/r[0],h=(s[8]+1)/s[0],d=a*c,p=a*h,m=i/(-c+h),f=m*-c;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===r[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{const t=a+m,n=o+m,r=d-f,s=p+(i-f),c=l*o/n*t,h=u*o/n*t;e.projectionMatrix.makePerspective(r,s,c,h,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(r,s,a):r.projectionMatrix.copy(s.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld));e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*fn*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,r,o)}_getController(e){let t=this._controllers[e];return void 0===t&&(t=new Ts,this._controllers[e]=t),t}}function LU(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}function DU(e){const t=this._controllerInputSources.indexOf(e.inputSource);if(-1===t)return;const n=this._controllers[t];if(void 0!==n){const t=this.getReferenceSpace();n.update(e.inputSource,e.frame,t),n.dispatchEvent({type:e.type,data:e.inputSource})}}function OU(){const e=this._session,t=this._renderer;e.removeEventListener("select",this._onSessionEvent),e.removeEventListener("selectstart",this._onSessionEvent),e.removeEventListener("selectend",this._onSessionEvent),e.removeEventListener("squeeze",this._onSessionEvent),e.removeEventListener("squeezestart",this._onSessionEvent),e.removeEventListener("squeezeend",this._onSessionEvent),e.removeEventListener("end",this._onSessionEnd),e.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let n=0;n<this._controllers.length;n++){const e=this._controllerInputSources[n];null!==e&&(this._controllerInputSources[n]=null,this._controllers[n].disconnect(e))}if(this._currentDepthNear=null,this._currentDepthFar=null,t._resetXRState(),this._session=null,this._xrRenderTarget=null,!0===this._sessionUsesLayers)for(const n of this._layers)n.renderTarget=new CU(n.pixelwidth,n.pixelheight,{format:Ye,type:De,depthTexture:new vo(n.pixelwidth,n.pixelheight,n.stencilBuffer?He:Ve,void 0,void 0,void 0,void 0,void 0,void 0,n.stencilBuffer?Ze:Ke),stencilBuffer:n.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),n.renderTarget.isXRRenderTarget=!1,n.plane.material=n.material,n.material.map=n.renderTarget.texture,n.material.map.offset.y=1,n.material.map.repeat.y=-1,delete n.xrlayer;this.isPresenting=!1,this._useMultiview=!1,t._animation.stop(),t._animation.setAnimationLoop(this._currentAnimationLoop),t._animation.setContext(this._currentAnimationContext),t._animation.start(),t.setPixelRatio(this._currentPixelRatio),t.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function UU(e){const t=this._controllers,n=this._controllerInputSources;for(let i=0;i<e.removed.length;i++){const r=e.removed[i],s=n.indexOf(r);s>=0&&(n[s]=null,t[s].disconnect(r))}for(let i=0;i<e.added.length;i++){const r=e.added[i];let s=n.indexOf(r);if(-1===s){for(let e=0;e<t.length;e++){if(e>=n.length){n.push(r),s=e;break}if(null===n[e]){n[e]=r,s=e;break}}if(-1===s)break}const a=t[s];a&&a.connect(r)}}function FU(e){return"quad"===e.type?this._glBinding.createQuadLayer({transform:new XRRigidTransform(e.translation,e.quaternion),width:e.width/2,height:e.height/2,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(e.translation,e.quaternion),radius:e.radius,centralAngle:e.centralAngle,aspectRatio:e.aspectRatio,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1})}function BU(e,t){if(void 0===t)return;const n=this._cameraXR,i=this._renderer,r=i.backend,s=this._glBaseLayer,a=this.getReferenceSpace(),o=t.getViewerPose(a);if(this._xrFrame=t,null!==o){const e=o.views;null!==this._glBaseLayer&&r.setXRTarget(s.framebuffer);let t=!1;e.length!==n.cameras.length&&(n.cameras.length=0,t=!0);for(let i=0;i<e.length;i++){const a=e[i];let o;if(!0===this._supportsLayers){const e=this._glBinding.getViewSubImage(this._glProjLayer,a);o=e.viewport,0===i&&r.setXRRenderTargetTextures(this._xrRenderTarget,e.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:e.depthStencilTexture)}else o=s.getViewport(a);let l=this._cameras[i];void 0===l&&(l=new fs,l.layers.enable(i),l.viewport=new Zn,this._cameras[i]=l),l.matrix.fromArray(a.transform.matrix),l.matrix.decompose(l.position,l.quaternion,l.scale),l.projectionMatrix.fromArray(a.projectionMatrix),l.projectionMatrixInverse.copy(l.projectionMatrix).invert(),l.viewport.set(o.x,o.y,o.width,o.height),0===i&&(n.matrix.copy(l.matrix),n.matrix.decompose(n.position,n.quaternion,n.scale)),!0===t&&n.cameras.push(l)}i.setOutputRenderTarget(this._xrRenderTarget)}for(let l=0;l<this._controllers.length;l++){const e=this._controllerInputSources[l],n=this._controllers[l];null!==e&&void 0!==n&&n.update(e,t,a)}this._currentAnimationLoop&&this._currentAnimationLoop(e,t),t.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:t}),this._xrFrame=null}const VU=new ws,qU=new Sn,zU=new Zn,kU=new wa,GU=new Ra,HU=new Ci,jU=new Zn;class WU{constructor(e,t={}){this.isRenderer=!0;const{logarithmicDepthBuffer:n=!1,alpha:i=!0,depth:r=!0,stencil:s=!1,antialias:a=!1,samples:o=0,getFallback:l=null,colorBufferType:u=ze,multiview:c=!1}=t;this.domElement=e.getDomElement(),this.backend=e,this.samples=o||!0===a?4:0,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=i,this.logarithmicDepthBuffer=n,this.outputColorSpace=Ht,this.toneMapping=0,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=r,this.stencil=s,this.info=new oN,this.overrideNodes={modelViewMatrix:null,modelNormalViewMatrix:null},this.library=new wU,this.lighting=new RU,this._getFallback=l,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new Zn(0,0,this._width,this._height),this._scissor=new Zn(0,0,this._width,this._height),this._scissorTest=!1,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 EP(new rA),this._quad.material.name="Renderer_output",this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTarget=null;const h=!0===this.alpha?0:1;this._clearColor=new NN(0,0,0,h),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._colorBufferType=u,this._initialized=!1,this._initPromise=null,this._compilationPromises=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,type:1},this.xr=new IU(this,c),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(e,t,n)=>{await this.compileAsync(e,t);const i=this._renderLists.get(e,t),r=this._renderContexts.get(e,t,this._renderTarget),s=e.overrideMaterial||n.material,a=this._objects.get(n,s,e,t,i.lightsNode,r,r.clippingContext),{fragmentShader:o,vertexShader:l}=a.getNodeBuilderState();return{fragmentShader:o,vertexShader:l}}}}async init(){if(this._initialized)throw new Error("Renderer: Backend has already been initialized.");return null!==this._initPromise||(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(i){if(null===this._getFallback)return void t(i);try{this.backend=n=this._getFallback(i),await n.init(this)}catch(r){return void t(r)}}this._nodes=new vU(this,n),this._animation=new jC(this._nodes,this.info),this._attributes=new iN(n),this._background=new gO(this,this._nodes),this._geometries=new aN(this._attributes,this.info),this._textures=new CN(this,n,this.info),this._pipelines=new pN(n,this._nodes),this._bindings=new mN(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new KC(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new xN(this.lighting),this._bundles=new MU,this._renderContexts=new AN,this._animation.start(),this._initialized=!0,e(this)})),this._initPromise}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(!0===this._isDeviceLost)return;!1===this._initialized&&await this.init();const i=this._nodes.nodeFrame,r=i.renderId,s=this._currentRenderContext,a=this._currentRenderObjectFunction,o=this._compilationPromises,l=!0===e.isScene?e:VU;null===n&&(n=e);const u=this._renderTarget,c=this._renderContexts.get(n,t,u),h=this._activeMipmapLevel,d=[];this._currentRenderContext=c,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=d,i.renderId++,i.update(),c.depth=this.depth,c.stencil=this.stencil,c.clippingContext||(c.clippingContext=new bU),c.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,u);const p=this._renderLists.get(e,t);if(p.begin(),this._projectObject(e,t,0,p,c.clippingContext),n!==e&&n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&p.pushLight(e)}),p.finish(),null!==u){this._textures.updateRenderTarget(u,h);const e=this._textures.get(u);c.textures=e.textures,c.depthTexture=e.depthTexture}else c.textures=null,c.depthTexture=null;this._background.update(l,p,c);const m=p.opaque,f=p.transparent,g=p.transparentDoublePass,_=p.lightsNode;!0===this.opaque&&m.length>0&&this._renderObjects(m,t,l,_),!0===this.transparent&&f.length>0&&this._renderTransparents(f,g,t,l,_),i.renderId=r,this._currentRenderContext=s,this._currentRenderObjectFunction=a,this._compilationPromises=o,this._handleObjectFunction=this._renderObjectDirect,await Promise.all(d)}async renderAsync(e,t){!1===this._initialized&&await this.init(),this._renderScene(e,t)}async waitForGPU(){await this.backend.waitForGPU()}set highPrecision(e){!0===e?(this.overrideNodes.modelViewMatrix=qS,this.overrideNodes.modelNormalViewMatrix=zS):this.highPrecision&&(this.overrideNodes.modelViewMatrix=null,this.overrideNodes.modelNormalViewMatrix=null)}get highPrecision(){return this.overrideNodes.modelViewMatrix===qS&&this.overrideNodes.modelNormalViewMatrix===zS}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getColorBufferType(){return this._colorBufferType}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:\n\nMessage: ${e.message}`;e.reason&&(t+=`\nReason: ${e.reason}`),this._isDeviceLost=!0}_renderBundle(e,t,n){const{bundleGroup:i,camera:r,renderList:s}=e,a=this._currentRenderContext,o=this._bundles.get(i,r),l=this.backend.get(o);void 0===l.renderContexts&&(l.renderContexts=new Set);const u=i.version!==l.version,c=!1===l.renderContexts.has(a)||u;if(l.renderContexts.add(a),c){this.backend.beginBundle(a),(void 0===l.renderObjects||u)&&(l.renderObjects=[]),this._currentRenderBundle=o;const{transparentDoublePass:e,transparent:c,opaque:h}=s;!0===this.opaque&&h.length>0&&this._renderObjects(h,r,t,n),!0===this.transparent&&c.length>0&&this._renderTransparents(c,e,r,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,o),l.version=i.version}else{const{renderObjects:e}=l;for(let t=0,n=e.length;t<n;t++){const n=e[t];this._nodes.needsRefresh(n)&&(this._nodes.updateBefore(n),this._nodes.updateForRender(n),this._bindings.updateForRender(n),this._nodes.updateAfter(n))}}this.backend.addBundle(a,o)}render(e,t){if(!1===this._initialized)return this.renderAsync(e,t);this._renderScene(e,t)}_getFrameBufferTarget(){const{currentToneMapping:e,currentColorSpace:t}=this,n=0!==e,i=t!==qn.workingColorSpace;if(!1===n&&!1===i)return null;const{width:r,height:s}=this.getDrawingBufferSize(qU),{depth:a,stencil:o}=this;let l=this._frameBufferTarget;null===l&&(l=new Jn(r,s,{depthBuffer:a,stencilBuffer:o,type:this._colorBufferType,format:Ye,colorSpace:qn.workingColorSpace,generateMipmaps:!1,minFilter:Pe,magFilter:Pe,samples:this.samples}),l.isPostProcessingRenderTarget=!0,this._frameBufferTarget=l);const u=this.getOutputRenderTarget();return l.depthBuffer=a,l.stencilBuffer=o,null!==u?l.setSize(u.width,u.height,u.depth):l.setSize(r,s,1),l.viewport.copy(this._viewport),l.scissor.copy(this._scissor),l.viewport.multiplyScalar(this._pixelRatio),l.scissor.multiplyScalar(this._pixelRatio),l.scissorTest=this._scissorTest,l.multiview=null!==u&&u.multiview,l.resolveDepthBuffer=null===u||u.resolveDepthBuffer,l._autoAllocateDepthBuffer=null!==u&&u._autoAllocateDepthBuffer,l}_renderScene(e,t,n=!0){if(!0===this._isDeviceLost)return;const i=n?this._getFrameBufferTarget():null,r=this._nodes.nodeFrame,s=r.renderId,a=this._currentRenderContext,o=this._currentRenderObjectFunction,l=!0===e.isScene?e:VU,u=this._renderTarget||this._outputRenderTarget,c=this._activeCubeFace,h=this._activeMipmapLevel;let d;null!==i?(d=i,this.setRenderTarget(d)):d=u;const p=this._renderContexts.get(e,t,d);this._currentRenderContext=p,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,r.renderId=this.info.calls;const m=this.coordinateSystem,f=this.xr;if(t.coordinateSystem!==m&&!1===f.isPresenting&&(t.coordinateSystem=m,t.updateProjectionMatrix(),t.isArrayCamera))for(const R of t.cameras)R.coordinateSystem=m,R.updateProjectionMatrix();!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===f.enabled&&!0===f.isPresenting&&(!0===f.cameraAutoUpdate&&f.updateCamera(t),t=f.getCamera());let g=this._viewport,_=this._scissor,y=this._pixelRatio;null!==d&&(g=d.viewport,_=d.scissor,y=1),this.getDrawingBufferSize(qU),zU.set(0,0,qU.width,qU.height);const v=void 0===g.minDepth?0:g.minDepth,x=void 0===g.maxDepth?1:g.maxDepth;p.viewportValue.copy(g).multiplyScalar(y).floor(),p.viewportValue.width>>=h,p.viewportValue.height>>=h,p.viewportValue.minDepth=v,p.viewportValue.maxDepth=x,p.viewport=!1===p.viewportValue.equals(zU),p.scissorValue.copy(_).multiplyScalar(y).floor(),p.scissor=this._scissorTest&&!1===p.scissorValue.equals(zU),p.scissorValue.width>>=h,p.scissorValue.height>>=h,p.clippingContext||(p.clippingContext=new bU),p.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,d);const b=t.isArrayCamera?GU:kU;t.isArrayCamera||(HU.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),b.setFromProjectionMatrix(HU,t.coordinateSystem,t.reversedDepth));const T=this._renderLists.get(e,t);if(T.begin(),this._projectObject(e,t,0,T,p.clippingContext),T.finish(),!0===this.sortObjects&&T.sort(this._opaqueSort,this._transparentSort),null!==d){this._textures.updateRenderTarget(d,h);const e=this._textures.get(d);p.textures=e.textures,p.depthTexture=e.depthTexture,p.width=e.width,p.height=e.height,p.renderTarget=d,p.depth=d.depthBuffer,p.stencil=d.stencilBuffer}else p.textures=null,p.depthTexture=null,p.width=qU.width,p.height=qU.height,p.depth=this.depth,p.stencil=this.stencil;p.width>>=h,p.height>>=h,p.activeCubeFace=c,p.activeMipmapLevel=h,p.occlusionQueryCount=T.occlusionQueryCount,p.scissorValue.max(jU.set(0,0,0,0)),p.scissorValue.x+p.scissorValue.width>p.width&&(p.scissorValue.width=Math.max(p.width-p.scissorValue.x,0)),p.scissorValue.y+p.scissorValue.height>p.height&&(p.scissorValue.height=Math.max(p.height-p.scissorValue.y,0)),this._background.update(l,T,p),p.camera=t,this.backend.beginRender(p);const{bundles:S,lightsNode:M,transparentDoublePass:w,transparent:E,opaque:A}=T;return S.length>0&&this._renderBundles(S,l,M),!0===this.opaque&&A.length>0&&this._renderObjects(A,t,l,M),!0===this.transparent&&E.length>0&&this._renderTransparents(E,w,t,l,M),this.backend.finishRender(p),r.renderId=s,this._currentRenderContext=a,this._currentRenderObjectFunction=o,null!==i&&(this.setRenderTarget(u,c,h),this._renderOutput(d)),l.onAfterRender(this,e,t,d),p}_setXRLayerSize(e,t){this._width=e,this._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,i=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(t,t.camera,!1),this.autoClear=n,this.xr.enabled=i}getMaxAnisotropy(){return this.backend.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){!1===this._initialized&&await this.init(),this._animation.setAnimationLoop(e)}async getArrayBufferAsync(e){return await this.backend.getArrayBufferAsync(e)}getContext(){return this.backend.getContext()}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._initialized&&this.backend.updateSize())}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),!0===n&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._initialized&&this.backend.updateSize())}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}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,i){const r=this._scissor;
1e.isVector4?r.copy(e):r.set(e,t,n,i)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e,this.backend.setScissorTest(e)}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,i,r=0,s=1){const a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,i),a.minDepth=r,a.maxDepth=s}getClearColor(e){return e.copy(this._clearColor)}setClearColor(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._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(!1===this._initialized)return this.clearAsync(e,t,n);const i=this._renderTarget||this._getFrameBufferTarget();let r=null;if(null!==i){this._textures.updateRenderTarget(i);const e=this._textures.get(i);r=this._renderContexts.getForClear(i),r.textures=e.textures,r.depthTexture=e.depthTexture,r.width=e.width,r.height=e.height,r.renderTarget=i,r.depth=i.depthBuffer,r.stencil=i.stencilBuffer,r.clearColorValue=this.backend.getClearColor(),r.activeCubeFace=this.getActiveCubeFace(),r.activeMipmapLevel=this.getActiveMipmapLevel()}this.backend.clear(e,t,n,r),null!==i&&null===this._renderTarget&&this._renderOutput(i)}clearColor(){return this.clear(!0,!1,!1)}clearDepth(){return this.clear(!1,!0,!1)}clearStencil(){return this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){!1===this._initialized&&await this.init(),this.clear(e,t,n)}async clearColorAsync(){this.clearAsync(!0,!1,!1)}async clearDepthAsync(){this.clearAsync(!1,!0,!1)}async clearStencilAsync(){this.clearAsync(!1,!1,!0)}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:0}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:qn.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||null===this._renderTarget}dispose(){!0===this._initialized&&(this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose(),null!==this._frameBufferTarget&&this._frameBufferTarget.dispose(),Object.values(this.backend.timestampQueryPool).forEach(e=>{null!==e&&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}_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(!0===this._isDeviceLost)return;if(!1===this._initialized)return this.computeAsync(e);const n=this._nodes.nodeFrame,i=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls;const r=this.backend,s=this._pipelines,a=this._bindings,o=this._nodes,l=Array.isArray(e)?e:[e];if(void 0===l[0]||!0!==l[0].isComputeNode)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");r.beginCompute(e);for(const u of l){if(!1===s.has(u)){const e=()=>{u.removeEventListener("dispose",e),s.delete(u),a.delete(u),o.delete(u)};u.addEventListener("dispose",e);const t=u.onInitFunction;null!==t&&t.call(u,{renderer:this})}o.updateForCompute(u),a.updateForCompute(u);const n=a.getForCompute(u),i=s.getForCompute(u,n);r.compute(e,u,n,i,t)}r.finishCompute(e),n.renderId=i}async computeAsync(e,t=null){!1===this._initialized&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return!1===this._initialized&&await this.init(),this.backend.hasFeature(e)}async resolveTimestampsAsync(e="render"){return!1===this._initialized&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){return!1!==this._initialized&&this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){!1===this._initialized&&await this.init(),this._textures.updateTexture(e)}initTexture(e){this._initialized,this._textures.updateTexture(e)}
1copyFramebufferToTexture(e,t=null){if(null!==t)if(t.isVector2)t=jU.set(t.x,t.y,e.image.width,e.image.height).floor();else{if(!t.isVector4)return;t=jU.copy(t).floor()}else t=jU.set(0,0,e.image.width,e.image.height);let n,i=this._currentRenderContext;null!==i?n=i.renderTarget:(n=this._renderTarget||this._getFrameBufferTarget(),null!==n&&(this._textures.updateRenderTarget(n),i=this._textures.get(n))),this._textures.updateTexture(e,{renderTarget:n}),this.backend.copyFramebufferToTexture(e,i,t)}copyTextureToTexture(e,t,n=null,i=null,r=0,s=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,i,r,s)}async readRenderTargetPixelsAsync(e,t,n,i,r,s=0,a=0){return this.backend.copyTextureToBuffer(e.textures[s],t,n,i,r,a)}_projectObject(e,t,n,i,r){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(r=r.getGroupContext(e));else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)i.pushLight(e);else if(e.isSprite){const s=t.isArrayCamera?GU:kU;if(!e.frustumCulled||s.intersectsSprite(e,t)){!0===this.sortObjects&&jU.setFromMatrixPosition(e.matrixWorld).applyMatrix4(HU);const{geometry:t,material:s}=e;s.visible&&i.push(e,t,s,n,jU.z,null,r)}}else if(e.isLineLoop);else if(e.isMesh||e.isLine||e.isPoints){const s=t.isArrayCamera?GU:kU;if(!e.frustumCulled||s.intersectsObject(e,t)){const{geometry:t,material:s}=e;if(!0===this.sortObjects&&(null===t.boundingSphere&&t.computeBoundingSphere(),jU.copy(t.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(HU)),Array.isArray(s)){const a=t.groups;for(let o=0,l=a.length;o<l;o++){const l=a[o],u=s[l.materialIndex];u&&u.visible&&i.push(e,t,u,n,jU.z,l,r)}}else s.visible&&i.push(e,t,s,n,jU.z,null,r)}}if(!0===e.isBundleGroup&&void 0!==this.backend.beginBundle){const n=i;(i=this._renderLists.get(e,t)).begin(),n.pushBundle({bundleGroup:e,camera:t,renderList:i}),i.finish()}const s=e.children;for(let a=0,o=s.length;a<o;a++)this._projectObject(s[a],t,n,i,r)}_renderBundles(e,t,n){for(const i of e)this._renderBundle(i,t,n)}_renderTransparents(e,t,n,i,r){if(t.length>0){for(const{material:e}of t)e.side=1;this._renderObjects(t,n,i,r,"backSide");for(const{material:e}of t)e.side=0;this._renderObjects(e,n,i,r);for(const{material:e}of t)e.side=2}else this._renderObjects(e,n,i,r)}_renderObjects(e,t,n,i,r=null){for(let s=0,a=e.length;s<a;s++){const{object:a,geometry:o,material:l,group:u,clippingContext:c}=e[s];this._currentRenderObjectFunction(a,n,t,o,l,u,i,c,r)}}renderObject(e,t,n,i,r,s,a,o=null,l=null){let u,c,h;if(e.onBeforeRender(this,t,n,i,r,s),!0===r.allowOverride&&null!==t.overrideMaterial){const e=t.overrideMaterial;r.positionNode&&r.positionNode.isNode&&(u=e.positionNode,e.positionNode=r.positionNode),e.alphaTest=r.alphaTest,e.alphaMap=r.alphaMap,e.transparent=r.transparent||r.transmission>0,e.isShadowPassMaterial&&(e.side=null===r.shadowSide?r.side:r.shadowSide,r.depthNode&&r.depthNode.isNode&&(h=e.depthNode,e.depthNode=r.depthNode),r.castShadowNode&&r.castShadowNode.isNode&&(c=e.colorNode,e.colorNode=r.castShadowNode),r.castShadowPositionNode&&r.castShadowPositionNode.isNode&&(u=e.positionNode,e.positionNode=r.castShadowPositionNode)),r=e}!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,this._handleObjectFunction(e,r,t,n,a,s,o,"backSide"),r.side=0,this._handleObjectFunction(e,r,t,n,a,s,o,l),r.side=2):this._handleObjectFunction(e,r,t,n,a,s,o,l),void 0!==u&&(t.overrideMaterial.positionNode=u),void 0!==h&&(t.overrideMaterial.depthNode=h),void 0!==c&&(t.overrideMaterial.colorNode=c),e.onAfterRender(this,t,n,i,r,s)}_renderObjectDirect(e,t,n,i,r,s,a,o){const l=this._objects.get(e,t,n,i,r,this._currentRenderContext,a,o);l.drawRange=e.geometry.drawRange,l.group=s;const u=this._nodes.needsRefresh(l);if(u&&(this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l)),this._pipelines.updateForRender(l),null!==this._currentRenderBundle){this.backend.get(this._currentRenderBundle).renderObjects.push(l),l.bundle=this._currentRenderBundle.bundleGroup}this.backend.draw(l,this.info),u&&this._nodes.updateAfter(l)}_createObjectPipeline(e,t,n,i,r,s,a,o){const l=this._objects.get(e,t,n,i,r,this._currentRenderContext,a,o);l.drawRange=e.geometry.drawRange,l.group=s,this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l),this._pipelines.getForRender(l,this._compilationPromises),this._nodes.updateAfter(l)}get compile(){return this.compileAsync}}class XU{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}clone(){return Object.assign(new this.constructor,this)}}class $U extends XU{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t}get byteLength(){return(e=this._buffer.byteLength)+(nN-e%nN)%nN;var e}get buffer(){return this._buffer}update(){return!0}}class YU extends $U{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let KU=0;class ZU extends YU{constructor(e,t){super("UniformBuffer_"+KU++,e?e.value:null),this.nodeUniform=e,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class JU extends YU{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[]}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}get values(){return null===this._values&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(null===e){const t=this.byteLength;
vendor: 37,394 bytes, line 1
1e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){const e=this.bytesPerElement;let t=0;for(let n=0,i=this.uniforms.length;n<i;n++){const i=this.uniforms[n],r=i.boundary,s=i.itemSize*e,a=t%nN,o=a%r,l=a+o;t+=o,0!==l&&nN-l<s&&(t+=nN-l),i.offset=t/e,t+=s}return Math.ceil(t/nN)*nN}update(){let e=!1;for(const t of this.uniforms)!0===this.updateByType(t)&&(e=!0);return e}updateByType(e){return e.isNumberUniform?this.updateNumber(e):e.isVector2Uniform?this.updateVector2(e):e.isVector3Uniform?this.updateVector3(e):e.isVector4Uniform?this.updateVector4(e):e.isColorUniform?this.updateColor(e):e.isMatrix3Uniform?this.updateMatrix3(e):e.isMatrix4Uniform?this.updateMatrix4(e):void 0}updateNumber(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset,s=e.getType();if(n[r]!==i){this._getBufferForType(s)[r]=n[r]=i,t=!0}return t}updateVector2(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset,s=e.getType();if(n[r+0]!==i.x||n[r+1]!==i.y){const e=this._getBufferForType(s);e[r+0]=n[r+0]=i.x,e[r+1]=n[r+1]=i.y,t=!0}return t}updateVector3(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset,s=e.getType();if(n[r+0]!==i.x||n[r+1]!==i.y||n[r+2]!==i.z){const e=this._getBufferForType(s);e[r+0]=n[r+0]=i.x,e[r+1]=n[r+1]=i.y,e[r+2]=n[r+2]=i.z,t=!0}return t}updateVector4(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset,s=e.getType();if(n[r+0]!==i.x||n[r+1]!==i.y||n[r+2]!==i.z||n[r+4]!==i.w){const e=this._getBufferForType(s);e[r+0]=n[r+0]=i.x,e[r+1]=n[r+1]=i.y,e[r+2]=n[r+2]=i.z,e[r+3]=n[r+3]=i.w,t=!0}return t}updateColor(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset;if(n[r+0]!==i.r||n[r+1]!==i.g||n[r+2]!==i.b){const e=this.buffer;e[r+0]=n[r+0]=i.r,e[r+1]=n[r+1]=i.g,e[r+2]=n[r+2]=i.b,t=!0}return t}updateMatrix3(e){let t=!1;const n=this.values,i=e.getValue().elements,r=e.offset;if(n[r+0]!==i[0]||n[r+1]!==i[1]||n[r+2]!==i[2]||n[r+4]!==i[3]||n[r+5]!==i[4]||n[r+6]!==i[5]||n[r+8]!==i[6]||n[r+9]!==i[7]||n[r+10]!==i[8]){const e=this.buffer;e[r+0]=n[r+0]=i[0],e[r+1]=n[r+1]=i[1],e[r+2]=n[r+2]=i[2],e[r+4]=n[r+4]=i[3],e[r+5]=n[r+5]=i[4],e[r+6]=n[r+6]=i[5],e[r+8]=n[r+8]=i[6],e[r+9]=n[r+9]=i[7],e[r+10]=n[r+10]=i[8],t=!0}return t}updateMatrix4(e){let t=!1;const n=this.values,i=e.getValue().elements,r=e.offset;if(!1===function(e,t,n){for(let i=0,r=t.length;i<r;i++)if(e[n+i]!==t[i])return!1;return!0}(n,i,r)){this.buffer.set(i,r),function(e,t,n){for(let i=0,r=t.length;i<r;i++)e[n+i]=t[i]}(n,i,r),t=!0}return t}_getBufferForType(e){return"int"===e||"ivec2"===e||"ivec3"===e||"ivec4"===e?new Int32Array(this.buffer.buffer):"uint"===e||"uvec2"===e||"uvec3"===e||"uvec4"===e?new Uint32Array(this.buffer.buffer):this.buffer}}let QU=0;class eF extends JU{constructor(e,t){super(e),this.id=QU++,this.groupNode=t,this.isNodeUniformsGroup=!0}}class tF extends XU{constructor(e,t){super(e),this.texture=t,this.version=t?t.version:0,this.generation=null,this.isSampler=!0}set texture(e){if(this._texture===e)return;const t=()=>{this._texture=null,this.generation=null,this.version=0};this._texture&&this._texture.removeEventListener("dispose",t),this._texture=e,this.generation=null,this.version=0,this._texture&&this._texture.addEventListener("dispose",t)}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version&&(this.version=e.version,!0)}clone(){const e=super.clone();return e._texture=null,e.texture=this.texture,e}}let nF=0;class iF extends tF{constructor(e,t){super(e,t),this.id=nF++,this.store=!1,this.isSampledTexture=!0}}class rF extends iF{constructor(e,t,n,i=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=i}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class sF extends rF{constructor(e,t,n,i=null){super(e,t,n,i),this.isSampledCubeTexture=!0}}class aF extends rF{constructor(e,t,n,i=null){super(e,t,n,i),this.isSampledTexture3D=!0}}const oF={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint"},lF={low:"lowp",medium:"mediump",high:"highp"},uF={swizzleAssign:!0,storageBuffer:!1},cF={perspective:"smooth",linear:"noperspective"},hF={centroid:"centroid"},dF="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nprecision highp sampler3D;\nprecision highp samplerCube;\nprecision highp sampler2DArray;\n\nprecision highp usampler2D;\nprecision highp usampler3D;\nprecision highp usamplerCube;\nprecision highp usampler2DArray;\n\nprecision highp isampler2D;\nprecision highp isampler3D;\nprecision highp isamplerCube;\nprecision highp isampler2DArray;\n\nprecision lowp sampler2DShadow;\nprecision lowp sampler2DArrayShadow;\nprecision lowp samplerCubeShadow;\n";class pF extends $O{constructor(e,t){super(e,t,new fU),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return!0===e.isVideoTexture&&e.colorSpace!==Gt}getMethod(e){return oF[e]||e}getBitcastMethod(e,t){return oF[`bitcast_${t}_${e}`]}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),i=[];for(const r of t.inputs)i.push(this.getType(r.type)+" "+r.name);return`${this.getType(t.type)} ${t.name}( ${i.join(", ")} ) {\n\n\t${n.vars}\n\n${n.code}\n\treturn ${n.result};\n\n}`}setupPBO(e){const t=e.value;if(void 0===t.pbo){const e=t.array,n=t.count*t.itemSize,{itemSize:i}=t,r=t.array.constructor.name.toLowerCase().includes("int");let s=r?Qe:Je;2===i?s=r?tt:et:3===i?s=r?1032:$e:4===i&&(s=r?nt:Ye);const a={Float32Array:qe,Uint8Array:De,Uint16Array:Fe,Uint32Array:Ve,Int8Array:Oe,Int16Array:Ue,Int32Array:Be,Uint8ClampedArray:De},o=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(n/i))));let l=Math.ceil(n/i/o);o*l*i<n&&l++;const u=o*l*i,c=new e.constructor(u);c.set(e,0),t.array=c;const h=new sa(t.array,o,l,s,a[t.array.constructor.name]||qe);h.needsUpdate=!0,h.isPBOTexture=!0;const d=new GT(h,null,null);d.setPrecision("high"),t.pboNode=d,t.pbo=d.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&!0!==e.node.isTextureNode&&!0!==e.node.isBufferNode?t.charAt(0)+"_"+e.name:super.getPropertyName(e,t)}generatePBO(e){const{node:t,indexNode:n}=e,i=t.value;if(this.renderer.backend.has(i)){this.renderer.backend.get(i).pbo=i.pbo}const r=this.getUniformFromNode(i.pboNode,"texture",this.shaderStage,this.context.nodeName),s=this.getPropertyName(r);this.increaseUsage(n);const a=n.build(this,"uint"),o=this.getDataFromNode(e);let l=o.propertyName;if(void 0===l){const n=this.getVarFromNode(e);l=this.getPropertyName(n);const r=this.getDataFromNode(t);let u=r.propertySizeName;void 0===u&&(u=l+"Size",this.getVarFromNode(t,u,"uint"),this.addLineFlowCode(`${u} = uint( textureSize( ${s}, 0 ).x )`,e),r.propertySizeName=u);const{itemSize:c}=i,h="."+C_.join("").slice(0,c),d=`ivec2(${a} % ${u}, ${a} / ${u})`,p=this.generateTextureLoad(null,s,d,null,null,"0");let m="vec4";i.pbo.type===Ve?m="uvec4":i.pbo.type===Be&&(m="ivec4"),this.addLineFlowCode(`${l} = ${m}(${p})${h}`,e),o.propertyName=l}return l}generateTextureLoad(e,t,n,i,r,s="0"){let a;return a=i?r?`texelFetchOffset( ${t}, ivec3( ${n}, ${i} ), ${s}, ${r} )`:`texelFetch( ${t}, ivec3( ${n}, ${i} ), ${s} )`:r?`texelFetchOffset( ${t}, ${n}, ${s}, ${r} )`:`texelFetch( ${t}, ${n}, ${s} )`,null!==e&&e.isDepthTexture&&(a+=".x"),a}generateTexture(e,t,n,i,r){return i&&(n=`vec3( ${n}, ${i} )`),e.isDepthTexture?r?`textureOffset( ${t}, ${n}, ${r} ).x`:`texture( ${t}, ${n} ).x`:r?`textureOffset( ${t}, ${n}, ${r} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,i,r){return r?`textureLodOffset( ${t}, ${n}, ${i}, ${r} )`:`textureLod( ${t}, ${n}, ${i} )`}generateTextureBias(e,t,n,i,r){return r?`textureOffset( ${t}, ${n}, ${r}, ${i} )`:`texture( ${t}, ${n}, ${i} )`}generateTextureGrad(e,t,n,i,r){return r?`textureGradOffset( ${t}, ${n}, ${i[0]}, ${i[1]}, ${r} )`:`textureGrad( ${t}, ${n}, ${i[0]}, ${i[1]} )`}generateTextureCompare(e,t,n,i,r,s,a=this.shaderStage){if("fragment"===a)return r?s?`textureOffset( ${t}, vec4( ${n}, ${r}, ${i} ), ${s} )`:`texture( ${t}, vec4( ${n}, ${r}, ${i} ) )`:s?`textureOffset( ${t}, vec3( ${n}, ${i} ), ${s} )`:`texture( ${t}, vec3( ${n}, ${i} ) )`}getVars(e){const t=[],n=this.vars[e];if(void 0!==n)for(const i of n)t.push(`${this.getVar(i.type,i.name,i.count)};`);return t.join("\n\t")}getUniforms(e){const t=this.uniforms[e],n=[],i={};for(const s of t){let t=null,r=!1;if("texture"===s.type||"texture3D"===s.type){const e=s.node.value;let n="";!0!==e.isDataTexture&&!0!==e.isData3DTexture||(e.type===Ve?n="u":e.type===Be&&(n="i")),t="texture3D"===s.type&&!1===e.isArrayTexture?`${n}sampler3D ${s.name};`:e.compareFunction?!0===e.isArrayTexture?`sampler2DArrayShadow ${s.name};`:`sampler2DShadow ${s.name};`:!0===e.isArrayTexture||!0===e.isDataArrayTexture||!0===e.isCompressedArrayTexture?`${n}sampler2DArray ${s.name};`:`${n}sampler2D ${s.name};`}else if("cubeTexture"===s.type)t=`samplerCube ${s.name};`;else if("buffer"===s.type){const e=s.node,n=this.getType(e.bufferType),i=e.bufferCount,r=i>0?i:"";t=`${e.name} {\n\t${n} ${s.name}[${r}];\n};\n`}else{t=`${this.getVectorType(s.type)} ${this.getPropertyName(s,e)};`,r=!0}const a=s.node.precision;if(null!==a&&(t=lF[a]+" "+t),r){t="\t"+t;const e=s.groupNode.name;(i[e]||(i[e]=[])).push(t)}else t="uniform "+t,n.push(t)}let r="";for(const s in i){const t=i[s];r+=this._getGLSLUniformStruct(e+"_"+s,t.join("\n"))+"\n"}return r+=n.join("\n"),r}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Be){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);const i=n.array;!1==(i instanceof Uint32Array||i instanceof Int32Array)&&(t=t.slice(1))}return t}getAttributes(e){let t="";if("vertex"===e||"compute"===e){const e=this.getAttributesArray();let n=0;for(const i of e)t+=`layout( location = ${n++} ) in ${i.type} ${i.name};\n`}return t}getStructMembers(e){const t=[];for(const n of e.members)t.push(`\t${n.type} ${n.name};`);return t.join("\n")}getStructs(e){const t=[],n=this.structs[e],i=[];for(const r of n)if(r.output)for(const e of r.members)i.push(`layout( location = ${e.index} ) out ${e.type} ${e.name};`);else{let e="struct "+r.name+" {\n";e+=this.getStructMembers(r),e+="\n};\n",t.push(e)}return 0===i.length&&i.push("layout( location = 0 ) out vec4 fragColor;"),"\n"+i.join("\n")+"\n\n"+t.join("\n")}getVaryings(e){let t="";const n=this.varyings;if("vertex"===e||"compute"===e)for(const i of n){"compute"===e&&(i.needsInterpolation=!0);const n=this.getType(i.type);if(i.needsInterpolation)if(i.interpolationType){t+=`${cF[i.interpolationType]||i.interpolationType} ${hF[i.interpolationSampling]||""} out ${n} ${i.name};\n`}else{t+=`${n.includes("int")||n.includes("uv")||n.includes("iv")?"flat ":""}out ${n} ${i.name};\n`}else t+=`${n} ${i.name};\n`}else if("fragment"===e)for(const i of n)if(i.needsInterpolation){const e=this.getType(i.type);if(i.interpolationType){t+=`${cF[i.interpolationType]||i.interpolationType} ${hF[i.interpolationSampling]||""} in ${e} ${i.name};\n`}else{t+=`${e.includes("int")||e.includes("uv")||e.includes("iv")?"flat ":""}in ${e} ${i.name};\n`}}for(const i of this.builtins[e])t+=`${i};\n`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((e,t)=>e*t,1)}u`}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 i=this.extensions[n]||(this.extensions[n]=new Map);!1===i.has(e)&&i.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if("vertex"===e){const t=this.renderer.backend.extensions;this.object.isBatchedMesh&&t.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const n=this.extensions[e];if(void 0!==n)for(const{name:i,behavior:r}of n.values())t.push(`#extension ${i} : ${r}`);return t.join("\n")}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=uF[e];if(void 0===t){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance"}if(void 0!==n){const e=this.renderer.backend.extensions;e.has(n)&&(e.get(n),t=!0)}uF[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){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 i=e[n],r=this.getPropertyName(i.attributeNode);r&&(t+=`${i.varyingName} = ${r};\n\t`)}return t}_getGLSLUniformStruct(e,t){return`\nlayout( std140 ) uniform ${e} {\n${t}\n};`}_getGLSLVertexCode(e){return`#version 300 es\n\n${this.getSignature()}\n\n// extensions\n${e.extensions}\n\n// precision\n${dF}\n\n// uniforms\n${e.uniforms}\n\n// varyings\n${e.varyings}\n\n// attributes\n${e.attributes}\n\n// codes\n${e.codes}\n\nvoid main() {\n\n\t// vars\n\t${e.vars}\n\n\t// transforms\n\t${e.transforms}\n\n\t// flow\n\t${e.flow}\n\n\tgl_PointSize = 1.0;\n\n}\n`}_getGLSLFragmentCode(e){return`#version 300 es\n\n${this.getSignature()}\n\n// extensions\n${e.extensions}\n\n// precision\n${dF}\n\n// uniforms\n${e.uniforms}\n\n// varyings\n${e.varyings}\n\n// codes\n${e.codes}\n\n// structs\n${e.structs}\n\nvoid main() {\n\n\t// vars\n\t${e.vars}\n\n\t// flow\n\t${e.flow}\n\n}\n`}buildCode(){const e=null!==this.material?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){let n="// code\n\n";n+=this.flowCode[t];const i=this.flowNodes[t],r=i[i.length-1];for(const e of i){const i=this.getFlowData(e),s=e.name;s&&(n.length>0&&(n+="\n"),n+=`\t// flow -> ${s}\n\t`),n+=`${i.code}\n\t`,e===r&&"compute"!==t&&(n+="// result\n\t","vertex"===t?(n+="gl_Position = ",n+=`${i.result};`):"fragment"===t&&(e.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${i.result};`)))}const s=e[t];s.extensions=this.getExtensions(t),s.uniforms=this.getUniforms(t),s.attributes=this.getAttributes(t),s.varyings=this.getVaryings(t),s.vars=this.getVars(t),s.structs=this.getStructs(t),s.codes=this.getCodes(t),s.transforms=this.getTransforms(t),s.flow=n}null!==this.material?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,i=null){const r=super.getUniformFromNode(e,t,n,i),s=this.getDataFromNode(e,n,this.globalCache);let a=s.uniformGPU;if(void 0===a){const i=e.groupNode,o=i.name,l=this.getBindGroupArray(o,n);if("texture"===t)a=new rF(r.name,r.node,i),l.push(a);else if("cubeTexture"===t)a=new sF(r.name,r.node,i),l.push(a);else if("texture3D"===t)a=new aF(r.name,r.node,i),l.push(a);else if("buffer"===t){e.name=`NodeBuffer_${e.id}`,r.name=`buffer${e.id}`;const t=new ZU(e,i);t.name=e.name,l.push(t),a=t}else{const e=this.uniformGroups[n]||(this.uniformGroups[n]={});let s=e[o];void 0===s&&(s=new eF(n+"_"+o,i),e[o]=s,l.push(s)),a=this.getNodeUniform(r,t),s.addUniform(a)}s.uniformGPU=a}return r}}let mF=null,fF=null;class gF{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={render:null,compute:null},this.trackTimestamp=!0===e.trackTimestamp}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}createSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}getTimestampUID(e){const t=this.get(e);let n=!0===e.isComputeNode?"c":"r";return n+=":"+t.frameCalls+":"+e.id,n}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp)return void Un("WebGPURenderer: Timestamp tracking is disabled.");const t=this.timestampQueryPool[e];if(!t)return void Un(`WebGPURenderer: No timestamp query pool for type '${e}' found.`);const n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async waitForGPU(){}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return mF=mF||new Sn,this.renderer.getDrawingBufferSize(mF)}setScissorTest(){}getClearColor(){const e=this.renderer;return fF=fF||new NN,e.getClearColor(fF),fF.getRGB(fF),fF}getDomElement(){let e=this.domElement;return null===e&&(e=void 0!==this.parameters.canvas?this.parameters.canvas:Dn(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${V} webgpu`),this.domElement=e),e}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}dispose(){}}let _F,yF,vF=0;class xF{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[1^this.activeBufferIndex]}switchBuffers(){this.activeBufferIndex^=1}}class bF{constructor(e){this.backend=e}createAttribute(e,t){const n=this.backend,{gl:i}=n,r=e.array,s=e.usage||i.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,o=n.get(a);let l,u=o.bufferGPU;if(void 0===u&&(u=this._createBuffer(i,t,r,s),o.bufferGPU=u,o.bufferType=t,o.version=a.version),r instanceof Float32Array)l=i.FLOAT;else if("undefined"!=typeof Float16Array&&r instanceof Float16Array)l=i.HALF_FLOAT;else if(r instanceof Uint16Array)l=e.isFloat16BufferAttribute?i.HALF_FLOAT:i.UNSIGNED_SHORT;else if(r instanceof Int16Array)l=i.SHORT;else if(r instanceof Uint32Array)l=i.UNSIGNED_INT;else if(r instanceof Int32Array)l=i.INT;else if(r instanceof Int8Array)l=i.BYTE;else if(r instanceof Uint8Array)l=i.UNSIGNED_BYTE;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+r);l=i.UNSIGNED_BYTE}let c={bufferGPU:u,bufferType:t,type:l,byteLength:r.byteLength,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:l===i.INT||l===i.UNSIGNED_INT||e.gpuType===Be,id:vF++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const e=this._createBuffer(i,t,r,s);c=new xF(c,e)}n.set(e,c)}updateAttribute(e){const t=this.backend,{gl:n}=t,i=e.array,r=e.isInterleavedBufferAttribute?e.data:e,s=t.get(r),a=s.bufferType,o=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,s.bufferGPU),0===o.length)n.bufferSubData(a,0,i);else{for(let e=0,t=o.length;e<t;e++){const t=o[e];n.bufferSubData(a,t.start*i.BYTES_PER_ELEMENT,i,t.start,t.count)}r.clearUpdateRanges()}n.bindBuffer(a,null),s.version=r.version}destroyAttribute(e){const t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);const i=t.get(e);n.deleteBuffer(i.bufferGPU),t.delete(e)}async getArrayBufferAsync(e){const t=this.backend,{gl:n}=t,i=e.isInterleavedBufferAttribute?e.data:e,{bufferGPU:r}=t.get(i),s=e.array,a=s.byteLength;n.bindBuffer(n.COPY_READ_BUFFER,r);const o=n.createBuffer();n.bindBuffer(n.COPY_WRITE_BUFFER,o),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 l=new e.array.constructor(s.length);return n.bindBuffer(n.COPY_WRITE_BUFFER,o),n.getBufferSubData(n.COPY_WRITE_BUFFER,0,l),n.deleteBuffer(o),n.bindBuffer(n.COPY_READ_BUFFER,null),n.bindBuffer(n.COPY_WRITE_BUFFER,null),l.buffer}_createBuffer(e,t,n,i){const r=e.createBuffer();return e.bindBuffer(t,r),e.bufferData(t,n,i),e.bindBuffer(t,null),r}}class TF{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.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;_F={[j]:e.FUNC_ADD,[W]:e.FUNC_SUBTRACT,[X]:e.FUNC_REVERSE_SUBTRACT},yF={[$]:e.ZERO,[Y]:e.ONE,[K]:e.SRC_COLOR,[J]:e.SRC_ALPHA,[re]:e.SRC_ALPHA_SATURATE,[ne]:e.DST_COLOR,[ee]:e.DST_ALPHA,[Z]:e.ONE_MINUS_SRC_COLOR,[Q]:e.ONE_MINUS_SRC_ALPHA,[ie]:e.ONE_MINUS_DST_COLOR,[te]:e.ONE_MINUS_DST_ALPHA};const t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=(new Zn).fromArray(t),this.currentViewport=(new Zn).fromArray(n),this._tempVec4=new Zn}enable(e){const{enabled:t}=this;!0!==t[e]&&(this.gl.enable(e),t[e]=!0)}disable(e){const{enabled:t}=this;!1!==t[e]&&(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;0!==e?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(1===e?t.cullFace(t.BACK):2===e?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)}setBlending(e,t,n,i,r,s,a,o){const{gl:l}=this;if(0!==e){if(!1===this.currentBlendingEnabled&&(this.enable(l.BLEND),this.currentBlendingEnabled=!0),5===e)r=r||t,s=s||n,a=a||i,t===this.currentBlendEquation&&r===this.currentBlendEquationAlpha||(l.blendEquationSeparate(_F[t],_F[r]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=r),n===this.currentBlendSrc&&i===this.currentBlendDst&&s===this.currentBlendSrcAlpha&&a===this.currentBlendDstAlpha||(l.blendFuncSeparate(yF[n],yF[i],yF[s],yF[a]),this.currentBlendSrc=n,this.currentBlendDst=i,this.currentBlendSrcAlpha=s,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1;else if(e!==this.currentBlending||o!==this.currentPremultipledAlpha){if(this.currentBlendEquation===j&&this.currentBlendEquationAlpha===j||(l.blendEquation(l.FUNC_ADD),this.currentBlendEquation=j,this.currentBlendEquationAlpha=j),o)switch(e){case 1:l.blendFuncSeparate(l.ONE,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA);break;case 2:l.blendFunc(l.ONE,l.ONE);break;case 3:l.blendFuncSeparate(l.ZERO,l.ONE_MINUS_SRC_COLOR,l.ZERO,l.ONE);break;case 4:l.blendFuncSeparate(l.DST_COLOR,l.ONE_MINUS_SRC_ALPHA,l.ZERO,l.ONE)}else switch(e){case 1:l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA);break;case 2:l.blendFuncSeparate(l.SRC_ALPHA,l.ONE,l.ONE,l.ONE)}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=o}}else!0===this.currentBlendingEnabled&&(this.disable(l.BLEND),this.currentBlendingEnabled=!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)}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthFunc!==e){const{gl:t}=this;switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,i){const r=this._tempVec4.set(e,t,n,i);if(!1===this.currentScissor.equals(r)){const{gl:e}=this;e.scissor(r.x,r.y,r.z,r.w),this.currentScissor.copy(r)}}viewport(e,t,n,i){const r=this._tempVec4.set(e,t,n,i);if(!1===this.currentViewport.equals(r)){const{gl:e}=this;e.viewport(r.x,r.y,r.z,r.w),this.currentViewport.copy(r)}}setScissorTest(e){const t=this.gl;e?t.enable(t.SCISSOR_TEST):t.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:i}=this;2===e.side?this.disable(i.CULL_FACE):this.enable(i.CULL_FACE);let r=1===e.side;t&&(r=!r),this.setFlipSided(r),1===e.blending&&!1===e.transparent?this.setBlending(0):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 s=e.stencilWrite;if(this.setStencilTest(s),s&&(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),!0===e.alphaToCoverage&&this.backend.renderer.samples>1?this.enable(i.SAMPLE_ALPHA_TO_COVERAGE):this.disable(i.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n){const e=12288;for(let t=0;t<8;t++)t<n?this.enable(e+t):this.disable(e+t)}}setPolygonOffset(e,t,n){const{gl:i}=this;e?(this.enable(i.POLYGON_OFFSET_FILL),this.currentPolygonOffsetFactor===t&&this.currentPolygonOffsetUnits===n||(i.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(i.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e&&(this.gl.useProgram(e),this.currentProgram=e,!0)}setVertexState(e,t=null){const n=this.gl;return(this.currentVAO!==e||this.currentIndex!==t)&&(n.bindVertexArray(e),null!==t&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0)}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:i}=this;return i[e]!==t&&(n.bindFramebuffer(e,t),i[e]=t,e===n.DRAW_FRAMEBUFFER&&(i[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(i[n.DRAW_FRAMEBUFFER]=t),!0)}drawBuffers(e,t){const{gl:n}=this;let i=[],r=!1;if(null!==e.textures){i=this.currentDrawbuffers.get(t),void 0===i&&(i=[],this.currentDrawbuffers.set(t,i));const s=e.textures;if(i.length!==s.length||i[0]!==n.COLOR_ATTACHMENT0){for(let e=0,t=s.length;e<t;e++)i[e]=n.COLOR_ATTACHMENT0+e;i.length=s.length,r=!0}}else i[0]!==n.BACK&&(i[0]=n.BACK,r=!0);r&&n.drawBuffers(i)}activeTexture(e){const{gl:t,currentTextureSlot:n,maxTextures:i}=this;void 0===e&&(e=t.TEXTURE0+i-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){const{gl:i,currentTextureSlot:r,currentBoundTextures:s,maxTextures:a}=this;void 0===n&&(n=null===r?i.TEXTURE0+a-1:r);let o=s[n];void 0===o&&(o={type:void 0,texture:void 0},s[n]=o),o.type===e&&o.texture===t||(r!==n&&(i.activeTexture(n),this.currentTextureSlot=n),i.bindTexture(e,t),o.type=e,o.texture=t)}bindBufferBase(e,t,n){const{gl:i}=this,r=`${e}-${t}`;return this.currentBoundBufferBases[r]!==n&&(i.bindBufferBase(e,t,n),this.currentBoundBufferBases[r]=n,!0)}unbindTexture(){const{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,i=n[t];void 0!==i&&void 0!==i.type&&(e.bindTexture(i.type,null),i.type=void 0,i.texture=void 0)}}class SF{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=""){const{gl:n,extensions:i}=this;let r;const s=qn.getTransfer(t);if(e===De)return n.UNSIGNED_BYTE;if(e===ke)return n.UNSIGNED_SHORT_4_4_4_4;if(e===Ge)return n.UNSIGNED_SHORT_5_5_5_1;if(e===je)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===We)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Oe)return n.BYTE;if(e===Ue)return n.SHORT;if(e===Fe)return n.UNSIGNED_SHORT;if(e===Be)return n.INT;if(e===Ve)return n.UNSIGNED_INT;if(e===qe)return n.FLOAT;if(e===ze)return n.HALF_FLOAT;if(e===Xe)return n.ALPHA;if(e===$e)return n.RGB;if(e===Ye)return n.RGBA;if(e===Ke)return n.DEPTH_COMPONENT;if(e===Ze)return n.DEPTH_STENCIL;if(e===Je)return n.RED;if(e===Qe)return n.RED_INTEGER;if(e===et)return n.RG;if(e===tt)return n.RG_INTEGER;if(e===nt)return n.RGBA_INTEGER;if(e===it||e===rt||e===st||e===at)if(s===Xt){if(r=i.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(e===it)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===rt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===st)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===at)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=i.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(e===it)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===rt)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===st)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===at)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===ot||e===lt||e===ut||e===ct){if(r=i.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(e===ot)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===lt)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===ut)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===ct)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===ht||e===dt||e===pt){if(r=i.get("WEBGL_compressed_texture_etc"),null===r)return null;if(e===ht||e===dt)return s===Xt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(e===pt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(e===mt||e===ft||e===gt||e===_t||e===yt||e===vt||e===xt||e===bt||e===Tt||e===St||e===Mt||e===wt||e===Et||e===At){if(r=i.get("WEBGL_compressed_texture_astc"),null===r)return null;if(e===mt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===ft)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===gt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===_t)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===yt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===vt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===xt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===bt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===Tt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===St)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===Mt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===wt)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===Et)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===At)return s===Xt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(e===Rt){if(r=i.get("EXT_texture_compression_bptc"),null===r)return null;if(e===Rt)return s===Xt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(e===Pt||e===It||e===Lt||e===Dt){if(r=i.get("EXT_texture_compression_rgtc"),null===r)return null;if(e===Pt)return r.COMPRESSED_RED_RGTC1_EXT;if(e===It)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===Lt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Dt)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return e===He?n.UNSIGNED_INT_24_8:void 0!==n[e]?n[e]:null}_clientWaitAsync(){const{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,i)=>{!function r(){const s=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(s===e.WAIT_FAILED)return e.deleteSync(t),void i();s!==e.TIMEOUT_EXPIRED?(e.deleteSync(t),n()):requestAnimationFrame(r)}()})}}let MF,wF,EF,AF=!1;class RF{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},!1===AF&&(this._init(),AF=!0)}_init(){const e=this.gl;MF={[we]:e.REPEAT,[Ee]:e.CLAMP_TO_EDGE,[Ae]:e.MIRRORED_REPEAT},wF={[Re]:e.NEAREST,[Ce]:e.NEAREST_MIPMAP_NEAREST,[Ne]:e.NEAREST_MIPMAP_LINEAR,[Pe]:e.LINEAR,[Ie]:e.LINEAR_MIPMAP_NEAREST,[Le]:e.LINEAR_MIPMAP_LINEAR},EF={[Kt]:e.NEVER,[rn]:e.ALWAYS,[Zt]:e.LESS,[Qt]:e.LEQUAL,[Jt]:e.EQUAL,[nn]:e.GEQUAL,[en]:e.GREATER,[tn]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let n;return n=!0===e.isCubeTexture?t.TEXTURE_CUBE_MAP:!0===e.isArrayTexture||!0===e.isDataArrayTexture||!0===e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:!0===e.isData3DTexture?t.TEXTURE_3D:t.TEXTURE_2D,n}getInternalFormat(e,t,n,i,r=!1){const{gl:s,extensions:a}=this;if(null!==e&&void 0!==s[e])return s[e];let o=t;if(t===s.RED&&(n===s.FLOAT&&(o=s.R32F),n===s.HALF_FLOAT&&(o=s.R16F),n===s.UNSIGNED_BYTE&&(o=s.R8),n===s.UNSIGNED_SHORT&&(o=s.R16),n===s.UNSIGNED_INT&&(o=s.R32UI),n===s.BYTE&&(o=s.R8I),n===s.SHORT&&(o=s.R16I),n===s.INT&&(o=s.R32I)),t===s.RED_INTEGER&&(n===s.UNSIGNED_BYTE&&(o=s.R8UI),n===s.UNSIGNED_SHORT&&(o=s.R16UI),n===s.UNSIGNED_INT&&(o=s.R32UI),n===s.BYTE&&(o=s.R8I),n===s.SHORT&&(o=s.R16I),n===s.INT&&(o=s.R32I)),t===s.RG&&(n===s.FLOAT&&(o=s.RG32F),n===s.HALF_FLOAT&&(o=s.RG16F),n===s.UNSIGNED_BYTE&&(o=s.RG8),n===s.UNSIGNED_SHORT&&(o=s.RG16),n===s.UNSIGNED_INT&&(o=s.RG32UI),n===s.BYTE&&(o=s.RG8I),n===s.SHORT&&(o=s.RG16I),n===s.INT&&(o=s.RG32I)),t===s.RG_INTEGER&&(n===s.UNSIGNED_BYTE&&(o=s.RG8UI),n===s.UNSIGNED_SHORT&&(o=s.RG16UI),n===s.UNSIGNED_INT&&(o=s.RG32UI),n===s.BYTE&&(o=s.RG8I),n===s.SHORT&&(o=s.RG16I),n===s.INT&&(o=s.RG32I)),t===s.RGB){const e=r?Wt:qn.getTransfer(i);n===s.FLOAT&&(o=s.RGB32F),n===s.HALF_FLOAT&&(o=s.RGB16F),n===s.UNSIGNED_BYTE&&(o=s.RGB8),n===s.UNSIGNED_SHORT&&(o=s.RGB16),n===s.UNSIGNED_INT&&(o=s.RGB32UI),n===s.BYTE&&(o=s.RGB8I),n===s.SHORT&&(o=s.RGB16I),n===s.INT&&(o=s.RGB32I),n===s.UNSIGNED_BYTE&&(o=e===Xt?s.SRGB8:s.RGB8),n===s.UNSIGNED_SHORT_5_6_5&&(o=s.RGB565),n===s.UNSIGNED_SHORT_5_5_5_1&&(o=s.RGB5_A1),n===s.UNSIGNED_SHORT_4_4_4_4&&(o=s.RGB4),n===s.UNSIGNED_INT_5_9_9_9_REV&&(o=s.RGB9_E5),n===s.UNSIGNED_INT_10F_11F_11F_REV&&(o=s.R11F_G11F_B10F)}if(t===s.RGB_INTEGER&&(n===s.UNSIGNED_BYTE&&(o=s.RGB8UI),n===s.UNSIGNED_SHORT&&(o=s.RGB16UI),n===s.UNSIGNED_INT&&(o=s.RGB32UI),n===s.BYTE&&(o=s.RGB8I),n===s.SHORT&&(o=s.RGB16I),n===s.INT&&(o=s.RGB32I)),t===s.RGBA){const e=r?Wt:qn.getTransfer(i);n===s.FLOAT&&(o=s.RGBA32F),n===s.HALF_FLOAT&&(o=s.RGBA16F),n===s.UNSIGNED_BYTE&&(o=s.RGBA8),n===s.UNSIGNED_SHORT&&(o=s.RGBA16),n===s.UNSIGNED_INT&&(o=s.RGBA32UI),n===s.BYTE&&(o=s.RGBA8I),n===s.SHORT&&(o=s.RGBA16I),n===s.INT&&(o=s.RGBA32I),n===s.UNSIGNED_BYTE&&(o=e===Xt?s.SRGB8_ALPHA8:s.RGBA8),n===s.UNSIGNED_SHORT_4_4_4_4&&(o=s.RGBA4),n===s.UNSIGNED_SHORT_5_5_5_1&&(o=s.RGB5_A1)}return t===s.RGBA_INTEGER&&(n===s.UNSIGNED_BYTE&&(o=s.RGBA8UI),n===s.UNSIGNED_SHORT&&(o=s.RGBA16UI),n===s.UNSIGNED_INT&&(o=s.RGBA32UI),n===s.BYTE&&(o=s.RGBA8I),n===s.SHORT&&(o=s.RGBA16I),n===s.INT&&(o=s.RGBA32I)),t===s.DEPTH_COMPONENT&&(n===s.UNSIGNED_SHORT&&(o=s.DEPTH_COMPONENT16),n===s.UNSIGNED_INT&&(o=s.DEPTH_COMPONENT24),n===s.FLOAT&&(o=s.DEPTH_COMPONENT32F)),t===s.DEPTH_STENCIL&&n===s.UNSIGNED_INT_24_8&&(o=s.DEPTH24_STENCIL8),o!==s.R16F&&o!==s.R32F&&o!==s.RG16F&&o!==s.RG32F&&o!==s.RGBA16F&&o!==s.RGBA32F||a.get("EXT_color_buffer_float"),o}setTextureParameters(e,t){const{gl:n,extensions:i,backend:r}=this,s=qn.getPrimaries(qn.workingColorSpace),a=t.colorSpace===Gt?null:qn.getPrimaries(t.colorSpace),o=t.colorSpace
vendor: 3,991 bytes, line 1
1===Gt||s===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,o),n.texParameteri(e,n.TEXTURE_WRAP_S,MF[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,MF[t.wrapT]),e!==n.TEXTURE_3D&&e!==n.TEXTURE_2D_ARRAY||t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,MF[t.wrapR]),n.texParameteri(e,n.TEXTURE_MAG_FILTER,wF[t.magFilter]);const l=void 0!==t.mipmaps&&t.mipmaps.length>0,u=t.minFilter===Pe&&l?Le:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,wF[u]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,EF[t.compareFunction])),!0===i.has("EXT_texture_filter_anisotropic")){if(t.magFilter===Re)return;if(t.minFilter!==Ne&&t.minFilter!==Le)return;if(t.type===qe&&!1===i.has("OES_texture_float_linear"))return;if(t.anisotropy>1){const s=i.get("EXT_texture_filter_anisotropic");n.texParameterf(e,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,r.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:n,defaultTextures:i}=this,r=this.getGLTextureType(e);let s=i[r];void 0===s&&(s=t.createTexture(),n.state.bindTexture(r,s),t.texParameteri(r,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(r,t.TEXTURE_MAG_FILTER,t.NEAREST),i[r]=s),n.set(e,{textureGPU:s,glTextureType:r,isDefault:!0})}createTexture(e,t){const{gl:n,backend:i}=this,{levels:r,width:s,height:a,depth:o}=t,l=i.utils.convert(e.format,e.colorSpace),u=i.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,l,u,e.colorSpace,e.isVideoTexture),h=n.createTexture(),d=this.getGLTextureType(e);i.state.bindTexture(d,h),this.setTextureParameters(d,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,r,c,s,a,o):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,r,c,s,a,o):e.isVideoTexture||n.texStorage2D(d,r,c,s,a),i.set(e,{textureGPU:h,glTextureType:d,glFormat:l,glType:u,glInternalFormat:c})}copyBufferToTexture(e,t){const{gl:n,backend:i}=this,{textureGPU:r,glTextureType:s,glFormat:a,glType:o}=i.get(t),{width:l,height:u}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),i.state.bindTexture(s,r),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(s,0,0,0,l,u,a,o,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),i.state.unbindTexture()}updateTexture(e,t){const{gl:n}=this,{width:i,height:r}=t,{textureGPU:s,glTextureType:a,glFormat:o,glType:l,glInternalFormat:u}=this.backend.get(e);if(!e.isRenderTargetTexture&&void 0!==s)if(this.backend.state.bindTexture(a,s),this.setTextureParameters(a,e),e.isCompressedTexture){const i=e.mipmaps,r=t.image;for(let t=0;t<i.length;t++){const s=i[t];e.isCompressedArrayTexture?e.format!==n.RGBA?null!==o&&n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,t,0,0,0,s.width,s.height,r.depth,o,s.data):n.texSubImage3D(n.TEXTURE_2D_ARRAY,t,0,0,0,s.width,s.height,r.depth,o,l,s.data):null!==o&&n.compressedTexSubImage2D(n.TEXTURE_2D,t,0,0,s.width,s.height,o,s.data)}}else if(e.isCubeTexture){const s=t.images,a=e.mipmaps;for(let e=0;e<6;e++){const t=CF(s[e]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,i,r,o,l,t);for(let i=0;i<a.length;i++){const t=CF(a[i].images[e]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,t.width,t.height,o,l,t)}}}else if(e.isDataArrayTexture||e.isArrayTexture){const i=t.image;if(e.layerUpdates.size>0){const t=xh(i.width,i.height,e.format,e.type);for(const r of e.layerUpdates){const e=i.data.subarray(r*t/i.data.BYTES_PER_ELEMENT,(r+1)*t/i.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,r,i.width,i.height,1,o,l,e)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,i.width,i.height,i.depth,o,l,i.data)}else if(e.isData3DTexture){const e=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,e.width,e.height,e.depth,o,l,e.data)}
vendor: 4,143 bytes, line 1
1else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,o,l,t.image);else{const s=e.mipmaps;if(s.length>0)for(let e=0,t=s.length;e<t;e++){const t=s[e],i=CF(t);n.texSubImage2D(a,e,0,0,t.width,t.height,o,l,i)}else{const e=CF(t.image);n.texSubImage2D(a,0,0,0,i,r,o,l,e)}}}generateMipmaps(e){const{gl:t,backend:n}=this,{textureGPU:i,glTextureType:r}=n.get(e);n.state.bindTexture(r,i),t.generateMipmap(r)}deallocateRenderBuffers(e){const{gl:t,backend:n}=this;if(e){const i=n.get(e);if(i.renderBufferStorageSetup=void 0,i.framebuffers){for(const e in i.framebuffers)t.deleteFramebuffer(i.framebuffers[e]);delete i.framebuffers}if(i.depthRenderbuffer&&(t.deleteRenderbuffer(i.depthRenderbuffer),delete i.depthRenderbuffer),i.stencilRenderbuffer&&(t.deleteRenderbuffer(i.stencilRenderbuffer),delete i.stencilRenderbuffer),i.msaaFrameBuffer&&(t.deleteFramebuffer(i.msaaFrameBuffer),delete i.msaaFrameBuffer),i.msaaRenderbuffers){for(let e=0;e<i.msaaRenderbuffers.length;e++)t.deleteRenderbuffer(i.msaaRenderbuffers[e]);delete i.msaaRenderbuffers}}}destroyTexture(e){const{gl:t,backend:n}=this,{textureGPU:i,renderTarget:r}=n.get(e);this.deallocateRenderBuffers(r),t.deleteTexture(i),n.delete(e)}copyTextureToTexture(e,t,n=null,i=null,r=0,s=0){const{gl:a,backend:o}=this,{state:l}=this.backend,{textureGPU:u,glTextureType:c,glType:h,glFormat:d}=o.get(t);let p,m,f,g,_,y,v,x,b;l.bindTexture(c,u);const T=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==n)p=n.max.x-n.min.x,m=n.max.y-n.min.y,f=n.isBox3?n.max.z-n.min.z:1,g=n.min.x,_=n.min.y,y=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-r);p=Math.floor(T.width*t),m=Math.floor(T.height*t),f=e.isDataArrayTexture||e.isArrayTexture?T.depth:e.isData3DTexture?Math.floor(T.depth*t):1,g=0,_=0,y=0}null!==i?(v=i.x,x=i.y,b=i.z):(v=0,x=0,b=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 S=a.getParameter(a.UNPACK_ROW_LENGTH),M=a.getParameter(a.UNPACK_IMAGE_HEIGHT),w=a.getParameter(a.UNPACK_SKIP_PIXELS),E=a.getParameter(a.UNPACK_SKIP_ROWS),A=a.getParameter(a.UNPACK_SKIP_IMAGES);a.pixelStorei(a.UNPACK_ROW_LENGTH,T.width),a.pixelStorei(a.UNPACK_IMAGE_HEIGHT,T.height),a.pixelStorei(a.UNPACK_SKIP_PIXELS,g),a.pixelStorei(a.UNPACK_SKIP_ROWS,_),a.pixelStorei(a.UNPACK_SKIP_IMAGES,y);const R=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isRenderTargetTexture||e.isDepthTexture){const n=o.get(e),i=o.get(t),r=o.get(n.renderTarget),s=o.get(i.renderTarget),u=r.framebuffers[n.cacheKey],c=s.framebuffers[i.cacheKey];l.bindFramebuffer(a.READ_FRAMEBUFFER,u),l.bindFramebuffer(a.DRAW_FRAMEBUFFER,c);let h=a.COLOR_BUFFER_BIT;e.isDepthTexture&&(h=a.DEPTH_BUFFER_BIT),a.blitFramebuffer(g,_,p,m,v,x,p,m,h,a.NEAREST),l.bindFramebuffer(a.READ_FRAMEBUFFER,null),l.bindFramebuffer(a.DRAW_FRAMEBUFFER,null)}else R?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(c,s,v,x,b,p,m,f,d,h,T.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(c,s,v,x,b,p,m,f,d,T.data):a.texSubImage3D(c,s,v,x,b,p,m,f,d,h,T):e.isDataTexture?a.texSubImage2D(c,s,v,x,p,m,d,h,T.data):e.isCompressedTexture?a.compressedTexSubImage2D(c,s,v,x,T.width,T.height,d,T.data):a.texSubImage2D(c,s,v,x,p,m,d,h,T);a.pixelStorei(a.UNPACK_ROW_LENGTH,S),a.pixelStorei(a.UNPACK_IMAGE_HEIGHT,M),a.pixelStorei(a.UNPACK_SKIP_PIXELS,w),a.pixelStorei(a.UNPACK_SKIP_ROWS,E),a.pixelStorei(a.UNPACK_SKIP_IMAGES,A),0===s&&t.generateMipmaps&&a.generateMipmap(c),l.unbindTexture()}copyFramebufferToTexture(e,t,n){const{gl:i}=this,{state:r}=this.backend,{textureGPU:s}=this.backend.get(e),{x:a,y:o,z:l,w:u}=n,c=!0===e.isDepthTexture||t.renderTarget&&t.renderTarget.samples>0,h=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(c){const n=0!==a||0!==o;let c,d;if(!0===e.isDepthTexture?(c=i.DEPTH_BUFFER_BIT,d=i.DEPTH_ATTACHMENT,t.stencil&&(c|=i.STENCIL_BUFFER_BIT)):(c=i.COLOR_BUFFER_BIT,d=i.COLOR_ATTACHMENT0),n){const e=this.backend.get(t.renderTarget),n=e.framebuffers[t.getCacheKey()],d=e.msaaFrameBuffer;r.bindFramebuffer(i.DRAW_FRAMEBUFFER,n),r.bindFramebuffer(i.READ_FRAMEBUFFER,d);const p=h-o-u;
vendor: 5,643 bytes, line 1
1i.blitFramebuffer(a,p,a+l,p+u,a,p,a+l,p+u,c,i.NEAREST),r.bindFramebuffer(i.READ_FRAMEBUFFER,n),r.bindTexture(i.TEXTURE_2D,s),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,a,p,l,u),r.unbindTexture()}else{const e=i.createFramebuffer();r.bindFramebuffer(i.DRAW_FRAMEBUFFER,e),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,d,i.TEXTURE_2D,s,0),i.blitFramebuffer(0,0,l,u,0,0,l,u,c,i.NEAREST),i.deleteFramebuffer(e)}}else r.bindTexture(i.TEXTURE_2D,s),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,a,h-u-o,l,u),r.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,i=!1){const{gl:r}=this,s=t.renderTarget,{depthTexture:a,depthBuffer:o,stencilBuffer:l,width:u,height:c}=s;if(r.bindRenderbuffer(r.RENDERBUFFER,e),o&&!l){let t=r.DEPTH_COMPONENT24;if(!0===i){this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(r.RENDERBUFFER,s.samples,t,u,c)}else n>0?(a&&a.isDepthTexture&&a.type===r.FLOAT&&(t=r.DEPTH_COMPONENT32F),r.renderbufferStorageMultisample(r.RENDERBUFFER,n,t,u,c)):r.renderbufferStorage(r.RENDERBUFFER,t,u,c);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,e)}else o&&l&&(n>0?r.renderbufferStorageMultisample(r.RENDERBUFFER,n,r.DEPTH24_STENCIL8,u,c):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,u,c),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,e));r.bindRenderbuffer(r.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,i,r,s){const{backend:a,gl:o}=this,{textureGPU:l,glFormat:u,glType:c}=this.backend.get(e),h=o.createFramebuffer();o.bindFramebuffer(o.READ_FRAMEBUFFER,h);const d=e.isCubeTexture?o.TEXTURE_CUBE_MAP_POSITIVE_X+s:o.TEXTURE_2D;o.framebufferTexture2D(o.READ_FRAMEBUFFER,o.COLOR_ATTACHMENT0,d,l,0);const p=this._getTypedArrayType(c),m=i*r*this._getBytesPerTexel(c,u),f=o.createBuffer();o.bindBuffer(o.PIXEL_PACK_BUFFER,f),o.bufferData(o.PIXEL_PACK_BUFFER,m,o.STREAM_READ),o.readPixels(t,n,i,r,u,c,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();const g=new p(m/p.BYTES_PER_ELEMENT);return o.bindBuffer(o.PIXEL_PACK_BUFFER,f),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,g),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),o.deleteFramebuffer(h),g}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_5_5_1)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_6_5)return Uint16Array;if(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 i=0;return e===n.UNSIGNED_BYTE&&(i=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||(i=2),e!==n.UNSIGNED_INT&&e!==n.FLOAT||(i=4),t===n.RGBA?4*i:t===n.RGB?3*i:t===n.ALPHA?i:void 0}}function CF(e){return e.isDataTexture?e.image.data:"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?e:e.data}class NF{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 void 0===t&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class PF{constructor(e){this.backend=e,this.maxAnisotropy=null}getMaxAnisotropy(){if(null!==this.maxAnisotropy)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(!0===t.has("EXT_texture_filter_anisotropic")){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 IF={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",WEBKIT_WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-bc",EXT_texture_compression_bptc:"texture-compression-bptc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class LF{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:i,object:r,type:s,info:a,index:o}=this;0!==o?n.drawElements(i,t,s,e):n.drawArrays(i,e,t),a.update(r,t,1)}renderInstances(e,t,n){const{gl:i,mode:r,type:s,index:a,object:o,info:l}=this;0!==n&&(0!==a?i.drawElementsInstanced(r,t,s,e,n):i.drawArraysInstanced(r,e,t,n),l.update(o,t,n))}renderMultiDraw(e,t,n){const{extensions:i,mode:r,object:s,info:a}=this;if(0===n)return;const o=i.get("WEBGL_multi_draw");if(null===o)for(let l=0;l<n;l++)this.render(e[l],t[l]);else{0!==this.index?o.multiDrawElementsWEBGL(r,t,0,this.type,e,0,n):o.multiDrawArraysWEBGL(r,e,0,t,0,n);let i=0;for(let e=0;e<n;e++)i+=t[e];a.update(s,i,1)}}renderMultiDrawInstances(e,t,n,i){const{extensions:r,mode:s,object:a,info:o}=this;if(0===n)return;const l=r.get("WEBGL_multi_draw");if(null===l)for(let u=0;u<n;u++)this.renderInstances(e[u],t[u],i[u]);else{0!==this.index?l.multiDrawElementsInstancedWEBGL(s,t,0,this.type,e,0,i,0,n):l.multiDrawArraysInstancedWE
1BGL(s,e,0,t,0,i,0,n);let r=0;for(let e=0;e<n;e++)r+=t[e]*i[e];o.update(a,r,1)}}}class DF{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.pendingResolve=!1}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}}class OF extends DF{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){this.queries=[];for(let t=0;t<this.maxQueries;t++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}else this.trackTimestamp=!1}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return Un(`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(null==t)return;if(null!==this.activeQuery)return;const n=this.queries[t];if(n)try{"inactive"===this.queryStates.get(t)&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(i){this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null!=t&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(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=[];for(const[n,i]of this.queryStates)if("ended"===i){const t=this.queries[n];e.push(this.resolveQuery(t))}if(0===e.length)return this.lastValue;const t=(await Promise.all(e)).reduce((e,t)=>e+t,0);return this.lastValue=t,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,t}catch(e){return this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed)return void t(this.lastValue);let n,i=!1;const r=e=>{i||(i=!0,n&&(clearTimeout(n),n=null),t(e))},s=()=>
vendor: 29,132 bytes, line 1
1{if(this.isDisposed)r(this.lastValue);else try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT))return void r(this.lastValue);if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE))return void(n=setTimeout(s,1));const i=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(i)/1e6)}catch(i){t(this.lastValue)}};s()})}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 UF extends gF{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="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,n={antialias:e.samples>0,alpha:!0,depth:e.depth,stencil:e.stencil},i=void 0!==t.context?t.context:e.domElement.getContext("webgl2",n);function r(t){t.preventDefault();const n={api:"WebGL",message:t.statusMessage||"Unknown reason",reason:null,originalEvent:t};e.onDeviceLost(n)}this._onContextLost=r,e.domElement.addEventListener("webglcontextlost",r,!1),this.gl=i,this.extensions=new NF(this),this.capabilities=new PF(this),this.attributeUtils=new bF(this),this.textureUtils=new RF(this),this.bufferRenderer=new LF(this),this.state=new TF(this),this.utils=new SF(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.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile")}get coordinateSystem(){return ln}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async waitForGPU(){await this.utils._clientWaitAsync()}async makeXRCompatible(){!0!==this.gl.getContextAttributes().xrCompatible&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){const i=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:i.RGBA8}),null!==n){const t=e.stencilBuffer?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:t}),!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!0===e._autoAllocateDepthBuffer&&e.multiview,e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new OF(this.gl,e,2048));const n=this.timestampQueryPool[e];null!==n.allocateQueriesForContext(t)&&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(n.frameCalls=this.renderer.info.render.frameCalls,e.viewport)this.updateViewport(e);else{const{width:e,height:n}=this.getDrawingBufferSize();t.viewport(0,0,e,n)}if(e.scissor){const{x:n,y:i,width:r,height:s}=e.scissorValue;t.scissor(n,e.height-s-i,r,s)}this.initTimestampQuery(cn.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 i=e.occlusionQueryCount;i>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(i),n.occlusionQueryObjects=new Array(i),n.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:n}=this,i=this.get(e),r=i.previousContext;n.resetVertexState();const s=e.occlusionQueryCount;s>0&&(s>i.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const a=e.textures;if(null!==a)for(let o=0;o<a.length;o++){const e=a[o];e.generateMipmaps&&this.generateMipmaps(e)}if(this._currentContext=r,this._resolveRenderTarget(e),null!==r)if(this._setFramebuffer(r),r.viewport)this.updateViewport(r);else{const{width:e,height:t}=this.getDrawingBufferSize();n.viewport(0,0,e,t)}this.prepareTimestampBuffer(cn.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){const t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:i}=t;if(n&&i){const e=new WeakSet,{gl:r}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;const s=()=>{let a=0;for(let t=0;t<n.length;t++){const s=n[t];null!==s&&(r.getQueryParameter(s,r.QUERY_RESULT_AVAILABLE)&&(0===r.getQueryParameter(s,r.QUERY_RESULT)&&e.add(i[t]),n[t]=null,r.deleteQuery(s),a++))}a<n.length?requestAnimationFrame(s):t.occluded=e};s()}}isOccluded(e,t){const n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){const{state:t}=this,{x:n,y:i,width:r,height:s}=e.viewportValue;t.viewport(n,e.height-s-i,r,s)}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,i=null,r=!0,s=!0){const{gl:a,renderer:o}=this;if(null===i){i={textures:null,clearColorValue:this.getClearColor()}}let l=0;if(e&&(l|=a.COLOR_BUFFER_BIT),t&&(l|=a.DEPTH_BUFFER_BIT),n&&(l|=a.STENCIL_BUFFER_BIT),0!==l){let u;u=i.clearColorValue?i.clearColorValue:this.getClearColor();const c=o.getClearDepth(),h=o.getClearStencil();if(t&&this.state.setDepthMask(!0),null===i.textures)a.clearColor(u.r,u.g,u.b,u.a),a.clear(l);else{if(r&&this._setFramebuffer(i),e)for(let e=0;e<i.textures.length;e++)0===e?a.clearBufferfv(a.COLOR,e,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,e,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,c,h):t?a.clearBufferfv(a.DEPTH,0,[c]):n&&a.clearBufferiv(a.STENCIL,0,[h]),r&&s&&this._resolveRenderTarget(i)}}}beginCompute(e){const{state:t,gl:n}=this;this.get(e).frameCalls=this.renderer.info.compute.frameCalls,t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(cn.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,i,r=null){const{state:s,gl:a}=this;!1===this.discard&&(a.enable(a.RASTERIZER_DISCARD),this.discard=!0);const{programGPU:o,transformBuffers:l,attributes:u}=this.get(i),c=this._getVaoKey(u),h=this.vaoCache[c];void 0===h?this.vaoCache[c]=this._createVao(u):s.setVertexState(h),s.useProgram(o),this._bindUniforms(n);const d=this._getTransformFeedback(l);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,d),a.beginTransformFeedback(a.POINTS),r=null!==r?r:t.count,Array.isArray(r)&&(Un("WebGLBackend.compute(): The count parameter must be a single number, not an array."),r=r[0]),u[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,r):a.drawArrays(a.POINTS,0,r),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let p=0;p<l.length;p++){const e=l[p];e.pbo&&this.has(e.pbo)&&this.textureUtils.copyBufferToTexture(e.transformBuffer,e.pbo),e.switchBuffers()}}finishCompute(e){const t=this.gl;this.discard=!1,t.disable(t.RASTERIZER_DISCARD),this.prepareTimestampBuffer(cn.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:i,context:r,hardwareClippingPlanes:s}=e,{programGPU:a}=this.get(n),{gl:o,state:l}=this,u=this.get(r),c=e.getDrawParameters();if(null===c)return;this._bindUniforms(e.getBindings());const h=t.isMesh&&t.matrixWorld.determinant()<0;l.setMaterial(i,h,s),l.useProgram(a);const d=e.getAttributes(),p=this.get(d);let m=p.vaoGPU;if(void 0===m){const e=this._getVaoKey(d);m=this.vaoCache[e],void 0===m&&(m=this._createVao(d),this.vaoCache[e]=m,p.vaoGPU=m)}const f=e.getIndex(),g=null!==f?this.get(f).bufferGPU:null;l.setVertexState(m,g);const _=u.lastOcclusionObject;if(_!==t&&void 0!==_){if(null!==_&&!0===_.occlusionTest&&(o.endQuery(o.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),!0===t.occlusionTest){const e=o.createQuery();o.beginQuery(o.ANY_SAMPLES_PASSED,e),u.occlusionQueries[u.occlusionQueryIndex]=e,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}const y=this.bufferRenderer;t.isPoints?y.mode=o.POINTS:t.isLineSegments?y.mode=o.LINES:t.isLine?y.mode=o.LINE_STRIP:t.isLineLoop?y.mode=o.LINE_LOOP:!0===i.wireframe?(l.setLineWidth(i.wireframeLinewidth*this.renderer.getPixelRatio()),y.mode=o.LINES):y.mode=o.TRIANGLES;const{vertexCount:v,instanceCount:x}=c;let{firstVertex:b}=c;if(y.object=t,null!==f){b*=f.array.BYTES_PER_ELEMENT;const e=this.get(f);y.index=f.count,y.type=e.type}else y.index=0;const T=()=>{t.isBatchedMesh?null!==t._multiDrawInstances?(Un("THREE.WebGLBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),y.renderMultiDrawInstances(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount,t._multiDrawInstances)):this.hasFeature("WEBGL_multi_draw")?y.renderMultiDraw(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount):Un("THREE.WebGLRenderer: WEBGL_multi_draw not supported."):x>1?y.renderInstances(b,v,x):y.render(b,v)};if(!0===e.camera.isArrayCamera&&e.camera.cameras.length>0&&!1===e.camera.isMultiViewCamera){const n=this.get(e.camera),i=e.camera.cameras,r=e.getBindingGroup("cameraIndex").bindings[0];if(void 0===n.indexesGPU||n.indexesGPU.length!==i.length){const e=new Uint32Array([0,0,0,0]),t=[];for(let n=0,r=i.length;n<r;n++){const i=o.createBuffer();e[0]=n,o.bindBuffer(o.UNIFORM_BUFFER,i),o.bufferData(o.UNIFORM_BUFFER,e,o.STATIC_DRAW),t.push(i)}n.indexesGPU=t}const s=this.get(r),a=this.renderer.getPixelRatio(),u=this._currentContext.renderTarget,c=this._isRenderCameraDepthArray(this._currentContext),h=this._currentContext.activeCubeFace;if(c){const e=this.get(u.depthTexture);if(e.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){e.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;const{stencilBuffer:t}=u;for(let e=0,n=i.length;e<n;e++)this.renderer._activeCubeFace=e,this._currentContext.activeCubeFace=e,this._setFramebuffer(this._currentContext),this.clear(!1,!0,t,this._currentContext,!1,!1);this.renderer._activeCubeFace=h,this._currentContext.activeCubeFace=h}}for(let d=0,p=i.length;d<p;d++){const r=i[d];if(t.layers.test(r.layers)){c&&(this.renderer._activeCubeFace=d,this._currentContext.activeCubeFace=d,this._setFramebuffer(this._currentContext));const t=r.viewport;if(void 0!==t){const n=t.x*a,i=t.y*a,r=t.width*a,s=t.height*a;l.viewport(Math.floor(n),Math.floor(e.context.height-s-i),Math.floor(r),Math.floor(s))}l.bindBufferBase(o.UNIFORM_BUFFER,s.index,n.indexesGPU[d]),T()}this._currentContext.activeCubeFace=h,this.renderer._activeCubeFace=h}}else T()}needsRenderUpdate(){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){this.textureUtils.destroyTexture(e)}async copyTextureToBuffer(e,t,n,i,r,s){return this.textureUtils.copyTextureToBuffer(e,t,n,i,r,s)}createSampler(){}destroySampler(){}createNodeBuilder(e,t){return new pF(e,t)}createProgram(e){const t=this.gl,{stage:n,code:i}=e,r="fragment"===n?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(r,i),t.compileShader(r),this.set(e,{shaderGPU:r})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){const n=this.gl,i=e.pipeline,{fragmentProgram:r,vertexProgram:s}=i,a=n.createProgram(),o=this.get(r).shaderGPU,l=this.get(s).shaderGPU;if(n.attachShader(a,o),n.attachShader(a,l),n.linkProgram(a),this.set(i,{programGPU:a,fragmentShader:o,vertexShader:l}),null!==t&&this.parallel){const r=new Promise(t=>{const r=this.parallel,s=()=>{n.getProgramParameter(a,r.COMPLETION_STATUS_KHR)?(this._completeCompile(e,i),t()):requestAnimationFrame(s)};s()});return void t.push(r)}this._completeCompile(e,i)}_handleSource(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let a=r;a<s;a++){const e=a+1;i.push(`${e===t?">":" "} ${e}: ${n[a]}`)}return i.join("\n")}_getShaderErrors(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=(e.getShaderInfoLog(t)||"").trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+this._handleSource(e.getShaderSource(t),i)}return r}_logProgramError(e,t,n){if(this.renderer.debug.checkShaderErrors){const i=this.gl;(i.getProgramInfoLog(e)||"").trim();if(!1===i.getProgramParameter(e,i.LINK_STATUS))if("function"==typeof this.renderer.debug.onShaderError)this.renderer.debug.onShaderError(i,e,n,t);else{this._getShaderErrors(i,n,"vertex"),this._getShaderErrors(i,t,"fragment")}}}_completeCompile(e,t){const{state:n,gl:i}=this,r=this.get(t),{programGPU:s,fragmentShader:a,vertexShader:o}=r;!1===i.getProgramParameter(s,i.LINK_STATUS)&&this._logProgramError(s,a,o),n.useProgram(s);const l=e.getBindings();this._setupBindings(l,s),this.set(t,{programGPU:s})}createComputePipeline(e,t){const{state:n,gl:i}=this,r={stage:"fragment",code:"#version 300 es\nprecision highp float;\nvoid main() {}"};this.createProgram(r);const{computeProgram:s}=e,a=i.createProgram(),o=this.get(r).shaderGPU,l=this.get(s).shaderGPU,u=s.transforms,c=[],h=[];for(let f=0;f<u.length;f++){const e=u[f];c.push(e.varyingName),h.push(e.attributeNode)}i.attachShader(a,o),i.attachShader(a,l),i.transformFeedbackVaryings(a,c,i.SEPARATE_ATTRIBS),i.linkProgram(a),!1===i.getProgramParameter(a,i.LINK_STATUS)&&this._logProgramError(a,o,l),n.useProgram(a),this._setupBindings(t,a);const d=s.attributes,p=[],m=[];for(let f=0;f<d.length;f++){const e=d[f].node.attribute;p.push(e),this.has(e)||this.attributeUtils.createAttribute(e,i.ARRAY_BUFFER)}for(let f=0;f<h.length;f++){const e=h[f].attribute;this.has(e)||this.attributeUtils.createAttribute(e,i.ARRAY_BUFFER);const t=this.get(e);m.push(t)}this.set(e,{programGPU:a,transformBuffers:m,attributes:p})}createBindings(e,t){if(!1===this._knownBindings.has(t)){this._knownBindings.add(t);let e=0,n=0;for(const i of t){this.set(i,{textures:n,uniformBuffers:e});for(const t of i.bindings)t.isUniformBuffer&&e++,t.isSampledTexture&&n++}}this.updateBindings(e,t)}updateBindings(e){const{gl:t}=this,n=this.get(e);let i=n.uniformBuffers,r=n.textures;for(const s of e.bindings){const e=this.get(s);if(s.isUniformsGroup||s.isUniformBuffer){const n=s.buffer;let{bufferGPU:r}=this.get(n);void 0===r?(r=t.createBuffer(),t.bindBuffer(t.UNIFORM_BUFFER,r),t.bufferData(t.UNIFORM_BUFFER,n,t.DYNAMIC_DRAW),this.set(n,{bufferGPU:r})):(t.bindBuffer(t.UNIFORM_BUFFER,r),t.bufferSubData(t.UNIFORM_BUFFER,0,n)),e.index=i++,e.bufferGPU=r,this.set(s,e)}else if(s.isSampledTexture){const{textureGPU:t,glTextureType:n}=this.get(s.texture);e.index=r++,e.textureGPU=t,e.glTextureType=n,this.set(s,e)}}}updateBinding(e){const t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){const n=this.get(e).bufferGPU,i=e.buffer;t.bindBuffer(t.UNIFORM_BUFFER,n),t.bufferData(t.UNIFORM_BUFFER,i,t.DYNAMIC_DRAW)}}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(IF).filter(t=>IF[t]===e),n=this.extensions;for(let i=0;i<t.length;i++)if(n.has(t[i]))return!0;return!1}getMaxAnisotropy(){return this.capabilities.getMaxAnisotropy()}copyTextureToTexture(e,t,n=null,i=null,r=0,s=0){this.textureUtils.copyTextureToTexture(e,t,n,i,r,s)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}_setFramebuffer(e){const{gl:t,state:n}=this;let i=null;if(null!==e.textures){const r=e.renderTarget,s=this.get(r),{samples:a,depthBuffer:o,stencilBuffer:l}=r,u=!0===r.isWebGLCubeRenderTarget,c=!0===r.isRenderTarget3D,h=r.depth>1,d=!0===r.isXRRenderTarget,p=!0===d&&!0===r._hasExternalTextures;let m=s.msaaFrameBuffer,f=s.depthRenderbuffer;const g=this.extensions.get("WEBGL_multisampled_render_to_texture"),_=this.extensions.get("OVR_multiview2"),y=this._useMultisampledExtension(r),v=SN(e);let x;if(u?(s.cubeFramebuffers||(s.cubeFramebuffers={}),x=s.cubeFramebuffers[v]):d&&!1===p?x=this._xrFramebuffer:(s.framebuffers||(s.framebuffers={}),x=s.framebuffers[v]),void 0===x){x=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,x);const i=e.textures,o=[];if(u){s.cubeFramebuffers[v]=x;const{textureGPU:e}=this.get(i[0]),n=this.renderer._activeCubeFace,r=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,e,r)}else{s.framebuffers[v]=x;for(let n=0;n<i.length;n++){const s=i[n],o=this.get(s);o.renderTarget=e.renderTarget,o.cacheKey=v;const l=t.COLOR_ATTACHMENT0+n;if(r.multiview)_.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,l,o.textureGPU,0,a,0,2);else if(c||h){const e=this.renderer._activeCubeFace,n=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,l,o.textureGPU,n,e)}else if(y)g.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,t.TEXTURE_2D,o.textureGPU,0,a);else{const e=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,l,t.TEXTURE_2D,o.textureGPU,e)}}}const d=l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(!0===r._autoAllocateDepthBuffer){const n=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(n,e,0,y),s.xrDepthRenderbuffer=n,o.push(l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,d,t.RENDERBUFFER,n)}else if(null!==e.depthTexture){o.push(l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);const n=this.get(e.depthTexture);if(n.renderTarget=e.renderTarget,n.cacheKey=v,r.multiview)_.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,d,n.textureGPU,0,a,0,2);else if(p&&y)g.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,d,t.TEXTURE_2D,n.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){const e=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,d,n.textureGPU,0,e)}else t.framebufferTexture2D(t.FRAMEBUFFER,d,t.TEXTURE_2D,n.textureGPU,0)}s.depthInvalidationArray=o}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,x);const i=this.renderer._activeCubeFace,r=this.get(e.depthTexture),s=l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,s,r.textureGPU,0,i)}if((d||y||r.multiview)&&!0!==r._isOpaqueFramebuffer){n.bindFramebuffer(t.FRAMEBUFFER,x);const i=this.get(e.textures[0]);r.multiview?_.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,i.textureGPU,0,a,0,2):y?g.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i.textureGPU,0);const o=l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(!0===r._autoAllocateDepthBuffer){const e=s.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,e),t.framebufferRenderbuffer(t.FRAMEBUFFER,o,t.RENDERBUFFER,e)}else{const n=this.get(e.depthTexture);r.multiview?_.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,o,n.textureGPU,0,a,0,2):y?g.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,o,t.TEXTURE_2D,n.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,n.textureGPU,0)}}}if(a>0&&!1===y&&!r.multiview){if(void 0===m){const i=[];m=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,m);const r=[],u=e.textures;for(let n=0;n<u.length;n++){r[n]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,r[n]),i.push(t.COLOR_ATTACHMENT0+n);const s=e.textures[n],o=this.get(s);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,o.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+n,t.RENDERBUFFER,r[n])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),s.msaaFrameBuffer=m,s.msaaRenderbuffers=r,o&&void 0===f){f=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(f,e,a),s.depthRenderbuffer=f;const n=l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;i.push(n)}s.invalidationArray=i}i=s.msaaFrameBuffer}else i=x;n.drawBuffers(e,x)}n.bindFramebuffer(t.FRAMEBUFFER,i)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){t+=":"+this.get(e[n]).id}return t}_createVao(e){const{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let i=0;i<e.length;i++){const n=e[i],r=this.get(n);let s,a;t.bindBuffer(t.ARRAY_BUFFER,r.bufferGPU),t.enableVertexAttribArray(i),!0===n.isInterleavedBufferAttribute?(s=n.data.stride*r.bytesPerElement,a=n.offset*r.bytesPerElement):(s=0,a=0),r.isInteger?t.vertexAttribIPointer(i,n.itemSize,r.type,s,a):t.vertexAttribPointer(i,n.itemSize,r.type,n.normalized,s,a),n.isInstancedBufferAttribute&&!n.isInterleavedBufferAttribute?t.vertexAttribDivisor(i,n.meshPerAttribute):n.isInterleavedBufferAttribute&&n.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(i,n.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let r=0;r<e.length;r++)t+=":"+e[r].id;let n=this.transformFeedbackCache[t];if(void 0!==n)return n;const{gl:i}=this;n=i.createTransformFeedback(),i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,n);for(let r=0;r<e.length;r++){const t=e[r];i.bindBufferBase(i.TRANSFORM_FEEDBACK_BUFFER,r,t.transformBuffer)}return i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){const n=this.gl;for(const i of e)for(const e of i.bindings){const i=this.get(e).index;if(e.isUniformsGroup||e.isUniformBuffer){const r=n.getUniformBlockIndex(t,e.name);n.uniformBlockBinding(t,r,i)}else if(e.isSampledTexture){const r=n.getUniformLocation(t,e.name);n.uniform1i(r,i)}}}_bindUniforms(e){const{gl:t,state:n}=this;for(const i of e)for(const e of i.bindings){const i=this.get(e),r=i.index;e.isUniformsGroup||e.isUniformBuffer?n.bindBufferBase(t.UNIFORM_BUFFER,r,i.bufferGPU):e.isSampledTexture&&n.bindTexture(i.glTextureType,i.textureGPU,t.TEXTURE0+r)}}_resolveRenderTarget(e){const{gl:t,state:n}=this,i=e.renderTarget;if(null!==e.textures&&i){const r=this.get(i);if(i.samples>0&&!1===this._useMultisampledExtension(i)){const s=r.framebuffers[e.getCacheKey()];let a=t.COLOR_BUFFER_BIT;i.resolveDepthBuffer&&(i.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),i.stencilBuffer&&i.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));const o=r.msaaFrameBuffer,l=r.msaaRenderbuffers,u=e.textures,c=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,o),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,s),c)for(let e=0;e<u.length;e++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);for(let n=0;n<u.length;n++){if(c){const{textureGPU:e}=this.get(u[n]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,l[n]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}if(e.scissor){const{x:n,y:i,width:r,height:s}=e.scissorValue,o=e.height-s-i;t.blitFramebuffer(n,o,n+r,o+s,n,o,n+r,o+s,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(c)for(let e=0;e<u.length;e++){const{textureGPU:n}=this.get(u[e]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,l[e]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,n,0)}!0===this._supportsInvalidateFramebuffer&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,r.invalidationArray)}else if(!1===i.resolveDepthBuffer&&r.framebuffers){const i=r.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,i),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,r.depthInvalidationArray)}}}_useMultisampledExtension(e){return!0===e.multiview||e.samples>0&&!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!1!==e._autoAllocateDepthBuffer}dispose(){const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const FF="point-list",BF="line-list",VF="line-strip",qF="triangle-list",zF="triangle-strip",kF="never",GF="less",HF="equal",jF="less-equal",WF="greater",XF="not-equal",$F="greater-equal",YF="always",KF="store",ZF="load",JF="clear",QF="ccw",eB="cw",tB="none",nB="back",iB="uint16",rB="uint32",sB="r8unorm",aB="r8snorm",oB="r8uint",lB="r8sint",uB="r16uint",cB="r16sint",hB="r16float",dB="rg8unorm",pB="rg8snorm",mB="rg8uint",fB="rg8sint",gB="r32uint",_B="r32sint",yB="r32float",vB="rg16uint",xB="rg16sint",bB="rg16float",TB="rgba8unorm",SB="rgba8unorm-srgb",MB="rgba8snorm",wB="rgba8uint",EB="rgba8sint",AB="bgra8unorm",RB="bgra8unorm-srgb",CB="rgb9e5ufloat",NB="rgb10a2unorm",PB="rg11b10ufloat",IB="rg32uint",LB="rg32sint",DB="rg32float",OB="rgba16uint",UB="rgba16sint",FB="rgba16float",BB="rgba32uint",VB="rgba32sint",qB="rgba32float",zB="depth16unorm",kB="depth24plus",GB="depth24plus-stencil8",HB="depth32float",jB="depth32float-stencil8",WB="bc1-rgba-unorm",XB="bc1-rgba-unorm-srgb",$B="bc2-rgba-unorm",YB="bc2-rgba-unorm-srgb",KB="bc3-rgba-unorm",ZB="bc3-rgba-unorm-srgb",JB="bc4-r-unorm",QB="bc4-r-snorm",eV="bc5-rg-unorm",tV="bc5-rg-snorm",nV="bc6h-rgb-ufloat",iV="bc6h-rgb-float",rV="bc7-rgba-unorm",sV="bc7-rgba-unorm-srgb",aV="etc2-rgb8unorm",oV="etc2-rgb8unorm-srgb",lV="etc2-rgb8a1unorm",uV="etc2-rgb8a1unorm-srgb",cV="etc2-rgba8unorm",hV="etc2-rgba8unorm-srgb",dV="eac-r11unorm",pV="eac-r11snorm",mV="eac-rg11unorm",fV="eac-rg11snorm",gV="astc-4x4-unorm",_V="astc-4x4-unorm-srgb",yV="astc-5x4-unorm",vV="astc-5x4-unorm-srgb",xV="astc-5x5-unorm",bV="astc-5x5-unorm-srgb",TV="astc-6x5-unorm",SV="astc-6x5-unorm-srgb",MV="astc-6x6-unorm",wV="astc-6x6-unorm-srgb",EV="astc-8x5-unorm",AV="astc-8x5-unorm-srgb",RV="astc-8x6-unorm",CV="astc-8x6-unorm-srgb",NV="astc-8x8-unorm",PV="astc-8x8-unorm-srgb",IV="astc-10x5-unorm",LV="astc-10x5-unorm-srgb",DV="astc-10x6-unorm",OV="astc-10x6-unorm-srgb",UV="astc-10x8-unorm",FV="astc-10x8-unorm-srgb",BV="astc-10x10-unorm",VV="astc-10x10-unorm-srgb",qV="astc-12x10-unorm",zV="astc-12x10-unorm-srgb",kV="astc-12x12-unorm",GV="astc-12x12-unorm-srgb",HV="clamp-to-edge",jV="repeat",WV="mirror-repeat",XV="linear",$V="nearest",YV="zero",KV="one",ZV="src",JV="one-minus-src",QV="src-alpha",eq="one-minus-src-alpha",tq="dst",nq="one-minus-dst",iq="dst-alpha",rq="one-minus-dst-alpha",sq="src-alpha-saturated",aq="constant",oq="one-minus-constant",lq="add",uq="subtract",cq="reverse-subtract",hq="min",dq="max",pq=0,mq=15,fq="keep",gq="zero",_q="replace",yq="invert",vq="increment-clamp",xq="decrement-clamp",bq="increment-wrap",Tq="decrement-wrap",Sq="storage",Mq="read-only-storage",wq="write-only",Eq="read-only",Aq="read-write",Rq="non-filtering",Cq="comparison",Nq="float",Pq="unfilterable-float",Iq="depth",Lq="sint",Dq="uint",Oq="2d",Uq="3d",Fq="2d",Bq="2d-array",Vq="cube",qq="3d",zq="all",kq="vertex",Gq="instance",Hq={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"};class jq extends tF{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){this.texture=this.textureNode.value}}class Wq extends $U{constructor(e,t){super(e,t?t.array:null),this.attribute=t,this.isStorageBuffer=!0}}let Xq=0;class $q extends Wq{constructor(e,t){super("StorageBuffer_"+Xq++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:w_.READ_WRITE,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class Yq extends ZC{constructor(e){super(),this.device=e;this.mipmapSampler=e.createSampler({minFilter:XV}),this.flipYSampler=e.createSampler({minFilter:$V}),this.transferPipelines={},this.flipYPipelines={}
1,this.mipmapVertexShaderModule=e.createShaderModule({label:"mipmapVertex",code:"\nstruct VarysStruct {\n\t@builtin( position ) Position: vec4<f32>,\n\t@location( 0 ) vTex : vec2<f32>\n};\n\n@vertex\nfn main( @builtin( vertex_index ) vertexIndex : u32 ) -> VarysStruct {\n\n\tvar Varys : VarysStruct;\n\n\tvar pos = array< vec2<f32>, 4 >(\n\t\tvec2<f32>( -1.0, 1.0 ),\n\t\tvec2<f32>( 1.0, 1.0 ),\n\t\tvec2<f32>( -1.0, -1.0 ),\n\t\tvec2<f32>( 1.0, -1.0 )\n\t);\n\n\tvar tex = array< vec2<f32>, 4 >(\n\t\tvec2<f32>( 0.0, 0.0 ),\n\t\tvec2<f32>( 1.0, 0.0 ),\n\t\tvec2<f32>( 0.0, 1.0 ),\n\t\tvec2<f32>( 1.0, 1.0 )\n\t);\n\n\tVarys.vTex = tex[ vertexIndex ];\n\tVarys.Position = vec4<f32>( pos[ vertexIndex ], 0.0, 1.0 );\n\n\treturn Varys;\n\n}\n"}),this.mipmapFragmentShaderModule=e.createShaderModule({label:"mipmapFragment",code:"\n@group( 0 ) @binding( 0 )\nvar imgSampler : sampler;\n\n@group( 0 ) @binding( 1 )\nvar img : texture_2d<f32>;\n\n@fragment\nfn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> {\n\n\treturn textureSample( img, imgSampler, vTex );\n\n}\n"}),this.flipYFragmentShaderModule=e.createShaderModule({label:"flipYFragment",code:"\n@group( 0 ) @binding( 0 )\nvar imgSampler : sampler;\n\n@group( 0 ) @binding( 1 )\nvar img : texture_2d<f32>;\n\n@fragment\nfn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> {\n\n\treturn textureSample( img, imgSampler, vec2( vTex.x, 1.0 - vTex.y ) );\n\n}\n"})}getTransferPipeline(e){let t=this.transferPipelines[e];return void 0===t&&(t=this.device.createRenderPipeline({label:`mipmap-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.mipmapFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:zF,stripIndexFormat:rB},layout:"auto"}),this.transferPipelines[e]=t),t}getFlipYPipeline(e){let t=this.flipYPipelines[e];return void 0===t&&(t=this.device.createRenderPipeline({label:`flipY-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.flipYFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:zF,stripIndexFormat:rB},layout:"auto"}),this.flipYPipelines[e]=t),t}flipY(e,t,n=0){const i=t.format,{width:r,height:s}=t.size,a=this.getTransferPipeline(i),o=this.getFlipYPipeline(i),l=this.device.createTexture({size:{width:r,height:s,depthOrArrayLayers:1},format:i,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),u=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:Fq,baseArrayLayer:n}),c=l.createView({baseMipLevel:0,mipLevelCount:1,dimension:Fq,baseArrayLayer:0}),h=this.device.createCommandEncoder({}),d=(e,t,n)=>{const i=e.getBindGroupLayout(0),r=this.device.createBindGroup({layout:i,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:t}]}),s=h.beginRenderPass({colorAttachments:[{view:n,loadOp:JF,storeOp:KF,clearValue:[0,0,0,0]}]});s.setPipeline(e),s.setBindGroup(0,r),s.draw(4,1,0,0),s.end()};d(a,u,c),d(o,c,u),this.device.queue.submit([h.finish()]),l.destroy()}generateMipmaps(e,t,n=0){const i=this.get(e);void 0===i.useCount&&(i.useCount=0,i.layers=[]);const r=i.layers[n]||this._mipmapCreateBundles(e,t,n),s=this.device.createCommandEncoder({});this._mipmapRunBundles(s,r),this.device.queue.submit([s.finish()]),0!==i.useCount&&(i.layers[n]=r),i.useCount++}_mipmapCreateBundles(e,t,n){const i=this.getTransferPipeline(t.format),r=i.getBindGroupLayout(0);let s=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:Fq,baseArrayLayer:n});const a=[];for(let o=1;o<t.mipLevelCount;o++){const l=this.device.createBindGroup({layout:r,entries:[{binding:0,resource:this.mipmapSampler},{binding:1,resource:s}]}),u=e.createView({baseMipLevel:o,mipLevelCount:1,dimension:Fq,baseArrayLayer:n}),c={colorAttachments:[{view:u,loadOp:JF,storeOp:KF,clearValue:[0,0,0,0]}]},h=this.device.createRenderBundleEncoder({colorFormats:[t.format]});h.setPipeline(i),h.setBindGroup(0,l),h.draw(4,1,0,0),a.push({renderBundles:[h.finish()],passDescriptor:c}),s=u}return a}_mipmapRunBundles(e,t){const n=t.length;for(let i=0;i<n;i++){const n=t[i],r=e.beginRenderPass(n.passDescriptor);r.executeBundles(n.renderBundles),r.end()}}}const Kq={[Kt]:"never",[Zt]:"less",[Jt]:"equal",[Qt]:"less-equal",[en]:"greater",[nn]:"greater-equal",[rn]:"always",[tn]:"not-equal"},Zq=[0,1,3,2,4,5];class Jq{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this.colorBuffer=null,this.depthTexture=new vo,this.depthTexture.name="depthBuffer"}createSampler(e){const t=this.backend,n=t.device,i=t.get(e),r={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};r.magFilter===XV&&r.minFilter===XV&&r.mipmapFilter===XV&&(r.maxAnisotropy=e.anisotropy),e.isDepthTexture&&null!==e.compareFunction&&(r.compare=Kq[e.compareFunction]),i.sampler=n.createSampler(r)}createDefaultTexture(e){let t;const n=Qq(e);t=e.isCubeTexture?this._getDefaultCubeTextureGPU(n):this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}
vendor: 6,956 bytes, line 1
1createTexture(e,t={}){const n=this.backend,i=n.get(e);if(i.initialized)throw new Error("WebGPUTextureUtils: Texture already initialized.");if(e.isExternalTexture)return i.texture=e.sourceTexture,void(i.initialized=!0);void 0===t.needsMipmaps&&(t.needsMipmaps=!1),void 0===t.levels&&(t.levels=1),void 0===t.depth&&(t.depth=1);const{width:r,height:s,depth:a,levels:o}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());const l=this._getDimension(e),u=e.internalFormat||t.format||Qq(e,n.device);i.format=u;const{samples:c,primarySamples:h,isMSAA:d}=n.utils.getTextureSampleData(e);let p=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;!0===e.isStorageTexture&&(p|=GPUTextureUsage.STORAGE_BINDING),!0!==e.isCompressedTexture&&!0!==e.isCompressedArrayTexture&&u!==CB&&(p|=GPUTextureUsage.RENDER_ATTACHMENT);const m={label:e.name,size:{width:r,height:s,depthOrArrayLayers:a},mipLevelCount:o,sampleCount:h,dimension:l,format:u,usage:p};if(void 0!==u){if(e.isCubeTexture&&(m.textureBindingViewDimension=Vq),i.texture=n.device.createTexture(m),d){const e=Object.assign({},m);e.label=e.label+"-msaa",e.sampleCount=c,e.mipLevelCount=1,i.msaaTexture=n.device.createTexture(e)}i.initialized=!0,i.textureDescriptorGPU=m}else this.createDefaultTexture(e)}destroyTexture(e){const t=this.backend,n=t.get(e);void 0!==n.texture&&n.texture.destroy(),void 0!==n.msaaTexture&&n.msaaTexture.destroy(),t.delete(e)}destroySampler(e){delete this.backend.get(e).sampler}generateMipmaps(e){const t=this.backend.get(e);if(e.isCubeTexture)for(let n=0;n<6;n++)this._generateMipmaps(t.texture,t.textureDescriptorGPU,n);else{const n=e.image.depth||1;for(let e=0;e<n;e++)this._generateMipmaps(t.texture,t.textureDescriptorGPU,e)}}getColorBuffer(){this.colorBuffer&&this.colorBuffer.destroy();const e=this.backend,{width:t,height:n}=e.getDrawingBufferSize();return this.colorBuffer=e.device.createTexture({label:"colorBuffer",size:{width:t,height:n,depthOrArrayLayers:1},sampleCount:e.utils.getSampleCount(e.renderer.samples),format:e.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC}),this.colorBuffer}getDepthBuffer(e=!0,t=!1){const n=this.backend,{width:i,height:r}=n.getDrawingBufferSize(),s=this.depthTexture,a=n.get(s).texture;let o,l;if(t?(o=Ze,l=He):e&&(o=Ke,l=Ve),void 0!==a){if(s.image.width===i&&s.image.height===r&&s.format===o&&s.type===l)return a;this.destroyTexture(s)}return s.name="depthBuffer",s.format=o,s.type=l,s.image.width=i,s.image.height=r,this.createTexture(s,{width:i,height:r}),n.get(s).texture}updateTexture(e,t){const n=this.backend.get(e),i=e.mipmaps,{textureDescriptorGPU:r}=n;if(!e.isRenderTargetTexture&&void 0!==r){if(e.isDataTexture)if(i.length>0)for(let t=0,s=i.length;t<s;t++){const s=i[t];this._copyBufferToTexture(s,n.texture,r,0,e.flipY,0,t)}else this._copyBufferToTexture(t.image,n.texture,r,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)for(let i=0;i<t.image.depth;i++)this._copyBufferToTexture(t.image,n.texture,r,i,e.flipY,i);else if(e.isCompressedTexture||e.isCompressedArrayTexture)this._copyCompressedBufferToTexture(e.mipmaps,n.texture,r);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,r);else if(i.length>0)for(let t=0,s=i.length;t<s;t++){const s=i[t];this._copyImageToTexture(s,n.texture,r,0,e.flipY,e.premultiplyAlpha,t)}else this._copyImageToTexture(t.image,n.texture,r,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,i,r,s){const a=this.backend.device,o=this.backend.get(e),l=o.texture,u=o.textureDescriptorGPU.format,c=this._getBytesPerTexel(u);let h=i*c;h=256*Math.ceil(h/256);const d=a.createBuffer({size:(r-1)*h+i*c,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),p=a.createCommandEncoder();p.copyTextureToBuffer({texture:l,origin:{x:t,y:n,z:s}},{buffer:d,bytesPerRow:h},{width:i,height:r});const m=this._getTypedArrayType(u);a.queue.submit([p.finish()]),await d.mapAsync(GPUMapMode.READ);return new m(d.getMappedRange())}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(void 0===t){const n=new Kn;n.minFilter=Re,n.magFilter=Re,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.defaultTexture[e];if(void 0===t){const n=new ys;n.minFilter=Re,n.magFilter=Re,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 i=e.images,r=e.mipmaps;for(let s=0;s<6;s++){const a=i[s],o=!0===e.flipY?Zq[s]:s;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,o,e.flipY):this._copyImageToTexture(a,t,n,o,e.flipY,e.premultiplyAlpha);for(let i=0;i<r.length;i++){const a=r[i].images[s];a.isDataTexture?this._copyBufferToTexture(a.image,t,n,o,e.flipY,0,i+1):this._copyImageToTexture(a,t,n,o,e.flipY,e.premultiplyAlpha,i+1)}}}_copyImageToTexture(e,t,n,i,r,s,a=0){const o=this.backend.device,l=a>0?e.width:n.size.width,u=a>0?e.height:n.size.height;o.queue.copyExternalImageToTexture({source:e,flipY:r},{texture:t,mipLevel:a,origin:{x:0,y:0,z:i},premultipliedAlpha:s},{width:l,height:u,depthOrArrayLayers:1})}_getPassUtils(){let e=this._passUtils;return null===e&&(this._passUtils=e=new Yq(this.backend.device)),e}_generateMipmaps(e,t,n=0){this._getPassUtils().generateMipmaps(e,t,n)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,i,r,s=0,a=0){const o=this.backend.device,l=e.data,u=this._getBytesPerTexel(n.format),c=e.width*u;o.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:i}},l,{offset:e.width*e.height*u*s,bytesPerRow:c},{width:e.width,height:e.height,depthOrArrayLayers:1}),!0===r&&this._flipY(t,n,i)}_copyCompressedBufferToTexture(e,t,n){const i=this.backend.device,r=this._getBlockData(n.format),s=n.size.depthOrArrayLayers>1;for(let a=0;a<e.length;a++){const o=e[a],l=o.width,u=o.height,c=s?n.size.depthOrArrayLayers:1,h=Math.ceil(l/r.width)*r.byteLength,d=h*Math.ceil(u/r.height);for(let e=0;e<c;e++)i.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:e}},o.data,{offset:e*d,bytesPerRow:h,rowsPerImage:Math.ceil(u/r.height)},{width:Math.ceil(l/r.width)*r.width,height:Math.ceil(u/r.height)*r.height,depthOrArrayLayers:1})}}_getBlockData(e){return e===WB||e===XB?{byteLength:8,width:4,height:4}:e===$B||e===YB||e===KB||e===ZB?{byteLength:16,width:4,height:4}:e===JB||e===QB?{byteLength:8,width:4,height:4}:e===eV||e===tV||e===nV||e===iV||e===rV||e===sV?{byteLength:16,width:4,height:4}:e===aV||e===oV||e===lV||e===uV?{byteLength:8,width:4,height:4}:e===cV||e===hV?{byteLength:16,width:4,height:4}:e===dV||e===pV?{byteLength:8,width:4,height:4}:e===mV||e===fV||e===gV||e===_V?{byteLength:16,width:4,height:4}:e===yV||e===vV?{byteLength:16,width:5,height:4}:e===xV||e===bV?{byteLength:16,width:5,height:5}
1:e===TV||e===SV?{byteLength:16,width:6,height:5}:e===MV||e===wV?{byteLength:16,width:6,height:6}:e===EV||e===AV?{byteLength:16,width:8,height:5}:e===RV||e===CV?{byteLength:16,width:8,height:6}:e===NV||e===PV?{byteLength:16,width:8,height:8}:e===IV||e===LV?{byteLength:16,width:10,height:5}:e===DV||e===OV?{byteLength:16,width:10,height:6}:e===UV||e===FV?{byteLength:16,width:10,height:8}:e===BV||e===VV?{byteLength:16,width:10,height:10}:e===qV||e===zV?{byteLength:16,width:12,height:10}:e===kV||e===GV?{byteLength:16,width:12,height:12}:void 0}_convertAddressMode(e){let t=HV;return e===we?t=jV:e===Ae&&(t=WV),t}_convertFilterMode(e){let t=XV;return e!==Re&&e!==Ce&&e!==Ne||(t=$V),t}_getBytesPerTexel(e){return e===sB||e===aB||e===oB||e===lB?1:e===uB||e===cB||e===hB||e===dB||e===pB||e===mB||e===fB?2:e===gB||e===_B||e===yB||e===vB||e===xB||e===bB||e===TB||e===SB||e===MB||e===wB||e===EB||e===AB||e===RB||e===CB||e===NB||e===PB||e===HB||e===kB||e===GB||e===jB?4:e===IB||e===LB||e===DB||e===OB||e===UB||e===FB?8:e===BB||e===VB||e===qB?16:void 0}_getTypedArrayType(e){return e===oB?Uint8Array:e===lB?Int8Array:e===sB?Uint8Array:e===aB?Int8Array:e===mB?Uint8Array:e===fB?Int8Array:e===dB?Uint8Array:e===pB?Int8Array:e===wB?Uint8Array:e===EB?Int8Array:e===TB||e===SB?Uint8Array:e===MB?Int8Array:e===uB?Uint16Array:e===cB?Int16Array:e===vB?Uint16Array:e===xB?Int16Array:e===OB?Uint16Array:e===UB?Int16Array:e===hB||e===bB||e===FB?Uint16Array:e===gB?Uint32Array:e===_B?Int32Array:e===yB?Float32Array:e===IB?Uint32Array:e===LB?Int32Array:e===DB?Float32Array:e===BB?Uint32Array:e===VB?Int32Array:e===qB?Float32Array:e===AB||e===RB?Uint8Array:e===NB||e===CB||e===PB?Uint32Array:e===HB?Float32Array:e===kB||e===GB?Uint32Array:e===jB?Float32Array:void 0}_getDimension(e){let t;return t=e.is3DTexture||e.isData3DTexture?Uq:Oq,t}}function Qq(e,t=null){const n=e.format,i=e.type,r=e.colorSpace,s=qn.getTransfer(r);let a;if(!0===e.isCompressedTexture||!0===e.isCompressedArrayTexture)switch(n){case it:case rt:a=s===Xt?XB:WB;break;case st:a=s===Xt?YB:$B;break;case at:a=s===Xt?ZB:KB;break;case Pt:a=JB;break;case It:a=QB;break;case Lt:a=eV;break;case Dt:a=tV;break;case Rt:a=s===Xt?sV:rV;break;case dt:case ht:a=s===Xt?oV:aV;break;case pt:a=s===Xt?hV:cV;break;case mt:a=s===Xt?_V:gV;break;case ft:a=s===Xt?vV:yV;break;case gt:a=s===Xt?bV:xV;break;case _t:a=s===Xt?SV:TV;break;case yt:a=s===Xt?wV:MV;break;case vt:a=s===Xt?AV:EV;break;case xt:a=s===Xt?CV:RV;break;case bt:a=s===Xt?PV:NV;break;case Tt:a=s===Xt?LV:IV;break;case St:a=s===Xt?OV:DV;break;case Mt:a=s===Xt?FV:UV;break;case wt:a=s===Xt?VV:BV;break;case Et:a=s===Xt?zV:qV;break;case At:a=s===Xt?GV:kV;break;case Ye:a=s===Xt?SB:TB}else switch(n){case Ye:switch(i){case Oe:a=MB;break;case Ue:a=UB;break;case Fe:a=OB;break;case Ve:a=BB;break;case Be:a=VB;break;case De:a=s===Xt?SB:TB;break;case ze:a=FB;break;case qe:a=qB}break;case $e:switch(i){case je:a=CB;break;case We:a=PB}break;case Je:switch(i){case Oe:a=aB;break;case Ue:a=cB;break;case Fe:a=uB;break;case Ve:a=gB;break;case Be:a=_B;break;case De:a=sB;break;case ze:a=hB;break;case qe:a=yB}break;case et:switch(i){case Oe:a=pB;break;case Ue:a=xB;break;case Fe:a=vB;break;case Ve:a=IB;break;case Be:a=LB;break;case De:a=dB;break;case ze:a=bB;break;case qe:a=DB}break;case Ke:switch(i){case Fe:a=zB;break;case Ve:a=kB;break;case qe:a=HB}break;case Ze:switch(i){case He:a=GB;break;case qe:t&&t.features.has(Hq.Depth32FloatStencil8),a=jB}break;case Qe:switch(i){case Be:a=_B;break;case Ve:a=gB}break;case tt:switch(i){case Be:a=LB;break;case Ve:a=IB}break;case nt:switch(i){case Be:a=VB;break;case Ve:a=BB}}return a}const ez=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,tz=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/gi,nz={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>
1":"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"};class iz extends cU{constructor(e){const{type:t,inputs:n,name:i,inputsCode:r,blockCode:s,outputType:a}=(e=>{const t=(e=e.trim()).match(ez);if(null!==t&&4===t.length){const n=t[2],i=[];let r=null;for(;null!==(r=tz.exec(n));)i.push({name:r[1],type:r[2]});const s=[];for(let e=0;e<i.length;e++){const{name:t,type:n}=i[e];let r=n;r.startsWith("ptr")?r="pointer":(r.startsWith("texture")&&(r=n.split("<")[0]),r=nz[r]),s.push(new KO(r,t))}const a=e.substring(t[0].length),o=t[3]||"void",l=void 0!==t[1]?t[1]:"";return{type:nz[o]||o,inputs:s,name:l,inputsCode:n,blockCode:a,outputType:o}}throw new Error("FunctionNode: Function is not a WGSL code.")})(e);super(t,n,i),this.inputsCode=r,this.blockCode=s,this.outputType=a}getCode(e=this.name){const t="void"!==this.outputType?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class rz extends uU{parseFunction(e){return new iz(e)}}const sz="undefined"!=typeof self?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},az={[w_.READ_ONLY]:"read",[w_.WRITE_ONLY]:"write",[w_.READ_WRITE]:"read_write"},oz={[we]:"repeat",[Ee]:"clamp",[Ae]:"mirror"},lz={vertex:sz?sz.VERTEX:1,fragment:sz?sz.FRAGMENT:2,compute:sz?sz.COMPUTE:4},uz={instance:!0,swizzleAssign:!1,storageBuffer:!0},cz={"^^":"tsl_xor"},hz={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>"},dz={},pz={tsl_xor:new EI("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new EI("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new EI("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new EI("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new EI("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new EI("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new EI("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new EI("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 EI("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 EI("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new EI("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 EI("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new EI("\nfn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n")},mz={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>"};let fz="";!0!==("undefined"!=typeof navigator&&/Firefox|Deno/g.test(navigator.userAgent))&&(fz+="diagnostic( off, derivative_uniformity );\n");
vendor: 10,814 bytes, line 1
1class gz extends $O{constructor(e,t){super(e,t,new rz),this.uniformGroups={},this.builtins={},this.directives={},this.scopedArrays=new Map}_generateTextureSample(e,t,n,i,r,s=this.shaderStage){return"fragment"===s?i?r?`textureSample( ${t}, ${t}_sampler, ${n}, ${i}, ${r} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${i} )`:r?`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",i)}generateTextureSampleLevel(e,t,n,i,r,s){return!1===this.isUnfilterable(e)?s?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i}, ${s} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,s,i):this.generateTextureLod(e,t,n,r,s,i)}generateWrapFunction(e){const t=`tsl_coord_${oz[e.wrapS]}S_${oz[e.wrapT]}_${e.isData3DTexture?"3d":"2d"}T`;let n=dz[t];if(void 0===n){const i=[],r=e.isData3DTexture?"vec3f":"vec2f";let s=`fn ${t}( coord : ${r} ) -> ${r} {\n\n\treturn ${r}(\n`;const a=(e,t)=>{e===we?(i.push(pz.repeatWrapping_float),s+=`\t\ttsl_repeatWrapping_float( coord.${t} )`):e===Ee?(i.push(pz.clampWrapping_float),s+=`\t\ttsl_clampWrapping_float( coord.${t} )`):e===Ae?(i.push(pz.mirrorWrapping_float),s+=`\t\ttsl_mirrorWrapping_float( coord.${t} )`):s+=`\t\tcoord.${t}`};a(e.wrapS,"x"),s+=",\n",a(e.wrapT,"y"),e.isData3DTexture&&(s+=",\n",a(e.wrapR,"z")),s+="\n\t);\n\n}\n",dz[t]=n=new EI(s,i)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){const i=this.getDataFromNode(e,this.shaderStage,this.globalCache);void 0===i.dimensionsSnippet&&(i.dimensionsSnippet={});let r=i.dimensionsSnippet[n];if(void 0===i.dimensionsSnippet[n]){let s,a;const{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(e),l=o>1;a=e.isData3DTexture?"vec3<u32>":"vec2<u32>",s=l||e.isStorageTexture?t:`${t}${n?`, u32( ${n} )`:""}`,r=new Hb(new RT(`textureDimensions( ${s} )`,a)),i.dimensionsSnippet[n]=r,(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)&&(i.arrayLayerCount=new Hb(new RT(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(i.cubeFaceCount=new Hb(new RT("6u","u32")))}return r.build(this)}generateFilteredTexture(e,t,n,i,r="0u"){this._include("biquadraticTexture");const s=this.generateWrapFunction(e),a=this.generateTextureDimension(e,t,r);return i&&(n=`${n} + vec2<f32>(${i}) / ${a}`),`tsl_biquadraticTexture( ${t}, ${s}( ${n} ), ${a}, u32( ${r} ) )`}generateTextureLod(e,t,n,i,r,s="0u"){const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,s),l=e.isData3DTexture?"vec3":"vec2";r&&(n=`${n} + ${l}<f32>(${r}) / ${l}<f32>( ${o} )`);const u=`${l}<u32>( ${a}( ${n} ) * ${l}<f32>( ${o} ) )`;return this.generateTextureLoad(e,t,u,i,null,s)}generateTextureLoad(e,t,n,i,r,s="0u"){let a;return r&&(n=`${n} + ${r}`),i?a=`textureLoad( ${t}, ${n}, ${i}, u32( ${s} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${s} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,i,r){let s;return s=i?`textureStore( ${t}, ${n}, ${i}, ${r} )`:`textureStore( ${t}, ${n}, ${r} )`,s}isSampleCompare(e){return!0===e.isDepthTexture&&null!==e.compareFunction}isUnfilterable(e){return"float"!==this.getComponentTypeFromTexture(e)||!this.isAvailable("float32Filterable")&&!0===e.isDataTexture&&e.type===qe||!1===this.isSampleCompare(e)&&e.minFilter===Re&&e.magFilter===Re||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,i,r,s=this.shaderStage){let a=null;return a=this.isUnfilterable(e)?this.generateTextureLod(e,t,n,i,r,"0",s):this._generateTextureSample(e,t,n,i,r,s),a}generateTextureGrad(e,t,n,i,r,s,a=this.shaderStage){if("fragment"===a)return s?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${i[0]}, ${i[1]}, ${s} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${i[0]}, ${i[1]} )`}generateTextureCompare(e,t,n,i,r,s,a=this.shaderStage){if("fragment"===a)return!0===e.isDepthTexture&&!0===e.isArrayTexture?s?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${i}, ${s} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${i} )`:s?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${i}, ${s} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${i} )`}generateTextureLevel(e,t,n,i,r,s){return!1===this.isUnfilterable(e)?s?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i}, ${s} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,s,i):this.generateTextureLod(e,t,n,r,s,i)}generateTextureBias(e,t,n,i,r,s,a=this.shaderStage){if("fragment"===a)return s?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${i}, ${s} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${i} )`}getPropertyName(e,t=this.shaderStage){if(!0===e.isNodeVarying&&!0===e.needsInterpolation){if("vertex"===t)return`varyings.${e.name}`}else if(!0===e.isNodeUniform){const t=e.name,n=e.type;return"texture"===n||"cubeTexture"===n||"storageTexture"===n||"texture3D"===n?t:"buffer"===n||"storageBuffer"===n||"indirectStorageBuffer"===n?this.isCustomStruct(e)?t:t+".value":e.groupNode.name+"."+t}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=cz[e];return void 0!==t?(this._include(t),t):null}getNodeAccess(e,t){return"compute"!==t?!0===e.isAtomic?w_.READ_WRITE:w_.READ_ONLY:e.access}getStorageAccess(e,t){return az[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,i=null){const r=super.getUniformFromNode(e,t,n,i),s=this.getDataFromNode(e,n,this.globalCache);if(void 0===s.uniformGPU){let a;const o=e.groupNode,l=o.name,u=this.getBindGroupArray(l,n);if("texture"===t||"cubeTexture"===t||"storageTexture"===t||"texture3D"===t){let i=null;const s=this.getNodeAccess(e,n);if("texture"===t||"storageTexture"===t?i=!0===e.value.is3DTexture?new aF(r.name,r.node,o,s):new rF(r.name,r.node,o,s):"cubeTexture"===t?i=new sF(r.name,r.node,o,s):"texture3D"===t&&(i=new aF(r.name,r.node,o,s)),i.store=!0===e.isStorageTextureNode,i.setVisibility(lz[n]),!1===this.isUnfilterable(e.value)&&!1===i.store){const e=new jq(`${r.name}_sampler`,r.node,o);e.setVisibility(lz[n]),u.push(e,i),a=[e,i]}else u.push(i),a=[i]}else if("buffer"===t||"storageBuffer"===t||"indirectStorageBuffer"===t){const s=new("buffer"===t?ZU:$q)(e,o);s.setVisibility(lz[n]),u.push(s),a=s,r.name=i||"NodeBuffer_"+r.id}else{const e=this.uniformGroups[n]||(this.uniformGroups[n]={});let i=e[l];void 0===i&&(i=new eF(l,o),i.setVisibility(lz[n]),e[l]=i,u.push(i)),a=this.getNodeUniform(r,t),i.addUniform(a)}s.uniformGPU=a}return r}getBuiltin(e,t,n,i=this.shaderStage){const r=this.builtins[i]||(this.builtins[i]=new Map);return!1===r.has(e)&&r.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return void 0!==this.builtins[t]&&this.builtins[t].has(e)}getVertexIndex(){return"vertex"===this.shaderStage?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),i=[];for(const s of t.inputs)i.push(s.name+" : "+this.getType(s.type));let r=`fn ${t.name}( ${i.join(", ")} ) -> ${this.getType(t.type)} {\n${n.vars}\n${n.code}\n`;return n.result&&(r+=`\treturn ${n.result};\n`),r+="\n}\n",r}getInstanceIndex(){return"vertex"===this.shaderStage?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(void 0!==n)for(const i of n)t.push(`enable ${i};`);return t.join("\n")}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(void 0!==n)for(const{name:i,property:r,type:s}of n.values())t.push(`@builtin( ${i} ) ${r} : ${s}`);return t.join(",\n\t")}getScopedArray(e,t,n,i){return!1===this.scopedArrays.has(e)&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:n,bufferCount:i}),e}getScopedArrays(e){if("compute"!==e)return;const t=[];for(const{name:n,scope:i,bufferType:r,bufferCount:s}of this.scopedArrays.values()){const e=this.getType(r);t.push(`var<${i}> ${n}: array< ${e}, ${s} >;`)}return t.join("\n")}getAttributes(e){const t=[];if("compute"===e&&(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"))),"vertex"===e||"compute"===e){const e=this.getBuiltins("attribute");e&&t.push(e);const n=this.getAttributesArray();for(let i=0,r=n.length;i<r;i++){const e=n[i],r=e.name,s=this.getType(e.type);t.push(`@location( ${i} ) ${r} : ${s}`)}}return t.join(",\n\t")}getStructMembers(e){const t=[];for(const n of e.members){const i=e.output?"@location( "+n.index+" ) ":"";let r=this.getType(n.type);n.atomic&&(r="atomic< "+r+" >"),t.push(`\t${i+n.name} : ${r}`)}return e.output&&t.push(`\t${this.getBuiltins("output")}`),t.join(",\n")}getStructs(e){let t="";const n=this.structs[e];if(n.length>0){const e=[];for(const t of n){let n=`struct ${t.name} {\n`;n+=this.getStructMembers(t),n+="\n};",e.push(n)}t="\n"+e.join("\n\n")+"\n"}return t}getVar(e,t,n=null){let i=`var ${t} : `;return i+=null!==n?this.generateArrayDeclaration(e,n):this.getType(e),i}getVars(e){const t=[],n=this.vars[e];if(void 0!==n)for(const i of n)t.push(`\t${this.getVar(i.type,i.name,i.count)}
1;`);return`\n${t.join("\n")}\n`}getVaryings(e){const t=[];if("vertex"===e&&this.getBuiltin("position","Vertex","vec4<f32>","vertex"),"vertex"===e||"fragment"===e){const n=this.varyings,i=this.vars[e];for(let r=0;r<n.length;r++){const s=n[r];if(s.needsInterpolation){let e=`@location( ${r} )`;if(s.interpolationType){const t=null!==s.interpolationSampling?`, ${s.interpolationSampling} )`:" )";e+=` @interpolate( ${s.interpolationType}${t}`}else/^(int|uint|ivec|uvec)/.test(s.type)&&(e+=` @interpolate( ${this.renderer.backend.compatibilityMode?"flat, either":"flat"} )`);t.push(`${e} ${s.name} : ${this.getType(s.type)}`)}else"vertex"===e&&!1===i.includes(s)&&i.push(s)}}const n=this.getBuiltins(e);n&&t.push(n);const i=t.join(",\n\t");return"vertex"===e?this._getWGSLStruct("VaryingsStruct","\t"+i):i}isCustomStruct(e){const t=e.value,n=e.node,i=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&null!==n.structTypeNode,r=n.value&&n.value.array&&"number"==typeof n.value.itemSize&&n.value.array.length>n.value.itemSize;return i&&!r}getUniforms(e){const t=this.uniforms[e],n=[],i=[],r=[],s={};for(const o of t){const t=o.groupNode.name,r=this.bindingsIndexes[t];if("texture"===o.type||"cubeTexture"===o.type||"storageTexture"===o.type||"texture3D"===o.type){const t=o.node.value;let i;!1===this.isUnfilterable(t)&&!0!==o.node.isStorageTextureNode&&(this.isSampleCompare(t)?n.push(`@binding( ${r.binding++} ) @group( ${r.group} ) var ${o.name}_sampler : sampler_comparison;`):n.push(`@binding( ${r.binding++} ) @group( ${r.group} ) var ${o.name}_sampler : sampler;`));let s="";const{primarySamples:a}=this.renderer.backend.utils.getTextureSampleData(t);if(a>1&&(s="_multisampled"),!0===t.isCubeTexture)i="texture_cube<f32>";else if(!0===t.isDepthTexture)i=this.renderer.backend.compatibilityMode&&null===t.compareFunction?`texture${s}_2d<f32>`:`texture_depth${s}_2d${!0===t.isArrayTexture?"_array":""}`;else if(!0===o.node.isStorageTextureNode){const n=Qq(t),r=this.getStorageAccess(o.node,e),s=o.node.value.is3DTexture,a=o.node.value.isArrayTexture;i=`texture_storage_${s?"3d":"2d"+(a?"_array":"")}<${n}, ${r}>`}else if(!0===t.isArrayTexture||!0===t.isDataArrayTexture||!0===t.isCompressedArrayTexture)i="texture_2d_array<f32>";else if(!0===t.is3DTexture||!0===t.isData3DTexture)i="texture_3d<f32>";else{i=`texture${s}_2d<${this.getComponentTypeFromTexture(t).charAt(0)}32>`}n.push(`@binding( ${r.binding++} ) @group( ${r.group} ) var ${o.name} : ${i};`)}else if("buffer"===o.type||"storageBuffer"===o.type||"indirectStorageBuffer"===o.type){const t=o.node,n=this.getType(t.getNodeType(this)),s=t.bufferCount,a=s>0&&"buffer"===o.type?", "+s:"",l=t.isStorageBufferNode?`storage, ${this.getStorageAccess(t,e)}`:"uniform";if(this.isCustomStruct(o))i.push(`@binding( ${r.binding++} ) @group( ${r.group} ) var<${l}> ${o.name} : ${n};`);else{const e=`\tvalue : array< ${t.isAtomic?`atomic<${n}>`:`${n}`}${a} >`;i.push(this._getWGSLStructBinding(o.name,e,l,r.binding++,r.group))}}else{const e=this.getType(this.getVectorType(o.type)),t=o.groupNode.name;(s[t]||(s[t]={index:r.binding++,id:r.group,snippets:[]})).snippets.push(`\t${o.name} : ${e}`)}}for(const o in s){const e=s[o];r.push(this._getWGSLStructBinding(o,e.snippets.join(",\n"),"uniform",e.index,e.id))}let a=n.join("\n");return a+=i.join("\n"),a+=r.join("\n"),a}buildCode(){const e=null!==this.material?{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 i="// code\n\n";i+=this.flowCode[t];const r=this.flowNodes[t],s=r[r.length-1],a=s.outputNode,o=void 0!==a&&!0===a.isOutputStructNode;for(const e of r){const r=this.getFlowData(e),l=e.name;if(l&&(i.length>0&&(i+="\n"),i+=`\t// flow -> ${l}\n`),i+=`${r.code}\n\t`,e===s&&"compute"!==t)if(i+="// result\n\n\t","vertex"===t)i+=`varyings.Vertex = ${r.result};`;else if("fragment"===t)if(o)n.returnType=a.getNodeType(this),n.structs+="var<private> output : "+n.returnType+";",i+=`return ${r.result};`;else{let e="\t@location(0) color: vec4<f32>";const t=this.getBuiltins("output");t&&(e+=",\n\t"+t),n.returnType="OutputStruct",n.structs+=this._getWGSLStruct("OutputStruct",e),n.structs+="\nvar<private> output : OutputStruct;",i+=`output.color = ${r.result};\n\n\treturn output;`}}n.flow=i}if(this.shaderStage=null,null!==this.material)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 null!==t&&(n=this._getWGSLMethod(e+"_"+t)),void 0===n&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}
vendor: 1,158 bytes, line 1
1getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return hz[e]||e}isAvailable(e){let t=uz[e];return void 0===t&&("float32Filterable"===e?t=this.renderer.hasFeature("float32-filterable"):"clipDistance"===e&&(t=this.renderer.hasFeature("clip-distances")),uz[e]=t),t}_getWGSLMethod(e){return void 0!==pz[e]&&this._include(e),mz[e]}_include(e){const t=pz[e];return t.build(this),null!==this.currentFunctionNode&&this.currentFunctionNode.includes.push(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}\n// directives\n${e.directives}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// varyings\n${e.varyings}\nvar<private> varyings : VaryingsStruct;\n\n// codes\n${e.codes}\n\n@vertex\nfn main( ${e.attributes} ) -> VaryingsStruct {\n\n\t// vars\n\t${e.vars}\n\n\t// flow\n\t${e.flow}\n\n\treturn varyings;\n\n}\n`}_getWGSLFragmentCode(e){return`${this.getSignature()}\n// global\n${fz}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// codes\n${e.codes}\n\n@fragment\nfn main( ${e.varyings} ) -> ${e.returnType} {\n\n\t// vars\n\t${e.vars}\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLComputeCode(e,t){const[n,i,r]=t;
vendor: 11,923 bytes, line 1
1return`${this.getSignature()}\n// directives\n${e.directives}\n\n// system\nvar<private> instanceIndex : u32;\n\n// locals\n${e.scopedArrays}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// codes\n${e.codes}\n\n@compute @workgroup_size( ${n}, ${i}, ${r} )\nfn main( ${e.attributes} ) {\n\n\t// system\n\tinstanceIndex = globalId.x\n\t\t+ globalId.y * ( ${n} * numWorkgroups.x )\n\t\t+ globalId.z * ( ${n} * numWorkgroups.x ) * ( ${i} * numWorkgroups.y );\n\n\t// vars\n\t${e.vars}\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLStruct(e,t){return`\nstruct ${e} {\n${t}\n};`}_getWGSLStructBinding(e,t,n,i=0,r=0){const s=e+"Struct";return`${this._getWGSLStruct(s,t)}\n@binding( ${i} ) @group( ${r} )\nvar<${n}> ${e} : ${s};`}}class _z{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return null!==e.depthTexture?t=this.getTextureFormatGPU(e.depthTexture):e.depth&&e.stencil?t=GB:e.depth&&(t=kB),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 e=this.backend.renderer,n=e.getRenderTarget();t=n?n.samples:e.samples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const n=t>1&&null!==e.renderTarget&&!0!==e.isDepthTexture&&!0!==e.isFramebufferTexture;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return t=null!==e.textures?this.getTextureFormatGPU(e.textures[0]):this.getPreferredCanvasFormat(),t}getCurrentColorSpace(e){return null!==e.textures?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){return e.isPoints?FF:e.isLineSegments||e.isMesh&&!0===t.wireframe?BF:e.isLine?VF:e.isMesh?qF:void 0}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return null!==e.textures?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.samples)}getPreferredCanvasFormat(){const e=this.backend.parameters.outputType;if(void 0===e)return navigator.gpu.getPreferredCanvasFormat();if(e===De)return AB;if(e===ze)return FB;throw new Error("Unsupported outputType")}}const yz=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);"undefined"!=typeof Float16Array&&yz.set(Float16Array,["float16"]);const vz=new Map([[Ur,["float16"]]]),xz=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class bz{constructor(e){this.backend=e}createAttribute(e,t){const n=this._getBufferAttribute(e),i=this.backend,r=i.get(n);let s=r.buffer;if(void 0===s){const a=i.device;let o=n.array;if(!1===e.normalized)if(o.constructor===Int16Array||o.constructor===Int8Array)o=new Int32Array(o);else if((o.constructor===Uint16Array||o.constructor===Uint8Array)&&(o=new Uint32Array(o),t&GPUBufferUsage.INDEX))for(let e=0;e<o.length;e++)65535===o[e]&&(o[e]=4294967295);if(n.array=o,(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&3===n.itemSize){o=new o.constructor(4*n.count);for(let e=0;e<n.count;e++)o.set(n.array.subarray(3*e,3*e+3),4*e);n.itemSize=4,n.array=o,r._force3to4BytesAlignment=!0}const l=o.byteLength,u=l+(4-l%4)%4;s=a.createBuffer({label:n.name,size:u,usage:t,mappedAtCreation:!0}),new o.constructor(s.getMappedRange()).set(o),s.unmap(),r.buffer=s}}updateAttribute(e){const t=this._getBufferAttribute(e),n=this.backend,i=n.device,r=n.get(t),s=n.get(t).buffer;let a=t.array;if(!0===r._force3to4BytesAlignment){a=new a.constructor(4*t.count);for(let e=0;e<t.count;e++)a.set(t.array.subarray(3*e,3*e+3),4*e);t.array=a}const o=this._isTypedArray(a),l=t.updateRanges;if(0===l.length)i.queue.writeBuffer(s,0,a,0);else{const e=o?1:a.BYTES_PER_ELEMENT;for(let t=0,n=l.length;t<n;t++){const n=l[t];let u,c;if(!0===r._force3to4BytesAlignment){u=4*Math.floor(n.start/3)*e,c=4*Math.ceil(n.count/3)*e}else u=n.start*e,c=n.count*e;const h=u*(o?a.BYTES_PER_ELEMENT:1);i.queue.writeBuffer(s,h,a,u,c)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){const t=e.getAttributes(),n=new Map;for(let i=0;i<t.length;i++){const e=t[i],r=e.array.BYTES_PER_ELEMENT,s=this._getBufferAttribute(e);let a=n.get(s);if(void 0===a){let t,i;!0===e.isInterleavedBufferAttribute?(t=e.data.stride*r,i=e.data.isInstancedInterleavedBuffer?Gq:kq):(t=e.itemSize*r,i=e.isInstancedBufferAttribute?Gq:kq),!1!==e.normalized||e.array.constructor!==Int16Array&&e.array.constructor!==Uint16Array||(t=4),a={arrayStride:t,attributes:[],stepMode:i},n.set(s,a)}const o=this._getVertexFormat(e),l=!0===e.isInterleavedBufferAttribute?e.offset*r:0;a.attributes.push({shaderLocation:i,offset:l,format:o})}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,i=t.get(this._getBufferAttribute(e)).buffer,r=i.size,s=n.createBuffer({label:`${e.name}_readback`,size:r,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),a=n.createCommandEncoder({label:`readback_encoder_${e.name}`});a.copyBufferToBuffer(i,0,s,0,r);const o=a.finish();n.queue.submit([o]),await s.mapAsync(GPUMapMode.READ);const l=s.getMappedRange(),u=new e.array.constructor(l.slice(0));return s.unmap(),u.buffer}_getVertexFormat(e){const{itemSize:t,normalized:n}=e,i=e.array.constructor,r=e.constructor;let s;if(1===t)s=xz.get(i);else{const e=(vz.get(r)||yz.get(i))[n?1:0];if(e){const n=i.BYTES_PER_ELEMENT*t,r=4*Math.floor((n+3)/4)/i.BYTES_PER_ELEMENT;if(r%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");s=`${e}x${r}`}}return s}_isTypedArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}class Tz{constructor(e){this.backend=e,this.bindGroupLayoutCache=new WeakMap}createBindingsLayout(e){const t=this.backend,n=t.device,i=[];let r=0;for(const s of e.bindings){const e={binding:r++,visibility:s.visibility};if(s.isUniformBuffer||s.isStorageBuffer){const t={};s.isStorageBuffer&&(4&s.visibility&&(s.access===w_.READ_WRITE||s.access===w_.WRITE_ONLY)?t.type=Sq:t.type=Mq),e.buffer=t}else if(s.isSampledTexture&&s.store){const t={};t.format=this.backend.get(s.texture).texture.format;const n=s.access;t.access=n===w_.READ_WRITE?Aq:n===w_.WRITE_ONLY?wq:Eq,s.texture.isArrayTexture?t.viewDimension=Bq:s.texture.is3DTexture&&(t.viewDimension=qq),e.storageTexture=t}else if(s.isSampledTexture){const n={},{primarySamples:i}=t.utils.getTextureSampleData(s.texture);if(i>1&&(n.multisampled=!0,s.texture.isDepthTexture||(n.sampleType=Pq)),s.texture.isDepthTexture)t.compatibilityMode&&null===s.texture.compareFunction?n.sampleType=Pq:n.sampleType=Iq;else if(s.texture.isDataTexture||s.texture.isDataArrayTexture||s.texture.isData3DTexture){const e=s.texture.type;e===Be?n.sampleType=Lq:e===Ve?n.sampleType=Dq:e===qe&&(this.backend.hasFeature("float32-filterable")?n.sampleType=Nq:n.sampleType=Pq)}s.isSampledCubeTexture?n.viewDimension=Vq:s.texture.isArrayTexture||s.texture.isDataArrayTexture||s.texture.isCompressedArrayTexture?n.viewDimension=Bq:s.isSampledTexture3D&&(n.viewDimension=qq),e.texture=n}else if(s.isSampler){const n={};s.texture.isDepthTexture&&(null!==s.texture.compareFunction?n.type=Cq:t.compatibilityMode&&(n.type=Rq)),e.sampler=n}i.push(e)}return n.createBindGroupLayout({entries:i})}createBindings(e,t,n,i=0){const{backend:r,bindGroupLayoutCache:s}=this,a=r.get(e);let o,l=s.get(e.bindingsReference);void 0===l&&(l=this.createBindingsLayout(e),s.set(e.bindingsReference,l)),n>0&&(void 0===a.groups&&(a.groups=[],a.versions=[]),a.versions[n]===i&&(o=a.groups[n])),void 0===o&&(o=this.createBindGroup(e,l),n>0&&(a.groups[n]=o,a.versions[n]=i)),a.group=o,a.layout=l}updateBinding(e){const t=this.backend,n=t.device,i=e.buffer,r=t.get(e).buffer;n.queue.writeBuffer(r,0,i,0)}createBindGroupIndex(e,t){const n=this.backend.device,i=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,r=e[0],s=n.createBuffer({label:"bindingCameraIndex_"+r,size:16,usage:i});n.queue.writeBuffer(s,0,e,0);const a=[{binding:0,resource:{buffer:s}}];return n.createBindGroup({label:"bindGroupCameraIndex_"+r,layout:t,entries:a})}createBindGroup(e,t){const n=this.backend,i=n.device;let r=0;const s=[];for(const a of e.bindings){if(a.isUniformBuffer){const e=n.get(a);if(void 0===e.buffer){const t=a.byteLength,n=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,r=i.createBuffer({label:"bindingBuffer_"+a.name,size:t,usage:n});e.buffer=r}s.push({binding:r,resource:{buffer:e.buffer}})}else if(a.isStorageBuffer){const e=n.get(a);if(void 0===e.buffer){const t=a.attribute;e.buffer=n.get(t).buffer}s.push({binding:r,resource:{buffer:e.buffer}})}else if(a.isSampledTexture){const e=n.get(a.texture);let t;if(void 0!==e.externalTexture)t=i.importExternalTexture({source:e.externalTexture});else{const n=a.store?1:e.texture.mipLevelCount;let i=`view-${e.texture.width}-${e.texture.height}`;if(e.texture.depthOrArrayLayers>1&&(i+=`-${e.texture.depthOrArrayLayers}`),i+=`-${n}`,t=e[i],void 0===t){const r=zq;let s;s=a.isSampledCubeTexture?Vq:a.isSampledTexture3D?qq:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?Bq:Fq,t=e[i]=e.texture.createView({aspect:r,dimension:s,mipLevelCount:n})}}s.push({binding:r,resource:t})}else if(a.isSampler){const e=n.get(a.texture);s.push({binding:r,resource:e.sampler})}r++}return i.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:s})}}class Sz{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))}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:n,material:i,geometry:r,pipeline:s}=e,{vertexProgram:a,fragmentProgram:o}=s,l=this.backend,u=l.device,c=l.utils,h=l.get(s),d=[];for(const R of e.getBindings()){const e=l.get(R);d.push(e.layout)}const p=l.attributeUtils.createShaderVertexBuffers(e);let m;0===i.blending||1===i.blending&&!1===i.transparent||(m=this._getBlending(i));let f={};!0===i.stencilWrite&&(f={compare:this._getStencilCompare(i),failOp:this._getStencilOperation(i.stencilFail),depthFailOp:this._getStencilOperation(i.stencilZFail),passOp:this._getStencilOperation(i.stencilZPass)});const g=this._getColorWriteMask(i),_=[];if(null!==e.context.textures){const t=e.context.textures;for(let e=0;e<t.length;e++){const n=c.getTextureFormatGPU(t[e]);_.push({format:n,blend:m,writeMask:g})}}else{const t=c.getCurrentColorFormat(e.context);_.push({format:t,blend:m,writeMask:g})}const y=l.get(a).module,v=l.get(o).module,x=this._getPrimitiveState(n,r,i),b=this._getDepthCompare(i),T=c.getCurrentDepthStencilFormat(e.context),S=this._getSampleCount(e.context),M={label:`renderPipeline_${i.name||i.type}_${i.id}`,vertex:Object.assign({},y,{buffers:p}),fragment:Object.assign({},v,{targets:_}),primitive:x,multisample:{count:S,alphaToCoverageEnabled:i.alphaToCoverage&&S>1},layout:u.createPipelineLayout({bindGroupLayouts:d})},w={},E=e.context.depth,A=e.context.stencil;if(!0!==E&&!0!==A||(!0===E&&(w.format=T,w.depthWriteEnabled=i.depthWrite,w.depthCompare=b),!0===A&&(w.stencilFront=f,w.stencilBack={},w.stencilReadMask=i.stencilFuncMask,w.stencilWriteMask=i.stencilWriteMask),!0===i.polygonOffset&&(w.depthBias=i.polygonOffsetUnits,w.depthBiasSlopeScale=i.polygonOffsetFactor,w.depthBiasClamp=0),M.depthStencil=w),null===t)h.pipeline=u.createRenderPipeline(M);else{const e=new Promise(e=>{u.createRenderPipelineAsync(M).then(t=>{h.pipeline=t,e()})});t.push(e)}}createBundleEncoder(e,t="renderBundleEncoder"){const n=this.backend,{utils:i,device:r}=n,s=i.getCurrentDepthStencilFormat(e),a={label:t,colorFormats:[i.getCurrentColorFormat(e)],depthStencilFormat:s,sampleCount:this._getSampleC
1ount(e)};return r.createRenderBundleEncoder(a)}createComputePipeline(e,t){const n=this.backend,i=n.device,r=n.get(e.computeProgram).module,s=n.get(e),a=[];for(const o of t){const e=n.get(o);a.push(e.layout)}s.pipeline=i.createComputePipeline({compute:r,layout:i.createPipelineLayout({bindGroupLayouts:a})})}_getBlending(e){let t,n;const i=e.blending,r=e.blendSrc,s=e.blendDst,a=e.blendEquation;if(5===i){const i=null!==e.blendSrcAlpha?e.blendSrcAlpha:r,o=null!==e.blendDstAlpha?e.blendDstAlpha:s,l=null!==e.blendEquationAlpha?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(r),dstFactor:this._getBlendFactor(s),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(i),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(l)}}else{const r=(e,i,r,s)=>{t={srcFactor:e,dstFactor:i,operation:lq},n={srcFactor:r,dstFactor:s,operation:lq}};if(e.premultipliedAlpha)switch(i){case 1:r(KV,eq,KV,eq);break;case 2:r(KV,KV,KV,KV);break;case 3:r(YV,JV,YV,KV);break;case 4:r(tq,eq,YV,KV)}else switch(i){case 1:r(QV,eq,KV,eq);break;case 2:r(QV,KV,KV,KV)}}if(void 0!==t&&void 0!==n)return{color:t,alpha:n}}_getBlendFactor(e){let t;switch(e){case $:t=YV;break;case Y:t=KV;break;case K:t=ZV;break;case Z:t=JV;break;case J:t=QV;break;case Q:t=eq;break;case ne:t=tq;break;case ie:t=nq;break;case ee:t=iq;break;case te:t=rq;break;case re:t=sq;break;case 211:t=aq;break;case 212:t=oq}return t}_getStencilCompare(e){let t;switch(e.stencilFunc){case 512:t=kF;break;case Yt:t=YF;break;case 513:t=GF;break;case 515:t=jF;break;case 514:t=HF;break;case 518:t=$F;break;case 516:t=WF;break;case 517:t=XF}return t}_getStencilOperation(e){let t;switch(e){case $t:t=fq;break;case 0:t=gq;break;case 7681:t=_q;break;case 5386:t=yq;break;case 7682:t=vq;break;case 7683:t=xq;break;case 34055:t=bq;break;case 34056:t=Tq}return t}_getBlendOperation(e){let t;switch(e){case j:t=lq;break;case W:t=uq;break;case X:t=cq;break;case 103:t=hq;break;case 104:t=dq}return t}_getPrimitiveState(e,t,n){const i={},r=this.backend.utils;i.topology=r.getPrimitiveTopology(e,n),null!==t.index&&!0===e.isLine&&!0!==e.isLineSegments&&(i.stripIndexFormat=t.index.array instanceof Uint16Array?iB:rB);let s=1===n.side;return e.isMesh&&e.matrixWorld.determinant()<0&&(s=!s),i.frontFace=!0===s?eB:QF,i.cullMode=2===n.side?tB:nB,i}_getColorWriteMask(e){return!0===e.colorWrite?mq:pq}_getDepthCompare(e){let t;if(!1===e.depthTest)t=YF;else{switch(e.depthFunc){case 0:t=kF;break;case 1:t=YF;break;case 2:t=GF;break;case 3:t=jF;break;case 4:t=HF;break;case 5:t=$F;break;case 6:t=WF;break;case 7:t=XF}}return t}}class Mz extends DF{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 i=8*this.maxQueries;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:i,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:i,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Un(`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||0===this.currentQueryIndex||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("unmapped"!==this.resultBuffer.mapState)return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=8*t;this.currentQueryIndex=0,this.queryOffsets.clear();const i=this.device.createCommandEncoder();i.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),i.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);const r=i.finish();if(this.device.queue.submit([r]),"unmapped"!==this.resultBuffer.mapState)return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue;const s=new BigUint64Array(this.resultBuffer.getMappedRange(0,n));let a=0;for(const[,o]of e){const e=s[o],t=s[o+1];a+=Number(t-e)/1e6}return this.resultBuffer.unmap(),this.lastValue=a,a}catch(e){return"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){}if(this.resultBuffer&&"mapped"===this.resultBuffer.mapState)try{this.resultBuffer.unmap()}catch(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 wz extends gF{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=void 0===e.alpha||e.alpha,this.parameters.compatibilityMode=void 0!==e.compatibilityMode&&e.compatibilityMode,this.parameters.requiredLimits=void 0===e.requiredLimits?{}:e.requiredLimits,this.compatibilityMode=this.parameters.compatibilityMode,this.device=null,this.context=null,this.colorBuffer=null,this.defaultRenderPassdescriptor=null,this.utils=new _z(this),this.attributeUtils=new bz(this),this.bindingUtils=new Tz(this),this.pipelineUtils=new Sz(this),this.textureUtils=new Jq(this),this.occludedResolveCache=new Map}async init(e){await super.init(e);const t=this.parameters;let n;if(void 0===t.device){const e={powerPreference:t.powerPreference,featureLevel:t.compatibilityMode?"compatibility":void 0},i="undefined"!=typeof navigator?await navigator.gpu.requestAdapter(e):null;if(null===i)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const r=Object.values(Hq),s=[];for(const t of r)i.features.has(t)&&s.push(t);const a={requiredFeatures:s,requiredLimits:t.requiredLimits};n=await i.requestDevice(a)}else n=t.device;n.lost.then(t=>{const n={api:"WebGPU",message:t.message||"Unknown reason",reason:t.reason||null,originalEvent:t};e.onDeviceLost(n)});const i=void 0!==t.context?t.context:e.domElement.getContext("webgpu");this.device=n,this.context=i;const r=t.alpha?"premultiplied":"opaque",s=qn.getToneMappingMode(this.renderer.outputColorSpace);this.context.configure({device:this.device,format:this.utils.getPreferredCanvasF
1ormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:r,toneMapping:{mode:s}}),this.trackTimestamp=this.trackTimestamp&&this.hasFeature(Hq.TimestampQuery),this.updateSize()}get coordinateSystem(){return un}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.defaultRenderPassdescriptor;if(null===e){const t=this.renderer;e={colorAttachments:[{view:null}]},!0!==this.renderer.depth&&!0!==this.renderer.stencil||(e.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(t.depth,t.stencil).createView()});const n=e.colorAttachments[0];this.renderer.samples>0?n.view=this.colorBuffer.createView():n.resolveTarget=void 0,this.defaultRenderPassdescriptor=e}const t=e.colorAttachments[0];return this.renderer.samples>0?t.resolveTarget=this.context.getCurrentTexture().createView():t.view=this.context.getCurrentTexture().createView(),e}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){const n=e.renderTarget,i=this.get(n);let r=i.descriptors;void 0!==r&&i.width===n.width&&i.height===n.height&&i.samples===n.samples||(r={},i.descriptors=r);const s=e.getCacheKey();let a=r[s];if(void 0===a){const t=e.textures,o=[];let l;const u=this._isRenderCameraDepthArray(e);for(let i=0;i<t.length;i++){const r=this.get(t[i]),s={label:`colorAttachment_${i}`,baseMipLevel:e.activeMipmapLevel,mipLevelCount:1,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1,dimension:Fq};if(n.isRenderTarget3D)l=e.activeCubeFace,s.baseArrayLayer=0,s.dimension=qq,s.depthOrArrayLayers=t[i].image.depth;else if(n.isRenderTarget&&t[i].image.depth>1)if(!0===u){const t=e.camera.cameras;for(let e=0;e<t.length;e++){const t={...s,baseArrayLayer:e,arrayLayerCount:1,dimension:Fq},n=r.texture.createView(t);o.push({view:n,resolveTarget:void 0,depthSlice:void 0})}}else s.dimension=Bq,s.depthOrArrayLayers=t[i].image.depth;if(!0!==u){const e=r.texture.createView(s);let t,n;void 0!==r.msaaTexture?(t=r.msaaTexture.createView(),n=e):(t=e,n=void 0),o.push({view:t,resolveTarget:n,depthSlice:l})}}if(a={textureViews:o},e.depth){const t=this.get(e.depthTexture),n={};e.depthTexture.isArrayTexture&&(n.dimension=Fq,n.arrayLayerCount=1,n.baseArrayLayer=e.activeCubeFace),a.depthStencilView=t.texture.createView(n)}r[s]=a,i.width=n.width,i.height=n.height,i.samples=n.samples,i.activeMipmapLevel=e.activeMipmapLevel,i.activeCubeFace=e.activeCubeFace}const o={colorAttachments:[]};for(let l=0;l<a.textureViews.length;l++){const e=a.textureViews[l];let n={r:0,g:0,b:0,a:1};0===l&&t.clearValue&&(n=t.clearValue),o.colorAttachments.push({view:e.view,depthSlice:e.depthSlice,resolveTarget:e.resolveTarget,loadOp:t.loadOp||ZF,storeOp:t.storeOp||KF,clearValue:n})}return a.depthStencilView&&(o.depthStencilAttachment={view:a.depthStencilView}),o}beginRender(e){const t=this.get(e);t.frameCalls=this.renderer.info.render.frameCalls;const n=this.device,i=e.occlusionQueryCount;let r,s;i>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,r=n.createQuerySet({type:"occlusion",count:i,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=r,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(i),t.lastOcclusionObject=null),s=null===e.textures?this._getDefaultRenderPassDescriptor():this._getRenderPassDescriptor(e,{loadOp:ZF}),this.initTimestampQuery(cn.RENDER,this.getTimestampUID(e),s),s.occlusionQuerySet=r;const a=s.depthStencilAttachment;if(null!==e.textures){const t=s.colorAttachments;for(let n=0;n<t.length;n++){const i=t[n];e.clearColor?(i.clearValue=0===n?e.clearColorValue:{r:0,g:0,b:0,a:1},i.loadOp=JF):i.loadOp=ZF,i.storeOp=KF}}else{const t=s.colorAttachments[0];e.clearColor?(t.clearValue=e.clearColorValue,t.loadOp=JF):t.loadOp=ZF,t.storeOp=KF}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=JF):a.depthLoadOp=ZF,a.depthStoreOp=KF),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=JF):a.stencilLoadOp=ZF,a.stencilStoreOp=KF);const o=n.createCommandEncoder({label:"renderContext_"+e.id});if(!0===this._isRenderCameraDepthArray(e)){const n=e.camera.cameras;t.layerDescriptors&&t.layerDescriptors.length===n.length?this._updateDepthLayerDescriptors(e,t,n
vendor: 16,061 bytes, line 1
1):this._createDepthLayerDescriptors(e,t,s,n),t.bundleEncoders=[],t.bundleSets=[];for(let i=0;i<n.length;i++){const n=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+i),r={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(n),t.bundleSets.push(r)}t.currentPass=null}else{const n=o.beginRenderPass(s);if(t.currentPass=n,e.viewport&&this.updateViewport(e),e.scissor){const{x:t,y:i,width:r,height:s}=e.scissorValue;n.setScissorRect(t,i,r,s)}}t.descriptor=s,t.encoder=o,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createDepthLayerDescriptors(e,t,n,i){const r=n.depthStencilAttachment;t.layerDescriptors=[];const s=this.get(e.depthTexture);s.viewCache||(s.viewCache=[]);for(let a=0;a<i.length;a++){const i={...n,colorAttachments:[{...n.colorAttachments[0],view:n.colorAttachments[a].view}]};if(n.depthStencilAttachment){const t=a;s.viewCache[t]||(s.viewCache[t]=s.texture.createView({dimension:Fq,baseArrayLayer:a,arrayLayerCount:1})),i.depthStencilAttachment={view:s.viewCache[t],depthLoadOp:r.depthLoadOp||JF,depthStoreOp:r.depthStoreOp||KF,depthClearValue:r.depthClearValue||1},e.stencil&&(i.depthStencilAttachment.stencilLoadOp=r.stencilLoadOp,i.depthStencilAttachment.stencilStoreOp=r.stencilStoreOp,i.depthStencilAttachment.stencilClearValue=r.stencilClearValue)}else i.depthStencilAttachment={...r};t.layerDescriptors.push(i)}}_updateDepthLayerDescriptors(e,t,n){for(let i=0;i<n.length;i++){const n=t.layerDescriptors[i];if(n.depthStencilAttachment){const t=n.depthStencilAttachment;e.depth&&(e.clearDepth?(t.depthClearValue=e.clearDepthValue,t.depthLoadOp=JF):t.depthLoadOp=ZF),e.stencil&&(e.clearStencil?(t.stencilClearValue=e.clearStencilValue,t.stencilLoadOp=JF):t.stencilLoadOp=ZF)}}}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 i=t.encoder;if(!0===this._isRenderCameraDepthArray(e)){const n=[];for(let e=0;e<t.bundleEncoders.length;e++){const i=t.bundleEncoders[e];n.push(i.finish())}for(let r=0;r<t.layerDescriptors.length;r++)if(r<n.length){const s=t.layerDescriptors[r],a=i.beginRenderPass(s);if(e.viewport){const{x:t,y:n,width:i,height:r,minDepth:s,maxDepth:o}=e.viewportValue;a.setViewport(t,n,i,r,s,o)}if(e.scissor){const{x:t,y:n,width:i,height:r}=e.scissorValue;a.setScissorRect(t,n,i,r)}a.executeBundles([n[r]]),a.end()}}else t.currentPass&&t.currentPass.end();if(n>0){const i=8*n;let r=this.occludedResolveCache.get(i);void 0===r&&(r=this.device.createBuffer({size:i,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(i,r));const s=this.device.createBuffer({size:i,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,r,0),t.encoder.copyBufferToBuffer(r,0,s,0,i),t.occlusionQueryBuffer=s,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),null!==e.textures){const t=e.textures;for(let e=0;e<t.length;e++){const n=t[e];!0===n.generateMipmaps&&this.textureUtils.generateMipmaps(n)}}}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:i}=t;if(n&&i){const e=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);const r=n.getMappedRange(),s=new BigUint64Array(r);for(let t=0;t<i.length;t++)s[t]===BigInt(0)&&e.add(i[t]);n.destroy(),t.occluded=e}}updateViewport(e){const{currentPass:t}=this.get(e),{x:n,y:i,width:r,height:s,minDepth:a,maxDepth:o}=e.viewportValue;t.setViewport(n,i,r,s,a,o)}getClearColor(){const e=super.getClearColor();return!0===this.renderer.alpha&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,i=null){const r=this.device,s=this.renderer;let a,o,l,u,c=[];if(e){const e=this.getClearColor();o={r:e.r,g:e.g,b:e.b,a:e.a}}if(null===i){l=s.depth,u=s.stencil;const t=this._getDefaultRenderPassDescriptor();if(e){c=t.colorAttachments;const e=c[0];e.clearValue=o,e.loadOp=JF,e.storeOp=KF}(l||u)&&(a=t.depthStencilAttachment)}else{l=i.depth,u=i.stencil;const r={loadOp:e?JF:ZF,clearValue:e?o:void 0};l&&(r.depthLoadOp=t?JF:ZF,r.depthClearValue=t?s.getClearDepth():void 0,r.depthStoreOp=KF),u&&(r.stencilLoadOp=n?JF:ZF,r.stencilClearValue=n?s.getClearStencil():void 0,r.stencilStoreOp=KF);const h=this._getRenderPassDescriptor(i,r);c=h.colorAttachments,a=h.depthStencilAttachment}l&&a&&(t?(a.depthLoadOp=JF,a.depthClearValue=s.getClearDepth(),a.depthStoreOp=KF):(a.depthLoadOp=ZF,a.depthStoreOp=KF)),u&&a&&(n?(a.stencilLoadOp=JF,a.stencilClearValue=s.getClearStencil(),a.stencilStoreOp=KF):(a.stencilLoadOp=ZF,a.stencilStoreOp=KF));const h=r.createCommandEncoder({label:"clear"});h.beginRenderPass({colorAttachments:c,depthStencilAttachment:a}).end(),r.queue.submit([h.finish()])}beginCompute(e){const t=this.get(e);t.frameCalls=this.renderer.info.compute.frameCalls;const n={label:"computeGroup_"+e.id};this.initTimestampQuery(cn.COMPUTE,this.getTimestampUID(e),n),t.cmdEncoderGPU=this.device.createCommandEncoder({label:"computeGroup_"+e.id}),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(n)}compute(e,t,n,i,r=null){const s=this.get(t),{passEncoderGPU:a}=this.get(e),o=this.get(i).pipeline;this.pipelineUtils.setPipeline(a,o);for(let u=0,c=n.length;u<c;u++){const e=n[u],t=this.get(e);a.setBindGroup(u,t.group)}let l;if(null===r&&(r=t.count),"number"==typeof r){const e=r;if(void 0===s.dispatchSize||s.count!==e){s.dispatchSize=[0,1,1],s.count=e;const n=t.workgroupSize;let i=n[0];for(let e=1;e<n.length;e++)i*=n[e];const r=Math.ceil(e/i),a=this.device.limits.maxComputeWorkgroupsPerDimension;l=[r,1,1],r>a&&(l[0]=Math.min(r,a),l[1]=Math.ceil(r/a)),s.dispatchSize=l}l=s.dispatchSize}else l=r;a.dispatchWorkgroups(l[0],l[1]||1,l[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}async waitForGPU(){await this.device.queue.onSubmittedWorkDone()}draw(e,t){const{object:n,material:i,context:r,pipeline:s}=e,a=e.getBindings(),o=this.get(r),l=this.get(s).pipeline,u=e.getIndex(),c=null!==u,h=e.getDrawParameters();if(null===h)return;const d=(t,n)=>{this.pipelineUtils.setPipeline(t,l),n.pipeline=l;const s=n.bindingGroups;for(let e=0,i=a.length;e<i;e++){const n=a[e],i=this.get(n);s[n.index]!==n.id&&(t.setBindGroup(n.index,i.group),s[n.index]=n.id)}if(!0===c&&n.index!==u){const e=this.get(u).buffer,i=u.array instanceof Uint16Array?iB:rB;t.setIndexBuffer(e,i),n.index=u}const h=e.getVertexBuffers();for(let e=0,i=h.length;e<i;e++){const i=h[e];if(n.attributes[e]!==i){const r=this.get(i).buffer;t.setVertexBuffer(e,r),n.attributes[e]=i}}!0===r.stencil&&!0===i.stencilWrite&&o.currentStencilRef!==i.stencilRef&&(t.setStencilReference(i.stencilRef),o.currentStencilRef=i.stencilRef)},p=(i,r)=>{if(d(i,r),!0===n.isBatchedMesh){const e=n._multiDrawStarts,r=n._multiDrawCounts,s=n._multiDrawCount,a=n._multiDrawInstances;null!==a&&Un("THREE.WebGPUBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.");for(let o=0;o<s;o++){const s=a?a[o]:1,l=s>1?0:o;!0===c?i.drawIndexed(r[o],s,e[o]/u.array.BYTES_PER_ELEMENT,0,l):i.draw(r[o],s,e[o],l),t.update(n,r[o],s)}}else if(!0===c){const{vertexCount:r,instanceCount:s,firstVertex:a}=h,o=e.getIndirect();if(null!==o){const e=this.get(o).buffer;i.drawIndexedIndirect(e,0)}else i.drawIndexed(r,s,a,0,0);t.update(n,r,s)}else{const{vertexCount:r,instanceCount:s,firstVertex:a}=h,o=e.getIndirect();if(null!==o){const e=this.get(o).buffer;i.drawIndirect(e,0)}else i.draw(r,s,a,0);t.update(n,r,s)}};if(e.camera.isArrayCamera&&e.camera.cameras.length>0){const t=this.get(e.camera),i=e.camera.cameras,s=e.getBindingGroup("cameraIndex");if(void 0===t.indexesGPU||t.indexesGPU.length!==i.length){const e=this.get(s),n=[],r=new Uint32Array([0,0,0,0]);for(let t=0,s=i.length;t<s;t++){r[0]=t;const i=this.bindingUtils.createBindGroupIndex(r,e.layout);n.push(i)}t.indexesGPU=n}const a=this.renderer.getPixelRatio();for(let e=0,l=i.length;e<l;e++){const l=i[e];if(n.layers.test(l.layers)){const n=l.viewport;let i=o.currentPass,u=o.currentSets;if(o.bundleEncoders){i=o.bundleEncoders[e],u=o.bundleSets[e]}n&&i.setViewport(Math.floor(n.x*a),Math.floor(n.y*a),Math.floor(n.width*a),Math.floor(n.height*a),r.viewportValue.minDepth,r.viewportValue.maxDepth),s&&t.indexesGPU&&(i.setBindGroup(s.index,t.indexesGPU[e]),u.bindingGroups[s.index]=s.id),p(i,u)}}}else if(o.currentPass){if(void 0!==o.occlusionQuerySet){const e=o.lastOcclusionObject;e!==n&&(null!==e&&!0===e.occlusionTest&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),!0===n.occlusionTest&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=n),o.lastOcclusionObject=n)}p(o.currentPass,o.currentSets)}}needsRenderUpdate(e){const t=this.get(e),{object:n,material:i}=e,r=this.utils,s=r.getSampleCountRenderContext(e.context),a=r.getCurrentColorSpace(e.context),o=r.getCurrentColorFormat(e.context),l=r.getCurrentDepthStencilFormat(e.context),u=r.getPrimitiveTopology(n,i);let c=!1;return t.material===i&&t.materialVersion===i.version&&t.transparent===i.transparent&&t.blending===i.blending&&t.premultipliedAlpha===i.premultipliedAlpha&&t.blendSrc===i.blendSrc&&t.blendDst===i.blendDst&&t.blendEquation===i.blendEquation&&t.blendSrcAlpha===i.blendSrcAlpha&&t.blendDstAlpha===i.blendDstAlpha&&t.blendEquationAlpha===i.blendEquationAlpha&&t.colorWrite===i.colorWrite&&t.depthWrite===i.depthWrite&&t.depthTest===i.depthTest&&t.depthFunc===i.depthFunc&&t.stencilWrite===i.stencilWrite&&t.stencilFunc===i.stencilFunc&&t.stencilFail===i.stencilFail&&t.stencilZFail===i.stencilZFail&&t.stencilZPass===i.stencilZPass&&t.stencilFuncMask===i.stencilFuncMask&&t.stencilWriteMask===i.stencilWriteMask&&t.side===i.side&&t.alphaToCoverage===i.alphaToCoverage&&t.sampleCount===s&&t.colorSpace===a&&t.colorFormat===o&&t.depthStencilFormat===l&&t.primitiveTopology===u&&t.clippingContextCacheKey===e.clippingContextCacheKey||(t.material=i,t.materialVersion=i.version,t.transparent=i.transparent,t.blending=i.blending,t.premultipliedAlpha=i.premultipliedAlpha,t.blendSrc=i.blendSrc,t.blendDst=i.blendDst,t.blendEquation=i.blendEquation,t.blendSrcAlpha=i.blendSrcAlpha,t.blendDstAlpha=i.blendDstAlpha,t.blendEquationAlpha=i.blendEquationAlpha,t.colorWrite=i.colorWrite,t.depthWrite=i.depthWrite,t.depthTest=i.depthTest,t.depthFunc=i.depthFunc,t.stencilWrite=i.stencilWrite,t.stencilFunc=i.stencilFunc,t.stencilFail=i.stencilFail,t.stencilZFail=i.stencilZFail,t.stencilZPass=i.stencilZPass,t.stencilFuncMask=i.stencilFuncMask,t.stencilWriteMask=i.stencilWriteMask,t.side=i.side,t.alphaToCoverage=i.alphaToCoverage,t.sampleCount=s,t.colorSpace=a,t.colorFormat=o,t.depthStencilFormat=l,t.primitiveTopology=u,t.clippingContextCacheKey=e.clippingContextCacheKey,c=!0),c}getRenderCacheKey(e){const{object:t,material:n}=e,i=this.utils,r=e.context,s=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,s,i.getSampleCountRenderContext(r),i.getCurrentColorSpace(r),i.getCurrentColorFormat(r),i.getCurrentDepthStencilFormat(r),i.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}createSampler(e){this.textureUtils.createSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}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){this.textureUtils.destroyTexture(e)}async copyTextureToBuffer(e,t,n,i,r,s){return this.textureUtils.copyTextureToBuffer(e,t,n,i,r,s)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new Mz(this.device,e,2048));const i=this.timestampQueryPool[e],r=i.allocateQueriesForContext(t);n.timestampWrites={querySet:i.querySet,beginningOfPassWriteIndex:r,endOfPassWriteIndex:r+1}}createNodeBuilder(e,t){return new gz(e,t)}createProgram(e){this.get(e).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),i=n.currentPass.finish();this.get(t).bundleGPU=i,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createBindings(e,t,n,i){this.bindingUtils.createBindings(e,t,n,i)}updateBindings(e,t,n,i){this.bindingUtils.createBindings(e,t,n,i)}updateBinding(e){this.bindingUtils.updateBinding(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.colorBuffer=this.textureUtils.getColorBuffer(),this.defaultRenderPassdescriptor=null}getMaxAnisotropy(){return 16}hasFeature(e){return this.device.features.has(e)}copyTextureToTexture(e,t,n=null,i=null,r=0,s=0){let a=0,o=0,l=0,u=0,c=0,h=0,d=e.image.width,p=e.image.height,m=1;null!==n&&(!0===n.isBox3?(u=n.min.x,c=n.min.y,h=n.min.z,d=n.max.x-n.min.x,p=n.max.y-n.min.y,m=n.max.z-n.min.z):(u=n.min.x,c=n.min.y,d=n.max.x-n.min.x,p=n.max.y-n.min.y,m=1)),null!==i&&(a=i.x,o=i.y,l=i.z||0);const f=this.device.createCommandEncoder({label:"copyTextureToTexture_"+e.id+"_"+t.id}),g=this.get(e).texture,_=this.get(t).texture;f.copyTextureToTexture({texture:g,mipLevel:r,origin:{x:u,y:c,z:h}},{texture:_,mipLevel:s,origin:{x:a,y:o,z:l}},[d,p,m]),this.device.queue.submit([f.finish()]),0===s&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){const i=this.get(t);let r=null;r=t.renderTarget?e.isDepthTexture?this.get(t.depthTexture).texture:this.get(t.textures[0]).texture:e.isDepthTexture?this.textureUtils.getDepthBuffer(t.depth,t.stencil):this.context.getCurrentTexture();const s=this.get(e).texture;if(r.format!==s.format)return;let a;if(i.currentPass?(i.currentPass.end(),a=i.encoder):a=this.device.createCommandEncoder({label:"copyFramebufferToTexture_"+e.id}),a.copyTextureToTexture({texture:r,origin:[n.x,n.y,0]},{texture:s},[n.z,n.w]),i.currentPass){const{descriptor:e}=i;for(let t=0;t<e.colorAttachments.length;t++)e.colorAttachments[t].loadOp=ZF;if(t.depth&&(e.depthStencilAttachment.depthLoadOp=ZF),t.stencil&&(e.depthStencilAttachment.stencilLoadOp=ZF),i.currentPass=a.beginRenderPass(e),i.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor){const{x:e,y:n,width:r,height:s}=t.scissorValue;
1i.currentPass.setScissorRect(e,n,r,s)}}else this.device.queue.submit([a.finish()]);e.generateMipmaps&&this.textureUtils.generateMipmaps(e)}}class Ez extends zu{constructor(e,t,n,i,r,s){super(e,t,n,i,r,s),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class Az extends zu{constructor(e,t,n,i,r,s){super(e,t,n,i,r,s),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}}class Rz extends wU{constructor(){super(),this.addMaterial(UA,"MeshPhongMaterial"),this.addMaterial(MC,"MeshStandardMaterial"),this.addMaterial(EC,"MeshPhysicalMaterial"),this.addMaterial(NC,"MeshToonMaterial"),this.addMaterial(AA,"MeshBasicMaterial"),this.addMaterial(DA,"MeshLambertMaterial"),this.addMaterial(mA,"MeshNormalMaterial"),this.addMaterial(LC,"MeshMatcapMaterial"),this.addMaterial(aA,"LineBasicMaterial"),this.addMaterial(lA,"LineDashedMaterial"),this.addMaterial(qC,"PointsMaterial"),this.addMaterial(FC,"SpriteMaterial"),this.addMaterial(HC,"ShadowMaterial"),this.addLight(bD,Wu),this.addLight(ZO,Yu),this.addLight(tU,Zu),this.addLight(nU,zu),this.addLight(aU,Ku),this.addLight(oU,Ou),this.addLight(lU,Qu),this.addLight(iU,Ez),this.addLight(sU,Az),this.addToneMapping(gI,1),this.addToneMapping(_I,2),this.addToneMapping(yI,3),this.addToneMapping(xI,4),this.addToneMapping(MI,6),this.addToneMapping(wI,7)}}class Cz extends WU{constructor(e={}){let t;e.forceWebGL?t=UF:(t=wz,e.getFallback=()=>new UF(e));super(new t(e),e),this.library=new Rz,this.isWebGPURenderer=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}mO.BRDF_GGX,mO.BRDF_Lambert,mO.BasicPointShadowFilter,mO.BasicShadowFilter,mO.Break,mO.Const,mO.Continue,mO.DFGApprox,mO.D_GGX,mO.Discard,mO.EPSILON,mO.F_Schlick;const Nz=mO.Fn;mO.INFINITY;const Pz=mO.If,Iz=mO.Loop;mO.NodeAccess,mO.NodeShaderStage,mO.NodeType,mO.NodeUpdateType,mO.PCFShadowFilter,mO.PCFSoftShadowFilter,mO.PI,mO.PI2,mO.PointShadowFilter,mO.Return,mO.Schlick_to_F0,mO.ScriptableNodeResources,mO.ShaderNode,mO.Stack,mO.Switch,mO.TBNViewMatrix,mO.VSMShadowFilter,mO.V_GGX_SmithCorrelated,mO.Var,mO.VarIntent,mO.abs,mO.acesFilmicToneMapping,mO.acos,mO.add,mO.addMethodChaining,mO.addNodeElement,mO.agxToneMapping,mO.all,mO.alphaT,mO.and,mO.anisotropy,mO.anisotropyB,mO.anisotropyT,mO.any,mO.append,mO.array,mO.arrayBuffer;const Lz=mO.asin;mO.assign,mO.atan,mO.atan2,mO.atomicAdd,mO.atomicAnd,mO.atomicFunc,mO.atomicLoad,mO.atomicMax,mO.atomicMin,mO.atomicOr,mO.atomicStore,mO.atomicSub,mO.atomicXor,mO.attenuationColor,mO.attenuationDistance,mO.attribute,mO.attributeArray,mO.backgroundBlurriness,mO.backgroundIntensity,mO.backgroundRotation,mO.batch,mO.bentNormalView,mO.billboarding,mO.bitAnd,mO.bitNot,mO.b
1itOr,mO.bitXor,mO.bitangentGeometry,mO.bitangentLocal,mO.bitangentView,mO.bitangentWorld,mO.bitcast,mO.blendBurn,mO.blendColor,mO.blendDodge,mO.blendOverlay,mO.blendScreen,mO.blur,mO.bool,mO.buffer,mO.bufferAttribute,mO.bumpMap,mO.burn,mO.builtin,mO.bvec2,mO.bvec3,mO.bvec4,mO.bypass,mO.cache,mO.call,mO.cameraFar,mO.cameraIndex,mO.cameraNear,mO.cameraNormalMatrix,mO.cameraPosition,mO.cameraProjectionMatrix,mO.cameraProjectionMatrixInverse,mO.cameraViewMatrix,mO.cameraViewport,mO.cameraWorldMatrix,mO.cbrt,mO.cdl,mO.ceil,mO.checker,mO.cineonToneMapping,mO.clamp,mO.clearcoat,mO.clearcoatNormalView,mO.clearcoatRoughness,mO.code,mO.color,mO.colorSpaceToWorking,mO.colorToDirection,mO.compute,mO.computeKernel,mO.computeSkinning,mO.context,mO.convert,mO.convertColorSpace,mO.convertToTexture;const Dz=mO.cos;mO.cross,mO.cubeTexture,mO.cubeTextureBase,mO.cubeToUV,mO.dFdx,mO.dFdy,mO.dashSize,mO.debug,mO.decrement,mO.decrementBefore,mO.defaultBuildStages,mO.defaultShaderStages,mO.defined,mO.degrees,mO.deltaTime,mO.densityFog,mO.densityFogFactor,mO.depth,mO.depthPass,mO.determinant,mO.difference,mO.diffuseColor,mO.directPointLight,mO.directionToColor,mO.directionToFaceDirection,mO.dispersion,mO.distance,mO.div,mO.dodge,mO.dot,mO.drawIndex,mO.dynamicBufferAttribute,mO.element,mO.emissive,mO.equal,mO.equals,mO.equirectUV;const Oz=mO.exp;mO.exp2,mO.expression,mO.faceDirection,mO.faceForward,mO.faceforward;const Uz=mO.float;mO.floatBitsToInt,mO.floatBitsToUint,mO.floor,mO.fog,mO.fract,mO.frameGroup,mO.frameId,mO.frontFacing,mO.fwidth,mO.gain,mO.gapSize,mO.getConstNodeType,mO.getCurrentStack,mO.getDirection,mO.getDistanceAttenuation,mO.getGeometryRoughness,mO.getNormalFromDepth,mO.getParallaxCorrectNormal,mO.getRoughness,mO.getScreenPosition,mO.getShIrradianceAt,mO.getShadowMaterial,mO.getShadowRenderObjectFunction,mO.getTextureIndex,mO.getViewPosition,mO.globalId,mO.glsl,mO.glslFn,mO.grayscale,mO.greaterThan,mO.greaterThanEqual,mO.hash,mO.highpModelNormalViewMatrix,mO.highpModelViewMatrix,mO.hue,mO.increment,mO.incrementBefore,mO.instance;const Fz=mO.instanceIndex;mO.instancedArray,mO.instancedBufferAttribute,mO.instancedDynamicBufferAttribute,mO.instancedMesh,mO.int,mO.intBitsToFloat,mO.inverse,mO.inverseSqrt,mO.inversesqrt,mO.invocationLocalIndex,mO.invocationSubgroupIndex,mO.ior,mO.iridescence,mO.iridescenceIOR,mO.iridescenceThickness,mO.ivec2,mO.ivec3,mO.ivec4,mO.js,mO.label,mO.length,mO.lengthSq,mO.lessThan,mO.lessThanEqual,mO.lightPosition,mO.lightProjectionUV,mO.lightShadowMatrix,mO.lightTargetDirection,mO.lightTargetPosition,mO.lightViewPosition,mO.lightingContext,mO.lights,mO.linearDepth,mO.linearToneMapping,mO.localId,mO.log,mO.log2,mO.logarithmicDepthToViewZ,mO.luminance,mO.mat2,mO.mat3,mO.mat4,mO.matcapUV,mO.materialAO,mO.materialAlphaTest,mO.materialAnisotropy,mO.materialAnisotropyVector,mO.materialAttenuationColor,mO.materialAttenuationDistance,mO.materialClearcoat,mO.materialClearcoatNormal,mO.materialClearcoatRoughness,mO.materialColor,mO.materialDispersion,mO.materialEmissive,mO.materialEnvIntensity,mO.materialEnvRotation,mO.materialIOR,mO.materialIridescence,mO.materialIridescenceIOR,mO.materialIridescenceThickness,mO.materialLightMap,mO.materialLineDashOffset,mO.materialLineDashSize,mO.materialLineGapSize,mO.materialLineScale,mO.materialLineWidth,mO.materialMetalness,mO.materialNormal,mO.materialOpacity,mO.materialPointSize,mO.materialReference,mO.materialReflectivity,mO.materialRefractionRatio,mO.materialRotation,mO.materialRoughness,mO.materialSheen,mO.materialSheenRoughness,mO.materialShininess,mO.materialSpecular,mO.materialSpecularColor,mO.materialSpecularIntensity,mO.materialSpecularStrength,mO.materialThickness,mO.materialTransmission,mO.max,mO.maxMipLevel,mO.mediumpModelViewMatrix,mO.metalness,mO.min,mO.mix,mO.mixElement,mO.mod,mO.modInt,mO.modelDirection,mO.modelNormalMatrix,mO.modelPosition,mO.modelRadius,mO.modelScale,mO.modelViewMatrix,mO.modelViewPosition,mO.modelViewProjection,mO.modelWorldMatrix,mO.modelWorldMatrixInverse,mO.morphReference,mO.mrt,mO.mul,mO.mx_aastep,mO.mx_add,mO.mx_atan2,mO.mx_cell_noise_float,mO.mx_contrast,mO.mx_divide,mO.mx_fractal_noise_float,mO.mx_fractal_noise_vec2,mO.mx_fractal_noise_vec3,mO.mx_fractal_noise_vec4,mO.mx_frame,mO.mx_heighttonormal,mO.mx_hsvtorgb,mO.mx_ifequal,mO.mx_ifgreater,mO.mx_ifgreatereq,mO.mx_invert,mO.mx_modulo,mO.mx_multiply,mO.mx_noise_float,mO.mx_noise_vec3,mO.mx_noise_vec4,mO.mx_place2d,mO.mx_power,mO.mx_ramp4,mO.mx_ramplr,mO.mx_ramptb,mO.mx_rgbtohsv,mO.mx_rotate2d,mO.mx_rotate3d,mO.mx_safepower,mO.mx_separate,mO.mx_splitlr,mO.mx_splittb,mO.mx_srgb_texture_to_lin_rec709,mO.mx_subtract,mO.mx_timer,mO.mx_transform_uv,mO.mx_unifiednoise2d,mO.mx_unifiednoise3d,mO.mx_
vendor: 6,441 bytes, line 1
1worley_noise_float,mO.mx_worley_noise_vec2,mO.mx_worley_noise_vec3;const Bz=mO.negate;mO.neutralToneMapping,mO.nodeArray,mO.nodeImmutable,mO.nodeObject,mO.nodeObjectIntent,mO.nodeObjects,mO.nodeProxy,mO.nodeProxyIntent,mO.normalFlat,mO.normalGeometry,mO.normalLocal,mO.normalMap,mO.normalView,mO.normalViewGeometry,mO.normalWorld,mO.normalWorldGeometry,mO.normalize,mO.not,mO.notEqual,mO.numWorkgroups,mO.objectDirection,mO.objectGroup,mO.objectPosition,mO.objectRadius,mO.objectScale,mO.objectViewPosition,mO.objectWorldMatrix,mO.OnObjectUpdate,mO.OnMaterialUpdate,mO.oneMinus,mO.or,mO.orthographicDepthToViewZ,mO.oscSawtooth,mO.oscSine,mO.oscSquare,mO.oscTriangle,mO.output,mO.outputStruct,mO.overlay,mO.overloadingFn,mO.parabola,mO.parallaxDirection,mO.parallaxUV,mO.parameter,mO.pass,mO.passTexture,mO.pcurve,mO.perspectiveDepthToViewZ,mO.pmremTexture,mO.pointShadow,mO.pointUV,mO.pointWidth,mO.positionGeometry,mO.positionLocal,mO.positionPrevious,mO.positionView,mO.positionViewDirection,mO.positionWorld,mO.positionWorldDirection,mO.posterize,mO.pow,mO.pow2,mO.pow3,mO.pow4,mO.premultiplyAlpha,mO.property,mO.radians,mO.rand,mO.range,mO.rangeFog,mO.rangeFogFactor,mO.reciprocal,mO.reference,mO.referenceBuffer,mO.reflect,mO.reflectVector,mO.reflectView,mO.reflector,mO.refract,mO.refractVector,mO.refractView,mO.reinhardToneMapping,mO.remap,mO.remapClamp,mO.renderGroup,mO.renderOutput,mO.rendererReference,mO.rotate,mO.rotateUV,mO.roughness,mO.round,mO.rtt,mO.sRGBTransferEOTF,mO.sRGBTransferOETF,mO.sample,mO.sampler,mO.samplerComparison,mO.saturate,mO.saturation,mO.screen,mO.screenCoordinate,mO.screenDPR,mO.screenSize,mO.screenUV,mO.scriptable,mO.scriptableValue,mO.select,mO.setCurrentStack,mO.setName,mO.shaderStages,mO.shadow,mO.shadowPositionWorld,mO.shapeCircle,mO.sharedUniformGroup,mO.sheen,mO.sheenRoughness,mO.shiftLeft,mO.shiftRight,mO.shininess,mO.sign;const Vz=mO.sin;mO.sinc,mO.skinning,mO.smoothstep,mO.smoothstepElement,mO.specularColor,mO.specularF90,mO.spherizeUV,mO.split,mO.spritesheetUV;const qz=mO.sqrt;mO.stack,mO.step,mO.stepElement;const zz=mO.storage;mO.storageBarrier,mO.storageObject,mO.storageTexture,mO.string,mO.struct,mO.sub,mO.subgroupAdd,mO.subgroupAll,mO.subgroupAnd,mO.subgroupAny,mO.subgroupBallot,mO.subgroupBroadcast,mO.subgroupBroadcastFirst,mO.subBuild,mO.subgroupElect,mO.subgroupExclusiveAdd,mO.subgroupExclusiveMul,mO.subgroupInclusiveAdd,mO.subgroupInclusiveMul,mO.subgroupIndex,mO.subgroupMax,mO.subgroupMin,mO.subgroupMul,mO.subgroupOr,mO.subgroupShuffle,mO.subgroupShuffleDown,mO.subgroupShuffleUp,mO.subgroupShuffleXor,mO.subgroupSize,mO.subgroupXor,mO.tan,mO.tangentGeometry,mO.tangentLocal,mO.tangentView,mO.tangentWorld,mO.texture,mO.texture3D,mO.textureBarrier,mO.textureBicubic,mO.textureBicubicLevel,mO.textureCubeUV,mO.textureLoad,mO.textureSize,mO.textureStore,mO.thickness,mO.time,mO.toneMapping,mO.toneMappingExposure,mO.toonOutlinePass,mO.transformDirection,mO.transformNormal,mO.transformNormalToView,mO.transformedClearcoatNormalView,mO.transformedNormalView,mO.transformedNormalWorld,mO.transmission,mO.transpose,mO.triNoise3D,mO.triplanarTexture,mO.triplanarTextures,mO.trunc,mO.uint,mO.uintBitsToFloat;const kz=mO.uniform;mO.uniformArray,mO.uniformCubeTexture,mO.uniformGroup,mO.uniformFlow,mO.uniformTexture,mO.unpremultiplyAlpha,mO.userData,mO.uv,mO.uvec2,mO.uvec3,mO.uvec4,mO.varying,mO.varyingProperty,mO.vec2,mO.vec3,mO.vec4,mO.vectorComponents,mO.velocity,mO.vertexColor,mO.vertexIndex,mO.vertexStage,mO.vibrance,mO.viewZToLogarithmicDepth,mO.viewZToOrthographicDepth,mO.viewZToPerspectiveDepth,mO.viewport,mO.viewportCoordinate,mO.viewportDepthTexture,mO.viewportLinearDepth,mO.viewportMipTexture,mO.viewportResolution,mO.viewportSafeUV,mO.viewportSharedTexture,mO.viewportSize,mO.viewportTexture,mO.viewportUV,mO.wgsl,mO.wgslFn,mO.workgroupArray,mO.workgroupBarrier,mO.workgroupId,mO.workingToColorSpace,mO.xor;const Gz=new ni,Hz=new wn;class jz extends nc{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new Fr([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new Fr([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new Fc(t,6,1);return this.setAttribute("instanceStart",new Rs(n,3,0)),this.setAttribute("instanceEnd",new Rs(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 Fc(t,6,1);return this.setAttribute("instanceColorStart",new Rs(n,3,0)),this.setAttribute("instanceColorEnd",new Rs(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 Hl(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new ni);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),Gz.setFromBufferAttribute(t),this.boundingBox.union(Gz))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new xi),null===this.boundingBox&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let r=0,s=e.count;r<s;r++)Hz.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Hz)),Hz.fromBufferAttribute(t,r),i=Math.max(i,n.distanceToSquared(Hz));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)}}toJSON(){}}Mh.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Sn(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},wh.line={uniforms:us.merge([Mh.common,Mh.fog,Mh
vendor: 9,152 bytes, line 1
1.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tfloat alpha = opacity;\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class
vendor: 6,337 bytes, line 1
1Wz extends cs{constructor(e){super({type:"LineMaterial",uniforms:us.clone(wh.line.uniforms),vertexShader:wh.line.vertexShader,fragmentShader:wh.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){!0===e?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){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?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&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const Xz=new Zn,$z=new wn,Yz=new wn,Kz=new Zn,Zz=new Zn,Jz=new Zn,Qz=new wn,ek=new Ci,tk=new Qc,nk=new wn,ik=new ni,rk=new xi,sk=new Zn;let ak,ok;function lk(e,t,n){return sk.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),sk.multiplyScalar(1/sk.w),sk.x=ok/n.width,sk.y=ok/n.height,sk.applyMatrix4(e.projectionMatrixInverse),sk.multiplyScalar(1/sk.w),Math.abs(Math.max(sk.x,sk.y))}class uk extends is{constructor(e=new jz,t=new Wz({color:16777215*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let s=0,a=0,o=t.count;s<o;s++,a+=2)$z.fromBufferAttribute(t,s),Yz.fromBufferAttribute(n,s),i[a]=0===a?0:i[a-1],i[a+1]=i[a]+$z.distanceTo(Yz);const r=new Fc(i,2,1);return e.setAttribute("instanceDistanceStart",new Rs(r,1,0)),e.setAttribute("instanceDistanceEnd",new Rs(r,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera,r=void 0!==e.params.Line2&&e.params.Line2.threshold||0;ak=e.ray;const s=this.matrixWorld,a=this.geometry,o=this.material;let l,u;if(ok=o.linewidth+r,null===a.boundingSphere&&a.computeBoundingSphere(),rk.copy(a.boundingSphere).applyMatrix4(s),n)l=.5*ok;else{l=lk(i,Math.max(i.near,rk.distanceToPoint(ak.origin)),o.resolution)}if(rk.radius+=l,!1!==ak.intersectsSphere(rk)){if(null===a.boundingBox&&a.computeBoundingBox(),ik.copy(a.boundingBox).applyMatrix4(s),n)u=.5*ok;else{u=lk(i,Math.max(i.near,ik.distanceToPoint(ak.origin)),o.resolution)}ik.expandByScalar(u),!1!==ak.intersectsBox(ik)&&(n?function(e,t){const n=e.matrixWorld,i=e.geometry,r=i.attributes.instanceStart,s=i.attributes.instanceEnd;for(let a=0,o=Math.min(i.instanceCount,r.count);a<o;a++){tk.start.fromBufferAttribute(r,a),tk.end.fromBufferAttribute(s,a),tk.applyMatrix4(n);const i=new wn,o=new wn;ak.distanceSqToSegment(tk.start,tk.end,o,i),o.distanceTo(i)<.5*ok&&t.push({point:o,pointOnLine:i,distance:ak.origin.distanceTo(o),object:e,face:null,faceIndex:a,uv:null,uv1:null})}}(this,t):function(e,t,n){const i=t.projectionMatrix,r=e.material.resolution,s=e.matrixWorld,a=e.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,u=Math.min(a.instanceCount,o.count),c=-t.near;ak.at(1,Jz),Jz.w=1,Jz.applyMatrix4(t.matrixWorldInverse),Jz.applyMatrix4(i),Jz.multiplyScalar(1/Jz.w),Jz.x*=r.x/2,Jz.y*=r.y/2,Jz.z=0,Qz.copy(Jz),ek.multiplyMatrices(t.matrixWorldInverse,s);for(let h=0,d=u;h<d;h++){if(Kz.fromBufferAttribute(o,h),Zz.fromBufferAttribute(l,h),Kz.w=1,Zz.w=1,Kz.applyMatrix4(ek),Zz.applyMatrix4(ek),Kz.z>c&&Zz.z>c)continue;if(Kz.z>c){const e=Kz.z-Zz.z,t=(Kz.z-c)/e;Kz.lerp(Zz,t)}else if(Zz.z>c){const e=Zz.z-Kz.z,t=(Zz.z-c)/e;Zz.lerp(Kz,t)}Kz.applyMatrix4(i),Zz.applyMatrix4(i),Kz.multiplyScalar(1/Kz.w),Zz.multiplyScalar(1/Zz.w),Kz.x*=r.x/2,Kz.y*=r.y/2,Zz.x*=r.x/2,Zz.y*=r.y/2,tk.start.copy(Kz),tk.start.z=0,tk.end.copy(Zz),tk.end.z=0;const t=tk.closestPointToPointParameter(Qz,!0);tk.at(t,nk);const a=Tn.lerp(Kz.z,Zz.z,t),u=a>=-1&&a<=1,d=Qz.distanceTo(nk)<.5*ok;if(u&&d){tk.start.fromBufferAttribute(o,h),tk.end.fromBufferAttribute(l,h),tk.start.applyMatrix4(s),tk.end.applyMatrix4(s);const t=new wn,i=new wn;ak.distanceSqToSegment(tk.start,tk.end,i,t),n.push({point:i,pointOnLine:t,distance:ak.origin.distanceTo(i),object:e,face:null,faceIndex:h,uv:null,uv1:null})}}}(this,i,t))}}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Xz),this.material.uniforms.resolution.value.set(Xz.z,Xz.w))}}class ck extends jz{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setColors(n),this}setFromPoints(e){const t=e.length-1,n=new Float32Array(6*t);for(let i=0;i<t;i++)n[6*i]=e[i].x,n[6*i+1]=e[i].y,n[6*i+2]=e[i].z||0,n[6*i+3]=e[i+1].x,n[6*i+4]=e[i+1].y,n[6*i+5]=e[i+1].z||0;return super.setPositions(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class hk extends uk{constructor(e=new ck,t=new Wz({color:16777215*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}class dk extends Pl{constructor(e,t={}){const n=t.font;if(void 0===n)super();else{const i=n.generateShapes(e,t.size);void 0===t.depth&&(t.depth=50),void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),super(i,t)}
vendor: 4,127 bytes, line 1
1this.type="TextGeometry"}}function pk(e,t,n,i,r){const s=r.glyphs[e]||r.glyphs["?"];if(!s)return;const a=new yh;let o,l,u,c,h,d,p,m;if(s.o){const e=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let r=0,s=e.length;r<s;){switch(e[r++]){case"m":o=e[r++]*t+n,l=e[r++]*t+i,a.moveTo(o,l);break;case"l":o=e[r++]*t+n,l=e[r++]*t+i,a.lineTo(o,l);break;case"q":u=e[r++]*t+n,c=e[r++]*t+i,h=e[r++]*t+n,d=e[r++]*t+i,a.quadraticCurveTo(h,d,u,c);break;case"b":u=e[r++]*t+n,c=e[r++]*t+i,h=e[r++]*t+n,d=e[r++]*t+i,p=e[r++]*t+n,m=e[r++]*t+i,a.bezierCurveTo(h,d,p,m,u,c)}}}return{offsetX:s.ha*t,path:a}}function mk(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function fk(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function gk(e,t,n,i,r,s,a){try{var o=e[s](a),l=o.value}catch(u){return void n(u)}o.done?t(l):Promise.resolve(l).then(i,r)}function _k(e,t,n){return t=Ek(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Rk()?Reflect.construct(t,n||[],Ek(e).constructor):t.apply(e,n))}function yk(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vk(e,t){return e.get(fk(e,t))}function xk(e,t,n){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,n)}function bk(e,t,n){return e.set(fk(e,t),n),n}function Tk(e,t,n){if(Rk())return Reflect.construct.apply(null,arguments);var i=[null];return i.push.apply(i,t),new(e.bind.apply(e,i))}function Sk(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Fk(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mk(e,t,n){return(t=Fk(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wk(){return wk="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ek(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},wk.apply(null,arguments)}function Ek(e){return(Ek=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ak(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lk(e,t)}function Rk(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Rk=function(){return!!e})()}function Ck(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function Nk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ck(Object(n),!0).forEach(function(t){Mk(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ck(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Pk(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function s(n,i,r,s){var l=i&&i.prototype instanceof o?i:o,u=Object.create(l.prototype);return Ik(u,"_invoke",function(n,i,r){var s,o,l,u=0,c=r||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return s=t,o=0,l=e,d.n=n,a}};function p(n,i){for(o=n,l=i,t=0;!h&&u&&!r&&t<c.length;t++){var r,s=c[t],p=d.p,m=s[2];n>
vendor: 5,599 bytes, line 1
13?(r=m===i)&&(l=s[(o=s[4])?5:(o=3,3)],s[4]=s[5]=e):s[0]<=p&&((r=n<2&&p<s[1])?(o=0,d.v=i,d.n=s[1]):p<m&&(r=n<3||s[0]>i||i>m)&&(s[4]=n,s[5]=i,d.n=m,o=0))}if(r||n>1)return a;throw h=!0,i}return function(r,c,m){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,m),o=c,l=m;(t=o<2?e:l)||!h;){s||(o?o<3?(o>1&&(d.n=-1),p(o,l)):d.n=l:d.v=l);try{if(u=2,s){if(o||(r="next"),t=s[r]){if(!(t=t.call(s,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,o<2&&(o=0)}else 1===o&&(t=s.return)&&t.call(s),o<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),o=1);s=e}else if((t=(h=d.n<0)?l:n.call(i,d))!==a)break}catch(f){s=e,o=1,l=f}finally{u=1}}return{value:t,done:h}}}(n,r,s),!0),u}var a={};function o(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(Ik(t={},i,function(){return this}),t),h=u.prototype=o.prototype=Object.create(c);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Ik(e,r,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,Ik(h,"constructor",u),Ik(u,"constructor",l),l.displayName="GeneratorFunction",Ik(u,r,"GeneratorFunction"),Ik(h),Ik(h,r,"Generator"),Ik(h,i,function(){return this}),Ik(h,"toString",function(){return"[object Generator]"}),(Pk=function(){return{w:s,m:d}})()}function Ik(e,t,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(s){r=0}(Ik=function(e,t,n,i){function s(t,n){Ik(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(s("next",0),s("throw",1),s("return",2))})(e,t,n,i)}function Lk(e,t){return(Lk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Dk(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=s.call(n)).done)&&(o.push(i.value),o.length!==t);l=!0);}catch(c){u=!0,r=c}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return o}}(e,t)||Bk(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ok(e,t,n,i){var r=wk(Ek(e.prototype),t,n);return"function"==typeof r?function(e){return r.apply(n,e)}:r}function Uk(e){return function(e){if(Array.isArray(e))return mk(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Bk(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fk(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function Bk(e,t){if(e){if("string"==typeof e)return mk(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mk(e,t):void 0}}var Vk=function(e){e instanceof Array?e.forEach(Vk):(e.map&&e.map.dispose(),e.dispose())},qk=function(e){e.geometry&&e.geometry.dispose(),e.material&&Vk(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(qk)},zk=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),qk(t)}};function kk(e,t){var n=new t;return{linkProp:function(t){return{default:n[t](),onChange:function(n,i){i[e][t](n)},triggerUpdate:!1}},linkMethod:function(t){return function(n){for(var i=n[e],r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];var o=i[t].apply(i,s);return o===i?this:o}}}}var Gk=100;function Hk(){return Gk}function jk(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=(90-e)*Math.PI/180,r=(90-t)*Math.PI/180,s=Gk*(1+n),a=Math.sin(i);return{x:s*a*Math.cos(r),y:s*Math.cos(i),z:s*a*Math.sin(r)}}function Wk(e){var t=e.x,n=e.y,i=e.z,r=Math.sqrt(t*t+n*n+i*i),s=Math.acos(n/r),a=Math.atan2(i,t);return{lat:90-180*s/Math.PI,lng:90-180*a/Math.PI-(a<-Math.PI/2?360:0),altitude:r/Gk-1}}function Xk(e){return e*Math.PI/180}var $k=window.THREE?window.THREE:{BackSide:1,BufferAttribute:Lr,Color:br,Mesh:is,ShaderMaterial:cs};var Yk=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.color,s=void 0===r?"gold":r,a=i.size,o=void 0===a?2:a,l=i.coefficient,u=void 0===l?.5:l,c=i.power,h=void 0===c?1:c,d=i.hollowRadius,p=void 0===d?0:d,m=i.backside,f=void 0===m||m;yk(this,e),n=_k(this,e);var g=function(e,t){for(var n=e.clone(),i=new Float32Array(3*e.attributes.position.count),r=0,s=i.length;r<s;r++){var a=e.attributes.normal.array[r],o=e.attributes.position.array[r];i[r]=o+a*t}return n.setAttribute("position",new $k.BufferAttribute(i,3)),n}(t,o),_=function(e,t,n,i){return new $k.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:"\nuniform float hollowRadius;\n\nvarying vec3 vVertexWorldPosition;\nvarying vec3 vVertexNormal;\nvarying float vCameraDistanceToObjCenter;\nvarying float vVertexAngularDistanceToHollowRadius;\n\nvoid main() { \n vVertexNormal\t= normalize(normalMatrix * normal);
1\n vVertexWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;\n \n vec4 objCenterViewPosition = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n vCameraDistanceToObjCenter = length(objCenterViewPosition);\n \n float edgeAngle = atan(hollowRadius / vCameraDistanceToObjCenter);\n float vertexAngle = acos(dot(normalize(modelViewMatrix * vec4(position, 1.0)), normalize(objCenterViewPosition)));\n vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle;\n\n gl_Position\t= projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",fragmentShader:"\nuniform vec3 color;\nuniform float coefficient;\nuniform float power;\nuniform float hollowRadius;\n\nvarying vec3 vVertexNormal;\nvarying vec3 vVertexWorldPosition;\nvarying float vCameraDistanceToObjCenter;\nvarying float vVertexAngularDistanceToHollowRadius;\n\nvoid main() {\n if (vCameraDistanceToObjCenter < hollowRadius) discard; // inside the hollowRadius\n if (vVertexAngularDistanceToHollowRadius < 0.0) discard; // frag position is within the hollow radius\n\n vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition;\n vec3 viewCameraToVertex\t= (viewMatrix * vec4(worldCameraToVertex, 0.0)).xyz;\n viewCameraToVertex = normalize(viewCameraToVertex);\n float intensity\t= pow(\n coefficient + dot(vVertexNormal, viewCameraToVertex),\n power\n );\n gl_FragColor = vec4(color, intensity);\n}",uniforms:{coefficient:{value:e},color:{value:new $k.Color(t)},power:{value:n},hollowRadius:{value:i}}})}(u,s,h,p);return f&&(_.side=$k.BackSide),n.geometry=g,n.material=_,n}return Ak(e,$k.Mesh),Sk(e)}(),Kk=window.THREE?window.THREE:{Color:br,Group:xs,LineBasicMaterial:$a,LineSegments:ao,Mesh:is,MeshPhongMaterial:Zl,SphereGeometry:Vl,SRGBColorSpace:Ht,TextureLoader:Lu},Zk=g({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 void 0!==t?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){zk(e.globeObj),zk(e.tileEngine),zk(e.graticulesObj)}},stateInit:function(){var e=new Kk.MeshPhongMaterial({color:0}),t=new Kk.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new wg(Gk),i=new Kk.Group;return i.__globeObjType="globe",i.add(t),i.add(n),{globeGroup:i,globeObj:t,graticulesObj:new Kk.LineSegments(new Vg(_(),Gk,2),new Kk.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1})),defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){zk(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 i;null===(i=e.globeObj.geometry)||void 0===i||i.dispose();var r=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new Kk.SphereGeometry(Gk,r,r/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?(new Kk.TextureLoader).load(e.globeImageUrl,function(t){t.colorSpace=Kk.SRGBColorSpace,n.map=t,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new Kk.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&(new Kk.TextureLoader).load(e.bumpImageUrl,function(e){n.bumpMap=e,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),zk(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var s=e.atmosphereObj=new Yk(e.globeObj.geometry,{color:e.atmosphereColor,size:Gk*e.atmosphereAltitude,hollowRadius:Gk,coefficient:.1,power:3.5});
vendor: 8,419 bytes, line 1
1s.visible=!!e.showAtmosphere,s.__globeObjType="atmosphere",e.scene.add(s)}e.ready||e.globeImageUrl&&!e.globeTileEngineUrl||(e.ready=!0,e.onReady())}}),Jk=function(e){return isNaN(e)?parseInt(P(e).toHex(),16):e},Qk=function(e){return e&&isNaN(e)?N(e).opacity:1},eG=function(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=1,s=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(s){var a=Dk(s.slice(1),4),o=a[0],l=a[1],u=a[2],c=a[3];t=new br("rgb(".concat(+o,",").concat(+l,",").concat(+u,")")),r=Math.min(+c,1)}else t=new br(e);i&&t.convertLinearToSRGB();var h=t.toArray();return n?[].concat(Uk(h),[r]):h};var tG=window.THREE?window.THREE:{BufferAttribute:Lr};function nG(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float32Array;if(1===t)return new tG.BufferAttribute(new n(e),t);for(var i=new tG.BufferAttribute(new n(e.length*t),t),r=0,s=e.length;r<s;r++)i.set(e[r],r*t);return i}var iG=new WeakMap,rG=new WeakMap,sG=new WeakMap,aG=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.dataBindAttr,s=void 0===r?"__data":r,a=i.objBindAttr,o=void 0===a?"__threeObj":a,l=i.removeDelay,u=void 0===l?0:l;return yk(this,e),Mk(n=_k(this,e),"scene",void 0),xk(n,iG,void 0),xk(n,rG,void 0),xk(n,sG,void 0),n.scene=t,bk(iG,n,s),bk(rG,n,o),bk(sG,n,u),n.onRemoveObj(function(){}),n}return Ak(e,I),Sk(e,[{key:"onCreateObj",value:function(t){var n=this;return Ok(e,"onCreateObj",this)([function(e){var i=t(e);return e[vk(rG,n)]=i,i[vk(iG,n)]=e,n.scene.add(i),i}]),this}},{key:"onRemoveObj",value:function(t){var n=this;return Ok(e,"onRemoveObj",this)([function(i,r){var s=Ok(e,"getData",n)([i]);t(i,r);var a=function(){n.scene.remove(i),zk(i),delete s[vk(rG,n)]};vk(sG,n)?setTimeout(a,vk(sG,n)):a()}]),this}}])}(),oG=window.THREE?window.THREE:{BufferGeometry:jr,CylinderGeometry:So,Matrix4:Ci,Mesh:is,MeshLambertMaterial:eu,Object3D:nr,Vector3:wn},lG=Object.assign({},lm),uG=lG.BufferGeometryUtils||lG,cG=g({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 i=n.tweenGroup;zk(e),t.scene=e,t.tweenGroup=i,t.dataMapper=new aG(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=y(e.pointLat),i=y(e.pointLng),r=y(e.pointAltitude),s=y(e.pointRadius),a=y(e.pointColor),o=new oG.CylinderGeometry(1,1,1,e.pointResolution);o.applyMatrix4((new oG.Matrix4).makeRotationX(Math.PI/2)),o.applyMatrix4((new oG.Matrix4).makeTranslation(0,0,-.5));var l=2*Math.PI*Gk/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&zk(e.scene),e.dataMapper.scene=e.pointsMerge?new oG.Object3D:e.scene,e.dataMapper.onCreateObj(function(){var e=new oG.Mesh(o);return e.__globeObjType="point",e}).onUpdateObj(function(t,o){var c=function(n){var i=t.__currentTargetD=n,r=i.r,s=i.alt,a=i.lat,o=i.lng;Object.assign(t.position,jk(a,o));var u=e.pointsMerge?new oG.Vector3(0,0,0):e.scene.localToWorld(new oG.Vector3(0,0,0));t.lookAt(u),t.scale.x=t.scale.y=Math.min(30,r)*l,t.scale.z=Math.max(s*Gk,.1)},h={alt:+r(o),r:+s(o),lat:+n(o),lng:+i(o)},d=t.__currentTargetD||Object.assign({},h,{alt:-.001});Object.keys(h).some(function(e){return d[e]!==h[e]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?c(h):e.tweenGroup.add(new v(d).to(h,e.pointsTransitionDuration).easing(x.Quadratic.InOut).onUpdate(c).start()));if(!e.pointsMerge){var p=a(o),m=p?Qk(p):0,f=!!m;t.visible=f,f&&(u.hasOwnProperty(p)||(u[p]=new oG.MeshLambertMaterial({color:Jk(p),transparent:m<1,opacity:m})),t.material=u[p])}}).digest(e.pointsData),e.pointsMerge){var c=e.pointsData.length?(uG.mergeGeometries||uG.mergeBufferGeometries)(e.pointsData.map(function(t){var n=e.dataMapper.getObj(t),i=n.geometry.clone();n.updateMatrix(),i.applyMatrix4(n.matrix);var r=eG(a(t));return i.setAttribute("color",nG(Array(i.getAttribute("position").count).fill(r),4)),i})):new oG.BufferGeometry,h=new oG.Mesh(c,new oG.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));h.__globeObjType="points",h.__data=e.pointsData,e.dataMapper.clear(),zk(e.scene),e.scene.add(h)}}}),hG=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:"\n ".concat(Sh.common,"\n ").concat(Sh.logdepthbuf_pars_vertex,"\n \n uniform float dashTranslate; \n\n attribute vec4 color;\n varying vec4 vColor;\n \n attribute float relDistance;\n varying float vRelDistance;\n\n void main() {\n // pass through colors and distances\n vColor = color;\n vRelDistance = relDistance + dashTranslate;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n \n ").concat(Sh.logdepthbuf_vertex,"\n }\n "),fragmentShader:"\n ".concat(Sh.logdepthbuf_pars_fragment,"\n\n uniform float dashOffset; \n uniform float dashSize;\n uniform float gapSize; \n \n varying vec4 vColor;\n varying float vRelDistance;\n \n void main() {\n // ignore pixels in the gap\n if (vRelDistance < dashOffset) discard;\n if (mod(vRelDistance - dashOffset, dashSize + gapSize) > dashSize) discard;\n \n // set px color: [r, g, b, a], interpolated between vertices \n gl_FragColor = vColor; \n \n ").concat(Sh.logdepthbuf_fragment,"\n }\n ")}},dG=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=("attribute float surfaceRadius;\nvarying float vSurfaceRadius;\nvarying vec3 vPos;\n"+e.vertexShader).replace("void main() {",["void main() {","vSurfaceRadius = surfaceRadius;","vPos = position;"].join("\n")),e.fragmentShader=("uniform float uSurfaceRadius;\nvarying float vSurfaceRadius;\nvarying vec3 vPos;\n"+e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join("\n")),e},pG=function(e){return e.vertexShader="\n attribute float r;\n \n const float PI = 3.1415926535897932384626433832795;\n float toRad(in float a) {\n return a * PI / 180.0;\n }\n \n vec3 Polar2Cartesian(in vec3 c) { // [lat, lng, r]\n float phi = toRad(90.0 - c.x);\n float theta = toRad(90.0 - c.y);\n float r = c.z;\n return vec3( // x,y,z\n r * sin(phi) * cos(theta),\n r * cos(phi),\n r * sin(phi) * sin(theta)\n );\n }\n \n vec2 Cartesian2Polar(in vec3 p) {\n float r = sqrt(p.x * p.x + p.y * p.y + p.z * p.z);\n float phi = acos(p.y / r);\n float theta = atan(p.z, p.x);\n return vec2( // lat,lng\n 90.0 - phi * 180.0 / PI,\n 90.0 - theta * 180.0 / PI - (theta < -PI / 2.0 ? 360.0 : 0.0)\n );\n }\n ".concat(e.vertexShader.replace("}"," \n vec3 pos = Polar2Cartesian(vec3(Cartesian2Polar(position), r));\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n }\n "),"\n "),e},mG=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},fG=["stroke"],gG=window.THREE?window.THREE:{BufferGeometry:jr,CubicBezierCurve3:jo,Curve:Io,Group:xs,Line:no,Mesh:is,NormalBlending:1,ShaderMaterial:cs,TubeGeometry:Gl,Vector3:wn},_G=b.default||b,yG=g({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;null===(t=e.ticker)||void 0===t||t.pause()},resumeAnimation:function(e){var t;null===(t=e.ticker)||void 0===t||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),null===(t=e.ticker)||void 0===t||t.dis
vendor: 11,110 bytes, line 1
1pose()}},stateInit:function(e){return{tweenGroup:e.tweenGroup,ticker:new _G,sharedMaterial:new gG.ShaderMaterial(Nk(Nk({},hG()),{},{transparent:!0,blending:gG.NormalBlending}))}},init:function(e,t){zk(e),t.scene=e,t.dataMapper=new aG(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var e=new gG.Group;return e.__globeObjType="arc",e}),t.ticker.onTick.add(function(e,n){t.dataMapper.entries().map(function(e){return Dk(e,2)[1]}).filter(function(e){return e.children.length&&e.children[0].material&&e.children[0].__dashAnimateStep}).forEach(function(e){var t=e.children[0],i=t.__dashAnimateStep*n,r=t.material.uniforms.dashTranslate.value%1e9;t.material.uniforms.dashTranslate.value=r+i})})},update:function(e){var n=y(e.arcStartLat),i=y(e.arcStartLng),a=y(e.arcStartAltitude),o=y(e.arcEndLat),l=y(e.arcEndLng),u=y(e.arcEndAltitude),c=y(e.arcAltitude),h=y(e.arcAltitudeAutoScale),d=y(e.arcStroke),p=y(e.arcColor),m=y(e.arcDashLength),f=y(e.arcDashGap),g=y(e.arcDashInitialGap),_=y(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(y,b){var T=d(b),S=null!=T;if(!y.children.length||S!==("Mesh"===y.children[0].type)){zk(y);var M=S?new gG.Mesh:new gG.Line(new gG.BufferGeometry);M.material=e.sharedMaterial.clone(),y.add(M)}var w=y.children[0];Object.assign(w.material.uniforms,{dashSize:{value:m(b)},gapSize:{value:f(b)},dashOffset:{value:g(b)}});var E=_(b);w.__dashAnimateStep=E>0?1e3/E:0;var A=function(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=n+1;if(e instanceof Array||e instanceof Function){var a=e instanceof Array?t().domain(e.map(function(t,n){return n/(e.length-1)})).range(e):e;i=function(e){return eG(a(e),!0,!0)}}else{var o=eG(e,!0,!0);i=function(){return o}}for(var l=[],u=0,c=s;u<c;u++)for(var h=i(u/(c-1)),d=0;d<r;d++)l.push(h);return nG(l,4)}(p(b),e.arcCurveResolution,S?e.arcCircularResolution+1:1),R=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],r=0,s=e+1;r<s;r++)for(var a=r/(s-1),o=0;o<t;o++)i.push(a);return n&&i.reverse(),nG(i,1)}(e.arcCurveResolution,S?e.arcCircularResolution+1:1,!0);w.geometry.setAttribute("color",A),w.geometry.setAttribute("relDistance",R);var C=function(t){var n=y.__currentTargetD=t,i=n.stroke,a=function(e){var t=e.alt,n=e.altAutoScale,i=e.startLat,a=e.startLng,o=e.startAlt,l=e.endLat,u=e.endLng,c=e.endAlt,h=function(e){var t=Dk(e,3),n=t[0],i=jk(t[1],n,t[2]),r=i.x,s=i.y,a=i.z;return new gG.Vector3(r,s,a)},d=[a,i],p=[u,l],m=t;if(null==m&&(m=r(d,p)/2*n+Math.max(o,c)),m||o||c){var f=s(d,p),g=function(e,t){return t+(t-e)*(e<t?.5:.25)},_=Dk([.25,.75].map(function(e){return[].concat(Uk(f(e)),[g(e<.5?o:c,m)])}),2),y=_[0],v=_[1];return Tk(gG.CubicBezierCurve3,Uk([[].concat(d,[o]),y,v,[].concat(p,[c])].map(h)))}var x=.001;return b.apply(void 0,Uk([[].concat(d,[x]),[].concat(p,[x])].map(h)));function b(e,t){var n=e.angleTo(t),i=0===n?function(){return e.clone()}:function(i){return(new gG.Vector3).addVectors(e.clone().multiplyScalar(Math.sin((1-i)*n)),t.clone().multiplyScalar(Math.sin(i*n))).divideScalar(Math.sin(n))},r=new gG.Curve;return r.getPoint=i,r}}(function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(n,fG));S?(w.geometry&&w.geometry.dispose(),w.geometry=new gG.TubeGeometry(a,e.arcCurveResolution,i/2,e.arcCircularResolution),w.geometry.setAttribute("color",A),w.geometry.setAttribute("relDistance",R)):w.geometry.setFromPoints(a.getPoints(e.arcCurveResolution))},N={stroke:T,alt:c(b),altAutoScale:+h(b),startLat:+n(b),startLng:+i(b),startAlt:+a(b),endLat:+o(b),endLng:+l(b),endAlt:+u(b)},P=y.__currentTargetD||Object.assign({},N,{altAutoScale:-.001});Object.keys(N).some(function(e){return P[e]!==N[e]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?C(N):e.tweenGroup.add(new v(P).to(N,e.arcsTransitionDuration).easing(x.Quadratic.InOut).onUpdate(C).start()))}).digest(e.arcsData)}}),vG=window.THREE?window.THREE:{BufferGeometry:jr,DoubleSide:2,Mesh:is,MeshLambertMaterial:eu,Object3D:nr},xG=Object.assign({},lm),bG=xG.BufferGeometryUtils||xG,TG=g({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){return.01*e.sumWeight}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var i=n.tweenGroup;zk(e),t.scene=e,t.tweenGroup=i,t.dataMapper=new aG(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=y(e.hexBinPointLat),i=y(e.hexBinPointLng),r=y(e.hexBinPointWeight),s=y(e.hexAltitude),a=y(e.hexTopColor),o=y(e.hexSideColor),l=y(e.hexMargin),u=T(e.hexBinPointsData.map(function(t){return Nk(Nk({},t),{},{h3Idx:S(n(t),i(t),e.hexBinResolution)})}),"h3Idx"),c=Object.entries(u).map(function(e){var t=Dk(e,2),n=t[0],i=t[1];return{h3Idx:n,points:i,sumWeight:i.reduce(function(e,t){return e+ +r(t)},0)}}),h={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&zk(e.scene),e.dataMapper.scene=e.hexBinMerge?new vG.Object3D:e.scene,e.dataMapper.id(function(e){return e.h3Idx}).onCreateObj(function(e){var t=new vG.Mesh;t.__hexCenter=M(e.h3Idx),t.__hexGeoJson=w(e.h3Idx,!0).reverse();var n=t.__hexCenter[1];return t.__hexGeoJson.forEach(function(e){var t=e[0];Math.abs(n-t)>170&&(e[0]+=n>t?360:-360)}),t.__globeObjType="hexbin",t}).onUpdateObj(function(t,n){var i=Math.max(0,Math.min(1,+l(n))),r=Dk(t.__hexCenter,2),u=r[0],c=r[1],d=0===i?t.__hexGeoJson:t.__hexGeoJson.map(function(e){var t=Dk(e,2),n=t[0],r=t[1];return[[n,c],[r,u]].map(function(e){var t=Dk(e,2);return function(e,t,n){return e-(e-t)*n}(t[0],t[1],i)})}),p=e.hexTopCurvatureResolution;t.geometry&&t.geometry.dispose(),t.geometry=new t_([d],0,Gk,!1,!0,!0,p);var m={alt:+s(n)},f=function(e){var n=(t.__currentTargetD=e).alt;t.scale.x=t.scale.y=t.scale.z=1+n;var i=Gk/(n+1);t.geometry.setAttribute("surfaceRadius",nG(Array(t.geometry.getAttribute("position").count).fill(i),1))},g=t.__currentTargetD||Object.assign({},m,{alt:-.001});Object.keys(m).some(function(e){return g[e]!==m[e]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?f(m):e.tweenGroup.add(new v(g).to(m,e.hexTransitionDuration).easing(x.Quadratic.InOut).onUpdate(f).start()));if(!e.hexBinMerge){var _=o(n),y=a(n);[_,y].forEach(function(e){if(!h.hasOwnProperty(e)){var t=Qk(e);h[e]=mG(new vG.MeshLambertMaterial({color:Jk(e),transparent:t<1,opacity:t,side:vG.DoubleSide}),dG)}}),t.material=[_,y].map(function(e){return h[e]})}}).digest(c),e.hexBinMerge){var d=c.length?(bG.mergeGeometries||bG.mergeBufferGeometries)(c.map(function(t){var n=e.dataMapper.getObj(t),i=n.geometry.toNonIndexed();n.updateMatrix(),i.applyMatrix4(n.matrix);var r=eG(a(t)),s=eG(o(t)),l=i.getAttribute("position").count,u=i.groups[0].count;return i.setAttribute("color",nG(Uk(new Array(l)).map(function(e,t){return t>=u?r:s}),4)),i})):new vG.BufferGeometry,p=new vG.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:vG.DoubleSide});p.onBeforeCompile=function(e){p.userData.shader=dG(e)};var m=new vG.Mesh(d,p);m.__globeObjType="hexBinPoints",m.__data=c,e.dataMapper.clear(),zk(e.scene),e.scene.add(m)}}}),SG=function(e){return e*e},MG=function(e){return e*Math.PI/180};var wG=Math.sqrt(2*Math.PI);var EG=function(e){var t=Dk(e,2),n=t[0],i=t[1],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=s.lngAccessor,o=void 0===a?function(e){return e[0]}:a,l=s.latAccessor,u=void 0===l?function(e){return e[1]}:l,c=s.weightAccessor,h=void 0===c?function(){return 1}:c,d=s.bandwidth,p=[n,i],m=d*Math.PI/180;return O(r.map(function(e){var t=h(e);if(!t)return 0;var n,i,r,s,a,l,c,d,f,g,_,y=(n=p,i=[o(e),u(e)],r=Math.sqrt,s=Math.cos,a=function(e){return SG(Math.sin(e/2))},l=MG(n[1]),c=MG(i[1]),d=MG(n[0]),f=MG(i[0]),2*Math.asin(r(a(c-l)+s(l)*s(c)*a(f-d))));return g=y,_=m,Math.exp(-SG(g/_)/2)/(_*wG)*t}))},AG=function(){var e,t=(e=Pk().m(function e(t){var n,i,r,s,a,o,l,u,c,h,d,p,m,f,g,_,y,v,x,b,T,S,M,w,E,A,R,C,N,P,I,L,D,O,U,F,B,V,q,z,k,G,H=arguments;return Pk().w(function(e){for(;;)switch(e.n){case 0:if(i=H.length>1&&void 0!==H[1]?H[1]:[],s=(r=H.length>2&&void 0!==H[2]?H[2]:{}).lngAccessor,a=void 0===s?function(e){return e[0]}:s,o=r.latAccessor,l=void 0===o?function(e){return e[1]}:o,u=r.weightAccessor,c=void 0===u?function(){return 1}:u,h=r.bandwidth,null!==(n=navigator)&&void 0!==n&&n.gpu){e.n=1;break}return e.a(2,t.map(function(e){return EG(e,i,{lngAccessor:a,latAccessor:l,weightAccessor:c,bandwidth:h})}));case 1:return d=Nz,p=Pz,m=kz,g=Uz,_=Fz,y=Iz,v=qz,x=Vz,b=Dz,T=Lz,S=Oz,M=Bz,w=(f=zz)(new UP(new Float32Array(t.flat().map(MG)),2),"vec2",t.length),E=f(new UP(new Float32Array(i.map(function(e){return[MG(a(e)),MG(l(e)),c(e)]}).flat()),3),"vec3",i.length),A=new UP(t.length,1),R=f(A,"float",t.length),C=g(Math.PI),N=v(C.mul(2)),P=function(e){return e.mul(e)},I=function(e){return P(x(e.div(2)))},L=function(e,t){var n=g(e[1]),i=g(t[1]),r=g(e[0]),s=g(t[0]);return g(2).mul(T(v(I(i.sub(n)).add(b(n).mul(b(i)).mul(I(s.sub(r)))))))},D=function(e,t){return S(M(P(e.div(t)).div(2))).div(t.mul(N))},O=m(MG(h)),U=m(MG(4*h)),F=m(i.length),B=d(function(){var e=w.element(_),t=R.element(_);t.assign(0),y(F,function(n){var i=n.i,r=E.element(i),s=r.z;p(s,function(){var n=L(r.xy,e.xy);p(n&&n.lessThan(U),function(){t.addAssign(D(n,O).mul(s))})})})}),V=B().compute(t.length),q=new Cz,e.n=2,q.computeAsync(V);case 2:return z=Array,k=Float32Array,e.n=3,q.getArrayBufferAsync(A);case 3:return G=e.v,e.a(2,z.from.call(z,new k(G)))}},e)}),function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function a(e){gk(s,i,r,a,o,"next",e)}function o(e){gk(s,i,r,a,o,"throw",e)}a(void 0)})});return function(e){return t.apply(this,arguments)}}(),RG=window.THREE?window.THREE:{Mesh:is,MeshLambertMaterial:eu,SphereGeometry:Vl},CG=function(e){var t=N(L(e));return t.opacity=Math.cbrt(e),t.formatRgb()},NG=g({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 CG}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var i=n.tweenGroup;zk(e),t.scene=e,t.tweenGroup=i,t.dataMapper=new aG(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var e=new RG.Mesh(new RG.SphereGeometry(Gk),mG(new RG.MeshLambertMaterial({vertexColors:!0,transparent:!0}),pG));
vendor: 18,951 bytes, line 1
1return e.__globeObjType="heatmap",e})},update:function(e){var n=y(e.heatmapPoints),i=y(e.heatmapPointLat),r=y(e.heatmapPointLng),s=y(e.heatmapPointWeight),a=y(e.heatmapBandwidth),o=y(e.heatmapColorFn),l=y(e.heatmapColorSaturation),u=y(e.heatmapBaseAltitude),c=y(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(h,d){var p=a(d),m=o(d),f=l(d),g=u(d),_=c(d),y=n(d).map(function(e){var t=i(e),n=r(e),a=jk(t,n);return{x:a.x,y:a.y,z:a.z,lat:t,lng:n,weight:s(e)}}),b=Math.max(.1,p/3.5),T=Math.ceil(360/(b||-1));h.geometry.parameters.widthSegments!==T&&(h.geometry.dispose(),h.geometry=new RG.SphereGeometry(Gk,T,T/2));var S=function(e){for(var t=e.itemSize,n=[],i=0;i<e.count;i++)n.push(e.array.slice(i*t,(i+1)*t));return n}(h.geometry.getAttribute("position")).map(function(e){var t=Dk(e,3),n=Wk({x:t[0],y:t[1],z:t[2]});return[n.lng,n.lat]});AG(S,y,{latAccessor:function(e){return e.lat},lngAccessor:function(e){return e.lng},weightAccessor:function(e){return e.weight},bandwidth:p}).then(function(n){var i=Uk(new Array(100)).map(function(e,t){return eG(m(t/99))}),r=function(e){var n=h.__currentTargetD=e,r=n.kdeVals,s=n.topAlt,a=n.saturation,o=E(r.map(Math.abs))||1e-15,l=A([0,o/a],i);h.geometry.setAttribute("color",nG(r.map(function(e){return l(Math.abs(e))}),4));var u=t([0,o],[Gk*(1+g),Gk*(1+(s||g))]);h.geometry.setAttribute("r",nG(r.map(u)))},s={kdeVals:n,topAlt:_,saturation:f},a=h.__currentTargetD||Object.assign({},s,{kdeVals:n.map(function(){return 0}),topAlt:_?g:_,saturation:.5});a.kdeVals.length!==n.length&&(a.kdeVals=n.slice()),Object.keys(s).some(function(e){return a[e]!==s[e]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?r(s):e.tweenGroup.add(new v(a).to(s,e.heatmapsTransitionDuration).easing(x.Quadratic.InOut).onUpdate(r).start()))})}).digest(e.heatmapsData)}}),PG=window.THREE?window.THREE:{DoubleSide:2,Group:xs,LineBasicMaterial:$a,LineSegments:ao,Mesh:is,MeshBasicMaterial:wr},IG=g({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 i=n.tweenGroup;zk(e),t.scene=e,t.tweenGroup=i,t.dataMapper=new aG(e,{objBindAttr:"__threeObjPolygon"}).id(function(e){return e.id}).onCreateObj(function(){var e=new PG.Group;return e.__defaultSideMaterial=mG(new PG.MeshBasicMaterial({side:PG.DoubleSide,depthWrite:!0}),dG),e.__defaultCapMaterial=new PG.MeshBasicMaterial({side:PG.DoubleSide,depthWrite:!0}),e.add(new PG.Mesh(void 0,[e.__defaultSideMaterial,e.__defaultCapMaterial])),e.add(new PG.LineSegments(void 0,new PG.LineBasicMaterial)),e.__globeObjType="polygon",e})},update:function(e){var t=y(e.polygonGeoJsonGeometry),n=y(e.polygonAltitude),i=y(e.polygonCapCurvatureResolution),r=y(e.polygonCapColor),s=y(e.polygonCapMaterial),a=y(e.polygonSideColor),o=y(e.polygonSideMaterial),l=y(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(e){var c={data:e,capColor:r(e),capMaterial:s(e),sideColor:a(e),sideMaterial:o(e),strokeColor:l(e),altitude:+n(e),capCurvatureResolution:+i(e)},h=t(e),d=e.__id||"".concat(Math.round(1e9*Math.random()));e.__id=d,"Polygon"===h.type?u.push(Nk({id:"".concat(d,"_0"),coords:h.coordinates},c)):"MultiPolygon"===h.type&&u.push.apply(u,Uk(h.coordinates.map(function(e,t){return Nk({id:"".concat(d,"_").concat(t),coords:e},c)})))}),e.dataMapper.onUpdateObj(function(t,n){var i=n.coords,r=n.capColor,s=n.capMaterial,a=n.sideColor,o=n.sideMaterial,l=n.strokeColor,u=n.altitude,c=n.capCurvatureResolution,h=Dk(t.children,2),d=h[0],p=h[1],m=!!l;p.visible=m;var f=!(!r&&!s),g=!(!a&&!o);(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return function(e,t){return e===t}};return Object.entries(t).every(function(t){var i=Dk(t,2),r=i[0],s=i[1];return e.hasOwnProperty(r)&&n(r)(e[r],s)})})(d.geometry.parameters||{},{polygonGeoJson:i,curvatureResolution:c,closedTop:f,includeSides:g})||(d.geometry&&d.geometry.dispose(),d.geometry=new t_(i,0,Gk,!1,f,g,c)),!m||p.geometry.parameters&&p.geometry.parameters.geoJson.coordinates===i&&p.geometry.parameters.resolution===c||(p.geometry&&p.geometry.dispose(),p.geometry=new Vg({type:"Polygon",coordinates:i},Gk,c));var _=g?0:-1,y=f?g?1:0:-1;if(_>=0&&(d.material[_]=o||t.__defaultSideMaterial),y>=0&&(d.material[y]=s||t.__defaultCapMaterial),[[!o&&a,_],[!s&&r,y]].forEach(function(e){var t=Dk(e,2),n=t[0],i=t[1];if(n&&!(i<0)){var r=d.material[i],s=Qk(n);r.color.set(Jk(n)),r.transparent=s<1,r.opacity=s}}),m){var b=p.material,T=Qk(l);b.color.set(Jk(l)),b.transparent=T<1,b.opacity=T}var S={alt:u},M=function(e){var n=(t.__currentTargetD=e).alt;d.scale.x=d.scale.y=d.scale.z=1+n,m&&(p.scale.x=p.scale.y=p.scale.z=1+n+1e-4),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(e){n(e),t(e.uniforms)}}}(t.__defaultSideMaterial,function(e){return e.uSurfaceRadius.value=Gk/(n+1)})},w=t.__currentTargetD||Object.assign({},S,{alt:-.001});Object.keys(S).some(function(e){return w[e]!==S[e]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||w.alt===S.alt?M(S):e.tweenGroup.add(new v(w).to(S,e.polygonsTransitionDuration).easing(x.Quadratic.InOut).onUpdate(M).start()))}).digest(u)}});var LG=window.THREE?window.THREE:{BufferGeometry:jr,DoubleSide:2,Mesh:is,MeshLambertMaterial:eu,Vector3:wn},DG=Object.assign({},lm),OG=DG.BufferGeometryUtils||DG,UG=g({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 i=n.tweenGroup;zk(e),t.scene=e,t.tweenGroup=i,t.dataMapper=new aG(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var e=new LG.Mesh(void 0,new LG.MeshLambertMaterial({side:LG.DoubleSide}));return e.__globeObjType="hexPolygon",e})},update:function(e){var t=y(e.hexPolygonGeoJsonGeometry),n=y(e.hexPolygonColor),i=y(e.hexPolygonAltitude),r=y(e.hexPolygonResolution),s=y(e.hexPolygonMargin),a=y(e.hexPolygonUseDots),o=y(e.hexPolygonCurvatureResolution),l=y(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,c){var h=t(c),d=r(c),p=i(c),m=Math.max(0,Math.min(1,+s(c))),f=a(c),g=o(c),_=l(c),y=n(c),b=Qk(y);u.material.color.set(Jk(y)),u.material.transparent=b<1,u.material.opacity=b;var T={alt:p,margin:m,curvatureResolution:g},S={geoJson:h,h3Res:d},E=u.__currentTargetD||Object.assign({},T,{alt:-.001}),A=u.__currentMemD||S;if(Object.keys(T).some(function(e){return E[e]!==T[e]})||Object.keys(S).some(function(e){return A[e]!==S[e]})){u.__currentMemD=S;var C=[];"Polygon"===h.type?R(h.coordinates,d,!0).forEach(function(e){return C.push(e)}):"MultiPolygon"===h.type&&h.coordinates.forEach(function(e){return R(e,d,!0).forEach(function(e){return C.push(e)})});var N=C.map(function(e){var t=M(e),n=w(e,!0).reverse(),i=t[1];return n.forEach(function(e){var t=e[0];Math.abs(i-t)>170&&(e[0]+=i>t?360:-360)}),{h3Idx:e,hexCenter:t,hexGeoJson:n}}),P=function(e){var t=u.__currentTargetD=e,n=t.alt,i=t.margin,r=t.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=N.length?(OG.mergeGeometries||OG.mergeBufferGeometries)(N.map(function(e){var t=Dk(e.hexCenter,2),s=t[0],a=t[1];if(f){var o=jk(s,a,n),l=jk(e.hexGeoJson[0][1],e.hexGeoJson[0][0],n),u=.85*(1-i)*new LG.Vector3(o.x,o.y,o.z).distanceTo(new LG.Vector3(l.x,l.y,l.z)),c=new To(u,_);return c.rotateX(Xk(-s)),c.rotateY(Xk(a)),c.translate(o.x,o.y,o.z),c}var h=0===i?e.hexGeoJson:e.hexGeoJson.map(function(e){var t=Dk(e,2),n=t[0],r=t[1];return[[n,a],[r,s]].map(function(e){var t=Dk(e,2);return function(e,t,n){return e-(e-t)*n}(t[0],t[1],i)})});return new t_([h],Gk,Gk*(1+n),!1,!0,!1,r)})):new LG.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?P(T):e.tweenGroup.add(new v(E).to(T,e.hexPolygonsTransitionDuration).easing(x.Quadratic.InOut).onUpdate(P).start())}}).digest(e.hexPolygonsData)}}),FG=window.THREE?window.THREE:{Vector3:wn};function BG(e,t){var n=Math.max(e.length,t.length),i=D.apply(void 0,Uk([e,t].map(function(e){return e.map(function(e){return[e.x,e.y,e.z]})}).map(function(e){return function(e,t){var n=e[e.length-1];return[].concat(Uk(e),Uk(Array(t-e.length).fill(n)))}(e,n)})));return function(n){return 0===n?e:1===n?t:i(n).map(function(e){var t=Dk(e,3),n=t[0],i=t[1],r=t[2];return new FG.Vector3(n,i,r)})}}var VG=window.THREE?window.THREE:{BufferGeometry:jr,Color:br,Group:xs,Line:no,NormalBlending:1,ShaderMaterial:cs,Vector3:wn},qG=b.default||b,zG=g({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;null===(t=e.ticker)||void 0===t||t.pause()},resumeAnimation:function(e){var t;null===(t=e.ticker)||void 0===t||t.resume()},_destructor:function(e){var t;null===(t=e.ticker)||void 0===t||t.dispose()}},stateInit:function(e){return{tweenGroup:e.tweenGroup,ticker:new qG,sharedMaterial:new VG.ShaderMaterial(Nk(Nk({},hG()),{},{transparent:!0,blending:VG.NormalBlending}))}},init:function(e,t){zk(e),t.scene=e,t.dataMapper=new aG(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var e=new VG.Group;return e.__globeObjType="path",e}),t.ticker.onTick.add(function(e,n){t.dataMapper.entries().map(function(e){return Dk(e,2)[1]}).filter(function(e){return e.children.length&&e.children[0].material&&e.children[0].__dashAnimateStep}).forEach(function(e){var t=e.children[0],i=t.__dashAnimateStep*n;if("Line"===t.type){var r=t.material.uniforms.dashTranslate.value%1e9;t.material.uniforms.dashTranslate.value=r+i}else if("Line2"===t.type){for(var s=t.material.dashOffset-i,a=t.material.dashSize+t.material.gapSize;s<=-a;)s+=a;t.material.dashOffset=s}})})},update:function(e){var n=y(e.pathPoints),i=y(e.pathPointLat),r=y(e.pathPointLng),s=y(e.pathPointAlt),a=y(e.pathStroke),o=y(e.pathColor),l=y(e.pathDashLength),u=y(e.pathDashGap),c=y(e.pathDashInitialGap),h=y(e.pathDashAnimateTime);function d(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=n+1;if(e instanceof Array||e instanceof Function){var o=e instanceof Array?t().domain(e.map(function(t,n){return n/(e.length-1)})).range(e):e;i=function(e){return eG(o(e),s,!0)}}else{var l=eG(e,s,!0);i=function(){return l}}for(var u=[],c=0,h=a;c<h;c++)for(var d=i(c/(h-1)),p=0;p<r;p++)u.push(d);return nG(u,s?4:3)}e.dataMapper.onUpdateObj(function(t,p){var m=a(p),f=null!=m;if(!t.children.length||f===("Line"===t.children[0].type)){zk(t);var g=f?new hk(new ck,new Wz):new VG.Line(new VG.BufferGeometry,e.sharedMaterial.clone());t.add(g)}var _,y,b=t.children[0],T=function(e,t,n,i,r){var s=function(e,t,n){for(var i=[],r=1;r<=n;r++)i.push(e+(t-e)*r/(n+1));return i},a=function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=[],n=null;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(function(i){if(n){for(;Math.abs(n[1]-i[1])>180;)n[1]+=360*(n[1]<i[1]?1:-1);var r=Math.sqrt(Math.pow(i[0]-n[0],2)+Math.pow(i[1]-n[1],2));if(r>e)for(var a=Math.floor(r/e),o=s(n[0],i[0],a),l=s(n[1],i[1],a),u=s(n[2],i[2],a),c=0,h=o.length;c<h;c++)t.push([o[c],l[c],u[c]])}t.push(n=i)}),t},o=function(e){var t=Dk(e,3),n=jk(t[0],t[1],t[2]),i=n.x,r=n.y,s=n.z;return new VG.Vector3(i,r,s)};return a(e.map(function(e){return[t(e),n(e),i(e)]}),r).map(o)}(n(p),i,r,s,e.pathResolution),S=h(p);if(b.__dashAnimateStep=S>0?1e3/S:0,f){b.material.resolution=e.rendererSize;var M=l(p),w=u(p),E=c(p);b.material.dashed=w>0,b.material.dashed?b.material.defines.USE_DASH="":delete b.material.defines.USE_DASH,b.material.dashed&&(b.material.dashScale=1/(y=0,T.forEach(function(e){_&&(y+=_.distanceTo(e)),_=e}),y),b.material.dashSize=M,b.material.gapSize=w,b.material.dashOffset=-E);var A=o(p);if(A instanceof Array){var R=d(o(p),T.length-1,1,!1);b.geometry.setColors(R.array),b.material.vertexColors=!0}else{var C=A,N=Qk(C);b.material.color=new VG.Color(Jk(C)),b.material.transparent=N<1,b.material.opacity=N,b.material.vertexColors=!1}b.material.needsUpdate=!0}else{Object.assign(b.material.uniforms,{dashSize:{value:l(p)},gapSize:{value:u(p)},dashOffset:{value:c(p)}});var P=d(o(p),T.length),I=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],r=0,s=e+1;r<s;r++)for(var a=r/(s-1),o=0;o<t;o++)i.push(a);return n&&i.reverse(),nG(i,1)}(T.length,1,!0);b.geometry.setAttribute("color",P),b.geometry.setAttribute("relDistance",I)}var L=BG(t.__currentTargetD&&t.__currentTargetD.points||[T[0]],T),D=function(e){var n,i=t.__currentTargetD=e,r=i.stroke,s=i.interpolK,a=t.__currentTargetD.points=L(s);f?(b.geometry.setPositions((n=[]).concat.apply(n,Uk(a.map(function(e){return[e.x,e.y,e.z]})))),b.material.linewidth=r,b.material.dashed&&b.computeLineDistances()):(b.geometry.setFromPoints(a),b.geometry.computeBoundingSphere())},O={stroke:m,interpolK:1},U=Object.assign({},t.__currentTargetD||O,{interpolK:0});Object.keys(O).some(function(e){return U[e]!==O[e]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?D(O):e.tweenGroup.add(new v(U).to(O,e.pathTransitionDuration).easing(x.Quadratic.InOut).onUpdate(D).start()))}).digest(e.pathsData)}}),kG=window.THREE?window.THREE:{Euler:Vi,Mesh:is,MeshLambertMaterial:eu,SphereGeometry:Vl},GG=g({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 kG.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var i=n.tweenGroup;zk(e),t.scene=e,t.tweenGroup=i,t.dataMapper=new aG(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var e=new kG.Mesh;return e.__globeObjType="tile",e})},update:function(e){var t=y(e.tileLat),n=y(e.tileLng),i=y(e.tileAltitude),r=y(e.tileWidth),s=y(e.tileHeight),a=y(e.tileUseGlobeProjection),o=y(e.tileMaterial),l=y(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,c){u.material=o(c);var h=a(c),d=l(c),p=function(e){var t=u.__currentTargetD=e,n=t.lat,i=t.lng,r=t.alt,s=t.width,a=t.height,o=HG(i),l=HG(-n);u.geometry&&u.geometry.dispose(),u.geometry=new kG.SphereGeometry(Gk*(1+r),Math.ceil(s/(d||-1)),Math.ceil(a/(d||-1)),HG(90-s/2)+(h?o:0),HG(s),HG(90-a/2)+(h?l:0),HG(a)),h||u.setRotationFromEuler(new kG.Euler(l,o,0,"YXZ"))},m={lat:+t(c),lng:+n(c),alt:+i(c),width:+r(c),height:+s(c)},f=u.__currentTargetD||Object.assign({},m,{width:0,height:0});Object.keys(m).some(function(e){return f[e]!==m[e]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?p(m):e.tweenGroup.add(new v(f).to(m,e.tilesTransitionDuration).easing(x.Quadratic.InOut).onUpdate(p).start()))}).digest(e.tilesData)}}),HG=function(e){return e*Math.PI/180},jG=window.THREE?window.THREE:{BufferGeometry:jr,Color:br,Points:mo,PointsMaterial:lo},WG=g({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){zk(e),t.scene=e,t.dataMapper=new aG(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var e=new jG.Points(new jG.BufferGeometry,new jG.PointsMaterial);return e.__globeObjType="particles",e}).onUpdateObj(function(e,n){var i=y(t.particlesList),r=y(t.particleLat),s=y(t.particleLng),a=y(t.particleAltitude);e.geometry.setAttribute("position",nG(i(n).map(function(e){return Object.values(jk(r(e),s(e),a(e)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(e){return t.hasOwnProperty(e)})&&e.dataMapper.digest(e.particlesData);var n=y(e.particlesColor),i=y(e.particlesSize),r=y(e.particlesSizeAttenuation),s=y(e.particlesTexture);e.dataMapper.entries().forEach(function(t){var a=Dk(t,2),o=a[0],l=a[1];if(l.material.size=i(o),l.material.sizeAttenuation=r(o),e.particlesTexture)l.material.color=new jG.Color(16777215),l.material.transparent=!1,l.material.alphaTest=.5,l.material.map=s(o);else{var u=n(o),c=Qk(u);l.material.color=new jG.Color(Jk(u)),l.material.transparent=c<1,l.material.opacity=c,l.material.alphaTest=0}})}}),XG=window.THREE?window.THREE:{BufferGeometry:jr},$G=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32;yk(this,e),(t=_k(this,e)).type="CircleLineGeometry",t.parameters={radius:n,segmentCount:i};for(var r=[],s=0;s<=i;s++){var a=(s/i-.25)*Math.PI*2;r.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(r),t}return Ak(e,XG.BufferGeometry),Sk(e)}(),YG=window.THREE?window.THREE:{Color:br,Group:xs,Line:no,LineBasicMaterial:$a,Vector3:wn},KG=b.default||b,ZG=g({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;null===(t=e.ticker)||void 0===t||t.pause()},resumeAnimation:function(e){var t;null===(t=e.ticker)||void 0===t||t.resume()},_destructor:function(e){var t;null===(t=e.ticker)||void 0===t||t.dispose()}},init:function(e,n,i){var r=i.tweenGroup;zk(e),n.scene=e,n.tweenGroup=r,n.dataMapper=new aG(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var e=new YG.Group;return e.__globeObjType="ring",e}),n.ticker=new KG,n.ticker.onTick.add(function(e){if(n.ringsData.length){var i=y(n.ringColor),r=y(n.ringAltitude),s=y(n.ringMaxRadius),a=y(n.ringPropagationSpeed),o=y(n.ringRepeatPeriod);n.dataMapper.entries().filter(function(e){return Dk(e,2)[1]}
vendor: 1,271 bytes, line 1
1).forEach(function(l){var u,c,h=Dk(l,2),d=h[0],p=h[1];if((p.__nextRingTime||0)<=e){var m=o(d)/1e3;p.__nextRingTime=e+(m<=0?1/0:m);var f,g=new YG.Line(new $G(1,n.ringResolution),new YG.LineBasicMaterial),_=i(d),y=_ instanceof Array||_ instanceof Function;y?_ instanceof Array?(f=t().domain(_.map(function(e,t){return t/(_.length-1)})).range(_),g.material.transparent=_.some(function(e){return Qk(e)<1})):(f=_,g.material.transparent=!0):(g.material.color=new YG.Color(Jk(_)),u=g.material,c=Qk(_),u.opacity=c,u.transparent=c<1,u.depthWrite=c>=1);var x=Gk*(1+r(d)),b=s(d),T=b*Math.PI/180,S=a(d),M=S<=0,w=function(e){var t=e.t,n=(M?1-t:t)*T;if(g.scale.x=g.scale.y=x*Math.sin(n),g.position.z=x*(1-Math.cos(n)),y){var i=f(t);g.material.color=new YG.Color(Jk(i)),g.material.transparent&&(g.material.opacity=Qk(i))}};if(0===S)w({t:0}),p.add(g);else{var E=1e3*Math.abs(b/S);n.tweenGroup.add(new v({t:0}).to({t:1},E).onUpdate(w).onStart(function(){return p.add(g)}).onComplete(function(){p.remove(g),qk(g)}).start())}}})}})},update:function(e){var t=y(e.ringLat),n=y(e.ringLng),i=y(e.ringAltitude),r=e.scene.localToWorld(new YG.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(e,s){var a=t(s),o=n(s),l=i(s);Object.assign(e.position,jk(a,o,l)),e.lookAt(r)}).digest(e.ringsData)}}),J
vendor: 19,981 bytes, line 1
1G={glyphs:{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 "},"/":{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 "},"^":{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 "},"{":{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
vendor: 3,101 bytes, line 1
11013 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
vendor: 15,718 bytes, line 1
1603 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 "},"]":{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 436 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
vendor: 4,390 bytes, line 1
10 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
vendor: 18,118 bytes, line 1
110 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 436 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 -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 "},"¤":{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 "}},cssFontWeight:"normal",ascender:1189,underlinePosition:-100,cssFontStyle:"normal",boundingBox:{yMin:-334,xMin:-111,yMax:1189,xMax:1672},resolution:1e3,original_font_information:{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\n\r\nPermission 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\n\r\nThe above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r\n\r\nThe 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\n\r\nThis 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\n\r\nThe 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\n\r\nTHE 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"},descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50},
1QG=Nk(Nk({},window.THREE?window.THREE:{BoxGeometry:ss,CircleGeometry:To,DoubleSide:2,Group:xs,Mesh:is,MeshLambertMaterial:eu,TextGeometry:dk,Vector3:wn}
vendor: 4,144 bytes, line 1
1),{},{Font:class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const n=[],i=function(e,t,n){const i=Array.from(e),r=t/n.resolution,s=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,a=[];let o=0,l=0;for(let u=0;u<i.length;u++){const e=i[u];if("\n"===e)o=0,l-=s;else{const t=pk(e,r,o,l,n);o+=t.offsetX,a.push(t.path)}}return a}(e,t,this.data);for(let r=0,s=i.length;r<s;r++)n.push(...i[r].toShapes());return n}},TextGeometry:dk}),eH=g({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:JG,onChange:function(e,t){t.font=new QG.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 i=n.tweenGroup;zk(e),t.scene=e,t.tweenGroup=i;var r=new QG.CircleGeometry(1,32);t.dataMapper=new aG(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var e=new QG.MeshLambertMaterial;e.side=2;var t=new QG.Group;t.add(new QG.Mesh(r,e));var n=new QG.Mesh(void 0,e);t.add(n);var i=new QG.Mesh;return i.visible=!1,n.add(i),t.__globeObjType="label",t})},update:function(e){var t=y(e.labelLat),n=y(e.labelLng),i=y(e.labelAltitude),r=y(e.labelText),s=y(e.labelSize),a=y(e.labelRotation),o=y(e.labelColor),l=y(e.labelIncludeDot),u=y(e.labelDotRadius),c=y(e.labelDotOrientation),h=new Set(["right","top","bottom"]),d=2*Math.PI*Gk/360;e.dataMapper.onUpdateObj(function(p,m){var f=Dk(p.children,2),g=f[0],_=f[1],y=Dk(_.children,1)[0],b=o(m),T=Qk(b);_.material.color.set(Jk(b)),_.material.transparent=T<1,_.material.opacity=T;var S=l(m),M=c(m);!S||!h.has(M)&&(M="bottom");var w=S?+u(m)*d:1e-12;g.scale.x=g.scale.y=w;var E=+s(m)*d;if(_.geometry&&_.geometry.dispose(),_.geometry=new QG.TextGeometry(r(m),{font:e.font,size:E,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),y.geometry&&y.geometry.dispose(),_.geometry.computeBoundingBox(),y.geometry=Tk(QG.BoxGeometry,Uk((new QG.Vector3).subVectors(_.geometry.boundingBox.max,_.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),"right"!==M&&_.geometry.center(),S){var A=w+E/2;"right"===M&&(_.position.x=A),_.position.y={right:-E/2,top:A+E/2,bottom:-A-E/2}[M]}var R=function(t){var n=p.__currentTargetD=t,i=n.lat,r=n.lng,s=n.alt,a=n.rot,o=n.scale;Object.assign(p.position,jk(i,r,s)),p.lookAt(e.scene.localToWorld(new QG.Vector3(0,0,0))),p.rotateY(Math.PI),p.rotateZ(-a*Math.PI/180),p.scale.x=p.scale.y=p.scale.z=o},C={lat:+t(m),lng:+n(m),alt:+i(m),rot:+a(m),scale:1},N=p.__currentTargetD||Object.assign({},C,{scale:1e-12});Object.keys(C).some(function(e){return N[e]!==C[e]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?R(C):e.tweenGroup.add(new v(N).to(C,e.labelsTransitionDuration).easing(x.Quadratic.InOut).onUpdate(R).start()))}).digest(e.labelsData)}}),tH=Nk(Nk({},window.THREE?window.THREE:{}),{},{CSS2DObject:class extends nr{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 Sn(.5,.5),this.addEventListener("removed",function(){this.traverse(function(e){e.element instanceof e.element.ownerDocument.defaultView.Element&&null!==e.element.parentNode&&e.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}}),nH=g({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){e.dataMapper&&(t?[t]:e.dataMapper.entries().map(function(e){return Dk(e,2)[1]}).filter(function(e){return e}
vendor: 4,249 bytes, line 1
1)).forEach(function(t){var n=!e.isBehindGlobe||!e.isBehindGlobe(t.position);e.htmlElementVisibilityModifier?(t.visible=!0,e.htmlElementVisibilityModifier(t.element,n)):t.visible=n})}},init:function(e,t,n){var i=n.tweenGroup;zk(e),t.scene=e,t.tweenGroup=i,t.dataMapper=new aG(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(e){var n=y(t.htmlElement)(e),i=new tH.CSS2DObject(n);return i.__globeObjType="html",i})},update:function(e,t){var n=this,i=y(e.htmlLat),r=y(e.htmlLng),s=y(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(t,a){var o=function(e){var i=t.__currentTargetD=e,r=i.alt,s=i.lat,a=i.lng;Object.assign(t.position,jk(s,a,r)),n.updateObjVisibility(t)},l={lat:+i(a),lng:+r(a),alt:+s(a)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!t.__currentTargetD?o(l):e.tweenGroup.add(new v(t.__currentTargetD).to(l,e.htmlTransitionDuration).easing(x.Quadratic.InOut).onUpdate(o).start())}).digest(e.htmlElementsData)}}),iH=window.THREE?window.THREE:{Group:xs,Mesh:is,MeshLambertMaterial:eu,SphereGeometry:Vl},rH=g({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new iH.Mesh(new iH.SphereGeometry(1,16,8),new iH.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){zk(e),t.scene=e,t.dataMapper=new aG(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(e){var n=y(t.objectThreeObject)(e);t.objectThreeObject===n&&(n=n.clone());var i=new iH.Group;return i.add(n),i.__globeObjType="object",i})},update:function(e,t){var n=y(e.objectLat),i=y(e.objectLng),r=y(e.objectAltitude),s=y(e.objectFacesSurface),a=y(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(e,t){var o=+n(t),l=+i(t),u=+r(t);Object.assign(e.position,jk(o,l,u)),s(t)?e.setRotationFromEuler(new Vi(Xk(-o),Xk(l),0,"YXZ")):e.rotation.set(0,0,0);var c=e.children[0],h=a(t);h&&c.setRotationFromEuler(new Vi(Xk(h.x||0),Xk(h.y||0),Xk(h.z||0)))}).digest(e.objectsData)}}),sH=g({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){zk(e),t.scene=e,t.dataMapper=new aG(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(e){var n=y(t.customThreeObject)(e,Gk);return n&&(t.customThreeObject===n&&(n=n.clone()),n.__globeObjType="custom"),n})},update:function(e,t){e.customThreeObjectUpdate||zk(e.scene);var n=y(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(e,t){return n(e,t,Gk)}).digest(e.customLayerData)}}),aH=window.THREE?window.THREE:{Camera:hs,Group:xs,Vector2:Sn,Vector3:wn},oH=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],lH=kk("globeLayer",Zk),uH=Object.assign.apply(Object,Uk(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(e){return Mk({},e,lH.linkProp(e))}))),cH=Object.assign.apply(Object,Uk(["globeMaterial","globeTileEngineClearCache"].map(function(e){return Mk({},e,lH.linkMethod(e))}))),hH=kk("pointsLayer",cG),dH=Object.assign.apply(Object,Uk(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(e){return Mk({},e,hH.linkProp(e))}))),pH=kk("arcsLayer",yG),mH=Object.assign.apply(Object,Uk(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(e){return Mk({},e,pH.linkProp(e))}))),fH=kk("hexBinLayer",TG),gH=Object.assign.apply(Object,Uk(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinRes
1olution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(e){return Mk({},e,fH.linkProp(e))}))),_H=kk("heatmapsLayer",NG),yH=Object.assign.apply(Object,Uk(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(e){return Mk({},e,_H.linkProp(e))}))),vH=kk("hexedPolygonsLayer",UG),xH=Object.assign.apply(Object,Uk(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(e){return Mk({},e,vH.linkProp(e))}))),bH=kk("polygonsLayer",IG),TH=Object.assign.apply(Object,Uk(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(e){return Mk({},e,bH.linkProp(e))}))),SH=kk("pathsLayer",zG),MH=Object.assign.apply(Object,Uk(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(e){return Mk({},e,SH.linkProp(e))}))),wH=kk("tilesLayer",GG),EH=Object.assign.apply(Object,Uk(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(e){return Mk({},e,wH.linkProp(e))}))),AH=kk("particlesLayer",WG),RH=Object.assign.apply(Object,Uk(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(e){return Mk({},e,AH.linkProp(e))}))),CH=kk("ringsLayer",ZG),NH=Object.assign.apply(Object,Uk(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(e){return Mk({},e,CH.linkProp(e))}))),PH=kk("labelsLayer",eH),IH=Object.assign.apply(Object,Uk(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(e){return Mk({},e,PH.linkProp(e))}))),LH=kk("htmlElementsLayer",nH),DH=Object.assign.apply(Object,Uk(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(e){return Mk({},e,LH.linkProp(e))}))),OH=kk("objectsLayer",rH),UH=Object.assign.apply(Object,Uk(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(e){return Mk({},e,OH.linkProp(e))}))),FH=kk("customLayer",sH),BH=Object.assign.apply(Object,Uk(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(e){return Mk({},e,FH.linkProp(e))})));var VH=function(e){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=function(n){function i(){var n;yk(this,i);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return(n=_k(this,i,[].concat(s))).__kapsuleInstance=Tk(e,[].concat(Uk(t?[n]:[]),s)),n}return Ak(i,n),Sk(i)}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object);return Object.keys(e()).forEach(function(e){return n.prototype[e]=function(){var t,n=(t=this.__kapsuleInstance)[e].apply(t,arguments);return n===this.__kapsuleInstance?this:n}}),n}(g({props:Nk(Nk(Nk(Nk(Nk(Nk(Nk(Nk(Nk(Nk(Nk(Nk(Nk(Nk(Nk({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new aH.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},uH),dH),mH),gH),yH),TH),xH),MH),EH),RH),NH),IH),DH),UH),BH),methods:Nk({getGlobeRadius:Hk,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return jk.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Wk.apply(void 0,n)}
vendor: 12,028 bytes, line 1
1,setPointOfView:function(e,t){var n,i,r,s,a=t instanceof aH.Camera?t.position:t,o=Hk(),l=void 0;e.scene&&a&&(l=function(t){void 0===n&&(n=a.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),void 0===i&&(i=n.length()),void 0===r&&(r=Math.sqrt(Math.pow(i,2)-Math.pow(o,2))),void 0===s&&(s=Math.acos(r/i));var l=n.distanceTo(t);if(l<r)return!1;var u=t.length();return Math.acos((Math.pow(i,2)+Math.pow(l,2)-Math.pow(u,2))/(2*i*l))<s});e.layersThatNeedUpdatePov.forEach(function(e){return e.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(e){return e.isBehindGlobe(l)})},pauseAnimation:function(e){return null!==e.animationFrameRequestId&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(e){var t;return null===(t=e.pauseAnimation)||void 0===t?void 0:t.call(e)}),this},resumeAnimation:function(e){return null===e.animationFrameRequestId&&this._animationCycle(),e.pausableLayers.forEach(function(e){var t;return null===(t=e.resumeAnimation)||void 0===t?void 0:t.call(e)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(e){return e._destructor()})}},cH),stateInit:function(){var e=new C,t={tweenGroup:e},n={globeLayer:Zk(t),pointsLayer:cG(t),arcsLayer:yG(t),hexBinLayer:TG(t),heatmapsLayer:NG(t),polygonsLayer:IG(t),hexedPolygonsLayer:UG(t),pathsLayer:zG(t),tilesLayer:GG(t),particlesLayer:WG(t),ringsLayer:ZG(t),labelsLayer:eH(t),htmlElementsLayer:nH(t),objectsLayer:rH(t),customLayer:sH(t)};return Nk(Nk({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(e){return e.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(e){return e.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(e){return e.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(e){return e.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var i=n.animateIn,r=void 0===i||i,s=n.waitForGlobeReady,a=void 0===s||s;zk(e),t.scene=e,t.scene.visible=!1,oH.forEach(function(e){var n=new aH.Group;t.scene.add(n),t[e](n)});var o=function(){if(r){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new v({k:1e-6}).to({k:1},600).easing(x.Quadratic.Out).onUpdate(function(e){var n=e.k;return t.scene.scale.set(n,n,n)}).start());var e=new aH.Vector3(0,1,0);t.tweenGroup.add(new v({rot:2*Math.PI}).to({rot:0},1200).easing(x.Quintic.Out).onUpdate(function(n){var i=n.rot;return t.scene.setRotationFromAxisAngle(e,i)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(o):o(),this._animationCycle()},update:function(e){}}),(window.THREE?window.THREE:{Group:xs}).Group,!0);const qH={type:"change"},zH={type:"start"},kH={type:"end"},GH=1e-6,HH=-1,jH=0,WH=1,XH=2,$H=3,YH=4,KH=new Sn,ZH=new Sn,JH=new wn,QH=new wn,ej=new wn,tj=new Mn,nj=new wn,ij=new wn,rj=new wn,sj=new wn;class aj extends vh{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:q.ROTATE,MIDDLE:q.DOLLY,RIGHT:q.PAN},this.target=new wn,this.state=HH,this.keyState=HH,this._lastPosition=new wn,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new wn,this._movePrev=new Sn,this._moveCurr=new Sn,this._lastAxis=new wn,this._zoomStart=new Sn,this._zoomEnd=new Sn,this._panStart=new Sn,this._panEnd=new Sn,this._pointers=[],this._pointerPositions={},this._onPointerMove=lj.bind(this),this._onPointerDown=oj.bind(this),this._onPointerUp=uj.bind(this),this._onPointerCancel=cj.bind(this),this._onContextMenu=_j.bind(this),this._onMouseWheel=gj.bind(this),this._onKeyDown=dj.bind(this),this._onKeyUp=hj.bind(this),this._onTouchStart=yj.bind(this),this._onTouchMove=vj.bind(this),this._onTouchEnd=xj.bind(this),this._onMouseDown=pj.bind(this),this._onMouseMove=mj.bind(this),this._onMouseUp=fj.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,null!==t&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}handleResize(){const e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>GH&&(this.dispatchEvent(qH),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera&&(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>GH||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(qH),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom))}reset(){this.state=HH,this.keyState=HH,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(qH),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(ZH.copy(this._panEnd).sub(this._panStart),ZH.lengthSq()){if(this.object.isOrthographicCamera){const e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;ZH.x*=e,ZH.y*=t}ZH.multiplyScalar(this._eye.length()*this.panSpeed),QH.copy(this._eye).cross(this.object.up).setLength(ZH.x),QH.add(JH.copy(this.object.up).setLength(ZH.y)),this.object.position.add(QH),this.target.add(QH),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(ZH.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){sj.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=sj.length();e?(this._eye.copy(this.object.position).sub(this.target),nj.copy(this._eye).normalize(),ij.copy(this.object.up).normalize(),rj.crossVectors(ij,nj).normalize(),ij.setLength(this._moveCurr.y-this._movePrev.y),rj.setLength(this._moveCurr.x-this._movePrev.x),sj.copy(ij.add(rj)),ej.crossVectors(sj,this._eye).normalize(),e*=this.rotateSpeed,tj.setFromAxisAngle(ej,e),this._eye.applyQuaternion(tj),this.object.up.applyQuaternion(tj),this._lastAxis.copy(ej),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),tj.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(tj),this.object.up.applyQuaternion(tj)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===YH?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera&&(this.object.zoom=Tn.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix())):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,1!==e&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera&&(this.object.zoom=Tn.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix())),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return KH.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),KH}_getMouseOnCircle(e,t){return KH.set((e-.5*this.screen.width-this.screen.left)/(.5*this.screen.width),(this.screen.height+2*(this.screen.top-t))/this.screen.width),KH}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId)return void this._pointers.splice(t,1)}_trackPointer(e){let t=this._pointerPositions[e.pointerId];void 0===t&&(t=new Sn,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){this.noZoom&&this.noPan||(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}}function oj(e){!1!==this.enabled&&(0===this._pointers.length&&(this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),this._addPointer(e),"touch"===e.pointerType?this._onTouchStart(e):this._onMouseDown(e))}function lj(e){!1!==this.enabled&&("touch"===e.pointerType?this._onTouchMove(e):this._onMouseMove(e))}function uj(e){!1!==this.enabled&&("touch"===e.pointerType?this._onTouchEnd(e):this._onMouseUp(),this._removePointer(e),0===this._pointers.length&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp)))}function cj(e){this._removePointer(e)}function hj(){!1!==this.enabled&&(this.keyState=HH,window.addEventListener("keydown",this._onKeyDown))}function dj(e){!1!==this.enabled&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===HH&&(e.code!==this.keys[jH]||this.noRotate?e.code!==this.keys[WH]||this.noZoom?e.code!==this.keys[XH]||this.noPan||(this.keyState=XH):this.keyState=WH:this.keyState=jH))}function pj(e){let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case q.DOLLY:this.state=WH;break;case q.ROTATE:this.state=jH;break;case q.PAN:this.state=XH;break;default:this.state=HH}
vendor: 14,068 bytes, line 1
1const n=this.keyState!==HH?this.keyState:this.state;n!==jH||this.noRotate?n!==WH||this.noZoom?n!==XH||this.noPan||(this._panStart.copy(this._getMouseOnScreen(e.pageX,e.pageY)),this._panEnd.copy(this._panStart)):(this._zoomStart.copy(this._getMouseOnScreen(e.pageX,e.pageY)),this._zoomEnd.copy(this._zoomStart)):(this._moveCurr.copy(this._getMouseOnCircle(e.pageX,e.pageY)),this._movePrev.copy(this._moveCurr)),this.dispatchEvent(zH)}function mj(e){const t=this.keyState!==HH?this.keyState:this.state;t!==jH||this.noRotate?t!==WH||this.noZoom?t!==XH||this.noPan||this._panEnd.copy(this._getMouseOnScreen(e.pageX,e.pageY)):this._zoomEnd.copy(this._getMouseOnScreen(e.pageX,e.pageY)):(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(e.pageX,e.pageY)))}function fj(){this.state=HH,this.dispatchEvent(kH)}function gj(e){if(!1!==this.enabled&&!0!==this.noZoom){switch(e.preventDefault(),e.deltaMode){case 2:this._zoomStart.y-=.025*e.deltaY;break;case 1:this._zoomStart.y-=.01*e.deltaY;break;default:this._zoomStart.y-=25e-5*e.deltaY}this.dispatchEvent(zH),this.dispatchEvent(kH)}}function _j(e){!1!==this.enabled&&e.preventDefault()}function yj(e){if(this._trackPointer(e),1===this._pointers.length)this.state=$H,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=YH;const e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);const n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,i=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,i)),this._panEnd.copy(this._panStart)}this.dispatchEvent(zH)}function vj(e){if(this._trackPointer(e),1===this._pointers.length)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(e.pageX,e.pageY));else{const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y;this._touchZoomDistanceEnd=Math.sqrt(n*n+i*i);const r=(e.pageX+t.x)/2,s=(e.pageY+t.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s))}}function xj(e){switch(this._pointers.length){case 0:this.state=HH;break;case 1:this.state=$H,this._moveCurr.copy(this._getMouseOnCircle(e.pageX,e.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=YH;for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId!==e.pointerId){const e=this._pointerPositions[this._pointers[t].pointerId];this._moveCurr.copy(this._getMouseOnCircle(e.x,e.y)),this._movePrev.copy(this._moveCurr);break}}this.dispatchEvent(kH)}const bj={type:"change"},Tj=1e-6,Sj=new Mn;class Mj extends vh{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new wn(0,0,0),this._rotationVector=new wn(0,0,0),this._lastQuaternion=new Mn,this._lastPosition=new wn,this._status=0,this._onKeyDown=wj.bind(this),this._onKeyUp=Ej.bind(this),this._onPointerMove=Rj.bind(this),this._onPointerDown=Aj.bind(this),this._onPointerUp=Cj.bind(this),this._onPointerCancel=Nj.bind(this),this._onContextMenu=Pj.bind(this),null!==t&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu)}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu)}dispose(){this.disconnect()}update(e){if(!1===this.enabled)return;const t=this.object,n=e*this.movementSpeed,i=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),Sj.set(this._rotationVector.x*i,this._rotationVector.y*i,this._rotationVector.z*i,1).normalize(),t.quaternion.multiply(Sj),(this._lastPosition.distanceToSquared(t.position)>Tj||8*(1-this._lastQuaternion.dot(t.quaternion))>Tj)&&(this.dispatchEvent(bj),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){const e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}}function wj(e){if(!e.altKey&&!1!==this.enabled){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1}this._updateMovementVector(),this._updateRotationVector()}}function Ej(e){if(!1!==this.enabled){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0}this._updateMovementVector(),this._updateRotationVector()}}function Aj(e){if(!1!==this.enabled)if(this.dragToLook)this._status++;else{switch(e.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1}this._updateMovementVector()}}function Rj(e){if(!1!==this.enabled&&(!this.dragToLook||this._status>0)){const t=this._getContainerDimensions(),n=t.size[0]/2,i=t.size[1]/2;this._moveState.yawLeft=-(e.pageX-t.offset[0]-n)/n,this._moveState.pitchDown=(e.pageY-t.offset[1]-i)/i,this._updateRotationVector()}}function Cj(e){if(!1!==this.enabled){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(e.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0}this._updateMovementVector()}this._updateRotationVector()}}function Nj(){!1!==this.enabled&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function Pj(e){!1!==this.enabled&&e.preventDefault()}const Ij={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"};class Lj{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){}dispose(){}}const Dj=new Xu(-1,1,1,-1,0,1);const Oj=new class extends jr{constructor(){super(),this.setAttribute("position",new Fr([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Fr([0,2,0,0,2,0],2))}};class Uj{constructor(e){this._mesh=new is(Oj,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Dj)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Fj extends Lj{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof cs?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=us.clone(e.uniforms),this.material=new cs({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new Uj(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class Bj extends Lj{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),r=e.state;let s,a;r.buffers.color.setMask(!1),r.buffers.depth.setMask(!1),r.buffers.color.setLocked(!0),r.buffers.depth.setLocked(!0),this.inverse?(s=0,a=1):(s=1,a=0),r.buffers.stencil.setTest(!0),r.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),r.buffers.stencil.setFunc(i.ALWAYS,s,4294967295),r.buffers.stencil.setClear(a),r.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),r.buffers.color.setLocked(!1),r.buffers.depth.setLocked(!1),r.buffers.color.setMask(!0),r.buffers.depth.setMask(!0),r.buffers.stencil.setLocked(!1),r.buffers.stencil.setFunc(i.EQUAL,1,4294967295),r.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),r.buffers.stencil.setLocked(!0)}}class Vj extends Lj{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class qj{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===t){const n=e.getSize(new Sn);this._width=n.width,this._height=n.height,(t=new Qn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:ze})).texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Fj(Ij),this.copyPass.material.blending=0,this.clock=new fc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let i=0,r=this.passes.length;i<r;i++){const t=this.passes[i];if(!1!==t.enabled){if(t.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(i),t.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),t.needsSwap){if(n){const t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==Bj&&(t instanceof Bj?n=!0:t instanceof Vj&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new Sn);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(n,i),this.renderTarget2.setSize(n,i);for(let r=0;r<this.passes.length;r++)this.passes[r].setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class zj extends Lj{constructor(e,t,n=null,i=null,r=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=r,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new br}render(e,t,n){const i=e.autoClear;let r,s;e.autoClear=!1,null!==this.overrideMaterial&&(s=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),null!==this.clearAlpha&&
vendor: 4,383 bytes, line 1
1(r=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),1==this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),!0===this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),null!==this.clearColor&&e.setClearColor(this._oldClearColor),null!==this.clearAlpha&&e.setClearAlpha(r),null!==this.overrideMaterial&&(this.scene.overrideMaterial=s),e.autoClear=i}}function kj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Gj(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hj(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(l=(i=s.call(n)).done)&&(o.push(i.value),o.length!==t);l=!0);}catch(c){u=!0,r=c}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return o}}(e,t)||Wj(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jj(e){return function(e){if(Array.isArray(e))return kj(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Wj(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wj(e,t){if(e){if("string"==typeof e)return kj(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kj(e,t):void 0}}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".scene-nav-info {\n position: absolute;\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n font-family: sans-serif;\n pointer-events: none;\n user-select: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}");var Xj=window.THREE?window.THREE:{WebGLRenderer:im,Scene:ws,PerspectiveCamera:fs,Raycaster:Vc,SRGBColorSpace:Ht,TextureLoader:Lu,Vector2:Sn,Vector3:wn,Box3:ni,Color:br,Mesh:is,SphereGeometry:Vl,MeshBasicMaterial:wr,BackSide:1,Clock:fc},$j=g({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.clock.getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEac
vendor: 5,993 bytes, line 1
1h(function(t){return t.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var i=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&i.sort(function(t,n){return e.hoverOrderComparator(t.object,n.object)});var r=i.find(function(t){return e.hoverFilter(t.object)})||null;n=r?r.object:null,e.intersection=r||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&y(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos;return{x:t.x,y:t.y}},cameraPosition:function(e,t,n,i){var r=e.camera;if(t&&e.initialised){var s=t,a=n||{x:0,y:0,z:0};if(i){var o=Object.assign({},r.position),l=h();e.tweenGroup.add(new v(o).to(s,i).easing(x.Quadratic.Out).onUpdate(u).start()),e.tweenGroup.add(new v(l).to(a,i/3).easing(x.Quadratic.Out).onUpdate(c).start())}else u(s),c(a);return this}return Object.assign({},r.position,{lookAt:h()});function u(e){var t=e.x,n=e.y,i=e.z;void 0!==t&&(r.position.x=t),void 0!==n&&(r.position.y=n),void 0!==i&&(r.position.z=i)}function c(t){var n=new Xj.Vector3(t.x,t.y,t.z);e.controls.enabled&&e.controls.target?e.controls.target=n:r.lookAt(n)}function h(){return Object.assign(new Xj.Vector3(0,0,-1e3).applyQuaternion(r.quaternion).add(r.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,i=arguments.length,r=new Array(i>3?i-3:0),s=3;s<i;s++)r[s-3]=arguments[s];return this.fitToBbox(this.getBbox.apply(this,r),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,r=e.camera;if(t){var s=new Xj.Vector3(0,0,0),a=2*Math.max.apply(Math,jj(Object.entries(t).map(function(e){var t=Hj(e,2),n=t[0],i=t[1];return Math.max.apply(Math,jj(i.map(function(e){return Math.abs(s[n]-e)})))}))),o=(1-2*i/e.height)*r.fov,l=a/Math.atan(o*Math.PI/180),u=l/r.aspect,c=Math.max(l,u);if(c>0){var h=s.clone().sub(r.position).normalize().multiplyScalar(-c);this.cameraPosition(h,s,n)}}return this},getBbox:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0},n=new Xj.Box3(new Xj.Vector3(0,0,0),new Xj.Vector3(0,0,0)),i=e.objects.filter(t);return i.length?(i.forEach(function(e){return n.expandByObject(e)}),Object.assign.apply(Object,jj(["x","y","z"].map(function(e){return Gj({},e,[n.min[e],n.max[e]])})))):null},getScreenCoords:function(e,t,n,i){var r=new Xj.Vector3(t,n,i);return r.project(this.camera()),{x:(r.x+1)*e.width/2,y:-(r.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=new Xj.Vector2(t/e.width*2-1,-n/e.height*2+1),s=new Xj.Raycaster;return s.setFromCamera(r,e.camera),Object.assign({},s.ray.at(i,new Xj.Vector3))},intersectingObjects:function(e,t,n){var i=new Xj.Vector2(t/e.width*2-1,-n/e.height*2+1),r=new Xj.Raycaster;return r.params.Line.threshold=e.lineHoverPrecision,r.params.Points.threshold=e.pointsHoverPrecision,r.setFromCamera(i,e.camera),r.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls}},stateInit:function(){return{scene:new Xj.Scene,camera:new Xj.PerspectiveCamera,clock:new Xj.Clock,tweenGroup:new C,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.controlType,r=void 0===i?"trackball":i,s=n.useWebGPU,a=void 0!==s&&s,o=n.rendererConfig,l=void 0===o?{}:o,u=n.extraRenderers,c=void 0===u?[]:u,h=n.waitForLoadComplete,d=void 0===h||h;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[r]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new B(t.container),t.pointerPos=new Xj.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(e){return t.container.addEventListener(e,function(n){if("pointerdown"===e&&(t.isPointerPressed=!0),!t.isPointerDragging&&"pointermove"===n.type&&(n.pressure>0||t.isPointerPressed)&&("mouse"===n.pointerType||void 0===n.movementX||[n.movementX,n.movementY].some(function(e){return Math.abs(e)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var i=(r=t.container,s=r.getBoundingClientRect(),a=window.pageXOffset||document.documentElement.scrollLeft,o=window.pageYOffset||document.documentElement.scrollTop,{top:s.top+o,left:s.left+a});t.pointerPos.x=n.pageX-i.left,t.pointerPos.y=n.pageY-i.top}var r,s,a,o},{passive:!0})}),t.container.addEventListener("pointerup",function(e){t.isPointerPressed&&(t.isPointerPressed=!1,t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag)||requestAnimationFrame(function(){0===e.button&&t.onClick(t.hoverObj||null,e,t.intersection),2===e.button&&t.onRightClick&&t.onRightClick(t.hoverObj||null,e,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(e){t.onRightClick&&e.preventDefault()}),t.renderer=new(a?Cz:Xj.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},l)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=c,t.extraRenderers.forEac
vendor: 3,307 bytes, line 1
1h(function(e){e.domElement.style.position="absolute",e.domElement.style.top="0px",e.domElement.style.pointerEvents="none",t.container.appendChild(e.domElement)}),t.postProcessingComposer=new qj(t.renderer),t.postProcessingComposer.addPass(new zj(t.scene,t.camera)),t.controls=new{trackball:aj,orbit:wf,fly:Mj}[r](t.camera,t.renderer.domElement),"fly"===r&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),"trackball"!==r&&"orbit"!==r||(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(jj(t.extraRenderers)).forEach(function(e){return e.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Xj.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!d,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,i=e.width,r=e.height;e.container.style.width="".concat(i,"px"),e.container.style.height="".concat(r,"px"),[e.renderer,e.postProcessingComposer].concat(jj(e.extraRenderers)).forEach(function(e){return e.setSize(i,r)}),e.camera.aspect=i/r;var s=e.viewOffset.slice(0,2);s.some(function(e){return e})&&(n=e.camera).setViewOffset.apply(n,[i,r].concat(jj(s),[i,r])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,o=e.width,l=e.height,u=e.viewOffset.slice(0,2);u.some(function(e){return e})?(a=e.camera).setViewOffset.apply(a,[o,l].concat(jj(u),[o,l])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=2.5*e.skyRadius,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new Xj.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var c=U(e.backgroundColor).alpha;void 0===c&&(c=1),e.renderer.setClearColor(new Xj.Color(F(1,e.backgroundColor)),c)}function h(){e.loadComplete=e.scene.visible=!0}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?(new Xj.TextureLoader).load(e.backgroundImageUrl,function(t){t.colorSpace=Xj.SRGBColorSpace,e.skysphere.material=new Xj.MeshBasicMaterial({map:t,side:Xj.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&h()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&h())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(t){return e.scene.remove(t)}),e.lights.forEach(function(t){return e.scene.add(t)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(t){return e.scene.remove(t)}),e.objects.forEach(function(t){return e.scene.add(t)}))}});export{Ku as A,Gf as C,Yu as D,um as G,Ou as H,Ll as I,is as M,wf as O,fs as P,V as R,ws as S,Lu as T,Sn as V,im as W,$j as a,br as b,cs as c,mo as d,Wu as e,Ul as f,wr as g,rm as h,VH as t};
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.