Files
lit-examples/assets/aframe-forcegraph-component-B3vzsuem.js
2026-07-05 02:38:01 +00:00

4860 lines
1.3 MiB
Plaintext

import{G as Q0,i as _x,m as Mx,C as Sx,j as Ix,c as Bx,b as Tx,L as Rx,f as Lx,h as Dx,B as Px,e as Ux,Q as Fx,g as Ox,d as kx,o as Nx,p as Qx}from"./three.module-Unazwo7z.js";import{c as Gx,f as zx,D as Hx}from"./data-bind-mapper-D9QKwI5o.js";import{i as Vx,h as pt,e as Wx,g as qx,b as jx,c as Xx,f as Yx,k as Kx,m as Jx,l as G0,o as Zx,s as $x}from"./Paired-C4wB-ooD.js";/**
* @license
* Copyright 2010-2025 Three.js Authors
* SPDX-License-Identifier: MIT
*/const Jc="173",eb={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},tb={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},z0=0,Rd=1,H0=2,nb=3,ib=0,Bf=1,V0=2,ii=3,Pi=0,An=1,si=2,Bi=0,Gr=1,Ld=2,Dd=3,Pd=4,W0=5,Zi=100,q0=101,j0=102,X0=103,Y0=104,K0=200,J0=201,Z0=202,$0=203,Kl=204,Jl=205,ev=206,tv=207,nv=208,iv=209,rv=210,sv=211,ov=212,av=213,lv=214,Zl=0,$l=1,ec=2,Wr=3,tc=4,nc=5,ic=6,rc=7,oa=0,cv=1,hv=2,Ti=0,uv=1,dv=2,fv=3,pv=4,Av=5,mv=6,gv=7,Ud="attached",vv="detached",Zc=300,Ui=301,nr=302,Oo=303,ko=304,Gs=306,No=1e3,On=1001,Qo=1002,Zt=1003,Tf=1004,rb=1004,Ss=1005,sb=1005,Ht=1006,_o=1007,ob=1007,oi=1008,ab=1008,hi=1009,Rf=1010,Lf=1011,Us=1012,$c=1013,Fi=1014,un=1015,zs=1016,eh=1017,th=1018,$i=1020,Df=35902,Pf=1021,Uf=1022,pn=1023,Ff=1024,Of=1025,er=1026,tr=1027,nh=1028,aa=1029,kf=1030,ih=1031,lb=1032,rh=1033,Mo=33776,So=33777,Io=33778,Bo=33779,sc=35840,oc=35841,ac=35842,lc=35843,cc=36196,hc=37492,uc=37496,dc=37808,fc=37809,pc=37810,Ac=37811,mc=37812,gc=37813,vc=37814,yc=37815,Ec=37816,xc=37817,bc=37818,Cc=37819,wc=37820,_c=37821,To=36492,Mc=36494,Sc=36495,Nf=36283,Ic=36284,Bc=36285,Tc=36286,yv=2200,Ev=2201,xv=2202,Go=2300,Rc=2301,Ql=2302,Or=2400,kr=2401,zo=2402,sh=2500,Qf=2501,cb=0,hb=1,ub=2,bv=3200,Cv=3201,db=3202,fb=3203,or=0,wv=1,Ci="",xn="srgb",qr="srgb-linear",Ho="linear",bt="srgb",pb=0,Pr=7680,Ab=7681,mb=7682,gb=7683,vb=34055,yb=34056,Eb=5386,xb=512,bb=513,Cb=514,wb=515,_b=516,Mb=517,Sb=518,Fd=519,_v=512,Mv=513,Sv=514,Gf=515,Iv=516,Bv=517,Tv=518,Rv=519,Vo=35044,Ib=35048,Bb=35040,Tb=35045,Rb=35049,Lb=35041,Db=35046,Pb=35050,Ub=35042,Fb="100",Od="300 es",Kn=2e3,Wo=2001,Ob={COMPUTE:"compute",RENDER:"render"};class ui{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const en=["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 nA=1234567;const zr=Math.PI/180,Fs=180/Math.PI;function Rn(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(en[n&255]+en[n>>8&255]+en[n>>16&255]+en[n>>24&255]+"-"+en[e&255]+en[e>>8&255]+"-"+en[e>>16&15|64]+en[e>>24&255]+"-"+en[t&63|128]+en[t>>8&255]+"-"+en[t>>16&255]+en[t>>24&255]+en[i&255]+en[i>>8&255]+en[i>>16&255]+en[i>>24&255]).toLowerCase()}function tt(n,e,t){return Math.max(e,Math.min(t,n))}function zf(n,e){return(n%e+e)%e}function kb(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function Nb(n,e,t){return n!==e?(t-n)/(e-n):0}function Ro(n,e,t){return(1-t)*n+t*e}function Qb(n,e,t,i){return Ro(n,e,1-Math.exp(-t*i))}function Gb(n,e=1){return e-Math.abs(zf(n,e*2)-e)}function zb(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Hb(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Vb(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Wb(n,e){return n+Math.random()*(e-n)}function qb(n){return n*(.5-Math.random())}function jb(n){n!==void 0&&(nA=n);let e=nA+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Xb(n){return n*zr}function Yb(n){return n*Fs}function Kb(n){return(n&n-1)===0&&n!==0}function Jb(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Zb(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function $b(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),h=o((e+i)/2),u=s((e-i)/2),d=o((e-i)/2),f=s((i-e)/2),A=o((i-e)/2);switch(r){case"XYX":n.set(a*h,l*u,l*d,a*c);break;case"YZY":n.set(l*d,a*h,l*u,a*c);break;case"ZXZ":n.set(l*u,l*d,a*h,a*c);break;case"XZX":n.set(a*h,l*A,l*f,a*c);break;case"YXY":n.set(l*f,a*h,l*A,a*c);break;case"ZYZ":n.set(l*A,l*f,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function dn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function rt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const eC={DEG2RAD:zr,RAD2DEG:Fs,generateUUID:Rn,clamp:tt,euclideanModulo:zf,mapLinear:kb,inverseLerp:Nb,lerp:Ro,damp:Qb,pingpong:Gb,smoothstep:zb,smootherstep:Hb,randInt:Vb,randFloat:Wb,randFloatSpread:qb,seededRandom:jb,degToRad:Xb,radToDeg:Yb,isPowerOfTwo:Kb,ceilPowerOfTwo:Jb,floorPowerOfTwo:Zb,setQuaternionFromProperEuler:$b,normalize:rt,denormalize:dn};class fe{constructor(e=0,t=0){fe.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,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,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 i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class et{constructor(e,t,i,r,s,o,a,l,c){et.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=a,h[3]=t,h[4]=s,h[5]=l,h[6]=i,h[7]=o,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.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 i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],h=i[4],u=i[7],d=i[2],f=i[5],A=i[8],g=r[0],m=r[3],p=r[6],v=r[1],y=r[4],b=r[7],w=r[2],M=r[5],S=r[8];return s[0]=o*g+a*v+l*w,s[3]=o*m+a*y+l*M,s[6]=o*p+a*b+l*S,s[1]=c*g+h*v+u*w,s[4]=c*m+h*y+u*M,s[7]=c*p+h*b+u*S,s[2]=d*g+f*v+A*w,s[5]=d*m+f*y+A*M,s[8]=d*p+f*b+A*S,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],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-i*s*h+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=h*o-a*c,d=a*l-h*s,f=c*s-o*l,A=t*u+i*d+r*f;if(A===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/A;return e[0]=u*g,e[1]=(r*c-h*i)*g,e[2]=(a*i-r*o)*g,e[3]=d*g,e[4]=(h*t-r*l)*g,e[5]=(r*s-a*t)*g,e[6]=f*g,e[7]=(i*l-c*t)*g,e[8]=(o*t-i*s)*g,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,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(zh.makeScale(e,t)),this}rotate(e){return this.premultiply(zh.makeRotation(-e)),this}translate(e,t){return this.premultiply(zh.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),i=Math.sin(e);return this.set(t,-i,0,i,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,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const zh=new et;function Lv(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const tC={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Is(n,e){return new tC[n](e)}function qo(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Dv(){const n=qo("canvas");return n.style.display="block",n}const iA={};function Ms(n){n in iA||(iA[n]=!0,console.warn(n))}function nC(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}function iC(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function rC(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const rA=new et().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),sA=new et().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function sC(){const n={enabled:!0,workingColorSpace:qr,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===bt&&(r.r=Ri(r.r),r.g=Ri(r.g),r.b=Ri(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===bt&&(r.r=Ds(r.r),r.g=Ds(r.g),r.b=Ds(r.b))),r},fromWorkingColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},toWorkingColorSpace:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Ci?Ho:this.spaces[r].transfer},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[qr]:{primaries:e,whitePoint:i,transfer:Ho,toXYZ:rA,fromXYZ:sA,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:xn},outputColorSpaceConfig:{drawingBufferColorSpace:xn}},[xn]:{primaries:e,whitePoint:i,transfer:bt,toXYZ:rA,fromXYZ:sA,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:xn}}}),n}const ht=sC();function Ri(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ds(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let ts;class Pv{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ts===void 0&&(ts=qo("canvas")),ts.width=e.width,ts.height=e.height;const i=ts.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=ts}return t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=qo("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Ri(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Ri(t[i]/255)*255):t[i]=Ri(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let oC=0;class Nr{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:oC++}),this.uuid=Rn(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(Hh(r[o].image)):s.push(Hh(r[o]))}else s=Hh(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Hh(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Pv.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let aC=0;class Tt extends ui{constructor(e=Tt.DEFAULT_IMAGE,t=Tt.DEFAULT_MAPPING,i=On,r=On,s=Ht,o=oi,a=pn,l=hi,c=Tt.DEFAULT_ANISOTROPY,h=Ci){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:aC++}),this.uuid=Rn(),this.name="",this.source=new Nr(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new fe(0,0),this.repeat=new fe(1,1),this.center=new fe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new et,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Zc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case No:e.x=e.x-Math.floor(e.x);break;case On:e.x=e.x<0?0:1;break;case Qo:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case No:e.y=e.y-Math.floor(e.y);break;case On:e.y=e.y<0?0:1;break;case Qo:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Tt.DEFAULT_IMAGE=null;Tt.DEFAULT_MAPPING=Zc;Tt.DEFAULT_ANISOTROPY=1;class mt{constructor(e=0,t=0,i=0,r=1){mt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],h=l[4],u=l[8],d=l[1],f=l[5],A=l[9],g=l[2],m=l[6],p=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-g)<.01&&Math.abs(A-m)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+g)<.1&&Math.abs(A+m)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,b=(f+1)/2,w=(p+1)/2,M=(h+d)/4,S=(u+g)/4,R=(A+m)/4;return y>b&&y>w?y<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(y),r=M/i,s=S/i):b>w?b<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),i=M/r,s=R/r):w<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),i=S/s,r=R/s),this.set(i,r,s,t),this}let v=Math.sqrt((m-A)*(m-A)+(u-g)*(u-g)+(d-h)*(d-h));return Math.abs(v)<.001&&(v=1),this.x=(m-A)/v,this.y=(u-g)/v,this.z=(d-h)/v,this.w=Math.acos((c+f+p-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=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this.z=tt(this.z,e.z,t.z),this.w=tt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this.z=tt(this.z,e,t),this.w=tt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,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 oh extends ui{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new mt(0,0,e,t),this.scissorTest=!1,this.viewport=new mt(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ht,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Tt(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;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 i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0,this.textures[i].renderTarget=this;const t=Object.assign({},e.texture.image);return this.texture.source=new Nr(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Jn extends oh{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class la extends Tt{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Zt,this.minFilter=Zt,this.wrapR=On,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class lC extends Jn{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new la(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class ah extends Tt{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Zt,this.minFilter=Zt,this.wrapR=On,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class cC extends Jn{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new ah(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class wn{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],h=i[r+2],u=i[r+3];const d=s[o+0],f=s[o+1],A=s[o+2],g=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(a===1){e[t+0]=d,e[t+1]=f,e[t+2]=A,e[t+3]=g;return}if(u!==g||l!==d||c!==f||h!==A){let m=1-a;const p=l*d+c*f+h*A+u*g,v=p>=0?1:-1,y=1-p*p;if(y>Number.EPSILON){const w=Math.sqrt(y),M=Math.atan2(w,p*v);m=Math.sin(m*M)/w,a=Math.sin(a*M)/w}const b=a*v;if(l=l*m+d*b,c=c*m+f*b,h=h*m+A*b,u=u*m+g*b,m===1-a){const w=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=w,c*=w,h*=w,u*=w}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],h=i[r+3],u=s[o],d=s[o+1],f=s[o+2],A=s[o+3];return e[t]=a*A+h*u+l*f-c*d,e[t+1]=l*A+h*d+c*u-a*f,e[t+2]=c*A+h*f+a*d-l*u,e[t+3]=h*A-a*u-l*d-c*f,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,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),h=a(r/2),u=a(s/2),d=l(i/2),f=l(r/2),A=l(s/2);switch(o){case"XYZ":this._x=d*h*u+c*f*A,this._y=c*f*u-d*h*A,this._z=c*h*A+d*f*u,this._w=c*h*u-d*f*A;break;case"YXZ":this._x=d*h*u+c*f*A,this._y=c*f*u-d*h*A,this._z=c*h*A-d*f*u,this._w=c*h*u+d*f*A;break;case"ZXY":this._x=d*h*u-c*f*A,this._y=c*f*u+d*h*A,this._z=c*h*A+d*f*u,this._w=c*h*u-d*f*A;break;case"ZYX":this._x=d*h*u-c*f*A,this._y=c*f*u+d*h*A,this._z=c*h*A-d*f*u,this._w=c*h*u+d*f*A;break;case"YZX":this._x=d*h*u+c*f*A,this._y=c*f*u+d*h*A,this._z=c*h*A-d*f*u,this._w=c*h*u-d*f*A;break;case"XZY":this._x=d*h*u-c*f*A,this._y=c*f*u-d*h*A,this._z=c*h*A+d*f*u,this._w=c*h*u+d*f*A;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],h=t[6],u=t[10],d=i+a+u;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-l)*f,this._y=(s-c)*f,this._z=(o-r)*f}else if(i>a&&i>u){const f=2*Math.sqrt(1+i-a-u);this._w=(h-l)/f,this._x=.25*f,this._y=(r+o)/f,this._z=(s+c)/f}else if(a>u){const f=2*Math.sqrt(1+a-i-u);this._w=(s-c)/f,this._x=(r+o)/f,this._y=.25*f,this._z=(l+h)/f}else{const f=2*Math.sqrt(1+u-i-a);this._w=(o-r)/f,this._x=(s+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(tt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=i*h+o*a+r*c-s*l,this._y=r*h+o*l+s*a-i*c,this._z=s*h+o*c+i*l-r*a,this._w=o*h-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const f=1-t;return this._w=f*o+t*this._w,this._x=f*i+t*this._x,this._y=f*r+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,a),u=Math.sin((1-t)*h)/c,d=Math.sin(t*h)/c;return this._w=o*u+this._w*d,this._x=i*u+this._x*d,this._y=r*u+this._y*d,this._z=s*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,i=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,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(oA.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(oA.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),h=2*(a*t-s*r),u=2*(s*i-o*t);return this.x=t+l*c+o*u-a*h,this.y=i+l*h+a*c-s*u,this.z=r+l*u+s*h-o*c,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,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this.z=tt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this.z=tt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Vh.copy(this).projectOnVector(e),this.sub(Vh)}reflect(e){return this.sub(Vh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,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(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Vh=new F,oA=new wn;class mn{constructor(e=new F(1/0,1/0,1/0),t=new F(-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,i=e.length;t<i;t+=3)this.expandByPoint(Qn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Qn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Qn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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 i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Qn):Qn.fromBufferAttribute(s,o),Qn.applyMatrix4(e.matrixWorld),this.expandByPoint(Qn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ea.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Ea.copy(i.boundingBox)),Ea.applyMatrix4(e.matrixWorld),this.union(Ea)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Qn),Qn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Xs),xa.subVectors(this.max,Xs),ns.subVectors(e.a,Xs),is.subVectors(e.b,Xs),rs.subVectors(e.c,Xs),Ni.subVectors(is,ns),Qi.subVectors(rs,is),dr.subVectors(ns,rs);let t=[0,-Ni.z,Ni.y,0,-Qi.z,Qi.y,0,-dr.z,dr.y,Ni.z,0,-Ni.x,Qi.z,0,-Qi.x,dr.z,0,-dr.x,-Ni.y,Ni.x,0,-Qi.y,Qi.x,0,-dr.y,dr.x,0];return!Wh(t,ns,is,rs,xa)||(t=[1,0,0,0,1,0,0,0,1],!Wh(t,ns,is,rs,xa))?!1:(ba.crossVectors(Ni,Qi),t=[ba.x,ba.y,ba.z],Wh(t,ns,is,rs,xa))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Qn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(fi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const fi=[new F,new F,new F,new F,new F,new F,new F,new F],Qn=new F,Ea=new mn,ns=new F,is=new F,rs=new F,Ni=new F,Qi=new F,dr=new F,Xs=new F,xa=new F,ba=new F,fr=new F;function Wh(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){fr.fromArray(n,s);const a=r.x*Math.abs(fr.x)+r.y*Math.abs(fr.y)+r.z*Math.abs(fr.z),l=e.dot(fr),c=t.dot(fr),h=i.dot(fr);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}const hC=new mn,Ys=new F,qh=new F;class sn{constructor(e=new F,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 i=this.center;t!==void 0?i.copy(t):hC.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>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;Ys.subVectors(e,this.center);const t=Ys.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Ys,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(qh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ys.copy(e.center).add(qh)),this.expandByPoint(Ys.copy(e.center).sub(qh))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const pi=new F,jh=new F,Ca=new F,Gi=new F,Xh=new F,wa=new F,Yh=new F;class Hs{constructor(e=new F,t=new F(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,pi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=pi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(pi.copy(this.origin).addScaledVector(this.direction,t),pi.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){jh.copy(e).add(t).multiplyScalar(.5),Ca.copy(t).sub(e).normalize(),Gi.copy(this.origin).sub(jh);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Ca),a=Gi.dot(this.direction),l=-Gi.dot(Ca),c=Gi.lengthSq(),h=Math.abs(1-o*o);let u,d,f,A;if(h>0)if(u=o*l-a,d=o*a-l,A=s*h,u>=0)if(d>=-A)if(d<=A){const g=1/h;u*=g,d*=g,f=u*(u+o*d+2*a)+d*(o*u+d+2*l)+c}else d=s,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*l)+c;else d=-s,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*l)+c;else d<=-A?(u=Math.max(0,-(-o*s+a)),d=u>0?-s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c):d<=A?(u=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(u=Math.max(0,-(o*s+a)),d=u>0?s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c);else d=o>0?-s:s,u=Math.max(0,-(o*d+a)),f=-u*u+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(jh).addScaledVector(Ca,d),f}intersectSphere(e,t){pi.subVectors(e.center,this.origin);const i=pi.dot(this.direction),r=pi.dot(pi)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),h>=0?(s=(e.min.y-d.y)*h,o=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,o=(e.min.y-d.y)*h),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),u>=0?(a=(e.min.z-d.z)*u,l=(e.max.z-d.z)*u):(a=(e.max.z-d.z)*u,l=(e.min.z-d.z)*u),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,pi)!==null}intersectTriangle(e,t,i,r,s){Xh.subVectors(t,e),wa.subVectors(i,e),Yh.crossVectors(Xh,wa);let o=this.direction.dot(Yh),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Gi.subVectors(this.origin,e);const l=a*this.direction.dot(wa.crossVectors(Gi,wa));if(l<0)return null;const c=a*this.direction.dot(Xh.cross(Gi));if(c<0||l+c>o)return null;const h=-a*Gi.dot(Yh);return h<0?null:this.at(h/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ye{constructor(e,t,i,r,s,o,a,l,c,h,u,d,f,A,g,m){Ye.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,h,u,d,f,A,g,m)}set(e,t,i,r,s,o,a,l,c,h,u,d,f,A,g,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=i,p[12]=r,p[1]=s,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=A,p[11]=g,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ye().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/ss.setFromMatrixColumn(e,0).length(),s=1/ss.setFromMatrixColumn(e,1).length(),o=1/ss.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const d=o*h,f=o*u,A=a*h,g=a*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=f+A*c,t[5]=d-g*c,t[9]=-a*l,t[2]=g-d*c,t[6]=A+f*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*h,f=l*u,A=c*h,g=c*u;t[0]=d+g*a,t[4]=A*a-f,t[8]=o*c,t[1]=o*u,t[5]=o*h,t[9]=-a,t[2]=f*a-A,t[6]=g+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*h,f=l*u,A=c*h,g=c*u;t[0]=d-g*a,t[4]=-o*u,t[8]=A+f*a,t[1]=f+A*a,t[5]=o*h,t[9]=g-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*h,f=o*u,A=a*h,g=a*u;t[0]=l*h,t[4]=A*c-f,t[8]=d*c+g,t[1]=l*u,t[5]=g*c+d,t[9]=f*c-A,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,f=o*c,A=a*l,g=a*c;t[0]=l*h,t[4]=g-d*u,t[8]=A*u+f,t[1]=u,t[5]=o*h,t[9]=-a*h,t[2]=-c*h,t[6]=f*u+A,t[10]=d-g*u}else if(e.order==="XZY"){const d=o*l,f=o*c,A=a*l,g=a*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=d*u+g,t[5]=o*h,t[9]=f*u-A,t[2]=A*u-f,t[6]=a*h,t[10]=g*u+d}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(uC,e,dC)}lookAt(e,t,i){const r=this.elements;return Sn.subVectors(e,t),Sn.lengthSq()===0&&(Sn.z=1),Sn.normalize(),zi.crossVectors(i,Sn),zi.lengthSq()===0&&(Math.abs(i.z)===1?Sn.x+=1e-4:Sn.z+=1e-4,Sn.normalize(),zi.crossVectors(i,Sn)),zi.normalize(),_a.crossVectors(Sn,zi),r[0]=zi.x,r[4]=_a.x,r[8]=Sn.x,r[1]=zi.y,r[5]=_a.y,r[9]=Sn.y,r[2]=zi.z,r[6]=_a.z,r[10]=Sn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],h=i[1],u=i[5],d=i[9],f=i[13],A=i[2],g=i[6],m=i[10],p=i[14],v=i[3],y=i[7],b=i[11],w=i[15],M=r[0],S=r[4],R=r[8],_=r[12],I=r[1],D=r[5],Q=r[9],N=r[13],z=r[2],$=r[6],H=r[10],K=r[14],Y=r[3],ee=r[7],pe=r[11],be=r[15];return s[0]=o*M+a*I+l*z+c*Y,s[4]=o*S+a*D+l*$+c*ee,s[8]=o*R+a*Q+l*H+c*pe,s[12]=o*_+a*N+l*K+c*be,s[1]=h*M+u*I+d*z+f*Y,s[5]=h*S+u*D+d*$+f*ee,s[9]=h*R+u*Q+d*H+f*pe,s[13]=h*_+u*N+d*K+f*be,s[2]=A*M+g*I+m*z+p*Y,s[6]=A*S+g*D+m*$+p*ee,s[10]=A*R+g*Q+m*H+p*pe,s[14]=A*_+g*N+m*K+p*be,s[3]=v*M+y*I+b*z+w*Y,s[7]=v*S+y*D+b*$+w*ee,s[11]=v*R+y*Q+b*H+w*pe,s[15]=v*_+y*N+b*K+w*be,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],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],h=e[2],u=e[6],d=e[10],f=e[14],A=e[3],g=e[7],m=e[11],p=e[15];return A*(+s*l*u-r*c*u-s*a*d+i*c*d+r*a*f-i*l*f)+g*(+t*l*f-t*c*d+s*o*d-r*o*f+r*c*h-s*l*h)+m*(+t*c*u-t*a*f-s*o*u+i*o*f+s*a*h-i*c*h)+p*(-r*a*h-t*l*u+t*a*d+r*o*u-i*o*d+i*l*h)}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,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],f=e[11],A=e[12],g=e[13],m=e[14],p=e[15],v=u*m*c-g*d*c+g*l*f-a*m*f-u*l*p+a*d*p,y=A*d*c-h*m*c-A*l*f+o*m*f+h*l*p-o*d*p,b=h*g*c-A*u*c+A*a*f-o*g*f-h*a*p+o*u*p,w=A*u*l-h*g*l-A*a*d+o*g*d+h*a*m-o*u*m,M=t*v+i*y+r*b+s*w;if(M===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/M;return e[0]=v*S,e[1]=(g*d*s-u*m*s-g*r*f+i*m*f+u*r*p-i*d*p)*S,e[2]=(a*m*s-g*l*s+g*r*c-i*m*c-a*r*p+i*l*p)*S,e[3]=(u*l*s-a*d*s-u*r*c+i*d*c+a*r*f-i*l*f)*S,e[4]=y*S,e[5]=(h*m*s-A*d*s+A*r*f-t*m*f-h*r*p+t*d*p)*S,e[6]=(A*l*s-o*m*s-A*r*c+t*m*c+o*r*p-t*l*p)*S,e[7]=(o*d*s-h*l*s+h*r*c-t*d*c-o*r*f+t*l*f)*S,e[8]=b*S,e[9]=(A*u*s-h*g*s-A*i*f+t*g*f+h*i*p-t*u*p)*S,e[10]=(o*g*s-A*a*s+A*i*c-t*g*c-o*i*p+t*a*p)*S,e[11]=(h*a*s-o*u*s-h*i*c+t*u*c+o*i*f-t*a*f)*S,e[12]=w*S,e[13]=(h*g*r-A*u*r+A*i*d-t*g*d-h*i*m+t*u*m)*S,e[14]=(A*a*r-o*g*r-A*i*l+t*g*l+o*i*m-t*a*m)*S,e[15]=(o*u*r-h*a*r+h*i*l-t*u*l-o*i*d+t*a*d)*S,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){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,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,h=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,h*a+i,h*l-r*o,0,c*l-r*a,h*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,h=o+o,u=a+a,d=s*c,f=s*h,A=s*u,g=o*h,m=o*u,p=a*u,v=l*c,y=l*h,b=l*u,w=i.x,M=i.y,S=i.z;return r[0]=(1-(g+p))*w,r[1]=(f+b)*w,r[2]=(A-y)*w,r[3]=0,r[4]=(f-b)*M,r[5]=(1-(d+p))*M,r[6]=(m+v)*M,r[7]=0,r[8]=(A+y)*S,r[9]=(m-v)*S,r[10]=(1-(d+g))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=ss.set(r[0],r[1],r[2]).length();const o=ss.set(r[4],r[5],r[6]).length(),a=ss.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Gn.copy(this);const c=1/s,h=1/o,u=1/a;return Gn.elements[0]*=c,Gn.elements[1]*=c,Gn.elements[2]*=c,Gn.elements[4]*=h,Gn.elements[5]*=h,Gn.elements[6]*=h,Gn.elements[8]*=u,Gn.elements[9]*=u,Gn.elements[10]*=u,t.setFromRotationMatrix(Gn),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Kn){const l=this.elements,c=2*s/(t-e),h=2*s/(i-r),u=(t+e)/(t-e),d=(i+r)/(i-r);let f,A;if(a===Kn)f=-(o+s)/(o-s),A=-2*o*s/(o-s);else if(a===Wo)f=-o/(o-s),A=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=A,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Kn){const l=this.elements,c=1/(t-e),h=1/(i-r),u=1/(o-s),d=(t+e)*c,f=(i+r)*h;let A,g;if(a===Kn)A=(o+s)*u,g=-2*u;else if(a===Wo)A=s*u,g=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=g,l[14]=-A,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const ss=new F,Gn=new Ye,uC=new F(0,0,0),dC=new F(1,1,1),zi=new F,_a=new F,Sn=new F,aA=new Ye,lA=new wn;class Ln{constructor(e=0,t=0,i=0,r=Ln.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],h=r[9],u=r[2],d=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(tt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-tt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(tt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-tt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(tt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-tt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return aA.makeRotationFromQuaternion(e),this.setFromRotationMatrix(aA,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return lA.setFromEuler(this),this.setFromQuaternion(lA,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ln.DEFAULT_ORDER="XYZ";class lh{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let fC=0;const cA=new F,os=new wn,Ai=new Ye,Ma=new F,Ks=new F,pC=new F,AC=new wn,hA=new F(1,0,0),uA=new F(0,1,0),dA=new F(0,0,1),fA={type:"added"},mC={type:"removed"},as={type:"childadded",child:null},Kh={type:"childremoved",child:null};class gt extends ui{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:fC++}),this.uuid=Rn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=gt.DEFAULT_UP.clone();const e=new F,t=new Ln,i=new wn,r=new F(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Ye},normalMatrix:{value:new et}}),this.matrix=new Ye,this.matrixWorld=new Ye,this.matrixAutoUpdate=gt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=gt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new lh,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return os.setFromAxisAngle(e,t),this.quaternion.multiply(os),this}rotateOnWorldAxis(e,t){return os.setFromAxisAngle(e,t),this.quaternion.premultiply(os),this}rotateX(e){return this.rotateOnAxis(hA,e)}rotateY(e){return this.rotateOnAxis(uA,e)}rotateZ(e){return this.rotateOnAxis(dA,e)}translateOnAxis(e,t){return cA.copy(e).applyQuaternion(this.quaternion),this.position.add(cA.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(hA,e)}translateY(e){return this.translateOnAxis(uA,e)}translateZ(e){return this.translateOnAxis(dA,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ai.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Ma.copy(e):Ma.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Ks.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ai.lookAt(Ks,Ma,this.up):Ai.lookAt(Ma,Ks,this.up),this.quaternion.setFromRotationMatrix(Ai),r&&(Ai.extractRotation(r.matrixWorld),os.setFromRotationMatrix(Ai),this.quaternion.premultiply(os.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(fA),as.child=e,this.dispatchEvent(as),as.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(mC),Kh.child=e,this.dispatchEvent(Kh),Kh.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Ai.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ai.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ai),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(fA),as.child=e,this.dispatchEvent(as),as.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 i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ks,e,pC),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ks,AC,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 i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),h=o(e.images),u=o(e.shapes),d=o(e.skeletons),f=o(e.animations),A=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),h.length>0&&(i.images=h),u.length>0&&(i.shapes=u),d.length>0&&(i.skeletons=d),f.length>0&&(i.animations=f),A.length>0&&(i.nodes=A)}return i.object=r,i;function o(a){const l=[];for(const c in a){const h=a[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}gt.DEFAULT_UP=new F(0,1,0);gt.DEFAULT_MATRIX_AUTO_UPDATE=!0;gt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const zn=new F,mi=new F,Jh=new F,gi=new F,ls=new F,cs=new F,pA=new F,Zh=new F,$h=new F,eu=new F,tu=new mt,nu=new mt,iu=new mt;class bn{constructor(e=new F,t=new F,i=new F){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),zn.subVectors(e,t),r.cross(zn);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){zn.subVectors(r,t),mi.subVectors(i,t),Jh.subVectors(e,t);const o=zn.dot(zn),a=zn.dot(mi),l=zn.dot(Jh),c=mi.dot(mi),h=mi.dot(Jh),u=o*c-a*a;if(u===0)return s.set(0,0,0),null;const d=1/u,f=(c*l-a*h)*d,A=(o*h-a*l)*d;return s.set(1-f-A,A,f)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,gi)===null?!1:gi.x>=0&&gi.y>=0&&gi.x+gi.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,gi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,gi.x),l.addScaledVector(o,gi.y),l.addScaledVector(a,gi.z),l)}static getInterpolatedAttribute(e,t,i,r,s,o){return tu.setScalar(0),nu.setScalar(0),iu.setScalar(0),tu.fromBufferAttribute(e,t),nu.fromBufferAttribute(e,i),iu.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(tu,s.x),o.addScaledVector(nu,s.y),o.addScaledVector(iu,s.z),o}static isFrontFacing(e,t,i,r){return zn.subVectors(i,t),mi.subVectors(e,t),zn.cross(mi).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return zn.subVectors(this.c,this.b),mi.subVectors(this.a,this.b),zn.cross(mi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return bn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return bn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return bn.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return bn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return bn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;ls.subVectors(r,i),cs.subVectors(s,i),Zh.subVectors(e,i);const l=ls.dot(Zh),c=cs.dot(Zh);if(l<=0&&c<=0)return t.copy(i);$h.subVectors(e,r);const h=ls.dot($h),u=cs.dot($h);if(h>=0&&u<=h)return t.copy(r);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(i).addScaledVector(ls,o);eu.subVectors(e,s);const f=ls.dot(eu),A=cs.dot(eu);if(A>=0&&f<=A)return t.copy(s);const g=f*c-l*A;if(g<=0&&c>=0&&A<=0)return a=c/(c-A),t.copy(i).addScaledVector(cs,a);const m=h*A-f*u;if(m<=0&&u-h>=0&&f-A>=0)return pA.subVectors(s,r),a=(u-h)/(u-h+(f-A)),t.copy(r).addScaledVector(pA,a);const p=1/(m+g+d);return o=g*p,a=d*p,t.copy(i).addScaledVector(ls,o).addScaledVector(cs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Uv={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},Hi={h:0,s:0,l:0},Sa={h:0,s:0,l:0};function ru(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class De{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=xn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ht.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=ht.workingColorSpace){return this.r=e,this.g=t,this.b=i,ht.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=ht.workingColorSpace){if(e=zf(e,1),t=tt(t,0,1),i=tt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=ru(o,s,e+1/3),this.g=ru(o,s,e),this.b=ru(o,s,e-1/3)}return ht.toWorkingColorSpace(this,r),this}setStyle(e,t=xn){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=xn){const i=Uv[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ri(e.r),this.g=Ri(e.g),this.b=Ri(e.b),this}copyLinearToSRGB(e){return this.r=Ds(e.r),this.g=Ds(e.g),this.b=Ds(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=xn){return ht.fromWorkingColorSpace(tn.copy(this),e),Math.round(tt(tn.r*255,0,255))*65536+Math.round(tt(tn.g*255,0,255))*256+Math.round(tt(tn.b*255,0,255))}getHexString(e=xn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ht.workingColorSpace){ht.fromWorkingColorSpace(tn.copy(this),t);const i=tn.r,r=tn.g,s=tn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const h=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=h<=.5?u/(o+a):u/(2-o-a),o){case i:l=(r-s)/u+(r<s?6:0);break;case r:l=(s-i)/u+2;break;case s:l=(i-r)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=ht.workingColorSpace){return ht.fromWorkingColorSpace(tn.copy(this),t),e.r=tn.r,e.g=tn.g,e.b=tn.b,e}getStyle(e=xn){ht.fromWorkingColorSpace(tn.copy(this),e);const t=tn.r,i=tn.g,r=tn.b;return e!==xn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(Hi),this.setHSL(Hi.h+e,Hi.s+t,Hi.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Hi),e.getHSL(Sa);const i=Ro(Hi.h,Sa.h,t),r=Ro(Hi.s,Sa.s,t),s=Ro(Hi.l,Sa.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const tn=new De;De.NAMES=Uv;let gC=0;class on extends ui{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:gC++}),this.uuid=Rn(),this.name="",this.type="Material",this.blending=Gr,this.side=Pi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Kl,this.blendDst=Jl,this.blendEquation=Zi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new De(0,0,0),this.blendAlpha=0,this.depthFunc=Wr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Fd,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Pr,this.stencilZFail=Pr,this.stencilZPass=Pr,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Gr&&(i.blending=this.blending),this.side!==Pi&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Kl&&(i.blendSrc=this.blendSrc),this.blendDst!==Jl&&(i.blendDst=this.blendDst),this.blendEquation!==Zi&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Wr&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Fd&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Pr&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Pr&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Pr&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}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 i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class ar extends on{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new De(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 Ln,this.combine=oa,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 wi=vC();function vC(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;!(c&8388608);)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function yn(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=tt(n,-65504,65504),wi.floatView[0]=n;const e=wi.uint32View[0],t=e>>23&511;return wi.baseTable[t]+((e&8388607)>>wi.shiftTable[t])}function xo(n){const e=n>>10;return wi.uint32View[0]=wi.mantissaTable[wi.offsetTable[e]+(n&1023)]+wi.exponentTable[e],wi.floatView[0]}const yC={toHalfFloat:yn,fromHalfFloat:xo},Ot=new F,Ia=new fe;let EC=0;class wt{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:EC++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Vo,this.updateRanges=[],this.gpuType=un,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Ia.fromBufferAttribute(this,t),Ia.applyMatrix3(e),this.setXY(t,Ia.x,Ia.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Ot.fromBufferAttribute(this,t),Ot.applyMatrix3(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Ot.fromBufferAttribute(this,t),Ot.applyMatrix4(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Ot.fromBufferAttribute(this,t),Ot.applyNormalMatrix(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Ot.fromBufferAttribute(this,t),Ot.transformDirection(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=dn(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=rt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=dn(t,this.array)),t}setX(e,t){return this.normalized&&(t=rt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=dn(t,this.array)),t}setY(e,t){return this.normalized&&(t=rt(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=dn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=rt(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=dn(t,this.array)),t}setW(e,t){return this.normalized&&(t=rt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=rt(t,this.array),i=rt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=rt(t,this.array),i=rt(i,this.array),r=rt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=rt(t,this.array),i=rt(i,this.array),r=rt(r,this.array),s=rt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Vo&&(e.usage=this.usage),e}}class xC extends wt{constructor(e,t,i){super(new Int8Array(e),t,i)}}class bC extends wt{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class CC extends wt{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class wC extends wt{constructor(e,t,i){super(new Int16Array(e),t,i)}}class Hf extends wt{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class _C extends wt{constructor(e,t,i){super(new Int32Array(e),t,i)}}class Vf extends wt{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class MC extends wt{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=xo(this.array[e*this.itemSize]);return this.normalized&&(t=dn(t,this.array)),t}setX(e,t){return this.normalized&&(t=rt(t,this.array)),this.array[e*this.itemSize]=yn(t),this}getY(e){let t=xo(this.array[e*this.itemSize+1]);return this.normalized&&(t=dn(t,this.array)),t}setY(e,t){return this.normalized&&(t=rt(t,this.array)),this.array[e*this.itemSize+1]=yn(t),this}getZ(e){let t=xo(this.array[e*this.itemSize+2]);return this.normalized&&(t=dn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=rt(t,this.array)),this.array[e*this.itemSize+2]=yn(t),this}getW(e){let t=xo(this.array[e*this.itemSize+3]);return this.normalized&&(t=dn(t,this.array)),t}setW(e,t){return this.normalized&&(t=rt(t,this.array)),this.array[e*this.itemSize+3]=yn(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=rt(t,this.array),i=rt(i,this.array)),this.array[e+0]=yn(t),this.array[e+1]=yn(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=rt(t,this.array),i=rt(i,this.array),r=rt(r,this.array)),this.array[e+0]=yn(t),this.array[e+1]=yn(i),this.array[e+2]=yn(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=rt(t,this.array),i=rt(i,this.array),r=rt(r,this.array),s=rt(s,this.array)),this.array[e+0]=yn(t),this.array[e+1]=yn(i),this.array[e+2]=yn(r),this.array[e+3]=yn(s),this}}class Qe extends wt{constructor(e,t,i){super(new Float32Array(e),t,i)}}let SC=0;const Pn=new Ye,su=new gt,hs=new F,In=new mn,Js=new mn,qt=new F;class ot extends ui{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:SC++}),this.uuid=Rn(),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(Lv(e)?Vf:Hf)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new et().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Pn.makeRotationFromQuaternion(e),this.applyMatrix4(Pn),this}rotateX(e){return Pn.makeRotationX(e),this.applyMatrix4(Pn),this}rotateY(e){return Pn.makeRotationY(e),this.applyMatrix4(Pn),this}rotateZ(e){return Pn.makeRotationZ(e),this.applyMatrix4(Pn),this}translate(e,t,i){return Pn.makeTranslation(e,t,i),this.applyMatrix4(Pn),this}scale(e,t,i){return Pn.makeScale(e,t,i),this.applyMatrix4(Pn),this}lookAt(e){return su.lookAt(e),su.updateMatrix(),this.applyMatrix4(su.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(hs).negate(),this.translate(hs.x,hs.y,hs.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Qe(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new mn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];In.setFromBufferAttribute(s),this.morphTargetsRelative?(qt.addVectors(this.boundingBox.min,In.min),this.boundingBox.expandByPoint(qt),qt.addVectors(this.boundingBox.max,In.max),this.boundingBox.expandByPoint(qt)):(this.boundingBox.expandByPoint(In.min),this.boundingBox.expandByPoint(In.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new sn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new F,1/0);return}if(e){const i=this.boundingSphere.center;if(In.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];Js.setFromBufferAttribute(a),this.morphTargetsRelative?(qt.addVectors(In.min,Js.min),In.expandByPoint(qt),qt.addVectors(In.max,Js.max),In.expandByPoint(qt)):(In.expandByPoint(Js.min),In.expandByPoint(Js.max))}In.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)qt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(qt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,h=a.count;c<h;c++)qt.fromBufferAttribute(a,c),l&&(hs.fromBufferAttribute(e,c),qt.add(hs)),r=Math.max(r,i.distanceToSquared(qt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new wt(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let R=0;R<i.count;R++)a[R]=new F,l[R]=new F;const c=new F,h=new F,u=new F,d=new fe,f=new fe,A=new fe,g=new F,m=new F;function p(R,_,I){c.fromBufferAttribute(i,R),h.fromBufferAttribute(i,_),u.fromBufferAttribute(i,I),d.fromBufferAttribute(s,R),f.fromBufferAttribute(s,_),A.fromBufferAttribute(s,I),h.sub(c),u.sub(c),f.sub(d),A.sub(d);const D=1/(f.x*A.y-A.x*f.y);isFinite(D)&&(g.copy(h).multiplyScalar(A.y).addScaledVector(u,-f.y).multiplyScalar(D),m.copy(u).multiplyScalar(f.x).addScaledVector(h,-A.x).multiplyScalar(D),a[R].add(g),a[_].add(g),a[I].add(g),l[R].add(m),l[_].add(m),l[I].add(m))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let R=0,_=v.length;R<_;++R){const I=v[R],D=I.start,Q=I.count;for(let N=D,z=D+Q;N<z;N+=3)p(e.getX(N+0),e.getX(N+1),e.getX(N+2))}const y=new F,b=new F,w=new F,M=new F;function S(R){w.fromBufferAttribute(r,R),M.copy(w);const _=a[R];y.copy(_),y.sub(w.multiplyScalar(w.dot(_))).normalize(),b.crossVectors(M,_);const D=b.dot(l[R])<0?-1:1;o.setXYZW(R,y.x,y.y,y.z,D)}for(let R=0,_=v.length;R<_;++R){const I=v[R],D=I.start,Q=I.count;for(let N=D,z=D+Q;N<z;N+=3)S(e.getX(N+0)),S(e.getX(N+1)),S(e.getX(N+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new wt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let d=0,f=i.count;d<f;d++)i.setXYZ(d,0,0,0);const r=new F,s=new F,o=new F,a=new F,l=new F,c=new F,h=new F,u=new F;if(e)for(let d=0,f=e.count;d<f;d+=3){const A=e.getX(d+0),g=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,A),s.fromBufferAttribute(t,g),o.fromBufferAttribute(t,m),h.subVectors(o,s),u.subVectors(r,s),h.cross(u),a.fromBufferAttribute(i,A),l.fromBufferAttribute(i,g),c.fromBufferAttribute(i,m),a.add(h),l.add(h),c.add(h),i.setXYZ(A,a.x,a.y,a.z),i.setXYZ(g,l.x,l.y,l.z),i.setXYZ(m,c.x,c.y,c.z)}else for(let d=0,f=t.count;d<f;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),h.subVectors(o,s),u.subVectors(r,s),h.cross(u),i.setXYZ(d+0,h.x,h.y,h.z),i.setXYZ(d+1,h.x,h.y,h.z),i.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)qt.fromBufferAttribute(e,t),qt.normalize(),e.setXYZ(t,qt.x,qt.y,qt.z)}toNonIndexed(){function e(a,l){const c=a.array,h=a.itemSize,u=a.normalized,d=new c.constructor(l.length*h);let f=0,A=0;for(let g=0,m=l.length;g<m;g++){a.isInterleavedBufferAttribute?f=l[g]*a.data.stride+a.offset:f=l[g]*h;for(let p=0;p<h;p++)d[A++]=c[f++]}return new wt(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new ot,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let h=0,u=c.length;h<u;h++){const d=c[h],f=e(d,i);l.push(f)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u];h.push(f.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],u=s[c];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,h=o.length;c<h;c++){const u=o[c];this.addGroup(u.start,u.count,u.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const AA=new Ye,pr=new Hs,Ba=new sn,mA=new F,Ta=new F,Ra=new F,La=new F,ou=new F,Da=new F,gA=new F,Pa=new F;class kt extends gt{constructor(e=new ot,t=new ar){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){Da.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=a[l],u=s[l];h!==0&&(ou.fromBufferAttribute(u,e),o?Da.addScaledVector(ou,h):Da.addScaledVector(ou.sub(t),h))}t.add(Da)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ba.copy(i.boundingSphere),Ba.applyMatrix4(s),pr.copy(e.ray).recast(e.near),!(Ba.containsPoint(pr.origin)===!1&&(pr.intersectSphere(Ba,mA)===null||pr.origin.distanceToSquared(mA)>(e.far-e.near)**2))&&(AA.copy(s).invert(),pr.copy(e.ray).applyMatrix4(AA),!(i.boundingBox!==null&&pr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,pr)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,d=s.groups,f=s.drawRange;if(a!==null)if(Array.isArray(o))for(let A=0,g=d.length;A<g;A++){const m=d[A],p=o[m.materialIndex],v=Math.max(m.start,f.start),y=Math.min(a.count,Math.min(m.start+m.count,f.start+f.count));for(let b=v,w=y;b<w;b+=3){const M=a.getX(b),S=a.getX(b+1),R=a.getX(b+2);r=Ua(this,p,e,i,c,h,u,M,S,R),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const A=Math.max(0,f.start),g=Math.min(a.count,f.start+f.count);for(let m=A,p=g;m<p;m+=3){const v=a.getX(m),y=a.getX(m+1),b=a.getX(m+2);r=Ua(this,o,e,i,c,h,u,v,y,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let A=0,g=d.length;A<g;A++){const m=d[A],p=o[m.materialIndex],v=Math.max(m.start,f.start),y=Math.min(l.count,Math.min(m.start+m.count,f.start+f.count));for(let b=v,w=y;b<w;b+=3){const M=b,S=b+1,R=b+2;r=Ua(this,p,e,i,c,h,u,M,S,R),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const A=Math.max(0,f.start),g=Math.min(l.count,f.start+f.count);for(let m=A,p=g;m<p;m+=3){const v=m,y=m+1,b=m+2;r=Ua(this,o,e,i,c,h,u,v,y,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function IC(n,e,t,i,r,s,o,a){let l;if(e.side===An?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===Pi,a),l===null)return null;Pa.copy(a),Pa.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(Pa);return c<t.near||c>t.far?null:{distance:c,point:Pa.clone(),object:n}}function Ua(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Ta),n.getVertexPosition(l,Ra),n.getVertexPosition(c,La);const h=IC(n,e,t,i,Ta,Ra,La,gA);if(h){const u=new F;bn.getBarycoord(gA,Ta,Ra,La,u),r&&(h.uv=bn.getInterpolatedAttribute(r,a,l,c,u,new fe)),s&&(h.uv1=bn.getInterpolatedAttribute(s,a,l,c,u,new fe)),o&&(h.normal=bn.getInterpolatedAttribute(o,a,l,c,u,new F),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const d={a,b:l,c,normal:new F,materialIndex:0};bn.getNormal(Ta,Ra,La,d.normal),h.face=d,h.barycoord=u}return h}class Yr extends ot{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],h=[],u=[];let d=0,f=0;A("z","y","x",-1,-1,i,t,e,o,s,0),A("z","y","x",1,-1,i,t,-e,o,s,1),A("x","z","y",1,1,e,i,t,r,o,2),A("x","z","y",1,-1,e,i,-t,r,o,3),A("x","y","z",1,-1,e,t,i,r,s,4),A("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Qe(c,3)),this.setAttribute("normal",new Qe(h,3)),this.setAttribute("uv",new Qe(u,2));function A(g,m,p,v,y,b,w,M,S,R,_){const I=b/S,D=w/R,Q=b/2,N=w/2,z=M/2,$=S+1,H=R+1;let K=0,Y=0;const ee=new F;for(let pe=0;pe<H;pe++){const be=pe*D-N;for(let Ce=0;Ce<$;Ce++){const Pe=Ce*I-Q;ee[g]=Pe*v,ee[m]=be*y,ee[p]=z,c.push(ee.x,ee.y,ee.z),ee[g]=0,ee[m]=0,ee[p]=M>0?1:-1,h.push(ee.x,ee.y,ee.z),u.push(Ce/S),u.push(1-pe/R),K+=1}}for(let pe=0;pe<R;pe++)for(let be=0;be<S;be++){const Ce=d+be+$*pe,Pe=d+be+$*(pe+1),Me=d+(be+1)+$*(pe+1),te=d+(be+1)+$*pe;l.push(Ce,Pe,te),l.push(Pe,Me,te),Y+=6}a.addGroup(f,Y,_),f+=Y,d+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Os(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function cn(n){const e={};for(let t=0;t<n.length;t++){const i=Os(n[t]);for(const r in i)e[r]=i[r]}return e}function BC(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function Fv(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ht.workingColorSpace}const Ov={clone:Os,merge:cn};var TC=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,RC=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class Zn extends on{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=TC,this.fragmentShader=RC,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Os(e.uniforms),this.uniformsGroups=BC(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 r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class ch extends gt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ye,this.projectionMatrix=new Ye,this.projectionMatrixInverse=new Ye,this.coordinateSystem=Kn}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 Vi=new F,vA=new fe,yA=new fe;class Yt extends ch{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Fs*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(zr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Fs*2*Math.atan(Math.tan(zr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){Vi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Vi.x,Vi.y).multiplyScalar(-e/Vi.z),Vi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Vi.x,Vi.y).multiplyScalar(-e/Vi.z)}getViewSize(e,t){return this.getViewBounds(e,vA,yA),t.subVectors(yA,vA)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(zr*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const us=-90,ds=1;class kv extends gt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Yt(us,ds,e,t);r.layers=this.layers,this.add(r);const s=new Yt(us,ds,e,t);s.layers=this.layers,this.add(s);const o=new Yt(us,ds,e,t);o.layers=this.layers,this.add(o);const a=new Yt(us,ds,e,t);a.layers=this.layers,this.add(a);const l=new Yt(us,ds,e,t);l.layers=this.layers,this.add(l);const c=new Yt(us,ds,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Kn)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Wo)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),A=e.xr.enabled;e.xr.enabled=!1;const g=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=g,e.setRenderTarget(i,5,r),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=A,i.texture.needsPMREMUpdate=!0}}class ca extends Tt{constructor(e,t,i,r,s,o,a,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:Ui,super(e,t,i,r,s,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Nv extends Jn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new ca(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Ht}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},r=new Yr(5,5,5),s=new Zn({name:"CubemapFromEquirect",uniforms:Os(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:An,blending:Bi});s.uniforms.tEquirect.value=t;const o=new kt(r,s),a=t.minFilter;return t.minFilter===oi&&(t.minFilter=Ht),new kv(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}class Bs extends gt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const LC={type:"move"};class Gl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Bs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Bs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Bs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const g of e.hand.values()){const m=t.getJointPose(g,i),p=this._getHandJoint(c,g);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,A=.005;c.inputState.pinching&&d>f+A?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-A&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(LC)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Bs;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class hh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new De(e),this.density=t}clone(){return new hh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class uh{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new De(e),this.near=t,this.far=i}clone(){return new uh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Qv extends gt{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 Ln,this.environmentIntensity=1,this.environmentRotation=new Ln,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class dh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Vo,this.updateRanges=[],this.version=0,this.uuid=Rn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Rn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Rn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const an=new F;class jr{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=dn(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=rt(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=rt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=rt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=rt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=rt(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=dn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=dn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=dn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=dn(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=rt(t,this.array),i=rt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=rt(t,this.array),i=rt(i,this.array),r=rt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=rt(t,this.array),i=rt(i,this.array),r=rt(r,this.array),s=rt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new wt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new jr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Wf extends on{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new De(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 fs;const Zs=new F,ps=new F,As=new F,ms=new fe,$s=new fe,Gv=new Ye,Fa=new F,eo=new F,Oa=new F,EA=new fe,au=new fe,xA=new fe;class zv extends gt{constructor(e=new Wf){if(super(),this.isSprite=!0,this.type="Sprite",fs===void 0){fs=new ot;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new dh(t,5);fs.setIndex([0,1,2,0,2,3]),fs.setAttribute("position",new jr(i,3,0,!1)),fs.setAttribute("uv",new jr(i,2,3,!1))}this.geometry=fs,this.material=e,this.center=new fe(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ps.setFromMatrixScale(this.matrixWorld),Gv.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),As.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ps.multiplyScalar(-As.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;ka(Fa.set(-.5,-.5,0),As,o,ps,r,s),ka(eo.set(.5,-.5,0),As,o,ps,r,s),ka(Oa.set(.5,.5,0),As,o,ps,r,s),EA.set(0,0),au.set(1,0),xA.set(1,1);let a=e.ray.intersectTriangle(Fa,eo,Oa,!1,Zs);if(a===null&&(ka(eo.set(-.5,.5,0),As,o,ps,r,s),au.set(0,1),a=e.ray.intersectTriangle(Fa,Oa,eo,!1,Zs),a===null))return;const l=e.ray.origin.distanceTo(Zs);l<e.near||l>e.far||t.push({distance:l,point:Zs.clone(),uv:bn.getInterpolation(Zs,Fa,eo,Oa,EA,au,xA,new fe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function ka(n,e,t,i,r,s){ms.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?($s.x=s*ms.x-r*ms.y,$s.y=r*ms.x+s*ms.y):$s.copy(ms),n.copy(e),n.x+=$s.x,n.y+=$s.y,n.applyMatrix4(Gv)}const Na=new F,bA=new F;class Hv extends gt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let i=0;i<t.length;i++)if(t[i].distance===e){const r=t.splice(i,1);return this.remove(r[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){Na.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Na);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Na.setFromMatrixPosition(e.matrixWorld),bA.setFromMatrixPosition(this.matrixWorld);const i=Na.distanceTo(bA)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const CA=new F,wA=new mt,_A=new mt,DC=new F,MA=new Ye,Qa=new F,lu=new sn,SA=new Ye,cu=new Hs;class Vv extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Ud,this.bindMatrix=new Ye,this.bindMatrixInverse=new Ye,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new mn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Qa),this.boundingBox.expandByPoint(Qa)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new sn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Qa),this.boundingSphere.expandByPoint(Qa)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),lu.copy(this.boundingSphere),lu.applyMatrix4(r),e.ray.intersectsSphere(lu)!==!1&&(SA.copy(r).invert(),cu.copy(e.ray).applyMatrix4(SA),!(this.boundingBox!==null&&cu.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,cu)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new mt,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ud?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===vv?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;wA.fromBufferAttribute(r.attributes.skinIndex,e),_A.fromBufferAttribute(r.attributes.skinWeight,e),CA.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=_A.getComponent(s);if(o!==0){const a=wA.getComponent(s);MA.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(DC.copy(CA).applyMatrix4(MA),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class qf extends gt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class li extends Tt{constructor(e=null,t=1,i=1,r,s,o,a,l,c=Zt,h=Zt,u,d){super(null,o,a,l,c,h,r,s,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const IA=new Ye,PC=new Ye;class fh{constructor(e=[],t=[]){this.uuid=Rn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new Ye)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new Ye;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:PC;IA.multiplyMatrices(a,t[s]),IA.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new fh(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new li(t,e,e,pn,un);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new qf),this.bones.push(o),this.boneInverses.push(new Ye().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class ks extends wt{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const gs=new Ye,BA=new Ye,Ga=[],TA=new mn,UC=new Ye,to=new kt,no=new sn;class Wv extends kt{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ks(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,UC)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new mn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,gs),TA.copy(e.boundingBox).applyMatrix4(gs),this.boundingBox.union(TA)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new sn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,gs),no.copy(e.boundingSphere).applyMatrix4(gs),this.boundingSphere.union(no)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(to.geometry=this.geometry,to.material=this.material,to.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),no.copy(this.boundingSphere),no.applyMatrix4(i),e.ray.intersectsSphere(no)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,gs),BA.multiplyMatrices(i,gs),to.matrixWorld=BA,to.raycast(e,Ga);for(let o=0,a=Ga.length;o<a;o++){const l=Ga[o];l.instanceId=s,l.object=this,t.push(l)}Ga.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new ks(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new li(new Float32Array(r*this.count),r,this.count,nh,un));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<i.length;c++)o+=i[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=r*e;s[l]=a,s.set(i,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const hu=new F,FC=new F,OC=new et;class Ki{constructor(e=new F(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,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=hu.subVectors(i,t).cross(FC.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(hu),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<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 i=t||OC.getNormalMatrix(e),r=this.coplanarPoint(hu).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ar=new sn,za=new F;class ha{constructor(e=new Ki,t=new Ki,i=new Ki,r=new Ki,s=new Ki,o=new Ki){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Kn){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],h=r[5],u=r[6],d=r[7],f=r[8],A=r[9],g=r[10],m=r[11],p=r[12],v=r[13],y=r[14],b=r[15];if(i[0].setComponents(l-s,d-c,m-f,b-p).normalize(),i[1].setComponents(l+s,d+c,m+f,b+p).normalize(),i[2].setComponents(l+o,d+h,m+A,b+v).normalize(),i[3].setComponents(l-o,d-h,m-A,b-v).normalize(),i[4].setComponents(l-a,d-u,m-g,b-y).normalize(),t===Kn)i[5].setComponents(l+a,d+u,m+g,b+y).normalize();else if(t===Wo)i[5].setComponents(a,u,g,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ar.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ar.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ar)}intersectsSprite(e){return Ar.center.set(0,0,0),Ar.radius=.7071067811865476,Ar.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ar)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(za.x=r.normal.x>0?e.max.x:e.min.x,za.y=r.normal.y>0?e.max.y:e.min.y,za.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(za)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function uu(n,e){return n-e}function kC(n,e){return n.z-e.z}function NC(n,e){return e.z-n.z}class QC{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i,r){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const a=s[this.index];o.push(a),this.index++,a.start=e,a.count=t,a.z=i,a.index=r}reset(){this.list.length=0,this.index=0}}const vn=new Ye,GC=new De(1,1,1),du=new ha,Ha=new mn,mr=new sn,io=new F,RA=new F,zC=new F,fu=new QC,nn=new kt,Va=[];function HC(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}function gr(n,e){if(n.constructor!==e.constructor){const t=Math.min(n.length,e.length);for(let i=0;i<t;i++)e[i]=n[i]}else{const t=Math.min(n.length,e.length);e.set(new n.constructor(n.buffer,0,t))}}class qv extends kt{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(e,t,i=t*2,r){super(new ot,r),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=i,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),i=new li(t,e,e,pn,un);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new li(t,e,e,aa,Fi);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new li(t,e,e,pn,un);i.colorSpace=ht.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,h=new a.constructor(i*l),u=new wt(h,l,c);t.setAttribute(s,u)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new wt(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.normalized!==s.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||t[e].active===!1)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||t[e].active===!1)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(){this.boundingBox===null&&(this.boundingBox=new mn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,vn),this.getBoundingBoxAt(s,Ha).applyMatrix4(vn),e.union(Ha)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new sn);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let i=0,r=t.length;i<r;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,vn),this.getBoundingSphereAt(s,mr).applyMatrix4(vn),e.union(mr)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:e};let r=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(uu),r=this._availableInstanceIds.shift(),this._instanceInfo[r]=i):(r=this._instanceInfo.length,this._instanceInfo.push(i));const s=this._matricesTexture;vn.identity().toArray(s.image.data,r*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(GC.toArray(o.image.data,r*4),o.needsUpdate=!0),this._visibilityChanged=!0,r}addGeometry(e,t=-1,i=-1){this._initializeGeometry(e),this._validateGeometry(e);const r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=i===-1?o.count:i),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(uu),l=this._availableGeometryIds.shift(),s[l]=r):(l=this._geometryCount,this._geometryCount++,s.push(r)),this.setGeometryAt(l,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(r&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const h in i.attributes){const u=t.getAttribute(h),d=i.getAttribute(h);HC(u,d,l);const f=u.itemSize;for(let A=u.count,g=c;A<g;A++){const m=l+A;for(let p=0;p<f;p++)d.setComponent(m,p,0)}d.needsUpdate=!0,d.addUpdateRange(l*f,c*f)}if(r){const h=a.indexStart,u=a.reservedIndexCount;a.indexCount=t.getIndex().count;for(let d=0;d<o.count;d++)s.setX(h+d,l+o.getX(d));for(let d=o.count,f=u;d<f;d++)s.setX(h+d,l);s.needsUpdate=!0,s.addUpdateRange(h,a.reservedIndexCount)}return a.start=r?a.indexStart:a.vertexStart,a.count=r?a.indexCount:a.vertexCount,a.boundingBox=null,t.boundingBox!==null&&(a.boundingBox=t.boundingBox.clone()),a.boundingSphere=null,t.boundingSphere!==null&&(a.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const i=this._instanceInfo;for(let r=0,s=i.length;r<s;r++)i[r].active&&i[r].geometryIndex===e&&this.deleteInstance(r);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 i=this._geometryInfo,r=i.map((o,a)=>a).sort((o,a)=>i[o].vertexStart-i[a].vertexStart),s=this.geometry;for(let o=0,a=i.length;o<a;o++){const l=r[o],c=i[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==t){const{indexStart:h,vertexStart:u,reservedIndexCount:d}=c,f=s.index,A=f.array,g=e-u;for(let m=h;m<h+d;m++)A[m]=A[m]+g;f.array.copyWithin(t,h,h+d),f.addUpdateRange(t,d),c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:h,reservedVertexCount:u}=c,d=s.attributes;for(const f in d){const A=d[f],{array:g,itemSize:m}=A;g.copyWithin(e*m,h*m,(h+u)*m),A.addUpdateRange(e*m,u*m)}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart,this._nextIndexStart=s.index?c.indexStart+c.reservedIndexCount:0,this._nextVertexStart=c.vertexStart+c.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){const s=new mn,o=i.index,a=i.attributes.position;for(let l=r.start,c=r.start+r.count;l<c;l++){let h=l;o&&(h=o.getX(h)),s.expandByPoint(io.fromBufferAttribute(a,h))}r.boundingBox=s}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){const s=new sn;this.getBoundingBoxAt(e,Ha),Ha.getCenter(s.center);const o=i.index,a=i.attributes.position;let l=0;for(let c=r.start,h=r.start+r.count;c<h;c++){let u=c;o&&(u=o.getX(u)),io.fromBufferAttribute(a,u),l=Math.max(l,s.center.distanceToSquared(io))}s.radius=Math.sqrt(l),r.boundingSphere=s}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const i=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),i.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(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 i=this._geometryInfo[e];return t.vertexStart=i.vertexStart,t.vertexCount=i.vertexCount,t.reservedVertexCount=i.reservedVertexCount,t.indexStart=i.indexStart,t.indexCount=i.indexCount,t.reservedIndexCount=i.reservedIndexCount,t.start=i.start,t.count=i.count,t}setInstanceCount(e){const t=this._availableInstanceIds,i=this._instanceInfo;for(t.sort(uu);t[t.length-1]===i.length;)i.pop(),t.pop();if(e<i.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const r=new Int32Array(e),s=new Int32Array(e);gr(this._multiDrawCounts,r),gr(this._multiDrawStarts,s),this._multiDrawCounts=r,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,l=this._colorsTexture;o.dispose(),this._initIndirectTexture(),gr(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),gr(a.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),gr(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const i=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...i.map(a=>a.vertexStart+a.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new ot,this._initializeGeometry(s));const o=this.geometry;s.index&&gr(s.index.array,o.index.array);for(const a in s.attributes)gr(s.attributes[a].array,o.attributes[a].array)}raycast(e,t){const i=this._instanceInfo,r=this._geometryInfo,s=this.matrixWorld,o=this.geometry;nn.material=this.material,nn.geometry.index=o.index,nn.geometry.attributes=o.attributes,nn.geometry.boundingBox===null&&(nn.geometry.boundingBox=new mn),nn.geometry.boundingSphere===null&&(nn.geometry.boundingSphere=new sn);for(let a=0,l=i.length;a<l;a++){if(!i[a].visible||!i[a].active)continue;const c=i[a].geometryIndex,h=r[c];nn.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(a,nn.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,nn.geometry.boundingBox),this.getBoundingSphereAt(c,nn.geometry.boundingSphere),nn.raycast(e,Va);for(let u=0,d=Va.length;u<d;u++){const f=Va[u];f.object=this,f.batchId=a,t.push(f)}Va.length=0}nn.material=null,nn.geometry.index=null,nn.geometry.attributes={},nn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,h=this._multiDrawCounts,u=this._geometryInfo,d=this.perObjectFrustumCulled,f=this._indirectTexture,A=f.image.data;d&&(vn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),du.setFromProjectionMatrix(vn,e.coordinateSystem));let g=0;if(this.sortObjects){vn.copy(this.matrixWorld).invert(),io.setFromMatrixPosition(i.matrixWorld).applyMatrix4(vn),RA.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(vn);for(let v=0,y=l.length;v<y;v++)if(l[v].visible&&l[v].active){const b=l[v].geometryIndex;this.getMatrixAt(v,vn),this.getBoundingSphereAt(b,mr).applyMatrix4(vn);let w=!1;if(d&&(w=!du.intersectsSphere(mr)),!w){const M=u[b],S=zC.subVectors(mr.center,io).dot(RA);fu.push(M.start,M.count,S,v)}}const m=fu.list,p=this.customSort;p===null?m.sort(s.transparent?NC:kC):p.call(this,m,i);for(let v=0,y=m.length;v<y;v++){const b=m[v];c[g]=b.start*a,h[g]=b.count,A[g]=b.index,g++}fu.reset()}else for(let m=0,p=l.length;m<p;m++)if(l[m].visible&&l[m].active){const v=l[m].geometryIndex;let y=!1;if(d&&(this.getMatrixAt(m,vn),this.getBoundingSphereAt(v,mr).applyMatrix4(vn),y=!du.intersectsSphere(mr)),!y){const b=u[v];c[g]=b.start*a,h[g]=b.count,A[g]=m,g++}}f.needsUpdate=!0,this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class gn extends on{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new De(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 Lc=new F,Dc=new F,LA=new Ye,ro=new Hs,Wa=new sn,pu=new F,DA=new F;class ir extends gt{constructor(e=new ot,t=new gn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)Lc.fromBufferAttribute(t,r-1),Dc.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=Lc.distanceTo(Dc);e.setAttribute("lineDistance",new Qe(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Wa.copy(i.boundingSphere),Wa.applyMatrix4(r),Wa.radius+=s,e.ray.intersectsSphere(Wa)===!1)return;LA.copy(r).invert(),ro.copy(e.ray).applyMatrix4(LA);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,h=i.index,d=i.attributes.position;if(h!==null){const f=Math.max(0,o.start),A=Math.min(h.count,o.start+o.count);for(let g=f,m=A-1;g<m;g+=c){const p=h.getX(g),v=h.getX(g+1),y=qa(this,e,ro,l,p,v,g);y&&t.push(y)}if(this.isLineLoop){const g=h.getX(A-1),m=h.getX(f),p=qa(this,e,ro,l,g,m,A-1);p&&t.push(p)}}else{const f=Math.max(0,o.start),A=Math.min(d.count,o.start+o.count);for(let g=f,m=A-1;g<m;g+=c){const p=qa(this,e,ro,l,g,g+1,g);p&&t.push(p)}if(this.isLineLoop){const g=qa(this,e,ro,l,A-1,f,A-1);g&&t.push(g)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function qa(n,e,t,i,r,s,o){const a=n.geometry.attributes.position;if(Lc.fromBufferAttribute(a,r),Dc.fromBufferAttribute(a,s),t.distanceSqToSegment(Lc,Dc,pu,DA)>i)return;pu.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(pu);if(!(c<e.near||c>e.far))return{distance:c,point:DA.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const PA=new F,UA=new F;class di extends ir{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)PA.fromBufferAttribute(t,r),UA.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+PA.distanceTo(UA);e.setAttribute("lineDistance",new Qe(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class jv extends ir{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class jf extends on{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new De(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 FA=new Ye,kd=new Hs,ja=new sn,Xa=new F;class Xv extends gt{constructor(e=new ot,t=new jf){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),ja.copy(i.boundingSphere),ja.applyMatrix4(r),ja.radius+=s,e.ray.intersectsSphere(ja)===!1)return;FA.copy(r).invert(),kd.copy(e.ray).applyMatrix4(FA);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,u=i.attributes.position;if(c!==null){const d=Math.max(0,o.start),f=Math.min(c.count,o.start+o.count);for(let A=d,g=f;A<g;A++){const m=c.getX(A);Xa.fromBufferAttribute(u,m),OA(Xa,m,l,r,e,t,this)}}else{const d=Math.max(0,o.start),f=Math.min(u.count,o.start+o.count);for(let A=d,g=f;A<g;A++)Xa.fromBufferAttribute(u,A),OA(Xa,A,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function OA(n,e,t,i,r,s,o){const a=kd.distanceSqToPoint(n);if(a<t){const l=new F;kd.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class Yv extends Tt{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ht,this.magFilter=s!==void 0?s:Ht,this.generateMipmaps=!1;const h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class VC extends Yv{constructor(e,t,i,r,s,o,a,l){super({},e,t,i,r,s,o,a,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class WC extends Tt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Zt,this.minFilter=Zt,this.generateMipmaps=!1,this.needsUpdate=!0}}class ph extends Tt{constructor(e,t,i,r,s,o,a,l,c,h,u,d){super(null,o,a,l,c,h,r,s,u,d),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class qC extends ph{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=On,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class jC extends ph{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Ui),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class XC extends Tt{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Xf extends Tt{constructor(e,t,i,r,s,o,a,l,c,h=er){if(h!==er&&h!==tr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===er&&(i=Fi),i===void 0&&h===tr&&(i=$i),super(null,r,s,o,a,l,h,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Zt,this.minFilter=l!==void 0?l:Zt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class $n{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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 i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const h=i[r],d=i[r+1]-h,f=(o-h)/d;return(r+f)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new fe:new F);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new F,r=[],s=[],o=[],a=new F,l=new Ye;for(let f=0;f<=e;f++){const A=f/e;r[f]=this.getTangentAt(A,new F)}s[0]=new F,o[0]=new F;let c=Number.MAX_VALUE;const h=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);h<=c&&(c=h,i.set(1,0,0)),u<=c&&(c=u,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),o[f]=o[f-1].clone(),a.crossVectors(r[f-1],r[f]),a.length()>Number.EPSILON){a.normalize();const A=Math.acos(tt(r[f-1].dot(r[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(a,A))}o[f].crossVectors(r[f],s[f])}if(t===!0){let f=Math.acos(tt(s[0].dot(s[e]),-1,1));f/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(f=-f);for(let A=1;A<=e;A++)s[A].applyMatrix4(l.makeRotationAxis(r[A],f*A)),o[A].crossVectors(r[A],s[A])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Ah extends $n{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new fe){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=l-this.aX,f=c-this.aY;l=d*h-f*u+this.aX,c=d*u+f*h+this.aY}return i.set(l,c)}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 Kv extends Ah{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function Yf(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,h,u){let d=(o-s)/c-(a-s)/(c+h)+(a-o)/h,f=(a-o)/h-(l-o)/(h+u)+(l-a)/u;d*=h,f*=h,r(o,a,d,f)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const Ya=new F,Au=new Yf,mu=new Yf,gu=new Yf;class Jv extends $n{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new F){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,h;this.closed||a>0?c=r[(a-1)%s]:(Ya.subVectors(r[0],r[1]).add(r[0]),c=Ya);const u=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?h=r[(a+2)%s]:(Ya.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=Ya),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let A=Math.pow(c.distanceToSquared(u),f),g=Math.pow(u.distanceToSquared(d),f),m=Math.pow(d.distanceToSquared(h),f);g<1e-4&&(g=1),A<1e-4&&(A=g),m<1e-4&&(m=g),Au.initNonuniformCatmullRom(c.x,u.x,d.x,h.x,A,g,m),mu.initNonuniformCatmullRom(c.y,u.y,d.y,h.y,A,g,m),gu.initNonuniformCatmullRom(c.z,u.z,d.z,h.z,A,g,m)}else this.curveType==="catmullrom"&&(Au.initCatmullRom(c.x,u.x,d.x,h.x,this.tension),mu.initCatmullRom(c.y,u.y,d.y,h.y,this.tension),gu.initCatmullRom(c.z,u.z,d.z,h.z,this.tension));return i.set(Au.calc(l),mu.calc(l),gu.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new F().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function kA(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function YC(n,e){const t=1-n;return t*t*e}function KC(n,e){return 2*(1-n)*n*e}function JC(n,e){return n*n*e}function Lo(n,e,t,i){return YC(n,e)+KC(n,t)+JC(n,i)}function ZC(n,e){const t=1-n;return t*t*t*e}function $C(n,e){const t=1-n;return 3*t*t*n*e}function ew(n,e){return 3*(1-n)*n*n*e}function tw(n,e){return n*n*n*e}function Do(n,e,t,i,r){return ZC(n,e)+$C(n,t)+ew(n,i)+tw(n,r)}class Kf extends $n{constructor(e=new fe,t=new fe,i=new fe,r=new fe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new fe){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Do(e,r.x,s.x,o.x,a.x),Do(e,r.y,s.y,o.y,a.y)),i}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 Zv extends $n{constructor(e=new F,t=new F,i=new F,r=new F){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new F){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Do(e,r.x,s.x,o.x,a.x),Do(e,r.y,s.y,o.y,a.y),Do(e,r.z,s.z,o.z,a.z)),i}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 Jf extends $n{constructor(e=new fe,t=new fe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new fe){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new fe){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 $v extends $n{constructor(e=new F,t=new F){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new F){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new F){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 Zf extends $n{constructor(e=new fe,t=new fe,i=new fe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new fe){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Lo(e,r.x,s.x,o.x),Lo(e,r.y,s.y,o.y)),i}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 $f extends $n{constructor(e=new F,t=new F,i=new F){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new F){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Lo(e,r.x,s.x,o.x),Lo(e,r.y,s.y,o.y),Lo(e,r.z,s.z,o.z)),i}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 ep extends $n{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new fe){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],h=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return i.set(kA(a,l.x,c.x,h.x,u.x),kA(a,l.y,c.y,h.y,u.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new fe().fromArray(r))}return this}}var Pc=Object.freeze({__proto__:null,ArcCurve:Kv,CatmullRomCurve3:Jv,CubicBezierCurve:Kf,CubicBezierCurve3:Zv,EllipseCurve:Ah,LineCurve:Jf,LineCurve3:$v,QuadraticBezierCurve:Zf,QuadraticBezierCurve3:$f,SplineCurve:ep});class ey extends $n{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 i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Pc[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const h=l[c];i&&i.equals(h)||(t.push(h),i=h)}}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,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new Pc[r.type]().fromJSON(r))}return this}}class jo extends ey{constructor(e){super(),this.type="Path",this.currentPoint=new fe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;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 i=new Jf(this.currentPoint.clone(),new fe(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new Zf(this.currentPoint.clone(),new fe(e,t),new fe(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new Kf(this.currentPoint.clone(),new fe(e,t),new fe(i,r),new fe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new ep(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new Ah(e,t,i,r,s,o,a,l);if(this.curves.length>0){const u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),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 ua extends ot{constructor(e=[new fe(0,-.5),new fe(.5,0),new fe(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=tt(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],h=1/t,u=new F,d=new fe,f=new F,A=new F,g=new F;let m=0,p=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:m=e[v+1].x-e[v].x,p=e[v+1].y-e[v].y,f.x=p*1,f.y=-m,f.z=p*0,g.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case e.length-1:l.push(g.x,g.y,g.z);break;default:m=e[v+1].x-e[v].x,p=e[v+1].y-e[v].y,f.x=p*1,f.y=-m,f.z=p*0,A.copy(f),f.x+=g.x,f.y+=g.y,f.z+=g.z,f.normalize(),l.push(f.x,f.y,f.z),g.copy(A)}for(let v=0;v<=t;v++){const y=i+v*h*r,b=Math.sin(y),w=Math.cos(y);for(let M=0;M<=e.length-1;M++){u.x=e[M].x*b,u.y=e[M].y,u.z=e[M].x*w,o.push(u.x,u.y,u.z),d.x=v/t,d.y=M/(e.length-1),a.push(d.x,d.y);const S=l[3*M+0]*b,R=l[3*M+1],_=l[3*M+0]*w;c.push(S,R,_)}}for(let v=0;v<t;v++)for(let y=0;y<e.length-1;y++){const b=y+v*e.length,w=b,M=b+e.length,S=b+e.length+1,R=b+1;s.push(w,M,R),s.push(S,R,M)}this.setIndex(s),this.setAttribute("position",new Qe(o,3)),this.setAttribute("uv",new Qe(a,2)),this.setAttribute("normal",new Qe(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ua(e.points,e.segments,e.phiStart,e.phiLength)}}class mh extends ua{constructor(e=1,t=1,i=4,r=8){const s=new jo;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new mh(e.radius,e.length,e.capSegments,e.radialSegments)}}class gh extends ot{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new F,h=new fe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let u=0,d=3;u<=t;u++,d+=3){const f=i+u/t*r;c.x=e*Math.cos(f),c.y=e*Math.sin(f),o.push(c.x,c.y,c.z),a.push(0,0,1),h.x=(o[d]/e+1)/2,h.y=(o[d+1]/e+1)/2,l.push(h.x,h.y)}for(let u=1;u<=t;u++)s.push(u,u+1,0);this.setIndex(s),this.setAttribute("position",new Qe(o,3)),this.setAttribute("normal",new Qe(a,3)),this.setAttribute("uv",new Qe(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gh(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Vs extends ot{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const h=[],u=[],d=[],f=[];let A=0;const g=[],m=i/2;let p=0;v(),o===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new Qe(u,3)),this.setAttribute("normal",new Qe(d,3)),this.setAttribute("uv",new Qe(f,2));function v(){const b=new F,w=new F;let M=0;const S=(t-e)/i;for(let R=0;R<=s;R++){const _=[],I=R/s,D=I*(t-e)+e;for(let Q=0;Q<=r;Q++){const N=Q/r,z=N*l+a,$=Math.sin(z),H=Math.cos(z);w.x=D*$,w.y=-I*i+m,w.z=D*H,u.push(w.x,w.y,w.z),b.set($,S,H).normalize(),d.push(b.x,b.y,b.z),f.push(N,1-I),_.push(A++)}g.push(_)}for(let R=0;R<r;R++)for(let _=0;_<s;_++){const I=g[_][R],D=g[_+1][R],Q=g[_+1][R+1],N=g[_][R+1];(e>0||_!==0)&&(h.push(I,D,N),M+=3),(t>0||_!==s-1)&&(h.push(D,Q,N),M+=3)}c.addGroup(p,M,0),p+=M}function y(b){const w=A,M=new fe,S=new F;let R=0;const _=b===!0?e:t,I=b===!0?1:-1;for(let Q=1;Q<=r;Q++)u.push(0,m*I,0),d.push(0,I,0),f.push(.5,.5),A++;const D=A;for(let Q=0;Q<=r;Q++){const z=Q/r*l+a,$=Math.cos(z),H=Math.sin(z);S.x=_*H,S.y=m*I,S.z=_*$,u.push(S.x,S.y,S.z),d.push(0,I,0),M.x=$*.5+.5,M.y=H*.5*I+.5,f.push(M.x,M.y),A++}for(let Q=0;Q<r;Q++){const N=w+Q,z=D+Q;b===!0?h.push(z,z+1,N):h.push(z+1,z,N),R+=3}c.addGroup(p,R,b===!0?1:2),p+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vs(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class vh extends Vs{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new vh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class lr extends ot{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),h(),this.setAttribute("position",new Qe(s,3)),this.setAttribute("normal",new Qe(s.slice(),3)),this.setAttribute("uv",new Qe(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(v){const y=new F,b=new F,w=new F;for(let M=0;M<t.length;M+=3)f(t[M+0],y),f(t[M+1],b),f(t[M+2],w),l(y,b,w,v)}function l(v,y,b,w){const M=w+1,S=[];for(let R=0;R<=M;R++){S[R]=[];const _=v.clone().lerp(b,R/M),I=y.clone().lerp(b,R/M),D=M-R;for(let Q=0;Q<=D;Q++)Q===0&&R===M?S[R][Q]=_:S[R][Q]=_.clone().lerp(I,Q/D)}for(let R=0;R<M;R++)for(let _=0;_<2*(M-R)-1;_++){const I=Math.floor(_/2);_%2===0?(d(S[R][I+1]),d(S[R+1][I]),d(S[R][I])):(d(S[R][I+1]),d(S[R+1][I+1]),d(S[R+1][I]))}}function c(v){const y=new F;for(let b=0;b<s.length;b+=3)y.x=s[b+0],y.y=s[b+1],y.z=s[b+2],y.normalize().multiplyScalar(v),s[b+0]=y.x,s[b+1]=y.y,s[b+2]=y.z}function h(){const v=new F;for(let y=0;y<s.length;y+=3){v.x=s[y+0],v.y=s[y+1],v.z=s[y+2];const b=m(v)/2/Math.PI+.5,w=p(v)/Math.PI+.5;o.push(b,1-w)}A(),u()}function u(){for(let v=0;v<o.length;v+=6){const y=o[v+0],b=o[v+2],w=o[v+4],M=Math.max(y,b,w),S=Math.min(y,b,w);M>.9&&S<.1&&(y<.2&&(o[v+0]+=1),b<.2&&(o[v+2]+=1),w<.2&&(o[v+4]+=1))}}function d(v){s.push(v.x,v.y,v.z)}function f(v,y){const b=v*3;y.x=e[b+0],y.y=e[b+1],y.z=e[b+2]}function A(){const v=new F,y=new F,b=new F,w=new F,M=new fe,S=new fe,R=new fe;for(let _=0,I=0;_<s.length;_+=9,I+=6){v.set(s[_+0],s[_+1],s[_+2]),y.set(s[_+3],s[_+4],s[_+5]),b.set(s[_+6],s[_+7],s[_+8]),M.set(o[I+0],o[I+1]),S.set(o[I+2],o[I+3]),R.set(o[I+4],o[I+5]),w.copy(v).add(y).add(b).divideScalar(3);const D=m(w);g(M,I+0,v,D),g(S,I+2,y,D),g(R,I+4,b,D)}}function g(v,y,b,w){w<0&&v.x===1&&(o[y]=v.x-1),b.x===0&&b.z===0&&(o[y]=w/2/Math.PI+.5)}function m(v){return Math.atan2(v.z,-v.x)}function p(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lr(e.vertices,e.indices,e.radius,e.details)}}class yh extends lr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new yh(e.radius,e.detail)}}const Ka=new F,Ja=new F,vu=new F,Za=new bn;class ty extends ot{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(zr*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],h=["a","b","c"],u=new Array(3),d={},f=[];for(let A=0;A<l;A+=3){o?(c[0]=o.getX(A),c[1]=o.getX(A+1),c[2]=o.getX(A+2)):(c[0]=A,c[1]=A+1,c[2]=A+2);const{a:g,b:m,c:p}=Za;if(g.fromBufferAttribute(a,c[0]),m.fromBufferAttribute(a,c[1]),p.fromBufferAttribute(a,c[2]),Za.getNormal(vu),u[0]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,u[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,u[2]=`${Math.round(p.x*r)},${Math.round(p.y*r)},${Math.round(p.z*r)}`,!(u[0]===u[1]||u[1]===u[2]||u[2]===u[0]))for(let v=0;v<3;v++){const y=(v+1)%3,b=u[v],w=u[y],M=Za[h[v]],S=Za[h[y]],R=`${b}_${w}`,_=`${w}_${b}`;_ in d&&d[_]?(vu.dot(d[_].normal)<=s&&(f.push(M.x,M.y,M.z),f.push(S.x,S.y,S.z)),d[_]=null):R in d||(d[R]={index0:c[v],index1:c[y],normal:vu.clone()})}}for(const A in d)if(d[A]){const{index0:g,index1:m}=d[A];Ka.fromBufferAttribute(a,g),Ja.fromBufferAttribute(a,m),f.push(Ka.x,Ka.y,Ka.z),f.push(Ja.x,Ja.y,Ja.z)}this.setAttribute("position",new Qe(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Hr extends jo{constructor(e){super(e),this.uuid=Rn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].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,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new jo().fromJSON(r))}return this}}const nw={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=ny(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,u,d,f;if(i&&(s=aw(n,e,s,t)),n.length>80*t){a=c=n[0],l=h=n[1];for(let A=t;A<r;A+=t)u=n[A],d=n[A+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);f=Math.max(c-a,h-l),f=f!==0?32767/f:0}return Xo(s,o,t,a,l,f,0),o}};function ny(n,e,t,i,r){let s,o;if(r===vw(n,e,t,i)>0)for(s=e;s<t;s+=i)o=NA(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=NA(s,n[s],n[s+1],o);return o&&Eh(o,o.next)&&(Ko(o),o=o.next),o}function Xr(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Eh(t,t.next)||It(t.prev,t,t.next)===0)){if(Ko(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Xo(n,e,t,i,r,s,o){if(!n)return;!o&&s&&dw(n,i,r,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?rw(n,i,r,s):iw(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Ko(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=sw(Xr(n),e,t),Xo(n,e,t,i,r,s,2)):o===2&&ow(n,e,t,i,r,s):Xo(Xr(n),e,t,i,r,s,1);break}}}function iw(n){const e=n.prev,t=n,i=n.next;if(It(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,h=r<s?r<o?r:o:s<o?s:o,u=a<l?a<c?a:c:l<c?l:c,d=r>s?r>o?r:o:s>o?s:o,f=a>l?a>c?a:c:l>c?l:c;let A=i.next;for(;A!==e;){if(A.x>=h&&A.x<=d&&A.y>=u&&A.y<=f&&Ts(r,a,s,l,o,c,A.x,A.y)&&It(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function rw(n,e,t,i){const r=n.prev,s=n,o=n.next;if(It(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,h=r.y,u=s.y,d=o.y,f=a<l?a<c?a:c:l<c?l:c,A=h<u?h<d?h:d:u<d?u:d,g=a>l?a>c?a:c:l>c?l:c,m=h>u?h>d?h:d:u>d?u:d,p=Nd(f,A,e,t,i),v=Nd(g,m,e,t,i);let y=n.prevZ,b=n.nextZ;for(;y&&y.z>=p&&b&&b.z<=v;){if(y.x>=f&&y.x<=g&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&Ts(a,h,l,u,c,d,y.x,y.y)&&It(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=f&&b.x<=g&&b.y>=A&&b.y<=m&&b!==r&&b!==o&&Ts(a,h,l,u,c,d,b.x,b.y)&&It(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=p;){if(y.x>=f&&y.x<=g&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&Ts(a,h,l,u,c,d,y.x,y.y)&&It(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=f&&b.x<=g&&b.y>=A&&b.y<=m&&b!==r&&b!==o&&Ts(a,h,l,u,c,d,b.x,b.y)&&It(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function sw(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!Eh(r,s)&&iy(r,i,i.next,s)&&Yo(r,s)&&Yo(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Ko(i),Ko(i.next),i=n=s),i=i.next}while(i!==n);return Xr(i)}function ow(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Aw(o,a)){let l=ry(o,a);o=Xr(o,o.next),l=Xr(l,l.next),Xo(o,e,t,i,r,s,0),Xo(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function aw(n,e,t,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=ny(n,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(pw(c));for(r.sort(lw),s=0;s<r.length;s++)t=cw(r[s],t);return t}function lw(n,e){return n.x-e.x}function cw(n,e){const t=hw(n,e);if(!t)return e;const i=ry(t,n);return Xr(i,i.next),Xr(t,t.next)}function hw(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=s&&d>i&&(i=d,r=t.x<t.next.x?t:t.next,d===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let h=1/0,u;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&Ts(o<c?s:i,o,l,c,o<c?i:s,o,t.x,t.y)&&(u=Math.abs(o-t.y)/(s-t.x),Yo(t,n)&&(u<h||u===h&&(t.x>r.x||t.x===r.x&&uw(r,t)))&&(r=t,h=u)),t=t.next;while(t!==a);return r}function uw(n,e){return It(n.prev,n,e.prev)<0&&It(e.next,n,n.next)<0}function dw(n,e,t,i){let r=n;do r.z===0&&(r.z=Nd(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,fw(r)}function fw(n){let e,t,i,r,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(o>1);return n}function Nd(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function pw(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Ts(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function Aw(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!mw(n,e)&&(Yo(n,e)&&Yo(e,n)&&gw(n,e)&&(It(n.prev,n,e.prev)||It(n,e.prev,e))||Eh(n,e)&&It(n.prev,n,n.next)>0&&It(e.prev,e,e.next)>0)}function It(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Eh(n,e){return n.x===e.x&&n.y===e.y}function iy(n,e,t,i){const r=el(It(n,e,t)),s=el(It(n,e,i)),o=el(It(t,i,n)),a=el(It(t,i,e));return!!(r!==s&&o!==a||r===0&&$a(n,t,e)||s===0&&$a(n,i,e)||o===0&&$a(t,n,i)||a===0&&$a(t,e,i))}function $a(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function el(n){return n>0?1:n<0?-1:0}function mw(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&iy(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Yo(n,e){return It(n.prev,n,n.next)<0?It(n,e,n.next)>=0&&It(n,n.prev,e)>=0:It(n,e,n.prev)<0||It(n,n.next,e)<0}function gw(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function ry(n,e){const t=new Qd(n.i,n.x,n.y),i=new Qd(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function NA(n,e,t,i){const r=new Qd(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ko(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Qd(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function vw(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class ci{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return ci.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];QA(e),GA(i,e);let o=e.length;t.forEach(QA);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,GA(i,t[l]);const a=nw.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function QA(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function GA(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class xh extends ot{constructor(e=new Hr([new fe(.5,.5),new fe(-.5,.5),new fe(-.5,-.5),new fe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Qe(r,3)),this.setAttribute("uv",new Qe(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,A=t.bevelSize!==void 0?t.bevelSize:f-.1,g=t.bevelOffset!==void 0?t.bevelOffset:0,m=t.bevelSegments!==void 0?t.bevelSegments:3;const p=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:yw;let y,b=!1,w,M,S,R;p&&(y=p.getSpacedPoints(h),b=!0,d=!1,w=p.computeFrenetFrames(h,!1),M=new F,S=new F,R=new F),d||(m=0,f=0,A=0,g=0);const _=a.extractPoints(c);let I=_.shape;const D=_.holes;if(!ci.isClockWise(I)){I=I.reverse();for(let ne=0,le=D.length;ne<le;ne++){const ce=D[ne];ci.isClockWise(ce)&&(D[ne]=ce.reverse())}}const N=ci.triangulateShape(I,D),z=I;for(let ne=0,le=D.length;ne<le;ne++){const ce=D[ne];I=I.concat(ce)}function $(ne,le,ce){return le||console.error("THREE.ExtrudeGeometry: vec does not exist"),ne.clone().addScaledVector(le,ce)}const H=I.length,K=N.length;function Y(ne,le,ce){let O,me,ye;const x=ne.x-le.x,C=ne.y-le.y,T=ce.x-ne.x,U=ce.y-ne.y,k=x*x+C*C,j=x*U-C*T;if(Math.abs(j)>Number.EPSILON){const ie=Math.sqrt(k),ke=Math.sqrt(T*T+U*U),P=le.x-C/ie,B=le.y+x/ie,V=ce.x-U/ke,re=ce.y+T/ke,de=((V-P)*U-(re-B)*T)/(x*U-C*T);O=P+x*de-ne.x,me=B+C*de-ne.y;const oe=O*O+me*me;if(oe<=2)return new fe(O,me);ye=Math.sqrt(oe/2)}else{let ie=!1;x>Number.EPSILON?T>Number.EPSILON&&(ie=!0):x<-Number.EPSILON?T<-Number.EPSILON&&(ie=!0):Math.sign(C)===Math.sign(U)&&(ie=!0),ie?(O=-C,me=x,ye=Math.sqrt(k)):(O=x,me=C,ye=Math.sqrt(k/2))}return new fe(O/ye,me/ye)}const ee=[];for(let ne=0,le=z.length,ce=le-1,O=ne+1;ne<le;ne++,ce++,O++)ce===le&&(ce=0),O===le&&(O=0),ee[ne]=Y(z[ne],z[ce],z[O]);const pe=[];let be,Ce=ee.concat();for(let ne=0,le=D.length;ne<le;ne++){const ce=D[ne];be=[];for(let O=0,me=ce.length,ye=me-1,x=O+1;O<me;O++,ye++,x++)ye===me&&(ye=0),x===me&&(x=0),be[O]=Y(ce[O],ce[ye],ce[x]);pe.push(be),Ce=Ce.concat(be)}for(let ne=0;ne<m;ne++){const le=ne/m,ce=f*Math.cos(le*Math.PI/2),O=A*Math.sin(le*Math.PI/2)+g;for(let me=0,ye=z.length;me<ye;me++){const x=$(z[me],ee[me],O);se(x.x,x.y,-ce)}for(let me=0,ye=D.length;me<ye;me++){const x=D[me];be=pe[me];for(let C=0,T=x.length;C<T;C++){const U=$(x[C],be[C],O);se(U.x,U.y,-ce)}}}const Pe=A+g;for(let ne=0;ne<H;ne++){const le=d?$(I[ne],Ce[ne],Pe):I[ne];b?(S.copy(w.normals[0]).multiplyScalar(le.x),M.copy(w.binormals[0]).multiplyScalar(le.y),R.copy(y[0]).add(S).add(M),se(R.x,R.y,R.z)):se(le.x,le.y,0)}for(let ne=1;ne<=h;ne++)for(let le=0;le<H;le++){const ce=d?$(I[le],Ce[le],Pe):I[le];b?(S.copy(w.normals[ne]).multiplyScalar(ce.x),M.copy(w.binormals[ne]).multiplyScalar(ce.y),R.copy(y[ne]).add(S).add(M),se(R.x,R.y,R.z)):se(ce.x,ce.y,u/h*ne)}for(let ne=m-1;ne>=0;ne--){const le=ne/m,ce=f*Math.cos(le*Math.PI/2),O=A*Math.sin(le*Math.PI/2)+g;for(let me=0,ye=z.length;me<ye;me++){const x=$(z[me],ee[me],O);se(x.x,x.y,u+ce)}for(let me=0,ye=D.length;me<ye;me++){const x=D[me];be=pe[me];for(let C=0,T=x.length;C<T;C++){const U=$(x[C],be[C],O);b?se(U.x,U.y+y[h-1].y,y[h-1].x+ce):se(U.x,U.y,u+ce)}}}Me(),te();function Me(){const ne=r.length/3;if(d){let le=0,ce=H*le;for(let O=0;O<K;O++){const me=N[O];X(me[2]+ce,me[1]+ce,me[0]+ce)}le=h+m*2,ce=H*le;for(let O=0;O<K;O++){const me=N[O];X(me[0]+ce,me[1]+ce,me[2]+ce)}}else{for(let le=0;le<K;le++){const ce=N[le];X(ce[2],ce[1],ce[0])}for(let le=0;le<K;le++){const ce=N[le];X(ce[0]+H*h,ce[1]+H*h,ce[2]+H*h)}}i.addGroup(ne,r.length/3-ne,0)}function te(){const ne=r.length/3;let le=0;Ae(z,le),le+=z.length;for(let ce=0,O=D.length;ce<O;ce++){const me=D[ce];Ae(me,le),le+=me.length}i.addGroup(ne,r.length/3-ne,1)}function Ae(ne,le){let ce=ne.length;for(;--ce>=0;){const O=ce;let me=ce-1;me<0&&(me=ne.length-1);for(let ye=0,x=h+m*2;ye<x;ye++){const C=H*ye,T=H*(ye+1),U=le+O+C,k=le+me+C,j=le+me+T,ie=le+O+T;he(U,k,j,ie)}}}function se(ne,le,ce){l.push(ne),l.push(le),l.push(ce)}function X(ne,le,ce){ue(ne),ue(le),ue(ce);const O=r.length/3,me=v.generateTopUV(i,r,O-3,O-2,O-1);ve(me[0]),ve(me[1]),ve(me[2])}function he(ne,le,ce,O){ue(ne),ue(le),ue(O),ue(le),ue(ce),ue(O);const me=r.length/3,ye=v.generateSideWallUV(i,r,me-6,me-3,me-2,me-1);ve(ye[0]),ve(ye[1]),ve(ye[3]),ve(ye[1]),ve(ye[2]),ve(ye[3])}function ue(ne){r.push(l[ne*3+0]),r.push(l[ne*3+1]),r.push(l[ne*3+2])}function ve(ne){s.push(ne.x),s.push(ne.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return Ew(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new Pc[r.type]().fromJSON(r)),new xh(i,e.options)}}const yw={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],h=e[r*3+1];return[new fe(s,o),new fe(a,l),new fe(c,h)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],h=e[i*3+1],u=e[i*3+2],d=e[r*3],f=e[r*3+1],A=e[r*3+2],g=e[s*3],m=e[s*3+1],p=e[s*3+2];return Math.abs(a-h)<Math.abs(o-c)?[new fe(o,1-l),new fe(c,1-u),new fe(d,1-A),new fe(g,1-p)]:[new fe(a,1-l),new fe(h,1-u),new fe(f,1-A),new fe(m,1-p)]}};function Ew(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class bh extends lr{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new bh(e.radius,e.detail)}}class da extends lr{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new da(e.radius,e.detail)}}class Ws extends ot{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,h=l+1,u=e/a,d=t/l,f=[],A=[],g=[],m=[];for(let p=0;p<h;p++){const v=p*d-o;for(let y=0;y<c;y++){const b=y*u-s;A.push(b,-v,0),g.push(0,0,1),m.push(y/a),m.push(1-p/l)}}for(let p=0;p<l;p++)for(let v=0;v<a;v++){const y=v+c*p,b=v+c*(p+1),w=v+1+c*(p+1),M=v+1+c*p;f.push(y,b,M),f.push(b,w,M)}this.setIndex(f),this.setAttribute("position",new Qe(A,3)),this.setAttribute("normal",new Qe(g,3)),this.setAttribute("uv",new Qe(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ws(e.width,e.height,e.widthSegments,e.heightSegments)}}class Ch extends ot{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],h=[];let u=e;const d=(t-e)/r,f=new F,A=new fe;for(let g=0;g<=r;g++){for(let m=0;m<=i;m++){const p=s+m/i*o;f.x=u*Math.cos(p),f.y=u*Math.sin(p),l.push(f.x,f.y,f.z),c.push(0,0,1),A.x=(f.x/t+1)/2,A.y=(f.y/t+1)/2,h.push(A.x,A.y)}u+=d}for(let g=0;g<r;g++){const m=g*(i+1);for(let p=0;p<i;p++){const v=p+m,y=v,b=v+i+1,w=v+i+2,M=v+1;a.push(y,b,M),a.push(b,w,M)}}this.setIndex(a),this.setAttribute("position",new Qe(l,3)),this.setAttribute("normal",new Qe(c,3)),this.setAttribute("uv",new Qe(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ch(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class wh extends ot{constructor(e=new Hr([new fe(0,.5),new fe(-.5,-.5),new fe(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let h=0;h<e.length;h++)c(e[h]),this.addGroup(a,l,h),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new Qe(r,3)),this.setAttribute("normal",new Qe(s,3)),this.setAttribute("uv",new Qe(o,2));function c(h){const u=r.length/3,d=h.extractPoints(t);let f=d.shape;const A=d.holes;ci.isClockWise(f)===!1&&(f=f.reverse());for(let m=0,p=A.length;m<p;m++){const v=A[m];ci.isClockWise(v)===!0&&(A[m]=v.reverse())}const g=ci.triangulateShape(f,A);for(let m=0,p=A.length;m<p;m++){const v=A[m];f=f.concat(v)}for(let m=0,p=f.length;m<p;m++){const v=f[m];r.push(v.x,v.y,0),s.push(0,0,1),o.push(v.x,v.y)}for(let m=0,p=g.length;m<p;m++){const v=g[m],y=v[0]+u,b=v[1]+u,w=v[2]+u;i.push(y,b,w),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return xw(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new wh(i,e.curveSegments)}}function xw(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class fa extends ot{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const h=[],u=new F,d=new F,f=[],A=[],g=[],m=[];for(let p=0;p<=i;p++){const v=[],y=p/i;let b=0;p===0&&o===0?b=.5/t:p===i&&l===Math.PI&&(b=-.5/t);for(let w=0;w<=t;w++){const M=w/t;u.x=-e*Math.cos(r+M*s)*Math.sin(o+y*a),u.y=e*Math.cos(o+y*a),u.z=e*Math.sin(r+M*s)*Math.sin(o+y*a),A.push(u.x,u.y,u.z),d.copy(u).normalize(),g.push(d.x,d.y,d.z),m.push(M+b,1-y),v.push(c++)}h.push(v)}for(let p=0;p<i;p++)for(let v=0;v<t;v++){const y=h[p][v+1],b=h[p][v],w=h[p+1][v],M=h[p+1][v+1];(p!==0||o>0)&&f.push(y,b,M),(p!==i-1||l<Math.PI)&&f.push(b,w,M)}this.setIndex(f),this.setAttribute("position",new Qe(A,3)),this.setAttribute("normal",new Qe(g,3)),this.setAttribute("uv",new Qe(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fa(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class _h extends lr{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new _h(e.radius,e.detail)}}class Mh extends ot{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],l=[],c=[],h=new F,u=new F,d=new F;for(let f=0;f<=i;f++)for(let A=0;A<=r;A++){const g=A/r*s,m=f/i*Math.PI*2;u.x=(e+t*Math.cos(m))*Math.cos(g),u.y=(e+t*Math.cos(m))*Math.sin(g),u.z=t*Math.sin(m),a.push(u.x,u.y,u.z),h.x=e*Math.cos(g),h.y=e*Math.sin(g),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(A/r),c.push(f/i)}for(let f=1;f<=i;f++)for(let A=1;A<=r;A++){const g=(r+1)*f+A-1,m=(r+1)*(f-1)+A-1,p=(r+1)*(f-1)+A,v=(r+1)*f+A;o.push(g,m,v),o.push(m,p,v)}this.setIndex(o),this.setAttribute("position",new Qe(a,3)),this.setAttribute("normal",new Qe(l,3)),this.setAttribute("uv",new Qe(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Mh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Sh extends ot{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],h=[],u=new F,d=new F,f=new F,A=new F,g=new F,m=new F,p=new F;for(let y=0;y<=i;++y){const b=y/i*s*Math.PI*2;v(b,s,o,e,f),v(b+.01,s,o,e,A),m.subVectors(A,f),p.addVectors(A,f),g.crossVectors(m,p),p.crossVectors(g,m),g.normalize(),p.normalize();for(let w=0;w<=r;++w){const M=w/r*Math.PI*2,S=-t*Math.cos(M),R=t*Math.sin(M);u.x=f.x+(S*p.x+R*g.x),u.y=f.y+(S*p.y+R*g.y),u.z=f.z+(S*p.z+R*g.z),l.push(u.x,u.y,u.z),d.subVectors(u,f).normalize(),c.push(d.x,d.y,d.z),h.push(y/i),h.push(w/r)}}for(let y=1;y<=i;y++)for(let b=1;b<=r;b++){const w=(r+1)*(y-1)+(b-1),M=(r+1)*y+(b-1),S=(r+1)*y+b,R=(r+1)*(y-1)+b;a.push(w,M,R),a.push(M,S,R)}this.setIndex(a),this.setAttribute("position",new Qe(l,3)),this.setAttribute("normal",new Qe(c,3)),this.setAttribute("uv",new Qe(h,2));function v(y,b,w,M,S){const R=Math.cos(y),_=Math.sin(y),I=w/b*y,D=Math.cos(I);S.x=M*(2+D)*.5*R,S.y=M*(2+D)*_*.5,S.z=M*Math.sin(I)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sh(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Ih extends ot{constructor(e=new $f(new F(-1,-1,0),new F(-1,1,0),new F(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new F,l=new F,c=new fe;let h=new F;const u=[],d=[],f=[],A=[];g(),this.setIndex(A),this.setAttribute("position",new Qe(u,3)),this.setAttribute("normal",new Qe(d,3)),this.setAttribute("uv",new Qe(f,2));function g(){for(let y=0;y<t;y++)m(y);m(s===!1?t:0),v(),p()}function m(y){h=e.getPointAt(y/t,h);const b=o.normals[y],w=o.binormals[y];for(let M=0;M<=r;M++){const S=M/r*Math.PI*2,R=Math.sin(S),_=-Math.cos(S);l.x=_*b.x+R*w.x,l.y=_*b.y+R*w.y,l.z=_*b.z+R*w.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=h.x+i*l.x,a.y=h.y+i*l.y,a.z=h.z+i*l.z,u.push(a.x,a.y,a.z)}}function p(){for(let y=1;y<=t;y++)for(let b=1;b<=r;b++){const w=(r+1)*(y-1)+(b-1),M=(r+1)*y+(b-1),S=(r+1)*y+b,R=(r+1)*(y-1)+b;A.push(w,M,R),A.push(M,S,R)}}function v(){for(let y=0;y<=t;y++)for(let b=0;b<=r;b++)c.x=y/t,c.y=b/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Ih(new Pc[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class sy extends ot{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new F,s=new F;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,h=l.length;c<h;++c){const u=l[c],d=u.start,f=u.count;for(let A=d,g=d+f;A<g;A+=3)for(let m=0;m<3;m++){const p=a.getX(A+m),v=a.getX(A+(m+1)%3);r.fromBufferAttribute(o,p),s.fromBufferAttribute(o,v),zA(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const h=3*a+c,u=3*a+(c+1)%3;r.fromBufferAttribute(o,h),s.fromBufferAttribute(o,u),zA(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Qe(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function zA(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var HA=Object.freeze({__proto__:null,BoxGeometry:Yr,CapsuleGeometry:mh,CircleGeometry:gh,ConeGeometry:vh,CylinderGeometry:Vs,DodecahedronGeometry:yh,EdgesGeometry:ty,ExtrudeGeometry:xh,IcosahedronGeometry:bh,LatheGeometry:ua,OctahedronGeometry:da,PlaneGeometry:Ws,PolyhedronGeometry:lr,RingGeometry:Ch,ShapeGeometry:wh,SphereGeometry:fa,TetrahedronGeometry:_h,TorusGeometry:Mh,TorusKnotGeometry:Sh,TubeGeometry:Ih,WireframeGeometry:sy});class oy extends on{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new De(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 ay extends Zn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class tp extends on{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new De(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 De(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=or,this.normalScale=new fe(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 Ln,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 ly extends tp{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 fe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return tt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new De(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 De(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new De(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 cy extends on{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new De(16777215),this.specular=new De(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new De(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=or,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ln,this.combine=oa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hy extends on{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new De(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new De(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=or,this.normalScale=new fe(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 uy extends on{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=or,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class dy extends on{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new De(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new De(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=or,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ln,this.combine=oa,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 np extends on{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=bv,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 ip extends on{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}}class fy extends on{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new De(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=or,this.normalScale=new fe(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 py extends gn{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 Qr(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Ay(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function my(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function Gd(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function rp(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function bw(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],h=c.getValueSize(),u=[],d=[];for(let f=0;f<c.times.length;++f){const A=c.times[f]*r;if(!(A<t||A>=i)){u.push(c.times[f]);for(let g=0;g<h;++g)d.push(c.values[f*h+g])}}u.length!==0&&(c.times=Qr(u,c.times.constructor),c.values=Qr(d,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function Cw(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(p){return p.name===a.name&&p.ValueTypeName===l});if(c===void 0)continue;let h=0;const u=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);const A=a.times.length-1;let g;if(s<=a.times[0]){const p=h,v=u-h;g=a.values.slice(p,v)}else if(s>=a.times[A]){const p=A*u+h,v=p+u-h;g=a.values.slice(p,v)}else{const p=a.createInterpolant(),v=h,y=u-h;p.evaluate(s),g=p.resultBuffer.slice(v,y)}l==="quaternion"&&new wn().fromArray(g).normalize().conjugate().toArray(g);const m=c.times.length;for(let p=0;p<m;++p){const v=p*f+d;if(l==="quaternion")wn.multiplyQuaternionsFlat(c.values,v,g,0,c.values,v);else{const y=f-d*2;for(let b=0;b<y;++b)c.values[v+b]-=g[b]}}}return n.blendMode=Qf,n}const ww={convertArray:Qr,isTypedArray:Ay,getKeyframeOrder:my,sortedArray:Gd,flattenJSON:rp,subclip:bw,makeClipAdditive:Cw};class pa{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class gy extends pa{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Or,endingEnd:Or}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case kr:s=e,a=2*t-i;break;case zo:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(l===void 0)switch(this.getSettings_().endingEnd){case kr:o=e,l=2*i-t;break;case zo:o=1,l=i+r[1]-r[0];break;default:o=e-1,l=t}const c=(i-t)*.5,h=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-i),this._offsetPrev=s*h,this._offsetNext=o*h}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,A=(i-t)/(r-t),g=A*A,m=g*A,p=-d*m+2*d*g-d*A,v=(1+d)*m+(-1.5-2*d)*g+(-.5+d)*A+1,y=(-1-f)*m+(1.5+f)*g+.5*A,b=f*m-f*g;for(let w=0;w!==a;++w)s[w]=p*o[h+w]+v*o[c+w]+y*o[l+w]+b*o[u+w];return s}}class sp extends pa{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=(i-t)/(r-t),u=1-h;for(let d=0;d!==a;++d)s[d]=o[c+d]*u+o[l+d]*h;return s}}class vy extends pa{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class ei{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Qr(t,this.TimeBufferType),this.values=Qr(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:Qr(e.times,Array),values:Qr(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new vy(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new sp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new gy(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Go:t=this.InterpolantFactoryMethodDiscrete;break;case Rc:t=this.InterpolantFactoryMethodLinear;break;case Ql:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Go;case this.InterpolantFactoryMethodLinear:return Rc;case this.InterpolantFactoryMethodSmooth:return Ql}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&Ay(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===Ql,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],h=e[a+1];if(c!==h&&(a!==1||c!==e[0]))if(r)l=!0;else{const u=a*i,d=u-i,f=u+i;for(let A=0;A!==i;++A){const g=t[u+A];if(g!==t[d+A]||g!==t[f+A]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const u=a*i,d=o*i;for(let f=0;f!==i;++f)t[d+f]=t[u+f]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}ei.prototype.TimeBufferType=Float32Array;ei.prototype.ValueBufferType=Float32Array;ei.prototype.DefaultInterpolation=Rc;class Kr extends ei{constructor(e,t,i){super(e,t,i)}}Kr.prototype.ValueTypeName="bool";Kr.prototype.ValueBufferType=Array;Kr.prototype.DefaultInterpolation=Go;Kr.prototype.InterpolantFactoryMethodLinear=void 0;Kr.prototype.InterpolantFactoryMethodSmooth=void 0;class op extends ei{}op.prototype.ValueTypeName="color";class Jo extends ei{}Jo.prototype.ValueTypeName="number";class yy extends pa{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let h=c+a;c!==h;c+=4)wn.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Aa extends ei{InterpolantFactoryMethodLinear(e){return new yy(this.times,this.values,this.getValueSize(),e)}}Aa.prototype.ValueTypeName="quaternion";Aa.prototype.InterpolantFactoryMethodSmooth=void 0;class Jr extends ei{constructor(e,t,i){super(e,t,i)}}Jr.prototype.ValueTypeName="string";Jr.prototype.ValueBufferType=Array;Jr.prototype.DefaultInterpolation=Go;Jr.prototype.InterpolantFactoryMethodLinear=void 0;Jr.prototype.InterpolantFactoryMethodSmooth=void 0;class Zo extends ei{}Zo.prototype.ValueTypeName="vector";class $o{constructor(e="",t=-1,i=[],r=sh){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Rn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(Mw(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(ei.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const h=my(l);l=Gd(l,1,h),c=Gd(c,1,h),!r&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Jo(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],h=c.name.match(s);if(h&&h.length>1){const u=h[1];let d=r[u];d||(r[u]=d=[]),d.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(u,d,f,A,g){if(f.length!==0){const m=[],p=[];rp(f,m,p,A),m.length!==0&&g.push(new u(d,m,p))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u<c.length;u++){const d=c[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let A;for(A=0;A<d.length;A++)if(d[A].morphTargets)for(let g=0;g<d[A].morphTargets.length;g++)f[d[A].morphTargets[g]]=-1;for(const g in f){const m=[],p=[];for(let v=0;v!==d[A].morphTargets.length;++v){const y=d[A];m.push(y.time),p.push(y.morphTarget===g?1:0)}r.push(new Jo(".morphTargetInfluence["+g+"]",m,p))}l=f.length*o}else{const f=".bones["+t[u].name+"]";i(Zo,f+".position",d,"pos",r),i(Aa,f+".quaternion",d,"rot",r),i(Zo,f+".scale",d,"scl",r)}}return r.length===0?null:new this(s,l,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function _w(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Jo;case"vector":case"vector2":case"vector3":case"vector4":return Zo;case"color":return op;case"quaternion":return Aa;case"bool":case"boolean":return Kr;case"string":return Jr}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function Mw(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=_w(n.type);if(n.times===void 0){const t=[],i=[];rp(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const _i={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class ap{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(h){a++,s===!1&&r.onStart!==void 0&&r.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,r.onProgress!==void 0&&r.onProgress(h,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const f=c[u],A=c[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return A}return null}}}const Ey=new ap;class _n{constructor(e){this.manager=e!==void 0?e:Ey,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}_n.DEFAULT_MATERIAL_NAME="__DEFAULT";const vi={};class Sw extends Error{constructor(e,t){super(e),this.response=t}}class Oi extends _n{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=_i.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(vi[e]!==void 0){vi[e].push({onLoad:t,onProgress:i,onError:r});return}vi[e]=[],vi[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=vi[e],u=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=d?parseInt(d):0,A=f!==0;let g=0;const m=new ReadableStream({start(p){v();function v(){u.read().then(({done:y,value:b})=>{if(y)p.close();else{g+=b.byteLength;const w=new ProgressEvent("progress",{lengthComputable:A,loaded:g,total:f});for(let M=0,S=h.length;M<S;M++){const R=h[M];R.onProgress&&R.onProgress(w)}p.enqueue(b),v()}},y=>{p.error(y)})}}});return new Response(m)}else throw new Sw(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return c.json();default:if(a===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(A=>f.decode(A))}}}).then(c=>{_i.add(e,c);const h=vi[e];delete vi[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(c)}}).catch(c=>{const h=vi[e];if(h===void 0)throw this.manager.itemError(e),c;delete vi[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Iw extends _n{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Oi(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=$o.parse(e[i]);t.push(r)}return t}}class Bw extends _n{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new ph,l=new Oi(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function h(u){l.load(e[u],function(d){const f=s.parse(d,!0);o[u]={width:f.width,height:f.height,format:f.format,mipmaps:f.mipmaps},c+=1,c===6&&(f.mipmapCount===1&&(a.minFilter=Ht),a.image=o,a.format=f.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let u=0,d=e.length;u<d;++u)h(u);else l.load(e,function(u){const d=s.parse(u,!0);if(d.isCubemap){const f=d.mipmaps.length/d.mipmapCount;for(let A=0;A<f;A++){o[A]={mipmaps:[]};for(let g=0;g<d.mipmapCount;g++)o[A].mipmaps.push(d.mipmaps[A*d.mipmapCount+g]),o[A].format=d.format,o[A].width=d.width,o[A].height=d.height}a.image=o}else a.image.width=d.width,a.image.height=d.height,a.mipmaps=d.mipmaps;d.mipmapCount===1&&(a.minFilter=Ht),a.format=d.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class ea extends _n{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=_i.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=qo("img");function l(){h(),_i.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){h(),r&&r(u),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Tw extends _n{constructor(e){super(e)}load(e,t,i,r){const s=new ca;s.colorSpace=xn;const o=new ea(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(h){s.images[c]=h,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class Rw extends _n{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new li,a=new Oi(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(h){if(r!==void 0)r(h);else{console.error(h);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:On,o.wrapT=c.wrapT!==void 0?c.wrapT:On,o.magFilter=c.magFilter!==void 0?c.magFilter:Ht,o.minFilter=c.minFilter!==void 0?c.minFilter:Ht,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=oi),c.mipmapCount===1&&(o.minFilter=Ht),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},i,r),o}}class Lw extends _n{constructor(e){super(e)}load(e,t,i,r){const s=new Tt,o=new ea(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class cr extends gt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new De(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class xy extends cr{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(gt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new De(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const yu=new Ye,VA=new F,WA=new F;class lp{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new fe(512,512),this.map=null,this.mapPass=null,this.matrix=new Ye,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ha,this._frameExtents=new fe(1,1),this._viewportCount=1,this._viewports=[new mt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;VA.setFromMatrixPosition(e.matrixWorld),t.position.copy(VA),WA.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(WA),t.updateMatrixWorld(),yu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(yu),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(yu)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Dw extends lp{constructor(){super(new Yt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Fs*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class by extends cr{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(gt.DEFAULT_UP),this.updateMatrix(),this.target=new gt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new Dw}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 qA=new Ye,so=new F,Eu=new F;class Pw extends lp{constructor(){super(new Yt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new fe(4,2),this._viewportCount=6,this._viewports=[new mt(2,1,1,1),new mt(0,1,1,1),new mt(3,1,1,1),new mt(1,1,1,1),new mt(3,0,1,1),new mt(1,0,1,1)],this._cubeDirections=[new F(1,0,0),new F(-1,0,0),new F(0,0,1),new F(0,0,-1),new F(0,1,0),new F(0,-1,0)],this._cubeUps=[new F(0,1,0),new F(0,1,0),new F(0,1,0),new F(0,1,0),new F(0,0,1),new F(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),so.setFromMatrixPosition(e.matrixWorld),i.position.copy(so),Eu.copy(i.position),Eu.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Eu),i.updateMatrixWorld(),r.makeTranslation(-so.x,-so.y,-so.z),qA.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(qA)}}class Cy extends cr{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new Pw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Bh extends ch{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=h*this.view.offsetY,l=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Uw extends lp{constructor(){super(new Bh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class wy extends cr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(gt.DEFAULT_UP),this.updateMatrix(),this.target=new gt,this.shadow=new Uw}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class _y extends cr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class My extends cr{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Sy{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new F)}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 i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],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 i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class Iy extends cr{constructor(e=new Sy,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 Th extends _n{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new Oi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new De().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(r.dispersion=e.dispersion),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new De().setHex(o.value);break;case"v2":r.uniforms[s].value=new fe().fromArray(o.value);break;case"v3":r.uniforms[s].value=new F().fromArray(o.value);break;case"v4":r.uniforms[s].value=new mt().fromArray(o.value);break;case"m3":r.uniforms[s].value=new et().fromArray(o.value);break;case"m4":r.uniforms[s].value=new Ye().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new fe().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new fe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Th.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:oy,SpriteMaterial:Wf,RawShaderMaterial:ay,ShaderMaterial:Zn,PointsMaterial:jf,MeshPhysicalMaterial:ly,MeshStandardMaterial:tp,MeshPhongMaterial:cy,MeshToonMaterial:hy,MeshNormalMaterial:uy,MeshLambertMaterial:dy,MeshDepthMaterial:np,MeshDistanceMaterial:ip,MeshBasicMaterial:ar,MeshMatcapMaterial:fy,LineDashedMaterial:py,LineBasicMaterial:gn,Material:on};return new t[e]}}class zd{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class By extends ot{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 Ty extends _n{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Oi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(f,A){if(t[A]!==void 0)return t[A];const m=f.interleavedBuffers[A],p=s(f,m.buffer),v=Is(m.type,p),y=new dh(v,m.stride);return y.uuid=m.uuid,t[A]=y,y}function s(f,A){if(i[A]!==void 0)return i[A];const m=f.arrayBuffers[A],p=new Uint32Array(m).buffer;return i[A]=p,p}const o=e.isInstancedBufferGeometry?new By:new ot,a=e.data.index;if(a!==void 0){const f=Is(a.type,a.array);o.setIndex(new wt(f,1))}const l=e.data.attributes;for(const f in l){const A=l[f];let g;if(A.isInterleavedBufferAttribute){const m=r(e.data,A.data);g=new jr(m,A.itemSize,A.offset,A.normalized)}else{const m=Is(A.type,A.array),p=A.isInstancedBufferAttribute?ks:wt;g=new p(m,A.itemSize,A.normalized)}A.name!==void 0&&(g.name=A.name),A.usage!==void 0&&g.setUsage(A.usage),o.setAttribute(f,g)}const c=e.data.morphAttributes;if(c)for(const f in c){const A=c[f],g=[];for(let m=0,p=A.length;m<p;m++){const v=A[m];let y;if(v.isInterleavedBufferAttribute){const b=r(e.data,v.data);y=new jr(b,v.itemSize,v.offset,v.normalized)}else{const b=Is(v.type,v.array);y=new wt(b,v.itemSize,v.normalized)}v.name!==void 0&&(y.name=v.name),g.push(y)}o.morphAttributes[f]=g}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const u=e.data.groups||e.data.drawcalls||e.data.offsets;if(u!==void 0)for(let f=0,A=u.length;f!==A;++f){const g=u[f];o.addGroup(g.start,g.count,g.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const f=new F;d.center!==void 0&&f.fromArray(d.center),o.boundingSphere=new sn(f,d.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class Fw extends _n{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?zd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Oi(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(u){r!==void 0&&r(u),console.error("THREE:ObjectLoader: Can't parse "+e+".",u.message);return}const h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?zd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new Oi(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,i),h=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,h),this.bindLightTargets(c),t!==void 0){let u=!1;for(const d in o)if(o[d].data instanceof HTMLImageElement){u=!0;break}u===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new Hr().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new fh().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const s=new Ty;for(let o=0,a=e.length;o<a;o++){let l;const c=e[o];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":l=s.parse(c);break;case"Geometry":if("THREE"in window&&"LegacyJSONLoader"in THREE){var r=new THREE.LegacyJSONLoader;l=r.parse(c,this.resourcePath).geometry}else console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:c.type in HA?l=HA[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}l.uuid=c.uuid,c.name!==void 0&&(l.name=c.name),c.userData!==void 0&&(l.userData=c.userData),i[c.uuid]=l}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new Th;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=$o.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return o(h)}else return l.data?{data:Is(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new ap(t);s=new ea(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=e.length;c<h;c++){const u=e[c],d=u.url;if(Array.isArray(d)){const f=[];for(let A=0,g=d.length;A<g;A++){const m=d[A],p=a(m);p!==null&&(p instanceof HTMLImageElement?f.push(p):f.push(new li(p.data,p.width,p.height)))}r[u.uuid]=new Nr(f)}else{const f=a(u.url);r[u.uuid]=new Nr(f)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(l)}else return o.data?{data:Is(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new ea(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){const h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u],A=await s(f);A!==null&&(A instanceof HTMLImageElement?h.push(A):h.push(new li(A.data,A.width,A.height)))}i[l.uuid]=new Nr(h)}else{const h=await s(l.url);i[l.uuid]=new Nr(h)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=t[a.image],c=l.data;let h;Array.isArray(c)?(h=new ca,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new li:h=new Tt,c&&(h.needsUpdate=!0)),h.source=l,h.uuid=a.uuid,a.name!==void 0&&(h.name=a.name),a.mapping!==void 0&&(h.mapping=i(a.mapping,Ow)),a.channel!==void 0&&(h.channel=a.channel),a.offset!==void 0&&h.offset.fromArray(a.offset),a.repeat!==void 0&&h.repeat.fromArray(a.repeat),a.center!==void 0&&h.center.fromArray(a.center),a.rotation!==void 0&&(h.rotation=a.rotation),a.wrap!==void 0&&(h.wrapS=i(a.wrap[0],jA),h.wrapT=i(a.wrap[1],jA)),a.format!==void 0&&(h.format=a.format),a.internalFormat!==void 0&&(h.internalFormat=a.internalFormat),a.type!==void 0&&(h.type=a.type),a.colorSpace!==void 0&&(h.colorSpace=a.colorSpace),a.minFilter!==void 0&&(h.minFilter=i(a.minFilter,XA)),a.magFilter!==void 0&&(h.magFilter=i(a.magFilter,XA)),a.anisotropy!==void 0&&(h.anisotropy=a.anisotropy),a.flipY!==void 0&&(h.flipY=a.flipY),a.generateMipmaps!==void 0&&(h.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(h.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(h.compareFunction=a.compareFunction),a.userData!==void 0&&(h.userData=a.userData),r[a.uuid]=h}return r}parseObject(e,t,i,r,s){let o;function a(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){const f=[];for(let A=0,g=d.length;A<g;A++){const m=d[A];i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),f.push(i[m])}return f}return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),i[d]}}function c(d){return r[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),r[d]}let h,u;switch(e.type){case"Scene":o=new Qv,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new De(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new uh(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new hh(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new Yt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Bh(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new _y(e.color,e.intensity);break;case"DirectionalLight":o=new wy(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new Cy(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new My(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new by(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new xy(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Iy().fromJSON(e);break;case"SkinnedMesh":h=a(e.geometry),u=l(e.material),o=new Vv(h,u),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":h=a(e.geometry),u=l(e.material),o=new kt(h,u);break;case"InstancedMesh":h=a(e.geometry),u=l(e.material);const d=e.count,f=e.instanceMatrix,A=e.instanceColor;o=new Wv(h,u,d),o.instanceMatrix=new ks(new Float32Array(f.array),16),A!==void 0&&(o.instanceColor=new ks(new Float32Array(A.array),A.itemSize));break;case"BatchedMesh":h=a(e.geometry),u=l(e.material),o=new qv(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,u),o.geometry=h,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(g=>{const m=new mn;m.min.fromArray(g.boxMin),m.max.fromArray(g.boxMax);const p=new sn;return p.radius=g.sphereRadius,p.center.fromArray(g.sphereCenter),{boxInitialized:g.boxInitialized,box:m,sphereInitialized:g.sphereInitialized,sphere:p}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new Hv;break;case"Line":o=new ir(a(e.geometry),l(e.material));break;case"LineLoop":o=new jv(a(e.geometry),l(e.material));break;case"LineSegments":o=new di(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new Xv(a(e.geometry),l(e.material));break;case"Sprite":o=new zv(l(e.material));break;case"Group":o=new Bs;break;case"Bone":o=new qf;break;default:o=new gt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let f=0;f<d.length;f++)o.add(this.parseObject(d[f],t,i,r,s))}if(e.animations!==void 0){const d=e.animations;for(let f=0;f<d.length;f++){const A=d[f];o.animations.push(s[A])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const d=e.levels;for(let f=0;f<d.length;f++){const A=d[f],g=o.getObjectByProperty("uuid",A.object);g!==void 0&&o.addLevel(g,A.distance,A.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const i=t.target,r=e.getObjectByProperty("uuid",i);r!==void 0?t.target=r:t.target=new gt}})}}const Ow={UVMapping:Zc,CubeReflectionMapping:Ui,CubeRefractionMapping:nr,EquirectangularReflectionMapping:Oo,EquirectangularRefractionMapping:ko,CubeUVReflectionMapping:Gs},jA={RepeatWrapping:No,ClampToEdgeWrapping:On,MirroredRepeatWrapping:Qo},XA={NearestFilter:Zt,NearestMipmapNearestFilter:Tf,NearestMipmapLinearFilter:Ss,LinearFilter:Ht,LinearMipmapNearestFilter:_o,LinearMipmapLinearFilter:oi};class kw extends _n{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=_i.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return _i.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),_i.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});_i.add(e,l),s.manager.itemStart(e)}}let tl;class cp{static getContext(){return tl===void 0&&(tl=new(window.AudioContext||window.webkitAudioContext)),tl}static setContext(e){tl=e}}class Nw extends _n{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Oi(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);cp.getContext().decodeAudioData(c,function(u){t(u)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const YA=new Ye,KA=new Ye,vr=new Ye;class Qw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Yt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Yt,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,vr.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(zr*t.fov*.5)/t.zoom;let a,l;KA.elements[12]=-r,YA.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,vr.elements[0]=2*t.near/(l-a),vr.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(vr),a=-o*t.aspect-s,l=o*t.aspect-s,vr.elements[0]=2*t.near/(l-a),vr.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(vr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(KA),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(YA)}}class Ry extends Yt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e,this.index=0}}class Ly{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=JA(),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=JA();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function JA(){return performance.now()}const yr=new F,ZA=new wn,Gw=new F,Er=new F;class zw extends gt{constructor(){super(),this.type="AudioListener",this.context=cp.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Ly}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(yr,ZA,Gw),Er.set(0,0,-1).applyQuaternion(ZA),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(yr.x,r),t.positionY.linearRampToValueAtTime(yr.y,r),t.positionZ.linearRampToValueAtTime(yr.z,r),t.forwardX.linearRampToValueAtTime(Er.x,r),t.forwardY.linearRampToValueAtTime(Er.y,r),t.forwardZ.linearRampToValueAtTime(Er.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(yr.x,yr.y,yr.z),t.setOrientation(Er.x,Er.y,Er.z,i.x,i.y,i.z)}}class Dy extends gt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(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 xr=new F,$A=new wn,Hw=new F,br=new F;class Vw extends Dy{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(xr,$A,Hw),br.set(0,0,1).applyQuaternion($A);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(xr.x,i),t.positionY.linearRampToValueAtTime(xr.y,i),t.positionZ.linearRampToValueAtTime(xr.z,i),t.orientationX.linearRampToValueAtTime(br.x,i),t.orientationY.linearRampToValueAtTime(br.y,i),t.orientationZ.linearRampToValueAtTime(br.z,i)}else t.setPosition(xr.x,xr.y,xr.z),t.setOrientation(br.x,br.y,br.z)}}class Ww{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class Py{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=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 i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){wn.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;wn.multiplyQuaternionsFlat(e,o,e,t,e,i),wn.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const hp="\\[\\]\\.:\\/",qw=new RegExp("["+hp+"]","g"),up="[^"+hp+"]",jw="[^"+hp.replace("\\.","")+"]",Xw=/((?:WC+[\/:])*)/.source.replace("WC",up),Yw=/(WCOD+)?/.source.replace("WCOD",jw),Kw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",up),Jw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",up),Zw=new RegExp("^"+Xw+Yw+Kw+Jw+"$"),$w=["material","materials","bones","map"];class e_{constructor(e,t,i){const r=i||At.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class At{constructor(e,t,i){this.path=t,this.parsedPath=i||At.parseTrackName(t),this.node=At.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new At.Composite(e,t,i):new At(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(qw,"")}static parseTrackName(e){const t=Zw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);$w.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=i(a.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_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 i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=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,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=At.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[r];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}At.Composite=e_;At.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};At.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};At.prototype.GetterByBindingType=[At.prototype._getValue_direct,At.prototype._getValue_array,At.prototype._getValue_arrayElement,At.prototype._getValue_toArray];At.prototype.SetterByBindingTypeAndVersioning=[[At.prototype._setValue_direct,At.prototype._setValue_direct_setNeedsUpdate,At.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[At.prototype._setValue_array,At.prototype._setValue_array_setNeedsUpdate,At.prototype._setValue_array_setMatrixWorldNeedsUpdate],[At.prototype._setValue_arrayElement,At.prototype._setValue_arrayElement_setNeedsUpdate,At.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[At.prototype._setValue_fromArray,At.prototype._setValue_fromArray_setNeedsUpdate,At.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class t_{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Rn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;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,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const d=arguments[h],f=d.uuid;let A=t[f];if(A===void 0){A=l++,t[f]=A,e.push(d);for(let g=0,m=o;g!==m;++g)s[g].push(new At(d,i[g],r[g]))}else if(A<c){a=e[A];const g=--c,m=e[g];t[m.uuid]=A,e[A]=m,t[f]=g,e[g]=d;for(let p=0,v=o;p!==v;++p){const y=s[p],b=y[g];let w=y[A];y[A]=b,w===void 0&&(w=new At(d,i[p],r[p])),y[g]=w}}else e[A]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,h=t[c];if(h!==void 0&&h>=s){const u=s++,d=e[u];t[d.uuid]=h,e[h]=d,t[c]=u,e[u]=l;for(let f=0,A=r;f!==A;++f){const g=i[f],m=g[u],p=g[h];g[h]=m,g[u]=p}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],h=c.uuid,u=t[h];if(u!==void 0)if(delete t[h],u<s){const d=--s,f=e[d],A=--o,g=e[A];t[f.uuid]=u,e[u]=f,t[g.uuid]=d,e[d]=g,e.pop();for(let m=0,p=r;m!==p;++m){const v=i[m],y=v[d],b=v[A];v[u]=y,v[d]=b,v.pop()}}else{const d=--o,f=e[d];d>0&&(t[f.uuid]=u),e[u]=f,e.pop();for(let A=0,g=r;A!==g;++A){const m=i[A];m[u]=m[d],m.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,u=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(u);for(let d=h,f=l.length;d!==f;++d){const A=l[d];u[d]=new At(A,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class Uy{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Or,endingEnd:Or};for(let c=0;c!==o;++c){const h=s[c].createInterpolant(null);a[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ev,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Qf:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulateAdditive(a);break;case sh:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===xv;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===yv){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=kr,r.endingEnd=kr):(e?r.endingStart=this.zeroSlopeAtStart?kr:Or:r.endingStart=zo,t?r.endingEnd=this.zeroSlopeAtEnd?kr:Or:r.endingEnd=zo)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const n_=new Float32Array(1);class i_ extends ui{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){const d=r[u],f=d.name;let A=h[f];if(A!==void 0)++A.referenceCount,o[u]=A;else{if(A=o[u],A!==void 0){A._cacheIndex===null&&(++A.referenceCount,this._addInactiveBinding(A,l,f));continue}const g=t&&t._propertyBindings[u].binding.parsedPath;A=new Py(At.create(i,f,g),d.ValueTypeName,d.getValueSize()),++A.referenceCount,this._addInactiveBinding(A,l,f),o[u]=A}a[u].resultBuffer=A.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),e._byClipCacheIndex=null;const u=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new sp(new Float32Array(2),new Float32Array(2),1,n_),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?$o.findByName(r,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(i===void 0&&(o!==null?i=o.blendMode:i=sh),l!==void 0){const u=l.actionByRoot[s];if(u!==void 0&&u.blendMode===i)return u;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const h=new Uy(this,o,t,i);return this._bindAction(h,c),this._addInactiveAction(h,a,s),h}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?$o.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const h=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class r_ extends oh{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isRenderTarget3D=!0,this.depth=i,this.texture=new ah(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class s_ extends oh{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isRenderTargetArray=!0,this.depth=i,this.texture=new la(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class dp{constructor(e){this.value=e}clone(){return new dp(this.value.clone===void 0?this.value:this.value.clone())}}let o_=0;class a_ extends ui{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:o_++}),this.name="",this.usage=Vo,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class l_ extends dh{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class c_{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const em=new Ye;class h_{constructor(e,t,i=0,r=1/0){this.ray=new Hs(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new lh,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return em.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(em),this}intersectObject(e,t=!0,i=[]){return Hd(e,this,i,t),i.sort(tm),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)Hd(e[r],this,i,t);return i.sort(tm),i}}function tm(n,e){return n.distance-e.distance}function Hd(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){const s=n.children;for(let o=0,a=s.length;o<a;o++)Hd(s[o],e,t,!0)}}class u_{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=tt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(tt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class d_{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,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,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}class fp{constructor(e,t,i,r){fp.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}}const nm=new fe;class f_{constructor(e=new fe(1/0,1/0),t=new fe(-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,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=nm.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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,nm).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const im=new F,nl=new F;class p_{constructor(e=new F,t=new F){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){im.subVectors(e,this.start),nl.subVectors(this.end,this.start);const i=nl.dot(nl);let s=nl.dot(im)/i;return t&&(s=tt(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const rm=new F;class A_ extends gt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new ot,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,h=a/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}i.setAttribute("position",new Qe(r,3));const s=new gn({fog:!1,toneMapped:!1});this.cone=new di(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),rm.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(rm),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Wi=new F,il=new Ye,xu=new Ye;class m_ extends di{constructor(e){const t=Fy(e),i=new ot,r=[],s=[],o=new De(0,0,1),a=new De(0,1,0);for(let c=0;c<t.length;c++){const h=t[c];h.parent&&h.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new Qe(r,3)),i.setAttribute("color",new Qe(s,3));const l=new gn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");xu.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(il.multiplyMatrices(xu,a.matrixWorld),Wi.setFromMatrixPosition(il),r.setXYZ(o,Wi.x,Wi.y,Wi.z),il.multiplyMatrices(xu,a.parent.matrixWorld),Wi.setFromMatrixPosition(il),r.setXYZ(o+1,Wi.x,Wi.y,Wi.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Fy(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,Fy(n.children[t]));return e}class g_ extends kt{constructor(e,t,i){const r=new fa(t,4,2),s=new ar({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const v_=new F,sm=new De,om=new De;class y_ extends gt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new da(t);r.rotateY(Math.PI*.5),this.material=new ar({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new wt(o,3)),this.add(new kt(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");sm.copy(this.light.color),om.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?sm:om;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(v_.setFromMatrixPosition(this.light.matrixWorld).negate())}}class E_ extends di{constructor(e=10,t=10,i=4473924,r=8947848){i=new De(i),r=new De(r);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let d=0,f=0,A=-a;d<=t;d++,A+=o){l.push(-a,0,A,a,0,A),l.push(A,0,-a,A,0,a);const g=d===s?i:r;g.toArray(c,f),f+=3,g.toArray(c,f),f+=3,g.toArray(c,f),f+=3,g.toArray(c,f),f+=3}const h=new ot;h.setAttribute("position",new Qe(l,3)),h.setAttribute("color",new Qe(c,3));const u=new gn({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class x_ extends di{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new De(s),o=new De(o);const a=[],l=[];if(t>1)for(let u=0;u<t;u++){const d=u/t*(Math.PI*2),f=Math.sin(d)*e,A=Math.cos(d)*e;a.push(0,0,0),a.push(f,0,A);const g=u&1?s:o;l.push(g.r,g.g,g.b),l.push(g.r,g.g,g.b)}for(let u=0;u<i;u++){const d=u&1?s:o,f=e-e/i*u;for(let A=0;A<r;A++){let g=A/r*(Math.PI*2),m=Math.sin(g)*f,p=Math.cos(g)*f;a.push(m,0,p),l.push(d.r,d.g,d.b),g=(A+1)/r*(Math.PI*2),m=Math.sin(g)*f,p=Math.cos(g)*f,a.push(m,0,p),l.push(d.r,d.g,d.b)}}const c=new ot;c.setAttribute("position",new Qe(a,3)),c.setAttribute("color",new Qe(l,3));const h=new gn({vertexColors:!0,toneMapped:!1});super(c,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const am=new F,rl=new F,lm=new F;class b_ extends gt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new ot;r.setAttribute("position",new Qe([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new gn({fog:!1,toneMapped:!1});this.lightPlane=new ir(r,s),this.add(this.lightPlane),r=new ot,r.setAttribute("position",new Qe([0,0,0,0,0,1],3)),this.targetLine=new ir(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),am.setFromMatrixPosition(this.light.matrixWorld),rl.setFromMatrixPosition(this.light.target.matrixWorld),lm.subVectors(rl,am),this.lightPlane.lookAt(rl),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(rl),this.targetLine.scale.z=lm.length()}}const sl=new F,Bt=new ch;class C_ extends di{constructor(e){const t=new ot,i=new gn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(A,g){l(A),l(g)}function l(A){r.push(0,0,0),s.push(0,0,0),o[A]===void 0&&(o[A]=[]),o[A].push(r.length/3-1)}t.setAttribute("position",new Qe(r,3)),t.setAttribute("color",new Qe(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const c=new De(16755200),h=new De(16711680),u=new De(43775),d=new De(16777215),f=new De(3355443);this.setColors(c,h,u,d,f)}setColors(e,t,i,r,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;Bt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const s=this.camera.coordinateSystem===Kn?-1:0;Lt("c",t,e,Bt,0,0,s),Lt("t",t,e,Bt,0,0,1),Lt("n1",t,e,Bt,-1,-1,s),Lt("n2",t,e,Bt,i,-1,s),Lt("n3",t,e,Bt,-1,r,s),Lt("n4",t,e,Bt,i,r,s),Lt("f1",t,e,Bt,-1,-1,1),Lt("f2",t,e,Bt,i,-1,1),Lt("f3",t,e,Bt,-1,r,1),Lt("f4",t,e,Bt,i,r,1),Lt("u1",t,e,Bt,i*.7,r*1.1,s),Lt("u2",t,e,Bt,-1*.7,r*1.1,s),Lt("u3",t,e,Bt,0,r*2,s),Lt("cf1",t,e,Bt,-1,0,1),Lt("cf2",t,e,Bt,i,0,1),Lt("cf3",t,e,Bt,0,-1,1),Lt("cf4",t,e,Bt,0,r,1),Lt("cn1",t,e,Bt,-1,0,s),Lt("cn2",t,e,Bt,i,0,s),Lt("cn3",t,e,Bt,0,-1,s),Lt("cn4",t,e,Bt,0,r,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Lt(n,e,t,i,r,s,o){sl.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,h=a.length;c<h;c++)l.setXYZ(a[c],sl.x,sl.y,sl.z)}}const ol=new mn;class w_ extends di{constructor(e,t=16776960){const i=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]),r=new Float32Array(8*3),s=new ot;s.setIndex(new wt(i,1)),s.setAttribute("position",new wt(r,3)),super(s,new gn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&ol.setFromObject(this.object),ol.isEmpty())return;const t=ol.min,i=ol.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class __ extends di{constructor(e,t=16776960){const i=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]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new ot;s.setIndex(new wt(i,1)),s.setAttribute("position",new Qe(r,3)),super(s,new gn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class M_ extends ir{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new ot;o.setAttribute("position",new Qe(s,3)),o.computeBoundingSphere(),super(o,new gn({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new ot;l.setAttribute("position",new Qe(a,3)),l.computeBoundingSphere(),this.add(new kt(l,new ar({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const cm=new F;let al,bu;class S_ extends gt{constructor(e=new F(0,0,1),t=new F(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",al===void 0&&(al=new ot,al.setAttribute("position",new Qe([0,0,0,0,1,0],3)),bu=new Vs(0,.5,1,5,1),bu.translate(0,-.5,0)),this.position.copy(t),this.line=new ir(al,new gn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(bu,new ar({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{cm.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(cm,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class I_ extends di{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new ot;r.setAttribute("position",new Qe(t,3)),r.setAttribute("color",new Qe(i,3));const s=new gn({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new De,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class B_{constructor(){this.type="ShapePath",this.color=new De,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new jo,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(p){const v=[];for(let y=0,b=p.length;y<b;y++){const w=p[y],M=new Hr;M.curves=w.curves,v.push(M)}return v}function i(p,v){const y=v.length;let b=!1;for(let w=y-1,M=0;M<y;w=M++){let S=v[w],R=v[M],_=R.x-S.x,I=R.y-S.y;if(Math.abs(I)>Number.EPSILON){if(I<0&&(S=v[M],_=-_,R=v[w],I=-I),p.y<S.y||p.y>R.y)continue;if(p.y===S.y){if(p.x===S.x)return!0}else{const D=I*(p.x-S.x)-_*(p.y-S.y);if(D===0)return!0;if(D<0)continue;b=!b}}else{if(p.y!==S.y)continue;if(R.x<=p.x&&p.x<=S.x||S.x<=p.x&&p.x<=R.x)return!0}}return b}const r=ci.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Hr,l.curves=a.curves,c.push(l),c;let h=!r(s[0].getPoints());h=e?!h:h;const u=[],d=[];let f=[],A=0,g;d[A]=void 0,f[A]=[];for(let p=0,v=s.length;p<v;p++)a=s[p],g=a.getPoints(),o=r(g),o=e?!o:o,o?(!h&&d[A]&&A++,d[A]={s:new Hr,p:g},d[A].s.curves=a.curves,h&&A++,f[A]=[]):f[A].push({h:a,p:g[0]});if(!d[0])return t(s);if(d.length>1){let p=!1,v=0;for(let y=0,b=d.length;y<b;y++)u[y]=[];for(let y=0,b=d.length;y<b;y++){const w=f[y];for(let M=0;M<w.length;M++){const S=w[M];let R=!0;for(let _=0;_<d.length;_++)i(S.p,d[_].p)&&(y!==_&&v++,R?(R=!1,u[_].push(S)):p=!0);R&&u[y].push(S)}}v>0&&p===!1&&(f=u)}let m;for(let p=0,v=d.length;p<v;p++){l=d[p].s,c.push(l),m=f[p];for(let y=0,b=m.length;y<b;y++)l.holes.push(m[y].h)}return c}}class T_ extends ui{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}function R_(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function L_(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function D_(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function Vd(n,e,t,i){const r=P_(i);switch(t){case Pf:return n*e;case Ff:return n*e;case Of:return n*e*2;case nh:return n*e/r.components*r.byteLength;case aa:return n*e/r.components*r.byteLength;case kf:return n*e*2/r.components*r.byteLength;case ih:return n*e*2/r.components*r.byteLength;case Uf:return n*e*3/r.components*r.byteLength;case pn:return n*e*4/r.components*r.byteLength;case rh:return n*e*4/r.components*r.byteLength;case Mo:case So:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Io:case Bo:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case oc:case lc:return Math.max(n,16)*Math.max(e,8)/4;case sc:case ac:return Math.max(n,8)*Math.max(e,8)/2;case cc:case hc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case uc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case dc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case fc:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case pc:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Ac:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case mc:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case gc:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case vc:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case yc:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Ec:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case xc:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case bc:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Cc:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case wc:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case _c:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case To:case Mc:case Sc:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Nf:case Ic:return Math.ceil(n/4)*Math.ceil(e/4)*8;case Bc:case Tc:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function P_(n){switch(n){case hi:case Rf:return{byteLength:1,components:1};case Us:case Lf:case zs:return{byteLength:2,components:1};case eh:case th:return{byteLength:2,components:4};case Fi:case $c:case un:return{byteLength:4,components:1};case Df:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}const U_={contain:R_,cover:L_,fill:D_,getByteLength:Vd};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Jc}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Jc);/**
* @license
* Copyright 2010-2025 Three.js Authors
* SPDX-License-Identifier: MIT
*/function Oy(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function F_(n){const e=new WeakMap;function t(a,l){const c=a.array,h=a.usage,u=c.byteLength,d=n.createBuffer();n.bindBuffer(l,d),n.bufferData(l,c,h),a.onUploadCallback();let f;if(c instanceof Float32Array)f=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?f=n.HALF_FLOAT:f=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=n.SHORT;else if(c instanceof Uint32Array)f=n.UNSIGNED_INT;else if(c instanceof Int32Array)f=n.INT;else if(c instanceof Int8Array)f=n.BYTE;else if(c instanceof Uint8Array)f=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:u}}function i(a,l,c){const h=l.array,u=l.updateRanges;if(n.bindBuffer(c,a),u.length===0)n.bufferSubData(c,0,h);else{u.sort((f,A)=>f.start-A.start);let d=0;for(let f=1;f<u.length;f++){const A=u[d],g=u[f];g.start<=A.start+A.count+1?A.count=Math.max(A.count,g.start+g.count-A.start):(++d,u[d]=g)}u.length=d+1;for(let f=0,A=u.length;f<A;f++){const g=u[f];n.bufferSubData(c,g.start*h.BYTES_PER_ELEMENT,h,g.start,g.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(n.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const h=e.get(a);(!h||h.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var O_=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,k_=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
}
float hash3D( vec3 value ) {
return hash2D( vec2( hash2D( value.xy ), value.z ) );
}
float getAlphaHashThreshold( vec3 position ) {
float maxDeriv = max(
length( dFdx( position.xyz ) ),
length( dFdy( position.xyz ) )
);
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
vec2 pixScales = vec2(
exp2( floor( log2( pixScale ) ) ),
exp2( ceil( log2( pixScale ) ) )
);
vec2 alpha = vec2(
hash3D( floor( pixScales.x * position.xyz ) ),
hash3D( floor( pixScales.y * position.xyz ) )
);
float lerpFactor = fract( log2( pixScale ) );
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
float a = min( lerpFactor, 1.0 - lerpFactor );
vec3 cases = vec3(
x * x / ( 2.0 * a * ( 1.0 - a ) ),
( x - 0.5 * a ) / ( 1.0 - a ),
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
);
float threshold = ( x < ( 1.0 - a ) )
? ( ( x < a ) ? cases.x : cases.y )
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
#endif`,N_=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,Q_=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,G_=`#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
#endif`,z_=`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,H_=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
clearcoatSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_SHEEN )
sheenSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
#endif`,V_=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,W_=`#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
#endif
uniform highp sampler2D batchingTexture;
uniform highp usampler2D batchingIdTexture;
mat4 getBatchingMatrix( const in float i ) {
int size = textureSize( batchingTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
float getIndirectIndex( const in int i ) {
int size = textureSize( batchingIdTexture, 0 ).x;
int x = i % size;
int y = i / size;
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
}
#endif
#ifdef USE_BATCHING_COLOR
uniform sampler2D batchingColorTexture;
vec3 getBatchingColor( const in float i ) {
int size = textureSize( batchingColorTexture, 0 ).x;
int j = int( i );
int x = j % size;
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
}
#endif`,q_=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,j_=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
#endif`,X_=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,Y_=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
} // validated`,K_=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
-0.4985314, 0.0415560, 1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt( fresnel0 );
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0e-9;
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
xyz /= 1.0685e-7;
vec3 rgb = XYZ_TO_REC709 * xyz;
return rgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
vec3 I;
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
float cosTheta2Sq = 1.0 - sinTheta2Sq;
if ( cosTheta2Sq < 0.0 ) {
return vec3( 1.0 );
}
float cosTheta2 = sqrt( cosTheta2Sq );
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
float T121 = 1.0 - R12;
float phi12 = 0.0;
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
float phi21 = PI - phi12;
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
vec3 phi23 = vec3( 0.0 );
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
vec3 phi = vec3( phi21 ) + phi23;
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
vec3 r123 = sqrt( R123 );
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
vec3 C0 = R12 + Rs;
I = C0;
vec3 Cm = Rs - T121;
for ( int m = 1; m <= 2; ++ m ) {
Cm *= r123;
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
I += Cm * Sm;
}
return max( I, vec3( 0.0 ) );
}
#endif`,J_=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vBumpMapUv );
vec2 dSTdy = dFdy( vBumpMapUv );
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
#endif`,Z_=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
float clipOpacity = 1.0;
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
distanceGradient = fwidth( distanceToPlane ) / 2.0;
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
if ( clipOpacity == 0.0 ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
float unionClipOpacity = 1.0;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
distanceGradient = fwidth( distanceToPlane ) / 2.0;
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
}
#pragma unroll_loop_end
clipOpacity *= 1.0 - unionClipOpacity;
#endif
diffuseColor.a *= clipOpacity;
if ( diffuseColor.a == 0.0 ) discard;
#else
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
}
#pragma unroll_loop_end
if ( clipped ) discard;
#endif
#endif
#endif`,$_=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,eM=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,tM=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,nM=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,iM=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,rM=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec3 vColor;
#endif`,sM=`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
vColor.xyz *= batchingColor.xyz;
#endif`,oM=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
mat3 tmp;
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
return tmp;
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,aM=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
vec3 absDirection = abs( direction );
float face = - 1.0;
if ( absDirection.x > absDirection.z ) {
if ( absDirection.x > absDirection.y )
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if ( absDirection.z > absDirection.y )
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV( vec3 direction, float face ) {
vec2 uv;
if ( face == 0.0 ) {
uv = vec2( direction.z, direction.y ) / abs( direction.x );
} else if ( face == 1.0 ) {
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
} else if ( face == 2.0 ) {
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
} else if ( face == 3.0 ) {
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
} else if ( face == 4.0 ) {
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
} else {
uv = vec2( direction.x, direction.y ) / abs( direction.z );
}
return 0.5 * ( uv + 1.0 );
}
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
float face = getFace( direction );
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
mipInt = max( mipInt, cubeUV_minMipLevel );
float faceSize = exp2( mipInt );
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
if ( face > 2.0 ) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
uv.x *= CUBEUV_TEXEL_WIDTH;
uv.y *= CUBEUV_TEXEL_HEIGHT;
#ifdef texture2DGradEXT
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
#else
return texture2D( envMap, uv ).rgb;
#endif
}
#define cubeUV_r0 1.0
#define cubeUV_m0 - 2.0
#define cubeUV_r1 0.8
#define cubeUV_m1 - 1.0
#define cubeUV_r4 0.4
#define cubeUV_m4 2.0
#define cubeUV_r5 0.305
#define cubeUV_m5 3.0
#define cubeUV_r6 0.21
#define cubeUV_m6 4.0
float roughnessToMip( float roughness ) {
float mip = 0.0;
if ( roughness >= cubeUV_r1 ) {
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
} else if ( roughness >= cubeUV_r4 ) {
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
} else if ( roughness >= cubeUV_r5 ) {
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
} else if ( roughness >= cubeUV_r6 ) {
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
} else {
mip = - 2.0 * log2( 1.16 * roughness ); }
return mip;
}
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
float mipF = fract( mip );
float mipInt = floor( mip );
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
if ( mipF == 0.0 ) {
return vec4( color0, 1.0 );
} else {
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
#endif`,lM=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
mat3 bm = mat3( batchingMatrix );
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
transformedNormal = bm * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = bm * transformedTangent;
#endif
#endif
#ifdef USE_INSTANCING
mat3 im = mat3( instanceMatrix );
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
transformedNormal = im * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = im * transformedTangent;
#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
#endif`,cM=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,hM=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,uM=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,dM=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,fM="gl_FragColor = linearToOutputTexel( gl_FragColor );",pM=`vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,AM=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif`,mM=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform mat3 envMapRotation;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,gM=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
#endif`,vM=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
#endif`,yM=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
#endif`,EM=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,xM=`#ifdef USE_FOG
varying float vFogDepth;
#endif`,bM=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,CM=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,wM=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return vec3( texture2D( gradientMap, coord ).r );
#else
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
}`,_M=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,MM=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,SM=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
};
void 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 ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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 ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,IM=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
light.color = directionalLight.color;
light.direction = directionalLight.direction;
light.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = pointLight.position - geometryPosition;
light.direction = normalize( lVector );
float lightDistance = length( lVector );
light.color = pointLight.color;
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = spotLight.position - geometryPosition;
light.direction = normalize( lVector );
float angleCos = dot( light.direction, spotLight.direction );
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
if ( spotAttenuation > 0.0 ) {
float lightDistance = length( lVector );
light.color = spotLight.color * spotAttenuation;
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
} else {
light.color = vec3( 0.0 );
light.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
float dotNL = dot( normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
#endif`,BM=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
return PI * envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 reflectVec = reflect( - viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
return envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
#ifdef USE_ANISOTROPY
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 bentNormal = cross( bitangent, viewDir );
bentNormal = normalize( cross( bentNormal, bitangent ) );
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
return getIBLRadiance( viewDir, bentNormal, roughness );
#else
return vec3( 0.0 );
#endif
}
#endif
#endif`,TM=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,RM=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
void 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 ) {
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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 ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,LM=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,DM=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void 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 ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void 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 ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,PM=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
material.ior = ior;
#ifdef USE_SPECULAR
float specularIntensityFactor = specularIntensity;
vec3 specularColorFactor = specularColor;
#ifdef USE_SPECULAR_COLORMAP
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
#endif
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
#else
float specularIntensityFactor = 1.0;
vec3 specularColorFactor = vec3( 1.0 );
material.specularF90 = 1.0;
#endif
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
material.clearcoat = clearcoat;
material.clearcoatRoughness = clearcoatRoughness;
material.clearcoatF0 = vec3( 0.04 );
material.clearcoatF90 = 1.0;
#ifdef USE_CLEARCOATMAP
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
#endif
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
material.iridescence = iridescence;
material.iridescenceIOR = iridescenceIOR;
#ifdef USE_IRIDESCENCEMAP
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
#else
material.iridescenceThickness = iridescenceThicknessMaximum;
#endif
#endif
#ifdef USE_SHEEN
material.sheenColor = sheenColor;
#ifdef USE_SHEEN_COLORMAP
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
#endif
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
#ifdef USE_SHEEN_ROUGHNESSMAP
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
#endif
#endif
#ifdef USE_ANISOTROPY
#ifdef USE_ANISOTROPYMAP
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
#else
vec2 anisotropyV = anisotropyVector;
#endif
material.anisotropy = length( anisotropyV );
if( material.anisotropy == 0.0 ) {
anisotropyV = vec2( 1.0, 0.0 );
} else {
anisotropyV /= material.anisotropy;
material.anisotropy = saturate( material.anisotropy );
}
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,UM=`struct PhysicalMaterial {
vec3 diffuseColor;
float roughness;
vec3 specularColor;
float specularF90;
float dispersion;
#ifdef USE_CLEARCOAT
float clearcoat;
float clearcoatRoughness;
vec3 clearcoatF0;
float clearcoatF90;
#endif
#ifdef USE_IRIDESCENCE
float iridescence;
float iridescenceIOR;
float iridescenceThickness;
vec3 iridescenceFresnel;
vec3 iridescenceF0;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
float sheenRoughness;
#endif
#ifdef IOR
float ior;
#endif
#ifdef USE_TRANSMISSION
float transmission;
float transmissionAlpha;
float thickness;
float attenuationDistance;
vec3 attenuationColor;
#endif
#ifdef USE_ANISOTROPY
float anisotropy;
float alphaT;
vec3 anisotropyT;
vec3 anisotropyB;
#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
float x2 = x * x;
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
float v = 0.5 / ( gv + gl );
return saturate(v);
}
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
float a2 = alphaT * alphaB;
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
highp float v2 = dot( v, v );
float w2 = a2 / v2;
return RECIPROCAL_PI * a2 * pow2 ( w2 );
}
#endif
#ifdef USE_CLEARCOAT
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
vec3 f0 = material.clearcoatF0;
float f90 = material.clearcoatF90;
float roughness = material.clearcoatRoughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( V * D );
}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 f0 = material.specularColor;
float f90 = material.specularF90;
float roughness = material.roughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
#ifdef USE_IRIDESCENCE
F = mix( F, material.iridescenceFresnel, material.iridescence );
#endif
#ifdef USE_ANISOTROPY
float dotTL = dot( material.anisotropyT, lightDir );
float dotTV = dot( material.anisotropyT, viewDir );
float dotTH = dot( material.anisotropyT, halfDir );
float dotBL = dot( material.anisotropyB, lightDir );
float dotBV = dot( material.anisotropyB, viewDir );
float dotBH = dot( material.anisotropyB, halfDir );
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
#else
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
#endif
return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
float alpha = pow2( roughness );
float invAlpha = 1.0 / alpha;
float cos2h = dotNH * dotNH;
float sin2h = max( 1.0 - cos2h, 0.0078125 );
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float D = D_Charlie( sheenRoughness, dotNH );
float V = V_Neubelt( dotNV, dotNL );
return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
float r2 = roughness * roughness;
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
vec4 r = roughness * c0 + c1;
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
vec2 fab = DFGApprox( normal, viewDir, roughness );
return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void 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 ) {
#else
void 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 ) {
#endif
vec2 fab = DFGApprox( normal, viewDir, roughness );
#ifdef USE_IRIDESCENCE
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
#else
vec3 Fr = specularColor;
#endif
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
float Ess = fab.x + fab.y;
float Ems = 1.0 - Ess;
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometryNormal;
vec3 viewDir = geometryViewDir;
vec3 position = geometryPosition;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.roughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void 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 ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifdef USE_CLEARCOAT
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = dotNLcc * directLight.color;
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
#endif
#ifdef USE_SHEEN
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
#endif
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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 ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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) {
#ifdef USE_CLEARCOAT
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
#endif
#ifdef USE_SHEEN
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
#endif
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
#ifdef USE_IRIDESCENCE
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
#else
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
#endif
vec3 totalScattering = singleScattering + multiScattering;
vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
reflectedLight.indirectSpecular += radiance * singleScattering;
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,FM=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometryViewDir ) );
if ( material.iridescenceThickness == 0.0 ) {
material.iridescence = 0.0;
} else {
material.iridescence = saturate( material.iridescence );
}
if ( material.iridescence > 0.0 ) {
material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointLightInfo( pointLight, geometryPosition, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
vec4 spotColor;
vec3 spotLightCoord;
bool inSpotLightMap;
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotLightInfo( spotLight, geometryPosition, directLight );
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
#else
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#endif
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
#endif
#undef SPOT_LIGHT_MAP_INDEX
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
#if defined( USE_LIGHT_PROBES )
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
#endif
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,OM=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getIBLIrradiance( geometryNormal );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
#ifdef USE_ANISOTROPY
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
#else
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
#endif
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
#endif`,kM=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,NM=`#if defined( USE_LOGDEPTHBUF )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,QM=`#if defined( USE_LOGDEPTHBUF )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,GM=`#ifdef USE_LOGDEPTHBUF
varying float vFragDepth;
varying float vIsPerspective;
#endif`,zM=`#ifdef USE_LOGDEPTHBUF
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,HM=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
#endif`,VM=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,WM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#endif
#ifdef USE_MAP
diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,qM=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,jM=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
#endif`,XM=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,YM=`#ifdef USE_INSTANCING_MORPH
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
}
#endif`,KM=`#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
#elif defined( USE_COLOR )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
#endif`,JM=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
#endif`,ZM=`#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
#endif
uniform sampler2DArray morphTargetsTexture;
uniform ivec2 morphTargetsTextureSize;
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
int y = texelIndex / morphTargetsTextureSize.x;
int x = texelIndex - y * morphTargetsTextureSize.x;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
#endif`,$M=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
#endif`,e2=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal *= faceDirection;
#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
#ifdef USE_TANGENT
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn = getTangentFrame( - vViewPosition, normal,
#if defined( USE_NORMALMAP )
vNormalMapUv
#elif defined( USE_CLEARCOAT_NORMALMAP )
vClearcoatNormalMapUv
#else
vUv
#endif
);
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn[0] *= faceDirection;
tbn[1] *= faceDirection;
#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
#ifdef USE_TANGENT
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn2[0] *= faceDirection;
tbn2[1] *= faceDirection;
#endif
#endif
vec3 nonPerturbedNormal = normal;`,t2=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,n2=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,i2=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,r2=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif`,s2=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
vec3 q0 = dFdx( eye_pos.xyz );
vec3 q1 = dFdy( eye_pos.xyz );
vec2 st0 = dFdx( uv.st );
vec2 st1 = dFdy( uv.st );
vec3 N = surf_norm;
vec3 q1perp = cross( q1, N );
vec3 q0perp = cross( N, q0 );
vec3 T = q1perp * st0.x + q0perp * st1.x;
vec3 B = q1perp * st0.y + q0perp * st1.y;
float det = max( dot( T, T ), dot( B, B ) );
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
#endif`,o2=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,a2=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,l2=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
#endif`,c2=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
#endif`,h2=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,u2=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
if( v <= 0.0 )
return vec4( 0., 0., 0., 0. );
if( v >= 1.0 )
return vec4( 1., 1., 1., 1. );
float vuf;
float af = modf( v * PackFactors.a, vuf );
float bf = modf( vuf * ShiftRight8, vuf );
float gf = modf( vuf * ShiftRight8, vuf );
return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
if( v <= 0.0 )
return vec3( 0., 0., 0. );
if( v >= 1.0 )
return vec3( 1., 1., 1. );
float vuf;
float bf = modf( v * PackFactors.b, vuf );
float gf = modf( vuf * ShiftRight8, vuf );
return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
if( v <= 0.0 )
return vec2( 0., 0. );
if( v >= 1.0 )
return vec2( 1., 1. );
float vuf;
float gf = modf( v * 256., vuf );
return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
}`,d2=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,f2=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,p2=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,A2=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
#endif`,m2=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
#endif`,g2=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,v2=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
struct SpotLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
}
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
return unpackRGBATo2Half( texture2D( shadow, uv ) );
}
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
float occlusion = 1.0;
vec2 distribution = texture2DDistribution( shadow, uv );
float hard_shadow = step( compare , distribution.x );
if (hard_shadow != 1.0 ) {
float distance = compare - distribution.x ;
float variance = max( 0.00000, distribution.y * distribution.y );
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
}
return occlusion;
}
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
#if defined( SHADOWMAP_TYPE_PCF )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx0 = - texelSize.x * shadowRadius;
float dy0 = - texelSize.y * shadowRadius;
float dx1 = + texelSize.x * shadowRadius;
float dy1 = + texelSize.y * shadowRadius;
float dx2 = dx0 / 2.0;
float dy2 = dy0 / 2.0;
float dx3 = dx1 / 2.0;
float dy3 = dy1 / 2.0;
shadow = (
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
) * ( 1.0 / 17.0 );
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx = texelSize.x;
float dy = texelSize.y;
vec2 uv = shadowCoord.xy;
vec2 f = fract( uv * shadowMapSize + 0.5 );
uv -= f * texelSize;
shadow = (
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
f.x ),
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
f.x ),
f.y )
) * ( 1.0 / 9.0 );
#elif defined( SHADOWMAP_TYPE_VSM )
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
#else
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
#endif
}
return mix( 1.0, shadow, shadowIntensity );
}
vec2 cubeToUV( vec3 v, float texelSizeY ) {
vec3 absV = abs( v );
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
absV *= scaleToCube;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
vec2 planar = v.xy;
float almostATexel = 1.5 * texelSizeY;
float almostOne = 1.0 - almostATexel;
if ( absV.z >= almostOne ) {
if ( v.z > 0.0 )
planar.x = 4.0 - v.x;
} else if ( absV.x >= almostOne ) {
float signX = sign( v.x );
planar.x = v.z * signX + 2.0 * signX;
} else if ( absV.y >= almostOne ) {
float signY = sign( v.y );
planar.x = v.x + 2.0 * signY + 2.0;
planar.y = v.z * signY - 2.0;
}
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
}
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
float shadow = 1.0;
vec3 lightToPosition = shadowCoord.xyz;
float lightToPositionLength = length( lightToPosition );
if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
vec3 bd3D = normalize( lightToPosition );
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
shadow = (
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
) * ( 1.0 / 9.0 );
#else
shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
#endif
}
return mix( 1.0, shadow, shadowIntensity );
}
#endif`,y2=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
struct SpotLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowIntensity;
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#endif`,E2=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
shadowWorldPosition = worldPosition;
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
#endif
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif`,x2=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLightShadows[ i ];
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLightShadows[ i ];
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLightShadows[ i ];
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
}`,b2=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,C2=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
mat4 getBoneMatrix( const in float i ) {
int size = textureSize( boneTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
#endif`,w2=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,_2=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
#endif`,M2=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,S2=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,I2=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,B2=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
const mat3 ACESInputMat = mat3(
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
vec3( 0.04823, 0.01566, 0.83777 )
);
const mat3 ACESOutputMat = mat3(
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
vec3( -0.07367, -0.00605, 1.07602 )
);
color *= toneMappingExposure / 0.6;
color = ACESInputMat * color;
color = RRTAndODTFit( color );
color = ACESOutputMat * color;
return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
vec3( 1.6605, - 0.1246, - 0.0182 ),
vec3( - 0.5876, 1.1329, - 0.1006 ),
vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
vec3( 0.6274, 0.0691, 0.0164 ),
vec3( 0.3293, 0.9195, 0.0880 ),
vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
vec3 x2 = x * x;
vec3 x4 = x2 * x2;
return + 15.5 * x4 * x2
- 40.14 * x4 * x
+ 31.96 * x4
- 6.868 * x2 * x
+ 0.4298 * x2
+ 0.1191 * x
- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
const mat3 AgXInsetMatrix = mat3(
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
);
const mat3 AgXOutsetMatrix = mat3(
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
);
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
color *= toneMappingExposure;
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
color = AgXInsetMatrix * color;
color = max( color, 1e-10 ); color = log2( color );
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
color = clamp( color, 0.0, 1.0 );
color = agxDefaultContrastApprox( color );
color = AgXOutsetMatrix * color;
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
color = clamp( color, 0.0, 1.0 );
return color;
}
vec3 NeutralToneMapping( vec3 color ) {
const float StartCompression = 0.8 - 0.04;
const float Desaturation = 0.15;
color *= toneMappingExposure;
float x = min( color.r, min( color.g, color.b ) );
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
color -= offset;
float peak = max( color.r, max( color.g, color.b ) );
if ( peak < StartCompression ) return color;
float d = 1. - StartCompression;
float newPeak = 1. - d * d / ( peak + d - StartCompression );
color *= newPeak / peak;
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,T2=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
material.attenuationDistance = attenuationDistance;
material.attenuationColor = attenuationColor;
#ifdef USE_TRANSMISSIONMAP
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
#endif
#ifdef USE_THICKNESSMAP
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
#endif
vec3 pos = vWorldPosition;
vec3 v = normalize( cameraPosition - pos );
vec3 n = inverseTransformDirection( normal, viewMatrix );
vec4 transmitted = getIBLVolumeRefraction(
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,R2=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
uniform vec3 attenuationColor;
#ifdef USE_TRANSMISSIONMAP
uniform sampler2D transmissionMap;
#endif
#ifdef USE_THICKNESSMAP
uniform sampler2D thicknessMap;
#endif
uniform vec2 transmissionSamplerSize;
uniform sampler2D transmissionSamplerMap;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
varying vec3 vWorldPosition;
float w0( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
}
float w1( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
}
float w2( float a ){
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
}
float w3( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * a );
}
float g0( float a ) {
return w0( a ) + w1( a );
}
float g1( float a ) {
return w2( a ) + w3( a );
}
float h0( float a ) {
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
}
float h1( float a ) {
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
}
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
uv = uv * texelSize.zw + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
float g0x = g0( fuv.x );
float g1x = g1( fuv.x );
float h0x = h0( fuv.x );
float h1x = h1( fuv.x );
float h0y = h0( fuv.y );
float h1y = h1( fuv.y );
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
}
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
vec2 fLodSizeInv = 1.0 / fLodSize;
vec2 cLodSizeInv = 1.0 / cLodSize;
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
return mix( fSample, cSample, fract( lod ) );
}
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
vec3 modelScale;
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
return normalize( refractionVector ) * thickness * modelScale;
}
float applyIorToRoughness( const in float roughness, const in float ior ) {
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
}
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
}
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
if ( isinf( attenuationDistance ) ) {
return vec3( 1.0 );
} else {
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
}
}
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
const in vec3 attenuationColor, const in float attenuationDistance ) {
vec4 transmittedLight;
vec3 transmittance;
#ifdef USE_DISPERSION
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
for ( int i = 0; i < 3; i ++ ) {
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
transmittedLight[ i ] = transmissionSample[ i ];
transmittedLight.a += transmissionSample.a;
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
}
transmittedLight.a /= 3.0;
#else
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
#endif
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
#endif`,L2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,D2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
uniform mat3 mapTransform;
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
uniform mat3 alphaMapTransform;
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
uniform mat3 lightMapTransform;
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
uniform mat3 aoMapTransform;
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
uniform mat3 bumpMapTransform;
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
uniform mat3 normalMapTransform;
varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
uniform mat3 displacementMapTransform;
varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
uniform mat3 emissiveMapTransform;
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
uniform mat3 metalnessMapTransform;
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
uniform mat3 roughnessMapTransform;
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
uniform mat3 anisotropyMapTransform;
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
uniform mat3 clearcoatMapTransform;
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform mat3 clearcoatNormalMapTransform;
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform mat3 clearcoatRoughnessMapTransform;
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
uniform mat3 sheenColorMapTransform;
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform mat3 sheenRoughnessMapTransform;
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
uniform mat3 iridescenceMapTransform;
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform mat3 iridescenceThicknessMapTransform;
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
uniform mat3 specularMapTransform;
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
uniform mat3 specularColorMapTransform;
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform mat3 specularIntensityMapTransform;
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
#endif`,P2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,U2=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
#endif
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
#endif`;const F2=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,O2=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
#ifdef DECODE_VIDEO_TEXTURE
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,k2=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,N2=`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
#else
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,Q2=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,G2=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
gl_FragColor = texColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,z2=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
}`,H2=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <logdepthbuf_fragment>
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( fragCoordZ );
#elif DEPTH_PACKING == 3202
gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
#elif DEPTH_PACKING == 3203
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
#endif
}`,V2=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
}`,W2=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
}`,q2=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,j2=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,X2=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,Y2=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,K2=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
}`,J2=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,Z2=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,$2=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_lambert_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,e1=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
}`,t1=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
#else
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,n1=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
}`,i1=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
}`,r1=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,s1=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,o1=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
}`,a1=`#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
uniform float ior;
#endif
#ifdef USE_SPECULAR
uniform float specularIntensity;
uniform vec3 specularColor;
#ifdef USE_SPECULAR_COLORMAP
uniform sampler2D specularColorMap;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform sampler2D specularIntensityMap;
#endif
#endif
#ifdef USE_CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
uniform float iridescence;
uniform float iridescenceIOR;
uniform float iridescenceThicknessMinimum;
uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
uniform vec3 sheenColor;
uniform float sheenRoughness;
#ifdef USE_SHEEN_COLORMAP
uniform sampler2D sheenColorMap;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform sampler2D sheenRoughnessMap;
#endif
#endif
#ifdef USE_ANISOTROPY
uniform vec2 anisotropyVector;
#ifdef USE_ANISOTROPYMAP
uniform sampler2D anisotropyMap;
#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
#ifdef USE_SHEEN
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
#endif
#ifdef USE_CLEARCOAT
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
#endif
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,l1=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,c1=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,h1=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
varying vec2 vUv;
uniform mat3 uvTransform;
#endif
void main() {
#ifdef USE_POINTS_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
}`,u1=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,d1=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,f1=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,p1=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix[ 3 ];
vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,A1=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,st={alphahash_fragment:O_,alphahash_pars_fragment:k_,alphamap_fragment:N_,alphamap_pars_fragment:Q_,alphatest_fragment:G_,alphatest_pars_fragment:z_,aomap_fragment:H_,aomap_pars_fragment:V_,batching_pars_vertex:W_,batching_vertex:q_,begin_vertex:j_,beginnormal_vertex:X_,bsdfs:Y_,iridescence_fragment:K_,bumpmap_pars_fragment:J_,clipping_planes_fragment:Z_,clipping_planes_pars_fragment:$_,clipping_planes_pars_vertex:eM,clipping_planes_vertex:tM,color_fragment:nM,color_pars_fragment:iM,color_pars_vertex:rM,color_vertex:sM,common:oM,cube_uv_reflection_fragment:aM,defaultnormal_vertex:lM,displacementmap_pars_vertex:cM,displacementmap_vertex:hM,emissivemap_fragment:uM,emissivemap_pars_fragment:dM,colorspace_fragment:fM,colorspace_pars_fragment:pM,envmap_fragment:AM,envmap_common_pars_fragment:mM,envmap_pars_fragment:gM,envmap_pars_vertex:vM,envmap_physical_pars_fragment:BM,envmap_vertex:yM,fog_vertex:EM,fog_pars_vertex:xM,fog_fragment:bM,fog_pars_fragment:CM,gradientmap_pars_fragment:wM,lightmap_pars_fragment:_M,lights_lambert_fragment:MM,lights_lambert_pars_fragment:SM,lights_pars_begin:IM,lights_toon_fragment:TM,lights_toon_pars_fragment:RM,lights_phong_fragment:LM,lights_phong_pars_fragment:DM,lights_physical_fragment:PM,lights_physical_pars_fragment:UM,lights_fragment_begin:FM,lights_fragment_maps:OM,lights_fragment_end:kM,logdepthbuf_fragment:NM,logdepthbuf_pars_fragment:QM,logdepthbuf_pars_vertex:GM,logdepthbuf_vertex:zM,map_fragment:HM,map_pars_fragment:VM,map_particle_fragment:WM,map_particle_pars_fragment:qM,metalnessmap_fragment:jM,metalnessmap_pars_fragment:XM,morphinstance_vertex:YM,morphcolor_vertex:KM,morphnormal_vertex:JM,morphtarget_pars_vertex:ZM,morphtarget_vertex:$M,normal_fragment_begin:e2,normal_fragment_maps:t2,normal_pars_fragment:n2,normal_pars_vertex:i2,normal_vertex:r2,normalmap_pars_fragment:s2,clearcoat_normal_fragment_begin:o2,clearcoat_normal_fragment_maps:a2,clearcoat_pars_fragment:l2,iridescence_pars_fragment:c2,opaque_fragment:h2,packing:u2,premultiplied_alpha_fragment:d2,project_vertex:f2,dithering_fragment:p2,dithering_pars_fragment:A2,roughnessmap_fragment:m2,roughnessmap_pars_fragment:g2,shadowmap_pars_fragment:v2,shadowmap_pars_vertex:y2,shadowmap_vertex:E2,shadowmask_pars_fragment:x2,skinbase_vertex:b2,skinning_pars_vertex:C2,skinning_vertex:w2,skinnormal_vertex:_2,specularmap_fragment:M2,specularmap_pars_fragment:S2,tonemapping_fragment:I2,tonemapping_pars_fragment:B2,transmission_fragment:T2,transmission_pars_fragment:R2,uv_pars_fragment:L2,uv_pars_vertex:D2,uv_vertex:P2,worldpos_vertex:U2,background_vert:F2,background_frag:O2,backgroundCube_vert:k2,backgroundCube_frag:N2,cube_vert:Q2,cube_frag:G2,depth_vert:z2,depth_frag:H2,distanceRGBA_vert:V2,distanceRGBA_frag:W2,equirect_vert:q2,equirect_frag:j2,linedashed_vert:X2,linedashed_frag:Y2,meshbasic_vert:K2,meshbasic_frag:J2,meshlambert_vert:Z2,meshlambert_frag:$2,meshmatcap_vert:e1,meshmatcap_frag:t1,meshnormal_vert:n1,meshnormal_frag:i1,meshphong_vert:r1,meshphong_frag:s1,meshphysical_vert:o1,meshphysical_frag:a1,meshtoon_vert:l1,meshtoon_frag:c1,points_vert:h1,points_frag:u1,shadow_vert:d1,shadow_frag:f1,sprite_vert:p1,sprite_frag:A1},_e={common:{diffuse:{value:new De(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new et},alphaMap:{value:null},alphaMapTransform:{value:new et},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new et}},envmap:{envMap:{value:null},envMapRotation:{value:new et},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new et}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new et}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new et},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new et},normalScale:{value:new fe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new et},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new et}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new et}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new et}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new De(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 De(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new et},alphaTest:{value:0},uvTransform:{value:new et}},sprite:{diffuse:{value:new De(16777215)},opacity:{value:1},center:{value:new fe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new et},alphaMap:{value:null},alphaMapTransform:{value:new et},alphaTest:{value:0}}},Xn={basic:{uniforms:cn([_e.common,_e.specularmap,_e.envmap,_e.aomap,_e.lightmap,_e.fog]),vertexShader:st.meshbasic_vert,fragmentShader:st.meshbasic_frag},lambert:{uniforms:cn([_e.common,_e.specularmap,_e.envmap,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.fog,_e.lights,{emissive:{value:new De(0)}}]),vertexShader:st.meshlambert_vert,fragmentShader:st.meshlambert_frag},phong:{uniforms:cn([_e.common,_e.specularmap,_e.envmap,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.fog,_e.lights,{emissive:{value:new De(0)},specular:{value:new De(1118481)},shininess:{value:30}}]),vertexShader:st.meshphong_vert,fragmentShader:st.meshphong_frag},standard:{uniforms:cn([_e.common,_e.envmap,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.roughnessmap,_e.metalnessmap,_e.fog,_e.lights,{emissive:{value:new De(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:st.meshphysical_vert,fragmentShader:st.meshphysical_frag},toon:{uniforms:cn([_e.common,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.gradientmap,_e.fog,_e.lights,{emissive:{value:new De(0)}}]),vertexShader:st.meshtoon_vert,fragmentShader:st.meshtoon_frag},matcap:{uniforms:cn([_e.common,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.fog,{matcap:{value:null}}]),vertexShader:st.meshmatcap_vert,fragmentShader:st.meshmatcap_frag},points:{uniforms:cn([_e.points,_e.fog]),vertexShader:st.points_vert,fragmentShader:st.points_frag},dashed:{uniforms:cn([_e.common,_e.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:st.linedashed_vert,fragmentShader:st.linedashed_frag},depth:{uniforms:cn([_e.common,_e.displacementmap]),vertexShader:st.depth_vert,fragmentShader:st.depth_frag},normal:{uniforms:cn([_e.common,_e.bumpmap,_e.normalmap,_e.displacementmap,{opacity:{value:1}}]),vertexShader:st.meshnormal_vert,fragmentShader:st.meshnormal_frag},sprite:{uniforms:cn([_e.sprite,_e.fog]),vertexShader:st.sprite_vert,fragmentShader:st.sprite_frag},background:{uniforms:{uvTransform:{value:new et},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:st.background_vert,fragmentShader:st.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new et}},vertexShader:st.backgroundCube_vert,fragmentShader:st.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:st.cube_vert,fragmentShader:st.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:st.equirect_vert,fragmentShader:st.equirect_frag},distanceRGBA:{uniforms:cn([_e.common,_e.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:st.distanceRGBA_vert,fragmentShader:st.distanceRGBA_frag},shadow:{uniforms:cn([_e.lights,_e.fog,{color:{value:new De(0)},opacity:{value:1}}]),vertexShader:st.shadow_vert,fragmentShader:st.shadow_frag}};Xn.physical={uniforms:cn([Xn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new et},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new et},clearcoatNormalScale:{value:new fe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new et},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new et},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new et},sheen:{value:0},sheenColor:{value:new De(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new et},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new et},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new et},transmissionSamplerSize:{value:new fe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new et},attenuationDistance:{value:0},attenuationColor:{value:new De(0)},specularColor:{value:new De(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new et},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new et},anisotropyVector:{value:new fe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new et}}]),vertexShader:st.meshphysical_vert,fragmentShader:st.meshphysical_frag};const ll={r:0,b:0,g:0},Cr=new Ln,m1=new Ye;function g1(n,e,t,i,r,s,o){const a=new De(0);let l=s===!0?0:1,c,h,u=null,d=0,f=null;function A(y){let b=y.isScene===!0?y.background:null;return b&&b.isTexture&&(b=(y.backgroundBlurriness>0?t:e).get(b)),b}function g(y){let b=!1;const w=A(y);w===null?p(a,l):w&&w.isColor&&(p(w,1),b=!0);const M=n.xr.getEnvironmentBlendMode();M==="additive"?i.buffers.color.setClear(0,0,0,1,o):M==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||b)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function m(y,b){const w=A(b);w&&(w.isCubeTexture||w.mapping===Gs)?(h===void 0&&(h=new kt(new Yr(1e4,1e4,1e4),new Zn({name:"BackgroundCubeMaterial",uniforms:Os(Xn.backgroundCube.uniforms),vertexShader:Xn.backgroundCube.vertexShader,fragmentShader:Xn.backgroundCube.fragmentShader,side:An,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(M,S,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Cr.copy(b.backgroundRotation),Cr.x*=-1,Cr.y*=-1,Cr.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Cr.y*=-1,Cr.z*=-1),h.material.uniforms.envMap.value=w,h.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(m1.makeRotationFromEuler(Cr)),h.material.toneMapped=ht.getTransfer(w.colorSpace)!==bt,(u!==w||d!==w.version||f!==n.toneMapping)&&(h.material.needsUpdate=!0,u=w,d=w.version,f=n.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null)):w&&w.isTexture&&(c===void 0&&(c=new kt(new Ws(2,2),new Zn({name:"BackgroundMaterial",uniforms:Os(Xn.background.uniforms),vertexShader:Xn.background.vertexShader,fragmentShader:Xn.background.fragmentShader,side:Pi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=w,c.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,c.material.toneMapped=ht.getTransfer(w.colorSpace)!==bt,w.matrixAutoUpdate===!0&&w.updateMatrix(),c.material.uniforms.uvTransform.value.copy(w.matrix),(u!==w||d!==w.version||f!==n.toneMapping)&&(c.material.needsUpdate=!0,u=w,d=w.version,f=n.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function p(y,b){y.getRGB(ll,Fv(n)),i.buffers.color.setClear(ll.r,ll.g,ll.b,b,o)}function v(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(y,b=1){a.set(y),l=b,p(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,p(a,l)},render:g,addToRenderList:m,dispose:v}}function v1(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=d(null);let s=r,o=!1;function a(I,D,Q,N,z){let $=!1;const H=u(N,Q,D);s!==H&&(s=H,c(s.object)),$=f(I,N,Q,z),$&&A(I,N,Q,z),z!==null&&e.update(z,n.ELEMENT_ARRAY_BUFFER),($||o)&&(o=!1,b(I,D,Q,N),z!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(z).buffer))}function l(){return n.createVertexArray()}function c(I){return n.bindVertexArray(I)}function h(I){return n.deleteVertexArray(I)}function u(I,D,Q){const N=Q.wireframe===!0;let z=i[I.id];z===void 0&&(z={},i[I.id]=z);let $=z[D.id];$===void 0&&($={},z[D.id]=$);let H=$[N];return H===void 0&&(H=d(l()),$[N]=H),H}function d(I){const D=[],Q=[],N=[];for(let z=0;z<t;z++)D[z]=0,Q[z]=0,N[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:D,enabledAttributes:Q,attributeDivisors:N,object:I,attributes:{},index:null}}function f(I,D,Q,N){const z=s.attributes,$=D.attributes;let H=0;const K=Q.getAttributes();for(const Y in K)if(K[Y].location>=0){const pe=z[Y];let be=$[Y];if(be===void 0&&(Y==="instanceMatrix"&&I.instanceMatrix&&(be=I.instanceMatrix),Y==="instanceColor"&&I.instanceColor&&(be=I.instanceColor)),pe===void 0||pe.attribute!==be||be&&pe.data!==be.data)return!0;H++}return s.attributesNum!==H||s.index!==N}function A(I,D,Q,N){const z={},$=D.attributes;let H=0;const K=Q.getAttributes();for(const Y in K)if(K[Y].location>=0){let pe=$[Y];pe===void 0&&(Y==="instanceMatrix"&&I.instanceMatrix&&(pe=I.instanceMatrix),Y==="instanceColor"&&I.instanceColor&&(pe=I.instanceColor));const be={};be.attribute=pe,pe&&pe.data&&(be.data=pe.data),z[Y]=be,H++}s.attributes=z,s.attributesNum=H,s.index=N}function g(){const I=s.newAttributes;for(let D=0,Q=I.length;D<Q;D++)I[D]=0}function m(I){p(I,0)}function p(I,D){const Q=s.newAttributes,N=s.enabledAttributes,z=s.attributeDivisors;Q[I]=1,N[I]===0&&(n.enableVertexAttribArray(I),N[I]=1),z[I]!==D&&(n.vertexAttribDivisor(I,D),z[I]=D)}function v(){const I=s.newAttributes,D=s.enabledAttributes;for(let Q=0,N=D.length;Q<N;Q++)D[Q]!==I[Q]&&(n.disableVertexAttribArray(Q),D[Q]=0)}function y(I,D,Q,N,z,$,H){H===!0?n.vertexAttribIPointer(I,D,Q,z,$):n.vertexAttribPointer(I,D,Q,N,z,$)}function b(I,D,Q,N){g();const z=N.attributes,$=Q.getAttributes(),H=D.defaultAttributeValues;for(const K in $){const Y=$[K];if(Y.location>=0){let ee=z[K];if(ee===void 0&&(K==="instanceMatrix"&&I.instanceMatrix&&(ee=I.instanceMatrix),K==="instanceColor"&&I.instanceColor&&(ee=I.instanceColor)),ee!==void 0){const pe=ee.normalized,be=ee.itemSize,Ce=e.get(ee);if(Ce===void 0)continue;const Pe=Ce.buffer,Me=Ce.type,te=Ce.bytesPerElement,Ae=Me===n.INT||Me===n.UNSIGNED_INT||ee.gpuType===$c;if(ee.isInterleavedBufferAttribute){const se=ee.data,X=se.stride,he=ee.offset;if(se.isInstancedInterleavedBuffer){for(let ue=0;ue<Y.locationSize;ue++)p(Y.location+ue,se.meshPerAttribute);I.isInstancedMesh!==!0&&N._maxInstanceCount===void 0&&(N._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let ue=0;ue<Y.locationSize;ue++)m(Y.location+ue);n.bindBuffer(n.ARRAY_BUFFER,Pe);for(let ue=0;ue<Y.locationSize;ue++)y(Y.location+ue,be/Y.locationSize,Me,pe,X*te,(he+be/Y.locationSize*ue)*te,Ae)}else{if(ee.isInstancedBufferAttribute){for(let se=0;se<Y.locationSize;se++)p(Y.location+se,ee.meshPerAttribute);I.isInstancedMesh!==!0&&N._maxInstanceCount===void 0&&(N._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let se=0;se<Y.locationSize;se++)m(Y.location+se);n.bindBuffer(n.ARRAY_BUFFER,Pe);for(let se=0;se<Y.locationSize;se++)y(Y.location+se,be/Y.locationSize,Me,pe,be*te,be/Y.locationSize*se*te,Ae)}}else if(H!==void 0){const pe=H[K];if(pe!==void 0)switch(pe.length){case 2:n.vertexAttrib2fv(Y.location,pe);break;case 3:n.vertexAttrib3fv(Y.location,pe);break;case 4:n.vertexAttrib4fv(Y.location,pe);break;default:n.vertexAttrib1fv(Y.location,pe)}}}}v()}function w(){R();for(const I in i){const D=i[I];for(const Q in D){const N=D[Q];for(const z in N)h(N[z].object),delete N[z];delete D[Q]}delete i[I]}}function M(I){if(i[I.id]===void 0)return;const D=i[I.id];for(const Q in D){const N=D[Q];for(const z in N)h(N[z].object),delete N[z];delete D[Q]}delete i[I.id]}function S(I){for(const D in i){const Q=i[D];if(Q[I.id]===void 0)continue;const N=Q[I.id];for(const z in N)h(N[z].object),delete N[z];delete Q[I.id]}}function R(){_(),o=!0,s!==r&&(s=r,c(s.object))}function _(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:R,resetDefaultState:_,dispose:w,releaseStatesOfGeometry:M,releaseStatesOfProgram:S,initAttributes:g,enableAttribute:m,disableUnusedAttributes:v}}function y1(n,e,t){let i;function r(c){i=c}function s(c,h){n.drawArrays(i,c,h),t.update(h,i,1)}function o(c,h,u){u!==0&&(n.drawArraysInstanced(i,c,h,u),t.update(h,i,u))}function a(c,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,h,0,u);let f=0;for(let A=0;A<u;A++)f+=h[A];t.update(f,i,1)}function l(c,h,u,d){if(u===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let A=0;A<c.length;A++)o(c[A],h[A],d[A]);else{f.multiDrawArraysInstancedWEBGL(i,c,0,h,0,d,0,u);let A=0;for(let g=0;g<u;g++)A+=h[g]*d[g];t.update(A,i,1)}}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function E1(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const S=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(S.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(S){return!(S!==pn&&i.convert(S)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(S){const R=S===zs&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(S!==hi&&i.convert(S)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&S!==un&&!R)}function l(S){if(S==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";S="mediump"}return S==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),f=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),A=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),p=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),y=n.getParameter(n.MAX_VARYING_VECTORS),b=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),w=A>0,M=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:d,maxTextures:f,maxVertexTextures:A,maxTextureSize:g,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,vertexTextures:w,maxSamples:M}}function x1(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Ki,a=new et,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||i!==0||r;return r=d,i=u.length,f},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,f){const A=u.clippingPlanes,g=u.clipIntersection,m=u.clipShadows,p=n.get(u);if(!r||A===null||A.length===0||s&&!m)s?h(null):c();else{const v=s?0:i,y=v*4;let b=p.clippingState||null;l.value=b,b=h(A,d,y,f);for(let w=0;w!==y;++w)b[w]=t[w];p.clippingState=b,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(u,d,f,A){const g=u!==null?u.length:0;let m=null;if(g!==0){if(m=l.value,A!==!0||m===null){const p=f+g*4,v=d.matrixWorldInverse;a.getNormalMatrix(v),(m===null||m.length<p)&&(m=new Float32Array(p));for(let y=0,b=f;y!==g;++y,b+=4)o.copy(u[y]).applyMatrix4(v,a),o.normal.toArray(m,b),m[b+3]=o.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,m}}function b1(n){let e=new WeakMap;function t(o,a){return a===Oo?o.mapping=Ui:a===ko&&(o.mapping=nr),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===Oo||a===ko)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new Nv(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}const Rs=4,hm=[.125,.215,.35,.446,.526,.582],Fr=20,Cu=new Bh,um=new De;let wu=null,_u=0,Mu=0,Su=!1;const Ur=(1+Math.sqrt(5))/2,vs=1/Ur,dm=[new F(-Ur,vs,0),new F(Ur,vs,0),new F(-vs,0,Ur),new F(vs,0,Ur),new F(0,Ur,-vs),new F(0,Ur,vs),new F(-1,1,-1),new F(1,1,-1),new F(-1,1,1),new F(1,1,1)];class Wd{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,i=.1,r=100){wu=this._renderer.getRenderTarget(),_u=this._renderer.getActiveCubeFace(),Mu=this._renderer.getActiveMipmapLevel(),Su=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Am(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=pm(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(wu,_u,Mu),this._renderer.xr.enabled=Su,e.scissorTest=!1,cl(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ui||e.mapping===nr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),wu=this._renderer.getRenderTarget(),_u=this._renderer.getActiveCubeFace(),Mu=this._renderer.getActiveMipmapLevel(),Su=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Ht,minFilter:Ht,generateMipmaps:!1,type:zs,format:pn,colorSpace:qr,depthBuffer:!1},r=fm(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=fm(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=C1(s)),this._blurMaterial=w1(s,e,t)}return r}_compileMaterial(e){const t=new kt(this._lodPlanes[0],e);this._renderer.compile(t,Cu)}_sceneToCubeUV(e,t,i,r){const a=new Yt(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,u=h.autoClear,d=h.toneMapping;h.getClearColor(um),h.toneMapping=Ti,h.autoClear=!1;const f=new ar({name:"PMREM.Background",side:An,depthWrite:!1,depthTest:!1}),A=new kt(new Yr,f);let g=!1;const m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,g=!0):(f.color.copy(um),g=!0);for(let p=0;p<6;p++){const v=p%3;v===0?(a.up.set(0,l[p],0),a.lookAt(c[p],0,0)):v===1?(a.up.set(0,0,l[p]),a.lookAt(0,c[p],0)):(a.up.set(0,l[p],0),a.lookAt(0,0,c[p]));const y=this._cubeSize;cl(r,v*y,p>2?y:0,y,y),h.setRenderTarget(r),g&&h.render(A,a),h.render(e,a)}A.geometry.dispose(),A.material.dispose(),h.toneMapping=d,h.autoClear=u,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Ui||e.mapping===nr;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Am()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=pm());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new kt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;cl(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Cu)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=dm[(r-s-1)%dm.length];this._blur(e,s-1,s,o,a)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new kt(this._lodPlanes[r],c),d=c.uniforms,f=this._sizeLods[i]-1,A=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*Fr-1),g=s/A,m=isFinite(s)?1+Math.floor(h*g):Fr;m>Fr&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Fr}`);const p=[];let v=0;for(let S=0;S<Fr;++S){const R=S/g,_=Math.exp(-R*R/2);p.push(_),S===0?v+=_:S<m&&(v+=2*_)}for(let S=0;S<p.length;S++)p[S]=p[S]/v;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=p,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);const{_lodMax:y}=this;d.dTheta.value=A,d.mipInt.value=y-i;const b=this._sizeLods[r],w=3*b*(r>y-Rs?r-y+Rs:0),M=4*(this._cubeSize-b);cl(t,w,M,3*b,2*b),l.setRenderTarget(t),l.render(u,Cu)}}function C1(n){const e=[],t=[],i=[];let r=n;const s=n-Rs+1+hm.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let l=1/a;o>n-Rs?l=hm[o-n+Rs-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,A=6,g=3,m=2,p=1,v=new Float32Array(g*A*f),y=new Float32Array(m*A*f),b=new Float32Array(p*A*f);for(let M=0;M<f;M++){const S=M%3*2/3-1,R=M>2?0:-1,_=[S,R,0,S+2/3,R,0,S+2/3,R+1,0,S,R,0,S+2/3,R+1,0,S,R+1,0];v.set(_,g*A*M),y.set(d,m*A*M);const I=[M,M,M,M,M,M];b.set(I,p*A*M)}const w=new ot;w.setAttribute("position",new wt(v,g)),w.setAttribute("uv",new wt(y,m)),w.setAttribute("faceIndex",new wt(b,p)),e.push(w),r>Rs&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function fm(n,e,t){const i=new Jn(n,e,t);return i.texture.mapping=Gs,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function cl(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function w1(n,e,t){const i=new Float32Array(Fr),r=new F(0,1,0);return new Zn({name:"SphericalGaussianBlur",defines:{n:Fr,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:pp(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[ n ];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
vec3 getSample( float theta, vec3 axis ) {
float cosTheta = cos( theta );
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross( axis, vOutputDirection ) * sin( theta )
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
return bilinearCubeUV( envMap, sampleDirection, mipInt );
}
void main() {
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
}
axis = normalize( axis );
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
for ( int i = 1; i < n; i++ ) {
if ( i >= samples ) {
break;
}
float theta = dTheta * float( i );
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
}
}
`,blending:Bi,depthTest:!1,depthWrite:!1})}function pm(){return new Zn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:pp(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
#include <common>
void main() {
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
`,blending:Bi,depthTest:!1,depthWrite:!1})}function Am(){return new Zn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:pp(),fragmentShader:`
precision mediump float;
precision mediump int;
uniform float flipEnvMap;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
`,blending:Bi,depthTest:!1,depthWrite:!1})}function pp(){return`
precision mediump float;
precision mediump int;
attribute float faceIndex;
varying vec3 vOutputDirection;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection( vec2 uv, float face ) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3( uv, 1.0 );
if ( face == 0.0 ) {
direction = direction.zyx; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction.xzy;
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction.x *= -1.0; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction.zyx;
direction.xz *= -1.0; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction.xzy;
direction.xy *= -1.0; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction.z *= -1.0; // ( u, v, -1 ) neg z
}
return direction;
}
void main() {
vOutputDirection = getDirection( uv, faceIndex );
gl_Position = vec4( position, 1.0 );
}
`}function _1(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===Oo||l===ko,h=l===Ui||l===nr;if(c||h){let u=e.get(a);const d=u!==void 0?u.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==d)return t===null&&(t=new Wd(n)),u=c?t.fromEquirectangular(a,u):t.fromCubemap(a,u),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),u.texture;if(u!==void 0)return u.texture;{const f=a.image;return c&&f&&f.height>0||h&&f&&r(f)?(t===null&&(t=new Wd(n)),u=c?t.fromEquirectangular(a):t.fromCubemap(a),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),a.addEventListener("dispose",s),u.texture):null}}}return a}function r(a){let l=0;const c=6;for(let h=0;h<c;h++)a[h]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function M1(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&Ms("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function S1(n,e,t,i){const r={},s=new WeakMap;function o(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const A in d.attributes)e.remove(d.attributes[A]);d.removeEventListener("dispose",o),delete r[d.id];const f=s.get(d);f&&(e.remove(f),s.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(u,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(u){const d=u.attributes;for(const f in d)e.update(d[f],n.ARRAY_BUFFER)}function c(u){const d=[],f=u.index,A=u.attributes.position;let g=0;if(f!==null){const v=f.array;g=f.version;for(let y=0,b=v.length;y<b;y+=3){const w=v[y+0],M=v[y+1],S=v[y+2];d.push(w,M,M,S,S,w)}}else if(A!==void 0){const v=A.array;g=A.version;for(let y=0,b=v.length/3-1;y<b;y+=3){const w=y+0,M=y+1,S=y+2;d.push(w,M,M,S,S,w)}}else return;const m=new(Lv(d)?Vf:Hf)(d,1);m.version=g;const p=s.get(u);p&&e.remove(p),s.set(u,m)}function h(u){const d=s.get(u);if(d){const f=u.index;f!==null&&d.version<f.version&&c(u)}else c(u);return s.get(u)}return{get:a,update:l,getWireframeAttribute:h}}function I1(n,e,t){let i;function r(d){i=d}let s,o;function a(d){s=d.type,o=d.bytesPerElement}function l(d,f){n.drawElements(i,f,s,d*o),t.update(f,i,1)}function c(d,f,A){A!==0&&(n.drawElementsInstanced(i,f,s,d*o,A),t.update(f,i,A))}function h(d,f,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,f,0,s,d,0,A);let m=0;for(let p=0;p<A;p++)m+=f[p];t.update(m,i,1)}function u(d,f,A,g){if(A===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let p=0;p<d.length;p++)c(d[p]/o,f[p],g[p]);else{m.multiDrawElementsInstancedWEBGL(i,f,0,s,d,0,g,0,A);let p=0;for(let v=0;v<A;v++)p+=f[v]*g[v];t.update(p,i,1)}}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function B1(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function T1(n,e,t){const i=new WeakMap,r=new mt;function s(o,a,l){const c=o.morphTargetInfluences,h=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,u=h!==void 0?h.length:0;let d=i.get(a);if(d===void 0||d.count!==u){let _=function(){S.dispose(),i.delete(a),a.removeEventListener("dispose",_)};d!==void 0&&d.texture.dispose();const f=a.morphAttributes.position!==void 0,A=a.morphAttributes.normal!==void 0,g=a.morphAttributes.color!==void 0,m=a.morphAttributes.position||[],p=a.morphAttributes.normal||[],v=a.morphAttributes.color||[];let y=0;f===!0&&(y=1),A===!0&&(y=2),g===!0&&(y=3);let b=a.attributes.position.count*y,w=1;b>e.maxTextureSize&&(w=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const M=new Float32Array(b*w*4*u),S=new la(M,b,w,u);S.type=un,S.needsUpdate=!0;const R=y*4;for(let I=0;I<u;I++){const D=m[I],Q=p[I],N=v[I],z=b*w*4*I;for(let $=0;$<D.count;$++){const H=$*R;f===!0&&(r.fromBufferAttribute(D,$),M[z+H+0]=r.x,M[z+H+1]=r.y,M[z+H+2]=r.z,M[z+H+3]=0),A===!0&&(r.fromBufferAttribute(Q,$),M[z+H+4]=r.x,M[z+H+5]=r.y,M[z+H+6]=r.z,M[z+H+7]=0),g===!0&&(r.fromBufferAttribute(N,$),M[z+H+8]=r.x,M[z+H+9]=r.y,M[z+H+10]=r.z,M[z+H+11]=N.itemSize===4?r.w:1)}}d={count:u,texture:S,size:new fe(b,w)},i.set(a,d),a.addEventListener("dispose",_)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let f=0;for(let g=0;g<c.length;g++)f+=c[g];const A=a.morphTargetsRelative?1:1-f;l.getUniforms().setValue(n,"morphTargetBaseInfluence",A),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",d.size)}return{update:s}}class R1{constructor(e,t,i){if(this.renderer=e,this.DEFAULT_NUMVIEWS=2,this.maxNumViews=0,this.gl=i,this.extensions=t,this.available=this.extensions.has("OCULUS_multiview"),this.available){const s=this.extensions.get("OCULUS_multiview");this.maxNumViews=this.gl.getParameter(s.MAX_VIEWS_OVR),this.mat4=[],this.mat3=[],this.cameraArray=[];for(var r=0;r<this.maxNumViews;r++)this.mat4[r]=new Ye,this.mat3[r]=new et}}getCameraArray(e){return e.isArrayCamera?e.cameras:(this.cameraArray[0]=e,this.cameraArray)}updateCameraProjectionMatricesUniform(e,t){for(var i=this.getCameraArray(e),r=0;r<i.length;r++)this.mat4[r].copy(i[r].projectionMatrix);t.setValue(this.gl,"projectionMatrices",this.mat4)}updateCameraViewMatricesUniform(e,t){for(var i=this.getCameraArray(e),r=0;r<i.length;r++)this.mat4[r].copy(i[r].matrixWorldInverse);t.setValue(this.gl,"viewMatrices",this.mat4)}updateObjectMatricesUniforms(e,t,i){for(var r=this.getCameraArray(t),s=0;s<r.length;s++)this.mat4[s].multiplyMatrices(r[s].matrixWorldInverse,e.matrixWorld),this.mat3[s].getNormalMatrix(this.mat4[s]);i.setValue(this.gl,"modelViewMatrices",this.mat4),i.setValue(this.gl,"normalMatrices",this.mat3)}}function L1(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,h=l.geometry,u=e.get(l,h);if(r.get(u)!==c&&(e.update(u),r.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;r.get(d)!==c&&(d.update(),r.set(d,c))}return u}function o(){r=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}const ky=new Tt,mm=new Xf(1,1),Ny=new la,Qy=new ah,Gy=new ca,gm=[],vm=[],ym=new Float32Array(16),Em=new Float32Array(9),xm=new Float32Array(4);function qs(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=gm[r];if(s===void 0&&(s=new Float32Array(r),gm[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Vt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Wt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Rh(n,e){let t=vm[e];t===void 0&&(t=new Int32Array(e),vm[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function D1(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function P1(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Vt(t,e))return;n.uniform2fv(this.addr,e),Wt(t,e)}}function U1(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Vt(t,e))return;n.uniform3fv(this.addr,e),Wt(t,e)}}function F1(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Vt(t,e))return;n.uniform4fv(this.addr,e),Wt(t,e)}}function O1(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Vt(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Wt(t,e)}else{if(Vt(t,i))return;xm.set(i),n.uniformMatrix2fv(this.addr,!1,xm),Wt(t,i)}}function k1(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Vt(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Wt(t,e)}else{if(Vt(t,i))return;Em.set(i),n.uniformMatrix3fv(this.addr,!1,Em),Wt(t,i)}}function N1(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Vt(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Wt(t,e)}else{if(Vt(t,i))return;ym.set(i),n.uniformMatrix4fv(this.addr,!1,ym),Wt(t,i)}}function Q1(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function G1(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Vt(t,e))return;n.uniform2iv(this.addr,e),Wt(t,e)}}function z1(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Vt(t,e))return;n.uniform3iv(this.addr,e),Wt(t,e)}}function H1(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Vt(t,e))return;n.uniform4iv(this.addr,e),Wt(t,e)}}function V1(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function W1(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Vt(t,e))return;n.uniform2uiv(this.addr,e),Wt(t,e)}}function q1(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Vt(t,e))return;n.uniform3uiv(this.addr,e),Wt(t,e)}}function j1(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Vt(t,e))return;n.uniform4uiv(this.addr,e),Wt(t,e)}}function X1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(mm.compareFunction=Gf,s=mm):s=ky,t.setTexture2D(e||s,r)}function Y1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||Qy,r)}function K1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||Gy,r)}function J1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||Ny,r)}function Z1(n){switch(n){case 5126:return D1;case 35664:return P1;case 35665:return U1;case 35666:return F1;case 35674:return O1;case 35675:return k1;case 35676:return N1;case 5124:case 35670:return Q1;case 35667:case 35671:return G1;case 35668:case 35672:return z1;case 35669:case 35673:return H1;case 5125:return V1;case 36294:return W1;case 36295:return q1;case 36296:return j1;case 35678:case 36198:case 36298:case 36306:case 35682:return X1;case 35679:case 36299:case 36307:return Y1;case 35680:case 36300:case 36308:case 36293:return K1;case 36289:case 36303:case 36311:case 36292:return J1}}function $1(n,e){n.uniform1fv(this.addr,e)}function eS(n,e){const t=qs(e,this.size,2);n.uniform2fv(this.addr,t)}function tS(n,e){const t=qs(e,this.size,3);n.uniform3fv(this.addr,t)}function nS(n,e){const t=qs(e,this.size,4);n.uniform4fv(this.addr,t)}function iS(n,e){const t=qs(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function rS(n,e){const t=qs(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function sS(n,e){const t=qs(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function oS(n,e){n.uniform1iv(this.addr,e)}function aS(n,e){n.uniform2iv(this.addr,e)}function lS(n,e){n.uniform3iv(this.addr,e)}function cS(n,e){n.uniform4iv(this.addr,e)}function hS(n,e){n.uniform1uiv(this.addr,e)}function uS(n,e){n.uniform2uiv(this.addr,e)}function dS(n,e){n.uniform3uiv(this.addr,e)}function fS(n,e){n.uniform4uiv(this.addr,e)}function pS(n,e,t){const i=this.cache,r=e.length,s=Rh(t,r);Vt(i,s)||(n.uniform1iv(this.addr,s),Wt(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||ky,s[o])}function AS(n,e,t){const i=this.cache,r=e.length,s=Rh(t,r);Vt(i,s)||(n.uniform1iv(this.addr,s),Wt(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||Qy,s[o])}function mS(n,e,t){const i=this.cache,r=e.length,s=Rh(t,r);Vt(i,s)||(n.uniform1iv(this.addr,s),Wt(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||Gy,s[o])}function gS(n,e,t){const i=this.cache,r=e.length,s=Rh(t,r);Vt(i,s)||(n.uniform1iv(this.addr,s),Wt(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||Ny,s[o])}function vS(n){switch(n){case 5126:return $1;case 35664:return eS;case 35665:return tS;case 35666:return nS;case 35674:return iS;case 35675:return rS;case 35676:return sS;case 5124:case 35670:return oS;case 35667:case 35671:return aS;case 35668:case 35672:return lS;case 35669:case 35673:return cS;case 5125:return hS;case 36294:return uS;case 36295:return dS;case 36296:return fS;case 35678:case 36198:case 36298:case 36306:case 35682:return pS;case 35679:case 36299:case 36307:return AS;case 35680:case 36300:case 36308:case 36293:return mS;case 36289:case 36303:case 36311:case 36292:return gS}}class yS{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=Z1(t.type)}}class ES{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=vS(t.type)}}class xS{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const Iu=/(\w+)(\])?(\[|\.)?/g;function bm(n,e){n.seq.push(e),n.map[e.id]=e}function bS(n,e,t){const i=n.name,r=i.length;for(Iu.lastIndex=0;;){const s=Iu.exec(i),o=Iu.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){bm(t,c===void 0?new yS(a,n,e):new ES(a,n,e));break}else{let u=t.map[a];u===void 0&&(u=new xS(a),bm(t,u)),t=u}}}class zl{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);bS(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function Cm(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const CS=37297;let wS=0;function _S(n,e){const t=n.split(`
`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;i.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return i.join(`
`)}const wm=new et;function MS(n){ht._getMatrix(wm,ht.workingColorSpace,n);const e=`mat3( ${wm.elements.map(t=>t.toFixed(4))} )`;switch(ht.getTransfer(n)){case Ho:return[e,"LinearTransferOETF"];case bt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function _m(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`
`+r+`
`+_S(n.getShaderSource(e),o)}else return r}function SS(n,e){const t=MS(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
`)}function IS(n,e){let t;switch(e){case uv:t="Linear";break;case dv:t="Reinhard";break;case fv:t="Cineon";break;case pv:t="ACESFilmic";break;case mv:t="AgX";break;case gv:t="Neutral";break;case Av:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const hl=new F;function BS(){ht.getLuminanceCoefficients(hl);const n=hl.x.toFixed(4),e=hl.y.toFixed(4),t=hl.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
`)}function TS(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(bo).join(`
`)}function RS(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function LS(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function bo(n){return n!==""}function Mm(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Sm(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const DS=/^[ \t]*#include +<([\w\d./]+)>/gm;function qd(n){return n.replace(DS,US)}const PS=new Map;function US(n,e){let t=st[e];if(t===void 0){const i=PS.get(e);if(i!==void 0)t=st[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return qd(t)}const FS=/#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 Im(n){return n.replace(FS,OS)}function OS(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Bm(n){let e=`precision ${n.precision} float;
precision ${n.precision} int;
precision ${n.precision} sampler2D;
precision ${n.precision} samplerCube;
precision ${n.precision} sampler3D;
precision ${n.precision} sampler2DArray;
precision ${n.precision} sampler2DShadow;
precision ${n.precision} samplerCubeShadow;
precision ${n.precision} sampler2DArrayShadow;
precision ${n.precision} isampler2D;
precision ${n.precision} isampler3D;
precision ${n.precision} isamplerCube;
precision ${n.precision} isampler2DArray;
precision ${n.precision} usampler2D;
precision ${n.precision} usampler3D;
precision ${n.precision} usamplerCube;
precision ${n.precision} usampler2DArray;
`;return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function kS(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===Bf?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===V0?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===ii&&(e="SHADOWMAP_TYPE_VSM"),e}function NS(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Ui:case nr:e="ENVMAP_TYPE_CUBE";break;case Gs:e="ENVMAP_TYPE_CUBE_UV";break}return e}function QS(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case nr:e="ENVMAP_MODE_REFRACTION";break}return e}function GS(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case oa:e="ENVMAP_BLENDING_MULTIPLY";break;case cv:e="ENVMAP_BLENDING_MIX";break;case hv:e="ENVMAP_BLENDING_ADD";break}return e}function zS(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function HS(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=kS(t),c=NS(t),h=QS(t),u=GS(t),d=zS(t),f=TS(t),A=RS(s),g=r.createProgram();let m,p,v=t.glslVersion?"#version "+t.glslVersion+`
`:"";const y=t.numMultiviewViews;t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A].filter(bo).join(`
`),m.length>0&&(m+=`
`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A].filter(bo).join(`
`),p.length>0&&(p+=`
`)):(m=[Bm(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
`].filter(bo).join(`
`),p=[Bm(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,A,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ti?"#define TONE_MAPPING":"",t.toneMapping!==Ti?st.tonemapping_pars_fragment:"",t.toneMapping!==Ti?IS("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",st.colorspace_pars_fragment,SS("linearToOutputTexel",t.outputColorSpace),BS(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(bo).join(`
`)),o=qd(o),o=Mm(o,t),o=Sm(o,t),a=qd(a),a=Mm(a,t),a=Sm(a,t),o=Im(o),a=Im(a),t.isRawShaderMaterial!==!0&&(v=`#version 300 es
`,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+m,p=["#define varying in",t.glslVersion===Od?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Od?"":"#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(`
`)+`
`+p,y>0&&(m=["#extension GL_OVR_multiview : require","layout(num_views = "+y+") in;","#define VIEW_ID gl_ViewID_OVR"].join(`
`)+`
`+m,m=m.replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join(`
`),["uniform mat4 modelViewMatrices["+y+"];","uniform mat4 projectionMatrices["+y+"];","uniform mat4 viewMatrices["+y+"];","uniform mat3 normalMatrices["+y+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join(`
`)),p=["#extension GL_OVR_multiview : require","#define VIEW_ID gl_ViewID_OVR"].join(`
`)+`
`+p,p=p.replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+y+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join(`
`))));const b=v+m+o,w=v+p+a,M=Cm(r,r.VERTEX_SHADER,b),S=Cm(r,r.FRAGMENT_SHADER,w);r.attachShader(g,M),r.attachShader(g,S),t.index0AttributeName!==void 0?r.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(g,0,"position"),r.linkProgram(g);function R(Q){if(n.debug.checkShaderErrors){const N=r.getProgramInfoLog(g).trim(),z=r.getShaderInfoLog(M).trim(),$=r.getShaderInfoLog(S).trim();let H=!0,K=!0;if(r.getProgramParameter(g,r.LINK_STATUS)===!1)if(H=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,g,M,S);else{const Y=_m(r,M,"vertex"),ee=_m(r,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(g,r.VALIDATE_STATUS)+`
Material Name: `+Q.name+`
Material Type: `+Q.type+`
Program Info Log: `+N+`
`+Y+`
`+ee)}else N!==""?console.warn("THREE.WebGLProgram: Program Info Log:",N):(z===""||$==="")&&(K=!1);K&&(Q.diagnostics={runnable:H,programLog:N,vertexShader:{log:z,prefix:m},fragmentShader:{log:$,prefix:p}})}r.deleteShader(M),r.deleteShader(S),_=new zl(r,g),I=LS(r,g)}let _;this.getUniforms=function(){return _===void 0&&R(this),_};let I;this.getAttributes=function(){return I===void 0&&R(this),I};let D=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(g,CS)),D},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=wS++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=M,this.fragmentShader=S,this.numMultiviewViews=y,this}let VS=0;class WS{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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 i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new qS(e),t.set(e,i)),i}}class qS{constructor(e){this.id=VS++,this.code=e,this.usedTimes=0}}function jS(n,e,t,i,r,s,o){const a=new lh,l=new WS,c=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures;let f=r.precision;const A={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 g(_){return c.add(_),_===0?"uv":`uv${_}`}function m(_,I,D,Q,N){const z=Q.fog,$=N.geometry,H=_.isMeshStandardMaterial?Q.environment:null,K=(_.isMeshStandardMaterial?t:e).get(_.envMap||H),Y=K&&K.mapping===Gs?K.image.height:null,ee=A[_.type];_.precision!==null&&(f=r.getMaxPrecision(_.precision),f!==_.precision&&console.warn("THREE.WebGLProgram.getParameters:",_.precision,"not supported, using",f,"instead."));const pe=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,be=pe!==void 0?pe.length:0;let Ce=0;$.morphAttributes.position!==void 0&&(Ce=1),$.morphAttributes.normal!==void 0&&(Ce=2),$.morphAttributes.color!==void 0&&(Ce=3);let Pe,Me,te,Ae;if(ee){const ut=Xn[ee];Pe=ut.vertexShader,Me=ut.fragmentShader}else Pe=_.vertexShader,Me=_.fragmentShader,l.update(_),te=l.getVertexShaderID(_),Ae=l.getFragmentShaderID(_);const se=n.getRenderTarget(),X=n.state.buffers.depth.getReversed(),he=se&&se.isWebGLMultiviewRenderTarget?se.numViews:0,ue=N.isInstancedMesh===!0,ve=N.isBatchedMesh===!0,ne=!!_.map,le=!!_.matcap,ce=!!K,O=!!_.aoMap,me=!!_.lightMap,ye=!!_.bumpMap,x=!!_.normalMap,C=!!_.displacementMap,T=!!_.emissiveMap,U=!!_.metalnessMap,k=!!_.roughnessMap,j=_.anisotropy>0,ie=_.clearcoat>0,ke=_.dispersion>0,P=_.iridescence>0,B=_.sheen>0,V=_.transmission>0,re=j&&!!_.anisotropyMap,de=ie&&!!_.clearcoatMap,oe=ie&&!!_.clearcoatNormalMap,Fe=ie&&!!_.clearcoatRoughnessMap,Ee=P&&!!_.iridescenceMap,Le=P&&!!_.iridescenceThicknessMap,nt=B&&!!_.sheenColorMap,we=B&&!!_.sheenRoughnessMap,Ve=!!_.specularMap,at=!!_.specularColorMap,G=!!_.specularIntensityMap,ae=V&&!!_.transmissionMap,xe=V&&!!_.thicknessMap,Te=!!_.gradientMap,Se=!!_.alphaMap,Ue=_.alphaTest>0,Ke=!!_.alphaHash,Ie=!!_.extensions;let Be=Ti;_.toneMapped&&(se===null||se.isXRRenderTarget===!0)&&(Be=n.toneMapping);const ze={shaderID:ee,shaderType:_.type,shaderName:_.name,vertexShader:Pe,fragmentShader:Me,defines:_.defines,customVertexShaderID:te,customFragmentShaderID:Ae,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:f,batching:ve,batchingColor:ve&&N._colorsTexture!==null,instancing:ue,instancingColor:ue&&N.instanceColor!==null,instancingMorph:ue&&N.morphTexture!==null,supportsVertexTextures:d,numMultiviewViews:he,outputColorSpace:se===null?n.outputColorSpace:se.isXRRenderTarget===!0?se.texture.colorSpace:qr,alphaToCoverage:!!_.alphaToCoverage,map:ne,matcap:le,envMap:ce,envMapMode:ce&&K.mapping,envMapCubeUVHeight:Y,aoMap:O,lightMap:me,bumpMap:ye,normalMap:x,displacementMap:d&&C,emissiveMap:T,normalMapObjectSpace:x&&_.normalMapType===wv,normalMapTangentSpace:x&&_.normalMapType===or,metalnessMap:U,roughnessMap:k,anisotropy:j,anisotropyMap:re,clearcoat:ie,clearcoatMap:de,clearcoatNormalMap:oe,clearcoatRoughnessMap:Fe,dispersion:ke,iridescence:P,iridescenceMap:Ee,iridescenceThicknessMap:Le,sheen:B,sheenColorMap:nt,sheenRoughnessMap:we,specularMap:Ve,specularColorMap:at,specularIntensityMap:G,transmission:V,transmissionMap:ae,thicknessMap:xe,gradientMap:Te,opaque:_.transparent===!1&&_.blending===Gr&&_.alphaToCoverage===!1,alphaMap:Se,alphaTest:Ue,alphaHash:Ke,combine:_.combine,mapUv:ne&&g(_.map.channel),aoMapUv:O&&g(_.aoMap.channel),lightMapUv:me&&g(_.lightMap.channel),bumpMapUv:ye&&g(_.bumpMap.channel),normalMapUv:x&&g(_.normalMap.channel),displacementMapUv:C&&g(_.displacementMap.channel),emissiveMapUv:T&&g(_.emissiveMap.channel),metalnessMapUv:U&&g(_.metalnessMap.channel),roughnessMapUv:k&&g(_.roughnessMap.channel),anisotropyMapUv:re&&g(_.anisotropyMap.channel),clearcoatMapUv:de&&g(_.clearcoatMap.channel),clearcoatNormalMapUv:oe&&g(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Fe&&g(_.clearcoatRoughnessMap.channel),iridescenceMapUv:Ee&&g(_.iridescenceMap.channel),iridescenceThicknessMapUv:Le&&g(_.iridescenceThicknessMap.channel),sheenColorMapUv:nt&&g(_.sheenColorMap.channel),sheenRoughnessMapUv:we&&g(_.sheenRoughnessMap.channel),specularMapUv:Ve&&g(_.specularMap.channel),specularColorMapUv:at&&g(_.specularColorMap.channel),specularIntensityMapUv:G&&g(_.specularIntensityMap.channel),transmissionMapUv:ae&&g(_.transmissionMap.channel),thicknessMapUv:xe&&g(_.thicknessMap.channel),alphaMapUv:Se&&g(_.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(x||j),vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!$.attributes.uv&&(ne||Se),fog:!!z,useFog:_.fog===!0,fogExp2:!!z&&z.isFogExp2,flatShading:_.flatShading===!0,sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:X,skinning:N.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:be,morphTextureStride:Ce,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:_.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:Be,decodeVideoTexture:ne&&_.map.isVideoTexture===!0&&ht.getTransfer(_.map.colorSpace)===bt,decodeVideoTextureEmissive:T&&_.emissiveMap.isVideoTexture===!0&&ht.getTransfer(_.emissiveMap.colorSpace)===bt,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===si,flipSided:_.side===An,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:Ie&&_.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ie&&_.extensions.multiDraw===!0||ve)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return ze.vertexUv1s=c.has(1),ze.vertexUv2s=c.has(2),ze.vertexUv3s=c.has(3),c.clear(),ze}function p(_){const I=[];if(_.shaderID?I.push(_.shaderID):(I.push(_.customVertexShaderID),I.push(_.customFragmentShaderID)),_.defines!==void 0)for(const D in _.defines)I.push(D),I.push(_.defines[D]);return _.isRawShaderMaterial===!1&&(v(I,_),y(I,_),I.push(n.outputColorSpace)),I.push(_.customProgramCacheKey),I.join()}function v(_,I){_.push(I.precision),_.push(I.outputColorSpace),_.push(I.envMapMode),_.push(I.envMapCubeUVHeight),_.push(I.mapUv),_.push(I.alphaMapUv),_.push(I.lightMapUv),_.push(I.aoMapUv),_.push(I.bumpMapUv),_.push(I.normalMapUv),_.push(I.displacementMapUv),_.push(I.emissiveMapUv),_.push(I.metalnessMapUv),_.push(I.roughnessMapUv),_.push(I.anisotropyMapUv),_.push(I.clearcoatMapUv),_.push(I.clearcoatNormalMapUv),_.push(I.clearcoatRoughnessMapUv),_.push(I.iridescenceMapUv),_.push(I.iridescenceThicknessMapUv),_.push(I.sheenColorMapUv),_.push(I.sheenRoughnessMapUv),_.push(I.specularMapUv),_.push(I.specularColorMapUv),_.push(I.specularIntensityMapUv),_.push(I.transmissionMapUv),_.push(I.thicknessMapUv),_.push(I.combine),_.push(I.fogExp2),_.push(I.sizeAttenuation),_.push(I.morphTargetsCount),_.push(I.morphAttributeCount),_.push(I.numDirLights),_.push(I.numPointLights),_.push(I.numSpotLights),_.push(I.numSpotLightMaps),_.push(I.numHemiLights),_.push(I.numRectAreaLights),_.push(I.numDirLightShadows),_.push(I.numPointLightShadows),_.push(I.numSpotLightShadows),_.push(I.numSpotLightShadowsWithMaps),_.push(I.numLightProbes),_.push(I.shadowMapType),_.push(I.toneMapping),_.push(I.numClippingPlanes),_.push(I.numClipIntersection),_.push(I.depthPacking)}function y(_,I){a.disableAll(),I.supportsVertexTextures&&a.enable(0),I.instancing&&a.enable(1),I.instancingColor&&a.enable(2),I.instancingMorph&&a.enable(3),I.matcap&&a.enable(4),I.envMap&&a.enable(5),I.normalMapObjectSpace&&a.enable(6),I.normalMapTangentSpace&&a.enable(7),I.clearcoat&&a.enable(8),I.iridescence&&a.enable(9),I.alphaTest&&a.enable(10),I.vertexColors&&a.enable(11),I.vertexAlphas&&a.enable(12),I.vertexUv1s&&a.enable(13),I.vertexUv2s&&a.enable(14),I.vertexUv3s&&a.enable(15),I.vertexTangents&&a.enable(16),I.anisotropy&&a.enable(17),I.alphaHash&&a.enable(18),I.batching&&a.enable(19),I.dispersion&&a.enable(20),I.batchingColor&&a.enable(21),_.push(a.mask),a.disableAll(),I.fog&&a.enable(0),I.useFog&&a.enable(1),I.flatShading&&a.enable(2),I.logarithmicDepthBuffer&&a.enable(3),I.reverseDepthBuffer&&a.enable(4),I.skinning&&a.enable(5),I.morphTargets&&a.enable(6),I.morphNormals&&a.enable(7),I.morphColors&&a.enable(8),I.premultipliedAlpha&&a.enable(9),I.shadowMapEnabled&&a.enable(10),I.doubleSided&&a.enable(11),I.flipSided&&a.enable(12),I.useDepthPacking&&a.enable(13),I.dithering&&a.enable(14),I.transmission&&a.enable(15),I.sheen&&a.enable(16),I.opaque&&a.enable(17),I.pointsUvs&&a.enable(18),I.decodeVideoTexture&&a.enable(19),I.decodeVideoTextureEmissive&&a.enable(20),I.alphaToCoverage&&a.enable(21),I.numMultiviewViews&&a.enable(21),_.push(a.mask)}function b(_){const I=A[_.type];let D;if(I){const Q=Xn[I];D=Ov.clone(Q.uniforms)}else D=_.uniforms;return D}function w(_,I){let D;for(let Q=0,N=h.length;Q<N;Q++){const z=h[Q];if(z.cacheKey===I){D=z,++D.usedTimes;break}}return D===void 0&&(D=new HS(n,I,_,s),h.push(D)),D}function M(_){if(--_.usedTimes===0){const I=h.indexOf(_);h[I]=h[h.length-1],h.pop(),_.destroy()}}function S(_){l.remove(_)}function R(){l.dispose()}return{getParameters:m,getProgramCacheKey:p,getUniforms:b,acquireProgram:w,releaseProgram:M,releaseShaderCache:S,programs:h,dispose:R}}function XS(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function i(o){n.delete(o)}function r(o,a,l){n.get(o)[a]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function YS(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function Tm(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Rm(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(u,d,f,A,g,m){let p=n[e];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:A,renderOrder:u.renderOrder,z:g,group:m},n[e]=p):(p.id=u.id,p.object=u,p.geometry=d,p.material=f,p.groupOrder=A,p.renderOrder=u.renderOrder,p.z=g,p.group=m),e++,p}function a(u,d,f,A,g,m){const p=o(u,d,f,A,g,m);f.transmission>0?i.push(p):f.transparent===!0?r.push(p):t.push(p)}function l(u,d,f,A,g,m){const p=o(u,d,f,A,g,m);f.transmission>0?i.unshift(p):f.transparent===!0?r.unshift(p):t.unshift(p)}function c(u,d){t.length>1&&t.sort(u||YS),i.length>1&&i.sort(d||Tm),r.length>1&&r.sort(d||Tm)}function h(){for(let u=e,d=n.length;u<d;u++){const f=n[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:h,sort:c}}function KS(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new Rm,n.set(i,[o])):r>=s.length?(o=new Rm,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function JS(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new De};break;case"SpotLight":t={position:new F,direction:new F,color:new De,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new De,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new De,groundColor:new De};break;case"RectAreaLight":t={color:new De,position:new F,halfWidth:new F,halfHeight:new F};break}return n[e.id]=t,t}}}function ZS(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fe,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let $S=0;function eI(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function tI(n){const e=new JS,t=ZS(),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 c=0;c<9;c++)i.probe.push(new F);const r=new F,s=new Ye,o=new Ye;function a(c){let h=0,u=0,d=0;for(let _=0;_<9;_++)i.probe[_].set(0,0,0);let f=0,A=0,g=0,m=0,p=0,v=0,y=0,b=0,w=0,M=0,S=0;c.sort(eI);for(let _=0,I=c.length;_<I;_++){const D=c[_],Q=D.color,N=D.intensity,z=D.distance,$=D.shadow&&D.shadow.map?D.shadow.map.texture:null;if(D.isAmbientLight)h+=Q.r*N,u+=Q.g*N,d+=Q.b*N;else if(D.isLightProbe){for(let H=0;H<9;H++)i.probe[H].addScaledVector(D.sh.coefficients[H],N);S++}else if(D.isDirectionalLight){const H=e.get(D);if(H.color.copy(D.color).multiplyScalar(D.intensity),D.castShadow){const K=D.shadow,Y=t.get(D);Y.shadowIntensity=K.intensity,Y.shadowBias=K.bias,Y.shadowNormalBias=K.normalBias,Y.shadowRadius=K.radius,Y.shadowMapSize=K.mapSize,i.directionalShadow[f]=Y,i.directionalShadowMap[f]=$,i.directionalShadowMatrix[f]=D.shadow.matrix,v++}i.directional[f]=H,f++}else if(D.isSpotLight){const H=e.get(D);H.position.setFromMatrixPosition(D.matrixWorld),H.color.copy(Q).multiplyScalar(N),H.distance=z,H.coneCos=Math.cos(D.angle),H.penumbraCos=Math.cos(D.angle*(1-D.penumbra)),H.decay=D.decay,i.spot[g]=H;const K=D.shadow;if(D.map&&(i.spotLightMap[w]=D.map,w++,K.updateMatrices(D),D.castShadow&&M++),i.spotLightMatrix[g]=K.matrix,D.castShadow){const Y=t.get(D);Y.shadowIntensity=K.intensity,Y.shadowBias=K.bias,Y.shadowNormalBias=K.normalBias,Y.shadowRadius=K.radius,Y.shadowMapSize=K.mapSize,i.spotShadow[g]=Y,i.spotShadowMap[g]=$,b++}g++}else if(D.isRectAreaLight){const H=e.get(D);H.color.copy(Q).multiplyScalar(N),H.halfWidth.set(D.width*.5,0,0),H.halfHeight.set(0,D.height*.5,0),i.rectArea[m]=H,m++}else if(D.isPointLight){const H=e.get(D);if(H.color.copy(D.color).multiplyScalar(D.intensity),H.distance=D.distance,H.decay=D.decay,D.castShadow){const K=D.shadow,Y=t.get(D);Y.shadowIntensity=K.intensity,Y.shadowBias=K.bias,Y.shadowNormalBias=K.normalBias,Y.shadowRadius=K.radius,Y.shadowMapSize=K.mapSize,Y.shadowCameraNear=K.camera.near,Y.shadowCameraFar=K.camera.far,i.pointShadow[A]=Y,i.pointShadowMap[A]=$,i.pointShadowMatrix[A]=D.shadow.matrix,y++}i.point[A]=H,A++}else if(D.isHemisphereLight){const H=e.get(D);H.skyColor.copy(D.color).multiplyScalar(N),H.groundColor.copy(D.groundColor).multiplyScalar(N),i.hemi[p]=H,p++}}m>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=_e.LTC_FLOAT_1,i.rectAreaLTC2=_e.LTC_FLOAT_2):(i.rectAreaLTC1=_e.LTC_HALF_1,i.rectAreaLTC2=_e.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=u,i.ambient[2]=d;const R=i.hash;(R.directionalLength!==f||R.pointLength!==A||R.spotLength!==g||R.rectAreaLength!==m||R.hemiLength!==p||R.numDirectionalShadows!==v||R.numPointShadows!==y||R.numSpotShadows!==b||R.numSpotMaps!==w||R.numLightProbes!==S)&&(i.directional.length=f,i.spot.length=g,i.rectArea.length=m,i.point.length=A,i.hemi.length=p,i.directionalShadow.length=v,i.directionalShadowMap.length=v,i.pointShadow.length=y,i.pointShadowMap.length=y,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=v,i.pointShadowMatrix.length=y,i.spotLightMatrix.length=b+w-M,i.spotLightMap.length=w,i.numSpotLightShadowsWithMaps=M,i.numLightProbes=S,R.directionalLength=f,R.pointLength=A,R.spotLength=g,R.rectAreaLength=m,R.hemiLength=p,R.numDirectionalShadows=v,R.numPointShadows=y,R.numSpotShadows=b,R.numSpotMaps=w,R.numLightProbes=S,i.version=$S++)}function l(c,h){let u=0,d=0,f=0,A=0,g=0;const m=h.matrixWorldInverse;for(let p=0,v=c.length;p<v;p++){const y=c[p];if(y.isDirectionalLight){const b=i.directional[u];b.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),u++}else if(y.isSpotLight){const b=i.spot[f];b.position.setFromMatrixPosition(y.matrixWorld),b.position.applyMatrix4(m),b.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),f++}else if(y.isRectAreaLight){const b=i.rectArea[A];b.position.setFromMatrixPosition(y.matrixWorld),b.position.applyMatrix4(m),o.identity(),s.copy(y.matrixWorld),s.premultiply(m),o.extractRotation(s),b.halfWidth.set(y.width*.5,0,0),b.halfHeight.set(0,y.height*.5,0),b.halfWidth.applyMatrix4(o),b.halfHeight.applyMatrix4(o),A++}else if(y.isPointLight){const b=i.point[d];b.position.setFromMatrixPosition(y.matrixWorld),b.position.applyMatrix4(m),d++}else if(y.isHemisphereLight){const b=i.hemi[g];b.direction.setFromMatrixPosition(y.matrixWorld),b.direction.transformDirection(m),g++}}}return{setup:a,setupView:l,state:i}}function Lm(n){const e=new tI(n),t=[],i=[];function r(h){c.camera=h,t.length=0,i.length=0}function s(h){t.push(h)}function o(h){i.push(h)}function a(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function nI(n){let e=new WeakMap;function t(r,s=0){const o=e.get(r);let a;return o===void 0?(a=new Lm(n),e.set(r,[a])):s>=o.length?(a=new Lm(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}const iI=`void main() {
gl_Position = vec4( position, 1.0 );
}`,rI=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
const float samples = float( VSM_SAMPLES );
float mean = 0.0;
float squared_mean = 0.0;
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
for ( float i = 0.0; i < samples; i ++ ) {
float uvOffset = uvStart + i * uvStride;
#ifdef HORIZONTAL_PASS
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean / samples;
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function sI(n,e,t){let i=new ha;const r=new fe,s=new fe,o=new mt,a=new np({depthPacking:Cv}),l=new ip,c={},h=t.maxTextureSize,u={[Pi]:An,[An]:Pi,[si]:si},d=new Zn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new fe},radius:{value:4}},vertexShader:iI,fragmentShader:rI}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const A=new ot;A.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new kt(A,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Bf;let p=this.type;this.render=function(M,S,R){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||M.length===0)return;const _=n.getRenderTarget(),I=n.getActiveCubeFace(),D=n.getActiveMipmapLevel(),Q=n.state;Q.setBlending(Bi),Q.buffers.color.setClear(1,1,1,1),Q.buffers.depth.setTest(!0),Q.setScissorTest(!1);const N=p!==ii&&this.type===ii,z=p===ii&&this.type!==ii;for(let $=0,H=M.length;$<H;$++){const K=M[$],Y=K.shadow;if(Y===void 0){console.warn("THREE.WebGLShadowMap:",K,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;r.copy(Y.mapSize);const ee=Y.getFrameExtents();if(r.multiply(ee),s.copy(Y.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/ee.x),r.x=s.x*ee.x,Y.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/ee.y),r.y=s.y*ee.y,Y.mapSize.y=s.y)),Y.map===null||N===!0||z===!0){const be=this.type!==ii?{minFilter:Zt,magFilter:Zt}:{};Y.map!==null&&Y.map.dispose(),Y.map=new Jn(r.x,r.y,be),Y.map.texture.name=K.name+".shadowMap",Y.camera.updateProjectionMatrix()}n.setRenderTarget(Y.map),n.clear();const pe=Y.getViewportCount();for(let be=0;be<pe;be++){const Ce=Y.getViewport(be);o.set(s.x*Ce.x,s.y*Ce.y,s.x*Ce.z,s.y*Ce.w),Q.viewport(o),Y.updateMatrices(K,be),i=Y.getFrustum(),b(S,R,Y.camera,K,this.type)}Y.isPointLightShadow!==!0&&this.type===ii&&v(Y,R),Y.needsUpdate=!1}p=this.type,m.needsUpdate=!1,n.setRenderTarget(_,I,D)};function v(M,S){const R=e.update(g);d.defines.VSM_SAMPLES!==M.blurSamples&&(d.defines.VSM_SAMPLES=M.blurSamples,f.defines.VSM_SAMPLES=M.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),M.mapPass===null&&(M.mapPass=new Jn(r.x,r.y)),d.uniforms.shadow_pass.value=M.map.texture,d.uniforms.resolution.value=M.mapSize,d.uniforms.radius.value=M.radius,n.setRenderTarget(M.mapPass),n.clear(),n.renderBufferDirect(S,null,R,d,g,null),f.uniforms.shadow_pass.value=M.mapPass.texture,f.uniforms.resolution.value=M.mapSize,f.uniforms.radius.value=M.radius,n.setRenderTarget(M.map),n.clear(),n.renderBufferDirect(S,null,R,f,g,null)}function y(M,S,R,_){let I=null;const D=R.isPointLight===!0?M.customDistanceMaterial:M.customDepthMaterial;if(D!==void 0)I=D;else if(I=R.isPointLight===!0?l:a,n.localClippingEnabled&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0||S.map&&S.alphaTest>0){const Q=I.uuid,N=S.uuid;let z=c[Q];z===void 0&&(z={},c[Q]=z);let $=z[N];$===void 0&&($=I.clone(),z[N]=$,S.addEventListener("dispose",w)),I=$}if(I.visible=S.visible,I.wireframe=S.wireframe,_===ii?I.side=S.shadowSide!==null?S.shadowSide:S.side:I.side=S.shadowSide!==null?S.shadowSide:u[S.side],I.alphaMap=S.alphaMap,I.alphaTest=S.alphaTest,I.map=S.map,I.clipShadows=S.clipShadows,I.clippingPlanes=S.clippingPlanes,I.clipIntersection=S.clipIntersection,I.displacementMap=S.displacementMap,I.displacementScale=S.displacementScale,I.displacementBias=S.displacementBias,I.wireframeLinewidth=S.wireframeLinewidth,I.linewidth=S.linewidth,R.isPointLight===!0&&I.isMeshDistanceMaterial===!0){const Q=n.properties.get(I);Q.light=R}return I}function b(M,S,R,_,I){if(M.visible===!1)return;if(M.layers.test(S.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&I===ii)&&(!M.frustumCulled||i.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,M.matrixWorld);const N=e.update(M),z=M.material;if(Array.isArray(z)){const $=N.groups;for(let H=0,K=$.length;H<K;H++){const Y=$[H],ee=z[Y.materialIndex];if(ee&&ee.visible){const pe=y(M,ee,_,I);M.onBeforeShadow(n,M,S,R,N,pe,Y),n.renderBufferDirect(R,null,N,pe,M,Y),M.onAfterShadow(n,M,S,R,N,pe,Y)}}}else if(z.visible){const $=y(M,z,_,I);M.onBeforeShadow(n,M,S,R,N,$,null),n.renderBufferDirect(R,null,N,$,M,null),M.onAfterShadow(n,M,S,R,N,$,null)}}const Q=M.children;for(let N=0,z=Q.length;N<z;N++)b(Q[N],S,R,_,I)}function w(M){M.target.removeEventListener("dispose",w);for(const R in c){const _=c[R],I=M.target.uuid;I in _&&(_[I].dispose(),delete _[I])}}}const oI={[Zl]:$l,[ec]:ic,[tc]:rc,[Wr]:nc,[$l]:Zl,[ic]:ec,[rc]:tc,[nc]:Wr};function aI(n,e){function t(){let G=!1;const ae=new mt;let xe=null;const Te=new mt(0,0,0,0);return{setMask:function(Se){xe!==Se&&!G&&(n.colorMask(Se,Se,Se,Se),xe=Se)},setLocked:function(Se){G=Se},setClear:function(Se,Ue,Ke,Ie,Be){Be===!0&&(Se*=Ie,Ue*=Ie,Ke*=Ie),ae.set(Se,Ue,Ke,Ie),Te.equals(ae)===!1&&(n.clearColor(Se,Ue,Ke,Ie),Te.copy(ae))},reset:function(){G=!1,xe=null,Te.set(-1,0,0,0)}}}function i(){let G=!1,ae=!1,xe=null,Te=null,Se=null;return{setReversed:function(Ue){if(ae!==Ue){const Ke=e.get("EXT_clip_control");ae?Ke.clipControlEXT(Ke.LOWER_LEFT_EXT,Ke.ZERO_TO_ONE_EXT):Ke.clipControlEXT(Ke.LOWER_LEFT_EXT,Ke.NEGATIVE_ONE_TO_ONE_EXT);const Ie=Se;Se=null,this.setClear(Ie)}ae=Ue},getReversed:function(){return ae},setTest:function(Ue){Ue?se(n.DEPTH_TEST):X(n.DEPTH_TEST)},setMask:function(Ue){xe!==Ue&&!G&&(n.depthMask(Ue),xe=Ue)},setFunc:function(Ue){if(ae&&(Ue=oI[Ue]),Te!==Ue){switch(Ue){case Zl:n.depthFunc(n.NEVER);break;case $l:n.depthFunc(n.ALWAYS);break;case ec:n.depthFunc(n.LESS);break;case Wr:n.depthFunc(n.LEQUAL);break;case tc:n.depthFunc(n.EQUAL);break;case nc:n.depthFunc(n.GEQUAL);break;case ic:n.depthFunc(n.GREATER);break;case rc:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Te=Ue}},setLocked:function(Ue){G=Ue},setClear:function(Ue){Se!==Ue&&(ae&&(Ue=1-Ue),n.clearDepth(Ue),Se=Ue)},reset:function(){G=!1,xe=null,Te=null,Se=null,ae=!1}}}function r(){let G=!1,ae=null,xe=null,Te=null,Se=null,Ue=null,Ke=null,Ie=null,Be=null;return{setTest:function(ze){G||(ze?se(n.STENCIL_TEST):X(n.STENCIL_TEST))},setMask:function(ze){ae!==ze&&!G&&(n.stencilMask(ze),ae=ze)},setFunc:function(ze,ut,Nt){(xe!==ze||Te!==ut||Se!==Nt)&&(n.stencilFunc(ze,ut,Nt),xe=ze,Te=ut,Se=Nt)},setOp:function(ze,ut,Nt){(Ue!==ze||Ke!==ut||Ie!==Nt)&&(n.stencilOp(ze,ut,Nt),Ue=ze,Ke=ut,Ie=Nt)},setLocked:function(ze){G=ze},setClear:function(ze){Be!==ze&&(n.clearStencil(ze),Be=ze)},reset:function(){G=!1,ae=null,xe=null,Te=null,Se=null,Ue=null,Ke=null,Ie=null,Be=null}}}const s=new t,o=new i,a=new r,l=new WeakMap,c=new WeakMap;let h={},u={},d=new WeakMap,f=[],A=null,g=!1,m=null,p=null,v=null,y=null,b=null,w=null,M=null,S=new De(0,0,0),R=0,_=!1,I=null,D=null,Q=null,N=null,z=null;const $=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,K=0;const Y=n.getParameter(n.VERSION);Y.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(Y)[1]),H=K>=1):Y.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),H=K>=2);let ee=null,pe={};const be=n.getParameter(n.SCISSOR_BOX),Ce=n.getParameter(n.VIEWPORT),Pe=new mt().fromArray(be),Me=new mt().fromArray(Ce);function te(G,ae,xe,Te){const Se=new Uint8Array(4),Ue=n.createTexture();n.bindTexture(G,Ue),n.texParameteri(G,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(G,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ke=0;Ke<xe;Ke++)G===n.TEXTURE_3D||G===n.TEXTURE_2D_ARRAY?n.texImage3D(ae,0,n.RGBA,1,1,Te,0,n.RGBA,n.UNSIGNED_BYTE,Se):n.texImage2D(ae+Ke,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Se);return Ue}const Ae={};Ae[n.TEXTURE_2D]=te(n.TEXTURE_2D,n.TEXTURE_2D,1),Ae[n.TEXTURE_CUBE_MAP]=te(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ae[n.TEXTURE_2D_ARRAY]=te(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Ae[n.TEXTURE_3D]=te(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),se(n.DEPTH_TEST),o.setFunc(Wr),me(!1),ye(Rd),se(n.CULL_FACE),ce(Bi);function se(G){h[G]!==!0&&(n.enable(G),h[G]=!0)}function X(G){h[G]!==!1&&(n.disable(G),h[G]=!1)}function he(G,ae){return u[G]!==ae?(n.bindFramebuffer(G,ae),u[G]=ae,G===n.DRAW_FRAMEBUFFER&&(u[n.FRAMEBUFFER]=ae),G===n.FRAMEBUFFER&&(u[n.DRAW_FRAMEBUFFER]=ae),!0):!1}function ue(G,ae){let xe=f,Te=!1;if(G){xe=d.get(ae),xe===void 0&&(xe=[],d.set(ae,xe));const Se=G.textures;if(xe.length!==Se.length||xe[0]!==n.COLOR_ATTACHMENT0){for(let Ue=0,Ke=Se.length;Ue<Ke;Ue++)xe[Ue]=n.COLOR_ATTACHMENT0+Ue;xe.length=Se.length,Te=!0}}else xe[0]!==n.BACK&&(xe[0]=n.BACK,Te=!0);Te&&n.drawBuffers(xe)}function ve(G){return A!==G?(n.useProgram(G),A=G,!0):!1}const ne={[Zi]:n.FUNC_ADD,[q0]:n.FUNC_SUBTRACT,[j0]:n.FUNC_REVERSE_SUBTRACT};ne[X0]=n.MIN,ne[Y0]=n.MAX;const le={[K0]:n.ZERO,[J0]:n.ONE,[Z0]:n.SRC_COLOR,[Kl]:n.SRC_ALPHA,[rv]:n.SRC_ALPHA_SATURATE,[nv]:n.DST_COLOR,[ev]:n.DST_ALPHA,[$0]:n.ONE_MINUS_SRC_COLOR,[Jl]:n.ONE_MINUS_SRC_ALPHA,[iv]:n.ONE_MINUS_DST_COLOR,[tv]:n.ONE_MINUS_DST_ALPHA,[sv]:n.CONSTANT_COLOR,[ov]:n.ONE_MINUS_CONSTANT_COLOR,[av]:n.CONSTANT_ALPHA,[lv]:n.ONE_MINUS_CONSTANT_ALPHA};function ce(G,ae,xe,Te,Se,Ue,Ke,Ie,Be,ze){if(G===Bi){g===!0&&(X(n.BLEND),g=!1);return}if(g===!1&&(se(n.BLEND),g=!0),G!==W0){if(G!==m||ze!==_){if((p!==Zi||b!==Zi)&&(n.blendEquation(n.FUNC_ADD),p=Zi,b=Zi),ze)switch(G){case Gr:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Ld:n.blendFunc(n.ONE,n.ONE);break;case Dd:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Pd:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Gr:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Ld:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case Dd:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Pd:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}v=null,y=null,w=null,M=null,S.set(0,0,0),R=0,m=G,_=ze}return}Se=Se||ae,Ue=Ue||xe,Ke=Ke||Te,(ae!==p||Se!==b)&&(n.blendEquationSeparate(ne[ae],ne[Se]),p=ae,b=Se),(xe!==v||Te!==y||Ue!==w||Ke!==M)&&(n.blendFuncSeparate(le[xe],le[Te],le[Ue],le[Ke]),v=xe,y=Te,w=Ue,M=Ke),(Ie.equals(S)===!1||Be!==R)&&(n.blendColor(Ie.r,Ie.g,Ie.b,Be),S.copy(Ie),R=Be),m=G,_=!1}function O(G,ae){G.side===si?X(n.CULL_FACE):se(n.CULL_FACE);let xe=G.side===An;ae&&(xe=!xe),me(xe),G.blending===Gr&&G.transparent===!1?ce(Bi):ce(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.blendColor,G.blendAlpha,G.premultipliedAlpha),o.setFunc(G.depthFunc),o.setTest(G.depthTest),o.setMask(G.depthWrite),s.setMask(G.colorWrite);const Te=G.stencilWrite;a.setTest(Te),Te&&(a.setMask(G.stencilWriteMask),a.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),a.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),C(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?se(n.SAMPLE_ALPHA_TO_COVERAGE):X(n.SAMPLE_ALPHA_TO_COVERAGE)}function me(G){I!==G&&(G?n.frontFace(n.CW):n.frontFace(n.CCW),I=G)}function ye(G){G!==z0?(se(n.CULL_FACE),G!==D&&(G===Rd?n.cullFace(n.BACK):G===H0?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):X(n.CULL_FACE),D=G}function x(G){G!==Q&&(H&&n.lineWidth(G),Q=G)}function C(G,ae,xe){G?(se(n.POLYGON_OFFSET_FILL),(N!==ae||z!==xe)&&(n.polygonOffset(ae,xe),N=ae,z=xe)):X(n.POLYGON_OFFSET_FILL)}function T(G){G?se(n.SCISSOR_TEST):X(n.SCISSOR_TEST)}function U(G){G===void 0&&(G=n.TEXTURE0+$-1),ee!==G&&(n.activeTexture(G),ee=G)}function k(G,ae,xe){xe===void 0&&(ee===null?xe=n.TEXTURE0+$-1:xe=ee);let Te=pe[xe];Te===void 0&&(Te={type:void 0,texture:void 0},pe[xe]=Te),(Te.type!==G||Te.texture!==ae)&&(ee!==xe&&(n.activeTexture(xe),ee=xe),n.bindTexture(G,ae||Ae[G]),Te.type=G,Te.texture=ae)}function j(){const G=pe[ee];G!==void 0&&G.type!==void 0&&(n.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function ie(){try{n.compressedTexImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ke(){try{n.compressedTexImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function P(){try{n.texSubImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function B(){try{n.texSubImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function V(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function re(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function de(){try{n.texStorage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function oe(){try{n.texStorage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Fe(){try{n.texImage2D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Ee(){try{n.texImage3D.apply(n,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Le(G){Pe.equals(G)===!1&&(n.scissor(G.x,G.y,G.z,G.w),Pe.copy(G))}function nt(G){Me.equals(G)===!1&&(n.viewport(G.x,G.y,G.z,G.w),Me.copy(G))}function we(G,ae){let xe=c.get(ae);xe===void 0&&(xe=new WeakMap,c.set(ae,xe));let Te=xe.get(G);Te===void 0&&(Te=n.getUniformBlockIndex(ae,G.name),xe.set(G,Te))}function Ve(G,ae){const Te=c.get(ae).get(G);l.get(ae)!==Te&&(n.uniformBlockBinding(ae,Te,G.__bindingPointIndex),l.set(ae,Te))}function at(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),o.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),h={},ee=null,pe={},u={},d=new WeakMap,f=[],A=null,g=!1,m=null,p=null,v=null,y=null,b=null,w=null,M=null,S=new De(0,0,0),R=0,_=!1,I=null,D=null,Q=null,N=null,z=null,Pe.set(0,0,n.canvas.width,n.canvas.height),Me.set(0,0,n.canvas.width,n.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:se,disable:X,bindFramebuffer:he,drawBuffers:ue,useProgram:ve,setBlending:ce,setMaterial:O,setFlipSided:me,setCullFace:ye,setLineWidth:x,setPolygonOffset:C,setScissorTest:T,activeTexture:U,bindTexture:k,unbindTexture:j,compressedTexImage2D:ie,compressedTexImage3D:ke,texImage2D:Fe,texImage3D:Ee,updateUBOMapping:we,uniformBlockBinding:Ve,texStorage2D:de,texStorage3D:oe,texSubImage2D:P,texSubImage3D:B,compressedTexSubImage2D:V,compressedTexSubImage3D:re,scissor:Le,viewport:nt,reset:at}}function lI(n,e,t,i,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=e.has("OCULUS_multiview")?e.get("OCULUS_multiview"):null,h=new fe,u=new WeakMap;let d;const f=new WeakMap;let A=[],g=!1,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(P,B){return m?new OffscreenCanvas(P,B):qo("canvas")}function v(P,B,V){let re=1;const de=ke(P);if((de.width>V||de.height>V)&&(re=V/Math.max(de.width,de.height)),re<1)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap||typeof VideoFrame<"u"&&P instanceof VideoFrame){const oe=Math.floor(re*de.width),Fe=Math.floor(re*de.height);d===void 0&&(d=p(oe,Fe));const Ee=B?p(oe,Fe):d;return Ee.width=oe,Ee.height=Fe,Ee.getContext("2d").drawImage(P,0,0,oe,Fe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+de.width+"x"+de.height+") to ("+oe+"x"+Fe+")."),Ee}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+de.width+"x"+de.height+")."),P;return P}function y(P){return P.generateMipmaps}function b(P){n.generateMipmap(P)}function w(P){return P.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:P.isWebGL3DRenderTarget?n.TEXTURE_3D:P.isWebGLArrayRenderTarget||P.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function M(P,B,V,re,de=!1){if(P!==null){if(n[P]!==void 0)return n[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let oe=B;if(B===n.RED&&(V===n.FLOAT&&(oe=n.R32F),V===n.HALF_FLOAT&&(oe=n.R16F),V===n.UNSIGNED_BYTE&&(oe=n.R8)),B===n.RED_INTEGER&&(V===n.UNSIGNED_BYTE&&(oe=n.R8UI),V===n.UNSIGNED_SHORT&&(oe=n.R16UI),V===n.UNSIGNED_INT&&(oe=n.R32UI),V===n.BYTE&&(oe=n.R8I),V===n.SHORT&&(oe=n.R16I),V===n.INT&&(oe=n.R32I)),B===n.RG&&(V===n.FLOAT&&(oe=n.RG32F),V===n.HALF_FLOAT&&(oe=n.RG16F),V===n.UNSIGNED_BYTE&&(oe=n.RG8)),B===n.RG_INTEGER&&(V===n.UNSIGNED_BYTE&&(oe=n.RG8UI),V===n.UNSIGNED_SHORT&&(oe=n.RG16UI),V===n.UNSIGNED_INT&&(oe=n.RG32UI),V===n.BYTE&&(oe=n.RG8I),V===n.SHORT&&(oe=n.RG16I),V===n.INT&&(oe=n.RG32I)),B===n.RGB_INTEGER&&(V===n.UNSIGNED_BYTE&&(oe=n.RGB8UI),V===n.UNSIGNED_SHORT&&(oe=n.RGB16UI),V===n.UNSIGNED_INT&&(oe=n.RGB32UI),V===n.BYTE&&(oe=n.RGB8I),V===n.SHORT&&(oe=n.RGB16I),V===n.INT&&(oe=n.RGB32I)),B===n.RGBA_INTEGER&&(V===n.UNSIGNED_BYTE&&(oe=n.RGBA8UI),V===n.UNSIGNED_SHORT&&(oe=n.RGBA16UI),V===n.UNSIGNED_INT&&(oe=n.RGBA32UI),V===n.BYTE&&(oe=n.RGBA8I),V===n.SHORT&&(oe=n.RGBA16I),V===n.INT&&(oe=n.RGBA32I)),B===n.RGB&&V===n.UNSIGNED_INT_5_9_9_9_REV&&(oe=n.RGB9_E5),B===n.RGBA){const Fe=de?Ho:ht.getTransfer(re);V===n.FLOAT&&(oe=n.RGBA32F),V===n.HALF_FLOAT&&(oe=n.RGBA16F),V===n.UNSIGNED_BYTE&&(oe=Fe===bt?n.SRGB8_ALPHA8:n.RGBA8),V===n.UNSIGNED_SHORT_4_4_4_4&&(oe=n.RGBA4),V===n.UNSIGNED_SHORT_5_5_5_1&&(oe=n.RGB5_A1)}return(oe===n.R16F||oe===n.R32F||oe===n.RG16F||oe===n.RG32F||oe===n.RGBA16F||oe===n.RGBA32F)&&e.get("EXT_color_buffer_float"),oe}function S(P,B){let V;return P?B===null||B===Fi||B===$i?V=n.DEPTH24_STENCIL8:B===un?V=n.DEPTH32F_STENCIL8:B===Us&&(V=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):B===null||B===Fi||B===$i?V=n.DEPTH_COMPONENT24:B===un?V=n.DEPTH_COMPONENT32F:B===Us&&(V=n.DEPTH_COMPONENT16),V}function R(P,B){return y(P)===!0||P.isFramebufferTexture&&P.minFilter!==Zt&&P.minFilter!==Ht?Math.log2(Math.max(B.width,B.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?B.mipmaps.length:1}function _(P){const B=P.target;B.removeEventListener("dispose",_),D(B),B.isVideoTexture&&u.delete(B)}function I(P){const B=P.target;B.removeEventListener("dispose",I),N(B)}function D(P){const B=i.get(P);if(B.__webglInit===void 0)return;const V=P.source,re=f.get(V);if(re){const de=re[B.__cacheKey];de.usedTimes--,de.usedTimes===0&&Q(P),Object.keys(re).length===0&&f.delete(V)}i.remove(P)}function Q(P){const B=i.get(P);n.deleteTexture(B.__webglTexture);const V=P.source,re=f.get(V);delete re[B.__cacheKey],o.memory.textures--}function N(P){const B=i.get(P);if(P.depthTexture&&(P.depthTexture.dispose(),i.remove(P.depthTexture)),P.isWebGLCubeRenderTarget)for(let re=0;re<6;re++){if(Array.isArray(B.__webglFramebuffer[re]))for(let de=0;de<B.__webglFramebuffer[re].length;de++)n.deleteFramebuffer(B.__webglFramebuffer[re][de]);else n.deleteFramebuffer(B.__webglFramebuffer[re]);B.__webglDepthbuffer&&n.deleteRenderbuffer(B.__webglDepthbuffer[re])}else{if(Array.isArray(B.__webglFramebuffer))for(let re=0;re<B.__webglFramebuffer.length;re++)n.deleteFramebuffer(B.__webglFramebuffer[re]);else n.deleteFramebuffer(B.__webglFramebuffer);if(B.__webglDepthbuffer&&n.deleteRenderbuffer(B.__webglDepthbuffer),B.__webglMultisampledFramebuffer&&n.deleteFramebuffer(B.__webglMultisampledFramebuffer),B.__webglColorRenderbuffer)for(let re=0;re<B.__webglColorRenderbuffer.length;re++)B.__webglColorRenderbuffer[re]&&n.deleteRenderbuffer(B.__webglColorRenderbuffer[re]);B.__webglDepthRenderbuffer&&n.deleteRenderbuffer(B.__webglDepthRenderbuffer)}const V=P.textures;for(let re=0,de=V.length;re<de;re++){const oe=i.get(V[re]);oe.__webglTexture&&(n.deleteTexture(oe.__webglTexture),o.memory.textures--),i.remove(V[re])}i.remove(P)}let z=0;function $(){z=0}function H(){const P=z;return P>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+r.maxTextures),z+=1,P}function K(P){const B=[];return B.push(P.wrapS),B.push(P.wrapT),B.push(P.wrapR||0),B.push(P.magFilter),B.push(P.minFilter),B.push(P.anisotropy),B.push(P.internalFormat),B.push(P.format),B.push(P.type),B.push(P.generateMipmaps),B.push(P.premultiplyAlpha),B.push(P.flipY),B.push(P.unpackAlignment),B.push(P.colorSpace),B.join()}function Y(P,B){const V=i.get(P);if(P.isVideoTexture&&j(P),P.isRenderTargetTexture===!1&&P.version>0&&V.__version!==P.version){const re=P.image;if(re===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(re.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else if(he(V,P,B))return}t.bindTexture(n.TEXTURE_2D,V.__webglTexture,n.TEXTURE0+B)}function ee(P,B){const V=i.get(P);if(P.version>0&&V.__version!==P.version){he(V,P,B);return}t.bindTexture(n.TEXTURE_2D_ARRAY,V.__webglTexture,n.TEXTURE0+B)}function pe(P,B){const V=i.get(P);if(P.version>0&&V.__version!==P.version){he(V,P,B);return}t.bindTexture(n.TEXTURE_3D,V.__webglTexture,n.TEXTURE0+B)}function be(P,B){const V=i.get(P);if(P.version>0&&V.__version!==P.version){ue(V,P,B);return}t.bindTexture(n.TEXTURE_CUBE_MAP,V.__webglTexture,n.TEXTURE0+B)}const Ce={[No]:n.REPEAT,[On]:n.CLAMP_TO_EDGE,[Qo]:n.MIRRORED_REPEAT},Pe={[Zt]:n.NEAREST,[Tf]:n.NEAREST_MIPMAP_NEAREST,[Ss]:n.NEAREST_MIPMAP_LINEAR,[Ht]:n.LINEAR,[_o]:n.LINEAR_MIPMAP_NEAREST,[oi]:n.LINEAR_MIPMAP_LINEAR},Me={[_v]:n.NEVER,[Rv]:n.ALWAYS,[Mv]:n.LESS,[Gf]:n.LEQUAL,[Sv]:n.EQUAL,[Tv]:n.GEQUAL,[Iv]:n.GREATER,[Bv]:n.NOTEQUAL};function te(P,B){if(B.type===un&&e.has("OES_texture_float_linear")===!1&&(B.magFilter===Ht||B.magFilter===_o||B.magFilter===Ss||B.magFilter===oi||B.minFilter===Ht||B.minFilter===_o||B.minFilter===Ss||B.minFilter===oi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(P,n.TEXTURE_WRAP_S,Ce[B.wrapS]),n.texParameteri(P,n.TEXTURE_WRAP_T,Ce[B.wrapT]),(P===n.TEXTURE_3D||P===n.TEXTURE_2D_ARRAY)&&n.texParameteri(P,n.TEXTURE_WRAP_R,Ce[B.wrapR]),n.texParameteri(P,n.TEXTURE_MAG_FILTER,Pe[B.magFilter]),n.texParameteri(P,n.TEXTURE_MIN_FILTER,Pe[B.minFilter]),B.compareFunction&&(n.texParameteri(P,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(P,n.TEXTURE_COMPARE_FUNC,Me[B.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(B.magFilter===Zt||B.minFilter!==Ss&&B.minFilter!==oi||B.type===un&&e.has("OES_texture_float_linear")===!1)return;if(B.anisotropy>1||i.get(B).__currentAnisotropy){const V=e.get("EXT_texture_filter_anisotropic");n.texParameterf(P,V.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(B.anisotropy,r.getMaxAnisotropy())),i.get(B).__currentAnisotropy=B.anisotropy}}}function Ae(P,B){let V=!1;P.__webglInit===void 0&&(P.__webglInit=!0,B.addEventListener("dispose",_));const re=B.source;let de=f.get(re);de===void 0&&(de={},f.set(re,de));const oe=K(B);if(oe!==P.__cacheKey){de[oe]===void 0&&(de[oe]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,V=!0),de[oe].usedTimes++;const Fe=de[P.__cacheKey];Fe!==void 0&&(de[P.__cacheKey].usedTimes--,Fe.usedTimes===0&&Q(B)),P.__cacheKey=oe,P.__webglTexture=de[oe].texture}return V}function se(P){g=P}function X(){const P=g;g=!1;for(const B of A)he(B.textureProperties,B.texture,B.slot),B.texture.isPendingDeferredUpload=!1;A=[],g=P}function he(P,B,V){if(g)return B.isPendingDeferredUpload||(B.isPendingDeferredUpload=!0,A.push({textureProperties:P,texture:B,slot:V})),!1;let re=n.TEXTURE_2D;(B.isDataArrayTexture||B.isCompressedArrayTexture)&&(re=n.TEXTURE_2D_ARRAY),B.isData3DTexture&&(re=n.TEXTURE_3D);const de=Ae(P,B),oe=B.source;t.bindTexture(re,P.__webglTexture,n.TEXTURE0+V);const Fe=i.get(oe);if(oe.version!==Fe.__version||de===!0){t.activeTexture(n.TEXTURE0+V);const Ee=ht.getPrimaries(ht.workingColorSpace),Le=B.colorSpace===Ci?null:ht.getPrimaries(B.colorSpace),nt=B.colorSpace===Ci||Ee===Le?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,B.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,B.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,nt);let we=v(B.image,!1,r.maxTextureSize);we=ie(B,we);const Ve=s.convert(B.format,B.colorSpace),at=s.convert(B.type);let G=M(B.internalFormat,Ve,at,B.colorSpace,B.isVideoTexture);te(re,B);let ae;const xe=B.mipmaps,Te=B.isVideoTexture!==!0,Se=Fe.__version===void 0||de===!0,Ue=oe.dataReady,Ke=R(B,we);if(B.isDepthTexture)G=S(B.format===tr,B.type),Se&&(Te?t.texStorage2D(n.TEXTURE_2D,1,G,we.width,we.height):t.texImage2D(n.TEXTURE_2D,0,G,we.width,we.height,0,Ve,at,null));else if(B.isDataTexture)if(xe.length>0){Te&&Se&&t.texStorage2D(n.TEXTURE_2D,Ke,G,xe[0].width,xe[0].height);for(let Ie=0,Be=xe.length;Ie<Be;Ie++)ae=xe[Ie],Te?Ue&&t.texSubImage2D(n.TEXTURE_2D,Ie,0,0,ae.width,ae.height,Ve,at,ae.data):t.texImage2D(n.TEXTURE_2D,Ie,G,ae.width,ae.height,0,Ve,at,ae.data);B.generateMipmaps=!1}else Te?(Se&&t.texStorage2D(n.TEXTURE_2D,Ke,G,we.width,we.height),Ue&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,we.width,we.height,Ve,at,we.data)):t.texImage2D(n.TEXTURE_2D,0,G,we.width,we.height,0,Ve,at,we.data);else if(B.isCompressedTexture)if(B.isCompressedArrayTexture){Te&&Se&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ke,G,xe[0].width,xe[0].height,we.depth);for(let Ie=0,Be=xe.length;Ie<Be;Ie++)if(ae=xe[Ie],B.format!==pn)if(Ve!==null)if(Te){if(Ue)if(B.layerUpdates.size>0){const ze=Vd(ae.width,ae.height,B.format,B.type);for(const ut of B.layerUpdates){const Nt=ae.data.subarray(ut*ze/ae.data.BYTES_PER_ELEMENT,(ut+1)*ze/ae.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Ie,0,0,ut,ae.width,ae.height,1,Ve,Nt)}B.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Ie,0,0,0,ae.width,ae.height,we.depth,Ve,ae.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Ie,G,ae.width,ae.height,we.depth,0,ae.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Te?Ue&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Ie,0,0,0,ae.width,ae.height,we.depth,Ve,at,ae.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Ie,G,ae.width,ae.height,we.depth,0,Ve,at,ae.data)}else{Te&&Se&&t.texStorage2D(n.TEXTURE_2D,Ke,G,xe[0].width,xe[0].height);for(let Ie=0,Be=xe.length;Ie<Be;Ie++)ae=xe[Ie],B.format!==pn?Ve!==null?Te?Ue&&t.compressedTexSubImage2D(n.TEXTURE_2D,Ie,0,0,ae.width,ae.height,Ve,ae.data):t.compressedTexImage2D(n.TEXTURE_2D,Ie,G,ae.width,ae.height,0,ae.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Te?Ue&&t.texSubImage2D(n.TEXTURE_2D,Ie,0,0,ae.width,ae.height,Ve,at,ae.data):t.texImage2D(n.TEXTURE_2D,Ie,G,ae.width,ae.height,0,Ve,at,ae.data)}else if(B.isDataArrayTexture)if(Te){if(Se&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ke,G,we.width,we.height,we.depth),Ue)if(B.layerUpdates.size>0){const Ie=Vd(we.width,we.height,B.format,B.type);for(const Be of B.layerUpdates){const ze=we.data.subarray(Be*Ie/we.data.BYTES_PER_ELEMENT,(Be+1)*Ie/we.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Be,we.width,we.height,1,Ve,at,ze)}B.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,we.width,we.height,we.depth,Ve,at,we.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,G,we.width,we.height,we.depth,0,Ve,at,we.data);else if(B.isData3DTexture)Te?(Se&&t.texStorage3D(n.TEXTURE_3D,Ke,G,we.width,we.height,we.depth),Ue&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,we.width,we.height,we.depth,Ve,at,we.data)):t.texImage3D(n.TEXTURE_3D,0,G,we.width,we.height,we.depth,0,Ve,at,we.data);else if(B.isFramebufferTexture){if(Se)if(Te)t.texStorage2D(n.TEXTURE_2D,Ke,G,we.width,we.height);else{let Ie=we.width,Be=we.height;for(let ze=0;ze<Ke;ze++)t.texImage2D(n.TEXTURE_2D,ze,G,Ie,Be,0,Ve,at,null),Ie>>=1,Be>>=1}}else if(xe.length>0){if(Te&&Se){const Ie=ke(xe[0]);t.texStorage2D(n.TEXTURE_2D,Ke,G,Ie.width,Ie.height)}for(let Ie=0,Be=xe.length;Ie<Be;Ie++)ae=xe[Ie],Te?Ue&&t.texSubImage2D(n.TEXTURE_2D,Ie,0,0,Ve,at,ae):t.texImage2D(n.TEXTURE_2D,Ie,G,Ve,at,ae);B.generateMipmaps=!1}else if(Te){if(Se){const Ie=ke(we);t.texStorage2D(n.TEXTURE_2D,Ke,G,Ie.width,Ie.height)}Ue&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Ve,at,we)}else t.texImage2D(n.TEXTURE_2D,0,G,Ve,at,we);y(B)&&b(re),Fe.__version=oe.version,B.onUpdate&&B.onUpdate(B)}return P.__version=B.version,!0}function ue(P,B,V){if(B.image.length!==6)return;const re=Ae(P,B),de=B.source;t.bindTexture(n.TEXTURE_CUBE_MAP,P.__webglTexture,n.TEXTURE0+V);const oe=i.get(de);if(de.version!==oe.__version||re===!0){t.activeTexture(n.TEXTURE0+V);const Fe=ht.getPrimaries(ht.workingColorSpace),Ee=B.colorSpace===Ci?null:ht.getPrimaries(B.colorSpace),Le=B.colorSpace===Ci||Fe===Ee?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,B.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,B.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);const nt=B.isCompressedTexture||B.image[0].isCompressedTexture,we=B.image[0]&&B.image[0].isDataTexture,Ve=[];for(let Be=0;Be<6;Be++)!nt&&!we?Ve[Be]=v(B.image[Be],!0,r.maxCubemapSize):Ve[Be]=we?B.image[Be].image:B.image[Be],Ve[Be]=ie(B,Ve[Be]);const at=Ve[0],G=s.convert(B.format,B.colorSpace),ae=s.convert(B.type),xe=M(B.internalFormat,G,ae,B.colorSpace),Te=B.isVideoTexture!==!0,Se=oe.__version===void 0||re===!0,Ue=de.dataReady;let Ke=R(B,at);te(n.TEXTURE_CUBE_MAP,B);let Ie;if(nt){Te&&Se&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Ke,xe,at.width,at.height);for(let Be=0;Be<6;Be++){Ie=Ve[Be].mipmaps;for(let ze=0;ze<Ie.length;ze++){const ut=Ie[ze];B.format!==pn?G!==null?Te?Ue&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ze,0,0,ut.width,ut.height,G,ut.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ze,xe,ut.width,ut.height,0,ut.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Te?Ue&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ze,0,0,ut.width,ut.height,G,ae,ut.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ze,xe,ut.width,ut.height,0,G,ae,ut.data)}}}else{if(Ie=B.mipmaps,Te&&Se){Ie.length>0&&Ke++;const Be=ke(Ve[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Ke,xe,Be.width,Be.height)}for(let Be=0;Be<6;Be++)if(we){Te?Ue&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,Ve[Be].width,Ve[Be].height,G,ae,Ve[Be].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,xe,Ve[Be].width,Ve[Be].height,0,G,ae,Ve[Be].data);for(let ze=0;ze<Ie.length;ze++){const Nt=Ie[ze].image[Be].image;Te?Ue&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ze+1,0,0,Nt.width,Nt.height,G,ae,Nt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ze+1,xe,Nt.width,Nt.height,0,G,ae,Nt.data)}}else{Te?Ue&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,G,ae,Ve[Be]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,xe,G,ae,Ve[Be]);for(let ze=0;ze<Ie.length;ze++){const ut=Ie[ze];Te?Ue&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ze+1,0,0,G,ae,ut.image[Be]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,ze+1,xe,G,ae,ut.image[Be])}}}y(B)&&b(n.TEXTURE_CUBE_MAP),oe.__version=de.version,B.onUpdate&&B.onUpdate(B)}P.__version=B.version}function ve(P,B,V,re,de,oe){const Fe=s.convert(V.format,V.colorSpace),Ee=s.convert(V.type),Le=M(V.internalFormat,Fe,Ee,V.colorSpace),nt=i.get(B),we=i.get(V);if(we.__renderTarget=B,!nt.__hasExternalTextures){const at=Math.max(1,B.width>>oe),G=Math.max(1,B.height>>oe);B.isWebGLMultiviewRenderTarget===!0?t.texStorage3D(n.TEXTURE_2D_ARRAY,0,Le,B.width,B.height,B.numViews):de===n.TEXTURE_3D||de===n.TEXTURE_2D_ARRAY?t.texImage3D(de,oe,Le,at,G,B.depth,0,Fe,Ee,null):t.texImage2D(de,oe,Le,at,G,0,Fe,Ee,null)}t.bindFramebuffer(n.FRAMEBUFFER,P);const Ve=k(B);B.isWebGLMultiviewRenderTarget===!0?Ve?c.framebufferTextureMultisampleMultiviewOVR(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,we.__webglTexture,0,U(B),0,B.numViews):c.framebufferTextureMultiviewOVR(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,we.__webglTexture,0,0,B.numViews):(de===n.TEXTURE_2D||de>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&de<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&(Ve?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,re,de,we.__webglTexture,0,U(B)):n.framebufferTexture2D(n.FRAMEBUFFER,re,de,we.__webglTexture,oe)),t.bindFramebuffer(n.FRAMEBUFFER,null)}function ne(P,B,V){if(n.bindRenderbuffer(n.RENDERBUFFER,P),B.isWebGLMultiviewRenderTarget===!0){const re=k(B),de=B.numViews,oe=B.depthTexture;let Fe=n.DEPTH_COMPONENT24,Ee=n.DEPTH_ATTACHMENT;oe&&oe.isDepthTexture&&(oe.type===un?Fe=n.DEPTH_COMPONENT32F:oe.type===$i&&(Fe=n.DEPTH24_STENCIL8,Ee=n.DEPTH_STENCIL_ATTACHMENT));let Le=i.get(B.depthTexture).__webglTexture;Le===void 0&&(Le=n.createTexture(),n.bindTexture(n.TEXTURE_2D_ARRAY,Le),n.texStorage3D(n.TEXTURE_2D_ARRAY,1,Fe,B.width,B.height,de)),re?c.framebufferTextureMultisampleMultiviewOVR(n.FRAMEBUFFER,Ee,Le,0,U(B),0,de):c.framebufferTextureMultiviewOVR(n.FRAMEBUFFER,Ee,Le,0,0,de)}else if(B.depthBuffer){const re=B.depthTexture,de=re&&re.isDepthTexture?re.type:null,oe=S(B.stencilBuffer,de),Fe=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ee=U(B);k(B)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ee,oe,B.width,B.height):V?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ee,oe,B.width,B.height):n.renderbufferStorage(n.RENDERBUFFER,oe,B.width,B.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Fe,n.RENDERBUFFER,P)}else{const re=B.textures;for(let de=0;de<re.length;de++){const oe=re[de],Fe=s.convert(oe.format,oe.colorSpace),Ee=s.convert(oe.type),Le=M(oe.internalFormat,Fe,Ee,oe.colorSpace),nt=U(B);V&&k(B)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,nt,Le,B.width,B.height):k(B)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,nt,Le,B.width,B.height):n.renderbufferStorage(n.RENDERBUFFER,Le,B.width,B.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function le(P,B){if(B&&B.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,P),!(B.depthTexture&&B.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const re=i.get(B.depthTexture);re.__renderTarget=B,(!re.__webglTexture||B.depthTexture.image.width!==B.width||B.depthTexture.image.height!==B.height)&&(B.depthTexture.image.width=B.width,B.depthTexture.image.height=B.height,B.depthTexture.needsUpdate=!0),B.depthTexture.image.depth!=1?ee(B.depthTexture,0):Y(B.depthTexture,0);const de=re.__webglTexture,oe=U(B);if(B.isWebGLMultiviewRenderTarget===!0){const Fe=k(B),Ee=B.numViews;if(B.depthTexture.format===er)Fe?c.framebufferTextureMultisampleMultiviewOVR(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,de,0,oe,0,Ee):c.framebufferTextureMultiviewOVR(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,de,0,0,Ee);else if(B.depthTexture.format===tr)Fe?c.framebufferTextureMultisampleMultiviewOVR(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,de,0,oe,0,Ee):c.framebufferTextureMultiviewOVR(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,de,0,0,Ee);else throw new Error("Unknown depthTexture format")}else if(B.depthTexture.format===er)k(B)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,de,0,oe):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,de,0);else if(B.depthTexture.format===tr)k(B)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,de,0,oe):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,de,0);else throw new Error("Unknown depthTexture format")}function ce(P){const B=i.get(P),V=P.isWebGLCubeRenderTarget===!0;if(B.__boundDepthTexture!==P.depthTexture){const re=P.depthTexture;if(B.__depthDisposeCallback&&B.__depthDisposeCallback(),re){const de=()=>{delete B.__boundDepthTexture,delete B.__depthDisposeCallback,re.removeEventListener("dispose",de)};re.addEventListener("dispose",de),B.__depthDisposeCallback=de}B.__boundDepthTexture=re}if(P.depthTexture&&!B.__autoAllocateDepthBuffer){if(V)throw new Error("target.depthTexture not supported in Cube render targets");le(B.__webglFramebuffer,P)}else if(V){B.__webglDepthbuffer=[];for(let re=0;re<6;re++)if(t.bindFramebuffer(n.FRAMEBUFFER,B.__webglFramebuffer[re]),B.__webglDepthbuffer[re]===void 0)B.__webglDepthbuffer[re]=n.createRenderbuffer(),ne(B.__webglDepthbuffer[re],P,!1);else{const de=P.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,oe=B.__webglDepthbuffer[re];n.bindRenderbuffer(n.RENDERBUFFER,oe),n.framebufferRenderbuffer(n.FRAMEBUFFER,de,n.RENDERBUFFER,oe)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,B.__webglFramebuffer),B.__webglDepthbuffer===void 0)B.__webglDepthbuffer=n.createRenderbuffer(),ne(B.__webglDepthbuffer,P,!1);else{const re=P.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,de=B.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,de),n.framebufferRenderbuffer(n.FRAMEBUFFER,re,n.RENDERBUFFER,de)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function O(P,B,V){const re=i.get(P);B!==void 0&&ve(re.__webglFramebuffer,P,P.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),V!==void 0&&ce(P)}function me(P){const B=P.texture,V=i.get(P),re=i.get(B);P.addEventListener("dispose",I);const de=P.textures,oe=P.isWebGLCubeRenderTarget===!0,Fe=de.length>1;if(Fe||(re.__webglTexture===void 0&&(re.__webglTexture=n.createTexture()),re.__version=B.version,o.memory.textures++),oe){V.__webglFramebuffer=[];for(let Ee=0;Ee<6;Ee++)if(B.mipmaps&&B.mipmaps.length>0){V.__webglFramebuffer[Ee]=[];for(let Le=0;Le<B.mipmaps.length;Le++)V.__webglFramebuffer[Ee][Le]=n.createFramebuffer()}else V.__webglFramebuffer[Ee]=n.createFramebuffer()}else{if(B.mipmaps&&B.mipmaps.length>0){V.__webglFramebuffer=[];for(let Ee=0;Ee<B.mipmaps.length;Ee++)V.__webglFramebuffer[Ee]=n.createFramebuffer()}else V.__webglFramebuffer=n.createFramebuffer();if(Fe)for(let Ee=0,Le=de.length;Ee<Le;Ee++){const nt=i.get(de[Ee]);nt.__webglTexture===void 0&&(nt.__webglTexture=n.createTexture(),o.memory.textures++)}if(P.samples>0&&k(P)===!1){V.__webglMultisampledFramebuffer=n.createFramebuffer(),V.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,V.__webglMultisampledFramebuffer);for(let Ee=0;Ee<de.length;Ee++){const Le=de[Ee];V.__webglColorRenderbuffer[Ee]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,V.__webglColorRenderbuffer[Ee]);const nt=s.convert(Le.format,Le.colorSpace),we=s.convert(Le.type),Ve=M(Le.internalFormat,nt,we,Le.colorSpace,P.isXRRenderTarget===!0),at=U(P);n.renderbufferStorageMultisample(n.RENDERBUFFER,at,Ve,P.width,P.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ee,n.RENDERBUFFER,V.__webglColorRenderbuffer[Ee])}n.bindRenderbuffer(n.RENDERBUFFER,null),P.depthBuffer&&(V.__webglDepthRenderbuffer=n.createRenderbuffer(),ne(V.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(oe){t.bindTexture(n.TEXTURE_CUBE_MAP,re.__webglTexture),te(n.TEXTURE_CUBE_MAP,B);for(let Ee=0;Ee<6;Ee++)if(B.mipmaps&&B.mipmaps.length>0)for(let Le=0;Le<B.mipmaps.length;Le++)ve(V.__webglFramebuffer[Ee][Le],P,B,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Le);else ve(V.__webglFramebuffer[Ee],P,B,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,0);y(B)&&b(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Fe){for(let Ee=0,Le=de.length;Ee<Le;Ee++){const nt=de[Ee],we=i.get(nt);t.bindTexture(n.TEXTURE_2D,we.__webglTexture),te(n.TEXTURE_2D,nt),ve(V.__webglFramebuffer,P,nt,n.COLOR_ATTACHMENT0+Ee,n.TEXTURE_2D,0),y(nt)&&b(n.TEXTURE_2D)}t.unbindTexture()}else{let Ee=n.TEXTURE_2D;if((P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(Ee=P.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),P.isWebGLMultiviewRenderTarget===!0&&(Ee=n.TEXTURE_2D_ARRAY),t.bindTexture(Ee,re.__webglTexture),te(Ee,B),B.mipmaps&&B.mipmaps.length>0)for(let Le=0;Le<B.mipmaps.length;Le++)ve(V.__webglFramebuffer[Le],P,B,n.COLOR_ATTACHMENT0,Ee,Le);else ve(V.__webglFramebuffer,P,B,n.COLOR_ATTACHMENT0,Ee,0);y(B)&&b(Ee),t.unbindTexture()}(P.depthBuffer||P.isWebGLMultiviewRenderTarget===!0)&&this.setupDepthRenderbuffer(P)}function ye(P){const B=P.textures;for(let V=0,re=B.length;V<re;V++){const de=B[V];if(y(de)){const oe=w(P),Fe=i.get(de).__webglTexture;t.bindTexture(oe,Fe),b(oe),t.unbindTexture()}}}const x=[],C=[];function T(P){if(P.samples>0){if(k(P)===!1){const B=P.textures,V=P.width,re=P.height;let de=n.COLOR_BUFFER_BIT;const oe=P.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Fe=i.get(P),Ee=B.length>1;if(Ee)for(let Le=0;Le<B.length;Le++)t.bindFramebuffer(n.FRAMEBUFFER,Fe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Le,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Fe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Le,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Fe.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Fe.__webglFramebuffer);for(let Le=0;Le<B.length;Le++){if(P.resolveDepthBuffer&&(P.depthBuffer&&(de|=n.DEPTH_BUFFER_BIT),P.stencilBuffer&&P.resolveStencilBuffer&&(de|=n.STENCIL_BUFFER_BIT)),Ee){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Fe.__webglColorRenderbuffer[Le]);const nt=i.get(B[Le]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,nt,0)}n.blitFramebuffer(0,0,V,re,0,0,V,re,de,n.NEAREST),l===!0&&(x.length=0,C.length=0,x.push(n.COLOR_ATTACHMENT0+Le),P.depthBuffer&&P.resolveDepthBuffer===!1&&(x.push(oe),C.push(oe),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,C)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,x))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Ee)for(let Le=0;Le<B.length;Le++){t.bindFramebuffer(n.FRAMEBUFFER,Fe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Le,n.RENDERBUFFER,Fe.__webglColorRenderbuffer[Le]);const nt=i.get(B[Le]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Fe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Le,n.TEXTURE_2D,nt,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Fe.__webglMultisampledFramebuffer)}else if(P.depthBuffer&&P.resolveDepthBuffer===!1&&l){const B=P.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[B])}}}function U(P){return Math.min(r.maxSamples,P.samples)}function k(P){const B=i.get(P);return P.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&B.__useRenderToTexture!==!1}function j(P){const B=o.render.frame;u.get(P)!==B&&(u.set(P,B),P.update())}function ie(P,B){const V=P.colorSpace,re=P.format,de=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||V!==qr&&V!==Ci&&(ht.getTransfer(V)===bt?(re!==pn||de!==hi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",V)),B}function ke(P){return typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement?(h.width=P.naturalWidth||P.width,h.height=P.naturalHeight||P.height):typeof VideoFrame<"u"&&P instanceof VideoFrame?(h.width=P.displayWidth,h.height=P.displayHeight):(h.width=P.width,h.height=P.height),h}this.allocateTextureUnit=H,this.resetTextureUnits=$,this.setTexture2D=Y,this.setTexture2DArray=ee,this.setTexture3D=pe,this.setTextureCube=be,this.rebindTextures=O,this.uploadTexture=he,this.setupRenderTarget=me,this.updateRenderTargetMipmap=ye,this.updateMultisampleRenderTarget=T,this.setupDepthTexture=le,this.setupDepthRenderbuffer=ce,this.setupFrameBufferTexture=ve,this.useMultisampledRTT=k,this.runDeferredUploads=X,this.setDeferTextureUploads=se}function zy(n,e){function t(i,r=Ci){let s;const o=ht.getTransfer(r);if(i===hi)return n.UNSIGNED_BYTE;if(i===eh)return n.UNSIGNED_SHORT_4_4_4_4;if(i===th)return n.UNSIGNED_SHORT_5_5_5_1;if(i===Df)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===Rf)return n.BYTE;if(i===Lf)return n.SHORT;if(i===Us)return n.UNSIGNED_SHORT;if(i===$c)return n.INT;if(i===Fi)return n.UNSIGNED_INT;if(i===un)return n.FLOAT;if(i===zs)return n.HALF_FLOAT;if(i===Pf)return n.ALPHA;if(i===Uf)return n.RGB;if(i===pn)return n.RGBA;if(i===Ff)return n.LUMINANCE;if(i===Of)return n.LUMINANCE_ALPHA;if(i===er)return n.DEPTH_COMPONENT;if(i===tr)return n.DEPTH_STENCIL;if(i===nh)return n.RED;if(i===aa)return n.RED_INTEGER;if(i===kf)return n.RG;if(i===ih)return n.RG_INTEGER;if(i===rh)return n.RGBA_INTEGER;if(i===Mo||i===So||i===Io||i===Bo)if(o===bt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Mo)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===So)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Io)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Bo)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Mo)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===So)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Io)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Bo)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===sc||i===oc||i===ac||i===lc)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===sc)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===oc)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===ac)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===lc)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===cc||i===hc||i===uc)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===cc||i===hc)return o===bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===uc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===dc||i===fc||i===pc||i===Ac||i===mc||i===gc||i===vc||i===yc||i===Ec||i===xc||i===bc||i===Cc||i===wc||i===_c)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===dc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===fc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===pc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Ac)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===mc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===gc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===vc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===yc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ec)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===xc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===bc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Cc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===wc)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===_c)return o===bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===To||i===Mc||i===Sc)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===To)return o===bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Mc)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Sc)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Nf||i===Ic||i===Bc||i===Tc)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===To)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Ic)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Bc)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Tc)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===$i?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class Hy extends Jn{constructor(e,t,i,r={}){super(e,t,r),this.depthBuffer=!1,this.stencilBuffer=!1,this.numViews=i}copy(e){return super.copy(e),this.numViews=e.numViews,this}}Hy.prototype.isWebGLMultiviewRenderTarget=!0;const cI=`
void main() {
gl_Position = vec4( position, 1.0 );
}`,hI=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;
void main() {
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
if ( coord.x >= 1.0 ) {
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
} else {
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
}
}`;class uI{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new Tt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!==i.depthNear||t.depthFar!==i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new Zn({vertexShader:cI,fragmentShader:hI,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new Ws(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class dI extends ui{constructor(e,t,i,r){super();const s=this;let o=null,a=1;var l=null;let c=null,h="local-floor",u=1,d=null,f=null;var A=[];let g=null,m=null,p=null,v=null;const y=new uI,b=t.getContextAttributes();let w=null,M=null;const S=[],R=[],_=new fe;let I=null;const D=new Yt;D.viewport=new mt;const Q=new Yt;Q.viewport=new mt;const N=[D,Q],z=new Ry;let $=null,H=null;this.cameraAutoUpdate=!0,this.layersEnabled=!1,this.enabled=!1,this.isPresenting=!1,this.isMultiview=!1,this.getCameraPose=function(){return f},this.getController=function(X){let he=S[X];return he===void 0&&(he=new Gl,S[X]=he),he.getTargetRaySpace()},this.getControllerGrip=function(X){let he=S[X];return he===void 0&&(he=new Gl,S[X]=he),he.getGripSpace()},this.getHand=function(X){let he=S[X];return he===void 0&&(he=new Gl,S[X]=he),he.getHandSpace()};function K(X){const he=R.indexOf(X.inputSource);if(he===-1)return;const ue=S[he];ue!==void 0&&(ue.update(X.inputSource,X.frame,d||c),ue.dispatchEvent({type:X.type,data:X.inputSource}))}function Y(){o.removeEventListener("select",K),o.removeEventListener("selectstart",K),o.removeEventListener("selectend",K),o.removeEventListener("squeeze",K),o.removeEventListener("squeezestart",K),o.removeEventListener("squeezeend",K),o.removeEventListener("end",Y),o.removeEventListener("inputsourceschange",ee);for(let X=0;X<S.length;X++){const he=R[X];he!==null&&(R[X]=null,S[X].disconnect(he))}$=null,H=null,y.reset(),s.isPresenting=!1,e.setRenderTarget(w),p=null,m=null,g=null,o=null,M=null,se.stop(),e.setPixelRatio(I),e.setSize(_.width,_.height,!1),s.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){a=X,s.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){h=X,s.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||c},this.setReferenceSpace=function(X){d=X},this.getBaseLayer=function(){return m!==null?m:p},this.getBinding=function(){return g},this.getRenderTarget=function(){return M},this.getFrame=function(){return v},this.getSession=function(){return o},this.setSession=async function(X){if(o=X,o!==null){if(w=e.getRenderTarget(),o.addEventListener("select",K),o.addEventListener("selectstart",K),o.addEventListener("selectend",K),o.addEventListener("squeeze",K),o.addEventListener("squeezestart",K),o.addEventListener("squeezeend",K),o.addEventListener("end",Y),o.addEventListener("inputsourceschange",ee),b.xrCompatible!==!0&&await t.makeXRCompatible(),I=e.getPixelRatio(),e.getSize(_),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let ue=null,ve=null,ne=null;b.depth&&(ne=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ue=b.stencil?tr:er,ve=b.stencil?$i:Fi),s.isMultiview=r&&i.has("OCULUS_multiview");const le={colorFormat:t.RGBA8,depthFormat:ne,scaleFactor:a};s.isMultiview&&(le.textureType="texture-array"),g=new XRWebGLBinding(o,t),m=g.createProjectionLayer(le),o.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1);const ce={format:pn,type:hi,depthTexture:new Xf(m.textureWidth,m.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,ue),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1};if(s.isMultiview){const O=i.get("OCULUS_multiview");this.maxNumViews=t.getParameter(O.MAX_VIEWS_OVR),M=new Hy(m.textureWidth,m.textureHeight,2,ce)}else M=new Jn(m.textureWidth,m.textureHeight,ce)}else{const ue={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:a};p=new XRWebGLLayer(o,t,ue),o.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),M=new Jn(p.framebufferWidth,p.framebufferHeight,{format:pn,type:hi,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil})}M.isXRRenderTarget=!0,this.setFoveation(u),d=null,c=await o.requestReferenceSpace(h),se.setContext(o),se.start(),s.isPresenting=!0,s.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(o!==null)return o.environmentBlendMode},this.addLayer=function(X){!window.XRWebGLBinding||!this.layersEnabled||!o||(A.push(X),this.updateLayers())},this.removeLayer=function(X){A.splice(A.indexOf(X),1),!(!window.XRWebGLBinding||!this.layersEnabled||!o)&&this.updateLayers()},this.updateLayers=function(){var X=A.map(function(he){return he});X.unshift(o.renderState.layers[0]),o.updateRenderState({layers:X})},this.getDepthTexture=function(){return y.getDepthTexture()};function ee(X){for(let he=0;he<X.removed.length;he++){const ue=X.removed[he],ve=R.indexOf(ue);ve>=0&&(R[ve]=null,S[ve].disconnect(ue))}for(let he=0;he<X.added.length;he++){const ue=X.added[he];let ve=R.indexOf(ue);if(ve===-1){for(let le=0;le<S.length;le++)if(le>=R.length){R.push(ue),ve=le;break}else if(R[le]===null){R[le]=ue,ve=le;break}if(ve===-1)break}const ne=S[ve];ne&&ne.connect(ue)}}const pe=new F,be=new F;function Ce(X,he,ue){pe.setFromMatrixPosition(he.matrixWorld),be.setFromMatrixPosition(ue.matrixWorld);const ve=pe.distanceTo(be),ne=he.projectionMatrix.elements,le=ue.projectionMatrix.elements,ce=ne[14]/(ne[10]-1),O=ne[14]/(ne[10]+1),me=(ne[9]+1)/ne[5],ye=(ne[9]-1)/ne[5],x=(ne[8]-1)/ne[0],C=(le[8]+1)/le[0],T=ce*x,U=ce*C,k=ve/(-x+C),j=k*-x;if(he.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX(j),X.translateZ(k),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert(),ne[10]===-1)X.projectionMatrix.copy(he.projectionMatrix),X.projectionMatrixInverse.copy(he.projectionMatrixInverse);else{const ie=ce+k,ke=O+k,P=T-j,B=U+(ve-j),V=me*O/ke*ie,re=ye*O/ke*ie;X.projectionMatrix.makePerspective(P,B,V,re,ie,ke),X.projectionMatrixInverse.copy(X.projectionMatrix).invert()}}function Pe(X,he){he===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(he.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.setPoseTarget=function(X){X!==void 0&&(l=X)},this.updateCamera=function(X){if(o===null)return;let he=X.near,ue=X.far;y.texture!==null&&(y.depthNear>0&&(he=y.depthNear),y.depthFar>0&&(ue=y.depthFar)),z.near=Q.near=D.near=he,z.far=Q.far=D.far=ue,($!==z.near||H!==z.far)&&(o.updateRenderState({depthNear:z.near,depthFar:z.far}),$=z.near,H=z.far),D.layers.mask=X.layers.mask|2,Q.layers.mask=X.layers.mask|4,z.layers.mask=D.layers.mask|Q.layers.mask;const ve=z.cameras;var ne=l||X;const le=ne.parent;Pe(z,le);for(let ce=0;ce<ve.length;ce++)Pe(ve[ce],le);ve.length===2?Ce(z,D,Q):z.projectionMatrix.copy(D.projectionMatrix),Me(X,z,ne)};function Me(X,he,ue){he.matrixWorld.decompose(he.position,he.quaternion,he.scale),ue.parent===null?ue.matrix.copy(he.matrixWorld):(ue.matrix.copy(ue.parent.matrixWorld),ue.matrix.invert(),ue.matrix.multiply(he.matrixWorld)),ue.matrix.decompose(ue.position,ue.quaternion,ue.scale),ue.updateMatrixWorld(!0),X.projectionMatrix.copy(he.projectionMatrix),X.projectionMatrixInverse.copy(he.projectionMatrixInverse),X.isPerspectiveCamera&&(X.fov=Fs*2*Math.atan(1/X.projectionMatrix.elements[5]),X.zoom=1)}this.getCamera=function(){return z},this.getFoveation=function(){if(!(m===null&&p===null))return u},this.setFoveation=function(X){u=X,m!==null&&(m.fixedFoveation=X),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=X)},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(z)};let te=null;function Ae(X,he){if(f=he.getViewerPose(d||c),v=he,f!==null){const ue=f.views;p!==null&&(e.setRenderTargetFramebuffer(M,p.framebuffer),e.setRenderTarget(M));let ve=!1;ue.length!==z.cameras.length&&(z.cameras.length=0,ve=!0);for(let ce=0;ce<ue.length;ce++){const O=ue[ce];let me=null;if(p!==null)me=p.getViewport(O);else{const x=g.getViewSubImage(m,O);me=x.viewport,ce===0&&(e.setRenderTargetTextures(M,x.colorTexture,m.ignoreDepthValues?void 0:x.depthStencilTexture),e.setRenderTarget(M))}let ye=N[ce];ye===void 0&&(ye=new Yt,ye.layers.enable(ce),ye.viewport=new mt,N[ce]=ye),ye.matrix.fromArray(O.transform.matrix),ye.matrix.decompose(ye.position,ye.quaternion,ye.scale),ye.projectionMatrix.fromArray(O.projectionMatrix),ye.projectionMatrixInverse.copy(ye.projectionMatrix).invert(),ye.viewport.set(me.x,me.y,me.width,me.height),ce===0&&(z.matrix.copy(ye.matrix),z.matrix.decompose(z.position,z.quaternion,z.scale)),ve===!0&&z.cameras.push(ye)}const ne=o.enabledFeatures;if(ne&&ne.includes("depth-sensing")&&o.depthUsage=="gpu-optimized"&&g){const ce=g.getDepthInformation(ue[0]);ce&&ce.isValid&&ce.texture&&y.init(e,ce,o.renderState)}}for(let ue=0;ue<S.length;ue++){const ve=R[ue],ne=S[ue];ve!==null&&ne!==void 0&&ne.update(ve,he,d||c)}te&&te(X,he),he.detectedPlanes&&s.dispatchEvent({type:"planesdetected",data:he}),v=null}const se=new Oy;se.setAnimationLoop(Ae),this.setAnimationLoop=function(X){te=X},this.dispose=function(){}}}const wr=new Ln,fI=new Ye;function pI(n,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function i(m,p){p.color.getRGB(m.fogColor.value,Fv(n)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function r(m,p,v,y,b){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(m,p):p.isMeshToonMaterial?(s(m,p),u(m,p)):p.isMeshPhongMaterial?(s(m,p),h(m,p)):p.isMeshStandardMaterial?(s(m,p),d(m,p),p.isMeshPhysicalMaterial&&f(m,p,b)):p.isMeshMatcapMaterial?(s(m,p),A(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),g(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(o(m,p),p.isLineDashedMaterial&&a(m,p)):p.isPointsMaterial?l(m,p,v,y):p.isSpriteMaterial?c(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===An&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===An&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const v=e.get(p),y=v.envMap,b=v.envMapRotation;y&&(m.envMap.value=y,wr.copy(b),wr.x*=-1,wr.y*=-1,wr.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(wr.y*=-1,wr.z*=-1),m.envMapRotation.value.setFromMatrix4(fI.makeRotationFromEuler(wr)),m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,v,y){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*v,m.scale.value=y*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,v){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===An&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function A(m,p){p.matcap&&(m.matcap.value=p.matcap)}function g(m,p){const v=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(v.matrixWorld),m.nearDistance.value=v.shadow.camera.near,m.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function AI(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,y){const b=y.program;i.uniformBlockBinding(v,b)}function c(v,y){let b=r[v.id];b===void 0&&(A(v),b=h(v),r[v.id]=b,v.addEventListener("dispose",m));const w=y.program;i.updateUBOMapping(v,w);const M=e.render.frame;s[v.id]!==M&&(d(v),s[v.id]=M)}function h(v){const y=u();v.__bindingPointIndex=y;const b=n.createBuffer(),w=v.__size,M=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,b),n.bufferData(n.UNIFORM_BUFFER,w,M),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,y,b),b}function u(){for(let v=0;v<a;v++)if(o.indexOf(v)===-1)return o.push(v),v;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(v){const y=r[v.id],b=v.uniforms,w=v.__cache;n.bindBuffer(n.UNIFORM_BUFFER,y);for(let M=0,S=b.length;M<S;M++){const R=Array.isArray(b[M])?b[M]:[b[M]];for(let _=0,I=R.length;_<I;_++){const D=R[_];if(f(D,M,_,w)===!0){const Q=D.__offset,N=Array.isArray(D.value)?D.value:[D.value];let z=0;for(let $=0;$<N.length;$++){const H=N[$],K=g(H);typeof H=="number"||typeof H=="boolean"?(D.__data[0]=H,n.bufferSubData(n.UNIFORM_BUFFER,Q+z,D.__data)):H.isMatrix3?(D.__data[0]=H.elements[0],D.__data[1]=H.elements[1],D.__data[2]=H.elements[2],D.__data[3]=0,D.__data[4]=H.elements[3],D.__data[5]=H.elements[4],D.__data[6]=H.elements[5],D.__data[7]=0,D.__data[8]=H.elements[6],D.__data[9]=H.elements[7],D.__data[10]=H.elements[8],D.__data[11]=0):(H.toArray(D.__data,z),z+=K.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,Q,D.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function f(v,y,b,w){const M=v.value,S=y+"_"+b;if(w[S]===void 0)return typeof M=="number"||typeof M=="boolean"?w[S]=M:w[S]=M.clone(),!0;{const R=w[S];if(typeof M=="number"||typeof M=="boolean"){if(R!==M)return w[S]=M,!0}else if(R.equals(M)===!1)return R.copy(M),!0}return!1}function A(v){const y=v.uniforms;let b=0;const w=16;for(let S=0,R=y.length;S<R;S++){const _=Array.isArray(y[S])?y[S]:[y[S]];for(let I=0,D=_.length;I<D;I++){const Q=_[I],N=Array.isArray(Q.value)?Q.value:[Q.value];for(let z=0,$=N.length;z<$;z++){const H=N[z],K=g(H),Y=b%w,ee=Y%K.boundary,pe=Y+ee;b+=ee,pe!==0&&w-pe<K.storage&&(b+=w-pe),Q.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),Q.__offset=b,b+=K.storage}}}const M=b%w;return M>0&&(b+=w-M),v.__size=b,v.__cache={},this}function g(v){const y={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(y.boundary=4,y.storage=4):v.isVector2?(y.boundary=8,y.storage=8):v.isVector3||v.isColor?(y.boundary=16,y.storage=12):v.isVector4?(y.boundary=16,y.storage=16):v.isMatrix3?(y.boundary=48,y.storage=48):v.isMatrix4?(y.boundary=64,y.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),y}function m(v){const y=v.target;y.removeEventListener("dispose",m);const b=o.indexOf(y.__bindingPointIndex);o.splice(b,1),n.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function p(){for(const v in r)n.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:l,update:c,dispose:p}}class mI{constructor(e={}){const{canvas:t=Dv(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1,multiviewStereo:f=!1}=e;this.isWebGLRenderer=!0;let A;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=i.getContextAttributes().alpha}else A=o;const g=new Uint32Array(4),m=new Int32Array(4);let p=null,v=null;const y=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=xn,this.toneMapping=Ti,this.toneMappingExposure=1;const w=this;let M=!1,S=0,R=0,_=null,I=-1,D=null;const Q=new mt,N=new mt;let z=null;const $=new De(0);let H=0,K=t.width,Y=t.height,ee=1,pe=null,be=null;const Ce=new mt(0,0,K,Y),Pe=new mt(0,0,K,Y);let Me=!1;const te=new ha;let Ae=!1,se=!1;this.transmissionResolutionScale=1;const X=new Ye,he=new Ye,ue=new F,ve=new mt,ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let le=!1;function ce(){return _===null?ee:1}let O=i;function me(L,W){return t.getContext(L,W)}try{const L={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Jc}`),t.addEventListener("webglcontextlost",Ue,!1),t.addEventListener("webglcontextrestored",Ke,!1),t.addEventListener("webglcontextcreationerror",Ie,!1),O===null){const W="webgl2";if(O=me(W,L),O===null)throw me(W)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(L){throw console.error("THREE.WebGLRenderer: "+L.message),L}let ye,x,C,T,U,k,j,ie,ke,P,B,V,re,de,oe,Fe,Ee,Le,nt,we,Ve,at,G,ae,xe;function Te(){ye=new M1(O),ye.init(),G=new zy(O,ye),x=new E1(O,ye,e,G),C=new aI(O,ye),x.reverseDepthBuffer&&d&&C.buffers.depth.setReversed(!0),T=new B1(O),U=new XS,k=new lI(O,ye,C,U,x,G,T),j=new b1(w),ie=new _1(w),ke=new F_(O),ae=new v1(O,ke),P=new S1(O,ke,T,ae),B=new L1(O,P,ke,T),we=new T1(O,x,k),Fe=new x1(U),V=new jS(w,j,ie,ye,x,ae,Fe),re=new pI(w,U),de=new KS,oe=new nI(ye),nt=new g1(w,j,ie,C,B,A,l),Le=new R1(w,ye,O),Ee=new sI(w,B,x),xe=new AI(O,T,x,C),Ve=new y1(O,ye,T),at=new I1(O,ye,T),T.programs=V.programs,w.capabilities=x,w.extensions=ye,w.properties=U,w.renderLists=de,w.shadowMap=Ee,w.state=C,w.info=T}Te();const Se=new dI(w,O);this.xr=Se,this.getContext=function(){return O},this.getContextAttributes=function(){return O.getContextAttributes()},this.forceContextLoss=function(){const L=ye.get("WEBGL_lose_context");L&&L.loseContext()},this.forceContextRestore=function(){const L=ye.get("WEBGL_lose_context");L&&L.restoreContext()},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(L){L!==void 0&&(ee=L,this.setSize(K,Y,!1))},this.getSize=function(L){return L.set(K,Y)},this.setSize=function(L,W,J=!0){if(Se.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}K=L,Y=W,t.width=Math.floor(L*ee),t.height=Math.floor(W*ee),J===!0&&(t.style.width=L+"px",t.style.height=W+"px"),this.setViewport(0,0,L,W)},this.getDrawingBufferSize=function(L){return L.set(K*ee,Y*ee).floor()},this.setDrawingBufferSize=function(L,W,J){K=L,Y=W,ee=J,t.width=Math.floor(L*J),t.height=Math.floor(W*J),this.setViewport(0,0,L,W)},this.getCurrentViewport=function(L){return L.copy(Q)},this.getViewport=function(L){return L.copy(Ce)},this.setViewport=function(L,W,J,Z){L.isVector4?Ce.set(L.x,L.y,L.z,L.w):Ce.set(L,W,J,Z),C.viewport(Q.copy(Ce).multiplyScalar(ee).round())},this.getScissor=function(L){return L.copy(Pe)},this.setScissor=function(L,W,J,Z){L.isVector4?Pe.set(L.x,L.y,L.z,L.w):Pe.set(L,W,J,Z),C.scissor(N.copy(Pe).multiplyScalar(ee).round())},this.getScissorTest=function(){return Me},this.setScissorTest=function(L){C.setScissorTest(Me=L)},this.setOpaqueSort=function(L){pe=L},this.setTransparentSort=function(L){be=L},this.getClearColor=function(L){return L.copy(nt.getClearColor())},this.setClearColor=function(){nt.setClearColor.apply(nt,arguments)},this.getClearAlpha=function(){return nt.getClearAlpha()},this.setClearAlpha=function(){nt.setClearAlpha.apply(nt,arguments)},this.clear=function(L=!0,W=!0,J=!0){let Z=0;if(L){let q=!1;if(_!==null){const ge=_.texture.format;q=ge===rh||ge===ih||ge===aa}if(q){const ge=_.texture.type,Re=ge===hi||ge===Fi||ge===Us||ge===$i||ge===eh||ge===th,Oe=nt.getClearColor(),Ne=nt.getClearAlpha(),Je=Oe.r,$e=Oe.g,qe=Oe.b;Re?(g[0]=Je,g[1]=$e,g[2]=qe,g[3]=Ne,O.clearBufferuiv(O.COLOR,0,g)):(m[0]=Je,m[1]=$e,m[2]=qe,m[3]=Ne,O.clearBufferiv(O.COLOR,0,m))}else Z|=O.COLOR_BUFFER_BIT}W&&(Z|=O.DEPTH_BUFFER_BIT),J&&(Z|=O.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),O.clear(Z)},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",Ue,!1),t.removeEventListener("webglcontextrestored",Ke,!1),t.removeEventListener("webglcontextcreationerror",Ie,!1),nt.dispose(),de.dispose(),oe.dispose(),U.dispose(),j.dispose(),ie.dispose(),B.dispose(),ae.dispose(),xe.dispose(),V.dispose(),Se.dispose(),Se.removeEventListener("sessionstart",Yp),Se.removeEventListener("sessionend",Kp),hr.stop()};function Ue(L){L.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),M=!0}function Ke(){console.log("THREE.WebGLRenderer: Context Restored."),M=!1;const L=T.autoReset,W=Ee.enabled,J=Ee.autoUpdate,Z=Ee.needsUpdate,q=Ee.type;Te(),T.autoReset=L,Ee.enabled=W,Ee.autoUpdate=J,Ee.needsUpdate=Z,Ee.type=q}function Ie(L){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",L.statusMessage)}function Be(L){const W=L.target;W.removeEventListener("dispose",Be),ze(W)}function ze(L){ut(L),U.remove(L)}function ut(L){const W=U.get(L).programs;W!==void 0&&(W.forEach(function(J){V.releaseProgram(J)}),L.isShaderMaterial&&V.releaseShaderCache(L))}this.renderBufferDirect=function(L,W,J,Z,q,ge){W===null&&(W=ne);const Re=q.isMesh&&q.matrixWorld.determinant()<0,Oe=yx(L,W,J,Z,q);C.setMaterial(Z,Re);let Ne=J.index,Je=1;if(Z.wireframe===!0){if(Ne=P.getWireframeAttribute(J),Ne===void 0)return;Je=2}const $e=J.drawRange,qe=J.attributes.position;let dt=$e.start*Je,xt=($e.start+$e.count)*Je;ge!==null&&(dt=Math.max(dt,ge.start*Je),xt=Math.min(xt,(ge.start+ge.count)*Je)),Ne!==null?(dt=Math.max(dt,0),xt=Math.min(xt,Ne.count)):qe!=null&&(dt=Math.max(dt,0),xt=Math.min(xt,qe.count));const Ut=xt-dt;if(Ut<0||Ut===1/0)return;ae.setup(q,Z,Oe,J,Ne);let Rt,ft=Ve;if(Ne!==null&&(Rt=ke.get(Ne),ft=at,ft.setIndex(Rt)),q.isMesh)Z.wireframe===!0?(C.setLineWidth(Z.wireframeLinewidth*ce()),ft.setMode(O.LINES)):ft.setMode(O.TRIANGLES);else if(q.isLine){let $t=Z.linewidth;$t===void 0&&($t=1),C.setLineWidth($t*ce()),q.isLineSegments?ft.setMode(O.LINES):q.isLineLoop?ft.setMode(O.LINE_LOOP):ft.setMode(O.LINE_STRIP)}else q.isPoints?ft.setMode(O.POINTS):q.isSprite&&ft.setMode(O.TRIANGLES);if(q.isBatchedMesh)if(q._multiDrawInstances!==null)ft.renderMultiDrawInstances(q._multiDrawStarts,q._multiDrawCounts,q._multiDrawCount,q._multiDrawInstances);else if(ye.get("WEBGL_multi_draw"))ft.renderMultiDraw(q._multiDrawStarts,q._multiDrawCounts,q._multiDrawCount);else{const $t=q._multiDrawStarts,We=q._multiDrawCounts,js=q._multiDrawCount,yt=Ne?ke.get(Ne).bytesPerElement:1,Mn=U.get(Z).currentProgram.getUniforms();for(let ti=0;ti<js;ti++)Mn.setValue(O,"_gl_DrawID",ti),ft.render($t[ti]/yt,We[ti])}else if(q.isInstancedMesh)ft.renderInstances(dt,Ut,q.count);else if(J.isInstancedBufferGeometry){const $t=J._maxInstanceCount!==void 0?J._maxInstanceCount:1/0,We=Math.min(J.instanceCount,$t);ft.renderInstances(dt,Ut,We)}else ft.render(dt,Ut)};function Nt(L,W,J){L.transparent===!0&&L.side===si&&L.forceSinglePass===!1?(L.side=An,L.needsUpdate=!0,ya(L,W,J),L.side=Pi,L.needsUpdate=!0,ya(L,W,J),L.side=si):ya(L,W,J)}this.compile=function(L,W,J=null){J===null&&(J=L),v=oe.get(J),v.init(W),b.push(v),J.traverseVisible(function(q){q.isLight&&q.layers.test(W.layers)&&(v.pushLight(q),q.castShadow&&v.pushShadow(q))}),L!==J&&L.traverseVisible(function(q){q.isLight&&q.layers.test(W.layers)&&(v.pushLight(q),q.castShadow&&v.pushShadow(q))}),v.setupLights();const Z=new Set;return L.traverse(function(q){if(!(q.isMesh||q.isPoints||q.isLine||q.isSprite))return;const ge=q.material;if(ge)if(Array.isArray(ge))for(let Re=0;Re<ge.length;Re++){const Oe=ge[Re];Nt(Oe,J,q),Z.add(Oe)}else Nt(ge,J,q),Z.add(ge)}),b.pop(),v=null,Z},this.compileAsync=function(L,W,J=null){const Z=this.compile(L,W,J);return new Promise(q=>{function ge(){if(Z.forEach(function(Re){U.get(Re).currentProgram.isReady()&&Z.delete(Re)}),Z.size===0){q(L);return}setTimeout(ge,10)}ye.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let Nh=null;function vx(L){Nh&&Nh(L)}function Yp(){hr.stop()}function Kp(){hr.start()}const hr=new Oy;hr.setAnimationLoop(vx),typeof self<"u"&&hr.setContext(self),this.setAnimationLoop=function(L){Nh=L,Se.setAnimationLoop(L),L===null?hr.stop():hr.start()},Se.addEventListener("sessionstart",Yp),Se.addEventListener("sessionend",Kp),this.render=function(L,W){if(W!==void 0&&W.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(M===!0)return;if(L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),Se.enabled===!0&&Se.isPresenting===!0&&(Se.cameraAutoUpdate===!0&&Se.updateCamera(W),W=Se.getCamera()),L.isScene===!0&&L.onBeforeRender(w,L,W,_),v=oe.get(L,b.length),v.init(W),b.push(v),he.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),te.setFromProjectionMatrix(he),se=this.localClippingEnabled,Ae=Fe.init(this.clippingPlanes,se),p=de.get(L,y.length),p.init(),y.push(p),Se.enabled===!0&&Se.isPresenting===!0){const ge=w.xr.getDepthSensingMesh();ge!==null&&Qh(ge,W,-1/0,w.sortObjects)}Qh(L,W,0,w.sortObjects),p.finish(),w.sortObjects===!0&&p.sort(pe,be),le=Se.enabled===!1||Se.isPresenting===!1||Se.hasDepthSensing()===!1,le&&nt.addToRenderList(p,L),this.info.render.frame++,Ae===!0&&Fe.beginShadows();const J=v.state.shadowsArray;Ee.render(J,L,W),Ae===!0&&Fe.endShadows(),this.info.autoReset===!0&&this.info.reset();const Z=p.opaque,q=p.transmissive;if(v.setupLights(),W.isArrayCamera){const ge=W.cameras;if(q.length>0)for(let Re=0,Oe=ge.length;Re<Oe;Re++){const Ne=ge[Re];Jp(Z,q,L,Ne)}if(le&&nt.render(L),Se.enabled&&Se.isMultiview)k.setDeferTextureUploads(!0),Gh(p,L,W,W.cameras[0].viewport);else for(let Re=0,Oe=ge.length;Re<Oe;Re++){const Ne=ge[Re];Gh(p,L,Ne,Ne.viewport)}}else q.length>0&&Jp(Z,q,L,W),le&&nt.render(L),Gh(p,L,W);_!==null&&R===0&&(k.updateMultisampleRenderTarget(_),k.updateRenderTargetMipmap(_)),L.isScene===!0&&L.onAfterRender(w,L,W),ae.resetDefaultState(),I=-1,D=null,b.pop(),b.length>0?(v=b[b.length-1],Ae===!0&&Fe.setGlobalState(w.clippingPlanes,v.state.camera)):v=null,y.pop(),y.length>0?p=y[y.length-1]:p=null};function Qh(L,W,J,Z){if(L.visible===!1)return;if(L.layers.test(W.layers)){if(L.isGroup)J=L.renderOrder;else if(L.isLOD)L.autoUpdate===!0&&L.update(W);else if(L.isLight)v.pushLight(L),L.castShadow&&v.pushShadow(L);else if(L.isSprite){if(!L.frustumCulled||te.intersectsSprite(L)){Z&&ve.setFromMatrixPosition(L.matrixWorld).applyMatrix4(he);const Re=B.update(L),Oe=L.material;Oe.visible&&p.push(L,Re,Oe,J,ve.z,null)}}else if((L.isMesh||L.isLine||L.isPoints)&&(!L.frustumCulled||te.intersectsObject(L))){const Re=B.update(L),Oe=L.material;if(Z&&(L.boundingSphere!==void 0?(L.boundingSphere===null&&L.computeBoundingSphere(),ve.copy(L.boundingSphere.center)):(Re.boundingSphere===null&&Re.computeBoundingSphere(),ve.copy(Re.boundingSphere.center)),ve.applyMatrix4(L.matrixWorld).applyMatrix4(he)),Array.isArray(Oe)){const Ne=Re.groups;for(let Je=0,$e=Ne.length;Je<$e;Je++){const qe=Ne[Je],dt=Oe[qe.materialIndex];dt&&dt.visible&&p.push(L,Re,dt,J,ve.z,qe)}}else Oe.visible&&p.push(L,Re,Oe,J,ve.z,null)}}const ge=L.children;for(let Re=0,Oe=ge.length;Re<Oe;Re++)Qh(ge[Re],W,J,Z)}function Gh(L,W,J,Z){const q=L.opaque,ge=L.transmissive,Re=L.transparent;v.setupLightsView(J),Ae===!0&&Fe.setGlobalState(w.clippingPlanes,J),Z&&C.viewport(Q.copy(Z)),q.length>0&&va(q,W,J),ge.length>0&&va(ge,W,J),Re.length>0&&va(Re,W,J),C.buffers.depth.setTest(!0),C.buffers.depth.setMask(!0),C.buffers.color.setMask(!0),C.setPolygonOffset(!1)}function Jp(L,W,J,Z){if((J.isScene===!0?J.overrideMaterial:null)!==null)return;v.state.transmissionRenderTarget[Z.id]===void 0&&(v.state.transmissionRenderTarget[Z.id]=new Jn(1,1,{generateMipmaps:!0,type:ye.has("EXT_color_buffer_half_float")||ye.has("EXT_color_buffer_float")?zs:hi,minFilter:oi,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ht.workingColorSpace}));const ge=v.state.transmissionRenderTarget[Z.id],Re=Z.viewport||Q;ge.setSize(Re.z*w.transmissionResolutionScale,Re.w*w.transmissionResolutionScale);const Oe=w.getRenderTarget();w.setRenderTarget(ge),w.getClearColor($),H=w.getClearAlpha(),H<1&&w.setClearColor(16777215,.5),w.clear(),le&&nt.render(J);const Ne=w.toneMapping;w.toneMapping=Ti;const Je=Z.viewport;if(Z.viewport!==void 0&&(Z.viewport=void 0),v.setupLightsView(Z),Ae===!0&&Fe.setGlobalState(w.clippingPlanes,Z),va(L,J,Z),k.updateMultisampleRenderTarget(ge),k.updateRenderTargetMipmap(ge),ye.has("WEBGL_multisampled_render_to_texture")===!1){let $e=!1;for(let qe=0,dt=W.length;qe<dt;qe++){const xt=W[qe],Ut=xt.object,Rt=xt.geometry,ft=xt.material,$t=xt.group;if(ft.side===si&&Ut.layers.test(Z.layers)){const We=ft.side;ft.side=An,ft.needsUpdate=!0,Zp(Ut,J,Z,Rt,ft,$t),ft.side=We,ft.needsUpdate=!0,$e=!0}}$e===!0&&(k.updateMultisampleRenderTarget(ge),k.updateRenderTargetMipmap(ge))}w.setRenderTarget(Oe),w.setClearColor($,H),Je!==void 0&&(Z.viewport=Je),w.toneMapping=Ne}function va(L,W,J){const Z=W.isScene===!0?W.overrideMaterial:null;for(let q=0,ge=L.length;q<ge;q++){const Re=L[q],Oe=Re.object,Ne=Re.geometry,Je=Z===null?Re.material:Z,$e=Re.group;Oe.layers.test(J.layers)&&Zp(Oe,W,J,Ne,Je,$e)}}function Zp(L,W,J,Z,q,ge){L.onBeforeRender(w,W,J,Z,q,ge),L.modelViewMatrix.multiplyMatrices(J.matrixWorldInverse,L.matrixWorld),L.normalMatrix.getNormalMatrix(L.modelViewMatrix),q.onBeforeRender(w,W,J,Z,L,ge),q.transparent===!0&&q.side===si&&q.forceSinglePass===!1?(q.side=An,q.needsUpdate=!0,w.renderBufferDirect(J,W,Z,q,L,ge),q.side=Pi,q.needsUpdate=!0,w.renderBufferDirect(J,W,Z,q,L,ge),q.side=si):w.renderBufferDirect(J,W,Z,q,L,ge),L.onAfterRender(w,W,J,Z,q,ge)}function ya(L,W,J){W.isScene!==!0&&(W=ne);const Z=U.get(L),q=v.state.lights,ge=v.state.shadowsArray,Re=q.state.version,Oe=V.getParameters(L,q.state,ge,W,J),Ne=V.getProgramCacheKey(Oe);let Je=Z.programs;Z.environment=L.isMeshStandardMaterial?W.environment:null,Z.fog=W.fog,Z.envMap=(L.isMeshStandardMaterial?ie:j).get(L.envMap||Z.environment),Z.envMapRotation=Z.environment!==null&&L.envMap===null?W.environmentRotation:L.envMapRotation,Je===void 0&&(L.addEventListener("dispose",Be),Je=new Map,Z.programs=Je);let $e=Je.get(Ne);if($e!==void 0){if(Z.currentProgram===$e&&Z.lightsStateVersion===Re)return eA(L,Oe),$e}else Oe.uniforms=V.getUniforms(L),L.onBeforeCompile(Oe,w),$e=V.acquireProgram(Oe,Ne),Je.set(Ne,$e),Z.uniforms=Oe.uniforms;const qe=Z.uniforms;return(!L.isShaderMaterial&&!L.isRawShaderMaterial||L.clipping===!0)&&(qe.clippingPlanes=Fe.uniform),eA(L,Oe),Z.needsLights=xx(L),Z.lightsStateVersion=Re,Z.needsLights&&(qe.ambientLightColor.value=q.state.ambient,qe.lightProbe.value=q.state.probe,qe.directionalLights.value=q.state.directional,qe.directionalLightShadows.value=q.state.directionalShadow,qe.spotLights.value=q.state.spot,qe.spotLightShadows.value=q.state.spotShadow,qe.rectAreaLights.value=q.state.rectArea,qe.ltc_1.value=q.state.rectAreaLTC1,qe.ltc_2.value=q.state.rectAreaLTC2,qe.pointLights.value=q.state.point,qe.pointLightShadows.value=q.state.pointShadow,qe.hemisphereLights.value=q.state.hemi,qe.directionalShadowMap.value=q.state.directionalShadowMap,qe.directionalShadowMatrix.value=q.state.directionalShadowMatrix,qe.spotShadowMap.value=q.state.spotShadowMap,qe.spotLightMatrix.value=q.state.spotLightMatrix,qe.spotLightMap.value=q.state.spotLightMap,qe.pointShadowMap.value=q.state.pointShadowMap,qe.pointShadowMatrix.value=q.state.pointShadowMatrix),Z.currentProgram=$e,Z.uniformsList=null,$e}function $p(L){if(L.uniformsList===null){const W=L.currentProgram.getUniforms();L.uniformsList=zl.seqWithValue(W.seq,L.uniforms)}return L.uniformsList}function eA(L,W){const J=U.get(L);J.outputColorSpace=W.outputColorSpace,J.batching=W.batching,J.batchingColor=W.batchingColor,J.instancing=W.instancing,J.instancingColor=W.instancingColor,J.instancingMorph=W.instancingMorph,J.skinning=W.skinning,J.morphTargets=W.morphTargets,J.morphNormals=W.morphNormals,J.morphColors=W.morphColors,J.morphTargetsCount=W.morphTargetsCount,J.numClippingPlanes=W.numClippingPlanes,J.numIntersection=W.numClipIntersection,J.vertexAlphas=W.vertexAlphas,J.vertexTangents=W.vertexTangents,J.toneMapping=W.toneMapping,J.numMultiviewViews=W.numMultiviewViews}function yx(L,W,J,Z,q){W.isScene!==!0&&(W=ne),k.resetTextureUnits();const ge=W.fog,Re=Z.isMeshStandardMaterial?W.environment:null,Oe=_===null?w.outputColorSpace:_.isXRRenderTarget===!0?_.texture.colorSpace:qr,Ne=(Z.isMeshStandardMaterial?ie:j).get(Z.envMap||Re),Je=Z.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,$e=!!J.attributes.tangent&&(!!Z.normalMap||Z.anisotropy>0),qe=!!J.morphAttributes.position,dt=!!J.morphAttributes.normal,xt=!!J.morphAttributes.color;let Ut=Ti;Z.toneMapped&&(_===null||_.isXRRenderTarget===!0)&&(Ut=w.toneMapping);const Rt=_&&_.isWebGLMultiviewRenderTarget?_.numViews:0,ft=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,$t=ft!==void 0?ft.length:0,We=U.get(Z),js=v.state.lights;if(Ae===!0&&(se===!0||L!==D)){const Ft=L===D&&Z.id===I;Fe.setState(Z,L,Ft)}let yt=!1;Z.version===We.__version?(We.needsLights&&We.lightsStateVersion!==js.state.version||We.outputColorSpace!==Oe||q.isBatchedMesh&&We.batching===!1||!q.isBatchedMesh&&We.batching===!0||q.isBatchedMesh&&We.batchingColor===!0&&q.colorTexture===null||q.isBatchedMesh&&We.batchingColor===!1&&q.colorTexture!==null||q.isInstancedMesh&&We.instancing===!1||!q.isInstancedMesh&&We.instancing===!0||q.isSkinnedMesh&&We.skinning===!1||!q.isSkinnedMesh&&We.skinning===!0||q.isInstancedMesh&&We.instancingColor===!0&&q.instanceColor===null||q.isInstancedMesh&&We.instancingColor===!1&&q.instanceColor!==null||q.isInstancedMesh&&We.instancingMorph===!0&&q.morphTexture===null||q.isInstancedMesh&&We.instancingMorph===!1&&q.morphTexture!==null||We.envMap!==Ne||Z.fog===!0&&We.fog!==ge||We.numClippingPlanes!==void 0&&(We.numClippingPlanes!==Fe.numPlanes||We.numIntersection!==Fe.numIntersection)||We.vertexAlphas!==Je||We.vertexTangents!==$e||We.morphTargets!==qe||We.morphNormals!==dt||We.morphColors!==xt||We.toneMapping!==Ut||We.morphTargetsCount!==$t||We.numMultiviewViews!==Rt)&&(yt=!0):(yt=!0,We.__version=Z.version);let Mn=We.currentProgram;yt===!0&&(Mn=ya(Z,W,q));let ti=!1,ur=!1,Zr=!1;const Ct=Mn.getUniforms(),jt=We.uniforms;if(C.useProgram(Mn.program)&&(ti=!0,ur=!0,Zr=!0),Z.id!==I&&(I=Z.id,ur=!0),ti||D!==L){Mn.numMultiviewViews>0?(Le.updateCameraProjectionMatricesUniform(L,Ct),Le.updateCameraViewMatricesUniform(L,Ct)):(C.buffers.depth.getReversed()?(X.copy(L.projectionMatrix),iC(X),rC(X),Ct.setValue(O,"projectionMatrix",X)):Ct.setValue(O,"projectionMatrix",L.projectionMatrix),Ct.setValue(O,"viewMatrix",L.matrixWorldInverse));const Ft=Ct.map.cameraPosition;Ft!==void 0&&Ft.setValue(O,ue.setFromMatrixPosition(L.matrixWorld)),x.logarithmicDepthBuffer&&Ct.setValue(O,"logDepthBufFC",2/(Math.log(L.far+1)/Math.LN2)),(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial)&&Ct.setValue(O,"isOrthographic",L.isOrthographicCamera===!0),D!==L&&(D=L,ur=!0,Zr=!0)}if(q.isSkinnedMesh){Ct.setOptional(O,q,"bindMatrix"),Ct.setOptional(O,q,"bindMatrixInverse");const Ft=q.skeleton;Ft&&(Ft.boneTexture===null&&Ft.computeBoneTexture(),Ct.setValue(O,"boneTexture",Ft.boneTexture,k))}q.isBatchedMesh&&(Ct.setOptional(O,q,"batchingTexture"),Ct.setValue(O,"batchingTexture",q._matricesTexture,k),Ct.setOptional(O,q,"batchingIdTexture"),Ct.setValue(O,"batchingIdTexture",q._indirectTexture,k),Ct.setOptional(O,q,"batchingColorTexture"),q._colorsTexture!==null&&Ct.setValue(O,"batchingColorTexture",q._colorsTexture,k));const ki=J.morphAttributes;if((ki.position!==void 0||ki.normal!==void 0||ki.color!==void 0)&&we.update(q,J,Mn),(ur||We.receiveShadow!==q.receiveShadow)&&(We.receiveShadow=q.receiveShadow,Ct.setValue(O,"receiveShadow",q.receiveShadow)),Z.isMeshGouraudMaterial&&Z.envMap!==null&&(jt.envMap.value=Ne,jt.flipEnvMap.value=Ne.isCubeTexture&&Ne.isRenderTargetTexture===!1?-1:1),Z.isMeshStandardMaterial&&Z.envMap===null&&W.environment!==null&&(jt.envMapIntensity.value=W.environmentIntensity),ur&&(Ct.setValue(O,"toneMappingExposure",w.toneMappingExposure),We.needsLights&&Ex(jt,Zr),ge&&Z.fog===!0&&re.refreshFogUniforms(jt,ge),re.refreshMaterialUniforms(jt,Z,ee,Y,v.state.transmissionRenderTarget[L.id]),zl.upload(O,$p(We),jt,k)),Z.isShaderMaterial&&Z.uniformsNeedUpdate===!0&&(zl.upload(O,$p(We),jt,k),Z.uniformsNeedUpdate=!1),Z.isSpriteMaterial&&Ct.setValue(O,"center",q.center),Mn.numMultiviewViews>0?Le.updateObjectMatricesUniforms(q,L,Ct):(Ct.setValue(O,"modelViewMatrix",q.modelViewMatrix),Ct.setValue(O,"normalMatrix",q.normalMatrix)),Ct.setValue(O,"modelMatrix",q.matrixWorld),Z.isShaderMaterial||Z.isRawShaderMaterial){const Ft=Z.uniformsGroups;for(let $r=0,es=Ft.length;$r<es;$r++){const tA=Ft[$r];xe.update(tA,Mn),xe.bind(tA,Mn)}}return Mn}function Ex(L,W){L.ambientLightColor.needsUpdate=W,L.lightProbe.needsUpdate=W,L.directionalLights.needsUpdate=W,L.directionalLightShadows.needsUpdate=W,L.pointLights.needsUpdate=W,L.pointLightShadows.needsUpdate=W,L.spotLights.needsUpdate=W,L.spotLightShadows.needsUpdate=W,L.rectAreaLights.needsUpdate=W,L.hemisphereLights.needsUpdate=W}function xx(L){return L.isMeshLambertMaterial||L.isMeshToonMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isShadowMaterial||L.isShaderMaterial&&L.lights===!0}this.setTexture2D=function(){var L=!1;return function(J,Z){J&&J.isWebGLRenderTarget&&(L||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),L=!0),J=J.texture),k.setTexture2D(J,Z)}}(),this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(L,W,J){U.get(L.texture).__webglTexture=W,U.get(L.depthTexture).__webglTexture=J;const Z=U.get(L);Z.__hasExternalTextures=!0,Z.__autoAllocateDepthBuffer=J===void 0,!Z.__autoAllocateDepthBuffer&&(!_||!_.isWebGLMultiviewRenderTarget)&&ye.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Z.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(L,W){const J=U.get(L);J.__webglFramebuffer=W,J.__useDefaultFramebuffer=W===void 0};const bx=O.createFramebuffer();this.setRenderTarget=function(L,W=0,J=0){L===null&&this.xr.isPresenting&&(L=this.xr.getRenderTarget()),_=L,S=W,R=J;let Z=!0,q=null,ge=!1,Re=!1;if(L){const Ne=U.get(L);if(Ne.__useDefaultFramebuffer!==void 0)C.bindFramebuffer(O.FRAMEBUFFER,null),Z=!1;else if(Ne.__webglFramebuffer===void 0)k.setupRenderTarget(L);else if(Ne.__hasExternalTextures)k.rebindTextures(L,U.get(L.texture).__webglTexture,U.get(L.depthTexture).__webglTexture);else if(L.depthBuffer){const qe=L.depthTexture;if(Ne.__boundDepthTexture!==qe){if(qe!==null&&U.has(qe)&&(L.width!==qe.image.width||L.height!==qe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");k.setupDepthRenderbuffer(L)}}const Je=L.texture;(Je.isData3DTexture||Je.isDataArrayTexture||Je.isCompressedArrayTexture)&&(Re=!0);const $e=U.get(L).__webglFramebuffer;L.isWebGLCubeRenderTarget?(Array.isArray($e[W])?q=$e[W][J]:q=$e[W],ge=!0):L.samples>0&&k.useMultisampledRTT(L)===!1?q=U.get(L).__webglMultisampledFramebuffer:Array.isArray($e)?q=$e[J]:q=$e,Q.copy(L.viewport),N.copy(L.scissor),z=L.scissorTest}else Q.copy(Ce).multiplyScalar(ee).floor(),N.copy(Pe).multiplyScalar(ee).floor(),z=Me;if(J!==0&&(q=bx),C.bindFramebuffer(O.FRAMEBUFFER,q)&&Z&&C.drawBuffers(L,q),C.viewport(Q),C.scissor(N),C.setScissorTest(z),ge){const Ne=U.get(L.texture);O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+W,Ne.__webglTexture,J)}else if(Re){const Ne=U.get(L.texture),Je=W;O.framebufferTextureLayer(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,Ne.__webglTexture,J,Je)}else if(L!==null&&J!==0){const Ne=U.get(L.texture);O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,Ne.__webglTexture,J)}I=-1},this.readRenderTargetPixels=function(L,W,J,Z,q,ge,Re){if(!(L&&L.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Oe=U.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Re!==void 0&&(Oe=Oe[Re]),Oe){C.bindFramebuffer(O.FRAMEBUFFER,Oe);try{const Ne=L.texture,Je=Ne.format,$e=Ne.type;if(!x.textureFormatReadable(Je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!x.textureTypeReadable($e)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=L.width-Z&&J>=0&&J<=L.height-q&&O.readPixels(W,J,Z,q,G.convert(Je),G.convert($e),ge)}finally{const Ne=_!==null?U.get(_).__webglFramebuffer:null;C.bindFramebuffer(O.FRAMEBUFFER,Ne)}}},this.readRenderTargetPixelsAsync=async function(L,W,J,Z,q,ge,Re){if(!(L&&L.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Oe=U.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Re!==void 0&&(Oe=Oe[Re]),Oe){const Ne=L.texture,Je=Ne.format,$e=Ne.type;if(!x.textureFormatReadable(Je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!x.textureTypeReadable($e))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(W>=0&&W<=L.width-Z&&J>=0&&J<=L.height-q){C.bindFramebuffer(O.FRAMEBUFFER,Oe);const qe=O.createBuffer();O.bindBuffer(O.PIXEL_PACK_BUFFER,qe),O.bufferData(O.PIXEL_PACK_BUFFER,ge.byteLength,O.STREAM_READ),O.readPixels(W,J,Z,q,G.convert(Je),G.convert($e),0);const dt=_!==null?U.get(_).__webglFramebuffer:null;C.bindFramebuffer(O.FRAMEBUFFER,dt);const xt=O.fenceSync(O.SYNC_GPU_COMMANDS_COMPLETE,0);return O.flush(),await nC(O,xt,4),O.bindBuffer(O.PIXEL_PACK_BUFFER,qe),O.getBufferSubData(O.PIXEL_PACK_BUFFER,0,ge),O.deleteBuffer(qe),O.deleteSync(xt),ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(L,W=null,J=0){L.isTexture!==!0&&(Ms("WebGLRenderer: copyFramebufferToTexture function signature has changed."),W=arguments[0]||null,L=arguments[1]);const Z=Math.pow(2,-J),q=Math.floor(L.image.width*Z),ge=Math.floor(L.image.height*Z),Re=W!==null?W.x:0,Oe=W!==null?W.y:0;k.setTexture2D(L,0),O.copyTexSubImage2D(O.TEXTURE_2D,J,0,0,Re,Oe,q,ge),C.unbindTexture()};const Cx=O.createFramebuffer(),wx=O.createFramebuffer();this.copyTextureToTexture=function(L,W,J=null,Z=null,q=0,ge=null){L.isTexture!==!0&&(Ms("WebGLRenderer: copyTextureToTexture function signature has changed."),Z=arguments[0]||null,L=arguments[1],W=arguments[2],ge=arguments[3]||0,J=null),ge===null&&(q!==0?(Ms("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ge=q,q=0):ge=0);let Re,Oe,Ne,Je,$e,qe,dt,xt,Ut;const Rt=L.isCompressedTexture?L.mipmaps[ge]:L.image;if(J!==null)Re=J.max.x-J.min.x,Oe=J.max.y-J.min.y,Ne=J.isBox3?J.max.z-J.min.z:1,Je=J.min.x,$e=J.min.y,qe=J.isBox3?J.min.z:0;else{const jt=Math.pow(2,-q);Re=Math.floor(Rt.width*jt),Oe=Math.floor(Rt.height*jt),L.isDataArrayTexture?Ne=Rt.depth:L.isData3DTexture?Ne=Math.floor(Rt.depth*jt):Ne=1,Je=0,$e=0,qe=0}Z!==null?(dt=Z.x,xt=Z.y,Ut=Z.z):(dt=0,xt=0,Ut=0);const ft=G.convert(W.format),$t=G.convert(W.type);let We;W.isData3DTexture?(k.setTexture3D(W,0),We=O.TEXTURE_3D):W.isDataArrayTexture||W.isCompressedArrayTexture?(k.setTexture2DArray(W,0),We=O.TEXTURE_2D_ARRAY):(k.setTexture2D(W,0),We=O.TEXTURE_2D),O.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,W.flipY),O.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),O.pixelStorei(O.UNPACK_ALIGNMENT,W.unpackAlignment);const js=O.getParameter(O.UNPACK_ROW_LENGTH),yt=O.getParameter(O.UNPACK_IMAGE_HEIGHT),Mn=O.getParameter(O.UNPACK_SKIP_PIXELS),ti=O.getParameter(O.UNPACK_SKIP_ROWS),ur=O.getParameter(O.UNPACK_SKIP_IMAGES);O.pixelStorei(O.UNPACK_ROW_LENGTH,Rt.width),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,Rt.height),O.pixelStorei(O.UNPACK_SKIP_PIXELS,Je),O.pixelStorei(O.UNPACK_SKIP_ROWS,$e),O.pixelStorei(O.UNPACK_SKIP_IMAGES,qe);const Zr=L.isDataArrayTexture||L.isData3DTexture,Ct=W.isDataArrayTexture||W.isData3DTexture;if(L.isDepthTexture){const jt=U.get(L),ki=U.get(W),Ft=U.get(jt.__renderTarget),$r=U.get(ki.__renderTarget);C.bindFramebuffer(O.READ_FRAMEBUFFER,Ft.__webglFramebuffer),C.bindFramebuffer(O.DRAW_FRAMEBUFFER,$r.__webglFramebuffer);for(let es=0;es<Ne;es++)Zr&&(O.framebufferTextureLayer(O.READ_FRAMEBUFFER,O.COLOR_ATTACHMENT0,U.get(L).__webglTexture,q,qe+es),O.framebufferTextureLayer(O.DRAW_FRAMEBUFFER,O.COLOR_ATTACHMENT0,U.get(W).__webglTexture,ge,Ut+es)),O.blitFramebuffer(Je,$e,Re,Oe,dt,xt,Re,Oe,O.DEPTH_BUFFER_BIT,O.NEAREST);C.bindFramebuffer(O.READ_FRAMEBUFFER,null),C.bindFramebuffer(O.DRAW_FRAMEBUFFER,null)}else if(q!==0||L.isRenderTargetTexture||U.has(L)){const jt=U.get(L),ki=U.get(W);C.bindFramebuffer(O.READ_FRAMEBUFFER,Cx),C.bindFramebuffer(O.DRAW_FRAMEBUFFER,wx);for(let Ft=0;Ft<Ne;Ft++)Zr?O.framebufferTextureLayer(O.READ_FRAMEBUFFER,O.COLOR_ATTACHMENT0,jt.__webglTexture,q,qe+Ft):O.framebufferTexture2D(O.READ_FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,jt.__webglTexture,q),Ct?O.framebufferTextureLayer(O.DRAW_FRAMEBUFFER,O.COLOR_ATTACHMENT0,ki.__webglTexture,ge,Ut+Ft):O.framebufferTexture2D(O.DRAW_FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,ki.__webglTexture,ge),q!==0?O.blitFramebuffer(Je,$e,Re,Oe,dt,xt,Re,Oe,O.COLOR_BUFFER_BIT,O.NEAREST):Ct?O.copyTexSubImage3D(We,ge,dt,xt,Ut+Ft,Je,$e,Re,Oe):O.copyTexSubImage2D(We,ge,dt,xt,Je,$e,Re,Oe);C.bindFramebuffer(O.READ_FRAMEBUFFER,null),C.bindFramebuffer(O.DRAW_FRAMEBUFFER,null)}else Ct?L.isDataTexture||L.isData3DTexture?O.texSubImage3D(We,ge,dt,xt,Ut,Re,Oe,Ne,ft,$t,Rt.data):W.isCompressedArrayTexture?O.compressedTexSubImage3D(We,ge,dt,xt,Ut,Re,Oe,Ne,ft,Rt.data):O.texSubImage3D(We,ge,dt,xt,Ut,Re,Oe,Ne,ft,$t,Rt):L.isDataTexture?O.texSubImage2D(O.TEXTURE_2D,ge,dt,xt,Re,Oe,ft,$t,Rt.data):L.isCompressedTexture?O.compressedTexSubImage2D(O.TEXTURE_2D,ge,dt,xt,Rt.width,Rt.height,ft,Rt.data):O.texSubImage2D(O.TEXTURE_2D,ge,dt,xt,Re,Oe,ft,$t,Rt);O.pixelStorei(O.UNPACK_ROW_LENGTH,js),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,yt),O.pixelStorei(O.UNPACK_SKIP_PIXELS,Mn),O.pixelStorei(O.UNPACK_SKIP_ROWS,ti),O.pixelStorei(O.UNPACK_SKIP_IMAGES,ur),ge===0&&W.generateMipmaps&&O.generateMipmap(We),C.unbindTexture()},this.copyTextureToTexture3D=function(L,W,J=null,Z=null,q=0){return L.isTexture!==!0&&(Ms("WebGLRenderer: copyTextureToTexture3D function signature has changed."),J=arguments[0]||null,Z=arguments[1]||null,L=arguments[2],W=arguments[3],q=arguments[4]||0),Ms('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(L,W,J,Z,q)},this.initRenderTarget=function(L){U.get(L).__webglFramebuffer===void 0&&k.setupRenderTarget(L)},this.initTexture=function(L){L.isCubeTexture?k.setTextureCube(L,0):L.isData3DTexture?k.setTexture3D(L,0):L.isDataArrayTexture||L.isCompressedArrayTexture?k.setTexture2DArray(L,0):k.setTexture2D(L,0),C.unbindTexture()},this.resetState=function(){S=0,R=0,_=null,C.reset(),ae.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Kn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=ht._getDrawingBufferColorSpace(e),t.unpackColorSpace=ht._getUnpackColorSpace()}}const gI=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:pv,AddEquation:Zi,AddOperation:hv,AdditiveAnimationBlendMode:Qf,AdditiveBlending:Ld,AgXToneMapping:mv,AlphaFormat:Pf,AlwaysCompare:Rv,AlwaysDepth:$l,AlwaysStencilFunc:Fd,AmbientLight:_y,AnimationAction:Uy,AnimationClip:$o,AnimationLoader:Iw,AnimationMixer:i_,AnimationObjectGroup:t_,AnimationUtils:ww,ArcCurve:Kv,ArrayCamera:Ry,ArrowHelper:S_,AttachedBindMode:Ud,Audio:Dy,AudioAnalyser:Ww,AudioContext:cp,AudioListener:zw,AudioLoader:Nw,AxesHelper:I_,BackSide:An,BasicDepthPacking:bv,BasicShadowMap:ib,BatchedMesh:qv,Bone:qf,BooleanKeyframeTrack:Kr,Box2:f_,Box3:mn,Box3Helper:__,BoxGeometry:Yr,BoxHelper:w_,BufferAttribute:wt,BufferGeometry:ot,BufferGeometryLoader:Ty,ByteType:Rf,Cache:_i,Camera:ch,CameraHelper:C_,CanvasTexture:XC,CapsuleGeometry:mh,CatmullRomCurve3:Jv,CineonToneMapping:fv,CircleGeometry:gh,ClampToEdgeWrapping:On,Clock:Ly,Color:De,ColorKeyframeTrack:op,ColorManagement:ht,CompressedArrayTexture:qC,CompressedCubeTexture:jC,CompressedTexture:ph,CompressedTextureLoader:Bw,ConeGeometry:vh,ConstantAlphaFactor:av,ConstantColorFactor:sv,Controls:T_,CubeCamera:kv,CubeReflectionMapping:Ui,CubeRefractionMapping:nr,CubeTexture:ca,CubeTextureLoader:Tw,CubeUVReflectionMapping:Gs,CubicBezierCurve:Kf,CubicBezierCurve3:Zv,CubicInterpolant:gy,CullFaceBack:Rd,CullFaceFront:H0,CullFaceFrontBack:nb,CullFaceNone:z0,Curve:$n,CurvePath:ey,CustomBlending:W0,CustomToneMapping:Av,CylinderGeometry:Vs,Cylindrical:d_,Data3DTexture:ah,DataArrayTexture:la,DataTexture:li,DataTextureLoader:Rw,DataUtils:yC,DecrementStencilOp:gb,DecrementWrapStencilOp:yb,DefaultLoadingManager:Ey,DepthFormat:er,DepthStencilFormat:tr,DepthTexture:Xf,DetachedBindMode:vv,DirectionalLight:wy,DirectionalLightHelper:b_,DiscreteInterpolant:vy,DodecahedronGeometry:yh,DoubleSide:si,DstAlphaFactor:ev,DstColorFactor:nv,DynamicCopyUsage:Pb,DynamicDrawUsage:Ib,DynamicReadUsage:Rb,EdgesGeometry:ty,EllipseCurve:Ah,EqualCompare:Sv,EqualDepth:tc,EqualStencilFunc:Cb,EquirectangularReflectionMapping:Oo,EquirectangularRefractionMapping:ko,Euler:Ln,EventDispatcher:ui,ExtrudeGeometry:xh,FileLoader:Oi,Float16BufferAttribute:MC,Float32BufferAttribute:Qe,FloatType:un,Fog:uh,FogExp2:hh,FramebufferTexture:WC,FrontSide:Pi,Frustum:ha,GLBufferAttribute:c_,GLSL1:Fb,GLSL3:Od,GreaterCompare:Iv,GreaterDepth:ic,GreaterEqualCompare:Tv,GreaterEqualDepth:nc,GreaterEqualStencilFunc:Sb,GreaterStencilFunc:_b,GridHelper:E_,Group:Bs,HalfFloatType:zs,HemisphereLight:xy,HemisphereLightHelper:y_,IcosahedronGeometry:bh,ImageBitmapLoader:kw,ImageLoader:ea,ImageUtils:Pv,IncrementStencilOp:mb,IncrementWrapStencilOp:vb,InstancedBufferAttribute:ks,InstancedBufferGeometry:By,InstancedInterleavedBuffer:l_,InstancedMesh:Wv,Int16BufferAttribute:wC,Int32BufferAttribute:_C,Int8BufferAttribute:xC,IntType:$c,InterleavedBuffer:dh,InterleavedBufferAttribute:jr,Interpolant:pa,InterpolateDiscrete:Go,InterpolateLinear:Rc,InterpolateSmooth:Ql,InvertStencilOp:Eb,KeepStencilOp:Pr,KeyframeTrack:ei,LOD:Hv,LatheGeometry:ua,Layers:lh,LessCompare:Mv,LessDepth:ec,LessEqualCompare:Gf,LessEqualDepth:Wr,LessEqualStencilFunc:wb,LessStencilFunc:bb,Light:cr,LightProbe:Iy,Line:ir,Line3:p_,LineBasicMaterial:gn,LineCurve:Jf,LineCurve3:$v,LineDashedMaterial:py,LineLoop:jv,LineSegments:di,LinearFilter:Ht,LinearInterpolant:sp,LinearMipMapLinearFilter:ab,LinearMipMapNearestFilter:ob,LinearMipmapLinearFilter:oi,LinearMipmapNearestFilter:_o,LinearSRGBColorSpace:qr,LinearToneMapping:uv,LinearTransfer:Ho,Loader:_n,LoaderUtils:zd,LoadingManager:ap,LoopOnce:yv,LoopPingPong:xv,LoopRepeat:Ev,LuminanceAlphaFormat:Of,LuminanceFormat:Ff,MOUSE:eb,Material:on,MaterialLoader:Th,MathUtils:eC,Matrix2:fp,Matrix3:et,Matrix4:Ye,MaxEquation:Y0,Mesh:kt,MeshBasicMaterial:ar,MeshDepthMaterial:np,MeshDistanceMaterial:ip,MeshLambertMaterial:dy,MeshMatcapMaterial:fy,MeshNormalMaterial:uy,MeshPhongMaterial:cy,MeshPhysicalMaterial:ly,MeshStandardMaterial:tp,MeshToonMaterial:hy,MinEquation:X0,MirroredRepeatWrapping:Qo,MixOperation:cv,MultiplyBlending:Pd,MultiplyOperation:oa,NearestFilter:Zt,NearestMipMapLinearFilter:sb,NearestMipMapNearestFilter:rb,NearestMipmapLinearFilter:Ss,NearestMipmapNearestFilter:Tf,NeutralToneMapping:gv,NeverCompare:_v,NeverDepth:Zl,NeverStencilFunc:xb,NoBlending:Bi,NoColorSpace:Ci,NoToneMapping:Ti,NormalAnimationBlendMode:sh,NormalBlending:Gr,NotEqualCompare:Bv,NotEqualDepth:rc,NotEqualStencilFunc:Mb,NumberKeyframeTrack:Jo,Object3D:gt,ObjectLoader:Fw,ObjectSpaceNormalMap:wv,OctahedronGeometry:da,OneFactor:J0,OneMinusConstantAlphaFactor:lv,OneMinusConstantColorFactor:ov,OneMinusDstAlphaFactor:tv,OneMinusDstColorFactor:iv,OneMinusSrcAlphaFactor:Jl,OneMinusSrcColorFactor:$0,OrthographicCamera:Bh,PCFShadowMap:Bf,PCFSoftShadowMap:V0,PMREMGenerator:Wd,Path:jo,PerspectiveCamera:Yt,Plane:Ki,PlaneGeometry:Ws,PlaneHelper:M_,PointLight:Cy,PointLightHelper:g_,Points:Xv,PointsMaterial:jf,PolarGridHelper:x_,PolyhedronGeometry:lr,PositionalAudio:Vw,PropertyBinding:At,PropertyMixer:Py,QuadraticBezierCurve:Zf,QuadraticBezierCurve3:$f,Quaternion:wn,QuaternionKeyframeTrack:Aa,QuaternionLinearInterpolant:yy,RED_GREEN_RGTC2_Format:Bc,RED_RGTC1_Format:Nf,REVISION:Jc,RGBADepthPacking:Cv,RGBAFormat:pn,RGBAIntegerFormat:rh,RGBA_ASTC_10x10_Format:Cc,RGBA_ASTC_10x5_Format:Ec,RGBA_ASTC_10x6_Format:xc,RGBA_ASTC_10x8_Format:bc,RGBA_ASTC_12x10_Format:wc,RGBA_ASTC_12x12_Format:_c,RGBA_ASTC_4x4_Format:dc,RGBA_ASTC_5x4_Format:fc,RGBA_ASTC_5x5_Format:pc,RGBA_ASTC_6x5_Format:Ac,RGBA_ASTC_6x6_Format:mc,RGBA_ASTC_8x5_Format:gc,RGBA_ASTC_8x6_Format:vc,RGBA_ASTC_8x8_Format:yc,RGBA_BPTC_Format:To,RGBA_ETC2_EAC_Format:uc,RGBA_PVRTC_2BPPV1_Format:lc,RGBA_PVRTC_4BPPV1_Format:ac,RGBA_S3TC_DXT1_Format:So,RGBA_S3TC_DXT3_Format:Io,RGBA_S3TC_DXT5_Format:Bo,RGBDepthPacking:db,RGBFormat:Uf,RGBIntegerFormat:lb,RGB_BPTC_SIGNED_Format:Mc,RGB_BPTC_UNSIGNED_Format:Sc,RGB_ETC1_Format:cc,RGB_ETC2_Format:hc,RGB_PVRTC_2BPPV1_Format:oc,RGB_PVRTC_4BPPV1_Format:sc,RGB_S3TC_DXT1_Format:Mo,RGDepthPacking:fb,RGFormat:kf,RGIntegerFormat:ih,RawShaderMaterial:ay,Ray:Hs,Raycaster:h_,RectAreaLight:My,RedFormat:nh,RedIntegerFormat:aa,ReinhardToneMapping:dv,RenderTarget:oh,RenderTarget3D:r_,RenderTargetArray:s_,RepeatWrapping:No,ReplaceStencilOp:Ab,ReverseSubtractEquation:j0,RingGeometry:Ch,SIGNED_RED_GREEN_RGTC2_Format:Tc,SIGNED_RED_RGTC1_Format:Ic,SRGBColorSpace:xn,SRGBTransfer:bt,Scene:Qv,ShaderChunk:st,ShaderLib:Xn,ShaderMaterial:Zn,ShadowMaterial:oy,Shape:Hr,ShapeGeometry:wh,ShapePath:B_,ShapeUtils:ci,ShortType:Lf,Skeleton:fh,SkeletonHelper:m_,SkinnedMesh:Vv,Source:Nr,Sphere:sn,SphereGeometry:fa,Spherical:u_,SphericalHarmonics3:Sy,SplineCurve:ep,SpotLight:by,SpotLightHelper:A_,Sprite:zv,SpriteMaterial:Wf,SrcAlphaFactor:Kl,SrcAlphaSaturateFactor:rv,SrcColorFactor:Z0,StaticCopyUsage:Db,StaticDrawUsage:Vo,StaticReadUsage:Tb,StereoCamera:Qw,StreamCopyUsage:Ub,StreamDrawUsage:Bb,StreamReadUsage:Lb,StringKeyframeTrack:Jr,SubtractEquation:q0,SubtractiveBlending:Dd,TOUCH:tb,TangentSpaceNormalMap:or,TetrahedronGeometry:_h,Texture:Tt,TextureLoader:Lw,TextureUtils:U_,TimestampQuery:Ob,TorusGeometry:Mh,TorusKnotGeometry:Sh,Triangle:bn,TriangleFanDrawMode:ub,TriangleStripDrawMode:hb,TrianglesDrawMode:cb,TubeGeometry:Ih,UVMapping:Zc,Uint16BufferAttribute:Hf,Uint32BufferAttribute:Vf,Uint8BufferAttribute:bC,Uint8ClampedBufferAttribute:CC,Uniform:dp,UniformsGroup:a_,UniformsLib:_e,UniformsUtils:Ov,UnsignedByteType:hi,UnsignedInt248Type:$i,UnsignedInt5999Type:Df,UnsignedIntType:Fi,UnsignedShort4444Type:eh,UnsignedShort5551Type:th,UnsignedShortType:Us,VSMShadowMap:ii,Vector2:fe,Vector3:F,Vector4:mt,VectorKeyframeTrack:Zo,VideoFrameTexture:VC,VideoTexture:Yv,WebGL3DRenderTarget:cC,WebGLArrayRenderTarget:lC,WebGLCoordinateSystem:Kn,WebGLCubeRenderTarget:Nv,WebGLRenderTarget:Jn,WebGLRenderer:mI,WebGLUtils:zy,WebGPUCoordinateSystem:Wo,WebXRController:Gl,WireframeGeometry:sy,WrapAroundEnding:zo,ZeroCurvatureEnding:Or,ZeroFactor:K0,ZeroSlopeEnding:kr,ZeroStencilOp:pb,createCanvasElement:Dv},Symbol.toStringTag,{value:"Module"}));var vI={},Vy={8167:n=>{var e=Object.prototype.toString;n.exports=function(t){return t.BYTES_PER_ELEMENT&&e.call(t.buffer)==="[object ArrayBuffer]"||Array.isArray(t)}},5734:n=>{n.exports=function(e,t){return typeof e=="number"?e:typeof t=="number"?t:0}},7961:(n,e)=>{e.byteLength=function(c){var h=a(c),u=h[0],d=h[1];return 3*(u+d)/4-d},e.toByteArray=function(c){var h,u,d=a(c),f=d[0],A=d[1],g=new r(function(v,y,b){return 3*(y+b)/4-b}(0,f,A)),m=0,p=A>0?f-4:f;for(u=0;u<p;u+=4)h=i[c.charCodeAt(u)]<<18|i[c.charCodeAt(u+1)]<<12|i[c.charCodeAt(u+2)]<<6|i[c.charCodeAt(u+3)],g[m++]=h>>16&255,g[m++]=h>>8&255,g[m++]=255&h;return A===2&&(h=i[c.charCodeAt(u)]<<2|i[c.charCodeAt(u+1)]>>4,g[m++]=255&h),A===1&&(h=i[c.charCodeAt(u)]<<10|i[c.charCodeAt(u+1)]<<4|i[c.charCodeAt(u+2)]>>2,g[m++]=h>>8&255,g[m++]=255&h),g},e.fromByteArray=function(c){for(var h,u=c.length,d=u%3,f=[],A=16383,g=0,m=u-d;g<m;g+=A)f.push(l(c,g,g+A>m?m:g+A));return d===1?(h=c[u-1],f.push(t[h>>2]+t[h<<4&63]+"==")):d===2&&(h=(c[u-2]<<8)+c[u-1],f.push(t[h>>10]+t[h>>4&63]+t[h<<2&63]+"=")),f.join("")};for(var t=[],i=[],r=typeof Uint8Array<"u"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)t[o]=s[o],i[s.charCodeAt(o)]=o;function a(c){var h=c.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=c.indexOf("=");return u===-1&&(u=h),[u,u===h?0:4-u%4]}function l(c,h,u){for(var d,f,A=[],g=h;g<u;g+=3)d=(c[g]<<16&16711680)+(c[g+1]<<8&65280)+(255&c[g+2]),A.push(t[(f=d)>>18&63]+t[f>>12&63]+t[f>>6&63]+t[63&f]);return A.join("")}i[45]=62,i[95]=63},911:(n,e,t)=>{var i=t(9922).hp;n.exports=function(r,s){if(i.isBuffer(r)&&i.isBuffer(s)){if(typeof r.equals=="function")return r.equals(s);if(r.length!==s.length)return!1;for(var o=0;o<r.length;o++)if(r[o]!==s[o])return!1;return!0}}},9922:(n,e,t)=>{const i=t(7961),r=t(1024),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=l,e.IS=50;const o=2147483647;function a(x){if(x>o)throw new RangeError('The value "'+x+'" is invalid for option "size"');const C=new Uint8Array(x);return Object.setPrototypeOf(C,l.prototype),C}function l(x,C,T){if(typeof x=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(x)}return c(x,C,T)}function c(x,C,T){if(typeof x=="string")return function(j,ie){if(typeof ie=="string"&&ie!==""||(ie="utf8"),!l.isEncoding(ie))throw new TypeError("Unknown encoding: "+ie);const ke=0|g(j,ie);let P=a(ke);const B=P.write(j,ie);return B!==ke&&(P=P.slice(0,B)),P}(x,C);if(ArrayBuffer.isView(x))return function(j){if(le(j,Uint8Array)){const ie=new Uint8Array(j);return f(ie.buffer,ie.byteOffset,ie.byteLength)}return d(j)}(x);if(x==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof x);if(le(x,ArrayBuffer)||x&&le(x.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(x,SharedArrayBuffer)||x&&le(x.buffer,SharedArrayBuffer)))return f(x,C,T);if(typeof x=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const U=x.valueOf&&x.valueOf();if(U!=null&&U!==x)return l.from(U,C,T);const k=function(j){if(l.isBuffer(j)){const ie=0|A(j.length),ke=a(ie);return ke.length===0||j.copy(ke,0,0,ie),ke}return j.length!==void 0?typeof j.length!="number"||ce(j.length)?a(0):d(j):j.type==="Buffer"&&Array.isArray(j.data)?d(j.data):void 0}(x);if(k)return k;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof x[Symbol.toPrimitive]=="function")return l.from(x[Symbol.toPrimitive]("string"),C,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof x)}function h(x){if(typeof x!="number")throw new TypeError('"size" argument must be of type number');if(x<0)throw new RangeError('The value "'+x+'" is invalid for option "size"')}function u(x){return h(x),a(x<0?0:0|A(x))}function d(x){const C=x.length<0?0:0|A(x.length),T=a(C);for(let U=0;U<C;U+=1)T[U]=255&x[U];return T}function f(x,C,T){if(C<0||x.byteLength<C)throw new RangeError('"offset" is outside of buffer bounds');if(x.byteLength<C+(T||0))throw new RangeError('"length" is outside of buffer bounds');let U;return U=C===void 0&&T===void 0?new Uint8Array(x):T===void 0?new Uint8Array(x,C):new Uint8Array(x,C,T),Object.setPrototypeOf(U,l.prototype),U}function A(x){if(x>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|x}function g(x,C){if(l.isBuffer(x))return x.length;if(ArrayBuffer.isView(x)||le(x,ArrayBuffer))return x.byteLength;if(typeof x!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof x);const T=x.length,U=arguments.length>2&&arguments[2]===!0;if(!U&&T===0)return 0;let k=!1;for(;;)switch(C){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return ue(x).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*T;case"hex":return T>>>1;case"base64":return ve(x).length;default:if(k)return U?-1:ue(x).length;C=(""+C).toLowerCase(),k=!0}}function m(x,C,T){let U=!1;if((C===void 0||C<0)&&(C=0),C>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0)<=(C>>>=0))return"";for(x||(x="utf8");;)switch(x){case"hex":return z(this,C,T);case"utf8":case"utf-8":return I(this,C,T);case"ascii":return Q(this,C,T);case"latin1":case"binary":return N(this,C,T);case"base64":return _(this,C,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,C,T);default:if(U)throw new TypeError("Unknown encoding: "+x);x=(x+"").toLowerCase(),U=!0}}function p(x,C,T){const U=x[C];x[C]=x[T],x[T]=U}function v(x,C,T,U,k){if(x.length===0)return-1;if(typeof T=="string"?(U=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),ce(T=+T)&&(T=k?0:x.length-1),T<0&&(T=x.length+T),T>=x.length){if(k)return-1;T=x.length-1}else if(T<0){if(!k)return-1;T=0}if(typeof C=="string"&&(C=l.from(C,U)),l.isBuffer(C))return C.length===0?-1:y(x,C,T,U,k);if(typeof C=="number")return C&=255,typeof Uint8Array.prototype.indexOf=="function"?k?Uint8Array.prototype.indexOf.call(x,C,T):Uint8Array.prototype.lastIndexOf.call(x,C,T):y(x,[C],T,U,k);throw new TypeError("val must be string, number or Buffer")}function y(x,C,T,U,k){let j,ie=1,ke=x.length,P=C.length;if(U!==void 0&&((U=String(U).toLowerCase())==="ucs2"||U==="ucs-2"||U==="utf16le"||U==="utf-16le")){if(x.length<2||C.length<2)return-1;ie=2,ke/=2,P/=2,T/=2}function B(V,re){return ie===1?V[re]:V.readUInt16BE(re*ie)}if(k){let V=-1;for(j=T;j<ke;j++)if(B(x,j)===B(C,V===-1?0:j-V)){if(V===-1&&(V=j),j-V+1===P)return V*ie}else V!==-1&&(j-=j-V),V=-1}else for(T+P>ke&&(T=ke-P),j=T;j>=0;j--){let V=!0;for(let re=0;re<P;re++)if(B(x,j+re)!==B(C,re)){V=!1;break}if(V)return j}return-1}function b(x,C,T,U){T=Number(T)||0;const k=x.length-T;U?(U=Number(U))>k&&(U=k):U=k;const j=C.length;let ie;for(U>j/2&&(U=j/2),ie=0;ie<U;++ie){const ke=parseInt(C.substr(2*ie,2),16);if(ce(ke))return ie;x[T+ie]=ke}return ie}function w(x,C,T,U){return ne(ue(C,x.length-T),x,T,U)}function M(x,C,T,U){return ne(function(k){const j=[];for(let ie=0;ie<k.length;++ie)j.push(255&k.charCodeAt(ie));return j}(C),x,T,U)}function S(x,C,T,U){return ne(ve(C),x,T,U)}function R(x,C,T,U){return ne(function(k,j){let ie,ke,P;const B=[];for(let V=0;V<k.length&&!((j-=2)<0);++V)ie=k.charCodeAt(V),ke=ie>>8,P=ie%256,B.push(P),B.push(ke);return B}(C,x.length-T),x,T,U)}function _(x,C,T){return C===0&&T===x.length?i.fromByteArray(x):i.fromByteArray(x.slice(C,T))}function I(x,C,T){T=Math.min(x.length,T);const U=[];let k=C;for(;k<T;){const j=x[k];let ie=null,ke=j>239?4:j>223?3:j>191?2:1;if(k+ke<=T){let P,B,V,re;switch(ke){case 1:j<128&&(ie=j);break;case 2:P=x[k+1],(192&P)==128&&(re=(31&j)<<6|63&P,re>127&&(ie=re));break;case 3:P=x[k+1],B=x[k+2],(192&P)==128&&(192&B)==128&&(re=(15&j)<<12|(63&P)<<6|63&B,re>2047&&(re<55296||re>57343)&&(ie=re));break;case 4:P=x[k+1],B=x[k+2],V=x[k+3],(192&P)==128&&(192&B)==128&&(192&V)==128&&(re=(15&j)<<18|(63&P)<<12|(63&B)<<6|63&V,re>65535&&re<1114112&&(ie=re))}}ie===null?(ie=65533,ke=1):ie>65535&&(ie-=65536,U.push(ie>>>10&1023|55296),ie=56320|1023&ie),U.push(ie),k+=ke}return function(j){const ie=j.length;if(ie<=D)return String.fromCharCode.apply(String,j);let ke="",P=0;for(;P<ie;)ke+=String.fromCharCode.apply(String,j.slice(P,P+=D));return ke}(U)}l.TYPED_ARRAY_SUPPORT=function(){try{const x=new Uint8Array(1),C={foo:function(){return 42}};return Object.setPrototypeOf(C,Uint8Array.prototype),Object.setPrototypeOf(x,C),x.foo()===42}catch{return!1}}(),l.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(x,C,T){return c(x,C,T)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(x,C,T){return function(U,k,j){return h(U),U<=0?a(U):k!==void 0?typeof j=="string"?a(U).fill(k,j):a(U).fill(k):a(U)}(x,C,T)},l.allocUnsafe=function(x){return u(x)},l.allocUnsafeSlow=function(x){return u(x)},l.isBuffer=function(x){return x!=null&&x._isBuffer===!0&&x!==l.prototype},l.compare=function(x,C){if(le(x,Uint8Array)&&(x=l.from(x,x.offset,x.byteLength)),le(C,Uint8Array)&&(C=l.from(C,C.offset,C.byteLength)),!l.isBuffer(x)||!l.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(x===C)return 0;let T=x.length,U=C.length;for(let k=0,j=Math.min(T,U);k<j;++k)if(x[k]!==C[k]){T=x[k],U=C[k];break}return T<U?-1:U<T?1:0},l.isEncoding=function(x){switch(String(x).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(x,C){if(!Array.isArray(x))throw new TypeError('"list" argument must be an Array of Buffers');if(x.length===0)return l.alloc(0);let T;if(C===void 0)for(C=0,T=0;T<x.length;++T)C+=x[T].length;const U=l.allocUnsafe(C);let k=0;for(T=0;T<x.length;++T){let j=x[T];if(le(j,Uint8Array))k+j.length>U.length?(l.isBuffer(j)||(j=l.from(j)),j.copy(U,k)):Uint8Array.prototype.set.call(U,j,k);else{if(!l.isBuffer(j))throw new TypeError('"list" argument must be an Array of Buffers');j.copy(U,k)}k+=j.length}return U},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const x=this.length;if(x%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;C<x;C+=2)p(this,C,C+1);return this},l.prototype.swap32=function(){const x=this.length;if(x%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let C=0;C<x;C+=4)p(this,C,C+3),p(this,C+1,C+2);return this},l.prototype.swap64=function(){const x=this.length;if(x%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let C=0;C<x;C+=8)p(this,C,C+7),p(this,C+1,C+6),p(this,C+2,C+5),p(this,C+3,C+4);return this},l.prototype.toString=function(){const x=this.length;return x===0?"":arguments.length===0?I(this,0,x):m.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(x){if(!l.isBuffer(x))throw new TypeError("Argument must be a Buffer");return this===x||l.compare(this,x)===0},l.prototype.inspect=function(){let x="";const C=e.IS;return x=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&(x+=" ... "),"<Buffer "+x+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(x,C,T,U,k){if(le(x,Uint8Array)&&(x=l.from(x,x.offset,x.byteLength)),!l.isBuffer(x))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof x);if(C===void 0&&(C=0),T===void 0&&(T=x?x.length:0),U===void 0&&(U=0),k===void 0&&(k=this.length),C<0||T>x.length||U<0||k>this.length)throw new RangeError("out of range index");if(U>=k&&C>=T)return 0;if(U>=k)return-1;if(C>=T)return 1;if(this===x)return 0;let j=(k>>>=0)-(U>>>=0),ie=(T>>>=0)-(C>>>=0);const ke=Math.min(j,ie),P=this.slice(U,k),B=x.slice(C,T);for(let V=0;V<ke;++V)if(P[V]!==B[V]){j=P[V],ie=B[V];break}return j<ie?-1:ie<j?1:0},l.prototype.includes=function(x,C,T){return this.indexOf(x,C,T)!==-1},l.prototype.indexOf=function(x,C,T){return v(this,x,C,T,!0)},l.prototype.lastIndexOf=function(x,C,T){return v(this,x,C,T,!1)},l.prototype.write=function(x,C,T,U){if(C===void 0)U="utf8",T=this.length,C=0;else if(T===void 0&&typeof C=="string")U=C,T=this.length,C=0;else{if(!isFinite(C))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");C>>>=0,isFinite(T)?(T>>>=0,U===void 0&&(U="utf8")):(U=T,T=void 0)}const k=this.length-C;if((T===void 0||T>k)&&(T=k),x.length>0&&(T<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");U||(U="utf8");let j=!1;for(;;)switch(U){case"hex":return b(this,x,C,T);case"utf8":case"utf-8":return w(this,x,C,T);case"ascii":case"latin1":case"binary":return M(this,x,C,T);case"base64":return S(this,x,C,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,x,C,T);default:if(j)throw new TypeError("Unknown encoding: "+U);U=(""+U).toLowerCase(),j=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const D=4096;function Q(x,C,T){let U="";T=Math.min(x.length,T);for(let k=C;k<T;++k)U+=String.fromCharCode(127&x[k]);return U}function N(x,C,T){let U="";T=Math.min(x.length,T);for(let k=C;k<T;++k)U+=String.fromCharCode(x[k]);return U}function z(x,C,T){const U=x.length;(!C||C<0)&&(C=0),(!T||T<0||T>U)&&(T=U);let k="";for(let j=C;j<T;++j)k+=O[x[j]];return k}function $(x,C,T){const U=x.slice(C,T);let k="";for(let j=0;j<U.length-1;j+=2)k+=String.fromCharCode(U[j]+256*U[j+1]);return k}function H(x,C,T){if(x%1!=0||x<0)throw new RangeError("offset is not uint");if(x+C>T)throw new RangeError("Trying to access beyond buffer length")}function K(x,C,T,U,k,j){if(!l.isBuffer(x))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>k||C<j)throw new RangeError('"value" argument is out of bounds');if(T+U>x.length)throw new RangeError("Index out of range")}function Y(x,C,T,U,k){Ae(C,U,k,x,T,7);let j=Number(C&BigInt(4294967295));x[T++]=j,j>>=8,x[T++]=j,j>>=8,x[T++]=j,j>>=8,x[T++]=j;let ie=Number(C>>BigInt(32)&BigInt(4294967295));return x[T++]=ie,ie>>=8,x[T++]=ie,ie>>=8,x[T++]=ie,ie>>=8,x[T++]=ie,T}function ee(x,C,T,U,k){Ae(C,U,k,x,T,7);let j=Number(C&BigInt(4294967295));x[T+7]=j,j>>=8,x[T+6]=j,j>>=8,x[T+5]=j,j>>=8,x[T+4]=j;let ie=Number(C>>BigInt(32)&BigInt(4294967295));return x[T+3]=ie,ie>>=8,x[T+2]=ie,ie>>=8,x[T+1]=ie,ie>>=8,x[T]=ie,T+8}function pe(x,C,T,U,k,j){if(T+U>x.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function be(x,C,T,U,k){return C=+C,T>>>=0,k||pe(x,0,T,4),r.write(x,C,T,U,23,4),T+4}function Ce(x,C,T,U,k){return C=+C,T>>>=0,k||pe(x,0,T,8),r.write(x,C,T,U,52,8),T+8}l.prototype.slice=function(x,C){const T=this.length;(x=~~x)<0?(x+=T)<0&&(x=0):x>T&&(x=T),(C=C===void 0?T:~~C)<0?(C+=T)<0&&(C=0):C>T&&(C=T),C<x&&(C=x);const U=this.subarray(x,C);return Object.setPrototypeOf(U,l.prototype),U},l.prototype.readUintLE=l.prototype.readUIntLE=function(x,C,T){x>>>=0,C>>>=0,T||H(x,C,this.length);let U=this[x],k=1,j=0;for(;++j<C&&(k*=256);)U+=this[x+j]*k;return U},l.prototype.readUintBE=l.prototype.readUIntBE=function(x,C,T){x>>>=0,C>>>=0,T||H(x,C,this.length);let U=this[x+--C],k=1;for(;C>0&&(k*=256);)U+=this[x+--C]*k;return U},l.prototype.readUint8=l.prototype.readUInt8=function(x,C){return x>>>=0,C||H(x,1,this.length),this[x]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(x,C){return x>>>=0,C||H(x,2,this.length),this[x]|this[x+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(x,C){return x>>>=0,C||H(x,2,this.length),this[x]<<8|this[x+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(x,C){return x>>>=0,C||H(x,4,this.length),(this[x]|this[x+1]<<8|this[x+2]<<16)+16777216*this[x+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(x,C){return x>>>=0,C||H(x,4,this.length),16777216*this[x]+(this[x+1]<<16|this[x+2]<<8|this[x+3])},l.prototype.readBigUInt64LE=me(function(x){se(x>>>=0,"offset");const C=this[x],T=this[x+7];C!==void 0&&T!==void 0||X(x,this.length-8);const U=C+256*this[++x]+65536*this[++x]+this[++x]*2**24,k=this[++x]+256*this[++x]+65536*this[++x]+T*2**24;return BigInt(U)+(BigInt(k)<<BigInt(32))}),l.prototype.readBigUInt64BE=me(function(x){se(x>>>=0,"offset");const C=this[x],T=this[x+7];C!==void 0&&T!==void 0||X(x,this.length-8);const U=C*2**24+65536*this[++x]+256*this[++x]+this[++x],k=this[++x]*2**24+65536*this[++x]+256*this[++x]+T;return(BigInt(U)<<BigInt(32))+BigInt(k)}),l.prototype.readIntLE=function(x,C,T){x>>>=0,C>>>=0,T||H(x,C,this.length);let U=this[x],k=1,j=0;for(;++j<C&&(k*=256);)U+=this[x+j]*k;return k*=128,U>=k&&(U-=Math.pow(2,8*C)),U},l.prototype.readIntBE=function(x,C,T){x>>>=0,C>>>=0,T||H(x,C,this.length);let U=C,k=1,j=this[x+--U];for(;U>0&&(k*=256);)j+=this[x+--U]*k;return k*=128,j>=k&&(j-=Math.pow(2,8*C)),j},l.prototype.readInt8=function(x,C){return x>>>=0,C||H(x,1,this.length),128&this[x]?-1*(255-this[x]+1):this[x]},l.prototype.readInt16LE=function(x,C){x>>>=0,C||H(x,2,this.length);const T=this[x]|this[x+1]<<8;return 32768&T?4294901760|T:T},l.prototype.readInt16BE=function(x,C){x>>>=0,C||H(x,2,this.length);const T=this[x+1]|this[x]<<8;return 32768&T?4294901760|T:T},l.prototype.readInt32LE=function(x,C){return x>>>=0,C||H(x,4,this.length),this[x]|this[x+1]<<8|this[x+2]<<16|this[x+3]<<24},l.prototype.readInt32BE=function(x,C){return x>>>=0,C||H(x,4,this.length),this[x]<<24|this[x+1]<<16|this[x+2]<<8|this[x+3]},l.prototype.readBigInt64LE=me(function(x){se(x>>>=0,"offset");const C=this[x],T=this[x+7];C!==void 0&&T!==void 0||X(x,this.length-8);const U=this[x+4]+256*this[x+5]+65536*this[x+6]+(T<<24);return(BigInt(U)<<BigInt(32))+BigInt(C+256*this[++x]+65536*this[++x]+this[++x]*2**24)}),l.prototype.readBigInt64BE=me(function(x){se(x>>>=0,"offset");const C=this[x],T=this[x+7];C!==void 0&&T!==void 0||X(x,this.length-8);const U=(C<<24)+65536*this[++x]+256*this[++x]+this[++x];return(BigInt(U)<<BigInt(32))+BigInt(this[++x]*2**24+65536*this[++x]+256*this[++x]+T)}),l.prototype.readFloatLE=function(x,C){return x>>>=0,C||H(x,4,this.length),r.read(this,x,!0,23,4)},l.prototype.readFloatBE=function(x,C){return x>>>=0,C||H(x,4,this.length),r.read(this,x,!1,23,4)},l.prototype.readDoubleLE=function(x,C){return x>>>=0,C||H(x,8,this.length),r.read(this,x,!0,52,8)},l.prototype.readDoubleBE=function(x,C){return x>>>=0,C||H(x,8,this.length),r.read(this,x,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(x,C,T,U){x=+x,C>>>=0,T>>>=0,U||K(this,x,C,T,Math.pow(2,8*T)-1,0);let k=1,j=0;for(this[C]=255&x;++j<T&&(k*=256);)this[C+j]=x/k&255;return C+T},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(x,C,T,U){x=+x,C>>>=0,T>>>=0,U||K(this,x,C,T,Math.pow(2,8*T)-1,0);let k=T-1,j=1;for(this[C+k]=255&x;--k>=0&&(j*=256);)this[C+k]=x/j&255;return C+T},l.prototype.writeUint8=l.prototype.writeUInt8=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,1,255,0),this[C]=255&x,C+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,2,65535,0),this[C]=255&x,this[C+1]=x>>>8,C+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,2,65535,0),this[C]=x>>>8,this[C+1]=255&x,C+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,4,4294967295,0),this[C+3]=x>>>24,this[C+2]=x>>>16,this[C+1]=x>>>8,this[C]=255&x,C+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,4,4294967295,0),this[C]=x>>>24,this[C+1]=x>>>16,this[C+2]=x>>>8,this[C+3]=255&x,C+4},l.prototype.writeBigUInt64LE=me(function(x,C=0){return Y(this,x,C,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=me(function(x,C=0){return ee(this,x,C,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(x,C,T,U){if(x=+x,C>>>=0,!U){const ke=Math.pow(2,8*T-1);K(this,x,C,T,ke-1,-ke)}let k=0,j=1,ie=0;for(this[C]=255&x;++k<T&&(j*=256);)x<0&&ie===0&&this[C+k-1]!==0&&(ie=1),this[C+k]=(x/j|0)-ie&255;return C+T},l.prototype.writeIntBE=function(x,C,T,U){if(x=+x,C>>>=0,!U){const ke=Math.pow(2,8*T-1);K(this,x,C,T,ke-1,-ke)}let k=T-1,j=1,ie=0;for(this[C+k]=255&x;--k>=0&&(j*=256);)x<0&&ie===0&&this[C+k+1]!==0&&(ie=1),this[C+k]=(x/j|0)-ie&255;return C+T},l.prototype.writeInt8=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,1,127,-128),x<0&&(x=255+x+1),this[C]=255&x,C+1},l.prototype.writeInt16LE=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,2,32767,-32768),this[C]=255&x,this[C+1]=x>>>8,C+2},l.prototype.writeInt16BE=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,2,32767,-32768),this[C]=x>>>8,this[C+1]=255&x,C+2},l.prototype.writeInt32LE=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,4,2147483647,-2147483648),this[C]=255&x,this[C+1]=x>>>8,this[C+2]=x>>>16,this[C+3]=x>>>24,C+4},l.prototype.writeInt32BE=function(x,C,T){return x=+x,C>>>=0,T||K(this,x,C,4,2147483647,-2147483648),x<0&&(x=4294967295+x+1),this[C]=x>>>24,this[C+1]=x>>>16,this[C+2]=x>>>8,this[C+3]=255&x,C+4},l.prototype.writeBigInt64LE=me(function(x,C=0){return Y(this,x,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=me(function(x,C=0){return ee(this,x,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeFloatLE=function(x,C,T){return be(this,x,C,!0,T)},l.prototype.writeFloatBE=function(x,C,T){return be(this,x,C,!1,T)},l.prototype.writeDoubleLE=function(x,C,T){return Ce(this,x,C,!0,T)},l.prototype.writeDoubleBE=function(x,C,T){return Ce(this,x,C,!1,T)},l.prototype.copy=function(x,C,T,U){if(!l.isBuffer(x))throw new TypeError("argument should be a Buffer");if(T||(T=0),U||U===0||(U=this.length),C>=x.length&&(C=x.length),C||(C=0),U>0&&U<T&&(U=T),U===T||x.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(T<0||T>=this.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("sourceEnd out of bounds");U>this.length&&(U=this.length),x.length-C<U-T&&(U=x.length-C+T);const k=U-T;return this===x&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(C,T,U):Uint8Array.prototype.set.call(x,this.subarray(T,U),C),k},l.prototype.fill=function(x,C,T,U){if(typeof x=="string"){if(typeof C=="string"?(U=C,C=0,T=this.length):typeof T=="string"&&(U=T,T=this.length),U!==void 0&&typeof U!="string")throw new TypeError("encoding must be a string");if(typeof U=="string"&&!l.isEncoding(U))throw new TypeError("Unknown encoding: "+U);if(x.length===1){const j=x.charCodeAt(0);(U==="utf8"&&j<128||U==="latin1")&&(x=j)}}else typeof x=="number"?x&=255:typeof x=="boolean"&&(x=Number(x));if(C<0||this.length<C||this.length<T)throw new RangeError("Out of range index");if(T<=C)return this;let k;if(C>>>=0,T=T===void 0?this.length:T>>>0,x||(x=0),typeof x=="number")for(k=C;k<T;++k)this[k]=x;else{const j=l.isBuffer(x)?x:l.from(x,U),ie=j.length;if(ie===0)throw new TypeError('The value "'+x+'" is invalid for argument "value"');for(k=0;k<T-C;++k)this[k+C]=j[k%ie]}return this};const Pe={};function Me(x,C,T){Pe[x]=class extends T{constructor(){super(),Object.defineProperty(this,"message",{value:C.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${x}]`,this.stack,delete this.name}get code(){return x}set code(U){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:U,writable:!0})}toString(){return`${this.name} [${x}]: ${this.message}`}}}function te(x){let C="",T=x.length;const U=x[0]==="-"?1:0;for(;T>=U+4;T-=3)C=`_${x.slice(T-3,T)}${C}`;return`${x.slice(0,T)}${C}`}function Ae(x,C,T,U,k,j){if(x>T||x<C){const ie=typeof C=="bigint"?"n":"";let ke;throw ke=C===0||C===BigInt(0)?`>= 0${ie} and < 2${ie} ** ${8*(j+1)}${ie}`:`>= -(2${ie} ** ${8*(j+1)-1}${ie}) and < 2 ** ${8*(j+1)-1}${ie}`,new Pe.ERR_OUT_OF_RANGE("value",ke,x)}(function(ie,ke,P){se(ke,"offset"),ie[ke]!==void 0&&ie[ke+P]!==void 0||X(ke,ie.length-(P+1))})(U,k,j)}function se(x,C){if(typeof x!="number")throw new Pe.ERR_INVALID_ARG_TYPE(C,"number",x)}function X(x,C,T){throw Math.floor(x)!==x?(se(x,T),new Pe.ERR_OUT_OF_RANGE("offset","an integer",x)):C<0?new Pe.ERR_BUFFER_OUT_OF_BOUNDS:new Pe.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${C}`,x)}Me("ERR_BUFFER_OUT_OF_BOUNDS",function(x){return x?`${x} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Me("ERR_INVALID_ARG_TYPE",function(x,C){return`The "${x}" argument must be of type number. Received type ${typeof C}`},TypeError),Me("ERR_OUT_OF_RANGE",function(x,C,T){let U=`The value of "${x}" is out of range.`,k=T;return Number.isInteger(T)&&Math.abs(T)>2**32?k=te(String(T)):typeof T=="bigint"&&(k=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(k=te(k)),k+="n"),U+=` It must be ${C}. Received ${k}`,U},RangeError);const he=/[^+/0-9A-Za-z-_]/g;function ue(x,C){let T;C=C||1/0;const U=x.length;let k=null;const j=[];for(let ie=0;ie<U;++ie){if(T=x.charCodeAt(ie),T>55295&&T<57344){if(!k){if(T>56319){(C-=3)>-1&&j.push(239,191,189);continue}if(ie+1===U){(C-=3)>-1&&j.push(239,191,189);continue}k=T;continue}if(T<56320){(C-=3)>-1&&j.push(239,191,189),k=T;continue}T=65536+(k-55296<<10|T-56320)}else k&&(C-=3)>-1&&j.push(239,191,189);if(k=null,T<128){if((C-=1)<0)break;j.push(T)}else if(T<2048){if((C-=2)<0)break;j.push(T>>6|192,63&T|128)}else if(T<65536){if((C-=3)<0)break;j.push(T>>12|224,T>>6&63|128,63&T|128)}else{if(!(T<1114112))throw new Error("Invalid code point");if((C-=4)<0)break;j.push(T>>18|240,T>>12&63|128,T>>6&63|128,63&T|128)}}return j}function ve(x){return i.toByteArray(function(C){if((C=(C=C.split("=")[0]).trim().replace(he,"")).length<2)return"";for(;C.length%4!=0;)C+="=";return C}(x))}function ne(x,C,T,U){let k;for(k=0;k<U&&!(k+T>=C.length||k>=x.length);++k)C[k+T]=x[k];return k}function le(x,C){return x instanceof C||x!=null&&x.constructor!=null&&x.constructor.name!=null&&x.constructor.name===C.name}function ce(x){return x!=x}const O=function(){const x="0123456789abcdef",C=new Array(256);for(let T=0;T<16;++T){const U=16*T;for(let k=0;k<16;++k)C[U+k]=x[T]+x[k]}return C}();function me(x){return typeof BigInt>"u"?ye:x}function ye(){throw new Error("BigInt not supported")}},9089:n=>{n.exports=function(e){var t=[];return t.toString=function(){return this.map(function(i){var r="",s=i[5]!==void 0;return i[4]&&(r+="@supports (".concat(i[4],") {")),i[2]&&(r+="@media ".concat(i[2]," {")),s&&(r+="@layer".concat(i[5].length>0?" ".concat(i[5]):""," {")),r+=e(i),s&&(r+="}"),i[2]&&(r+="}"),i[4]&&(r+="}"),r}).join("")},t.i=function(i,r,s,o,a){typeof i=="string"&&(i=[[null,i,void 0]]);var l={};if(s)for(var c=0;c<this.length;c++){var h=this[c][0];h!=null&&(l[h]=!0)}for(var u=0;u<i.length;u++){var d=[].concat(i[u]);s&&l[d[0]]||(a!==void 0&&(d[5]===void 0||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=a),r&&(d[2]&&(d[1]="@media ".concat(d[2]," {").concat(d[1],"}")),d[2]=r),o&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=o):d[4]="".concat(o)),t.push(d))}},t}},6492:n=>{n.exports=function(e,t){return t||(t={}),e&&(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e)}},963:n=>{n.exports=function(e){var t=e[1],i=e[3];if(!i)return t;if(typeof btoa=="function"){var r=btoa(unescape(encodeURIComponent(JSON.stringify(i)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),o="/*# ".concat(s," */");return[t].concat([o]).join(`
`)}return[t].join(`
`)}},8878:(n,e,t)=>{e.formatArgs=function(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;r.splice(1,0,s,"color: inherit");let o=0,a=0;r[0].replace(/%[a-zA-Z%]/g,l=>{l!=="%%"&&(o++,l==="%c"&&(a=o))}),r.splice(a,0,s)},e.save=function(r){try{r?e.storage.setItem("debug",r):e.storage.removeItem("debug")}catch{}},e.load=function(){let r;try{r=e.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=vI.DEBUG),r},e.useColors=function(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch{}}(),e.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),n.exports=t(8945)(e);const{formatters:i}=n.exports;i.j=function(r){try{return JSON.stringify(r)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}},8945:(n,e,t)=>{n.exports=function(i){function r(a){let l,c,h,u=null;function d(...f){if(!d.enabled)return;const A=d,g=Number(new Date),m=g-(l||g);A.diff=m,A.prev=l,A.curr=g,l=g,f[0]=r.coerce(f[0]),typeof f[0]!="string"&&f.unshift("%O");let p=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,(v,y)=>{if(v==="%%")return"%";p++;const b=r.formatters[y];if(typeof b=="function"){const w=f[p];v=b.call(A,w),f.splice(p,1),p--}return v}),r.formatArgs.call(A,f),(A.log||r.log).apply(A,f)}return d.namespace=a,d.useColors=r.useColors(),d.color=r.selectColor(a),d.extend=s,d.destroy=r.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(c!==r.namespaces&&(c=r.namespaces,h=r.enabled(a)),h),set:f=>{u=f}}),typeof r.init=="function"&&r.init(d),d}function s(a,l){const c=r(this.namespace+(l===void 0?":":l)+a);return c.log=this.log,c}function o(a,l){let c=0,h=0,u=-1,d=0;for(;c<a.length;)if(h<l.length&&(l[h]===a[c]||l[h]==="*"))l[h]==="*"?(u=h,d=c,h++):(c++,h++);else{if(u===-1)return!1;h=u+1,d++,c=d}for(;h<l.length&&l[h]==="*";)h++;return h===l.length}return r.debug=r,r.default=r,r.coerce=function(a){return a instanceof Error?a.stack||a.message:a},r.disable=function(){const a=[...r.names,...r.skips.map(l=>"-"+l)].join(",");return r.enable(""),a},r.enable=function(a){r.save(a),r.namespaces=a,r.names=[],r.skips=[];const l=(typeof a=="string"?a:"").trim().replace(" ",",").split(",").filter(Boolean);for(const c of l)c[0]==="-"?r.skips.push(c.slice(1)):r.names.push(c)},r.enabled=function(a){for(const l of r.skips)if(o(a,l))return!1;for(const l of r.names)if(o(a,l))return!0;return!1},r.humanize=t(9192),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(i).forEach(a=>{r[a]=i[a]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(a){let l=0;for(let c=0;c<a.length;c++)l=(l<<5)-l+a.charCodeAt(c),l|=0;return r.colors[Math.abs(l)%r.colors.length]},r.enable(r.load()),r}},1124:(n,e,t)=>{var i=t(6240),r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(l,c,h){var u=c[h];if(u!=null){if(r.call(l,h)&&(l[h]===void 0||l[h]===null))throw new TypeError("Cannot convert undefined or null to object ("+h+")");r.call(l,h)&&i(u)?l[h]=a(Object(l[h]),c[h]):l[h]=u}}function a(l,c){if(l===c)return l;for(var h in c=Object(c))r.call(c,h)&&o(l,c,h);if(Object.getOwnPropertySymbols)for(var u=Object.getOwnPropertySymbols(c),d=0;d<u.length;d++)s.call(c,u[d])&&o(l,c,u[d]);return l}n.exports=function(l){l=function(h){if(h==null)throw new TypeError("Sources cannot be null or undefined");return Object(h)}(l);for(var c=1;c<arguments.length;c++)a(l,arguments[c]);return l}},8480:n=>{n.exports=function(e){switch(e){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},919:(n,e,t)=>{var i;i=typeof window<"u"?window:t.g!==void 0?t.g:typeof self<"u"?self:{},n.exports=i},1024:(n,e)=>{e.read=function(t,i,r,s,o){var a,l,c=8*o-s-1,h=(1<<c)-1,u=h>>1,d=-7,f=r?o-1:0,A=r?-1:1,g=t[i+f];for(f+=A,a=g&(1<<-d)-1,g>>=-d,d+=c;d>0;a=256*a+t[i+f],f+=A,d-=8);for(l=a&(1<<-d)-1,a>>=-d,d+=s;d>0;l=256*l+t[i+f],f+=A,d-=8);if(a===0)a=1-u;else{if(a===h)return l?NaN:1/0*(g?-1:1);l+=Math.pow(2,s),a-=u}return(g?-1:1)*l*Math.pow(2,a-s)},e.write=function(t,i,r,s,o,a){var l,c,h,u=8*a-o-1,d=(1<<u)-1,f=d>>1,A=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=s?0:a-1,m=s?1:-1,p=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(c=isNaN(i)?1:0,l=d):(l=Math.floor(Math.log(i)/Math.LN2),i*(h=Math.pow(2,-l))<1&&(l--,h*=2),(i+=l+f>=1?A/h:A*Math.pow(2,1-f))*h>=2&&(l++,h/=2),l+f>=d?(c=0,l=d):l+f>=1?(c=(i*h-1)*Math.pow(2,o),l+=f):(c=i*Math.pow(2,f-1)*Math.pow(2,o),l=0));o>=8;t[r+g]=255&c,g+=m,c/=256,o-=8);for(l=l<<o|c,u+=o;u>0;t[r+g]=255&l,g+=m,l/=256,u-=8);t[r+g-m]|=128*p}},2225:n=>{function e(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}n.exports=function(t){return t!=null&&(e(t)||function(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&e(i.slice(0,0))}(t)||!!t._isBuffer)}},8847:n=>{n.exports=function(t){if(!t)return!1;var i=e.call(t);return i==="[object Function]"||typeof t=="function"&&i!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},6240:n=>{n.exports=function(e){var t=typeof e;return e!==null&&(t==="object"||t==="function")}},5651:(n,e,t)=>{var i=t(5406),r=t(4597),s=t(5734),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c=9,h=32;function u(m){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(m)}function d(m){return new Function(["return function "+m+"() {"," return this._"+m,"}"].join(`
`))()}function f(m,p){if(!m.chars||m.chars.length===0)return null;var v=g(m.chars,p);return v>=0?m.chars[v]:null}function A(m,p,v){if(!m.kernings||m.kernings.length===0)return 0;for(var y=m.kernings,b=0;b<y.length;b++){var w=y[b];if(w.first===p&&w.second===v)return w.amount}return 0}function g(m,p,v){for(var y=v=v||0;y<m.length;y++)if(m[y].id===p)return y;return-1}n.exports=function(m){return new u(m)},u.prototype.update=function(m){if(m=r({measure:this._measure},m),this._opt=m,this._opt.tabSize=s(this._opt.tabSize,4),!m.font)throw new Error("must provide a valid bitmap font");var p=this.glyphs,v=m.text||"",y=m.font;this._setupSpaceGlyphs(y);var b=i.lines(v,m),w=m.width||0;p.length=0;var M=b.reduce(function(H,K){return Math.max(H,K.width,w)},0),S=0,R=0,_=s(m.lineHeight,y.common.lineHeight),I=y.common.base,D=_-I,Q=m.letterSpacing||0,N=_*b.length-D,z=function(H){return H==="center"?1:H==="right"?2:0}(this._opt.align);R-=N,this._width=M,this._height=N,this._descender=_-I,this._baseline=I,this._xHeight=function(H){for(var K=0;K<o.length;K++){var Y=o[K].charCodeAt(0),ee=g(H.chars,Y);if(ee>=0)return H.chars[ee].height}return 0}(y),this._capHeight=function(H){for(var K=0;K<l.length;K++){var Y=l[K].charCodeAt(0),ee=g(H.chars,Y);if(ee>=0)return H.chars[ee].height}return 0}(y),this._lineHeight=_,this._ascender=_-D-this._xHeight;var $=this;b.forEach(function(H,K){for(var Y,ee=H.start,pe=H.end,be=H.width,Ce=ee;Ce<pe;Ce++){var Pe=v.charCodeAt(Ce),Me=$.getGlyph(y,Pe);if(Me){Y&&(S+=A(y,Y.id,Me.id));var te=S;z===1?te+=(M-be)/2:z===2&&(te+=M-be),p.push({position:[te,R],data:Me,index:Ce,line:K}),S+=Me.xadvance+Q,Y=Me}}R+=_,S=0}),this._linesTotal=b.length},u.prototype._setupSpaceGlyphs=function(m){if(this._fallbackSpaceGlyph=null,this._fallbackTabGlyph=null,m.chars&&m.chars.length!==0){var p=f(m,h)||function(y){for(var b=0;b<a.length;b++){var w=a[b].charCodeAt(0),M=g(y.chars,w);if(M>=0)return y.chars[M]}return 0}(m)||m.chars[0],v=this._opt.tabSize*p.xadvance;this._fallbackSpaceGlyph=p,this._fallbackTabGlyph=r(p,{x:0,y:0,xadvance:v,id:c,xoffset:0,yoffset:0,width:0,height:0})}},u.prototype.getGlyph=function(m,p){return f(m,p)||(p===c?this._fallbackTabGlyph:p===h?this._fallbackSpaceGlyph:null)},u.prototype.computeMetrics=function(m,p,v,y){var b,w=this._opt.letterSpacing||0,M=this._opt.font,S=0,R=0,_=0;if(!M.chars||M.chars.length===0)return{start:p,end:p,width:0};v=Math.min(m.length,v);for(var I=p;I<v;I++){var D,Q=m.charCodeAt(I);if(D=this.getGlyph(M,Q)){D.xoffset;var N=(S+=b?A(M,b.id,D.id):0)+D.xadvance+w,z=S+D.width;if(z>=y||N>=y)break;S=N,R=z,b=D}_++}return b&&(R+=b.xoffset),{start:p,end:p+_,width:R}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach(function(m){Object.defineProperty(u.prototype,m,{get:d(m),configurable:!0})})},5751:(n,e,t)=>{var i=t(9922).hp,r=t(3558),s=function(){},o=t(1476),a=t(7034),l=t(7480),c=t(573),h=t(4597),u=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;n.exports=function(d,f){f=typeof f=="function"?f:s,typeof d=="string"?d={uri:d}:d||(d={}),d.binary&&(d=function(A){if(u)return h(A,{responseType:"arraybuffer"});if(self.XMLHttpRequest===void 0)throw new Error("your browser does not support XHR loading");var g=new self.XMLHttpRequest;return g.overrideMimeType("text/plain; charset=x-user-defined"),h({xhr:g},A)}(d)),r(d,function(A,g,m){if(A)return f(A);if(!/^2/.test(g.statusCode))return f(new Error("http status code: "+g.statusCode));if(!m)return f(new Error("no body result"));var p,v,y=!1;if(p=m,Object.prototype.toString.call(p)==="[object ArrayBuffer]"){var b=new Uint8Array(m);m=i.from(b,"binary")}c(m)&&(y=!0,typeof m=="string"&&(m=i.from(m,"binary"))),y||(i.isBuffer(m)&&(m=m.toString(d.encoding)),m=m.trim());try{var w=g.headers["content-type"];v=y?l(m):/json/.test(w)||m.charAt(0)==="{"?JSON.parse(m):/xml/.test(w)||m.charAt(0)==="<"?a(m):o(m)}catch(M){f(new Error("error parsing font "+M.message)),f=s}f(null,v)})}},573:(n,e,t)=>{var i=t(9922).hp,r=t(911),s=i.from([66,77,70,3]);n.exports=function(o){return typeof o=="string"?o.substring(0,3)==="BMF":o.length>4&&r(o.slice(0,4),s)}},9192:n=>{var e=1e3,t=60*e,i=60*t,r=24*i,s=7*r;function o(a,l,c,h){var u=l>=1.5*c;return Math.round(a/c)+" "+h+(u?"s":"")}n.exports=function(a,l){l=l||{};var c,h,u=typeof a;if(u==="string"&&a.length>0)return function(d){if(!((d=String(d)).length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(f){var A=parseFloat(f[1]);switch((f[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*A;case"weeks":case"week":case"w":return A*s;case"days":case"day":case"d":return A*r;case"hours":case"hour":case"hrs":case"hr":case"h":return A*i;case"minutes":case"minute":case"mins":case"min":case"m":return A*t;case"seconds":case"second":case"secs":case"sec":case"s":return A*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}(a);if(u==="number"&&isFinite(a))return l.long?(c=a,(h=Math.abs(c))>=r?o(c,h,r,"day"):h>=i?o(c,h,i,"hour"):h>=t?o(c,h,t,"minute"):h>=e?o(c,h,e,"second"):c+" ms"):function(d){var f=Math.abs(d);return f>=r?Math.round(d/r)+"d":f>=i?Math.round(d/i)+"h":f>=t?Math.round(d/t)+"m":f>=e?Math.round(d/e)+"s":d+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}},1476:n=>{function e(i,r){if(!(i=i.replace(/\t+/g," ").trim()))return null;var s=i.indexOf(" ");if(s===-1)throw new Error("no named row at line "+r);var o=i.substring(0,s);i=(i=(i=(i=i.substring(s+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map(function(u){return u.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)});for(var a=[],l=0;l<i.length;l++){var c=i[l];l===0?a.push({key:c[0],data:""}):l===i.length-1?a[a.length-1].data=t(c[0]):(a[a.length-1].data=t(c[0]),a.push({key:c[1],data:""}))}var h={key:o,data:{}};return a.forEach(function(u){h.data[u.key]=u.data}),h}function t(i){return i&&i.length!==0?i.indexOf('"')===0||i.indexOf("'")===0?i.substring(1,i.length-1):i.indexOf(",")!==-1?function(r){return r.split(",").map(function(s){return parseInt(s,10)})}(i):parseInt(i,10):""}n.exports=function(i){if(!i)throw new Error("no data provided");var r={pages:[],chars:[],kernings:[]},s=(i=i.toString().trim()).split(/\r\n?|\n/g);if(s.length===0)throw new Error("no data in BMFont file");for(var o=0;o<s.length;o++){var a=e(s[o],o);if(a)if(a.key==="page"){if(typeof a.data.id!="number")throw new Error("malformed file at line "+o+" -- needs page id=N");if(typeof a.data.file!="string")throw new Error("malformed file at line "+o+' -- needs page file="path"');r.pages[a.data.id]=a.data.file}else a.key==="chars"||a.key==="kernings"||(a.key==="char"?r.chars.push(a.data):a.key==="kerning"?r.kernings.push(a.data):r[a.key]=a.data)}return r}},7480:n=>{var e=[66,77,70];function t(r,s,o){if(o>s.length-1)return 0;var a=s.readUInt8(o++),l=s.readInt32LE(o);switch(o+=4,a){case 1:r.info=function(c,h){var u={};u.size=c.readInt16LE(h);var d=c.readUInt8(h+2);return u.smooth=d>>7&1,u.unicode=d>>6&1,u.italic=d>>5&1,u.bold=d>>4&1,d>>3&1&&(u.fixedHeight=1),u.charset=c.readUInt8(h+3)||"",u.stretchH=c.readUInt16LE(h+4),u.aa=c.readUInt8(h+6),u.padding=[c.readInt8(h+7),c.readInt8(h+8),c.readInt8(h+9),c.readInt8(h+10)],u.spacing=[c.readInt8(h+11),c.readInt8(h+12)],u.outline=c.readUInt8(h+13),u.face=function(f,A){return i(f,A).toString("utf8")}(c,h+14),u}(s,o);break;case 2:r.common=function(c,h){var u={};return u.lineHeight=c.readUInt16LE(h),u.base=c.readUInt16LE(h+2),u.scaleW=c.readUInt16LE(h+4),u.scaleH=c.readUInt16LE(h+6),u.pages=c.readUInt16LE(h+8),c.readUInt8(h+10),u.packed=0,u.alphaChnl=c.readUInt8(h+11),u.redChnl=c.readUInt8(h+12),u.greenChnl=c.readUInt8(h+13),u.blueChnl=c.readUInt8(h+14),u}(s,o);break;case 3:r.pages=function(c,h,u){for(var d=[],f=i(c,h),A=f.length+1,g=u/A,m=0;m<g;m++)d[m]=c.slice(h,h+f.length).toString("utf8"),h+=A;return d}(s,o,l);break;case 4:r.chars=function(c,h,u){for(var d=[],f=u/20,A=0;A<f;A++){var g={},m=20*A;g.id=c.readUInt32LE(h+0+m),g.x=c.readUInt16LE(h+4+m),g.y=c.readUInt16LE(h+6+m),g.width=c.readUInt16LE(h+8+m),g.height=c.readUInt16LE(h+10+m),g.xoffset=c.readInt16LE(h+12+m),g.yoffset=c.readInt16LE(h+14+m),g.xadvance=c.readInt16LE(h+16+m),g.page=c.readUInt8(h+18+m),g.chnl=c.readUInt8(h+19+m),d[A]=g}return d}(s,o,l);break;case 5:r.kernings=function(c,h,u){for(var d=[],f=u/10,A=0;A<f;A++){var g={},m=10*A;g.first=c.readUInt32LE(h+0+m),g.second=c.readUInt32LE(h+4+m),g.amount=c.readInt16LE(h+8+m),d[A]=g}return d}(s,o,l)}return 5+l}function i(r,s){for(var o=s;o<r.length&&r[o]!==0;o++);return r.slice(s,o)}n.exports=function(r){if(r.length<6)throw new Error("invalid buffer length for BMFont");var s=e.every(function(c,h){return r.readUInt8(h)===c});if(!s)throw new Error("BMFont missing BMF byte header");var o=3;if(r.readUInt8(o++)>3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var a={kernings:[],chars:[]},l=0;l<5;l++)o+=t(a,r,o);return a}},7034:(n,e,t)=>{var i=t(7829),r=t(1896),s={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function o(a){var l=function(c){for(var h=[],u=0;u<c.attributes.length;u++)h.push(c.attributes[u]);return h}(a);return l.reduce(function(c,h){var u;return c[u=h.nodeName,s[u.toLowerCase()]||u]=h.nodeValue,c},{})}n.exports=function(a){a=a.toString();var l=r(a),c={pages:[],chars:[],kernings:[]};["info","common"].forEach(function(m){var p=l.getElementsByTagName(m)[0];p&&(c[m]=i(o(p)))});var h=l.getElementsByTagName("pages")[0];if(!h)throw new Error("malformed file -- no <pages> element");for(var u=h.getElementsByTagName("page"),d=0;d<u.length;d++){var f=u[d],A=parseInt(f.getAttribute("id"),10),g=f.getAttribute("file");if(isNaN(A))throw new Error('malformed file -- page "id" attribute is NaN');if(!g)throw new Error('malformed file -- needs page "file" attribute');c.pages[parseInt(A,10)]=g}return["chars","kernings"].forEach(function(m){var p=l.getElementsByTagName(m)[0];if(p)for(var v=m.substring(0,m.length-1),y=p.getElementsByTagName(v),b=0;b<y.length;b++){var w=y[b];c[m].push(i(o(w)))}}),c}},7829:n=>{var e="chasrset";n.exports=function(t){for(var i in t=Object.assign({},t),e in t&&(t.charset=t[e],delete t[e]),t)i!=="face"&&i!=="charset"&&(t[i]=i==="padding"||i==="spacing"?t[i].split(",").map(function(r){return parseInt(r,10)}):parseInt(t[i],10));return t}},3216:n=>{var e=function(t){return t.replace(/^\s+|\s+$/g,"")};n.exports=function(t){if(!t)return{};for(var i,r={},s=e(t).split(`
`),o=0;o<s.length;o++){var a=s[o],l=a.indexOf(":"),c=e(a.slice(0,l)).toLowerCase(),h=e(a.slice(l+1));r[c]===void 0?r[c]=h:(i=r[c],Object.prototype.toString.call(i)==="[object Array]"?r[c].push(h):r[c]=[r[c],h])}return r}},9035:(n,e,t)=>{var i=t(8480),r=t(8167),s=t(2225),o=[0,2,3],a=[2,1,3];n.exports=function(l,c){l&&(r(l)||s(l))||(c=l||{},l=null);for(var h=typeof(c=typeof c=="number"?{count:c}:c||{}).type=="string"?c.type:"uint16",u=typeof c.count=="number"?c.count:1,d=c.start||0,f=c.clockwise!==!1?o:a,A=f[0],g=f[1],m=f[2],p=6*u,v=l||new(i(h))(p),y=0,b=0;y<p;y+=6,b+=4){var w=y+d;v[w+0]=b+0,v[w+1]=b+1,v[w+2]=b+2,v[w+3]=b+A,v[w+4]=b+g,v[w+5]=b+m}return v}},4433:(n,e,t)=>{var i=t(5651),r=t(9035),s=t(7106),o=t(1684);n.exports=function(l){return new a(l)};class a extends THREE.BufferGeometry{constructor(c){super(),typeof c=="string"&&(c={text:c}),this._opt=Object.assign({},c),c&&this.update(c)}update(c){if(typeof c=="string"&&(c={text:c}),!(c=Object.assign({},this._opt,c)).font)throw new TypeError("must specify a { font } in options");this.layout=i(c);var h=c.flipY!==!1,u=c.font,d=u.common.scaleW,f=u.common.scaleH,A=this.layout.glyphs.filter(function(y){var b=y.data;return b.width*b.height>0});this.visibleGlyphs=A;var g=s.positions(A),m=s.uvs(A,d,f,h),p=r([],{clockwise:!0,type:"uint16",count:A.length});if(this.setIndex(p),this.setAttribute("position",new THREE.BufferAttribute(g,2)),this.setAttribute("uv",new THREE.BufferAttribute(m,2)),!c.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(c.multipage){var v=s.pages(A);this.setAttribute("page",new THREE.BufferAttribute(v,1))}this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere()}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array,h=this.attributes.position.itemSize;if(!c||!h||c.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);o.computeSphere(c,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new THREE.Box3);var c=this.boundingBox,h=this.attributes.position.array,u=this.attributes.position.itemSize;!h||!u||h.length<2?c.makeEmpty():o.computeBox(h,c)}}},1684:n=>{var e={min:[0,0],max:[0,0]};function t(i){var r=i.length/2;e.min[0]=i[0],e.min[1]=i[1],e.max[0]=i[0],e.max[1]=i[1];for(var s=0;s<r;s++){var o=i[2*s+0],a=i[2*s+1];e.min[0]=Math.min(o,e.min[0]),e.min[1]=Math.min(a,e.min[1]),e.max[0]=Math.max(o,e.max[0]),e.max[1]=Math.max(a,e.max[1])}}n.exports.computeBox=function(i,r){t(i),r.min.set(e.min[0],e.min[1],0),r.max.set(e.max[0],e.max[1],0)},n.exports.computeSphere=function(i,r){t(i);var s=e.min[0],o=e.min[1],a=e.max[0]-s,l=e.max[1]-o,c=Math.sqrt(a*a+l*l);r.center.set(s+a/2,o+l/2,0),r.radius=c/2}},7106:n=>{n.exports.pages=function(e){var t=new Float32Array(4*e.length*1),i=0;return e.forEach(function(r){var s=r.data.page||0;t[i++]=s,t[i++]=s,t[i++]=s,t[i++]=s}),t},n.exports.uvs=function(e,t,i,r){var s=new Float32Array(4*e.length*2),o=0;return e.forEach(function(a){var l=a.data,c=l.x+l.width,h=l.y+l.height,u=l.x/t,d=l.y/i,f=c/t,A=h/i;r&&(d=(i-l.y)/i,A=(i-h)/i),s[o++]=u,s[o++]=d,s[o++]=u,s[o++]=A,s[o++]=f,s[o++]=A,s[o++]=f,s[o++]=d}),s},n.exports.positions=function(e){var t=new Float32Array(4*e.length*2),i=0;return e.forEach(function(r){var s=r.data,o=r.position[0]+s.xoffset,a=r.position[1]+s.yoffset,l=s.width,c=s.height;t[i++]=o,t[i++]=a,t[i++]=o,t[i++]=a+c,t[i++]=o+l,t[i++]=a+c,t[i++]=o+l,t[i++]=a}),t}},5406:n=>{var e=/\n/,t=/\s/;function i(o,a,l,c){var h=o.indexOf(a,l);return h===-1||h>c?c:h}function r(o){return t.test(o)}function s(o,a,l,c){return{start:a,end:a+Math.min(c,l-a)}}n.exports=function(o,a){return n.exports.lines(o,a).map(function(l){return o.substring(l.start,l.end)}).join(`
`)},n.exports.lines=function(o,a){if((a=a||{}).width===0&&a.mode!=="nowrap")return[];o=o||"";var l=typeof a.width=="number"?a.width:Number.MAX_VALUE,c=Math.max(0,a.start||0),h=typeof a.end=="number"?a.end:o.length,u=a.mode,d=a.measure||s;return u==="pre"?function(f,A,g,m,p){for(var v=[],y=g,b=g;b<m&&b<A.length;b++){var w=A.charAt(b),M=e.test(w);if(M||b===m-1){var S=f(A,y,M?b:b+1,p);v.push(S),y=b+1}}return v}(d,o,c,h,l):function(f,A,g,m,p,v){var y=[],b=p;for(v==="nowrap"&&(b=Number.MAX_VALUE);g<m&&g<A.length;){for(var w=i(A,`
`,g,m);g<w&&r(A.charAt(g));)g++;var M=f(A,g,w,b),S=g+(M.end-M.start),R=S+1;if(S<w){for(;S>g&&!r(A.charAt(S));)S--;if(S===g)R>g+1&&R--,S=R;else for(R=S;S>g&&r(A.charAt(S-1));)S--}if(S>=g){var _=f(A,g,S,b);y.push(_)}g=R}return y}(d,o,c,h,l,u)}},3558:(n,e,t)=>{var i=t(919),r=t(8847),s=t(3216),o=t(4597);function a(h,u,d){var f=h;return r(u)?(d=u,typeof h=="string"&&(f={uri:h})):f=o(u,{uri:h}),f.callback=d,f}function l(h,u,d){return c(u=a(h,u,d))}function c(h){if(h.callback===void 0)throw new Error("callback argument missing");var u=!1,d=function(D,Q,N){u||(u=!0,h.callback(D,Q,N))};function f(){var D=void 0;if(D=v.response?v.response:v.responseText||function(Q){try{if(Q.responseType==="document")return Q.responseXML;var N=Q.responseXML&&Q.responseXML.documentElement.nodeName==="parsererror";if(Q.responseType===""&&!N)return Q.responseXML}catch{}return null}(v),_)try{D=JSON.parse(D)}catch{}return D}function A(D){return clearTimeout(y),D instanceof Error||(D=new Error(""+(D||"Unknown XMLHttpRequest Error"))),D.statusCode=0,d(D,I)}function g(){if(!p){var D;clearTimeout(y),D=h.useXDR&&v.status===void 0?200:v.status===1223?204:v.status;var Q=I,N=null;return D!==0?(Q={body:f(),statusCode:D,method:w,headers:{},url:b,rawRequest:v},v.getAllResponseHeaders&&(Q.headers=s(v.getAllResponseHeaders()))):N=new Error("Internal XMLHttpRequest Error"),d(N,Q,Q.body)}}var m,p,v=h.xhr||null;v||(v=h.cors||h.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var y,b=v.url=h.uri||h.url,w=v.method=h.method||"GET",M=h.body||h.data,S=v.headers=h.headers||{},R=!!h.sync,_=!1,I={body:void 0,headers:{},statusCode:0,method:w,url:b,rawRequest:v};if("json"in h&&h.json!==!1&&(_=!0,S.accept||S.Accept||(S.Accept="application/json"),w!=="GET"&&w!=="HEAD"&&(S["content-type"]||S["Content-Type"]||(S["Content-Type"]="application/json"),M=JSON.stringify(h.json===!0?M:h.json))),v.onreadystatechange=function(){v.readyState===4&&setTimeout(g,0)},v.onload=g,v.onerror=A,v.onprogress=function(){},v.onabort=function(){p=!0},v.ontimeout=A,v.open(w,b,!R,h.username,h.password),R||(v.withCredentials=!!h.withCredentials),!R&&h.timeout>0&&(y=setTimeout(function(){if(!p){p=!0,v.abort("timeout");var D=new Error("XMLHttpRequest timeout");D.code="ETIMEDOUT",A(D)}},h.timeout)),v.setRequestHeader)for(m in S)S.hasOwnProperty(m)&&v.setRequestHeader(m,S[m]);else if(h.headers&&!function(D){for(var Q in D)if(D.hasOwnProperty(Q))return!1;return!0}(h.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in h&&(v.responseType=h.responseType),"beforeSend"in h&&typeof h.beforeSend=="function"&&h.beforeSend(v),v.send(M||null),v}n.exports=l,n.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(h,u){for(var d=0;d<h.length;d++)u(h[d])}(["get","put","post","patch","head","delete"],function(h){l[h==="delete"?"del":h]=function(u,d,f){return(d=a(u,d,f)).method=h.toUpperCase(),c(d)}})},1896:n=>{n.exports=self.DOMParser!==void 0?function(e){return new self.DOMParser().parseFromString(e,"application/xml")}:self.ActiveXObject!==void 0&&new self.ActiveXObject("Microsoft.XMLDOM")?function(e){var t=new self.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}:function(e){var t=document.createElement("div");return t.innerHTML=e,t}},4597:n=>{n.exports=function(){for(var t={},i=0;i<arguments.length;i++){var r=arguments[i];for(var s in r)e.call(r,s)&&(t[s]=r[s])}return t};var e=Object.prototype.hasOwnProperty},8132:()=>{window.aframeStats=function(n){var e=null,t=n;return{update:function(){var i;e("te").set((i=t.querySelectorAll("*"),Array.prototype.slice.call(i).filter(function(r){return r.isEntity}),i.length)),window.performance.getEntriesByName&&e("lt").set(window.performance.getEntriesByName("render-started")[0].startTime.toFixed(0))},start:function(){},end:function(){},attach:function(i){e=i},values:{te:{caption:"Entities"},lt:{caption:"Load Time"}},groups:[{caption:"A-Frame",values:["te","lt"]}],fractions:[]}}},3729:n=>{window.glStats=function(){var e=null,t=0,i=0,r=0,s=0,o=0,a=0,l=0;function c(h,u){return function(){u.apply(this,arguments),h.apply(this,arguments)}}return WebGLRenderingContext.prototype.drawArrays=c(WebGLRenderingContext.prototype.drawArrays,function(){t++,arguments[0]==this.POINTS?a+=arguments[2]:o+=arguments[2]}),WebGLRenderingContext.prototype.drawElements=c(WebGLRenderingContext.prototype.drawElements,function(){i++,s+=arguments[1]/3,o+=arguments[1]}),WebGLRenderingContext.prototype.useProgram=c(WebGLRenderingContext.prototype.useProgram,function(){r++}),WebGLRenderingContext.prototype.bindTexture=c(WebGLRenderingContext.prototype.bindTexture,function(){l++}),{update:function(){e("allcalls").set(t+i),e("drawElements").set(i),e("drawArrays").set(t),e("bindTexture").set(l),e("useProgram").set(r),e("glfaces").set(s),e("glvertices").set(o),e("glpoints").set(a)},start:function(){t=0,i=0,r=0,s=0,o=0,a=0,l=0},end:function(){},attach:function(h){e=h},values:{allcalls:{over:3e3,caption:"Calls (hook)"},drawelements:{caption:"drawElements (hook)"},drawarrays:{caption:"drawArrays (hook)"}},groups:[{caption:"WebGL",values:["allcalls","drawelements","drawarrays","useprogram","bindtexture","glfaces","glvertices","glpoints"]}],fractions:[{base:"allcalls",steps:["drawelements","drawarrays"]}]}},window.threeStats=function(e){var t=null;return{update:function(){var i;t("renderer.info.memory.geometries").set(e.info.memory.geometries),t("renderer.info.programs").set(((i=e.info.programs)==null?void 0:i.length)??NaN),t("renderer.info.memory.textures").set(e.info.memory.textures),t("renderer.info.render.calls").set(e.info.render.calls),t("renderer.info.render.triangles").set(e.info.render.triangles),t("renderer.info.render.points").set(e.info.render.points)},start:function(){},end:function(){},attach:function(i){t=i},values:{"renderer.info.memory.geometries":{caption:"Geometries"},"renderer.info.memory.textures":{caption:"Textures"},"renderer.info.programs":{caption:"Programs"},"renderer.info.render.calls":{caption:"Calls"},"renderer.info.render.triangles":{caption:"Triangles",over:1e3},"renderer.info.render.points":{caption:"Points"}},groups:[{caption:"Three.js - Memory",values:["renderer.info.memory.geometries","renderer.info.programs","renderer.info.memory.textures"]},{caption:"Three.js - Render",values:["renderer.info.render.calls","renderer.info.render.triangles","renderer.info.render.points"]}],fractions:[]}},window.BrowserStats=function(){var e=null,t=0,i=0;window.performance&&!performance.memory&&(performance.memory={usedJSHeapSize:0,totalJSHeapSize:0}),performance.memory.totalJSHeapSize===0&&console.warn("totalJSHeapSize === 0... performance.memory is only available in Chrome .");var r=Math.log(1024);function s(o){var a=Math.floor(Math.log(o)/r);return Math.round(100*o/Math.pow(1024,a))/100}return{update:function(){t=s(performance.memory.usedJSHeapSize),i=s(performance.memory.totalJSHeapSize),e("memory").set(t),e("total").set(i)},start:function(){t=0},end:function(){},attach:function(o){e=o},values:{memory:{caption:"Used Memory",average:!0,avgMs:1e3,over:22},total:{caption:"Total Memory"}},groups:[{caption:"Browser",values:["memory","total"]}],fractions:[{base:"total",steps:["memory"]}]}},n.exports={glStats:window.glStats,threeStats:window.threeStats,BrowserStats:window.BrowserStats}},282:n=>{(function(){"performance"in window==0&&(window.performance={});var e=window.performance;if("now"in e==0){var t=Date.now();e.timing&&e.timing.navigationStart&&(t=e.timing.navigationStart),e.now=function(){return Date.now()-t}}e.mark||(e.mark=function(){}),e.measure||(e.measure=function(){})})(),window.rStats=function(e){function t(g,m){for(var p=Object.keys(g),v=0,y=p.length;v<y;v++)m(p[v])}var i=e||{},r=i.colours||["#850700","#c74900","#fcb300","#284280","#4c7c0c"],s=(i.CSSPath?i.CSSPath:"")+"rStats.css";(i.css||["https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300",s]).forEach(function(g){var m,p;m=g,(p=document.createElement("link")).href=m,p.rel="stylesheet",p.type="text/css",document.getElementsByTagName("head")[0].appendChild(p)}),i.values||(i.values={});var o,a,l=10,c={};function h(g,m,p){var v=p||{},y=document.createElement("canvas"),b=y.getContext("2d"),w=0,M=0,S=v.color?v.color:"#666666",R=document.createElement("canvas"),_=R.getContext("2d");R.width=1,R.height=20,_.fillStyle="#444444",_.fillRect(0,0,1,20),_.fillStyle=S,_.fillRect(0,l,1,l),_.fillStyle="#ffffff",_.globalAlpha=.5,_.fillRect(0,l,1,1),_.globalAlpha=1;var I=document.createElement("canvas"),D=I.getContext("2d");return I.width=1,I.height=20,D.fillStyle="#444444",D.fillRect(0,0,1,20),D.fillStyle="#b70000",D.fillRect(0,l,1,l),D.globalAlpha=.5,D.fillStyle="#ffffff",D.fillRect(0,l,1,1),D.globalAlpha=1,y.width=200,y.height=l,y.style.width=y.width+"px",y.style.height=y.height+"px",y.className="rs-canvas",g.appendChild(y),b.fillStyle="#444444",b.fillRect(0,0,y.width,y.height),{draw:function(Q,N){(M+=.1*(Q-M))>(w*=.99)&&(w=M),b.drawImage(y,1,0,y.width-1,y.height,0,0,y.width-1,y.height),N?b.drawImage(I,y.width-1,y.height-M*y.height/w-l):b.drawImage(R,y.width-1,y.height-M*y.height/w-l)}}}function u(g,m){var p=document.createElement("canvas"),v=p.getContext("2d");return p.width=200,p.height=l*m,p.style.width=p.width+"px",p.style.height=p.height+"px",p.className="rs-canvas",g.appendChild(p),v.fillStyle="#444444",v.fillRect(0,0,p.width,p.height),{draw:function(y){v.drawImage(p,1,0,p.width-1,p.height,0,0,p.width-1,p.height);var b=0;t(y,function(w){var M=y[w]*p.height;v.fillStyle=r[w],v.fillRect(p.width-1,b,1,M),b+=M})}}}function d(g,m){var p,v=g,y=0,b=0,w=0,M=0,S=performance.now(),R=0,_=document.createElement("div"),I=document.createElement("span"),D=document.createElement("div"),Q=document.createTextNode(""),N=i?i.values[v.toLowerCase()]:null,z=new h(_,v,N),$=!1;function H(ee){if(N&&N.average){M+=ee,R++;var pe=performance.now();pe-S>=(N.avgMs||1e3)&&(w=M/R,M=0,S=pe,R=0)}}function K(){p=performance.now(),i.userTimingAPI&&performance.mark(v+"-start"),$=!0}function Y(){y=performance.now()-p,i.userTimingAPI&&(performance.mark(v+"-end"),$&&performance.measure(v,v+"-start",v+"-end")),H(y)}return I.className="rs-counter-id",I.textContent=N&&N.caption?N.caption:v,D.className="rs-counter-value",D.appendChild(Q),_.appendChild(I),_.appendChild(D),m?m.div.appendChild(_):a.appendChild(_),p=performance.now(),{set:function(ee){H(y=ee)},start:K,tick:function(){Y(),K()},end:Y,frame:function(){var ee=performance.now(),pe=ee-p;b++,pe>1e3&&(y=N&&N.interpolate===!1?b:1e3*b/pe,b=0,p=ee,H(y))},value:function(){return y},draw:function(){var ee=N&&N.average?w:y;Q.nodeValue=Math.round(100*ee)/100;var pe=N&&(N.below&&y<N.below||N.over&&y>N.over);z.draw(y,pe),_.className=pe?"rs-counter-base alarm":"rs-counter-base"}}}function f(g){var m=g.toLowerCase();if(m===void 0&&(m="default"),c[m])return c[m];var p=null;i&&i.groups&&t(i.groups,function(y){var b=i.groups[parseInt(y,10)];p||b.values.indexOf(m.toLowerCase())===-1||(p=b)});var v=new d(m,p);return c[m]=v,v}function A(){t(i.plugins,function(g){i.plugins[g].update()}),t(c,function(g){c[g].draw()}),i&&i.fractions&&t(i.fractions,function(g){var m=i.fractions[parseInt(g,10)],p=[],v=c[m.base.toLowerCase()];v&&(v=v.value(),t(i.fractions[g].steps,function(y){var b=i.fractions[g].steps[parseInt(y,10)].toLowerCase(),w=c[b];w&&p.push(w.value()/v)})),m.graph.draw(p)})}return function(){if(i.plugins){i.values||(i.values={}),i.groups||(i.groups=[]),i.fractions||(i.fractions=[]);for(var g=0;g<i.plugins.length;g++)i.plugins[g].attach(f),t(i.plugins[g].values,function(m){i.values[m]=i.plugins[g].values[m]}),i.groups=i.groups.concat(i.plugins[g].groups),i.fractions=i.fractions.concat(i.plugins[g].fractions)}else i.plugins={};(o=document.createElement("div")).className="rs-base",(a=document.createElement("div")).className="rs-container",a.style.height="auto",o.appendChild(a),document.body.appendChild(o),i&&(i.groups&&t(i.groups,function(m){var p=i.groups[parseInt(m,10)],v=document.createElement("div");v.className="rs-group",p.div=v;var y=document.createElement("h1");y.textContent=p.caption,y.addEventListener("click",(function(b){this.classList.toggle("hidden"),b.preventDefault()}).bind(v)),a.appendChild(y),a.appendChild(v)}),i.fractions&&t(i.fractions,function(m){var p=i.fractions[parseInt(m,10)],v=document.createElement("div");v.className="rs-fraction";var y=document.createElement("div");y.className="rs-legend";var b=0;t(i.fractions[m].steps,function(M){var S=document.createElement("p");S.textContent=i.fractions[m].steps[M],S.style.color=r[b],y.appendChild(S),b++}),v.appendChild(y),v.style.height=b*l+"px",p.div=v;var w=new u(v,b);p.graph=w,a.appendChild(v)}))}(),function(g){return g?f(g):{element:o,update:A}}},n.exports=window.rStats},2535:n=>{var e={base64:function(t,i){return"data:"+t+";base64,"+i},isMobile:function(){var t,i=!1;return t=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(i=!0),i},isIOS:function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},isIFrame:function(){try{return window.self!==window.top}catch{return!0}},appendQueryParameter:function(t,i,r){var s=t.indexOf("?")<0?"?":"&";return t+(s+i+"=")+r},getQueryParameter:function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return i===null?"":decodeURIComponent(i[1].replace(/\+/g," "))},isLandscapeMode:function(){return window.orientation==90||window.orientation==-90}};n.exports=e},5928:(n,e,t)=>{var i,r=t(2535);n.exports=(i=navigator.userAgent||navigator.vendor||window.opera).match(/iPhone/i)||i.match(/iPod/i)?function(){var s=null;this.request=function(){s||(s=setInterval(function(){window.location.href="/",setTimeout(window.stop,0)},15e3))},this.release=function(){s&&(clearInterval(s),s=null)}}:function(){var s=document.createElement("video");s.addEventListener("ended",function(){s.play()}),this.request=function(){s.paused&&(s.src=r.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),s.play())},this.release=function(){s.pause(),s.src=""}}},8217:(n,e,t)=>{t.d(e,{A:()=>b});var i=t(963),r=t.n(i),s=t(9089),o=t.n(s),a=t(6492),l=t.n(a),c=new URL(t(9169),t.b),h=new URL(t(6085),t.b),u=new URL(t(3931),t.b),d=new URL(t(7889),t.b),f=new URL(t(6517),t.b),A=o()(r()),g=l()(c),m=l()(h),p=l()(u),v=l()(d),y=l()(f);A.push([n.id,`/* .a-fullscreen means not embedded. */
html.a-fullscreen {
bottom: 0;
left: 0;
position: fixed;
right: 0;
top: 0;
}
html.a-fullscreen body {
height: 100%;
margin: 0;
overflow: hidden;
padding: 0;
width: 100%;
}
/* Class is removed when doing <a-scene embedded>. */
html.a-fullscreen .a-canvas {
width: 100% !important;
height: 100% !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
position: fixed !important;
}
html:not(.a-fullscreen) .a-enter-vr,
html:not(.a-fullscreen) .a-enter-ar {
right: 5px;
bottom: 5px;
}
html:not(.a-fullscreen) .a-enter-ar {
right: 60px;
}
/* In chrome mobile the user agent stylesheet set it to white */
:-webkit-full-screen {
background-color: transparent;
}
.a-hidden {
display: none !important;
}
.a-canvas {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
.a-canvas.a-grab-cursor:hover {
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
}
canvas.a-canvas.a-mouse-cursor-hover:hover {
cursor: pointer;
}
.a-inspector-loader {
background-color: #ed3160;
position: fixed;
left: 3px;
top: 3px;
padding: 6px 10px;
color: #fff;
text-decoration: none;
font-size: 12px;
font-family: Roboto,sans-serif;
text-align: center;
z-index: 99999;
width: 204px;
}
/* Inspector loader animation */
@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }
@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }
@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }
@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }
@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }
@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }
.a-inspector-loader .dots span {
animation: dots-1 2s infinite steps(1);
-webkit-animation: dots-1 2s infinite steps(1);
}
.a-inspector-loader .dots span:first-child + span {
animation-name: dots-2;
-webkit-animation-name: dots-2;
}
.a-inspector-loader .dots span:first-child + span + span {
animation-name: dots-3;
-webkit-animation-name: dots-3;
}
a-scene {
display: block;
position: relative;
height: 100%;
width: 100%;
}
a-assets,
a-scene video,
a-scene img,
a-scene audio {
display: none;
}
.a-enter-vr-modal,
.a-orientation-modal {
font-family: Consolas, Andale Mono, Courier New, monospace;
}
.a-enter-vr-modal a {
border-bottom: 1px solid #fff;
padding: 2px 0;
text-decoration: none;
transition: .1s color ease-in;
}
.a-enter-vr-modal a:hover {
background-color: #fff;
color: #111;
padding: 2px 4px;
position: relative;
left: -4px;
}
.a-enter-vr,
.a-enter-ar {
font-family: sans-serif, monospace;
font-size: 13px;
width: 100%;
font-weight: 200;
line-height: 16px;
position: absolute;
right: 20px;
bottom: 20px;
}
.a-enter-ar.xr {
right: 90px;
}
.a-enter-vr-button,
.a-enter-vr-modal,
.a-enter-vr-modal a {
color: #fff;
user-select: none;
outline: none;
}
.a-enter-vr-button {
background: rgba(0, 0, 0, 0.35) url(${g}) 50% 50% no-repeat;
}
.a-enter-ar-button {
background: rgba(0, 0, 0, 0.20) url(${m}) 50% 50% no-repeat;
}
.a-enter-vr.fullscreen .a-enter-vr-button {
background-image: url(${p});
}
.a-enter-vr-button,
.a-enter-ar-button {
background-size: 90% 90%;
border: 0;
bottom: 0;
cursor: pointer;
min-width: 58px;
min-height: 34px;
/* 1.74418604651 */
/*
In order to keep the aspect ratio when resizing
padding-top percentages are relative to the containing block's width.
http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio
*/
padding-right: 0;
padding-top: 0;
position: absolute;
right: 0;
transition: background-color .05s ease;
-webkit-transition: background-color .05s ease;
z-index: 9999;
border-radius: 8px;
touch-action: manipulation; /* Prevent iOS double tap zoom on the button */
}
.a-enter-ar-button {
background-size: 100% 90%;
border-radius: 7px;
}
.a-enter-ar-button:active,
.a-enter-ar-button:hover,
.a-enter-vr-button:active,
.a-enter-vr-button:hover {
background-color: #ef2d5e;
}
.a-enter-vr-button.resethover {
background-color: rgba(0, 0, 0, 0.35);
}
.a-enter-vr-modal {
background-color: #666;
border-radius: 0;
display: none;
min-height: 32px;
margin-right: 70px;
padding: 9px;
width: 280px;
right: 2%;
position: absolute;
}
.a-enter-vr-modal:after {
border-bottom: 10px solid transparent;
border-left: 10px solid #666;
border-top: 10px solid transparent;
display: inline-block;
content: '';
position: absolute;
right: -5px;
top: 5px;
width: 0;
height: 0;
}
.a-enter-vr-modal p,
.a-enter-vr-modal a {
display: inline;
}
.a-enter-vr-modal p {
margin: 0;
}
.a-enter-vr-modal p:after {
content: ' ';
}
.a-orientation-modal {
background: rgba(244, 244, 244, 1) url(${v}) center no-repeat;
background-size: 50% 50%;
bottom: 0;
font-size: 14px;
font-weight: 600;
left: 0;
line-height: 20px;
right: 0;
position: fixed;
top: 0;
z-index: 9999999;
}
.a-orientation-modal:after {
color: #666;
content: "Insert phone into Cardboard holder.";
display: block;
position: absolute;
text-align: center;
top: 70%;
transform: translateY(-70%);
width: 100%;
}
.a-orientation-modal button {
background: url(${y}) no-repeat;
border: none;
height: 50px;
text-indent: -9999px;
width: 50px;
}
.a-loader-title {
background-color: rgba(0, 0, 0, 0.6);
font-family: sans-serif, monospace;
text-align: center;
font-size: 20px;
height: 50px;
font-weight: 300;
line-height: 50px;
position: absolute;
right: 0px;
left: 0px;
top: 0px;
color: white;
}
.a-modal {
position: absolute;
background: rgba(0, 0, 0, 0.60);
background-size: 50% 50%;
bottom: 0;
font-size: 14px;
font-weight: 600;
left: 0;
line-height: 20px;
right: 0;
position: fixed;
top: 0;
z-index: 9999999;
}
.a-dialog {
position: relative;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 199995;
width: 300px;
height: 200px;
background-size: contain;
background-color: white;
font-family: sans-serif, monospace;
font-size: 20px;
border-radius: 3px;
padding: 6px;
}
.a-dialog-text-container {
width: 100%;
height: 70%;
align-self: flex-start;
display: flex;
justify-content: center;
align-content: center;
flex-direction: column;
}
.a-dialog-text {
display: inline-block;
font-weight: normal;
font-size: 14pt;
margin: 8px;
}
.a-dialog-buttons-container {
display: inline-flex;
align-self: flex-end;
width: 100%;
height: 30%;
}
.a-dialog-button {
cursor: pointer;
align-self: center;
opacity: 0.9;
height: 80%;
width: 50%;
font-size: 12pt;
margin: 4px;
border-radius: 2px;
text-align:center;
border: none;
display: inline-block;
-webkit-transition: all 0.25s ease-in-out;
transition: all 0.25s ease-in-out;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);
user-select: none;
}
.a-dialog-permission-button:hover {
box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);
}
.a-dialog-allow-button {
background-color: #00ceff;
}
.a-dialog-deny-button {
background-color: #ff005b;
}
.a-dialog-ok-button {
background-color: #00ceff;
width: 100%;
}
.a-dom-overlay:not(.a-no-style) {
overflow: hidden;
position: absolute;
pointer-events: none;
box-sizing: border-box;
bottom: 0;
left: 0;
right: 0;
top: 0;
padding: 1em;
}
.a-dom-overlay:not(.a-no-style)>* {
pointer-events: auto;
}
`,"",{version:3,sources:["webpack://./src/style/aframe.css"],names:[],mappings:"AAAA,sCAAsC;AACtC;EACE,SAAS;EACT,OAAO;EACP,eAAe;EACf,QAAQ;EACR,MAAM;AACR;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,gBAAgB;EAChB,UAAU;EACV,WAAW;AACb;;AAEA,oDAAoD;AACpD;EACE,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,0BAA0B;AAC5B;;AAEA;;EAEE,UAAU;EACV,WAAW;AACb;;AAEA;EACE,WAAW;AACb;;AAEA,gEAAgE;AAChE;EACE,6BAA6B;AAC/B;;AAEA;EACE,wBAAwB;AAC1B;;AAEA;EACE,YAAY;EACZ,OAAO;EACP,kBAAkB;EAClB,MAAM;EACN,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,oBAAoB;AACtB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,eAAe;EACf,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,WAAW;EACX,qBAAqB;EACrB,eAAe;EACf,8BAA8B;EAC9B,kBAAkB;EAClB,cAAc;EACd,YAAY;AACd;;AAEA,+BAA+B;AAC/B,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;;AAErE;EACE,sCAAsC;EACtC,8CAA8C;AAChD;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,YAAY;EACZ,WAAW;AACb;;AAEA;;;;EAIE,aAAa;AACf;;AAEA;;EAEE,0DAA0D;AAC5D;;AAEA;EACE,6BAA6B;EAC7B,cAAc;EACd,qBAAqB;EACrB,6BAA6B;AAC/B;;AAEA;EACE,sBAAsB;EACtB,WAAW;EACX,gBAAgB;EAChB,kBAAkB;EAClB,UAAU;AACZ;;AAEA;;EAEE,kCAAkC;EAClC,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,WAAW;EACX,YAAY;AACd;;AAEA;EACE,WAAW;AACb;;AAEA;;;EAGE,WAAW;EACX,iBAAiB;EACjB,aAAa;AACf;;AAEA;EACE,yFAA4qB;AAC9qB;;AAEA;EACE,yFAAkzB;AACpzB;;AAEA;EACE,yDAA2qK;AAC7qK;;AAEA;;EAEE,wBAAwB;EACxB,SAAS;EACT,SAAS;EACT,eAAe;EACf,eAAe;EACf,gBAAgB;EAChB,kBAAkB;EAClB;;;;GAIC;EACD,gBAAgB;EAChB,cAAc;EACd,kBAAkB;EAClB,QAAQ;EACR,sCAAsC;EACtC,8CAA8C;EAC9C,aAAa;EACb,kBAAkB;EAClB,0BAA0B,EAAE,8CAA8C;AAC5E;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;AACpB;;AAEA;;;;EAIE,yBAAyB;AAC3B;;AAEA;EACE,qCAAqC;AACvC;;AAEA;EACE,sBAAsB;EACtB,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,SAAS;EACT,kBAAkB;AACpB;;AAEA;EACE,qCAAqC;EACrC,4BAA4B;EAC5B,kCAAkC;EAClC,qBAAqB;EACrB,WAAW;EACX,kBAAkB;EAClB,WAAW;EACX,QAAQ;EACR,QAAQ;EACR,SAAS;AACX;;AAEA;;EAEE,eAAe;AACjB;;AAEA;EACE,SAAS;AACX;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,2FAAivF;EACjvF,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,8CAA8C;EAC9C,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,QAAQ;EACR,2BAA2B;EAC3B,WAAW;AACb;;AAEA;EACE,6DAA25B;EAC35B,YAAY;EACZ,YAAY;EACZ,oBAAoB;EACpB,WAAW;AACb;;AAEA;EACE,oCAAoC;EACpC,kCAAkC;EAClC,kBAAkB;EAClB,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,UAAU;EACV,SAAS;EACT,QAAQ;EACR,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,+BAA+B;EAC/B,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;EACR,gCAAgC;EAChC,eAAe;EACf,YAAY;EACZ,aAAa;EACb,wBAAwB;EACxB,uBAAuB;EACvB,kCAAkC;EAClC,eAAe;EACf,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,WAAW;EACX,WAAW;EACX,sBAAsB;EACtB,aAAa;EACb,uBAAuB;EACvB,qBAAqB;EACrB,sBAAsB;AACxB;;AAEA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,eAAe;EACf,WAAW;AACb;;AAEA;EACE,oBAAoB;EACpB,oBAAoB;EACpB,WAAW;EACX,WAAW;AACb;;AAEA;EACE,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,UAAU;EACV,eAAe;EACf,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,YAAY;EACZ,qBAAqB;EACrB,yCAAyC;EACzC,iCAAiC;EACjC,wEAAwE;EACxE,iBAAiB;AACnB;;AAEA;EACE,mEAAmE;AACrE;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;EACzB,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,oBAAoB;EACpB,sBAAsB;EACtB,SAAS;EACT,OAAO;EACP,QAAQ;EACR,MAAM;EACN,YAAY;AACd;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:[`/* .a-fullscreen means not embedded. */
html.a-fullscreen {
bottom: 0;
left: 0;
position: fixed;
right: 0;
top: 0;
}
html.a-fullscreen body {
height: 100%;
margin: 0;
overflow: hidden;
padding: 0;
width: 100%;
}
/* Class is removed when doing <a-scene embedded>. */
html.a-fullscreen .a-canvas {
width: 100% !important;
height: 100% !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
position: fixed !important;
}
html:not(.a-fullscreen) .a-enter-vr,
html:not(.a-fullscreen) .a-enter-ar {
right: 5px;
bottom: 5px;
}
html:not(.a-fullscreen) .a-enter-ar {
right: 60px;
}
/* In chrome mobile the user agent stylesheet set it to white */
:-webkit-full-screen {
background-color: transparent;
}
.a-hidden {
display: none !important;
}
.a-canvas {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
.a-canvas.a-grab-cursor:hover {
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
}
canvas.a-canvas.a-mouse-cursor-hover:hover {
cursor: pointer;
}
.a-inspector-loader {
background-color: #ed3160;
position: fixed;
left: 3px;
top: 3px;
padding: 6px 10px;
color: #fff;
text-decoration: none;
font-size: 12px;
font-family: Roboto,sans-serif;
text-align: center;
z-index: 99999;
width: 204px;
}
/* Inspector loader animation */
@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }
@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }
@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }
@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }
@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }
@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }
.a-inspector-loader .dots span {
animation: dots-1 2s infinite steps(1);
-webkit-animation: dots-1 2s infinite steps(1);
}
.a-inspector-loader .dots span:first-child + span {
animation-name: dots-2;
-webkit-animation-name: dots-2;
}
.a-inspector-loader .dots span:first-child + span + span {
animation-name: dots-3;
-webkit-animation-name: dots-3;
}
a-scene {
display: block;
position: relative;
height: 100%;
width: 100%;
}
a-assets,
a-scene video,
a-scene img,
a-scene audio {
display: none;
}
.a-enter-vr-modal,
.a-orientation-modal {
font-family: Consolas, Andale Mono, Courier New, monospace;
}
.a-enter-vr-modal a {
border-bottom: 1px solid #fff;
padding: 2px 0;
text-decoration: none;
transition: .1s color ease-in;
}
.a-enter-vr-modal a:hover {
background-color: #fff;
color: #111;
padding: 2px 4px;
position: relative;
left: -4px;
}
.a-enter-vr,
.a-enter-ar {
font-family: sans-serif, monospace;
font-size: 13px;
width: 100%;
font-weight: 200;
line-height: 16px;
position: absolute;
right: 20px;
bottom: 20px;
}
.a-enter-ar.xr {
right: 90px;
}
.a-enter-vr-button,
.a-enter-vr-modal,
.a-enter-vr-modal a {
color: #fff;
user-select: none;
outline: none;
}
.a-enter-vr-button {
background: rgba(0, 0, 0, 0.35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z' fill='%23fff'/%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z' fill='%23fff'/%3E%3C/svg%3E") 50% 50% no-repeat;
}
.a-enter-ar-button {
background: rgba(0, 0, 0, 0.20) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z' fill='%23fff'/%3E%3Cpath d='M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z' fill='%23fff'/%3E%3Cpath d='M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z' fill='%23fff'/%3E%3C/svg%3E") 50% 50% no-repeat;
}
.a-enter-vr.fullscreen .a-enter-vr-button {
background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3Csvg width='108' height='62' viewBox='0 0 108 62' version='1.1' id='svg320' sodipodi:docname='fullscreen-aframe.svg' xml:space='preserve' inkscape:version='1.2.1 (9c6d41e 2022-07-14)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3E%3Cdefs id='defs324' /%3E%3Csodipodi:namedview id='namedview322' pagecolor='%23ffffff' bordercolor='%23000000' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23d1d1d1' showgrid='false' inkscape:zoom='3.8064516' inkscape:cx='91.423729' inkscape:cy='-1.4449153' inkscape:window-width='1440' inkscape:window-height='847' inkscape:window-x='32' inkscape:window-y='25' inkscape:window-maximized='0' inkscape:current-layer='svg320' /%3E%3Ctitle id='title312'%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z' fill='%23fff' id='path314' style='fill:%23ffffff' /%3E%3Cg id='g356' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g358' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g360' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g362' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g364' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g366' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g368' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g370' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g372' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g374' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g376' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g378' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g380' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g382' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g384' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cmetadata id='metadata561'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d='m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4' id='path596' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4' id='path598' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4' id='path600' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616' id='path602' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3C/svg%3E");
}
.a-enter-vr-button,
.a-enter-ar-button {
background-size: 90% 90%;
border: 0;
bottom: 0;
cursor: pointer;
min-width: 58px;
min-height: 34px;
/* 1.74418604651 */
/*
In order to keep the aspect ratio when resizing
padding-top percentages are relative to the containing block's width.
http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio
*/
padding-right: 0;
padding-top: 0;
position: absolute;
right: 0;
transition: background-color .05s ease;
-webkit-transition: background-color .05s ease;
z-index: 9999;
border-radius: 8px;
touch-action: manipulation; /* Prevent iOS double tap zoom on the button */
}
.a-enter-ar-button {
background-size: 100% 90%;
border-radius: 7px;
}
.a-enter-ar-button:active,
.a-enter-ar-button:hover,
.a-enter-vr-button:active,
.a-enter-vr-button:hover {
background-color: #ef2d5e;
}
.a-enter-vr-button.resethover {
background-color: rgba(0, 0, 0, 0.35);
}
.a-enter-vr-modal {
background-color: #666;
border-radius: 0;
display: none;
min-height: 32px;
margin-right: 70px;
padding: 9px;
width: 280px;
right: 2%;
position: absolute;
}
.a-enter-vr-modal:after {
border-bottom: 10px solid transparent;
border-left: 10px solid #666;
border-top: 10px solid transparent;
display: inline-block;
content: '';
position: absolute;
right: -5px;
top: 5px;
width: 0;
height: 0;
}
.a-enter-vr-modal p,
.a-enter-vr-modal a {
display: inline;
}
.a-enter-vr-modal p {
margin: 0;
}
.a-enter-vr-modal p:after {
content: ' ';
}
.a-orientation-modal {
background: rgba(244, 244, 244, 1) url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E) center no-repeat;
background-size: 50% 50%;
bottom: 0;
font-size: 14px;
font-weight: 600;
left: 0;
line-height: 20px;
right: 0;
position: fixed;
top: 0;
z-index: 9999999;
}
.a-orientation-modal:after {
color: #666;
content: "Insert phone into Cardboard holder.";
display: block;
position: absolute;
text-align: center;
top: 70%;
transform: translateY(-70%);
width: 100%;
}
.a-orientation-modal button {
background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E) no-repeat;
border: none;
height: 50px;
text-indent: -9999px;
width: 50px;
}
.a-loader-title {
background-color: rgba(0, 0, 0, 0.6);
font-family: sans-serif, monospace;
text-align: center;
font-size: 20px;
height: 50px;
font-weight: 300;
line-height: 50px;
position: absolute;
right: 0px;
left: 0px;
top: 0px;
color: white;
}
.a-modal {
position: absolute;
background: rgba(0, 0, 0, 0.60);
background-size: 50% 50%;
bottom: 0;
font-size: 14px;
font-weight: 600;
left: 0;
line-height: 20px;
right: 0;
position: fixed;
top: 0;
z-index: 9999999;
}
.a-dialog {
position: relative;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 199995;
width: 300px;
height: 200px;
background-size: contain;
background-color: white;
font-family: sans-serif, monospace;
font-size: 20px;
border-radius: 3px;
padding: 6px;
}
.a-dialog-text-container {
width: 100%;
height: 70%;
align-self: flex-start;
display: flex;
justify-content: center;
align-content: center;
flex-direction: column;
}
.a-dialog-text {
display: inline-block;
font-weight: normal;
font-size: 14pt;
margin: 8px;
}
.a-dialog-buttons-container {
display: inline-flex;
align-self: flex-end;
width: 100%;
height: 30%;
}
.a-dialog-button {
cursor: pointer;
align-self: center;
opacity: 0.9;
height: 80%;
width: 50%;
font-size: 12pt;
margin: 4px;
border-radius: 2px;
text-align:center;
border: none;
display: inline-block;
-webkit-transition: all 0.25s ease-in-out;
transition: all 0.25s ease-in-out;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);
user-select: none;
}
.a-dialog-permission-button:hover {
box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);
}
.a-dialog-allow-button {
background-color: #00ceff;
}
.a-dialog-deny-button {
background-color: #ff005b;
}
.a-dialog-ok-button {
background-color: #00ceff;
width: 100%;
}
.a-dom-overlay:not(.a-no-style) {
overflow: hidden;
position: absolute;
pointer-events: none;
box-sizing: border-box;
bottom: 0;
left: 0;
right: 0;
top: 0;
padding: 1em;
}
.a-dom-overlay:not(.a-no-style)>* {
pointer-events: auto;
}
`],sourceRoot:""}]);const b=A},2470:(n,e,t)=>{t.d(e,{A:()=>a});var i=t(963),r=t.n(i),s=t(9089),o=t.n(s)()(r());o.push([n.id,`.rs-base {
background-color: #333;
color: #fafafa;
border-radius: 0;
font: 10px monospace;
left: 5px;
line-height: 1em;
opacity: 0.85;
overflow: hidden;
padding: 10px;
position: fixed;
top: 5px;
width: 300px;
z-index: 10000;
}
.rs-base div.hidden {
display: none;
}
.rs-base h1 {
color: #fff;
cursor: pointer;
font-size: 1.4em;
font-weight: 300;
margin: 0 0 5px;
padding: 0;
}
.rs-group {
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column-reverse;
flex-direction: column-reverse;
margin-bottom: 5px;
}
.rs-group:last-child {
margin-bottom: 0;
}
.rs-counter-base {
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: flex;
height: 10px;
-webkit-justify-content: space-between;
justify-content: space-between;
margin: 2px 0;
}
.rs-counter-base.alarm {
color: #b70000;
text-shadow: 0 0 0 #b70000,
0 0 1px #fff,
0 0 1px #fff,
0 0 2px #fff,
0 0 2px #fff,
0 0 3px #fff,
0 0 3px #fff,
0 0 4px #fff,
0 0 4px #fff;
}
.rs-counter-id {
font-weight: 300;
-webkit-box-ordinal-group: 0;
-webkit-order: 0;
order: 0;
width: 54px;
}
.rs-counter-value {
font-weight: 300;
-webkit-box-ordinal-group: 1;
-webkit-order: 1;
order: 1;
text-align: right;
width: 35px;
}
.rs-canvas {
-webkit-box-ordinal-group: 2;
-webkit-order: 2;
order: 2;
}
@media (min-width: 480px) {
.rs-base {
left: 20px;
top: 20px;
}
}
`,"",{version:3,sources:["webpack://./src/style/rStats.css"],names:[],mappings:"AAAA;EACE,sBAAsB;EACtB,cAAc;EACd,gBAAgB;EAChB,oBAAoB;EACpB,SAAS;EACT,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,QAAQ;EACR,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,eAAe;EACf,UAAU;AACZ;;AAEA;EACE,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,sCAAsC;EACtC,8BAA8B;EAC9B,kBAAkB;AACpB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,mBAAmB;EACnB,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,YAAY;EACZ,sCAAsC;EACtC,8BAA8B;EAC9B,aAAa;AACf;;AAEA;EACE,cAAc;EACd;;;;;;;;2BAQyB;AAC3B;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,iBAAiB;EACjB,WAAW;AACb;;AAEA;EACE,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;AACV;;AAEA;EACE;IACE,UAAU;IACV,SAAS;EACX;AACF",sourcesContent:[`.rs-base {
background-color: #333;
color: #fafafa;
border-radius: 0;
font: 10px monospace;
left: 5px;
line-height: 1em;
opacity: 0.85;
overflow: hidden;
padding: 10px;
position: fixed;
top: 5px;
width: 300px;
z-index: 10000;
}
.rs-base div.hidden {
display: none;
}
.rs-base h1 {
color: #fff;
cursor: pointer;
font-size: 1.4em;
font-weight: 300;
margin: 0 0 5px;
padding: 0;
}
.rs-group {
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column-reverse;
flex-direction: column-reverse;
margin-bottom: 5px;
}
.rs-group:last-child {
margin-bottom: 0;
}
.rs-counter-base {
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: flex;
height: 10px;
-webkit-justify-content: space-between;
justify-content: space-between;
margin: 2px 0;
}
.rs-counter-base.alarm {
color: #b70000;
text-shadow: 0 0 0 #b70000,
0 0 1px #fff,
0 0 1px #fff,
0 0 2px #fff,
0 0 2px #fff,
0 0 3px #fff,
0 0 3px #fff,
0 0 4px #fff,
0 0 4px #fff;
}
.rs-counter-id {
font-weight: 300;
-webkit-box-ordinal-group: 0;
-webkit-order: 0;
order: 0;
width: 54px;
}
.rs-counter-value {
font-weight: 300;
-webkit-box-ordinal-group: 1;
-webkit-order: 1;
order: 1;
text-align: right;
width: 35px;
}
.rs-canvas {
-webkit-box-ordinal-group: 2;
-webkit-order: 2;
order: 2;
}
@media (min-width: 480px) {
.rs-base {
left: 20px;
top: 20px;
}
}
`],sourceRoot:""}]);const a=o},7180:(n,e,t)=>{t.r(e),t.d(e,{default:()=>p});var i=t(5072),r=t.n(i),s=t(7825),o=t.n(s),a=t(7659),l=t.n(a),c=t(5056),h=t.n(c),u=t(540),d=t.n(u),f=t(1113),A=t.n(f),g=t(8217),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(g.A,m);const p=g.A&&g.A.locals?g.A.locals:void 0},9379:(n,e,t)=>{t.r(e),t.d(e,{default:()=>p});var i=t(5072),r=t.n(i),s=t(7825),o=t.n(s),a=t(7659),l=t.n(a),c=t(5056),h=t.n(c),u=t(540),d=t.n(u),f=t(1113),A=t.n(f),g=t(2470),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(g.A,m);const p=g.A&&g.A.locals?g.A.locals:void 0},5072:n=>{var e=[];function t(s){for(var o=-1,a=0;a<e.length;a++)if(e[a].identifier===s){o=a;break}return o}function i(s,o){for(var a={},l=[],c=0;c<s.length;c++){var h=s[c],u=o.base?h[0]+o.base:h[0],d=a[u]||0,f="".concat(u," ").concat(d);a[u]=d+1;var A=t(f),g={css:h[1],media:h[2],sourceMap:h[3],supports:h[4],layer:h[5]};if(A!==-1)e[A].references++,e[A].updater(g);else{var m=r(g,o);o.byIndex=c,e.splice(c,0,{identifier:f,updater:m,references:1})}l.push(f)}return l}function r(s,o){var a=o.domAPI(o);return a.update(s),function(l){if(l){if(l.css===s.css&&l.media===s.media&&l.sourceMap===s.sourceMap&&l.supports===s.supports&&l.layer===s.layer)return;a.update(s=l)}else a.remove()}}n.exports=function(s,o){var a=i(s=s||[],o=o||{});return function(l){l=l||[];for(var c=0;c<a.length;c++){var h=t(a[c]);e[h].references--}for(var u=i(l,o),d=0;d<a.length;d++){var f=t(a[d]);e[f].references===0&&(e[f].updater(),e.splice(f,1))}a=u}}},7659:n=>{var e={};n.exports=function(t,i){var r=function(s){if(e[s]===void 0){var o=document.querySelector(s);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch{o=null}e[s]=o}return e[s]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(i)}},540:n=>{n.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:(n,e,t)=>{n.exports=function(i){var r=t.nc;r&&i.setAttribute("nonce",r)}},7825:n=>{n.exports=function(e){if(typeof document>"u")return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(i){(function(r,s,o){var a="";o.supports&&(a+="@supports (".concat(o.supports,") {")),o.media&&(a+="@media ".concat(o.media," {"));var l=o.layer!==void 0;l&&(a+="@layer".concat(o.layer.length>0?" ".concat(o.layer):""," {")),a+=o.css,l&&(a+="}"),o.media&&(a+="}"),o.supports&&(a+="}");var c=o.sourceMap;c&&typeof btoa<"u"&&(a+=`
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(c))))," */")),s.styleTagTransform(a,r,s.options)})(t,e,i)},remove:function(){(function(i){if(i.parentNode===null)return!1;i.parentNode.removeChild(i)})(t)}}}},1113:n=>{n.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},3931:n=>{n.exports="data:image/svg+xml,%3C%3Fxml version=%271.0%27 encoding=%27UTF-8%27 standalone=%27no%27%3F%3E%3Csvg width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27 version=%271.1%27 id=%27svg320%27 sodipodi:docname=%27fullscreen-aframe.svg%27 xml:space=%27preserve%27 inkscape:version=%271.2.1 %289c6d41e 2022-07-14%29%27 xmlns:inkscape=%27http://www.inkscape.org/namespaces/inkscape%27 xmlns:sodipodi=%27http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd%27 xmlns=%27http://www.w3.org/2000/svg%27 xmlns:svg=%27http://www.w3.org/2000/svg%27 xmlns:rdf=%27http://www.w3.org/1999/02/22-rdf-syntax-ns%23%27 xmlns:cc=%27http://creativecommons.org/ns%23%27 xmlns:dc=%27http://purl.org/dc/elements/1.1/%27%3E%3Cdefs id=%27defs324%27 /%3E%3Csodipodi:namedview id=%27namedview322%27 pagecolor=%27%23ffffff%27 bordercolor=%27%23000000%27 borderopacity=%270.25%27 inkscape:showpageshadow=%272%27 inkscape:pageopacity=%270.0%27 inkscape:pagecheckerboard=%270%27 inkscape:deskcolor=%27%23d1d1d1%27 showgrid=%27false%27 inkscape:zoom=%273.8064516%27 inkscape:cx=%2791.423729%27 inkscape:cy=%27-1.4449153%27 inkscape:window-width=%271440%27 inkscape:window-height=%27847%27 inkscape:window-x=%2732%27 inkscape:window-y=%2725%27 inkscape:window-maximized=%270%27 inkscape:current-layer=%27svg320%27 /%3E%3Ctitle id=%27title312%27%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z%27 fill=%27%23fff%27 id=%27path314%27 style=%27fill:%23ffffff%27 /%3E%3Cg id=%27g356%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g358%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g360%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g362%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g364%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g366%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g368%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g370%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g372%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g374%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g376%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g378%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g380%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g382%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g384%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cmetadata id=%27metadata561%27%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=%27%27%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d=%27m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4%27 id=%27path596%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4%27 id=%27path598%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4%27 id=%27path600%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616%27 id=%27path602%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3C/svg%3E"},6085:n=>{n.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},9169:n=>{n.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},6517:n=>{n.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E"},7889:n=>{n.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E"}},Dm={};function He(n){var e=Dm[n];if(e!==void 0)return e.exports;var t=Dm[n]={id:n,exports:{}};return Vy[n](t,t.exports,He),t.exports}He.m=Vy,He.n=n=>{var e=n&&n.__esModule?()=>n.default:()=>n;return He.d(e,{a:e}),e},He.d=(n,e)=>{for(var t in e)He.o(e,t)&&!He.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},He.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),He.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),He.r=n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},He.b=document.baseURI||self.location.href,He.nc=void 0;var Wy={};He.d(Wy,{A:()=>HR});var jd={};He.r(jd),He.d(jd,{computeMikkTSpaceTangents:()=>QI,computeMorphedAttributes:()=>jI,deepCloneAttribute:()=>zI,deinterleaveAttribute:()=>kc,deinterleaveGeometry:()=>VI,estimateBytesUsed:()=>WI,interleaveAttributes:()=>HI,mergeAttributes:()=>hf,mergeGeometries:()=>GI,mergeGroups:()=>XI,mergeVertices:()=>qI,toCreasedNormals:()=>YI,toTrianglesDrawMode:()=>uf});var Xd={};He.r(Xd),He.d(Xd,{checkARSupport:()=>_p,checkHeadsetConnected:()=>wp,checkVRSupport:()=>Af,isAppleVisionPro:()=>TE,isBrowserEnvironment:()=>Tp,isFirefoxReality:()=>RE,isIOS:()=>ma,isIpad:()=>BE,isLandscape:()=>LE,isMobile:()=>rr,isMobileDeviceRequestingDesktopSite:()=>Mp,isMobileVR:()=>Ip,isNodeEnvironment:()=>zB,isOculusBrowser:()=>Sp,isR7:()=>Bp,isTablet:()=>IE,isWebXRAvailable:()=>Dh});var Yd={};He.r(Yd),He.d(Yd,{clearObject:()=>Lp,createPool:()=>Rp,removeUnusedKeys:()=>na});var Kd={};He.r(Kd),He.d(Kd,{equals:()=>ql,isCoordinate:()=>jB,isCoordinates:()=>PE,parse:()=>zc,regex:()=>DE,stringify:()=>Wl,toVector3:()=>XB});var Jd={};He.r(Jd),He.d(Jd,{getComponentProperty:()=>UE,getComponentPropertyPath:()=>Ph,setComponentProperty:()=>Dp});var Zd={};He.r(Zd),He.d(Zd,{parseUrl:()=>mf,validateCubemapSrc:()=>OE,validateEnvMapSrc:()=>Pp,validateSrc:()=>Hc});var $d={};He.r($d),He.d($d,{createCompatibleTexture:()=>Fp,handleTextureEvents:()=>Up,isCompatibleTexture:()=>kE,setTextureProperties:()=>Vc,updateDistortionMap:()=>ni,updateEnvMap:()=>gf,updateMap:()=>Xl,updateMapMaterialFromData:()=>Uh});var Ns={};He.r(Ns),He.d(Ns,{parse:()=>ia,stringify:()=>ZB,toCamelCase:()=>NE});var ef={};He.r(ef),He.d(ef,{checkControllerPresentAndSetup:()=>Dn,emitIfAxesChanged:()=>Nn,findMatchingControllerWebXR:()=>Op,isControllerPresentWebXR:()=>QE,onButtonEvent:()=>Ze});var tf={};He.r(tf),He.d(tf,{bind:()=>nT,checkHeadsetConnected:()=>iT,clone:()=>Np,coordinates:()=>Kd,debounce:()=>zE,debug:()=>vt,deepEqual:()=>Qp,device:()=>Xd,diff:()=>HE,entity:()=>Jd,extend:()=>Cn,extendDeep:()=>Bn,findAllScenes:()=>WE,forceCanvasResizeSafariMobile:()=>FE,getElData:()=>cT,getUrlParameter:()=>ra,isIOS:()=>rT,isIframed:()=>VE,isMobile:()=>sT,material:()=>$d,objectPool:()=>Yd,shouldCaptureKeyEvent:()=>Gp,split:()=>Di,splitString:()=>lT,srcLoader:()=>Zd,styleParser:()=>Ns,throttle:()=>oT,throttleLeadingAndTrailing:()=>GE,throttleTick:()=>aT,trackedControls:()=>ef});var nf={};He.r(nf),He.d(nf,{isSingleProperty:()=>Fh,parseProperties:()=>YE,parseProperty:()=>Oh,process:()=>ga,processPropertyDefinition:()=>yf,stringifyProperties:()=>KE,stringifyProperty:()=>zp});var rf={};He.r(rf),He.d(rf,{Component:()=>sa,components:()=>Pt,registerComponent:()=>Ge,registrationOrderWarnings:()=>$E});var sf={};He.r(sf),He.d(sf,{System:()=>Xc,registerSystem:()=>kn,systems:()=>Si});var qy={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},Ap={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},yI=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],Uc={CSS:{},springs:{}};function Mi(n,e,t){return Math.min(Math.max(n,e),t)}function Co(n,e){return n.indexOf(e)>-1}function ul(n,e){return n.apply(null,e)}var EI=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,xI=/^rgb/,bI=/^hsl/,je={arr:function(n){return Array.isArray(n)},obj:function(n){return Co(Object.prototype.toString.call(n),"Object")},pth:function(n){return je.obj(n)&&n.hasOwnProperty("totalLength")},svg:function(n){return n instanceof SVGElement},inp:function(n){return n instanceof HTMLInputElement},dom:function(n){return n.nodeType||je.svg(n)},str:function(n){return typeof n=="string"},fnc:function(n){return typeof n=="function"},und:function(n){return n===void 0},hex:function(n){return EI.test(n)},rgb:function(n){return xI.test(n)},hsl:function(n){return bI.test(n)},col:function(n){return je.hex(n)||je.rgb(n)||je.hsl(n)},key:function(n){return!qy.hasOwnProperty(n)&&!Ap.hasOwnProperty(n)&&n!=="targets"&&n!=="keyframes"}},CI=/\(([^)]+)\)/;function jy(n){var e=CI.exec(n);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function Xy(n,e){var t=jy(n),i=Mi(je.und(t[0])?1:t[0],.1,100),r=Mi(je.und(t[1])?100:t[1],.1,100),s=Mi(je.und(t[2])?10:t[2],.1,100),o=Mi(je.und(t[3])?0:t[3],.1,100),a=Math.sqrt(r/i),l=s/(2*Math.sqrt(r*i)),c=l<1?a*Math.sqrt(1-l*l):0,h=l<1?(l*a-o)/c:-o+a;function u(d){var f=e?e*d/1e3:d;return f=l<1?Math.exp(-f*l*a)*(1*Math.cos(c*f)+h*Math.sin(c*f)):(1+h*f)*Math.exp(-f*a),d===0||d===1?d:1-f}return e?u:function(){var d=Uc.springs[n];if(d)return d;for(var f=1/6,A=0,g=0;;)if(u(A+=f)===1){if(++g>=16)break}else g=0;var m=A*f*1e3;return Uc.springs[n]=m,m}}function dl(n,e){n===void 0&&(n=1),e===void 0&&(e=.5);var t=Mi(n,1,10),i=Mi(e,.1,2);return function(r){return r===0||r===1?r:-t*Math.pow(2,10*(r-1))*Math.sin((r-1-i/(2*Math.PI)*Math.asin(1/t))*(2*Math.PI)/i)}}function wI(n){return n===void 0&&(n=10),function(e){return Math.round(e*n)*(1/n)}}var Pm=function(){var n=.1;function e(o,a){return 1-3*a+3*o}function t(o,a){return 3*a-6*o}function i(o){return 3*o}function r(o,a,l){return((e(a,l)*o+t(a,l))*o+i(a))*o}function s(o,a,l){return 3*e(a,l)*o*o+2*t(a,l)*o+i(a)}return function(o,a,l,c){if(0<=o&&o<=1&&0<=l&&l<=1){var h=new Float32Array(11);if(o!==a||l!==c)for(var u=0;u<11;++u)h[u]=r(u*n,o,l);return function(d){return o===a&&l===c||d===0||d===1?d:r(function(f){for(var A=0,g=1;g!==10&&h[g]<=f;++g)A+=n;--g;var m=A+(f-h[g])/(h[g+1]-h[g])*n,p=s(m,o,l);return p>=.001?function(v,y,b,w){for(var M=0;M<4;++M){var S=s(y,b,w);if(S===0)return y;y-=(r(y,b,w)-v)/S}return y}(f,m,o,l):p===0?m:function(v,y,b,w,M){var S,R,_=0;do(S=r(R=y+(b-y)/2,w,M)-v)>0?b=R:y=R;while(Math.abs(S)>1e-7&&++_<10);return R}(f,A,A+n,o,l)}(d),a,c)}}}}(),Yy=function(){var n=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],e={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],dl],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(o,a){return function(l){return 1-dl(o,a)(1-l)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(o,a){return function(l){return l<.5?dl(o,a)(2*l)/2:1-dl(o,a)(-2*l+2)/2}}]},t={linear:[.25,.25,.75,.75]};for(var i in e)for(var r=0,s=e[i].length;r<s;r++)t["ease"+i+n[r]]=e[i][r];return t}();function of(n,e){if(je.fnc(n))return n;var t=n.split("(")[0],i=Yy[t],r=jy(n);switch(t){case"spring":return Xy(n,e);case"cubicBezier":return ul(Pm,r);case"steps":return ul(wI,r);default:return je.fnc(i)?ul(i,r):ul(Pm,i)}}function Ky(n){try{return document.querySelectorAll(n)}catch{return}}var Um=[];function Fc(n,e){for(var t=Um,i=n.length,r=arguments.length>=2?arguments[1]:void 0,s=0;s<i;s++)if(s in n){var o=n[s];e.call(r,o,s,n)&&t.push(o)}return(Um=n).length=0,t}function Lh(n,e){e||(e=[]);for(var t=0,i=n.length;t<i;t++){var r=n[t];Array.isArray(r)?Lh(r,e):e.push(r)}return e}function Fm(n){return je.arr(n)?n:(je.str(n)&&(n=Ky(n)||n),n instanceof NodeList||n instanceof HTMLCollection?[].slice.call(n):[n])}function mp(n,e){return n.some(function(t){return t===e})}function gp(n){var e={};for(var t in n)e[t]=n[t];return e}function af(n,e){var t=gp(n);for(var i in n)t[i]=e.hasOwnProperty(i)?e[i]:n[i];return t}function Oc(n,e){var t=gp(n);for(var i in e)t[i]=je.und(n[i])?e[i]:n[i];return t}var _I=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g,MI=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,SI=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,II=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g,BI=/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g,TI=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/;function Li(n){var e=TI.exec(n);if(e)return e[2]}function lf(n,e){return je.fnc(n)?n(e.target,e.id,e.total):n}function ri(n,e){return n.getAttribute(e)}function vp(n,e,t){if(mp([t,"deg","rad","turn"],Li(e)))return e;var i=Uc.CSS[e+t];if(!je.und(i))return i;var r=document.createElement(n.tagName),s=n.parentNode&&n.parentNode!==document?n.parentNode:document.body;s.appendChild(r),r.style.position="absolute",r.style.width=100+t;var o=100/r.offsetWidth;s.removeChild(r);var a=o*parseFloat(e);return Uc.CSS[e+t]=a,a}function Jy(n,e,t){if(e in n.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=n.style[e]||getComputedStyle(n).getPropertyValue(i)||"0";return t?vp(n,r,t):r}}function yp(n,e){return je.dom(n)&&!je.inp(n)&&(ri(n,e)||je.svg(n)&&n[e])?"attribute":je.dom(n)&&mp(yI,e)?"transform":je.dom(n)&&e!=="transform"&&Jy(n,e)?"css":n[e]!=null?"object":void 0}var RI=/(\w+)\(([^)]*)\)/g;function Zy(n){if(je.dom(n)){for(var e,t=n.style.transform||"",i=new Map;e=RI.exec(t);)i.set(e[1],e[2]);return i}}function Ep(n,e,t,i){switch(yp(n,e)){case"transform":return function(r,s,o,a){var l=Co(s,"scale")?1:0+function(h){return Co(h,"translate")||h==="perspective"?"px":Co(h,"rotate")||Co(h,"skew")?"deg":void 0}(s),c=Zy(r).get(s)||l;return o&&(o.transforms.list.set(s,c),o.transforms.last=s),a?vp(r,c,a):c}(n,e,i,t);case"css":return Jy(n,e,t);case"attribute":return ri(n,e);default:return n[e]||0}}var LI=/^(\*=|\+=|-=)/;function xp(n,e){var t=LI.exec(n);if(!t)return n;var i=Li(n)||0,r=parseFloat(e),s=parseFloat(n.replace(t[0],""));switch(t[0][0]){case"+":return r+s+i;case"-":return r-s+i;case"*":return r*s+i}}var DI=/\s/g;function $y(n,e){if(je.col(n))return function(r){return je.rgb(r)?(s=r,(o=_I.exec(s))?"rgba("+o[1]+",1)":s):je.hex(r)?function(a){var l=a.replace(MI,function(h,u,d,f){return u+u+d+d+f+f}),c=SI.exec(l);return"rgba("+parseInt(c[1],16)+","+parseInt(c[2],16)+","+parseInt(c[3],16)+",1)"}(r):je.hsl(r)?function(a){var l,c,h,u=II.exec(a)||BI.exec(a),d=parseInt(u[1],10)/360,f=parseInt(u[2],10)/100,A=parseInt(u[3],10)/100,g=u[4]||1;function m(y,b,w){return w<0&&(w+=1),w>1&&(w-=1),w<1/6?y+6*(b-y)*w:w<.5?b:w<2/3?y+(b-y)*(2/3-w)*6:y}if(f==0)l=c=h=A;else{var p=A<.5?A*(1+f):A+f-A*f,v=2*A-p;l=m(v,p,d+1/3),c=m(v,p,d),h=m(v,p,d-1/3)}return"rgba("+255*l+","+255*c+","+255*h+","+g+")"}(r):void 0;var s,o}(n);var t=Li(n),i=t?n.substr(0,n.length-t.length):n;return e&&!DI.test(n)?i+e:i}function cf(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function Om(n){for(var e,t=n.points,i=0,r=0;r<t.numberOfItems;r++){var s=t.getItem(r);r>0&&(i+=cf(e,s)),e=s}return i}function km(n){if(n.getTotalLength)return n.getTotalLength();switch(n.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ri(e,"r")}(n);case"rect":return function(e){return 2*ri(e,"width")+2*ri(e,"height")}(n);case"line":return function(e){return cf({x:ri(e,"x1"),y:ri(e,"y1")},{x:ri(e,"x2"),y:ri(e,"y2")})}(n);case"polyline":return Om(n);case"polygon":return function(e){var t=e.points;return Om(e)+cf(t.getItem(t.numberOfItems-1),t.getItem(0))}(n)}}function eE(n,e){var t=e||{},i=t.el||function(c){for(var h=c.parentNode;je.svg(h)&&(h=h.parentNode,je.svg(h.parentNode)););return h}(n),r=i.getBoundingClientRect(),s=ri(i,"viewBox"),o=r.width,a=r.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function PI(n,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return n.el.getPointAtLength(l)}var i=eE(n.el,n.svg),r=t(),s=t(-1),o=t(1);switch(n.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}var Bu=/-?\d*\.?\d+/g;function Nm(n,e){var t=$y(je.pth(n)?n.totalLength:n,e)+"";return{original:t,numbers:t.match(Bu)?t.match(Bu).map(Number):[0],strings:je.str(n)||e?t.split(Bu):[]}}function tE(n){return Fc(n?Lh(je.arr(n)?n.map(Fm):Fm(n)):[],function(e,t,i){return i.indexOf(e)===t})}function nE(n){var e=tE(n);return e.map(function(t,i){return{target:t,id:i,total:e.length,transforms:{list:Zy(t)}}})}var UI=/^spring/;function FI(n,e){var t=gp(e);if(UI.test(t.easing)&&(t.duration=Xy(t.easing)),je.arr(n)){var i=n.length;i!==2||je.obj(n[0])?je.fnc(e.duration)||(t.duration=e.duration/i):n={value:n}}var r=je.arr(n)?n:[n];return r.map(function(s,o){var a=je.obj(s)&&!je.pth(s)?s:{value:s};return je.und(a.delay)&&(a.delay=o?0:e.delay),je.und(a.endDelay)&&(a.endDelay=o===r.length-1?e.endDelay:0),a}).map(function(s){return Oc(s,t)})}var iE={css:function(n,e,t){return n.style[e]=t},attribute:function(n,e,t){return n.setAttribute(e,t)},object:function(n,e,t){return n[e]=t},transform:function(n,e,t,i,r){if(i.list.set(e,t),e===i.last||r){var s="";i.list.forEach(function(o,a){s+=a+"("+o+") "}),n.style.transform=s}}};function rE(n,e){for(var t=nE(n),i=0,r=t.length;i<r;i++){var s=t[i];for(var o in e){var a=lf(e[o],s),l=s.target,c=Li(a),h=Ep(l,o,c,s),u=xp($y(a,c||Li(h)),h),d=yp(l,o);iE[d](l,o,u,s.transforms,!0)}}}function OI(n,e){return Fc(Lh(n.map(function(t){return e.map(function(i){return function(r,s){var o=yp(r.target,s.name);if(o){var a=function(c,h){var u;return c.tweens.map(function(d){var f=function(M,S){var R={};for(var _ in M){var I=lf(M[_],S);je.arr(I)&&(I=I.map(function(D){return lf(D,S)})).length===1&&(I=I[0]),R[_]=I}return R.duration=parseFloat(R.duration),R.delay=parseFloat(R.delay),R}(d,h),A=f.value,g=je.arr(A)?A[1]:A,m=Li(g),p=Ep(h.target,c.name,m,h),v=u?u.to.original:p,y=je.arr(A)?A[0]:v,b=Li(y)||Li(p),w=m||b;return je.und(g)&&(g=v),f.from=Nm(y,w),f.to=Nm(xp(g,y),w),f.start=u?u.end:0,f.end=f.start+f.delay+f.duration+f.endDelay,f.easing=of(f.easing,f.duration),f.isPath=je.pth(A),f.isColor=je.col(f.from.original),f.isColor&&(f.round=1),u=f,f})}(s,r),l=a[a.length-1];return{type:o,property:s.name,animatable:r,tweens:a,duration:l.end,delay:a[0].delay,endDelay:l.endDelay}}}(t,i)})})),function(t){return!je.und(t)})}function sE(n,e){var t=n.length,i=function(s){return s.timelineOffset?s.timelineOffset:0},r={};return r.duration=t?Math.max.apply(Math,n.map(function(s){return i(s)+s.duration})):e.duration,r.delay=t?Math.min.apply(Math,n.map(function(s){return i(s)+s.delay})):e.delay,r.endDelay=t?r.duration-Math.max.apply(Math,n.map(function(s){return i(s)+s.duration-s.endDelay})):e.endDelay,r}var Hl,Qm=0,En=[],Tu=[],kI=function(){function n(){Hl=requestAnimationFrame(e)}function e(t){var i=En.length;if(i){for(var r=0;r<i;){var s=En[r];if(s.paused){var o=En.indexOf(s);o>-1&&(En.splice(o,1),i=En.length)}else s.tick(t);r++}n()}else Hl=cancelAnimationFrame(Hl)}return n}();function Gt(n){n===void 0&&(n={});var e,t=0,i=0,r=0,s=0,o=null;function a(){return window.Promise&&new Promise(function(p){return o=p})}var l=a(),c=function(p){var v=af(qy,p),y=af(Ap,p),b=function(_,I){var D=[],Q=I.keyframes;for(var N in Q&&(I=Oc(function(z){for(var $=Fc(Lh(z.map(function(ee){return Object.keys(ee)})),function(ee){return je.key(ee)}).reduce(function(ee,pe){return ee.indexOf(pe)<0&&ee.push(pe),ee},[]),H={},K=function(ee){var pe=$[ee];H[pe]=z.map(function(be){var Ce={};for(var Pe in be)je.key(Pe)?Pe==pe&&(Ce.value=be[Pe]):Ce[Pe]=be[Pe];return Ce})},Y=0;Y<$.length;Y++)K(Y);return H}(Q),I)),I)je.key(N)&&D.push({name:N,tweens:FI(I[N],_)});return D}(y,p),w=nE(p.targets),M=OI(w,b),S=sE(M,y),R=Qm;return Qm++,Oc(v,{id:R,children:[],animatables:w,animations:M,duration:S.duration,delay:S.delay,endDelay:S.endDelay})}(n);function h(){c.reversed=!c.reversed;for(var p=0,v=e.length;p<v;p++)e[p].reversed=c.reversed}function u(p){return c.reversed?c.duration-p:p}function d(){t=0,i=u(c.currentTime)*(1/Gt.speed)}function f(p,v){v&&v.seek(p-v.timelineOffset)}function A(p){for(var v=0,y=c.animations,b=y.length;v<b;){var w=y[v],M=w.animatable,S=w.tweens,R=S.length-1,_=S[R];R&&(_=Fc(S,function(te){return p<te.end})[0]||_);for(var I=Mi(p-_.start-_.delay,0,_.duration)/_.duration,D=isNaN(I)?1:_.easing(I),Q=_.to.strings,N=_.round,z=[],$=_.to.numbers.length,H=void 0,K=0;K<$;K++){var Y=void 0,ee=_.to.numbers[K],pe=_.from.numbers[K]||0;Y=_.isPath?PI(_.value,D*ee):pe+D*(ee-pe),N&&(_.isColor&&K>2||(Y=Math.round(Y*N)/N)),z.push(Y)}var be=Q.length;if(be){H=Q[0];for(var Ce=0;Ce<be;Ce++){Q[Ce];var Pe=Q[Ce+1],Me=z[Ce];isNaN(Me)||(H+=Pe?Me+Pe:Me+" ")}}else H=z[0];iE[w.type](M.target,w.property,H,M.transforms),w.currentValue=H,v++}}function g(p){c[p]&&!c.passThrough&&c[p](c)}function m(p){var v=c.duration,y=c.delay,b=v-c.endDelay,w=u(p);c.progress=Mi(w/v*100,0,100),c.reversePlayback=w<c.currentTime,e&&function(M){if(c.reversePlayback)for(var S=s;S--;)f(M,e[S]);else for(var R=0;R<s;R++)f(M,e[R])}(w),!c.began&&c.currentTime>0&&(c.began=!0,g("begin"),g("loopBegin")),w<=y&&c.currentTime!==0&&A(0),(w>=b&&c.currentTime!==v||!v)&&A(v),w>y&&w<b?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,g("changeBegin")),g("change"),A(w)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,g("changeComplete")),c.currentTime=Mi(w,0,v),c.began&&g("update"),p>=v&&(i=0,c.remaining&&c.remaining!==!0&&c.remaining--,c.remaining?(t=r,g("loopComplete"),g("loopBegin"),c.direction==="alternate"&&h()):(c.paused=!0,c.completed||(c.completed=!0,g("loopComplete"),g("complete"),"Promise"in window&&(o(),l=a()))))}return c.reset=function(){var p=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed=p==="reverse",c.remaining=c.loop,e=c.children;for(var v=s=e.length;v--;)c.children[v].reset();(c.reversed&&c.loop!==!0||p==="alternate"&&c.loop===1)&&c.remaining++,A(0)},c.set=function(p,v){return rE(p,v),c},c.tick=function(p){r=p,t||(t=r),m((r+(i-t))*Gt.speed)},c.seek=function(p){m(u(p))},c.pause=function(){c.paused=!0,d()},c.play=function(){c.paused&&(c.paused=!1,En.push(c),d(),Hl||kI())},c.reverse=function(){h(),d()},c.restart=function(){c.reset(),c.play()},c.finished=l,c.reset(),c.autoplay&&c.play(),c}function Gm(n,e){for(var t=e.length;t--;)mp(n,e[t].animatable.target)&&e.splice(t,1)}document.addEventListener("visibilitychange",function(){if(document.hidden){for(var n=0,e=En.length;n<e;n++)activeInstance[n].pause();Tu=En.slice(0),En=[]}else for(var t=0,i=Tu.length;t<i;t++)Tu[t].play()}),Gt.version="3.0.0",Gt.speed=1,Gt.running=En,Gt.remove=function(n){for(var e=tE(n),t=En.length;t--;){var i=En[t],r=i.animations,s=i.children;Gm(e,r);for(var o=s.length;o--;){var a=s[o],l=a.animations;Gm(e,l),l.length||a.children.length||s.splice(o,1)}r.length||s.length||i.pause()}},Gt.get=Ep,Gt.set=rE,Gt.convertPx=vp,Gt.path=function(n,e){var t=je.str(n)?Ky(n)[0]:n,i=e||100;return function(r){return{property:r,el:t,svg:eE(t),totalLength:km(t)*(i/100)}}},Gt.setDashoffset=function(n){var e=km(n);return n.setAttribute("stroke-dasharray",e),e},Gt.stagger=function(n,e){e===void 0&&(e={});var t=e.direction||"normal",i=e.easing?of(e.easing):null,r=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",h=je.arr(n),u=parseFloat(h?n[0]:n),d=h?parseFloat(n[1]):0,f=Li(h?n[1]:n)||0,A=e.start||0+(h?u:0),g=[],m=0;return function(p,v,y){if(a&&(o=0),l&&(o=(y-1)/2),c&&(o=y-1),!g.length){for(var b=0;b<y;b++){if(r){var w=l?(r[0]-1)/2:o%r[0],M=l?(r[1]-1)/2:Math.floor(o/r[0]),S=w-b%r[0],R=M-Math.floor(b/r[0]),_=Math.sqrt(S*S+R*R);s==="x"&&(_=-S),s==="y"&&(_=-R),g.push(_)}else g.push(Math.abs(o-b));m=Math.max.apply(Math,g)}i&&(g=g.map(function(I){return i(I/m)*m})),t==="reverse"&&(g=g.map(function(I){return s?I<0?-1*I:-I:Math.abs(m-I)}))}return A+(h?(d-u)/m:u)*(Math.round(100*g[v])/100)+f}},Gt.timeline=function(n){n===void 0&&(n={});var e=Gt(n);return e.duration=0,e.add=function(t,i){var r=En.indexOf(e),s=e.children;function o(d){d.passThrough=!0}r>-1&&En.splice(r,1);for(var a=0;a<s.length;a++)o(s[a]);var l=Oc(t,af(Ap,n));l.targets=l.targets||n.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=je.und(i)?c:xp(i,c),o(e),e.seek(l.timelineOffset);var h=Gt(l);o(h),s.push(h);var u=sE(s,n);return e.delay=u.delay,e.endDelay=u.endDelay,e.duration=u.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},Gt.easing=of,Gt.penner=Yy,Gt.random=function(n,e){return Math.floor(Math.random()*(e-n+1))+n};const Vl=Gt,E=gI,Ru=new WeakMap;class oE extends E.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){const s=new E.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{this.parse(o,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,E.SRGBColorSpace,i).catch(i)}decodeDracoFile(e,t,i,r,s=E.LinearSRGBColorSpace,o=()=>{}){const a={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:s};return this.decodeGeometry(e,a).then(t).catch(o)}decodeGeometry(e,t){const i=JSON.stringify(t);if(Ru.has(e)){const l=Ru.get(e);if(l.key===i)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(r=l,new Promise((c,h)=>{r._callbacks[s]={resolve:c,reject:h},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),Ru.set(e,{key:i,promise:a}),a}_createGeometry(e){const t=new E.BufferGeometry;e.index&&t.setIndex(new E.BufferAttribute(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const r=e.attributes[i],s=r.name,o=r.array,a=r.itemSize,l=new E.BufferAttribute(o,a);s==="color"&&(this._assignVertexColorSpace(l,r.vertexColorSpace),l.normalized=o instanceof Float32Array==0),t.setAttribute(s,l)}return t}_assignVertexColorSpace(e,t){if(t!==E.SRGBColorSpace)return;const i=new E.Color;for(let r=0,s=e.count;r<s;r++)i.fromBufferAttribute(e,r),E.ColorManagement.toWorkingColorSpace(i,E.SRGBColorSpace),e.setXYZ(r,i.r,i.g,i.b)}_loadLibrary(e,t){const i=new E.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,s)=>{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const s=NI.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){const o=s.data;switch(o.type){case"decode":r._callbacks[o.id].resolve(o);break;case"error":r._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function NI(){let n,e;function t(i,r,s,o,a,l){const c=l.num_components(),h=s.num_points()*c,u=h*a.BYTES_PER_ELEMENT,d=function(g,m){switch(m){case Float32Array:return g.DT_FLOAT32;case Int8Array:return g.DT_INT8;case Int16Array:return g.DT_INT16;case Int32Array:return g.DT_INT32;case Uint8Array:return g.DT_UINT8;case Uint16Array:return g.DT_UINT16;case Uint32Array:return g.DT_UINT32}}(i,a),f=i._malloc(u);r.GetAttributeDataArrayForAllPoints(s,l,d,u,f);const A=new a(i.HEAPF32.buffer,f,h).slice();return i._free(f),{name:o,array:A,itemSize:c}}onmessage=function(i){const r=i.data;switch(r.type){case"init":n=r.decoderConfig,e=new Promise(function(a){n.onModuleLoaded=function(l){a({draco:l})},DracoDecoderModule(n)});break;case"decode":const s=r.buffer,o=r.taskConfig;e.then(a=>{const l=a.draco,c=new l.Decoder;try{const h=function(d,f,A,g){const m=g.attributeIDs,p=g.attributeTypes;let v,y;const b=f.GetEncodedGeometryType(A);if(b===d.TRIANGULAR_MESH)v=new d.Mesh,y=f.DecodeArrayToMesh(A,A.byteLength,v);else{if(b!==d.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");v=new d.PointCloud,y=f.DecodeArrayToPointCloud(A,A.byteLength,v)}if(!y.ok()||v.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+y.error_msg());const w={index:null,attributes:[]};for(const M in m){const S=self[p[M]];let R,_;if(g.useUniqueIDs)_=m[M],R=f.GetAttributeByUniqueId(v,_);else{if(_=f.GetAttributeId(v,d[m[M]]),_===-1)continue;R=f.GetAttribute(v,_)}const I=t(d,f,v,M,S,R);M==="color"&&(I.vertexColorSpace=g.vertexColorSpace),w.attributes.push(I)}return b===d.TRIANGULAR_MESH&&(w.index=function(M,S,R){const _=3*R.num_faces(),I=4*_,D=M._malloc(I);S.GetTrianglesUInt32Array(R,I,D);const Q=new Uint32Array(M.HEAPF32.buffer,D,_).slice();return M._free(D),{array:Q,itemSize:1}}(d,f,v)),d.destroy(v),w}(l,c,new Int8Array(s),o),u=h.attributes.map(d=>d.array.buffer);h.index&&u.push(h.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:h},u)}catch(h){console.error(h),self.postMessage({type:"error",id:r.id,error:h.message})}finally{l.destroy(c)}})}}}function QI(n,e,t=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!n.hasAttribute("position")||!n.hasAttribute("normal")||!n.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function i(o){if(o.normalized||o.isInterleavedBufferAttribute){const a=new Float32Array(o.count*o.itemSize);for(let l=0,c=0;l<o.count;l++)a[c++]=o.getX(l),a[c++]=o.getY(l),o.itemSize>2&&(a[c++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}const r=n.index?n.toNonIndexed():n,s=e.generateTangents(i(r.attributes.position),i(r.attributes.normal),i(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new E.BufferAttribute(s,4)),n!==r&&n.copy(r),n}function GI(n,e=!1){const t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),r=new Set(Object.keys(n[0].morphAttributes)),s={},o={},a=n[0].morphTargetsRelative,l=new E.BufferGeometry;let c=0;for(let h=0;h<n.length;++h){const u=n[h];let d=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in u.attributes){if(!i.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;s[f]===void 0&&(s[f]=[]),s[f].push(u.attributes[f]),d++}if(d!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in u.morphAttributes){if(!r.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[f]===void 0&&(o[f]=[]),o[f].push(u.morphAttributes[f])}if(e){let f;if(t)f=u.index.count;else{if(u.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;f=u.attributes.position.count}l.addGroup(c,f,h),c+=f}}if(t){let h=0;const u=[];for(let d=0;d<n.length;++d){const f=n[d].index;for(let A=0;A<f.count;++A)u.push(f.getX(A)+h);h+=n[d].attributes.position.count}l.setIndex(u)}for(const h in s){const u=hf(s[h]);if(!u)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,u)}for(const h in o){const u=o[h][0].length;if(u===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let d=0;d<u;++d){const f=[];for(let g=0;g<o[h].length;++g)f.push(o[h][g][d]);const A=hf(f);if(!A)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(A)}}return l}function hf(n){let e,t,i,r=-1,s=0;for(let c=0;c<n.length;++c){const h=n[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=h.itemSize),t!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=h.normalized),i!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=h.gpuType),r!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=h.count*t}const o=new e(s),a=new E.BufferAttribute(o,t,i);let l=0;for(let c=0;c<n.length;++c){const h=n[c];if(h.isInterleavedBufferAttribute){const u=l/t;for(let d=0,f=h.count;d<f;d++)for(let A=0;A<t;A++){const g=h.getComponent(d,A);a.setComponent(d+u,A,g)}}else o.set(h.array,l);l+=h.count*t}return r!==void 0&&(a.gpuType=r),a}function zI(n){return n.isInstancedInterleavedBufferAttribute||n.isInterleavedBufferAttribute?kc(n):n.isInstancedBufferAttribute?new E.InstancedBufferAttribute().copy(n):new E.BufferAttribute().copy(n)}function HI(n){let e,t=0,i=0;for(let c=0,h=n.length;c<h;++c){const u=n[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=u.array.length,i+=u.itemSize}const r=new E.InterleavedBuffer(new e(t),i);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,h=n.length;c<h;c++){const u=n[c],d=u.itemSize,f=u.count,A=new E.InterleavedBufferAttribute(r,d,s,u.normalized);o.push(A),s+=d;for(let g=0;g<f;g++)for(let m=0;m<d;m++)A[l[m]](g,u[a[m]](g))}return o}function kc(n){const e=n.data.array.constructor,t=n.count,i=n.itemSize,r=n.normalized,s=new e(t*i);let o;o=n.isInstancedInterleavedBufferAttribute?new E.InstancedBufferAttribute(s,i,r,n.meshPerAttribute):new E.BufferAttribute(s,i,r);for(let a=0;a<t;a++)o.setX(a,n.getX(a)),i>=2&&o.setY(a,n.getY(a)),i>=3&&o.setZ(a,n.getZ(a)),i>=4&&o.setW(a,n.getW(a));return o}function VI(n){const e=n.attributes,t=n.morphTargets,i=new Map;for(const r in e){const s=e[r];s.isInterleavedBufferAttribute&&(i.has(s)||i.set(s,kc(s)),e[r]=i.get(s))}for(const r in t){const s=t[r];s.isInterleavedBufferAttribute&&(i.has(s)||i.set(s,kc(s)),t[r]=i.get(s))}}function WI(n){let e=0;for(const i in n.attributes){const r=n.getAttribute(i);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}const t=n.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function qI(n,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},i=n.getIndex(),r=n.getAttribute("position"),s=i?i.count:r.count;let o=0;const a=Object.keys(n.attributes),l={},c={},h=[],u=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let v=0,y=a.length;v<y;v++){const b=a[v],w=n.attributes[b];l[b]=new w.constructor(new w.array.constructor(w.count*w.itemSize),w.itemSize,w.normalized);const M=n.morphAttributes[b];M&&(c[b]||(c[b]=[]),M.forEach((S,R)=>{const _=new S.array.constructor(S.count*S.itemSize);c[b][R]=new S.constructor(_,S.itemSize,S.normalized)}))}const f=.5*e,A=Math.log10(1/e),g=Math.pow(10,A),m=f*g;for(let v=0;v<s;v++){const y=i?i.getX(v):v;let b="";for(let w=0,M=a.length;w<M;w++){const S=a[w],R=n.getAttribute(S),_=R.itemSize;for(let I=0;I<_;I++)b+=~~(R[u[I]](y)*g+m)+","}if(b in t)h.push(t[b]);else{for(let w=0,M=a.length;w<M;w++){const S=a[w],R=n.getAttribute(S),_=n.morphAttributes[S],I=R.itemSize,D=l[S],Q=c[S];for(let N=0;N<I;N++){const z=u[N],$=d[N];if(D[$](o,R[z](y)),_)for(let H=0,K=_.length;H<K;H++)Q[H][$](o,_[H][z](y))}}t[b]=o,h.push(o),o++}}const p=n.clone();for(const v in n.attributes){const y=l[v];if(p.setAttribute(v,new y.constructor(y.array.slice(0,o*y.itemSize),y.itemSize,y.normalized)),v in c)for(let b=0;b<c[v].length;b++){const w=c[v][b];p.morphAttributes[v][b]=new w.constructor(w.array.slice(0,o*w.itemSize),w.itemSize,w.normalized)}}return p.setIndex(h),p}function uf(n,e){if(e===E.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===E.TriangleFanDrawMode||e===E.TriangleStripDrawMode){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a===void 0)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n;for(let l=0;l<a.count;l++)o.push(l);n.setIndex(o),t=n.getIndex()}const i=t.count-2,r=[];if(e===E.TriangleFanDrawMode)for(let o=1;o<=i;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<i;o++)o%2==0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=n.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}function jI(n){const e=new E.Vector3,t=new E.Vector3,i=new E.Vector3,r=new E.Vector3,s=new E.Vector3,o=new E.Vector3,a=new E.Vector3,l=new E.Vector3,c=new E.Vector3;function h(K,Y,ee,pe,be,Ce,Pe,Me){e.fromBufferAttribute(Y,be),t.fromBufferAttribute(Y,Ce),i.fromBufferAttribute(Y,Pe);const te=K.morphTargetInfluences;if(ee&&te){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let Ae=0,se=ee.length;Ae<se;Ae++){const X=te[Ae],he=ee[Ae];X!==0&&(r.fromBufferAttribute(he,be),s.fromBufferAttribute(he,Ce),o.fromBufferAttribute(he,Pe),pe?(a.addScaledVector(r,X),l.addScaledVector(s,X),c.addScaledVector(o,X)):(a.addScaledVector(r.sub(e),X),l.addScaledVector(s.sub(t),X),c.addScaledVector(o.sub(i),X)))}e.add(a),t.add(l),i.add(c)}K.isSkinnedMesh&&(K.applyBoneTransform(be,e),K.applyBoneTransform(Ce,t),K.applyBoneTransform(Pe,i)),Me[3*be+0]=e.x,Me[3*be+1]=e.y,Me[3*be+2]=e.z,Me[3*Ce+0]=t.x,Me[3*Ce+1]=t.y,Me[3*Ce+2]=t.z,Me[3*Pe+0]=i.x,Me[3*Pe+1]=i.y,Me[3*Pe+2]=i.z}const u=n.geometry,d=n.material;let f,A,g;const m=u.index,p=u.attributes.position,v=u.morphAttributes.position,y=u.morphTargetsRelative,b=u.attributes.normal,w=u.morphAttributes.position,M=u.groups,S=u.drawRange;let R,_,I,D,Q,N,z;const $=new Float32Array(p.count*p.itemSize),H=new Float32Array(b.count*b.itemSize);if(m!==null)if(Array.isArray(d))for(R=0,I=M.length;R<I;R++)for(Q=M[R],N=Math.max(Q.start,S.start),z=Math.min(Q.start+Q.count,S.start+S.count),_=N,D=z;_<D;_+=3)f=m.getX(_),A=m.getX(_+1),g=m.getX(_+2),h(n,p,v,y,f,A,g,$),h(n,b,w,y,f,A,g,H);else for(N=Math.max(0,S.start),z=Math.min(m.count,S.start+S.count),R=N,I=z;R<I;R+=3)f=m.getX(R),A=m.getX(R+1),g=m.getX(R+2),h(n,p,v,y,f,A,g,$),h(n,b,w,y,f,A,g,H);else if(Array.isArray(d))for(R=0,I=M.length;R<I;R++)for(Q=M[R],N=Math.max(Q.start,S.start),z=Math.min(Q.start+Q.count,S.start+S.count),_=N,D=z;_<D;_+=3)f=_,A=_+1,g=_+2,h(n,p,v,y,f,A,g,$),h(n,b,w,y,f,A,g,H);else for(N=Math.max(0,S.start),z=Math.min(p.count,S.start+S.count),R=N,I=z;R<I;R+=3)f=R,A=R+1,g=R+2,h(n,p,v,y,f,A,g,$),h(n,b,w,y,f,A,g,H);return{positionAttribute:p,normalAttribute:b,morphedPositionAttribute:new E.Float32BufferAttribute($,3),morphedNormalAttribute:new E.Float32BufferAttribute(H,3)}}function XI(n){if(n.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),n;let e=n.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),n.getIndex()===null){const o=n.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);n.setIndex(a)}const t=n.getIndex(),i=[];for(let o=0;o<e.length;o++){const a=e[o],l=a.start,c=l+a.count;for(let h=l;h<c;h++)i.push(t.getX(h))}n.dispose(),n.setIndex(i);let r=0;for(let o=0;o<e.length;o++){const a=e[o];a.start=r,r+=a.count}let s=e[0];n.groups=[s];for(let o=1;o<e.length;o++){const a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,n.groups.push(s))}return n}function YI(n,e=Math.PI/3){const t=Math.cos(e),i=100*(1+1e-10),r=[new E.Vector3,new E.Vector3,new E.Vector3],s=new E.Vector3,o=new E.Vector3,a=new E.Vector3,l=new E.Vector3;function c(g){return`${~~(g.x*i)},${~~(g.y*i)},${~~(g.z*i)}`}const h=n.index?n.toNonIndexed():n,u=h.attributes.position,d={};for(let g=0,m=u.count/3;g<m;g++){const p=3*g,v=r[0].fromBufferAttribute(u,p+0),y=r[1].fromBufferAttribute(u,p+1),b=r[2].fromBufferAttribute(u,p+2);s.subVectors(b,y),o.subVectors(v,y);const w=new E.Vector3().crossVectors(s,o).normalize();for(let M=0;M<3;M++){const S=c(r[M]);S in d||(d[S]=[]),d[S].push(w)}}const f=new Float32Array(3*u.count),A=new E.BufferAttribute(f,3,!1);for(let g=0,m=u.count/3;g<m;g++){const p=3*g,v=r[0].fromBufferAttribute(u,p+0),y=r[1].fromBufferAttribute(u,p+1),b=r[2].fromBufferAttribute(u,p+2);s.subVectors(b,y),o.subVectors(v,y),a.crossVectors(s,o).normalize();for(let w=0;w<3;w++){const M=d[c(r[w])];l.set(0,0,0);for(let S=0,R=M.length;S<R;S++){const _=M[S];a.dot(_)>t&&l.add(_)}l.normalize(),A.setXYZ(p+w,l.x,l.y,l.z)}}return h.setAttribute("normal",A),h}class bp extends E.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new eB(t)}),this.register(function(t){return new tB(t)}),this.register(function(t){return new hB(t)}),this.register(function(t){return new uB(t)}),this.register(function(t){return new dB(t)}),this.register(function(t){return new iB(t)}),this.register(function(t){return new rB(t)}),this.register(function(t){return new sB(t)}),this.register(function(t){return new oB(t)}),this.register(function(t){return new $I(t)}),this.register(function(t){return new aB(t)}),this.register(function(t){return new nB(t)}),this.register(function(t){return new cB(t)}),this.register(function(t){return new lB(t)}),this.register(function(t){return new JI(t)}),this.register(function(t){return new fB(t)}),this.register(function(t){return new pB(t)})}load(e,t,i,r){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const c=E.LoaderUtils.extractUrlBase(e);o=E.LoaderUtils.resolveURL(c,this.path)}else o=E.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){r?r(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new E.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,o,function(h){t(h),s.manager.itemEnd(e)},a)}catch(h){a(h)}},i,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 this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let s;const o={},a={},l=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===aE){try{o[lt.KHR_BINARY_GLTF]=new AB(e)}catch(h){return void(r&&r(h))}s=JSON.parse(o[lt.KHR_BINARY_GLTF].content)}else s=JSON.parse(l.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2)return void(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new MB(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,o[u.name]=!0}if(s.extensionsUsed)for(let h=0;h<s.extensionsUsed.length;++h){const u=s.extensionsUsed[h],d=s.extensionsRequired||[];switch(u){case lt.KHR_MATERIALS_UNLIT:o[u]=new ZI;break;case lt.KHR_DRACO_MESH_COMPRESSION:o[u]=new mB(s,this.dracoLoader);break;case lt.KHR_TEXTURE_TRANSFORM:o[u]=new gB;break;case lt.KHR_MESH_QUANTIZATION:o[u]=new vB;break;default:d.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function KI(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const lt={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 JI{constructor(e){this.parser=e,this.name=lt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){const s=t[i];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let a;const l=new E.Color(16777215);o.color!==void 0&&l.setRGB(o.color[0],o.color[1],o.color[2],E.LinearSRGBColorSpace);const c=o.range!==void 0?o.range:0;switch(o.type){case"directional":a=new E.DirectionalLight(l),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new E.PointLight(l),a.distance=c;break;case"spot":a=new E.SpotLight(l),a.distance=c,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),bi(a,o),o.intensity!==void 0&&(a.intensity=o.intensity),a.name=t.createUniqueName(o.name||"light_"+e),r=Promise.resolve(a),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,r=i.json.nodes[e],s=(r.extensions&&r.extensions[this.name]||{}).light;return s===void 0?null:this._loadLight(s).then(function(o){return i._getNodeRef(t.cache,s,o)})}}class ZI{constructor(){this.name=lt.KHR_MATERIALS_UNLIT}getMaterialType(){return E.MeshBasicMaterial}extendParams(e,t,i){const r=[];e.color=new E.Color(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],E.LinearSRGBColorSpace),e.opacity=o[3]}s.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",s.baseColorTexture,E.SRGBColorSpace))}return Promise.all(r)}}class $I{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class eB{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(i.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new E.Vector2(a,a)}return Promise.all(s)}}class tB{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return t.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class nB{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class iB{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new E.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=r.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],E.LinearSRGBColorSpace)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(i.assignTexture(t,"sheenColorMap",o.sheenColorTexture,E.SRGBColorSpace)),o.sheenRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class rB{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(i.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class sB{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(i.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new E.Color().setRGB(a[0],a[1],a[2],E.LinearSRGBColorSpace),Promise.all(s)}}class oB{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class aB{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(i.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new E.Color().setRGB(a[0],a[1],a[2],E.LinearSRGBColorSpace),o.specularColorTexture!==void 0&&s.push(i.assignTexture(t,"specularColorMap",o.specularColorTexture,E.SRGBColorSpace)),Promise.all(s)}}class lB{constructor(e){this.parser=e,this.name=lt.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(i.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(s)}}class cB{constructor(e){this.parser=e,this.name=lt.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?E.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(i.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class hB{constructor(e){this.parser=e,this.name=lt.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const s=r.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class uB{constructor(e){this.parser=e,this.name=lt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class dB{constructor(e){this.parser=e,this.name=lt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class fB{constructor(e){this.name=lt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.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 s.then(function(a){const l=r.byteOffset||0,c=r.byteLength||0,h=r.count,u=r.byteStride,d=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,u,d,r.mode,r.filter).then(function(f){return f.buffer}):o.ready.then(function(){const f=new ArrayBuffer(h*u);return o.decodeGltfBuffer(new Uint8Array(f),h,u,d,r.mode,r.filter),f})})}return null}}class pB{constructor(e){this.name=lt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const l of r.primitives)if(l.mode!==Fn.TRIANGLES&&l.mode!==Fn.TRIANGLE_STRIP&&l.mode!==Fn.TRIANGLE_FAN&&l.mode!==void 0)return null;const s=i.extensions[this.name].attributes,o=[],a={};for(const l in s)o.push(this.parser.getDependency("accessor",s[l]).then(c=>(a[l]=c,a[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{const c=l.pop(),h=c.isGroup?c.children:[c],u=l[0].count,d=[];for(const f of h){const A=new E.Matrix4,g=new E.Vector3,m=new E.Quaternion,p=new E.Vector3(1,1,1),v=new E.InstancedMesh(f.geometry,f.material,u);for(let y=0;y<u;y++)a.TRANSLATION&&g.fromBufferAttribute(a.TRANSLATION,y),a.ROTATION&&m.fromBufferAttribute(a.ROTATION,y),a.SCALE&&p.fromBufferAttribute(a.SCALE,y),v.setMatrixAt(y,A.compose(g,m,p));for(const y in a)if(y==="_COLOR_0"){const b=a[y];v.instanceColor=new E.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else y!=="TRANSLATION"&&y!=="ROTATION"&&y!=="SCALE"&&f.geometry.setAttribute(y,a[y]);E.Object3D.prototype.copy.call(v,f),this.parser.assignFinalMaterial(v),d.push(v)}return c.isGroup?(c.clear(),c.add(...d),c):d[0]}))}}const aE="glTF";class AB{constructor(e){this.name=lt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==aE)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,s=new DataView(e,12);let o=0;for(;o<r;){const a=s.getUint32(o,!0);o+=4;const l=s.getUint32(o,!0);if(o+=4,l===1313821514){const c=new Uint8Array(e,12+o,a);this.content=i.decode(c)}else if(l===5130562){const c=12+o;this.body=e.slice(c,c+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class mB{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=lt.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},l={},c={};for(const h in o){const u=df[h]||h.toLowerCase();a[u]=o[h]}for(const h in e.attributes){const u=df[h]||h.toLowerCase();if(o[h]!==void 0){const d=i.accessors[e.attributes[h]],f=Ps[d.componentType];c[u]=f.name,l[u]=d.normalized===!0}}return t.getDependency("bufferView",s).then(function(h){return new Promise(function(u,d){r.decodeDracoFile(h,function(f){for(const A in f.attributes){const g=f.attributes[A],m=l[A];m!==void 0&&(g.normalized=m)}u(f)},a,c,E.LinearSRGBColorSpace,d)})})}}class gB{constructor(){this.name=lt.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord!==void 0&&t.texCoord!==e.channel||t.offset!==void 0||t.rotation!==void 0||t.scale!==void 0)&&(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class vB{constructor(){this.name=lt.KHR_MESH_QUANTIZATION}}class lE extends E.Interpolant{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r*3+r;for(let o=0;o!==r;o++)t[o]=i[s+o];return t}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=2*a,c=3*a,h=r-t,u=(i-t)/h,d=u*u,f=d*u,A=e*c,g=A-c,m=-2*f+3*d,p=f-d,v=1-m,y=p-d+u;for(let b=0;b!==a;b++){const w=o[g+b+a],M=o[g+b+l]*h,S=o[A+b+a],R=o[A+b]*h;s[b]=v*w+y*M+m*S+p*R}return s}}const yB=new E.Quaternion;class EB extends lE{interpolate_(e,t,i,r){const s=super.interpolate_(e,t,i,r);return yB.fromArray(s).normalize().toArray(s),s}}const Fn={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Ps={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},zm={9728:E.NearestFilter,9729:E.LinearFilter,9984:E.NearestMipmapNearestFilter,9985:E.LinearMipmapNearestFilter,9986:E.NearestMipmapLinearFilter,9987:E.LinearMipmapLinearFilter},Hm={33071:E.ClampToEdgeWrapping,33648:E.MirroredRepeatWrapping,10497:E.RepeatWrapping},Lu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},df={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"},qi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},xB={CUBICSPLINE:void 0,LINEAR:E.InterpolateLinear,STEP:E.InterpolateDiscrete};function bB(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new E.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:E.FrontSide})),n.DefaultMaterial}function _r(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function bi(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function CB(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function wB(n){let e;const t=n.extensions&&n.extensions[lt.KHR_DRACO_MESH_COMPRESSION];if(e=t?"draco:"+t.bufferView+":"+t.indices+":"+Du(t.attributes):n.indices+":"+Du(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+Du(n.targets[i]);return e}function Du(n){let e="";const t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function ff(n){switch(n){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 _B=new E.Matrix4;class MB{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new KI,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 i=!1,r=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);r=i&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||s&&o<98?this.textureLoader=new E.TextureLoader(this.options.manager):this.textureLoader=new E.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new E.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return _r(s,a,r),bi(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const o=t[r].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let r=0,s=e.length;r<s;r++){const o=e[r];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(i[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const r=i.clone(),s=(o,a)=>{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,h]of o.children.entries())s(h,a.children[c])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const s=e(t[r]);s&&i.push(s)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e)}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(s,o){return i.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[lt.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,o){i.load(E.LoaderUtils.resolveURL(t.uri,r.path),s,void 0,function(){o(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(i){const r=t.byteLength||0,s=t.byteOffset||0;return i.slice(s,s+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const o=Lu[r.type],a=Ps[r.componentType],l=r.normalized===!0,c=new a(r.count*o);return Promise.resolve(new E.BufferAttribute(c,o,l))}const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(o){const a=o[0],l=Lu[r.type],c=Ps[r.componentType],h=c.BYTES_PER_ELEMENT,u=h*l,d=r.byteOffset||0,f=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,A=r.normalized===!0;let g,m;if(f&&f!==u){const p=Math.floor(d/f),v="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+p+":"+r.count;let y=t.cache.get(v);y||(g=new c(a,p*f,r.count*f/h),y=new E.InterleavedBuffer(g,f/h),t.cache.add(v,y)),m=new E.InterleavedBufferAttribute(y,l,d%f/h,A)}else g=a===null?new c(r.count*l):new c(a,d,r.count*l),m=new E.BufferAttribute(g,l,A);if(r.sparse!==void 0){const p=Lu.SCALAR,v=Ps[r.sparse.indices.componentType],y=r.sparse.indices.byteOffset||0,b=r.sparse.values.byteOffset||0,w=new v(o[1],y,r.sparse.count*p),M=new c(o[2],b,r.sparse.count*l);a!==null&&(m=new E.BufferAttribute(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let S=0,R=w.length;S<R;S++){const _=w[S];if(m.setX(_,M[S*l]),l>=2&&m.setY(_,M[S*l+1]),l>=3&&m.setZ(_,M[S*l+2]),l>=4&&m.setW(_,M[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=A}return m})}loadTexture(e){const t=this.json,i=this.options,r=t.textures[e].source,s=t.images[r];let o=this.textureLoader;if(s.uri){const a=i.manager.getHandler(s.uri);a!==null&&(o=a)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(h){h.flipY=!1,h.name=o.name||a.name||"",h.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(h.name=a.uri);const u=(s.samplers||{})[o.sampler]||{};return h.magFilter=zm[u.magFilter]||E.LinearFilter,h.minFilter=zm[u.minFilter]||E.LinearMipmapLinearFilter,h.wrapS=Hm[u.wrapS]||E.RepeatWrapping,h.wrapT=Hm[u.wrapT]||E.RepeatWrapping,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==E.NearestFilter&&h.minFilter!==E.LinearFilter,r.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const s=i.images[e],o=self.URL||self.webkitURL;let a=s.uri||"",l=!1;if(s.bufferView!==void 0)a=this.getDependency("bufferView",s.bufferView).then(function(h){l=!0;const u=new Blob([h],{type:s.mimeType});return a=o.createObjectURL(u),a});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(a).then(function(h){return new Promise(function(u,d){let f=u;t.isImageBitmapLoader===!0&&(f=function(A){const g=new E.Texture(A);g.needsUpdate=!0,u(g)}),t.load(E.LoaderUtils.resolveURL(h,r.path),f,void 0,d)})}).then(function(h){var u;return l===!0&&o.revokeObjectURL(a),bi(h,s),h.userData.mimeType=s.mimeType||((u=s.uri).search(/\.jpe?g($|\?)/i)>0||u.search(/^data\:image\/jpeg/)===0?"image/jpeg":u.search(/\.webp($|\?)/i)>0||u.search(/^data\:image\/webp/)===0?"image/webp":u.search(/\.ktx2($|\?)/i)>0||u.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),h});return this.sourceCache[e]=c,c}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&((o=o.clone()).channel=i.texCoord),s.extensions[lt.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[lt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[lt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new E.PointsMaterial,E.Material.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new E.LineBasicMaterial,E.Material.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return E.MeshStandardMaterial}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=[];if((s.extensions||{})[lt.KHR_MATERIALS_UNLIT]){const h=r[lt.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),l.push(h.extendParams(a,s,t))}else{const h=s.pbrMetallicRoughness||{};if(a.color=new E.Color(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const u=h.baseColorFactor;a.color.setRGB(u[0],u[1],u[2],E.LinearSRGBColorSpace),a.opacity=u[3]}h.baseColorTexture!==void 0&&l.push(t.assignTexture(a,"map",h.baseColorTexture,E.SRGBColorSpace)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(u){return u.getMaterialType&&u.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(u){return u.extendMaterialParams&&u.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=E.DoubleSide);const c=s.alphaMode||"OPAQUE";if(c==="BLEND"?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c==="MASK"&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==E.MeshBasicMaterial&&(l.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new E.Vector2(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;a.normalScale.set(h,h)}if(s.occlusionTexture!==void 0&&o!==E.MeshBasicMaterial&&(l.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==E.MeshBasicMaterial){const h=s.emissiveFactor;a.emissive=new E.Color().setRGB(h[0],h[1],h[2],E.LinearSRGBColorSpace)}return s.emissiveTexture!==void 0&&o!==E.MeshBasicMaterial&&l.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,E.SRGBColorSpace)),Promise.all(l).then(function(){const h=new o(a);return s.name&&(h.name=s.name),bi(h,s),t.associations.set(h,{materials:e}),s.extensions&&_r(r,h,s),h})}createUniqueName(e){const t=E.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[lt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return Vm(l,a,t)})}const o=[];for(let a=0,l=e.length;a<l;a++){const c=e[a],h=wB(c),u=r[h];if(u)o.push(u.promise);else{let d;d=c.extensions&&c.extensions[lt.KHR_DRACO_MESH_COMPRESSION]?s(c):Vm(new E.BufferGeometry,c,t),r[h]={primitive:c,promise:d},o.push(d)}}return Promise.all(o)}loadMesh(e){const t=this,i=this.json,r=this.extensions,s=i.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l<c;l++){const h=o[l].material===void 0?bB(this.cache):this.getDependency("material",o[l].material);a.push(h)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(l){const c=l.slice(0,l.length-1),h=l[l.length-1],u=[];for(let f=0,A=h.length;f<A;f++){const g=h[f],m=o[f];let p;const v=c[f];if(m.mode===Fn.TRIANGLES||m.mode===Fn.TRIANGLE_STRIP||m.mode===Fn.TRIANGLE_FAN||m.mode===void 0)p=s.isSkinnedMesh===!0?new E.SkinnedMesh(g,v):new E.Mesh(g,v),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),m.mode===Fn.TRIANGLE_STRIP?p.geometry=uf(p.geometry,E.TriangleStripDrawMode):m.mode===Fn.TRIANGLE_FAN&&(p.geometry=uf(p.geometry,E.TriangleFanDrawMode));else if(m.mode===Fn.LINES)p=new E.LineSegments(g,v);else if(m.mode===Fn.LINE_STRIP)p=new E.Line(g,v);else if(m.mode===Fn.LINE_LOOP)p=new E.LineLoop(g,v);else{if(m.mode!==Fn.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);p=new E.Points(g,v)}Object.keys(p.geometry.morphAttributes).length>0&&CB(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),bi(p,s),m.extensions&&_r(r,p,m),t.assignFinalMaterial(p),u.push(p)}for(let f=0,A=u.length;f<A;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return s.extensions&&_r(r,u[0],s),u[0];const d=new E.Group;s.extensions&&_r(r,d,s),t.associations.set(d,{meshes:e});for(let f=0,A=u.length;f<A;f++)d.add(u[f]);return d})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(r)return i.type==="perspective"?t=new E.PerspectiveCamera(E.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new E.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),bi(t,i),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],i=[];for(let r=0,s=t.joints.length;r<s;r++)i.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(r){const s=r.pop(),o=r,a=[],l=[];for(let c=0,h=o.length;c<h;c++){const u=o[c];if(u){a.push(u);const d=new E.Matrix4;s!==null&&d.fromArray(s.array,16*c),l.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new E.Skeleton(a,l)})}loadAnimation(e){const t=this.json,i=this,r=t.animations[e],s=r.name?r.name:"animation_"+e,o=[],a=[],l=[],c=[],h=[];for(let u=0,d=r.channels.length;u<d;u++){const f=r.channels[u],A=r.samplers[f.sampler],g=f.target,m=g.node,p=r.parameters!==void 0?r.parameters[A.input]:A.input,v=r.parameters!==void 0?r.parameters[A.output]:A.output;g.node!==void 0&&(o.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",p)),l.push(this.getDependency("accessor",v)),c.push(A),h.push(g))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c),Promise.all(h)]).then(function(u){const d=u[0],f=u[1],A=u[2],g=u[3],m=u[4],p=[];for(let v=0,y=d.length;v<y;v++){const b=d[v],w=f[v],M=A[v],S=g[v],R=m[v];if(b===void 0)continue;b.updateMatrix&&b.updateMatrix();const _=i._createAnimationTracks(b,w,M,S,R);if(_)for(let I=0;I<_.length;I++)p.push(_[I])}return new E.AnimationClip(s,void 0,p)})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(s){const o=i._getNodeRef(i.meshCache,r.mesh,s);return r.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,c=r.weights.length;l<c;l++)a.morphTargetInfluences[l]=r.weights[l]}),o})}loadNode(e){const t=this,i=this.json.nodes[e],r=t._loadNodeShallow(e),s=[],o=i.children||[];for(let l=0,c=o.length;l<c;l++)s.push(t.getDependency("node",o[l]));const a=i.skin===void 0?Promise.resolve(null):t.getDependency("skin",i.skin);return Promise.all([r,Promise.all(s),a]).then(function(l){const c=l[0],h=l[1],u=l[2];u!==null&&c.traverse(function(d){d.isSkinnedMesh&&d.bind(u,_B)});for(let d=0,f=h.length;d<f;d++)c.add(h[d]);return c})}_loadNodeShallow(e){const t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],o=s.name?r.createUniqueName(s.name):"",a=[],l=r._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(r.getDependency("camera",s.camera).then(function(c){return r._getNodeRef(r.cameraCache,s.camera,c)})),r._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let h;if(h=s.isBone===!0?new E.Bone:c.length>1?new E.Group:c.length===1?c[0]:new E.Object3D,h!==c[0])for(let u=0,d=c.length;u<d;u++)h.add(c[u]);if(s.name&&(h.userData.name=s.name,h.name=o),bi(h,s),s.extensions&&_r(i,h,s),s.matrix!==void 0){const u=new E.Matrix4;u.fromArray(s.matrix),h.applyMatrix4(u)}else s.translation!==void 0&&h.position.fromArray(s.translation),s.rotation!==void 0&&h.quaternion.fromArray(s.rotation),s.scale!==void 0&&h.scale.fromArray(s.scale);return r.associations.has(h)||r.associations.set(h,{}),r.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,s=new E.Group;i.name&&(s.name=r.createUniqueName(i.name)),bi(s,i),i.extensions&&_r(t,s,i);const o=i.nodes||[],a=[];for(let l=0,c=o.length;l<c;l++)a.push(r.getDependency("node",o[l]));return Promise.all(a).then(function(l){for(let c=0,h=l.length;c<h;c++)s.add(l[c]);return r.associations=(c=>{const h=new Map;for(const[u,d]of r.associations)(u instanceof E.Material||u instanceof E.Texture)&&h.set(u,d);return c.traverse(u=>{const d=r.associations.get(u);d!=null&&h.set(u,d)}),h})(s),s})}_createAnimationTracks(e,t,i,r,s){const o=[],a=e.name?e.name:e.uuid,l=[];let c;switch(qi[s.path]===qi.weights?e.traverse(function(d){d.morphTargetInfluences&&l.push(d.name?d.name:d.uuid)}):l.push(a),qi[s.path]){case qi.weights:c=E.NumberKeyframeTrack;break;case qi.rotation:c=E.QuaternionKeyframeTrack;break;case qi.position:case qi.scale:c=E.VectorKeyframeTrack;break;default:c=i.itemSize===1?E.NumberKeyframeTrack:E.VectorKeyframeTrack}const h=r.interpolation!==void 0?xB[r.interpolation]:E.InterpolateLinear,u=this._getArrayFromAccessor(i);for(let d=0,f=l.length;d<f;d++){const A=new c(l[d]+"."+qi[s.path],t.array,u,h);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(A),o.push(A)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=ff(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*i;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(t){return new(this instanceof E.QuaternionKeyframeTrack?EB:lE)(this.times,this.values,this.getValueSize()/3,t)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Vm(n,e,t){const i=e.attributes,r=[];function s(o,a){return t.getDependency("accessor",o).then(function(l){n.setAttribute(a,l)})}for(const o in i){const a=df[o]||o.toLowerCase();a in n.attributes||r.push(s(i[o],a))}if(e.indices!==void 0&&!n.index){const o=t.getDependency("accessor",e.indices).then(function(a){n.setIndex(a)});r.push(o)}return E.ColorManagement.workingColorSpace!==E.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${E.ColorManagement.workingColorSpace}" not supported.`),bi(n,e),function(o,a,l){const c=a.attributes,h=new E.Box3;if(c.POSITION===void 0)return;{const f=l.json.accessors[c.POSITION],A=f.min,g=f.max;if(A===void 0||g===void 0)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(h.set(new E.Vector3(A[0],A[1],A[2]),new E.Vector3(g[0],g[1],g[2])),f.normalized){const m=ff(Ps[f.componentType]);h.min.multiplyScalar(m),h.max.multiplyScalar(m)}}const u=a.targets;if(u!==void 0){const f=new E.Vector3,A=new E.Vector3;for(let g=0,m=u.length;g<m;g++){const p=u[g];if(p.POSITION!==void 0){const v=l.json.accessors[p.POSITION],y=v.min,b=v.max;if(y!==void 0&&b!==void 0){if(A.setX(Math.max(Math.abs(y[0]),Math.abs(b[0]))),A.setY(Math.max(Math.abs(y[1]),Math.abs(b[1]))),A.setZ(Math.max(Math.abs(y[2]),Math.abs(b[2]))),v.normalized){const w=ff(Ps[v.componentType]);A.multiplyScalar(w)}f.max(A)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}h.expandByVector(f)}o.boundingBox=h;const d=new E.Sphere;h.getCenter(d.center),d.radius=h.min.distanceTo(h.max)/2,o.boundingSphere=d}(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?function(o,a,l){let c=!1,h=!1,u=!1;for(let g=0,m=a.length;g<m;g++){const p=a[g];if(p.POSITION!==void 0&&(c=!0),p.NORMAL!==void 0&&(h=!0),p.COLOR_0!==void 0&&(u=!0),c&&h&&u)break}if(!c&&!h&&!u)return Promise.resolve(o);const d=[],f=[],A=[];for(let g=0,m=a.length;g<m;g++){const p=a[g];if(c){const v=p.POSITION!==void 0?l.getDependency("accessor",p.POSITION):o.attributes.position;d.push(v)}if(h){const v=p.NORMAL!==void 0?l.getDependency("accessor",p.NORMAL):o.attributes.normal;f.push(v)}if(u){const v=p.COLOR_0!==void 0?l.getDependency("accessor",p.COLOR_0):o.attributes.color;A.push(v)}}return Promise.all([Promise.all(d),Promise.all(f),Promise.all(A)]).then(function(g){const m=g[0],p=g[1],v=g[2];return c&&(o.morphAttributes.position=m),h&&(o.morphAttributes.normal=p),u&&(o.morphAttributes.color=v),o.morphTargetsRelative=!0,o})}(n,e.targets,t):n})}class SB{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const i=this.workersResolve[e];if(i&&i(t),this.queue.length){const{resolve:r,msg:s,transfer:o}=this.queue.shift();this.workersResolve[e]=r,this.workers[e].postMessage(s,o)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{const r=this._getIdleWorker();r!==-1?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=i,this.workers[r].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const cE=9,hE=15,uE=16,dE=22,fE=37,pE=43,AE=76,mE=83,gE=97,vE=100,yE=103,EE=109,xE=165,bE=166,Cp=1000066e3;class IB{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class oo{constructor(e,t,i,r){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,i),this._littleEndian=r,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t){t===void 0&&(t=0);const i=this._offset;let r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,r)}}const ln=[171,75,84,88,32,50,48,187,13,10,26,10];function Wm(n){return new TextDecoder().decode(n)}var BB=He(9922).hp;let Pu,xi,pf;const Uu={env:{emscripten_notify_memory_growth:function(n){pf=new Uint8Array(xi.exports.memory.buffer)}}};class TB{init(){return Pu||(Pu=typeof fetch<"u"?fetch("data:application/wasm;base64,"+qm).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Uu)).then(this._init):WebAssembly.instantiate(BB.from(qm,"base64"),Uu).then(this._init),Pu)}_init(e){xi=e.instance,Uu.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!xi)throw new Error("ZSTDDecoder: Await .init() before decoding.");const i=e.byteLength,r=xi.exports.malloc(i);pf.set(e,r),t=t||Number(xi.exports.ZSTD_findDecompressedSize(r,i));const s=xi.exports.malloc(t),o=xi.exports.ZSTD_decompress(s,t,r,i),a=pf.slice(s,s+o);return xi.exports.free(r),xi.exports.free(s),a}}const qm="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",Fu=new WeakMap;let Ou,ku=0;class Tn extends E.Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new SB,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new E.FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),i=new E.FileLoader(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const r=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,r]).then(([s,o])=>{const a=Tn.BasisWorker.toString(),l=["/* constants */","let _EngineFormat = "+JSON.stringify(Tn.EngineFormat),"let _EngineType = "+JSON.stringify(Tn.EngineType),"let _TranscoderFormat = "+JSON.stringify(Tn.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Tn.BasisFormat),"/* basis_transcoder.js */",s,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([l])),this.transcoderBinary=o,this.workerPool.setWorkerCreator(()=>{const c=new Worker(this.workerSourceURL),h=this.transcoderBinary.slice(0);return c.postMessage({type:"init",config:this.workerConfig,transcoderBinary:h},[h]),c})}),ku>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),ku++}return this.transcoderPending}load(e,t,i,r){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const s=new E.FileLoader(this.manager);s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials),s.load(e,o=>{this.parse(o,t,r)},i,r)}parse(e,t,i){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(Fu.has(e))return Fu.get(e).promise.then(t).catch(i);this._createTexture(e).then(r=>t?t(r):null).catch(i)}_createTextureFrom(e,t){const{type:i,error:r,data:{faces:s,width:o,height:a,format:l,type:c,dfdFlags:h}}=e;if(i==="error")return Promise.reject(r);let u;if(t.faceCount===6)u=new E.CompressedCubeTexture(s,l,c);else{const d=s[0].mipmaps;u=t.layerCount>1?new E.CompressedArrayTexture(d,o,a,t.layerCount,l,c):new E.CompressedTexture(d,o,a,l,c)}return u.minFilter=s[0].mipmaps.length===1?E.LinearFilter:E.LinearMipmapLinearFilter,u.magFilter=E.LinearFilter,u.generateMipmaps=!1,u.needsUpdate=!0,u.colorSpace=jm(t),u.premultiplyAlpha=!!(1&h),u}async _createTexture(e,t={}){const i=function(a){const l=new Uint8Array(a.buffer,a.byteOffset,ln.length);if(l[0]!==ln[0]||l[1]!==ln[1]||l[2]!==ln[2]||l[3]!==ln[3]||l[4]!==ln[4]||l[5]!==ln[5]||l[6]!==ln[6]||l[7]!==ln[7]||l[8]!==ln[8]||l[9]!==ln[9]||l[10]!==ln[10]||l[11]!==ln[11])throw new Error("Missing KTX 2.0 identifier.");const c=new IB,h=17*Uint32Array.BYTES_PER_ELEMENT,u=new oo(a,ln.length,h,!0);c.vkFormat=u._nextUint32(),c.typeSize=u._nextUint32(),c.pixelWidth=u._nextUint32(),c.pixelHeight=u._nextUint32(),c.pixelDepth=u._nextUint32(),c.layerCount=u._nextUint32(),c.faceCount=u._nextUint32();const d=u._nextUint32();c.supercompressionScheme=u._nextUint32();const f=u._nextUint32(),A=u._nextUint32(),g=u._nextUint32(),m=u._nextUint32(),p=u._nextUint64(),v=u._nextUint64(),y=new oo(a,ln.length+h,3*d*8,!0);for(let Me=0;Me<d;Me++)c.levels.push({levelData:new Uint8Array(a.buffer,a.byteOffset+y._nextUint64(),y._nextUint64()),uncompressedByteLength:y._nextUint64()});const b=new oo(a,f,A,!0),w={vendorId:b._skip(4)._nextUint16(),descriptorType:b._nextUint16(),versionNumber:b._nextUint16(),descriptorBlockSize:b._nextUint16(),colorModel:b._nextUint8(),colorPrimaries:b._nextUint8(),transferFunction:b._nextUint8(),flags:b._nextUint8(),texelBlockDimension:[b._nextUint8(),b._nextUint8(),b._nextUint8(),b._nextUint8()],bytesPlane:[b._nextUint8(),b._nextUint8(),b._nextUint8(),b._nextUint8(),b._nextUint8(),b._nextUint8(),b._nextUint8(),b._nextUint8()],samples:[]},M=(w.descriptorBlockSize/4-6)/4;for(let Me=0;Me<M;Me++){const te={bitOffset:b._nextUint16(),bitLength:b._nextUint8(),channelType:b._nextUint8(),samplePosition:[b._nextUint8(),b._nextUint8(),b._nextUint8(),b._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&te.channelType?(te.sampleLower=b._nextInt32(),te.sampleUpper=b._nextInt32()):(te.sampleLower=b._nextUint32(),te.sampleUpper=b._nextUint32()),w.samples[Me]=te}c.dataFormatDescriptor.length=0,c.dataFormatDescriptor.push(w);const S=new oo(a,g,m,!0);for(;S._offset<m;){const Me=S._nextUint32(),te=S._scan(Me),Ae=Wm(te);if(c.keyValue[Ae]=S._nextUint8Array(Me-te.byteLength-1),Ae.match(/^ktx/i)){const se=Wm(c.keyValue[Ae]);c.keyValue[Ae]=se.substring(0,se.lastIndexOf("\0"))}S._skip(Me%4?4-Me%4:0)}if(v<=0)return c;const R=new oo(a,p,v,!0),_=R._nextUint16(),I=R._nextUint16(),D=R._nextUint32(),Q=R._nextUint32(),N=R._nextUint32(),z=R._nextUint32(),$=[];for(let Me=0;Me<d;Me++)$.push({imageFlags:R._nextUint32(),rgbSliceByteOffset:R._nextUint32(),rgbSliceByteLength:R._nextUint32(),alphaSliceByteOffset:R._nextUint32(),alphaSliceByteLength:R._nextUint32()});const H=p+R._offset,K=H+D,Y=K+Q,ee=Y+N,pe=new Uint8Array(a.buffer,a.byteOffset+H,D),be=new Uint8Array(a.buffer,a.byteOffset+K,Q),Ce=new Uint8Array(a.buffer,a.byteOffset+Y,N),Pe=new Uint8Array(a.buffer,a.byteOffset+ee,z);return c.globalData={endpointCount:_,selectorCount:I,imageDescs:$,endpointsData:pe,selectorsData:be,tablesData:Ce,extendedData:Pe},c}(new Uint8Array(e)),r=i.vkFormat===Cp&&i.dataFormatDescriptor[0].colorModel===167;if(i.vkFormat!==0&&(!r||this.workerConfig.astcHDRSupported))return async function(a){const{vkFormat:l}=a;if(Nu[l]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let c;a.supercompressionScheme===2&&(Ou||(Ou=new Promise(async d=>{const f=new TB;await f.init(),d(f)})),c=await Ou);const h=[];for(let d=0;d<a.levels.length;d++){const f=Math.max(1,a.pixelWidth>>d),A=Math.max(1,a.pixelHeight>>d),g=a.pixelDepth?Math.max(1,a.pixelDepth>>d):0,m=a.levels[d];let p,v;if(a.supercompressionScheme===0)p=m.levelData;else{if(a.supercompressionScheme!==2)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");p=c.decode(m.levelData,m.uncompressedByteLength)}v=Qu[l]===E.FloatType?new Float32Array(p.buffer,p.byteOffset,p.byteLength/Float32Array.BYTES_PER_ELEMENT):Qu[l]===E.HalfFloatType?new Uint16Array(p.buffer,p.byteOffset,p.byteLength/Uint16Array.BYTES_PER_ELEMENT):p,h.push({data:v,width:f,height:A,depth:g})}let u;if(RB.has(Nu[l]))u=a.pixelDepth===0?new E.DataTexture(h[0].data,a.pixelWidth,a.pixelHeight):new E.Data3DTexture(h[0].data,a.pixelWidth,a.pixelHeight,a.pixelDepth);else{if(a.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");u=new E.CompressedTexture(h,a.pixelWidth,a.pixelHeight),u.minFilter=h.length===1?E.LinearFilter:E.LinearMipmapLinearFilter,u.magFilter=E.LinearFilter}return u.mipmaps=h,u.type=Qu[l],u.format=Nu[l],u.colorSpace=jm(a),u.needsUpdate=!0,Promise.resolve(u)}(i);const s=t,o=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:s},[e])).then(a=>this._createTextureFrom(a.data,i));return Fu.set(e,{promise:o}),o}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),ku--,this}}Tn.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},Tn.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},Tn.EngineFormat={RGBAFormat:E.RGBAFormat,RGBA_ASTC_4x4_Format:E.RGBA_ASTC_4x4_Format,RGB_BPTC_UNSIGNED_Format:E.RGB_BPTC_UNSIGNED_Format,RGBA_BPTC_Format:E.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:E.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:E.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:E.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:E.RGB_ETC1_Format,RGB_ETC2_Format:E.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:E.RGB_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format:E.RGBA_S3TC_DXT1_Format},Tn.EngineType={UnsignedByteType:E.UnsignedByteType,HalfFloatType:E.HalfFloatType,FloatType:E.FloatType},Tn.BasisWorker=function(){let n,e,t;const i=_EngineFormat,r=_EngineType,s=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",function(u){const d=u.data;switch(d.type){case"init":n=d.config,f=d.transcoderBinary,e=new Promise(A=>{t={wasmBinary:f,onRuntimeInitialized:A},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":e.then(()=>{try{const{faces:A,buffers:g,width:m,height:p,hasAlpha:v,format:y,type:b,dfdFlags:w}=function(M){const S=new t.KTX2File(new Uint8Array(M));function R(){S.close(),S.delete()}if(!S.isValid())throw R(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let _;if(S.isUASTC())_=o.UASTC;else if(S.isETC1S())_=o.ETC1S;else{if(!S.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");_=o.UASTC_HDR}const I=S.getWidth(),D=S.getHeight(),Q=S.getLayers()||1,N=S.getLevels(),z=S.getFaces(),$=S.getHasAlpha(),H=S.getDFDFlags(),{transcoderFormat:K,engineFormat:Y,engineType:ee}=function(Ce,Pe,Me,te){const Ae=l[Ce];for(let se=0;se<Ae.length;se++){const X=Ae[se];if((!X.if||n[X.if])&&X.basisFormat.includes(Ce)&&!(te&&X.transcoderFormat.length<2)&&(!X.needsPowerOfTwo||c(Pe)&&c(Me)))return{transcoderFormat:X.transcoderFormat[te?1:0],engineFormat:X.engineFormat[te?1:0],engineType:X.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(_,I,D,$);if(!I||!D||!N)throw R(),new Error("THREE.KTX2Loader: Invalid texture");if(!S.startTranscoding())throw R(),new Error("THREE.KTX2Loader: .startTranscoding failed");const pe=[],be=[];for(let Ce=0;Ce<z;Ce++){const Pe=[];for(let Me=0;Me<N;Me++){const te=[];let Ae,se;for(let he=0;he<Q;he++){const ue=S.getImageLevelInfo(Me,he,Ce);Ce!==0||Me!==0||he!==0||ue.origWidth%4==0&&ue.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),N>1?(Ae=ue.origWidth,se=ue.origHeight):(Ae=ue.width,se=ue.height);let ve=new Uint8Array(S.getImageTranscodedSizeInBytes(Me,he,0,K));const ne=S.transcodeImage(ve,Me,he,Ce,K,0,-1,-1);if(ee===r.HalfFloatType&&(ve=new Uint16Array(ve.buffer,ve.byteOffset,ve.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!ne)throw R(),new Error("THREE.KTX2Loader: .transcodeImage failed.");te.push(ve)}const X=h(te);Pe.push({data:X,width:Ae,height:se}),be.push(X.buffer)}pe.push({mipmaps:Pe,width:I,height:D,format:Y,type:ee})}return R(),{faces:pe,buffers:be,width:I,height:D,hasAlpha:$,dfdFlags:H,format:Y,type:ee}}(d.buffer);self.postMessage({type:"transcode",id:d.id,data:{faces:A,width:m,height:p,hasAlpha:v,format:y,type:b,dfdFlags:w}},g)}catch(A){console.error(A),self.postMessage({type:"error",id:d.id,error:A.message})}})}var f});const a=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1],engineFormat:[i.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[i.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[i.RGBAFormat,i.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[i.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[o.ETC1S]:a.filter(u=>u.basisFormat.includes(o.ETC1S)).sort((u,d)=>u.priorityUASTC-d.priorityUASTC),[o.UASTC]:a.filter(u=>u.basisFormat.includes(o.UASTC)).sort((u,d)=>u.priorityUASTC-d.priorityUASTC),[o.UASTC_HDR]:a.filter(u=>u.basisFormat.includes(o.UASTC_HDR)).sort((u,d)=>u.priorityHDR-d.priorityHDR)};function c(u){return u<=2||!(u&u-1)&&u!==0}function h(u){if(u.length===1)return u[0];let d=0;for(let g=0;g<u.length;g++)d+=u[g].byteLength;const f=new Uint8Array(d);let A=0;for(let g=0;g<u.length;g++){const m=u[g];f.set(m,A),A+=m.byteLength}return f}};const RB=new Set([E.RGBAFormat,E.RGFormat,E.RedFormat]),Nu={[EE]:E.RGBAFormat,[gE]:E.RGBAFormat,[fE]:E.RGBAFormat,[pE]:E.RGBAFormat,[yE]:E.RGFormat,[mE]:E.RGFormat,[uE]:E.RGFormat,[dE]:E.RGFormat,[vE]:E.RedFormat,[AE]:E.RedFormat,[hE]:E.RedFormat,[cE]:E.RedFormat,[Cp]:E.RGBA_ASTC_4x4_Format,[bE]:E.RGBA_ASTC_6x6_Format,[xE]:E.RGBA_ASTC_6x6_Format},Qu={[EE]:E.FloatType,[gE]:E.HalfFloatType,[fE]:E.UnsignedByteType,[pE]:E.UnsignedByteType,[yE]:E.FloatType,[mE]:E.HalfFloatType,[uE]:E.UnsignedByteType,[dE]:E.UnsignedByteType,[vE]:E.FloatType,[AE]:E.HalfFloatType,[hE]:E.UnsignedByteType,[cE]:E.UnsignedByteType,[Cp]:E.HalfFloatType,[bE]:E.UnsignedByteType,[xE]:E.UnsignedByteType};function jm(n){const e=n.dataFormatDescriptor[0];return e.colorPrimaries===1?e.transferFunction===2?E.SRGBColorSpace:E.LinearSRGBColorSpace:e.colorPrimaries===10?e.transferFunction===2?"display-p3":"display-p3-linear":(e.colorPrimaries===0||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),E.NoColorSpace)}const ct={c:null,u:[new E.Vector3,new E.Vector3,new E.Vector3],e:[]},Et={c:null,u:[new E.Vector3,new E.Vector3,new E.Vector3],e:[]},St=[[],[],[]],it=[[],[],[]],_t=[],Mr=new E.Vector3,Sr=new E.Vector3,Ir=new E.Vector3,Qt=new E.Vector3,Xm=new E.Vector3,Ym=new E.Vector3,Hn=new E.Matrix3,Km=new E.Box3,fl=new E.Matrix4,Jm=new E.Matrix4,Zm=new E.Ray;class Nc{constructor(e=new E.Vector3,t=new E.Vector3,i=new E.Matrix3){this.center=e,this.halfSize=t,this.rotation=i}set(e,t,i){return this.center=e,this.halfSize=t,this.rotation=i,this}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new this.constructor().copy(this)}getSize(e){return e.copy(this.halfSize).multiplyScalar(2)}clampPoint(e,t){const i=this.halfSize;Qt.subVectors(e,this.center),this.rotation.extractBasis(Mr,Sr,Ir),t.copy(this.center);const r=E.MathUtils.clamp(Qt.dot(Mr),-i.x,i.x);t.add(Mr.multiplyScalar(r));const s=E.MathUtils.clamp(Qt.dot(Sr),-i.y,i.y);t.add(Sr.multiplyScalar(s));const o=E.MathUtils.clamp(Qt.dot(Ir),-i.z,i.z);return t.add(Ir.multiplyScalar(o)),t}containsPoint(e){return Qt.subVectors(e,this.center),this.rotation.extractBasis(Mr,Sr,Ir),Math.abs(Qt.dot(Mr))<=this.halfSize.x&&Math.abs(Qt.dot(Sr))<=this.halfSize.y&&Math.abs(Qt.dot(Ir))<=this.halfSize.z}intersectsBox3(e){return this.intersectsOBB(LB.fromBox3(e))}intersectsSphere(e){return this.clampPoint(e.center,Ym),Ym.distanceToSquared(e.center)<=e.radius*e.radius}intersectsOBB(e,t=Number.EPSILON){ct.c=this.center,ct.e[0]=this.halfSize.x,ct.e[1]=this.halfSize.y,ct.e[2]=this.halfSize.z,this.rotation.extractBasis(ct.u[0],ct.u[1],ct.u[2]),Et.c=e.center,Et.e[0]=e.halfSize.x,Et.e[1]=e.halfSize.y,Et.e[2]=e.halfSize.z,e.rotation.extractBasis(Et.u[0],Et.u[1],Et.u[2]);for(let s=0;s<3;s++)for(let o=0;o<3;o++)St[s][o]=ct.u[s].dot(Et.u[o]);Qt.subVectors(Et.c,ct.c),_t[0]=Qt.dot(ct.u[0]),_t[1]=Qt.dot(ct.u[1]),_t[2]=Qt.dot(ct.u[2]);for(let s=0;s<3;s++)for(let o=0;o<3;o++)it[s][o]=Math.abs(St[s][o])+t;let i,r;for(let s=0;s<3;s++)if(i=ct.e[s],r=Et.e[0]*it[s][0]+Et.e[1]*it[s][1]+Et.e[2]*it[s][2],Math.abs(_t[s])>i+r)return!1;for(let s=0;s<3;s++)if(i=ct.e[0]*it[0][s]+ct.e[1]*it[1][s]+ct.e[2]*it[2][s],r=Et.e[s],Math.abs(_t[0]*St[0][s]+_t[1]*St[1][s]+_t[2]*St[2][s])>i+r)return!1;return i=ct.e[1]*it[2][0]+ct.e[2]*it[1][0],r=Et.e[1]*it[0][2]+Et.e[2]*it[0][1],!(Math.abs(_t[2]*St[1][0]-_t[1]*St[2][0])>i+r||(i=ct.e[1]*it[2][1]+ct.e[2]*it[1][1],r=Et.e[0]*it[0][2]+Et.e[2]*it[0][0],Math.abs(_t[2]*St[1][1]-_t[1]*St[2][1])>i+r||(i=ct.e[1]*it[2][2]+ct.e[2]*it[1][2],r=Et.e[0]*it[0][1]+Et.e[1]*it[0][0],Math.abs(_t[2]*St[1][2]-_t[1]*St[2][2])>i+r||(i=ct.e[0]*it[2][0]+ct.e[2]*it[0][0],r=Et.e[1]*it[1][2]+Et.e[2]*it[1][1],Math.abs(_t[0]*St[2][0]-_t[2]*St[0][0])>i+r||(i=ct.e[0]*it[2][1]+ct.e[2]*it[0][1],r=Et.e[0]*it[1][2]+Et.e[2]*it[1][0],Math.abs(_t[0]*St[2][1]-_t[2]*St[0][1])>i+r||(i=ct.e[0]*it[2][2]+ct.e[2]*it[0][2],r=Et.e[0]*it[1][1]+Et.e[1]*it[1][0],Math.abs(_t[0]*St[2][2]-_t[2]*St[0][2])>i+r||(i=ct.e[0]*it[1][0]+ct.e[1]*it[0][0],r=Et.e[1]*it[2][2]+Et.e[2]*it[2][1],Math.abs(_t[1]*St[0][0]-_t[0]*St[1][0])>i+r||(i=ct.e[0]*it[1][1]+ct.e[1]*it[0][1],r=Et.e[0]*it[2][2]+Et.e[2]*it[2][0],Math.abs(_t[1]*St[0][1]-_t[0]*St[1][1])>i+r||(i=ct.e[0]*it[1][2]+ct.e[1]*it[0][2],r=Et.e[0]*it[2][1]+Et.e[1]*it[2][0],Math.abs(_t[1]*St[0][2]-_t[0]*St[1][2])>i+r)))))))))}intersectsPlane(e){this.rotation.extractBasis(Mr,Sr,Ir);const t=this.halfSize.x*Math.abs(e.normal.dot(Mr))+this.halfSize.y*Math.abs(e.normal.dot(Sr))+this.halfSize.z*Math.abs(e.normal.dot(Ir)),i=e.normal.dot(this.center)-e.constant;return Math.abs(i)<=t}intersectRay(e,t){return this.getSize(Xm),Km.setFromCenterAndSize(Qt.set(0,0,0),Xm),fl.setFromMatrix3(this.rotation),fl.setPosition(this.center),Jm.copy(fl).invert(),Zm.copy(e).applyMatrix4(Jm),Zm.intersectBox(Km,t)?t.applyMatrix4(fl):null}intersectsRay(e){return this.intersectRay(e,Qt)!==null}fromBox3(e){return e.getCenter(this.center),e.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(e){return e.center.equals(this.center)&&e.halfSize.equals(this.halfSize)&&e.rotation.equals(this.rotation)}applyMatrix4(e){const t=e.elements;let i=Qt.set(t[0],t[1],t[2]).length();const r=Qt.set(t[4],t[5],t[6]).length(),s=Qt.set(t[8],t[9],t[10]).length();e.determinant()<0&&(i=-i),Hn.setFromMatrix4(e);const o=1/i,a=1/r,l=1/s;return Hn.elements[0]*=o,Hn.elements[1]*=o,Hn.elements[2]*=o,Hn.elements[3]*=a,Hn.elements[4]*=a,Hn.elements[5]*=a,Hn.elements[6]*=l,Hn.elements[7]*=l,Hn.elements[8]*=l,this.rotation.multiply(Hn),this.halfSize.x*=i,this.halfSize.y*=r,this.halfSize.z*=s,Qt.setFromMatrixPosition(e),this.center.add(Qt),this}}const LB=new Nc,DB=/^[og]\s*(.+)?/,PB=/^mtllib /,UB=/^usemtl /,FB=/^usemap /,$m=/\s+/,eg=new E.Vector3,Gu=new E.Vector3,tg=new E.Vector3,ng=new E.Vector3,Un=new E.Vector3,pl=new E.Color;function OB(){const n={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1)return this.object.name=e,void(this.object.fromDeclaration=t!==!1);const i=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(r,s){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const a={index:this.materials.length,name:r||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){const c={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(r){const s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),r&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return r&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},i&&i.name&&typeof i.clone=="function"){const r=i.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)},parseNormalIndex:function(e,t){const i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)},parseUVIndex:function(e,t){const i=parseInt(e,10);return 2*(i>=0?i-1:i+t/2)},addVertex:function(e,t,i){const r=this.vertices,s=this.object.geometry.vertices;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[i+0],r[i+1],r[i+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,i){const r=this.normals,s=this.object.geometry.normals;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[i+0],r[i+1],r[i+2])},addFaceNormal:function(e,t,i){const r=this.vertices,s=this.object.geometry.normals;eg.fromArray(r,e),Gu.fromArray(r,t),tg.fromArray(r,i),Un.subVectors(tg,Gu),ng.subVectors(eg,Gu),Un.cross(ng),Un.normalize(),s.push(Un.x,Un.y,Un.z),s.push(Un.x,Un.y,Un.z),s.push(Un.x,Un.y,Un.z)},addColor:function(e,t,i){const r=this.colors,s=this.object.geometry.colors;r[e]!==void 0&&s.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&s.push(r[t+0],r[t+1],r[t+2]),r[i]!==void 0&&s.push(r[i+0],r[i+1],r[i+2])},addUV:function(e,t,i){const r=this.uvs,s=this.object.geometry.uvs;s.push(r[e+0],r[e+1]),s.push(r[t+0],r[t+1]),s.push(r[i+0],r[i+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,i,r,s,o,a,l,c){const h=this.vertices.length;let u=this.parseVertexIndex(e,h),d=this.parseVertexIndex(t,h),f=this.parseVertexIndex(i,h);if(this.addVertex(u,d,f),this.addColor(u,d,f),a!==void 0&&a!==""){const A=this.normals.length;u=this.parseNormalIndex(a,A),d=this.parseNormalIndex(l,A),f=this.parseNormalIndex(c,A),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==""){const A=this.uvs.length;u=this.parseUVIndex(r,A),d=this.parseUVIndex(s,A),f=this.parseUVIndex(o,A),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let i=0,r=e.length;i<r;i++){const s=this.parseVertexIndex(e[i],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const i=this.vertices.length,r=this.uvs.length;for(let s=0,o=e.length;s<o;s++)this.addVertexLine(this.parseVertexIndex(e[s],i));for(let s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],r))}};return n.startObject("",!1),n}class CE extends E.Loader{constructor(e){super(e),this.materials=null}load(e,t,i,r){const s=this,o=new E.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(a))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}setMaterials(e){return this.materials=e,this}parse(e){const t=new OB;e.indexOf(`\r
`)!==-1&&(e=e.replace(/\r\n/g,`
`)),e.indexOf(`\\
`)!==-1&&(e=e.replace(/\\\n/g,""));const i=e.split(`
`);let r=[];for(let o=0,a=i.length;o<a;o++){const l=i[o].trimStart();if(l.length===0)continue;const c=l.charAt(0);if(c!=="#")if(c==="v"){const h=l.split($m);switch(h[0]){case"v":t.vertices.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),h.length>=7?(pl.setRGB(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6]),E.SRGBColorSpace),t.colors.push(pl.r,pl.g,pl.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":t.uvs.push(parseFloat(h[1]),parseFloat(h[2]))}}else if(c==="f"){const h=l.slice(1).trim().split($m),u=[];for(let f=0,A=h.length;f<A;f++){const g=h[f];if(g.length>0){const m=g.split("/");u.push(m)}}const d=u[0];for(let f=1,A=u.length-1;f<A;f++){const g=u[f],m=u[f+1];t.addFace(d[0],g[0],m[0],d[1],g[1],m[1],d[2],g[2],m[2])}}else if(c==="l"){const h=l.substring(1).trim().split(" ");let u=[];const d=[];if(l.indexOf("/")===-1)u=h;else for(let f=0,A=h.length;f<A;f++){const g=h[f].split("/");g[0]!==""&&u.push(g[0]),g[1]!==""&&d.push(g[1])}t.addLineGeometry(u,d)}else if(c==="p"){const h=l.slice(1).trim().split(" ");t.addPointGeometry(h)}else if((r=DB.exec(l))!==null){const h=(" "+r[0].slice(1).trim()).slice(1);t.startObject(h)}else if(UB.test(l))t.object.startMaterial(l.substring(7).trim(),t.materialLibraries);else if(PB.test(l))t.materialLibraries.push(l.substring(7).trim());else if(FB.test(l))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(c==="s"){if(r=l.split(" "),r.length>1){const u=r[1].trim().toLowerCase();t.object.smooth=u!=="0"&&u!=="off"}else t.object.smooth=!0;const h=t.object.currentMaterial();h&&(h.smooth=t.object.smooth)}else{if(l==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+l+'"')}}t.finalize();const s=new E.Group;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0))for(let o=0,a=t.objects.length;o<a;o++){const l=t.objects[o],c=l.geometry,h=l.materials,u=c.type==="Line",d=c.type==="Points";let f=!1;if(c.vertices.length===0)continue;const A=new E.BufferGeometry;A.setAttribute("position",new E.Float32BufferAttribute(c.vertices,3)),c.normals.length>0&&A.setAttribute("normal",new E.Float32BufferAttribute(c.normals,3)),c.colors.length>0&&(f=!0,A.setAttribute("color",new E.Float32BufferAttribute(c.colors,3))),c.hasUVIndices===!0&&A.setAttribute("uv",new E.Float32BufferAttribute(c.uvs,2));const g=[];for(let p=0,v=h.length;p<v;p++){const y=h[p],b=y.name+"_"+y.smooth+"_"+f;let w=t.materials[b];if(this.materials!==null)if(w=this.materials.create(y.name),!u||!w||w instanceof E.LineBasicMaterial){if(d&&w&&!(w instanceof E.PointsMaterial)){const M=new E.PointsMaterial({size:10,sizeAttenuation:!1});E.Material.prototype.copy.call(M,w),M.color.copy(w.color),M.map=w.map,w=M}}else{const M=new E.LineBasicMaterial;E.Material.prototype.copy.call(M,w),M.color.copy(w.color),w=M}w===void 0&&(w=u?new E.LineBasicMaterial:d?new E.PointsMaterial({size:1,sizeAttenuation:!1}):new E.MeshPhongMaterial,w.name=y.name,w.flatShading=!y.smooth,w.vertexColors=f,t.materials[b]=w),g.push(w)}let m;if(g.length>1){for(let p=0,v=h.length;p<v;p++){const y=h[p];A.addGroup(y.groupStart,y.groupCount,p)}m=u?new E.LineSegments(A,g):d?new E.Points(A,g):new E.Mesh(A,g)}else m=u?new E.LineSegments(A,g[0]):d?new E.Points(A,g[0]):new E.Mesh(A,g[0]);m.name=l.name,s.add(m)}else if(t.vertices.length>0){const o=new E.PointsMaterial({size:1,sizeAttenuation:!1}),a=new E.BufferGeometry;a.setAttribute("position",new E.Float32BufferAttribute(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(a.setAttribute("color",new E.Float32BufferAttribute(t.colors,3)),o.vertexColors=!0);const l=new E.Points(a,o);s.add(l)}return s}}class wE extends E.Loader{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?E.LoaderUtils.extractUrlBase(e):this.path,a=new E.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{t(s.parse(l,o))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const i=e.split(`
`);let r={};const s=/\s+/,o={};for(let l=0;l<i.length;l++){let c=i[l];if(c=c.trim(),c.length===0||c.charAt(0)==="#")continue;const h=c.indexOf(" ");let u=h>=0?c.substring(0,h):c;u=u.toLowerCase();let d=h>=0?c.substring(h+1):"";if(d=d.trim(),u==="newmtl")r={name:d},o[d]=r;else if(u==="ka"||u==="kd"||u==="ks"||u==="ke"){const f=d.split(s,3);r[u]=[parseFloat(f[0]),parseFloat(f[1]),parseFloat(f[2])]}else r[u]=d}const a=new kB(this.resourcePath||t,this.materialOptions);return a.setCrossOrigin(this.crossOrigin),a.setManager(this.manager),a.setMaterials(o),a}}class kB{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:E.FrontSide,this.wrap=this.options.wrap!==void 0?this.options.wrap:E.RepeatWrapping}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const i in e){const r=e[i],s={};t[i]=s;for(const o in r){let a=!0,l=r[o];const c=o.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(l=[l[0]/255,l[1]/255,l[2]/255]),this.options&&this.options.ignoreZeroRGBs&&l[0]===0&&l[1]===0&&l[2]===0&&(a=!1)}a&&(s[c]=l)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return this.materials[e]===void 0&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,i=this.materialsInfo[e],r={name:e,side:this.side};function s(o,a){if(r[o])return;const l=t.getTextureParams(a,r),c=t.loadTexture((h=t.baseUrl,typeof(u=l.url)!="string"||u===""?"":/^https?:\/\//i.test(u)?u:h+u));var h,u;c.repeat.copy(l.scale),c.offset.copy(l.offset),c.wrapS=t.wrap,c.wrapT=t.wrap,o!=="map"&&o!=="emissiveMap"||(c.colorSpace=E.SRGBColorSpace),r[o]=c}for(const o in i){const a=i[o];let l;if(a!=="")switch(o.toLowerCase()){case"kd":r.color=E.ColorManagement.toWorkingColorSpace(new E.Color().fromArray(a),E.SRGBColorSpace);break;case"ks":r.specular=E.ColorManagement.toWorkingColorSpace(new E.Color().fromArray(a),E.SRGBColorSpace);break;case"ke":r.emissive=E.ColorManagement.toWorkingColorSpace(new E.Color().fromArray(a),E.SRGBColorSpace);break;case"map_kd":s("map",a);break;case"map_ks":s("specularMap",a);break;case"map_ke":s("emissiveMap",a);break;case"norm":s("normalMap",a);break;case"map_bump":case"bump":s("bumpMap",a);break;case"map_d":s("alphaMap",a),r.transparent=!0;break;case"ns":r.shininess=parseFloat(a);break;case"d":l=parseFloat(a),l<1&&(r.opacity=l,r.transparent=!0);break;case"tr":l=parseFloat(a),this.options&&this.options.invertTrProperty&&(l=1-l),l>0&&(r.opacity=1-l,r.transparent=!0)}}return this.materials[e]=new E.MeshPhongMaterial(r),this.materials[e]}getTextureParams(e,t){const i={scale:new E.Vector2(1,1),offset:new E.Vector2(0,0)},r=e.split(/\s+/);let s;return s=r.indexOf("-bm"),s>=0&&(t.bumpScale=parseFloat(r[s+1]),r.splice(s,2)),s=r.indexOf("-s"),s>=0&&(i.scale.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),s=r.indexOf("-o"),s>=0&&(i.offset.set(parseFloat(r[s+1]),parseFloat(r[s+2])),r.splice(s,4)),i.url=r.join(" ").trim(),i}loadTexture(e,t,i,r,s){const o=this.manager!==void 0?this.manager:E.DefaultLoadingManager;let a=o.getHandler(e);a===null&&(a=new E.TextureLoader(o)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin);const l=a.load(e,i,r,s);return t!==void 0&&(l.mapping=t),l}}class _E{static fromCubeTexture(e){let t=0;const i=new E.Vector3,r=new E.Vector3,s=new E.Color,o=[0,0,0,0,0,0,0,0,0],a=new E.SphericalHarmonics3,l=a.coefficients;for(let h=0;h<6;h++){const u=e.image[h],d=u.width,f=u.height,A=document.createElement("canvas");A.width=d,A.height=f;const g=A.getContext("2d");g.drawImage(u,0,0,d,f);const m=g.getImageData(0,0,d,f),p=m.data,v=m.width,y=2/v;for(let b=0,w=p.length;b<w;b+=4){s.setRGB(p[b]/255,p[b+1]/255,p[b+2]/255),ig(s,e.colorSpace);const M=b/4,S=(M%v+.5)*y-1,R=1-(Math.floor(M/v)+.5)*y;switch(h){case 0:i.set(-1,R,-S);break;case 1:i.set(1,R,S);break;case 2:i.set(-S,1,-R);break;case 3:i.set(-S,-1,R);break;case 4:i.set(-S,R,1);break;case 5:i.set(S,R,-1)}const _=i.lengthSq(),I=4/(Math.sqrt(_)*_);t+=I,r.copy(i).normalize(),E.SphericalHarmonics3.getBasisAt(r,o);for(let D=0;D<9;D++)l[D].x+=o[D]*s.r*I,l[D].y+=o[D]*s.g*I,l[D].z+=o[D]*s.b*I}}const c=4*Math.PI/t;for(let h=0;h<9;h++)l[h].x*=c,l[h].y*=c,l[h].z*=c;return new E.LightProbe(a)}static async fromCubeRenderTarget(e,t){const i=e.coordinateSystem===E.WebGLCoordinateSystem?-1:1;let r=0;const s=new E.Vector3,o=new E.Vector3,a=new E.Color,l=[0,0,0,0,0,0,0,0,0],c=new E.SphericalHarmonics3,h=c.coefficients,u=t.texture.type,d=t.width;let f;e.isWebGLRenderer&&(f=u===E.HalfFloatType?new Uint16Array(d*d*4):new Uint8Array(d*d*4));for(let g=0;g<6;g++){e.isWebGLRenderer?await e.readRenderTargetPixelsAsync(t,0,0,d,d,f,g):f=await e.readRenderTargetPixelsAsync(t,0,0,d,d,0,g);const m=2/d;for(let p=0,v=f.length;p<v;p+=4){let y,b,w;u===E.HalfFloatType?(y=E.DataUtils.fromHalfFloat(f[p]),b=E.DataUtils.fromHalfFloat(f[p+1]),w=E.DataUtils.fromHalfFloat(f[p+2])):(y=f[p]/255,b=f[p+1]/255,w=f[p+2]/255),a.setRGB(y,b,w),ig(a,t.texture.colorSpace);const M=p/4,S=(1-(M%d+.5)*m)*i,R=1-(Math.floor(M/d)+.5)*m;switch(g){case 0:s.set(-1*i,R,S*i);break;case 1:s.set(1*i,R,-S*i);break;case 2:s.set(S,1,-R);break;case 3:s.set(S,-1,R);break;case 4:s.set(S,R,1);break;case 5:s.set(-S,R,-1)}const _=s.lengthSq(),I=4/(Math.sqrt(_)*_);r+=I,o.copy(s).normalize(),E.SphericalHarmonics3.getBasisAt(o,l);for(let D=0;D<9;D++)h[D].x+=l[D]*a.r*I,h[D].y+=l[D]*a.g*I,h[D].z+=l[D]*a.b*I}}const A=4*Math.PI/r;for(let g=0;g<9;g++)h[g].x*=A,h[g].y*=A,h[g].z*=A;return new E.LightProbe(c)}}function ig(n,e){switch(e){case E.SRGBColorSpace:n.convertSRGBToLinear();break;case E.LinearSRGBColorSpace:case E.NoColorSpace:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.")}return n}var ME=function(n){var e=this;this.object=n,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;var t,i,r,s,o=function(c){e.deviceOrientation=c},a=function(){e.screenOrientation=window.orientation||0},l=(t=new THREE.Vector3(0,0,1),i=new THREE.Euler,r=new THREE.Quaternion,s=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),function(c,h,u,d,f){i.set(u,h,-d,"YXZ"),c.setFromEuler(i),c.multiply(s),c.multiply(r.setFromAxisAngle(t,-f))});this.connect=function(){a(),window.addEventListener("orientationchange",a,!1),window.addEventListener("deviceorientation",o,!1),e.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",a,!1),window.removeEventListener("deviceorientation",o,!1),e.enabled=!1},this.update=function(){if(e.enabled!==!1){var c=e.deviceOrientation;if(c){var h=c.alpha?THREE.MathUtils.degToRad(c.alpha)+e.alphaOffset:0,u=c.beta?THREE.MathUtils.degToRad(c.beta):0,d=c.gamma?THREE.MathUtils.degToRad(c.gamma):0,f=e.screenOrientation?THREE.MathUtils.degToRad(e.screenOrientation):0;l(e.object.quaternion,h,u,d,f)}}},this.dispose=function(){e.disconnect()},this.connect()},Wn=globalThis.THREE={...E};Wn.DRACOLoader=oE,Wn.GLTFLoader=bp,Wn.KTX2Loader=Tn,Wn.OBJLoader=CE,Wn.MTLLoader=wE,Wn.OBB=Nc,Wn.BufferGeometryUtils=jd,Wn.LightProbeGenerator=_E,Wn.DeviceOrientationControls=ME,Wn.Cache.enabled=!0;const SE=Wn;var Dt=window.AFRAME_CDN_ROOT||"https://cdn.aframe.io/",Kt="aframe-injected",NB=He(8878),ta=He.n(NB),rg={colors:{debug:"gray",error:"red",info:"gray",warn:"orange"}};ta().formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" "),this.useColors){var e;this.color=(e=function(s){var o=s.split(":");return o[o.length-1]}(this.namespace),rg.colors&&rg.colors[e]||null);var t="color: "+this.color;n.splice(1,0,t,"color: inherit");var i=0,r=0;n[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(i++,s==="%c"&&(r=i))}),n.splice(r,0,t)}};var zu=function(){try{return window.localStorage}catch{}}();zu&&(parseInt(zu.logs,10)||zu.logs==="true")?ta().enable("*"):ta().enable("*:error,*:info,*:warn");const vt=ta();var QB=He(1124),GB=He.n(QB),sg=vt("device:error"),Qc=!1,Gc=!1,Dh=navigator.xr!==void 0;if(Dh){var ys=function(){var n=document.querySelector("a-scene");n?n.hasLoaded?n.components["xr-mode-ui"].updateEnterInterfaces():n.addEventListener("loaded",ys):window.addEventListener("DOMContentLoaded",ys)},og=function(n){sg("WebXR session support error: "+n.message)};navigator.xr.isSessionSupported?(navigator.xr.isSessionSupported("immersive-vr").then(function(n){Qc=n,ys()}).catch(og),navigator.xr.isSessionSupported("immersive-ar").then(function(n){Gc=n,ys()}).catch(function(){})):navigator.xr.supportsSession?(navigator.xr.supportsSession("immersive-vr").then(function(){Qc=!0,ys()}).catch(og),navigator.xr.supportsSession("immersive-ar").then(function(){Gc=!0,ys()}).catch(function(){})):sg("WebXR has neither isSessionSupported or supportsSession?!")}function wp(){return Qc||Gc}function _p(){return Gc}function Af(){return Qc}var ao,Hu,rr=(ao=!1,Hu=window.navigator.userAgent||window.navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(Hu)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(Hu.substr(0,4)))&&(ao=!0),(ma()||IE()||Bp())&&(ao=!0),Ip()&&(ao=!1),function(){return ao});function IE(n){var e=n||window.navigator.userAgent;return/Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(e)||BE()}function BE(n,e,t){var i=n||window.navigator.userAgent,r=e||window.navigator.platform,s=t||window.navigator.maxTouchPoints||0;return(r==="iPad"||r==="MacIntel")&&s>0&&/Macintosh|Intel|iPad|ipad/i.test(i)&&!window.MSStream}function TE(){var n=navigator.userAgent.includes("Macintosh"),e=navigator.maxTouchPoints===5;return n&&e&&Dh}function ma(){return/iPad|iPhone|iPod/.test(window.navigator.platform)}function Mp(){return!rr()&&!Ip()&&window.orientation!==void 0}function Sp(){return/(OculusBrowser)/i.test(window.navigator.userAgent)}function RE(){return/(Mobile VR)/i.test(window.navigator.userAgent)}function Ip(){return Sp()||RE()||TE()}function Bp(){return/R7 Build/.test(window.navigator.userAgent)}function LE(){var n=window.orientation;return Bp()&&(n+=90),n===90||n===-90}var Tp=typeof process>"u"||process.browser===!0,zB=!Tp,HB=Object.freeze(Object.create(null));function VB(){return{}}function Rp(n){var e=[],t=null;function i(r){var s,o;if((r=r===void 0?e.length:r)>0&&t==null&&(t=0),r>0)for(s=e.length,e.length+=Number(r),o=s;o<e.length;o++)e[o]=n();return e.length}return n=n||VB,{grow:i,pool:e,recycle:function(r){r instanceof Object&&(t!==null&&t!==-1?e[--t]=r:e[e.length]=r)},size:function(){return e.length},use:function(){var r;return t!==null&&t!==e.length||i(e.length||5),r=e[t],e[t++]=HB,Lp(r),r}}}function Lp(n){var e;if(n&&n.constructor===Object)for(e in n)n[e]=void 0}function na(n,e){var t;if(n&&n.constructor===Object)for(t in n)t in e||delete n[t]}var WB=vt("utils:coordinates:warn"),ag=["x","y","z","w"],DE=/^\s*((-?\d*\.{0,1}\d+(e-?\d+)?)\s+){2,3}(-?\d*\.{0,1}\d+(e-?\d+)?)\s*$/,qB=/\s+/g;function zc(n,e,t){var i,r,s,o,a,l,c,h,u=t&&typeof t=="object"?t:{};if(n&&n instanceof Object)return a=n.x===void 0?e&&e.x:n.x,l=n.y===void 0?e&&e.y:n.y,c=n.z===void 0?e&&e.z:n.z,h=n.w===void 0?e&&e.w:n.w,a!=null&&(u.x=lo(a)),l!=null&&(u.y=lo(l)),c!=null&&(u.z=lo(c)),h!=null&&(u.w=lo(h)),u;if(n==null)return typeof e=="object"?Object.assign(u,e):e;for(i=n.trim().split(qB),o=0;o<ag.length;o++)if(s=ag[o],i[o])u[s]=parseFloat(i[o],10);else{if((r=e&&e[s])===void 0)continue;u[s]=lo(r)}return u}function Wl(n){var e;return typeof n!="object"?n:(e=n.x+" "+n.y,n.z!=null&&(e+=" "+n.z),n.w!=null&&(e+=" "+n.w),e)}function ql(n,e){return typeof n!="object"||typeof e!="object"?n===e:n.x===e.x&&n.y===e.y&&n.z===e.z&&n.w===e.w}function PE(n){return DE.test(n)}function jB(n){return WB("`AFRAME.utils.isCoordinate` has been renamed to `AFRAME.utils.isCoordinates`"),PE(n)}function lo(n){return n!=null&&n.constructor===String?parseFloat(n,10):n}function XB(n){return new E.Vector3(n.x,n.y,n.z)}var Di=function(){var n={};return function(e,t){return t in n||(n[t]={}),e in n[t]||(n[t][e]=e.split(t)),n[t][e]}}();function Ph(n,e){var t=Di(n,e=e||".");return t.length===1?t[0]:t}function UE(n,e,t){var i;return t=t||".",e.indexOf(t)!==-1?(i=Ph(e,t)).constructor===String?n.getAttribute(i):n.getAttribute(i[0])[i[1]]:n.getAttribute(e)}function Dp(n,e,t,i){var r;i=i||".",e.indexOf(i)===-1?n.setAttribute(e,t):(r=Ph(e,i)).constructor===String?n.setAttribute(r,t):n.setAttribute(r[0],r[1],t)}function FE(n){var e=n.style.width,t=n.style.height;n.style.width=parseInt(e,10)+1+"px",n.style.height=parseInt(t,10)+1+"px",setTimeout(function(){n.style.width=e,n.style.height=t},200)}var jl=vt("utils:src-loader:warn");function Hc(n,e,t){(function(i,r){var s;i.tagName?r(i.tagName==="IMG"):((s=new XMLHttpRequest).open("HEAD",i),s.addEventListener("load",function(o){var a;s.status>=200&&s.status<300?(a=s.getResponseHeader("Content-Type"))==null?lg(i,r):a.startsWith("image")?r(!0):r(!1):lg(i,r),s.abort()}),s.send())})(n,function(i){i?e(n):t(n)})}function Pp(n,e,t){var i,r,s,o="",a=[];if(typeof n=="string"){let l=function(c){a.push(c),a.length===6&&e(a)};for(r=0;r<5;r++)o+="(url\\((?:[^\\)]+)\\),\\s*)";if(o+="(url\\((?:[^\\)]+)\\)\\s*)",s=n.match(new RegExp(o))){for(r=1;r<7;r++)Hc(mf(s[r]),l);return}if(!n.startsWith("#"))return void Hc(mf(n)||n,t)}if(i=n.tagName?n:function(l){try{var c=document.querySelector(l);return c||jl('No element was found matching the selector: "%s"',l),c}catch{return void jl('"%s" is not a valid selector',l)}}(n))return i.tagName==="A-CUBEMAP"&&i.srcs?e(i.srcs):i.tagName==="IMG"?t(i):void jl('Selector "%s" does not point to <a-cubemap> or <img>',n)}function OE(n,e){return Pp(n,e,function(){jl("Expected cubemap but got image")})}function mf(n){var e=n.match(/url\((.+)\)/);if(e)return e[1]}function lg(n,e){var t=new Image;t.addEventListener("load",function(){e(!0)}),t.addEventListener("error",function(){e(!1)}),t.src=n}var YB=vt("utils:material:warn"),KB=new Set(["emissiveMap","envMap","map","specularMap"]);function Vc(n,e){var t=e.offset||{x:0,y:0},i=e.repeat||{x:1,y:1},r=e.npot||!1,s=e.anisotropy||E.Texture.DEFAULT_ANISOTROPY,o=n.wrapS,a=n.wrapT,l=n.magFilter,c=n.minFilter;r&&(o=E.ClampToEdgeWrapping,a=E.ClampToEdgeWrapping,l=E.LinearFilter,c=E.LinearFilter),i.x===1&&i.y===1||(o=E.RepeatWrapping,a=E.RepeatWrapping),n.offset.set(t.x,t.y),n.repeat.set(i.x,i.y),n.wrapS===o&&n.wrapT===a&&n.magFilter===l&&n.minFilter===c&&n.anisotropy===s||(n.wrapS=o,n.wrapT=a,n.magFilter=l,n.minFilter=c,n.anisotropy=s,n.needsUpdate=!0)}function Uh(n,e,t,i){var r=t.el,s=t.material,o=r.sceneEl.systems.renderer,a=i[e];if(t.materialSrcs||(t.materialSrcs={}),!a)return delete t.materialSrcs[n],void l(null);function l(c){s[n]!==c&&(s[n]&&s[n].dispose(),s[n]=c,s.needsUpdate=!0,Up(r,c))}a===t.materialSrcs[n]&&s[n]?Vc(s[n],i):(t.materialSrcs[n]=a,a instanceof E.Texture?l(a):r.sceneEl.systems.material.loadTextureSource(a,function(c){if(t.materialSrcs[n]===a){var h=s[n];!h||c!==null&&kE(h,c)||(h=null),!h&&c&&(h=Fp(c)),h&&(h.source!==c&&(h.source=c,h.needsUpdate=!0),KB.has(n)&&o.applyColorCorrection(h),Vc(h,i)),l(h)}}))}function Xl(n,e){return Uh("map","src",n,e)}function ni(n,e,t){var i=n;n==="ambientOcclusion"&&(i="ao");var r={};return r.src=t[n+"Map"],r.offset=t[n+"TextureOffset"],r.repeat=t[n+"TextureRepeat"],r.wrap=t[n+"TextureWrap"],Uh(i+"Map","src",e,r)}var Vu={};function gf(n,e){var t=n.material,i=n.el,r="envMap",s=e.envMap,o=e.sphericalEnvMap,a=e.refract;if(o&&(s=o,YB("`sphericalEnvMap` property is deprecated, using spherical map as equirectangular map instead. Use `envMap` property with a CubeMap or Equirectangular image instead.")),n.materialSrcs||(n.materialSrcs={}),!s)return delete n.materialSrcs[r],t.envMap=null,void(t.needsUpdate=!0);function l(c){n.materialSrcs[r]===s&&(t.envMap=c,t.needsUpdate=!0,Up(i,c))}n.materialSrcs[r]=s,Vu[s]?Vu[s].then(l):Vu[s]=new Promise(function(c){Pp(s,function(h){i.sceneEl.systems.material.loadCubeMapTexture(h,function(u){u.mapping=a?E.CubeRefractionMapping:E.CubeReflectionMapping,l(u),c(u)})},function(h){i.sceneEl.systems.material.loadTexture(h,{src:h},function(u){u.mapping=a?E.EquirectangularRefractionMapping:E.EquirectangularReflectionMapping,l(u),c(u)})})})}function Up(n,e){function t(){n.emit("materialvideoloadeddata",{src:e.image,texture:e})}function i(){n.emit("materialvideoended",{src:e.image,texture:e})}e&&(n.emit("materialtextureloaded",{src:e.image,texture:e}),e.image&&e.image.tagName==="VIDEO"&&(e.image.addEventListener("loadeddata",t),e.image.addEventListener("ended",i),e.addEventListener("dispose",function(){e.image.removeEventListener("loadeddata",t),e.image.removeEventListener("ended",i)})))}function kE(n,e){return n.source===e&&(e.data instanceof HTMLCanvasElement?n.isCanvasTexture:e.data instanceof HTMLVideoElement?n.isVideoTexture:n.isTexture&&!n.isCanvasTexture&&!n.isVideoTexture)}function Fp(n){var e;return(e=n.data instanceof HTMLCanvasElement?new E.CanvasTexture:n.data instanceof HTMLVideoElement?new E.VideoTexture(n.data):new E.Texture).source=n,e.needsUpdate=!0,e}var JB=/-([a-z])/g;function ia(n,e){var t;return typeof n!="string"?n:(t=function(i,r){var s,o,a,l,c,h;for(r=r||{},s=$B(i),o=0;o<s.length;o++)(a=s[o])&&(l=a.indexOf(":"),c=a.substr(0,l).trim(),h=a.substr(l+1).trim(),r[NE(c)]=h);return r}(n,e),t[""]?n:t)}function ZB(n){return typeof n=="string"?n:function(e){var t,i=0,r=0,s="";for(t in e)i++;for(t in e)s+=t+": "+e[t],r<i-1&&(s+="; "),r++;return s}(n)}function NE(n){return n.replace(JB,eT)}var Al,cg,$B=(Al=[],cg=/url\([^)]+$/,function(n){var e,t="",i=0;for(Al.length=0;i<n.length;)(e=n.indexOf(";",i))===-1&&(e=n.length),t+=n.substring(i,e),cg.test(t)?(t+=";",i=e+1):(Al.push(t.trim()),t="",i=e+1);return Al});function eT(n){return n[1].toUpperCase()}var tT=["x","y","z","w"];function Dn(n,e,t){var i,r,s=n.el;if((r=!!(i=QE(n,e,t)))===n.controllerPresent)return r;n.controllerPresent=r,r?(n.addEventListeners(),n.injectTrackedControls(i),s.emit("controllerconnected",{name:n.name,component:n})):(n.removeEventListeners(),s.emit("controllerdisconnected",{name:n.name,component:n}))}function QE(n,e,t){var i,r=n.el.sceneEl,s=r&&r.systems["tracked-controls"];return!!s&&!(!(i=s.controllers)||!i.length)&&Op(i,e,t.hand,t.index,t.iterateControllerProfiles,t.handTracking)}function Op(n,e,t,i,r,s){var o,a,l,c,h=!1;for(o=0;o<n.length;o++){if(c=(l=n[o]).profiles,s)h=l.hand;else if(r)for(a=0;a<c.length&&!(h=c[a].startsWith(e));a++);else h=c.length>0&&c[0].startsWith(e);if(h){if(l.handedness==="right"||l.handedness==="left"){if(l.handedness===t)return n[o]}else if(o===i)return n[o]}}}function Nn(n,e,t){var i,r,s,o,a;for(r in e){for(i=e[r],s=!1,a=0;a<i.length;a++)t.detail.changed[i[a]]&&(s=!0);if(s){for(o={},a=0;a<i.length;a++)o[tT[a]]=t.detail.axis[i[a]];n.el.emit(r+"moved",o)}}}function Ze(n,e,t,i){var r=(i?t.mapping[i]:t.mapping).buttons[n];t.el.emit(r+e),t.updateModel&&t.updateModel(r,e)}var kp=vt("utils:warn");function nT(n){return n.bind.apply(n,Array.prototype.slice.call(arguments,1))}function iT(){return kp("`utils.checkHeadsetConnected` has moved to `utils.device.checkHeadsetConnected`"),wp()}function rT(){return kp("`utils.isIOS` has moved to `utils.device.isIOS`"),ma()}function sT(){return kp("`utils.isMobile has moved to `utils.device.isMobile`"),rr(arguments)}function oT(n,e,t){var i;return t&&(n=n.bind(t)),function(){var r=Date.now();(i===void 0||(i===void 0?e:r-i)>=e)&&(i=r,n.apply(null,arguments))}}function GE(n,e,t){var i,r,s;t&&(n=n.bind(t));var o=function(){i=Date.now(),n.apply(this,s),r=void 0};return function(){var a=Date.now(),l=i===void 0?e:a-i;l>=e?(clearTimeout(r),r=void 0,i=a,n.apply(null,arguments)):(r=r||setTimeout(o,e-l),s=arguments)}}function aT(n,e,t){var i;return t&&(n=n.bind(t)),function(r,s){var o=i===void 0?s:r-i;(i===void 0||o>=e)&&(i=r,n(r,o))}}function zE(n,e,t){var i;return function(){var r=this,s=arguments,o=t&&!i;clearTimeout(i),i=setTimeout(function(){i=null,t||n.apply(r,s)},e),o&&n.apply(r,s)}}var Cn=Object.assign,Bn=GB();function Np(n){return JSON.parse(JSON.stringify(n))}var Vn,Br,Qp=(Vn=Rp(function(){return[]}),function(n,e){var t,i,r,s,o,a;if(n===void 0||e===void 0||n===null||e===null||!(n&&e&&n.constructor===Object&&e.constructor===Object||n.constructor===Array&&e.constructor===Array))return n===e;for(t in i=Vn.use(),r=Vn.use(),i.length=0,r.length=0,n)i.push(t);for(t in e)r.push(t);if(i.length!==r.length)return Vn.recycle(i),Vn.recycle(r),!1;for(s=0;s<i.length;++s)if(o=n[i[s]],a=e[i[s]],typeof o=="object"||typeof a=="object"||Array.isArray(o)&&Array.isArray(a)){if(o===a)continue;if(!Qp(o,a))return Vn.recycle(i),Vn.recycle(r),!1}else if(o!==a)return Vn.recycle(i),Vn.recycle(r),!1;return Vn.recycle(i),Vn.recycle(r),!0}),HE=(Br=[],function(n,e,t){var i,r,s,o,a,l,c;for(a in o=t||{},Br.length=0,n)Br.push(a);if(!e)return o;for(s in e)Br.indexOf(s)===-1&&Br.push(s);for(l=0;l<Br.length;l++)i=n[a=Br[l]],r=e[a],((c=i&&r&&i.constructor===Object&&r.constructor===Object)&&!Qp(i,r)||!c&&i!==r)&&(o[a]=r);return o});function Gp(n){return!n.metaKey&&document.activeElement===document.body}function lT(n,e){e===void 0&&(e=" ");var t=new RegExp(e,"g");return(n=(n||"").replace(t,e)).split(e)}function cT(n,e){e=e||{};var t={};return Object.keys(e).forEach(function(i){n.hasAttribute(i)&&(t[i]=n.getAttribute(i))}),t}function ra(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(location.search);return e===null?"":decodeURIComponent(e[1].replace(/\+/g," "))}function VE(){return window.top!==window.self}function WE(n){for(var e=[],t=n.getElementsByTagName("*"),i=0,r=t.length;i<r;i++)t[i].isScene&&e.push(t[i]);return e}var Wu,hT=[Po({name:"viewport",content:"width=device-width,initial-scale=1,maximum-scale=1,shrink-to-fit=no,user-scalable=no,minimal-ui,viewport-fit=cover"}),Po({name:"mobile-web-app-capable",content:"yes"}),Po({name:"theme-color",content:"black"})],uT=[Po({name:"apple-mobile-web-app-capable",content:"yes"}),Po({name:"apple-mobile-web-app-status-bar-style",content:"black"}),(Wu={rel:"apple-touch-icon",href:"https://aframe.io/images/aframe-logo-152.png"},{tagName:"link",attributes:Wu,exists:function(){return document.querySelector('link[rel="'+Wu.rel+'"]')}})];function Po(n){return{tagName:"meta",attributes:n,exists:function(){return document.querySelector('meta[name="'+n.name+'"]')}}}var Yn,ji,qE,dT=He(5928),fT=He.n(dT),pT=Ns,hg="loading-screen";function qu(n){var e=Yn.hasAttribute("embedded"),t=qE(Yn.canvas,e,Yn.maxCanvasSize,Yn.is("vr-mode"));n.aspect=t.width/t.height,n.updateProjectionMatrix(),Yn.renderer.setSize(t.width,t.height,!1)}const Vr=[];var jE=ta()("core:propertyTypes:warn"),vf={},AT=/[,> .[\]:]/,mT=/url\((.+)\)/;function Xt(n,e,t,i,r,s){if(n in vf)throw new Error("Property type "+n+" is already registered.");vf[n]={default:e,parse:t||gT,stringify:i||Wc,equals:r||XE,isCacheable:s!==!1}}function ug(n,e){if(!Array.isArray(n)||!Array.isArray(e))return n===e;if(n.length!==e.length)return!1;for(var t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function co(n){var e,t;return typeof n!="string"?n:(t=n.match(mT))?t[1]:n.charAt(0)==="#"?(e=document.getElementById(n.substring(1)))?e.tagName==="CANVAS"||e.tagName==="VIDEO"||e.tagName==="IMG"?e:e.getAttribute("src"):void jE('"'+n+'" asset not found.'):n}function ho(n){return n.getAttribute?n.getAttribute("id")?"#"+n.getAttribute("id"):n.getAttribute("src"):Wc(n)}function gT(n){return n}function Wc(n){return n===null?"null":n.toString()}function XE(n,e){return n===e}function dg(n){return parseInt(n,10)}function ju(n,e,t){return zc(n,e,t)}function Xu(n,e){if(n===null)return!0;if(typeof n!="object"||Object.keys(n).length!==e)return!1;var t=n.x,i=n.y,r=n.z,s=n.w;return!(typeof t!="number"||typeof i!="number"||e>2&&typeof r!="number"||e>3&&typeof s!="number")}Xt("audio","",co,ho),Xt("array",[],function(n){return Array.isArray(n)?n:n&&typeof n=="string"?n.split(",").map(function(e){return e.trim()}):[]},function(n){return n.join(", ")},ug),Xt("asset","",co,ho),Xt("boolean",!1,function(n){return n!=="false"&&n!==!1}),Xt("color","#FFF"),Xt("int",0,dg),Xt("number",0,function(n){return parseFloat(n,10)}),Xt("map","",co,ho),Xt("model","",co,ho),Xt("selector",null,function(n){return n?typeof n!="string"?n:n[0]!=="#"||AT.test(n)?document.querySelector(n):document.getElementById(n.substring(1)):null},function(n){return n.getAttribute?"#"+n.getAttribute("id"):Wc(n)},XE,!1),Xt("selectorAll",null,function(n){return n?typeof n!="string"?n:Array.prototype.slice.call(document.querySelectorAll(n),0):null},function(n){return n instanceof Array?n.map(function(e){return"#"+e.getAttribute("id")}).join(", "):Wc(n)},ug,!1),Xt("src","",function(n){return jE("`src` property type is deprecated. Use `asset` instead."),co(n)},ho),Xt("string",""),Xt("time",0,dg),Xt("vec2",{x:0,y:0},ju,Wl,ql),Xt("vec3",{x:0,y:0,z:0},ju,Wl,ql),Xt("vec4",{x:0,y:0,z:0,w:1},ju,Wl,ql);var vT=function(n,e){return(n!=="audio"||typeof e=="string")&&!(n==="array"&&!Array.isArray(e))&&(n!=="asset"||typeof e=="string")&&(n!=="boolean"||typeof e=="boolean")&&(n!=="color"||typeof e=="string")&&(n!=="int"||typeof e=="number")&&(n!=="number"||typeof e=="number")&&(n!=="map"||typeof e=="string")&&(n!=="model"||typeof e=="string")&&(n!=="selector"||typeof e=="string"||e===null)&&(n!=="selectorAll"||typeof e=="string"||e===null)&&(n!=="src"||typeof e=="string")&&(n!=="string"||typeof e=="string")&&(n!=="time"||typeof e=="number")&&(n==="vec2"?Xu(e,2):n==="vec3"?Xu(e,3):n!=="vec4"||Xu(e,4))},yT=vf,qc=vt("core:schema:warn");function Fh(n){return"type"in n?typeof n.type=="string":"default"in n}function ga(n,e){var t;if(Fh(n))return yf(n,e);for(t in n)n[t]=yf(n[t],e);return n}function yf(n,e){var t,i,r=n.default,s=n.type;return n.type?n.type==="bool"?s="boolean":n.type==="float"&&(s="number"):s=r===void 0||typeof r!="boolean"&&typeof r!="number"?Array.isArray(r)?"array":"string":typeof r,(i=yT[s])||qc("Unknown property type for component `"+e+"`: "+s),t=!!n.parse,n.parse=n.parse||i.parse,n.stringify=n.stringify||i.stringify,n.equals=n.equals||i.equals,n.isCacheable=n.isCacheable===!0||i.isCacheable,n.type=s,"default"in n?t||vT(s,r)||qc("Default value `"+r+"` does not match type `"+s+"` in component `"+e+"`"):n.default=i.default,n}var uo,YE=(uo=[],function(n,e,t,i,r){var s,o,a,l;for(o in uo.length=0,t?n:e)t&&n[o]===void 0||uo.push(o);if(n===null||typeof n!="object")return n;for(o in n)n[o]===void 0||e[o]||r||qc("Unknown property `"+o+"` for component/system `"+i+"`.");for(s=0;s<uo.length;s++){if(a=e[o=uo[s]],l=n[o],!e[o])return;n[o]=Oh(l,a)}return n});function Oh(n,e,t){return n!=null&&n!==""||(n=e.default,Array.isArray(n)&&(n=n.slice())),e.parse(n,e.default,t)}function KE(n,e){var t,i,r,s,o={};for(t in n)i=e[t],typeof(s=r=n[t])=="object"&&(s=zp(r,i),i||qc("Unknown component property: "+t)),s!==void 0&&(o[t]=s);return o}function zp(n,e){return typeof n!="object"?n:e&&n!==null?e.stringify(n):JSON.stringify(n)}var Pt={},wo=Oh,JE=ga,ET=Fh,xT=KE,bT=zp,Yu=Ns,Uo=vt("core:component:warn"),CT=document.currentScript,wT=new RegExp("[A-Z]+"),ZE={},_T=Object.freeze({}),Es=[],MT={get:function(n,e){return n.getComputedPropertyValue(e)},set:function(n,e,t){return e in n.schema?n.recomputeProperty(e,t):t!==void 0&&n.handleUnknownProperty(e,t),!0}},sa=function(n,e,t){var i=this;if(this.sceneOnly&&!n.isScene)throw new Error("Component `"+this.name+"` can only be applied to <a-scene>");if(t&&!this.multiple)throw new Error("Trying to initialize multiple components of type `"+this.name+"`. There can only be one component of this type per entity.");this.el=n,this.id=t,this.attrName=this.name+(t?"__"+t:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.el.components[this.attrName]=this,this.objectPool=ZE[this.name];var r=this.events;this.events={},function(s,o){var a;for(a in o)s.events[a]=o[a].bind(s)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.data=this.objectPool.use(),na(this.data,this.schema),this.oldData=this.objectPool.use(),na(this.oldData,this.schema),this.attrValueProxy=new Proxy(this,MT)):(this.data=void 0,this.oldData=void 0,this.attrValueProxy=void 0),this.deferUnknownPropertyWarnings=!!this.updateSchema,this.throttledEmitComponentChanged=GE(function(){n.emit("componentchanged",i.evtDetail,!1)},200),this.updateProperties(e,!0)};sa.prototype={schema:{},init:function(){},events:{},update:function(n){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},stringify:function(n){var e=this.schema;return typeof n=="string"?n:this.isSingleProperty?bT(n,e):(n=xT(n,e),Yu.stringify(n))},flushToDOM:function(n){var e=n?this.data:this.attrValue;e!=null&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(e))},updateProperties:function(n,e){var t=this.el;this.updateData(n,e),(t.hasLoaded||t.isLoading)&&(this.initialized?this.callUpdateHandler():this.initComponent())},initComponent:function(){var n,e=this.el;e.initializingComponents[this.name]||(e.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete e.initializingComponents[this.name],n=this.isObjectBased?_T:void 0,this.dataChanged=!1,this.storeOldData(),this.update(n),e.isPlaying&&this.play(),e.emit("componentinitialized",this.evtDetail,!1))},updateData:function(n,e){this.isSingleProperty?this.recomputeProperty(void 0,n):(e?(Lp(this.attrValue),this.recomputeData(n),this.schemaChangeRequired=!!this.updateSchema):typeof n=="string"?Yu.parse(n,this.attrValueProxy):Cn(this.attrValueProxy,n),this.updateSchemaIfNeeded(n))},updateSchemaIfNeeded:function(n){if(this.schemaChangeRequired&&this.updateSchema)for(var e in Es.length=0,this.updateSchema(this.data),na(this.data,this.schema),this.recomputeData(n),this.schemaChangeRequired=!1,this.attrValue)this.attrValue[e]!==void 0&&Es.indexOf(e)===-1&&(e in this.schema||Uo("Unknown property `"+e+"` for component `"+this.name+"`."));for(var t=0;t<Es.length;t++)Uo("Unknown property `"+Es[t]+"` for component `"+this.name+"`.");Es.length=0},callUpdateHandler:function(){if(this.isPositionRotationScale||this.dataChanged){this.dataChanged=!1;var n=this.oldData;this.oldDataInUse=!0,this.update(n),n!==this.oldData&&this.objectPool.recycle(n),this.oldDataInUse=!1,this.storeOldData(),this.throttledEmitComponentChanged()}},handleMixinUpdate:function(){this.recomputeData(),this.updateSchemaIfNeeded(),this.callUpdateHandler()},resetProperty:function(n){(this.isSingleProperty||n in this.schema)&&(n?this.attrValue[n]=void 0:(this.isObjectBased&&this.objectPool.recycle(this.attrValue),this.attrValue=void 0),this.recomputeProperty(n,void 0),this.updateSchemaIfNeeded(),this.callUpdateHandler())},extendSchema:function(n){var e;e=Cn({},Pt[this.name].schema),Cn(e,n),this.schema=JE(e),this.el.emit("schemachanged",this.evtDetail)},getComputedPropertyValue:function(n){var e=this.el.mixinEls,t=this.attrValue&&n?this.attrValue[n]:this.attrValue;if(t!==void 0)return t;for(var i=e.length-1;i>=0;i--){var r=e[i].getAttribute(this.attrName);if(r!==null&&(!n||n in r))return n?r[n]:r}return n?this.schema[n].default:this.schema.default},recomputeProperty:function(n,e){var t=n?this.schema[n]:this.schema;if(e!=null){this.attrValue===void 0&&this.isObjectBased&&(this.attrValue=this.objectPool.use());var i=n?this.attrValue[n]:this.attrValue;typeof(i=t.isCacheable?wo(e,t,i):e)=="string"&&(i=e===""?void 0:e),n?this.attrValue[n]=i:this.attrValue=i}this.oldDataInUse&&(this.oldData=this.objectPool.use(),na(this.oldData,this.schema),this.storeOldData(),this.oldDataInUse=!1);var r=n?this.oldData[n]:this.oldData,s=n?this.data[n]:this.data,o=wo(this.getComputedPropertyValue(n),t,s);return t.type!=="array"||n||(o=Np(o)),t.equals(o,r)||(this.dataChanged=!0,t.schemaChange&&(this.schemaChangeRequired=!0)),n?this.data[n]=o:this.data=o,o},handleUnknownProperty:function(n,e){this.attrValue===void 0&&(this.attrValue=this.objectPool.use()),this.attrValue[n]=e,this.deferUnknownPropertyWarnings?Es.push(n):this.silenceUnknownPropertyWarnings||Uo("Unknown property `"+n+"` for component `"+this.name+"`.")},storeOldData:function(){var n;if(this.isObjectBased)if(this.isSingleProperty)this.oldData=wo(this.data,this.schema,this.oldData);else for(n in this.schema)this.data[n]!==void 0&&(this.data[n]&&typeof this.data[n]=="object"?this.oldData[n]=wo(this.data[n],this.schema[n],this.oldData[n]):this.oldData[n]=this.data[n]);else this.oldData=this.data},recomputeData:function(n){var e;if(this.isSingleProperty)this.recomputeProperty(void 0,n);else{for(e in this.schema)this.attrValueProxy[e]=void 0;n&&typeof n=="object"?Cn(this.attrValueProxy,n):typeof n=="string"&&Yu.parse(n,this.attrValueProxy)}},eventsAttach:function(){var n;for(n in this.eventsDetach(),this.events)this.el.addEventListener(n,this.events[n])},eventsDetach:function(){var n;for(n in this.events)this.el.removeEventListener(n,this.events[n])},destroy:function(){this.objectPool.recycle(this.attrValue),this.objectPool.recycle(this.data),this.objectPool.recycle(this.oldData),this.attrValue=this.data=this.oldData=this.attrValueProxy=void 0}};var $E={};function Ge(n,e){var t,i,r,s,o,a={};if(document.currentScript&&document.currentScript!==CT&&Vr.forEach(function(c){c.hasLoaded||document.currentScript.compareDocumentPosition(c)!==Node.DOCUMENT_POSITION_FOLLOWING&&(Uo("The component `"+n+"` was registered in a <script> tag after the scene. Component <script> tags in an HTML file should be declared *before* the scene such that the component is available to entities during scene initialization."),window.debug&&($E[n]=!0))}),wT.test(n)===!0&&Uo("The component name `"+n+"` contains uppercase characters, but HTML will ignore the capitalization of attribute names. Change the name to be lowercase: `"+n.toLowerCase()+"`"),n.indexOf("__")!==-1)throw new Error("The component name `"+n+"` is not allowed. The sequence __ (double underscore) is reserved to specify an id for multiple components of the same type");if(Object.keys(e).forEach(function(c){a[c]={value:e[c],writable:!0}}),Pt[n])throw new Error("The component `"+n+"` has been already registered. Check that you are not loading two versions of the same component or two different components of the same name.");((t=function(c,h,u){sa.call(this,c,h,u)}).prototype=Object.create(sa.prototype,a)).name=n,t.prototype.isPositionRotationScale=n==="position"||n==="rotation"||n==="scale",t.prototype.constructor=t,t.prototype.system=sf&&Si[n],t.prototype.play=(s=t.prototype.play,function(){var c=this.el.sceneEl,h=this.el.isPlaying&&!this.isPlaying;this.initialized&&h&&(s.call(this),this.isPlaying=!0,this.eventsAttach(),fg(this)&&c.addBehavior(this))}),t.prototype.pause=(o=t.prototype.pause,function(){var c=this.el.sceneEl;this.isPlaying&&(o.call(this),this.isPlaying=!1,this.eventsDetach(),fg(this)&&c.removeBehavior(this))}),i=Cn(JE(t.prototype.schema,t.prototype.name)),t.prototype.isSingleProperty=r=ET(t.prototype.schema),t.prototype.isObjectBased=!r||r&&(pg(i.default)||pg(wo(void 0,i))),ZE[n]=Rp(),Pt[n]={Component:t,dependencies:t.prototype.dependencies,before:t.prototype.before,after:t.prototype.after,isSingleProperty:t.prototype.isSingleProperty,isObjectBased:t.prototype.isObjectBased,multiple:t.prototype.multiple,sceneOnly:t.prototype.sceneOnly,name:n,schema:i,stringify:t.prototype.stringify};for(var l=0;l<Vr.length;l++)Vr[l].emit("componentregistered",{name:n},!1);return t}function fg(n){return n.tick||n.tock}function pg(n){return n&&n.constructor===Object&&!(n instanceof window.HTMLElement)}var jc=!1;function Ef(){jc||(jc=!0,setTimeout(function(){document.dispatchEvent(new CustomEvent("aframeready"))}))}var ST=Ns,Si={},Xc=function(n){var e=rf&&Pt[this.name];this.el=n,this.sceneEl=n,e&&(e.Component.prototype.system=this),this.buildData(),this.init(),this.update({})};function kn(n,e){var t,i,r={},s=WE(document);if(Object.keys(e).forEach(function(o){r[o]={value:e[o],writable:!0}}),Si[n])throw new Error("The system `"+n+"` has been already registered. Check that you are not loading two versions of the same system or two different systems of the same name.");if(i=function(o){Xc.call(this,o)},(i.prototype=Object.create(Xc.prototype,r)).name=n,i.prototype.constructor=i,i.prototype.schema=Cn(ga(i.prototype.schema)),Si[n]=i,jc)for(t=0;t<s.length;t++)s[t].initSystem(n)}Xc.prototype={schema:{},init:function(){},update:function(n){},updateProperties:function(n){var e=this.data;Object.keys(this.schema).length!==0&&(this.buildData(n),this.update(e))},buildData:function(n){var e=this.schema;Object.keys(e).length!==0&&(n=n||window.HTMLElement.prototype.getAttribute.call(this.sceneEl,this.name),Fh(e)?this.data=Oh(n,e):this.data=YE(ST.parse(n)||{},e,!1,this.name))},tick:void 0,tock:void 0,play:function(){},pause:function(){}};var Ku=vt("core:a-node:warn"),xf={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function IT(n){return n.tagName.toLowerCase()in xf||n.isANode}class Jt extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isANode=!0,this.mixinEls=[]}connectedCallback(){jc?this.doConnectedCallback():document.addEventListener("aframeready",this.connectedCallback.bind(this))}doConnectedCallback(){var e;this.sceneEl=this.closestScene(),this.sceneEl||Ku("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `<a-scene>` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(e=this.getAttribute("mixin"))&&this.updateMixins(e)}attributeChangedCallback(e,t,i){i!==this.computedMixinStr&&(e!=="mixin"||this.isMixin||this.updateMixins(i,t))}closestScene(){for(var e=this;e&&!e.isScene;)e=e.parentElement;return e}closest(e){for(var t=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,i=this;i&&!t.call(i,e);)i=i.parentElement;return i}disconnectedCallback(){this.hasLoaded=!1}load(e,t){var i,r=this;this.hasLoaded||(t=t||IT,i=this.getChildren().filter(t).map(function(s){return new Promise(function(o,a){if(s.hasLoaded)return o();s.addEventListener("loaded",o),s.addEventListener("error",a)})}),Promise.allSettled(i).then(function(s){s.forEach(function(o){o.status==="rejected"&&Ku("Rendering scene with errors on node: ",o.reason.target)}),r.isLoading=!0,r.setupMutationObserver(),e&&e(),r.isLoading=!1,r.hasLoaded=!0,r.emit("loaded-private",void 0,!1),r.emit("loaded",void 0,!1)}))}setupMutationObserver(){var e=this;new MutationObserver(function(t){var i;for(i=0;i<t.length;i++)if(t[i].type==="attributes"){var r=t[i].attributeName,s=window.HTMLElement.prototype.getAttribute.call(e,r),o=t[i].oldValue;e.attributeChangedCallback(r,o,s)}}).observe(this,{attributes:!0,attributeOldValue:!0})}getChildren(){return Array.prototype.slice.call(this.children,0)}updateMixins(e,t){var i,r,s,o=Jt.newMixinIdArray,a=Jt.oldMixinIdArray,l=Jt.mixinIds;for(o.length=0,a.length=0,r=e?Di(e.trim(),/\s+/):o,s=t?Di(t.trim(),/\s+/):a,l.newMixinIds=r,l.oldMixinIds=s,i=0;i<s.length;i++)r.indexOf(s[i])===-1&&this.unregisterMixin(s[i]);for(this.computedMixinStr="",this.mixinEls.length=0,i=0;i<r.length;i++)this.registerMixin(r[i]);return this.computedMixinStr&&(this.computedMixinStr=this.computedMixinStr.trim(),window.HTMLElement.prototype.setAttribute.call(this,"mixin",this.computedMixinStr)),r.length===0&&window.HTMLElement.prototype.removeAttribute.call(this,"mixin"),l}registerMixin(e){var t,i,r,s=document.getElementById(e);if(s){if(r=s.getAttribute("mixin"))for(t=Di(r.trim(),/\s+/),i=0;i<t.length;i++)this.registerMixin(t[i]);this.computedMixinStr=this.computedMixinStr+" "+s.id,this.mixinEls.push(s)}else Ku("No mixin was found with id `%s`",e)}setAttribute(e,t){e==="mixin"&&this.updateMixins(t),window.HTMLElement.prototype.setAttribute.call(this,e,t)}unregisterMixin(e){var t,i=this.mixinEls;for(t=0;t<i.length;++t)if(e===i[t].id){i.splice(t,1);break}}emit(e,t,i,r){var s=Jt.evtData;i===void 0&&(i=!0),s.bubbles=!!i,s.detail=t,r&&(s=Cn({},r,s)),this.dispatchEvent(new CustomEvent(e,s))}}Jt.evtData={},Jt.newMixinIdArray=[],Jt.oldMixinIdArray=[],Jt.mixinIds={},customElements.define("a-node",Jt);var BT=vt("core:a-entity:debug"),Ju=vt("core:a-entity:warn"),Yc="__",Zu=["position","rotation","scale","visible"],TT={once:!0};class zt extends Jt{constructor(){super(),this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new E.Group,this.object3D.rotation.order="YXZ",this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(e,t,i){var r=this.components[e];super.attributeChangedCallback(),r&&r.justInitialized&&i===""?delete r.justInitialized:(r||i!==null)&&this.setEntityAttribute(e,t,i)}doConnectedCallback(){var e,t,i=this;super.doConnectedCallback(),t=this.sceneEl,this.addToParent(),this.isScene||(t?!(e=t.querySelector("a-assets"))||e.hasLoaded?this.load():e.addEventListener("loaded",function(){i.load()}):this.load())}disconnectedCallback(){var e;if(this.parentEl){for(e in this.components)this.removeComponent(e,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(e){return this.object3DMap[e]}setObject3D(e,t){var i,r=this;if(!(t instanceof E.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(i=this.getObject3D(e))&&this.object3D.remove(i),t.el=this,t.children.length&&t.traverse(function(s){s.el=r}),this.object3D.add(t),this.object3DMap[e]=t,this.emit("object3dset",{object:t,type:e})}removeObject3D(e){var t=this.getObject3D(e);t?(this.object3D.remove(t),delete this.object3DMap[e],this.emit("object3dremove",{type:e})):Ju("Tried to remove `Object3D` of type:",e,"which was not defined.")}getOrCreateObject3D(e,t){var i=this.getObject3D(e);return!i&&t&&(i=new t,this.setObject3D(e,i)),Ju("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),i}add(e){if(!e.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(e.object3D),this.emit("child-attached",{el:e})}addToParent(){var e=this.parentEl=this.parentNode;e&&e.add&&!this.attachedToParent&&(e.add(this),this.attachedToParent=!0)}removeFromParent(){var e=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,e.emit("child-detached",{el:this})}load(){var e=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,function(){e.parentEl&&(e.updateComponents(),(e.isScene||e.parentEl.isPlaying)&&e.play())})}remove(e){e?this.object3D.remove(e.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var e=this.children,t=[],i=0;i<e.length;i++){var r=e[i];r instanceof zt&&t.push(r)}return t}initComponent(e,t,i){var r,s,o,a;a=(o=Di(e,Yc))[0],s=o.length>2?o.slice(1).join("__"):o[1],Pt[a]&&(Ag(this,e)||t!==void 0||i)&&(e in this.components||(this.initComponentDependencies(a),r=new Pt[a].Component(this,t,s),this.isPlaying&&r.play(),this.hasAttribute(e)||(r.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,e,"")),BT("Component initialized: %s",e)))}initComponentDependencies(e){var t,i;if(Pt[e]&&(t=Pt[e].dependencies))for(i=0;i<t.length;i++)this.initComponent(t[i],window.HTMLElement.prototype.getAttribute.call(this,t[i])||void 0,!0)}removeComponent(e,t){var i;(i=this.components[e])&&(i.initialized?(i.pause(),i.remove(),t&&(i.destroy(),delete this.components[e],this.hasAttribute(e)&&window.HTMLElement.prototype.removeAttribute.call(this,e)),this.emit("componentremoved",i.evtDetail,!1)):this.addEventListener("componentinitialized",function r(s){s.detail.name===e&&(this.removeComponent(e,t),this.removeEventListener("componentinitialized",r))}))}updateComponents(){var e,t,i,r,s,o,a=this.componentsToUpdate;if(this.hasLoaded||this.isLoading){for(i=0;i<this.mixinEls.length;i++)for(r in this.mixinEls[i].componentCache)$u(r)&&(a[r]=!0);if(this.getExtraComponents)for(r in t=this.getExtraComponents())$u(r)&&(a[r]=!0);for(i=0;i<this.attributes.length;++i)r=this.attributes[i].name,Zu.indexOf(r)===-1&&$u(r)&&(a[r]=!0);for(i=0;i<Zu.length;i++)r=Zu[i],this.hasAttribute(r)&&this.updateComponent(r,this.getDOMAttribute(r));for(r in a)s=this.getDOMAttribute(r),e=(o=t&&t[r])?o.constructor===Object?Cn(o,ia(s||{})):s||o:s,this.updateComponent(r,e),delete a[r]}}updateComponent(e,t,i){var r=this.components[e];if(r)return t!==null||Ag(this,e)?void r.updateProperties(t,i):void this.removeComponent(e,!0);this.initComponent(e,t,!1)}removeAttribute(e,t){var i=this.components[e];i&&t===void 0&&this.removeComponent(e,!0),i&&t!==void 0?i.resetProperty(t):(e==="mixin"&&this.mixinUpdate(""),window.HTMLElement.prototype.removeAttribute.call(this,e))}play(){var e,t,i;if(!this.isPlaying&&(this.hasLoaded||this.isLoading)){for(i in this.isPlaying=!0,this.components)this.components[i].play();for(e=this.getChildEntities(),t=0;t<e.length;t++)e[t].play();this.emit("play")}}pause(){var e,t,i;if(this.isPlaying){for(i in this.isPlaying=!1,this.components)this.components[i].pause();for(e=this.getChildEntities(),t=0;t<e.length;t++)e[t].pause();this.emit("pause")}}setEntityAttribute(e,t,i){if(Pt[e]||this.components[e])this.updateComponent(e,i);else if(e==="mixin"){if(i===this.computedMixinStr)return;this.mixinUpdate(i,t)}}mixinUpdate(e,t,i){var r,s,o,a,l=zt.componentsUpdated,c=this;if(i||(t=t||this.getAttribute("mixin")),this.hasLoaded){for(o=this.updateMixins(e,t),l.length=0,a=0;a<this.mixinEls.length;a++)for(r in this.mixinEls[a].componentCache)l.indexOf(r)===-1&&(this.components[r]?this.components[r].handleMixinUpdate():this.initComponent(r,null),l.push(r));for(a=0;a<o.oldMixinIds.length;a++)if(s=document.getElementById(o.oldMixinIds[a]))for(r in s.componentCache)l.indexOf(r)===-1&&this.components[r]&&(this.getDOMAttribute(r)?this.components[r].handleMixinUpdate():this.removeComponent(r,!0))}else this.addEventListener("loaded-private",function(){c.mixinUpdate(e,t,!0)},TT)}setAttribute(e,t,i){var r,s,o,a,l,c=zt.singlePropUpdate;if(o=(a=e.indexOf(Yc))>0?e.substring(0,a):e,!Pt[o])return e==="mixin"&&this.mixinUpdate(t),void super.setAttribute.call(this,e,t);if(!this.components[e]&&this.hasAttribute(e)&&this.updateComponent(e,window.HTMLElement.prototype.getAttribute.call(this,e)),i!==void 0&&typeof t=="string"&&t.length>0&&typeof ia(t)=="string"){for(l in c)delete c[l];(r=c)[t]=i,s=!1}else r=t,s=i===!0;this.updateComponent(e,r,s),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[e].flushToDOM()}flushToDOM(e){var t,i,r,s=this.components,o=this.children;for(r in s)s[r].flushToDOM();if(e)for(i=0;i<o.length;++i)(t=o[i]).flushToDOM&&t.flushToDOM(e)}getAttribute(e){var t,i,r,s;return e==="position"?this.object3D.position:e==="rotation"?(i=E.MathUtils.radToDeg,r=this.object3D.rotation,(s=this.rotationObj).x=i(r.x),s.y=i(r.y),s.z=i(r.z),s):e==="scale"?this.object3D.scale:e==="visible"?this.object3D.visible:(t=this.components[e])?t.data:window.HTMLElement.prototype.getAttribute.call(this,e)}getDOMAttribute(e){var t=this.components[e];return t?t.attrValue:window.HTMLElement.prototype.getAttribute.call(this,e)}addState(e){this.is(e)||(this.states.push(e),this.emit("stateadded",e))}removeState(e){var t=this.states.indexOf(e);t!==-1&&(this.states.splice(t,1),this.emit("stateremoved",e))}is(e){return this.states.indexOf(e)!==-1}inspect(){this.sceneEl.components.inspector.openInspector(this)}destroy(){var e;if(this.parentNode)Ju("Entity can only be destroyed if detached from scenegraph.");else for(e in this.components)this.components[e].destroy()}}function Ag(n,e){return!(!n.components[e]||!n.components[e].attrValue)||function(t,i){var r,s=!1;for(r=0;r<i.length&&!(s=i[r].hasAttribute(t));++r);return s}(e,n.mixinEls)}function $u(n){return n.indexOf(Yc)!==-1&&(n=Di(n,Yc)[0]),!!Pt[n]}function RT(n){if(n.data&&n.data.type==="vr")switch(n.data.data){case"enter":this.enterVR();break;case"exit":this.exitVR()}}zt.componentsUpdated=[],zt.singlePropUpdate={},customElements.define("a-entity",zt),ma()&&window.addEventListener("orientationchange",function(){document.documentElement.style.height="initial",setTimeout(function(){document.documentElement.style.height="100%",setTimeout(function(){window.scrollTo(0,1)},500)},500)});var ed=vt("core:a-scene:warn"),LT=ma(),mg=rr(),DT=Dh;class ex extends zt{constructor(){var e;super(),(e=this).clock=new E.Clock,e.isIOS=LT,e.isMobile=mg,e.hasWebXR=DT,e.isAR=!1,e.isScene=!0,e.object3D=new E.Scene,e.resize=e.resize.bind(e),e.render=e.render.bind(e),e.systems={},e.systemNames=[],e.time=e.delta=0,e.usedOfferSession=!1,e.componentOrder=[],e.behaviors={},e.hasLoaded=!1,e.isPlaying=!1,e.originalHTML=e.innerHTML}addFullScreenStyles(){document.documentElement.classList.add("a-fullscreen")}removeFullScreenStyles(){document.documentElement.classList.remove("a-fullscreen")}doConnectedCallback(){var e=this,t=this.hasAttribute("embedded");this.setAttribute("inspector",""),this.setAttribute("keyboard-shortcuts",""),this.setAttribute("screenshot",""),this.setAttribute("xr-mode-ui",""),this.setAttribute("device-orientation-permission-ui",""),super.doConnectedCallback(),function(i){var r;function s(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||i.exitVR(),document.activeElement.blur(),document.body.focus()}(r=document.createElement("canvas")).classList.add("a-canvas"),r.dataset.aframeCanvas=!0,i.appendChild(r),document.addEventListener("fullscreenchange",s),document.addEventListener("mozfullscreenchange",s),document.addEventListener("webkitfullscreenchange",s),document.addEventListener("MSFullscreenChange",s),r.addEventListener("touchmove",function(o){o.preventDefault()},{passive:!1}),i.canvas=r,i.emit("render-target-loaded",{target:r}),setTimeout(i.resize.bind(i),0)}(this),this.setupRenderer(),function(i,r){qE=r;var s,o,a,l,c,h,u,d,f,A,g=(Yn=i).hasAttribute(hg)?pT.parse(Yn.getAttribute(hg)):void 0,m=g&&g.dotsColor||"white",p=g&&g.backgroundColor||"#24CAFF";(g===void 0||g.enabled==="true"||g.enabled===void 0)&&(s=new E.Scene,o=new E.SphereGeometry(.2,36,18,0,2*Math.PI,0,Math.PI),a=new E.MeshBasicMaterial({color:m}),l=new E.Mesh(o,a),c=l.clone(),h=l.clone(),u=new E.PerspectiveCamera(80,window.innerWidth/window.innerHeight,5e-4,1e4),d=new E.Clock,f=0,A=function(){Yn.renderer.render(s,u),f=d.getElapsedTime()%4,l.visible=f>=1,c.visible=f>=2,h.visible=f>=3},s.background=new E.Color(p),s.add(u),l.position.set(-1,0,-15),c.position.set(0,0,-15),h.position.set(1,0,-15),u.add(l),u.add(c),u.add(h),(ji=document.createElement("div")).className="a-loader-title",ji.innerHTML=document.title,ji.style.display="none",ji.setAttribute(Kt,""),Yn.appendChild(ji),setTimeout(function(){Yn.hasLoaded||(qu(u),ji.style.display="block",window.addEventListener("resize",function(){qu(u)}),Yn.renderer.setAnimationLoop(A))},200))}(this,yg),this.resize(),t||this.addFullScreenStyles(),VE()&&window.addEventListener("message",RT.bind(this)),function(i){var r,s=document.head,o=s.querySelector("script"),a=[];return hT.forEach(l),i.isIOS&&uT.forEach(l),a;function l(c){c&&!c.exists()&&(r=function(h){if(h&&h.tagName){var u=document.createElement(h.tagName);return u.setAttribute(Kt,""),Cn(u,h.attributes)}}(c),r&&(o?o.parentNode.insertBefore(r,o):s.appendChild(r),a.push(r)))}}(this),function(i){if(i.isMobile){var r=i.wakelock=new(fT());i.addEventListener("enter-vr",function(){r.request()}),i.addEventListener("exit-vr",function(){r.release()})}}(this),this.enterVRBound=function(){e.enterVR()},this.exitVRBound=function(){e.exitVR()},window.addEventListener("sessionend",this.resize),this.addEventListener("cameraready",function(){e.attachedCallbackPostCamera()}),this.initSystems(),this.componentOrder=gg(Pt,this.componentOrder),this.addEventListener("componentregistered",function(){e.componentOrder=gg(Pt,e.componentOrder)}),this.hasWebXR&&navigator.xr&&navigator.xr.addEventListener&&navigator.xr.addEventListener("sessiongranted",function(){e.enterVR()})}attachedCallbackPostCamera(){var e=this;window.addEventListener("load",void 0),window.addEventListener("resize",function(){e.isIOS?setTimeout(e.resize,100):e.resize()}),this.play(),Vr.push(this)}initSystems(){var e;for(e in this.initSystem("camera"),Si)e!=="camera"&&this.initSystem(e)}initSystem(e){this.systems[e]||(this.systems[e]=new Si[e](this),this.systemNames.push(e))}disconnectedCallback(){var e=Vr.indexOf(this);super.disconnectedCallback(),Vr.splice(e,1),window.removeEventListener("sessionend",this.resize),this.removeFullScreenStyles(),this.renderer.dispose()}addBehavior(e){var t,i,r=this.behaviors[e.name];for(i in r||(r=this.behaviors[e.name]={tick:{inUse:!1,array:[],markedForRemoval:[]},tock:{inUse:!1,array:[],markedForRemoval:[]}}),r)if(e[i]){if((t=r[i]).inUse){var s=t.markedForRemoval.indexOf(e);s!==-1&&t.markedForRemoval.splice(s,1)}t.array.indexOf(e)===-1&&t.array.push(e)}}getPointerLockElement(){return document.pointerLockElement}checkHeadsetConnected(){return wp()}enterAR(){var e;if(!this.hasWebXR)throw e="Failed to enter AR mode, WebXR not supported.",new Error(e);if(!_p())throw e="Failed to enter AR, WebXR immersive-ar mode not supported in your browser or device.",new Error(e);return this.enterVR(!0)}enterVR(e,t){var i,r=this,s=r.renderer.xr;if(t&&(!navigator.xr||!navigator.xr.offerSession))return Promise.resolve("OfferSession is not supported.");if(r.usedOfferSession&&t)return Promise.resolve("OfferSession was already called.");if(this.is("vr-mode"))return Promise.resolve("Already in VR.");if(this.checkHeadsetConnected()||this.isMobile){var o=r.getAttribute("renderer");if(s.enabled=!0,this.hasWebXR){this.xrSession&&this.xrSession.removeEventListener("end",this.exitVRBound);var a=this.sceneEl.systems.webxr.sessionReferenceSpaceType;s.setReferenceSpaceType(a);var l=e?"immersive-ar":"immersive-vr";return i=this.sceneEl.systems.webxr.sessionConfiguration,new Promise(function(h,u){var d=t?navigator.xr.offerSession.bind(navigator.xr):navigator.xr.requestSession.bind(navigator.xr);r.usedOfferSession|=t,d(l,i).then(function(f){t&&(r.usedOfferSession=!1),s.layersEnabled=i.requiredFeatures.indexOf("layers")!==-1,s.setSession(f).then(function(){s.setFoveation(o.foveationLevel),r.xrSession=f,r.systems.renderer.setWebXRFrameRate(f),f.addEventListener("end",r.exitVRBound),c(h)})},function(f){u(new Error("Failed to enter "+(l==="immersive-ar"?"AR":"VR")+" mode (`requestSession`)",{cause:f}))})})}throw new Error("Failed to enter "+(e?"AR":"VR")+" no WebXR")}return c(),Promise.resolve();function c(h){var u;e?r.addState("ar-mode"):r.addState("vr-mode"),r.emit("enter-vr",{target:r}),!r.hasWebXR&&r.isMobile&&screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape"),r.addFullScreenStyles(),r.isMobile||r.checkHeadsetConnected()||((u=r.canvas).requestFullscreen||u.webkitRequestFullscreen||u.mozRequestFullScreen||u.msRequestFullscreen).apply(u,[{navigationUI:"hide"}]),r.resize(),h&&h()}}exitVR(){var e=this,t=this.renderer.xr;if(!this.is("vr-mode")&&!this.is("ar-mode"))return Promise.resolve("Not in immersive mode.");if(this.checkHeadsetConnected()||this.isMobile){if(t.enabled=!1,!this.hasWebXR)throw Error("Failed to exit VR - no WebXR");this.xrSession.removeEventListener("end",this.exitVRBound),this.xrSession.end().then(function(){},function(){}),this.xrSession=void 0}else(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen());return e.removeState("vr-mode"),e.removeState("ar-mode"),e.isMobile&&screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),e.hasAttribute("embedded")&&e.removeFullScreenStyles(),e.resize(),e.isIOS&&FE(e.canvas),e.renderer.setPixelRatio(window.devicePixelRatio),e.emit("exit-vr",{target:e}),Promise.resolve()}getAttribute(e){var t=this.systems[e];return t?t.data:zt.prototype.getAttribute.call(this,e)}getDOMAttribute(e){var t=this.systems[e];return t?t.data:zt.prototype.getDOMAttribute.call(this,e)}setAttribute(e,t,i){if(Si[e]){Jt.prototype.setAttribute.call(this,e,t);var r=this.systems[e];r&&r.updateProperties(t)}else zt.prototype.setAttribute.call(this,e,t,i)}removeBehavior(e){var t,i,r,s=this.behaviors[e.name];for(i in s)e[i]&&(r=(t=s[i]).array.indexOf(e))!==-1&&(t.inUse?t.markedForRemoval.indexOf(e)===-1&&t.markedForRemoval.push(e):(t.array[r]=t.array[t.array.length-1],t.array.pop()))}resize(){var e,t,i=this.camera,r=this.canvas,s=this.renderer.xr.isPresenting;e=this.renderer.xr.enabled&&s,!i||!r||this.is("vr-mode")&&(this.isMobile||e)||(t=yg(r,this.getAttribute("embedded")&&!this.is("vr-mode"),this.maxCanvasSize,this.is("vr-mode")),i.aspect=t.width/t.height,i.updateProjectionMatrix(),this.renderer.setSize(t.width,t.height,!1),this.emit("rendererresize",null,!1))}setupRenderer(){var e,t,i,r=this;i={alpha:!0,antialias:!mg,canvas:this.canvas,logarithmicDepthBuffer:!1,powerPreference:"high-performance"},this.maxCanvasSize={height:-1,width:-1},this.hasAttribute("renderer")&&((t=ia(this.getAttribute("renderer"))).precision&&(i.precision=t.precision+"p"),t.antialias&&t.antialias!=="auto"&&(i.antialias=t.antialias==="true"),t.logarithmicDepthBuffer&&t.logarithmicDepthBuffer!=="auto"&&(i.logarithmicDepthBuffer=t.logarithmicDepthBuffer==="true"),t.alpha&&(i.alpha=t.alpha==="true"),t.stencil&&(i.stencil=t.stencil==="true"),t.multiviewStereo&&(i.multiviewStereo=t.multiviewStereo==="true"),this.maxCanvasSize={width:t.maxCanvasWidth?parseInt(t.maxCanvasWidth):this.maxCanvasSize.width,height:t.maxCanvasHeight?parseInt(t.maxCanvasHeight):this.maxCanvasSize.height});var s=["WebGLRenderer","WebGPURenderer"].find(function(o){return E[o]});(e=this.renderer=new E[s](i)).xr.setPoseTarget||(e.xr.setPoseTarget=function(){}),e.setPixelRatio(window.devicePixelRatio),this.camera&&e.xr.setPoseTarget(this.camera.el.object3D),this.addEventListener("camera-set-active",function(){e.xr.setPoseTarget(r.camera.el.object3D)})}play(){var e=this,t=this;this.renderStarted?zt.prototype.play.call(this):(this.addEventListener("loaded",function(){var i=this.renderer;zt.prototype.play.call(this),t.renderStarted||(t.resize(),t.renderer&&(window.performance&&window.performance.mark("render-started"),window.removeEventListener("resize",qu),ji&&(ji.style.display="none"),i.setAnimationLoop(this.render),t.renderStarted=!0,t.emit("renderstart")))}),setTimeout(function(){zt.prototype.load.call(e)}))}updateComponent(e){e in Si||zt.prototype.updateComponent.apply(this,arguments)}tick(e,t){var i,r=this.systems;for(this.callComponentBehaviors("tick",e,t),i=0;i<this.systemNames.length;i++)r[this.systemNames[i]].tick&&r[this.systemNames[i]].tick(e,t)}tock(e,t,i){var r,s=this.systems;for(this.callComponentBehaviors("tock",e,t),r=0;r<this.systemNames.length;r++)s[this.systemNames[r]].tock&&s[this.systemNames[r]].tock(e,t,i)}render(e,t){var i=this.renderer;this.frame=t,this.delta=1e3*this.clock.getDelta(),this.time=1e3*this.clock.elapsedTime,this.isPlaying&&this.tick(this.time,this.delta);var r=null;if(this.is("ar-mode")&&(r=this.object3D.background,this.object3D.background=null),i.render(this.object3D,this.camera),r&&(this.object3D.background=r),this.isPlaying){var s=i.xr.isPresenting?i.xr.getCamera():this.camera;this.tock(this.time,this.delta,s)}}callComponentBehaviors(e,t,i){for(var r,s=0;s<this.componentOrder.length;s++){var o=this.behaviors[this.componentOrder[s]];if(o){var a=o[e];for(a.inUse=!0,r=0;r<a.array.length;r++)a.array[r].isPlaying&&a.array[r][e](t,i);for(a.inUse=!1,r=0;r<a.markedForRemoval.length;r++)this.removeBehavior(a.markedForRemoval[r]);a.markedForRemoval.length=0}}}}function gg(n,e){var t,i,r={},s=e||[];for(i in s.length=0,n){var o=n[i];if(o!==void 0){var a=o.before?o.before.slice(0):[],l=o.after?o.after.slice(0):[];r[i]={before:a,after:l,visited:!1,done:!1}}}for(i in r)for(t=0;t<r[i].before.length;t++){var c=r[i].before[t];c in r?r[c].after.push(i):ed("Invalid ordering constraint, no component named `"+c+"` referenced by `"+i+"`")}function h(u){if(u in r&&!r[u].done)if(r[u].visited)ed("Cycle detected, ignoring one or more before/after constraints. The resulting order might be incorrect");else{r[u].visited=!0;for(var d=0;d<r[u].after.length;d++){var f=r[u].after[d];f in r||ed("Invalid before/after constraint, no component named `"+f+"` referenced in `"+u+"`"),h(f)}r[u].done=!0,s.push(u)}}for(i in r)r[i].done||h(i);return s}function vg(n,e){var t,i=window.devicePixelRatio;return!e||e.width===-1&&e.height===-1||n.width*i<e.width&&n.height*i<e.height||(t=n.width/n.height,n.width*i>e.width&&e.width!==-1&&(n.width=Math.round(e.width/i),n.height=Math.round(e.width/t/i)),n.height*i>e.height&&e.height!==-1&&(n.height=Math.round(e.height/i),n.width=Math.round(e.height*t/i))),n}function yg(n,e,t,i){return n.parentElement?e?vg({height:n.parentElement.offsetHeight,width:n.parentElement.offsetWidth},t):function(r,s){var o;return o={height:document.body.offsetHeight,width:document.body.offsetWidth},s?o:vg(o,r)}(t,i):{height:0,width:0}}customElements.define("a-scene",ex);var PT=ga,sr={},Hp=[],bf=function(){};function fn(n,e){var t,i={};if(Object.keys(e).forEach(function(r){i[r]={value:e[r],writable:!0}}),sr[n])throw new Error("The geometry `"+n+"` has been already registered");return((t=function(){bf.call(this)}).prototype=Object.create(bf.prototype,i)).name=n,t.prototype.constructor=t,sr[n]={Geometry:t,schema:PT(t.prototype.schema)},Hp.push(n),t}bf.prototype={schema:{},init:function(n){return this.geometry=new E.BufferGeometry,this.geometry},update:function(n){}};var Vp=vt,UT=Dp,FT=Vp("extras:primitives:debug"),Eg=Vp("extras:primitives:warn"),OT=Vp("extras:primitives:error"),tx={};function hn(n,e){if(n=n.toLowerCase(),!xf[n]){xf[n]=!0,FT("Registering <%s>",n),e.defaultAttributes&&Eg("The 'defaultAttributes' object is deprecated. Use 'defaultComponents' instead.");var t=e.mappings||{},i=class extends zt{constructor(){super(),this.defaultComponentsFromPrimitive=e.defaultComponents||e.defaultAttributes||{},this.deprecated=e.deprecated||null,this.deprecatedMappings=e.deprecatedMappings||{},this.mappings=t,e.deprecated&&console.warn(e.deprecated),this.resolveMappingCollisions()}resolveMappingCollisions(){var r=this.mappings,s=this;Object.keys(r).forEach(function(o){var a;o!==o.toLowerCase()&&Eg("Mapping keys should be specified in lower case. The mapping key "+o+" may not be recognized"),Pt[o]&&(a=r[o].replace(".","-"),r[a]=r[o],delete r[o],console.warn("The primitive "+s.tagName.toLowerCase()+" has a mapping collision. The attribute "+o+" has the same name as a registered component and has been renamed to "+a))})}getExtraComponents(){var r,s,o,a,l,c=this;for(s=Np(this.defaultComponentsFromPrimitive),(l=this.getAttribute("mixin"))&&(l=Di(l.trim(),/\s+/)).forEach(function(f){var A,g,m=document.getElementById(f);if(m){var p=m.rawAttributeCache,v=m.componentCache;for(var y in p){if(a=c.mappings[y])return void xg(a,p[y],s);y in v&&(s[y]=(A=s[y],g=v[y],h(A)?u(g):h(g)?u(A):d(A)&&d(g)?Bn(A,g):u(g)))}}}),o=0;o<this.attributes.length;o++)r=this.attributes[o],(a=this.mappings[r.name])&&xg(a,r.value,s);return s;function h(f){return f===void 0}function u(f){return d(f)?Bn({},f):f}function d(f){return f!==null&&f.constructor===Object}}attributeChangedCallback(r,s,o){var a=this.mappings[r];r in this.deprecatedMappings&&console.warn(this.deprecatedMappings[r]),r&&a?UT(this,a,o):super.attributeChangedCallback(r,s,o)}};return customElements.define(n,i),i.mappings=t,tx[n]=i,i}OT("Trying to register primitive "+n+" that has been already previously registered")}function xg(n,e,t){var i=Ph(n);i.constructor===Array?(t[i[0]]=t[i[0]]||{},t[i[0]][i[1]]=e.trim()):t[i]=e.trim()}var ai={},nx=[],kT={array:"v3",color:"v3",int:"i",number:"f",map:"t",time:"f",vec2:"v2",vec3:"v3",vec4:"v4"},Cf=function(){};function Ji(n,e){var t,i={};if(Object.keys(e).forEach(function(r){i[r]={value:e[r],writable:!0}}),ai[n])throw new Error("The shader "+n+" has already been registered");return((t=function(){Cf.call(this)}).prototype=Object.create(Cf.prototype,i)).name=n,t.prototype.constructor=t,ai[n]={Shader:t,schema:ga(t.prototype.schema)},nx.push(n),t}Cf.prototype={schema:{},vertexShader:"void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);}",fragmentShader:"void main() {gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);}",init:function(n){return this.uniforms=this.initUniforms(),this.material=new(this.raw?E.RawShaderMaterial:E.ShaderMaterial)({uniforms:this.uniforms,glslVersion:this.raw||this.glsl3?E.GLSL3:null,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader}),this.material},initUniforms:function(){var n,e,t=this.schema,i={};for(n in t)t[n].is==="uniform"&&(e=kT[t[n].type],i[n]={type:e,value:void 0});return i},update:function(n){var e,t,i=this.schema,r=this.uniforms;for(e in n)if(i[e]&&i[e].is==="uniform")if(i[e].type!=="map")r[e].value=this.parseValue(i[e].type,n[e]),r[e].needsUpdate=!0;else{if(!r[e]||r[e].value===n[e])continue;t="_texture_"+e,this.setMapOnTextureLoad(r,e,t),Uh(t,e,this,n)}},parseValue:function(n,e){var t;switch(n){case"vec2":return new E.Vector2(e.x,e.y);case"vec3":return new E.Vector3(e.x,e.y,e.z);case"vec4":return new E.Vector4(e.x,e.y,e.z,e.w);case"color":return t=new E.Color(e),new E.Vector3(t.r,t.g,t.b);default:return e}},setMapOnTextureLoad:function(n,e,t){var i=this;this.el.addEventListener("materialtextureloaded",function(){n[e].value=i.material[t],n[e].needsUpdate=!0})}};var td=new E.FileLoader,wf=vt("core:a-assets:warn");function NT(n){if(n.hasAttribute("autoplay")||n.getAttribute("preload")==="auto")return new Promise(function(e,t){if(n.readyState===4)return e();if(n.error)return t();function i(){for(var r=0,s=0;s<n.buffered.length;s++)r+=n.buffered.end(s)-n.buffered.start(s);r>=n.duration&&(n.tagName==="VIDEO"&&E.Cache.add(n.getAttribute("src"),n),e())}n.addEventListener("loadeddata",i,!1),n.addEventListener("progress",i,!1),n.addEventListener("error",t,!1)})}function bg(n){var e=function(t){var i,r,s;return t.hasAttribute("crossorigin")||(i=t.getAttribute("src"))!==null&&(i.indexOf("://")===-1||(s=(r=i).indexOf("://")>-1?r.split("/")[2]:r.split("/")[0]).substring(0,s.indexOf(":"))===window.location.host)?t:(wf('Cross-origin element (e.g., <img>) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., <img crossorigin="anonymous">)',i),t.crossOrigin="anonymous",t.cloneNode(!0))}(n);return e.tagName&&e.tagName.toLowerCase()==="video"&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")),e!==n&&(n.parentNode.appendChild(e),n.parentNode.removeChild(n)),e}customElements.define("a-assets",class extends Jt{constructor(){super(),this.isAssets=!0,this.fileLoader=td,this.timeout=null}doConnectedCallback(){var n,e,t,i,r,s,o=this,a=[];if(super.doConnectedCallback(),!this.parentNode.isScene)throw new Error("<a-assets> must be a child of a <a-scene>.");for(r=this.querySelectorAll("img"),n=0;n<r.length;n++)i=bg(r[n]),a.push(new Promise(function(l,c){E.Cache.add(r[n].getAttribute("src"),i),i.complete?l():(i.onload=l,i.onerror=c)}));for(t=this.querySelectorAll("audio, video"),n=0;n<t.length;n++)(e=bg(t[n])).src||e.srcObject||wf("Audio/video asset has neither `src` nor `srcObject` attributes."),a.push(NT(e));this.getChildren().forEach(function(l){l.isAssetItem&&l.hasAttribute("src")&&a.push(new Promise(function(c,h){if(l.hasLoaded)return c();l.addEventListener("loaded",c),l.addEventListener("error",h)}))}),Promise.allSettled(a).then(function(){o.timeout!==null&&o.load()}),s=parseInt(this.getAttribute("timeout"),10)||3e3,this.timeout=setTimeout(function(){o.hasLoaded||(wf("Asset loading timed out in",s,"ms"),o.timeout=null,o.emit("timeout"),o.load())},s)}disconnectedCallback(){super.disconnectedCallback(),this.timeout&&clearTimeout(this.timeout)}load(){super.load.call(this,null,function(){return!1})}}),customElements.define("a-asset-item",class extends Jt{constructor(){super(),this.data=null,this.isAssetItem=!0}connectedCallback(){var n=this,e=this.getAttribute("src");td.setResponseType(this.getAttribute("response-type")||function(t){var i=function(s){var o=document.createElement("a");o.href=s;var a=o.search.replace(/^\?/,""),l=s.replace(a,"").replace("?","");return l.substring(l.lastIndexOf("/")+1)}(t),r=i.lastIndexOf(".");return r>=0&&i.slice(r,t.search(/\?|#|$/))===".glb"?"arraybuffer":"text"}(e)),td.load(e,function(t){n.data=t,Jt.prototype.load.call(n)},function(t){n.emit("progress",{loadedBytes:t.loaded,totalBytes:t.total,xhr:t})},function(t){n.emit("error",{xhr:t},!1)})}});var QT=vt("core:cubemap:warn");class Wp extends HTMLElement{constructor(e){return super(e)}onReadyStateChange(){document.readyState==="complete"&&this.doConnectedCallback()}connectedCallback(){document.readyState==="complete"?Wp.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){this.srcs=this.validate()}validate(){var e,t=this.querySelectorAll("[src]"),i=[];if(t.length===6){for(e=0;e<t.length;e++)t[e].tagName==="IMG"?i.push(t[e]):i.push(t[e].getAttribute("src"));return i}QT("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",Wp),customElements.define("a-mixin",class extends Jt{constructor(){super(),this.componentCache={},this.rawAttributeCache={},this.isMixin=!0}doConnectedCallback(){super.doConnectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(n,e,t){super.attributeChangedCallback(),this.cacheAttribute(n,t),this.updateEntities()}setAttribute(n,e){window.HTMLElement.prototype.setAttribute.call(this,n,e),this.cacheAttribute(n,e)}cacheAttribute(n,e){var t,i;i=Di(n,"__")[0],t=Pt[i],e===void 0&&(e=window.HTMLElement.prototype.getAttribute.call(this,n)),this.rawAttributeCache[n]=e,t&&(this.componentCache[n]=this.parseComponentAttrValue(t,e))}parseComponentAttrValue(n,e){var t;return typeof e!="string"?e:(n.isSingleProperty?typeof(t=n.schema.parse(e))=="string"&&(t=e):t=ia(e),t)}getAttribute(n){return this.componentCache[n]||window.HTMLElement.prototype.getAttribute.call(this,n)}cacheAttributes(){var n,e,t=this.attributes;for(e=0;e<t.length;e++)n=t[e].name,this.cacheAttribute(n)}updateEntities(){var n,e,t;if(this.sceneEl)for(e=this.sceneEl.querySelectorAll("[mixin~="+this.id+"]"),t=0;t<e.length;t++)(n=e[t]).hasLoaded&&!n.isMixin&&n.mixinUpdate(this.id)}});const ix="1.7.0";var ml=new E.Color,gl=new E.Color,Cg=UE,wg=Dp,nd={},rx="color",_g="rotation",sx="components";function Mg(n){n.x=E.MathUtils.degToRad(n.x),n.y=E.MathUtils.degToRad(n.y),n.z=E.MathUtils.degToRad(n.z)}function id(n,e,t){var i;for(i=0;i<e.length;i++)n.addEventListener(e[i],t)}function rd(n,e,t){var i;for(i=0;i<e.length;i++)n.removeEventListener(e[i],t)}function Sg(n,e){var t,i,r;for(i=Kc(e),r=n,t=0;t<i.length;t++)r=r[i[t]];if(r===void 0)throw console.log(n),new Error("[animation] property ("+e+") could not be found");return r}function Ig(n,e,t,i){var r,s,o,a;for(e.startsWith("object3D.rotation")&&(t=E.MathUtils.degToRad(t)),s=Kc(e),a=n,r=0;r<s.length-1;r++)a=a[s[r]];o=s[s.length-1],i!==rx?a[o]=t:"r"in a[o]?(a[o].r=t.r,a[o].g=t.g,a[o].b=t.b):(a[o].x=t.r,a[o].y=t.g,a[o].z=t.b)}function Kc(n){return n in nd||(nd[n]=n.split(".")),nd[n]}function sd(n){return n.isRawProperty||n.property.startsWith(sx)||n.property.startsWith("object3D")}Ge("animation",{schema:{autoplay:{default:!0},delay:{default:0},dir:{default:""},dur:{default:1e3},easing:{default:"easeInQuad"},elasticity:{default:400},enabled:{default:!0},from:{default:""},loop:{default:0,parse:function(n){return n===!0||n==="true"||n!==!1&&n!=="false"&&parseInt(n,10)}},property:{default:""},startEvents:{type:"array"},pauseEvents:{type:"array"},resumeEvents:{type:"array"},round:{default:!1},to:{default:""},type:{default:""},isRawProperty:{default:!1}},multiple:!0,init:function(){var n=this;this.eventDetail={name:this.attrName},this.time=0,this.animation=null,this.animationIsPlaying=!1,this.onStartEvent=this.onStartEvent.bind(this),this.beginAnimation=this.beginAnimation.bind(this),this.pauseAnimation=this.pauseAnimation.bind(this),this.resumeAnimation=this.resumeAnimation.bind(this),this.fromColor={},this.toColor={},this.targets={},this.targetsArray=[],this.updateConfigForDefault=this.updateConfigForDefault.bind(this),this.updateConfigForRawColor=this.updateConfigForRawColor.bind(this),this.config={complete:function(){n.animationIsPlaying=!1,n.el.emit("animationcomplete",n.eventDetail,!1),n.id&&n.el.emit("animationcomplete__"+n.id,n.eventDetail,!1)}}},update:function(n){var e=this.config,t=this.data;this.animationIsPlaying=!1,this.data.enabled&&t.property&&(e.autoplay=!1,e.direction=t.dir,e.duration=t.dur,e.easing=t.easing,e.elasticity=t.elasticity,e.loop=t.loop,e.round=t.round,this.createAndStartAnimation())},tick:function(n,e){this.animationIsPlaying&&(this.time+=e,this.animation.tick(this.time))},remove:function(){this.pauseAnimation(),this.removeEventListeners()},pause:function(){this.paused=!0,this.pausedWasPlaying=this.animationIsPlaying,this.pauseAnimation(),this.removeEventListeners()},play:function(){this.paused&&(this.paused=!1,this.addEventListeners(),this.pausedWasPlaying&&(this.resumeAnimation(),this.pausedWasPlaying=!1))},createAndStartAnimation:function(){var n=this.data;this.updateConfig(),this.animationIsPlaying=!1,this.animation=Vl(this.config),this.animation.began=!0,this.removeEventListeners(),this.addEventListeners(),!n.autoplay||n.startEvents&&n.startEvents.length||(n.delay?setTimeout(this.beginAnimation,n.delay):this.beginAnimation())},beginAnimation:function(){this.updateConfig(),this.animation.began=!0,this.time=0,this.animationIsPlaying=!0,this.stopRelatedAnimations(),this.el.emit("animationbegin",this.eventDetail,!1)},pauseAnimation:function(){this.animationIsPlaying=!1},resumeAnimation:function(){this.animationIsPlaying=!0},onStartEvent:function(){this.data.enabled&&(this.updateConfig(),this.animation&&this.animation.pause(),this.animation=Vl(this.config),this.data.delay?setTimeout(this.beginAnimation,this.data.delay):this.beginAnimation())},updateConfigForRawColor:function(){var n,e,t,i=this.config,r=this.data,s=this.el;if(!this.waitComponentInitRawProperty(this.updateConfigForRawColor)){for(e in n=r.from===""?Sg(s,r.property):r.from,t=r.to,this.setColorConfig(n,t),n=this.fromColor,t=this.toColor,this.targetsArray.length=0,this.targetsArray.push(n),i.targets=this.targetsArray,t)i[e]=t[e];var o;i.update=(o={},function(a){var l;(l=a.animatables[0].target).r===o.r&&l.g===o.g&&l.b===o.b||Ig(s,r.property,l,r.type)})}},updateConfigForDefault:function(){var n,e,t,i,r=this.config,s=this.data,o=this.el;this.waitComponentInitRawProperty(this.updateConfigForDefault)||(n=s.from===""?sd(s)?Sg(o,s.property):Cg(o,s.property):s.from,t=s.to,isNaN(n||t)?(n=n&&n.toString(),t=t&&t.toString()):(n=parseFloat(n),t=parseFloat(t)),(e=s.to==="true"||s.to==="false"||s.to===!0||s.to===!1)&&(n=s.from==="true"||s.from===!0?1:0,t=s.to==="true"||s.to===!0?1:0),this.targets.aframeProperty=n,r.targets=this.targets,r.aframeProperty=t,r.update=function(a){var l;(l=a.animatables[0].target.aframeProperty)!==i&&(i=l,e&&(l=l>=1),sd(s)?Ig(o,s.property,l,s.type):wg(o,s.property,l))})},updateConfigForVector:function(){var n,e,t,i,r=this.config,s=this.data,o=this.el,a=Kc(s.property),l=a[0]==="object3D"?a[1]:a[0];for(n in e=s.from!==""?zc(s.from):Cg(o,l),t=zc(s.to),l===_g&&(Mg(e),Mg(t)),this.targetsArray.length=0,this.targetsArray.push(e),r.targets=this.targetsArray,t)r[n]=t[n];r.update=l!=="position"&&l!==_g&&l!=="scale"?function(){var c={};return function(h){var u=h.animatables[0].target;u.x===c.x&&u.y===c.y&&u.z===c.z||(c.x=u.x,c.y=u.y,c.z=u.z,wg(o,s.property,u))}}():(i={},function(c){var h=c.animatables[0].target;h.x===i.x&&h.y===i.y&&h.z===i.z||(i.x=h.x,i.y=h.y,i.z=h.z,o.object3D[l].set(h.x,h.y,h.z))})},updateConfig:function(){var n;n=function(e,t){var i,r,s,o;return(s=t.split("."))[0]!=="object3D"||s[2]||s[1]!=="position"&&s[1]!=="rotation"&&s[1]!=="scale"?(r=s[0],o=s[1],(i=e.components[r]||Pt[r])?o&&!i.schema[o]?null:o?i.schema[o].type:i.schema.type:null):"vec3"}(this.el,this.data.property),sd(this.data)&&this.data.type===rx?this.updateConfigForRawColor():n==="vec2"||n==="vec3"||n==="vec4"?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(n){var e,t=this.data,i=this.el,r=this;return t.from===""&&!!t.property.startsWith(sx)&&(e=Kc(t.property)[1],!i.components[e]&&(i.addEventListener("componentinitialized",function s(o){o.detail.name===e&&(n(),r.animation=Vl(r.config),i.removeEventListener("componentinitialized",s))}),!0))},stopRelatedAnimations:function(){var n,e;for(e in this.el.components)n=this.el.components[e],e!==this.attrName&&n.name==="animation"&&n.animationIsPlaying&&n.data.property===this.data.property&&(n.animationIsPlaying=!1)},addEventListeners:function(){var n=this.data,e=this.el;id(e,n.startEvents,this.onStartEvent),id(e,n.pauseEvents,this.pauseAnimation),id(e,n.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var n=this.data,e=this.el;rd(e,n.startEvents,this.onStartEvent),rd(e,n.pauseEvents,this.pauseAnimation),rd(e,n.resumeEvents,this.resumeAnimation)},setColorConfig:function(n,e){ml.set(n),gl.set(e),n=this.fromColor,e=this.toColor,n.r=ml.r,n.g=ml.g,n.b=ml.b,e.r=gl.r,e.g=gl.g,e.b=gl.b}});var od=vt("components:anchored:warn");Ge("anchored",{schema:{persistent:{default:!1}},init:function(){var n=this.el.sceneEl.getAttribute("webxr"),e=n.optionalFeatures;e.indexOf("anchors")===-1&&(e.push("anchors"),this.el.sceneEl.setAttribute("webxr",n)),this.auxQuaternion=new E.Quaternion,this.onEnterVR=this.onEnterVR.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR)},onEnterVR:function(){this.anchor=void 0,this.requestPersistentAnchorPending=this.data.persistent,this.requestAnchorPending=!this.data.persistent},tick:function(){var n,e,t,i=this.el.sceneEl,r=i.renderer.xr,s=this.el.object3D;(i.is("ar-mode")||i.is("vr-mode"))&&(!this.anchor&&this.requestPersistentAnchorPending&&this.restorePersistentAnchor(),!this.anchor&&this.requestAnchorPending&&this.createAnchor(),this.anchor&&(n=i.frame,e=r.getReferenceSpace(),t=n.getPose(this.anchor.anchorSpace,e),s.position.copy(t.transform.position),s.quaternion.copy(t.transform.orientation)))},createAnchor:async function(n,e){var t,i,r,s,o=this.el.sceneEl,a=o.renderer.xr,l=this.el.object3D;n=n||l.position,e=e||this.auxQuaternion.setFromEuler(l.rotation),function(c){var h=c.renderer.xr.getSession();return h&&h.restorePersistentAnchor}(o)?(this.anchor&&this.deleteAnchor(),t=o.frame,i=a.getReferenceSpace(),r=new XRRigidTransform({x:n.x,y:n.y,z:n.z},{x:e.x,y:e.y,z:e.z,w:e.w}),this.requestAnchorPending=!1,s=await t.createAnchor(r,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await s.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):od("The anchor won't be persisted because the entity has no assigned id.")),o.object3D.attach(this.el.object3D),this.anchor=s):od("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var n,e=this.el.sceneEl.renderer.xr.getSession(),t=e.persistentAnchors;if(this.requestPersistentAnchorPending=!1,!this.el.id)return od("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."),void(this.requestAnchorPending=!0);if(t){n=localStorage.getItem(this.el.id);for(var i=0;i<t.length;++i)if(n===t[i]){this.anchor=await e.restorePersistentAnchor(t[i]),this.anchor&&(this.persistentHandle=t[i]);break}this.anchor||(this.requestAnchorPending=!0)}else this.requestPersistentAnchorPending=!0},deleteAnchor:function(){var n,e=this.anchor;e&&(n=this.el.sceneEl.renderer.xr.getSession(),e.delete(),this.el.sceneEl.object3D.add(this.el.object3D),this.persistentHandle&&n.deletePersistentAnchor(this.persistentHandle),this.anchor=void 0)}}),Ge("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var n,e=this.el;n=this.camera=new E.PerspectiveCamera,e.setObject3D("camera",n)},update:function(n){var e=this.data,t=this.camera;t.aspect=e.aspect||window.innerWidth/window.innerHeight,t.far=e.far,t.fov=e.fov,t.near=e.near,t.zoom=e.zoom,t.updateProjectionMatrix(),this.updateActiveCamera(n),this.updateSpectatorCamera(n)},updateActiveCamera:function(n){var e=this.data,t=this.el,i=this.system;n&&n.active===e.active||e.spectator||(e.active&&i.activeCameraEl!==t?i.setActiveCamera(t):e.active||i.activeCameraEl!==t||i.disableActiveCamera())},updateSpectatorCamera:function(n){var e=this.data,t=this.el,i=this.system;n&&n.spectator===e.spectator||(e.spectator&&i.spectatorCameraEl!==t?i.setSpectatorCamera(t):e.spectator||i.spectatorCameraEl!==t||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}});var Xi,Tr,Yi,Bg,Tg="click",Rg="mouseup",vl="cursor-fusing",ad="cursor-hovering",ld="cursor-hovered",yl={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},El={DOWN:["selectstart"],UP:["selectend"]},Lg="a-mouse-cursor-hover",GT=(Ge("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:rr()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},after:["tracked-controls"],multiple:!0,init:function(){var n=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=zE(function(){n.canvasBounds=n.el.sceneEl.canvas.getBoundingClientRect()},500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=this.onCursorDown.bind(this),this.onCursorUp=this.onCursorUp.bind(this),this.onIntersection=this.onIntersection.bind(this),this.onIntersectionCleared=this.onIntersectionCleared.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},update:function(n){var e=this.data.rayOrigin;e!==n.rayOrigin&&(e==="entity"&&this.resetRaycaster(),this.updateMouseEventListeners(),e!=="xrselect"&&e!=="entity"||this.addWebXREventListeners(),n.rayOrigin!=="xrselect"&&n.rayOrigin!=="entity"||this.removeWebXREventListeners())},tick:function(){var n=this.el.sceneEl.frame,e=this.activeXRInput;this.data.rayOrigin==="xrselect"&&n&&e&&this.onMouseMove({frame:n,inputSource:e,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var n=this.el;n.removeState(ad),n.removeState(vl),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(ld),this.removeEventListeners()},addEventListeners:function(){var n,e=this.data,t=this.el,i=this;function r(){n=t.sceneEl.canvas,e.downEvents.length||e.upEvents.length||(yl.DOWN.forEach(function(s){n.addEventListener(s,i.onCursorDown,{passive:!1})}),yl.UP.forEach(function(s){n.addEventListener(s,i.onCursorUp,{passive:!1})}))}(n=t.sceneEl.canvas)?r():t.sceneEl.addEventListener("render-target-loaded",r),e.downEvents.forEach(function(s){t.addEventListener(s,i.onCursorDown)}),e.upEvents.forEach(function(s){t.addEventListener(s,i.onCursorUp)}),t.addEventListener("raycaster-intersection",this.onIntersection),t.addEventListener("raycaster-closest-entity-changed",this.onIntersection),t.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),t.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),t.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var n,e=this.data,t=this.el,i=this;!(n=t.sceneEl.canvas)||e.downEvents.length||e.upEvents.length||(yl.DOWN.forEach(function(r){n.removeEventListener(r,i.onCursorDown)}),yl.UP.forEach(function(r){n.removeEventListener(r,i.onCursorUp)})),e.downEvents.forEach(function(r){t.removeEventListener(r,i.onCursorDown)}),e.upEvents.forEach(function(r){t.removeEventListener(r,i.onCursorUp)}),t.removeEventListener("raycaster-intersection",this.onIntersection),t.removeEventListener("raycaster-closest-entity-changed",this.onIntersection),t.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.removeEventListener("mousemove",this.onMouseMove),n.removeEventListener("touchstart",this.onMouseMove),n.removeEventListener("touchmove",this.onMouseMove),t.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),t.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds),this.removeWebXREventListeners()},updateMouseEventListeners:function(){var n,e=this.el;(n=e.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),n.removeEventListener("touchmove",this.onMouseMove),e.setAttribute("raycaster","useWorldCoordinates",!1),this.data.rayOrigin==="mouse"&&(n.addEventListener("mousemove",this.onMouseMove),n.addEventListener("touchmove",this.onMouseMove,{passive:!1}),e.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},resetRaycaster:function(){this.el.setAttribute("raycaster",{direction:new E.Vector3().set(0,0,-1),origin:new E.Vector3})},addWebXREventListeners:function(){var n=this,e=this.el.sceneEl.xrSession;e&&(El.DOWN.forEach(function(t){e.addEventListener(t,n.onCursorDown)}),El.UP.forEach(function(t){e.addEventListener(t,n.onCursorUp)}))},removeWebXREventListeners:function(){var n=this,e=this.el.sceneEl.xrSession;e&&(El.DOWN.forEach(function(t){e.removeEventListener(t,n.onCursorDown)}),El.UP.forEach(function(t){e.removeEventListener(t,n.onCursorUp)}))},onMouseMove:(Xi=new E.Vector3,Tr=new E.Vector2,Yi=new E.Vector3,Bg={origin:Yi,direction:Xi},function(n){var e,t,i,r,s,o,a,l,c,h=this.canvasBounds,u=this.el.sceneEl.camera;u.parent.updateMatrixWorld(),t=(i=n.type==="touchmove"||n.type==="touchstart"?n.touches.item(0):n).clientX-h.left,r=i.clientY-h.top,Tr.x=t/h.width*2-1,Tr.y=-r/h.height*2+1,this.data.rayOrigin!=="xrselect"||n.type!=="selectstart"&&n.type!=="fakeselectevent"?n.type==="fakeselectout"?(Xi.set(0,1,0),Yi.set(0,9999,0)):u&&u.isPerspectiveCamera?(Yi.setFromMatrixPosition(u.matrixWorld),Xi.set(Tr.x,Tr.y,.5).unproject(u).sub(Yi).normalize()):u&&u.isOrthographicCamera?(Yi.set(Tr.x,Tr.y,(u.near+u.far)/(u.near-u.far)).unproject(u),Xi.set(0,0,-1).transformDirection(u.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+u.type):(s=n.frame,o=n.inputSource,a=this.el.sceneEl.renderer.xr.getReferenceSpace(),(l=s.getPose(o.targetRaySpace,a))&&(c=l.transform,Xi.set(0,0,-1),Xi.applyQuaternion(c.orientation),Yi.copy(c.position),(e=u.el.object3D.parent).localToWorld(Yi),Xi.transformDirection(e.matrixWorld))),this.el.setAttribute("raycaster",Bg),n.type==="touchmove"&&n.preventDefault()}),onCursorDown:function(n){this.isCursorDown=!0,this.data.rayOrigin==="mouse"&&n.type==="touchstart"&&(this.onMouseMove(n),this.el.components.raycaster.checkIntersections(),n.preventDefault()),this.data.rayOrigin==="xrselect"&&n.type==="selectstart"&&(this.activeXRInput=n.inputSource,this.onMouseMove(n),this.el.components.raycaster.checkIntersections(),this.el.components.raycaster.intersectedEls.length&&this.el.sceneEl.components["ar-hit-test"]!==void 0&&this.el.sceneEl.getAttribute("ar-hit-test").enabled&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!1),this.reenableARHitTest=!0)),this.twoWayEmit("mousedown",n),this.cursorDownEl=this.intersectedEl},onCursorUp:function(n){if(this.isCursorDown&&(this.data.rayOrigin!=="xrselect"||this.activeXRInput===n.inputSource)){this.isCursorDown=!1;var e=this.data;this.twoWayEmit(Rg,n),this.reenableARHitTest===!0&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!0),this.reenableARHitTest=void 0),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(Rg,this.intersectedEventDetail)),e.fuse&&e.rayOrigin!=="mouse"&&e.rayOrigin!=="xrselect"||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(Tg,n),e.rayOrigin==="xrselect"&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,n.type==="touchend"&&n.preventDefault()}},onIntersection:function(n){var e,t,i,r,s=this.el;t=n.detail.els[0]===s?1:0,r=n.detail.intersections[t],(i=n.detail.els[t])&&this.intersectedEl!==i&&(this.intersectedEl&&(e=this.el.components.raycaster.getIntersection(this.intersectedEl))&&e.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(n){n.detail.clearedEls.indexOf(this.intersectedEl)!==-1&&this.clearCurrentIntersection()},onEnterVR:function(){var n=this.data.rayOrigin;this.clearCurrentIntersection(!0),n!=="xrselect"&&n!=="entity"||this.addWebXREventListeners()},setIntersection:function(n,e){var t=this.el,i=this.data,r=this;this.intersectedEl!==n&&(this.intersectedEl=n,t.addState(ad),n.addState(ld),this.twoWayEmit("mouseenter"),this.data.mouseCursorStylesEnabled&&this.data.rayOrigin==="mouse"&&this.el.sceneEl.canvas.classList.add(Lg),i.fuseTimeout!==0&&i.fuse&&i.rayOrigin!=="xrselect"&&i.rayOrigin!=="mouse"&&(t.addState(vl),this.twoWayEmit("fusing"),this.fuseTimeout=setTimeout(function(){t.removeState(vl),r.twoWayEmit(Tg)},i.fuseTimeout)))},clearCurrentIntersection:function(n){var e,t,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(ld),i.removeState(ad),i.removeState(vl),this.twoWayEmit("mouseleave"),this.data.mouseCursorStylesEnabled&&this.data.rayOrigin==="mouse"&&this.el.sceneEl.canvas.classList.remove(Lg),this.intersectedEl=null,clearTimeout(this.fuseTimeout),n!==!0&&(t=this.el.components.raycaster.intersections).length!==0&&(e=t[t[0].object.el===i?1:0])&&this.setIntersection(e.object.el,e))},twoWayEmit:function(n,e){var t,i=this.el,r=this.intersectedEl;function s(o,a){e instanceof MouseEvent?o.mouseEvent=e:typeof TouchEvent<"u"&&e instanceof TouchEvent&&(o.touchEvent=e)}t=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=t,s(this.eventDetail),i.emit(n,this.eventDetail),r&&(this.intersectedEventDetail.intersection=t,s(this.intersectedEventDetail),r.emit(n,this.intersectedEventDetail))}}),new E.BufferGeometry),Dg=(Ge("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:Hp,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(n){var e,t=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(n),this.geometry=null),this.geometry=r.getOrCreateGeometry(t),(e=i.getObject3D("mesh"))?e.geometry=this.geometry:((e=new E.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(e.material=new E.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",e))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=GT,this.geometry=null},updateSchema:function(n){var e=this.oldData&&this.oldData.primitive,t=n.primitive,i=sr[t]&&sr[t].schema;if(!i)throw new Error("Unknown geometry schema `"+t+"`");e&&e===t||this.extendSchema(i)}}),"generic"),zT=(Ge("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},disabled:{default:!1}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var n=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){Ze(e.detail.id,"down",n)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.bindMethods(),this.el.addEventListener("controllerconnected",function(e){e.detail.name!==n.name&&(n.wasControllerConnected=!0,n.removeEventListeners(),n.removeControllersUpdateListener())})},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var n=this.data,e=n.hand?n.hand:void 0;Dn(this,Dg,{hand:e,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var n=this.el,e=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(n.setAttribute("tracked-controls",{hand:e.hand,idPrefix:Dg,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.wasControllerConnected&&this.checkIfControllerPresent()},onButtonChanged:function(n){var e=this.mapping.buttons[n.detail.id];e&&this.el.emit(e+"changed",n.detail.state)},onAxisMoved:function(n){Nn(this,this.mapping.axes,n)},initDefaultModel:function(){var n=this.modelEl=document.createElement("a-entity");n.setAttribute("geometry",{primitive:"sphere",radius:.03}),n.setAttribute("material",{color:this.data.color}),this.el.appendChild(n),this.el.emit("controllermodelready",{name:"generic-tracked-controller-controls",model:this.modelEl,rayOrigin:{origin:{x:0,y:0,z:-.01},direction:{x:0,y:0,z:-1}}})}}),vt("components:gltf-model:warn"));Ge("gltf-model",{schema:{type:"model"},init:function(){var n=this,e=this.system.getDRACOLoader(),t=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new bp,e&&this.loader.setDRACOLoader(e),this.ready=t?t.then(function(r){n.loader.setMeshoptDecoder(r)}):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var n=this,e=this.el,t=this.data;t&&(this.remove(),this.ready.then(function(){n.loader.load(t,function(i){n.model=i.scene||i.scenes[0],n.model.animations=i.animations,e.setObject3D("mesh",n.model),e.emit("model-loaded",{format:"gltf",model:n.model})},void 0,function(i){var r=i&&i.message?i.message:"Failed to load glTF model";zT(r),e.emit("model-error",{format:"gltf",src:t})})}))},remove:function(){this.model&&this.el.removeObject3D("mesh")}}),Ge("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}});var xl,HT=Dt+"controllers/oculus-hands/v4/left.glb",VT=Dt+"controllers/oculus-hands/v4/right.glb",cd=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"];Ge("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"},modelOpacity:{default:1}},after:["tracked-controls"],bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var n=0;n<this.jointEls.length;++n)this.jointEls[n].object3D.visible=!0},removeEventListeners:function(){this.el.removeEventListener("model-loaded",this.onModelLoaded);for(var n=0;n<this.jointEls.length;++n)this.jointEls[n].object3D.visible=!1},init:function(){var n=this.el.sceneEl,e=n.getAttribute("webxr"),t=e.optionalFeatures;t.indexOf("hand-tracking")===-1&&(t.push("hand-tracking"),n.setAttribute("webxr",e)),this.wristObject3D=new E.Object3D,this.el.sceneEl.object3D.add(this.wristObject3D),this.onModelLoaded=this.onModelLoaded.bind(this),this.onChildAttached=this.onChildAttached.bind(this),this.jointEls=[],this.controllerPresent=!1,this.isPinched=!1,this.pinchEventDetail={position:new E.Vector3,wristRotation:new E.Quaternion},this.indexTipPosition=new E.Vector3,this.hasPoses=!1,this.jointPoses=new Float32Array(16*cd.length),this.jointRadii=new Float32Array(cd.length),this.bindMethods(),this.updateReferenceSpace=this.updateReferenceSpace.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.updateReferenceSpace),this.el.sceneEl.addEventListener("exit-vr",this.updateReferenceSpace),this.el.addEventListener("child-attached",this.onChildAttached),this.wristObject3D.visible=!1},onChildAttached:function(n){this.addChildEntity(n.detail.el)},update:function(){this.updateModelMaterial()},updateModelMaterial:function(){var n=this.jointEls,e=this.skinnedMesh,t=this.data.modelOpacity!==1;e&&(this.skinnedMesh.material.color.set(this.data.modelColor),this.skinnedMesh.material.transparent=t,this.skinnedMesh.material.opacity=this.data.modelOpacity);for(var i=0;i<n.length;i++)n[i].setAttribute("material",{color:this.data.modelColor,transparent:t,opacity:this.data.modelOpacity})},updateReferenceSpace:function(){var n=this,e=this.el.sceneEl.xrSession;if(this.referenceSpace=void 0,e){var t=n.el.sceneEl.systems.webxr.sessionReferenceSpaceType;e.requestReferenceSpace(t).then(function(i){n.referenceSpace=i}).catch(function(i){throw n.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(t,"tracked-controls-webxr uses reference space "+t),i})}},checkIfControllerPresent:function(){var n=this.data;Dn(this,"",{hand:n.hand?n.hand:void 0,iterateControllerProfiles:!0,handTracking:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},tick:function(){var n=this.el.sceneEl,e=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,t=n.frame,i=this.el.components["tracked-controls"],r=this.referenceSpace;e&&t&&r&&i&&(this.hasPoses=!1,e.hand&&(this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),this.hasPoses=t.fillPoses(e.hand.values(),r,this.jointPoses)&&t.fillJointRadii(e.hand.values(),this.jointRadii),this.updateHandModel(),this.detectGesture(),this.updateWristObject()))},updateWristObject:(xl=new E.Matrix4,function(){var n=this.wristObject3D;n&&this.hasPoses&&(xl.fromArray(this.jointPoses,0),n.position.setFromMatrixPosition(xl),n.quaternion.setFromRotationMatrix(xl))}),updateHandModel:function(){this.wristObject3D.visible=!0,this.el.object3D.visible=!0,this.data.modelStyle==="dots"&&this.updateHandDotsModel(),this.data.modelStyle==="mesh"&&this.updateHandMeshModel()},getBone:function(n){for(var e=this.bones,t=0;t<e.length;t++)if(e[t].name===n)return e[t];return null},updateHandMeshModel:function(){var n=new E.Matrix4;return function(){var e=0,t=this.jointPoses,i=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller;if(i&&this.mesh&&(this.mesh.visible=!1,this.hasPoses))for(var r of i.hand.values()){var s=this.getBone(r.jointName);s!=null&&(this.mesh.visible=!0,n.fromArray(t,16*e),s.position.setFromMatrixPosition(n),s.quaternion.setFromRotationMatrix(n)),e++}}}(),updateHandDotsModel:function(){for(var n,e,t=this.jointPoses,i=this.jointRadii,r=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,s=0;s<r.hand.size;s++)e=(n=this.jointEls[s]).object3D,n.object3D.visible=this.hasPoses,this.hasPoses&&(e.matrix.fromArray(t,16*s),e.matrix.decompose(e.position,e.rotation,e.scale),n.setAttribute("scale",{x:i[s],y:i[s],z:i[s]}))},detectGesture:function(){this.detectPinch()},detectPinch:function(){var n=new E.Vector3,e=new E.Matrix4;return function(){var t=this.indexTipPosition,i=this.pinchEventDetail;if(this.hasPoses){n.setFromMatrixPosition(e.fromArray(this.jointPoses,64)),t.setFromMatrixPosition(e.fromArray(this.jointPoses,144)),i.wristRotation.setFromRotationMatrix(e.fromArray(this.jointPoses,0));var r=t.distanceTo(n);r<.015&&this.isPinched===!1&&(this.isPinched=!0,i.position.copy(t).add(n).multiplyScalar(.5),this.el.emit("pinchstarted",i)),r>.02&&this.isPinched===!0&&(this.isPinched=!1,i.position.copy(t).add(n).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(t).add(n).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var n=this.el,e=this.data;n.setAttribute("tracked-controls",{id:"",hand:e.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==n.getObject3D("mesh")&&n.setObject3D("mesh",this.mesh):this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var n,e=this.el;this.checkIfControllerPresent(),n=e.components["tracked-controls"]&&e.components["tracked-controls"].controller,this.mesh&&n&&n.hand&&n.hand instanceof XRHand&&e.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var n=this.data;n.modelStyle==="dots"&&this.initDotsModel(),n.modelStyle==="mesh"&&this.initMeshHandModel(),this.el.object3D.visible=!0,this.wristObject3D.visible=!0},initDotsModel:function(){if(this.jointEls.length===0){for(var n=0;n<cd.length;++n){var e=this.jointEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:1}),e.object3D.visible=!1,this.el.appendChild(e),this.jointEls.push(e)}this.updateModelMaterial()}},initMeshHandModel:function(){var n=this.data.hand==="left"?HT:VT;this.el.setAttribute("gltf-model",n)},onModelLoaded:function(){var n=this.mesh=this.el.getObject3D("mesh").children[0],e=this.skinnedMesh=n.getObjectByProperty("type","SkinnedMesh");this.skinnedMesh&&(this.bones=e.skeleton.bones,this.el.removeObject3D("mesh"),n.position.set(0,0,0),n.rotation.set(0,0,0),e.frustumCulled=!1,e.material=new E.MeshStandardMaterial,this.updateModelMaterial(),this.setupChildrenEntities(),this.el.setObject3D("mesh",n),this.el.emit("controllermodelready",{name:"hand-tracking-controls",model:this.data.model,rayOrigin:new E.Vector3(0,0,0)}))},setupChildrenEntities:function(){for(var n=this.el.children,e=0;e<n.length;++e)n[e]instanceof zt&&this.addChildEntity(n[e])},addChildEntity:function(n){n instanceof zt&&this.wristObject3D.add(n.object3D)}}),Ge("hand-tracking-grab-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},color:{type:"color",default:"white"},hoverColor:{type:"color",default:"#538df1"},hoverEnabled:{default:!1}},init:function(){var n,e=this.el,t=this.data;n=t.hand==="right"?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",e.setAttribute("hand-tracking-controls",{hand:t.hand}),e.setAttribute("obb-collider",{trackedObject3D:n,size:.04}),this.auxMatrix=new E.Matrix4,this.onCollisionStarted=this.onCollisionStarted.bind(this),this.el.addEventListener("obbcollisionstarted",this.onCollisionStarted),this.onCollisionEnded=this.onCollisionEnded.bind(this),this.el.addEventListener("obbcollisionended",this.onCollisionEnded),this.onPinchStarted=this.onPinchStarted.bind(this),this.el.addEventListener("pinchstarted",this.onPinchStarted),this.onPinchEnded=this.onPinchEnded.bind(this),this.el.addEventListener("pinchended",this.onPinchEnded)},transferEntityOwnership:function(){for(var n,e=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),t=0;t<e.length;++t)(n=e[t].components["hand-tracking-grab-controls"])!==this&&this.grabbedEl&&this.grabbedEl===n.grabbedEl&&n.releaseGrabbedEntity();return!1},onCollisionStarted:function(n){var e=n.detail.withEl;this.collidedEl||e.getAttribute("grabbable")&&(this.collidedEl=e,this.grabbingObject3D=n.detail.trackedObject3D,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.hoverColor))},onCollisionEnded:function(){this.collidedEl=void 0,this.grabbedEl||(this.grabbingObject3D=void 0,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.color))},onPinchStarted:function(n){this.collidedEl&&(this.grabbedEl=this.collidedEl,this.transferEntityOwnership(),this.grab())},onPinchEnded:function(){this.releaseGrabbedEntity()},releaseGrabbedEntity:function(){var n=this.grabbedEl;if(n){var e=n.object3D,t=e.parent,i=this.originalParent;e.applyMatrix4(t.matrixWorld),e.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),t.remove(e),i.add(e),this.el.emit("grabended",{grabbedEl:n}),this.grabbedEl=void 0,this.originalParent=void 0}},grab:function(){var n=this.grabbedEl,e=n.object3D,t=e.parent;this.originalParent=t;var i=this.el.components["hand-tracking-controls"].wristObject3D;e.applyMatrix4(t.matrixWorld),e.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),t.remove(e),i.add(e),this.el.emit("grabstarted",{grabbedEl:n})}});var WT={toonLeft:Dt+"controllers/hands/leftHand.glb",toonRight:Dt+"controllers/hands/rightHand.glb",lowPolyLeft:Dt+"controllers/hands/leftHandLow.glb",lowPolyRight:Dt+"controllers/hands/rightHandLow.glb",highPolyLeft:Dt+"controllers/hands/leftHandHigh.glb",highPolyRight:Dt+"controllers/hands/rightHandHigh.glb"},hd="Point",ud="Fist",Pg="Thumb Up",Yl={};function Ug(n,e){var t;if(n)return(t=Yl[n])==="grip"?t+(e?"close":"open"):t==="point"?t+(e?"up":"down"):t==="pointing"||t==="pistol"?t+(e?"start":"end"):void 0}Yl[ud]="grip",Yl[Pg]="pistol",Yl[hd]="pointing",Ge("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},after:["tracked-controls"],init:function(){var n=this,e=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new bp,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){n.handleButton("grip","down")},this.onGripUp=function(){n.handleButton("grip","up")},this.onTrackpadDown=function(){n.handleButton("trackpad","down")},this.onTrackpadUp=function(){n.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){n.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){n.handleButton("trackpad","touchend")},this.onTriggerDown=function(){n.handleButton("trigger","down")},this.onTriggerUp=function(){n.handleButton("trigger","up")},this.onTriggerTouchStart=function(){n.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){n.handleButton("trigger","touchend")},this.onGripTouchStart=function(){n.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){n.handleButton("grip","touchend")},this.onThumbstickDown=function(){n.handleButton("thumbstick","down")},this.onThumbstickUp=function(){n.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){n.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){n.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){n.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){n.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){n.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){n.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected),e.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(n,e){var t=this.el.getObject3D("mesh");t&&t.mixer&&t.mixer.update(e/1e3)},onControllerConnected:function(n){var e=this.el,t=this.data.hand,i=this.el.getObject3D("mesh");e.object3D.visible=!0;var r=t==="left"?Math.PI/2:-Math.PI/2,s=e.sceneEl.hasWebXR?-Math.PI/2:0;n.detail.name==="pico-controls"&&(s+=Math.PI/4),i.position.set(0,0,0),i.rotation.set(s,0,r)},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var n=this.el;n.addEventListener("gripdown",this.onGripDown),n.addEventListener("gripup",this.onGripUp),n.addEventListener("trackpaddown",this.onTrackpadDown),n.addEventListener("trackpadup",this.onTrackpadUp),n.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),n.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),n.addEventListener("triggerdown",this.onTriggerDown),n.addEventListener("triggerup",this.onTriggerUp),n.addEventListener("triggertouchstart",this.onTriggerTouchStart),n.addEventListener("triggertouchend",this.onTriggerTouchEnd),n.addEventListener("griptouchstart",this.onGripTouchStart),n.addEventListener("griptouchend",this.onGripTouchEnd),n.addEventListener("thumbstickdown",this.onThumbstickDown),n.addEventListener("thumbstickup",this.onThumbstickUp),n.addEventListener("abuttontouchstart",this.onAorXTouchStart),n.addEventListener("abuttontouchend",this.onAorXTouchEnd),n.addEventListener("bbuttontouchstart",this.onBorYTouchStart),n.addEventListener("bbuttontouchend",this.onBorYTouchEnd),n.addEventListener("xbuttontouchstart",this.onAorXTouchStart),n.addEventListener("xbuttontouchend",this.onAorXTouchEnd),n.addEventListener("ybuttontouchstart",this.onBorYTouchStart),n.addEventListener("ybuttontouchend",this.onBorYTouchEnd),n.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),n.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var n=this.el;n.removeEventListener("gripdown",this.onGripDown),n.removeEventListener("gripup",this.onGripUp),n.removeEventListener("trackpaddown",this.onTrackpadDown),n.removeEventListener("trackpadup",this.onTrackpadUp),n.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),n.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),n.removeEventListener("triggerdown",this.onTriggerDown),n.removeEventListener("triggerup",this.onTriggerUp),n.removeEventListener("triggertouchstart",this.onTriggerTouchStart),n.removeEventListener("triggertouchend",this.onTriggerTouchEnd),n.removeEventListener("griptouchstart",this.onGripTouchStart),n.removeEventListener("griptouchend",this.onGripTouchEnd),n.removeEventListener("thumbstickdown",this.onThumbstickDown),n.removeEventListener("thumbstickup",this.onThumbstickUp),n.removeEventListener("abuttontouchstart",this.onAorXTouchStart),n.removeEventListener("abuttontouchend",this.onAorXTouchEnd),n.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),n.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),n.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),n.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),n.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),n.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),n.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),n.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(n){var e,t=this.el,i=this.data.hand,r=this.data.handModelStyle,s=this.data.color,o=this;if(e={hand:i,model:!1},i!==n){var a=WT[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(a,function(l){var c=l.scene.children[0];c.mixer=new E.AnimationMixer(c),o.clips=l.animations,t.setObject3D("mesh",c),c.traverse(function(h){h.isMesh&&(h.material.color=new E.Color(s))}),t.setAttribute("magicleap-controls",e),t.setAttribute("vive-controls",e),t.setAttribute("meta-touch-controls",e),t.setAttribute("pico-controls",e),t.setAttribute("windows-motion-controls",e),t.setAttribute("hp-mixed-reality-controls",e)})}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(n,e){var t,i=e==="down",r=e==="touchstart";if(e.indexOf("touch")===0){if(r===this.touchedButtons[n])return;this.touchedButtons[n]=r}else{if(i===this.pressedButtons[n])return;this.pressedButtons[n]=i}t=this.gesture,this.gesture=this.determineGesture(),this.gesture!==t&&(this.animateGesture(this.gesture,t),this.emitGestureEvents(this.gesture,t))},determineGesture:function(){var n,e,t,i=this.pressedButtons.grip,r=this.pressedButtons.surface||this.touchedButtons.surface,s=this.pressedButtons.trackpad||this.touchedButtons.trackpad,o=this.pressedButtons.trigger||this.touchedButtons.trigger,a=this.touchedButtons.AorX||this.touchedButtons.BorY;return e=this.el.components["tracked-controls"],(t=e&&e.controller)&&(t.id&&t.id.indexOf("OpenVR ")===0||t.profiles&&t.profiles[0]&&t.profiles[0]==="htc-vive")?i||o?n=ud:s&&(n=hd):i?n=r||a||s?o?ud:hd:o?Pg:"Point + Thumb":o&&(n="Hold"),n},getClip:function(n){var e,t;for(t=0;t<this.clips.length;t++)if((e=this.clips[t]).name===n)return e},animateGesture:function(n,e){n?this.playAnimation(n||"Open",e,!1):this.playAnimation(e,e,!0)},emitGestureEvents:function(n,e){var t,i=this.el;e!==n&&((t=Ug(e,!1))&&i.emit(t),(t=Ug(n,!0))&&i.emit(t))},playAnimation:function(n,e,t){var i,r,s=this.el.getObject3D("mesh");if(s){if(i=this.getClip(n),r=s.mixer.clipAction(i),t)return r.paused=!1,void(r.timeScale=-1);if(r.clampWhenFinished=!0,r.loop=E.LoopOnce,r.repetitions=0,r.timeScale=1,r.time=0,r.weight=1,!e)return s.mixer.stopAllAction(),void r.play();i=this.getClip(e),r.reset(),r.play(),s.mixer.clipAction(i).crossFadeTo(r,.15,!0)}}}),Ge("hide-on-enter-ar",{init:function(){var n=this;this.el.sceneEl.addEventListener("enter-vr",function(){n.el.sceneEl.is("ar-mode")&&(n.el.object3D.visible=!1)}),this.el.sceneEl.addEventListener("exit-vr",function(){n.el.object3D.visible=!0})}}),Ge("hide-on-enter-vr",{init:function(){var n=this;this.el.sceneEl.addEventListener("enter-vr",function(){n.el.sceneEl.is("vr-mode")&&(n.el.object3D.visible=!1)}),this.el.sceneEl.addEventListener("exit-vr",function(){n.el.object3D.visible=!0})}});var Fg="hp-mixed-reality",qT=Dt+"controllers/hp/mixed-reality/",jT={x:0,y:0,z:.06},XT={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"},YT=(Ge("hp-mixed-reality-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var n=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){Ze(e.detail.id,"down",n,n.data.hand)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n,n.data.hand)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n,n.data.hand)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n,n.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var n=this.data;this.controllerIndex=n.hand==="right"?0:n.hand==="left"?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("axismove",this.onAxisMoved),n.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("axismove",this.onAxisMoved),n.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var n=this.data;Dn(this,Fg,{index:this.controllerIndex,hand:n.hand})},injectTrackedControls:function(){var n=this.el,e=this.data;n.setAttribute("tracked-controls",{idPrefix:Fg,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",qT+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(n){var e,t=this.mapping[this.data.hand].buttons[n.detail.id];t&&(t==="trigger"&&(e=n.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(t+"changed",n.detail.state))},onModelLoaded:function(n){var e=n.detail.model;this.data.model&&(e.position.copy(jT),e.rotation.copy(XT),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new E.Vector3(0,0,0)}))},onAxisMoved:function(n){Nn(this,this.mapping.axes,n)}}),vt("components:layer:warn"));function Og(n,e,t){return(e.dot(n)-e.dot(t))/e.length()}Ge("layer",{schema:{type:{default:"quad",oneOf:["quad","monocubemap","stereocubemap"]},src:{type:"map"},rotateCubemap:{default:!1},width:{default:0},height:{default:0}},init:function(){var n=this.el.sceneEl.renderer.getContext();this.quaternion=new E.Quaternion,this.position=new E.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=n.createFramebuffer();var e=this.el.sceneEl.getAttribute("webxr"),t=e.requiredFeatures;t.indexOf("layers")===-1&&(t.push("layers"),this.el.sceneEl.setAttribute("webxr",e)),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR),this.el.sceneEl.addEventListener("exit-vr",this.onExitVR)},bindMethods:function(){this.onRequestedReferenceSpace=this.onRequestedReferenceSpace.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this)},update:function(n){this.data.src!==n.src&&this.updateSrc()},updateSrc:function(){var n=this.data.type;this.texture=void 0,n!=="quad"?n!=="monocubemap"&&n!=="stereocubemap"||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var n,e=this.xrGLFactory,t=this.el.sceneEl.frame,i=this.data.src,r=this.data.type;this.visibilityChanged=!1,this.layer&&(r!=="monocubemap"&&r!=="stereocubemap"||(i.complete?this.pendingCubeMapUpdate=!1:this.pendingCubeMapUpdate=!0,this.loadingScreen?this.loadingScreen=!1:this.loadingScreen=!0,r==="monocubemap"?(n=e.getSubImage(this.layer,t),this.loadCubeMapImage(n.colorTexture,i,0)):(n=e.getSubImage(this.layer,t,"left"),this.loadCubeMapImage(n.colorTexture,i,0),n=e.getSubImage(this.layer,t,"right"),this.loadCubeMapImage(n.colorTexture,i,6))))},loadQuadImage:function(){var n=this.data.src,e=this;this.el.sceneEl.systems.material.loadTexture(n,{src:n},function(t){e.el.sceneEl.renderer.initTexture(t),e.texture=t,n.tagName==="VIDEO"&&setTimeout(function(){e.textureIsVideo=!0},1e3),e.layer&&(e.layer.height=e.data.height/2||e.texture.image.height/1e3,e.layer.width=e.data.width/2||e.texture.image.width/1e3,e.needsRedraw=!0),e.updateQuadPanel()})},preGenerateCubeMapTextures:function(n,e){this.data.type==="monocubemap"?this.generateCubeMapTextures(n,0,e):(this.generateCubeMapTextures(n,0,e),this.generateCubeMapTextures(n,6,e))},generateCubeMapTextures:function(n,e,t){for(var i,r,s=this.data,o=this.cubeFaceSize,a=Math.min(n.width,n.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=o;var u=h.getContext("2d");s.rotateCubemap&&(c!==2&&c!==3||(u.save(),u.translate(o,o),u.rotate(Math.PI))),u.drawImage(n,(c+e)*a,0,a,a,0,0,o,o),u.restore(),t&&t(),l.push(h)}return s.rotateCubemap&&(i=l[0],r=l[1],l[0]=r,l[1]=i,i=l[4],r=l[5],l[4]=r,l[5]=i),t&&t(),l},loadCubeMapImage:function(n,e,t){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,n),i=!e.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(e,t);var s=0;i.forEach(function(o,a){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,0,0,r.RGBA,r.UNSIGNED_BYTE,o),s=r.getError()}),s!==0&&console.log("renderingError, WebGL Error Code: "+s),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&this.referenceSpace&&(this.layer||!this.el.sceneEl.is("vr-mode")&&!this.el.sceneEl.is("ar-mode")||this.initLayer(),this.updateTransform(),this.data.src.complete&&(this.pendingCubeMapUpdate||this.loadingScreen||this.visibilityChanged)&&this.loadCubeMapImages(),(this.needsRedraw||this.layer.needsRedraw||this.textureIsVideo)&&(this.data.type==="quad"&&this.draw(),this.needsRedraw=!1))},initLayer:function(){var n=this,e=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(t){n.visibilityChanged=t.session.visibilityState!=="hidden"},e!=="quad"?e!=="monocubemap"&&e!=="stereocubemap"||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var n=this.el.sceneEl,e=n.renderer.getContext(),t=this.xrGLFactory=new XRWebGLBinding(n.xrSession,e);this.texture&&(this.layer=t.createQuadLayer({space:this.referenceSpace,viewPixelHeight:2048,viewPixelWidth:2048,height:this.data.height/2||this.texture.image.height/1e3,width:this.data.width/2||this.texture.image.width/1e3}),this.initLoadingScreenImages(),n.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var n=this.data.src,e=this.el.sceneEl,t=e.renderer.getContext(),i=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(n.width,n.height)),s=this.xrGLFactory=new XRWebGLBinding(e.xrSession,t);this.layer=s.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:this.data.type==="monocubemap"?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),e.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var n=this.cubeFaceSize,e=this.loadingScreenImages=[],t=0;t<6;t++){var i=document.createElement("CANVAS");i.width=i.height=n;var r=i.getContext("2d");i.width=i.height=n,r.fillStyle="black",r.fillRect(0,0,n,n),t!==2&&t!==3&&(r.translate(n,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",n/2,n/2)),e.push(i)}},destroyLayer:function(){this.layer&&(this.el.sceneEl.renderer.xr.removeLayer(this.layer),this.layer.destroy(),this.layer=void 0)},toggleCompositorLayer:function(){this.enableCompositorLayer(!this.layerEnabled)},enableCompositorLayer:function(n){this.layerEnabled=n,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var n=this.quadPanelEl;this.quadPanelEl||(n=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(n)),n.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),n.setAttribute("geometry",{primitive:"plane",height:this.data.height||this.texture.image.height/1e3,width:this.data.width||this.texture.image.height/1e3})},draw:function(){var n=this.el.sceneEl,e=this.el.sceneEl.renderer.getContext(),t=this.xrGLFactory.getSubImage(this.layer,n.frame),i=n.renderer.properties.get(this.texture).__webglTexture,r=e.getParameter(e.FRAMEBUFFER_BINDING);e.viewport(t.viewport.x,t.viewport.y,t.viewport.width,t.viewport.height),e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.colorTexture,0),function(s,o,a,l){var c=s.createFramebuffer(),h=a.viewport.x,u=a.viewport.y,d=a.viewport.x+a.viewport.width,f=a.viewport.y+a.viewport.height;l.tagName==="VIDEO"&&(s.bindTexture(s.TEXTURE_2D,o),s.texSubImage2D(s.TEXTURE_2D,0,0,0,l.width,l.height,s.RGB,s.UNSIGNED_BYTE,l)),s.bindFramebuffer(s.READ_FRAMEBUFFER,c),s.framebufferTexture2D(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,o,0),s.readBuffer(s.COLOR_ATTACHMENT0),s.blitFramebuffer(0,0,l.width,l.height,h,u,d,f,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.deleteFramebuffer(c)}(e,i,t,this.data.src),e.bindFramebuffer(e.FRAMEBUFFER,r)},updateTransform:function(){var n=this.el,e=this.position,t=this.quaternion;n.object3D.updateMatrixWorld(),e.setFromMatrixPosition(n.object3D.matrixWorld),t.setFromRotationMatrix(n.object3D.matrixWorld),this.layerEnabled||e.set(0,0,1e8),this.layer.transform=new XRRigidTransform(e,t)},onEnterVR:function(){var n=this.el.sceneEl,e=n.xrSession;n.hasWebXR&&XRWebGLBinding&&e?(e.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),this.layerEnabled=!0,this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!1),this.data.src.play&&this.data.src.play()):YT("The layer component requires WebXR and the layers API enabled")},onExitVR:function(){this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!0),this.destroyLayer()},onRequestedReferenceSpace:function(n){this.referenceSpace=n}}),Ge("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var n=this.config,e=this.data,t=this.el,i=this,r={hand:e.hand,model:e.model};function s(o){var a=n[o.detail.name];if(a){var l=Cn({showLine:!0},a.raycaster||{});o.detail.rayOrigin&&(l.origin=o.detail.rayOrigin.origin,l.direction=o.detail.rayOrigin.direction,l.showLine=!0),o.detail.rayOrigin||!i.modelReady?t.setAttribute("raycaster",l):t.setAttribute("raycaster","showLine",!0),t.setAttribute("cursor",Cn({fuse:!1},a.cursor))}}t.setAttribute("hp-mixed-reality-controls",r),t.setAttribute("magicleap-controls",r),t.setAttribute("oculus-go-controls",r),t.setAttribute("meta-touch-controls",r),t.setAttribute("pico-controls",r),t.setAttribute("valve-index-controls",r),t.setAttribute("vive-controls",r),t.setAttribute("vive-focus-controls",r),t.setAttribute("windows-motion-controls",r),t.setAttribute("generic-tracked-controller-controls",{hand:r.hand}),t.addEventListener("controllerconnected",s),t.addEventListener("controllerdisconnected",function(o){n[o.detail.name]&&t.setAttribute("raycaster","showLine",!1)}),t.addEventListener("controllermodelready",function(o){s(o),i.modelReady=!0})},config:{"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"hp-mixed-reality-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"meta-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"pico-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}});var dd,bl,Cl,wl,yi,kg,fd,fo,po,_l,Ng=E.MathUtils.degToRad,KT=vt("components:light:warn"),JT=new E.CubeTextureLoader,Rr={};function Qg(n,e){return!(!n||!e)&&n.x===e.x&&n.y===e.y&&n.z===e.z}Ge("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color",if:{type:["ambient","directional","hemisphere","point","spot"]}},envMap:{default:"",if:{type:["probe"]}},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:3.14,min:0,if:{type:["ambient","directional","hemisphere","point","spot","probe"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot","probe"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowCameraAutomatic:{default:"",if:{type:["directional"]}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var n=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(n)},update:function(n){var e=this.data,t=HE(e,n),i=this.light,r=this;if(!i||"type"in t)this.setLight(this.data),this.updateShadow();else{var s=!1;Object.keys(t).forEach(function(o){var a=e[o];switch(o){case"color":i.color.set(a);break;case"groundColor":i.groundColor.set(a);break;case"angle":i.angle=Ng(a);break;case"target":a===null?e.type!=="spot"&&e.type!=="directional"||(i.target=r.defaultTarget):a.hasLoaded?r.onSetTarget(a,i):a.addEventListener("loaded",r.onSetTarget.bind(r,a,i));break;case"envMap":r.updateProbeMap(e,i);break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(r.updateShadow(),s=!0);break;case"shadowCameraAutomatic":e.shadowCameraAutomatic?r.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):r.shadowCameraAutomaticEls=[];break;default:i[o]=a}})}},tick:(dd=new E.Box3,bl=new E.Vector3,Cl=new E.Vector3,wl=new E.Matrix4,yi=new E.Sphere,kg=new E.Vector3,function(){if(this.data.type==="directional"&&this.light.shadow&&this.light.shadow.camera instanceof E.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var n=this.light.shadow.camera;n.getWorldDirection(bl),n.getWorldPosition(Cl),wl.copy(n.matrixWorld),wl.invert(),n.near=1,n.left=1e5,n.right=-1e5,n.top=-1e5,n.bottom=1e5,this.shadowCameraAutomaticEls.forEach(function(e){dd.setFromObject(e.object3D),dd.getBoundingSphere(yi);var t,i,r,s,o,a=Og(Cl,bl,yi.center),l=(t=Cl,i=bl,r=yi.center,s=kg,o=Og(t,i,r),s.copy(i),s.multiplyScalar(o),s.add(r),s).applyMatrix4(wl);n.near=Math.min(-a-yi.radius-1,n.near),n.left=Math.min(-yi.radius+l.x,n.left),n.right=Math.max(yi.radius+l.x,n.right),n.top=Math.max(yi.radius+l.y,n.top),n.bottom=Math.min(-yi.radius+l.y,n.bottom)}),n.updateProjectionMatrix()}}),setLight:function(n){var e=this.el,t=this.getLight(n);t&&(this.light&&e.removeObject3D("light"),this.light=t,this.light.el=e,e.setObject3D("light",this.light),n.type!=="spot"&&n.type!=="directional"&&n.type!=="hemisphere"||e.getObject3D("light").translateY(-1),n.type==="spot"&&(e.setObject3D("light-target",this.defaultTarget),e.getObject3D("light-target").position.set(0,0,-1)),n.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(n.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var n=this.el,e=this.data,t=this.light;t.castShadow=e.castShadow;var i=n.getObject3D("cameraHelper");if(e.shadowCameraVisible&&!i?(i=new E.CameraHelper(t.shadow.camera),n.setObject3D("cameraHelper",i)):!e.shadowCameraVisible&&i&&n.removeObject3D("cameraHelper"),!e.castShadow)return t;t.shadow.bias=e.shadowBias,t.shadow.radius=e.shadowRadius,t.shadow.mapSize.height=e.shadowMapHeight,t.shadow.mapSize.width=e.shadowMapWidth,t.shadow.camera.near=e.shadowCameraNear,t.shadow.camera.far=e.shadowCameraFar,t.shadow.camera instanceof E.OrthographicCamera?(t.shadow.camera.top=e.shadowCameraTop,t.shadow.camera.right=e.shadowCameraRight,t.shadow.camera.bottom=e.shadowCameraBottom,t.shadow.camera.left=e.shadowCameraLeft):t.shadow.camera.fov=e.shadowCameraFov,t.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(n){var e=n.angle,t=new E.Color(n.color);t=t.getHex();var i=n.decay,r=n.distance,s=new E.Color(n.groundColor);s=s.getHex();var o=n.intensity,a=n.type,l=n.target,c=null;switch(a.toLowerCase()){case"ambient":return new E.AmbientLight(t,o);case"directional":return c=new E.DirectionalLight(t,o),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"hemisphere":return new E.HemisphereLight(t,s,o);case"point":return new E.PointLight(t,o,r,i);case"spot":return c=new E.SpotLight(t,o,r,Ng(e),n.penumbra,i),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"probe":return c=new E.LightProbe,this.updateProbeMap(n,c),c;default:KT("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",a)}},updateProbeMap:function(n,e){n.envMap?(Rr[n.envMap]===void 0&&(Rr[n.envMap]=new window.Promise(function(t){OE(n.envMap,function(i){JT.load(i,function(r){var s=_E.fromCubeTexture(r);Rr[n.envMap]=s,t(s)})})})),Rr[n.envMap]instanceof window.Promise?Rr[n.envMap].then(function(t){e.copy(t)}):Rr[n.envMap]instanceof E.LightProbe&&e.copy(Rr[n.envMap])):e.copy(new E.LightProbe)},onSetTarget:function(n,e){e.target=n.object3D},remove:function(){var n=this.el;n.removeObject3D("light"),n.getObject3D("cameraHelper")&&n.removeObject3D("cameraHelper")}}),Ge("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var n,e,t=this.data;e=this.material=new E.LineBasicMaterial({color:t.color,opacity:t.opacity,transparent:t.opacity<1,visible:t.visible}),(n=this.geometry=new E.BufferGeometry).setAttribute("position",new E.BufferAttribute(new Float32Array(6),3)),this.line=new E.Line(n,e),this.el.setObject3D(this.attrName,this.line)},update:function(n){var e=this.data,t=this.geometry,i=!1,r=this.material,s=t.attributes.position.array;Qg(e.start,n.start)||(s[0]=e.start.x,s[1]=e.start.y,s[2]=e.start.z,i=!0),Qg(e.end,n.end)||(s[3]=e.end.x,s[4]=e.end.y,s[5]=e.end.z,i=!0),i&&(t.attributes.position.needsUpdate=!0,t.computeBoundingSphere()),r.color.setStyle(e.color),r.opacity=e.opacity,r.transparent=e.opacity<1,r.visible=e.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}}),Ge("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new E.Quaternion,this.hiddenEls=[]},update:function(n){var e,t,i=this.data,r=this.el;if(i.visualAspectEnabled){var s=this.el.getAttribute("scale");this.previewDistance=15*(s.x+s.y)/2,this.initVisualAspect(),e=i.highlighted?i.highlightedColor:i.backgroundColor,t=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",e),r.setAttribute("material","strokeColor",t),i.on!==n.on&&this.updateEventListener(),n.peekMode!==void 0&&i.peekMode!==n.peekMode&&this.updatePeekMode(),i.image&&n.image!==i.image&&r.setAttribute("material","pano",typeof i.image=="string"?i.image:i.image.src)}},updatePeekMode:function(){var n=this.el,e=this.sphereEl;this.data.peekMode?(this.hideAll(),n.getObject3D("mesh").visible=!1,e.setAttribute("visible",!0)):(this.showAll(),n.getObject3D("mesh").visible=!0,e.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var n=this.el;n.isPlaying&&(this.removeEventListener(),n.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var n=this.data.on;n&&this.el.removeEventListener(n,this.navigate)},initVisualAspect:function(){var n,e,t,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(t=this.textEl=this.textEl||document.createElement("a-entity"),e=this.sphereEl=this.sphereEl||document.createElement("a-entity"),n=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),i.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),i.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double",previewDistance:this.previewDistance}),t.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),t.setAttribute("position","0 1.5 0"),i.appendChild(t),n.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),n.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),n.setAttribute("rotation","0 180 0"),n.setAttribute("position","0 0 0"),n.setAttribute("visible",!1),i.appendChild(n),e.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),e.setAttribute("visible",!1),i.appendChild(e),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:function(){var n=new E.Vector3,e=new E.Vector3,t=new E.Quaternion,i=new E.Vector3;return function(){var r,s,o=this.el,a=o.object3D,l=o.sceneEl.camera,c=this.textEl;if(this.data.visualAspectEnabled)if(a.updateMatrixWorld(),l.parent.updateMatrixWorld(),l.updateMatrixWorld(),a.matrix.decompose(e,t,i),e.setFromMatrixPosition(a.matrixWorld),n.setFromMatrixPosition(l.matrixWorld),(s=e.distanceTo(n))>1.33333*this.previewDistance)this.previousQuaternion||(this.quaternionClone.copy(t),this.previousQuaternion=this.quaternionClone),a.lookAt(n);else{if(r=this.calculateCameraPortalOrientation(),s<.5){if(this.semiSphereEl.getAttribute("visible")===!0)return;c.setAttribute("text","width",1.5),r<=0?(c.setAttribute("position","0 0 0.75"),c.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(c.setAttribute("position","0 0 -0.75"),c.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),o.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=r}else r<=0?c.setAttribute("rotation","0 180 0"):c.setAttribute("rotation","0 0 0"),c.setAttribute("text","width",5),c.setAttribute("position","0 1.5 0"),o.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(a.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}}(),hideAll:function(){var n=this.el,e=this.hiddenEls,t=this;e.length>0||n.sceneEl.object3D.traverse(function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==n.sceneEl.object3D&&i.el!==n&&i.el!==t.sphereEl&&i.el!==n.sceneEl.cameraEl&&i.el.getAttribute("visible")!==!1&&i.el!==t.textEl&&i.el!==t.semiSphereEl&&(i.el.setAttribute("visible",!1),e.push(i.el))})},showAll:function(){this.hiddenEls.forEach(function(n){n.setAttribute("visible",!0)}),this.hiddenEls=[]},calculateCameraPortalOrientation:(fd=new E.Matrix4,fo=new E.Vector3,po=new E.Vector3(0,0,1),_l=new E.Vector3(0,0,0),function(){var n=this.el,e=n.sceneEl.camera;return fo.set(0,0,0),po.set(0,0,1),_l.set(0,0,0),n.object3D.matrixWorld.extractRotation(fd),po.applyMatrix4(fd),n.object3D.updateMatrixWorld(),n.object3D.localToWorld(_l),e.parent.parent.updateMatrixWorld(),e.parent.updateMatrixWorld(),e.updateMatrixWorld(),e.localToWorld(fo),fo.sub(_l).normalize(),po.normalize(),Math.sign(po.dot(fo))}),remove:function(){this.removeEventListener()}}),Ji("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"},previewDistance:{default:15,type:"float",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join(`
`),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","uniform float previewDistance;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / previewDistance), 2.0), 0.0, 1.0));","}","}"].join(`
`)});var Gg="logitech-mx-ink",ZT=Dt+"controllers/logitech/",zg=(Ge("logitech-mx-ink-controls",{schema:{hand:{default:"left"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{buttons:["front","back","none","none","none","tip"]},right:{buttons:["front","back","none","none","none","tip"]}},init:function(){var n=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){Ze(e.detail.id,"down",n,n.data.hand)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n,n.data.hand)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n,n.data.hand)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n,n.data.hand)},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("axismove",this.onAxisMoved),n.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("axismove",this.onAxisMoved),n.removeEventListener("model-loaded",this.onModelLoaded),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),n.sceneEl.removeEventListener("exit-vr",this.onExitVR),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var n=this.controllerObject3D;n&&(n.visible=!1),Dn(this,Gg,{hand:this.data.hand,iterateControllerProfiles:!0})},injectTrackedControls:function(){var n=this.el,e=this.data,t=Gg;n.setAttribute("tracked-controls",{id:t,hand:e.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0,orientationOffset:e.orientationOffset}),this.loadModel()},loadModel:function(){var n=this.controllerObject3D;if(this.data.model)return n?(n.visible=this.el.sceneEl.is("vr-mode"),void this.el.setObject3D("mesh",n)):void this.el.setAttribute("gltf-model",ZT+"logitech-mx-ink.glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(n){var e,t=this.mapping[this.data.hand].buttons[n.detail.id];t&&(t==="trigger"&&(e=n.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(t+"changed",n.detail.state))},onModelLoaded:function(n){n.target===this.el&&this.data.model&&(this.el.emit("controllermodelready",{name:"logitech-mx-ink-controls",model:this.data.model,rayOrigin:new E.Vector3(0,0,0)}),this.controllerObject3D=this.el.getObject3D("mesh"),this.controllerObject3D.visible=this.el.sceneEl.is("vr-mode"))},onAxisMoved:function(n){Nn(this,this.mapping.axes,n)}}),Math.PI/2),Hg=(Ge("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new E.Vector3,this.hmdQuaternion=new E.Quaternion,this.magicWindowAbsoluteEuler=new E.Euler,this.magicWindowDeltaEuler=new E.Euler,this.position=new E.Vector3,this.magicWindowObject=new E.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new E.Vector3,rotation:new E.Euler},(this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode"))&&this.onEnterVR()},setupMagicWindowControls:function(){var n,e=this.data;(rr()||Mp())&&(n=this.magicWindowControls=new ME(this.magicWindowObject),typeof DeviceOrientationEvent<"u"&&DeviceOrientationEvent.requestPermission&&(n.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?n.enabled=e.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",function(){n.enabled=e.magicWindowTrackingEnabled})))},update:function(n){var e=this.data;e.enabled!==n.enabled&&this.updateGrabCursor(e.enabled),n&&!e.magicWindowTrackingEnabled&&n.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=e.magicWindowTrackingEnabled),n&&!e.pointerLockEnabled!==n.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(n){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this),this.onPointerLockChange=this.onPointerLockChange.bind(this),this.onPointerLockError=this.onPointerLockError.bind(this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new E.Object3D,this.yawObject=new E.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var n=this.el.sceneEl,e=n.canvas;e?(e.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),e.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),n.addEventListener("enter-vr",this.onEnterVR),n.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):n.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var n=this.el.sceneEl,e=n&&n.canvas;e&&(e.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),n.removeEventListener("enter-vr",this.onEnterVR),n.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var n=this.el.object3D,e=this.pitchObject,t=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),n.rotation.x=this.magicWindowDeltaEuler.x+e.rotation.x,n.rotation.y=this.magicWindowDeltaEuler.y+t.rotation.y,n.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var n=this.magicWindowAbsoluteEuler,e=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),n.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||n.y===0||(this.previousMagicWindowYaw=n.y),this.previousMagicWindowYaw&&(e.x=n.x,e.y+=n.y-this.previousMagicWindowYaw,e.z=n.z,this.previousMagicWindowYaw=n.y))},onMouseMove:function(n){var e,t,i,r=this.pitchObject,s=this.previousMouseEvent,o=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(t=n.movementX||n.mozMovementX||0,i=n.movementY||n.mozMovementY||0):(t=n.screenX-s.screenX,i=n.screenY-s.screenY),this.previousMouseEvent.screenX=n.screenX,this.previousMouseEvent.screenY=n.screenY,e=this.data.reverseMouseDrag?1:-1,o.rotation.y+=.002*t*e,r.rotation.x+=.002*i*e,r.rotation.x=Math.max(-zg,Math.min(zg,r.rotation.x)))},onMouseDown:function(n){var e=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!e.is("vr-mode")&&!e.is("ar-mode")||!e.checkHeadsetConnected())&&n.button===0){var t=e&&e.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=n.screenX,this.previousMouseEvent.screenY=n.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(t.requestPointerLock?t.requestPointerLock():t.mozRequestPointerLock&&t.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(n){n.touches.length!==1||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:n.touches[0].pageX,y:n.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(n){var e,t,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(t=2*Math.PI*(n.touches[0].pageX-this.touchStart.x)/i.clientWidth,e=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*t*e,this.touchStart={x:n.touches[0].pageX,y:n.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var n=this.el.sceneEl;n.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),n.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(n){var e=this.el.sceneEl;function t(){e.canvas.classList.add("a-grab-cursor")}function i(){e.canvas.classList.remove("a-grab-cursor")}e.canvas?n?t():i():n?e.addEventListener("render-target-loaded",t):e.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var n=this.el;this.savedPose.position.copy(n.object3D.position),this.savedPose.rotation.copy(n.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var n=this.el,e=this.savedPose;this.hasSavedPose&&(n.object3D.position.copy(e.position),n.object3D.rotation.copy(e.rotation),this.hasSavedPose=!1)}}),"magicleap-one"),$T=Dt+"controllers/magicleap/magicleap-one-controller.glb",eR=(Ge("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]},init:function(){var n=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){Ze(e.detail.id,"down",n)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n)},this.previousButtonValues={},this.bindMethods()},update:function(){var n=this.data;this.controllerIndex=n.hand==="right"?0:n.hand==="left"?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("axismove",this.onAxisMoved),n.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("axismove",this.onAxisMoved),n.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var n=this.data;Dn(this,Hg,{index:this.controllerIndex,hand:n.hand})},injectTrackedControls:function(){var n=this.el,e=this.data;n.setAttribute("tracked-controls",{idPrefix:Hg,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",$T)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(n){var e,t=this.mapping.buttons[n.detail.id];t&&(t==="trigger"&&(e=n.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(t+"changed",n.detail.state))},onModelLoaded:function(n){n.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(n){Nn(this,this.mapping.axes,n)},updateModel:function(n,e){},setButtonColor:function(n,e){}}),vt("components:material:error"));function Vg(n,e){n.dispose(),e.unregisterMaterial(n),Object.keys(n).filter(function(t){return n[t]&&n[t].isTexture}).forEach(function(t){n[t].dispose()})}Ge("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:nx,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColorsEnabled:{default:!1},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0},anisotropy:{default:0,min:0}},init:function(){this.material=null},update:function(n){var e=this.data;this.shader&&e.shader===n.shader||this.updateShader(e.shader),this.shader.update(this.data),this.updateMaterial(n)},updateSchema:function(n){var e,t,i,r;t=n&&n.shader,e=this.oldData&&this.oldData.shader,(i=ai[r=t||e]&&ai[r].schema)||eR("Unknown shader schema "+r),e&&t===e||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var n,e,t=this.el.sceneEl,i=this.schema,r=this;function s(o,a){var l;for(l in e)e[l]=o;r.shader.update(e)}for(n in this.tick=void 0,e={},i)i[n].type==="time"&&(this.tick=s,e[n]=!0);t&&(this.tick?t.addBehavior(this):t.removeBehavior(this))},updateShader:function(n){var e,t=this.data,i=ai[n]&&ai[n].Shader;if(!i)throw new Error("Unknown shader "+n);(e=this.shader=new i).el=this.el,e.init(t),this.setMaterial(e.material),this.updateSchema(t)},updateMaterial:function(n){var e,t=this.data,i=this.material;for(e in i.alphaTest=t.alphaTest,i.depthTest=t.depthTest!==!1,i.depthWrite=t.depthWrite!==!1,i.opacity=t.opacity,i.flatShading=t.flatShading,i.side=function(r){switch(r){case"back":return E.BackSide;case"double":return E.DoubleSide;default:return E.FrontSide}}(t.side),i.transparent=t.transparent!==!1||t.opacity<1,i.vertexColors=t.vertexColorsEnabled,i.visible=t.visible,i.blending=function(r){switch(r){case"none":return E.NoBlending;case"additive":return E.AdditiveBlending;case"subtractive":return E.SubtractiveBlending;case"multiply":return E.MultiplyBlending;default:return E.NormalBlending}}(t.blending),i.dithering=t.dithering,n)break;!e||n.alphaTest===t.alphaTest&&n.side===t.side&&n.vertexColorsEnabled===t.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var n=new E.MeshBasicMaterial,e=this.material,t=this.el.getObject3D("mesh");t&&(t.material=n),Vg(e,this.system)},setMaterial:function(n){var e,t=this.el,i=this.system;this.material&&Vg(this.material,i),this.material=n,i.registerMaterial(n),(e=t.getObject3D("mesh"))?e.material=n:t.addEventListener("object3dset",function r(s){s.detail.type==="mesh"&&s.target===t&&(t.getObject3D("mesh").material=n,t.removeEventListener("object3dset",r))})}});var Ml,Sl,pd,Wg,Ad,qg="oculus-touch",Ls=Dt+"controllers/oculus/oculus-touch-controller-",Il=Dt+"controllers/meta/",tR={left:{modelUrl:Ls+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new E.Vector3(-.005,.036,-.037),modelPivotRotation:new E.Euler(Math.PI/4.5,0,0)},right:{modelUrl:Ls+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new E.Vector3(.005,.036,-.037),modelPivotRotation:new E.Euler(Math.PI/4.5,0,0)}},jg="oculus-touch",Lr={"oculus-touch":tR,"oculus-touch-v2":{left:{modelUrl:Ls+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new E.Vector3(0,-.007,-.021),modelPivotRotation:new E.Euler(-Math.PI/4,0,0)},right:{modelUrl:Ls+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new E.Vector3(0,-.007,-.021),modelPivotRotation:new E.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:Ls+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new E.Vector3(0,0,0),modelPivotRotation:new E.Euler(0,0,0)},right:{modelUrl:Ls+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new E.Vector3(0,0,0),modelPivotRotation:new E.Euler(0,0,0)}},"meta-quest-touch-pro":{left:{modelUrl:Il+"quest-touch-pro-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new E.Vector3(0,0,0),modelPivotRotation:new E.Euler(0,0,0)},right:{modelUrl:Il+"quest-touch-pro-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new E.Vector3(0,0,0),modelPivotRotation:new E.Euler(0,0,0)}},"meta-quest-touch-plus":{left:{modelUrl:Il+"quest-touch-plus-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new E.Vector3(0,0,0),modelPivotRotation:new E.Euler(0,0,0)},right:{modelUrl:Il+"quest-touch-plus-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new E.Vector3(0,0,0),modelPivotRotation:new E.Euler(0,0,0)}}},Xg={schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]}},after:["tracked-controls"],mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}},bindMethods:function(){this.onButtonChanged=this.onButtonChanged.bind(this),this.onThumbstickMoved=this.onThumbstickMoved.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var n=this;this.onButtonDown=function(e){Ze(e.detail.id,"down",n,n.data.hand)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n,n.data.hand)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n,n.data.hand)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n,n.data.hand)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new E.Euler},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("axismove",this.onAxisMoved),n.addEventListener("model-loaded",this.onModelLoaded),n.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("axismove",this.onAxisMoved),n.removeEventListener("model-loaded",this.onModelLoaded),n.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var n=this.controllerObject3D;n&&(n.visible=!1),Dn(this,qg,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(n){var e,t=this.data;if(t.model){if(this.controllerObject3D)return this.controllerObject3D.visible=!0,void this.el.setObject3D("mesh",this.controllerObject3D);if(this.displayModel=Lr[t.controllerType]||Lr[jg],t.controllerType==="auto"){e=jg;for(var i=Object.keys(Lr),r=0;r<n.profiles.length;r++)if(i.indexOf(n.profiles[r])!==-1){e=n.profiles[r];break}this.displayModel=Lr[e]}var s=this.displayModel[t.hand].modelUrl;this.isTouchV3orPROorPlus=this.displayModel===Lr["oculus-touch-v3"]||this.displayModel===Lr["meta-quest-touch-pro"]||this.displayModel===Lr["meta-quest-touch-plus"],this.el.setAttribute("gltf-model",s)}},injectTrackedControls:function(n){var e=this.data,t=qg;this.el.setAttribute("tracked-controls",{id:t,hand:e.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0}),this.loadModel(n)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(n){var e=this.mapping[this.data.hand].buttons[n.detail.id];if(e){if(this.isTouchV3orPROorPlus)this.onButtonChangedV3orPROorPlus(n);else{var t,i=this.buttonMeshes;e!=="trigger"&&e!=="grip"||(t=n.detail.state.value),i&&(e==="trigger"&&i.trigger&&(i.trigger.rotation.x=this.originalXRotationTrigger-t*(Math.PI/26)),e==="grip"&&i.grip&&(t*=this.data.hand==="left"?-1:1,i.grip.position.x=this.originalXPositionGrip+.004*t))}this.el.emit(e+"changed",n.detail.state)}},onButtonChangedV3orPROorPlus:function(n){var e,t=this.mapping[this.data.hand].buttons[n.detail.id],i=this.buttonObjects;i&&i[t]&&(e=n.detail.state.value,i[t].quaternion.slerpQuaternions(this.buttonRanges[t].min.quaternion,this.buttonRanges[t].max.quaternion,e),i[t].position.lerpVectors(this.buttonRanges[t].min.position,this.buttonRanges[t].max.position,e))},onModelLoaded:function(n){if(n.target===this.el&&this.data.model){if(this.isTouchV3orPROorPlus)this.onTouchV3orPROorPlusModelLoaded(n);else{var e,t=this.controllerObject3D=n.detail.model;(e=this.buttonMeshes={}).grip=t.getObjectByName("buttonHand"),this.originalXPositionGrip=e.grip&&e.grip.position.x,e.trigger=t.getObjectByName("buttonTrigger"),this.originalXRotationTrigger=e.trigger&&e.trigger.rotation.x,e.thumbstick=t.getObjectByName("stick"),e.xbutton=t.getObjectByName("buttonX"),e.abutton=t.getObjectByName("buttonA"),e.ybutton=t.getObjectByName("buttonY"),e.bbutton=t.getObjectByName("buttonB")}for(var i in this.buttonMeshes)this.buttonMeshes[i]&&nR(this.buttonMeshes[i]);this.applyOffset(n.detail.model),this.el.emit("controllermodelready",{name:"meta-touch-controls",model:this.data.model,rayOrigin:this.displayModel[this.data.hand].rayOrigin})}},applyOffset:function(n){n.position.copy(this.displayModel[this.data.hand].modelPivotOffset),n.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation)},onTouchV3orPROorPlusModelLoaded:function(n){var e=this.controllerObject3D=n.detail.model,t=this.buttonObjects={},i=this.buttonMeshes={},r=this.buttonRanges={};i.grip=e.getObjectByName("squeeze"),t.grip=e.getObjectByName("xr_standard_squeeze_pressed_value"),r.grip={min:e.getObjectByName("xr_standard_squeeze_pressed_min"),max:e.getObjectByName("xr_standard_squeeze_pressed_max")},t.grip.minX=t.grip.position.x,i.thumbstick=e.getObjectByName("thumbstick"),t.thumbstick=e.getObjectByName("xr_standard_thumbstick_pressed_value"),r.thumbstick={min:e.getObjectByName("xr_standard_thumbstick_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_pressed_max")},t.thumbstickXAxis=e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_value"),r.thumbstickXAxis={min:e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_max")},t.thumbstickYAxis=e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_value"),r.thumbstickYAxis={min:e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_max")},i.trigger=e.getObjectByName("trigger"),t.trigger=e.getObjectByName("xr_standard_trigger_pressed_value"),r.trigger={min:e.getObjectByName("xr_standard_trigger_pressed_min"),max:e.getObjectByName("xr_standard_trigger_pressed_max")},r.trigger.diff={x:Math.abs(r.trigger.max.rotation.x)-Math.abs(r.trigger.min.rotation.x),y:Math.abs(r.trigger.max.rotation.y)-Math.abs(r.trigger.min.rotation.y),z:Math.abs(r.trigger.max.rotation.z)-Math.abs(r.trigger.min.rotation.z)};var s=this.data.hand==="left"?"x":"a",o=this.data.hand==="left"?"y":"b",a=s+"button",l=o+"button";i[a]=e.getObjectByName(s+"_button"),t[a]=e.getObjectByName(s+"_button_pressed_value"),r[a]={min:e.getObjectByName(s+"_button_pressed_min"),max:e.getObjectByName(s+"_button_pressed_max")},i[l]=e.getObjectByName(o+"_button"),t[l]=e.getObjectByName(o+"_button_pressed_value"),r[l]={min:e.getObjectByName(o+"_button_pressed_min"),max:e.getObjectByName(o+"_button_pressed_max")}},onAxisMoved:function(n){Nn(this,this.mapping[this.data.hand].axes,n)},onThumbstickMoved:function(n){if(this.buttonMeshes&&this.buttonMeshes.thumbstick)if(this.isTouchV3orPROorPlus)this.updateThumbstickTouchV3orPROorPlus(n);else for(var e in n.detail)this.buttonObjects.thumbstick.rotation[this.axisMap[e]]=this.buttonRanges.thumbstick.originalRotation[this.axisMap[e]]-Math.PI/8*n.detail[e]*(e==="y"||this.data.hand==="right"?-1:1)},axisMap:{y:"x",x:"z"},updateThumbstickTouchV3orPROorPlus:function(n){var e=(n.detail.x+1)/2;this.buttonObjects.thumbstickXAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickXAxis.min.quaternion,this.buttonRanges.thumbstickXAxis.max.quaternion,e);var t=(n.detail.y+1)/2;this.buttonObjects.thumbstickYAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickYAxis.min.quaternion,this.buttonRanges.thumbstickYAxis.max.quaternion,t)},updateModel:function(n,e){this.data.model&&this.updateButtonModel(n,e)},updateButtonModel:function(n,e){var t,i=this.buttonMeshes;i&&i[n]&&(t=e==="up"||e==="touchend"?i[n].originalColor||this.data.buttonColor:e==="touchstart"?this.data.buttonTouchColor:this.data.buttonHighlightColor,i[n].material.color.set(t))}};function nR(n){n.traverse(function(e){var t;e.type==="Mesh"&&(t=e.material.clone(),n.originalColor=e.material.color,e.material.dispose(),e.material=t)})}Ge("oculus-touch-controls",Xg),Ge("meta-touch-controls",Xg),Ge("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=new E.Vector3().copy(this.el.object3D.scale),this.auxEuler=new E.Euler,this.boundingBox=new E.Box3,this.boundingBoxSize=new E.Vector3,this.updateCollider=this.updateCollider.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.updateBoundingBox=this.updateBoundingBox.bind(this),this.el.addEventListener("model-loaded",this.onModelLoaded),this.updateCollider(),this.system.addCollider(this.el)},remove:function(){this.system.removeCollider(this.el)},update:function(){this.data.trackedObject3D&&(this.trackedObject3DPath=this.data.trackedObject3D.split("."))},onModelLoaded:function(){this.data.centerModel&&this.centerModel(),this.updateCollider()},centerModel:function(){var n,e=this.el,t=e.components["gltf-model"]&&e.components["gltf-model"].model;t&&(this.el.removeObject3D("mesh"),n=new E.Box3().setFromObject(t).getCenter(new E.Vector3),t.position.x+=t.position.x-n.x,t.position.y+=t.position.y-n.y,t.position.z+=t.position.z-n.z,this.el.setObject3D("mesh",t))},updateCollider:function(){var n=this.el,e=this.boundingBoxSize,t=this.aabb=this.aabb||new Nc;this.obb=this.obb||new Nc,n.hasLoaded?(this.updateBoundingBox(),t.halfSize.copy(e).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):n.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var n=this.renderColliderMesh,e=this.boundingBoxSize;n?(n.geometry.dispose(),n.geometry=new E.BoxGeometry(e.x,e.y,e.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var n,e,t;n=this.boundingBoxSize,e=this.renderColliderGeometry=new E.BoxGeometry(n.x,n.y,n.z),(t=this.renderColliderMesh=new E.Mesh(e,new E.MeshLambertMaterial({color:65280,side:E.DoubleSide}))).matrixAutoUpdate=!1,t.matrixWorldAutoUpdate=!1,t.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(t)},updateBoundingBox:(Ml=new E.Vector3,Sl=new E.Vector3,pd=new E.Quaternion,Wg=new E.Quaternion,Ad=new E.Matrix4,function(){var n=this.auxEuler,e=this.boundingBox,t=this.data.size,i=this.trackedObject3D||this.el.object3D,r=this.boundingBoxSize,s=this.data.minimumColliderDimension;if(t)return this.boundingBoxSize.x=t,this.boundingBoxSize.y=t,void(this.boundingBoxSize.z=t);n.copy(i.rotation),i.rotation.set(0,0,0),i.parent.matrixWorld.decompose(Ml,pd,Sl),Ad.compose(Ml,Wg,Sl),i.parent.matrixWorld.copy(Ad),e.setFromObject(i,!0),e.getSize(r),r.x=r.x<s?s:r.x,r.y=r.y<s?s:r.y,r.z=r.z<s?s:r.z,i.parent.matrixWorld.compose(Ml,pd,Sl),this.el.object3D.rotation.copy(n)}),checkTrackedObject:function(){var n,e=this.trackedObject3DPath;if(e&&e.length&&!this.trackedObject3D){n=this.el;for(var t=0;t<e.length&&(n=n[e[t]]);t++);n&&(this.trackedObject3D=n,this.updateCollider())}return this.trackedObject3D},tick:function(){var n=new E.Vector3,e=new E.Vector3,t=new E.Quaternion,i=new E.Matrix4;return function(){var r=this.obb,s=this.renderColliderMesh,o=this.checkTrackedObject()||this.el.object3D;o&&(o.updateMatrix(),o.updateMatrixWorld(!0),o.matrixWorld.decompose(n,t,e),(Math.abs(e.x-this.previousScale.x)>1e-4||Math.abs(e.y-this.previousScale.y)>1e-4||Math.abs(e.z-this.previousScale.z)>1e-4)&&this.updateCollider(),this.previousScale.copy(e),e.set(1,1,1),i.compose(n,t,e),s&&s.matrixWorld.copy(i),r.copy(this.aabb),r.applyMatrix4(i))}}()});var iR=vt("components:obj-model:warn"),rR=(Ge("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var n=this;this.model=null,this.objLoader=new CE,this.mtlLoader=new wE(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",function(e){n.model&&e.detail.name==="material"&&n.applyMaterial()})},update:function(){var n=this.data;n.obj&&(this.resetMesh(),this.loadObj(n.obj,n.mtl))},remove:function(){this.resetMesh()},resetMesh:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(n,e){var t=this,i=this.el,r=this.mtlLoader,s=this.objLoader,o=this.el.sceneEl.systems.renderer,a=e.substr(0,e.lastIndexOf("/")+1);if(e)return i.hasAttribute("material")&&iR("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(a),void r.load(e,function(l){l.preload(),s.setMaterials(l),s.load(n,function(c){t.model=c,t.model.traverse(function(h){if(h.isMesh){var u=h.material;u.map&&o.applyColorCorrection(u.map),u.emissiveMap&&o.applyColorCorrection(u.emissiveMap)}}),i.setObject3D("mesh",c),i.emit("model-loaded",{format:"obj",model:c})})});s.load(n,function(l){t.model=l,t.applyMaterial(),i.setObject3D("mesh",l),i.emit("model-loaded",{format:"obj",model:l})})},applyMaterial:function(){var n=this.el.components.material;n&&this.model.traverse(function(e){e instanceof E.Mesh&&(e.material=n.material)})}}),Dt+"controllers/oculus/go/oculus-go-controller.gltf"),Yg="oculus-go",Kg=(Ge("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var n=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){Ze(e.detail.id,"down",n)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("model-loaded",this.onModelLoaded),n.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("model-loaded",this.onModelLoaded),n.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){Dn(this,Yg,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var n=this.el,e=this.data;n.setAttribute("tracked-controls",{hand:e.hand,idPrefix:Yg}),this.data.model&&this.el.setAttribute("gltf-model",rR)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(n){var e,t=n.detail.model;n.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=t.getObjectByName("oculus_go_button_trigger"),e.trackpad=t.getObjectByName("oculus_go_touchpad"),e.touchpad=t.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(n){var e=this.mapping.buttons[n.detail.id];e&&this.el.emit(e+"changed",n.detail.state)},onAxisMoved:function(n){Nn(this,this.mapping.axes,n)},updateModel:function(n,e){this.data.model&&this.updateButtonModel(n,e)},updateButtonModel:function(n,e){var t=this.buttonMeshes;if(t&&t[n]){var i;switch(e){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}t[n].material.color.set(i)}}}),"pico-4"),sR=Dt+"controllers/pico/pico4/",Jg=(Ge("pico-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var n=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){Ze(e.detail.id,"down",n,n.data.hand)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n,n.data.hand)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n,n.data.hand)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n,n.data.hand)},this.bindMethods()},update:function(){var n=this.data;this.controllerIndex=n.hand==="right"?0:n.hand==="left"?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("axismove",this.onAxisMoved),n.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("axismove",this.onAxisMoved),n.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var n=this.data;Dn(this,Kg,{index:this.controllerIndex,hand:n.hand})},injectTrackedControls:function(){var n=this.el,e=this.data;n.setAttribute("tracked-controls",{idPrefix:Kg,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",sR+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(n){var e,t=this.mapping[this.data.hand].buttons[n.detail.id];t&&(t==="trigger"&&(e=n.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(t+"changed",n.detail.state))},onModelLoaded:function(n){n.target===this.el&&this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new E.Vector3(0,0,0)})},onAxisMoved:function(n){Nn(this,this.mapping[this.data.hand].axes,n)}}),Ge("position",{schema:{type:"vec3"},update:function(){var n=this.el.object3D,e=this.data;n.position.set(e.x,e.y,e.z)},remove:function(){this.el.object3D.position.set(0,0,0)}}),vt("components:raycaster:warn")),oR=/^[\w\s-.,[\]#]*$/,aR={childList:!0,attributes:!0,subtree:!0},Zg="raycaster-intersected-cleared",$g="raycaster-intersection-cleared";function e0(n,e){var t;for(n.length=e.length,t=0;t<e.length;t++)n[t]=e[t]}Ge("raycaster",{schema:{autoRefresh:{default:!0},direction:{type:"vec3",default:{x:0,y:0,z:-1}},enabled:{default:!0},far:{default:1e3},interval:{default:0},near:{default:0},objects:{default:""},origin:{type:"vec3"},showLine:{default:!1},lineColor:{default:"white"},lineOpacity:{default:1},useWorldCoordinates:{default:!1}},multiple:!0,init:function(){this.clearedIntersectedEls=[],this.unitLineEndVec3=new E.Vector3,this.intersectedEls=[],this.intersections=[],this.newIntersectedEls=[],this.newIntersections=[],this.objects=[],this.prevCheckTime=void 0,this.prevIntersectedEls=[],this.rawIntersections=[],this.raycaster=new E.Raycaster,this.updateOriginDirection(),this.setDirty=this.setDirty.bind(this),this.updateLine=this.updateLine.bind(this),this.observer=new MutationObserver(this.setDirty),this.dirty=!0,this.lineEndVec3=new E.Vector3,this.otherLineEndVec3=new E.Vector3,this.lineData={end:this.lineEndVec3},this.getIntersection=this.getIntersection.bind(this),this.intersectedDetail={el:this.el,getIntersection:this.getIntersection},this.intersectedClearedDetail={el:this.el},this.intersectionClearedDetail={clearedEls:this.clearedIntersectedEls},this.intersectionDetail={}},update:function(n){var e=this.data,t=this.el,i=this.raycaster;i.far=e.far,i.near=e.near,!e.showLine||e.far===n.far&&e.origin===n.origin&&e.direction===n.direction&&n.showLine||(this.unitLineEndVec3.copy(e.direction).normalize(),this.drawLine()),!e.showLine&&n.showLine&&t.removeAttribute("line"),e.objects===n.objects||oR.test(e.objects)||Jg('[raycaster] Selector "'+e.objects+'" may not update automatically with DOM changes.'),e.objects||Jg('[raycaster] For performance, please define raycaster.objects when using raycaster or cursor components to whitelist which entities to intersect with. e.g., raycaster="objects: [data-raycastable]".'),e.autoRefresh!==n.autoRefresh&&t.isPlaying&&(e.autoRefresh?this.addEventListeners():this.removeEventListeners()),n.enabled&&!e.enabled&&this.clearAllIntersections(),e.objects!==n.objects&&this.setDirty()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.data.showLine&&this.el.removeAttribute("line"),this.clearAllIntersections()},addEventListeners:function(){this.data.autoRefresh&&(this.observer.observe(this.el.sceneEl,aR),this.el.sceneEl.addEventListener("object3dset",this.setDirty),this.el.sceneEl.addEventListener("object3dremove",this.setDirty))},removeEventListeners:function(){this.observer.disconnect(),this.el.sceneEl.removeEventListener("object3dset",this.setDirty),this.el.sceneEl.removeEventListener("object3dremove",this.setDirty)},setDirty:function(){this.dirty=!0},refreshObjects:function(){var n,e=this.data;n=e.objects?this.el.sceneEl.querySelectorAll(e.objects):this.el.sceneEl.querySelectorAll("*"),this.objects=this.flattenObject3DMaps(n),this.dirty=!1},tock:function(n){var e=this.data,t=this.prevCheckTime;e.enabled&&(t&&n-t<e.interval||(this.prevCheckTime=n,this.checkIntersections()))},checkIntersections:function(){var n,e,t=this.clearedIntersectedEls,i=this.el,r=this.data,s=this.intersectedEls,o=this.intersections,a=this.newIntersectedEls,l=this.newIntersections,c=this.prevIntersectedEls,h=this.rawIntersections;for(this.dirty&&this.refreshObjects(),e0(this.prevIntersectedEls,this.intersectedEls),this.updateOriginDirection(),h.length=0,this.raycaster.intersectObjects(this.objects,!0,h),o.length=0,s.length=0,n=0;n<h.length;n++)e=h[n],r.showLine&&e.object===i.getObject3D("line")||e.object.el&&(o.push(e),s.push(e.object.el));for(l.length=0,a.length=0,n=0;n<o.length;n++)c.indexOf(o[n].object.el)===-1&&(l.push(o[n]),a.push(o[n].object.el));for(t.length=0,n=0;n<c.length;n++)s.indexOf(c[n])===-1&&(c[n].emit(Zg,this.intersectedClearedDetail),t.push(c[n]));for(t.length&&i.emit($g,this.intersectionClearedDetail),n=0;n<a.length;n++)a[n].emit("raycaster-intersected",this.intersectedDetail);l.length&&(this.intersectionDetail.els=a,this.intersectionDetail.intersections=l,i.emit("raycaster-intersection",this.intersectionDetail)),(c.length===0&&o.length>0||c.length>0&&o.length===0||c.length&&o.length&&c[0]!==o[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=o,i.emit("raycaster-closest-entity-changed",this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var n,e=this.el,t=this.intersections;t.length&&(n=t[0].object.el===e&&t[1]?t[1].distance:t[0].distance),this.drawLine(n)},getIntersection:function(n){var e,t;for(e=0;e<this.intersections.length;e++)if((t=this.intersections[e]).object.el===n)return t;return null},updateOriginDirection:function(){var n=new E.Vector3,e=new E.Vector3;return function(){var t=this.el,i=this.data;i.useWorldCoordinates?this.raycaster.set(i.origin,i.direction):(t.object3D.updateMatrixWorld(),e.setFromMatrixPosition(t.object3D.matrixWorld),i.origin.x===0&&i.origin.y===0&&i.origin.z===0||(e=t.object3D.localToWorld(e.copy(i.origin))),n.copy(i.direction).transformDirection(t.object3D.matrixWorld).normalize(),this.raycaster.set(e,n))}}(),drawLine:function(n){var e,t=this.data,i=this.el;e=this.lineData.end===this.lineEndVec3?this.otherLineEndVec3:this.lineEndVec3,n===void 0&&(n=t.far===1/0?1e3:t.far),this.lineData.start=t.origin,this.lineData.end=e.copy(this.unitLineEndVec3).multiplyScalar(n).add(t.origin),this.lineData.color=t.lineColor,this.lineData.opacity=t.lineOpacity,i.setAttribute("line",this.lineData)},flattenObject3DMaps:function(n){var e,t,i=this.objects,r=this.el.sceneEl.object3D;function s(a){return a.parent?s(a.parent):a===r}for(i.length=0,t=0;t<n.length;t++){var o=n[t];if(o.isEntity&&o.object3D&&s(o.object3D))for(e in o.object3DMap)i.push(o.getObject3D(e))}return i},clearAllIntersections:function(){var n;for(n=0;n<this.intersectedEls.length;n++)this.intersectedEls[n].emit(Zg,this.intersectedClearedDetail);e0(this.clearedIntersectedEls,this.intersectedEls),this.intersectedEls.length=0,this.intersections.length=0,this.el.emit($g,this.intersectionClearedDetail)}});var t0,xs,n0,i0,md=E.MathUtils.degToRad,gd=(Ge("rotation",{schema:{type:"vec3"},update:function(){var n=this.data;this.el.object3D.rotation.set(md(n.x),md(n.y),md(n.z),"YXZ")},remove:function(){this.el.object3D.rotation.set(0,0,0)}}),Ge("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var n=this.data;this.el.object3D.scale.set(n.x,n.y,n.z)},remove:function(){this.el.object3D.scale.set(1,1,1)}}),Ge("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=this.update.bind(this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var n=this.data;this.updateDescendants(n.cast,n.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(n,e){var t=this.el.sceneEl;this.el.object3D.traverse(function(i){if(i instanceof E.Mesh&&(i.castShadow=n,i.receiveShadow=e,t.hasLoaded&&i.material))for(var r=Array.isArray(i.material)?i.material:[i.material],s=0;s<r.length;s++)r[s].needsUpdate=!0})}}),vt("components:sound:warn")),lR=(Ge("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},loopStart:{default:0},loopEnd:{default:0},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var n=this;this.listener=null,this.audioLoader=new E.AudioLoader,this.pool=new E.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){n.playSound()}},update:function(n){var e,t,i=this.data,r=i.src!==n.src;if(r){if(!i.src)return;this.setupSound()}for(e=0;e<this.pool.children.length;e++)t=this.pool.children[e],i.positional&&(t.setDistanceModel(i.distanceModel),t.setMaxDistance(i.maxDistance),t.setRefDistance(i.refDistance),t.setRolloffFactor(i.rolloffFactor)),t.setLoop(i.loop),t.setLoopStart(i.loopStart),i.loopStart!==0&&i.loopEnd===0?t.setLoopEnd(t.buffer.duration):t.setLoopEnd(i.loopEnd),t.setVolume(i.volume),t.isPaused=!1;if(i.on!==n.on&&this.updateEventListener(n.on),r){var s=this;this.loaded=!1,this.audioLoader.load(i.src,function(o){for(e=0;e<s.pool.children.length;e++)(t=s.pool.children[e]).setBuffer(o);s.loaded=!0,E.Cache.remove(i.src),(s.data.autoplay||s.mustPlay)&&s.playSound(s.processSound),s.el.emit("sound-loaded",s.evtDetail,!1)})}},pause:function(){this.stopSound(),this.removeEventListener()},play:function(){this.data.autoplay&&this.playSound(),this.updateEventListener()},remove:function(){var n;this.removeEventListener(),this.el.getObject3D(this.attrName)&&this.el.removeObject3D(this.attrName);try{for(n=0;n<this.pool.children.length;n++)this.pool.children[n].disconnect()}catch{gd("Audio source not properly disconnected")}},updateEventListener:function(n){var e=this.el;n&&e.removeEventListener(n,this.playSoundBound),e.addEventListener(this.data.on,this.playSoundBound)},removeEventListener:function(){this.el.removeEventListener(this.data.on,this.playSoundBound)},setupSound:function(){var n,e,t=this.el,i=t.sceneEl,r=this;this.pool.children.length>0&&(this.stopSound(),t.removeObject3D("sound"));var s=this.listener=i.audioListener||new E.AudioListener;for(i.audioListener=s,i.camera&&i.camera.add(s),i.addEventListener("camera-set-active",function(o){o.detail.cameraEl.getObject3D("camera").add(s)}),this.pool=new E.Group,n=0;n<this.data.poolSize;n++)e=this.data.positional?new E.PositionalAudio(s):new E.Audio(s),this.pool.add(e);for(t.setObject3D(this.attrName,this.pool),n=0;n<this.pool.children.length;n++)(e=this.pool.children[n]).onEnded=function(){this.isPlaying=!1,r.el.emit("sound-ended",r.evtDetail,!1)}},pauseSound:function(){var n,e;for(this.isPlaying=!1,n=0;n<this.pool.children.length;n++)(e=this.pool.children[n]).source&&e.source.buffer&&e.isPlaying&&!e.isPaused&&(e.isPaused=!0,e.pause())},playSound:function(n){var e,t,i;if(!this.loaded)return gd("Sound not loaded yet. It will be played once it finished loading"),this.mustPlay=!0,void(this.processSound=n);for(e=!1,this.isPlaying=!0,t=0;t<this.pool.children.length;t++)(i=this.pool.children[t]).isPlaying||!i.buffer||e||(n&&n(i),i.play(),i.isPaused=!1,e=!0);e?(this.mustPlay=!1,this.processSound=void 0):gd("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the size of pool with the `poolSize` attribute.",this.el)},stopSound:function(){var n,e;for(this.isPlaying=!1,n=0;n<this.pool.children.length;n++){if(!(e=this.pool.children[n]).source||!e.source.buffer)return;e.stop()}}}),He(4433)),cR=He.n(lR),hR=He(5751),uR=He.n(hR),bs=vt("components:text:error"),dR=vt("components:text:warn"),Ei=Dt+"fonts/",r0={aileronsemibold:Ei+"Aileron-Semibold.fnt",dejavu:Ei+"DejaVu-sdf.fnt",exo2bold:Ei+"Exo2Bold.fnt",exo2semibold:Ei+"Exo2SemiBold.fnt",kelsonsans:Ei+"KelsonSans.fnt",monoid:Ei+"Monoid.fnt",mozillavr:Ei+"mozillavr.fnt",roboto:Ei+"Roboto-msdf.json",sourcecodepro:Ei+"SourceCodePro.fnt"},s0=["roboto"],vd="roboto",o0=new function(){var n=this.cache={};this.get=function(e,t){return e in n||(n[e]=t()),n[e]}},a0={},Bl={},fR=/^\w+:/;function l0(n,e,t){return n||(.5+e)*t}Ge("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:vd},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:ai},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=cR()(),this.createOrUpdateMaterial(),this.explicitGeoDimensionsChecked=!1},update:function(n){var e=this.data,t=this.currentFont;Bl[e.font]?this.texture=Bl[e.font]:(this.texture=Bl[e.font]=new E.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),n.font===e.font?t&&(this.updateGeometry(this.geometry,t),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var n,e,t,i=this.data,r=this.material,s=this.shaderData;if(t=i.shader,s0.indexOf(i.font)!==-1||i.font.indexOf("-msdf.")>=0?t="msdf":i.font in r0&&s0.indexOf(i.font)===-1&&(t="sdf"),n=(this.shaderObject&&this.shaderObject.name)!==t,s.alphaTest=i.alphaTest,s.color=i.color,s.map=this.texture,s.opacity=i.opacity,s.side=function(o){switch(o){case"back":return E.FrontSide;case"double":return E.DoubleSide;default:return E.BackSide}}(i.side),s.transparent=i.transparent,s.negate=i.negate,!n)return this.shaderObject.update(s),r.transparent=s.transparent,void(r.side=s.side);e=function(o,a,l){var c,h;return(h=new ai[a].Shader).el=o,h.init(l),h.update(l),(c=h.material).transparent=l.transparent,{material:c,shader:h}}(this.el,t,s),this.material=e.material,this.shaderObject=e.shader,this.material.side=s.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var n,e=this.data,t=this.el,i=this.geometry,r=this;e.font||dR("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),n=this.lookupFont(e.font||vd)||e.font,o0.get(n,function(){return function(s,o){return new Promise(function(a,l){uR()(s,function(c,h){if(c)return bs("Error loading font",s),void l(c);s.indexOf("/Roboto-msdf.json")>=0&&(o=30),o&&h.chars.forEach(function(u){u.yoffset+=o}),a(h)})})}(n,e.yOffset)}).then(function(s){var o;if(s.pages.length!==1)throw new Error("Currently only single-page bitmap fonts are supported.");a0[n]||(s.widthFactor=a0[s]=function(a){var l=0,c=0,h=0;return a.chars.forEach(function(u){l+=u.xadvance,u.id>=48&&u.id<=57&&(h++,c+=u.xadvance)}),h?c/h:l/a.chars.length}(s)),r.currentFont=s,o=r.getFontImageSrc(),o0.get(o,function(){return function(a){return new Promise(function(l,c){new E.ImageLoader().load(a,function(h){l(h)},void 0,function(){bs("Error loading font image",a),c(null)})})}(o)}).then(function(a){var l=r.texture;l&&(l.image=a,l.needsUpdate=!0,Bl[e.font]=l,r.texture=l,r.initMesh(),r.currentFont=s,r.updateGeometry(i,s),r.updateLayout(),r.mesh.visible=!0,t.emit("textfontset",{font:e.font,fontObj:s}))}).catch(function(a){bs(a.message),bs(a.stack)})}).catch(function(s){bs(s.message),bs(s.stack)})},initMesh:function(){this.mesh||(this.mesh=new E.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var n=this.lookupFont(this.data.font||vd)||this.data.font,e=this.currentFont.pages[0];return e.match(fR)&&e.indexOf("http")!==0?n.replace(/(\.fnt)|(\.json)/,".png"):E.LoaderUtils.extractUrlBase(n)+e},updateLayout:function(){var n,e,t,i,r,s,o,a,l,c=this.el,h=this.data,u=this.geometry,d=this.mesh;if(d&&u.layout){if(t=c.getAttribute("geometry"),i=(s=(o=h.width||t&&t.width||1)/l0(h.wrapPixels,h.wrapCount,this.currentFont.widthFactor))*((r=u.layout).height+r.descender),t&&t.primitive==="plane"&&(this.explicitGeoDimensionsChecked||(this.explicitGeoDimensionsChecked=!0,this.hasExplicitGeoWidth=!!t.width,this.hasExplicitGeoHeight=!!t.height),this.hasExplicitGeoWidth||c.setAttribute("geometry","width",o),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),(n=h.anchor==="align"?h.align:h.anchor)==="left")a=0;else if(n==="right")a=-1*r.width;else{if(n!=="center")throw new TypeError("Invalid text.anchor property value",n);a=-1*r.width/2}if((e=h.baseline)==="bottom")l=0;else if(e==="top")l=-1*r.height+r.ascender;else{if(e!=="center")throw new TypeError("Invalid text.baseline property value",e);l=-1*r.height/2}d.position.x=a*s+h.xOffset,d.position.y=l*s,d.position.z=h.zOffset,d.scale.set(s,-1*s,s)}},lookupFont:function(n){return r0[n]},updateGeometry:(t0={},xs={},n0=/\\n/g,i0=/\\t/g,function(n,e){var t=this.data;xs.font=e,xs.lineHeight=t.lineHeight&&isFinite(t.lineHeight)?t.lineHeight:e.common.lineHeight,xs.text=t.value.toString().replace(n0,`
`).replace(i0," "),xs.width=l0(t.wrapPixels,t.wrapCount,e.widthFactor),n.update(Cn(t0,t,xs))})});var Cs,yd,c0=(Ge("tracked-controls",{schema:{id:{type:"string",default:""},controller:{default:-1},autoHide:{default:!0},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},iterateControllerProfiles:{default:!1}},init:function(){this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.updateController=this.updateController.bind(this)},update:function(){this.updateController()},play:function(){var n=this.el.sceneEl;this.updateController(),n.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(n){return!(!this.controller||this.controller.gamepad||n.inputSource.handedness!=="none"&&n.inputSource.handedness!==this.data.hand)},updateController:function(){this.controller=Op(this.system.controllers,this.data.id,this.data.hand,this.data.controller,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller},tick:function(){var n=this.el.sceneEl,e=this.controller,t=n.frame;this.data.autoHide&&(this.el.object3D.visible=!!e),e&&n.frame&&this.system.referenceSpace&&(e.hand||(this.pose=t.getPose(e.gripSpace,this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var n=this.el.object3D,e=this.pose;e&&(n.matrix.elements=e.transform.matrix,n.matrix.decompose(n.position,n.rotation,n.scale))},updateButtons:function(){var n,e,t,i=this.controller;if(i&&i.gamepad){for(t=i.gamepad,e=0;e<t.buttons.length;++e)this.buttonStates[e]||(this.buttonStates[e]={pressed:!1,touched:!1,value:0}),this.buttonEventDetails[e]||(this.buttonEventDetails[e]={id:e,state:this.buttonStates[e]}),n=t.buttons[e],this.handleButton(e,n);this.handleAxes()}},handleButton:function(n,e){return!!(this.handlePress(n,e)|this.handleTouch(n,e)|this.handleValue(n,e))&&(this.el.emit("buttonchanged",this.buttonEventDetails[n],!1),!0)},handleAxes:function(){var n,e=!1,t=this.controller.gamepad.axes,i=this.axis,r=this.changedAxes;for(this.changedAxes.splice(0,this.changedAxes.length),n=0;n<t.length;++n)r.push(i[n]!==t[n]),r[n]&&(e=!0);if(!e)return!1;for(this.axis.splice(0,this.axis.length),n=0;n<t.length;n++)this.axis.push(t[n]);return this.el.emit("axismove",this.axisMoveEventDetail,!1),!0},handlePress:function(n,e){var t,i=this.buttonStates[n];return e.pressed!==i.pressed&&(t=e.pressed?"buttondown":"buttonup",this.el.emit(t,this.buttonEventDetails[n],!1),i.pressed=e.pressed,!0)},handleTouch:function(n,e){var t,i=this.buttonStates[n];return e.touched!==i.touched&&(t=e.touched?"touchstart":"touchend",this.el.emit(t,this.buttonEventDetails[n],!1),i.touched=e.touched,!0)},handleValue:function(n,e){var t=this.buttonStates[n];return e.value!==t.value&&(t.value=e.value,!0)}}),Ge("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}}),Dt+"controllers/valve/index/valve-index-"),pR={left:c0+"left.glb",right:c0+"right.glb"},h0="valve",AR={left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}},mR={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}},gR=(Ge("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var n=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){Ze(e.detail.id,"down",n)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("model-loaded",this.onModelLoaded),n.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("model-loaded",this.onModelLoaded),n.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var n=this.data,e=n.hand==="right"?0:n.hand==="left"?1:2;Dn(this,h0,{index:e,iterateControllerProfiles:!0,hand:n.hand})},injectTrackedControls:function(){var n=this.el,e=this.data;n.setAttribute("tracked-controls",{idPrefix:h0,controller:e.hand==="right"?1:e.hand==="left"?0:2,hand:e.hand}),this.loadModel()},loadModel:function(){var n=this.data;n.model&&this.el.setAttribute("gltf-model",""+pR[n.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(n){var e,t=this.mapping.buttons[n.detail.id],i=this.buttonMeshes;t&&(t==="trigger"&&(e=n.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-e*(Math.PI/40))),this.el.emit(t+"changed",n.detail.state))},onModelLoaded:function(n){var e,t=n.detail.model,i=this;n.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:t.getObjectByName("leftgrip"),right:t.getObjectByName("rightgrip")},e.menu=t.getObjectByName("menubutton"),e.system=t.getObjectByName("systembutton"),e.trackpad=t.getObjectByName("touchpad"),e.trigger=t.getObjectByName("trigger"),this.triggerOriginalRotationX=e.trigger.rotation.x,Object.keys(e).forEach(function(r){i.setButtonColor(r,i.data.buttonColor)}),t.position.copy(mR[this.data.hand]),t.rotation.copy(AR[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controls",model:this.data.model,rayOrigin:new E.Vector3(0,0,0)}))},onAxisMoved:function(n){Nn(this,this.mapping.axes,n)},updateModel:function(n,e){var t;this.data.model&&(e.indexOf("touch")!==-1||(t=e==="up"?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(n,t)))},setButtonColor:function(n,e){}}),Dt+"controllers/vive/vr_controller_vive.obj"),vR=Dt+"controllers/vive/vr_controller_vive.mtl",u0="htc-vive",yR=(Ge("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","none"]},init:function(){var n=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){Ze(e.detail.id,"down",n)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n)},this.previousButtonValues={},this.bindMethods()},update:function(){var n=this.data;this.controllerIndex=n.hand==="right"?0:n.hand==="left"?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("model-loaded",this.onModelLoaded),n.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("model-loaded",this.onModelLoaded),n.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var n=this.data;Dn(this,u0,{index:this.controllerIndex,hand:n.hand})},injectTrackedControls:function(){var n=this.el,e=this.data;n.setAttribute("tracked-controls",{idPrefix:u0,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("obj-model",{obj:gR,mtl:vR})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(n){var e,t=this.mapping.buttons[n.detail.id],i=this.buttonMeshes;t&&(t==="trigger"&&(e=n.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-e*(Math.PI/12))),this.el.emit(t+"changed",n.detail.state))},onModelLoaded:function(n){var e,t=n.detail.model,i=this;n.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:t.getObjectByName("leftgrip"),right:t.getObjectByName("rightgrip")},e.menu=t.getObjectByName("menubutton"),e.system=t.getObjectByName("systembutton"),e.trackpad=t.getObjectByName("touchpad"),e.touchpad=t.getObjectByName("touchpad"),e.trigger=t.getObjectByName("trigger"),Object.keys(e).forEach(function(r){i.setButtonColor(r,i.data.buttonColor)}),t.position.set(0,-.015,.04))},onAxisMoved:function(n){Nn(this,this.mapping.axes,n)},updateModel:function(n,e){var t;this.data.model&&(e.indexOf("touch")!==-1||(t=e==="up"?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(n,t)))},setButtonColor:function(n,e){var t=this.buttonMeshes;if(t)return n==="grip"?(t.grip.left.material.color.set(e),void t.grip.right.material.color.set(e)):void t[n].material.color.set(e)}}),Dt+"controllers/vive/focus-controller/focus-controller.gltf"),d0="htc-vive-focus",f0=(Ge("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var n=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){Ze(e.detail.id,"down",n)},this.onButtonUp=function(e){Ze(e.detail.id,"up",n)},this.onButtonTouchStart=function(e){Ze(e.detail.id,"touchstart",n)},this.onButtonTouchEnd=function(e){Ze(e.detail.id,"touchend",n)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("model-loaded",this.onModelLoaded),n.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("model-loaded",this.onModelLoaded),n.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){Dn(this,d0,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){this.el.setAttribute("tracked-controls",{idPrefix:d0}),this.data.model&&this.el.setAttribute("gltf-model",yR)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(n){var e,t=n.detail.model;n.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=t.getObjectByName("BumperKey"),e.triggerPressed=t.getObjectByName("BumperKey_Press"),e.triggerPressed&&(e.triggerPressed.visible=!1),e.touchpad=t.getObjectByName("TouchPad"),e.touchpadPressed=t.getObjectByName("TouchPad_Press"),e.trackpad=t.getObjectByName("TouchPad"),e.trackpadPressed=t.getObjectByName("TouchPad_Press"),e.trackpadPressed&&(e.trackpadPressed.visible=!1))},onButtonChanged:function(n){var e=this.mapping.buttons[n.detail.id];e&&this.el.emit(e+"changed",n.detail.state)},onAxisMoved:function(n){Nn(this,this.mapping.axes,n)},updateModel:function(n,e){this.data.model&&this.updateButtonModel(n,e)},updateButtonModel:function(n,e){var t=this.buttonMeshes,i=n+"Pressed";if(t&&t[n]&&t[i]){var r;switch(e){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor}r&&t[i].material.color.set(r),t[i].visible=!!r,t[n].visible=!r}}}),{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}),ER=Gp,p0=1e-5,xR=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];Ge("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},after:["look-controls"],init:function(){this.keys={},this.easing=1.1,this.velocity=new E.Vector3,this.onBlur=this.onBlur.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.attachVisibilityEventListeners()},tick:function(n,e){var t=this.data,i=this.el,r=this.velocity;(r[t.adAxis]||r[t.wsAxis]||!function(s){var o;for(o in s)return!1;return!0}(this.keys))&&(e/=1e3,this.updateVelocity(e),(r[t.adAxis]||r[t.wsAxis])&&i.object3D.position.add(this.getMovementVector(e)))},update:function(n){n.adAxis!==this.data.adAxis&&(this.velocity[n.adAxis]=0),n.wsAxis!==this.data.wsAxis&&(this.velocity[n.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(n){var e,t,i,r,s,o=this.data,a=this.keys,l=this.velocity;if(t=o.adAxis,r=o.wsAxis,n>.2)return l[t]=0,void(l[r]=0);var c=Math.pow(1/this.easing,60*n);l[t]!==0&&(l[t]=l[t]*c),l[r]!==0&&(l[r]=l[r]*c),Math.abs(l[t])<p0&&(l[t]=0),Math.abs(l[r])<p0&&(l[r]=0),o.enabled&&(e=o.acceleration,o.adEnabled&&(i=o.adInverted?-1:1,(a.KeyA||a.ArrowLeft)&&(l[t]-=i*e*n),(a.KeyD||a.ArrowRight)&&(l[t]+=i*e*n)),o.wsEnabled&&(s=o.wsInverted?-1:1,(a.KeyW||a.ArrowUp)&&(l[r]-=s*e*n),(a.KeyS||a.ArrowDown)&&(l[r]+=s*e*n)))},getMovementVector:(Cs=new E.Vector3(0,0,0),yd=new E.Euler(0,0,0,"YXZ"),function(n){var e,t=this.el.getAttribute("rotation"),i=this.velocity;return Cs.copy(i),Cs.multiplyScalar(n),t&&(e=this.data.fly?t.x:0,yd.set(E.MathUtils.degToRad(e),E.MathUtils.degToRad(t.y),0),Cs.applyEuler(yd)),Cs}),attachVisibilityEventListeners:function(){window.oncontextmenu=this.onContextMenu,window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus),document.addEventListener("visibilitychange",this.onVisibilityChange)},removeVisibilityEventListeners:function(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),document.removeEventListener("visibilitychange",this.onVisibilityChange)},attachKeyEventListeners:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)},removeKeyEventListeners:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)},onContextMenu:function(){for(var n=Object.keys(this.keys),e=0;e<n.length;e++)delete this.keys[n[e]]},onBlur:function(){this.pause()},onFocus:function(){this.play()},onVisibilityChange:function(){document.hidden?this.onBlur():this.onFocus()},onKeyDown:function(n){var e;ER(n)&&(e=n.code||f0[n.keyCode],xR.indexOf(e)!==-1&&(this.keys[e]=!0))},onKeyUp:function(n){var e;e=n.code||f0[n.keyCode],delete this.keys[e]}});var Ed,Tl,Ao,mo=vt("components:windows-motion-controls:debug"),ws=vt("components:windows-motion-controls:warn"),bR=Dt+"controllers/microsoft/",A0={left:"left.glb",right:"right.glb",default:"universal.glb"},m0="windows-mixed-reality",_s=(Ge("windows-motion-controls",{schema:{hand:{default:"right"},pair:{default:0},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"},bindMethods:function(){this.onModelError=this.onModelError.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var n=this,e=this.el;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){Ze(t.detail.id,"down",n)},this.onButtonUp=function(t){Ze(t.detail.id,"up",n)},this.onButtonTouchStart=function(t){Ze(t.detail.id,"touchstart",n)},this.onButtonTouchEnd=function(t){Ze(t.detail.id,"touchend",n)},this.onControllerConnected=function(){n.setModelVisibility(!0)},this.onControllerDisconnected=function(){n.setModelVisibility(!1)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new E.Vector3,direction:new E.Vector3(0,0,-1),createdFromMesh:!1},e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var n=this.el;n.addEventListener("buttonchanged",this.onButtonChanged),n.addEventListener("buttondown",this.onButtonDown),n.addEventListener("buttonup",this.onButtonUp),n.addEventListener("touchstart",this.onButtonTouchStart),n.addEventListener("touchend",this.onButtonTouchEnd),n.addEventListener("axismove",this.onAxisMoved),n.addEventListener("model-error",this.onModelError),n.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var n=this.el;n.removeEventListener("buttonchanged",this.onButtonChanged),n.removeEventListener("buttondown",this.onButtonDown),n.removeEventListener("buttonup",this.onButtonUp),n.removeEventListener("touchstart",this.onButtonTouchStart),n.removeEventListener("touchend",this.onButtonTouchEnd),n.removeEventListener("axismove",this.onAxisMoved),n.removeEventListener("model-error",this.onModelError),n.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){Dn(this,m0,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(this.data.model&&!this.rayOrigin.createdFromMesh){var n=this.createControllerModelUrl();this.loadModel(n)}else this.modelReady()},createControllerModelUrl:function(n){var e=this.data.hand;return bR+"default/"+(A0[e]||A0.default)},injectTrackedControls:function(){var n=this.data;this.el.setAttribute("tracked-controls",{idPrefix:m0,controller:n.pair,hand:n.hand}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(n){var e=this.createControllerModelUrl(!0);n.detail.src!==e?(ws("Failed to load controller model for device, attempting to load default."),this.loadModel(e)):ws("Failed to load default controller model.")},loadModel:function(n){this.el.setAttribute("gltf-model","url("+n+")")},onModelLoaded:function(n){var e,t,i,r,s=this.controllerModel=n.detail.model,o=this.loadedMeshInfo;if(n.target===this.el){if(mo("Processing model"),o.buttonMeshes={},o.axisMeshes={},s){for(e=0;e<this.mapping.buttons.length;e++)(t=this.mapping.buttonMeshNames[this.mapping.buttons[e]])?(i=s.getObjectByName(t))?(r={index:e,value:a(i,"VALUE"),pressed:a(i,"PRESSED"),unpressed:a(i,"UNPRESSED")}).value&&r.pressed&&r.unpressed?o.buttonMeshes[this.mapping.buttons[e]]=r:ws("Missing button submesh under mesh with name: "+t+"(VALUE: "+!!r.value+", PRESSED: "+!!r.pressed+", UNPRESSED:"+!!r.unpressed+")"):ws("Missing button mesh with name: "+t):mo("Skipping unknown button at index: "+e+" with mapped name: "+this.mapping.buttons[e]);for(e=0;e<this.mapping.axisMeshNames.length;e++)(t=this.mapping.axisMeshNames[e])?(i=s.getObjectByName(t))?(r={index:e,value:a(i,"VALUE"),min:a(i,"MIN"),max:a(i,"MAX")}).value&&r.min&&r.max?o.axisMeshes[e]=r:ws("Missing axis submesh under mesh with name: "+t+"(VALUE: "+!!r.value+", MIN: "+!!r.min+", MAX:"+!!r.max+")"):ws("Missing axis mesh with name: "+t):mo("Skipping unknown axis at index: "+e);this.calculateRayOriginFromMesh(s),this.setModelVisibility()}mo("Model load complete.")}function a(l,c){for(var h=0,u=l.children.length;h<u;h++){var d=l.children[h];if(d&&d.name===c)return d}}},calculateRayOriginFromMesh:function(){var n=new E.Quaternion;return function(e){var t;if(this.rayOrigin.origin.set(0,0,0),this.rayOrigin.direction.set(0,0,-1),this.rayOrigin.createdFromMesh=!0,t=e.getObjectByName(this.mapping.pointingPoseMeshName)){var i=e.parent;i&&(e.parent=null,e.updateMatrixWorld(!0),e.parent=i),t.getWorldPosition(this.rayOrigin.origin),t.getWorldQuaternion(n),this.rayOrigin.direction.applyQuaternion(n),i&&e.updateMatrixWorld(!0)}else mo("Mesh does not contain pointing origin data, defaulting to none.");this.modelReady()}}(),lerpAxisTransform:function(){var n=new E.Quaternion;return function(e,t){var i=this.loadedMeshInfo.axisMeshes[e];if(i){var r=i.min,s=i.max,o=i.value,a=.5*t+.5;o.setRotationFromQuaternion(n.copy(r.quaternion).slerp(s.quaternion,a)),o.position.lerpVectors(r.position,s.position,a)}}}(),lerpButtonTransform:function(){var n=new E.Quaternion;return function(e,t){var i=this.loadedMeshInfo.buttonMeshes[e];if(i){var r=i.unpressed,s=i.pressed,o=i.value;o.setRotationFromQuaternion(n.copy(r.quaternion).slerp(s.quaternion,t)),o.position.lerpVectors(r.position,s.position,t)}}}(),modelReady:function(){this.el.emit("controllermodelready",{name:"windows-motion-controls",model:this.data.model,rayOrigin:this.rayOrigin})},onButtonChanged:function(n){var e=this.mapping.buttons[n.detail.id];e&&(this.loadedMeshInfo&&this.loadedMeshInfo.buttonMeshes&&this.lerpButtonTransform(e,n.detail.state.value),this.el.emit(e+"changed",n.detail.state))},onAxisMoved:function(n){var e=this.mapping.axisMeshNames.length;if(this.loadedMeshInfo&&this.loadedMeshInfo.axisMeshes)for(var t=0;t<e;t++)this.lerpAxisTransform(t,n.detail.axis[t]||0);Nn(this,this.mapping.axes,n)},setModelVisibility:function(n){var e=this.el.getObject3D("mesh");this.controllerPresent&&(n=n!==void 0?n:this.modelVisible,this.modelVisible=n,e&&(e.visible=n))}}),Ed=new E.Quaternion,Tl=new E.Vector3,function(n,e,t){e.position.copy(n.transform.position),e.quaternion.copy(n.transform.orientation),Tl.copy(t),Ed.copy(n.transform.orientation),Tl.applyQuaternion(Ed),e.position.sub(Tl)});function rn(n,e){this.renderer=n,this.xrHitTestSource=null,n.xr.addEventListener("sessionend",(function(){this.xrHitTestSource=null}).bind(this)),n.xr.addEventListener("sessionstart",(function(){this.sessionStart(e)}).bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(e)}function xd(n){console.warn(n.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from <a-scene>?')}_s.tempFakePose={transform:{orientation:new E.Quaternion,position:new E.Vector3}},rn.prototype.previousFrameAnchors=new Set,rn.prototype.anchorToObject3D=new Map,rn.prototype.sessionStart=function(n){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?n.space?this.session.requestHitTestSource(n).then((function(e){this.xrHitTestSource=e}).bind(this)).catch(xd):n.profile&&this.session.requestHitTestSourceForTransientInput(n).then((function(e){this.xrHitTestSource=e,this.transient=!0}).bind(this)).catch(xd):xd({message:"No requestHitTestSource on the session."})},rn.prototype.anchorFromLastHitTestResult=function(n,e){var t=this.lastHitTest;if(t){var i={object3D:n,offset:e};Array.from(this.anchorToObject3D.entries()).forEach((function(r){var s=r[1].object3D,o=r[0];s===n&&(this.anchorToObject3D.delete(o),o.delete())}).bind(this)),t.createAnchor&&t.createAnchor().then((function(r){this.anchorToObject3D.set(r,i)}).bind(this)).catch(function(r){console.warn(r.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from <a-scene>?')})}},rn.prototype.doHit=function(n){if(this.renderer.xr.isPresenting){var e,t,i=this.renderer.xr.getReferenceSpace(),r=n.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(e=n.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(t=e[0].results).length>0&&(this.lastHitTest=t[0],t[0].getPose(i)):(e=n.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=e[0],e[0].getPose(i)):void 0}},rn.updateAnchorPoses=function(n,e){var t=n.trackedAnchors||rn.prototype.previousFrameAnchors;rn.prototype.previousFrameAnchors.forEach(function(i){t.has(i)||rn.prototype.anchorToObject3D.delete(i)}),t.forEach(function(i){var r,s,o,a;try{if(r=n.getPose(i.anchorSpace,e)){if(!(s=rn.prototype.anchorToObject3D.get(i)))return;o=s.offset,a=s.object3D,_s(r,a,o)}}catch(l){console.error("while updating anchor poses:",l)}}),rn.prototype.previousFrameAnchors=t},Ge("ar-hit-test",{schema:{target:{type:"selector"},enabled:{default:!0},src:{default:"data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=",type:"map"},type:{default:"footprint",oneOf:["footprint","map"]},footprintDepth:{default:.1},mapSize:{type:"vec2",default:{x:.5,y:.5}}},sceneOnly:!0,init:function(){this.hitTest=null,this.imageDataArray=new Uint8ClampedArray(1048576),this.imageData=new ImageData(this.imageDataArray,512,512),this.textureCache=new Map,this.orthoCam=new E.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new E.WebGLRenderTarget(512,512,{}),this.basicMaterial=new E.MeshBasicMaterial({color:0,side:E.DoubleSide}),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.canvas.width=512,this.canvas.height=512,this.canvasTexture=new E.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var n=this.el.getAttribute("webxr"),e=n.optionalFeatures;e.includes("hit-test")&&e.includes("anchors")||(e.push("hit-test"),e.push("anchors"),this.el.setAttribute("webxr",n)),this.el.sceneEl.renderer.xr.addEventListener("sessionend",(function(){this.hitTest=null}).bind(this)),this.el.sceneEl.addEventListener("enter-vr",(function(){if(this.el.is("ar-mode")){var t=this.el.sceneEl.renderer,i=this.session=t.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,Ao||(Ao=new Map),i.requestReferenceSpace("viewer").then((function(a){this.viewerHitTest=this.hitTest=new rn(t,{space:a}),this.el.emit("ar-hit-test-start")}).bind(this));var r=this;this.el.sceneEl.addEventListener("controllersupdated",function(){var a=this.xrSession&&this.xrSession.inputSources;if(a){for(var l=0;l<a.length;++l)if(a[l].targetRayMode==="tracked-pointer"){r.hitTest=new rn(t,{space:a[l].targetRaySpace}),Ao.set(a[l],r.hitTest),r.viewerHitTest&&typeof r.viewerHitTest.cancel=="function"&&(r.viewerHitTest.cancel(),r.viewerHitTest=null);break}}});var s="generic-touchscreen",o=new rn(t,{profile:s});i.addEventListener("selectstart",(function(a){if(this.data.enabled===!0){var l=a.inputSource;this.bboxMesh.visible=!0,this.hasPosedOnce===!0&&(this.el.emit("ar-hit-test-select-start",{inputSource:l,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),l.profiles[0]===s?this.hitTest=o:(this.hitTest=Ao.get(l)||new rn(t,{space:l.targetRaySpace}),Ao.set(l,this.hitTest)))}}).bind(this)),i.addEventListener("selectend",(function(a){if(this.hitTest&&this.data.enabled===!0){var l,c=a.inputSource;this.hasPosedOnce===!0&&(this.bboxMesh.visible=!1,this.data.target&&(l=this.data.target.object3D)&&(_s.tempFakePose.transform.position.copy(this.bboxMesh.position),_s.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),_s(_s.tempFakePose,l,this.bboxOffset),l.visible=!0,this.hitTest.anchorFromLastHitTestResult(l,this.bboxOffset)),this.el.emit("ar-hit-test-select",{inputSource:c,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),this.hitTest=null)}else this.hitTest=null}).bind(this))}}).bind(this)),this.bboxOffset=new E.Vector3,this.update=this.update.bind(this),this.makeBBox()},update:function(){this.data.enabled===!1&&(this.hitTest=null,this.bboxMesh.visible=!1),this.data.target&&(this.data.target.object3D?(this.data.target.addEventListener("model-loaded",this.update),this.data.target.object3D.layers.enable(21),this.data.target.object3D.traverse(function(n){n.layers.enable(21)})):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var n=new E.PlaneGeometry(1,1),e=new E.MeshBasicMaterial({transparent:!0,color:16777215});n.rotateX(-Math.PI/2),n.rotateY(-Math.PI/2),this.bbox=new E.Box3,this.bboxMesh=new E.Mesh(n,e),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var n,e,t,i=this.el.sceneEl.renderer,r=i.xr.enabled;this.bboxMesh.material.map=this.canvasTexture,this.bboxMesh.material.needsUpdate=!0,this.orthoCam.rotation.set(-Math.PI/2,0,-Math.PI/2),this.orthoCam.position.copy(this.bboxMesh.position),this.orthoCam.position.y-=this.bboxMesh.scale.y/2,this.orthoCam.near=.1,this.orthoCam.far=this.orthoCam.near+this.data.footprintDepth*this.bboxMesh.scale.y,this.orthoCam.position.y+=this.orthoCam.far,this.orthoCam.right=this.bboxMesh.scale.z/2,this.orthoCam.left=-this.bboxMesh.scale.z/2,this.orthoCam.top=this.bboxMesh.scale.x/2,this.orthoCam.bottom=-this.bboxMesh.scale.x/2,this.orthoCam.updateProjectionMatrix(),e=i.getRenderTarget(),i.setRenderTarget(this.textureTarget),i.xr.enabled=!1,t=this.el.object3D.background,this.el.object3D.overrideMaterial=this.basicMaterial,this.el.object3D.background=null,i.render(this.el.object3D,this.orthoCam),this.el.object3D.background=t,this.el.object3D.overrideMaterial=null,i.xr.enabled=r,i.setRenderTarget(e),i.readRenderTargetPixels(this.textureTarget,0,0,512,512,this.imageDataArray),this.context.putImageData(this.imageData,0,0),this.context.shadowColor="white",this.context.shadowBlur=10,this.context.drawImage(this.canvas,0,0),n=this.context.getImageData(0,0,512,512);for(var s=0;s<262144;s++)n.data[4*s+3]!==0&&n.data[4*s+3]!==255&&(n.data[4*s+3]=128);this.context.putImageData(n,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var n,e,t=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;t&&rn.updateAnchorPoses(t,i.xr.getReferenceSpace()),this.bboxNeedsUpdate&&(this.bboxNeedsUpdate=!1,this.data.target&&this.data.type!=="map"||(this.textureCache.has(this.data.src)?e=this.textureCache.get(this.data.src):(e=new E.TextureLoader().load(this.data.src),this.textureCache.set(this.data.src,e)),this.bboxMesh.material.map=e,this.bboxMesh.material.needsUpdate=!0),this.data.target&&this.data.target.object3D?(this.bbox.setFromObject(this.data.target.object3D),this.bbox.getCenter(this.bboxMesh.position),this.bbox.getSize(this.bboxMesh.scale),this.data.type==="footprint"&&(this.bboxMesh.scale.x*=1.04,this.bboxMesh.scale.z*=1.04,this.updateFootprint()),this.bboxMesh.position.y-=this.bboxMesh.scale.y/2,this.bboxOffset.copy(this.bboxMesh.position),this.bboxOffset.sub(this.data.target.object3D.position)):this.bboxMesh.scale.set(this.data.mapSize.x,1,this.data.mapSize.y)),this.hitTest&&(n=this.hitTest.doHit(t))&&(this.hasPosedOnce!==!0&&(this.hasPosedOnce=!0,this.el.emit("ar-hit-test-achieved")),this.bboxMesh.visible=!0,this.bboxMesh.position.copy(n.transform.position),this.bboxMesh.quaternion.copy(n.transform.orientation))}}),Ge("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},sceneOnly:!0,update:function(){var n=this.data,e=this.el.object3D;n.transparent?e.background=null:e.background=new E.Color(n.color)},remove:function(){this.el.object3D.background=null}}),Ge("debug",{schema:{default:!0},sceneOnly:!0});var g0="a-dialog-buttons-container",bd="a-dialog-button";function v0(n,e){var t,i,r,s;return(t=document.createElement("div")).classList.add("a-modal"),t.setAttribute(Kt,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(Kt,""),t.appendChild(i),(r=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(r),(s=document.createElement("div")).classList.add("a-dialog-text"),s.innerHTML=n,r.appendChild(s),i.appendChild(e),t}Ge("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},sceneOnly:!0,init:function(){var n=this;this.data.enabled&&(window.isSecureContext||this.showHTTPAlert(),typeof DeviceOrientationEvent<"u"&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=this.onDeviceMotionDialogAllowClicked.bind(this),this.onDeviceMotionDialogDenyClicked=this.onDeviceMotionDialogDenyClicked.bind(this),DeviceOrientationEvent.requestPermission().then(function(){n.el.emit("deviceorientationpermissiongranted"),n.permissionGranted=!0}).catch(function(){var e,t,i,r,s,o,a,l;n.devicePermissionDialogEl=(e=n.data.denyButtonText,t=n.data.allowButtonText,i=n.data.deviceMotionMessage,r=n.onDeviceMotionDialogAllowClicked,s=n.onDeviceMotionDialogDenyClicked,(o=document.createElement("div")).classList.add(g0),(a=document.createElement("button")).classList.add(bd,"a-dialog-deny-button"),a.setAttribute(Kt,""),a.innerHTML=e,o.appendChild(a),(l=document.createElement("button")).classList.add(bd,"a-dialog-allow-button"),l.setAttribute(Kt,""),l.innerHTML=t,o.appendChild(l),l.addEventListener("click",function(c){c.stopPropagation(),r()}),a.addEventListener("click",function(c){c.stopPropagation(),s()}),v0(i,o)),n.el.appendChild(n.devicePermissionDialogEl)})):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var n,e,t,i,r,s=this,o=(n=s.data.cancelButtonText,e=s.data.httpsMessage,t=function(){s.el.removeChild(o)},(i=document.createElement("div")).classList.add(g0),(r=document.createElement("button")).classList.add(bd,"a-dialog-ok-button"),r.setAttribute(Kt,""),r.innerHTML=n,i.appendChild(r),r.addEventListener("click",function(a){a.stopPropagation(),t()}),v0(e,i));this.el.appendChild(o)},onDeviceMotionDialogAllowClicked:function(){var n=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then(function(e){e==="granted"?(n.el.emit("deviceorientationpermissiongranted"),n.permissionGranted=!0):n.el.emit("deviceorientationpermissionrejected"),n.remove()}).catch(console.error)}}),Ge("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},sceneOnly:!0,update:function(){var n=this.el,e=n.querySelector(".a-enter-vr");this.data===!0?(e&&e.classList.add("embedded"),n.removeFullScreenStyles()):(e&&e.classList.remove("embedded"),n.addFullScreenStyles())}});var CR="https://unpkg.com/aframe-inspector@"+function(){var n=ix.split(".");return n[2]="x",n.join(".")}()+"/dist/aframe-inspector.min.js";Ge("inspector",{schema:{url:{default:CR}},sceneOnly:!0,init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var n;this.firstPlay&&(n=ra("inspector"))!=="false"&&n&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML='Loading Inspector<span class="dots"><span>.</span><span>.</span><span>.</span></span>'},remove:function(){this.removeEventListeners()},onKeydown:function(n){n.keyCode===73&&(n.ctrlKey&&n.altKey||n.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(n){n.data==="INJECT_AFRAME_INSPECTOR"&&this.openInspector()},openInspector:function(n){var e,t=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(n):(this.showLoader(),(e=document.createElement("script")).src=this.data.url,e.setAttribute("data-name","aframe-inspector"),e.setAttribute(Kt,""),e.onload=function(){AFRAME.INSPECTOR.open(n),t.hideLoader(),t.removeEventListeners()},e.onerror=function(){t.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(e),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}}),Ge("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},sceneOnly:!0,update:function(){var n=this.data,e=this.el,t=this.el.object3D.fog;t&&n.type===t.name?Object.keys(this.schema).forEach(function(i){var r=n[i];i==="color"&&(r=new E.Color(r)),t[i]=r}):e.object3D.fog=function(i){var r;return(r=i.type==="exponential"?new E.FogExp2(i.color,i.density):new E.Fog(i.color,i.near,i.far)).name=i.type,r}(n)},remove:function(){var n=this.el;this.el.object3D.fog&&(n.object3D.fog=null)}}),Ge("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},sceneOnly:!0,init:function(){this.onKeyup=this.onKeyup.bind(this)},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(n){var e=this.el;Gp(n)&&(this.data.enterVR&&n.keyCode===70&&e.enterVR(),this.data.exitVR&&n.keyCode===27&&e.exitVR())}});var go=vt("components:pool:warn");Ge("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},sceneOnly:!0,multiple:!0,initPool:function(){var n;for(this.availableEls=[],this.usedEls=[],this.data.mixin||go("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||go("Container "+this.data.container+" not found.")),this.container=this.container||this.el,n=0;n<this.data.size;++n)this.createEntity()},update:function(n){var e=this.data;n.mixin===e.mixin&&n.size===e.size||this.initPool()},createEntity:function(){var n;(n=document.createElement("a-entity")).play=this.wrapPlay(n.play),n.setAttribute("mixin",this.data.mixin),n.object3D.visible=!1,n.pause(),this.container.appendChild(n),this.availableEls.push(n);var e=this.usedEls;n.addEventListener("loaded",function(){e.indexOf(n)===-1&&(n.object3DParent=n.object3D.parent,n.object3D.parent.remove(n.object3D))})},wrapPlay:function(n){var e=this.usedEls;return function(){e.indexOf(this)!==-1&&n.call(this)}},requestEntity:function(){var n;if(this.availableEls.length===0){if(this.data.dynamic===!1)return void go("Requested entity from empty pool: "+this.attrName);go("Requested entity from empty pool. This pool is dynamic and will resize automatically. You might want to increase its initial size: "+this.attrName),this.createEntity()}return n=this.availableEls.shift(),this.usedEls.push(n),n.object3DParent&&(n.object3DParent.add(n.object3D),this.updateRaycasters()),n.object3D.visible=!0,n},returnEntity:function(n){var e=this.usedEls.indexOf(n);if(e!==-1)return this.usedEls.splice(e,1),this.availableEls.push(n),n.object3DParent=n.object3D.parent,n.object3D.parent.remove(n.object3D),this.updateRaycasters(),n.object3D.visible=!1,n.pause(),n;go("The returned entity was not previously pooled from "+this.attrName)},updateRaycasters:function(){document.querySelectorAll("[raycaster]").forEach(function(n){n.components.raycaster.setDirty()})}}),Ge("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},sceneOnly:!0,init:function(){var n=this.el.getAttribute("webxr"),e=n.requiredFeatures;e.indexOf("mesh-detection")===-1&&(e.push("mesh-detection"),this.el.setAttribute("webxr",n)),e.indexOf("plane-detection")===-1&&(e.push("plane-detection"),this.el.setAttribute("webxr",n)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var n,e,t,i=this.data,r=this.el,s=this.meshEntities,o=!1,a=[],l=this.data.filterLabels;n=(t=r.frame).detectedMeshes,e=t.detectedPlanes;for(var c=0;c<s.length;c++)s[c].present=!1;if(i.meshesEnabled){for(var h of n.values())if(!l.length||l.indexOf(h.semanticLabel)!==-1){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}}if(i.planesEnabled){for(h of e.values())if(!l.length||l.indexOf(h.semanticLabel)!==-1){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}}this.deleteMeshes(),this.createNewMeshes(a)},updateMeshes:function(){var n=new E.Matrix4;return function(){for(var e,t,i,r=this.el,s=r.frame,o=this.meshEntities,a=r.renderer.xr.getReferenceSpace(),l=0;l<o.length;l++)i=o[l].mesh.meshSpace||o[l].mesh.planeSpace,e=s.getPose(i,a),(t=o[l].el).hasLoaded&&(n.fromArray(e.transform.matrix),n.decompose(t.object3D.position,t.object3D.quaternion,t.object3D.scale))}}(),deleteMeshes:function(){for(var n=this.meshEntities,e=[],t=0;t<n.length;t++)n[t].present?e.push(n[t]):this.el.removeChild(n[t]);this.meshEntities=e},createNewMeshes:function(n){for(var e,t=0;t<n.length;t++)e=document.createElement("a-entity"),this.meshEntities.push({mesh:n[t],el:e}),e.addEventListener("loaded",this.initWorldMeshEntity),this.el.appendChild(e)},initMeshGeometry:function(n){var e,t,i;if(n instanceof XRPlane){t=new E.Shape,i=n.polygon;for(var r=0;r<i.length;++r)r===0?t.moveTo(i[r].x,i[r].z):t.lineTo(i[r].x,i[r].z);return(e=new E.ShapeGeometry(t)).rotateX(Math.PI/2),e}return(e=new E.BufferGeometry).setAttribute("position",new E.BufferAttribute(n.vertices,3)),e.setIndex(new E.BufferAttribute(n.indices,1)),e},initWorldMeshEntity:function(n){for(var e,t,i,r=n.target,s=this.meshEntities,o=0;o<s.length;o++)if(s[o].el===r){i=s[o];break}e=this.initMeshGeometry(i.mesh),t=new E.Mesh(e,new E.MeshBasicMaterial({color:16777215*Math.random(),side:E.DoubleSide})),r.setObject3D("mesh",t),i.mesh instanceof XRPlane&&this.data.planeMixin?r.setAttribute("mixin",this.data.planeMixin):this.data.meshMixin&&r.setAttribute("mixin",this.data.meshMixin),r.setAttribute("data-world-mesh",i.mesh.semanticLabel)},updateMeshGeometry:function(n,e){var t=n.getObject3D("mesh");t.geometry.dispose(),t.geometry=this.initMeshGeometry(e)}}),Ge("reflection",{schema:{directionalLight:{type:"selector"}},sceneOnly:!0,init:function(){var n=this;this.cubeRenderTarget=new E.WebGLCubeRenderTarget(16),this.cubeCamera=new E.CubeCamera(.1,1e3,this.cubeRenderTarget),this.lightingEstimationTexture=new E.WebGLCubeRenderTarget(16).texture,this.needsVREnvironmentUpdate=!0;var e=this.el.getAttribute("webxr"),t=e.optionalFeatures;t.includes("light-estimation")||(t.push("light-estimation"),this.el.setAttribute("webxr",e)),this.el.addEventListener("enter-vr",function(){n.el.is("ar-mode")&&n.el.renderer.xr.getSession().requestLightProbe&&n.startLightProbe()}),this.el.addEventListener("exit-vr",function(){n.xrLightProbe&&n.stopLightProbe()}),this.el.object3D.environment=this.cubeRenderTarget.texture},stopLightProbe:function(){this.xrLightProbe=null,this.probeLight&&(this.probeLight.components.light.light.intensity=0),this.needsVREnvironmentUpdate=!0,this.el.object3D.environment=this.cubeRenderTarget.texture},startLightProbe:function(){this.needsLightProbeUpdate=!0},setupLightProbe:function(){var n=this.el.renderer,e=n.xr.getSession(),t=this,i=n.getContext();if(!this.probeLight){var r=document.createElement("a-light");r.setAttribute("type","probe"),r.setAttribute("intensity",0),this.el.appendChild(r),this.probeLight=r}switch(e.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(e,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),e.requestLightProbe().then(function(s){t.xrLightProbe=s,s.addEventListener("reflectionchange",t.updateXRCubeMap.bind(t))}).catch(function(s){console.warn("Lighting estimation not supported: "+s.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from <a-scene>?')})},updateXRCubeMap:function(){var n=this.el.renderer,e=this.glBinding.getReflectionCubeMap(this.xrLightProbe);e&&(n.properties.get(this.lightingEstimationTexture).__webglTexture=e,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var n=this.el.object3D,e=this.el.renderer,t=this.el.frame;if(t&&this.xrLightProbe){var i=t.getLightEstimate(this.xrLightProbe);i&&function(r,s,o,a){var l=Math.max(r.primaryLightIntensity.x,Math.max(r.primaryLightIntensity.y,r.primaryLightIntensity.z));s.sh.fromArray(r.sphericalHarmonicsCoefficients),s.intensity=3.14,o&&(o.color.setRGB(r.primaryLightIntensity.x/l,r.primaryLightIntensity.y/l,r.primaryLightIntensity.z/l),o.intensity=l,a.copy(r.primaryLightDirection))}(i,this.probeLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.object3D.position)}this.needsVREnvironmentUpdate&&(n.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(e,n),n.environment=this.cubeRenderTarget.texture),this.needsLightProbeUpdate&&t&&(this.setupLightProbe(),this.needsLightProbeUpdate=!1)},remove:function(){this.el.object3D.environment=null,this.probeLight&&this.el.removeChild(this.probeLight)}});var wR=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),_R=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join(`
`),MR=(Ge("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},sceneOnly:!0,setup:function(){var n=this.el;if(!this.canvas){var e=n.renderer.getContext();e&&(this.cubeMapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.material=new E.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:wR,fragmentShader:_R,side:E.DoubleSide}),this.quad=new E.Mesh(new E.PlaneGeometry(1,1),this.material),this.quad.visible=!1,this.camera=new E.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),n.object3D.add(this.quad),this.onKeyDown=this.onKeyDown.bind(this))}},getRenderTarget:function(n,e){return new E.WebGLRenderTarget(n,e,{colorSpace:this.el.sceneEl.renderer.outputColorSpace,minFilter:E.LinearFilter,magFilter:E.LinearFilter,wrapS:E.ClampToEdgeWrapping,wrapT:E.ClampToEdgeWrapping,format:E.RGBAFormat,type:E.UnsignedByteType})},resize:function(n,e){this.quad.scale.set(n,e,1),this.camera.left=-1*n/2,this.camera.right=n/2,this.camera.top=e/2,this.camera.bottom=-1*e/2,this.camera.updateProjectionMatrix(),this.canvas.width=n,this.canvas.height=e},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(n){var e=n.keyCode===83&&n.ctrlKey&&n.altKey;if(this.data&&e){var t=n.shiftKey?"equirectangular":"perspective";this.capture(t)}},setCapture:function(n){var e,t,i,r,s=this.el;return n==="perspective"?(this.quad.visible=!1,t=this.data.camera&&this.data.camera.components.camera.camera||s.camera,e={width:this.data.width,height:this.data.height}):(t=this.camera,r=new E.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:E.RGBFormat,generateMipmaps:!0,minFilter:E.LinearMipmapLinearFilter,colorSpace:E.SRGBColorSpace}),i=new E.CubeCamera(s.camera.near,s.camera.far,r),s.camera.getWorldPosition(i.position),s.camera.getWorldQuaternion(i.quaternion),i.update(s.renderer,s.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,e={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:t,size:e,projection:n}},capture:function(n){var e,t=this.el.renderer.xr.enabled,i=this.el.renderer;this.setup(),i.xr.enabled=!1,e=this.setCapture(n),this.renderCapture(e.camera,e.size,e.projection),this.saveCapture(),i.xr.enabled=t},getCanvas:function(n){var e=this.el.renderer.xr.enabled,t=this.el.renderer;this.setup();var i=this.setCapture(n);return t.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),t.xr.enabled=e,this.canvas},renderCapture:function(n,e,t){var i,r,s,o=this.el.renderer.autoClear,a=this.el,l=a.renderer;r=this.getRenderTarget(e.width,e.height),s=new Uint8Array(4*e.width*e.height),this.resize(e.width,e.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(a.object3D,n),l.autoClear=o,l.readRenderTargetPixels(r,0,0,e.width,e.height,s),l.setRenderTarget(null),t==="perspective"&&(s=this.flipPixelsVertically(s,e.width,e.height)),i=new ImageData(new Uint8ClampedArray(s),e.width,e.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(n,e,t){for(var i=n.slice(0),r=0;r<e;++r)for(var s=0;s<t;++s)i[4*r+s*e*4]=n[4*r+(t-s)*e*4],i[4*r+1+s*e*4]=n[4*r+1+(t-s)*e*4],i[4*r+2+s*e*4]=n[4*r+2+(t-s)*e*4],i[4*r+3+s*e*4]=n[4*r+3+(t-s)*e*4];return i},saveCapture:function(){this.canvas.toBlob(function(n){var e="screenshot-"+document.title.toLowerCase()+"-"+Date.now()+".png",t=document.createElement("a"),i=URL.createObjectURL(n);t.href=i,t.setAttribute("download",e),t.innerHTML="downloading...",t.style.display="none",document.body.appendChild(t),setTimeout(function(){t.click(),document.body.removeChild(t)},1)},"image/png")}}),He(282)),SR=He.n(MR),IR=(He(3729),He(8132),window.aframeStats),y0="a-hidden",BR=window.threeStats;Ge("stats",{schema:{default:!0},sceneOnly:!0,init:function(){var n=this.el;ra("stats")!=="false"&&(this.stats=function(e){var t=new BR(e.renderer),i=new IR(e),r=e.isMobile?[]:[t,i];return new(SR())({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:r})}(n),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),n.addEventListener("enter-vr",this.hideBound),n.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var n=this.stats;n&&(n("rAF").tick(),n("FPS").frame(),n().update())},hide:function(){this.statsEl.classList.add(y0)},show:function(){this.statsEl.classList.remove(y0)}});var Dr="a-hidden";function E0(n){n.addEventListener("touchstart",function(){n.classList.remove("resethover")},{passive:!0}),n.addEventListener("touchend",function(){n.classList.add("resethover")},{passive:!0})}Ge("xr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},enterVRButton:{default:""},enterVREnabled:{default:!0},enterARButton:{default:""},enterAREnabled:{default:!0},XRMode:{default:"vr",oneOf:["vr","ar","xr"]}},sceneOnly:!0,init:function(){var n=this,e=this.el;ra("ui")!=="false"&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),e.addEventListener("enter-vr",this.updateEnterInterfaces),e.addEventListener("exit-vr",this.updateEnterInterfaces),e.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",function(t){t.data.type==="loaderReady"&&(n.insideLoader=!0,n.remove())}),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=this.onEnterVRButtonClick.bind(this),this.onEnterARButtonClick=this.onEnterARButtonClick.bind(this),this.onModalClick=this.onModalClick.bind(this),this.toggleOrientationModalIfNeeded=this.toggleOrientationModalIfNeeded.bind(this),this.updateEnterInterfaces=this.updateEnterInterfaces.bind(this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var n,e,t,i=this.data,r=this.el;if(!i.enabled||this.insideLoader||ra("ui")==="false")return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!i.enterVREnabled||i.XRMode!=="xr"&&i.XRMode!=="vr"||(i.enterVRButton?(this.enterVREl=document.querySelector(i.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=(n=this.onEnterVRButtonClick,(t=document.createElement("div")).classList.add("a-enter-vr"),t.setAttribute(Kt,""),(e=document.createElement("button")).className="a-enter-vr-button",e.setAttribute("title","Enter VR mode with a headset or fullscreen without"),e.setAttribute(Kt,""),rr()&&E0(e),t.appendChild(e),e.addEventListener("click",function(s){n(),s.stopPropagation()}),t),r.appendChild(this.enterVREl))),this.enterAREl||!i.enterAREnabled||i.XRMode!=="xr"&&i.XRMode!=="ar"||(i.enterARButton?(this.enterAREl=document.querySelector(i.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(s,o){var a,l;return(l=document.createElement("div")).classList.add("a-enter-ar"),o&&l.classList.add("xr"),l.setAttribute(Kt,""),(a=document.createElement("button")).className="a-enter-ar-button",a.setAttribute("title","Enter AR mode with a headset or handheld device."),a.setAttribute(Kt,""),rr()&&E0(a),l.appendChild(a),a.addEventListener("click",function(c){s(),c.stopPropagation()}),l}(this.onEnterARButtonClick,i.XRMode==="xr"),r.appendChild(this.enterAREl))),this.orientationModalEl=function(s){var o=document.createElement("div");o.className="a-orientation-modal",o.classList.add(Dr),o.setAttribute(Kt,"");var a=document.createElement("button");return a.setAttribute(Kt,""),a.innerHTML="Exit VR",a.addEventListener("click",s),o.appendChild(a),o}(this.onModalClick),r.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach(function(n){n&&n.parentNode&&n.parentNode.removeChild(n)}),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var n=this.el;this.enterVREl&&(n.is("vr-mode")||(n.isMobile||Mp())&&!Af()?this.enterVREl.classList.add(Dr):(Af()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(Dr),n.enterVR(!1,!0)))},toggleEnterARButtonIfNeeded:function(){var n=this.el;this.enterAREl&&(n.is("vr-mode")||!_p()?this.enterAREl.classList.add(Dr):(this.enterAREl.classList.remove(Dr),n.enterVR(!0,!0)))},toggleOrientationModalIfNeeded:function(){var n=this.el,e=this.orientationModalEl;e&&n.isMobile&&(!LE()&&n.is("vr-mode")?e.classList.remove(Dr):e.classList.add(Dr))}}),fn("box",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"},segmentsDepth:{default:1,min:1,max:20,type:"int"}},init:function(n){this.geometry=new E.BoxGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth)}});var x0=E.MathUtils.degToRad;fn("circle",{schema:{radius:{default:1,min:0},segments:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(n){this.geometry=new E.CircleGeometry(n.radius,n.segments,x0(n.thetaStart),x0(n.thetaLength))}});var b0=E.MathUtils.degToRad;fn("cone",{schema:{height:{default:1,min:0},openEnded:{default:!1},radiusBottom:{default:1,min:0},radiusTop:{default:.01,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(n){this.geometry=new E.CylinderGeometry(n.radiusTop,n.radiusBottom,n.height,n.segmentsRadial,n.segmentsHeight,n.openEnded,b0(n.thetaStart),b0(n.thetaLength))}});var C0=E.MathUtils.degToRad;fn("cylinder",{schema:{height:{default:1,min:0},openEnded:{default:!1},radius:{default:1,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(n){this.geometry=new E.CylinderGeometry(n.radius,n.radius,n.height,n.segmentsRadial,n.segmentsHeight,n.openEnded,C0(n.thetaStart),C0(n.thetaLength))}}),fn("dodecahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(n){this.geometry=new E.DodecahedronGeometry(n.radius,n.detail)}}),fn("icosahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(n){this.geometry=new E.IcosahedronGeometry(n.radius,n.detail)}}),fn("octahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(n){this.geometry=new E.OctahedronGeometry(n.radius,n.detail)}}),fn("plane",{schema:{height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"}},init:function(n){this.geometry=new E.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight)}});var w0=E.MathUtils.degToRad;fn("ring",{schema:{radiusInner:{default:.8,min:0},radiusOuter:{default:1.2,min:0},segmentsPhi:{default:10,min:1,type:"int"},segmentsTheta:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(n){this.geometry=new E.RingGeometry(n.radiusInner,n.radiusOuter,n.segmentsTheta,n.segmentsPhi,w0(n.thetaStart),w0(n.thetaLength))}});var Rl=E.MathUtils.degToRad;fn("sphere",{schema:{radius:{default:1,min:0},phiLength:{default:360},phiStart:{default:0,min:0},thetaLength:{default:180,min:0},thetaStart:{default:0},segmentsHeight:{default:18,min:2,type:"int"},segmentsWidth:{default:36,min:3,type:"int"}},init:function(n){this.geometry=new E.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight,Rl(n.phiStart),Rl(n.phiLength),Rl(n.thetaStart),Rl(n.thetaLength))}}),fn("tetrahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(n){this.geometry=new E.TetrahedronGeometry(n.radius,n.detail)}});var TR=E.MathUtils.degToRad;fn("torus",{schema:{arc:{default:360},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:36,min:2,type:"int"},segmentsTubular:{default:32,min:3,type:"int"}},init:function(n){this.geometry=new E.TorusGeometry(n.radius,2*n.radiusTubular,n.segmentsRadial,n.segmentsTubular,TR(n.arc))}}),fn("torusKnot",{schema:{p:{default:2,min:1},q:{default:3,min:1},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:8,min:3,type:"int"},segmentsTubular:{default:100,min:3,type:"int"}},init:function(n){this.geometry=new E.TorusKnotGeometry(n.radius,2*n.radiusTubular,n.segmentsTubular,n.segmentsRadial,n.p,n.q)}});var Ll=new E.Quaternion,RR=new E.Vector3(0,0,1),vo=new E.Vector2,_0=new E.Vector2,Dl=new E.Vector2;function M0(n,e){return e.color.set(n.color),e.fog=n.fog,e.wireframe=n.wireframe,e.toneMapped=n.toneMapped,e.wireframeLinewidth=n.wireframeLinewidth,e}function S0(n,e){return e.color.set(n.color),e.emissive.set(n.emissive),e.emissiveIntensity=n.emissiveIntensity,e.fog=n.fog,e.metalness=n.metalness,e.roughness=n.roughness,e.wireframe=n.wireframe,e.wireframeLinewidth=n.wireframeLinewidth,n.normalMap&&(e.normalScale=n.normalScale),n.ambientOcclusionMap&&(e.aoMapIntensity=n.ambientOcclusionMapIntensity),n.displacementMap&&(e.displacementScale=n.displacementScale,e.displacementBias=n.displacementBias),e}function I0(n,e){switch(e.color.set(n.color),e.specular.set(n.specular),e.emissive.set(n.emissive),e.emissiveIntensity=n.emissiveIntensity,e.fog=n.fog,e.transparent=n.transparent,e.wireframe=n.wireframe,e.wireframeLinewidth=n.wireframeLinewidth,e.shininess=n.shininess,e.flatShading=n.flatShading,e.wireframe=n.wireframe,e.wireframeLinewidth=n.wireframeLinewidth,e.reflectivity=n.reflectivity,e.refractionRatio=n.refractionRatio,n.combine){case"mix":e.combine=E.MixOperation;break;case"multiply":e.combine=E.MultiplyOperation;break;case"add":e.combine=E.AddOperation}return n.normalMap&&(e.normalScale=n.normalScale),n.ambientOcclusionMap&&(e.aoMapIntensity=n.ambientOcclusionMapIntensity),n.bumpMap&&(e.bumpScale=n.bumpMapScale),n.displacementMap&&(e.displacementScale=n.displacementScale,e.displacementBias=n.displacementBias),e}fn("triangle",{schema:{vertexA:{type:"vec3",default:{x:0,y:.5,z:0}},vertexB:{type:"vec3",default:{x:-.5,y:-.5,z:0}},vertexC:{type:"vec3",default:{x:.5,y:-.5,z:0}}},init:function(n){var e,t,i,r,s,o,a,l,c;(i=new E.Triangle).a.set(n.vertexA.x,n.vertexA.y,n.vertexA.z),i.b.set(n.vertexB.x,n.vertexB.y,n.vertexB.z),i.c.set(n.vertexC.x,n.vertexC.y,n.vertexC.z),t=i.getNormal(new E.Vector3),Ll.setFromUnitVectors(t,RR),r=i.a.clone().applyQuaternion(Ll),s=i.b.clone().applyQuaternion(Ll),o=i.c.clone().applyQuaternion(Ll),vo.set(Math.min(r.x,s.x,o.x),Math.min(r.y,s.y,o.y)),_0.set(Math.max(r.x,s.x,o.x),Math.max(r.y,s.y,o.y)),Dl.set(0,0).subVectors(_0,vo),r=new E.Vector2().subVectors(r,vo).divide(Dl),s=new E.Vector2().subVectors(s,vo).divide(Dl),o=new E.Vector2().subVectors(o,vo).divide(Dl),e=this.geometry=new E.BufferGeometry,a=[i.a.x,i.a.y,i.a.z,i.b.x,i.b.y,i.b.z,i.c.x,i.c.y,i.c.z],l=[t.x,t.y,t.z,t.x,t.y,t.z,t.x,t.y,t.z],c=[r.x,r.y,s.x,s.y,o.x,o.y],e.setAttribute("position",new E.Float32BufferAttribute(a,3)),e.setAttribute("normal",new E.Float32BufferAttribute(l,3)),e.setAttribute("uv",new E.Float32BufferAttribute(c,2))}}),Ji("flat",{schema:{color:{type:"color"},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},wireframe:{default:!1},wireframeLinewidth:{default:2},toneMapped:{default:!0}},init:function(n){this.materialData={color:new E.Color},M0(n,this.materialData),this.material=new E.MeshBasicMaterial(this.materialData)},update:function(n){this.updateMaterial(n),Xl(this,n)},updateMaterial:function(n){var e;for(e in M0(n,this.materialData),this.materialData)this.material[e]=this.materialData[e]}}),Ji("standard",{schema:{ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},ambientOcclusionTextureOffset:{type:"vec2"},ambientOcclusionTextureRepeat:{type:"vec2",default:{x:1,y:1}},color:{type:"color"},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},emissive:{type:"color",default:"#000"},emissiveIntensity:{default:1},envMap:{default:""},fog:{default:!0},metalness:{default:0,min:0,max:1},metalnessMap:{type:"map"},metalnessTextureOffset:{type:"vec2"},metalnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},roughness:{default:.5,min:0,max:1},roughnessMap:{type:"map"},roughnessTextureOffset:{type:"vec2"},roughnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},sphericalEnvMap:{type:"map"},src:{type:"map"},wireframe:{default:!1},wireframeLinewidth:{default:2}},init:function(n){this.materialData={color:new E.Color,emissive:new E.Color},S0(n,this.materialData),this.material=new E.MeshStandardMaterial(this.materialData)},update:function(n){this.updateMaterial(n),Xl(this,n),ni("normal",this,n),ni("displacement",this,n),ni("ambientOcclusion",this,n),ni("metalness",this,n),ni("roughness",this,n),gf(this,n)},updateMaterial:function(n){var e,t=this.material;for(e in S0(n,this.materialData),this.materialData)t[e]=this.materialData[e]}}),Ji("phong",{schema:{color:{type:"color"},emissive:{type:"color",default:"black"},emissiveIntensity:{default:1},specular:{type:"color",default:"#111111"},transparent:{default:!1},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},envMap:{default:""},sphericalEnvMap:{type:"map"},shininess:{default:30},flatShading:{default:!1},wireframe:{default:!1},wireframeLinewidth:{default:2},combine:{oneOF:["multiply","mix","add"],default:"mix"},reflectivity:{default:.9},refractionRatio:{default:.98},refract:{default:!1},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},bumpMap:{type:"map"},bumpMapScale:{default:1},bumpTextureOffset:{type:"vec2"},bumpTextureRepeat:{type:"vec2",default:{x:1,y:1}}},init:function(n){this.materialData={color:new E.Color,specular:new E.Color,emissive:new E.Color},I0(n,this.materialData),this.material=new E.MeshPhongMaterial(this.materialData);var e=this.el.sceneEl;Object.defineProperty(this.material,"envMap",{get:function(){return this._envMap||e.object3D.environment},set:function(t){this._envMap=t}})},update:function(n){this.updateMaterial(n),Xl(this,n),ni("normal",this,n),ni("displacement",this,n),ni("ambientOcclusion",this,n),ni("bump",this,n),gf(this,n)},updateMaterial:function(n){var e;for(e in I0(n,this.materialData),this.materialData)this.material[e]=this.materialData[e]}}),Ji("sdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},opacity:{type:"number",is:"uniform",default:1}},vertexShader:["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join(`
`),fragmentShader:["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float contour(float width, float value) {"," return smoothstep(0.5 - value, 0.5 + value, width);","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec2 uv = vUV;"," vec4 texColor = texture(map, uv);"," float dist = texColor.a;"," float width = fwidth(dist);"," float alpha = contour(dist, width);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(uv) + dFdy(uv));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * dist;"," }"," if (isBigEnough <= BIG_ENOUGH) {"," vec4 box = vec4 (uv - duv, uv + duv);"," alpha = (alpha + 0.5 * ("," contour(texture(map, box.xy).a, width)"," + contour(texture(map, box.zw).a, width)"," + contour(texture(map, box.xw).a, width)"," + contour(texture(map, box.zy).a, width)"," )) / 3.0;"," }"," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color, opacity * alpha);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join(`
`),init:function(){return this.uniforms=this.initUniforms(),E.UniformsUtils&&(this.uniforms=E.UniformsUtils.merge([E.UniformsLib.fog,this.uniforms])),this.material=new E.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}}),Ji("msdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},negate:{type:"boolean",is:"uniform",default:!0},opacity:{type:"number",is:"uniform",default:1}},vertexShader:["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join(`
`),fragmentShader:["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform bool negate;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec3 sampleColor = texture(map, vUV).rgb;"," if (negate) { sampleColor = 1.0 - sampleColor; }"," float sigDist = median(sampleColor.r, sampleColor.g, sampleColor.b) - 0.5;"," float alpha = clamp(sigDist / fwidth(sigDist) + 0.5, 0.0, 1.0);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(vUV) + dFdy(vUV));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," // Do modified alpha test."," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * (sigDist + 0.5);"," }"," // Do modified alpha test."," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color.xyz, alpha * opacity);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join(`
`),init:function(){return this.uniforms=this.initUniforms(),E.UniformsUtils&&(this.uniforms=E.UniformsUtils.merge([E.UniformsLib.fog,this.uniforms])),this.material=new E.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}}),Ji("shadow",{schema:{opacity:{default:.5},transparent:{default:!0},alphaToCoverage:{default:!0}},init:function(n){this.material=new E.ShadowMaterial},update:function(n){this.material.opacity=n.opacity,this.material.alphaToCoverage=n.alphaToCoverage,this.material.transparent=n.transparent}});var B0="data-aframe-default-camera";function T0(n){var e=n.primitive,t=sr[e]&&sr[e].Geometry,i=new t;if(!t)throw new Error("Unknown geometry `"+e+"`");return i.init(n),i.geometry}kn("camera",{init:function(){this.activeCameraEl=null,this.render=this.render.bind(this),this.unwrapRender=this.unwrapRender.bind(this),this.wrapRender=this.wrapRender.bind(this),this.initialCameraFound=!1,this.numUserCameras=0,this.numUserCamerasChecked=0,this.setupInitialCamera()},setupInitialCamera:function(){var n,e,t=this.sceneEl,i=this;if(!t.camera||t.camera.el.getAttribute("camera").spectator)if((n=t.querySelectorAll("a-camera, :not(a-mixin)[camera]")).length)for(this.numUserCameras=n.length,e=0;e<n.length;e++)n[e].addEventListener("object3dset",function(r){r.detail.type==="camera"&&i.checkUserCamera(this)}),n[e].isANode?n[e].load():n[e].addEventListener("nodeready",function(){this.load()});else this.createDefaultCamera();else t.emit("cameraready",{cameraEl:t.camera.el})},checkUserCamera:function(n){var e,t=this.el.sceneEl;this.numUserCamerasChecked++,this.initialCameraFound||((e=n.getAttribute("camera")).active&&!e.spectator?(this.initialCameraFound=!0,t.camera=n.getObject3D("camera"),t.emit("cameraready",{cameraEl:n})):this.numUserCamerasChecked===this.numUserCameras&&this.createDefaultCamera())},createDefaultCamera:function(){var n,e=this.sceneEl;(n=document.createElement("a-entity")).setAttribute("camera",{active:!0}),n.setAttribute("position",{x:0,y:1.6,z:0}),n.setAttribute("wasd-controls",""),n.setAttribute("look-controls",""),n.setAttribute(Kt,""),n.addEventListener("object3dset",function(t){t.detail.type==="camera"&&(e.camera=t.detail.object,e.emit("cameraready",{cameraEl:n}))}),e.appendChild(n)},disableActiveCamera:function(){var n;(n=this.sceneEl.querySelectorAll(":not(a-mixin)[camera]"))[n.length-1].setAttribute("camera","active",!0)},setActiveCamera:function(n){var e,t,i,r,s=this.activeCameraEl,o=this.sceneEl;if((r=n.getObject3D("camera"))&&n!==this.activeCameraEl){var a=o.querySelector("["+B0+"]");for(n!==(a&&a.querySelector(":not(a-mixin)[camera]"))&&function(l){var c;l.camera&&(c=l.querySelector("["+B0+"]"))&&l.removeChild(c)}(o),this.activeCameraEl=n,this.activeCameraEl.play(),o.camera=r,s&&s.setAttribute("camera","active",!1),t=o.querySelectorAll(":not(a-mixin)[camera]"),i=0;i<t.length;i++)(e=t[i]).isEntity&&n!==e&&(e.setAttribute("camera","active",!1),e.pause());o.emit("camera-set-active",{cameraEl:n})}},setSpectatorCamera:function(n){var e,t=this.spectatorCameraEl,i=this.sceneEl;n.getObject3D("camera")&&n!==this.spectatorCameraEl&&(t&&t.setAttribute("camera","spectator",!1),e=this.spectatorCameraEl=n,i.addEventListener("enter-vr",this.wrapRender),i.addEventListener("exit-vr",this.unwrapRender),e.setAttribute("camera","active",!1),e.play(),i.emit("camera-set-spectator",{cameraEl:n}))},disableSpectatorCamera:function(){this.spectatorCameraEl=void 0},wrapRender:function(){this.spectatorCameraEl&&!this.originalRender&&(this.originalRender=this.sceneEl.renderer.render,this.sceneEl.renderer.render=this.render)},unwrapRender:function(){this.originalRender&&(this.sceneEl.renderer.render=this.originalRender,this.originalRender=void 0)},render:function(n,e){var t,i,r=this.sceneEl;t=r.renderer.xr.enabled,this.originalRender.call(r.renderer,n,e),this.spectatorCameraEl&&!r.isMobile&&t&&(i=this.spectatorCameraEl.components.camera.camera,r.renderer.xr.enabled=!1,this.originalRender.call(r.renderer,n,i),r.renderer.xr.enabled=t)}}),kn("geometry",{init:function(){this.cache={},this.cacheCount={}},clearCache:function(){this.cache={},this.cacheCount={}},getOrCreateGeometry:function(n){var e,t,i=this.cache;return n.skipCache?T0(n):(e=i[t=this.hash(n)],function(r,s){r[s]=r[s]===void 0?1:r[s]+1}(this.cacheCount,t),e||(e=T0(n),i[t]=e,e))},unuseGeometry:function(n){var e,t=this.cache,i=this.cacheCount;n.skipCache||t[e=this.hash(n)]&&(function(r,s){r[s]--}(i,e),i[e]>0||(t[e].dispose(),delete t[e],delete i[e]))},hash:function(n){return JSON.stringify(n)}}),kn("gltf-model",{schema:{dracoDecoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.5.7/"},basisTranscoderPath:{default:""},meshoptDecoderPath:{default:""}},init:function(){this.update()},update:function(){var n=this.data.dracoDecoderPath,e=this.data.basisTranscoderPath,t=this.data.meshoptDecoderPath;!this.dracoLoader&&n&&(this.dracoLoader=new oE,this.dracoLoader.setDecoderPath(n)),!this.ktx2Loader&&e&&(this.ktx2Loader=new Tn,this.ktx2Loader.setTranscoderPath(e).detectSupport(this.el.renderer)),!this.meshoptDecoder&&t&&(this.meshoptDecoder=function(i){return new Promise(function(r,s){var o=document.createElement("script");document.body.appendChild(o),o.onload=r,o.onerror=s,o.async=!0,o.src=i})}(t).then(function(){return window.MeshoptDecoder.ready}).then(function(){return window.MeshoptDecoder}))},getDRACOLoader:function(){return this.dracoLoader},getKTX2Loader:function(){return this.ktx2Loader},getMeshoptDecoder:function(){return this.meshoptDecoder}});var Pl="data-aframe-default-light",ox=(kn("light",{schema:{defaultLightsEnabled:{default:!0}},init:function(){this.defaultLights=!1,this.userDefinedLights=!1,this.sceneEl.addEventListener("loaded",this.setupDefaultLights.bind(this))},registerLight:function(n){n.hasAttribute(Pl)||(this.removeDefaultLights(),this.userDefinedLights=!0)},removeDefaultLights:function(){var n,e=this.sceneEl;if(this.defaultLights){n=document.querySelectorAll("["+Pl+"]");for(var t=0;t<n.length;t++)e.removeChild(n[t]);this.defaultLights=!1}},setupDefaultLights:function(){var n,e,t=this.sceneEl;this.userDefinedLights||this.defaultLights||!this.data.defaultLightsEnabled||((n=document.createElement("a-entity")).setAttribute("light",{color:"#BBB",type:"ambient"}),n.setAttribute(Pl,""),n.setAttribute(Kt,""),t.appendChild(n),(e=document.createElement("a-entity")).setAttribute("light",{color:"#FFF",intensity:1.884,castShadow:!0}),e.setAttribute("position",{x:-.5,y:1,z:1}),e.setAttribute(Pl,""),e.setAttribute(Kt,""),t.appendChild(e),this.defaultLights=!0)}}),vt),LR=ox("components:texture:error"),R0=ox("components:texture:warn"),DR=new E.ImageLoader;kn("material",{init:function(){this.materials={},this.sourceCache={}},clearTextureSourceCache:function(){this.sourceCache={}},loadTexture:function(n,e,t){this.loadTextureSource(n,function(i){var r=Fp(i);Vc(r,e),t(r)})},loadTextureSource:function(n,e){var t=this,i=this.sourceCache,r=this.hash(n);function s(o){i[r]=Promise.resolve(o),i[r].then(e)}i[r]?i[r].then(e):n.tagName!=="CANVAS"?s(new Promise(function(o,a){Hc(n,function(l){t.loadImage(l,o)},function(l){t.loadVideo(l,o)})})):s(new E.Source(n))},loadCubeMapTexture:function(n,e){var t=this,i=0,r=new E.CubeTexture;function s(a){t.loadTextureSource(n[a],function(l){r.images[a]=l.data,++i==6&&(r.needsUpdate=!0,e(r))})}if(r.colorSpace=E.SRGBColorSpace,n.length===6)for(var o=0;o<n.length;o++)s(o);else R0("Cube map texture requires exactly 6 sources, got only %s sources",n.length)},loadImage:function(n,e){e(typeof n=="string"?function(t){return new Promise(function(i,r){DR.load(t,function(s){i(new E.Source(s))},function(){},function(s){LR("`$s` could not be fetched (Error code: %s; Response: %s)",s.status,s.statusText)})})}(n):new E.Source(n))},loadVideo:function(n,e){var t;typeof n!="string"&&function(i){i.autoplay=i.hasAttribute("autoplay")&&i.getAttribute("autoplay")!=="false",i.controls=i.hasAttribute("controls")&&i.getAttribute("controls")!=="false",i.getAttribute("loop")==="false"&&i.removeAttribute("loop"),i.getAttribute("preload")==="false"&&(i.preload="none"),i.crossOrigin=i.crossOrigin||"anonymous",i.setAttribute("playsinline",""),i.setAttribute("webkit-playsinline","")}(t=n),t=t||function(i){var r=document.createElement("video");return r.setAttribute("playsinline",""),r.setAttribute("webkit-playsinline",""),r.autoplay=!0,r.loop=!0,r.crossOrigin="anonymous",r.addEventListener("error",function(){R0("`%s` is not a valid video",i)},!0),r.src=i,r}(n),e(new E.Source(t))},hash:function(n){return n.tagName&&(n.id||n.src)||n},registerMaterial:function(n){this.materials[n.uuid]=n},unregisterMaterial:function(n){delete this.materials[n.uuid]}}),kn("obb-collider",{schema:{showColliders:{default:!1}},init:function(){this.collisions=[],this.colliderEls=[]},addCollider:function(n){this.colliderEls.push(n),this.data.showColliders?n.components["obb-collider"].showCollider():n.components["obb-collider"].hideCollider(),this.tick=this.detectCollisions},removeCollider:function(n){var e=this.colliderEls,t=e.indexOf(n);n.components["obb-collider"].hideCollider(),t>-1&&e.splice(t,1),e.length===0&&(this.tick=void 0)},registerCollision:function(n,e){var t=this.collisions,i=!1,r=n.obb,s=e.obb,o=n.renderColliderMesh,a=e.renderColliderMesh;o&&o.material.color.set(16711680),a&&a.material.color.set(16711680);for(var l=0;l<t.length;l++)if(t[l].componentA.obb===r&&t[l].componentB.obb===s||t[l].componentA.obb===s&&t[l].componentB.obb===r){i=!0,t[l].detected=!0;break}i||(t.push({componentA:n,componentB:e,detected:!0}),n.el.emit("obbcollisionstarted",{trackedObject3D:n.trackedObject3D,withEl:e.el}),e.el.emit("obbcollisionstarted",{trackedObject3D:e.trackedObject3D,withEl:n.el}))},resetCollisions:function(){for(var n=this.collisions,e=0;e<n.length;e++)n[e].detected=!1},clearCollisions:function(){for(var n,e,t,i,r=this.collisions,s=[],o=0;o<r.length;o++)r[o].detected?s.push(r[o]):(n=r[o].componentA,e=r[o].componentB,t=n.renderColliderMesh,i=e.renderColliderMesh,t&&t.material.color.set(65280),n.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:e.el}),i&&i.material.color.set(65280),e.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:n.el}));this.collisions=s},detectCollisions:function(){var n,e,t,i,r=this.colliderEls;if(!(r.length<2)){this.resetCollisions();for(var s=0;s<r.length;s++)if(t=r[s].components["obb-collider"],(n=r[s].components["obb-collider"].obb).halfSize.x!==0&&n.halfSize.y!==0&&n.halfSize.z!==0)for(var o=s+1;o<r.length;o++)(e=(i=r[o].components["obb-collider"]).obb).halfSize.x!==0&&e.halfSize.y!==0&&e.halfSize.z!==0&&n.intersectsOBB(e)&&this.registerCollision(t,i);this.clearCollisions()}}});var Cd=vt("components:renderer:warn");function PR(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z-e.z}function UR(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder-e.renderOrder}function FR(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:e.z-n.z}kn("renderer",{schema:{antialias:{default:"auto",oneOf:["true","false","auto"]},highRefreshRate:{default:Sp()},logarithmicDepthBuffer:{default:"auto",oneOf:["true","false","auto"]},maxCanvasWidth:{default:-1},maxCanvasHeight:{default:-1},multiviewStereo:{default:!1},exposure:{default:1,if:{toneMapping:["ACESFilmic","linear","reinhard","cineon","AgX","neutral"]}},toneMapping:{default:"no",oneOf:["no","ACESFilmic","linear","reinhard","cineon","AgX","neutral"]},precision:{default:"high",oneOf:["high","medium","low"]},anisotropy:{default:1},sortTransparentObjects:{default:!1},colorManagement:{default:!0},alpha:{default:!0},stencil:{default:!1},foveationLevel:{default:1}},init:function(){var n=this.data,e=this.el,t=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1),i=e.renderer;i.toneMapping=E[t+"ToneMapping"],E.Texture.DEFAULT_ANISOTROPY=n.anisotropy,E.ColorManagement.enabled=n.colorManagement,i.outputColorSpace=n.colorManagement?E.SRGBColorSpace:E.LinearSRGBColorSpace,e.hasAttribute("antialias")&&Cd('Component `antialias` is deprecated. Use `renderer="antialias: true"` instead.'),e.hasAttribute("logarithmicDepthBuffer")&&Cd('Component `logarithmicDepthBuffer` is deprecated. Use `renderer="logarithmicDepthBuffer: true"` instead.'),i.sortObjects=!0,i.setOpaqueSort(PR)},update:function(){var n=this.data,e=this.el.renderer,t=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1);e.toneMapping=E[t+"ToneMapping"],e.toneMappingExposure=n.exposure,e.xr.setFoveation(n.foveationLevel),n.sortObjects&&Cd('`sortObjects` property is deprecated. Use `renderer="sortTransparentObjects: true"` instead.'),n.sortTransparentObjects?e.setTransparentSort(FR):e.setTransparentSort(UR)},applyColorCorrection:function(n){this.data.colorManagement&&n&&n.isTexture&&n.colorSpace!==E.SRGBColorSpace&&(n.colorSpace=E.SRGBColorSpace,n.needsUpdate=!0)},setWebXRFrameRate:function(n){var e,t=this.data,i=n.supportedFrameRates;i&&n.updateTargetFrameRate&&(e=i.includes(90)?t.highRefreshRate?90:72:t.highRefreshRate?72:60,n.updateTargetFrameRate(e).catch(function(r){console.warn("failed to set target frame rate of "+e+". Error info: "+r)}))}});var OR={basic:E.BasicShadowMap,pcf:E.PCFShadowMap,pcfsoft:E.PCFSoftShadowMap};kn("shadow",{schema:{enabled:{default:!0},autoUpdate:{default:!0},type:{default:"pcf",oneOf:["basic","pcf","pcfsoft"]}},init:function(){var n=this.sceneEl,e=this.data;this.shadowMapEnabled=!1,n.renderer.shadowMap.type=OR[e.type],n.renderer.shadowMap.autoUpdate=e.autoUpdate},update:function(n){n.enabled!==this.data.enabled&&this.setShadowMapEnabled(this.shadowMapEnabled)},setShadowMapEnabled:function(n){var e=this.sceneEl,t=this.sceneEl.renderer;this.shadowMapEnabled=n;var i=this.data.enabled&&this.shadowMapEnabled;t&&i!==t.shadowMap.enabled&&(t.shadowMap.enabled=i,function(r){r.hasLoaded&&r.object3D.traverse(function(s){if(s.material)for(var o=Array.isArray(s.material)?s.material:[s.material],a=0;a<o.length;a++)o[a].needsUpdate=!0})}(e))}}),kn("tracked-controls",{init:function(){this.controllers=[],this.onInputSourcesChange=this.onInputSourcesChange.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.el.addEventListener("enter-vr",this.onEnterVR),this.onExitVR=this.onExitVR.bind(this),this.el.addEventListener("exit-vr",this.onExitVR)},onEnterVR:function(){this.el.xrSession&&this.el.xrSession.addEventListener("inputsourceschange",this.onInputSourcesChange)},onExitVR:function(){this.referenceSpace=void 0,this.controllers=[],this.el.emit("controllersupdated",void 0,!1)},onInputSourcesChange:function(){var n=this,e=this.el.xrSession,t=this.el.sceneEl.systems.webxr.sessionReferenceSpaceType;e.requestReferenceSpace(t).then(function(i){n.referenceSpace=i}).catch(function(i){throw n.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(t,'tracked-controls uses reference space "'+t+'".'),i}),this.controllers=e.inputSources,this.el.emit("controllersupdated",void 0,!1)}});var kR=vt("systems:webxr:warn"),ax=(kn("webxr",{schema:{referenceSpaceType:{type:"string",default:"local-floor"},requiredFeatures:{type:"array",default:["local-floor"]},optionalFeatures:{type:"array",default:["bounded-floor"]},overlayElement:{type:"selector"}},update:function(){var n=this.data;this.sessionConfiguration={requiredFeatures:n.requiredFeatures,optionalFeatures:n.optionalFeatures},this.sessionReferenceSpaceType=n.referenceSpaceType,n.overlayElement&&(n.overlayElement.classList.remove("a-dom-overlay"),n.optionalFeatures.includes("dom-overlay")||(n.optionalFeatures.push("dom-overlay"),this.el.setAttribute("webxr",n)),this.warnIfFeatureNotRequested("dom-overlay"),this.sessionConfiguration.domOverlay={root:n.overlayElement},n.overlayElement.classList.add("a-dom-overlay"))},wasFeatureRequested:function(n){return n==="viewer"||n==="local"||!(!this.sessionConfiguration.requiredFeatures.includes(n)&&!this.sessionConfiguration.optionalFeatures.includes(n))},warnIfFeatureNotRequested:function(n,e){this.wasFeatureRequested(n)||kR((e?e+" ":"")+'Please add the feature "'+n+`" to a-scene's webxr system options in requiredFeatures/optionalFeatures.`)}}),{});function L0(n){var e=n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();n==="fog"&&(e="material-fog"),n==="visible"&&(e="material-visible"),ax[e]="material."+n}function Ii(){return{defaultComponents:{material:{}},mappings:Cn({},ax)}}Object.keys(Pt.material.schema).forEach(L0),Object.keys(ai.standard.schema).forEach(L0);var Ul=new E.Vector3,NR=new E.Vector3;Ge("pivot",{dependencies:["position"],schema:{type:"vec3"},init:function(){var n=this.data,e=this.el,t=e.object3D.parent,i=e.object3D,r=new E.Group;Ul.copy(i.position),NR.copy(i.rotation),t.remove(i),r.add(i),t.add(r),e.object3D=r,i.position.set(-1*n.x,-1*n.y,-1*n.z),r.position.set(n.x+Ul.x,n.y+Ul.y,n.z+Ul.z),r.rotation.copy(i.rotation),i.rotation.set(0,0,0)}}),hn("a-camera",{defaultComponents:{camera:{},"look-controls":{},"wasd-controls":{},position:{x:0,y:1.6,z:0}},mappings:{active:"camera.active",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","pointer-lock-enabled":"look-controls.pointerLockEnabled","wasd-controls-enabled":"wasd-controls.enabled","reverse-mouse-drag":"look-controls.reverseMouseDrag",zoom:"camera.zoom"}}),hn("a-cursor",Bn({},Ii(),{defaultComponents:{cursor:{},geometry:{primitive:"ring",radiusOuter:.016,radiusInner:.01,segmentsTheta:32},material:{color:"#000",shader:"flat",opacity:.8},position:{x:0,y:0,z:-1}},mappings:{far:"raycaster.far",fuse:"cursor.fuse","fuse-timeout":"cursor.fuseTimeout",interval:"raycaster.interval",objects:"raycaster.objects"}})),hn("a-curvedimage",Bn({},Ii(),{defaultComponents:{geometry:{height:1,primitive:"cylinder",radius:2,segmentsRadial:48,thetaLength:270,openEnded:!0,thetaStart:0},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0,repeat:"-1 1"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius",segments:"geometry.segmentsRadial",start:"geometry.thetaStart","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",width:"geometry.thetaLength"}})),hn("a-gltf-model",{mappings:{src:"gltf-model"}}),hn("a-image",Bn({},Ii(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}})),hn("a-light",{defaultComponents:{light:{}},mappings:{angle:"light.angle",color:"light.color","ground-color":"light.groundColor",decay:"light.decay",distance:"light.distance",intensity:"light.intensity",penumbra:"light.penumbra",type:"light.type",target:"light.target",envmap:"light.envMap","shadow-camera-automatic":"light.shadowCameraAutomatic"}}),hn("a-link",{defaultComponents:{link:{visualAspectEnabled:!0}},mappings:{href:"link.href",image:"link.image",title:"link.title"}}),hn("a-obj-model",Bn({},Ii(),{defaultComponents:{"obj-model":{}},mappings:{src:"obj-model.obj",mtl:"obj-model.mtl"}}));const lx={},QR=lx;function D0(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var wd,Fl;Hp.forEach(function(n){var e=sr[n],t=D0(n),i={};Object.keys(e.schema).forEach(function(o){i[D0(o)]="geometry."+o});var r="a-"+t,s=hn(r,Bn({},Ii(),{defaultComponents:{geometry:{primitive:n}},mappings:i}));lx[r]=s}),hn("a-sky",Bn({},Ii(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",side:"back",shader:"flat",npot:!0},scale:"-1 1 1"},mappings:Bn({},QR["a-sphere"].mappings)})),hn("a-sound",{defaultComponents:{sound:{}},mappings:{src:"sound.src",on:"sound.on",autoplay:"sound.autoplay",loop:"sound.loop",volume:"sound.volume"}}),wd={text:{anchor:"align",width:5}},Fl=Fl||{},Object.keys(wd).forEach(function(n){(function(e,t){var i=Pt[e].schema;Object.keys(i).forEach(function(r){var s=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();t[s]!==void 0&&(s=e+"-"+r),t[s]=e+"."+r})})(n,Fl)}),hn("a-text",Bn({},null,{defaultComponents:wd,mappings:Fl})),hn("a-video",Bn({},Ii(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}})),hn("a-videosphere",Bn({},Ii(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",shader:"flat",side:"back",npot:!0},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth"}}));var qp=vt,GR=qp("A-Frame:error"),zR=qp("A-Frame:warn");window.document.currentScript&&window.document.currentScript.parentNode!==window.document.head&&!window.debug&&zR("Put the A-Frame <script> tag in the <head> of the HTML *before* the scene to ensure everything for A-Frame is properly registered before they are used from HTML."),window.cordova||window.location.protocol!=="file:"||GR("This HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server: https://aframe.io/docs/1.4.0/introduction/installation.html#use-a-local-server."),Tp&&(window.logs=qp,He(7180),He(9379)),console.log("A-Frame Version: 1.7.0 (Date 2025-03-12, Commit #1b9650f1)"),console.log("THREE Version (https://github.com/supermedium/three.js):",SE.REVISION),window.AFRAME_ASYNC||(document.readyState!=="complete"?document.addEventListener("readystatechange",function n(){document.readyState==="complete"&&(document.removeEventListener("readystatechange",n),Ef())}):Ef());const HR=globalThis.AFRAME={AComponent:sa,AEntity:zt,ANode:Jt,ANIME:Vl,AScene:ex,components:Pt,coreComponents:Object.keys(Pt),geometries:sr,registerComponent:Ge,registerGeometry:fn,registerPrimitive:hn,registerShader:Ji,registerSystem:kn,primitives:{getMeshMixin:Ii,primitives:tx},scenes:Vr,schema:nf,shaders:ai,systems:Si,emitReady:Ef,THREE:SE,utils:tf,version:ix};Wy.A;function _f(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function VR(n){if(Array.isArray(n))return n}function WR(n){if(Array.isArray(n))return _f(n)}function cx(n,e,t){if(typeof n=="function"?n===e:n.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function qR(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function hx(n,e,t){return e=Qs(e),eL(n,jp()?Reflect.construct(e,t||[],Qs(n).constructor):e.apply(n,t))}function jR(n,e){if(e.has(n))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ux(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function _d(n,e){return n.get(cx(n,e))}function P0(n,e,t){jR(n,e),e.set(n,t)}function U0(n,e,t){return n.set(cx(n,e),t),t}function dx(n,e,t){if(jp())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,e);var r=new(n.bind.apply(n,i));return r}function XR(n,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,Ax(i.key),i)}}function fx(n,e,t){return e&&XR(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function kh(n,e,t){return(e=Ax(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mf(){return Mf=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(n,e,t){var i=tL(n,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(arguments.length<3?n:t):r.value}},Mf.apply(null,arguments)}function Qs(n){return Qs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Qs(n)}function px(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Sf(n,e)}function jp(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jp=function(){return!!n})()}function YR(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function KR(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e!==0)for(;!(l=(i=s.call(t)).done)&&(a.push(i.value),a.length!==e);l=!0);}catch(h){c=!0,r=h}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function JR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZR(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function F0(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function $R(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?F0(Object(t),!0).forEach(function(i){kh(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):F0(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function eL(n,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qR(n)}function Sf(n,e){return Sf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},Sf(n,e)}function Fo(n,e){return VR(n)||KR(n,e)||mx(n,e)||JR()}function tL(n,e){for(;!{}.hasOwnProperty.call(n,e)&&(n=Qs(n))!==null;);return n}function Md(n,e,t,i){var r=Mf(Qs(n.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function jn(n){return WR(n)||YR(n)||mx(n)||ZR()}function nL(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ax(n){var e=nL(n,"string");return typeof e=="symbol"?e:e+""}function If(n){"@babel/helpers - typeof";return If=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},If(n)}function mx(n,e){if(n){if(typeof n=="string")return _f(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_f(n,e):void 0}}var gx=function(e){e instanceof Array?e.forEach(gx):(e.map&&e.map.dispose(),e.dispose())},Xp=function(e){e.geometry&&e.geometry.dispose(),e.material&&gx(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Xp)},O0=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Xp(t)}},Sd=new WeakMap,Ol=new WeakMap,yo=function(n){function e(t){var i,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a;return ux(this,e),i=hx(this,e),kh(i,"scene",void 0),P0(i,Sd,void 0),P0(i,Ol,void 0),i.scene=t,U0(Sd,i,o),U0(Ol,i,l),i.onRemoveObj(function(){}),i}return px(e,n),fx(e,[{key:"onCreateObj",value:function(i){var r=this;return Md(e,"onCreateObj",this)([function(s){var o=i(s);return s[_d(Ol,r)]=o,o[_d(Sd,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(i){var r=this;return Md(e,"onRemoveObj",this)([function(s,o){var a=Md(e,"getData",r)([s]);i(s,o),r.scene.remove(s),Xp(s),delete a[_d(Ol,r)]}]),this}}])}(Hx),Eo=function(e){return isNaN(e)?parseInt(G0(e).toHex(),16):e},Id=function(e){return isNaN(e)?G0(e).getAlpha():1},iL=Zx($x);function k0(n,e,t){!e||typeof t!="string"||n.filter(function(i){return!i[t]}).forEach(function(i){i[t]=iL(e(i))})}function rL(n,e){var t=n.nodes,i=n.links,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=r.nodeFilter,o=s===void 0?function(){return!0}:s,a=r.onLoopError,l=a===void 0?function(f){throw"Invalid DAG structure! Found cycle in node path: ".concat(f.join(" -> "),".")}:a,c={};t.forEach(function(f){return c[e(f)]={data:f,out:[],depth:-1,skip:!o(f)}}),i.forEach(function(f){var A=f.source,g=f.target,m=b(A),p=b(g);if(!c.hasOwnProperty(m))throw"Missing source node with id: ".concat(m);if(!c.hasOwnProperty(p))throw"Missing target node with id: ".concat(p);var v=c[m],y=c[p];v.out.push(y);function b(w){return If(w)==="object"?e(w):w}});var h=[];d(Object.values(c));var u=Object.assign.apply(Object,[{}].concat(jn(Object.entries(c).filter(function(f){var A=Fo(f,2),g=A[1];return!g.skip}).map(function(f){var A=Fo(f,2),g=A[0],m=A[1];return kh({},g,m.depth)}))));return u;function d(f){for(var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,m=function(){var b=f[p];if(A.indexOf(b)!==-1){var w=[].concat(jn(A.slice(A.indexOf(b))),[b]).map(function(M){return e(M.data)});return h.some(function(M){return M.length===w.length&&M.every(function(S,R){return S===w[R]})})||(h.push(w),l(w)),1}g>b.depth&&(b.depth=g,d(b.out,[].concat(jn(A),[b]),g+(b.skip?0:1)))},p=0,v=f.length;p<v;p++)m()}}var Xe=window.THREE?window.THREE:{Group:Q0,Mesh:_x,MeshLambertMaterial:Ix,Color:Sx,BufferGeometry:Bx,BufferAttribute:Tx,Matrix4:Dx,Vector3:Qx,SphereGeometry:Mx,CylinderGeometry:Lx,TubeGeometry:Nx,ConeGeometry:kx,Line:Rx,LineBasicMaterial:Ox,QuadraticBezierCurve3:Fx,CubicBezierCurve3:Ux,Box3:Px},N0={graph:Gx,forcelayout:zx},sL=2,Bd=new Xe.BufferGeometry().setAttribute?"setAttribute":"addAttribute",kl=new Xe.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",oL=Vx({props:{jsonUrl:{onChange:function(e,t){var i=this;e&&!t.fetchingJson&&(t.fetchingJson=!0,t.onLoading(),fetch(e).then(function(r){return r.json()}).then(function(r){t.fetchingJson=!1,t.onFinishLoading(r),i.graphData(r)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(e,t){t.engineRunning=!1}},numDimensions:{default:3,onChange:function(e,t){var i=t.d3ForceLayout.force("charge");i&&i.strength(e>2?-60:-30),e<3&&r(t.graphData.nodes,"z"),e<2&&r(t.graphData.nodes,"y");function r(s,o){s.forEach(function(a){delete a[o],delete a["v".concat(o)]})}}},dagMode:{onChange:function(e,t){!e&&t.forceEngine==="d3"&&(t.graphData.nodes||[]).forEach(function(i){return i.fx=i.fy=i.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(e){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaDecay(e)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaTarget(e)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.velocityDecay(e)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(e){return e._flushObjects=!0,e._rerender(),this},d3Force:function(e,t,i){return i===void 0?e.d3ForceLayout.force(t):(e.d3ForceLayout.force(t,i),this)},d3ReheatSimulation:function(e){return e.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(e){return e.cntTicks=0,e.startTickTime=new Date,e.engineRunning=!0,this},tickFrame:function(e){var t=e.forceEngine!=="ngraph";return e.engineRunning&&i(),r(),s(),this;function i(){++e.cntTicks>e.cooldownTicks||new Date-e.startTickTime>e.cooldownTime||t&&e.d3AlphaMin>0&&e.d3ForceLayout.alpha()<e.d3AlphaMin?(e.engineRunning=!1,e.onEngineStop()):(e.layout[t?"tick":"step"](),e.onEngineTick());var o=pt(e.nodeThreeObjectExtend);e.nodeDataMapper.entries().forEach(function(d){var f=Fo(d,2),A=f[0],g=f[1];if(g){var m=t?A:e.layout.getNodePosition(A[e.nodeId]),p=o(A);(!e.nodePositionUpdate||!e.nodePositionUpdate(p?g.children[0]:g,{x:m.x,y:m.y,z:m.z},A)||p)&&(g.position.x=m.x,g.position.y=m.y||0,g.position.z=m.z||0)}});var a=pt(e.linkWidth),l=pt(e.linkCurvature),c=pt(e.linkCurveRotation),h=pt(e.linkThreeObjectExtend);e.linkDataMapper.entries().forEach(function(d){var f=Fo(d,2),A=f[0],g=f[1];if(g){var m=t?A:e.layout.getLinkPosition(e.layout.graph.getLink(A.source,A.target).id),p=m[t?"source":"from"],v=m[t?"target":"to"];if(!(!p||!v||!p.hasOwnProperty("x")||!v.hasOwnProperty("x"))){u(A);var y=h(A);if(!(e.linkPositionUpdate&&e.linkPositionUpdate(y?g.children[1]:g,{start:{x:p.x,y:p.y,z:p.z},end:{x:v.x,y:v.y,z:v.z}},A)&&!y)){var b=30,w=A.__curve,M=g.children.length?g.children[0]:g;if(M.type==="Line"){if(w){var R=w.getPoints(b);M.geometry.getAttribute("position").array.length!==R.length*3&&M.geometry[Bd]("position",new Xe.BufferAttribute(new Float32Array(R.length*3),3)),M.geometry.setFromPoints(R)}else{var S=M.geometry.getAttribute("position");(!S||!S.array||S.array.length!==6)&&M.geometry[Bd]("position",S=new Xe.BufferAttribute(new Float32Array(2*3),3)),S.array[0]=p.x,S.array[1]=p.y||0,S.array[2]=p.z||0,S.array[3]=v.x,S.array[4]=v.y||0,S.array[5]=v.z||0,S.needsUpdate=!0}M.geometry.computeBoundingSphere()}else if(M.type==="Mesh")if(w){M.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(M.position.set(0,0,0),M.rotation.set(0,0,0),M.scale.set(1,1,1));var $=Math.ceil(a(A)*10)/10,H=$/2,K=new Xe.TubeGeometry(w,b,H,e.linkResolution,!1);M.geometry.dispose(),M.geometry=K}else{if(!M.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var _=Math.ceil(a(A)*10)/10,I=_/2,D=new Xe.CylinderGeometry(I,I,1,e.linkResolution,1,!1);D[kl](new Xe.Matrix4().makeTranslation(0,1/2,0)),D[kl](new Xe.Matrix4().makeRotationX(Math.PI/2)),M.geometry.dispose(),M.geometry=D}var Q=new Xe.Vector3(p.x,p.y||0,p.z||0),N=new Xe.Vector3(v.x,v.y||0,v.z||0),z=Q.distanceTo(N);M.position.x=Q.x,M.position.y=Q.y,M.position.z=Q.z,M.scale.z=z,M.parent.localToWorld(N),M.lookAt(N)}}}}});function u(d){var f=t?d:e.layout.getLinkPosition(e.layout.graph.getLink(d.source,d.target).id),A=f[t?"source":"from"],g=f[t?"target":"to"];if(!(!A||!g||!A.hasOwnProperty("x")||!g.hasOwnProperty("x"))){var m=l(d);if(!m)d.__curve=null;else{var p=new Xe.Vector3(A.x,A.y||0,A.z||0),v=new Xe.Vector3(g.x,g.y||0,g.z||0),y=p.distanceTo(v),b,w=c(d);if(y>0){var M=g.x-A.x,S=g.y-A.y||0,R=new Xe.Vector3().subVectors(v,p),_=R.clone().multiplyScalar(m).cross(M!==0||S!==0?new Xe.Vector3(0,0,1):new Xe.Vector3(0,1,0)).applyAxisAngle(R.normalize(),w).add(new Xe.Vector3().addVectors(p,v).divideScalar(2));b=new Xe.QuadraticBezierCurve3(p,_,v)}else{var I=m*70,D=-w,Q=D+Math.PI/2;b=new Xe.CubicBezierCurve3(p,new Xe.Vector3(I*Math.cos(Q),I*Math.sin(Q),0).add(p),new Xe.Vector3(I*Math.cos(D),I*Math.sin(D),0).add(p),v)}d.__curve=b}}}}function r(){var o=pt(e.linkDirectionalArrowRelPos),a=pt(e.linkDirectionalArrowLength),l=pt(e.nodeVal);e.arrowDataMapper.entries().forEach(function(c){var h=Fo(c,2),u=h[0],d=h[1];if(d){var f=t?u:e.layout.getLinkPosition(e.layout.graph.getLink(u.source,u.target).id),A=f[t?"source":"from"],g=f[t?"target":"to"];if(!(!A||!g||!A.hasOwnProperty("x")||!g.hasOwnProperty("x"))){var m=Math.cbrt(Math.max(0,l(A)||1))*e.nodeRelSize,p=Math.cbrt(Math.max(0,l(g)||1))*e.nodeRelSize,v=a(u),y=o(u),b=u.__curve?function(I){return u.__curve.getPoint(I)}:function(I){var D=function(N,z,$,H){return z[N]+($[N]-z[N])*H||0};return{x:D("x",A,g,I),y:D("y",A,g,I),z:D("z",A,g,I)}},w=u.__curve?u.__curve.getLength():Math.sqrt(["x","y","z"].map(function(I){return Math.pow((g[I]||0)-(A[I]||0),2)}).reduce(function(I,D){return I+D},0)),M=m+v+(w-m-p-v)*y,S=b(M/w),R=b((M-v)/w);["x","y","z"].forEach(function(I){return d.position[I]=R[I]});var _=dx(Xe.Vector3,jn(["x","y","z"].map(function(I){return S[I]})));d.parent.localToWorld(_),d.lookAt(_)}}})}function s(){var o=pt(e.linkDirectionalParticleSpeed),a=pt(e.linkDirectionalParticleOffset);e.graphData.links.forEach(function(l){var c=e.particlesDataMapper.getObj(l),h=c&&c.children,u=l.__singleHopPhotonsObj&&l.__singleHopPhotonsObj.children;if(!((!u||!u.length)&&(!h||!h.length))){var d=t?l:e.layout.getLinkPosition(e.layout.graph.getLink(l.source,l.target).id),f=d[t?"source":"from"],A=d[t?"target":"to"];if(!(!f||!A||!f.hasOwnProperty("x")||!A.hasOwnProperty("x"))){var g=o(l),m=Math.abs(a(l)),p=l.__curve?function(y){return l.__curve.getPoint(y)}:function(y){var b=function(M,S,R,_){return S[M]+(R[M]-S[M])*_||0};return{x:b("x",f,A,y),y:b("y",f,A,y),z:b("z",f,A,y)}},v=[].concat(jn(h||[]),jn(u||[]));v.forEach(function(y,b){var w=y.parent.__linkThreeObjType==="singleHopPhotons";if(y.hasOwnProperty("__progressRatio")||(y.__progressRatio=w?g<0?1:0:(b+m)/h.length),y.__progressRatio+=g,y.__progressRatio>=1||y.__progressRatio<0)if(!w)y.__progressRatio=y.__progressRatio%1,y.__progressRatio<0&&y.__progressRatio++;else{y.parent.remove(y),O0(y);return}var M=y.__progressRatio,S=p(M);y.geometry.type!=="SphereGeometry"&&y.lookAt(S.x,S.y,S.z),["x","y","z"].forEach(function(R){return y.position[R]=S[R]})})}}})}},emitParticle:function(e,t){if(t&&e.graphData.links.includes(t)){if(!t.__singleHopPhotonsObj){var i=new Xe.Group;i.__linkThreeObjType="singleHopPhotons",t.__singleHopPhotonsObj=i,e.graphScene.add(i)}var r=pt(e.linkDirectionalParticleThreeObject)(t);if(r&&e.linkDirectionalParticleThreeObject===r&&(r=r.clone()),!r){var s=pt(e.linkDirectionalParticleWidth),o=Math.ceil(s(t)*10)/10/2,a=e.linkDirectionalParticleResolution,l=new Xe.SphereGeometry(o,a,a),c=pt(e.linkColor),h=pt(e.linkDirectionalParticleColor),u=h(t)||c(t)||"#f0f0f0",d=new Xe.Color(Eo(u)),f=e.linkOpacity*3,A=new Xe.MeshLambertMaterial({color:d,transparent:!0,opacity:f});r=new Xe.Mesh(l,A)}t.__singleHopPhotonsObj.add(r)}return this},getGraphBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!e.initialised)return null;var i=function r(s){var o=[];if(s.geometry){s.geometry.computeBoundingBox();var a=new Xe.Box3;a.copy(s.geometry.boundingBox).applyMatrix4(s.matrixWorld),o.push(a)}return o.concat.apply(o,jn((s.children||[]).filter(function(l){return!l.hasOwnProperty("__graphObjType")||l.__graphObjType==="node"&&t(l.__data)}).map(r)))}(e.graphScene);return i.length?Object.assign.apply(Object,jn(["x","y","z"].map(function(r){return kh({},r,[Kx(i,function(s){return s.min[r]}),Jx(i,function(s){return s.max[r]})])}))):null}},stateInit:function(){return{d3ForceLayout:qx().force("link",jx()).force("charge",Xx()).force("center",Yx()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(e,t){t.graphScene=e,t.nodeDataMapper=new yo(e,{objBindAttr:"__threeObj"}),t.linkDataMapper=new yo(e,{objBindAttr:"__lineObj"}),t.arrowDataMapper=new yo(e,{objBindAttr:"__arrowObj"}),t.particlesDataMapper=new yo(e,{objBindAttr:"__photonsObj"})},update:function(e,t){var i=function(Ae){return Ae.some(function(se){return t.hasOwnProperty(se)})};if(e.engineRunning=!1,typeof e.onUpdate=="function"&&e.onUpdate(),e.nodeAutoColorBy!==null&&i(["nodeAutoColorBy","graphData","nodeColor"])&&k0(e.graphData.nodes,pt(e.nodeAutoColorBy),e.nodeColor),e.linkAutoColorBy!==null&&i(["linkAutoColorBy","graphData","linkColor"])&&k0(e.graphData.links,pt(e.linkAutoColorBy),e.linkColor),e._flushObjects||i(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var r=pt(e.nodeThreeObject),s=pt(e.nodeThreeObjectExtend),o=pt(e.nodeVal),a=pt(e.nodeColor),l=pt(e.nodeVisibility),c={},h={};(e._flushObjects||i(["nodeThreeObject","nodeThreeObjectExtend"]))&&e.nodeDataMapper.clear(),e.nodeDataMapper.onCreateObj(function(te){var Ae=r(te),se=s(te);Ae&&e.nodeThreeObject===Ae&&(Ae=Ae.clone());var X;return Ae&&!se?X=Ae:(X=new Xe.Mesh,X.__graphDefaultObj=!0,Ae&&se&&X.add(Ae)),X.__graphObjType="node",X}).onUpdateObj(function(te,Ae){if(te.__graphDefaultObj){var se=o(Ae)||1,X=Math.cbrt(se)*e.nodeRelSize,he=e.nodeResolution;(!te.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||te.geometry.parameters.radius!==X||te.geometry.parameters.widthSegments!==he)&&(c.hasOwnProperty(se)||(c[se]=new Xe.SphereGeometry(X,he,he)),te.geometry.dispose(),te.geometry=c[se]);var ue=a(Ae),ve=new Xe.Color(Eo(ue||"#ffffaa")),ne=e.nodeOpacity*Id(ue);(te.material.type!=="MeshLambertMaterial"||!te.material.color.equals(ve)||te.material.opacity!==ne)&&(h.hasOwnProperty(ue)||(h[ue]=new Xe.MeshLambertMaterial({color:ve,transparent:!0,opacity:ne})),te.material.dispose(),te.material=h[ue])}}).digest(e.graphData.nodes.filter(l))}if(e._flushObjects||i(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var u=pt(e.linkThreeObject),d=pt(e.linkThreeObjectExtend),f=pt(e.linkMaterial),A=pt(e.linkVisibility),g=pt(e.linkColor),m=pt(e.linkWidth),p={},v={},y={},b=e.graphData.links.filter(A);if((e._flushObjects||i(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&e.linkDataMapper.clear(),e.linkDataMapper.onRemoveObj(function(te){var Ae=te.__data&&te.__data.__singleHopPhotonsObj;Ae&&(Ae.parent.remove(Ae),O0(Ae),delete te.__data.__singleHopPhotonsObj)}).onCreateObj(function(te){var Ae=u(te),se=d(te);Ae&&e.linkThreeObject===Ae&&(Ae=Ae.clone());var X;if(!Ae||se){var he=!!m(te);if(he)X=new Xe.Mesh;else{var ue=new Xe.BufferGeometry;ue[Bd]("position",new Xe.BufferAttribute(new Float32Array(2*3),3)),X=new Xe.Line(ue)}}var ve;return Ae?se?(ve=new Xe.Group,ve.__graphDefaultObj=!0,ve.add(X),ve.add(Ae)):ve=Ae:(ve=X,ve.__graphDefaultObj=!0),ve.renderOrder=10,ve.__graphObjType="link",ve}).onUpdateObj(function(te,Ae){if(te.__graphDefaultObj){var se=te.children.length?te.children[0]:te,X=Math.ceil(m(Ae)*10)/10,he=!!X;if(he){var ue=X/2,ve=e.linkResolution;if(!se.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||se.geometry.parameters.radiusTop!==ue||se.geometry.parameters.radialSegments!==ve){if(!p.hasOwnProperty(X)){var ne=new Xe.CylinderGeometry(ue,ue,1,ve,1,!1);ne[kl](new Xe.Matrix4().makeTranslation(0,1/2,0)),ne[kl](new Xe.Matrix4().makeRotationX(Math.PI/2)),p[X]=ne}se.geometry.dispose(),se.geometry=p[X]}}var le=f(Ae);if(le)se.material=le;else{var ce=g(Ae),O=new Xe.Color(Eo(ce||"#f0f0f0")),me=e.linkOpacity*Id(ce),ye=he?"MeshLambertMaterial":"LineBasicMaterial";if(se.material.type!==ye||!se.material.color.equals(O)||se.material.opacity!==me){var x=he?v:y;x.hasOwnProperty(ce)||(x[ce]=new Xe[ye]({color:O,transparent:me<1,opacity:me,depthWrite:me>=1})),se.material.dispose(),se.material=x[ce]}}}}).digest(b),e.linkDirectionalArrowLength||t.hasOwnProperty("linkDirectionalArrowLength")){var w=pt(e.linkDirectionalArrowLength),M=pt(e.linkDirectionalArrowColor);e.arrowDataMapper.onCreateObj(function(){var te=new Xe.Mesh(void 0,new Xe.MeshLambertMaterial({transparent:!0}));return te.__linkThreeObjType="arrow",te}).onUpdateObj(function(te,Ae){var se=w(Ae),X=e.linkDirectionalArrowResolution;if(!te.geometry.type.match(/^Cone(Buffer)?Geometry$/)||te.geometry.parameters.height!==se||te.geometry.parameters.radialSegments!==X){var he=new Xe.ConeGeometry(se*.25,se,X);he.translate(0,se/2,0),he.rotateX(Math.PI/2),te.geometry.dispose(),te.geometry=he}var ue=M(Ae)||g(Ae)||"#f0f0f0";te.material.color=new Xe.Color(Eo(ue)),te.material.opacity=e.linkOpacity*3*Id(ue)}).digest(b.filter(w))}if(e.linkDirectionalParticles||t.hasOwnProperty("linkDirectionalParticles")){var S=pt(e.linkDirectionalParticles),R=pt(e.linkDirectionalParticleWidth),_=pt(e.linkDirectionalParticleColor),I=pt(e.linkDirectionalParticleThreeObject),D={},Q={};e.particlesDataMapper.onCreateObj(function(){var te=new Xe.Group;return te.__linkThreeObjType="photons",te.__photonDataMapper=new yo(te),te}).onUpdateObj(function(te,Ae){var se=!!te.children.length&&te.children[0],X=I(Ae),he,ue;if(X)he=X.geometry,ue=X.material;else{var ve=Math.ceil(R(Ae)*10)/10/2,ne=e.linkDirectionalParticleResolution;se&&se.geometry.parameters.radius===ve&&se.geometry.parameters.widthSegments===ne?he=se.geometry:(Q.hasOwnProperty(ve)||(Q[ve]=new Xe.SphereGeometry(ve,ne,ne)),he=Q[ve]);var le=_(Ae)||g(Ae)||"#f0f0f0",ce=new Xe.Color(Eo(le)),O=e.linkOpacity*3;se&&se.material.color.equals(ce)&&se.material.opacity===O?ue=se.material:(D.hasOwnProperty(le)||(D[le]=new Xe.MeshLambertMaterial({color:ce,transparent:!0,opacity:O})),ue=D[le])}se&&(se.geometry!==he&&se.geometry.dispose(),se.material!==ue&&se.material.dispose());var me=Math.round(Math.abs(S(Ae)));te.__photonDataMapper.id(function(ye){return ye.idx}).onCreateObj(function(){return new Xe.Mesh(he,ue)}).onUpdateObj(function(ye){ye.geometry=he,ye.material=ue}).digest(jn(new Array(me)).map(function(ye,x){return{idx:x}}))}).digest(b.filter(S))}}if(e._flushObjects=!1,i(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){e.engineRunning=!1,e.graphData.links.forEach(function(te){te.source=te[e.linkSource],te.target=te[e.linkTarget]});var N=e.forceEngine!=="ngraph",z;if(N){(z=e.d3ForceLayout).stop().alpha(1).numDimensions(e.numDimensions).nodes(e.graphData.nodes);var $=e.d3ForceLayout.force("link");$&&$.id(function(te){return te[e.nodeId]}).links(e.graphData.links);var H=e.dagMode&&rL(e.graphData,function(te){return te[e.nodeId]},{nodeFilter:e.dagNodeFilter,onLoopError:e.onDagError||void 0}),K=Math.max.apply(Math,jn(Object.values(H||[]))),Y=e.dagLevelDistance||e.graphData.nodes.length/(K||1)*sL*(["radialin","radialout"].indexOf(e.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var ee=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";e.graphData.nodes.filter(e.dagNodeFilter).forEach(function(te){return delete te[ee]})}if(["lr","rl","td","bu","zin","zout"].includes(e.dagMode)){var pe=["rl","td","zout"].includes(e.dagMode),be=function(Ae){return(H[Ae[e.nodeId]]-K/2)*Y*(pe?-1:1)},Ce=["lr","rl"].includes(e.dagMode)?"fx":["td","bu"].includes(e.dagMode)?"fy":"fz";e.graphData.nodes.filter(e.dagNodeFilter).forEach(function(te){return te[Ce]=be(te)})}e.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(e.dagMode)!==-1?Wx(function(te){var Ae=H[te[e.nodeId]]||-1;return(e.dagMode==="radialin"?K-Ae:Ae)*Y}).strength(function(te){return e.dagNodeFilter(te)?1:0}):null)}else{var Pe=N0.graph();e.graphData.nodes.forEach(function(te){Pe.addNode(te[e.nodeId])}),e.graphData.links.forEach(function(te){Pe.addLink(te.source,te.target)}),z=N0.forcelayout(Pe,$R({dimensions:e.numDimensions},e.ngraphPhysics)),z.graph=Pe}for(var Me=0;Me<e.warmupTicks&&!(N&&e.d3AlphaMin>0&&e.d3ForceLayout.alpha()<e.d3AlphaMin);Me++)z[N?"tick":"step"]();e.layout=z,this.resetCountdown()}e.engineRunning=!0,e.onFinishUpdate()}});function aL(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=function(r){function s(){var o;ux(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=hx(this,s,[].concat(l)),o.__kapsuleInstance=dx(n,[].concat(jn(t?[o]:[]),l)),o}return px(s,r),fx(s)}(e);return Object.keys(n()).forEach(function(r){return i.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),i}var lL=window.THREE?window.THREE:{Group:Q0},Nl=aL(oL,lL.Group,!0);if(typeof AFRAME>"u")throw new Error("Component attempted to register before AFRAME was available.");var Td=function(e){return typeof e=="string"?JSON.parse(e):e},qn=function(e){if(typeof e=="function")return e;var t=eval;try{var i=t("("+e+")");return i}catch{}return null},Mt=function(e){return isNaN(parseFloat(e))?qn(e)?qn(e):e:parseFloat(e)};AFRAME.components.hasOwnProperty("forcegraph")||AFRAME.registerComponent("forcegraph",{schema:{jsonUrl:{type:"string",default:""},nodes:{parse:Td,default:[]},links:{parse:Td,default:[]},numDimensions:{type:"number",default:3},dagMode:{type:"string",default:""},dagLevelDistance:{type:"number",default:0},dagNodeFilter:{parse:qn,default:function(){return!0}},onDagError:{parse:qn,default:void 0},nodeRelSize:{type:"number",default:4},nodeId:{type:"string",default:"id"},nodeVal:{parse:Mt,default:"val"},nodeResolution:{type:"number",default:8},nodeVisibility:{parse:Mt,default:!0},nodeColor:{parse:Mt,default:"color"},nodeAutoColorBy:{parse:Mt,default:""},nodeOpacity:{type:"number",default:.75},nodeThreeObject:{parse:Mt,default:null},nodeThreeObjectExtend:{parse:Mt,default:!1},linkSource:{type:"string",default:"source"},linkTarget:{type:"string",default:"target"},linkVisibility:{parse:Mt,default:!0},linkColor:{parse:Mt,default:"color"},linkAutoColorBy:{parse:Mt,default:""},linkOpacity:{type:"number",default:.2},linkWidth:{parse:Mt,default:0},linkResolution:{type:"number",default:6},linkCurvature:{parse:Mt,default:0},linkCurveRotation:{parse:Mt,default:0},linkMaterial:{parse:Mt,default:null},linkThreeObject:{parse:Mt,default:null},linkThreeObjectExtend:{parse:Mt,default:!1},linkPositionUpdate:{parse:qn,default:null},linkDirectionalArrowLength:{parse:Mt,default:0},linkDirectionalArrowColor:{parse:Mt,default:null},linkDirectionalArrowRelPos:{parse:Mt,default:.5},linkDirectionalArrowResolution:{type:"number",default:8},linkDirectionalParticles:{parse:Mt,default:0},linkDirectionalParticleSpeed:{parse:Mt,default:.01},linkDirectionalParticleOffset:{parse:Mt,default:0},linkDirectionalParticleWidth:{parse:Mt,default:.5},linkDirectionalParticleColor:{parse:Mt,default:null},linkDirectionalParticleResolution:{type:"number",default:4},linkDirectionalParticleThreeObject:{parse:Mt,default:null},onNodeHover:{parse:qn,default:function(){}},onLinkHover:{parse:qn,default:function(){}},onNodeClick:{parse:qn,default:function(){}},onLinkClick:{parse:qn,default:function(){}},forceEngine:{type:"string",default:"d3"},d3AlphaMin:{type:"number",default:0},d3AlphaDecay:{type:"number",default:.0228},d3VelocityDecay:{type:"number",default:.4},ngraphPhysics:{parse:Td,default:null},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1e18},cooldownTime:{type:"int",default:15e3},onEngineTick:{parse:qn,default:function(){}},onEngineStop:{parse:qn,default:function(){}}},getGraphBbox:function(e){return this.forceGraph||(this.forceGraph=new Nl),this.forceGraph.getGraphBbox(e)},emitParticle:function(){this.forceGraph||(this.forceGraph=new Nl);var e=this.forceGraph,t=e.emitParticle.apply(e,arguments);return t===e?this:t},d3Force:function(){this.forceGraph||(this.forceGraph=new Nl);var e=this.forceGraph,t=e.d3Force.apply(e,arguments);return t===e?this:t},d3ReheatSimulation:function(){return this.forceGraph&&this.forceGraph.d3ReheatSimulation(),this},refresh:function(){return this.forceGraph&&this.forceGraph.refresh(),this},init:function(){var e=this,t=this.state={};t.infoEl=document.createElement("a-text"),t.infoEl.setAttribute("position","0 -0.1 -1"),t.infoEl.setAttribute("width",1),t.infoEl.setAttribute("align","center"),t.infoEl.setAttribute("color","lavender");var i=document.querySelector("a-entity[camera], a-camera");i.appendChild(t.infoEl),t.cameraObj=i.object3D.children.filter(function(r){return r.type==="PerspectiveCamera"})[0],this.el.sceneEl.addEventListener("camera-set-active",function(r){t.cameraObj=r.detail.cameraEl.components.camera.camera}),this.forceGraph||(this.forceGraph=new Nl),this.forceGraph.onFinishUpdate(function(){return e.el.setObject3D("forcegraphGroup",e.forceGraph)}).onLoading(function(){return t.infoEl.setAttribute("value","Loading...")}).onFinishLoading(function(){return t.infoEl.setAttribute("value","")}),this.el.addEventListener("raycaster-intersected",function(r){return t.hoverDetail=r.detail}),this.el.addEventListener("raycaster-intersected-cleared",function(r){return t.hoverDetail=r.detail}),this.el.addEventListener("click",function(){return t.hoverObj&&e.data["on"+(t.hoverObj.__graphObjType==="node"?"Node":"Link")+"Click"](t.hoverObj.__data)})},remove:function(){this.state.infoEl.remove(),this.el.removeObject3D("forcegraphGroup")},update:function(e){var t=this,i=this.data,r=AFRAME.utils.diff(i,e),s=["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject","forceEngine","d3AlphaMin","d3AphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"];s.filter(function(o){return o in r}).forEach(function(o){t.forceGraph[o](i[o]!==""?i[o]:null)}),("nodes"in r||"links"in r)&&t.forceGraph.graphData({nodes:i.nodes,links:i.links})},tick:function(e,t){for(var i=this.state,r=this.data,s=i.hoverDetail?i.hoverDetail.getIntersection?i.hoverDetail.getIntersection(this.el):i.hoverDetail.intersection||void 0:void 0,o=s?s.object:void 0;o&&!o.hasOwnProperty("__graphObjType");)o=o.parent;if(o!==i.hoverObj){var a=i.hoverObj?i.hoverObj.__graphObjType:null,l=i.hoverObj?i.hoverObj.__data:null,c=o?o.__graphObjType:null,h=o?o.__data:null;a&&a!==c&&r["on"+(a==="node"?"Node":"Link")+"Hover"](null,l),c&&r["on"+(c==="node"?"Node":"Link")+"Hover"](h,a===c?l:null),i.hoverObj=o}this.forceGraph.tickFrame()}});