@yschindel/ara3d-webgl 1.3.5 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- (function(Ut,Yt){typeof exports=="object"&&typeof module<"u"?Yt(exports):typeof define=="function"&&define.amd?define(["exports"],Yt):(Ut=typeof globalThis<"u"?globalThis:Ut||self,Yt(Ut.ara3d={}))})(this,function(Ut){"use strict";var UT=Object.defineProperty;var BT=(Ut,Yt,zi)=>Yt in Ut?UT(Ut,Yt,{enumerable:!0,configurable:!0,writable:!0,value:zi}):Ut[Yt]=zi;var J=(Ut,Yt,zi)=>(BT(Ut,typeof Yt!="symbol"?Yt+"":Yt,zi),zi);/**
1
+ (function(Ut,Yt){typeof exports=="object"&&typeof module<"u"?Yt(exports):typeof define=="function"&&define.amd?define(["exports"],Yt):(Ut=typeof globalThis<"u"?globalThis:Ut||self,Yt(Ut.ara3d={}))})(this,function(Ut){"use strict";var UT=Object.defineProperty;var BT=(Ut,Yt,zi)=>Yt in Ut?UT(Ut,Yt,{enumerable:!0,configurable:!0,writable:!0,value:zi}):Ut[Yt]=zi;var $=(Ut,Yt,zi)=>(BT(Ut,typeof Yt!="symbol"?Yt+"":Yt,zi),zi);/**
2
2
  * @license
3
3
  * Copyright 2010-2025 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
- */const Yt="182",zi={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},xf=0,Bl=1,Af=2,o0=3,a0=0,Ls=1,bf=2,Dr=3,Wn=0,en=1,Sn=2,qn=0,ki=1,Ol=2,Fl=3,zl=4,wf=5,_i=100,Sf=101,Mf=102,Ef=103,Tf=104,Cf=200,If=201,Rf=202,Pf=203,zo=204,ko=205,Df=206,Lf=207,Nf=208,Uf=209,Bf=210,Of=211,Ff=212,zf=213,kf=214,Vo=0,Ho=1,Go=2,Vi=3,Wo=4,qo=5,Xo=6,Zo=7,Ns=0,Vf=1,Hf=2,Nn=0,kl=1,Vl=2,Hl=3,Yo=4,Gl=5,Wl=6,ql=7,Xl="attached",Gf="detached",Qo=300,Xn=301,vi=302,Us=303,Bs=304,Lr=306,yi=1e3,tn=1001,Nr=1002,Mt=1003,Ko=1004,c0=1004,Hi=1005,l0=1005,pt=1006,Ur=1007,h0=1007,Mn=1008,u0=1008,ln=1009,Zl=1010,Yl=1011,Br=1012,jo=1013,En=1014,nn=1015,Zn=1016,Jo=1017,$o=1018,Or=1020,Ql=35902,Kl=35899,jl=1021,Jl=1022,rn=1023,Yn=1026,xi=1027,ea=1028,Os=1029,Gi=1030,ta=1031,f0=1032,na=1033,Fs=33776,zs=33777,ks=33778,Vs=33779,ia=35840,ra=35841,sa=35842,oa=35843,aa=36196,ca=37492,la=37496,ha=37488,ua=37489,fa=37490,da=37491,pa=37808,ma=37809,ga=37810,_a=37811,va=37812,ya=37813,xa=37814,Aa=37815,ba=37816,wa=37817,Sa=37818,Ma=37819,Ea=37820,Ta=37821,Ca=36492,Ia=36494,Ra=36495,Pa=36283,Da=36284,La=36285,Na=36286,Wf=2200,qf=2201,Xf=2202,Fr=2300,zr=2301,Ua=2302,Wi=2400,qi=2401,Hs=2402,Ba=2500,$l=2501,Zf=0,eh=1,Oa=2,Yf=3200,d0=3201,p0=3202,m0=3203,Ai=0,Qf=1,ri="",Tt="srgb",Xt="srgb-linear",Gs="linear",ut="srgb",g0="",_0="rg",v0="ga",y0=0,Xi=7680,x0=7681,A0=7682,b0=7683,w0=34055,S0=34056,M0=5386,E0=512,T0=513,C0=514,I0=515,R0=516,P0=517,D0=518,th=519,Kf=512,jf=513,Jf=514,Fa=515,$f=516,ed=517,za=518,td=519,kr=35044,L0=35048,N0=35040,U0=35045,B0=35049,O0=35041,F0=35046,z0=35050,k0=35042,V0="100",nh="300 es",gn=2e3,Vr=2001,H0={COMPUTE:"compute",RENDER:"render"},G0={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},W0={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function nd(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const q0={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Hr(r,e){return new q0[r](e)}function id(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Ws(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function rd(){const r=Ws("canvas");return r.style.display="block",r}const sd={};let bi=null;function X0(r){bi=r}function Z0(){return bi}function qs(...r){const e="THREE."+r.shift();bi?bi("log",e,...r):console.log(e,...r)}function Te(...r){const e="THREE."+r.shift();bi?bi("warn",e,...r):console.warn(e,...r)}function Ge(...r){const e="THREE."+r.shift();bi?bi("error",e,...r):console.error(e,...r)}function Gr(...r){const e=r.join(" ");e in sd||(sd[e]=!0,Te(...r))}function Y0(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}class Qn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const Qt=["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 od=1234567;const Zi=Math.PI/180,Wr=180/Math.PI;function _n(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Qt[r&255]+Qt[r>>8&255]+Qt[r>>16&255]+Qt[r>>24&255]+"-"+Qt[e&255]+Qt[e>>8&255]+"-"+Qt[e>>16&15|64]+Qt[e>>24&255]+"-"+Qt[t&63|128]+Qt[t>>8&255]+"-"+Qt[t>>16&255]+Qt[t>>24&255]+Qt[n&255]+Qt[n>>8&255]+Qt[n>>16&255]+Qt[n>>24&255]).toLowerCase()}function Qe(r,e,t){return Math.max(e,Math.min(t,r))}function ih(r,e){return(r%e+e)%e}function Q0(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function K0(r,e,t){return r!==e?(t-r)/(e-r):0}function Xs(r,e,t){return(1-t)*r+t*e}function j0(r,e,t,n){return Xs(r,e,1-Math.exp(-t*n))}function J0(r,e=1){return e-Math.abs(ih(r,e*2)-e)}function $0(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function e_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function t_(r,e){return r+Math.floor(Math.random()*(e-r+1))}function n_(r,e){return r+Math.random()*(e-r)}function i_(r){return r*(.5-Math.random())}function r_(r){r!==void 0&&(od=r);let e=od+=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 s_(r){return r*Zi}function o_(r){return r*Wr}function a_(r){return(r&r-1)===0&&r!==0}function c_(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function l_(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function h_(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),c=o(t/2),l=s((e+n)/2),h=o((e+n)/2),u=s((e-n)/2),f=o((e-n)/2),d=s((n-e)/2),g=o((n-e)/2);switch(i){case"XYX":r.set(a*h,c*u,c*f,a*l);break;case"YZY":r.set(c*f,a*h,c*u,a*l);break;case"ZXZ":r.set(c*u,c*f,a*h,a*l);break;case"XZX":r.set(a*h,c*g,c*d,a*l);break;case"YXY":r.set(c*d,a*h,c*g,a*l);break;case"ZYZ":r.set(c*g,c*d,a*h,a*l);break;default:Te("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function sn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function tt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const ka={DEG2RAD:Zi,RAD2DEG:Wr,generateUUID:_n,clamp:Qe,euclideanModulo:ih,mapLinear:Q0,inverseLerp:K0,lerp:Xs,damp:j0,pingpong:J0,smoothstep:$0,smootherstep:e_,randInt:t_,randFloat:n_,randFloatSpread:i_,seededRandom:r_,degToRad:s_,radToDeg:o_,isPowerOfTwo:a_,ceilPowerOfTwo:c_,floorPowerOfTwo:l_,setQuaternionFromProperEuler:h_,normalize:tt,denormalize:sn};class he{constructor(e=0,t=0){he.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Qe(this.x,e.x,t.x),this.y=Qe(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Qe(this.x,e,t),this.y=Qe(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Qe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Qe(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class wt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,o,a){let c=n[i+0],l=n[i+1],h=n[i+2],u=n[i+3],f=s[o+0],d=s[o+1],g=s[o+2],_=s[o+3];if(a<=0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(a>=1){e[t+0]=f,e[t+1]=d,e[t+2]=g,e[t+3]=_;return}if(u!==_||c!==f||l!==d||h!==g){let m=c*f+l*d+h*g+u*_;m<0&&(f=-f,d=-d,g=-g,_=-_,m=-m);let p=1-a;if(m<.9995){const v=Math.acos(m),y=Math.sin(v);p=Math.sin(p*v)/y,a=Math.sin(a*v)/y,c=c*p+f*a,l=l*p+d*a,h=h*p+g*a,u=u*p+_*a}else{c=c*p+f*a,l=l*p+d*a,h=h*p+g*a,u=u*p+_*a;const v=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=v,l*=v,h*=v,u*=v}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],c=n[i+1],l=n[i+2],h=n[i+3],u=s[o],f=s[o+1],d=s[o+2],g=s[o+3];return e[t]=a*g+h*u+c*d-l*f,e[t+1]=c*g+h*f+l*u-a*d,e[t+2]=l*g+h*d+a*f-c*u,e[t+3]=h*g-a*u-c*f-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(n/2),h=a(i/2),u=a(s/2),f=c(n/2),d=c(i/2),g=c(s/2);switch(o){case"XYZ":this._x=f*h*u+l*d*g,this._y=l*d*u-f*h*g,this._z=l*h*g+f*d*u,this._w=l*h*u-f*d*g;break;case"YXZ":this._x=f*h*u+l*d*g,this._y=l*d*u-f*h*g,this._z=l*h*g-f*d*u,this._w=l*h*u+f*d*g;break;case"ZXY":this._x=f*h*u-l*d*g,this._y=l*d*u+f*h*g,this._z=l*h*g+f*d*u,this._w=l*h*u-f*d*g;break;case"ZYX":this._x=f*h*u-l*d*g,this._y=l*d*u+f*h*g,this._z=l*h*g-f*d*u,this._w=l*h*u+f*d*g;break;case"YZX":this._x=f*h*u+l*d*g,this._y=l*d*u+f*h*g,this._z=l*h*g-f*d*u,this._w=l*h*u-f*d*g;break;case"XZY":this._x=f*h*u-l*d*g,this._y=l*d*u-f*h*g,this._z=l*h*g+f*d*u,this._w=l*h*u+f*d*g;break;default:Te("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],a=t[5],c=t[9],l=t[2],h=t[6],u=t[10],f=n+a+u;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-c)*d,this._y=(s-l)*d,this._z=(o-i)*d}else if(n>a&&n>u){const d=2*Math.sqrt(1+n-a-u);this._w=(h-c)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+l)/d}else if(a>u){const d=2*Math.sqrt(1+a-n-u);this._w=(s-l)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(c+h)/d}else{const d=2*Math.sqrt(1+u-n-a);this._w=(o-i)/d,this._x=(s+l)/d,this._y=(c+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Qe(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+o*a+i*l-s*c,this._y=i*h+o*c+s*a-n*l,this._z=s*h+o*l+n*c-i*a,this._w=o*h-n*a-i*c-s*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,i=-i,s=-s,o=-o,a=-a);let c=1-t;if(a<.9995){const l=Math.acos(a),h=Math.sin(l);c=Math.sin(c*l)/h,t=Math.sin(t*l)/h,this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+s*t,this._w=this._w*c+o*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+s*t,this._w=this._w*c+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class U{constructor(e=0,t=0,n=0){U.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(ad.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ad.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,c=e.w,l=2*(o*i-a*n),h=2*(a*t-s*i),u=2*(s*n-o*t);return this.x=t+c*l+o*u-a*h,this.y=n+c*h+a*l-s*u,this.z=i+c*u+s*h-o*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Qe(this.x,e.x,t.x),this.y=Qe(this.y,e.y,t.y),this.z=Qe(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Qe(this.x,e,t),this.y=Qe(this.y,e,t),this.z=Qe(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Qe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,c=t.z;return this.x=i*c-s*a,this.y=s*o-n*c,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return rh.copy(this).projectOnVector(e),this.sub(rh)}reflect(e){return this.sub(rh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Qe(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const rh=new U,ad=new wt;class et{constructor(e,t,n,i,s,o,a,c,l){et.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,c,l)}set(e,t,n,i,s,o,a,c,l){const h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=s,h[5]=c,h[6]=n,h[7]=o,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[3],c=n[6],l=n[1],h=n[4],u=n[7],f=n[2],d=n[5],g=n[8],_=i[0],m=i[3],p=i[6],v=i[1],y=i[4],x=i[7],A=i[2],E=i[5],I=i[8];return s[0]=o*_+a*v+c*A,s[3]=o*m+a*y+c*E,s[6]=o*p+a*x+c*I,s[1]=l*_+h*v+u*A,s[4]=l*m+h*y+u*E,s[7]=l*p+h*x+u*I,s[2]=f*_+d*v+g*A,s[5]=f*m+d*y+g*E,s[8]=f*p+d*x+g*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8];return t*o*h-t*a*l-n*s*h+n*a*c+i*s*l-i*o*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=h*o-a*l,f=a*c-h*s,d=l*s-o*c,g=t*u+n*f+i*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=u*_,e[1]=(i*l-h*n)*_,e[2]=(a*n-i*o)*_,e[3]=f*_,e[4]=(h*t-i*c)*_,e[5]=(i*s-a*t)*_,e[6]=d*_,e[7]=(n*c-l*t)*_,e[8]=(o*t-n*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,o,a){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*o+l*a)+o+e,-i*l,i*c,-i*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(sh.makeScale(e,t)),this}rotate(e){return this.premultiply(sh.makeRotation(-e)),this}translate(e,t){return this.premultiply(sh.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const sh=new et,cd=new et().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ld=new et().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function u_(){const r={enabled:!0,workingColorSpace:Xt,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===ut&&(i.r=si(i.r),i.g=si(i.g),i.b=si(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===ut&&(i.r=qr(i.r),i.g=qr(i.g),i.b=qr(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===ri?Gs:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Gr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Gr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Xt]:{primaries:e,whitePoint:n,transfer:Gs,toXYZ:cd,fromXYZ:ld,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Tt},outputColorSpaceConfig:{drawingBufferColorSpace:Tt}},[Tt]:{primaries:e,whitePoint:n,transfer:ut,toXYZ:cd,fromXYZ:ld,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Tt}}}),r}const rt=u_();function si(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function qr(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Xr;class hd{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Xr===void 0&&(Xr=Ws("canvas")),Xr.width=e.width,Xr.height=e.height;const i=Xr.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Xr}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Ws("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=si(s[o]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(si(t[n]/255)*255):t[n]=si(t[n]);return{data:t,width:e.width,height:e.height}}else return Te("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let f_=0;class wi{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:f_++}),this.uuid=_n(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(oh(i[o].image)):s.push(oh(i[o]))}else s=oh(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function oh(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?hd.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(Te("Texture: Unable to serialize Texture."),{})}let d_=0;const ah=new U;class xt extends Qn{constructor(e=xt.DEFAULT_IMAGE,t=xt.DEFAULT_MAPPING,n=tn,i=tn,s=pt,o=Mn,a=rn,c=ln,l=xt.DEFAULT_ANISOTROPY,h=ri){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:d_++}),this.uuid=_n(),this.name="",this.source=new wi(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new he(0,0),this.repeat=new he(1,1),this.center=new he(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.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(ah).x}get height(){return this.source.getSize(ah).y}get depth(){return this.source.getSize(ah).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Te(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Te(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Qo)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case yi:e.x=e.x-Math.floor(e.x);break;case tn:e.x=e.x<0?0:1;break;case Nr: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 yi:e.y=e.y-Math.floor(e.y);break;case tn:e.y=e.y<0?0:1;break;case Nr: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++}}xt.DEFAULT_IMAGE=null,xt.DEFAULT_MAPPING=Qo,xt.DEFAULT_ANISOTROPY=1;class gt{constructor(e=0,t=0,n=0,i=1){gt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const c=e.elements,l=c[0],h=c[4],u=c[8],f=c[1],d=c[5],g=c[9],_=c[2],m=c[6],p=c[10];if(Math.abs(h-f)<.01&&Math.abs(u-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+_)<.1&&Math.abs(g+m)<.1&&Math.abs(l+d+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(l+1)/2,x=(d+1)/2,A=(p+1)/2,E=(h+f)/4,I=(u+_)/4,D=(g+m)/4;return y>x&&y>A?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=E/n,s=I/n):x>A?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=E/i,s=D/i):A<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(A),n=I/s,i=D/s),this.set(n,i,s,t),this}let v=Math.sqrt((m-g)*(m-g)+(u-_)*(u-_)+(f-h)*(f-h));return Math.abs(v)<.001&&(v=1),this.x=(m-g)/v,this.y=(u-_)/v,this.z=(f-h)/v,this.w=Math.acos((l+d+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=Qe(this.x,e.x,t.x),this.y=Qe(this.y,e.y,t.y),this.z=Qe(this.z,e.z,t.z),this.w=Qe(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Qe(this.x,e,t),this.y=Qe(this.y,e,t),this.z=Qe(this.z,e,t),this.w=Qe(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Qe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ch extends Qn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:pt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gt(0,0,e,t),this.scissorTest=!1,this.viewport=new gt(0,0,e,t);const i={width:e,height:t,depth:n.depth},s=new xt(i);this.textures=[];const o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:pt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new wi(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class vn extends ch{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Va extends xt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Mt,this.minFilter=Mt,this.wrapR=tn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class p_ extends vn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Va(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Ha extends xt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Mt,this.minFilter=Mt,this.wrapR=tn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class m_ extends vn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Ha(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Gt{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Un.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Un.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Un.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Un):Un.fromBufferAttribute(s,o),Un.applyMatrix4(e.matrixWorld),this.expandByPoint(Un);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ga.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Ga.copy(n.boundingBox)),Ga.applyMatrix4(e.matrixWorld),this.union(Ga)}const i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Un),Un.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Zs),Wa.subVectors(this.max,Zs),Zr.subVectors(e.a,Zs),Yr.subVectors(e.b,Zs),Qr.subVectors(e.c,Zs),Si.subVectors(Yr,Zr),Mi.subVectors(Qr,Yr),Yi.subVectors(Zr,Qr);let t=[0,-Si.z,Si.y,0,-Mi.z,Mi.y,0,-Yi.z,Yi.y,Si.z,0,-Si.x,Mi.z,0,-Mi.x,Yi.z,0,-Yi.x,-Si.y,Si.x,0,-Mi.y,Mi.x,0,-Yi.y,Yi.x,0];return!lh(t,Zr,Yr,Qr,Wa)||(t=[1,0,0,0,1,0,0,0,1],!lh(t,Zr,Yr,Qr,Wa))?!1:(qa.crossVectors(Si,Mi),t=[qa.x,qa.y,qa.z],lh(t,Zr,Yr,Qr,Wa))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Un).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Un).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:(oi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),oi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),oi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),oi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),oi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),oi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),oi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),oi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(oi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const oi=[new U,new U,new U,new U,new U,new U,new U,new U],Un=new U,Ga=new Gt,Zr=new U,Yr=new U,Qr=new U,Si=new U,Mi=new U,Yi=new U,Zs=new U,Wa=new U,qa=new U,Qi=new U;function lh(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Qi.fromArray(r,s);const a=i.x*Math.abs(Qi.x)+i.y*Math.abs(Qi.y)+i.z*Math.abs(Qi.z),c=e.dot(Qi),l=t.dot(Qi),h=n.dot(Qi);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>a)return!1}return!0}const g_=new Gt,Ys=new U,hh=new U;class Pt{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):g_.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ys.subVectors(e,this.center);const t=Ys.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ys,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(hh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ys.copy(e.center).add(hh)),this.expandByPoint(Ys.copy(e.center).sub(hh))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const ai=new U,uh=new U,Xa=new U,Ei=new U,fh=new U,Za=new U,dh=new U;class Kr{constructor(e=new U,t=new U(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,ai)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ai.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ai.copy(this.origin).addScaledVector(this.direction,t),ai.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){uh.copy(e).add(t).multiplyScalar(.5),Xa.copy(t).sub(e).normalize(),Ei.copy(this.origin).sub(uh);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Xa),a=Ei.dot(this.direction),c=-Ei.dot(Xa),l=Ei.lengthSq(),h=Math.abs(1-o*o);let u,f,d,g;if(h>0)if(u=o*c-a,f=o*a-c,g=s*h,u>=0)if(f>=-g)if(f<=g){const _=1/h;u*=_,f*=_,d=u*(u+o*f+2*a)+f*(o*u+f+2*c)+l}else f=s,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*c)+l;else f=-s,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*c)+l;else f<=-g?(u=Math.max(0,-(-o*s+a)),f=u>0?-s:Math.min(Math.max(-s,-c),s),d=-u*u+f*(f+2*c)+l):f<=g?(u=0,f=Math.min(Math.max(-s,-c),s),d=f*(f+2*c)+l):(u=Math.max(0,-(o*s+a)),f=u>0?s:Math.min(Math.max(-s,-c),s),d=-u*u+f*(f+2*c)+l);else f=o>0?-s:s,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(uh).addScaledVector(Xa,f),d}intersectSphere(e,t){ai.subVectors(e.center,this.origin);const n=ai.dot(this.direction),i=ai.dot(ai)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,c=n+o;return c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,a,c;const l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return l>=0?(n=(e.min.x-f.x)*l,i=(e.max.x-f.x)*l):(n=(e.max.x-f.x)*l,i=(e.min.x-f.x)*l),h>=0?(s=(e.min.y-f.y)*h,o=(e.max.y-f.y)*h):(s=(e.max.y-f.y)*h,o=(e.min.y-f.y)*h),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o<i||isNaN(i))&&(i=o),u>=0?(a=(e.min.z-f.z)*u,c=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,c=(e.min.z-f.z)*u),n>c||a>i)||((a>n||n!==n)&&(n=a),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ai)!==null}intersectTriangle(e,t,n,i,s){fh.subVectors(t,e),Za.subVectors(n,e),dh.crossVectors(fh,Za);let o=this.direction.dot(dh),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ei.subVectors(this.origin,e);const c=a*this.direction.dot(Za.crossVectors(Ei,Za));if(c<0)return null;const l=a*this.direction.dot(fh.cross(Ei));if(l<0||c+l>o)return null;const h=-a*Ei.dot(dh);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 We{constructor(e,t,n,i,s,o,a,c,l,h,u,f,d,g,_,m){We.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,c,l,h,u,f,d,g,_,m)}set(e,t,n,i,s,o,a,c,l,h,u,f,d,g,_,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=h,p[10]=u,p[14]=f,p[3]=d,p[7]=g,p[11]=_,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 We().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/jr.setFromMatrixColumn(e,0).length(),s=1/jr.setFromMatrixColumn(e,1).length(),o=1/jr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=o*h,d=o*u,g=a*h,_=a*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=d+g*l,t[5]=f-_*l,t[9]=-a*c,t[2]=_-f*l,t[6]=g+d*l,t[10]=o*c}else if(e.order==="YXZ"){const f=c*h,d=c*u,g=l*h,_=l*u;t[0]=f+_*a,t[4]=g*a-d,t[8]=o*l,t[1]=o*u,t[5]=o*h,t[9]=-a,t[2]=d*a-g,t[6]=_+f*a,t[10]=o*c}else if(e.order==="ZXY"){const f=c*h,d=c*u,g=l*h,_=l*u;t[0]=f-_*a,t[4]=-o*u,t[8]=g+d*a,t[1]=d+g*a,t[5]=o*h,t[9]=_-f*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){const f=o*h,d=o*u,g=a*h,_=a*u;t[0]=c*h,t[4]=g*l-d,t[8]=f*l+_,t[1]=c*u,t[5]=_*l+f,t[9]=d*l-g,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){const f=o*c,d=o*l,g=a*c,_=a*l;t[0]=c*h,t[4]=_-f*u,t[8]=g*u+d,t[1]=u,t[5]=o*h,t[9]=-a*h,t[2]=-l*h,t[6]=d*u+g,t[10]=f-_*u}else if(e.order==="XZY"){const f=o*c,d=o*l,g=a*c,_=a*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=f*u+_,t[5]=o*h,t[9]=d*u-g,t[2]=g*u-d,t[6]=a*h,t[10]=_*u+f}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(__,e,v_)}lookAt(e,t,n){const i=this.elements;return yn.subVectors(e,t),yn.lengthSq()===0&&(yn.z=1),yn.normalize(),Ti.crossVectors(n,yn),Ti.lengthSq()===0&&(Math.abs(n.z)===1?yn.x+=1e-4:yn.z+=1e-4,yn.normalize(),Ti.crossVectors(n,yn)),Ti.normalize(),Ya.crossVectors(yn,Ti),i[0]=Ti.x,i[4]=Ya.x,i[8]=yn.x,i[1]=Ti.y,i[5]=Ya.y,i[9]=yn.y,i[2]=Ti.z,i[6]=Ya.z,i[10]=yn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[4],c=n[8],l=n[12],h=n[1],u=n[5],f=n[9],d=n[13],g=n[2],_=n[6],m=n[10],p=n[14],v=n[3],y=n[7],x=n[11],A=n[15],E=i[0],I=i[4],D=i[8],b=i[12],C=i[1],B=i[5],R=i[9],O=i[13],M=i[2],z=i[6],X=i[10],H=i[14],re=i[3],$=i[7],le=i[11],W=i[15];return s[0]=o*E+a*C+c*M+l*re,s[4]=o*I+a*B+c*z+l*$,s[8]=o*D+a*R+c*X+l*le,s[12]=o*b+a*O+c*H+l*W,s[1]=h*E+u*C+f*M+d*re,s[5]=h*I+u*B+f*z+d*$,s[9]=h*D+u*R+f*X+d*le,s[13]=h*b+u*O+f*H+d*W,s[2]=g*E+_*C+m*M+p*re,s[6]=g*I+_*B+m*z+p*$,s[10]=g*D+_*R+m*X+p*le,s[14]=g*b+_*O+m*H+p*W,s[3]=v*E+y*C+x*M+A*re,s[7]=v*I+y*B+x*z+A*$,s[11]=v*D+y*R+x*X+A*le,s[15]=v*b+y*O+x*H+A*W,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],o=e[1],a=e[5],c=e[9],l=e[13],h=e[2],u=e[6],f=e[10],d=e[14],g=e[3],_=e[7],m=e[11],p=e[15],v=c*d-l*f,y=a*d-l*u,x=a*f-c*u,A=o*d-l*h,E=o*f-c*h,I=o*u-a*h;return t*(_*v-m*y+p*x)-n*(g*v-m*A+p*E)+i*(g*y-_*A+p*I)-s*(g*x-_*E+m*I)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=e[9],f=e[10],d=e[11],g=e[12],_=e[13],m=e[14],p=e[15],v=u*m*l-_*f*l+_*c*d-a*m*d-u*c*p+a*f*p,y=g*f*l-h*m*l-g*c*d+o*m*d+h*c*p-o*f*p,x=h*_*l-g*u*l+g*a*d-o*_*d-h*a*p+o*u*p,A=g*u*c-h*_*c-g*a*f+o*_*f+h*a*m-o*u*m,E=t*v+n*y+i*x+s*A;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const I=1/E;return e[0]=v*I,e[1]=(_*f*s-u*m*s-_*i*d+n*m*d+u*i*p-n*f*p)*I,e[2]=(a*m*s-_*c*s+_*i*l-n*m*l-a*i*p+n*c*p)*I,e[3]=(u*c*s-a*f*s-u*i*l+n*f*l+a*i*d-n*c*d)*I,e[4]=y*I,e[5]=(h*m*s-g*f*s+g*i*d-t*m*d-h*i*p+t*f*p)*I,e[6]=(g*c*s-o*m*s-g*i*l+t*m*l+o*i*p-t*c*p)*I,e[7]=(o*f*s-h*c*s+h*i*l-t*f*l-o*i*d+t*c*d)*I,e[8]=x*I,e[9]=(g*u*s-h*_*s-g*n*d+t*_*d+h*n*p-t*u*p)*I,e[10]=(o*_*s-g*a*s+g*n*l-t*_*l-o*n*p+t*a*p)*I,e[11]=(h*a*s-o*u*s-h*n*l+t*u*l+o*n*d-t*a*d)*I,e[12]=A*I,e[13]=(h*_*i-g*u*i+g*n*f-t*_*f-h*n*m+t*u*m)*I,e[14]=(g*a*i-o*_*i-g*n*c+t*_*c+o*n*m-t*a*m)*I,e[15]=(o*u*i-h*a*i+h*n*c-t*u*c-o*n*f+t*a*f)*I,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,a=e.y,c=e.z,l=s*o,h=s*a;return this.set(l*o+n,l*a-i*c,l*c+i*a,0,l*a+i*c,h*a+n,h*c-i*o,0,l*c-i*a,h*c+i*o,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,c=t._w,l=s+s,h=o+o,u=a+a,f=s*l,d=s*h,g=s*u,_=o*h,m=o*u,p=a*u,v=c*l,y=c*h,x=c*u,A=n.x,E=n.y,I=n.z;return i[0]=(1-(_+p))*A,i[1]=(d+x)*A,i[2]=(g-y)*A,i[3]=0,i[4]=(d-x)*E,i[5]=(1-(f+p))*E,i[6]=(m+v)*E,i[7]=0,i[8]=(g+y)*I,i[9]=(m-v)*I,i[10]=(1-(f+_))*I,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let s=jr.set(i[0],i[1],i[2]).length();const o=jr.set(i[4],i[5],i[6]).length(),a=jr.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),Bn.copy(this);const l=1/s,h=1/o,u=1/a;return Bn.elements[0]*=l,Bn.elements[1]*=l,Bn.elements[2]*=l,Bn.elements[4]*=h,Bn.elements[5]*=h,Bn.elements[6]*=h,Bn.elements[8]*=u,Bn.elements[9]*=u,Bn.elements[10]*=u,t.setFromRotationMatrix(Bn),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o,a=gn,c=!1){const l=this.elements,h=2*s/(t-e),u=2*s/(n-i),f=(t+e)/(t-e),d=(n+i)/(n-i);let g,_;if(c)g=s/(o-s),_=o*s/(o-s);else if(a===gn)g=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===Vr)g=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=h,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,o,a=gn,c=!1){const l=this.elements,h=2/(t-e),u=2/(n-i),f=-(t+e)/(t-e),d=-(n+i)/(n-i);let g,_;if(c)g=1/(o-s),_=o/(o-s);else if(a===gn)g=-2/(o-s),_=-(o+s)/(o-s);else if(a===Vr)g=-1/(o-s),_=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=h,l[4]=0,l[8]=0,l[12]=f,l[1]=0,l[5]=u,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=g,l[14]=_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const jr=new U,Bn=new We,__=new U(0,0,0),v_=new U(1,1,1),Ti=new U,Ya=new U,yn=new U,ud=new We,fd=new wt;class Zt{constructor(e=0,t=0,n=0,i=Zt.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],c=i[1],l=i[5],h=i[9],u=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Qe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Qe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Qe(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Qe(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Qe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Qe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:Te("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ud.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ud,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fd.setFromEuler(this),this.setFromQuaternion(fd,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}}Zt.DEFAULT_ORDER="XYZ";class Qa{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 y_=0;const dd=new U,Jr=new wt,ci=new We,Ka=new U,Qs=new U,x_=new U,A_=new wt,pd=new U(1,0,0),md=new U(0,1,0),gd=new U(0,0,1),_d={type:"added"},b_={type:"removed"},$r={type:"childadded",child:null},ph={type:"childremoved",child:null};class ct extends Qn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:y_++}),this.uuid=_n(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ct.DEFAULT_UP.clone();const e=new U,t=new Zt,n=new wt,i=new U(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new We},normalMatrix:{value:new et}}),this.matrix=new We,this.matrixWorld=new We,this.matrixAutoUpdate=ct.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Qa,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Jr.setFromAxisAngle(e,t),this.quaternion.multiply(Jr),this}rotateOnWorldAxis(e,t){return Jr.setFromAxisAngle(e,t),this.quaternion.premultiply(Jr),this}rotateX(e){return this.rotateOnAxis(pd,e)}rotateY(e){return this.rotateOnAxis(md,e)}rotateZ(e){return this.rotateOnAxis(gd,e)}translateOnAxis(e,t){return dd.copy(e).applyQuaternion(this.quaternion),this.position.add(dd.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(pd,e)}translateY(e){return this.translateOnAxis(md,e)}translateZ(e){return this.translateOnAxis(gd,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ci.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ka.copy(e):Ka.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Qs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ci.lookAt(Qs,Ka,this.up):ci.lookAt(Ka,Qs,this.up),this.quaternion.setFromRotationMatrix(ci),i&&(ci.extractRotation(i.matrixWorld),Jr.setFromRotationMatrix(ci),this.quaternion.premultiply(Jr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("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(_d),$r.child=e,this.dispatchEvent($r),$r.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(b_),ph.child=e,this.dispatchEvent(ph),ph.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),ci.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ci.multiply(e.parent.matrixWorld)),e.applyMatrix4(ci),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(_d),$r.child=e,this.dispatchEvent($r),$r.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Qs,e,x_),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Qs,A_,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const u=c[l];s(e.shapes,u)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(s(e.materials,this.material[c]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const c=this.animations[a];i.animations.push(s(e.animations,c))}}if(t){const a=o(e.geometries),c=o(e.materials),l=o(e.textures),h=o(e.images),u=o(e.shapes),f=o(e.skeletons),d=o(e.animations),g=o(e.nodes);a.length>0&&(n.geometries=a),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),g.length>0&&(n.nodes=g)}return n.object=i,n;function o(a){const c=[];for(const l in a){const h=a[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}ct.DEFAULT_UP=new U(0,1,0),ct.DEFAULT_MATRIX_AUTO_UPDATE=!0,ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const On=new U,li=new U,mh=new U,hi=new U,es=new U,ts=new U,vd=new U,gh=new U,_h=new U,vh=new U,yh=new gt,xh=new gt,Ah=new gt;class hn{constructor(e=new U,t=new U,n=new U){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),On.subVectors(e,t),i.cross(On);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){On.subVectors(i,t),li.subVectors(n,t),mh.subVectors(e,t);const o=On.dot(On),a=On.dot(li),c=On.dot(mh),l=li.dot(li),h=li.dot(mh),u=o*l-a*a;if(u===0)return s.set(0,0,0),null;const f=1/u,d=(l*c-a*h)*f,g=(o*h-a*c)*f;return s.set(1-d-g,g,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,hi)===null?!1:hi.x>=0&&hi.y>=0&&hi.x+hi.y<=1}static getInterpolation(e,t,n,i,s,o,a,c){return this.getBarycoord(e,t,n,i,hi)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,hi.x),c.addScaledVector(o,hi.y),c.addScaledVector(a,hi.z),c)}static getInterpolatedAttribute(e,t,n,i,s,o){return yh.setScalar(0),xh.setScalar(0),Ah.setScalar(0),yh.fromBufferAttribute(e,t),xh.fromBufferAttribute(e,n),Ah.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(yh,s.x),o.addScaledVector(xh,s.y),o.addScaledVector(Ah,s.z),o}static isFrontFacing(e,t,n,i){return On.subVectors(n,t),li.subVectors(e,t),On.cross(li).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return On.subVectors(this.c,this.b),li.subVectors(this.a,this.b),On.cross(li).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return hn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return hn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return hn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return hn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return hn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,a;es.subVectors(i,n),ts.subVectors(s,n),gh.subVectors(e,n);const c=es.dot(gh),l=ts.dot(gh);if(c<=0&&l<=0)return t.copy(n);_h.subVectors(e,i);const h=es.dot(_h),u=ts.dot(_h);if(h>=0&&u<=h)return t.copy(i);const f=c*u-h*l;if(f<=0&&c>=0&&h<=0)return o=c/(c-h),t.copy(n).addScaledVector(es,o);vh.subVectors(e,s);const d=es.dot(vh),g=ts.dot(vh);if(g>=0&&d<=g)return t.copy(s);const _=d*l-c*g;if(_<=0&&l>=0&&g<=0)return a=l/(l-g),t.copy(n).addScaledVector(ts,a);const m=h*g-d*u;if(m<=0&&u-h>=0&&d-g>=0)return vd.subVectors(s,i),a=(u-h)/(u-h+(d-g)),t.copy(i).addScaledVector(vd,a);const p=1/(m+_+f);return o=_*p,a=f*p,t.copy(n).addScaledVector(es,o).addScaledVector(ts,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const yd={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},Ci={h:0,s:0,l:0},ja={h:0,s:0,l:0};function bh(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Tt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,rt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=rt.workingColorSpace){return this.r=e,this.g=t,this.b=n,rt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=rt.workingColorSpace){if(e=ih(e,1),t=Qe(t,0,1),n=Qe(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=bh(o,s,e+1/3),this.g=bh(o,s,e),this.b=bh(o,s,e-1/3)}return rt.colorSpaceToWorking(this,i),this}setStyle(e,t=Tt){function n(s){s!==void 0&&parseFloat(s)<1&&Te("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Te("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[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);Te("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Tt){const n=yd[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Te("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=si(e.r),this.g=si(e.g),this.b=si(e.b),this}copyLinearToSRGB(e){return this.r=qr(e.r),this.g=qr(e.g),this.b=qr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Tt){return rt.workingToColorSpace(Kt.copy(this),e),Math.round(Qe(Kt.r*255,0,255))*65536+Math.round(Qe(Kt.g*255,0,255))*256+Math.round(Qe(Kt.b*255,0,255))}getHexString(e=Tt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=rt.workingColorSpace){rt.workingToColorSpace(Kt.copy(this),t);const n=Kt.r,i=Kt.g,s=Kt.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let c,l;const h=(a+o)/2;if(a===o)c=0,l=0;else{const u=o-a;switch(l=h<=.5?u/(o+a):u/(2-o-a),o){case n:c=(i-s)/u+(i<s?6:0);break;case i:c=(s-n)/u+2;break;case s:c=(n-i)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=rt.workingColorSpace){return rt.workingToColorSpace(Kt.copy(this),t),e.r=Kt.r,e.g=Kt.g,e.b=Kt.b,e}getStyle(e=Tt){rt.workingToColorSpace(Kt.copy(this),e);const t=Kt.r,n=Kt.g,i=Kt.b;return e!==Tt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Ci),this.setHSL(Ci.h+e,Ci.s+t,Ci.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ci),e.getHSL(ja);const n=Xs(Ci.h,ja.h,t),i=Xs(Ci.s,ja.s,t),s=Xs(Ci.l,ja.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Kt=new xe;xe.NAMES=yd;let w_=0;class zt extends Qn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:w_++}),this.uuid=_n(),this.name="",this.type="Material",this.blending=ki,this.side=Wn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zo,this.blendDst=ko,this.blendEquation=_i,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new xe(0,0,0),this.blendAlpha=0,this.depthFunc=Vi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=th,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Xi,this.stencilZFail=Xi,this.stencilZPass=Xi,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Te(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Te(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ki&&(n.blending=this.blending),this.side!==Wn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==zo&&(n.blendSrc=this.blendSrc),this.blendDst!==ko&&(n.blendDst=this.blendDst),this.blendEquation!==_i&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Vi&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==th&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Xi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Xi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Xi&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const c=s[a];delete c.metadata,o.push(c)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class un extends zt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new xe(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 Zt,this.combine=Ns,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 ui=S_();function S_(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let c=0;c<256;++c){const l=c-127;l<-27?(n[c]=0,n[c|256]=32768,i[c]=24,i[c|256]=24):l<-14?(n[c]=1024>>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,h=0;for(;(l&8388608)===0;)l<<=1,h-=8388608;l&=-8388609,h+=947912704,s[c]=l|h}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(a[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function fn(r){Math.abs(r)>65504&&Te("DataUtils.toHalfFloat(): Value out of range."),r=Qe(r,-65504,65504),ui.floatView[0]=r;const e=ui.uint32View[0],t=e>>23&511;return ui.baseTable[t]+((e&8388607)>>ui.shiftTable[t])}function Ks(r){const e=r>>10;return ui.uint32View[0]=ui.mantissaTable[ui.offsetTable[e]+(r&1023)]+ui.exponentTable[e],ui.floatView[0]}class M_{static toHalfFloat(e){return fn(e)}static fromHalfFloat(e){return Ks(e)}}const Bt=new U,Ja=new he;let E_=0;class ot{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:E_++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=kr,this.updateRanges=[],this.gpuType=nn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Ja.fromBufferAttribute(this,t),Ja.applyMatrix3(e),this.setXY(t,Ja.x,Ja.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyMatrix3(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyMatrix4(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyNormalMatrix(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.transformDirection(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=sn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=tt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=sn(t,this.array)),t}setX(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=sn(t,this.array)),t}setY(e,t){return this.normalized&&(t=tt(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=sn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=tt(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=sn(t,this.array)),t}setW(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array),s=tt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,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!==kr&&(e.usage=this.usage),e}}class T_ extends ot{constructor(e,t,n){super(new Int8Array(e),t,n)}}class C_ extends ot{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class I_ extends ot{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class R_ extends ot{constructor(e,t,n){super(new Int16Array(e),t,n)}}class wh extends ot{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class P_ extends ot{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Sh extends ot{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class D_ extends ot{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Ks(this.array[e*this.itemSize]);return this.normalized&&(t=sn(t,this.array)),t}setX(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize]=fn(t),this}getY(e){let t=Ks(this.array[e*this.itemSize+1]);return this.normalized&&(t=sn(t,this.array)),t}setY(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize+1]=fn(t),this}getZ(e){let t=Ks(this.array[e*this.itemSize+2]);return this.normalized&&(t=sn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize+2]=fn(t),this}getW(e){let t=Ks(this.array[e*this.itemSize+3]);return this.normalized&&(t=sn(t,this.array)),t}setW(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize+3]=fn(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array)),this.array[e+0]=fn(t),this.array[e+1]=fn(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array)),this.array[e+0]=fn(t),this.array[e+1]=fn(n),this.array[e+2]=fn(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array),s=tt(s,this.array)),this.array[e+0]=fn(t),this.array[e+1]=fn(n),this.array[e+2]=fn(i),this.array[e+3]=fn(s),this}}class Be extends ot{constructor(e,t,n){super(new Float32Array(e),t,n)}}let L_=0;const Tn=new We,Mh=new ct,ns=new U,xn=new Gt,js=new Gt,Wt=new U;class Ke extends Qn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:L_++}),this.uuid=_n(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(nd(e)?Sh:wh)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new et().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Tn.makeRotationFromQuaternion(e),this.applyMatrix4(Tn),this}rotateX(e){return Tn.makeRotationX(e),this.applyMatrix4(Tn),this}rotateY(e){return Tn.makeRotationY(e),this.applyMatrix4(Tn),this}rotateZ(e){return Tn.makeRotationZ(e),this.applyMatrix4(Tn),this}translate(e,t,n){return Tn.makeTranslation(e,t,n),this.applyMatrix4(Tn),this}scale(e,t,n){return Tn.makeScale(e,t,n),this.applyMatrix4(Tn),this}lookAt(e){return Mh.lookAt(e),Mh.updateMatrix(),this.applyMatrix4(Mh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ns).negate(),this.translate(ns.x,ns.y,ns.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const o=e[i];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Be(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&Te("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 Gt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];xn.setFromBufferAttribute(s),this.morphTargetsRelative?(Wt.addVectors(this.boundingBox.min,xn.min),this.boundingBox.expandByPoint(Wt),Wt.addVectors(this.boundingBox.max,xn.max),this.boundingBox.expandByPoint(Wt)):(this.boundingBox.expandByPoint(xn.min),this.boundingBox.expandByPoint(xn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('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 Pt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new U,1/0);return}if(e){const n=this.boundingSphere.center;if(xn.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];js.setFromBufferAttribute(a),this.morphTargetsRelative?(Wt.addVectors(xn.min,js.min),xn.expandByPoint(Wt),Wt.addVectors(xn.max,js.max),xn.expandByPoint(Wt)):(xn.expandByPoint(js.min),xn.expandByPoint(js.max))}xn.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)Wt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Wt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],c=this.morphTargetsRelative;for(let l=0,h=a.count;l<h;l++)Wt.fromBufferAttribute(a,l),c&&(ns.fromBufferAttribute(e,l),Wt.add(ns)),i=Math.max(i,n.distanceToSquared(Wt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Ge('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){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ot(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),a=[],c=[];for(let D=0;D<n.count;D++)a[D]=new U,c[D]=new U;const l=new U,h=new U,u=new U,f=new he,d=new he,g=new he,_=new U,m=new U;function p(D,b,C){l.fromBufferAttribute(n,D),h.fromBufferAttribute(n,b),u.fromBufferAttribute(n,C),f.fromBufferAttribute(s,D),d.fromBufferAttribute(s,b),g.fromBufferAttribute(s,C),h.sub(l),u.sub(l),d.sub(f),g.sub(f);const B=1/(d.x*g.y-g.x*d.y);!isFinite(B)||(_.copy(h).multiplyScalar(g.y).addScaledVector(u,-d.y).multiplyScalar(B),m.copy(u).multiplyScalar(d.x).addScaledVector(h,-g.x).multiplyScalar(B),a[D].add(_),a[b].add(_),a[C].add(_),c[D].add(m),c[b].add(m),c[C].add(m))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let D=0,b=v.length;D<b;++D){const C=v[D],B=C.start,R=C.count;for(let O=B,M=B+R;O<M;O+=3)p(e.getX(O+0),e.getX(O+1),e.getX(O+2))}const y=new U,x=new U,A=new U,E=new U;function I(D){A.fromBufferAttribute(i,D),E.copy(A);const b=a[D];y.copy(b),y.sub(A.multiplyScalar(A.dot(b))).normalize(),x.crossVectors(E,b);const B=x.dot(c[D])<0?-1:1;o.setXYZW(D,y.x,y.y,y.z,B)}for(let D=0,b=v.length;D<b;++D){const C=v[D],B=C.start,R=C.count;for(let O=B,M=B+R;O<M;O+=3)I(e.getX(O+0)),I(e.getX(O+1)),I(e.getX(O+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ot(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const i=new U,s=new U,o=new U,a=new U,c=new U,l=new U,h=new U,u=new U;if(e)for(let f=0,d=e.count;f<d;f+=3){const g=e.getX(f+0),_=e.getX(f+1),m=e.getX(f+2);i.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),o.fromBufferAttribute(t,m),h.subVectors(o,s),u.subVectors(i,s),h.cross(u),a.fromBufferAttribute(n,g),c.fromBufferAttribute(n,_),l.fromBufferAttribute(n,m),a.add(h),c.add(h),l.add(h),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(_,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),h.subVectors(o,s),u.subVectors(i,s),h.cross(u),n.setXYZ(f+0,h.x,h.y,h.z),n.setXYZ(f+1,h.x,h.y,h.z),n.setXYZ(f+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Wt.fromBufferAttribute(e,t),Wt.normalize(),e.setXYZ(t,Wt.x,Wt.y,Wt.z)}toNonIndexed(){function e(a,c){const l=a.array,h=a.itemSize,u=a.normalized,f=new l.constructor(c.length*h);let d=0,g=0;for(let _=0,m=c.length;_<m;_++){a.isInterleavedBufferAttribute?d=c[_]*a.data.stride+a.offset:d=c[_]*h;for(let p=0;p<h;p++)f[g++]=l[d++]}return new ot(f,h,u)}if(this.index===null)return Te("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ke,n=this.index.array,i=this.attributes;for(const a in i){const c=i[a],l=e(c,n);t.setAttribute(a,l)}const s=this.morphAttributes;for(const a in s){const c=[],l=s[a];for(let h=0,u=l.length;h<u;h++){const f=l[h],d=e(f,n);c.push(d)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,c=o.length;a<c;a++){const l=o[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let u=0,f=l.length;u<f;u++){const d=l[u];h.push(d.toJSON(e.data))}h.length>0&&(i[c]=h,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const l in i){const h=i[l];this.setAttribute(l,h.clone(t))}const s=e.morphAttributes;for(const l in s){const h=[],u=s[l];for(let f=0,d=u.length;f<d;f++)h.push(u[f].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let l=0,h=o.length;l<h;l++){const u=o[l];this.addGroup(u.start,u.count,u.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const xd=new We,Ki=new Kr,$a=new Pt,Ad=new U,ec=new U,tc=new U,nc=new U,Eh=new U,ic=new U,bd=new U,rc=new U;class St extends ct{constructor(e=new Ke,t=new un){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){ic.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const h=a[c],u=s[c];h!==0&&(Eh.fromBufferAttribute(u,e),o?ic.addScaledVector(Eh,h):ic.addScaledVector(Eh.sub(t),h))}t.add(ic)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),$a.copy(n.boundingSphere),$a.applyMatrix4(s),Ki.copy(e.ray).recast(e.near),!($a.containsPoint(Ki.origin)===!1&&(Ki.intersectSphere($a,Ad)===null||Ki.origin.distanceToSquared(Ad)>(e.far-e.near)**2))&&(xd.copy(s).invert(),Ki.copy(e.ray).applyMatrix4(xd),!(n.boundingBox!==null&&Ki.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ki)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,a=s.index,c=s.attributes.position,l=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,f=s.groups,d=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=f.length;g<_;g++){const m=f[g],p=o[m.materialIndex],v=Math.max(m.start,d.start),y=Math.min(a.count,Math.min(m.start+m.count,d.start+d.count));for(let x=v,A=y;x<A;x+=3){const E=a.getX(x),I=a.getX(x+1),D=a.getX(x+2);i=sc(this,p,e,n,l,h,u,E,I,D),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),_=Math.min(a.count,d.start+d.count);for(let m=g,p=_;m<p;m+=3){const v=a.getX(m),y=a.getX(m+1),x=a.getX(m+2);i=sc(this,o,e,n,l,h,u,v,y,x),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(o))for(let g=0,_=f.length;g<_;g++){const m=f[g],p=o[m.materialIndex],v=Math.max(m.start,d.start),y=Math.min(c.count,Math.min(m.start+m.count,d.start+d.count));for(let x=v,A=y;x<A;x+=3){const E=x,I=x+1,D=x+2;i=sc(this,p,e,n,l,h,u,E,I,D),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),_=Math.min(c.count,d.start+d.count);for(let m=g,p=_;m<p;m+=3){const v=m,y=m+1,x=m+2;i=sc(this,o,e,n,l,h,u,v,y,x),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}}function N_(r,e,t,n,i,s,o,a){let c;if(e.side===en?c=n.intersectTriangle(o,s,i,!0,a):c=n.intersectTriangle(i,s,o,e.side===Wn,a),c===null)return null;rc.copy(a),rc.applyMatrix4(r.matrixWorld);const l=t.ray.origin.distanceTo(rc);return l<t.near||l>t.far?null:{distance:l,point:rc.clone(),object:r}}function sc(r,e,t,n,i,s,o,a,c,l){r.getVertexPosition(a,ec),r.getVertexPosition(c,tc),r.getVertexPosition(l,nc);const h=N_(r,e,t,n,ec,tc,nc,bd);if(h){const u=new U;hn.getBarycoord(bd,ec,tc,nc,u),i&&(h.uv=hn.getInterpolatedAttribute(i,a,c,l,u,new he)),s&&(h.uv1=hn.getInterpolatedAttribute(s,a,c,l,u,new he)),o&&(h.normal=hn.getInterpolatedAttribute(o,a,c,l,u,new U),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const f={a,b:c,c:l,normal:new U,materialIndex:0};hn.getNormal(ec,tc,nc,f.normal),h.face=f,h.barycoord=u}return h}class ji extends Ke{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const c=[],l=[],h=[],u=[];let f=0,d=0;g("z","y","x",-1,-1,n,t,e,o,s,0),g("z","y","x",1,-1,n,t,-e,o,s,1),g("x","z","y",1,1,e,n,t,i,o,2),g("x","z","y",1,-1,e,n,-t,i,o,3),g("x","y","z",1,-1,e,t,n,i,s,4),g("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(c),this.setAttribute("position",new Be(l,3)),this.setAttribute("normal",new Be(h,3)),this.setAttribute("uv",new Be(u,2));function g(_,m,p,v,y,x,A,E,I,D,b){const C=x/I,B=A/D,R=x/2,O=A/2,M=E/2,z=I+1,X=D+1;let H=0,re=0;const $=new U;for(let le=0;le<X;le++){const W=le*B-O;for(let Z=0;Z<z;Z++){const ge=Z*C-R;$[_]=ge*v,$[m]=W*y,$[p]=M,l.push($.x,$.y,$.z),$[_]=0,$[m]=0,$[p]=E>0?1:-1,h.push($.x,$.y,$.z),u.push(Z/I),u.push(1-le/D),H+=1}}for(let le=0;le<D;le++)for(let W=0;W<I;W++){const Z=f+W+z*le,ge=f+W+z*(le+1),_e=f+(W+1)+z*(le+1),de=f+(W+1)+z*le;c.push(Z,ge,de),c.push(ge,_e,de),re+=6}a.addGroup(d,re,b),d+=re,f+=H}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ji(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function is(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(Te("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function on(r){const e={};for(let t=0;t<r.length;t++){const n=is(r[t]);for(const i in n)e[i]=n[i]}return e}function U_(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function wd(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:rt.workingColorSpace}const Sd={clone:is,merge:on};var B_=`void main() {
5
+ */const Yt="182",zi={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},s0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},xf=0,Bl=1,Af=2,o0=3,a0=0,Ls=1,bf=2,Dr=3,Wn=0,en=1,Sn=2,qn=0,ki=1,Ol=2,Fl=3,zl=4,wf=5,_i=100,Sf=101,Mf=102,Ef=103,Tf=104,Cf=200,If=201,Rf=202,Pf=203,zo=204,ko=205,Df=206,Lf=207,Nf=208,Uf=209,Bf=210,Of=211,Ff=212,zf=213,kf=214,Vo=0,Ho=1,Go=2,Vi=3,Wo=4,qo=5,Xo=6,Zo=7,Ns=0,Vf=1,Hf=2,Nn=0,kl=1,Vl=2,Hl=3,Yo=4,Gl=5,Wl=6,ql=7,Xl="attached",Gf="detached",Qo=300,Xn=301,vi=302,Us=303,Bs=304,Lr=306,yi=1e3,tn=1001,Nr=1002,Mt=1003,Ko=1004,c0=1004,Hi=1005,l0=1005,pt=1006,Ur=1007,h0=1007,Mn=1008,u0=1008,ln=1009,Zl=1010,Yl=1011,Br=1012,jo=1013,En=1014,nn=1015,Zn=1016,Jo=1017,$o=1018,Or=1020,Ql=35902,Kl=35899,jl=1021,Jl=1022,rn=1023,Yn=1026,xi=1027,ea=1028,Os=1029,Gi=1030,ta=1031,f0=1032,na=1033,Fs=33776,zs=33777,ks=33778,Vs=33779,ia=35840,ra=35841,sa=35842,oa=35843,aa=36196,ca=37492,la=37496,ha=37488,ua=37489,fa=37490,da=37491,pa=37808,ma=37809,ga=37810,_a=37811,va=37812,ya=37813,xa=37814,Aa=37815,ba=37816,wa=37817,Sa=37818,Ma=37819,Ea=37820,Ta=37821,Ca=36492,Ia=36494,Ra=36495,Pa=36283,Da=36284,La=36285,Na=36286,Wf=2200,qf=2201,Xf=2202,Fr=2300,zr=2301,Ua=2302,Wi=2400,qi=2401,Hs=2402,Ba=2500,$l=2501,Zf=0,eh=1,Oa=2,Yf=3200,d0=3201,p0=3202,m0=3203,Ai=0,Qf=1,ri="",Tt="srgb",Xt="srgb-linear",Gs="linear",ut="srgb",g0="",_0="rg",v0="ga",y0=0,Xi=7680,x0=7681,A0=7682,b0=7683,w0=34055,S0=34056,M0=5386,E0=512,T0=513,C0=514,I0=515,R0=516,P0=517,D0=518,th=519,Kf=512,jf=513,Jf=514,Fa=515,$f=516,ed=517,za=518,td=519,kr=35044,L0=35048,N0=35040,U0=35045,B0=35049,O0=35041,F0=35046,z0=35050,k0=35042,V0="100",nh="300 es",gn=2e3,Vr=2001,H0={COMPUTE:"compute",RENDER:"render"},G0={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},W0={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function nd(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const q0={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Hr(r,e){return new q0[r](e)}function id(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Ws(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function rd(){const r=Ws("canvas");return r.style.display="block",r}const sd={};let bi=null;function X0(r){bi=r}function Z0(){return bi}function qs(...r){const e="THREE."+r.shift();bi?bi("log",e,...r):console.log(e,...r)}function Te(...r){const e="THREE."+r.shift();bi?bi("warn",e,...r):console.warn(e,...r)}function Ge(...r){const e="THREE."+r.shift();bi?bi("error",e,...r):console.error(e,...r)}function Gr(...r){const e=r.join(" ");e in sd||(sd[e]=!0,Te(...r))}function Y0(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}class Qn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const Qt=["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 od=1234567;const Zi=Math.PI/180,Wr=180/Math.PI;function _n(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Qt[r&255]+Qt[r>>8&255]+Qt[r>>16&255]+Qt[r>>24&255]+"-"+Qt[e&255]+Qt[e>>8&255]+"-"+Qt[e>>16&15|64]+Qt[e>>24&255]+"-"+Qt[t&63|128]+Qt[t>>8&255]+"-"+Qt[t>>16&255]+Qt[t>>24&255]+Qt[n&255]+Qt[n>>8&255]+Qt[n>>16&255]+Qt[n>>24&255]).toLowerCase()}function Qe(r,e,t){return Math.max(e,Math.min(t,r))}function ih(r,e){return(r%e+e)%e}function Q0(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function K0(r,e,t){return r!==e?(t-r)/(e-r):0}function Xs(r,e,t){return(1-t)*r+t*e}function j0(r,e,t,n){return Xs(r,e,1-Math.exp(-t*n))}function J0(r,e=1){return e-Math.abs(ih(r,e*2)-e)}function $0(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function e_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function t_(r,e){return r+Math.floor(Math.random()*(e-r+1))}function n_(r,e){return r+Math.random()*(e-r)}function i_(r){return r*(.5-Math.random())}function r_(r){r!==void 0&&(od=r);let e=od+=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 s_(r){return r*Zi}function o_(r){return r*Wr}function a_(r){return(r&r-1)===0&&r!==0}function c_(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function l_(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function h_(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),c=o(t/2),l=s((e+n)/2),h=o((e+n)/2),u=s((e-n)/2),f=o((e-n)/2),d=s((n-e)/2),g=o((n-e)/2);switch(i){case"XYX":r.set(a*h,c*u,c*f,a*l);break;case"YZY":r.set(c*f,a*h,c*u,a*l);break;case"ZXZ":r.set(c*u,c*f,a*h,a*l);break;case"XZX":r.set(a*h,c*g,c*d,a*l);break;case"YXY":r.set(c*d,a*h,c*g,a*l);break;case"ZYZ":r.set(c*g,c*d,a*h,a*l);break;default:Te("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function sn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function tt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const ka={DEG2RAD:Zi,RAD2DEG:Wr,generateUUID:_n,clamp:Qe,euclideanModulo:ih,mapLinear:Q0,inverseLerp:K0,lerp:Xs,damp:j0,pingpong:J0,smoothstep:$0,smootherstep:e_,randInt:t_,randFloat:n_,randFloatSpread:i_,seededRandom:r_,degToRad:s_,radToDeg:o_,isPowerOfTwo:a_,ceilPowerOfTwo:c_,floorPowerOfTwo:l_,setQuaternionFromProperEuler:h_,normalize:tt,denormalize:sn};class he{constructor(e=0,t=0){he.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Qe(this.x,e.x,t.x),this.y=Qe(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Qe(this.x,e,t),this.y=Qe(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Qe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Qe(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class wt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,o,a){let c=n[i+0],l=n[i+1],h=n[i+2],u=n[i+3],f=s[o+0],d=s[o+1],g=s[o+2],_=s[o+3];if(a<=0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(a>=1){e[t+0]=f,e[t+1]=d,e[t+2]=g,e[t+3]=_;return}if(u!==_||c!==f||l!==d||h!==g){let m=c*f+l*d+h*g+u*_;m<0&&(f=-f,d=-d,g=-g,_=-_,m=-m);let p=1-a;if(m<.9995){const v=Math.acos(m),y=Math.sin(v);p=Math.sin(p*v)/y,a=Math.sin(a*v)/y,c=c*p+f*a,l=l*p+d*a,h=h*p+g*a,u=u*p+_*a}else{c=c*p+f*a,l=l*p+d*a,h=h*p+g*a,u=u*p+_*a;const v=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=v,l*=v,h*=v,u*=v}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],c=n[i+1],l=n[i+2],h=n[i+3],u=s[o],f=s[o+1],d=s[o+2],g=s[o+3];return e[t]=a*g+h*u+c*d-l*f,e[t+1]=c*g+h*f+l*u-a*d,e[t+2]=l*g+h*d+a*f-c*u,e[t+3]=h*g-a*u-c*f-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(n/2),h=a(i/2),u=a(s/2),f=c(n/2),d=c(i/2),g=c(s/2);switch(o){case"XYZ":this._x=f*h*u+l*d*g,this._y=l*d*u-f*h*g,this._z=l*h*g+f*d*u,this._w=l*h*u-f*d*g;break;case"YXZ":this._x=f*h*u+l*d*g,this._y=l*d*u-f*h*g,this._z=l*h*g-f*d*u,this._w=l*h*u+f*d*g;break;case"ZXY":this._x=f*h*u-l*d*g,this._y=l*d*u+f*h*g,this._z=l*h*g+f*d*u,this._w=l*h*u-f*d*g;break;case"ZYX":this._x=f*h*u-l*d*g,this._y=l*d*u+f*h*g,this._z=l*h*g-f*d*u,this._w=l*h*u+f*d*g;break;case"YZX":this._x=f*h*u+l*d*g,this._y=l*d*u+f*h*g,this._z=l*h*g-f*d*u,this._w=l*h*u-f*d*g;break;case"XZY":this._x=f*h*u-l*d*g,this._y=l*d*u-f*h*g,this._z=l*h*g+f*d*u,this._w=l*h*u+f*d*g;break;default:Te("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],a=t[5],c=t[9],l=t[2],h=t[6],u=t[10],f=n+a+u;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-c)*d,this._y=(s-l)*d,this._z=(o-i)*d}else if(n>a&&n>u){const d=2*Math.sqrt(1+n-a-u);this._w=(h-c)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+l)/d}else if(a>u){const d=2*Math.sqrt(1+a-n-u);this._w=(s-l)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(c+h)/d}else{const d=2*Math.sqrt(1+u-n-a);this._w=(o-i)/d,this._x=(s+l)/d,this._y=(c+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Qe(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+o*a+i*l-s*c,this._y=i*h+o*c+s*a-n*l,this._z=s*h+o*l+n*c-i*a,this._w=o*h-n*a-i*c-s*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,i=-i,s=-s,o=-o,a=-a);let c=1-t;if(a<.9995){const l=Math.acos(a),h=Math.sin(l);c=Math.sin(c*l)/h,t=Math.sin(t*l)/h,this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+s*t,this._w=this._w*c+o*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+s*t,this._w=this._w*c+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class U{constructor(e=0,t=0,n=0){U.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(ad.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ad.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,c=e.w,l=2*(o*i-a*n),h=2*(a*t-s*i),u=2*(s*n-o*t);return this.x=t+c*l+o*u-a*h,this.y=n+c*h+a*l-s*u,this.z=i+c*u+s*h-o*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Qe(this.x,e.x,t.x),this.y=Qe(this.y,e.y,t.y),this.z=Qe(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Qe(this.x,e,t),this.y=Qe(this.y,e,t),this.z=Qe(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Qe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,c=t.z;return this.x=i*c-s*a,this.y=s*o-n*c,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return rh.copy(this).projectOnVector(e),this.sub(rh)}reflect(e){return this.sub(rh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Qe(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const rh=new U,ad=new wt;class et{constructor(e,t,n,i,s,o,a,c,l){et.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,c,l)}set(e,t,n,i,s,o,a,c,l){const h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=s,h[5]=c,h[6]=n,h[7]=o,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[3],c=n[6],l=n[1],h=n[4],u=n[7],f=n[2],d=n[5],g=n[8],_=i[0],m=i[3],p=i[6],v=i[1],y=i[4],x=i[7],A=i[2],E=i[5],I=i[8];return s[0]=o*_+a*v+c*A,s[3]=o*m+a*y+c*E,s[6]=o*p+a*x+c*I,s[1]=l*_+h*v+u*A,s[4]=l*m+h*y+u*E,s[7]=l*p+h*x+u*I,s[2]=f*_+d*v+g*A,s[5]=f*m+d*y+g*E,s[8]=f*p+d*x+g*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8];return t*o*h-t*a*l-n*s*h+n*a*c+i*s*l-i*o*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=h*o-a*l,f=a*c-h*s,d=l*s-o*c,g=t*u+n*f+i*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=u*_,e[1]=(i*l-h*n)*_,e[2]=(a*n-i*o)*_,e[3]=f*_,e[4]=(h*t-i*c)*_,e[5]=(i*s-a*t)*_,e[6]=d*_,e[7]=(n*c-l*t)*_,e[8]=(o*t-n*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,o,a){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*o+l*a)+o+e,-i*l,i*c,-i*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(sh.makeScale(e,t)),this}rotate(e){return this.premultiply(sh.makeRotation(-e)),this}translate(e,t){return this.premultiply(sh.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const sh=new et,cd=new et().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ld=new et().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function u_(){const r={enabled:!0,workingColorSpace:Xt,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===ut&&(i.r=si(i.r),i.g=si(i.g),i.b=si(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===ut&&(i.r=qr(i.r),i.g=qr(i.g),i.b=qr(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===ri?Gs:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Gr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Gr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Xt]:{primaries:e,whitePoint:n,transfer:Gs,toXYZ:cd,fromXYZ:ld,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Tt},outputColorSpaceConfig:{drawingBufferColorSpace:Tt}},[Tt]:{primaries:e,whitePoint:n,transfer:ut,toXYZ:cd,fromXYZ:ld,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Tt}}}),r}const rt=u_();function si(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function qr(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Xr;class hd{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Xr===void 0&&(Xr=Ws("canvas")),Xr.width=e.width,Xr.height=e.height;const i=Xr.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Xr}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Ws("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=si(s[o]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(si(t[n]/255)*255):t[n]=si(t[n]);return{data:t,width:e.width,height:e.height}}else return Te("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let f_=0;class wi{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:f_++}),this.uuid=_n(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(oh(i[o].image)):s.push(oh(i[o]))}else s=oh(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function oh(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?hd.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(Te("Texture: Unable to serialize Texture."),{})}let d_=0;const ah=new U;class xt extends Qn{constructor(e=xt.DEFAULT_IMAGE,t=xt.DEFAULT_MAPPING,n=tn,i=tn,s=pt,o=Mn,a=rn,c=ln,l=xt.DEFAULT_ANISOTROPY,h=ri){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:d_++}),this.uuid=_n(),this.name="",this.source=new wi(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new he(0,0),this.repeat=new he(1,1),this.center=new he(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.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(ah).x}get height(){return this.source.getSize(ah).y}get depth(){return this.source.getSize(ah).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Te(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Te(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Qo)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case yi:e.x=e.x-Math.floor(e.x);break;case tn:e.x=e.x<0?0:1;break;case Nr: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 yi:e.y=e.y-Math.floor(e.y);break;case tn:e.y=e.y<0?0:1;break;case Nr: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++}}xt.DEFAULT_IMAGE=null,xt.DEFAULT_MAPPING=Qo,xt.DEFAULT_ANISOTROPY=1;class gt{constructor(e=0,t=0,n=0,i=1){gt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const c=e.elements,l=c[0],h=c[4],u=c[8],f=c[1],d=c[5],g=c[9],_=c[2],m=c[6],p=c[10];if(Math.abs(h-f)<.01&&Math.abs(u-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+_)<.1&&Math.abs(g+m)<.1&&Math.abs(l+d+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(l+1)/2,x=(d+1)/2,A=(p+1)/2,E=(h+f)/4,I=(u+_)/4,D=(g+m)/4;return y>x&&y>A?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=E/n,s=I/n):x>A?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=E/i,s=D/i):A<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(A),n=I/s,i=D/s),this.set(n,i,s,t),this}let v=Math.sqrt((m-g)*(m-g)+(u-_)*(u-_)+(f-h)*(f-h));return Math.abs(v)<.001&&(v=1),this.x=(m-g)/v,this.y=(u-_)/v,this.z=(f-h)/v,this.w=Math.acos((l+d+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=Qe(this.x,e.x,t.x),this.y=Qe(this.y,e.y,t.y),this.z=Qe(this.z,e.z,t.z),this.w=Qe(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Qe(this.x,e,t),this.y=Qe(this.y,e,t),this.z=Qe(this.z,e,t),this.w=Qe(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Qe(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ch extends Qn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:pt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gt(0,0,e,t),this.scissorTest=!1,this.viewport=new gt(0,0,e,t);const i={width:e,height:t,depth:n.depth},s=new xt(i);this.textures=[];const o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:pt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new wi(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class vn extends ch{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Va extends xt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Mt,this.minFilter=Mt,this.wrapR=tn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class p_ extends vn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Va(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Ha extends xt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Mt,this.minFilter=Mt,this.wrapR=tn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class m_ extends vn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Ha(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Gt{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Un.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Un.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Un.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Un):Un.fromBufferAttribute(s,o),Un.applyMatrix4(e.matrixWorld),this.expandByPoint(Un);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ga.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Ga.copy(n.boundingBox)),Ga.applyMatrix4(e.matrixWorld),this.union(Ga)}const i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Un),Un.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Zs),Wa.subVectors(this.max,Zs),Zr.subVectors(e.a,Zs),Yr.subVectors(e.b,Zs),Qr.subVectors(e.c,Zs),Si.subVectors(Yr,Zr),Mi.subVectors(Qr,Yr),Yi.subVectors(Zr,Qr);let t=[0,-Si.z,Si.y,0,-Mi.z,Mi.y,0,-Yi.z,Yi.y,Si.z,0,-Si.x,Mi.z,0,-Mi.x,Yi.z,0,-Yi.x,-Si.y,Si.x,0,-Mi.y,Mi.x,0,-Yi.y,Yi.x,0];return!lh(t,Zr,Yr,Qr,Wa)||(t=[1,0,0,0,1,0,0,0,1],!lh(t,Zr,Yr,Qr,Wa))?!1:(qa.crossVectors(Si,Mi),t=[qa.x,qa.y,qa.z],lh(t,Zr,Yr,Qr,Wa))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Un).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Un).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:(oi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),oi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),oi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),oi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),oi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),oi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),oi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),oi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(oi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const oi=[new U,new U,new U,new U,new U,new U,new U,new U],Un=new U,Ga=new Gt,Zr=new U,Yr=new U,Qr=new U,Si=new U,Mi=new U,Yi=new U,Zs=new U,Wa=new U,qa=new U,Qi=new U;function lh(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Qi.fromArray(r,s);const a=i.x*Math.abs(Qi.x)+i.y*Math.abs(Qi.y)+i.z*Math.abs(Qi.z),c=e.dot(Qi),l=t.dot(Qi),h=n.dot(Qi);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>a)return!1}return!0}const g_=new Gt,Ys=new U,hh=new U;class Pt{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):g_.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ys.subVectors(e,this.center);const t=Ys.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ys,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(hh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ys.copy(e.center).add(hh)),this.expandByPoint(Ys.copy(e.center).sub(hh))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const ai=new U,uh=new U,Xa=new U,Ei=new U,fh=new U,Za=new U,dh=new U;class Kr{constructor(e=new U,t=new U(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,ai)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ai.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ai.copy(this.origin).addScaledVector(this.direction,t),ai.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){uh.copy(e).add(t).multiplyScalar(.5),Xa.copy(t).sub(e).normalize(),Ei.copy(this.origin).sub(uh);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Xa),a=Ei.dot(this.direction),c=-Ei.dot(Xa),l=Ei.lengthSq(),h=Math.abs(1-o*o);let u,f,d,g;if(h>0)if(u=o*c-a,f=o*a-c,g=s*h,u>=0)if(f>=-g)if(f<=g){const _=1/h;u*=_,f*=_,d=u*(u+o*f+2*a)+f*(o*u+f+2*c)+l}else f=s,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*c)+l;else f=-s,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*c)+l;else f<=-g?(u=Math.max(0,-(-o*s+a)),f=u>0?-s:Math.min(Math.max(-s,-c),s),d=-u*u+f*(f+2*c)+l):f<=g?(u=0,f=Math.min(Math.max(-s,-c),s),d=f*(f+2*c)+l):(u=Math.max(0,-(o*s+a)),f=u>0?s:Math.min(Math.max(-s,-c),s),d=-u*u+f*(f+2*c)+l);else f=o>0?-s:s,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(uh).addScaledVector(Xa,f),d}intersectSphere(e,t){ai.subVectors(e.center,this.origin);const n=ai.dot(this.direction),i=ai.dot(ai)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,c=n+o;return c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,a,c;const l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return l>=0?(n=(e.min.x-f.x)*l,i=(e.max.x-f.x)*l):(n=(e.max.x-f.x)*l,i=(e.min.x-f.x)*l),h>=0?(s=(e.min.y-f.y)*h,o=(e.max.y-f.y)*h):(s=(e.max.y-f.y)*h,o=(e.min.y-f.y)*h),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o<i||isNaN(i))&&(i=o),u>=0?(a=(e.min.z-f.z)*u,c=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,c=(e.min.z-f.z)*u),n>c||a>i)||((a>n||n!==n)&&(n=a),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ai)!==null}intersectTriangle(e,t,n,i,s){fh.subVectors(t,e),Za.subVectors(n,e),dh.crossVectors(fh,Za);let o=this.direction.dot(dh),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ei.subVectors(this.origin,e);const c=a*this.direction.dot(Za.crossVectors(Ei,Za));if(c<0)return null;const l=a*this.direction.dot(fh.cross(Ei));if(l<0||c+l>o)return null;const h=-a*Ei.dot(dh);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 We{constructor(e,t,n,i,s,o,a,c,l,h,u,f,d,g,_,m){We.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,c,l,h,u,f,d,g,_,m)}set(e,t,n,i,s,o,a,c,l,h,u,f,d,g,_,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=h,p[10]=u,p[14]=f,p[3]=d,p[7]=g,p[11]=_,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 We().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/jr.setFromMatrixColumn(e,0).length(),s=1/jr.setFromMatrixColumn(e,1).length(),o=1/jr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=o*h,d=o*u,g=a*h,_=a*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=d+g*l,t[5]=f-_*l,t[9]=-a*c,t[2]=_-f*l,t[6]=g+d*l,t[10]=o*c}else if(e.order==="YXZ"){const f=c*h,d=c*u,g=l*h,_=l*u;t[0]=f+_*a,t[4]=g*a-d,t[8]=o*l,t[1]=o*u,t[5]=o*h,t[9]=-a,t[2]=d*a-g,t[6]=_+f*a,t[10]=o*c}else if(e.order==="ZXY"){const f=c*h,d=c*u,g=l*h,_=l*u;t[0]=f-_*a,t[4]=-o*u,t[8]=g+d*a,t[1]=d+g*a,t[5]=o*h,t[9]=_-f*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){const f=o*h,d=o*u,g=a*h,_=a*u;t[0]=c*h,t[4]=g*l-d,t[8]=f*l+_,t[1]=c*u,t[5]=_*l+f,t[9]=d*l-g,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){const f=o*c,d=o*l,g=a*c,_=a*l;t[0]=c*h,t[4]=_-f*u,t[8]=g*u+d,t[1]=u,t[5]=o*h,t[9]=-a*h,t[2]=-l*h,t[6]=d*u+g,t[10]=f-_*u}else if(e.order==="XZY"){const f=o*c,d=o*l,g=a*c,_=a*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=f*u+_,t[5]=o*h,t[9]=d*u-g,t[2]=g*u-d,t[6]=a*h,t[10]=_*u+f}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(__,e,v_)}lookAt(e,t,n){const i=this.elements;return yn.subVectors(e,t),yn.lengthSq()===0&&(yn.z=1),yn.normalize(),Ti.crossVectors(n,yn),Ti.lengthSq()===0&&(Math.abs(n.z)===1?yn.x+=1e-4:yn.z+=1e-4,yn.normalize(),Ti.crossVectors(n,yn)),Ti.normalize(),Ya.crossVectors(yn,Ti),i[0]=Ti.x,i[4]=Ya.x,i[8]=yn.x,i[1]=Ti.y,i[5]=Ya.y,i[9]=yn.y,i[2]=Ti.z,i[6]=Ya.z,i[10]=yn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[4],c=n[8],l=n[12],h=n[1],u=n[5],f=n[9],d=n[13],g=n[2],_=n[6],m=n[10],p=n[14],v=n[3],y=n[7],x=n[11],A=n[15],E=i[0],I=i[4],D=i[8],b=i[12],C=i[1],B=i[5],R=i[9],O=i[13],M=i[2],z=i[6],X=i[10],H=i[14],re=i[3],J=i[7],le=i[11],W=i[15];return s[0]=o*E+a*C+c*M+l*re,s[4]=o*I+a*B+c*z+l*J,s[8]=o*D+a*R+c*X+l*le,s[12]=o*b+a*O+c*H+l*W,s[1]=h*E+u*C+f*M+d*re,s[5]=h*I+u*B+f*z+d*J,s[9]=h*D+u*R+f*X+d*le,s[13]=h*b+u*O+f*H+d*W,s[2]=g*E+_*C+m*M+p*re,s[6]=g*I+_*B+m*z+p*J,s[10]=g*D+_*R+m*X+p*le,s[14]=g*b+_*O+m*H+p*W,s[3]=v*E+y*C+x*M+A*re,s[7]=v*I+y*B+x*z+A*J,s[11]=v*D+y*R+x*X+A*le,s[15]=v*b+y*O+x*H+A*W,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],o=e[1],a=e[5],c=e[9],l=e[13],h=e[2],u=e[6],f=e[10],d=e[14],g=e[3],_=e[7],m=e[11],p=e[15],v=c*d-l*f,y=a*d-l*u,x=a*f-c*u,A=o*d-l*h,E=o*f-c*h,I=o*u-a*h;return t*(_*v-m*y+p*x)-n*(g*v-m*A+p*E)+i*(g*y-_*A+p*I)-s*(g*x-_*E+m*I)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=e[9],f=e[10],d=e[11],g=e[12],_=e[13],m=e[14],p=e[15],v=u*m*l-_*f*l+_*c*d-a*m*d-u*c*p+a*f*p,y=g*f*l-h*m*l-g*c*d+o*m*d+h*c*p-o*f*p,x=h*_*l-g*u*l+g*a*d-o*_*d-h*a*p+o*u*p,A=g*u*c-h*_*c-g*a*f+o*_*f+h*a*m-o*u*m,E=t*v+n*y+i*x+s*A;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const I=1/E;return e[0]=v*I,e[1]=(_*f*s-u*m*s-_*i*d+n*m*d+u*i*p-n*f*p)*I,e[2]=(a*m*s-_*c*s+_*i*l-n*m*l-a*i*p+n*c*p)*I,e[3]=(u*c*s-a*f*s-u*i*l+n*f*l+a*i*d-n*c*d)*I,e[4]=y*I,e[5]=(h*m*s-g*f*s+g*i*d-t*m*d-h*i*p+t*f*p)*I,e[6]=(g*c*s-o*m*s-g*i*l+t*m*l+o*i*p-t*c*p)*I,e[7]=(o*f*s-h*c*s+h*i*l-t*f*l-o*i*d+t*c*d)*I,e[8]=x*I,e[9]=(g*u*s-h*_*s-g*n*d+t*_*d+h*n*p-t*u*p)*I,e[10]=(o*_*s-g*a*s+g*n*l-t*_*l-o*n*p+t*a*p)*I,e[11]=(h*a*s-o*u*s-h*n*l+t*u*l+o*n*d-t*a*d)*I,e[12]=A*I,e[13]=(h*_*i-g*u*i+g*n*f-t*_*f-h*n*m+t*u*m)*I,e[14]=(g*a*i-o*_*i-g*n*c+t*_*c+o*n*m-t*a*m)*I,e[15]=(o*u*i-h*a*i+h*n*c-t*u*c-o*n*f+t*a*f)*I,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,a=e.y,c=e.z,l=s*o,h=s*a;return this.set(l*o+n,l*a-i*c,l*c+i*a,0,l*a+i*c,h*a+n,h*c-i*o,0,l*c-i*a,h*c+i*o,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,c=t._w,l=s+s,h=o+o,u=a+a,f=s*l,d=s*h,g=s*u,_=o*h,m=o*u,p=a*u,v=c*l,y=c*h,x=c*u,A=n.x,E=n.y,I=n.z;return i[0]=(1-(_+p))*A,i[1]=(d+x)*A,i[2]=(g-y)*A,i[3]=0,i[4]=(d-x)*E,i[5]=(1-(f+p))*E,i[6]=(m+v)*E,i[7]=0,i[8]=(g+y)*I,i[9]=(m-v)*I,i[10]=(1-(f+_))*I,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let s=jr.set(i[0],i[1],i[2]).length();const o=jr.set(i[4],i[5],i[6]).length(),a=jr.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),Bn.copy(this);const l=1/s,h=1/o,u=1/a;return Bn.elements[0]*=l,Bn.elements[1]*=l,Bn.elements[2]*=l,Bn.elements[4]*=h,Bn.elements[5]*=h,Bn.elements[6]*=h,Bn.elements[8]*=u,Bn.elements[9]*=u,Bn.elements[10]*=u,t.setFromRotationMatrix(Bn),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o,a=gn,c=!1){const l=this.elements,h=2*s/(t-e),u=2*s/(n-i),f=(t+e)/(t-e),d=(n+i)/(n-i);let g,_;if(c)g=s/(o-s),_=o*s/(o-s);else if(a===gn)g=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===Vr)g=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=h,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,o,a=gn,c=!1){const l=this.elements,h=2/(t-e),u=2/(n-i),f=-(t+e)/(t-e),d=-(n+i)/(n-i);let g,_;if(c)g=1/(o-s),_=o/(o-s);else if(a===gn)g=-2/(o-s),_=-(o+s)/(o-s);else if(a===Vr)g=-1/(o-s),_=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=h,l[4]=0,l[8]=0,l[12]=f,l[1]=0,l[5]=u,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=g,l[14]=_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const jr=new U,Bn=new We,__=new U(0,0,0),v_=new U(1,1,1),Ti=new U,Ya=new U,yn=new U,ud=new We,fd=new wt;class Zt{constructor(e=0,t=0,n=0,i=Zt.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],c=i[1],l=i[5],h=i[9],u=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Qe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Qe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Qe(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Qe(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Qe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Qe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:Te("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ud.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ud,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fd.setFromEuler(this),this.setFromQuaternion(fd,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}}Zt.DEFAULT_ORDER="XYZ";class Qa{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 y_=0;const dd=new U,Jr=new wt,ci=new We,Ka=new U,Qs=new U,x_=new U,A_=new wt,pd=new U(1,0,0),md=new U(0,1,0),gd=new U(0,0,1),_d={type:"added"},b_={type:"removed"},$r={type:"childadded",child:null},ph={type:"childremoved",child:null};class ct extends Qn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:y_++}),this.uuid=_n(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ct.DEFAULT_UP.clone();const e=new U,t=new Zt,n=new wt,i=new U(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new We},normalMatrix:{value:new et}}),this.matrix=new We,this.matrixWorld=new We,this.matrixAutoUpdate=ct.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Qa,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Jr.setFromAxisAngle(e,t),this.quaternion.multiply(Jr),this}rotateOnWorldAxis(e,t){return Jr.setFromAxisAngle(e,t),this.quaternion.premultiply(Jr),this}rotateX(e){return this.rotateOnAxis(pd,e)}rotateY(e){return this.rotateOnAxis(md,e)}rotateZ(e){return this.rotateOnAxis(gd,e)}translateOnAxis(e,t){return dd.copy(e).applyQuaternion(this.quaternion),this.position.add(dd.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(pd,e)}translateY(e){return this.translateOnAxis(md,e)}translateZ(e){return this.translateOnAxis(gd,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ci.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ka.copy(e):Ka.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Qs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ci.lookAt(Qs,Ka,this.up):ci.lookAt(Ka,Qs,this.up),this.quaternion.setFromRotationMatrix(ci),i&&(ci.extractRotation(i.matrixWorld),Jr.setFromRotationMatrix(ci),this.quaternion.premultiply(Jr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("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(_d),$r.child=e,this.dispatchEvent($r),$r.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(b_),ph.child=e,this.dispatchEvent(ph),ph.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),ci.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ci.multiply(e.parent.matrixWorld)),e.applyMatrix4(ci),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(_d),$r.child=e,this.dispatchEvent($r),$r.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Qs,e,x_),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Qs,A_,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const u=c[l];s(e.shapes,u)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(s(e.materials,this.material[c]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const c=this.animations[a];i.animations.push(s(e.animations,c))}}if(t){const a=o(e.geometries),c=o(e.materials),l=o(e.textures),h=o(e.images),u=o(e.shapes),f=o(e.skeletons),d=o(e.animations),g=o(e.nodes);a.length>0&&(n.geometries=a),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),g.length>0&&(n.nodes=g)}return n.object=i,n;function o(a){const c=[];for(const l in a){const h=a[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}ct.DEFAULT_UP=new U(0,1,0),ct.DEFAULT_MATRIX_AUTO_UPDATE=!0,ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const On=new U,li=new U,mh=new U,hi=new U,es=new U,ts=new U,vd=new U,gh=new U,_h=new U,vh=new U,yh=new gt,xh=new gt,Ah=new gt;class hn{constructor(e=new U,t=new U,n=new U){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),On.subVectors(e,t),i.cross(On);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){On.subVectors(i,t),li.subVectors(n,t),mh.subVectors(e,t);const o=On.dot(On),a=On.dot(li),c=On.dot(mh),l=li.dot(li),h=li.dot(mh),u=o*l-a*a;if(u===0)return s.set(0,0,0),null;const f=1/u,d=(l*c-a*h)*f,g=(o*h-a*c)*f;return s.set(1-d-g,g,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,hi)===null?!1:hi.x>=0&&hi.y>=0&&hi.x+hi.y<=1}static getInterpolation(e,t,n,i,s,o,a,c){return this.getBarycoord(e,t,n,i,hi)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,hi.x),c.addScaledVector(o,hi.y),c.addScaledVector(a,hi.z),c)}static getInterpolatedAttribute(e,t,n,i,s,o){return yh.setScalar(0),xh.setScalar(0),Ah.setScalar(0),yh.fromBufferAttribute(e,t),xh.fromBufferAttribute(e,n),Ah.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(yh,s.x),o.addScaledVector(xh,s.y),o.addScaledVector(Ah,s.z),o}static isFrontFacing(e,t,n,i){return On.subVectors(n,t),li.subVectors(e,t),On.cross(li).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return On.subVectors(this.c,this.b),li.subVectors(this.a,this.b),On.cross(li).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return hn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return hn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return hn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return hn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return hn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,a;es.subVectors(i,n),ts.subVectors(s,n),gh.subVectors(e,n);const c=es.dot(gh),l=ts.dot(gh);if(c<=0&&l<=0)return t.copy(n);_h.subVectors(e,i);const h=es.dot(_h),u=ts.dot(_h);if(h>=0&&u<=h)return t.copy(i);const f=c*u-h*l;if(f<=0&&c>=0&&h<=0)return o=c/(c-h),t.copy(n).addScaledVector(es,o);vh.subVectors(e,s);const d=es.dot(vh),g=ts.dot(vh);if(g>=0&&d<=g)return t.copy(s);const _=d*l-c*g;if(_<=0&&l>=0&&g<=0)return a=l/(l-g),t.copy(n).addScaledVector(ts,a);const m=h*g-d*u;if(m<=0&&u-h>=0&&d-g>=0)return vd.subVectors(s,i),a=(u-h)/(u-h+(d-g)),t.copy(i).addScaledVector(vd,a);const p=1/(m+_+f);return o=_*p,a=f*p,t.copy(n).addScaledVector(es,o).addScaledVector(ts,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const yd={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},Ci={h:0,s:0,l:0},ja={h:0,s:0,l:0};function bh(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class xe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Tt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,rt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=rt.workingColorSpace){return this.r=e,this.g=t,this.b=n,rt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=rt.workingColorSpace){if(e=ih(e,1),t=Qe(t,0,1),n=Qe(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=bh(o,s,e+1/3),this.g=bh(o,s,e),this.b=bh(o,s,e-1/3)}return rt.colorSpaceToWorking(this,i),this}setStyle(e,t=Tt){function n(s){s!==void 0&&parseFloat(s)<1&&Te("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Te("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[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);Te("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Tt){const n=yd[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Te("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=si(e.r),this.g=si(e.g),this.b=si(e.b),this}copyLinearToSRGB(e){return this.r=qr(e.r),this.g=qr(e.g),this.b=qr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Tt){return rt.workingToColorSpace(Kt.copy(this),e),Math.round(Qe(Kt.r*255,0,255))*65536+Math.round(Qe(Kt.g*255,0,255))*256+Math.round(Qe(Kt.b*255,0,255))}getHexString(e=Tt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=rt.workingColorSpace){rt.workingToColorSpace(Kt.copy(this),t);const n=Kt.r,i=Kt.g,s=Kt.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let c,l;const h=(a+o)/2;if(a===o)c=0,l=0;else{const u=o-a;switch(l=h<=.5?u/(o+a):u/(2-o-a),o){case n:c=(i-s)/u+(i<s?6:0);break;case i:c=(s-n)/u+2;break;case s:c=(n-i)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=rt.workingColorSpace){return rt.workingToColorSpace(Kt.copy(this),t),e.r=Kt.r,e.g=Kt.g,e.b=Kt.b,e}getStyle(e=Tt){rt.workingToColorSpace(Kt.copy(this),e);const t=Kt.r,n=Kt.g,i=Kt.b;return e!==Tt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Ci),this.setHSL(Ci.h+e,Ci.s+t,Ci.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ci),e.getHSL(ja);const n=Xs(Ci.h,ja.h,t),i=Xs(Ci.s,ja.s,t),s=Xs(Ci.l,ja.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Kt=new xe;xe.NAMES=yd;let w_=0;class zt extends Qn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:w_++}),this.uuid=_n(),this.name="",this.type="Material",this.blending=ki,this.side=Wn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zo,this.blendDst=ko,this.blendEquation=_i,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new xe(0,0,0),this.blendAlpha=0,this.depthFunc=Vi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=th,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Xi,this.stencilZFail=Xi,this.stencilZPass=Xi,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Te(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Te(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ki&&(n.blending=this.blending),this.side!==Wn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==zo&&(n.blendSrc=this.blendSrc),this.blendDst!==ko&&(n.blendDst=this.blendDst),this.blendEquation!==_i&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Vi&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==th&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Xi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Xi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Xi&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const c=s[a];delete c.metadata,o.push(c)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class un extends zt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new xe(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 Zt,this.combine=Ns,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 ui=S_();function S_(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let c=0;c<256;++c){const l=c-127;l<-27?(n[c]=0,n[c|256]=32768,i[c]=24,i[c|256]=24):l<-14?(n[c]=1024>>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,h=0;for(;(l&8388608)===0;)l<<=1,h-=8388608;l&=-8388609,h+=947912704,s[c]=l|h}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(a[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function fn(r){Math.abs(r)>65504&&Te("DataUtils.toHalfFloat(): Value out of range."),r=Qe(r,-65504,65504),ui.floatView[0]=r;const e=ui.uint32View[0],t=e>>23&511;return ui.baseTable[t]+((e&8388607)>>ui.shiftTable[t])}function Ks(r){const e=r>>10;return ui.uint32View[0]=ui.mantissaTable[ui.offsetTable[e]+(r&1023)]+ui.exponentTable[e],ui.floatView[0]}class M_{static toHalfFloat(e){return fn(e)}static fromHalfFloat(e){return Ks(e)}}const Bt=new U,Ja=new he;let E_=0;class ot{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:E_++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=kr,this.updateRanges=[],this.gpuType=nn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Ja.fromBufferAttribute(this,t),Ja.applyMatrix3(e),this.setXY(t,Ja.x,Ja.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyMatrix3(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyMatrix4(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyNormalMatrix(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.transformDirection(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=sn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=tt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=sn(t,this.array)),t}setX(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=sn(t,this.array)),t}setY(e,t){return this.normalized&&(t=tt(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=sn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=tt(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=sn(t,this.array)),t}setW(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array),s=tt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,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!==kr&&(e.usage=this.usage),e}}class T_ extends ot{constructor(e,t,n){super(new Int8Array(e),t,n)}}class C_ extends ot{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class I_ extends ot{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class R_ extends ot{constructor(e,t,n){super(new Int16Array(e),t,n)}}class wh extends ot{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class P_ extends ot{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Sh extends ot{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class D_ extends ot{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Ks(this.array[e*this.itemSize]);return this.normalized&&(t=sn(t,this.array)),t}setX(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize]=fn(t),this}getY(e){let t=Ks(this.array[e*this.itemSize+1]);return this.normalized&&(t=sn(t,this.array)),t}setY(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize+1]=fn(t),this}getZ(e){let t=Ks(this.array[e*this.itemSize+2]);return this.normalized&&(t=sn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize+2]=fn(t),this}getW(e){let t=Ks(this.array[e*this.itemSize+3]);return this.normalized&&(t=sn(t,this.array)),t}setW(e,t){return this.normalized&&(t=tt(t,this.array)),this.array[e*this.itemSize+3]=fn(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array)),this.array[e+0]=fn(t),this.array[e+1]=fn(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array)),this.array[e+0]=fn(t),this.array[e+1]=fn(n),this.array[e+2]=fn(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array),s=tt(s,this.array)),this.array[e+0]=fn(t),this.array[e+1]=fn(n),this.array[e+2]=fn(i),this.array[e+3]=fn(s),this}}class Be extends ot{constructor(e,t,n){super(new Float32Array(e),t,n)}}let L_=0;const Tn=new We,Mh=new ct,ns=new U,xn=new Gt,js=new Gt,Wt=new U;class Ke extends Qn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:L_++}),this.uuid=_n(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(nd(e)?Sh:wh)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new et().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Tn.makeRotationFromQuaternion(e),this.applyMatrix4(Tn),this}rotateX(e){return Tn.makeRotationX(e),this.applyMatrix4(Tn),this}rotateY(e){return Tn.makeRotationY(e),this.applyMatrix4(Tn),this}rotateZ(e){return Tn.makeRotationZ(e),this.applyMatrix4(Tn),this}translate(e,t,n){return Tn.makeTranslation(e,t,n),this.applyMatrix4(Tn),this}scale(e,t,n){return Tn.makeScale(e,t,n),this.applyMatrix4(Tn),this}lookAt(e){return Mh.lookAt(e),Mh.updateMatrix(),this.applyMatrix4(Mh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ns).negate(),this.translate(ns.x,ns.y,ns.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const o=e[i];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Be(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&Te("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 Gt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];xn.setFromBufferAttribute(s),this.morphTargetsRelative?(Wt.addVectors(this.boundingBox.min,xn.min),this.boundingBox.expandByPoint(Wt),Wt.addVectors(this.boundingBox.max,xn.max),this.boundingBox.expandByPoint(Wt)):(this.boundingBox.expandByPoint(xn.min),this.boundingBox.expandByPoint(xn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('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 Pt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new U,1/0);return}if(e){const n=this.boundingSphere.center;if(xn.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];js.setFromBufferAttribute(a),this.morphTargetsRelative?(Wt.addVectors(xn.min,js.min),xn.expandByPoint(Wt),Wt.addVectors(xn.max,js.max),xn.expandByPoint(Wt)):(xn.expandByPoint(js.min),xn.expandByPoint(js.max))}xn.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)Wt.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Wt));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],c=this.morphTargetsRelative;for(let l=0,h=a.count;l<h;l++)Wt.fromBufferAttribute(a,l),c&&(ns.fromBufferAttribute(e,l),Wt.add(ns)),i=Math.max(i,n.distanceToSquared(Wt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Ge('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){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ot(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),a=[],c=[];for(let D=0;D<n.count;D++)a[D]=new U,c[D]=new U;const l=new U,h=new U,u=new U,f=new he,d=new he,g=new he,_=new U,m=new U;function p(D,b,C){l.fromBufferAttribute(n,D),h.fromBufferAttribute(n,b),u.fromBufferAttribute(n,C),f.fromBufferAttribute(s,D),d.fromBufferAttribute(s,b),g.fromBufferAttribute(s,C),h.sub(l),u.sub(l),d.sub(f),g.sub(f);const B=1/(d.x*g.y-g.x*d.y);!isFinite(B)||(_.copy(h).multiplyScalar(g.y).addScaledVector(u,-d.y).multiplyScalar(B),m.copy(u).multiplyScalar(d.x).addScaledVector(h,-g.x).multiplyScalar(B),a[D].add(_),a[b].add(_),a[C].add(_),c[D].add(m),c[b].add(m),c[C].add(m))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let D=0,b=v.length;D<b;++D){const C=v[D],B=C.start,R=C.count;for(let O=B,M=B+R;O<M;O+=3)p(e.getX(O+0),e.getX(O+1),e.getX(O+2))}const y=new U,x=new U,A=new U,E=new U;function I(D){A.fromBufferAttribute(i,D),E.copy(A);const b=a[D];y.copy(b),y.sub(A.multiplyScalar(A.dot(b))).normalize(),x.crossVectors(E,b);const B=x.dot(c[D])<0?-1:1;o.setXYZW(D,y.x,y.y,y.z,B)}for(let D=0,b=v.length;D<b;++D){const C=v[D],B=C.start,R=C.count;for(let O=B,M=B+R;O<M;O+=3)I(e.getX(O+0)),I(e.getX(O+1)),I(e.getX(O+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ot(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const i=new U,s=new U,o=new U,a=new U,c=new U,l=new U,h=new U,u=new U;if(e)for(let f=0,d=e.count;f<d;f+=3){const g=e.getX(f+0),_=e.getX(f+1),m=e.getX(f+2);i.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),o.fromBufferAttribute(t,m),h.subVectors(o,s),u.subVectors(i,s),h.cross(u),a.fromBufferAttribute(n,g),c.fromBufferAttribute(n,_),l.fromBufferAttribute(n,m),a.add(h),c.add(h),l.add(h),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(_,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),h.subVectors(o,s),u.subVectors(i,s),h.cross(u),n.setXYZ(f+0,h.x,h.y,h.z),n.setXYZ(f+1,h.x,h.y,h.z),n.setXYZ(f+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Wt.fromBufferAttribute(e,t),Wt.normalize(),e.setXYZ(t,Wt.x,Wt.y,Wt.z)}toNonIndexed(){function e(a,c){const l=a.array,h=a.itemSize,u=a.normalized,f=new l.constructor(c.length*h);let d=0,g=0;for(let _=0,m=c.length;_<m;_++){a.isInterleavedBufferAttribute?d=c[_]*a.data.stride+a.offset:d=c[_]*h;for(let p=0;p<h;p++)f[g++]=l[d++]}return new ot(f,h,u)}if(this.index===null)return Te("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ke,n=this.index.array,i=this.attributes;for(const a in i){const c=i[a],l=e(c,n);t.setAttribute(a,l)}const s=this.morphAttributes;for(const a in s){const c=[],l=s[a];for(let h=0,u=l.length;h<u;h++){const f=l[h],d=e(f,n);c.push(d)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,c=o.length;a<c;a++){const l=o[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let u=0,f=l.length;u<f;u++){const d=l[u];h.push(d.toJSON(e.data))}h.length>0&&(i[c]=h,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const l in i){const h=i[l];this.setAttribute(l,h.clone(t))}const s=e.morphAttributes;for(const l in s){const h=[],u=s[l];for(let f=0,d=u.length;f<d;f++)h.push(u[f].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let l=0,h=o.length;l<h;l++){const u=o[l];this.addGroup(u.start,u.count,u.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const xd=new We,Ki=new Kr,$a=new Pt,Ad=new U,ec=new U,tc=new U,nc=new U,Eh=new U,ic=new U,bd=new U,rc=new U;class St extends ct{constructor(e=new Ke,t=new un){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){ic.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const h=a[c],u=s[c];h!==0&&(Eh.fromBufferAttribute(u,e),o?ic.addScaledVector(Eh,h):ic.addScaledVector(Eh.sub(t),h))}t.add(ic)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),$a.copy(n.boundingSphere),$a.applyMatrix4(s),Ki.copy(e.ray).recast(e.near),!($a.containsPoint(Ki.origin)===!1&&(Ki.intersectSphere($a,Ad)===null||Ki.origin.distanceToSquared(Ad)>(e.far-e.near)**2))&&(xd.copy(s).invert(),Ki.copy(e.ray).applyMatrix4(xd),!(n.boundingBox!==null&&Ki.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ki)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,a=s.index,c=s.attributes.position,l=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,f=s.groups,d=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=f.length;g<_;g++){const m=f[g],p=o[m.materialIndex],v=Math.max(m.start,d.start),y=Math.min(a.count,Math.min(m.start+m.count,d.start+d.count));for(let x=v,A=y;x<A;x+=3){const E=a.getX(x),I=a.getX(x+1),D=a.getX(x+2);i=sc(this,p,e,n,l,h,u,E,I,D),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),_=Math.min(a.count,d.start+d.count);for(let m=g,p=_;m<p;m+=3){const v=a.getX(m),y=a.getX(m+1),x=a.getX(m+2);i=sc(this,o,e,n,l,h,u,v,y,x),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(o))for(let g=0,_=f.length;g<_;g++){const m=f[g],p=o[m.materialIndex],v=Math.max(m.start,d.start),y=Math.min(c.count,Math.min(m.start+m.count,d.start+d.count));for(let x=v,A=y;x<A;x+=3){const E=x,I=x+1,D=x+2;i=sc(this,p,e,n,l,h,u,E,I,D),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=m.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),_=Math.min(c.count,d.start+d.count);for(let m=g,p=_;m<p;m+=3){const v=m,y=m+1,x=m+2;i=sc(this,o,e,n,l,h,u,v,y,x),i&&(i.faceIndex=Math.floor(m/3),t.push(i))}}}}function N_(r,e,t,n,i,s,o,a){let c;if(e.side===en?c=n.intersectTriangle(o,s,i,!0,a):c=n.intersectTriangle(i,s,o,e.side===Wn,a),c===null)return null;rc.copy(a),rc.applyMatrix4(r.matrixWorld);const l=t.ray.origin.distanceTo(rc);return l<t.near||l>t.far?null:{distance:l,point:rc.clone(),object:r}}function sc(r,e,t,n,i,s,o,a,c,l){r.getVertexPosition(a,ec),r.getVertexPosition(c,tc),r.getVertexPosition(l,nc);const h=N_(r,e,t,n,ec,tc,nc,bd);if(h){const u=new U;hn.getBarycoord(bd,ec,tc,nc,u),i&&(h.uv=hn.getInterpolatedAttribute(i,a,c,l,u,new he)),s&&(h.uv1=hn.getInterpolatedAttribute(s,a,c,l,u,new he)),o&&(h.normal=hn.getInterpolatedAttribute(o,a,c,l,u,new U),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const f={a,b:c,c:l,normal:new U,materialIndex:0};hn.getNormal(ec,tc,nc,f.normal),h.face=f,h.barycoord=u}return h}class ji extends Ke{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const c=[],l=[],h=[],u=[];let f=0,d=0;g("z","y","x",-1,-1,n,t,e,o,s,0),g("z","y","x",1,-1,n,t,-e,o,s,1),g("x","z","y",1,1,e,n,t,i,o,2),g("x","z","y",1,-1,e,n,-t,i,o,3),g("x","y","z",1,-1,e,t,n,i,s,4),g("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(c),this.setAttribute("position",new Be(l,3)),this.setAttribute("normal",new Be(h,3)),this.setAttribute("uv",new Be(u,2));function g(_,m,p,v,y,x,A,E,I,D,b){const C=x/I,B=A/D,R=x/2,O=A/2,M=E/2,z=I+1,X=D+1;let H=0,re=0;const J=new U;for(let le=0;le<X;le++){const W=le*B-O;for(let Z=0;Z<z;Z++){const ge=Z*C-R;J[_]=ge*v,J[m]=W*y,J[p]=M,l.push(J.x,J.y,J.z),J[_]=0,J[m]=0,J[p]=E>0?1:-1,h.push(J.x,J.y,J.z),u.push(Z/I),u.push(1-le/D),H+=1}}for(let le=0;le<D;le++)for(let W=0;W<I;W++){const Z=f+W+z*le,ge=f+W+z*(le+1),_e=f+(W+1)+z*(le+1),de=f+(W+1)+z*le;c.push(Z,ge,de),c.push(ge,_e,de),re+=6}a.addGroup(d,re,b),d+=re,f+=H}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ji(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function is(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(Te("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function on(r){const e={};for(let t=0;t<r.length;t++){const n=is(r[t]);for(const i in n)e[i]=n[i]}return e}function U_(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function wd(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:rt.workingColorSpace}const Sd={clone:is,merge:on};var B_=`void main() {
6
6
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7
7
  }`,O_=`void main() {
8
8
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
@@ -41,7 +41,7 @@
41
41
  gl_FragColor = texture2D( tEquirect, sampleUV );
42
42
 
43
43
  }
44
- `},i=new ji(5,5,5),s=new Cn({name:"CubemapFromEquirect",uniforms:is(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:en,blending:qn});s.uniforms.tEquirect.value=t;const o=new St(i,s),a=t.minFilter;return t.minFilter===Mn&&(t.minFilter=pt),new Td(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}class Kn extends ct{constructor(){super(),this.isGroup=!0,this.type="Group"}}const F_={type:"move"};class ac{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Kn,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 Kn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Kn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,n),p=this._getHandJoint(l,_);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=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,g=.005;l.inputState.pinching&&f>d+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&f<=d-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(F_)))}return a!==null&&(a.visible=i!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Kn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class cc{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new xe(e),this.density=t}clone(){return new cc(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class lc{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new xe(e),this.near=t,this.far=n}clone(){return new lc(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Ch extends ct{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 Zt,this.environmentIntensity=1,this.environmentRotation=new Zt,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 os{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=kr,this.updateRanges=[],this.version=0,this.uuid=_n()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_n()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_n()),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 U;class fi{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=sn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=tt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=tt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=tt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=tt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=tt(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=sn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=sn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=sn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=sn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array),s=tt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){qs("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new ot(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 fi(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){qs("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Ih extends zt{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new xe(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 as;const $s=new U,cs=new U,ls=new U,hs=new he,eo=new he,Cd=new We,hc=new U,to=new U,uc=new U,Id=new he,Rh=new he,Rd=new he;class Pd extends ct{constructor(e=new Ih){if(super(),this.isSprite=!0,this.type="Sprite",as===void 0){as=new Ke;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new os(t,5);as.setIndex([0,1,2,0,2,3]),as.setAttribute("position",new fi(n,3,0,!1)),as.setAttribute("uv",new fi(n,2,3,!1))}this.geometry=as,this.material=e,this.center=new he(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),cs.setFromMatrixScale(this.matrixWorld),Cd.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ls.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&cs.multiplyScalar(-ls.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;fc(hc.set(-.5,-.5,0),ls,o,cs,i,s),fc(to.set(.5,-.5,0),ls,o,cs,i,s),fc(uc.set(.5,.5,0),ls,o,cs,i,s),Id.set(0,0),Rh.set(1,0),Rd.set(1,1);let a=e.ray.intersectTriangle(hc,to,uc,!1,$s);if(a===null&&(fc(to.set(-.5,.5,0),ls,o,cs,i,s),Rh.set(0,1),a=e.ray.intersectTriangle(hc,uc,to,!1,$s),a===null))return;const c=e.ray.origin.distanceTo($s);c<e.near||c>e.far||t.push({distance:c,point:$s.clone(),uv:hn.getInterpolation($s,hc,to,uc,Id,Rh,Rd,new he),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 fc(r,e,t,n,i,s){hs.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(eo.x=s*hs.x-i*hs.y,eo.y=i*hs.x+s*hs.y):eo.copy(hs),r.copy(e),r.x+=eo.x,r.y+=eo.y,r.applyMatrix4(Cd)}const dc=new U,Dd=new U;class Ld extends ct{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){dc.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(dc);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){dc.setFromMatrixPosition(e.matrixWorld),Dd.setFromMatrixPosition(this.matrixWorld);const n=dc.distanceTo(Dd)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Nd=new U,Ud=new gt,Bd=new gt,z_=new U,Od=new We,pc=new U,Ph=new Pt,Fd=new We,Dh=new Kr;class Lh extends St{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Xl,this.bindMatrix=new We,this.bindMatrixInverse=new We,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Gt),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,pc),this.boundingBox.expandByPoint(pc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Pt),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,pc),this.boundingSphere.expandByPoint(pc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ph.copy(this.boundingSphere),Ph.applyMatrix4(i),e.ray.intersectsSphere(Ph)!==!1&&(Fd.copy(i).invert(),Dh.copy(e.ray).applyMatrix4(Fd),!(this.boundingBox!==null&&Dh.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Dh)))}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 gt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Xl?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Gf?this.bindMatrixInverse.copy(this.bindMatrix).invert():Te("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Ud.fromBufferAttribute(i.attributes.skinIndex,e),Bd.fromBufferAttribute(i.attributes.skinWeight,e),Nd.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=Bd.getComponent(s);if(o!==0){const a=Ud.getComponent(s);Od.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(z_.copy(Nd).applyMatrix4(Od),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class mc extends ct{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Fn extends xt{constructor(e=null,t=1,n=1,i,s,o,a,c,l=Mt,h=Mt,u,f){super(null,o,a,c,l,h,i,s,u,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const zd=new We,k_=new We;class no{constructor(e=[],t=[]){this.uuid=_n(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=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){Te("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new We)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new We;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:k_;zd.multiplyMatrices(a,t[s]),zd.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new no(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Fn(t,e,e,rn,nn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let o=t[s];o===void 0&&(Te("Skeleton: No bone found with UUID:",s),o=new mc),this.bones.push(o),this.boneInverses.push(new We().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Ji extends ot{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const us=new We,kd=new We,gc=[],Vd=new Gt,V_=new We,io=new St,ro=new Pt;class _c extends St{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ji(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,V_)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Gt),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,us),Vd.copy(e.boundingBox).applyMatrix4(us),this.boundingBox.union(Vd)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Pt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,us),ro.copy(e.boundingSphere).applyMatrix4(us),this.boundingSphere.union(ro)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,o=e*s+1;for(let a=0;a<n.length;a++)n[a]=i[o+a]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(io.geometry=this.geometry,io.material=this.material,io.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ro.copy(this.boundingSphere),ro.applyMatrix4(n),e.ray.intersectsSphere(ro)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,us),kd.multiplyMatrices(n,us),io.matrixWorld=kd,io.raycast(e,gc);for(let o=0,a=gc.length;o<a;o++){const c=gc[o];c.instanceId=s,c.object=this,t.push(c)}gc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ji(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Fn(new Float32Array(i*this.count),i,this.count,ea,nn));const s=this.morphTexture.source.data.data;let o=0;for(let l=0;l<n.length;l++)o+=n[l];const a=this.geometry.morphTargetsRelative?1:1-o,c=i*e;s[c]=a,s.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Nh=new U,H_=new U,G_=new et;class Ri{constructor(e=new U(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Nh.subVectors(n,t).cross(H_.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Nh),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||G_.getNormalMatrix(e),i=this.coplanarPoint(Nh).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const $i=new Pt,W_=new he(.5,.5),vc=new U;class fs{constructor(e=new Ri,t=new Ri,n=new Ri,i=new Ri,s=new Ri,o=new Ri){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=gn,n=!1){const i=this.planes,s=e.elements,o=s[0],a=s[1],c=s[2],l=s[3],h=s[4],u=s[5],f=s[6],d=s[7],g=s[8],_=s[9],m=s[10],p=s[11],v=s[12],y=s[13],x=s[14],A=s[15];if(i[0].setComponents(l-o,d-h,p-g,A-v).normalize(),i[1].setComponents(l+o,d+h,p+g,A+v).normalize(),i[2].setComponents(l+a,d+u,p+_,A+y).normalize(),i[3].setComponents(l-a,d-u,p-_,A-y).normalize(),n)i[4].setComponents(c,f,m,x).normalize(),i[5].setComponents(l-c,d-f,p-m,A-x).normalize();else if(i[4].setComponents(l-c,d-f,p-m,A-x).normalize(),t===gn)i[5].setComponents(l+c,d+f,p+m,A+x).normalize();else if(t===Vr)i[5].setComponents(c,f,m,x).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(),$i.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),$i.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere($i)}intersectsSprite(e){$i.center.set(0,0,0);const t=W_.distanceTo(e.center);return $i.radius=.7071067811865476+t,$i.applyMatrix4(e.matrixWorld),this.intersectsSphere($i)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(vc.x=i.normal.x>0?e.max.x:e.min.x,vc.y=i.normal.y>0?e.max.y:e.min.y,vc.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(vc)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const jn=new We,Jn=new fs;class yc{constructor(){this.coordinateSystem=gn}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.containsPoint(e))return!0}return!1}clone(){return new yc}}function Uh(r,e){return r-e}function q_(r,e){return r.z-e.z}function X_(r,e){return e.z-r.z}class Z_{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){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=n,a.index=i}reset(){this.list.length=0,this.index=0}}const dn=new We,Y_=new xe(1,1,1),Hd=new fs,Q_=new yc,xc=new Gt,er=new Pt,so=new U,Gd=new U,K_=new U,Bh=new Z_,jt=new St,Ac=[];function j_(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let o=0;o<n;o++)e.setComponent(s+t,o,r.getComponent(s,o))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function tr(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++)e[n]=r[n]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class Wd extends St{constructor(e,t,n=t*2,i){super(new Ke,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Fn(t,e,e,rn,nn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Fn(t,e,e,Os,En);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Fn(t,e,e,rn,nn);n.colorSpace=rt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:c,normalized:l}=o,h=new a.constructor(n*c),u=new ot(h,c,l);t.setAttribute(s,u)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new ot(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(Boolean(e.getIndex())!==Boolean(t.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.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 Gt);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,dn),this.getBoundingBoxAt(s,xc).applyMatrix4(dn),e.union(xc)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Pt);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,dn),this.getBoundingSphereAt(s,er).applyMatrix4(dn),e.union(er)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Uh),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;dn.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(Y_.toArray(o.image.data,i*4),o.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?o.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let c;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Uh),c=this._availableGeometryIds.shift(),s[c]=i):(c=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(c,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,c}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(i&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const c=a.vertexStart,l=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const h in n.attributes){const u=t.getAttribute(h),f=n.getAttribute(h);j_(u,f,c);const d=u.itemSize;for(let g=u.count,_=l;g<_;g++){const m=c+g;for(let p=0;p<d;p++)f.setComponent(m,p,0)}f.needsUpdate=!0,f.addUpdateRange(c*d,l*d)}if(i){const h=a.indexStart,u=a.reservedIndexCount;a.indexCount=t.getIndex().count;for(let f=0;f<o.count;f++)s.setX(h+f,c+o.getX(f));for(let f=o.count,d=u;f<d;f++)s.setX(h+f,c);s.needsUpdate=!0,s.addUpdateRange(h,a.reservedIndexCount)}return a.start=i?a.indexStart:a.vertexStart,a.count=i?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 n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((o,a)=>a).sort((o,a)=>n[o].vertexStart-n[a].vertexStart),s=this.geometry;for(let o=0,a=n.length;o<a;o++){const c=i[o],l=n[c];if(l.active!==!1){if(s.index!==null){if(l.indexStart!==t){const{indexStart:h,vertexStart:u,reservedIndexCount:f}=l,d=s.index,g=d.array,_=e-u;for(let m=h;m<h+f;m++)g[m]=g[m]+_;d.array.copyWithin(t,h,h+f),d.addUpdateRange(t,f),d.needsUpdate=!0,l.indexStart=t}t+=l.reservedIndexCount}if(l.vertexStart!==e){const{vertexStart:h,reservedVertexCount:u}=l,f=s.attributes;for(const d in f){const g=f[d],{array:_,itemSize:m}=g;_.copyWithin(e*m,h*m,(h+u)*m),g.addUpdateRange(e*m,u*m),g.needsUpdate=!0}l.vertexStart=e}e+=l.reservedVertexCount,l.start=s.index?l.indexStart:l.vertexStart,this._nextIndexStart=s.index?l.indexStart+l.reservedIndexCount:0,this._nextVertexStart=l.vertexStart+l.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new Gt,o=n.index,a=n.attributes.position;for(let c=i.start,l=i.start+i.count;c<l;c++){let h=c;o&&(h=o.getX(h)),s.expandByPoint(so.fromBufferAttribute(a,h))}i.boundingBox=s}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new Pt;this.getBoundingBoxAt(e,xc),xc.getCenter(s.center);const o=n.index,a=n.attributes.position;let c=0;for(let l=i.start,h=i.start+i.count;l<h;l++){let u=l;o&&(u=o.getX(u)),so.fromBufferAttribute(a,u),c=Math.max(c,s.center.distanceToSquared(so))}s.radius=Math.sqrt(c),i.boundingSphere=s}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.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 n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(Uh);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);tr(this._multiDrawCounts,i),tr(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,c=this._colorsTexture;o.dispose(),this._initIndirectTexture(),tr(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),tr(a.image.data,this._matricesTexture.image.data),c&&(c.dispose(),this._initColorsTexture(),tr(c.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...n.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(...n.map(c=>c.indexStart+c.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 Ke,this._initializeGeometry(s));const o=this.geometry;s.index&&tr(s.index.array,o.index.array);for(const a in s.attributes)tr(s.attributes[a].array,o.attributes[a].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;jt.material=this.material,jt.geometry.index=o.index,jt.geometry.attributes=o.attributes,jt.geometry.boundingBox===null&&(jt.geometry.boundingBox=new Gt),jt.geometry.boundingSphere===null&&(jt.geometry.boundingSphere=new Pt);for(let a=0,c=n.length;a<c;a++){if(!n[a].visible||!n[a].active)continue;const l=n[a].geometryIndex,h=i[l];jt.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(a,jt.matrixWorld).premultiply(s),this.getBoundingBoxAt(l,jt.geometry.boundingBox),this.getBoundingSphereAt(l,jt.geometry.boundingSphere),jt.raycast(e,Ac);for(let u=0,f=Ac.length;u<f;u++){const d=Ac[u];d.object=this,d.batchId=a,t.push(d)}Ac.length=0}jt.material=null,jt.geometry.index=null,jt.geometry.attributes={},jt.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._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,c=this._instanceInfo,l=this._multiDrawStarts,h=this._multiDrawCounts,u=this._geometryInfo,f=this.perObjectFrustumCulled,d=this._indirectTexture,g=d.image.data,_=n.isArrayCamera?Q_:Hd;f&&!n.isArrayCamera&&(dn.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Hd.setFromProjectionMatrix(dn,n.coordinateSystem,n.reversedDepth));let m=0;if(this.sortObjects){dn.copy(this.matrixWorld).invert(),so.setFromMatrixPosition(n.matrixWorld).applyMatrix4(dn),Gd.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(dn);for(let y=0,x=c.length;y<x;y++)if(c[y].visible&&c[y].active){const A=c[y].geometryIndex;this.getMatrixAt(y,dn),this.getBoundingSphereAt(A,er).applyMatrix4(dn);let E=!1;if(f&&(E=!_.intersectsSphere(er,n)),!E){const I=u[A],D=K_.subVectors(er.center,so).dot(Gd);Bh.push(I.start,I.count,D,y)}}const p=Bh.list,v=this.customSort;v===null?p.sort(s.transparent?X_:q_):v.call(this,p,n);for(let y=0,x=p.length;y<x;y++){const A=p[y];l[m]=A.start*a,h[m]=A.count,g[m]=A.index,m++}Bh.reset()}else for(let p=0,v=c.length;p<v;p++)if(c[p].visible&&c[p].active){const y=c[p].geometryIndex;let x=!1;if(f&&(this.getMatrixAt(p,dn),this.getBoundingSphereAt(y,er).applyMatrix4(dn),x=!_.intersectsSphere(er,n)),!x){const A=u[y];l[m]=A.start*a,h[m]=A.count,g[m]=p,m++}}d.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class qt extends zt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new xe(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 bc=new U,wc=new U,qd=new We,oo=new Kr,Sc=new Pt,Oh=new U,Xd=new U;class di extends ct{constructor(e=new Ke,t=new qt){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)bc.fromBufferAttribute(t,i-1),wc.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=bc.distanceTo(wc);e.setAttribute("lineDistance",new Be(n,1))}else Te("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Sc.copy(n.boundingSphere),Sc.applyMatrix4(i),Sc.radius+=s,e.ray.intersectsSphere(Sc)===!1)return;qd.copy(i).invert(),oo.copy(e.ray).applyMatrix4(qd);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,h=n.index,f=n.attributes.position;if(h!==null){const d=Math.max(0,o.start),g=Math.min(h.count,o.start+o.count);for(let _=d,m=g-1;_<m;_+=l){const p=h.getX(_),v=h.getX(_+1),y=Mc(this,e,oo,c,p,v,_);y&&t.push(y)}if(this.isLineLoop){const _=h.getX(g-1),m=h.getX(d),p=Mc(this,e,oo,c,_,m,g-1);p&&t.push(p)}}else{const d=Math.max(0,o.start),g=Math.min(f.count,o.start+o.count);for(let _=d,m=g-1;_<m;_+=l){const p=Mc(this,e,oo,c,_,_+1,_);p&&t.push(p)}if(this.isLineLoop){const _=Mc(this,e,oo,c,g-1,d,g-1);_&&t.push(_)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Mc(r,e,t,n,i,s,o){const a=r.geometry.attributes.position;if(bc.fromBufferAttribute(a,i),wc.fromBufferAttribute(a,s),t.distanceSqToSegment(bc,wc,Oh,Xd)>n)return;Oh.applyMatrix4(r.matrixWorld);const l=e.ray.origin.distanceTo(Oh);if(!(l<e.near||l>e.far))return{distance:l,point:Xd.clone().applyMatrix4(r.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:r}}const Zd=new U,Yd=new U;class In extends di{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Zd.fromBufferAttribute(t,i),Yd.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Zd.distanceTo(Yd);e.setAttribute("lineDistance",new Be(n,1))}else Te("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Fh extends di{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Ec extends zt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new xe(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 Qd=new We,zh=new Kr,Tc=new Pt,Cc=new U;class kh extends ct{constructor(e=new Ke,t=new Ec){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Tc.copy(n.boundingSphere),Tc.applyMatrix4(i),Tc.radius+=s,e.ray.intersectsSphere(Tc)===!1)return;Qd.copy(i).invert(),zh.copy(e.ray).applyMatrix4(Qd);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=n.index,u=n.attributes.position;if(l!==null){const f=Math.max(0,o.start),d=Math.min(l.count,o.start+o.count);for(let g=f,_=d;g<_;g++){const m=l.getX(g);Cc.fromBufferAttribute(u,m),Kd(Cc,m,c,i,e,t,this)}}else{const f=Math.max(0,o.start),d=Math.min(u.count,o.start+o.count);for(let g=f,_=d;g<_;g++)Cc.fromBufferAttribute(u,g),Kd(Cc,g,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Kd(r,e,t,n,i,s,o){const a=zh.distanceSqToPoint(r);if(a<t){const c=new U;zh.closestPointToPoint(r,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class jd extends xt{constructor(e,t,n,i,s=pt,o=pt,a,c,l){super(e,t,n,i,s,o,a,c,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;function u(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=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)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class J_ extends jd{constructor(e,t,n,i,s,o,a,c){super({},e,t,n,i,s,o,a,c),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class $_ extends xt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Mt,this.minFilter=Mt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ic extends xt{constructor(e,t,n,i,s,o,a,c,l,h,u,f){super(null,o,a,c,l,h,i,s,u,f),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class ev extends Ic{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=tn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class tv extends Ic{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Xn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class nv extends xt{constructor(e,t,n,i,s,o,a,c,l){super(e,t,n,i,s,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ds extends xt{constructor(e,t,n=En,i,s,o,a=Mt,c=Mt,l,h=Yn,u=1){if(h!==Yn&&h!==xi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:u};super(f,i,s,o,a,c,h,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new wi(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Jd extends ds{constructor(e,t=En,n=Xn,i,s,o=Mt,a=Mt,c,l=Yn){const h={width:e,height:e,depth:1},u=[h,h,h,h,h,h];super(e,e,t,n,i,s,o,a,c,l),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Vh extends xt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Rc extends Ke{constructor(e=1,t=1,n=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:s},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const o=[],a=[],c=[],l=[],h=t/2,u=Math.PI/2*e,f=t,d=2*u+f,g=n*2+s,_=i+1,m=new U,p=new U;for(let v=0;v<=g;v++){let y=0,x=0,A=0,E=0;if(v<=n){const b=v/n,C=b*Math.PI/2;x=-h-e*Math.cos(C),A=e*Math.sin(C),E=-e*Math.cos(C),y=b*u}else if(v<=n+s){const b=(v-n)/s;x=-h+b*t,A=e,E=0,y=u+b*f}else{const b=(v-n-s)/n,C=b*Math.PI/2;x=h+e*Math.sin(C),A=e*Math.cos(C),E=e*Math.sin(C),y=u+f+b*u}const I=Math.max(0,Math.min(1,y/d));let D=0;v===0?D=.5/i:v===g&&(D=-.5/i);for(let b=0;b<=i;b++){const C=b/i,B=C*Math.PI*2,R=Math.sin(B),O=Math.cos(B);p.x=-A*O,p.y=x,p.z=A*R,a.push(p.x,p.y,p.z),m.set(-A*O,E,A*R),m.normalize(),c.push(m.x,m.y,m.z),l.push(C+D,I)}if(v>0){const b=(v-1)*_;for(let C=0;C<i;C++){const B=b+C,R=b+C+1,O=v*_+C,M=v*_+C+1;o.push(B,R,O),o.push(R,M,O)}}}this.setIndex(o),this.setAttribute("position",new Be(a,3)),this.setAttribute("normal",new Be(c,3)),this.setAttribute("uv",new Be(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Rc(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Pc extends Ke{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],o=[],a=[],c=[],l=new U,h=new he;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let u=0,f=3;u<=t;u++,f+=3){const d=n+u/t*i;l.x=e*Math.cos(d),l.y=e*Math.sin(d),o.push(l.x,l.y,l.z),a.push(0,0,1),h.x=(o[f]/e+1)/2,h.y=(o[f+1]/e+1)/2,c.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 Be(o,3)),this.setAttribute("normal",new Be(a,3)),this.setAttribute("uv",new Be(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pc(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ao extends Ke{constructor(e=1,t=1,n=1,i=32,s=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:c};const l=this;i=Math.floor(i),s=Math.floor(s);const h=[],u=[],f=[],d=[];let g=0;const _=[],m=n/2;let p=0;v(),o===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new Be(u,3)),this.setAttribute("normal",new Be(f,3)),this.setAttribute("uv",new Be(d,2));function v(){const x=new U,A=new U;let E=0;const I=(t-e)/n;for(let D=0;D<=s;D++){const b=[],C=D/s,B=C*(t-e)+e;for(let R=0;R<=i;R++){const O=R/i,M=O*c+a,z=Math.sin(M),X=Math.cos(M);A.x=B*z,A.y=-C*n+m,A.z=B*X,u.push(A.x,A.y,A.z),x.set(z,I,X).normalize(),f.push(x.x,x.y,x.z),d.push(O,1-C),b.push(g++)}_.push(b)}for(let D=0;D<i;D++)for(let b=0;b<s;b++){const C=_[b][D],B=_[b+1][D],R=_[b+1][D+1],O=_[b][D+1];(e>0||b!==0)&&(h.push(C,B,O),E+=3),(t>0||b!==s-1)&&(h.push(B,R,O),E+=3)}l.addGroup(p,E,0),p+=E}function y(x){const A=g,E=new he,I=new U;let D=0;const b=x===!0?e:t,C=x===!0?1:-1;for(let R=1;R<=i;R++)u.push(0,m*C,0),f.push(0,C,0),d.push(.5,.5),g++;const B=g;for(let R=0;R<=i;R++){const M=R/i*c+a,z=Math.cos(M),X=Math.sin(M);I.x=b*X,I.y=m*C,I.z=b*z,u.push(I.x,I.y,I.z),f.push(0,C,0),E.x=z*.5+.5,E.y=X*.5*C+.5,d.push(E.x,E.y),g++}for(let R=0;R<i;R++){const O=A+R,M=B+R;x===!0?h.push(M,M+1,O):h.push(M+1,M,O),D+=3}l.addGroup(p,D,x===!0?1:2),p+=D}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ao(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class co extends ao{constructor(e=1,t=1,n=32,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new co(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Pi extends Ke{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];a(i),l(n),h(),this.setAttribute("position",new Be(s,3)),this.setAttribute("normal",new Be(s.slice(),3)),this.setAttribute("uv",new Be(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(v){const y=new U,x=new U,A=new U;for(let E=0;E<t.length;E+=3)d(t[E+0],y),d(t[E+1],x),d(t[E+2],A),c(y,x,A,v)}function c(v,y,x,A){const E=A+1,I=[];for(let D=0;D<=E;D++){I[D]=[];const b=v.clone().lerp(x,D/E),C=y.clone().lerp(x,D/E),B=E-D;for(let R=0;R<=B;R++)R===0&&D===E?I[D][R]=b:I[D][R]=b.clone().lerp(C,R/B)}for(let D=0;D<E;D++)for(let b=0;b<2*(E-D)-1;b++){const C=Math.floor(b/2);b%2===0?(f(I[D][C+1]),f(I[D+1][C]),f(I[D][C])):(f(I[D][C+1]),f(I[D+1][C+1]),f(I[D+1][C]))}}function l(v){const y=new U;for(let x=0;x<s.length;x+=3)y.x=s[x+0],y.y=s[x+1],y.z=s[x+2],y.normalize().multiplyScalar(v),s[x+0]=y.x,s[x+1]=y.y,s[x+2]=y.z}function h(){const v=new U;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 x=m(v)/2/Math.PI+.5,A=p(v)/Math.PI+.5;o.push(x,1-A)}g(),u()}function u(){for(let v=0;v<o.length;v+=6){const y=o[v+0],x=o[v+2],A=o[v+4],E=Math.max(y,x,A),I=Math.min(y,x,A);E>.9&&I<.1&&(y<.2&&(o[v+0]+=1),x<.2&&(o[v+2]+=1),A<.2&&(o[v+4]+=1))}}function f(v){s.push(v.x,v.y,v.z)}function d(v,y){const x=v*3;y.x=e[x+0],y.y=e[x+1],y.z=e[x+2]}function g(){const v=new U,y=new U,x=new U,A=new U,E=new he,I=new he,D=new he;for(let b=0,C=0;b<s.length;b+=9,C+=6){v.set(s[b+0],s[b+1],s[b+2]),y.set(s[b+3],s[b+4],s[b+5]),x.set(s[b+6],s[b+7],s[b+8]),E.set(o[C+0],o[C+1]),I.set(o[C+2],o[C+3]),D.set(o[C+4],o[C+5]),A.copy(v).add(y).add(x).divideScalar(3);const B=m(A);_(E,C+0,v,B),_(I,C+2,y,B),_(D,C+4,x,B)}}function _(v,y,x,A){A<0&&v.x===1&&(o[y]=v.x-1),x.x===0&&x.z===0&&(o[y]=A/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 Pi(e.vertices,e.indices,e.radius,e.detail)}}class Dc extends Pi{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],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 Dc(e.radius,e.detail)}}const Lc=new U,Nc=new U,Hh=new U,Uc=new hn;class $d extends Ke{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(Zi*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,l=[0,0,0],h=["a","b","c"],u=new Array(3),f={},d=[];for(let g=0;g<c;g+=3){o?(l[0]=o.getX(g),l[1]=o.getX(g+1),l[2]=o.getX(g+2)):(l[0]=g,l[1]=g+1,l[2]=g+2);const{a:_,b:m,c:p}=Uc;if(_.fromBufferAttribute(a,l[0]),m.fromBufferAttribute(a,l[1]),p.fromBufferAttribute(a,l[2]),Uc.getNormal(Hh),u[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,u[1]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,u[2]=`${Math.round(p.x*i)},${Math.round(p.y*i)},${Math.round(p.z*i)}`,!(u[0]===u[1]||u[1]===u[2]||u[2]===u[0]))for(let v=0;v<3;v++){const y=(v+1)%3,x=u[v],A=u[y],E=Uc[h[v]],I=Uc[h[y]],D=`${x}_${A}`,b=`${A}_${x}`;b in f&&f[b]?(Hh.dot(f[b].normal)<=s&&(d.push(E.x,E.y,E.z),d.push(I.x,I.y,I.z)),f[b]=null):D in f||(f[D]={index0:l[v],index1:l[y],normal:Hh.clone()})}}for(const g in f)if(f[g]){const{index0:_,index1:m}=f[g];Lc.fromBufferAttribute(a,_),Nc.fromBufferAttribute(a,m),d.push(Lc.x,Lc.y,Lc.z),d.push(Nc.x,Nc.y,Nc.z)}this.setAttribute("position",new Be(d,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class zn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Te("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,c=s-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(s-1);const h=n[i],f=n[i+1]-h,d=(o-h)/f;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),c=t||(o.isVector2?new he:new U);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new U,i=[],s=[],o=[],a=new U,c=new We;for(let d=0;d<=e;d++){const g=d/e;i[d]=this.getTangentAt(g,new U)}s[0]=new U,o[0]=new U;let l=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);h<=l&&(l=h,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),f<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(Qe(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(c.makeRotationAxis(a,g))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(Qe(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let g=1;g<=e;g++)s[g].applyMatrix4(c.makeRotationAxis(i[g],d*g)),o[g].crossVectors(i[g],s[g])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Bc extends zn{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new he){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),f=c-this.aX,d=l-this.aY;c=f*h-d*u+this.aX,l=f*u+d*h+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class ep extends Bc{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function Gh(){let r=0,e=0,t=0,n=0;function i(s,o,a,c){r=s,e=a,t=-3*s+3*o-2*a-c,n=2*s-2*o+a+c}return{initCatmullRom:function(s,o,a,c,l){i(o,a,l*(a-s),l*(c-o))},initNonuniformCatmullRom:function(s,o,a,c,l,h,u){let f=(o-s)/l-(a-s)/(l+h)+(a-o)/h,d=(a-o)/h-(c-o)/(h+u)+(c-a)/u;f*=h,d*=h,i(o,a,f,d)},calc:function(s){const o=s*s,a=o*s;return r+e*s+t*o+n*a}}}const Oc=new U,Wh=new Gh,qh=new Gh,Xh=new Gh;class tp extends zn{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new U){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:c===0&&a===s-1&&(a=s-2,c=1);let l,h;this.closed||a>0?l=i[(a-1)%s]:(Oc.subVectors(i[0],i[1]).add(i[0]),l=Oc);const u=i[a%s],f=i[(a+1)%s];if(this.closed||a+2<s?h=i[(a+2)%s]:(Oc.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=Oc),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let g=Math.pow(l.distanceToSquared(u),d),_=Math.pow(u.distanceToSquared(f),d),m=Math.pow(f.distanceToSquared(h),d);_<1e-4&&(_=1),g<1e-4&&(g=_),m<1e-4&&(m=_),Wh.initNonuniformCatmullRom(l.x,u.x,f.x,h.x,g,_,m),qh.initNonuniformCatmullRom(l.y,u.y,f.y,h.y,g,_,m),Xh.initNonuniformCatmullRom(l.z,u.z,f.z,h.z,g,_,m)}else this.curveType==="catmullrom"&&(Wh.initCatmullRom(l.x,u.x,f.x,h.x,this.tension),qh.initCatmullRom(l.y,u.y,f.y,h.y,this.tension),Xh.initCatmullRom(l.z,u.z,f.z,h.z,this.tension));return n.set(Wh.calc(c),qh.calc(c),Xh.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new U().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function np(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,a=r*r,c=r*a;return(2*t-2*n+s+o)*c+(-3*t+3*n-2*s-o)*a+s*r+t}function iv(r,e){const t=1-r;return t*t*e}function rv(r,e){return 2*(1-r)*r*e}function sv(r,e){return r*r*e}function lo(r,e,t,n){return iv(r,e)+rv(r,t)+sv(r,n)}function ov(r,e){const t=1-r;return t*t*t*e}function av(r,e){const t=1-r;return 3*t*t*r*e}function cv(r,e){return 3*(1-r)*r*r*e}function lv(r,e){return r*r*r*e}function ho(r,e,t,n,i){return ov(r,e)+av(r,t)+cv(r,n)+lv(r,i)}class Zh extends zn{constructor(e=new he,t=new he,n=new he,i=new he){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new he){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(ho(e,i.x,s.x,o.x,a.x),ho(e,i.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class ip extends zn{constructor(e=new U,t=new U,n=new U,i=new U){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new U){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(ho(e,i.x,s.x,o.x,a.x),ho(e,i.y,s.y,o.y,a.y),ho(e,i.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Yh extends zn{constructor(e=new he,t=new he){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new he){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new he){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 rp extends zn{constructor(e=new U,t=new U){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new U){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new U){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 Qh extends zn{constructor(e=new he,t=new he,n=new he){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new he){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(lo(e,i.x,s.x,o.x),lo(e,i.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Kh extends zn{constructor(e=new U,t=new U,n=new U){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new U){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(lo(e,i.x,s.x,o.x),lo(e,i.y,s.y,o.y),lo(e,i.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class jh extends zn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new he){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,c=i[o===0?o:o-1],l=i[o],h=i[o>i.length-2?i.length-1:o+1],u=i[o>i.length-3?i.length-1:o+2];return n.set(np(a,c.x,l.x,h.x,u.x),np(a,c.y,l.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new he().fromArray(i))}return this}}var Fc=Object.freeze({__proto__:null,ArcCurve:ep,CatmullRomCurve3:tp,CubicBezierCurve:Zh,CubicBezierCurve3:ip,EllipseCurve:Bc,LineCurve:Yh,LineCurve3:rp,QuadraticBezierCurve:Qh,QuadraticBezierCurve3:Kh,SplineCurve:jh});class sp extends zn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Fc[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const o=i[s]-n,a=this.curves[s],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){const h=c[l];n&&n.equals(h)||(t.push(h),n=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,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Fc[i.type]().fromJSON(i))}return this}}class zc extends sp{constructor(e){super(),this.type="Path",this.currentPoint=new he,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Yh(this.currentPoint.clone(),new he(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Qh(this.currentPoint.clone(),new he(e,t),new he(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const a=new Zh(this.currentPoint.clone(),new he(e,t),new he(n,i),new he(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new jh(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,a,c){const l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,n,i,s,o,a,c),this}absellipse(e,t,n,i,s,o,a,c){const l=new Bc(e,t,n,i,s,o,a,c);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);const h=l.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 nr extends zc{constructor(e){super(e),this.uuid=_n(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new zc().fromJSON(i))}return this}}function hv(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=op(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,c,l;if(n&&(s=mv(r,e,s,t)),r.length>80*t){a=r[0],c=r[1];let h=a,u=c;for(let f=t;f<i;f+=t){const d=r[f],g=r[f+1];d<a&&(a=d),g<c&&(c=g),d>h&&(h=d),g>u&&(u=g)}l=Math.max(h-a,u-c),l=l!==0?32767/l:0}return uo(s,o,t,a,c,l,0),o}function op(r,e,t,n,i){let s;if(i===Ev(r,e,t,n)>0)for(let o=e;o<t;o+=n)s=hp(o/n|0,r[o],r[o+1],s);else for(let o=t-n;o>=e;o-=n)s=hp(o/n|0,r[o],r[o+1],s);return s&&ps(s,s.next)&&(mo(s),s=s.next),s}function ir(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ps(t,t.next)||Et(t.prev,t,t.next)===0)){if(mo(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function uo(r,e,t,n,i,s,o){if(!r)return;!o&&s&&xv(r,n,i,s);let a=r;for(;r.prev!==r.next;){const c=r.prev,l=r.next;if(s?fv(r,n,i,s):uv(r)){e.push(c.i,r.i,l.i),mo(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=dv(ir(r),e),uo(r,e,t,n,i,s,2)):o===2&&pv(r,e,t,n,i,s):uo(ir(r),e,t,n,i,s,1);break}}}function uv(r){const e=r.prev,t=r,n=r.next;if(Et(e,t,n)>=0)return!1;const i=e.x,s=t.x,o=n.x,a=e.y,c=t.y,l=n.y,h=Math.min(i,s,o),u=Math.min(a,c,l),f=Math.max(i,s,o),d=Math.max(a,c,l);let g=n.next;for(;g!==e;){if(g.x>=h&&g.x<=f&&g.y>=u&&g.y<=d&&fo(i,a,s,c,o,l,g.x,g.y)&&Et(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function fv(r,e,t,n){const i=r.prev,s=r,o=r.next;if(Et(i,s,o)>=0)return!1;const a=i.x,c=s.x,l=o.x,h=i.y,u=s.y,f=o.y,d=Math.min(a,c,l),g=Math.min(h,u,f),_=Math.max(a,c,l),m=Math.max(h,u,f),p=Jh(d,g,e,t,n),v=Jh(_,m,e,t,n);let y=r.prevZ,x=r.nextZ;for(;y&&y.z>=p&&x&&x.z<=v;){if(y.x>=d&&y.x<=_&&y.y>=g&&y.y<=m&&y!==i&&y!==o&&fo(a,h,c,u,l,f,y.x,y.y)&&Et(y.prev,y,y.next)>=0||(y=y.prevZ,x.x>=d&&x.x<=_&&x.y>=g&&x.y<=m&&x!==i&&x!==o&&fo(a,h,c,u,l,f,x.x,x.y)&&Et(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;y&&y.z>=p;){if(y.x>=d&&y.x<=_&&y.y>=g&&y.y<=m&&y!==i&&y!==o&&fo(a,h,c,u,l,f,y.x,y.y)&&Et(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=v;){if(x.x>=d&&x.x<=_&&x.y>=g&&x.y<=m&&x!==i&&x!==o&&fo(a,h,c,u,l,f,x.x,x.y)&&Et(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function dv(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ps(n,i)&&cp(n,t,t.next,i)&&po(n,i)&&po(i,n)&&(e.push(n.i,t.i,i.i),mo(t),mo(t.next),t=r=i),t=t.next}while(t!==r);return ir(t)}function pv(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&wv(o,a)){let c=lp(o,a);o=ir(o,o.next),c=ir(c,c.next),uo(o,e,t,n,i,s,0),uo(c,e,t,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function mv(r,e,t,n){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*n,c=s<o-1?e[s+1]*n:r.length,l=op(r,a,c,n,!1);l===l.next&&(l.steiner=!0),i.push(bv(l))}i.sort(gv);for(let s=0;s<i.length;s++)t=_v(i[s],t);return t}function gv(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function _v(r,e){const t=vv(r,e);if(!t)return e;const n=lp(t,r);return ir(n,n.next),ir(t,t.next)}function vv(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;if(ps(r,t))return t;do{if(ps(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const u=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>s&&(s=u,o=t.x<t.next.x?t:t.next,u===n))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,c=o.x,l=o.y;let h=1/0;t=o;do{if(n>=t.x&&t.x>=c&&n!==t.x&&ap(i<l?n:s,i,c,l,i<l?s:n,i,t.x,t.y)){const u=Math.abs(i-t.y)/(n-t.x);po(t,r)&&(u<h||u===h&&(t.x>o.x||t.x===o.x&&yv(o,t)))&&(o=t,h=u)}t=t.next}while(t!==a);return o}function yv(r,e){return Et(r.prev,r,e.prev)<0&&Et(e.next,r,r.next)<0}function xv(r,e,t,n){let i=r;do i.z===0&&(i.z=Jh(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Av(i)}function Av(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let l=0;l<t&&(a++,o=o.nextZ,!!o);l++);let c=t;for(;a>0||c>0&&o;)a!==0&&(c===0||!o||n.z<=o.z)?(i=n,n=n.nextZ,a--):(i=o,o=o.nextZ,c--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=o}s.nextZ=null,t*=2}while(e>1);return r}function Jh(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function bv(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function ap(r,e,t,n,i,s,o,a){return(i-o)*(e-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(n-a)}function fo(r,e,t,n,i,s,o,a){return!(r===o&&e===a)&&ap(r,e,t,n,i,s,o,a)}function wv(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Sv(r,e)&&(po(r,e)&&po(e,r)&&Mv(r,e)&&(Et(r.prev,r,e.prev)||Et(r,e.prev,e))||ps(r,e)&&Et(r.prev,r,r.next)>0&&Et(e.prev,e,e.next)>0)}function Et(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ps(r,e){return r.x===e.x&&r.y===e.y}function cp(r,e,t,n){const i=Vc(Et(r,e,t)),s=Vc(Et(r,e,n)),o=Vc(Et(t,n,r)),a=Vc(Et(t,n,e));return!!(i!==s&&o!==a||i===0&&kc(r,t,e)||s===0&&kc(r,n,e)||o===0&&kc(t,r,n)||a===0&&kc(t,e,n))}function kc(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Vc(r){return r>0?1:r<0?-1:0}function Sv(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&cp(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function po(r,e){return Et(r.prev,r,r.next)<0?Et(r,e,r.next)>=0&&Et(r,r.prev,e)>=0:Et(r,e,r.prev)<0||Et(r,r.next,e)<0}function Mv(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function lp(r,e){const t=$h(r.i,r.x,r.y),n=$h(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function hp(r,e,t,n){const i=$h(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function mo(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function $h(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ev(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class Tv{static triangulate(e,t,n=2){return hv(e,t,n)}}class kn{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return kn.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];up(e),fp(n,e);let o=e.length;t.forEach(up);for(let c=0;c<t.length;c++)i.push(o),o+=t[c].length,fp(n,t[c]);const a=Tv.triangulate(n,i);for(let c=0;c<a.length;c+=3)s.push(a.slice(c,c+3));return s}}function up(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function fp(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Hc extends Ke{constructor(e=new nr([new he(.5,.5),new he(-.5,.5),new he(-.5,-.5),new he(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];o(l)}this.setAttribute("position",new Be(i,3)),this.setAttribute("uv",new Be(s,2)),this.computeVertexNormals();function o(a){const c=[],l=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1;let f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,g=t.bevelSize!==void 0?t.bevelSize:d-.1,_=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:Cv;let y,x=!1,A,E,I,D;if(p){y=p.getSpacedPoints(h),x=!0,f=!1;const w=p.isCatmullRomCurve3?p.closed:!1;A=p.computeFrenetFrames(h,w),E=new U,I=new U,D=new U}f||(m=0,d=0,g=0,_=0);const b=a.extractPoints(l);let C=b.shape;const B=b.holes;if(!kn.isClockWise(C)){C=C.reverse();for(let w=0,q=B.length;w<q;w++){const k=B[w];kn.isClockWise(k)&&(B[w]=k.reverse())}}function O(w){const k=10000000000000001e-36;let N=w[0];for(let S=1;S<=w.length;S++){const G=S%w.length,K=w[G],ie=K.x-N.x,V=K.y-N.y,P=ie*ie+V*V,T=Math.max(Math.abs(K.x),Math.abs(K.y),Math.abs(N.x),Math.abs(N.y)),F=k*T*T;if(P<=F){w.splice(G,1),S--;continue}N=K}}O(C),B.forEach(O);const M=B.length,z=C;for(let w=0;w<M;w++){const q=B[w];C=C.concat(q)}function X(w,q,k){return q||Ge("ExtrudeGeometry: vec does not exist"),w.clone().addScaledVector(q,k)}const H=C.length;function re(w,q,k){let N,S,G;const K=w.x-q.x,ie=w.y-q.y,V=k.x-w.x,P=k.y-w.y,T=K*K+ie*ie,F=K*P-ie*V;if(Math.abs(F)>Number.EPSILON){const Q=Math.sqrt(T),ce=Math.sqrt(V*V+P*P),te=q.x-ie/Q,Re=q.y+K/Q,we=k.x-P/ce,Le=k.y+V/ce,Xe=((we-te)*P-(Le-Re)*V)/(K*P-ie*V);N=te+K*Xe-w.x,S=Re+ie*Xe-w.y;const fe=N*N+S*S;if(fe<=2)return new he(N,S);G=Math.sqrt(fe/2)}else{let Q=!1;K>Number.EPSILON?V>Number.EPSILON&&(Q=!0):K<-Number.EPSILON?V<-Number.EPSILON&&(Q=!0):Math.sign(ie)===Math.sign(P)&&(Q=!0),Q?(N=-ie,S=K,G=Math.sqrt(T)):(N=K,S=ie,G=Math.sqrt(T/2))}return new he(N/G,S/G)}const $=[];for(let w=0,q=z.length,k=q-1,N=w+1;w<q;w++,k++,N++)k===q&&(k=0),N===q&&(N=0),$[w]=re(z[w],z[k],z[N]);const le=[];let W,Z=$.concat();for(let w=0,q=M;w<q;w++){const k=B[w];W=[];for(let N=0,S=k.length,G=S-1,K=N+1;N<S;N++,G++,K++)G===S&&(G=0),K===S&&(K=0),W[N]=re(k[N],k[G],k[K]);le.push(W),Z=Z.concat(W)}let ge;if(m===0)ge=kn.triangulateShape(z,B);else{const w=[],q=[];for(let k=0;k<m;k++){const N=k/m,S=d*Math.cos(N*Math.PI/2),G=g*Math.sin(N*Math.PI/2)+_;for(let K=0,ie=z.length;K<ie;K++){const V=X(z[K],$[K],G);ye(V.x,V.y,-S),N===0&&w.push(V)}for(let K=0,ie=M;K<ie;K++){const V=B[K];W=le[K];const P=[];for(let T=0,F=V.length;T<F;T++){const Q=X(V[T],W[T],G);ye(Q.x,Q.y,-S),N===0&&P.push(Q)}N===0&&q.push(P)}}ge=kn.triangulateShape(w,q)}const _e=ge.length,de=g+_;for(let w=0;w<H;w++){const q=f?X(C[w],Z[w],de):C[w];x?(I.copy(A.normals[0]).multiplyScalar(q.x),E.copy(A.binormals[0]).multiplyScalar(q.y),D.copy(y[0]).add(I).add(E),ye(D.x,D.y,D.z)):ye(q.x,q.y,0)}for(let w=1;w<=h;w++)for(let q=0;q<H;q++){const k=f?X(C[q],Z[q],de):C[q];x?(I.copy(A.normals[w]).multiplyScalar(k.x),E.copy(A.binormals[w]).multiplyScalar(k.y),D.copy(y[w]).add(I).add(E),ye(D.x,D.y,D.z)):ye(k.x,k.y,u/h*w)}for(let w=m-1;w>=0;w--){const q=w/m,k=d*Math.cos(q*Math.PI/2),N=g*Math.sin(q*Math.PI/2)+_;for(let S=0,G=z.length;S<G;S++){const K=X(z[S],$[S],N);ye(K.x,K.y,u+k)}for(let S=0,G=B.length;S<G;S++){const K=B[S];W=le[S];for(let ie=0,V=K.length;ie<V;ie++){const P=X(K[ie],W[ie],N);x?ye(P.x,P.y+y[h-1].y,y[h-1].x+k):ye(P.x,P.y,u+k)}}}oe(),ee();function oe(){const w=i.length/3;if(f){let q=0,k=H*q;for(let N=0;N<_e;N++){const S=ge[N];Ae(S[2]+k,S[1]+k,S[0]+k)}q=h+m*2,k=H*q;for(let N=0;N<_e;N++){const S=ge[N];Ae(S[0]+k,S[1]+k,S[2]+k)}}else{for(let q=0;q<_e;q++){const k=ge[q];Ae(k[2],k[1],k[0])}for(let q=0;q<_e;q++){const k=ge[q];Ae(k[0]+H*h,k[1]+H*h,k[2]+H*h)}}n.addGroup(w,i.length/3-w,0)}function ee(){const w=i.length/3;let q=0;pe(z,q),q+=z.length;for(let k=0,N=B.length;k<N;k++){const S=B[k];pe(S,q),q+=S.length}n.addGroup(w,i.length/3-w,1)}function pe(w,q){let k=w.length;for(;--k>=0;){const N=k;let S=k-1;S<0&&(S=w.length-1);for(let G=0,K=h+m*2;G<K;G++){const ie=H*G,V=H*(G+1),P=q+N+ie,T=q+S+ie,F=q+S+V,Q=q+N+V;ze(P,T,F,Q)}}}function ye(w,q,k){c.push(w),c.push(q),c.push(k)}function Ae(w,q,k){je(w),je(q),je(k);const N=i.length/3,S=v.generateTopUV(n,i,N-3,N-2,N-1);He(S[0]),He(S[1]),He(S[2])}function ze(w,q,k,N){je(w),je(q),je(N),je(q),je(k),je(N);const S=i.length/3,G=v.generateSideWallUV(n,i,S-6,S-3,S-2,S-1);He(G[0]),He(G[1]),He(G[3]),He(G[1]),He(G[2]),He(G[3])}function je(w){i.push(c[w*3+0]),i.push(c[w*3+1]),i.push(c[w*3+2])}function He(w){s.push(w.x),s.push(w.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Iv(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Fc[i.type]().fromJSON(i)),new Hc(n,e.options)}}const Cv={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1],a=e[n*3],c=e[n*3+1],l=e[i*3],h=e[i*3+1];return[new he(s,o),new he(a,c),new he(l,h)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[n*3],h=e[n*3+1],u=e[n*3+2],f=e[i*3],d=e[i*3+1],g=e[i*3+2],_=e[s*3],m=e[s*3+1],p=e[s*3+2];return Math.abs(a-h)<Math.abs(o-l)?[new he(o,1-c),new he(l,1-u),new he(f,1-g),new he(_,1-p)]:[new he(a,1-c),new he(h,1-u),new he(d,1-g),new he(m,1-p)]}};function Iv(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Gc extends Pi{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Gc(e.radius,e.detail)}}class Wc extends Ke{constructor(e=[new he(0,-.5),new he(.5,0),new he(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Qe(i,0,Math.PI*2);const s=[],o=[],a=[],c=[],l=[],h=1/t,u=new U,f=new he,d=new U,g=new U,_=new U;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,d.x=p*1,d.y=-m,d.z=p*0,_.copy(d),d.normalize(),c.push(d.x,d.y,d.z);break;case e.length-1:c.push(_.x,_.y,_.z);break;default:m=e[v+1].x-e[v].x,p=e[v+1].y-e[v].y,d.x=p*1,d.y=-m,d.z=p*0,g.copy(d),d.x+=_.x,d.y+=_.y,d.z+=_.z,d.normalize(),c.push(d.x,d.y,d.z),_.copy(g)}for(let v=0;v<=t;v++){const y=n+v*h*i,x=Math.sin(y),A=Math.cos(y);for(let E=0;E<=e.length-1;E++){u.x=e[E].x*x,u.y=e[E].y,u.z=e[E].x*A,o.push(u.x,u.y,u.z),f.x=v/t,f.y=E/(e.length-1),a.push(f.x,f.y);const I=c[3*E+0]*x,D=c[3*E+1],b=c[3*E+0]*A;l.push(I,D,b)}}for(let v=0;v<t;v++)for(let y=0;y<e.length-1;y++){const x=y+v*e.length,A=x,E=x+e.length,I=x+e.length+1,D=x+1;s.push(A,E,D),s.push(I,D,E)}this.setIndex(s),this.setAttribute("position",new Be(o,3)),this.setAttribute("uv",new Be(a,2)),this.setAttribute("normal",new Be(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wc(e.points,e.segments,e.phiStart,e.phiLength)}}class go extends Pi{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new go(e.radius,e.detail)}}class rr extends Ke{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,o=t/2,a=Math.floor(n),c=Math.floor(i),l=a+1,h=c+1,u=e/a,f=t/c,d=[],g=[],_=[],m=[];for(let p=0;p<h;p++){const v=p*f-o;for(let y=0;y<l;y++){const x=y*u-s;g.push(x,-v,0),_.push(0,0,1),m.push(y/a),m.push(1-p/c)}}for(let p=0;p<c;p++)for(let v=0;v<a;v++){const y=v+l*p,x=v+l*(p+1),A=v+1+l*(p+1),E=v+1+l*p;d.push(y,x,E),d.push(x,A,E)}this.setIndex(d),this.setAttribute("position",new Be(g,3)),this.setAttribute("normal",new Be(_,3)),this.setAttribute("uv",new Be(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rr(e.width,e.height,e.widthSegments,e.heightSegments)}}class qc extends Ke{constructor(e=.5,t=1,n=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],c=[],l=[],h=[];let u=e;const f=(t-e)/i,d=new U,g=new he;for(let _=0;_<=i;_++){for(let m=0;m<=n;m++){const p=s+m/n*o;d.x=u*Math.cos(p),d.y=u*Math.sin(p),c.push(d.x,d.y,d.z),l.push(0,0,1),g.x=(d.x/t+1)/2,g.y=(d.y/t+1)/2,h.push(g.x,g.y)}u+=f}for(let _=0;_<i;_++){const m=_*(n+1);for(let p=0;p<n;p++){const v=p+m,y=v,x=v+n+1,A=v+n+2,E=v+1;a.push(y,x,E),a.push(x,A,E)}}this.setIndex(a),this.setAttribute("position",new Be(c,3)),this.setAttribute("normal",new Be(l,3)),this.setAttribute("uv",new Be(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qc(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Xc extends Ke{constructor(e=new nr([new he(0,.5),new he(-.5,-.5),new he(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let h=0;h<e.length;h++)l(e[h]),this.addGroup(a,c,h),a+=c,c=0;this.setIndex(n),this.setAttribute("position",new Be(i,3)),this.setAttribute("normal",new Be(s,3)),this.setAttribute("uv",new Be(o,2));function l(h){const u=i.length/3,f=h.extractPoints(t);let d=f.shape;const g=f.holes;kn.isClockWise(d)===!1&&(d=d.reverse());for(let m=0,p=g.length;m<p;m++){const v=g[m];kn.isClockWise(v)===!0&&(g[m]=v.reverse())}const _=kn.triangulateShape(d,g);for(let m=0,p=g.length;m<p;m++){const v=g[m];d=d.concat(v)}for(let m=0,p=d.length;m<p;m++){const v=d[m];i.push(v.x,v.y,0),s.push(0,0,1),o.push(v.x,v.y)}for(let m=0,p=_.length;m<p;m++){const v=_[m],y=v[0]+u,x=v[1]+u,A=v[2]+u;n.push(y,x,A),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return Rv(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new Xc(n,e.curveSegments)}}function Rv(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class ms extends Ke{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(o+a,Math.PI);let l=0;const h=[],u=new U,f=new U,d=[],g=[],_=[],m=[];for(let p=0;p<=n;p++){const v=[],y=p/n;let x=0;p===0&&o===0?x=.5/t:p===n&&c===Math.PI&&(x=-.5/t);for(let A=0;A<=t;A++){const E=A/t;u.x=-e*Math.cos(i+E*s)*Math.sin(o+y*a),u.y=e*Math.cos(o+y*a),u.z=e*Math.sin(i+E*s)*Math.sin(o+y*a),g.push(u.x,u.y,u.z),f.copy(u).normalize(),_.push(f.x,f.y,f.z),m.push(E+x,1-y),v.push(l++)}h.push(v)}for(let p=0;p<n;p++)for(let v=0;v<t;v++){const y=h[p][v+1],x=h[p][v],A=h[p+1][v],E=h[p+1][v+1];(p!==0||o>0)&&d.push(y,x,E),(p!==n-1||c<Math.PI)&&d.push(x,A,E)}this.setIndex(d),this.setAttribute("position",new Be(g,3)),this.setAttribute("normal",new Be(_,3)),this.setAttribute("uv",new Be(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ms(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Zc extends Pi{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Zc(e.radius,e.detail)}}class Yc extends Ke{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],c=[],l=[],h=new U,u=new U,f=new U;for(let d=0;d<=n;d++)for(let g=0;g<=i;g++){const _=g/i*s,m=d/n*Math.PI*2;u.x=(e+t*Math.cos(m))*Math.cos(_),u.y=(e+t*Math.cos(m))*Math.sin(_),u.z=t*Math.sin(m),a.push(u.x,u.y,u.z),h.x=e*Math.cos(_),h.y=e*Math.sin(_),f.subVectors(u,h).normalize(),c.push(f.x,f.y,f.z),l.push(g/i),l.push(d/n)}for(let d=1;d<=n;d++)for(let g=1;g<=i;g++){const _=(i+1)*d+g-1,m=(i+1)*(d-1)+g-1,p=(i+1)*(d-1)+g,v=(i+1)*d+g;o.push(_,m,v),o.push(m,p,v)}this.setIndex(o),this.setAttribute("position",new Be(a,3)),this.setAttribute("normal",new Be(c,3)),this.setAttribute("uv",new Be(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yc(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Qc extends Ke{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],l=[],h=[],u=new U,f=new U,d=new U,g=new U,_=new U,m=new U,p=new U;for(let y=0;y<=n;++y){const x=y/n*s*Math.PI*2;v(x,s,o,e,d),v(x+.01,s,o,e,g),m.subVectors(g,d),p.addVectors(g,d),_.crossVectors(m,p),p.crossVectors(_,m),_.normalize(),p.normalize();for(let A=0;A<=i;++A){const E=A/i*Math.PI*2,I=-t*Math.cos(E),D=t*Math.sin(E);u.x=d.x+(I*p.x+D*_.x),u.y=d.y+(I*p.y+D*_.y),u.z=d.z+(I*p.z+D*_.z),c.push(u.x,u.y,u.z),f.subVectors(u,d).normalize(),l.push(f.x,f.y,f.z),h.push(y/n),h.push(A/i)}}for(let y=1;y<=n;y++)for(let x=1;x<=i;x++){const A=(i+1)*(y-1)+(x-1),E=(i+1)*y+(x-1),I=(i+1)*y+x,D=(i+1)*(y-1)+x;a.push(A,E,D),a.push(E,I,D)}this.setIndex(a),this.setAttribute("position",new Be(c,3)),this.setAttribute("normal",new Be(l,3)),this.setAttribute("uv",new Be(h,2));function v(y,x,A,E,I){const D=Math.cos(y),b=Math.sin(y),C=A/x*y,B=Math.cos(C);I.x=E*(2+B)*.5*D,I.y=E*(2+B)*b*.5,I.z=E*Math.sin(C)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Kc extends Ke{constructor(e=new Kh(new U(-1,-1,0),new U(-1,1,0),new U(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new U,c=new U,l=new he;let h=new U;const u=[],f=[],d=[],g=[];_(),this.setIndex(g),this.setAttribute("position",new Be(u,3)),this.setAttribute("normal",new Be(f,3)),this.setAttribute("uv",new Be(d,2));function _(){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 x=o.normals[y],A=o.binormals[y];for(let E=0;E<=i;E++){const I=E/i*Math.PI*2,D=Math.sin(I),b=-Math.cos(I);c.x=b*x.x+D*A.x,c.y=b*x.y+D*A.y,c.z=b*x.z+D*A.z,c.normalize(),f.push(c.x,c.y,c.z),a.x=h.x+n*c.x,a.y=h.y+n*c.y,a.z=h.z+n*c.z,u.push(a.x,a.y,a.z)}}function p(){for(let y=1;y<=t;y++)for(let x=1;x<=i;x++){const A=(i+1)*(y-1)+(x-1),E=(i+1)*y+(x-1),I=(i+1)*y+x,D=(i+1)*(y-1)+x;g.push(A,E,D),g.push(E,I,D)}}function v(){for(let y=0;y<=t;y++)for(let x=0;x<=i;x++)l.x=y/t,l.y=x/i,d.push(l.x,l.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 Kc(new Fc[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class eu extends Ke{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new U,s=new U;if(e.index!==null){const o=e.attributes.position,a=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:a.count,materialIndex:0}]);for(let l=0,h=c.length;l<h;++l){const u=c[l],f=u.start,d=u.count;for(let g=f,_=f+d;g<_;g+=3)for(let m=0;m<3;m++){const p=a.getX(g+m),v=a.getX(g+(m+1)%3);i.fromBufferAttribute(o,p),s.fromBufferAttribute(o,v),dp(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,c=o.count/3;a<c;a++)for(let l=0;l<3;l++){const h=3*a+l,u=3*a+(l+1)%3;i.fromBufferAttribute(o,h),s.fromBufferAttribute(o,u),dp(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Be(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function dp(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var pp=Object.freeze({__proto__:null,BoxGeometry:ji,CapsuleGeometry:Rc,CircleGeometry:Pc,ConeGeometry:co,CylinderGeometry:ao,DodecahedronGeometry:Dc,EdgesGeometry:$d,ExtrudeGeometry:Hc,IcosahedronGeometry:Gc,LatheGeometry:Wc,OctahedronGeometry:go,PlaneGeometry:rr,PolyhedronGeometry:Pi,RingGeometry:qc,ShapeGeometry:Xc,SphereGeometry:ms,TetrahedronGeometry:Zc,TorusGeometry:Yc,TorusKnotGeometry:Qc,TubeGeometry:Kc,WireframeGeometry:eu});class mp extends zt{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new xe(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 tu extends Cn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class gs extends zt{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new xe(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 xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(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 Zt,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 Rn extends gs{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 he(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Qe(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 xe(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 xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xe(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 gp extends zt{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new xe(16777215),this.specular=new xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zt,this.combine=Ns,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 _p extends zt{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(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 vp extends zt{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(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 yp extends zt{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zt,this.combine=Ns,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 nu extends zt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Yf,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 iu extends zt{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 xp extends zt{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ap extends qt{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 sr(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function bp(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function ru(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let c=0;c!==e;++c)i[o++]=r[a+c]}return i}function su(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push(...o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}function Pv(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let c=0;c<s.tracks.length;++c){const l=s.tracks[c],h=l.getValueSize(),u=[],f=[];for(let d=0;d<l.times.length;++d){const g=l.times[d]*i;if(!(g<t||g>=n)){u.push(l.times[d]);for(let _=0;_<h;++_)f.push(l.values[d*h+_])}}u.length!==0&&(l.times=sr(u,l.times.constructor),l.values=sr(f,l.values.constructor),o.push(l))}s.tracks=o;let a=1/0;for(let c=0;c<s.tracks.length;++c)a>s.tracks[c].times[0]&&(a=s.tracks[c].times[0]);for(let c=0;c<s.tracks.length;++c)s.tracks[c].shift(-1*a);return s.resetDuration(),s}function Dv(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;const l=r.tracks.find(function(p){return p.name===a.name&&p.ValueTypeName===c});if(l===void 0)continue;let h=0;const u=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let f=0;const d=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);const g=a.times.length-1;let _;if(s<=a.times[0]){const p=h,v=u-h;_=a.values.slice(p,v)}else if(s>=a.times[g]){const p=g*u+h,v=p+u-h;_=a.values.slice(p,v)}else{const p=a.createInterpolant(),v=h,y=u-h;p.evaluate(s),_=p.resultBuffer.slice(v,y)}c==="quaternion"&&new wt().fromArray(_).normalize().conjugate().toArray(_);const m=l.times.length;for(let p=0;p<m;++p){const v=p*d+f;if(c==="quaternion")wt.multiplyQuaternionsFlat(l.values,v,_,0,l.values,v);else{const y=d-f*2;for(let x=0;x<y;++x)l.values[v+x]-=_[x]}}}return r.blendMode=$l,r}class Lv{static convertArray(e,t){return sr(e,t)}static isTypedArray(e){return id(e)}static getKeyframeOrder(e){return bp(e)}static sortedArray(e,t,n){return ru(e,t,n)}static flattenJSON(e,t,n,i){su(e,t,n,i)}static subclip(e,t,n,i,s=30){return Pv(e,t,n,i,s)}static makeClipAdditive(e,t=0,n=e,i=30){return Dv(e,t,n,i)}}class _s{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(n=2,s=a);for(let c=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class wp extends _s{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Wi,endingEnd:Wi}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],c=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case qi:s=e,a=2*t-n;break;case Hs:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case qi:o=e,c=2*n-t;break;case Hs:o=1,c=n+i[1]-i[0];break;default:o=e-1,c=t}const l=(n-t)*.5,h=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-n),this._offsetPrev=s*h,this._offsetNext=o*h}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,g=(n-t)/(i-t),_=g*g,m=_*g,p=-f*m+2*f*_-f*g,v=(1+f)*m+(-1.5-2*f)*_+(-.5+f)*g+1,y=(-1-d)*m+(1.5+d)*_+.5*g,x=d*m-d*_;for(let A=0;A!==a;++A)s[A]=p*o[h+A]+v*o[l+A]+y*o[c+A]+x*o[u+A];return s}}class ou extends _s{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=(n-t)/(i-t),u=1-h;for(let f=0;f!==a;++f)s[f]=o[l+f]*u+o[c+f]*h;return s}}class Sp extends _s{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Pn{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=sr(t,this.TimeBufferType),this.values=sr(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:sr(e.times,Array),values:sr(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Sp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ou(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new wp(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Fr:t=this.InterpolantFactoryMethodDiscrete;break;case zr:t=this.InterpolantFactoryMethodLinear;break;case Ua:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Te("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Fr;case this.InterpolantFactoryMethodLinear:return zr;case this.InterpolantFactoryMethodSmooth:return Ua}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=n.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&&(Ge("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(Ge("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){Ge("KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){Ge("KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&id(i))for(let a=0,c=i.length;a!==c;++a){const l=i[a];if(isNaN(l)){Ge("KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Ua,s=e.length-1;let o=1;for(let a=1;a<s;++a){let c=!1;const l=e[a],h=e[a+1];if(l!==h&&(a!==1||l!==e[0]))if(i)c=!0;else{const u=a*n,f=u-n,d=u+n;for(let g=0;g!==n;++g){const _=t[u+g];if(_!==t[f+g]||_!==t[d+g]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];const u=a*n,f=o*n;for(let d=0;d!==n;++d)t[f+d]=t[u+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Pn.prototype.ValueTypeName="",Pn.prototype.TimeBufferType=Float32Array,Pn.prototype.ValueBufferType=Float32Array,Pn.prototype.DefaultInterpolation=zr;class or extends Pn{constructor(e,t,n){super(e,t,n)}}or.prototype.ValueTypeName="bool",or.prototype.ValueBufferType=Array,or.prototype.DefaultInterpolation=Fr,or.prototype.InterpolantFactoryMethodLinear=void 0,or.prototype.InterpolantFactoryMethodSmooth=void 0;class au extends Pn{constructor(e,t,n,i){super(e,t,n,i)}}au.prototype.ValueTypeName="color";class ar extends Pn{constructor(e,t,n,i){super(e,t,n,i)}}ar.prototype.ValueTypeName="number";class Mp extends _s{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let l=e*a;for(let h=l+a;l!==h;l+=4)wt.slerpFlat(s,0,o,l-a,o,l,c);return s}}class cr extends Pn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Mp(this.times,this.values,this.getValueSize(),e)}}cr.prototype.ValueTypeName="quaternion",cr.prototype.InterpolantFactoryMethodSmooth=void 0;class lr extends Pn{constructor(e,t,n){super(e,t,n)}}lr.prototype.ValueTypeName="string",lr.prototype.ValueBufferType=Array,lr.prototype.DefaultInterpolation=Fr,lr.prototype.InterpolantFactoryMethodLinear=void 0,lr.prototype.InterpolantFactoryMethodSmooth=void 0;class hr extends Pn{constructor(e,t,n,i){super(e,t,n,i)}}hr.prototype.ValueTypeName="vector";class vs{constructor(e="",t=-1,n=[],i=Ba){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=_n(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(Uv(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,o=n.length;s!==o;++s)t.push(Pn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a<s;a++){let c=[],l=[];c.push((a+s-1)%s,a,(a+1)%s),l.push(0,1,0);const h=bp(c);c=ru(c,1,h),l=ru(l,1,h),!i&&c[0]===0&&(c.push(s),l.push(l[0])),o.push(new ar(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const l=e[a],h=l.name.match(s);if(h&&h.length>1){const u=h[1];let f=i[u];f||(i[u]=f=[]),f.push(l)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(Te("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Ge("AnimationClip: No animation in JSONLoader data."),null;const n=function(u,f,d,g,_){if(d.length!==0){const m=[],p=[];su(d,m,p,g),m.length!==0&&_.push(new u(f,m,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let u=0;u<l.length;u++){const f=l[u].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let g;for(g=0;g<f.length;g++)if(f[g].morphTargets)for(let _=0;_<f[g].morphTargets.length;_++)d[f[g].morphTargets[_]]=-1;for(const _ in d){const m=[],p=[];for(let v=0;v!==f[g].morphTargets.length;++v){const y=f[g];m.push(y.time),p.push(y.morphTarget===_?1:0)}i.push(new ar(".morphTargetInfluence["+_+"]",m,p))}c=d.length*o}else{const d=".bones["+t[u].name+"]";n(hr,d+".position",f,"pos",i),n(cr,d+".quaternion",f,"rot",i),n(hr,d+".scale",f,"scl",i)}}return i.length===0?null:new this(s,c,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Nv(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ar;case"vector":case"vector2":case"vector3":case"vector4":return hr;case"color":return au;case"quaternion":return cr;case"bool":case"boolean":return or;case"string":return lr}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function Uv(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Nv(r.type);if(r.times===void 0){const t=[],n=[];su(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const $n={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class cu{constructor(e,t,n){const i=this;let s=!1,o=0,a=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(h){a++,s===!1&&i.onStart!==void 0&&i.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,i.onProgress!==void 0&&i.onProgress(h,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,u){return l.push(h,u),this},this.removeHandler=function(h){const u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,f=l.length;u<f;u+=2){const d=l[u],g=l[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const Ep=new cu;class Jt{constructor(e){this.manager=e!==void 0?e:Ep,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Jt.DEFAULT_MATERIAL_NAME="__DEFAULT";const pi={};class Bv extends Error{constructor(e,t){super(e),this.response=t}}class An extends Jt{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=$n.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(pi[e]!==void 0){pi[e].push({onLoad:t,onProgress:n,onError:i});return}pi[e]=[],pi[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&Te("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const h=pi[e],u=l.body.getReader(),f=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),d=f?parseInt(f):0,g=d!==0;let _=0;const m=new ReadableStream({start(p){v();function v(){u.read().then(({done:y,value:x})=>{if(y)p.close();else{_+=x.byteLength;const A=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:d});for(let E=0,I=h.length;E<I;E++){const D=h[E];D.onProgress&&D.onProgress(A)}p.enqueue(x),v()}},y=>{p.error(y)})}}});return new Response(m)}else throw new Bv(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return l.json();default:if(a==="")return l.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return l.arrayBuffer().then(g=>d.decode(g))}}}).then(l=>{$n.add(`file:${e}`,l);const h=pi[e];delete pi[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onLoad&&d.onLoad(l)}}).catch(l=>{const h=pi[e];if(h===void 0)throw this.manager.itemError(e),l;delete pi[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onError&&d.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Ov extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new An(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(c){i?i(c):Ge(c),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=vs.parse(e[n]);t.push(i)}return t}}class Fv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],a=new Ic,c=new An(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(s.withCredentials);let l=0;function h(u){c.load(e[u],function(f){const d=s.parse(f,!0);o[u]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},l+=1,l===6&&(d.mipmapCount===1&&(a.minFilter=pt),a.image=o,a.format=d.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let u=0,f=e.length;u<f;++u)h(u);else c.load(e,function(u){const f=s.parse(u,!0);if(f.isCubemap){const d=f.mipmaps.length/f.mipmapCount;for(let g=0;g<d;g++){o[g]={mipmaps:[]};for(let _=0;_<f.mipmapCount;_++)o[g].mipmaps.push(f.mipmaps[g*f.mipmapCount+_]),o[g].format=f.format,o[g].width=f.width,o[g].height=f.height}a.image=o}else a.image.width=f.width,a.image.height=f.height,a.mipmaps=f.mipmaps;f.mipmapCount===1&&(a.minFilter=pt),a.format=f.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}const ys=new WeakMap;class _o extends Jt{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$n.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let u=ys.get(o);u===void 0&&(u=[],ys.set(o,u)),u.push({onLoad:t,onError:i})}return o}const a=Ws("img");function c(){h(),t&&t(this);const u=ys.get(this)||[];for(let f=0;f<u.length;f++){const d=u[f];d.onLoad&&d.onLoad(this)}ys.delete(this),s.manager.itemEnd(e)}function l(u){h(),i&&i(u),$n.remove(`image:${e}`);const f=ys.get(this)||[];for(let d=0;d<f.length;d++){const g=f[d];g.onError&&g.onError(u)}ys.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),$n.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}class zv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=new Js;s.colorSpace=Tt;const o=new _o(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(l){o.load(e[l],function(h){s.images[l]=h,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let l=0;l<e.length;++l)c(l);return s}}class kv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Fn,a=new An(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(c){let l;try{l=s.parse(c)}catch(h){if(i!==void 0)i(h);else{h(h);return}}l.image!==void 0?o.image=l.image:l.data!==void 0&&(o.image.width=l.width,o.image.height=l.height,o.image.data=l.data),o.wrapS=l.wrapS!==void 0?l.wrapS:tn,o.wrapT=l.wrapT!==void 0?l.wrapT:tn,o.magFilter=l.magFilter!==void 0?l.magFilter:pt,o.minFilter=l.minFilter!==void 0?l.minFilter:pt,o.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(o.colorSpace=l.colorSpace),l.flipY!==void 0&&(o.flipY=l.flipY),l.format!==void 0&&(o.format=l.format),l.type!==void 0&&(o.type=l.type),l.mipmaps!==void 0&&(o.mipmaps=l.mipmaps,o.minFilter=Mn),l.mipmapCount===1&&(o.minFilter=pt),l.generateMipmaps!==void 0&&(o.generateMipmaps=l.generateMipmaps),o.needsUpdate=!0,t&&t(o,l)},n,i),o}}class lu extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=new xt,o=new _o(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class Di extends ct{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new xe(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class hu extends Di{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ct.DEFAULT_UP),this.updateMatrix(),this.groundColor=new xe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const uu=new We,Tp=new U,Cp=new U;class fu{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new he(512,512),this.mapType=ln,this.map=null,this.mapPass=null,this.matrix=new We,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new fs,this._frameExtents=new he(1,1),this._viewportCount=1,this._viewports=[new gt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Tp.setFromMatrixPosition(e.matrixWorld),t.position.copy(Tp),Cp.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Cp),t.updateMatrixWorld(),uu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(uu,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(uu)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,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 Vv extends fu{constructor(){super(new kt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Wr*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class du extends Di{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ct.DEFAULT_UP),this.updateMatrix(),this.target=new ct,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new Vv}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class Hv extends fu{constructor(){super(new kt(90,1,.5,500)),this.isPointLightShadow=!0}}class pu extends Di{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Hv}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class ur extends oc{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,o=s+l*this.view.width,a-=h*this.view.offsetY,c=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Gv extends fu{constructor(){super(new ur(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class jc extends Di{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ct.DEFAULT_UP),this.updateMatrix(),this.target=new ct,this.shadow=new Gv}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class mu extends Di{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ip extends Di{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class gu{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new U)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class Rp extends Di{constructor(e=new gu,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Jc extends Jt{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new An(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(c){i?i(c):Ge(c),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&Te("MaterialLoader: Undefined texture",s),t[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new xe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new xe().setHex(o.value);break;case"v2":i.uniforms[s].value=new he().fromArray(o.value);break;case"v3":i.uniforms[s].value=new U().fromArray(o.value);break;case"v4":i.uniforms[s].value=new gt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new et().fromArray(o.value);break;case"m4":i.uniforms[s].value=new We().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new he().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new he().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Jc.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:mp,SpriteMaterial:Ih,RawShaderMaterial:tu,ShaderMaterial:Cn,PointsMaterial:Ec,MeshPhysicalMaterial:Rn,MeshStandardMaterial:gs,MeshPhongMaterial:gp,MeshToonMaterial:_p,MeshNormalMaterial:vp,MeshLambertMaterial:yp,MeshDepthMaterial:nu,MeshDistanceMaterial:iu,MeshBasicMaterial:un,MeshMatcapMaterial:xp,LineDashedMaterial:Ap,LineBasicMaterial:qt,Material:zt};return new t[e]}}class Li{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 Pp extends Ke{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 Dp extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new An(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(c){i?i(c):Ge(c),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(d,g){if(t[g]!==void 0)return t[g];const m=d.interleavedBuffers[g],p=s(d,m.buffer),v=Hr(m.type,p),y=new os(v,m.stride);return y.uuid=m.uuid,t[g]=y,y}function s(d,g){if(n[g]!==void 0)return n[g];const m=d.arrayBuffers[g],p=new Uint32Array(m).buffer;return n[g]=p,p}const o=e.isInstancedBufferGeometry?new Pp:new Ke,a=e.data.index;if(a!==void 0){const d=Hr(a.type,a.array);o.setIndex(new ot(d,1))}const c=e.data.attributes;for(const d in c){const g=c[d];let _;if(g.isInterleavedBufferAttribute){const m=i(e.data,g.data);_=new fi(m,g.itemSize,g.offset,g.normalized)}else{const m=Hr(g.type,g.array),p=g.isInstancedBufferAttribute?Ji:ot;_=new p(m,g.itemSize,g.normalized)}g.name!==void 0&&(_.name=g.name),g.usage!==void 0&&_.setUsage(g.usage),o.setAttribute(d,_)}const l=e.data.morphAttributes;if(l)for(const d in l){const g=l[d],_=[];for(let m=0,p=g.length;m<p;m++){const v=g[m];let y;if(v.isInterleavedBufferAttribute){const x=i(e.data,v.data);y=new fi(x,v.itemSize,v.offset,v.normalized)}else{const x=Hr(v.type,v.array);y=new ot(x,v.itemSize,v.normalized)}v.name!==void 0&&(y.name=v.name),_.push(y)}o.morphAttributes[d]=_}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const u=e.data.groups||e.data.drawcalls||e.data.offsets;if(u!==void 0)for(let d=0,g=u.length;d!==g;++d){const _=u[d];o.addGroup(_.start,_.count,_.materialIndex)}const f=e.data.boundingSphere;return f!==void 0&&(o.boundingSphere=new Pt().fromJSON(f)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class Wv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?Li.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new An(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){let l=null;try{l=JSON.parse(c)}catch(u){i!==void 0&&i(u),u("ObjectLoader: Can't parse "+e+".",u.message);return}const h=l.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),Ge("ObjectLoader: Can't load "+e);return}s.parse(l,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?Li.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new An(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),c=a.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(l)}),a=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,s,c,a,n),h=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,h),this.bindLightTargets(l),t!==void 0){let u=!1;for(const f in o)if(o[f].data instanceof HTMLImageElement){u=!0;break}u===!1&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,i,a,o,t),l=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,l),this.bindLightTargets(c),c}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new nr().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new no().fromJSON(e[s],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Dp;for(let s=0,o=e.length;s<o;s++){let a;const c=e[s];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(c);break;default:c.type in pp?a=pp[c.type].fromJSON(c,t):Te(`ObjectLoader: Unsupported geometry type "${c.type}"`)}a.uuid=c.uuid,c.name!==void 0&&(a.name=c.name),c.userData!==void 0&&(a.userData=c.userData),n[c.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new Jc;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const c=e[o];n[c.uuid]===void 0&&(n[c.uuid]=s.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=vs.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(c){return n.manager.itemStart(c),s.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function a(c){if(typeof c=="string"){const l=c,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:n.resourcePath+l;return o(h)}else return c.data?{data:Hr(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new cu(t);s=new _o(c),s.setCrossOrigin(this.crossOrigin);for(let l=0,h=e.length;l<h;l++){const u=e[l],f=u.url;if(Array.isArray(f)){const d=[];for(let g=0,_=f.length;g<_;g++){const m=f[g],p=a(m);p!==null&&(p instanceof HTMLImageElement?d.push(p):d.push(new Fn(p.data,p.width,p.height)))}i[u.uuid]=new wi(d)}else{const d=a(u.url);i[u.uuid]=new wi(d)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(o){if(typeof o=="string"){const a=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(c)}else return o.data?{data:Hr(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new _o(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const c=e[o],l=c.url;if(Array.isArray(l)){const h=[];for(let u=0,f=l.length;u<f;u++){const d=l[u],g=await s(d);g!==null&&(g instanceof HTMLImageElement?h.push(g):h.push(new Fn(g.data,g.width,g.height)))}n[c.uuid]=new wi(h)}else{const h=await s(c.url);n[c.uuid]=new wi(h)}}}return n}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(Te("ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&Te('ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&Te("ObjectLoader: Undefined image",a.image);const c=t[a.image],l=c.data;let h;Array.isArray(l)?(h=new Js,l.length===6&&(h.needsUpdate=!0)):(l&&l.data?h=new Fn:h=new xt,l&&(h.needsUpdate=!0)),h.source=c,h.uuid=a.uuid,a.name!==void 0&&(h.name=a.name),a.mapping!==void 0&&(h.mapping=n(a.mapping,qv)),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=n(a.wrap[0],Lp),h.wrapT=n(a.wrap[1],Lp)),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=n(a.minFilter,Np)),a.magFilter!==void 0&&(h.magFilter=n(a.magFilter,Np)),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),i[a.uuid]=h}return i}parseObject(e,t,n,i,s){let o;function a(f){return t[f]===void 0&&Te("ObjectLoader: Undefined geometry",f),t[f]}function c(f){if(f!==void 0){if(Array.isArray(f)){const d=[];for(let g=0,_=f.length;g<_;g++){const m=f[g];n[m]===void 0&&Te("ObjectLoader: Undefined material",m),d.push(n[m])}return d}return n[f]===void 0&&Te("ObjectLoader: Undefined material",f),n[f]}}function l(f){return i[f]===void 0&&Te("ObjectLoader: Undefined texture",f),i[f]}let h,u;switch(e.type){case"Scene":o=new Ch,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new xe(e.background):o.background=l(e.background)),e.environment!==void 0&&(o.environment=l(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new lc(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new cc(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 kt(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 ur(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 mu(e.color,e.intensity);break;case"DirectionalLight":o=new jc(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new pu(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Ip(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new du(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new hu(e.color,e.groundColor,e.intensity);break;case"LightProbe":const f=new gu().fromArray(e.sh);o=new Rp(f,e.intensity);break;case"SkinnedMesh":h=a(e.geometry),u=c(e.material),o=new Lh(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=c(e.material),o=new St(h,u);break;case"InstancedMesh":h=a(e.geometry),u=c(e.material);const d=e.count,g=e.instanceMatrix,_=e.instanceColor;o=new _c(h,u,d),o.instanceMatrix=new Ji(new Float32Array(g.array),16),_!==void 0&&(o.instanceColor=new Ji(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":h=a(e.geometry),u=c(e.material),o=new Wd(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._geometryInfo=e.geometryInfo.map(m=>{let p=null,v=null;return m.boundingBox!==void 0&&(p=new Gt().fromJSON(m.boundingBox)),m.boundingSphere!==void 0&&(v=new Pt().fromJSON(m.boundingSphere)),{...m,boundingBox:p,boundingSphere:v}}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=l(e.matricesTexture.uuid),o._indirectTexture=l(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=l(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(o.boundingSphere=new Pt().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Gt().fromJSON(e.boundingBox));break;case"LOD":o=new Ld;break;case"Line":o=new di(a(e.geometry),c(e.material));break;case"LineLoop":o=new Fh(a(e.geometry),c(e.material));break;case"LineSegments":o=new In(a(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new kh(a(e.geometry),c(e.material));break;case"Sprite":o=new Pd(c(e.material));break;case"Group":o=new Kn;break;case"Bone":o=new mc;break;default:o=new ct}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 f=e.children;for(let d=0;d<f.length;d++)o.add(this.parseObject(f[d],t,n,i,s))}if(e.animations!==void 0){const f=e.animations;for(let d=0;d<f.length;d++){const g=f[d];o.animations.push(s[g])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const f=e.levels;for(let d=0;d<f.length;d++){const g=f[d],_=o.getObjectByProperty("uuid",g.object);_!==void 0&&o.addLevel(_,g.distance,g.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?Te("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new ct}})}}const qv={UVMapping:Qo,CubeReflectionMapping:Xn,CubeRefractionMapping:vi,EquirectangularReflectionMapping:Us,EquirectangularRefractionMapping:Bs,CubeUVReflectionMapping:Lr},Lp={RepeatWrapping:yi,ClampToEdgeWrapping:tn,MirroredRepeatWrapping:Nr},Np={NearestFilter:Mt,NearestMipmapNearestFilter:Ko,NearestMipmapLinearFilter:Hi,LinearFilter:pt,LinearMipmapNearestFilter:Ur,LinearMipmapLinearFilter:Mn},_u=new WeakMap;class Up extends Jt{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Te("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Te("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$n.get(`image-bitmap:${e}`);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(l=>{if(_u.has(o)===!0)i&&i(_u.get(o)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(l),s.manager.itemEnd(e),l});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,a.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const c=fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){return $n.add(`image-bitmap:${e}`,l),t&&t(l),s.manager.itemEnd(e),l}).catch(function(l){i&&i(l),_u.set(c,l),$n.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});$n.add(`image-bitmap:${e}`,c),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let $c;class vu{static getContext(){return $c===void 0&&($c=new(window.AudioContext||window.webkitAudioContext)),$c}static setContext(e){$c=e}}class Xv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new An(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const l=c.slice(0);vu.getContext().decodeAudioData(l,function(u){t(u)}).catch(a)}catch(l){a(l)}},n,i);function a(c){i?i(c):Ge(c),s.manager.itemError(e)}}}const Bp=new We,Op=new We,fr=new We;class Zv{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new kt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new kt,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,fr.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(Zi*t.fov*.5)/t.zoom;let a,c;Op.elements[12]=-i,Bp.elements[12]=i,a=-o*t.aspect+s,c=o*t.aspect+s,fr.elements[0]=2*t.near/(c-a),fr.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(fr),a=-o*t.aspect-s,c=o*t.aspect-s,fr.elements[0]=2*t.near/(c-a),fr.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(fr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Op),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Bp)}}class Fp extends kt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class el{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const dr=new U,yu=new wt,Yv=new U,pr=new U,mr=new U;class Qv extends ct{constructor(){super(),this.type="AudioListener",this.context=vu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new el}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;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(dr,yu,Yv),pr.set(0,0,-1).applyQuaternion(yu),mr.set(0,1,0).applyQuaternion(yu),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(dr.x,n),t.positionY.linearRampToValueAtTime(dr.y,n),t.positionZ.linearRampToValueAtTime(dr.z,n),t.forwardX.linearRampToValueAtTime(pr.x,n),t.forwardY.linearRampToValueAtTime(pr.y,n),t.forwardZ.linearRampToValueAtTime(pr.z,n),t.upX.linearRampToValueAtTime(mr.x,n),t.upY.linearRampToValueAtTime(mr.y,n),t.upZ.linearRampToValueAtTime(mr.z,n)}else t.setPosition(dr.x,dr.y,dr.z),t.setOrientation(pr.x,pr.y,pr.z,mr.x,mr.y,mr.z)}}class zp extends ct{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){Te("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Te("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){Te("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){Te("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){Te("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?(Te("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){Te("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"?(Te("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 gr=new U,kp=new wt,Kv=new U,_r=new U;class jv extends zp{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(gr,kp,Kv),_r.set(0,0,1).applyQuaternion(kp);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(gr.x,n),t.positionY.linearRampToValueAtTime(gr.y,n),t.positionZ.linearRampToValueAtTime(gr.z,n),t.orientationX.linearRampToValueAtTime(_r.x,n),t.orientationY.linearRampToValueAtTime(_r.y,n),t.orientationZ.linearRampToValueAtTime(_r.z,n)}else t.setPosition(gr.x,gr.y,gr.z),t.setOrientation(_r.x,_r.y,_r.z)}}class Jv{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Vp{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,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 n=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[s+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){wt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;wt.multiplyQuaternionsFlat(e,o,e,t,e,n),wt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const xu="\\[\\]\\.:\\/",$v=new RegExp("["+xu+"]","g"),Au="[^"+xu+"]",ey="[^"+xu.replace("\\.","")+"]",ty=/((?:WC+[\/:])*)/.source.replace("WC",Au),ny=/(WCOD+)?/.source.replace("WCOD",ey),iy=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Au),ry=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Au),sy=new RegExp("^"+ty+ny+iy+ry+"$"),oy=["material","materials","bones","map"];class ay{constructor(e,t,n){const i=n||lt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class lt{constructor(e,t,n){this.path=t,this.parsedPath=n||lt.parseTrackName(t),this.node=lt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new lt.Composite(e,t,n):new lt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($v,"")}static parseTrackName(e){const t=sy.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);oy.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const c=n(a.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=lt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Te("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ge("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){Ge("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===l){l=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ge("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ge("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){Ge("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const o=e[i];if(o===void 0){const l=t.nodeName;Ge("PropertyBinding: Trying to update property for track: "+l+"."+i+" 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 c=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ge("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])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}lt.Composite=ay,lt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},lt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},lt.prototype.GetterByBindingType=[lt.prototype._getValue_direct,lt.prototype._getValue_array,lt.prototype._getValue_arrayElement,lt.prototype._getValue_toArray],lt.prototype.SetterByBindingTypeAndVersioning=[[lt.prototype._setValue_direct,lt.prototype._setValue_direct_setNeedsUpdate,lt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_array,lt.prototype._setValue_array_setNeedsUpdate,lt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_arrayElement,lt.prototype._setValue_arrayElement_setNeedsUpdate,lt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_fromArray,lt.prototype._setValue_fromArray_setNeedsUpdate,lt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class cy{constructor(){this.isAnimationObjectGroup=!0,this.uuid=_n(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length;let a,c=e.length,l=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const f=arguments[h],d=f.uuid;let g=t[d];if(g===void 0){g=c++,t[d]=g,e.push(f);for(let _=0,m=o;_!==m;++_)s[_].push(new lt(f,n[_],i[_]))}else if(g<l){a=e[g];const _=--l,m=e[_];t[m.uuid]=g,e[g]=m,t[d]=_,e[_]=f;for(let p=0,v=o;p!==v;++p){const y=s[p],x=y[_];let A=y[g];y[g]=x,A===void 0&&(A=new lt(f,n[p],i[p])),y[_]=A}}else e[g]!==a&&Ge("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const c=arguments[o],l=c.uuid,h=t[l];if(h!==void 0&&h>=s){const u=s++,f=e[u];t[f.uuid]=h,e[h]=f,t[l]=u,e[u]=c;for(let d=0,g=i;d!==g;++d){const _=n[d],m=_[u],p=_[h];_[h]=m,_[u]=p}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const l=arguments[a],h=l.uuid,u=t[h];if(u!==void 0)if(delete t[h],u<s){const f=--s,d=e[f],g=--o,_=e[g];t[d.uuid]=u,e[u]=d,t[_.uuid]=f,e[f]=_,e.pop();for(let m=0,p=i;m!==p;++m){const v=n[m],y=v[f],x=v[g];v[u]=y,v[f]=x,v.pop()}}else{const f=--o,d=e[f];f>0&&(t[d.uuid]=u),e[u]=d,e.pop();for(let g=0,_=i;g!==_;++g){const m=n[g];m[u]=m[f],m.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,h=this.nCachedObjects_,u=new Array(l);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(u);for(let f=h,d=c.length;f!==d;++f){const g=c[f];u[f]=new lt(g,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],l=e[a];t[l]=n,o[n]=c,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}class Hp{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),c={endingStart:Wi,endingEnd:Wi};for(let l=0;l!==o;++l){const h=s[l].createInterpolant(null);a[l]=h,h.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qf,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=s,c[1]=s+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case $l:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulateAdditive(a);break;case Ba:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===Xf;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===Wf){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=qi,i.endingEnd=qi):(e?i.endingStart=this.zeroSlopeAtStart?qi:Wi:i.endingStart=Hs,t?i.endingEnd=this.zeroSlopeAtEnd?qi:Wi:i.endingEnd=Hs)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=s,c[0]=t,a[1]=s+e,c[1]=n,this}}const ly=new Float32Array(1);class hy extends Qn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==s;++u){const f=i[u],d=f.name;let g=h[d];if(g!==void 0)++g.referenceCount,o[u]=g;else{if(g=o[u],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,c,d));continue}const _=t&&t._propertyBindings[u].binding.parsedPath;g=new Vp(lt.create(n,d,_),f.ValueTypeName,f.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,c,d),o[u]=g}a[u].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let 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=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],c=a.knownActions,l=c[c.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,c[h]=l,c.pop(),e._byClipCacheIndex=null;const u=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete u[f],c.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,a=o[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new ou(new Float32Array(2),new Float32Array(2),1,ly),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let o=typeof e=="string"?vs.findByName(i,e):e;const a=o!==null?o.uuid:e,c=this._actionsByClip[a];let l=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Ba),c!==void 0){const u=c.actionByRoot[s];if(u!==void 0&&u.blendMode===n)return u;l=c.knownActions[0],o===null&&(o=l._clip)}if(o===null)return null;const h=new Hp(this,o,t,n);return this._bindAction(h,l),this._addInactiveAction(h,a,s),h}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?vs.findByName(n,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,s,o);const a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const o=s.knownActions;for(let a=0,c=o.length;a!==c;++a){const l=o[a];this._deactivateAction(l);const h=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class uy extends ch{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Ha(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class bu{constructor(e){this.value=e}clone(){return new bu(this.value.clone===void 0?this.value:this.value.clone())}}let fy=0;class dy extends Qn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:fy++}),this.name="",this.usage=kr,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(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class py extends os{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class my{constructor(e,t,n,i,s,o=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.normalized=o,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 Gp=new We;class gy{constructor(e,t,n=0,i=1/0){this.ray=new Kr(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Qa,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):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Gp.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Gp),this}intersectObject(e,t=!0,n=[]){return wu(e,this,n,t),n.sort(Wp),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)wu(e[i],this,n,t);return n.sort(Wp),n}}function Wp(r,e){return r.distance-e.distance}function wu(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let o=0,a=s.length;o<a;o++)wu(s[o],e,t,!0)}}class _y{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=vy.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function vy(){this._document.hidden===!1&&this.reset()}class yy{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Qe(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Qe(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class xy{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Su{constructor(e,t,n,i){Su.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}}const qp=new he;class Ay{constructor(e=new he(1/0,1/0),t=new he(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qp.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qp).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 Xp=new U,tl=new U,xs=new U,As=new U,Mu=new U,by=new U,wy=new U;class Sy{constructor(e=new U,t=new U){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){Xp.subVectors(e,this.start),tl.subVectors(this.end,this.start);const n=tl.dot(tl);let s=tl.dot(Xp)/n;return t&&(s=Qe(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=by,n=wy){const i=10000000000000001e-32;let s,o;const a=this.start,c=e.start,l=this.end,h=e.end;xs.subVectors(l,a),As.subVectors(h,c),Mu.subVectors(a,c);const u=xs.dot(xs),f=As.dot(As),d=As.dot(Mu);if(u<=i&&f<=i)return t.copy(a),n.copy(c),t.sub(n),t.dot(t);if(u<=i)s=0,o=d/f,o=Qe(o,0,1);else{const g=xs.dot(Mu);if(f<=i)o=0,s=Qe(-g/u,0,1);else{const _=xs.dot(As),m=u*f-_*_;m!==0?s=Qe((_*d-g*f)/m,0,1):s=0,o=(_*s+d)/f,o<0?(o=0,s=Qe(-g/u,0,1)):o>1&&(o=1,s=Qe((_-g)/u,0,1))}}return t.copy(a).add(xs.multiplyScalar(s)),n.copy(c).add(As.multiplyScalar(o)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Zp=new U;class My extends ct{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Ke,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,c=32;o<c;o++,a++){const l=o/c*Math.PI*2,h=a/c*Math.PI*2;i.push(Math.cos(l),Math.sin(l),1,Math.cos(h),Math.sin(h),1)}n.setAttribute("position",new Be(i,3));const s=new qt({fog:!1,toneMapped:!1});this.cone=new In(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Zp.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Zp),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Ni=new U,nl=new We,Eu=new We;class Ey extends In{constructor(e){const t=Yp(e),n=new Ke,i=[],s=[];for(let l=0;l<t.length;l++){const h=t[l];h.parent&&h.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}n.setAttribute("position",new Be(i,3)),n.setAttribute("color",new Be(s,3));const o=new qt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const a=new xe(255),c=new xe(65280);this.setColors(a,c)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Eu.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(nl.multiplyMatrices(Eu,a.matrixWorld),Ni.setFromMatrixPosition(nl),i.setXYZ(o,Ni.x,Ni.y,Ni.z),nl.multiplyMatrices(Eu,a.parent.matrixWorld),Ni.setFromMatrixPosition(nl),i.setXYZ(o+1,Ni.x,Ni.y,Ni.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,e.r,e.g,e.b),i.setXYZ(s+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function Yp(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...Yp(r.children[t]));return e}class Ty extends St{constructor(e,t,n){const i=new ms(t,4,2),s=new un({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Cy=new U,Qp=new xe,Kp=new xe;class Iy extends ct{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new go(t);i.rotateY(Math.PI*.5),this.material=new un({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new ot(o,3)),this.add(new St(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Qp.copy(this.light.color),Kp.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?Qp:Kp;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Cy.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Ry extends In{constructor(e=10,t=10,n=4473924,i=8947848){n=new xe(n),i=new xe(i);const s=t/2,o=e/t,a=e/2,c=[],l=[];for(let f=0,d=0,g=-a;f<=t;f++,g+=o){c.push(-a,0,g,a,0,g),c.push(g,0,-a,g,0,a);const _=f===s?n:i;_.toArray(l,d),d+=3,_.toArray(l,d),d+=3,_.toArray(l,d),d+=3,_.toArray(l,d),d+=3}const h=new Ke;h.setAttribute("position",new Be(c,3)),h.setAttribute("color",new Be(l,3));const u=new qt({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Py extends In{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new xe(s),o=new xe(o);const a=[],c=[];if(t>1)for(let u=0;u<t;u++){const f=u/t*(Math.PI*2),d=Math.sin(f)*e,g=Math.cos(f)*e;a.push(0,0,0),a.push(d,0,g);const _=u&1?s:o;c.push(_.r,_.g,_.b),c.push(_.r,_.g,_.b)}for(let u=0;u<n;u++){const f=u&1?s:o,d=e-e/n*u;for(let g=0;g<i;g++){let _=g/i*(Math.PI*2),m=Math.sin(_)*d,p=Math.cos(_)*d;a.push(m,0,p),c.push(f.r,f.g,f.b),_=(g+1)/i*(Math.PI*2),m=Math.sin(_)*d,p=Math.cos(_)*d,a.push(m,0,p),c.push(f.r,f.g,f.b)}}const l=new Ke;l.setAttribute("position",new Be(a,3)),l.setAttribute("color",new Be(c,3));const h=new qt({vertexColors:!0,toneMapped:!1});super(l,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const jp=new U,il=new U,Jp=new U;class Dy extends ct{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new Ke;i.setAttribute("position",new Be([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new qt({fog:!1,toneMapped:!1});this.lightPlane=new di(i,s),this.add(this.lightPlane),i=new Ke,i.setAttribute("position",new Be([0,0,0,0,0,1],3)),this.targetLine=new di(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),jp.setFromMatrixPosition(this.light.matrixWorld),il.setFromMatrixPosition(this.light.target.matrixWorld),Jp.subVectors(il,jp),this.lightPlane.lookAt(il),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(il),this.targetLine.scale.z=Jp.length()}}const rl=new U,Ct=new oc;class Ly extends In{constructor(e){const t=new Ke,n=new qt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],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(g,_){c(g),c(_)}function c(g){i.push(0,0,0),s.push(0,0,0),o[g]===void 0&&(o[g]=[]),o[g].push(i.length/3-1)}t.setAttribute("position",new Be(i,3)),t.setAttribute("color",new Be(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const l=new xe(16755200),h=new xe(16711680),u=new xe(43775),f=new xe(16777215),d=new xe(3355443);this.setColors(l,h,u,f,d)}setColors(e,t,n,i,s){const a=this.geometry.getAttribute("color");return a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,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,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let s,o;if(Ct.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,o=0;else if(this.camera.coordinateSystem===gn)s=-1,o=1;else if(this.camera.coordinateSystem===Vr)s=0,o=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Dt("c",t,e,Ct,0,0,s),Dt("t",t,e,Ct,0,0,o),Dt("n1",t,e,Ct,-n,-i,s),Dt("n2",t,e,Ct,n,-i,s),Dt("n3",t,e,Ct,-n,i,s),Dt("n4",t,e,Ct,n,i,s),Dt("f1",t,e,Ct,-n,-i,o),Dt("f2",t,e,Ct,n,-i,o),Dt("f3",t,e,Ct,-n,i,o),Dt("f4",t,e,Ct,n,i,o),Dt("u1",t,e,Ct,n*.7,i*1.1,s),Dt("u2",t,e,Ct,-n*.7,i*1.1,s),Dt("u3",t,e,Ct,0,i*2,s),Dt("cf1",t,e,Ct,-n,0,o),Dt("cf2",t,e,Ct,n,0,o),Dt("cf3",t,e,Ct,0,-i,o),Dt("cf4",t,e,Ct,0,i,o),Dt("cn1",t,e,Ct,-n,0,s),Dt("cn2",t,e,Ct,n,0,s),Dt("cn3",t,e,Ct,0,-i,s),Dt("cn4",t,e,Ct,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Dt(r,e,t,n,i,s,o){rl.set(i,s,o).unproject(n);const a=e[r];if(a!==void 0){const c=t.getAttribute("position");for(let l=0,h=a.length;l<h;l++)c.setXYZ(a[l],rl.x,rl.y,rl.z)}}const sl=new Gt;class Ny extends In{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new Ke;s.setIndex(new ot(n,1)),s.setAttribute("position",new ot(i,3)),super(s,new qt({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&sl.setFromObject(this.object),sl.isEmpty())return;const e=sl.min,t=sl.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Uy extends In{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ke;s.setIndex(new ot(n,1)),s.setAttribute("position",new Be(i,3)),super(s,new qt({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 By extends di{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new Ke;o.setAttribute("position",new Be(s,3)),o.computeBoundingSphere(),super(o,new qt({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new Ke;c.setAttribute("position",new Be(a,3)),c.computeBoundingSphere(),this.add(new St(c,new un({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const $p=new U;let ol,Tu;class Oy extends ct{constructor(e=new U(0,0,1),t=new U(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",ol===void 0&&(ol=new Ke,ol.setAttribute("position",new Be([0,0,0,0,1,0],3)),Tu=new co(.5,1,5,1),Tu.translate(0,-.5,0)),this.position.copy(t),this.line=new di(ol,new qt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new St(Tu,new un({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,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{$p.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle($p,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Fy extends In{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Ke;i.setAttribute("position",new Be(t,3)),i.setAttribute("color",new Be(n,3));const s=new qt({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new xe,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class zy{constructor(){this.type="ShapePath",this.color=new xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new zc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(p){const v=[];for(let y=0,x=p.length;y<x;y++){const A=p[y],E=new nr;E.curves=A.curves,v.push(E)}return v}function n(p,v){const y=v.length;let x=!1;for(let A=y-1,E=0;E<y;A=E++){let I=v[A],D=v[E],b=D.x-I.x,C=D.y-I.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(I=v[E],b=-b,D=v[A],C=-C),p.y<I.y||p.y>D.y)continue;if(p.y===I.y){if(p.x===I.x)return!0}else{const B=C*(p.x-I.x)-b*(p.y-I.y);if(B===0)return!0;if(B<0)continue;x=!x}}else{if(p.y!==I.y)continue;if(D.x<=p.x&&p.x<=I.x||I.x<=p.x&&p.x<=D.x)return!0}}return x}const i=kn.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,c;const l=[];if(s.length===1)return a=s[0],c=new nr,c.curves=a.curves,l.push(c),l;let h=!i(s[0].getPoints());h=e?!h:h;const u=[],f=[];let d=[],g=0,_;f[g]=void 0,d[g]=[];for(let p=0,v=s.length;p<v;p++)a=s[p],_=a.getPoints(),o=i(_),o=e?!o:o,o?(!h&&f[g]&&g++,f[g]={s:new nr,p:_},f[g].s.curves=a.curves,h&&g++,d[g]=[]):d[g].push({h:a,p:_[0]});if(!f[0])return t(s);if(f.length>1){let p=!1,v=0;for(let y=0,x=f.length;y<x;y++)u[y]=[];for(let y=0,x=f.length;y<x;y++){const A=d[y];for(let E=0;E<A.length;E++){const I=A[E];let D=!0;for(let b=0;b<f.length;b++)n(I.p,f[b].p)&&(y!==b&&v++,D?(D=!1,u[b].push(I)):p=!0);D&&u[y].push(I)}}v>0&&p===!1&&(d=u)}let m;for(let p=0,v=f.length;p<v;p++){c=f[p].s,l.push(c),m=d[p];for(let y=0,x=m.length;y<x;y++)c.holes.push(m[y].h)}return l}}class ky extends Qn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Te("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Vy(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function Hy(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function Gy(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Cu(r,e,t,n){const i=Wy(n);switch(t){case jl:return r*e;case ea:return r*e/i.components*i.byteLength;case Os:return r*e/i.components*i.byteLength;case Gi:return r*e*2/i.components*i.byteLength;case ta:return r*e*2/i.components*i.byteLength;case Jl:return r*e*3/i.components*i.byteLength;case rn:return r*e*4/i.components*i.byteLength;case na:return r*e*4/i.components*i.byteLength;case Fs:case zs:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case ks:case Vs:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case ra:case oa:return Math.max(r,16)*Math.max(e,8)/4;case ia:case sa:return Math.max(r,8)*Math.max(e,8)/2;case aa:case ca:case ha:case ua:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case la:case fa:case da:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case pa:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case ma:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case ga:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case _a:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case va:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case ya:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case xa:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Aa:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case ba:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case wa:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case Sa:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Ma:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Ea:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Ta:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Ca:case Ia:case Ra:return Math.ceil(r/4)*Math.ceil(e/4)*16;case Pa:case Da:return Math.ceil(r/4)*Math.ceil(e/4)*8;case La:case Na:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Wy(r){switch(r){case ln:case Zl:return{byteLength:1,components:1};case Br:case Yl:case Zn:return{byteLength:2,components:1};case Jo:case $o:return{byteLength:2,components:4};case En:case jo:case nn:return{byteLength:4,components:1};case Ql:case Kl:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class qy{static contain(e,t){return Vy(e,t)}static cover(e,t){return Hy(e,t)}static fill(e){return Gy(e)}static getByteLength(e,t,n,i){return Cu(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Yt}})),typeof window<"u"&&(window.__THREE__?Te("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Yt);/**
44
+ `},i=new ji(5,5,5),s=new Cn({name:"CubemapFromEquirect",uniforms:is(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:en,blending:qn});s.uniforms.tEquirect.value=t;const o=new St(i,s),a=t.minFilter;return t.minFilter===Mn&&(t.minFilter=pt),new Td(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}class Kn extends ct{constructor(){super(),this.isGroup=!0,this.type="Group"}}const F_={type:"move"};class ac{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Kn,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 Kn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Kn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,n),p=this._getHandJoint(l,_);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=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,g=.005;l.inputState.pinching&&f>d+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&f<=d-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(F_)))}return a!==null&&(a.visible=i!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Kn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class cc{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new xe(e),this.density=t}clone(){return new cc(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class lc{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new xe(e),this.near=t,this.far=n}clone(){return new lc(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Ch extends ct{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 Zt,this.environmentIntensity=1,this.environmentRotation=new Zt,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 os{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=kr,this.updateRanges=[],this.version=0,this.uuid=_n()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_n()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_n()),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 U;class fi{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyMatrix4(e),this.setXYZ(t,an.x,an.y,an.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.applyNormalMatrix(e),this.setXYZ(t,an.x,an.y,an.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)an.fromBufferAttribute(this,t),an.transformDirection(e),this.setXYZ(t,an.x,an.y,an.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=sn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=tt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=tt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=tt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=tt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=tt(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=sn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=sn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=sn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=sn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=tt(t,this.array),n=tt(n,this.array),i=tt(i,this.array),s=tt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){qs("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new ot(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 fi(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){qs("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Ih extends zt{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new xe(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 as;const $s=new U,cs=new U,ls=new U,hs=new he,eo=new he,Cd=new We,hc=new U,to=new U,uc=new U,Id=new he,Rh=new he,Rd=new he;class Pd extends ct{constructor(e=new Ih){if(super(),this.isSprite=!0,this.type="Sprite",as===void 0){as=new Ke;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new os(t,5);as.setIndex([0,1,2,0,2,3]),as.setAttribute("position",new fi(n,3,0,!1)),as.setAttribute("uv",new fi(n,2,3,!1))}this.geometry=as,this.material=e,this.center=new he(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),cs.setFromMatrixScale(this.matrixWorld),Cd.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ls.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&cs.multiplyScalar(-ls.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;fc(hc.set(-.5,-.5,0),ls,o,cs,i,s),fc(to.set(.5,-.5,0),ls,o,cs,i,s),fc(uc.set(.5,.5,0),ls,o,cs,i,s),Id.set(0,0),Rh.set(1,0),Rd.set(1,1);let a=e.ray.intersectTriangle(hc,to,uc,!1,$s);if(a===null&&(fc(to.set(-.5,.5,0),ls,o,cs,i,s),Rh.set(0,1),a=e.ray.intersectTriangle(hc,uc,to,!1,$s),a===null))return;const c=e.ray.origin.distanceTo($s);c<e.near||c>e.far||t.push({distance:c,point:$s.clone(),uv:hn.getInterpolation($s,hc,to,uc,Id,Rh,Rd,new he),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 fc(r,e,t,n,i,s){hs.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(eo.x=s*hs.x-i*hs.y,eo.y=i*hs.x+s*hs.y):eo.copy(hs),r.copy(e),r.x+=eo.x,r.y+=eo.y,r.applyMatrix4(Cd)}const dc=new U,Dd=new U;class Ld extends ct{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){dc.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(dc);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){dc.setFromMatrixPosition(e.matrixWorld),Dd.setFromMatrixPosition(this.matrixWorld);const n=dc.distanceTo(Dd)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Nd=new U,Ud=new gt,Bd=new gt,z_=new U,Od=new We,pc=new U,Ph=new Pt,Fd=new We,Dh=new Kr;class Lh extends St{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Xl,this.bindMatrix=new We,this.bindMatrixInverse=new We,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Gt),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,pc),this.boundingBox.expandByPoint(pc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Pt),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,pc),this.boundingSphere.expandByPoint(pc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ph.copy(this.boundingSphere),Ph.applyMatrix4(i),e.ray.intersectsSphere(Ph)!==!1&&(Fd.copy(i).invert(),Dh.copy(e.ray).applyMatrix4(Fd),!(this.boundingBox!==null&&Dh.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Dh)))}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 gt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Xl?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Gf?this.bindMatrixInverse.copy(this.bindMatrix).invert():Te("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Ud.fromBufferAttribute(i.attributes.skinIndex,e),Bd.fromBufferAttribute(i.attributes.skinWeight,e),Nd.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=Bd.getComponent(s);if(o!==0){const a=Ud.getComponent(s);Od.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(z_.copy(Nd).applyMatrix4(Od),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class mc extends ct{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Fn extends xt{constructor(e=null,t=1,n=1,i,s,o,a,c,l=Mt,h=Mt,u,f){super(null,o,a,c,l,h,i,s,u,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const zd=new We,k_=new We;class no{constructor(e=[],t=[]){this.uuid=_n(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=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){Te("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new We)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new We;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:k_;zd.multiplyMatrices(a,t[s]),zd.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new no(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Fn(t,e,e,rn,nn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let o=t[s];o===void 0&&(Te("Skeleton: No bone found with UUID:",s),o=new mc),this.bones.push(o),this.boneInverses.push(new We().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Ji extends ot{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const us=new We,kd=new We,gc=[],Vd=new Gt,V_=new We,io=new St,ro=new Pt;class _c extends St{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ji(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,V_)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Gt),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,us),Vd.copy(e.boundingBox).applyMatrix4(us),this.boundingBox.union(Vd)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Pt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,us),ro.copy(e.boundingSphere).applyMatrix4(us),this.boundingSphere.union(ro)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,o=e*s+1;for(let a=0;a<n.length;a++)n[a]=i[o+a]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(io.geometry=this.geometry,io.material=this.material,io.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ro.copy(this.boundingSphere),ro.applyMatrix4(n),e.ray.intersectsSphere(ro)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,us),kd.multiplyMatrices(n,us),io.matrixWorld=kd,io.raycast(e,gc);for(let o=0,a=gc.length;o<a;o++){const c=gc[o];c.instanceId=s,c.object=this,t.push(c)}gc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ji(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Fn(new Float32Array(i*this.count),i,this.count,ea,nn));const s=this.morphTexture.source.data.data;let o=0;for(let l=0;l<n.length;l++)o+=n[l];const a=this.geometry.morphTargetsRelative?1:1-o,c=i*e;s[c]=a,s.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Nh=new U,H_=new U,G_=new et;class Ri{constructor(e=new U(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Nh.subVectors(n,t).cross(H_.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Nh),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||G_.getNormalMatrix(e),i=this.coplanarPoint(Nh).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const $i=new Pt,W_=new he(.5,.5),vc=new U;class fs{constructor(e=new Ri,t=new Ri,n=new Ri,i=new Ri,s=new Ri,o=new Ri){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=gn,n=!1){const i=this.planes,s=e.elements,o=s[0],a=s[1],c=s[2],l=s[3],h=s[4],u=s[5],f=s[6],d=s[7],g=s[8],_=s[9],m=s[10],p=s[11],v=s[12],y=s[13],x=s[14],A=s[15];if(i[0].setComponents(l-o,d-h,p-g,A-v).normalize(),i[1].setComponents(l+o,d+h,p+g,A+v).normalize(),i[2].setComponents(l+a,d+u,p+_,A+y).normalize(),i[3].setComponents(l-a,d-u,p-_,A-y).normalize(),n)i[4].setComponents(c,f,m,x).normalize(),i[5].setComponents(l-c,d-f,p-m,A-x).normalize();else if(i[4].setComponents(l-c,d-f,p-m,A-x).normalize(),t===gn)i[5].setComponents(l+c,d+f,p+m,A+x).normalize();else if(t===Vr)i[5].setComponents(c,f,m,x).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(),$i.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),$i.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere($i)}intersectsSprite(e){$i.center.set(0,0,0);const t=W_.distanceTo(e.center);return $i.radius=.7071067811865476+t,$i.applyMatrix4(e.matrixWorld),this.intersectsSphere($i)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(vc.x=i.normal.x>0?e.max.x:e.min.x,vc.y=i.normal.y>0?e.max.y:e.min.y,vc.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(vc)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const jn=new We,Jn=new fs;class yc{constructor(){this.coordinateSystem=gn}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(jn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Jn.setFromProjectionMatrix(jn,i.coordinateSystem,i.reversedDepth),Jn.containsPoint(e))return!0}return!1}clone(){return new yc}}function Uh(r,e){return r-e}function q_(r,e){return r.z-e.z}function X_(r,e){return e.z-r.z}class Z_{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){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=n,a.index=i}reset(){this.list.length=0,this.index=0}}const dn=new We,Y_=new xe(1,1,1),Hd=new fs,Q_=new yc,xc=new Gt,er=new Pt,so=new U,Gd=new U,K_=new U,Bh=new Z_,jt=new St,Ac=[];function j_(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let o=0;o<n;o++)e.setComponent(s+t,o,r.getComponent(s,o))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function tr(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++)e[n]=r[n]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class Wd extends St{constructor(e,t,n=t*2,i){super(new Ke,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Fn(t,e,e,rn,nn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Fn(t,e,e,Os,En);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Fn(t,e,e,rn,nn);n.colorSpace=rt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:c,normalized:l}=o,h=new a.constructor(n*c),u=new ot(h,c,l);t.setAttribute(s,u)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new ot(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(Boolean(e.getIndex())!==Boolean(t.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.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 Gt);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,dn),this.getBoundingBoxAt(s,xc).applyMatrix4(dn),e.union(xc)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Pt);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,dn),this.getBoundingSphereAt(s,er).applyMatrix4(dn),e.union(er)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Uh),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;dn.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(Y_.toArray(o.image.data,i*4),o.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?o.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let c;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Uh),c=this._availableGeometryIds.shift(),s[c]=i):(c=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(c,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,c}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(i&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const c=a.vertexStart,l=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const h in n.attributes){const u=t.getAttribute(h),f=n.getAttribute(h);j_(u,f,c);const d=u.itemSize;for(let g=u.count,_=l;g<_;g++){const m=c+g;for(let p=0;p<d;p++)f.setComponent(m,p,0)}f.needsUpdate=!0,f.addUpdateRange(c*d,l*d)}if(i){const h=a.indexStart,u=a.reservedIndexCount;a.indexCount=t.getIndex().count;for(let f=0;f<o.count;f++)s.setX(h+f,c+o.getX(f));for(let f=o.count,d=u;f<d;f++)s.setX(h+f,c);s.needsUpdate=!0,s.addUpdateRange(h,a.reservedIndexCount)}return a.start=i?a.indexStart:a.vertexStart,a.count=i?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 n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((o,a)=>a).sort((o,a)=>n[o].vertexStart-n[a].vertexStart),s=this.geometry;for(let o=0,a=n.length;o<a;o++){const c=i[o],l=n[c];if(l.active!==!1){if(s.index!==null){if(l.indexStart!==t){const{indexStart:h,vertexStart:u,reservedIndexCount:f}=l,d=s.index,g=d.array,_=e-u;for(let m=h;m<h+f;m++)g[m]=g[m]+_;d.array.copyWithin(t,h,h+f),d.addUpdateRange(t,f),d.needsUpdate=!0,l.indexStart=t}t+=l.reservedIndexCount}if(l.vertexStart!==e){const{vertexStart:h,reservedVertexCount:u}=l,f=s.attributes;for(const d in f){const g=f[d],{array:_,itemSize:m}=g;_.copyWithin(e*m,h*m,(h+u)*m),g.addUpdateRange(e*m,u*m),g.needsUpdate=!0}l.vertexStart=e}e+=l.reservedVertexCount,l.start=s.index?l.indexStart:l.vertexStart,this._nextIndexStart=s.index?l.indexStart+l.reservedIndexCount:0,this._nextVertexStart=l.vertexStart+l.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new Gt,o=n.index,a=n.attributes.position;for(let c=i.start,l=i.start+i.count;c<l;c++){let h=c;o&&(h=o.getX(h)),s.expandByPoint(so.fromBufferAttribute(a,h))}i.boundingBox=s}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new Pt;this.getBoundingBoxAt(e,xc),xc.getCenter(s.center);const o=n.index,a=n.attributes.position;let c=0;for(let l=i.start,h=i.start+i.count;l<h;l++){let u=l;o&&(u=o.getX(u)),so.fromBufferAttribute(a,u),c=Math.max(c,s.center.distanceToSquared(so))}s.radius=Math.sqrt(c),i.boundingSphere=s}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.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 n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(Uh);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);tr(this._multiDrawCounts,i),tr(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,c=this._colorsTexture;o.dispose(),this._initIndirectTexture(),tr(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),tr(a.image.data,this._matricesTexture.image.data),c&&(c.dispose(),this._initColorsTexture(),tr(c.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...n.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(...n.map(c=>c.indexStart+c.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 Ke,this._initializeGeometry(s));const o=this.geometry;s.index&&tr(s.index.array,o.index.array);for(const a in s.attributes)tr(s.attributes[a].array,o.attributes[a].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;jt.material=this.material,jt.geometry.index=o.index,jt.geometry.attributes=o.attributes,jt.geometry.boundingBox===null&&(jt.geometry.boundingBox=new Gt),jt.geometry.boundingSphere===null&&(jt.geometry.boundingSphere=new Pt);for(let a=0,c=n.length;a<c;a++){if(!n[a].visible||!n[a].active)continue;const l=n[a].geometryIndex,h=i[l];jt.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(a,jt.matrixWorld).premultiply(s),this.getBoundingBoxAt(l,jt.geometry.boundingBox),this.getBoundingSphereAt(l,jt.geometry.boundingSphere),jt.raycast(e,Ac);for(let u=0,f=Ac.length;u<f;u++){const d=Ac[u];d.object=this,d.batchId=a,t.push(d)}Ac.length=0}jt.material=null,jt.geometry.index=null,jt.geometry.attributes={},jt.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._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,c=this._instanceInfo,l=this._multiDrawStarts,h=this._multiDrawCounts,u=this._geometryInfo,f=this.perObjectFrustumCulled,d=this._indirectTexture,g=d.image.data,_=n.isArrayCamera?Q_:Hd;f&&!n.isArrayCamera&&(dn.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Hd.setFromProjectionMatrix(dn,n.coordinateSystem,n.reversedDepth));let m=0;if(this.sortObjects){dn.copy(this.matrixWorld).invert(),so.setFromMatrixPosition(n.matrixWorld).applyMatrix4(dn),Gd.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(dn);for(let y=0,x=c.length;y<x;y++)if(c[y].visible&&c[y].active){const A=c[y].geometryIndex;this.getMatrixAt(y,dn),this.getBoundingSphereAt(A,er).applyMatrix4(dn);let E=!1;if(f&&(E=!_.intersectsSphere(er,n)),!E){const I=u[A],D=K_.subVectors(er.center,so).dot(Gd);Bh.push(I.start,I.count,D,y)}}const p=Bh.list,v=this.customSort;v===null?p.sort(s.transparent?X_:q_):v.call(this,p,n);for(let y=0,x=p.length;y<x;y++){const A=p[y];l[m]=A.start*a,h[m]=A.count,g[m]=A.index,m++}Bh.reset()}else for(let p=0,v=c.length;p<v;p++)if(c[p].visible&&c[p].active){const y=c[p].geometryIndex;let x=!1;if(f&&(this.getMatrixAt(p,dn),this.getBoundingSphereAt(y,er).applyMatrix4(dn),x=!_.intersectsSphere(er,n)),!x){const A=u[y];l[m]=A.start*a,h[m]=A.count,g[m]=p,m++}}d.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class qt extends zt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new xe(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 bc=new U,wc=new U,qd=new We,oo=new Kr,Sc=new Pt,Oh=new U,Xd=new U;class di extends ct{constructor(e=new Ke,t=new qt){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)bc.fromBufferAttribute(t,i-1),wc.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=bc.distanceTo(wc);e.setAttribute("lineDistance",new Be(n,1))}else Te("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Sc.copy(n.boundingSphere),Sc.applyMatrix4(i),Sc.radius+=s,e.ray.intersectsSphere(Sc)===!1)return;qd.copy(i).invert(),oo.copy(e.ray).applyMatrix4(qd);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,h=n.index,f=n.attributes.position;if(h!==null){const d=Math.max(0,o.start),g=Math.min(h.count,o.start+o.count);for(let _=d,m=g-1;_<m;_+=l){const p=h.getX(_),v=h.getX(_+1),y=Mc(this,e,oo,c,p,v,_);y&&t.push(y)}if(this.isLineLoop){const _=h.getX(g-1),m=h.getX(d),p=Mc(this,e,oo,c,_,m,g-1);p&&t.push(p)}}else{const d=Math.max(0,o.start),g=Math.min(f.count,o.start+o.count);for(let _=d,m=g-1;_<m;_+=l){const p=Mc(this,e,oo,c,_,_+1,_);p&&t.push(p)}if(this.isLineLoop){const _=Mc(this,e,oo,c,g-1,d,g-1);_&&t.push(_)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Mc(r,e,t,n,i,s,o){const a=r.geometry.attributes.position;if(bc.fromBufferAttribute(a,i),wc.fromBufferAttribute(a,s),t.distanceSqToSegment(bc,wc,Oh,Xd)>n)return;Oh.applyMatrix4(r.matrixWorld);const l=e.ray.origin.distanceTo(Oh);if(!(l<e.near||l>e.far))return{distance:l,point:Xd.clone().applyMatrix4(r.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:r}}const Zd=new U,Yd=new U;class In extends di{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Zd.fromBufferAttribute(t,i),Yd.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Zd.distanceTo(Yd);e.setAttribute("lineDistance",new Be(n,1))}else Te("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Fh extends di{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Ec extends zt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new xe(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 Qd=new We,zh=new Kr,Tc=new Pt,Cc=new U;class kh extends ct{constructor(e=new Ke,t=new Ec){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Tc.copy(n.boundingSphere),Tc.applyMatrix4(i),Tc.radius+=s,e.ray.intersectsSphere(Tc)===!1)return;Qd.copy(i).invert(),zh.copy(e.ray).applyMatrix4(Qd);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=n.index,u=n.attributes.position;if(l!==null){const f=Math.max(0,o.start),d=Math.min(l.count,o.start+o.count);for(let g=f,_=d;g<_;g++){const m=l.getX(g);Cc.fromBufferAttribute(u,m),Kd(Cc,m,c,i,e,t,this)}}else{const f=Math.max(0,o.start),d=Math.min(u.count,o.start+o.count);for(let g=f,_=d;g<_;g++)Cc.fromBufferAttribute(u,g),Kd(Cc,g,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Kd(r,e,t,n,i,s,o){const a=zh.distanceSqToPoint(r);if(a<t){const c=new U;zh.closestPointToPoint(r,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class jd extends xt{constructor(e,t,n,i,s=pt,o=pt,a,c,l){super(e,t,n,i,s,o,a,c,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;function u(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=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)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class J_ extends jd{constructor(e,t,n,i,s,o,a,c){super({},e,t,n,i,s,o,a,c),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class $_ extends xt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Mt,this.minFilter=Mt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ic extends xt{constructor(e,t,n,i,s,o,a,c,l,h,u,f){super(null,o,a,c,l,h,i,s,u,f),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class ev extends Ic{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=tn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class tv extends Ic{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Xn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class nv extends xt{constructor(e,t,n,i,s,o,a,c,l){super(e,t,n,i,s,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ds extends xt{constructor(e,t,n=En,i,s,o,a=Mt,c=Mt,l,h=Yn,u=1){if(h!==Yn&&h!==xi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:u};super(f,i,s,o,a,c,h,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new wi(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Jd extends ds{constructor(e,t=En,n=Xn,i,s,o=Mt,a=Mt,c,l=Yn){const h={width:e,height:e,depth:1},u=[h,h,h,h,h,h];super(e,e,t,n,i,s,o,a,c,l),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Vh extends xt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Rc extends Ke{constructor(e=1,t=1,n=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:s},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const o=[],a=[],c=[],l=[],h=t/2,u=Math.PI/2*e,f=t,d=2*u+f,g=n*2+s,_=i+1,m=new U,p=new U;for(let v=0;v<=g;v++){let y=0,x=0,A=0,E=0;if(v<=n){const b=v/n,C=b*Math.PI/2;x=-h-e*Math.cos(C),A=e*Math.sin(C),E=-e*Math.cos(C),y=b*u}else if(v<=n+s){const b=(v-n)/s;x=-h+b*t,A=e,E=0,y=u+b*f}else{const b=(v-n-s)/n,C=b*Math.PI/2;x=h+e*Math.sin(C),A=e*Math.cos(C),E=e*Math.sin(C),y=u+f+b*u}const I=Math.max(0,Math.min(1,y/d));let D=0;v===0?D=.5/i:v===g&&(D=-.5/i);for(let b=0;b<=i;b++){const C=b/i,B=C*Math.PI*2,R=Math.sin(B),O=Math.cos(B);p.x=-A*O,p.y=x,p.z=A*R,a.push(p.x,p.y,p.z),m.set(-A*O,E,A*R),m.normalize(),c.push(m.x,m.y,m.z),l.push(C+D,I)}if(v>0){const b=(v-1)*_;for(let C=0;C<i;C++){const B=b+C,R=b+C+1,O=v*_+C,M=v*_+C+1;o.push(B,R,O),o.push(R,M,O)}}}this.setIndex(o),this.setAttribute("position",new Be(a,3)),this.setAttribute("normal",new Be(c,3)),this.setAttribute("uv",new Be(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Rc(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Pc extends Ke{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],o=[],a=[],c=[],l=new U,h=new he;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let u=0,f=3;u<=t;u++,f+=3){const d=n+u/t*i;l.x=e*Math.cos(d),l.y=e*Math.sin(d),o.push(l.x,l.y,l.z),a.push(0,0,1),h.x=(o[f]/e+1)/2,h.y=(o[f+1]/e+1)/2,c.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 Be(o,3)),this.setAttribute("normal",new Be(a,3)),this.setAttribute("uv",new Be(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pc(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ao extends Ke{constructor(e=1,t=1,n=1,i=32,s=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:c};const l=this;i=Math.floor(i),s=Math.floor(s);const h=[],u=[],f=[],d=[];let g=0;const _=[],m=n/2;let p=0;v(),o===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new Be(u,3)),this.setAttribute("normal",new Be(f,3)),this.setAttribute("uv",new Be(d,2));function v(){const x=new U,A=new U;let E=0;const I=(t-e)/n;for(let D=0;D<=s;D++){const b=[],C=D/s,B=C*(t-e)+e;for(let R=0;R<=i;R++){const O=R/i,M=O*c+a,z=Math.sin(M),X=Math.cos(M);A.x=B*z,A.y=-C*n+m,A.z=B*X,u.push(A.x,A.y,A.z),x.set(z,I,X).normalize(),f.push(x.x,x.y,x.z),d.push(O,1-C),b.push(g++)}_.push(b)}for(let D=0;D<i;D++)for(let b=0;b<s;b++){const C=_[b][D],B=_[b+1][D],R=_[b+1][D+1],O=_[b][D+1];(e>0||b!==0)&&(h.push(C,B,O),E+=3),(t>0||b!==s-1)&&(h.push(B,R,O),E+=3)}l.addGroup(p,E,0),p+=E}function y(x){const A=g,E=new he,I=new U;let D=0;const b=x===!0?e:t,C=x===!0?1:-1;for(let R=1;R<=i;R++)u.push(0,m*C,0),f.push(0,C,0),d.push(.5,.5),g++;const B=g;for(let R=0;R<=i;R++){const M=R/i*c+a,z=Math.cos(M),X=Math.sin(M);I.x=b*X,I.y=m*C,I.z=b*z,u.push(I.x,I.y,I.z),f.push(0,C,0),E.x=z*.5+.5,E.y=X*.5*C+.5,d.push(E.x,E.y),g++}for(let R=0;R<i;R++){const O=A+R,M=B+R;x===!0?h.push(M,M+1,O):h.push(M+1,M,O),D+=3}l.addGroup(p,D,x===!0?1:2),p+=D}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ao(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class co extends ao{constructor(e=1,t=1,n=32,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new co(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Pi extends Ke{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];a(i),l(n),h(),this.setAttribute("position",new Be(s,3)),this.setAttribute("normal",new Be(s.slice(),3)),this.setAttribute("uv",new Be(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(v){const y=new U,x=new U,A=new U;for(let E=0;E<t.length;E+=3)d(t[E+0],y),d(t[E+1],x),d(t[E+2],A),c(y,x,A,v)}function c(v,y,x,A){const E=A+1,I=[];for(let D=0;D<=E;D++){I[D]=[];const b=v.clone().lerp(x,D/E),C=y.clone().lerp(x,D/E),B=E-D;for(let R=0;R<=B;R++)R===0&&D===E?I[D][R]=b:I[D][R]=b.clone().lerp(C,R/B)}for(let D=0;D<E;D++)for(let b=0;b<2*(E-D)-1;b++){const C=Math.floor(b/2);b%2===0?(f(I[D][C+1]),f(I[D+1][C]),f(I[D][C])):(f(I[D][C+1]),f(I[D+1][C+1]),f(I[D+1][C]))}}function l(v){const y=new U;for(let x=0;x<s.length;x+=3)y.x=s[x+0],y.y=s[x+1],y.z=s[x+2],y.normalize().multiplyScalar(v),s[x+0]=y.x,s[x+1]=y.y,s[x+2]=y.z}function h(){const v=new U;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 x=m(v)/2/Math.PI+.5,A=p(v)/Math.PI+.5;o.push(x,1-A)}g(),u()}function u(){for(let v=0;v<o.length;v+=6){const y=o[v+0],x=o[v+2],A=o[v+4],E=Math.max(y,x,A),I=Math.min(y,x,A);E>.9&&I<.1&&(y<.2&&(o[v+0]+=1),x<.2&&(o[v+2]+=1),A<.2&&(o[v+4]+=1))}}function f(v){s.push(v.x,v.y,v.z)}function d(v,y){const x=v*3;y.x=e[x+0],y.y=e[x+1],y.z=e[x+2]}function g(){const v=new U,y=new U,x=new U,A=new U,E=new he,I=new he,D=new he;for(let b=0,C=0;b<s.length;b+=9,C+=6){v.set(s[b+0],s[b+1],s[b+2]),y.set(s[b+3],s[b+4],s[b+5]),x.set(s[b+6],s[b+7],s[b+8]),E.set(o[C+0],o[C+1]),I.set(o[C+2],o[C+3]),D.set(o[C+4],o[C+5]),A.copy(v).add(y).add(x).divideScalar(3);const B=m(A);_(E,C+0,v,B),_(I,C+2,y,B),_(D,C+4,x,B)}}function _(v,y,x,A){A<0&&v.x===1&&(o[y]=v.x-1),x.x===0&&x.z===0&&(o[y]=A/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 Pi(e.vertices,e.indices,e.radius,e.detail)}}class Dc extends Pi{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],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 Dc(e.radius,e.detail)}}const Lc=new U,Nc=new U,Hh=new U,Uc=new hn;class $d extends Ke{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(Zi*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,l=[0,0,0],h=["a","b","c"],u=new Array(3),f={},d=[];for(let g=0;g<c;g+=3){o?(l[0]=o.getX(g),l[1]=o.getX(g+1),l[2]=o.getX(g+2)):(l[0]=g,l[1]=g+1,l[2]=g+2);const{a:_,b:m,c:p}=Uc;if(_.fromBufferAttribute(a,l[0]),m.fromBufferAttribute(a,l[1]),p.fromBufferAttribute(a,l[2]),Uc.getNormal(Hh),u[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,u[1]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,u[2]=`${Math.round(p.x*i)},${Math.round(p.y*i)},${Math.round(p.z*i)}`,!(u[0]===u[1]||u[1]===u[2]||u[2]===u[0]))for(let v=0;v<3;v++){const y=(v+1)%3,x=u[v],A=u[y],E=Uc[h[v]],I=Uc[h[y]],D=`${x}_${A}`,b=`${A}_${x}`;b in f&&f[b]?(Hh.dot(f[b].normal)<=s&&(d.push(E.x,E.y,E.z),d.push(I.x,I.y,I.z)),f[b]=null):D in f||(f[D]={index0:l[v],index1:l[y],normal:Hh.clone()})}}for(const g in f)if(f[g]){const{index0:_,index1:m}=f[g];Lc.fromBufferAttribute(a,_),Nc.fromBufferAttribute(a,m),d.push(Lc.x,Lc.y,Lc.z),d.push(Nc.x,Nc.y,Nc.z)}this.setAttribute("position",new Be(d,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class zn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Te("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,c=s-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(s-1);const h=n[i],f=n[i+1]-h,d=(o-h)/f;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),c=t||(o.isVector2?new he:new U);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new U,i=[],s=[],o=[],a=new U,c=new We;for(let d=0;d<=e;d++){const g=d/e;i[d]=this.getTangentAt(g,new U)}s[0]=new U,o[0]=new U;let l=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);h<=l&&(l=h,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),f<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(Qe(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(c.makeRotationAxis(a,g))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(Qe(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let g=1;g<=e;g++)s[g].applyMatrix4(c.makeRotationAxis(i[g],d*g)),o[g].crossVectors(i[g],s[g])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Bc extends zn{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new he){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),f=c-this.aX,d=l-this.aY;c=f*h-d*u+this.aX,l=f*u+d*h+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class ep extends Bc{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function Gh(){let r=0,e=0,t=0,n=0;function i(s,o,a,c){r=s,e=a,t=-3*s+3*o-2*a-c,n=2*s-2*o+a+c}return{initCatmullRom:function(s,o,a,c,l){i(o,a,l*(a-s),l*(c-o))},initNonuniformCatmullRom:function(s,o,a,c,l,h,u){let f=(o-s)/l-(a-s)/(l+h)+(a-o)/h,d=(a-o)/h-(c-o)/(h+u)+(c-a)/u;f*=h,d*=h,i(o,a,f,d)},calc:function(s){const o=s*s,a=o*s;return r+e*s+t*o+n*a}}}const Oc=new U,Wh=new Gh,qh=new Gh,Xh=new Gh;class tp extends zn{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new U){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:c===0&&a===s-1&&(a=s-2,c=1);let l,h;this.closed||a>0?l=i[(a-1)%s]:(Oc.subVectors(i[0],i[1]).add(i[0]),l=Oc);const u=i[a%s],f=i[(a+1)%s];if(this.closed||a+2<s?h=i[(a+2)%s]:(Oc.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=Oc),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let g=Math.pow(l.distanceToSquared(u),d),_=Math.pow(u.distanceToSquared(f),d),m=Math.pow(f.distanceToSquared(h),d);_<1e-4&&(_=1),g<1e-4&&(g=_),m<1e-4&&(m=_),Wh.initNonuniformCatmullRom(l.x,u.x,f.x,h.x,g,_,m),qh.initNonuniformCatmullRom(l.y,u.y,f.y,h.y,g,_,m),Xh.initNonuniformCatmullRom(l.z,u.z,f.z,h.z,g,_,m)}else this.curveType==="catmullrom"&&(Wh.initCatmullRom(l.x,u.x,f.x,h.x,this.tension),qh.initCatmullRom(l.y,u.y,f.y,h.y,this.tension),Xh.initCatmullRom(l.z,u.z,f.z,h.z,this.tension));return n.set(Wh.calc(c),qh.calc(c),Xh.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new U().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function np(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,a=r*r,c=r*a;return(2*t-2*n+s+o)*c+(-3*t+3*n-2*s-o)*a+s*r+t}function iv(r,e){const t=1-r;return t*t*e}function rv(r,e){return 2*(1-r)*r*e}function sv(r,e){return r*r*e}function lo(r,e,t,n){return iv(r,e)+rv(r,t)+sv(r,n)}function ov(r,e){const t=1-r;return t*t*t*e}function av(r,e){const t=1-r;return 3*t*t*r*e}function cv(r,e){return 3*(1-r)*r*r*e}function lv(r,e){return r*r*r*e}function ho(r,e,t,n,i){return ov(r,e)+av(r,t)+cv(r,n)+lv(r,i)}class Zh extends zn{constructor(e=new he,t=new he,n=new he,i=new he){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new he){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(ho(e,i.x,s.x,o.x,a.x),ho(e,i.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class ip extends zn{constructor(e=new U,t=new U,n=new U,i=new U){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new U){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(ho(e,i.x,s.x,o.x,a.x),ho(e,i.y,s.y,o.y,a.y),ho(e,i.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Yh extends zn{constructor(e=new he,t=new he){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new he){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new he){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 rp extends zn{constructor(e=new U,t=new U){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new U){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new U){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 Qh extends zn{constructor(e=new he,t=new he,n=new he){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new he){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(lo(e,i.x,s.x,o.x),lo(e,i.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Kh extends zn{constructor(e=new U,t=new U,n=new U){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new U){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(lo(e,i.x,s.x,o.x),lo(e,i.y,s.y,o.y),lo(e,i.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class jh extends zn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new he){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,c=i[o===0?o:o-1],l=i[o],h=i[o>i.length-2?i.length-1:o+1],u=i[o>i.length-3?i.length-1:o+2];return n.set(np(a,c.x,l.x,h.x,u.x),np(a,c.y,l.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new he().fromArray(i))}return this}}var Fc=Object.freeze({__proto__:null,ArcCurve:ep,CatmullRomCurve3:tp,CubicBezierCurve:Zh,CubicBezierCurve3:ip,EllipseCurve:Bc,LineCurve:Yh,LineCurve3:rp,QuadraticBezierCurve:Qh,QuadraticBezierCurve3:Kh,SplineCurve:jh});class sp extends zn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Fc[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const o=i[s]-n,a=this.curves[s],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){const h=c[l];n&&n.equals(h)||(t.push(h),n=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,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Fc[i.type]().fromJSON(i))}return this}}class zc extends sp{constructor(e){super(),this.type="Path",this.currentPoint=new he,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Yh(this.currentPoint.clone(),new he(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Qh(this.currentPoint.clone(),new he(e,t),new he(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const a=new Zh(this.currentPoint.clone(),new he(e,t),new he(n,i),new he(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new jh(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,a,c){const l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,n,i,s,o,a,c),this}absellipse(e,t,n,i,s,o,a,c){const l=new Bc(e,t,n,i,s,o,a,c);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);const h=l.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 nr extends zc{constructor(e){super(e),this.uuid=_n(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new zc().fromJSON(i))}return this}}function hv(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=op(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,c,l;if(n&&(s=mv(r,e,s,t)),r.length>80*t){a=r[0],c=r[1];let h=a,u=c;for(let f=t;f<i;f+=t){const d=r[f],g=r[f+1];d<a&&(a=d),g<c&&(c=g),d>h&&(h=d),g>u&&(u=g)}l=Math.max(h-a,u-c),l=l!==0?32767/l:0}return uo(s,o,t,a,c,l,0),o}function op(r,e,t,n,i){let s;if(i===Ev(r,e,t,n)>0)for(let o=e;o<t;o+=n)s=hp(o/n|0,r[o],r[o+1],s);else for(let o=t-n;o>=e;o-=n)s=hp(o/n|0,r[o],r[o+1],s);return s&&ps(s,s.next)&&(mo(s),s=s.next),s}function ir(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ps(t,t.next)||Et(t.prev,t,t.next)===0)){if(mo(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function uo(r,e,t,n,i,s,o){if(!r)return;!o&&s&&xv(r,n,i,s);let a=r;for(;r.prev!==r.next;){const c=r.prev,l=r.next;if(s?fv(r,n,i,s):uv(r)){e.push(c.i,r.i,l.i),mo(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=dv(ir(r),e),uo(r,e,t,n,i,s,2)):o===2&&pv(r,e,t,n,i,s):uo(ir(r),e,t,n,i,s,1);break}}}function uv(r){const e=r.prev,t=r,n=r.next;if(Et(e,t,n)>=0)return!1;const i=e.x,s=t.x,o=n.x,a=e.y,c=t.y,l=n.y,h=Math.min(i,s,o),u=Math.min(a,c,l),f=Math.max(i,s,o),d=Math.max(a,c,l);let g=n.next;for(;g!==e;){if(g.x>=h&&g.x<=f&&g.y>=u&&g.y<=d&&fo(i,a,s,c,o,l,g.x,g.y)&&Et(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function fv(r,e,t,n){const i=r.prev,s=r,o=r.next;if(Et(i,s,o)>=0)return!1;const a=i.x,c=s.x,l=o.x,h=i.y,u=s.y,f=o.y,d=Math.min(a,c,l),g=Math.min(h,u,f),_=Math.max(a,c,l),m=Math.max(h,u,f),p=Jh(d,g,e,t,n),v=Jh(_,m,e,t,n);let y=r.prevZ,x=r.nextZ;for(;y&&y.z>=p&&x&&x.z<=v;){if(y.x>=d&&y.x<=_&&y.y>=g&&y.y<=m&&y!==i&&y!==o&&fo(a,h,c,u,l,f,y.x,y.y)&&Et(y.prev,y,y.next)>=0||(y=y.prevZ,x.x>=d&&x.x<=_&&x.y>=g&&x.y<=m&&x!==i&&x!==o&&fo(a,h,c,u,l,f,x.x,x.y)&&Et(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;y&&y.z>=p;){if(y.x>=d&&y.x<=_&&y.y>=g&&y.y<=m&&y!==i&&y!==o&&fo(a,h,c,u,l,f,y.x,y.y)&&Et(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=v;){if(x.x>=d&&x.x<=_&&x.y>=g&&x.y<=m&&x!==i&&x!==o&&fo(a,h,c,u,l,f,x.x,x.y)&&Et(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function dv(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ps(n,i)&&cp(n,t,t.next,i)&&po(n,i)&&po(i,n)&&(e.push(n.i,t.i,i.i),mo(t),mo(t.next),t=r=i),t=t.next}while(t!==r);return ir(t)}function pv(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&wv(o,a)){let c=lp(o,a);o=ir(o,o.next),c=ir(c,c.next),uo(o,e,t,n,i,s,0),uo(c,e,t,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function mv(r,e,t,n){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*n,c=s<o-1?e[s+1]*n:r.length,l=op(r,a,c,n,!1);l===l.next&&(l.steiner=!0),i.push(bv(l))}i.sort(gv);for(let s=0;s<i.length;s++)t=_v(i[s],t);return t}function gv(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function _v(r,e){const t=vv(r,e);if(!t)return e;const n=lp(t,r);return ir(n,n.next),ir(t,t.next)}function vv(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;if(ps(r,t))return t;do{if(ps(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const u=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>s&&(s=u,o=t.x<t.next.x?t:t.next,u===n))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,c=o.x,l=o.y;let h=1/0;t=o;do{if(n>=t.x&&t.x>=c&&n!==t.x&&ap(i<l?n:s,i,c,l,i<l?s:n,i,t.x,t.y)){const u=Math.abs(i-t.y)/(n-t.x);po(t,r)&&(u<h||u===h&&(t.x>o.x||t.x===o.x&&yv(o,t)))&&(o=t,h=u)}t=t.next}while(t!==a);return o}function yv(r,e){return Et(r.prev,r,e.prev)<0&&Et(e.next,r,r.next)<0}function xv(r,e,t,n){let i=r;do i.z===0&&(i.z=Jh(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Av(i)}function Av(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let l=0;l<t&&(a++,o=o.nextZ,!!o);l++);let c=t;for(;a>0||c>0&&o;)a!==0&&(c===0||!o||n.z<=o.z)?(i=n,n=n.nextZ,a--):(i=o,o=o.nextZ,c--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=o}s.nextZ=null,t*=2}while(e>1);return r}function Jh(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function bv(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function ap(r,e,t,n,i,s,o,a){return(i-o)*(e-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(n-a)}function fo(r,e,t,n,i,s,o,a){return!(r===o&&e===a)&&ap(r,e,t,n,i,s,o,a)}function wv(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Sv(r,e)&&(po(r,e)&&po(e,r)&&Mv(r,e)&&(Et(r.prev,r,e.prev)||Et(r,e.prev,e))||ps(r,e)&&Et(r.prev,r,r.next)>0&&Et(e.prev,e,e.next)>0)}function Et(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ps(r,e){return r.x===e.x&&r.y===e.y}function cp(r,e,t,n){const i=Vc(Et(r,e,t)),s=Vc(Et(r,e,n)),o=Vc(Et(t,n,r)),a=Vc(Et(t,n,e));return!!(i!==s&&o!==a||i===0&&kc(r,t,e)||s===0&&kc(r,n,e)||o===0&&kc(t,r,n)||a===0&&kc(t,e,n))}function kc(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Vc(r){return r>0?1:r<0?-1:0}function Sv(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&cp(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function po(r,e){return Et(r.prev,r,r.next)<0?Et(r,e,r.next)>=0&&Et(r,r.prev,e)>=0:Et(r,e,r.prev)<0||Et(r,r.next,e)<0}function Mv(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function lp(r,e){const t=$h(r.i,r.x,r.y),n=$h(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function hp(r,e,t,n){const i=$h(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function mo(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function $h(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ev(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class Tv{static triangulate(e,t,n=2){return hv(e,t,n)}}class kn{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return kn.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];up(e),fp(n,e);let o=e.length;t.forEach(up);for(let c=0;c<t.length;c++)i.push(o),o+=t[c].length,fp(n,t[c]);const a=Tv.triangulate(n,i);for(let c=0;c<a.length;c+=3)s.push(a.slice(c,c+3));return s}}function up(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function fp(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Hc extends Ke{constructor(e=new nr([new he(.5,.5),new he(-.5,.5),new he(-.5,-.5),new he(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];o(l)}this.setAttribute("position",new Be(i,3)),this.setAttribute("uv",new Be(s,2)),this.computeVertexNormals();function o(a){const c=[],l=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1;let f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,g=t.bevelSize!==void 0?t.bevelSize:d-.1,_=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:Cv;let y,x=!1,A,E,I,D;if(p){y=p.getSpacedPoints(h),x=!0,f=!1;const w=p.isCatmullRomCurve3?p.closed:!1;A=p.computeFrenetFrames(h,w),E=new U,I=new U,D=new U}f||(m=0,d=0,g=0,_=0);const b=a.extractPoints(l);let C=b.shape;const B=b.holes;if(!kn.isClockWise(C)){C=C.reverse();for(let w=0,q=B.length;w<q;w++){const k=B[w];kn.isClockWise(k)&&(B[w]=k.reverse())}}function O(w){const k=10000000000000001e-36;let N=w[0];for(let S=1;S<=w.length;S++){const G=S%w.length,K=w[G],ie=K.x-N.x,V=K.y-N.y,P=ie*ie+V*V,T=Math.max(Math.abs(K.x),Math.abs(K.y),Math.abs(N.x),Math.abs(N.y)),F=k*T*T;if(P<=F){w.splice(G,1),S--;continue}N=K}}O(C),B.forEach(O);const M=B.length,z=C;for(let w=0;w<M;w++){const q=B[w];C=C.concat(q)}function X(w,q,k){return q||Ge("ExtrudeGeometry: vec does not exist"),w.clone().addScaledVector(q,k)}const H=C.length;function re(w,q,k){let N,S,G;const K=w.x-q.x,ie=w.y-q.y,V=k.x-w.x,P=k.y-w.y,T=K*K+ie*ie,F=K*P-ie*V;if(Math.abs(F)>Number.EPSILON){const Q=Math.sqrt(T),ce=Math.sqrt(V*V+P*P),te=q.x-ie/Q,Re=q.y+K/Q,we=k.x-P/ce,Le=k.y+V/ce,Xe=((we-te)*P-(Le-Re)*V)/(K*P-ie*V);N=te+K*Xe-w.x,S=Re+ie*Xe-w.y;const fe=N*N+S*S;if(fe<=2)return new he(N,S);G=Math.sqrt(fe/2)}else{let Q=!1;K>Number.EPSILON?V>Number.EPSILON&&(Q=!0):K<-Number.EPSILON?V<-Number.EPSILON&&(Q=!0):Math.sign(ie)===Math.sign(P)&&(Q=!0),Q?(N=-ie,S=K,G=Math.sqrt(T)):(N=K,S=ie,G=Math.sqrt(T/2))}return new he(N/G,S/G)}const J=[];for(let w=0,q=z.length,k=q-1,N=w+1;w<q;w++,k++,N++)k===q&&(k=0),N===q&&(N=0),J[w]=re(z[w],z[k],z[N]);const le=[];let W,Z=J.concat();for(let w=0,q=M;w<q;w++){const k=B[w];W=[];for(let N=0,S=k.length,G=S-1,K=N+1;N<S;N++,G++,K++)G===S&&(G=0),K===S&&(K=0),W[N]=re(k[N],k[G],k[K]);le.push(W),Z=Z.concat(W)}let ge;if(m===0)ge=kn.triangulateShape(z,B);else{const w=[],q=[];for(let k=0;k<m;k++){const N=k/m,S=d*Math.cos(N*Math.PI/2),G=g*Math.sin(N*Math.PI/2)+_;for(let K=0,ie=z.length;K<ie;K++){const V=X(z[K],J[K],G);ye(V.x,V.y,-S),N===0&&w.push(V)}for(let K=0,ie=M;K<ie;K++){const V=B[K];W=le[K];const P=[];for(let T=0,F=V.length;T<F;T++){const Q=X(V[T],W[T],G);ye(Q.x,Q.y,-S),N===0&&P.push(Q)}N===0&&q.push(P)}}ge=kn.triangulateShape(w,q)}const _e=ge.length,de=g+_;for(let w=0;w<H;w++){const q=f?X(C[w],Z[w],de):C[w];x?(I.copy(A.normals[0]).multiplyScalar(q.x),E.copy(A.binormals[0]).multiplyScalar(q.y),D.copy(y[0]).add(I).add(E),ye(D.x,D.y,D.z)):ye(q.x,q.y,0)}for(let w=1;w<=h;w++)for(let q=0;q<H;q++){const k=f?X(C[q],Z[q],de):C[q];x?(I.copy(A.normals[w]).multiplyScalar(k.x),E.copy(A.binormals[w]).multiplyScalar(k.y),D.copy(y[w]).add(I).add(E),ye(D.x,D.y,D.z)):ye(k.x,k.y,u/h*w)}for(let w=m-1;w>=0;w--){const q=w/m,k=d*Math.cos(q*Math.PI/2),N=g*Math.sin(q*Math.PI/2)+_;for(let S=0,G=z.length;S<G;S++){const K=X(z[S],J[S],N);ye(K.x,K.y,u+k)}for(let S=0,G=B.length;S<G;S++){const K=B[S];W=le[S];for(let ie=0,V=K.length;ie<V;ie++){const P=X(K[ie],W[ie],N);x?ye(P.x,P.y+y[h-1].y,y[h-1].x+k):ye(P.x,P.y,u+k)}}}oe(),ee();function oe(){const w=i.length/3;if(f){let q=0,k=H*q;for(let N=0;N<_e;N++){const S=ge[N];Ae(S[2]+k,S[1]+k,S[0]+k)}q=h+m*2,k=H*q;for(let N=0;N<_e;N++){const S=ge[N];Ae(S[0]+k,S[1]+k,S[2]+k)}}else{for(let q=0;q<_e;q++){const k=ge[q];Ae(k[2],k[1],k[0])}for(let q=0;q<_e;q++){const k=ge[q];Ae(k[0]+H*h,k[1]+H*h,k[2]+H*h)}}n.addGroup(w,i.length/3-w,0)}function ee(){const w=i.length/3;let q=0;pe(z,q),q+=z.length;for(let k=0,N=B.length;k<N;k++){const S=B[k];pe(S,q),q+=S.length}n.addGroup(w,i.length/3-w,1)}function pe(w,q){let k=w.length;for(;--k>=0;){const N=k;let S=k-1;S<0&&(S=w.length-1);for(let G=0,K=h+m*2;G<K;G++){const ie=H*G,V=H*(G+1),P=q+N+ie,T=q+S+ie,F=q+S+V,Q=q+N+V;ze(P,T,F,Q)}}}function ye(w,q,k){c.push(w),c.push(q),c.push(k)}function Ae(w,q,k){je(w),je(q),je(k);const N=i.length/3,S=v.generateTopUV(n,i,N-3,N-2,N-1);He(S[0]),He(S[1]),He(S[2])}function ze(w,q,k,N){je(w),je(q),je(N),je(q),je(k),je(N);const S=i.length/3,G=v.generateSideWallUV(n,i,S-6,S-3,S-2,S-1);He(G[0]),He(G[1]),He(G[3]),He(G[1]),He(G[2]),He(G[3])}function je(w){i.push(c[w*3+0]),i.push(c[w*3+1]),i.push(c[w*3+2])}function He(w){s.push(w.x),s.push(w.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Iv(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Fc[i.type]().fromJSON(i)),new Hc(n,e.options)}}const Cv={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1],a=e[n*3],c=e[n*3+1],l=e[i*3],h=e[i*3+1];return[new he(s,o),new he(a,c),new he(l,h)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[n*3],h=e[n*3+1],u=e[n*3+2],f=e[i*3],d=e[i*3+1],g=e[i*3+2],_=e[s*3],m=e[s*3+1],p=e[s*3+2];return Math.abs(a-h)<Math.abs(o-l)?[new he(o,1-c),new he(l,1-u),new he(f,1-g),new he(_,1-p)]:[new he(a,1-c),new he(h,1-u),new he(d,1-g),new he(m,1-p)]}};function Iv(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Gc extends Pi{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Gc(e.radius,e.detail)}}class Wc extends Ke{constructor(e=[new he(0,-.5),new he(.5,0),new he(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Qe(i,0,Math.PI*2);const s=[],o=[],a=[],c=[],l=[],h=1/t,u=new U,f=new he,d=new U,g=new U,_=new U;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,d.x=p*1,d.y=-m,d.z=p*0,_.copy(d),d.normalize(),c.push(d.x,d.y,d.z);break;case e.length-1:c.push(_.x,_.y,_.z);break;default:m=e[v+1].x-e[v].x,p=e[v+1].y-e[v].y,d.x=p*1,d.y=-m,d.z=p*0,g.copy(d),d.x+=_.x,d.y+=_.y,d.z+=_.z,d.normalize(),c.push(d.x,d.y,d.z),_.copy(g)}for(let v=0;v<=t;v++){const y=n+v*h*i,x=Math.sin(y),A=Math.cos(y);for(let E=0;E<=e.length-1;E++){u.x=e[E].x*x,u.y=e[E].y,u.z=e[E].x*A,o.push(u.x,u.y,u.z),f.x=v/t,f.y=E/(e.length-1),a.push(f.x,f.y);const I=c[3*E+0]*x,D=c[3*E+1],b=c[3*E+0]*A;l.push(I,D,b)}}for(let v=0;v<t;v++)for(let y=0;y<e.length-1;y++){const x=y+v*e.length,A=x,E=x+e.length,I=x+e.length+1,D=x+1;s.push(A,E,D),s.push(I,D,E)}this.setIndex(s),this.setAttribute("position",new Be(o,3)),this.setAttribute("uv",new Be(a,2)),this.setAttribute("normal",new Be(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wc(e.points,e.segments,e.phiStart,e.phiLength)}}class go extends Pi{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new go(e.radius,e.detail)}}class rr extends Ke{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,o=t/2,a=Math.floor(n),c=Math.floor(i),l=a+1,h=c+1,u=e/a,f=t/c,d=[],g=[],_=[],m=[];for(let p=0;p<h;p++){const v=p*f-o;for(let y=0;y<l;y++){const x=y*u-s;g.push(x,-v,0),_.push(0,0,1),m.push(y/a),m.push(1-p/c)}}for(let p=0;p<c;p++)for(let v=0;v<a;v++){const y=v+l*p,x=v+l*(p+1),A=v+1+l*(p+1),E=v+1+l*p;d.push(y,x,E),d.push(x,A,E)}this.setIndex(d),this.setAttribute("position",new Be(g,3)),this.setAttribute("normal",new Be(_,3)),this.setAttribute("uv",new Be(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rr(e.width,e.height,e.widthSegments,e.heightSegments)}}class qc extends Ke{constructor(e=.5,t=1,n=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],c=[],l=[],h=[];let u=e;const f=(t-e)/i,d=new U,g=new he;for(let _=0;_<=i;_++){for(let m=0;m<=n;m++){const p=s+m/n*o;d.x=u*Math.cos(p),d.y=u*Math.sin(p),c.push(d.x,d.y,d.z),l.push(0,0,1),g.x=(d.x/t+1)/2,g.y=(d.y/t+1)/2,h.push(g.x,g.y)}u+=f}for(let _=0;_<i;_++){const m=_*(n+1);for(let p=0;p<n;p++){const v=p+m,y=v,x=v+n+1,A=v+n+2,E=v+1;a.push(y,x,E),a.push(x,A,E)}}this.setIndex(a),this.setAttribute("position",new Be(c,3)),this.setAttribute("normal",new Be(l,3)),this.setAttribute("uv",new Be(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qc(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Xc extends Ke{constructor(e=new nr([new he(0,.5),new he(-.5,-.5),new he(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let h=0;h<e.length;h++)l(e[h]),this.addGroup(a,c,h),a+=c,c=0;this.setIndex(n),this.setAttribute("position",new Be(i,3)),this.setAttribute("normal",new Be(s,3)),this.setAttribute("uv",new Be(o,2));function l(h){const u=i.length/3,f=h.extractPoints(t);let d=f.shape;const g=f.holes;kn.isClockWise(d)===!1&&(d=d.reverse());for(let m=0,p=g.length;m<p;m++){const v=g[m];kn.isClockWise(v)===!0&&(g[m]=v.reverse())}const _=kn.triangulateShape(d,g);for(let m=0,p=g.length;m<p;m++){const v=g[m];d=d.concat(v)}for(let m=0,p=d.length;m<p;m++){const v=d[m];i.push(v.x,v.y,0),s.push(0,0,1),o.push(v.x,v.y)}for(let m=0,p=_.length;m<p;m++){const v=_[m],y=v[0]+u,x=v[1]+u,A=v[2]+u;n.push(y,x,A),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return Rv(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new Xc(n,e.curveSegments)}}function Rv(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class ms extends Ke{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(o+a,Math.PI);let l=0;const h=[],u=new U,f=new U,d=[],g=[],_=[],m=[];for(let p=0;p<=n;p++){const v=[],y=p/n;let x=0;p===0&&o===0?x=.5/t:p===n&&c===Math.PI&&(x=-.5/t);for(let A=0;A<=t;A++){const E=A/t;u.x=-e*Math.cos(i+E*s)*Math.sin(o+y*a),u.y=e*Math.cos(o+y*a),u.z=e*Math.sin(i+E*s)*Math.sin(o+y*a),g.push(u.x,u.y,u.z),f.copy(u).normalize(),_.push(f.x,f.y,f.z),m.push(E+x,1-y),v.push(l++)}h.push(v)}for(let p=0;p<n;p++)for(let v=0;v<t;v++){const y=h[p][v+1],x=h[p][v],A=h[p+1][v],E=h[p+1][v+1];(p!==0||o>0)&&d.push(y,x,E),(p!==n-1||c<Math.PI)&&d.push(x,A,E)}this.setIndex(d),this.setAttribute("position",new Be(g,3)),this.setAttribute("normal",new Be(_,3)),this.setAttribute("uv",new Be(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ms(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Zc extends Pi{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Zc(e.radius,e.detail)}}class Yc extends Ke{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],c=[],l=[],h=new U,u=new U,f=new U;for(let d=0;d<=n;d++)for(let g=0;g<=i;g++){const _=g/i*s,m=d/n*Math.PI*2;u.x=(e+t*Math.cos(m))*Math.cos(_),u.y=(e+t*Math.cos(m))*Math.sin(_),u.z=t*Math.sin(m),a.push(u.x,u.y,u.z),h.x=e*Math.cos(_),h.y=e*Math.sin(_),f.subVectors(u,h).normalize(),c.push(f.x,f.y,f.z),l.push(g/i),l.push(d/n)}for(let d=1;d<=n;d++)for(let g=1;g<=i;g++){const _=(i+1)*d+g-1,m=(i+1)*(d-1)+g-1,p=(i+1)*(d-1)+g,v=(i+1)*d+g;o.push(_,m,v),o.push(m,p,v)}this.setIndex(o),this.setAttribute("position",new Be(a,3)),this.setAttribute("normal",new Be(c,3)),this.setAttribute("uv",new Be(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yc(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Qc extends Ke{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],l=[],h=[],u=new U,f=new U,d=new U,g=new U,_=new U,m=new U,p=new U;for(let y=0;y<=n;++y){const x=y/n*s*Math.PI*2;v(x,s,o,e,d),v(x+.01,s,o,e,g),m.subVectors(g,d),p.addVectors(g,d),_.crossVectors(m,p),p.crossVectors(_,m),_.normalize(),p.normalize();for(let A=0;A<=i;++A){const E=A/i*Math.PI*2,I=-t*Math.cos(E),D=t*Math.sin(E);u.x=d.x+(I*p.x+D*_.x),u.y=d.y+(I*p.y+D*_.y),u.z=d.z+(I*p.z+D*_.z),c.push(u.x,u.y,u.z),f.subVectors(u,d).normalize(),l.push(f.x,f.y,f.z),h.push(y/n),h.push(A/i)}}for(let y=1;y<=n;y++)for(let x=1;x<=i;x++){const A=(i+1)*(y-1)+(x-1),E=(i+1)*y+(x-1),I=(i+1)*y+x,D=(i+1)*(y-1)+x;a.push(A,E,D),a.push(E,I,D)}this.setIndex(a),this.setAttribute("position",new Be(c,3)),this.setAttribute("normal",new Be(l,3)),this.setAttribute("uv",new Be(h,2));function v(y,x,A,E,I){const D=Math.cos(y),b=Math.sin(y),C=A/x*y,B=Math.cos(C);I.x=E*(2+B)*.5*D,I.y=E*(2+B)*b*.5,I.z=E*Math.sin(C)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Kc extends Ke{constructor(e=new Kh(new U(-1,-1,0),new U(-1,1,0),new U(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new U,c=new U,l=new he;let h=new U;const u=[],f=[],d=[],g=[];_(),this.setIndex(g),this.setAttribute("position",new Be(u,3)),this.setAttribute("normal",new Be(f,3)),this.setAttribute("uv",new Be(d,2));function _(){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 x=o.normals[y],A=o.binormals[y];for(let E=0;E<=i;E++){const I=E/i*Math.PI*2,D=Math.sin(I),b=-Math.cos(I);c.x=b*x.x+D*A.x,c.y=b*x.y+D*A.y,c.z=b*x.z+D*A.z,c.normalize(),f.push(c.x,c.y,c.z),a.x=h.x+n*c.x,a.y=h.y+n*c.y,a.z=h.z+n*c.z,u.push(a.x,a.y,a.z)}}function p(){for(let y=1;y<=t;y++)for(let x=1;x<=i;x++){const A=(i+1)*(y-1)+(x-1),E=(i+1)*y+(x-1),I=(i+1)*y+x,D=(i+1)*(y-1)+x;g.push(A,E,D),g.push(E,I,D)}}function v(){for(let y=0;y<=t;y++)for(let x=0;x<=i;x++)l.x=y/t,l.y=x/i,d.push(l.x,l.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 Kc(new Fc[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class eu extends Ke{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new U,s=new U;if(e.index!==null){const o=e.attributes.position,a=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:a.count,materialIndex:0}]);for(let l=0,h=c.length;l<h;++l){const u=c[l],f=u.start,d=u.count;for(let g=f,_=f+d;g<_;g+=3)for(let m=0;m<3;m++){const p=a.getX(g+m),v=a.getX(g+(m+1)%3);i.fromBufferAttribute(o,p),s.fromBufferAttribute(o,v),dp(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,c=o.count/3;a<c;a++)for(let l=0;l<3;l++){const h=3*a+l,u=3*a+(l+1)%3;i.fromBufferAttribute(o,h),s.fromBufferAttribute(o,u),dp(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Be(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function dp(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var pp=Object.freeze({__proto__:null,BoxGeometry:ji,CapsuleGeometry:Rc,CircleGeometry:Pc,ConeGeometry:co,CylinderGeometry:ao,DodecahedronGeometry:Dc,EdgesGeometry:$d,ExtrudeGeometry:Hc,IcosahedronGeometry:Gc,LatheGeometry:Wc,OctahedronGeometry:go,PlaneGeometry:rr,PolyhedronGeometry:Pi,RingGeometry:qc,ShapeGeometry:Xc,SphereGeometry:ms,TetrahedronGeometry:Zc,TorusGeometry:Yc,TorusKnotGeometry:Qc,TubeGeometry:Kc,WireframeGeometry:eu});class mp extends zt{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new xe(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 tu extends Cn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class gs extends zt{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new xe(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 xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(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 Zt,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 Rn extends gs{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 he(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Qe(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 xe(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 xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xe(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 gp extends zt{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new xe(16777215),this.specular=new xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zt,this.combine=Ns,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 _p extends zt{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(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 vp extends zt{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(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 yp extends zt{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zt,this.combine=Ns,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 nu extends zt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Yf,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 iu extends zt{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 xp extends zt{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ai,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ap extends qt{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 sr(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function bp(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function ru(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let c=0;c!==e;++c)i[o++]=r[a+c]}return i}function su(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push(...o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}function Pv(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let c=0;c<s.tracks.length;++c){const l=s.tracks[c],h=l.getValueSize(),u=[],f=[];for(let d=0;d<l.times.length;++d){const g=l.times[d]*i;if(!(g<t||g>=n)){u.push(l.times[d]);for(let _=0;_<h;++_)f.push(l.values[d*h+_])}}u.length!==0&&(l.times=sr(u,l.times.constructor),l.values=sr(f,l.values.constructor),o.push(l))}s.tracks=o;let a=1/0;for(let c=0;c<s.tracks.length;++c)a>s.tracks[c].times[0]&&(a=s.tracks[c].times[0]);for(let c=0;c<s.tracks.length;++c)s.tracks[c].shift(-1*a);return s.resetDuration(),s}function Dv(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;const l=r.tracks.find(function(p){return p.name===a.name&&p.ValueTypeName===c});if(l===void 0)continue;let h=0;const u=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let f=0;const d=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);const g=a.times.length-1;let _;if(s<=a.times[0]){const p=h,v=u-h;_=a.values.slice(p,v)}else if(s>=a.times[g]){const p=g*u+h,v=p+u-h;_=a.values.slice(p,v)}else{const p=a.createInterpolant(),v=h,y=u-h;p.evaluate(s),_=p.resultBuffer.slice(v,y)}c==="quaternion"&&new wt().fromArray(_).normalize().conjugate().toArray(_);const m=l.times.length;for(let p=0;p<m;++p){const v=p*d+f;if(c==="quaternion")wt.multiplyQuaternionsFlat(l.values,v,_,0,l.values,v);else{const y=d-f*2;for(let x=0;x<y;++x)l.values[v+x]-=_[x]}}}return r.blendMode=$l,r}class Lv{static convertArray(e,t){return sr(e,t)}static isTypedArray(e){return id(e)}static getKeyframeOrder(e){return bp(e)}static sortedArray(e,t,n){return ru(e,t,n)}static flattenJSON(e,t,n,i){su(e,t,n,i)}static subclip(e,t,n,i,s=30){return Pv(e,t,n,i,s)}static makeClipAdditive(e,t=0,n=e,i=30){return Dv(e,t,n,i)}}class _s{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(n=2,s=a);for(let c=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class wp extends _s{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Wi,endingEnd:Wi}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],c=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case qi:s=e,a=2*t-n;break;case Hs:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case qi:o=e,c=2*n-t;break;case Hs:o=1,c=n+i[1]-i[0];break;default:o=e-1,c=t}const l=(n-t)*.5,h=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-n),this._offsetPrev=s*h,this._offsetNext=o*h}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,g=(n-t)/(i-t),_=g*g,m=_*g,p=-f*m+2*f*_-f*g,v=(1+f)*m+(-1.5-2*f)*_+(-.5+f)*g+1,y=(-1-d)*m+(1.5+d)*_+.5*g,x=d*m-d*_;for(let A=0;A!==a;++A)s[A]=p*o[h+A]+v*o[l+A]+y*o[c+A]+x*o[u+A];return s}}class ou extends _s{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=(n-t)/(i-t),u=1-h;for(let f=0;f!==a;++f)s[f]=o[l+f]*u+o[c+f]*h;return s}}class Sp extends _s{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Pn{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=sr(t,this.TimeBufferType),this.values=sr(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:sr(e.times,Array),values:sr(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Sp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ou(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new wp(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Fr:t=this.InterpolantFactoryMethodDiscrete;break;case zr:t=this.InterpolantFactoryMethodLinear;break;case Ua:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Te("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Fr;case this.InterpolantFactoryMethodLinear:return zr;case this.InterpolantFactoryMethodSmooth:return Ua}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=n.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&&(Ge("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(Ge("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){Ge("KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){Ge("KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&id(i))for(let a=0,c=i.length;a!==c;++a){const l=i[a];if(isNaN(l)){Ge("KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Ua,s=e.length-1;let o=1;for(let a=1;a<s;++a){let c=!1;const l=e[a],h=e[a+1];if(l!==h&&(a!==1||l!==e[0]))if(i)c=!0;else{const u=a*n,f=u-n,d=u+n;for(let g=0;g!==n;++g){const _=t[u+g];if(_!==t[f+g]||_!==t[d+g]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];const u=a*n,f=o*n;for(let d=0;d!==n;++d)t[f+d]=t[u+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Pn.prototype.ValueTypeName="",Pn.prototype.TimeBufferType=Float32Array,Pn.prototype.ValueBufferType=Float32Array,Pn.prototype.DefaultInterpolation=zr;class or extends Pn{constructor(e,t,n){super(e,t,n)}}or.prototype.ValueTypeName="bool",or.prototype.ValueBufferType=Array,or.prototype.DefaultInterpolation=Fr,or.prototype.InterpolantFactoryMethodLinear=void 0,or.prototype.InterpolantFactoryMethodSmooth=void 0;class au extends Pn{constructor(e,t,n,i){super(e,t,n,i)}}au.prototype.ValueTypeName="color";class ar extends Pn{constructor(e,t,n,i){super(e,t,n,i)}}ar.prototype.ValueTypeName="number";class Mp extends _s{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let l=e*a;for(let h=l+a;l!==h;l+=4)wt.slerpFlat(s,0,o,l-a,o,l,c);return s}}class cr extends Pn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Mp(this.times,this.values,this.getValueSize(),e)}}cr.prototype.ValueTypeName="quaternion",cr.prototype.InterpolantFactoryMethodSmooth=void 0;class lr extends Pn{constructor(e,t,n){super(e,t,n)}}lr.prototype.ValueTypeName="string",lr.prototype.ValueBufferType=Array,lr.prototype.DefaultInterpolation=Fr,lr.prototype.InterpolantFactoryMethodLinear=void 0,lr.prototype.InterpolantFactoryMethodSmooth=void 0;class hr extends Pn{constructor(e,t,n,i){super(e,t,n,i)}}hr.prototype.ValueTypeName="vector";class vs{constructor(e="",t=-1,n=[],i=Ba){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=_n(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(Uv(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,o=n.length;s!==o;++s)t.push(Pn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a<s;a++){let c=[],l=[];c.push((a+s-1)%s,a,(a+1)%s),l.push(0,1,0);const h=bp(c);c=ru(c,1,h),l=ru(l,1,h),!i&&c[0]===0&&(c.push(s),l.push(l[0])),o.push(new ar(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const l=e[a],h=l.name.match(s);if(h&&h.length>1){const u=h[1];let f=i[u];f||(i[u]=f=[]),f.push(l)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(Te("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Ge("AnimationClip: No animation in JSONLoader data."),null;const n=function(u,f,d,g,_){if(d.length!==0){const m=[],p=[];su(d,m,p,g),m.length!==0&&_.push(new u(f,m,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let u=0;u<l.length;u++){const f=l[u].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let g;for(g=0;g<f.length;g++)if(f[g].morphTargets)for(let _=0;_<f[g].morphTargets.length;_++)d[f[g].morphTargets[_]]=-1;for(const _ in d){const m=[],p=[];for(let v=0;v!==f[g].morphTargets.length;++v){const y=f[g];m.push(y.time),p.push(y.morphTarget===_?1:0)}i.push(new ar(".morphTargetInfluence["+_+"]",m,p))}c=d.length*o}else{const d=".bones["+t[u].name+"]";n(hr,d+".position",f,"pos",i),n(cr,d+".quaternion",f,"rot",i),n(hr,d+".scale",f,"scl",i)}}return i.length===0?null:new this(s,c,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Nv(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ar;case"vector":case"vector2":case"vector3":case"vector4":return hr;case"color":return au;case"quaternion":return cr;case"bool":case"boolean":return or;case"string":return lr}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function Uv(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Nv(r.type);if(r.times===void 0){const t=[],n=[];su(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const $n={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class cu{constructor(e,t,n){const i=this;let s=!1,o=0,a=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(h){a++,s===!1&&i.onStart!==void 0&&i.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,i.onProgress!==void 0&&i.onProgress(h,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,u){return l.push(h,u),this},this.removeHandler=function(h){const u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,f=l.length;u<f;u+=2){const d=l[u],g=l[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const Ep=new cu;class Jt{constructor(e){this.manager=e!==void 0?e:Ep,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Jt.DEFAULT_MATERIAL_NAME="__DEFAULT";const pi={};class Bv extends Error{constructor(e,t){super(e),this.response=t}}class An extends Jt{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=$n.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(pi[e]!==void 0){pi[e].push({onLoad:t,onProgress:n,onError:i});return}pi[e]=[],pi[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&Te("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const h=pi[e],u=l.body.getReader(),f=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),d=f?parseInt(f):0,g=d!==0;let _=0;const m=new ReadableStream({start(p){v();function v(){u.read().then(({done:y,value:x})=>{if(y)p.close();else{_+=x.byteLength;const A=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:d});for(let E=0,I=h.length;E<I;E++){const D=h[E];D.onProgress&&D.onProgress(A)}p.enqueue(x),v()}},y=>{p.error(y)})}}});return new Response(m)}else throw new Bv(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return l.json();default:if(a==="")return l.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return l.arrayBuffer().then(g=>d.decode(g))}}}).then(l=>{$n.add(`file:${e}`,l);const h=pi[e];delete pi[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onLoad&&d.onLoad(l)}}).catch(l=>{const h=pi[e];if(h===void 0)throw this.manager.itemError(e),l;delete pi[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onError&&d.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Ov extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new An(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(c){i?i(c):Ge(c),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=vs.parse(e[n]);t.push(i)}return t}}class Fv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],a=new Ic,c=new An(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(s.withCredentials);let l=0;function h(u){c.load(e[u],function(f){const d=s.parse(f,!0);o[u]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},l+=1,l===6&&(d.mipmapCount===1&&(a.minFilter=pt),a.image=o,a.format=d.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let u=0,f=e.length;u<f;++u)h(u);else c.load(e,function(u){const f=s.parse(u,!0);if(f.isCubemap){const d=f.mipmaps.length/f.mipmapCount;for(let g=0;g<d;g++){o[g]={mipmaps:[]};for(let _=0;_<f.mipmapCount;_++)o[g].mipmaps.push(f.mipmaps[g*f.mipmapCount+_]),o[g].format=f.format,o[g].width=f.width,o[g].height=f.height}a.image=o}else a.image.width=f.width,a.image.height=f.height,a.mipmaps=f.mipmaps;f.mipmapCount===1&&(a.minFilter=pt),a.format=f.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}const ys=new WeakMap;class _o extends Jt{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$n.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let u=ys.get(o);u===void 0&&(u=[],ys.set(o,u)),u.push({onLoad:t,onError:i})}return o}const a=Ws("img");function c(){h(),t&&t(this);const u=ys.get(this)||[];for(let f=0;f<u.length;f++){const d=u[f];d.onLoad&&d.onLoad(this)}ys.delete(this),s.manager.itemEnd(e)}function l(u){h(),i&&i(u),$n.remove(`image:${e}`);const f=ys.get(this)||[];for(let d=0;d<f.length;d++){const g=f[d];g.onError&&g.onError(u)}ys.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),$n.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}class zv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=new Js;s.colorSpace=Tt;const o=new _o(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(l){o.load(e[l],function(h){s.images[l]=h,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let l=0;l<e.length;++l)c(l);return s}}class kv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Fn,a=new An(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(c){let l;try{l=s.parse(c)}catch(h){if(i!==void 0)i(h);else{h(h);return}}l.image!==void 0?o.image=l.image:l.data!==void 0&&(o.image.width=l.width,o.image.height=l.height,o.image.data=l.data),o.wrapS=l.wrapS!==void 0?l.wrapS:tn,o.wrapT=l.wrapT!==void 0?l.wrapT:tn,o.magFilter=l.magFilter!==void 0?l.magFilter:pt,o.minFilter=l.minFilter!==void 0?l.minFilter:pt,o.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(o.colorSpace=l.colorSpace),l.flipY!==void 0&&(o.flipY=l.flipY),l.format!==void 0&&(o.format=l.format),l.type!==void 0&&(o.type=l.type),l.mipmaps!==void 0&&(o.mipmaps=l.mipmaps,o.minFilter=Mn),l.mipmapCount===1&&(o.minFilter=pt),l.generateMipmaps!==void 0&&(o.generateMipmaps=l.generateMipmaps),o.needsUpdate=!0,t&&t(o,l)},n,i),o}}class lu extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=new xt,o=new _o(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class Di extends ct{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new xe(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class hu extends Di{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ct.DEFAULT_UP),this.updateMatrix(),this.groundColor=new xe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const uu=new We,Tp=new U,Cp=new U;class fu{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new he(512,512),this.mapType=ln,this.map=null,this.mapPass=null,this.matrix=new We,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new fs,this._frameExtents=new he(1,1),this._viewportCount=1,this._viewports=[new gt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Tp.setFromMatrixPosition(e.matrixWorld),t.position.copy(Tp),Cp.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Cp),t.updateMatrixWorld(),uu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(uu,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(uu)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,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 Vv extends fu{constructor(){super(new kt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Wr*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class du extends Di{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ct.DEFAULT_UP),this.updateMatrix(),this.target=new ct,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new Vv}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class Hv extends fu{constructor(){super(new kt(90,1,.5,500)),this.isPointLightShadow=!0}}class pu extends Di{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Hv}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class ur extends oc{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,o=s+l*this.view.width,a-=h*this.view.offsetY,c=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Gv extends fu{constructor(){super(new ur(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class jc extends Di{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ct.DEFAULT_UP),this.updateMatrix(),this.target=new ct,this.shadow=new Gv}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class mu extends Di{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ip extends Di{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class gu{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new U)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class Rp extends Di{constructor(e=new gu,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Jc extends Jt{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new An(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(c){i?i(c):Ge(c),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&Te("MaterialLoader: Undefined texture",s),t[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new xe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new xe().setHex(o.value);break;case"v2":i.uniforms[s].value=new he().fromArray(o.value);break;case"v3":i.uniforms[s].value=new U().fromArray(o.value);break;case"v4":i.uniforms[s].value=new gt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new et().fromArray(o.value);break;case"m4":i.uniforms[s].value=new We().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new he().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new he().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Jc.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:mp,SpriteMaterial:Ih,RawShaderMaterial:tu,ShaderMaterial:Cn,PointsMaterial:Ec,MeshPhysicalMaterial:Rn,MeshStandardMaterial:gs,MeshPhongMaterial:gp,MeshToonMaterial:_p,MeshNormalMaterial:vp,MeshLambertMaterial:yp,MeshDepthMaterial:nu,MeshDistanceMaterial:iu,MeshBasicMaterial:un,MeshMatcapMaterial:xp,LineDashedMaterial:Ap,LineBasicMaterial:qt,Material:zt};return new t[e]}}class Li{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 Pp extends Ke{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 Dp extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new An(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(c){i?i(c):Ge(c),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(d,g){if(t[g]!==void 0)return t[g];const m=d.interleavedBuffers[g],p=s(d,m.buffer),v=Hr(m.type,p),y=new os(v,m.stride);return y.uuid=m.uuid,t[g]=y,y}function s(d,g){if(n[g]!==void 0)return n[g];const m=d.arrayBuffers[g],p=new Uint32Array(m).buffer;return n[g]=p,p}const o=e.isInstancedBufferGeometry?new Pp:new Ke,a=e.data.index;if(a!==void 0){const d=Hr(a.type,a.array);o.setIndex(new ot(d,1))}const c=e.data.attributes;for(const d in c){const g=c[d];let _;if(g.isInterleavedBufferAttribute){const m=i(e.data,g.data);_=new fi(m,g.itemSize,g.offset,g.normalized)}else{const m=Hr(g.type,g.array),p=g.isInstancedBufferAttribute?Ji:ot;_=new p(m,g.itemSize,g.normalized)}g.name!==void 0&&(_.name=g.name),g.usage!==void 0&&_.setUsage(g.usage),o.setAttribute(d,_)}const l=e.data.morphAttributes;if(l)for(const d in l){const g=l[d],_=[];for(let m=0,p=g.length;m<p;m++){const v=g[m];let y;if(v.isInterleavedBufferAttribute){const x=i(e.data,v.data);y=new fi(x,v.itemSize,v.offset,v.normalized)}else{const x=Hr(v.type,v.array);y=new ot(x,v.itemSize,v.normalized)}v.name!==void 0&&(y.name=v.name),_.push(y)}o.morphAttributes[d]=_}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const u=e.data.groups||e.data.drawcalls||e.data.offsets;if(u!==void 0)for(let d=0,g=u.length;d!==g;++d){const _=u[d];o.addGroup(_.start,_.count,_.materialIndex)}const f=e.data.boundingSphere;return f!==void 0&&(o.boundingSphere=new Pt().fromJSON(f)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class Wv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?Li.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new An(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){let l=null;try{l=JSON.parse(c)}catch(u){i!==void 0&&i(u),u("ObjectLoader: Can't parse "+e+".",u.message);return}const h=l.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),Ge("ObjectLoader: Can't load "+e);return}s.parse(l,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?Li.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new An(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),c=a.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(l)}),a=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,s,c,a,n),h=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,h),this.bindLightTargets(l),t!==void 0){let u=!1;for(const f in o)if(o[f].data instanceof HTMLImageElement){u=!0;break}u===!1&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,i,a,o,t),l=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,l),this.bindLightTargets(c),c}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new nr().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new no().fromJSON(e[s],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Dp;for(let s=0,o=e.length;s<o;s++){let a;const c=e[s];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(c);break;default:c.type in pp?a=pp[c.type].fromJSON(c,t):Te(`ObjectLoader: Unsupported geometry type "${c.type}"`)}a.uuid=c.uuid,c.name!==void 0&&(a.name=c.name),c.userData!==void 0&&(a.userData=c.userData),n[c.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new Jc;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const c=e[o];n[c.uuid]===void 0&&(n[c.uuid]=s.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=vs.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(c){return n.manager.itemStart(c),s.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function a(c){if(typeof c=="string"){const l=c,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:n.resourcePath+l;return o(h)}else return c.data?{data:Hr(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new cu(t);s=new _o(c),s.setCrossOrigin(this.crossOrigin);for(let l=0,h=e.length;l<h;l++){const u=e[l],f=u.url;if(Array.isArray(f)){const d=[];for(let g=0,_=f.length;g<_;g++){const m=f[g],p=a(m);p!==null&&(p instanceof HTMLImageElement?d.push(p):d.push(new Fn(p.data,p.width,p.height)))}i[u.uuid]=new wi(d)}else{const d=a(u.url);i[u.uuid]=new wi(d)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(o){if(typeof o=="string"){const a=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(c)}else return o.data?{data:Hr(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new _o(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const c=e[o],l=c.url;if(Array.isArray(l)){const h=[];for(let u=0,f=l.length;u<f;u++){const d=l[u],g=await s(d);g!==null&&(g instanceof HTMLImageElement?h.push(g):h.push(new Fn(g.data,g.width,g.height)))}n[c.uuid]=new wi(h)}else{const h=await s(c.url);n[c.uuid]=new wi(h)}}}return n}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(Te("ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&Te('ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&Te("ObjectLoader: Undefined image",a.image);const c=t[a.image],l=c.data;let h;Array.isArray(l)?(h=new Js,l.length===6&&(h.needsUpdate=!0)):(l&&l.data?h=new Fn:h=new xt,l&&(h.needsUpdate=!0)),h.source=c,h.uuid=a.uuid,a.name!==void 0&&(h.name=a.name),a.mapping!==void 0&&(h.mapping=n(a.mapping,qv)),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=n(a.wrap[0],Lp),h.wrapT=n(a.wrap[1],Lp)),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=n(a.minFilter,Np)),a.magFilter!==void 0&&(h.magFilter=n(a.magFilter,Np)),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),i[a.uuid]=h}return i}parseObject(e,t,n,i,s){let o;function a(f){return t[f]===void 0&&Te("ObjectLoader: Undefined geometry",f),t[f]}function c(f){if(f!==void 0){if(Array.isArray(f)){const d=[];for(let g=0,_=f.length;g<_;g++){const m=f[g];n[m]===void 0&&Te("ObjectLoader: Undefined material",m),d.push(n[m])}return d}return n[f]===void 0&&Te("ObjectLoader: Undefined material",f),n[f]}}function l(f){return i[f]===void 0&&Te("ObjectLoader: Undefined texture",f),i[f]}let h,u;switch(e.type){case"Scene":o=new Ch,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new xe(e.background):o.background=l(e.background)),e.environment!==void 0&&(o.environment=l(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new lc(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new cc(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 kt(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 ur(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 mu(e.color,e.intensity);break;case"DirectionalLight":o=new jc(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new pu(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Ip(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new du(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new hu(e.color,e.groundColor,e.intensity);break;case"LightProbe":const f=new gu().fromArray(e.sh);o=new Rp(f,e.intensity);break;case"SkinnedMesh":h=a(e.geometry),u=c(e.material),o=new Lh(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=c(e.material),o=new St(h,u);break;case"InstancedMesh":h=a(e.geometry),u=c(e.material);const d=e.count,g=e.instanceMatrix,_=e.instanceColor;o=new _c(h,u,d),o.instanceMatrix=new Ji(new Float32Array(g.array),16),_!==void 0&&(o.instanceColor=new Ji(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":h=a(e.geometry),u=c(e.material),o=new Wd(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._geometryInfo=e.geometryInfo.map(m=>{let p=null,v=null;return m.boundingBox!==void 0&&(p=new Gt().fromJSON(m.boundingBox)),m.boundingSphere!==void 0&&(v=new Pt().fromJSON(m.boundingSphere)),{...m,boundingBox:p,boundingSphere:v}}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=l(e.matricesTexture.uuid),o._indirectTexture=l(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=l(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(o.boundingSphere=new Pt().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Gt().fromJSON(e.boundingBox));break;case"LOD":o=new Ld;break;case"Line":o=new di(a(e.geometry),c(e.material));break;case"LineLoop":o=new Fh(a(e.geometry),c(e.material));break;case"LineSegments":o=new In(a(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new kh(a(e.geometry),c(e.material));break;case"Sprite":o=new Pd(c(e.material));break;case"Group":o=new Kn;break;case"Bone":o=new mc;break;default:o=new ct}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 f=e.children;for(let d=0;d<f.length;d++)o.add(this.parseObject(f[d],t,n,i,s))}if(e.animations!==void 0){const f=e.animations;for(let d=0;d<f.length;d++){const g=f[d];o.animations.push(s[g])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const f=e.levels;for(let d=0;d<f.length;d++){const g=f[d],_=o.getObjectByProperty("uuid",g.object);_!==void 0&&o.addLevel(_,g.distance,g.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?Te("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new ct}})}}const qv={UVMapping:Qo,CubeReflectionMapping:Xn,CubeRefractionMapping:vi,EquirectangularReflectionMapping:Us,EquirectangularRefractionMapping:Bs,CubeUVReflectionMapping:Lr},Lp={RepeatWrapping:yi,ClampToEdgeWrapping:tn,MirroredRepeatWrapping:Nr},Np={NearestFilter:Mt,NearestMipmapNearestFilter:Ko,NearestMipmapLinearFilter:Hi,LinearFilter:pt,LinearMipmapNearestFilter:Ur,LinearMipmapLinearFilter:Mn},_u=new WeakMap;class Up extends Jt{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Te("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Te("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$n.get(`image-bitmap:${e}`);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(l=>{if(_u.has(o)===!0)i&&i(_u.get(o)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(l),s.manager.itemEnd(e),l});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,a.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const c=fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){return $n.add(`image-bitmap:${e}`,l),t&&t(l),s.manager.itemEnd(e),l}).catch(function(l){i&&i(l),_u.set(c,l),$n.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});$n.add(`image-bitmap:${e}`,c),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let $c;class vu{static getContext(){return $c===void 0&&($c=new(window.AudioContext||window.webkitAudioContext)),$c}static setContext(e){$c=e}}class Xv extends Jt{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new An(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const l=c.slice(0);vu.getContext().decodeAudioData(l,function(u){t(u)}).catch(a)}catch(l){a(l)}},n,i);function a(c){i?i(c):Ge(c),s.manager.itemError(e)}}}const Bp=new We,Op=new We,fr=new We;class Zv{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new kt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new kt,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,fr.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(Zi*t.fov*.5)/t.zoom;let a,c;Op.elements[12]=-i,Bp.elements[12]=i,a=-o*t.aspect+s,c=o*t.aspect+s,fr.elements[0]=2*t.near/(c-a),fr.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(fr),a=-o*t.aspect-s,c=o*t.aspect-s,fr.elements[0]=2*t.near/(c-a),fr.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(fr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Op),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Bp)}}class Fp extends kt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class el{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const dr=new U,yu=new wt,Yv=new U,pr=new U,mr=new U;class Qv extends ct{constructor(){super(),this.type="AudioListener",this.context=vu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new el}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;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(dr,yu,Yv),pr.set(0,0,-1).applyQuaternion(yu),mr.set(0,1,0).applyQuaternion(yu),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(dr.x,n),t.positionY.linearRampToValueAtTime(dr.y,n),t.positionZ.linearRampToValueAtTime(dr.z,n),t.forwardX.linearRampToValueAtTime(pr.x,n),t.forwardY.linearRampToValueAtTime(pr.y,n),t.forwardZ.linearRampToValueAtTime(pr.z,n),t.upX.linearRampToValueAtTime(mr.x,n),t.upY.linearRampToValueAtTime(mr.y,n),t.upZ.linearRampToValueAtTime(mr.z,n)}else t.setPosition(dr.x,dr.y,dr.z),t.setOrientation(pr.x,pr.y,pr.z,mr.x,mr.y,mr.z)}}class zp extends ct{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){Te("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Te("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){Te("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){Te("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){Te("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?(Te("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){Te("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"?(Te("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 gr=new U,kp=new wt,Kv=new U,_r=new U;class jv extends zp{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(gr,kp,Kv),_r.set(0,0,1).applyQuaternion(kp);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(gr.x,n),t.positionY.linearRampToValueAtTime(gr.y,n),t.positionZ.linearRampToValueAtTime(gr.z,n),t.orientationX.linearRampToValueAtTime(_r.x,n),t.orientationY.linearRampToValueAtTime(_r.y,n),t.orientationZ.linearRampToValueAtTime(_r.z,n)}else t.setPosition(gr.x,gr.y,gr.z),t.setOrientation(_r.x,_r.y,_r.z)}}class Jv{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Vp{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,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 n=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[s+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){wt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;wt.multiplyQuaternionsFlat(e,o,e,t,e,n),wt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const xu="\\[\\]\\.:\\/",$v=new RegExp("["+xu+"]","g"),Au="[^"+xu+"]",ey="[^"+xu.replace("\\.","")+"]",ty=/((?:WC+[\/:])*)/.source.replace("WC",Au),ny=/(WCOD+)?/.source.replace("WCOD",ey),iy=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Au),ry=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Au),sy=new RegExp("^"+ty+ny+iy+ry+"$"),oy=["material","materials","bones","map"];class ay{constructor(e,t,n){const i=n||lt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class lt{constructor(e,t,n){this.path=t,this.parsedPath=n||lt.parseTrackName(t),this.node=lt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new lt.Composite(e,t,n):new lt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($v,"")}static parseTrackName(e){const t=sy.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);oy.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const c=n(a.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=lt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Te("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ge("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){Ge("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===l){l=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ge("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ge("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){Ge("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const o=e[i];if(o===void 0){const l=t.nodeName;Ge("PropertyBinding: Trying to update property for track: "+l+"."+i+" 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 c=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ge("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])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}lt.Composite=ay,lt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},lt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},lt.prototype.GetterByBindingType=[lt.prototype._getValue_direct,lt.prototype._getValue_array,lt.prototype._getValue_arrayElement,lt.prototype._getValue_toArray],lt.prototype.SetterByBindingTypeAndVersioning=[[lt.prototype._setValue_direct,lt.prototype._setValue_direct_setNeedsUpdate,lt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_array,lt.prototype._setValue_array_setNeedsUpdate,lt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_arrayElement,lt.prototype._setValue_arrayElement_setNeedsUpdate,lt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_fromArray,lt.prototype._setValue_fromArray_setNeedsUpdate,lt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class cy{constructor(){this.isAnimationObjectGroup=!0,this.uuid=_n(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length;let a,c=e.length,l=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const f=arguments[h],d=f.uuid;let g=t[d];if(g===void 0){g=c++,t[d]=g,e.push(f);for(let _=0,m=o;_!==m;++_)s[_].push(new lt(f,n[_],i[_]))}else if(g<l){a=e[g];const _=--l,m=e[_];t[m.uuid]=g,e[g]=m,t[d]=_,e[_]=f;for(let p=0,v=o;p!==v;++p){const y=s[p],x=y[_];let A=y[g];y[g]=x,A===void 0&&(A=new lt(f,n[p],i[p])),y[_]=A}}else e[g]!==a&&Ge("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const c=arguments[o],l=c.uuid,h=t[l];if(h!==void 0&&h>=s){const u=s++,f=e[u];t[f.uuid]=h,e[h]=f,t[l]=u,e[u]=c;for(let d=0,g=i;d!==g;++d){const _=n[d],m=_[u],p=_[h];_[h]=m,_[u]=p}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const l=arguments[a],h=l.uuid,u=t[h];if(u!==void 0)if(delete t[h],u<s){const f=--s,d=e[f],g=--o,_=e[g];t[d.uuid]=u,e[u]=d,t[_.uuid]=f,e[f]=_,e.pop();for(let m=0,p=i;m!==p;++m){const v=n[m],y=v[f],x=v[g];v[u]=y,v[f]=x,v.pop()}}else{const f=--o,d=e[f];f>0&&(t[d.uuid]=u),e[u]=d,e.pop();for(let g=0,_=i;g!==_;++g){const m=n[g];m[u]=m[f],m.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,h=this.nCachedObjects_,u=new Array(l);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(u);for(let f=h,d=c.length;f!==d;++f){const g=c[f];u[f]=new lt(g,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],l=e[a];t[l]=n,o[n]=c,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}class Hp{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),c={endingStart:Wi,endingEnd:Wi};for(let l=0;l!==o;++l){const h=s[l].createInterpolant(null);a[l]=h,h.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qf,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=s,c[1]=s+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case $l:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulateAdditive(a);break;case Ba:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===Xf;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===Wf){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=qi,i.endingEnd=qi):(e?i.endingStart=this.zeroSlopeAtStart?qi:Wi:i.endingStart=Hs,t?i.endingEnd=this.zeroSlopeAtEnd?qi:Wi:i.endingEnd=Hs)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=s,c[0]=t,a[1]=s+e,c[1]=n,this}}const ly=new Float32Array(1);class hy extends Qn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==s;++u){const f=i[u],d=f.name;let g=h[d];if(g!==void 0)++g.referenceCount,o[u]=g;else{if(g=o[u],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,c,d));continue}const _=t&&t._propertyBindings[u].binding.parsedPath;g=new Vp(lt.create(n,d,_),f.ValueTypeName,f.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,c,d),o[u]=g}a[u].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let 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=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],c=a.knownActions,l=c[c.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,c[h]=l,c.pop(),e._byClipCacheIndex=null;const u=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete u[f],c.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,a=o[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new ou(new Float32Array(2),new Float32Array(2),1,ly),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let o=typeof e=="string"?vs.findByName(i,e):e;const a=o!==null?o.uuid:e,c=this._actionsByClip[a];let l=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Ba),c!==void 0){const u=c.actionByRoot[s];if(u!==void 0&&u.blendMode===n)return u;l=c.knownActions[0],o===null&&(o=l._clip)}if(o===null)return null;const h=new Hp(this,o,t,n);return this._bindAction(h,l),this._addInactiveAction(h,a,s),h}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?vs.findByName(n,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,s,o);const a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const o=s.knownActions;for(let a=0,c=o.length;a!==c;++a){const l=o[a];this._deactivateAction(l);const h=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class uy extends ch{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Ha(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class bu{constructor(e){this.value=e}clone(){return new bu(this.value.clone===void 0?this.value:this.value.clone())}}let fy=0;class dy extends Qn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:fy++}),this.name="",this.usage=kr,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(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class py extends os{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class my{constructor(e,t,n,i,s,o=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.normalized=o,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 Gp=new We;class gy{constructor(e,t,n=0,i=1/0){this.ray=new Kr(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Qa,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):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Gp.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Gp),this}intersectObject(e,t=!0,n=[]){return wu(e,this,n,t),n.sort(Wp),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)wu(e[i],this,n,t);return n.sort(Wp),n}}function Wp(r,e){return r.distance-e.distance}function wu(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let o=0,a=s.length;o<a;o++)wu(s[o],e,t,!0)}}class _y{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=vy.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function vy(){this._document.hidden===!1&&this.reset()}class yy{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Qe(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Qe(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class xy{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Su{constructor(e,t,n,i){Su.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}}const qp=new he;class Ay{constructor(e=new he(1/0,1/0),t=new he(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=qp.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qp).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 Xp=new U,tl=new U,xs=new U,As=new U,Mu=new U,by=new U,wy=new U;class Sy{constructor(e=new U,t=new U){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){Xp.subVectors(e,this.start),tl.subVectors(this.end,this.start);const n=tl.dot(tl);let s=tl.dot(Xp)/n;return t&&(s=Qe(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=by,n=wy){const i=10000000000000001e-32;let s,o;const a=this.start,c=e.start,l=this.end,h=e.end;xs.subVectors(l,a),As.subVectors(h,c),Mu.subVectors(a,c);const u=xs.dot(xs),f=As.dot(As),d=As.dot(Mu);if(u<=i&&f<=i)return t.copy(a),n.copy(c),t.sub(n),t.dot(t);if(u<=i)s=0,o=d/f,o=Qe(o,0,1);else{const g=xs.dot(Mu);if(f<=i)o=0,s=Qe(-g/u,0,1);else{const _=xs.dot(As),m=u*f-_*_;m!==0?s=Qe((_*d-g*f)/m,0,1):s=0,o=(_*s+d)/f,o<0?(o=0,s=Qe(-g/u,0,1)):o>1&&(o=1,s=Qe((_-g)/u,0,1))}}return t.copy(a).add(xs.multiplyScalar(s)),n.copy(c).add(As.multiplyScalar(o)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Zp=new U;class My extends ct{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Ke,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,c=32;o<c;o++,a++){const l=o/c*Math.PI*2,h=a/c*Math.PI*2;i.push(Math.cos(l),Math.sin(l),1,Math.cos(h),Math.sin(h),1)}n.setAttribute("position",new Be(i,3));const s=new qt({fog:!1,toneMapped:!1});this.cone=new In(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Zp.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Zp),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Ni=new U,nl=new We,Eu=new We;class Ey extends In{constructor(e){const t=Yp(e),n=new Ke,i=[],s=[];for(let l=0;l<t.length;l++){const h=t[l];h.parent&&h.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}n.setAttribute("position",new Be(i,3)),n.setAttribute("color",new Be(s,3));const o=new qt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const a=new xe(255),c=new xe(65280);this.setColors(a,c)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Eu.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(nl.multiplyMatrices(Eu,a.matrixWorld),Ni.setFromMatrixPosition(nl),i.setXYZ(o,Ni.x,Ni.y,Ni.z),nl.multiplyMatrices(Eu,a.parent.matrixWorld),Ni.setFromMatrixPosition(nl),i.setXYZ(o+1,Ni.x,Ni.y,Ni.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,e.r,e.g,e.b),i.setXYZ(s+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function Yp(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...Yp(r.children[t]));return e}class Ty extends St{constructor(e,t,n){const i=new ms(t,4,2),s=new un({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Cy=new U,Qp=new xe,Kp=new xe;class Iy extends ct{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new go(t);i.rotateY(Math.PI*.5),this.material=new un({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new ot(o,3)),this.add(new St(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Qp.copy(this.light.color),Kp.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?Qp:Kp;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Cy.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Ry extends In{constructor(e=10,t=10,n=4473924,i=8947848){n=new xe(n),i=new xe(i);const s=t/2,o=e/t,a=e/2,c=[],l=[];for(let f=0,d=0,g=-a;f<=t;f++,g+=o){c.push(-a,0,g,a,0,g),c.push(g,0,-a,g,0,a);const _=f===s?n:i;_.toArray(l,d),d+=3,_.toArray(l,d),d+=3,_.toArray(l,d),d+=3,_.toArray(l,d),d+=3}const h=new Ke;h.setAttribute("position",new Be(c,3)),h.setAttribute("color",new Be(l,3));const u=new qt({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Py extends In{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new xe(s),o=new xe(o);const a=[],c=[];if(t>1)for(let u=0;u<t;u++){const f=u/t*(Math.PI*2),d=Math.sin(f)*e,g=Math.cos(f)*e;a.push(0,0,0),a.push(d,0,g);const _=u&1?s:o;c.push(_.r,_.g,_.b),c.push(_.r,_.g,_.b)}for(let u=0;u<n;u++){const f=u&1?s:o,d=e-e/n*u;for(let g=0;g<i;g++){let _=g/i*(Math.PI*2),m=Math.sin(_)*d,p=Math.cos(_)*d;a.push(m,0,p),c.push(f.r,f.g,f.b),_=(g+1)/i*(Math.PI*2),m=Math.sin(_)*d,p=Math.cos(_)*d,a.push(m,0,p),c.push(f.r,f.g,f.b)}}const l=new Ke;l.setAttribute("position",new Be(a,3)),l.setAttribute("color",new Be(c,3));const h=new qt({vertexColors:!0,toneMapped:!1});super(l,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const jp=new U,il=new U,Jp=new U;class Dy extends ct{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new Ke;i.setAttribute("position",new Be([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new qt({fog:!1,toneMapped:!1});this.lightPlane=new di(i,s),this.add(this.lightPlane),i=new Ke,i.setAttribute("position",new Be([0,0,0,0,0,1],3)),this.targetLine=new di(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),jp.setFromMatrixPosition(this.light.matrixWorld),il.setFromMatrixPosition(this.light.target.matrixWorld),Jp.subVectors(il,jp),this.lightPlane.lookAt(il),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(il),this.targetLine.scale.z=Jp.length()}}const rl=new U,Ct=new oc;class Ly extends In{constructor(e){const t=new Ke,n=new qt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],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(g,_){c(g),c(_)}function c(g){i.push(0,0,0),s.push(0,0,0),o[g]===void 0&&(o[g]=[]),o[g].push(i.length/3-1)}t.setAttribute("position",new Be(i,3)),t.setAttribute("color",new Be(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const l=new xe(16755200),h=new xe(16711680),u=new xe(43775),f=new xe(16777215),d=new xe(3355443);this.setColors(l,h,u,f,d)}setColors(e,t,n,i,s){const a=this.geometry.getAttribute("color");return a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,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,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let s,o;if(Ct.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,o=0;else if(this.camera.coordinateSystem===gn)s=-1,o=1;else if(this.camera.coordinateSystem===Vr)s=0,o=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Dt("c",t,e,Ct,0,0,s),Dt("t",t,e,Ct,0,0,o),Dt("n1",t,e,Ct,-n,-i,s),Dt("n2",t,e,Ct,n,-i,s),Dt("n3",t,e,Ct,-n,i,s),Dt("n4",t,e,Ct,n,i,s),Dt("f1",t,e,Ct,-n,-i,o),Dt("f2",t,e,Ct,n,-i,o),Dt("f3",t,e,Ct,-n,i,o),Dt("f4",t,e,Ct,n,i,o),Dt("u1",t,e,Ct,n*.7,i*1.1,s),Dt("u2",t,e,Ct,-n*.7,i*1.1,s),Dt("u3",t,e,Ct,0,i*2,s),Dt("cf1",t,e,Ct,-n,0,o),Dt("cf2",t,e,Ct,n,0,o),Dt("cf3",t,e,Ct,0,-i,o),Dt("cf4",t,e,Ct,0,i,o),Dt("cn1",t,e,Ct,-n,0,s),Dt("cn2",t,e,Ct,n,0,s),Dt("cn3",t,e,Ct,0,-i,s),Dt("cn4",t,e,Ct,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Dt(r,e,t,n,i,s,o){rl.set(i,s,o).unproject(n);const a=e[r];if(a!==void 0){const c=t.getAttribute("position");for(let l=0,h=a.length;l<h;l++)c.setXYZ(a[l],rl.x,rl.y,rl.z)}}const sl=new Gt;class Ny extends In{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new Ke;s.setIndex(new ot(n,1)),s.setAttribute("position",new ot(i,3)),super(s,new qt({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&sl.setFromObject(this.object),sl.isEmpty())return;const e=sl.min,t=sl.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Uy extends In{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ke;s.setIndex(new ot(n,1)),s.setAttribute("position",new Be(i,3)),super(s,new qt({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 By extends di{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new Ke;o.setAttribute("position",new Be(s,3)),o.computeBoundingSphere(),super(o,new qt({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new Ke;c.setAttribute("position",new Be(a,3)),c.computeBoundingSphere(),this.add(new St(c,new un({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const $p=new U;let ol,Tu;class Oy extends ct{constructor(e=new U(0,0,1),t=new U(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",ol===void 0&&(ol=new Ke,ol.setAttribute("position",new Be([0,0,0,0,1,0],3)),Tu=new co(.5,1,5,1),Tu.translate(0,-.5,0)),this.position.copy(t),this.line=new di(ol,new qt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new St(Tu,new un({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,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{$p.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle($p,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Fy extends In{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Ke;i.setAttribute("position",new Be(t,3)),i.setAttribute("color",new Be(n,3));const s=new qt({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new xe,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class zy{constructor(){this.type="ShapePath",this.color=new xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new zc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(p){const v=[];for(let y=0,x=p.length;y<x;y++){const A=p[y],E=new nr;E.curves=A.curves,v.push(E)}return v}function n(p,v){const y=v.length;let x=!1;for(let A=y-1,E=0;E<y;A=E++){let I=v[A],D=v[E],b=D.x-I.x,C=D.y-I.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(I=v[E],b=-b,D=v[A],C=-C),p.y<I.y||p.y>D.y)continue;if(p.y===I.y){if(p.x===I.x)return!0}else{const B=C*(p.x-I.x)-b*(p.y-I.y);if(B===0)return!0;if(B<0)continue;x=!x}}else{if(p.y!==I.y)continue;if(D.x<=p.x&&p.x<=I.x||I.x<=p.x&&p.x<=D.x)return!0}}return x}const i=kn.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,c;const l=[];if(s.length===1)return a=s[0],c=new nr,c.curves=a.curves,l.push(c),l;let h=!i(s[0].getPoints());h=e?!h:h;const u=[],f=[];let d=[],g=0,_;f[g]=void 0,d[g]=[];for(let p=0,v=s.length;p<v;p++)a=s[p],_=a.getPoints(),o=i(_),o=e?!o:o,o?(!h&&f[g]&&g++,f[g]={s:new nr,p:_},f[g].s.curves=a.curves,h&&g++,d[g]=[]):d[g].push({h:a,p:_[0]});if(!f[0])return t(s);if(f.length>1){let p=!1,v=0;for(let y=0,x=f.length;y<x;y++)u[y]=[];for(let y=0,x=f.length;y<x;y++){const A=d[y];for(let E=0;E<A.length;E++){const I=A[E];let D=!0;for(let b=0;b<f.length;b++)n(I.p,f[b].p)&&(y!==b&&v++,D?(D=!1,u[b].push(I)):p=!0);D&&u[y].push(I)}}v>0&&p===!1&&(d=u)}let m;for(let p=0,v=f.length;p<v;p++){c=f[p].s,l.push(c),m=d[p];for(let y=0,x=m.length;y<x;y++)c.holes.push(m[y].h)}return l}}class ky extends Qn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Te("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Vy(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function Hy(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function Gy(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Cu(r,e,t,n){const i=Wy(n);switch(t){case jl:return r*e;case ea:return r*e/i.components*i.byteLength;case Os:return r*e/i.components*i.byteLength;case Gi:return r*e*2/i.components*i.byteLength;case ta:return r*e*2/i.components*i.byteLength;case Jl:return r*e*3/i.components*i.byteLength;case rn:return r*e*4/i.components*i.byteLength;case na:return r*e*4/i.components*i.byteLength;case Fs:case zs:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case ks:case Vs:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case ra:case oa:return Math.max(r,16)*Math.max(e,8)/4;case ia:case sa:return Math.max(r,8)*Math.max(e,8)/2;case aa:case ca:case ha:case ua:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case la:case fa:case da:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case pa:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case ma:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case ga:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case _a:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case va:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case ya:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case xa:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Aa:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case ba:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case wa:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case Sa:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Ma:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Ea:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Ta:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Ca:case Ia:case Ra:return Math.ceil(r/4)*Math.ceil(e/4)*16;case Pa:case Da:return Math.ceil(r/4)*Math.ceil(e/4)*8;case La:case Na:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Wy(r){switch(r){case ln:case Zl:return{byteLength:1,components:1};case Br:case Yl:case Zn:return{byteLength:2,components:1};case Jo:case $o:return{byteLength:2,components:4};case En:case jo:case nn:return{byteLength:4,components:1};case Ql:case Kl:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class qy{static contain(e,t){return Vy(e,t)}static cover(e,t){return Hy(e,t)}static fill(e){return Gy(e)}static getByteLength(e,t,n,i){return Cu(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Yt}})),typeof window<"u"&&(window.__THREE__?Te("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Yt);/**
45
45
  * @license
46
46
  * Copyright 2010-2025 Three.js Authors
47
47
  * SPDX-License-Identifier: MIT
@@ -3610,7 +3610,7 @@ void main() {
3610
3610
  #include <tonemapping_fragment>
3611
3611
  #include <colorspace_fragment>
3612
3612
  #include <fog_fragment>
3613
- }`},Ce={common:{diffuse:{value:new xe(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},dfgLUT:{value:null}},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 he(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 xe(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 xe(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 xe(16777215)},opacity:{value:1},center:{value:new he(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new et},alphaMap:{value:null},alphaMapTransform:{value:new et},alphaTest:{value:0}}},Vn={basic:{uniforms:on([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.fog]),vertexShader:nt.meshbasic_vert,fragmentShader:nt.meshbasic_frag},lambert:{uniforms:on([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new xe(0)}}]),vertexShader:nt.meshlambert_vert,fragmentShader:nt.meshlambert_frag},phong:{uniforms:on([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new xe(0)},specular:{value:new xe(1118481)},shininess:{value:30}}]),vertexShader:nt.meshphong_vert,fragmentShader:nt.meshphong_frag},standard:{uniforms:on([Ce.common,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.roughnessmap,Ce.metalnessmap,Ce.fog,Ce.lights,{emissive:{value:new xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag},toon:{uniforms:on([Ce.common,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.gradientmap,Ce.fog,Ce.lights,{emissive:{value:new xe(0)}}]),vertexShader:nt.meshtoon_vert,fragmentShader:nt.meshtoon_frag},matcap:{uniforms:on([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,{matcap:{value:null}}]),vertexShader:nt.meshmatcap_vert,fragmentShader:nt.meshmatcap_frag},points:{uniforms:on([Ce.points,Ce.fog]),vertexShader:nt.points_vert,fragmentShader:nt.points_frag},dashed:{uniforms:on([Ce.common,Ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nt.linedashed_vert,fragmentShader:nt.linedashed_frag},depth:{uniforms:on([Ce.common,Ce.displacementmap]),vertexShader:nt.depth_vert,fragmentShader:nt.depth_frag},normal:{uniforms:on([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,{opacity:{value:1}}]),vertexShader:nt.meshnormal_vert,fragmentShader:nt.meshnormal_frag},sprite:{uniforms:on([Ce.sprite,Ce.fog]),vertexShader:nt.sprite_vert,fragmentShader:nt.sprite_frag},background:{uniforms:{uvTransform:{value:new et},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nt.background_vert,fragmentShader:nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new et}},vertexShader:nt.backgroundCube_vert,fragmentShader:nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nt.cube_vert,fragmentShader:nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nt.equirect_vert,fragmentShader:nt.equirect_frag},distance:{uniforms:on([Ce.common,Ce.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nt.distance_vert,fragmentShader:nt.distance_frag},shadow:{uniforms:on([Ce.lights,Ce.fog,{color:{value:new xe(0)},opacity:{value:1}}]),vertexShader:nt.shadow_vert,fragmentShader:nt.shadow_frag}};Vn.physical={uniforms:on([Vn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new et},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new et},clearcoatNormalScale:{value:new he(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 xe(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 he},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new et},attenuationDistance:{value:0},attenuationColor:{value:new xe(0)},specularColor:{value:new xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new et},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new et},anisotropyVector:{value:new he},anisotropyMap:{value:null},anisotropyMapTransform:{value:new et}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag};const al={r:0,b:0,g:0},vr=new Zt,XA=new We;function ZA(r,e,t,n,i,s,o){const a=new xe(0);let c=s===!0?0:1,l,h,u=null,f=0,d=null;function g(y){let x=y.isScene===!0?y.background:null;return x&&x.isTexture&&(x=(y.backgroundBlurriness>0?t:e).get(x)),x}function _(y){let x=!1;const A=g(y);A===null?p(a,c):A&&A.isColor&&(p(A,1),x=!0);const E=r.xr.getEnvironmentBlendMode();E==="additive"?n.buffers.color.setClear(0,0,0,1,o):E==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(r.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function m(y,x){const A=g(x);A&&(A.isCubeTexture||A.mapping===Lr)?(h===void 0&&(h=new St(new ji(1,1,1),new Cn({name:"BackgroundCubeMaterial",uniforms:is(Vn.backgroundCube.uniforms),vertexShader:Vn.backgroundCube.vertexShader,fragmentShader:Vn.backgroundCube.fragmentShader,side:en,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(E,I,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),vr.copy(x.backgroundRotation),vr.x*=-1,vr.y*=-1,vr.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(vr.y*=-1,vr.z*=-1),h.material.uniforms.envMap.value=A,h.material.uniforms.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(XA.makeRotationFromEuler(vr)),h.material.toneMapped=rt.getTransfer(A.colorSpace)!==ut,(u!==A||f!==A.version||d!==r.toneMapping)&&(h.material.needsUpdate=!0,u=A,f=A.version,d=r.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null)):A&&A.isTexture&&(l===void 0&&(l=new St(new rr(2,2),new Cn({name:"BackgroundMaterial",uniforms:is(Vn.background.uniforms),vertexShader:Vn.background.vertexShader,fragmentShader:Vn.background.fragmentShader,side:Wn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=A,l.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,l.material.toneMapped=rt.getTransfer(A.colorSpace)!==ut,A.matrixAutoUpdate===!0&&A.updateMatrix(),l.material.uniforms.uvTransform.value.copy(A.matrix),(u!==A||f!==A.version||d!==r.toneMapping)&&(l.material.needsUpdate=!0,u=A,f=A.version,d=r.toneMapping),l.layers.enableAll(),y.unshift(l,l.geometry,l.material,0,0,null))}function p(y,x){y.getRGB(al,wd(r)),n.buffers.color.setClear(al.r,al.g,al.b,x,o)}function v(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(y,x=1){a.set(y),c=x,p(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(y){c=y,p(a,c)},render:_,addToRenderList:m,dispose:v}}function YA(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=f(null);let s=i,o=!1;function a(C,B,R,O,M){let z=!1;const X=u(O,R,B);s!==X&&(s=X,l(s.object)),z=d(C,O,R,M),z&&g(C,O,R,M),M!==null&&e.update(M,r.ELEMENT_ARRAY_BUFFER),(z||o)&&(o=!1,x(C,B,R,O),M!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(M).buffer))}function c(){return r.createVertexArray()}function l(C){return r.bindVertexArray(C)}function h(C){return r.deleteVertexArray(C)}function u(C,B,R){const O=R.wireframe===!0;let M=n[C.id];M===void 0&&(M={},n[C.id]=M);let z=M[B.id];z===void 0&&(z={},M[B.id]=z);let X=z[O];return X===void 0&&(X=f(c()),z[O]=X),X}function f(C){const B=[],R=[],O=[];for(let M=0;M<t;M++)B[M]=0,R[M]=0,O[M]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:R,attributeDivisors:O,object:C,attributes:{},index:null}}function d(C,B,R,O){const M=s.attributes,z=B.attributes;let X=0;const H=R.getAttributes();for(const re in H)if(H[re].location>=0){const le=M[re];let W=z[re];if(W===void 0&&(re==="instanceMatrix"&&C.instanceMatrix&&(W=C.instanceMatrix),re==="instanceColor"&&C.instanceColor&&(W=C.instanceColor)),le===void 0||le.attribute!==W||W&&le.data!==W.data)return!0;X++}return s.attributesNum!==X||s.index!==O}function g(C,B,R,O){const M={},z=B.attributes;let X=0;const H=R.getAttributes();for(const re in H)if(H[re].location>=0){let le=z[re];le===void 0&&(re==="instanceMatrix"&&C.instanceMatrix&&(le=C.instanceMatrix),re==="instanceColor"&&C.instanceColor&&(le=C.instanceColor));const W={};W.attribute=le,le&&le.data&&(W.data=le.data),M[re]=W,X++}s.attributes=M,s.attributesNum=X,s.index=O}function _(){const C=s.newAttributes;for(let B=0,R=C.length;B<R;B++)C[B]=0}function m(C){p(C,0)}function p(C,B){const R=s.newAttributes,O=s.enabledAttributes,M=s.attributeDivisors;R[C]=1,O[C]===0&&(r.enableVertexAttribArray(C),O[C]=1),M[C]!==B&&(r.vertexAttribDivisor(C,B),M[C]=B)}function v(){const C=s.newAttributes,B=s.enabledAttributes;for(let R=0,O=B.length;R<O;R++)B[R]!==C[R]&&(r.disableVertexAttribArray(R),B[R]=0)}function y(C,B,R,O,M,z,X){X===!0?r.vertexAttribIPointer(C,B,R,M,z):r.vertexAttribPointer(C,B,R,O,M,z)}function x(C,B,R,O){_();const M=O.attributes,z=R.getAttributes(),X=B.defaultAttributeValues;for(const H in z){const re=z[H];if(re.location>=0){let $=M[H];if($===void 0&&(H==="instanceMatrix"&&C.instanceMatrix&&($=C.instanceMatrix),H==="instanceColor"&&C.instanceColor&&($=C.instanceColor)),$!==void 0){const le=$.normalized,W=$.itemSize,Z=e.get($);if(Z===void 0)continue;const ge=Z.buffer,_e=Z.type,de=Z.bytesPerElement,oe=_e===r.INT||_e===r.UNSIGNED_INT||$.gpuType===jo;if($.isInterleavedBufferAttribute){const ee=$.data,pe=ee.stride,ye=$.offset;if(ee.isInstancedInterleavedBuffer){for(let Ae=0;Ae<re.locationSize;Ae++)p(re.location+Ae,ee.meshPerAttribute);C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let Ae=0;Ae<re.locationSize;Ae++)m(re.location+Ae);r.bindBuffer(r.ARRAY_BUFFER,ge);for(let Ae=0;Ae<re.locationSize;Ae++)y(re.location+Ae,W/re.locationSize,_e,le,pe*de,(ye+W/re.locationSize*Ae)*de,oe)}else{if($.isInstancedBufferAttribute){for(let ee=0;ee<re.locationSize;ee++)p(re.location+ee,$.meshPerAttribute);C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let ee=0;ee<re.locationSize;ee++)m(re.location+ee);r.bindBuffer(r.ARRAY_BUFFER,ge);for(let ee=0;ee<re.locationSize;ee++)y(re.location+ee,W/re.locationSize,_e,le,W*de,W/re.locationSize*ee*de,oe)}}else if(X!==void 0){const le=X[H];if(le!==void 0)switch(le.length){case 2:r.vertexAttrib2fv(re.location,le);break;case 3:r.vertexAttrib3fv(re.location,le);break;case 4:r.vertexAttrib4fv(re.location,le);break;default:r.vertexAttrib1fv(re.location,le)}}}}v()}function A(){D();for(const C in n){const B=n[C];for(const R in B){const O=B[R];for(const M in O)h(O[M].object),delete O[M];delete B[R]}delete n[C]}}function E(C){if(n[C.id]===void 0)return;const B=n[C.id];for(const R in B){const O=B[R];for(const M in O)h(O[M].object),delete O[M];delete B[R]}delete n[C.id]}function I(C){for(const B in n){const R=n[B];if(R[C.id]===void 0)continue;const O=R[C.id];for(const M in O)h(O[M].object),delete O[M];delete R[C.id]}}function D(){b(),o=!0,s!==i&&(s=i,l(s.object))}function b(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:D,resetDefaultState:b,dispose:A,releaseStatesOfGeometry:E,releaseStatesOfProgram:I,initAttributes:_,enableAttribute:m,disableUnusedAttributes:v}}function QA(r,e,t){let n;function i(l){n=l}function s(l,h){r.drawArrays(n,l,h),t.update(h,n,1)}function o(l,h,u){u!==0&&(r.drawArraysInstanced(n,l,h,u),t.update(h,n,u))}function a(l,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,h,0,u);let d=0;for(let g=0;g<u;g++)d+=h[g];t.update(d,n,1)}function c(l,h,u,f){if(u===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let g=0;g<l.length;g++)o(l[g],h[g],f[g]);else{d.multiDrawArraysInstancedWEBGL(n,l,0,h,0,f,0,u);let g=0;for(let _=0;_<u;_++)g+=h[_]*f[_];t.update(g,n,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=c}function KA(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(I){return!(I!==rn&&n.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(I){const D=I===Zn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(I!==ln&&n.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&I!==nn&&!D)}function c(I){if(I==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const h=c(l);h!==l&&(Te("WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const u=t.logarithmicDepthBuffer===!0,f=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),d=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),g=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),m=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),p=r.getParameter(r.MAX_VERTEX_ATTRIBS),v=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),y=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),A=r.getParameter(r.MAX_SAMPLES),E=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:u,reversedDepthBuffer:f,maxTextures:d,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:x,maxSamples:A,samples:E}}function jA(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new Ri,a=new et,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const d=u.length!==0||f||n!==0||i;return i=f,n=u.length,d},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=h(u,f,0)},this.setState=function(u,f,d){const g=u.clippingPlanes,_=u.clipIntersection,m=u.clipShadows,p=r.get(u);if(!i||g===null||g.length===0||s&&!m)s?h(null):l();else{const v=s?0:n,y=v*4;let x=p.clippingState||null;c.value=x,x=h(g,f,y,d);for(let A=0;A!==y;++A)x[A]=t[A];p.clippingState=x,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=v}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,f,d,g){const _=u!==null?u.length:0;let m=null;if(_!==0){if(m=c.value,g!==!0||m===null){const p=d+_*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(m===null||m.length<p)&&(m=new Float32Array(p));for(let y=0,x=d;y!==_;++y,x+=4)o.copy(u[y]).applyMatrix4(v,a),o.normal.toArray(m,x),m[x+3]=o.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function JA(r){let e=new WeakMap;function t(o,a){return a===Us?o.mapping=Xn:a===Bs&&(o.mapping=vi),o}function n(o){if(o&&o.isTexture){const a=o.mapping;if(a===Us||a===Bs)if(e.has(o)){const c=e.get(o).texture;return t(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const l=new Th(c.height);return l.fromEquirectangularTexture(r,o),e.set(o,l),o.addEventListener("dispose",i),t(l.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Ui=4,tm=[.125,.215,.35,.446,.526,.582],yr=20,$A=256,vo=new ur,nm=new xe;let Iu=null,Ru=0,Pu=0,Du=!1;const e1=new U;class Lu{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,s={}){const{size:o=256,position:a=e1}=s;Iu=this._renderer.getRenderTarget(),Ru=this._renderer.getActiveCubeFace(),Pu=this._renderer.getActiveMipmapLevel(),Du=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,i,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=sm(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=rm(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Iu,Ru,Pu),this._renderer.xr.enabled=Du,e.scissorTest=!1,bs(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Xn||e.mapping===vi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Iu=this._renderer.getRenderTarget(),Ru=this._renderer.getActiveCubeFace(),Pu=this._renderer.getActiveMipmapLevel(),Du=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:pt,minFilter:pt,generateMipmaps:!1,type:Zn,format:rn,colorSpace:Xt,depthBuffer:!1},i=im(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=im(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=t1(s)),this._blurMaterial=i1(s,e,t),this._ggxMaterial=n1(s,e,t)}return i}_compileMaterial(e){const t=new St(new Ke,e);this._renderer.compile(t,vo)}_sceneToCubeUV(e,t,n,i,s){const c=new kt(90,1,t,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,f=u.autoClear,d=u.toneMapping;u.getClearColor(nm),u.toneMapping=Nn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new St(new ji,new un({name:"PMREM.Background",side:en,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,m=_.material;let p=!1;const v=e.background;v?v.isColor&&(m.color.copy(v),e.background=null,p=!0):(m.color.copy(nm),p=!0);for(let y=0;y<6;y++){const x=y%3;x===0?(c.up.set(0,l[y],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+h[y],s.y,s.z)):x===1?(c.up.set(0,0,l[y]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+h[y],s.z)):(c.up.set(0,l[y],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+h[y]));const A=this._cubeSize;bs(i,x*A,y>2?A:0,A,A),u.setRenderTarget(i),p&&u.render(_,c),u.render(e,c)}u.toneMapping=d,u.autoClear=f,e.background=v}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Xn||e.mapping===vi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=sm()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=rm());const s=i?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;const a=s.uniforms;a.envMap.value=e;const c=this._cubeSize;bs(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(o,vo)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;const c=o.uniforms,l=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),u=Math.sqrt(l*l-h*h),f=0+l*1.25,d=u*f,{_lodMax:g}=this,_=this._sizeLods[n],m=3*_*(n>g-Ui?n-g+Ui:0),p=4*(this._cubeSize-_);c.envMap.value=e.texture,c.roughness.value=d,c.mipInt.value=g-t,bs(s,m,p,3*_,2*_),i.setRenderTarget(s),i.render(a,vo),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=g-n,bs(e,m,p,3*_,2*_),i.setRenderTarget(e),i.render(a,vo)}_blur(e,t,n,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,a){const c=this._renderer,l=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Ge("blur direction must be either latitudinal or longitudinal!");const h=3,u=this._lodMeshes[i];u.material=l;const f=l.uniforms,d=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*yr-1),_=s/g,m=isFinite(s)?1+Math.floor(h*_):yr;m>yr&&Te(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${yr}`);const p=[];let v=0;for(let I=0;I<yr;++I){const D=I/_,b=Math.exp(-D*D/2);p.push(b),I===0?v+=b:I<m&&(v+=2*b)}for(let I=0;I<p.length;I++)p[I]=p[I]/v;f.envMap.value=e.texture,f.samples.value=m,f.weights.value=p,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a);const{_lodMax:y}=this;f.dTheta.value=g,f.mipInt.value=y-n;const x=this._sizeLods[i],A=3*x*(i>y-Ui?i-y+Ui:0),E=4*(this._cubeSize-x);bs(t,A,E,3*x,2*x),c.setRenderTarget(t),c.render(u,vo)}}function t1(r){const e=[],t=[],n=[];let i=r;const s=r-Ui+1+tm.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);e.push(a);let c=1/a;o>r-Ui?c=tm[o-r+Ui-1]:o===0&&(c=0),t.push(c);const l=1/(a-2),h=-l,u=1+l,f=[h,h,u,h,u,u,h,h,u,u,h,u],d=6,g=6,_=3,m=2,p=1,v=new Float32Array(_*g*d),y=new Float32Array(m*g*d),x=new Float32Array(p*g*d);for(let E=0;E<d;E++){const I=E%3*2/3-1,D=E>2?0:-1,b=[I,D,0,I+2/3,D,0,I+2/3,D+1,0,I,D,0,I+2/3,D+1,0,I,D+1,0];v.set(b,_*g*E),y.set(f,m*g*E);const C=[E,E,E,E,E,E];x.set(C,p*g*E)}const A=new Ke;A.setAttribute("position",new ot(v,_)),A.setAttribute("uv",new ot(y,m)),A.setAttribute("faceIndex",new ot(x,p)),n.push(new St(A,null)),i>Ui&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function im(r,e,t){const n=new vn(r,e,t);return n.texture.mapping=Lr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function bs(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function n1(r,e,t){return new Cn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:$A,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:cl(),fragmentShader:`
3613
+ }`},Ce={common:{diffuse:{value:new xe(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},dfgLUT:{value:null}},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 he(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 xe(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 xe(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 xe(16777215)},opacity:{value:1},center:{value:new he(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new et},alphaMap:{value:null},alphaMapTransform:{value:new et},alphaTest:{value:0}}},Vn={basic:{uniforms:on([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.fog]),vertexShader:nt.meshbasic_vert,fragmentShader:nt.meshbasic_frag},lambert:{uniforms:on([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new xe(0)}}]),vertexShader:nt.meshlambert_vert,fragmentShader:nt.meshlambert_frag},phong:{uniforms:on([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new xe(0)},specular:{value:new xe(1118481)},shininess:{value:30}}]),vertexShader:nt.meshphong_vert,fragmentShader:nt.meshphong_frag},standard:{uniforms:on([Ce.common,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.roughnessmap,Ce.metalnessmap,Ce.fog,Ce.lights,{emissive:{value:new xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag},toon:{uniforms:on([Ce.common,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.gradientmap,Ce.fog,Ce.lights,{emissive:{value:new xe(0)}}]),vertexShader:nt.meshtoon_vert,fragmentShader:nt.meshtoon_frag},matcap:{uniforms:on([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,{matcap:{value:null}}]),vertexShader:nt.meshmatcap_vert,fragmentShader:nt.meshmatcap_frag},points:{uniforms:on([Ce.points,Ce.fog]),vertexShader:nt.points_vert,fragmentShader:nt.points_frag},dashed:{uniforms:on([Ce.common,Ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nt.linedashed_vert,fragmentShader:nt.linedashed_frag},depth:{uniforms:on([Ce.common,Ce.displacementmap]),vertexShader:nt.depth_vert,fragmentShader:nt.depth_frag},normal:{uniforms:on([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,{opacity:{value:1}}]),vertexShader:nt.meshnormal_vert,fragmentShader:nt.meshnormal_frag},sprite:{uniforms:on([Ce.sprite,Ce.fog]),vertexShader:nt.sprite_vert,fragmentShader:nt.sprite_frag},background:{uniforms:{uvTransform:{value:new et},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nt.background_vert,fragmentShader:nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new et}},vertexShader:nt.backgroundCube_vert,fragmentShader:nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nt.cube_vert,fragmentShader:nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nt.equirect_vert,fragmentShader:nt.equirect_frag},distance:{uniforms:on([Ce.common,Ce.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nt.distance_vert,fragmentShader:nt.distance_frag},shadow:{uniforms:on([Ce.lights,Ce.fog,{color:{value:new xe(0)},opacity:{value:1}}]),vertexShader:nt.shadow_vert,fragmentShader:nt.shadow_frag}};Vn.physical={uniforms:on([Vn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new et},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new et},clearcoatNormalScale:{value:new he(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 xe(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 he},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new et},attenuationDistance:{value:0},attenuationColor:{value:new xe(0)},specularColor:{value:new xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new et},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new et},anisotropyVector:{value:new he},anisotropyMap:{value:null},anisotropyMapTransform:{value:new et}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag};const al={r:0,b:0,g:0},vr=new Zt,XA=new We;function ZA(r,e,t,n,i,s,o){const a=new xe(0);let c=s===!0?0:1,l,h,u=null,f=0,d=null;function g(y){let x=y.isScene===!0?y.background:null;return x&&x.isTexture&&(x=(y.backgroundBlurriness>0?t:e).get(x)),x}function _(y){let x=!1;const A=g(y);A===null?p(a,c):A&&A.isColor&&(p(A,1),x=!0);const E=r.xr.getEnvironmentBlendMode();E==="additive"?n.buffers.color.setClear(0,0,0,1,o):E==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(r.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function m(y,x){const A=g(x);A&&(A.isCubeTexture||A.mapping===Lr)?(h===void 0&&(h=new St(new ji(1,1,1),new Cn({name:"BackgroundCubeMaterial",uniforms:is(Vn.backgroundCube.uniforms),vertexShader:Vn.backgroundCube.vertexShader,fragmentShader:Vn.backgroundCube.fragmentShader,side:en,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(E,I,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),vr.copy(x.backgroundRotation),vr.x*=-1,vr.y*=-1,vr.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(vr.y*=-1,vr.z*=-1),h.material.uniforms.envMap.value=A,h.material.uniforms.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(XA.makeRotationFromEuler(vr)),h.material.toneMapped=rt.getTransfer(A.colorSpace)!==ut,(u!==A||f!==A.version||d!==r.toneMapping)&&(h.material.needsUpdate=!0,u=A,f=A.version,d=r.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null)):A&&A.isTexture&&(l===void 0&&(l=new St(new rr(2,2),new Cn({name:"BackgroundMaterial",uniforms:is(Vn.background.uniforms),vertexShader:Vn.background.vertexShader,fragmentShader:Vn.background.fragmentShader,side:Wn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=A,l.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,l.material.toneMapped=rt.getTransfer(A.colorSpace)!==ut,A.matrixAutoUpdate===!0&&A.updateMatrix(),l.material.uniforms.uvTransform.value.copy(A.matrix),(u!==A||f!==A.version||d!==r.toneMapping)&&(l.material.needsUpdate=!0,u=A,f=A.version,d=r.toneMapping),l.layers.enableAll(),y.unshift(l,l.geometry,l.material,0,0,null))}function p(y,x){y.getRGB(al,wd(r)),n.buffers.color.setClear(al.r,al.g,al.b,x,o)}function v(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(y,x=1){a.set(y),c=x,p(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(y){c=y,p(a,c)},render:_,addToRenderList:m,dispose:v}}function YA(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=f(null);let s=i,o=!1;function a(C,B,R,O,M){let z=!1;const X=u(O,R,B);s!==X&&(s=X,l(s.object)),z=d(C,O,R,M),z&&g(C,O,R,M),M!==null&&e.update(M,r.ELEMENT_ARRAY_BUFFER),(z||o)&&(o=!1,x(C,B,R,O),M!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(M).buffer))}function c(){return r.createVertexArray()}function l(C){return r.bindVertexArray(C)}function h(C){return r.deleteVertexArray(C)}function u(C,B,R){const O=R.wireframe===!0;let M=n[C.id];M===void 0&&(M={},n[C.id]=M);let z=M[B.id];z===void 0&&(z={},M[B.id]=z);let X=z[O];return X===void 0&&(X=f(c()),z[O]=X),X}function f(C){const B=[],R=[],O=[];for(let M=0;M<t;M++)B[M]=0,R[M]=0,O[M]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:R,attributeDivisors:O,object:C,attributes:{},index:null}}function d(C,B,R,O){const M=s.attributes,z=B.attributes;let X=0;const H=R.getAttributes();for(const re in H)if(H[re].location>=0){const le=M[re];let W=z[re];if(W===void 0&&(re==="instanceMatrix"&&C.instanceMatrix&&(W=C.instanceMatrix),re==="instanceColor"&&C.instanceColor&&(W=C.instanceColor)),le===void 0||le.attribute!==W||W&&le.data!==W.data)return!0;X++}return s.attributesNum!==X||s.index!==O}function g(C,B,R,O){const M={},z=B.attributes;let X=0;const H=R.getAttributes();for(const re in H)if(H[re].location>=0){let le=z[re];le===void 0&&(re==="instanceMatrix"&&C.instanceMatrix&&(le=C.instanceMatrix),re==="instanceColor"&&C.instanceColor&&(le=C.instanceColor));const W={};W.attribute=le,le&&le.data&&(W.data=le.data),M[re]=W,X++}s.attributes=M,s.attributesNum=X,s.index=O}function _(){const C=s.newAttributes;for(let B=0,R=C.length;B<R;B++)C[B]=0}function m(C){p(C,0)}function p(C,B){const R=s.newAttributes,O=s.enabledAttributes,M=s.attributeDivisors;R[C]=1,O[C]===0&&(r.enableVertexAttribArray(C),O[C]=1),M[C]!==B&&(r.vertexAttribDivisor(C,B),M[C]=B)}function v(){const C=s.newAttributes,B=s.enabledAttributes;for(let R=0,O=B.length;R<O;R++)B[R]!==C[R]&&(r.disableVertexAttribArray(R),B[R]=0)}function y(C,B,R,O,M,z,X){X===!0?r.vertexAttribIPointer(C,B,R,M,z):r.vertexAttribPointer(C,B,R,O,M,z)}function x(C,B,R,O){_();const M=O.attributes,z=R.getAttributes(),X=B.defaultAttributeValues;for(const H in z){const re=z[H];if(re.location>=0){let J=M[H];if(J===void 0&&(H==="instanceMatrix"&&C.instanceMatrix&&(J=C.instanceMatrix),H==="instanceColor"&&C.instanceColor&&(J=C.instanceColor)),J!==void 0){const le=J.normalized,W=J.itemSize,Z=e.get(J);if(Z===void 0)continue;const ge=Z.buffer,_e=Z.type,de=Z.bytesPerElement,oe=_e===r.INT||_e===r.UNSIGNED_INT||J.gpuType===jo;if(J.isInterleavedBufferAttribute){const ee=J.data,pe=ee.stride,ye=J.offset;if(ee.isInstancedInterleavedBuffer){for(let Ae=0;Ae<re.locationSize;Ae++)p(re.location+Ae,ee.meshPerAttribute);C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let Ae=0;Ae<re.locationSize;Ae++)m(re.location+Ae);r.bindBuffer(r.ARRAY_BUFFER,ge);for(let Ae=0;Ae<re.locationSize;Ae++)y(re.location+Ae,W/re.locationSize,_e,le,pe*de,(ye+W/re.locationSize*Ae)*de,oe)}else{if(J.isInstancedBufferAttribute){for(let ee=0;ee<re.locationSize;ee++)p(re.location+ee,J.meshPerAttribute);C.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let ee=0;ee<re.locationSize;ee++)m(re.location+ee);r.bindBuffer(r.ARRAY_BUFFER,ge);for(let ee=0;ee<re.locationSize;ee++)y(re.location+ee,W/re.locationSize,_e,le,W*de,W/re.locationSize*ee*de,oe)}}else if(X!==void 0){const le=X[H];if(le!==void 0)switch(le.length){case 2:r.vertexAttrib2fv(re.location,le);break;case 3:r.vertexAttrib3fv(re.location,le);break;case 4:r.vertexAttrib4fv(re.location,le);break;default:r.vertexAttrib1fv(re.location,le)}}}}v()}function A(){D();for(const C in n){const B=n[C];for(const R in B){const O=B[R];for(const M in O)h(O[M].object),delete O[M];delete B[R]}delete n[C]}}function E(C){if(n[C.id]===void 0)return;const B=n[C.id];for(const R in B){const O=B[R];for(const M in O)h(O[M].object),delete O[M];delete B[R]}delete n[C.id]}function I(C){for(const B in n){const R=n[B];if(R[C.id]===void 0)continue;const O=R[C.id];for(const M in O)h(O[M].object),delete O[M];delete R[C.id]}}function D(){b(),o=!0,s!==i&&(s=i,l(s.object))}function b(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:D,resetDefaultState:b,dispose:A,releaseStatesOfGeometry:E,releaseStatesOfProgram:I,initAttributes:_,enableAttribute:m,disableUnusedAttributes:v}}function QA(r,e,t){let n;function i(l){n=l}function s(l,h){r.drawArrays(n,l,h),t.update(h,n,1)}function o(l,h,u){u!==0&&(r.drawArraysInstanced(n,l,h,u),t.update(h,n,u))}function a(l,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,h,0,u);let d=0;for(let g=0;g<u;g++)d+=h[g];t.update(d,n,1)}function c(l,h,u,f){if(u===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let g=0;g<l.length;g++)o(l[g],h[g],f[g]);else{d.multiDrawArraysInstancedWEBGL(n,l,0,h,0,f,0,u);let g=0;for(let _=0;_<u;_++)g+=h[_]*f[_];t.update(g,n,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=c}function KA(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(I){return!(I!==rn&&n.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(I){const D=I===Zn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(I!==ln&&n.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&I!==nn&&!D)}function c(I){if(I==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const h=c(l);h!==l&&(Te("WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const u=t.logarithmicDepthBuffer===!0,f=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),d=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),g=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),m=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),p=r.getParameter(r.MAX_VERTEX_ATTRIBS),v=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),y=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),A=r.getParameter(r.MAX_SAMPLES),E=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:a,precision:l,logarithmicDepthBuffer:u,reversedDepthBuffer:f,maxTextures:d,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:x,maxSamples:A,samples:E}}function jA(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new Ri,a=new et,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const d=u.length!==0||f||n!==0||i;return i=f,n=u.length,d},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=h(u,f,0)},this.setState=function(u,f,d){const g=u.clippingPlanes,_=u.clipIntersection,m=u.clipShadows,p=r.get(u);if(!i||g===null||g.length===0||s&&!m)s?h(null):l();else{const v=s?0:n,y=v*4;let x=p.clippingState||null;c.value=x,x=h(g,f,y,d);for(let A=0;A!==y;++A)x[A]=t[A];p.clippingState=x,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=v}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,f,d,g){const _=u!==null?u.length:0;let m=null;if(_!==0){if(m=c.value,g!==!0||m===null){const p=d+_*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(m===null||m.length<p)&&(m=new Float32Array(p));for(let y=0,x=d;y!==_;++y,x+=4)o.copy(u[y]).applyMatrix4(v,a),o.normal.toArray(m,x),m[x+3]=o.constant}c.value=m,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function JA(r){let e=new WeakMap;function t(o,a){return a===Us?o.mapping=Xn:a===Bs&&(o.mapping=vi),o}function n(o){if(o&&o.isTexture){const a=o.mapping;if(a===Us||a===Bs)if(e.has(o)){const c=e.get(o).texture;return t(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const l=new Th(c.height);return l.fromEquirectangularTexture(r,o),e.set(o,l),o.addEventListener("dispose",i),t(l.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Ui=4,tm=[.125,.215,.35,.446,.526,.582],yr=20,$A=256,vo=new ur,nm=new xe;let Iu=null,Ru=0,Pu=0,Du=!1;const e1=new U;class Lu{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,s={}){const{size:o=256,position:a=e1}=s;Iu=this._renderer.getRenderTarget(),Ru=this._renderer.getActiveCubeFace(),Pu=this._renderer.getActiveMipmapLevel(),Du=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,i,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=sm(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=rm(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Iu,Ru,Pu),this._renderer.xr.enabled=Du,e.scissorTest=!1,bs(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Xn||e.mapping===vi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Iu=this._renderer.getRenderTarget(),Ru=this._renderer.getActiveCubeFace(),Pu=this._renderer.getActiveMipmapLevel(),Du=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:pt,minFilter:pt,generateMipmaps:!1,type:Zn,format:rn,colorSpace:Xt,depthBuffer:!1},i=im(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=im(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=t1(s)),this._blurMaterial=i1(s,e,t),this._ggxMaterial=n1(s,e,t)}return i}_compileMaterial(e){const t=new St(new Ke,e);this._renderer.compile(t,vo)}_sceneToCubeUV(e,t,n,i,s){const c=new kt(90,1,t,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,f=u.autoClear,d=u.toneMapping;u.getClearColor(nm),u.toneMapping=Nn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new St(new ji,new un({name:"PMREM.Background",side:en,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,m=_.material;let p=!1;const v=e.background;v?v.isColor&&(m.color.copy(v),e.background=null,p=!0):(m.color.copy(nm),p=!0);for(let y=0;y<6;y++){const x=y%3;x===0?(c.up.set(0,l[y],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+h[y],s.y,s.z)):x===1?(c.up.set(0,0,l[y]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+h[y],s.z)):(c.up.set(0,l[y],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+h[y]));const A=this._cubeSize;bs(i,x*A,y>2?A:0,A,A),u.setRenderTarget(i),p&&u.render(_,c),u.render(e,c)}u.toneMapping=d,u.autoClear=f,e.background=v}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Xn||e.mapping===vi;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=sm()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=rm());const s=i?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;const a=s.uniforms;a.envMap.value=e;const c=this._cubeSize;bs(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(o,vo)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;const c=o.uniforms,l=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),u=Math.sqrt(l*l-h*h),f=0+l*1.25,d=u*f,{_lodMax:g}=this,_=this._sizeLods[n],m=3*_*(n>g-Ui?n-g+Ui:0),p=4*(this._cubeSize-_);c.envMap.value=e.texture,c.roughness.value=d,c.mipInt.value=g-t,bs(s,m,p,3*_,2*_),i.setRenderTarget(s),i.render(a,vo),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=g-n,bs(e,m,p,3*_,2*_),i.setRenderTarget(e),i.render(a,vo)}_blur(e,t,n,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,a){const c=this._renderer,l=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Ge("blur direction must be either latitudinal or longitudinal!");const h=3,u=this._lodMeshes[i];u.material=l;const f=l.uniforms,d=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*yr-1),_=s/g,m=isFinite(s)?1+Math.floor(h*_):yr;m>yr&&Te(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${yr}`);const p=[];let v=0;for(let I=0;I<yr;++I){const D=I/_,b=Math.exp(-D*D/2);p.push(b),I===0?v+=b:I<m&&(v+=2*b)}for(let I=0;I<p.length;I++)p[I]=p[I]/v;f.envMap.value=e.texture,f.samples.value=m,f.weights.value=p,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a);const{_lodMax:y}=this;f.dTheta.value=g,f.mipInt.value=y-n;const x=this._sizeLods[i],A=3*x*(i>y-Ui?i-y+Ui:0),E=4*(this._cubeSize-x);bs(t,A,E,3*x,2*x),c.setRenderTarget(t),c.render(u,vo)}}function t1(r){const e=[],t=[],n=[];let i=r;const s=r-Ui+1+tm.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);e.push(a);let c=1/a;o>r-Ui?c=tm[o-r+Ui-1]:o===0&&(c=0),t.push(c);const l=1/(a-2),h=-l,u=1+l,f=[h,h,u,h,u,u,h,h,u,u,h,u],d=6,g=6,_=3,m=2,p=1,v=new Float32Array(_*g*d),y=new Float32Array(m*g*d),x=new Float32Array(p*g*d);for(let E=0;E<d;E++){const I=E%3*2/3-1,D=E>2?0:-1,b=[I,D,0,I+2/3,D,0,I+2/3,D+1,0,I,D,0,I+2/3,D+1,0,I,D+1,0];v.set(b,_*g*E),y.set(f,m*g*E);const C=[E,E,E,E,E,E];x.set(C,p*g*E)}const A=new Ke;A.setAttribute("position",new ot(v,_)),A.setAttribute("uv",new ot(y,m)),A.setAttribute("faceIndex",new ot(x,p)),n.push(new St(A,null)),i>Ui&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function im(r,e,t){const n=new vn(r,e,t);return n.texture.mapping=Lr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function bs(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function n1(r,e,t){return new Cn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:$A,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:cl(),fragmentShader:`
3614
3614
 
3615
3615
  precision highp float;
3616
3616
  precision highp int;
@@ -3958,14 +3958,14 @@ void main() {
3958
3958
  `)+`
3959
3959
  `+m,p=["#define varying in",t.glslVersion===nh?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===nh?"":"#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(`
3960
3960
  `)+`
3961
- `+p);const y=v+m+o,x=v+p+a,A=gm(i,i.VERTEX_SHADER,y),E=gm(i,i.FRAGMENT_SHADER,x);i.attachShader(_,A),i.attachShader(_,E),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function I(B){if(r.debug.checkShaderErrors){const R=i.getProgramInfoLog(_)||"",O=i.getShaderInfoLog(A)||"",M=i.getShaderInfoLog(E)||"",z=R.trim(),X=O.trim(),H=M.trim();let re=!0,$=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(re=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,A,E);else{const le=vm(i,A,"vertex"),W=vm(i,E,"fragment");Ge("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
3961
+ `+p);const y=v+m+o,x=v+p+a,A=gm(i,i.VERTEX_SHADER,y),E=gm(i,i.FRAGMENT_SHADER,x);i.attachShader(_,A),i.attachShader(_,E),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function I(B){if(r.debug.checkShaderErrors){const R=i.getProgramInfoLog(_)||"",O=i.getShaderInfoLog(A)||"",M=i.getShaderInfoLog(E)||"",z=R.trim(),X=O.trim(),H=M.trim();let re=!0,J=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(re=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,A,E);else{const le=vm(i,A,"vertex"),W=vm(i,E,"fragment");Ge("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
3962
3962
 
3963
3963
  Material Name: `+B.name+`
3964
3964
  Material Type: `+B.type+`
3965
3965
 
3966
3966
  Program Info Log: `+z+`
3967
3967
  `+le+`
3968
- `+W)}else z!==""?Te("WebGLProgram: Program Info Log:",z):(X===""||H==="")&&($=!1);$&&(B.diagnostics={runnable:re,programLog:z,vertexShader:{log:X,prefix:m},fragmentShader:{log:H,prefix:p}})}i.deleteShader(A),i.deleteShader(E),D=new hl(i,_),b=db(i,_)}let D;this.getUniforms=function(){return D===void 0&&I(this),D};let b;this.getAttributes=function(){return b===void 0&&I(this),b};let C=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return C===!1&&(C=i.getProgramParameter(_,ib)),C},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=rb++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=A,this.fragmentShader=E,this}let Ib=0;class Rb{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Pb(e),t.set(e,n)),n}}class Pb{constructor(e){this.id=Ib++,this.code=e,this.usedTimes=0}}function Db(r,e,t,n,i,s,o){const a=new Qa,c=new Rb,l=new Set,h=[],u=new Map,f=i.logarithmicDepthBuffer;let d=i.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(b){return l.add(b),b===0?"uv":`uv${b}`}function m(b,C,B,R,O){const M=R.fog,z=O.geometry,X=b.isMeshStandardMaterial?R.environment:null,H=(b.isMeshStandardMaterial?t:e).get(b.envMap||X),re=!!H&&H.mapping===Lr?H.image.height:null,$=g[b.type];b.precision!==null&&(d=i.getMaxPrecision(b.precision),d!==b.precision&&Te("WebGLProgram.getParameters:",b.precision,"not supported, using",d,"instead."));const le=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,W=le!==void 0?le.length:0;let Z=0;z.morphAttributes.position!==void 0&&(Z=1),z.morphAttributes.normal!==void 0&&(Z=2),z.morphAttributes.color!==void 0&&(Z=3);let ge,_e,de,oe;if($){const ft=Vn[$];ge=ft.vertexShader,_e=ft.fragmentShader}else ge=b.vertexShader,_e=b.fragmentShader,c.update(b),de=c.getVertexShaderID(b),oe=c.getFragmentShaderID(b);const ee=r.getRenderTarget(),pe=r.state.buffers.depth.getReversed(),ye=O.isInstancedMesh===!0,Ae=O.isBatchedMesh===!0,ze=!!b.map,je=!!b.matcap,He=!!H,w=!!b.aoMap,q=!!b.lightMap,k=!!b.bumpMap,N=!!b.normalMap,S=!!b.displacementMap,G=!!b.emissiveMap,K=!!b.metalnessMap,ie=!!b.roughnessMap,V=b.anisotropy>0,P=b.clearcoat>0,T=b.dispersion>0,F=b.iridescence>0,Q=b.sheen>0,ce=b.transmission>0,te=V&&!!b.anisotropyMap,Re=P&&!!b.clearcoatMap,we=P&&!!b.clearcoatNormalMap,Le=P&&!!b.clearcoatRoughnessMap,Xe=F&&!!b.iridescenceMap,fe=F&&!!b.iridescenceThicknessMap,Se=Q&&!!b.sheenColorMap,Oe=Q&&!!b.sheenRoughnessMap,Ue=!!b.specularMap,Me=!!b.specularColorMap,it=!!b.specularIntensityMap,Y=ce&&!!b.transmissionMap,Pe=ce&&!!b.thicknessMap,be=!!b.gradientMap,De=!!b.alphaMap,ve=b.alphaTest>0,me=!!b.alphaHash,Ee=!!b.extensions;let $e=Nn;b.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&($e=r.toneMapping);const vt={shaderID:$,shaderType:b.type,shaderName:b.name,vertexShader:ge,fragmentShader:_e,defines:b.defines,customVertexShaderID:de,customFragmentShaderID:oe,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:d,batching:Ae,batchingColor:Ae&&O._colorsTexture!==null,instancing:ye,instancingColor:ye&&O.instanceColor!==null,instancingMorph:ye&&O.morphTexture!==null,outputColorSpace:ee===null?r.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:Xt,alphaToCoverage:!!b.alphaToCoverage,map:ze,matcap:je,envMap:He,envMapMode:He&&H.mapping,envMapCubeUVHeight:re,aoMap:w,lightMap:q,bumpMap:k,normalMap:N,displacementMap:S,emissiveMap:G,normalMapObjectSpace:N&&b.normalMapType===Qf,normalMapTangentSpace:N&&b.normalMapType===Ai,metalnessMap:K,roughnessMap:ie,anisotropy:V,anisotropyMap:te,clearcoat:P,clearcoatMap:Re,clearcoatNormalMap:we,clearcoatRoughnessMap:Le,dispersion:T,iridescence:F,iridescenceMap:Xe,iridescenceThicknessMap:fe,sheen:Q,sheenColorMap:Se,sheenRoughnessMap:Oe,specularMap:Ue,specularColorMap:Me,specularIntensityMap:it,transmission:ce,transmissionMap:Y,thicknessMap:Pe,gradientMap:be,opaque:b.transparent===!1&&b.blending===ki&&b.alphaToCoverage===!1,alphaMap:De,alphaTest:ve,alphaHash:me,combine:b.combine,mapUv:ze&&_(b.map.channel),aoMapUv:w&&_(b.aoMap.channel),lightMapUv:q&&_(b.lightMap.channel),bumpMapUv:k&&_(b.bumpMap.channel),normalMapUv:N&&_(b.normalMap.channel),displacementMapUv:S&&_(b.displacementMap.channel),emissiveMapUv:G&&_(b.emissiveMap.channel),metalnessMapUv:K&&_(b.metalnessMap.channel),roughnessMapUv:ie&&_(b.roughnessMap.channel),anisotropyMapUv:te&&_(b.anisotropyMap.channel),clearcoatMapUv:Re&&_(b.clearcoatMap.channel),clearcoatNormalMapUv:we&&_(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Le&&_(b.clearcoatRoughnessMap.channel),iridescenceMapUv:Xe&&_(b.iridescenceMap.channel),iridescenceThicknessMapUv:fe&&_(b.iridescenceThicknessMap.channel),sheenColorMapUv:Se&&_(b.sheenColorMap.channel),sheenRoughnessMapUv:Oe&&_(b.sheenRoughnessMap.channel),specularMapUv:Ue&&_(b.specularMap.channel),specularColorMapUv:Me&&_(b.specularColorMap.channel),specularIntensityMapUv:it&&_(b.specularIntensityMap.channel),transmissionMapUv:Y&&_(b.transmissionMap.channel),thicknessMapUv:Pe&&_(b.thicknessMap.channel),alphaMapUv:De&&_(b.alphaMap.channel),vertexTangents:!!z.attributes.tangent&&(N||V),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!z.attributes.uv&&(ze||De),fog:!!M,useFog:b.fog===!0,fogExp2:!!M&&M.isFogExp2,flatShading:b.flatShading===!0&&b.wireframe===!1,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:pe,skinning:O.isSkinnedMesh===!0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:W,morphTextureStride:Z,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&B.length>0,shadowMapType:r.shadowMap.type,toneMapping:$e,decodeVideoTexture:ze&&b.map.isVideoTexture===!0&&rt.getTransfer(b.map.colorSpace)===ut,decodeVideoTextureEmissive:G&&b.emissiveMap.isVideoTexture===!0&&rt.getTransfer(b.emissiveMap.colorSpace)===ut,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Sn,flipSided:b.side===en,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Ee&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ee&&b.extensions.multiDraw===!0||Ae)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return vt.vertexUv1s=l.has(1),vt.vertexUv2s=l.has(2),vt.vertexUv3s=l.has(3),l.clear(),vt}function p(b){const C=[];if(b.shaderID?C.push(b.shaderID):(C.push(b.customVertexShaderID),C.push(b.customFragmentShaderID)),b.defines!==void 0)for(const B in b.defines)C.push(B),C.push(b.defines[B]);return b.isRawShaderMaterial===!1&&(v(C,b),y(C,b),C.push(r.outputColorSpace)),C.push(b.customProgramCacheKey),C.join()}function v(b,C){b.push(C.precision),b.push(C.outputColorSpace),b.push(C.envMapMode),b.push(C.envMapCubeUVHeight),b.push(C.mapUv),b.push(C.alphaMapUv),b.push(C.lightMapUv),b.push(C.aoMapUv),b.push(C.bumpMapUv),b.push(C.normalMapUv),b.push(C.displacementMapUv),b.push(C.emissiveMapUv),b.push(C.metalnessMapUv),b.push(C.roughnessMapUv),b.push(C.anisotropyMapUv),b.push(C.clearcoatMapUv),b.push(C.clearcoatNormalMapUv),b.push(C.clearcoatRoughnessMapUv),b.push(C.iridescenceMapUv),b.push(C.iridescenceThicknessMapUv),b.push(C.sheenColorMapUv),b.push(C.sheenRoughnessMapUv),b.push(C.specularMapUv),b.push(C.specularColorMapUv),b.push(C.specularIntensityMapUv),b.push(C.transmissionMapUv),b.push(C.thicknessMapUv),b.push(C.combine),b.push(C.fogExp2),b.push(C.sizeAttenuation),b.push(C.morphTargetsCount),b.push(C.morphAttributeCount),b.push(C.numDirLights),b.push(C.numPointLights),b.push(C.numSpotLights),b.push(C.numSpotLightMaps),b.push(C.numHemiLights),b.push(C.numRectAreaLights),b.push(C.numDirLightShadows),b.push(C.numPointLightShadows),b.push(C.numSpotLightShadows),b.push(C.numSpotLightShadowsWithMaps),b.push(C.numLightProbes),b.push(C.shadowMapType),b.push(C.toneMapping),b.push(C.numClippingPlanes),b.push(C.numClipIntersection),b.push(C.depthPacking)}function y(b,C){a.disableAll(),C.instancing&&a.enable(0),C.instancingColor&&a.enable(1),C.instancingMorph&&a.enable(2),C.matcap&&a.enable(3),C.envMap&&a.enable(4),C.normalMapObjectSpace&&a.enable(5),C.normalMapTangentSpace&&a.enable(6),C.clearcoat&&a.enable(7),C.iridescence&&a.enable(8),C.alphaTest&&a.enable(9),C.vertexColors&&a.enable(10),C.vertexAlphas&&a.enable(11),C.vertexUv1s&&a.enable(12),C.vertexUv2s&&a.enable(13),C.vertexUv3s&&a.enable(14),C.vertexTangents&&a.enable(15),C.anisotropy&&a.enable(16),C.alphaHash&&a.enable(17),C.batching&&a.enable(18),C.dispersion&&a.enable(19),C.batchingColor&&a.enable(20),C.gradientMap&&a.enable(21),b.push(a.mask),a.disableAll(),C.fog&&a.enable(0),C.useFog&&a.enable(1),C.flatShading&&a.enable(2),C.logarithmicDepthBuffer&&a.enable(3),C.reversedDepthBuffer&&a.enable(4),C.skinning&&a.enable(5),C.morphTargets&&a.enable(6),C.morphNormals&&a.enable(7),C.morphColors&&a.enable(8),C.premultipliedAlpha&&a.enable(9),C.shadowMapEnabled&&a.enable(10),C.doubleSided&&a.enable(11),C.flipSided&&a.enable(12),C.useDepthPacking&&a.enable(13),C.dithering&&a.enable(14),C.transmission&&a.enable(15),C.sheen&&a.enable(16),C.opaque&&a.enable(17),C.pointsUvs&&a.enable(18),C.decodeVideoTexture&&a.enable(19),C.decodeVideoTextureEmissive&&a.enable(20),C.alphaToCoverage&&a.enable(21),b.push(a.mask)}function x(b){const C=g[b.type];let B;if(C){const R=Vn[C];B=Sd.clone(R.uniforms)}else B=b.uniforms;return B}function A(b,C){let B=u.get(C);return B!==void 0?++B.usedTimes:(B=new Cb(r,C,b,s),h.push(B),u.set(C,B)),B}function E(b){if(--b.usedTimes===0){const C=h.indexOf(b);h[C]=h[h.length-1],h.pop(),u.delete(b.cacheKey),b.destroy()}}function I(b){c.remove(b)}function D(){c.dispose()}return{getParameters:m,getProgramCacheKey:p,getUniforms:x,acquireProgram:A,releaseProgram:E,releaseShaderCache:I,programs:h,dispose:D}}function Lb(){let r=new WeakMap;function e(o){return r.has(o)}function t(o){let a=r.get(o);return a===void 0&&(a={},r.set(o,a)),a}function n(o){r.delete(o)}function i(o,a,c){r.get(o)[a]=c}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function Nb(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function wm(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Sm(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(u,f,d,g,_,m){let p=r[e];return p===void 0?(p={id:u.id,object:u,geometry:f,material:d,groupOrder:g,renderOrder:u.renderOrder,z:_,group:m},r[e]=p):(p.id=u.id,p.object=u,p.geometry=f,p.material=d,p.groupOrder=g,p.renderOrder=u.renderOrder,p.z=_,p.group=m),e++,p}function a(u,f,d,g,_,m){const p=o(u,f,d,g,_,m);d.transmission>0?n.push(p):d.transparent===!0?i.push(p):t.push(p)}function c(u,f,d,g,_,m){const p=o(u,f,d,g,_,m);d.transmission>0?n.unshift(p):d.transparent===!0?i.unshift(p):t.unshift(p)}function l(u,f){t.length>1&&t.sort(u||Nb),n.length>1&&n.sort(f||wm),i.length>1&&i.sort(f||wm)}function h(){for(let u=e,f=r.length;u<f;u++){const d=r[u];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:a,unshift:c,finish:h,sort:l}}function Ub(){let r=new WeakMap;function e(n,i){const s=r.get(n);let o;return s===void 0?(o=new Sm,r.set(n,[o])):i>=s.length?(o=new Sm,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function Bb(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new xe};break;case"SpotLight":t={position:new U,direction:new U,color:new xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new xe,groundColor:new xe};break;case"RectAreaLight":t={color:new xe,position:new U,halfWidth:new U,halfHeight:new U};break}return r[e.id]=t,t}}}function Ob(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Fb=0;function zb(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function kb(r){const e=new Bb,t=Ob(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new U);const i=new U,s=new We,o=new We;function a(l){let h=0,u=0,f=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let d=0,g=0,_=0,m=0,p=0,v=0,y=0,x=0,A=0,E=0,I=0;l.sort(zb);for(let b=0,C=l.length;b<C;b++){const B=l[b],R=B.color,O=B.intensity,M=B.distance;let z=null;if(B.shadow&&B.shadow.map&&(B.shadow.map.texture.format===Gi?z=B.shadow.map.texture:z=B.shadow.map.depthTexture||B.shadow.map.texture),B.isAmbientLight)h+=R.r*O,u+=R.g*O,f+=R.b*O;else if(B.isLightProbe){for(let X=0;X<9;X++)n.probe[X].addScaledVector(B.sh.coefficients[X],O);I++}else if(B.isDirectionalLight){const X=e.get(B);if(X.color.copy(B.color).multiplyScalar(B.intensity),B.castShadow){const H=B.shadow,re=t.get(B);re.shadowIntensity=H.intensity,re.shadowBias=H.bias,re.shadowNormalBias=H.normalBias,re.shadowRadius=H.radius,re.shadowMapSize=H.mapSize,n.directionalShadow[d]=re,n.directionalShadowMap[d]=z,n.directionalShadowMatrix[d]=B.shadow.matrix,v++}n.directional[d]=X,d++}else if(B.isSpotLight){const X=e.get(B);X.position.setFromMatrixPosition(B.matrixWorld),X.color.copy(R).multiplyScalar(O),X.distance=M,X.coneCos=Math.cos(B.angle),X.penumbraCos=Math.cos(B.angle*(1-B.penumbra)),X.decay=B.decay,n.spot[_]=X;const H=B.shadow;if(B.map&&(n.spotLightMap[A]=B.map,A++,H.updateMatrices(B),B.castShadow&&E++),n.spotLightMatrix[_]=H.matrix,B.castShadow){const re=t.get(B);re.shadowIntensity=H.intensity,re.shadowBias=H.bias,re.shadowNormalBias=H.normalBias,re.shadowRadius=H.radius,re.shadowMapSize=H.mapSize,n.spotShadow[_]=re,n.spotShadowMap[_]=z,x++}_++}else if(B.isRectAreaLight){const X=e.get(B);X.color.copy(R).multiplyScalar(O),X.halfWidth.set(B.width*.5,0,0),X.halfHeight.set(0,B.height*.5,0),n.rectArea[m]=X,m++}else if(B.isPointLight){const X=e.get(B);if(X.color.copy(B.color).multiplyScalar(B.intensity),X.distance=B.distance,X.decay=B.decay,B.castShadow){const H=B.shadow,re=t.get(B);re.shadowIntensity=H.intensity,re.shadowBias=H.bias,re.shadowNormalBias=H.normalBias,re.shadowRadius=H.radius,re.shadowMapSize=H.mapSize,re.shadowCameraNear=H.camera.near,re.shadowCameraFar=H.camera.far,n.pointShadow[g]=re,n.pointShadowMap[g]=z,n.pointShadowMatrix[g]=B.shadow.matrix,y++}n.point[g]=X,g++}else if(B.isHemisphereLight){const X=e.get(B);X.skyColor.copy(B.color).multiplyScalar(O),X.groundColor.copy(B.groundColor).multiplyScalar(O),n.hemi[p]=X,p++}}m>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ce.LTC_FLOAT_1,n.rectAreaLTC2=Ce.LTC_FLOAT_2):(n.rectAreaLTC1=Ce.LTC_HALF_1,n.rectAreaLTC2=Ce.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=f;const D=n.hash;(D.directionalLength!==d||D.pointLength!==g||D.spotLength!==_||D.rectAreaLength!==m||D.hemiLength!==p||D.numDirectionalShadows!==v||D.numPointShadows!==y||D.numSpotShadows!==x||D.numSpotMaps!==A||D.numLightProbes!==I)&&(n.directional.length=d,n.spot.length=_,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=y,n.spotLightMatrix.length=x+A-E,n.spotLightMap.length=A,n.numSpotLightShadowsWithMaps=E,n.numLightProbes=I,D.directionalLength=d,D.pointLength=g,D.spotLength=_,D.rectAreaLength=m,D.hemiLength=p,D.numDirectionalShadows=v,D.numPointShadows=y,D.numSpotShadows=x,D.numSpotMaps=A,D.numLightProbes=I,n.version=Fb++)}function c(l,h){let u=0,f=0,d=0,g=0,_=0;const m=h.matrixWorldInverse;for(let p=0,v=l.length;p<v;p++){const y=l[p];if(y.isDirectionalLight){const x=n.directional[u];x.direction.setFromMatrixPosition(y.matrixWorld),i.setFromMatrixPosition(y.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(m),u++}else if(y.isSpotLight){const x=n.spot[d];x.position.setFromMatrixPosition(y.matrixWorld),x.position.applyMatrix4(m),x.direction.setFromMatrixPosition(y.matrixWorld),i.setFromMatrixPosition(y.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(m),d++}else if(y.isRectAreaLight){const x=n.rectArea[g];x.position.setFromMatrixPosition(y.matrixWorld),x.position.applyMatrix4(m),o.identity(),s.copy(y.matrixWorld),s.premultiply(m),o.extractRotation(s),x.halfWidth.set(y.width*.5,0,0),x.halfHeight.set(0,y.height*.5,0),x.halfWidth.applyMatrix4(o),x.halfHeight.applyMatrix4(o),g++}else if(y.isPointLight){const x=n.point[f];x.position.setFromMatrixPosition(y.matrixWorld),x.position.applyMatrix4(m),f++}else if(y.isHemisphereLight){const x=n.hemi[_];x.direction.setFromMatrixPosition(y.matrixWorld),x.direction.transformDirection(m),_++}}}return{setup:a,setupView:c,state:n}}function Mm(r){const e=new kb(r),t=[],n=[];function i(h){l.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function o(h){n.push(h)}function a(){e.setup(t)}function c(h){e.setupView(t,h)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:l,setupLights:a,setupLightsView:c,pushLight:s,pushShadow:o}}function Vb(r){let e=new WeakMap;function t(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new Mm(r),e.set(i,[a])):s>=o.length?(a=new Mm(r),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}const Hb=`void main() {
3968
+ `+W)}else z!==""?Te("WebGLProgram: Program Info Log:",z):(X===""||H==="")&&(J=!1);J&&(B.diagnostics={runnable:re,programLog:z,vertexShader:{log:X,prefix:m},fragmentShader:{log:H,prefix:p}})}i.deleteShader(A),i.deleteShader(E),D=new hl(i,_),b=db(i,_)}let D;this.getUniforms=function(){return D===void 0&&I(this),D};let b;this.getAttributes=function(){return b===void 0&&I(this),b};let C=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return C===!1&&(C=i.getProgramParameter(_,ib)),C},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=rb++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=A,this.fragmentShader=E,this}let Ib=0;class Rb{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Pb(e),t.set(e,n)),n}}class Pb{constructor(e){this.id=Ib++,this.code=e,this.usedTimes=0}}function Db(r,e,t,n,i,s,o){const a=new Qa,c=new Rb,l=new Set,h=[],u=new Map,f=i.logarithmicDepthBuffer;let d=i.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(b){return l.add(b),b===0?"uv":`uv${b}`}function m(b,C,B,R,O){const M=R.fog,z=O.geometry,X=b.isMeshStandardMaterial?R.environment:null,H=(b.isMeshStandardMaterial?t:e).get(b.envMap||X),re=!!H&&H.mapping===Lr?H.image.height:null,J=g[b.type];b.precision!==null&&(d=i.getMaxPrecision(b.precision),d!==b.precision&&Te("WebGLProgram.getParameters:",b.precision,"not supported, using",d,"instead."));const le=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,W=le!==void 0?le.length:0;let Z=0;z.morphAttributes.position!==void 0&&(Z=1),z.morphAttributes.normal!==void 0&&(Z=2),z.morphAttributes.color!==void 0&&(Z=3);let ge,_e,de,oe;if(J){const ft=Vn[J];ge=ft.vertexShader,_e=ft.fragmentShader}else ge=b.vertexShader,_e=b.fragmentShader,c.update(b),de=c.getVertexShaderID(b),oe=c.getFragmentShaderID(b);const ee=r.getRenderTarget(),pe=r.state.buffers.depth.getReversed(),ye=O.isInstancedMesh===!0,Ae=O.isBatchedMesh===!0,ze=!!b.map,je=!!b.matcap,He=!!H,w=!!b.aoMap,q=!!b.lightMap,k=!!b.bumpMap,N=!!b.normalMap,S=!!b.displacementMap,G=!!b.emissiveMap,K=!!b.metalnessMap,ie=!!b.roughnessMap,V=b.anisotropy>0,P=b.clearcoat>0,T=b.dispersion>0,F=b.iridescence>0,Q=b.sheen>0,ce=b.transmission>0,te=V&&!!b.anisotropyMap,Re=P&&!!b.clearcoatMap,we=P&&!!b.clearcoatNormalMap,Le=P&&!!b.clearcoatRoughnessMap,Xe=F&&!!b.iridescenceMap,fe=F&&!!b.iridescenceThicknessMap,Se=Q&&!!b.sheenColorMap,Oe=Q&&!!b.sheenRoughnessMap,Ue=!!b.specularMap,Me=!!b.specularColorMap,it=!!b.specularIntensityMap,Y=ce&&!!b.transmissionMap,Pe=ce&&!!b.thicknessMap,be=!!b.gradientMap,De=!!b.alphaMap,ve=b.alphaTest>0,me=!!b.alphaHash,Ee=!!b.extensions;let $e=Nn;b.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&($e=r.toneMapping);const vt={shaderID:J,shaderType:b.type,shaderName:b.name,vertexShader:ge,fragmentShader:_e,defines:b.defines,customVertexShaderID:de,customFragmentShaderID:oe,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:d,batching:Ae,batchingColor:Ae&&O._colorsTexture!==null,instancing:ye,instancingColor:ye&&O.instanceColor!==null,instancingMorph:ye&&O.morphTexture!==null,outputColorSpace:ee===null?r.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:Xt,alphaToCoverage:!!b.alphaToCoverage,map:ze,matcap:je,envMap:He,envMapMode:He&&H.mapping,envMapCubeUVHeight:re,aoMap:w,lightMap:q,bumpMap:k,normalMap:N,displacementMap:S,emissiveMap:G,normalMapObjectSpace:N&&b.normalMapType===Qf,normalMapTangentSpace:N&&b.normalMapType===Ai,metalnessMap:K,roughnessMap:ie,anisotropy:V,anisotropyMap:te,clearcoat:P,clearcoatMap:Re,clearcoatNormalMap:we,clearcoatRoughnessMap:Le,dispersion:T,iridescence:F,iridescenceMap:Xe,iridescenceThicknessMap:fe,sheen:Q,sheenColorMap:Se,sheenRoughnessMap:Oe,specularMap:Ue,specularColorMap:Me,specularIntensityMap:it,transmission:ce,transmissionMap:Y,thicknessMap:Pe,gradientMap:be,opaque:b.transparent===!1&&b.blending===ki&&b.alphaToCoverage===!1,alphaMap:De,alphaTest:ve,alphaHash:me,combine:b.combine,mapUv:ze&&_(b.map.channel),aoMapUv:w&&_(b.aoMap.channel),lightMapUv:q&&_(b.lightMap.channel),bumpMapUv:k&&_(b.bumpMap.channel),normalMapUv:N&&_(b.normalMap.channel),displacementMapUv:S&&_(b.displacementMap.channel),emissiveMapUv:G&&_(b.emissiveMap.channel),metalnessMapUv:K&&_(b.metalnessMap.channel),roughnessMapUv:ie&&_(b.roughnessMap.channel),anisotropyMapUv:te&&_(b.anisotropyMap.channel),clearcoatMapUv:Re&&_(b.clearcoatMap.channel),clearcoatNormalMapUv:we&&_(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Le&&_(b.clearcoatRoughnessMap.channel),iridescenceMapUv:Xe&&_(b.iridescenceMap.channel),iridescenceThicknessMapUv:fe&&_(b.iridescenceThicknessMap.channel),sheenColorMapUv:Se&&_(b.sheenColorMap.channel),sheenRoughnessMapUv:Oe&&_(b.sheenRoughnessMap.channel),specularMapUv:Ue&&_(b.specularMap.channel),specularColorMapUv:Me&&_(b.specularColorMap.channel),specularIntensityMapUv:it&&_(b.specularIntensityMap.channel),transmissionMapUv:Y&&_(b.transmissionMap.channel),thicknessMapUv:Pe&&_(b.thicknessMap.channel),alphaMapUv:De&&_(b.alphaMap.channel),vertexTangents:!!z.attributes.tangent&&(N||V),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!z.attributes.uv&&(ze||De),fog:!!M,useFog:b.fog===!0,fogExp2:!!M&&M.isFogExp2,flatShading:b.flatShading===!0&&b.wireframe===!1,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:pe,skinning:O.isSkinnedMesh===!0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:W,morphTextureStride:Z,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&B.length>0,shadowMapType:r.shadowMap.type,toneMapping:$e,decodeVideoTexture:ze&&b.map.isVideoTexture===!0&&rt.getTransfer(b.map.colorSpace)===ut,decodeVideoTextureEmissive:G&&b.emissiveMap.isVideoTexture===!0&&rt.getTransfer(b.emissiveMap.colorSpace)===ut,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Sn,flipSided:b.side===en,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Ee&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ee&&b.extensions.multiDraw===!0||Ae)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return vt.vertexUv1s=l.has(1),vt.vertexUv2s=l.has(2),vt.vertexUv3s=l.has(3),l.clear(),vt}function p(b){const C=[];if(b.shaderID?C.push(b.shaderID):(C.push(b.customVertexShaderID),C.push(b.customFragmentShaderID)),b.defines!==void 0)for(const B in b.defines)C.push(B),C.push(b.defines[B]);return b.isRawShaderMaterial===!1&&(v(C,b),y(C,b),C.push(r.outputColorSpace)),C.push(b.customProgramCacheKey),C.join()}function v(b,C){b.push(C.precision),b.push(C.outputColorSpace),b.push(C.envMapMode),b.push(C.envMapCubeUVHeight),b.push(C.mapUv),b.push(C.alphaMapUv),b.push(C.lightMapUv),b.push(C.aoMapUv),b.push(C.bumpMapUv),b.push(C.normalMapUv),b.push(C.displacementMapUv),b.push(C.emissiveMapUv),b.push(C.metalnessMapUv),b.push(C.roughnessMapUv),b.push(C.anisotropyMapUv),b.push(C.clearcoatMapUv),b.push(C.clearcoatNormalMapUv),b.push(C.clearcoatRoughnessMapUv),b.push(C.iridescenceMapUv),b.push(C.iridescenceThicknessMapUv),b.push(C.sheenColorMapUv),b.push(C.sheenRoughnessMapUv),b.push(C.specularMapUv),b.push(C.specularColorMapUv),b.push(C.specularIntensityMapUv),b.push(C.transmissionMapUv),b.push(C.thicknessMapUv),b.push(C.combine),b.push(C.fogExp2),b.push(C.sizeAttenuation),b.push(C.morphTargetsCount),b.push(C.morphAttributeCount),b.push(C.numDirLights),b.push(C.numPointLights),b.push(C.numSpotLights),b.push(C.numSpotLightMaps),b.push(C.numHemiLights),b.push(C.numRectAreaLights),b.push(C.numDirLightShadows),b.push(C.numPointLightShadows),b.push(C.numSpotLightShadows),b.push(C.numSpotLightShadowsWithMaps),b.push(C.numLightProbes),b.push(C.shadowMapType),b.push(C.toneMapping),b.push(C.numClippingPlanes),b.push(C.numClipIntersection),b.push(C.depthPacking)}function y(b,C){a.disableAll(),C.instancing&&a.enable(0),C.instancingColor&&a.enable(1),C.instancingMorph&&a.enable(2),C.matcap&&a.enable(3),C.envMap&&a.enable(4),C.normalMapObjectSpace&&a.enable(5),C.normalMapTangentSpace&&a.enable(6),C.clearcoat&&a.enable(7),C.iridescence&&a.enable(8),C.alphaTest&&a.enable(9),C.vertexColors&&a.enable(10),C.vertexAlphas&&a.enable(11),C.vertexUv1s&&a.enable(12),C.vertexUv2s&&a.enable(13),C.vertexUv3s&&a.enable(14),C.vertexTangents&&a.enable(15),C.anisotropy&&a.enable(16),C.alphaHash&&a.enable(17),C.batching&&a.enable(18),C.dispersion&&a.enable(19),C.batchingColor&&a.enable(20),C.gradientMap&&a.enable(21),b.push(a.mask),a.disableAll(),C.fog&&a.enable(0),C.useFog&&a.enable(1),C.flatShading&&a.enable(2),C.logarithmicDepthBuffer&&a.enable(3),C.reversedDepthBuffer&&a.enable(4),C.skinning&&a.enable(5),C.morphTargets&&a.enable(6),C.morphNormals&&a.enable(7),C.morphColors&&a.enable(8),C.premultipliedAlpha&&a.enable(9),C.shadowMapEnabled&&a.enable(10),C.doubleSided&&a.enable(11),C.flipSided&&a.enable(12),C.useDepthPacking&&a.enable(13),C.dithering&&a.enable(14),C.transmission&&a.enable(15),C.sheen&&a.enable(16),C.opaque&&a.enable(17),C.pointsUvs&&a.enable(18),C.decodeVideoTexture&&a.enable(19),C.decodeVideoTextureEmissive&&a.enable(20),C.alphaToCoverage&&a.enable(21),b.push(a.mask)}function x(b){const C=g[b.type];let B;if(C){const R=Vn[C];B=Sd.clone(R.uniforms)}else B=b.uniforms;return B}function A(b,C){let B=u.get(C);return B!==void 0?++B.usedTimes:(B=new Cb(r,C,b,s),h.push(B),u.set(C,B)),B}function E(b){if(--b.usedTimes===0){const C=h.indexOf(b);h[C]=h[h.length-1],h.pop(),u.delete(b.cacheKey),b.destroy()}}function I(b){c.remove(b)}function D(){c.dispose()}return{getParameters:m,getProgramCacheKey:p,getUniforms:x,acquireProgram:A,releaseProgram:E,releaseShaderCache:I,programs:h,dispose:D}}function Lb(){let r=new WeakMap;function e(o){return r.has(o)}function t(o){let a=r.get(o);return a===void 0&&(a={},r.set(o,a)),a}function n(o){r.delete(o)}function i(o,a,c){r.get(o)[a]=c}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function Nb(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function wm(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Sm(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(u,f,d,g,_,m){let p=r[e];return p===void 0?(p={id:u.id,object:u,geometry:f,material:d,groupOrder:g,renderOrder:u.renderOrder,z:_,group:m},r[e]=p):(p.id=u.id,p.object=u,p.geometry=f,p.material=d,p.groupOrder=g,p.renderOrder=u.renderOrder,p.z=_,p.group=m),e++,p}function a(u,f,d,g,_,m){const p=o(u,f,d,g,_,m);d.transmission>0?n.push(p):d.transparent===!0?i.push(p):t.push(p)}function c(u,f,d,g,_,m){const p=o(u,f,d,g,_,m);d.transmission>0?n.unshift(p):d.transparent===!0?i.unshift(p):t.unshift(p)}function l(u,f){t.length>1&&t.sort(u||Nb),n.length>1&&n.sort(f||wm),i.length>1&&i.sort(f||wm)}function h(){for(let u=e,f=r.length;u<f;u++){const d=r[u];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:a,unshift:c,finish:h,sort:l}}function Ub(){let r=new WeakMap;function e(n,i){const s=r.get(n);let o;return s===void 0?(o=new Sm,r.set(n,[o])):i>=s.length?(o=new Sm,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function Bb(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new xe};break;case"SpotLight":t={position:new U,direction:new U,color:new xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new xe,groundColor:new xe};break;case"RectAreaLight":t={color:new xe,position:new U,halfWidth:new U,halfHeight:new U};break}return r[e.id]=t,t}}}function Ob(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Fb=0;function zb(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function kb(r){const e=new Bb,t=Ob(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new U);const i=new U,s=new We,o=new We;function a(l){let h=0,u=0,f=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let d=0,g=0,_=0,m=0,p=0,v=0,y=0,x=0,A=0,E=0,I=0;l.sort(zb);for(let b=0,C=l.length;b<C;b++){const B=l[b],R=B.color,O=B.intensity,M=B.distance;let z=null;if(B.shadow&&B.shadow.map&&(B.shadow.map.texture.format===Gi?z=B.shadow.map.texture:z=B.shadow.map.depthTexture||B.shadow.map.texture),B.isAmbientLight)h+=R.r*O,u+=R.g*O,f+=R.b*O;else if(B.isLightProbe){for(let X=0;X<9;X++)n.probe[X].addScaledVector(B.sh.coefficients[X],O);I++}else if(B.isDirectionalLight){const X=e.get(B);if(X.color.copy(B.color).multiplyScalar(B.intensity),B.castShadow){const H=B.shadow,re=t.get(B);re.shadowIntensity=H.intensity,re.shadowBias=H.bias,re.shadowNormalBias=H.normalBias,re.shadowRadius=H.radius,re.shadowMapSize=H.mapSize,n.directionalShadow[d]=re,n.directionalShadowMap[d]=z,n.directionalShadowMatrix[d]=B.shadow.matrix,v++}n.directional[d]=X,d++}else if(B.isSpotLight){const X=e.get(B);X.position.setFromMatrixPosition(B.matrixWorld),X.color.copy(R).multiplyScalar(O),X.distance=M,X.coneCos=Math.cos(B.angle),X.penumbraCos=Math.cos(B.angle*(1-B.penumbra)),X.decay=B.decay,n.spot[_]=X;const H=B.shadow;if(B.map&&(n.spotLightMap[A]=B.map,A++,H.updateMatrices(B),B.castShadow&&E++),n.spotLightMatrix[_]=H.matrix,B.castShadow){const re=t.get(B);re.shadowIntensity=H.intensity,re.shadowBias=H.bias,re.shadowNormalBias=H.normalBias,re.shadowRadius=H.radius,re.shadowMapSize=H.mapSize,n.spotShadow[_]=re,n.spotShadowMap[_]=z,x++}_++}else if(B.isRectAreaLight){const X=e.get(B);X.color.copy(R).multiplyScalar(O),X.halfWidth.set(B.width*.5,0,0),X.halfHeight.set(0,B.height*.5,0),n.rectArea[m]=X,m++}else if(B.isPointLight){const X=e.get(B);if(X.color.copy(B.color).multiplyScalar(B.intensity),X.distance=B.distance,X.decay=B.decay,B.castShadow){const H=B.shadow,re=t.get(B);re.shadowIntensity=H.intensity,re.shadowBias=H.bias,re.shadowNormalBias=H.normalBias,re.shadowRadius=H.radius,re.shadowMapSize=H.mapSize,re.shadowCameraNear=H.camera.near,re.shadowCameraFar=H.camera.far,n.pointShadow[g]=re,n.pointShadowMap[g]=z,n.pointShadowMatrix[g]=B.shadow.matrix,y++}n.point[g]=X,g++}else if(B.isHemisphereLight){const X=e.get(B);X.skyColor.copy(B.color).multiplyScalar(O),X.groundColor.copy(B.groundColor).multiplyScalar(O),n.hemi[p]=X,p++}}m>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ce.LTC_FLOAT_1,n.rectAreaLTC2=Ce.LTC_FLOAT_2):(n.rectAreaLTC1=Ce.LTC_HALF_1,n.rectAreaLTC2=Ce.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=f;const D=n.hash;(D.directionalLength!==d||D.pointLength!==g||D.spotLength!==_||D.rectAreaLength!==m||D.hemiLength!==p||D.numDirectionalShadows!==v||D.numPointShadows!==y||D.numSpotShadows!==x||D.numSpotMaps!==A||D.numLightProbes!==I)&&(n.directional.length=d,n.spot.length=_,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=y,n.spotLightMatrix.length=x+A-E,n.spotLightMap.length=A,n.numSpotLightShadowsWithMaps=E,n.numLightProbes=I,D.directionalLength=d,D.pointLength=g,D.spotLength=_,D.rectAreaLength=m,D.hemiLength=p,D.numDirectionalShadows=v,D.numPointShadows=y,D.numSpotShadows=x,D.numSpotMaps=A,D.numLightProbes=I,n.version=Fb++)}function c(l,h){let u=0,f=0,d=0,g=0,_=0;const m=h.matrixWorldInverse;for(let p=0,v=l.length;p<v;p++){const y=l[p];if(y.isDirectionalLight){const x=n.directional[u];x.direction.setFromMatrixPosition(y.matrixWorld),i.setFromMatrixPosition(y.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(m),u++}else if(y.isSpotLight){const x=n.spot[d];x.position.setFromMatrixPosition(y.matrixWorld),x.position.applyMatrix4(m),x.direction.setFromMatrixPosition(y.matrixWorld),i.setFromMatrixPosition(y.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(m),d++}else if(y.isRectAreaLight){const x=n.rectArea[g];x.position.setFromMatrixPosition(y.matrixWorld),x.position.applyMatrix4(m),o.identity(),s.copy(y.matrixWorld),s.premultiply(m),o.extractRotation(s),x.halfWidth.set(y.width*.5,0,0),x.halfHeight.set(0,y.height*.5,0),x.halfWidth.applyMatrix4(o),x.halfHeight.applyMatrix4(o),g++}else if(y.isPointLight){const x=n.point[f];x.position.setFromMatrixPosition(y.matrixWorld),x.position.applyMatrix4(m),f++}else if(y.isHemisphereLight){const x=n.hemi[_];x.direction.setFromMatrixPosition(y.matrixWorld),x.direction.transformDirection(m),_++}}}return{setup:a,setupView:c,state:n}}function Mm(r){const e=new kb(r),t=[],n=[];function i(h){l.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function o(h){n.push(h)}function a(){e.setup(t)}function c(h){e.setupView(t,h)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:l,setupLights:a,setupLightsView:c,pushLight:s,pushShadow:o}}function Vb(r){let e=new WeakMap;function t(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new Mm(r),e.set(i,[a])):s>=o.length?(a=new Mm(r),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}const Hb=`void main() {
3969
3969
  gl_Position = vec4( position, 1.0 );
3970
3970
  }`,Gb=`uniform sampler2D shadow_pass;
3971
3971
  uniform vec2 resolution;
@@ -3992,7 +3992,7 @@ void main() {
3992
3992
  squared_mean = squared_mean / samples;
3993
3993
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
3994
3994
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
3995
- }`,Wb=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],qb=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],Em=new We,xo=new U,Ou=new U;function Xb(r,e,t){let n=new fs;const i=new he,s=new he,o=new gt,a=new nu,c=new iu,l={},h=t.maxTextureSize,u={[Wn]:en,[en]:Wn,[Sn]:Sn},f=new Cn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new he},radius:{value:4}},vertexShader:Hb,fragmentShader:Gb}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const g=new Ke;g.setAttribute("position",new ot(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new St(g,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ls;let p=this.type;this.render=function(E,I,D){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||E.length===0)return;E.type===bf&&(Te("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),E.type=Ls);const b=r.getRenderTarget(),C=r.getActiveCubeFace(),B=r.getActiveMipmapLevel(),R=r.state;R.setBlending(qn),R.buffers.depth.getReversed()===!0?R.buffers.color.setClear(0,0,0,0):R.buffers.color.setClear(1,1,1,1),R.buffers.depth.setTest(!0),R.setScissorTest(!1);const O=p!==this.type;O&&I.traverse(function(M){M.material&&(Array.isArray(M.material)?M.material.forEach(z=>z.needsUpdate=!0):M.material.needsUpdate=!0)});for(let M=0,z=E.length;M<z;M++){const X=E[M],H=X.shadow;if(H===void 0){Te("WebGLShadowMap:",X,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;i.copy(H.mapSize);const re=H.getFrameExtents();if(i.multiply(re),s.copy(H.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/re.x),i.x=s.x*re.x,H.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/re.y),i.y=s.y*re.y,H.mapSize.y=s.y)),H.map===null||O===!0){if(H.map!==null&&(H.map.depthTexture!==null&&(H.map.depthTexture.dispose(),H.map.depthTexture=null),H.map.dispose()),this.type===Dr){if(X.isPointLight){Te("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}H.map=new vn(i.x,i.y,{format:Gi,type:Zn,minFilter:pt,magFilter:pt,generateMipmaps:!1}),H.map.texture.name=X.name+".shadowMap",H.map.depthTexture=new ds(i.x,i.y,nn),H.map.depthTexture.name=X.name+".shadowMapDepth",H.map.depthTexture.format=Yn,H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=Mt,H.map.depthTexture.magFilter=Mt}else{X.isPointLight?(H.map=new Th(i.x),H.map.depthTexture=new Jd(i.x,En)):(H.map=new vn(i.x,i.y),H.map.depthTexture=new ds(i.x,i.y,En)),H.map.depthTexture.name=X.name+".shadowMap",H.map.depthTexture.format=Yn;const le=r.state.buffers.depth.getReversed();this.type===Ls?(H.map.depthTexture.compareFunction=le?za:Fa,H.map.depthTexture.minFilter=pt,H.map.depthTexture.magFilter=pt):(H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=Mt,H.map.depthTexture.magFilter=Mt)}H.camera.updateProjectionMatrix()}const $=H.map.isWebGLCubeRenderTarget?6:1;for(let le=0;le<$;le++){if(H.map.isWebGLCubeRenderTarget)r.setRenderTarget(H.map,le),r.clear();else{le===0&&(r.setRenderTarget(H.map),r.clear());const W=H.getViewport(le);o.set(s.x*W.x,s.y*W.y,s.x*W.z,s.y*W.w),R.viewport(o)}if(X.isPointLight){const W=H.camera,Z=H.matrix,ge=X.distance||W.far;ge!==W.far&&(W.far=ge,W.updateProjectionMatrix()),xo.setFromMatrixPosition(X.matrixWorld),W.position.copy(xo),Ou.copy(W.position),Ou.add(Wb[le]),W.up.copy(qb[le]),W.lookAt(Ou),W.updateMatrixWorld(),Z.makeTranslation(-xo.x,-xo.y,-xo.z),Em.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),H._frustum.setFromProjectionMatrix(Em,W.coordinateSystem,W.reversedDepth)}else H.updateMatrices(X);n=H.getFrustum(),x(I,D,H.camera,X,this.type)}H.isPointLightShadow!==!0&&this.type===Dr&&v(H,D),H.needsUpdate=!1}p=this.type,m.needsUpdate=!1,r.setRenderTarget(b,C,B)};function v(E,I){const D=e.update(_);f.defines.VSM_SAMPLES!==E.blurSamples&&(f.defines.VSM_SAMPLES=E.blurSamples,d.defines.VSM_SAMPLES=E.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),E.mapPass===null&&(E.mapPass=new vn(i.x,i.y,{format:Gi,type:Zn})),f.uniforms.shadow_pass.value=E.map.depthTexture,f.uniforms.resolution.value=E.mapSize,f.uniforms.radius.value=E.radius,r.setRenderTarget(E.mapPass),r.clear(),r.renderBufferDirect(I,null,D,f,_,null),d.uniforms.shadow_pass.value=E.mapPass.texture,d.uniforms.resolution.value=E.mapSize,d.uniforms.radius.value=E.radius,r.setRenderTarget(E.map),r.clear(),r.renderBufferDirect(I,null,D,d,_,null)}function y(E,I,D,b){let C=null;const B=D.isPointLight===!0?E.customDistanceMaterial:E.customDepthMaterial;if(B!==void 0)C=B;else if(C=D.isPointLight===!0?c:a,r.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0||I.alphaToCoverage===!0){const R=C.uuid,O=I.uuid;let M=l[R];M===void 0&&(M={},l[R]=M);let z=M[O];z===void 0&&(z=C.clone(),M[O]=z,I.addEventListener("dispose",A)),C=z}if(C.visible=I.visible,C.wireframe=I.wireframe,b===Dr?C.side=I.shadowSide!==null?I.shadowSide:I.side:C.side=I.shadowSide!==null?I.shadowSide:u[I.side],C.alphaMap=I.alphaMap,C.alphaTest=I.alphaToCoverage===!0?.5:I.alphaTest,C.map=I.map,C.clipShadows=I.clipShadows,C.clippingPlanes=I.clippingPlanes,C.clipIntersection=I.clipIntersection,C.displacementMap=I.displacementMap,C.displacementScale=I.displacementScale,C.displacementBias=I.displacementBias,C.wireframeLinewidth=I.wireframeLinewidth,C.linewidth=I.linewidth,D.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const R=r.properties.get(C);R.light=D}return C}function x(E,I,D,b,C){if(E.visible===!1)return;if(E.layers.test(I.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&C===Dr)&&(!E.frustumCulled||n.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,E.matrixWorld);const O=e.update(E),M=E.material;if(Array.isArray(M)){const z=O.groups;for(let X=0,H=z.length;X<H;X++){const re=z[X],$=M[re.materialIndex];if($&&$.visible){const le=y(E,$,b,C);E.onBeforeShadow(r,E,I,D,O,le,re),r.renderBufferDirect(D,null,O,le,E,re),E.onAfterShadow(r,E,I,D,O,le,re)}}}else if(M.visible){const z=y(E,M,b,C);E.onBeforeShadow(r,E,I,D,O,z,null),r.renderBufferDirect(D,null,O,z,E,null),E.onAfterShadow(r,E,I,D,O,z,null)}}const R=E.children;for(let O=0,M=R.length;O<M;O++)x(R[O],I,D,b,C)}function A(E){E.target.removeEventListener("dispose",A);for(const D in l){const b=l[D],C=E.target.uuid;C in b&&(b[C].dispose(),delete b[C])}}}const Zb={[Vo]:Ho,[Go]:Xo,[Wo]:Zo,[Vi]:qo,[Ho]:Vo,[Xo]:Go,[Zo]:Wo,[qo]:Vi};function Yb(r,e){function t(){let Y=!1;const Pe=new gt;let be=null;const De=new gt(0,0,0,0);return{setMask:function(ve){be!==ve&&!Y&&(r.colorMask(ve,ve,ve,ve),be=ve)},setLocked:function(ve){Y=ve},setClear:function(ve,me,Ee,$e,vt){vt===!0&&(ve*=$e,me*=$e,Ee*=$e),Pe.set(ve,me,Ee,$e),De.equals(Pe)===!1&&(r.clearColor(ve,me,Ee,$e),De.copy(Pe))},reset:function(){Y=!1,be=null,De.set(-1,0,0,0)}}}function n(){let Y=!1,Pe=!1,be=null,De=null,ve=null;return{setReversed:function(me){if(Pe!==me){const Ee=e.get("EXT_clip_control");me?Ee.clipControlEXT(Ee.LOWER_LEFT_EXT,Ee.ZERO_TO_ONE_EXT):Ee.clipControlEXT(Ee.LOWER_LEFT_EXT,Ee.NEGATIVE_ONE_TO_ONE_EXT),Pe=me;const $e=ve;ve=null,this.setClear($e)}},getReversed:function(){return Pe},setTest:function(me){me?ee(r.DEPTH_TEST):pe(r.DEPTH_TEST)},setMask:function(me){be!==me&&!Y&&(r.depthMask(me),be=me)},setFunc:function(me){if(Pe&&(me=Zb[me]),De!==me){switch(me){case Vo:r.depthFunc(r.NEVER);break;case Ho:r.depthFunc(r.ALWAYS);break;case Go:r.depthFunc(r.LESS);break;case Vi:r.depthFunc(r.LEQUAL);break;case Wo:r.depthFunc(r.EQUAL);break;case qo:r.depthFunc(r.GEQUAL);break;case Xo:r.depthFunc(r.GREATER);break;case Zo:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}De=me}},setLocked:function(me){Y=me},setClear:function(me){ve!==me&&(Pe&&(me=1-me),r.clearDepth(me),ve=me)},reset:function(){Y=!1,be=null,De=null,ve=null,Pe=!1}}}function i(){let Y=!1,Pe=null,be=null,De=null,ve=null,me=null,Ee=null,$e=null,vt=null;return{setTest:function(ft){Y||(ft?ee(r.STENCIL_TEST):pe(r.STENCIL_TEST))},setMask:function(ft){Pe!==ft&&!Y&&(r.stencilMask(ft),Pe=ft)},setFunc:function(ft,ii,gi){(be!==ft||De!==ii||ve!==gi)&&(r.stencilFunc(ft,ii,gi),be=ft,De=ii,ve=gi)},setOp:function(ft,ii,gi){(me!==ft||Ee!==ii||$e!==gi)&&(r.stencilOp(ft,ii,gi),me=ft,Ee=ii,$e=gi)},setLocked:function(ft){Y=ft},setClear:function(ft){vt!==ft&&(r.clearStencil(ft),vt=ft)},reset:function(){Y=!1,Pe=null,be=null,De=null,ve=null,me=null,Ee=null,$e=null,vt=null}}}const s=new t,o=new n,a=new i,c=new WeakMap,l=new WeakMap;let h={},u={},f=new WeakMap,d=[],g=null,_=!1,m=null,p=null,v=null,y=null,x=null,A=null,E=null,I=new xe(0,0,0),D=0,b=!1,C=null,B=null,R=null,O=null,M=null;const z=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,H=0;const re=r.getParameter(r.VERSION);re.indexOf("WebGL")!==-1?(H=parseFloat(/^WebGL (\d)/.exec(re)[1]),X=H>=1):re.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(re)[1]),X=H>=2);let $=null,le={};const W=r.getParameter(r.SCISSOR_BOX),Z=r.getParameter(r.VIEWPORT),ge=new gt().fromArray(W),_e=new gt().fromArray(Z);function de(Y,Pe,be,De){const ve=new Uint8Array(4),me=r.createTexture();r.bindTexture(Y,me),r.texParameteri(Y,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(Y,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Ee=0;Ee<be;Ee++)Y===r.TEXTURE_3D||Y===r.TEXTURE_2D_ARRAY?r.texImage3D(Pe,0,r.RGBA,1,1,De,0,r.RGBA,r.UNSIGNED_BYTE,ve):r.texImage2D(Pe+Ee,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ve);return me}const oe={};oe[r.TEXTURE_2D]=de(r.TEXTURE_2D,r.TEXTURE_2D,1),oe[r.TEXTURE_CUBE_MAP]=de(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),oe[r.TEXTURE_2D_ARRAY]=de(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),oe[r.TEXTURE_3D]=de(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),ee(r.DEPTH_TEST),o.setFunc(Vi),k(!1),N(Bl),ee(r.CULL_FACE),w(qn);function ee(Y){h[Y]!==!0&&(r.enable(Y),h[Y]=!0)}function pe(Y){h[Y]!==!1&&(r.disable(Y),h[Y]=!1)}function ye(Y,Pe){return u[Y]!==Pe?(r.bindFramebuffer(Y,Pe),u[Y]=Pe,Y===r.DRAW_FRAMEBUFFER&&(u[r.FRAMEBUFFER]=Pe),Y===r.FRAMEBUFFER&&(u[r.DRAW_FRAMEBUFFER]=Pe),!0):!1}function Ae(Y,Pe){let be=d,De=!1;if(Y){be=f.get(Pe),be===void 0&&(be=[],f.set(Pe,be));const ve=Y.textures;if(be.length!==ve.length||be[0]!==r.COLOR_ATTACHMENT0){for(let me=0,Ee=ve.length;me<Ee;me++)be[me]=r.COLOR_ATTACHMENT0+me;be.length=ve.length,De=!0}}else be[0]!==r.BACK&&(be[0]=r.BACK,De=!0);De&&r.drawBuffers(be)}function ze(Y){return g!==Y?(r.useProgram(Y),g=Y,!0):!1}const je={[_i]:r.FUNC_ADD,[Sf]:r.FUNC_SUBTRACT,[Mf]:r.FUNC_REVERSE_SUBTRACT};je[Ef]=r.MIN,je[Tf]=r.MAX;const He={[Cf]:r.ZERO,[If]:r.ONE,[Rf]:r.SRC_COLOR,[zo]:r.SRC_ALPHA,[Bf]:r.SRC_ALPHA_SATURATE,[Nf]:r.DST_COLOR,[Df]:r.DST_ALPHA,[Pf]:r.ONE_MINUS_SRC_COLOR,[ko]:r.ONE_MINUS_SRC_ALPHA,[Uf]:r.ONE_MINUS_DST_COLOR,[Lf]:r.ONE_MINUS_DST_ALPHA,[Of]:r.CONSTANT_COLOR,[Ff]:r.ONE_MINUS_CONSTANT_COLOR,[zf]:r.CONSTANT_ALPHA,[kf]:r.ONE_MINUS_CONSTANT_ALPHA};function w(Y,Pe,be,De,ve,me,Ee,$e,vt,ft){if(Y===qn){_===!0&&(pe(r.BLEND),_=!1);return}if(_===!1&&(ee(r.BLEND),_=!0),Y!==wf){if(Y!==m||ft!==b){if((p!==_i||x!==_i)&&(r.blendEquation(r.FUNC_ADD),p=_i,x=_i),ft)switch(Y){case ki:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ol:r.blendFunc(r.ONE,r.ONE);break;case Fl:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case zl:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:Ge("WebGLState: Invalid blending: ",Y);break}else switch(Y){case ki:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ol:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Fl:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case zl:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",Y);break}v=null,y=null,A=null,E=null,I.set(0,0,0),D=0,m=Y,b=ft}return}ve=ve||Pe,me=me||be,Ee=Ee||De,(Pe!==p||ve!==x)&&(r.blendEquationSeparate(je[Pe],je[ve]),p=Pe,x=ve),(be!==v||De!==y||me!==A||Ee!==E)&&(r.blendFuncSeparate(He[be],He[De],He[me],He[Ee]),v=be,y=De,A=me,E=Ee),($e.equals(I)===!1||vt!==D)&&(r.blendColor($e.r,$e.g,$e.b,vt),I.copy($e),D=vt),m=Y,b=!1}function q(Y,Pe){Y.side===Sn?pe(r.CULL_FACE):ee(r.CULL_FACE);let be=Y.side===en;Pe&&(be=!be),k(be),Y.blending===ki&&Y.transparent===!1?w(qn):w(Y.blending,Y.blendEquation,Y.blendSrc,Y.blendDst,Y.blendEquationAlpha,Y.blendSrcAlpha,Y.blendDstAlpha,Y.blendColor,Y.blendAlpha,Y.premultipliedAlpha),o.setFunc(Y.depthFunc),o.setTest(Y.depthTest),o.setMask(Y.depthWrite),s.setMask(Y.colorWrite);const De=Y.stencilWrite;a.setTest(De),De&&(a.setMask(Y.stencilWriteMask),a.setFunc(Y.stencilFunc,Y.stencilRef,Y.stencilFuncMask),a.setOp(Y.stencilFail,Y.stencilZFail,Y.stencilZPass)),G(Y.polygonOffset,Y.polygonOffsetFactor,Y.polygonOffsetUnits),Y.alphaToCoverage===!0?ee(r.SAMPLE_ALPHA_TO_COVERAGE):pe(r.SAMPLE_ALPHA_TO_COVERAGE)}function k(Y){C!==Y&&(Y?r.frontFace(r.CW):r.frontFace(r.CCW),C=Y)}function N(Y){Y!==xf?(ee(r.CULL_FACE),Y!==B&&(Y===Bl?r.cullFace(r.BACK):Y===Af?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):pe(r.CULL_FACE),B=Y}function S(Y){Y!==R&&(X&&r.lineWidth(Y),R=Y)}function G(Y,Pe,be){Y?(ee(r.POLYGON_OFFSET_FILL),(O!==Pe||M!==be)&&(r.polygonOffset(Pe,be),O=Pe,M=be)):pe(r.POLYGON_OFFSET_FILL)}function K(Y){Y?ee(r.SCISSOR_TEST):pe(r.SCISSOR_TEST)}function ie(Y){Y===void 0&&(Y=r.TEXTURE0+z-1),$!==Y&&(r.activeTexture(Y),$=Y)}function V(Y,Pe,be){be===void 0&&($===null?be=r.TEXTURE0+z-1:be=$);let De=le[be];De===void 0&&(De={type:void 0,texture:void 0},le[be]=De),(De.type!==Y||De.texture!==Pe)&&($!==be&&(r.activeTexture(be),$=be),r.bindTexture(Y,Pe||oe[Y]),De.type=Y,De.texture=Pe)}function P(){const Y=le[$];Y!==void 0&&Y.type!==void 0&&(r.bindTexture(Y.type,null),Y.type=void 0,Y.texture=void 0)}function T(){try{r.compressedTexImage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function F(){try{r.compressedTexImage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Q(){try{r.texSubImage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function ce(){try{r.texSubImage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function te(){try{r.compressedTexSubImage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Re(){try{r.compressedTexSubImage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function we(){try{r.texStorage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Le(){try{r.texStorage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Xe(){try{r.texImage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function fe(){try{r.texImage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Se(Y){ge.equals(Y)===!1&&(r.scissor(Y.x,Y.y,Y.z,Y.w),ge.copy(Y))}function Oe(Y){_e.equals(Y)===!1&&(r.viewport(Y.x,Y.y,Y.z,Y.w),_e.copy(Y))}function Ue(Y,Pe){let be=l.get(Pe);be===void 0&&(be=new WeakMap,l.set(Pe,be));let De=be.get(Y);De===void 0&&(De=r.getUniformBlockIndex(Pe,Y.name),be.set(Y,De))}function Me(Y,Pe){const De=l.get(Pe).get(Y);c.get(Pe)!==De&&(r.uniformBlockBinding(Pe,De,Y.__bindingPointIndex),c.set(Pe,De))}function it(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),o.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},$=null,le={},u={},f=new WeakMap,d=[],g=null,_=!1,m=null,p=null,v=null,y=null,x=null,A=null,E=null,I=new xe(0,0,0),D=0,b=!1,C=null,B=null,R=null,O=null,M=null,ge.set(0,0,r.canvas.width,r.canvas.height),_e.set(0,0,r.canvas.width,r.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:ee,disable:pe,bindFramebuffer:ye,drawBuffers:Ae,useProgram:ze,setBlending:w,setMaterial:q,setFlipSided:k,setCullFace:N,setLineWidth:S,setPolygonOffset:G,setScissorTest:K,activeTexture:ie,bindTexture:V,unbindTexture:P,compressedTexImage2D:T,compressedTexImage3D:F,texImage2D:Xe,texImage3D:fe,updateUBOMapping:Ue,uniformBlockBinding:Me,texStorage2D:we,texStorage3D:Le,texSubImage2D:Q,texSubImage3D:ce,compressedTexSubImage2D:te,compressedTexSubImage3D:Re,scissor:Se,viewport:Oe,reset:it}}function Qb(r,e,t,n,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new he,h=new WeakMap;let u;const f=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(P,T){return d?new OffscreenCanvas(P,T):Ws("canvas")}function _(P,T,F){let Q=1;const ce=V(P);if((ce.width>F||ce.height>F)&&(Q=F/Math.max(ce.width,ce.height)),Q<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 te=Math.floor(Q*ce.width),Re=Math.floor(Q*ce.height);u===void 0&&(u=g(te,Re));const we=T?g(te,Re):u;return we.width=te,we.height=Re,we.getContext("2d").drawImage(P,0,0,te,Re),Te("WebGLRenderer: Texture has been resized from ("+ce.width+"x"+ce.height+") to ("+te+"x"+Re+")."),we}else return"data"in P&&Te("WebGLRenderer: Image in DataTexture is too big ("+ce.width+"x"+ce.height+")."),P;return P}function m(P){return P.generateMipmaps}function p(P){r.generateMipmap(P)}function v(P){return P.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:P.isWebGL3DRenderTarget?r.TEXTURE_3D:P.isWebGLArrayRenderTarget||P.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function y(P,T,F,Q,ce=!1){if(P!==null){if(r[P]!==void 0)return r[P];Te("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let te=T;if(T===r.RED&&(F===r.FLOAT&&(te=r.R32F),F===r.HALF_FLOAT&&(te=r.R16F),F===r.UNSIGNED_BYTE&&(te=r.R8)),T===r.RED_INTEGER&&(F===r.UNSIGNED_BYTE&&(te=r.R8UI),F===r.UNSIGNED_SHORT&&(te=r.R16UI),F===r.UNSIGNED_INT&&(te=r.R32UI),F===r.BYTE&&(te=r.R8I),F===r.SHORT&&(te=r.R16I),F===r.INT&&(te=r.R32I)),T===r.RG&&(F===r.FLOAT&&(te=r.RG32F),F===r.HALF_FLOAT&&(te=r.RG16F),F===r.UNSIGNED_BYTE&&(te=r.RG8)),T===r.RG_INTEGER&&(F===r.UNSIGNED_BYTE&&(te=r.RG8UI),F===r.UNSIGNED_SHORT&&(te=r.RG16UI),F===r.UNSIGNED_INT&&(te=r.RG32UI),F===r.BYTE&&(te=r.RG8I),F===r.SHORT&&(te=r.RG16I),F===r.INT&&(te=r.RG32I)),T===r.RGB_INTEGER&&(F===r.UNSIGNED_BYTE&&(te=r.RGB8UI),F===r.UNSIGNED_SHORT&&(te=r.RGB16UI),F===r.UNSIGNED_INT&&(te=r.RGB32UI),F===r.BYTE&&(te=r.RGB8I),F===r.SHORT&&(te=r.RGB16I),F===r.INT&&(te=r.RGB32I)),T===r.RGBA_INTEGER&&(F===r.UNSIGNED_BYTE&&(te=r.RGBA8UI),F===r.UNSIGNED_SHORT&&(te=r.RGBA16UI),F===r.UNSIGNED_INT&&(te=r.RGBA32UI),F===r.BYTE&&(te=r.RGBA8I),F===r.SHORT&&(te=r.RGBA16I),F===r.INT&&(te=r.RGBA32I)),T===r.RGB&&(F===r.UNSIGNED_INT_5_9_9_9_REV&&(te=r.RGB9_E5),F===r.UNSIGNED_INT_10F_11F_11F_REV&&(te=r.R11F_G11F_B10F)),T===r.RGBA){const Re=ce?Gs:rt.getTransfer(Q);F===r.FLOAT&&(te=r.RGBA32F),F===r.HALF_FLOAT&&(te=r.RGBA16F),F===r.UNSIGNED_BYTE&&(te=Re===ut?r.SRGB8_ALPHA8:r.RGBA8),F===r.UNSIGNED_SHORT_4_4_4_4&&(te=r.RGBA4),F===r.UNSIGNED_SHORT_5_5_5_1&&(te=r.RGB5_A1)}return(te===r.R16F||te===r.R32F||te===r.RG16F||te===r.RG32F||te===r.RGBA16F||te===r.RGBA32F)&&e.get("EXT_color_buffer_float"),te}function x(P,T){let F;return P?T===null||T===En||T===Or?F=r.DEPTH24_STENCIL8:T===nn?F=r.DEPTH32F_STENCIL8:T===Br&&(F=r.DEPTH24_STENCIL8,Te("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):T===null||T===En||T===Or?F=r.DEPTH_COMPONENT24:T===nn?F=r.DEPTH_COMPONENT32F:T===Br&&(F=r.DEPTH_COMPONENT16),F}function A(P,T){return m(P)===!0||P.isFramebufferTexture&&P.minFilter!==Mt&&P.minFilter!==pt?Math.log2(Math.max(T.width,T.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?T.mipmaps.length:1}function E(P){const T=P.target;T.removeEventListener("dispose",E),D(T),T.isVideoTexture&&h.delete(T)}function I(P){const T=P.target;T.removeEventListener("dispose",I),C(T)}function D(P){const T=n.get(P);if(T.__webglInit===void 0)return;const F=P.source,Q=f.get(F);if(Q){const ce=Q[T.__cacheKey];ce.usedTimes--,ce.usedTimes===0&&b(P),Object.keys(Q).length===0&&f.delete(F)}n.remove(P)}function b(P){const T=n.get(P);r.deleteTexture(T.__webglTexture);const F=P.source,Q=f.get(F);delete Q[T.__cacheKey],o.memory.textures--}function C(P){const T=n.get(P);if(P.depthTexture&&(P.depthTexture.dispose(),n.remove(P.depthTexture)),P.isWebGLCubeRenderTarget)for(let Q=0;Q<6;Q++){if(Array.isArray(T.__webglFramebuffer[Q]))for(let ce=0;ce<T.__webglFramebuffer[Q].length;ce++)r.deleteFramebuffer(T.__webglFramebuffer[Q][ce]);else r.deleteFramebuffer(T.__webglFramebuffer[Q]);T.__webglDepthbuffer&&r.deleteRenderbuffer(T.__webglDepthbuffer[Q])}else{if(Array.isArray(T.__webglFramebuffer))for(let Q=0;Q<T.__webglFramebuffer.length;Q++)r.deleteFramebuffer(T.__webglFramebuffer[Q]);else r.deleteFramebuffer(T.__webglFramebuffer);if(T.__webglDepthbuffer&&r.deleteRenderbuffer(T.__webglDepthbuffer),T.__webglMultisampledFramebuffer&&r.deleteFramebuffer(T.__webglMultisampledFramebuffer),T.__webglColorRenderbuffer)for(let Q=0;Q<T.__webglColorRenderbuffer.length;Q++)T.__webglColorRenderbuffer[Q]&&r.deleteRenderbuffer(T.__webglColorRenderbuffer[Q]);T.__webglDepthRenderbuffer&&r.deleteRenderbuffer(T.__webglDepthRenderbuffer)}const F=P.textures;for(let Q=0,ce=F.length;Q<ce;Q++){const te=n.get(F[Q]);te.__webglTexture&&(r.deleteTexture(te.__webglTexture),o.memory.textures--),n.remove(F[Q])}n.remove(P)}let B=0;function R(){B=0}function O(){const P=B;return P>=i.maxTextures&&Te("WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+i.maxTextures),B+=1,P}function M(P){const T=[];return T.push(P.wrapS),T.push(P.wrapT),T.push(P.wrapR||0),T.push(P.magFilter),T.push(P.minFilter),T.push(P.anisotropy),T.push(P.internalFormat),T.push(P.format),T.push(P.type),T.push(P.generateMipmaps),T.push(P.premultiplyAlpha),T.push(P.flipY),T.push(P.unpackAlignment),T.push(P.colorSpace),T.join()}function z(P,T){const F=n.get(P);if(P.isVideoTexture&&K(P),P.isRenderTargetTexture===!1&&P.isExternalTexture!==!0&&P.version>0&&F.__version!==P.version){const Q=P.image;if(Q===null)Te("WebGLRenderer: Texture marked for update but no image data found.");else if(Q.complete===!1)Te("WebGLRenderer: Texture marked for update but image is incomplete");else{oe(F,P,T);return}}else P.isExternalTexture&&(F.__webglTexture=P.sourceTexture?P.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,F.__webglTexture,r.TEXTURE0+T)}function X(P,T){const F=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&F.__version!==P.version){oe(F,P,T);return}else P.isExternalTexture&&(F.__webglTexture=P.sourceTexture?P.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,F.__webglTexture,r.TEXTURE0+T)}function H(P,T){const F=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&F.__version!==P.version){oe(F,P,T);return}t.bindTexture(r.TEXTURE_3D,F.__webglTexture,r.TEXTURE0+T)}function re(P,T){const F=n.get(P);if(P.isCubeDepthTexture!==!0&&P.version>0&&F.__version!==P.version){ee(F,P,T);return}t.bindTexture(r.TEXTURE_CUBE_MAP,F.__webglTexture,r.TEXTURE0+T)}const $={[yi]:r.REPEAT,[tn]:r.CLAMP_TO_EDGE,[Nr]:r.MIRRORED_REPEAT},le={[Mt]:r.NEAREST,[Ko]:r.NEAREST_MIPMAP_NEAREST,[Hi]:r.NEAREST_MIPMAP_LINEAR,[pt]:r.LINEAR,[Ur]:r.LINEAR_MIPMAP_NEAREST,[Mn]:r.LINEAR_MIPMAP_LINEAR},W={[Kf]:r.NEVER,[td]:r.ALWAYS,[jf]:r.LESS,[Fa]:r.LEQUAL,[Jf]:r.EQUAL,[za]:r.GEQUAL,[$f]:r.GREATER,[ed]:r.NOTEQUAL};function Z(P,T){if(T.type===nn&&e.has("OES_texture_float_linear")===!1&&(T.magFilter===pt||T.magFilter===Ur||T.magFilter===Hi||T.magFilter===Mn||T.minFilter===pt||T.minFilter===Ur||T.minFilter===Hi||T.minFilter===Mn)&&Te("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(P,r.TEXTURE_WRAP_S,$[T.wrapS]),r.texParameteri(P,r.TEXTURE_WRAP_T,$[T.wrapT]),(P===r.TEXTURE_3D||P===r.TEXTURE_2D_ARRAY)&&r.texParameteri(P,r.TEXTURE_WRAP_R,$[T.wrapR]),r.texParameteri(P,r.TEXTURE_MAG_FILTER,le[T.magFilter]),r.texParameteri(P,r.TEXTURE_MIN_FILTER,le[T.minFilter]),T.compareFunction&&(r.texParameteri(P,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(P,r.TEXTURE_COMPARE_FUNC,W[T.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(T.magFilter===Mt||T.minFilter!==Hi&&T.minFilter!==Mn||T.type===nn&&e.has("OES_texture_float_linear")===!1)return;if(T.anisotropy>1||n.get(T).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");r.texParameterf(P,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(T.anisotropy,i.getMaxAnisotropy())),n.get(T).__currentAnisotropy=T.anisotropy}}}function ge(P,T){let F=!1;P.__webglInit===void 0&&(P.__webglInit=!0,T.addEventListener("dispose",E));const Q=T.source;let ce=f.get(Q);ce===void 0&&(ce={},f.set(Q,ce));const te=M(T);if(te!==P.__cacheKey){ce[te]===void 0&&(ce[te]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,F=!0),ce[te].usedTimes++;const Re=ce[P.__cacheKey];Re!==void 0&&(ce[P.__cacheKey].usedTimes--,Re.usedTimes===0&&b(T)),P.__cacheKey=te,P.__webglTexture=ce[te].texture}return F}function _e(P,T,F){return Math.floor(Math.floor(P/F)/T)}function de(P,T,F,Q){const te=P.updateRanges;if(te.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,T.width,T.height,F,Q,T.data);else{te.sort((fe,Se)=>fe.start-Se.start);let Re=0;for(let fe=1;fe<te.length;fe++){const Se=te[Re],Oe=te[fe],Ue=Se.start+Se.count,Me=_e(Oe.start,T.width,4),it=_e(Se.start,T.width,4);Oe.start<=Ue+1&&Me===it&&_e(Oe.start+Oe.count-1,T.width,4)===Me?Se.count=Math.max(Se.count,Oe.start+Oe.count-Se.start):(++Re,te[Re]=Oe)}te.length=Re+1;const we=r.getParameter(r.UNPACK_ROW_LENGTH),Le=r.getParameter(r.UNPACK_SKIP_PIXELS),Xe=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,T.width);for(let fe=0,Se=te.length;fe<Se;fe++){const Oe=te[fe],Ue=Math.floor(Oe.start/4),Me=Math.ceil(Oe.count/4),it=Ue%T.width,Y=Math.floor(Ue/T.width),Pe=Me,be=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,it),r.pixelStorei(r.UNPACK_SKIP_ROWS,Y),t.texSubImage2D(r.TEXTURE_2D,0,it,Y,Pe,be,F,Q,T.data)}P.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,we),r.pixelStorei(r.UNPACK_SKIP_PIXELS,Le),r.pixelStorei(r.UNPACK_SKIP_ROWS,Xe)}}function oe(P,T,F){let Q=r.TEXTURE_2D;(T.isDataArrayTexture||T.isCompressedArrayTexture)&&(Q=r.TEXTURE_2D_ARRAY),T.isData3DTexture&&(Q=r.TEXTURE_3D);const ce=ge(P,T),te=T.source;t.bindTexture(Q,P.__webglTexture,r.TEXTURE0+F);const Re=n.get(te);if(te.version!==Re.__version||ce===!0){t.activeTexture(r.TEXTURE0+F);const we=rt.getPrimaries(rt.workingColorSpace),Le=T.colorSpace===ri?null:rt.getPrimaries(T.colorSpace),Xe=T.colorSpace===ri||we===Le?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,T.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Xe);let fe=_(T.image,!1,i.maxTextureSize);fe=ie(T,fe);const Se=s.convert(T.format,T.colorSpace),Oe=s.convert(T.type);let Ue=y(T.internalFormat,Se,Oe,T.colorSpace,T.isVideoTexture);Z(Q,T);let Me;const it=T.mipmaps,Y=T.isVideoTexture!==!0,Pe=Re.__version===void 0||ce===!0,be=te.dataReady,De=A(T,fe);if(T.isDepthTexture)Ue=x(T.format===xi,T.type),Pe&&(Y?t.texStorage2D(r.TEXTURE_2D,1,Ue,fe.width,fe.height):t.texImage2D(r.TEXTURE_2D,0,Ue,fe.width,fe.height,0,Se,Oe,null));else if(T.isDataTexture)if(it.length>0){Y&&Pe&&t.texStorage2D(r.TEXTURE_2D,De,Ue,it[0].width,it[0].height);for(let ve=0,me=it.length;ve<me;ve++)Me=it[ve],Y?be&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,Me.width,Me.height,Se,Oe,Me.data):t.texImage2D(r.TEXTURE_2D,ve,Ue,Me.width,Me.height,0,Se,Oe,Me.data);T.generateMipmaps=!1}else Y?(Pe&&t.texStorage2D(r.TEXTURE_2D,De,Ue,fe.width,fe.height),be&&de(T,fe,Se,Oe)):t.texImage2D(r.TEXTURE_2D,0,Ue,fe.width,fe.height,0,Se,Oe,fe.data);else if(T.isCompressedTexture)if(T.isCompressedArrayTexture){Y&&Pe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,De,Ue,it[0].width,it[0].height,fe.depth);for(let ve=0,me=it.length;ve<me;ve++)if(Me=it[ve],T.format!==rn)if(Se!==null)if(Y){if(be)if(T.layerUpdates.size>0){const Ee=Cu(Me.width,Me.height,T.format,T.type);for(const $e of T.layerUpdates){const vt=Me.data.subarray($e*Ee/Me.data.BYTES_PER_ELEMENT,($e+1)*Ee/Me.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,$e,Me.width,Me.height,1,Se,vt)}T.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,0,Me.width,Me.height,fe.depth,Se,Me.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ve,Ue,Me.width,Me.height,fe.depth,0,Me.data,0,0);else Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Y?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,0,Me.width,Me.height,fe.depth,Se,Oe,Me.data):t.texImage3D(r.TEXTURE_2D_ARRAY,ve,Ue,Me.width,Me.height,fe.depth,0,Se,Oe,Me.data)}else{Y&&Pe&&t.texStorage2D(r.TEXTURE_2D,De,Ue,it[0].width,it[0].height);for(let ve=0,me=it.length;ve<me;ve++)Me=it[ve],T.format!==rn?Se!==null?Y?be&&t.compressedTexSubImage2D(r.TEXTURE_2D,ve,0,0,Me.width,Me.height,Se,Me.data):t.compressedTexImage2D(r.TEXTURE_2D,ve,Ue,Me.width,Me.height,0,Me.data):Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Y?be&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,Me.width,Me.height,Se,Oe,Me.data):t.texImage2D(r.TEXTURE_2D,ve,Ue,Me.width,Me.height,0,Se,Oe,Me.data)}else if(T.isDataArrayTexture)if(Y){if(Pe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,De,Ue,fe.width,fe.height,fe.depth),be)if(T.layerUpdates.size>0){const ve=Cu(fe.width,fe.height,T.format,T.type);for(const me of T.layerUpdates){const Ee=fe.data.subarray(me*ve/fe.data.BYTES_PER_ELEMENT,(me+1)*ve/fe.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,me,fe.width,fe.height,1,Se,Oe,Ee)}T.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,fe.width,fe.height,fe.depth,Se,Oe,fe.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,Ue,fe.width,fe.height,fe.depth,0,Se,Oe,fe.data);else if(T.isData3DTexture)Y?(Pe&&t.texStorage3D(r.TEXTURE_3D,De,Ue,fe.width,fe.height,fe.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,fe.width,fe.height,fe.depth,Se,Oe,fe.data)):t.texImage3D(r.TEXTURE_3D,0,Ue,fe.width,fe.height,fe.depth,0,Se,Oe,fe.data);else if(T.isFramebufferTexture){if(Pe)if(Y)t.texStorage2D(r.TEXTURE_2D,De,Ue,fe.width,fe.height);else{let ve=fe.width,me=fe.height;for(let Ee=0;Ee<De;Ee++)t.texImage2D(r.TEXTURE_2D,Ee,Ue,ve,me,0,Se,Oe,null),ve>>=1,me>>=1}}else if(it.length>0){if(Y&&Pe){const ve=V(it[0]);t.texStorage2D(r.TEXTURE_2D,De,Ue,ve.width,ve.height)}for(let ve=0,me=it.length;ve<me;ve++)Me=it[ve],Y?be&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,Se,Oe,Me):t.texImage2D(r.TEXTURE_2D,ve,Ue,Se,Oe,Me);T.generateMipmaps=!1}else if(Y){if(Pe){const ve=V(fe);t.texStorage2D(r.TEXTURE_2D,De,Ue,ve.width,ve.height)}be&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Se,Oe,fe)}else t.texImage2D(r.TEXTURE_2D,0,Ue,Se,Oe,fe);m(T)&&p(Q),Re.__version=te.version,T.onUpdate&&T.onUpdate(T)}P.__version=T.version}function ee(P,T,F){if(T.image.length!==6)return;const Q=ge(P,T),ce=T.source;t.bindTexture(r.TEXTURE_CUBE_MAP,P.__webglTexture,r.TEXTURE0+F);const te=n.get(ce);if(ce.version!==te.__version||Q===!0){t.activeTexture(r.TEXTURE0+F);const Re=rt.getPrimaries(rt.workingColorSpace),we=T.colorSpace===ri?null:rt.getPrimaries(T.colorSpace),Le=T.colorSpace===ri||Re===we?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,T.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);const Xe=T.isCompressedTexture||T.image[0].isCompressedTexture,fe=T.image[0]&&T.image[0].isDataTexture,Se=[];for(let me=0;me<6;me++)!Xe&&!fe?Se[me]=_(T.image[me],!0,i.maxCubemapSize):Se[me]=fe?T.image[me].image:T.image[me],Se[me]=ie(T,Se[me]);const Oe=Se[0],Ue=s.convert(T.format,T.colorSpace),Me=s.convert(T.type),it=y(T.internalFormat,Ue,Me,T.colorSpace),Y=T.isVideoTexture!==!0,Pe=te.__version===void 0||Q===!0,be=ce.dataReady;let De=A(T,Oe);Z(r.TEXTURE_CUBE_MAP,T);let ve;if(Xe){Y&&Pe&&t.texStorage2D(r.TEXTURE_CUBE_MAP,De,it,Oe.width,Oe.height);for(let me=0;me<6;me++){ve=Se[me].mipmaps;for(let Ee=0;Ee<ve.length;Ee++){const $e=ve[Ee];T.format!==rn?Ue!==null?Y?be&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee,0,0,$e.width,$e.height,Ue,$e.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee,it,$e.width,$e.height,0,$e.data):Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee,0,0,$e.width,$e.height,Ue,Me,$e.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee,it,$e.width,$e.height,0,Ue,Me,$e.data)}}}else{if(ve=T.mipmaps,Y&&Pe){ve.length>0&&De++;const me=V(Se[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,De,it,me.width,me.height)}for(let me=0;me<6;me++)if(fe){Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,Se[me].width,Se[me].height,Ue,Me,Se[me].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,it,Se[me].width,Se[me].height,0,Ue,Me,Se[me].data);for(let Ee=0;Ee<ve.length;Ee++){const vt=ve[Ee].image[me].image;Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee+1,0,0,vt.width,vt.height,Ue,Me,vt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee+1,it,vt.width,vt.height,0,Ue,Me,vt.data)}}else{Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,Ue,Me,Se[me]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,it,Ue,Me,Se[me]);for(let Ee=0;Ee<ve.length;Ee++){const $e=ve[Ee];Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee+1,0,0,Ue,Me,$e.image[me]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee+1,it,Ue,Me,$e.image[me])}}}m(T)&&p(r.TEXTURE_CUBE_MAP),te.__version=ce.version,T.onUpdate&&T.onUpdate(T)}P.__version=T.version}function pe(P,T,F,Q,ce,te){const Re=s.convert(F.format,F.colorSpace),we=s.convert(F.type),Le=y(F.internalFormat,Re,we,F.colorSpace),Xe=n.get(T),fe=n.get(F);if(fe.__renderTarget=T,!Xe.__hasExternalTextures){const Se=Math.max(1,T.width>>te),Oe=Math.max(1,T.height>>te);ce===r.TEXTURE_3D||ce===r.TEXTURE_2D_ARRAY?t.texImage3D(ce,te,Le,Se,Oe,T.depth,0,Re,we,null):t.texImage2D(ce,te,Le,Se,Oe,0,Re,we,null)}t.bindFramebuffer(r.FRAMEBUFFER,P),G(T)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Q,ce,fe.__webglTexture,0,S(T)):(ce===r.TEXTURE_2D||ce>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&ce<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Q,ce,fe.__webglTexture,te),t.bindFramebuffer(r.FRAMEBUFFER,null)}function ye(P,T,F){if(r.bindRenderbuffer(r.RENDERBUFFER,P),T.depthBuffer){const Q=T.depthTexture,ce=Q&&Q.isDepthTexture?Q.type:null,te=x(T.stencilBuffer,ce),Re=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;G(T)?a.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,S(T),te,T.width,T.height):F?r.renderbufferStorageMultisample(r.RENDERBUFFER,S(T),te,T.width,T.height):r.renderbufferStorage(r.RENDERBUFFER,te,T.width,T.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Re,r.RENDERBUFFER,P)}else{const Q=T.textures;for(let ce=0;ce<Q.length;ce++){const te=Q[ce],Re=s.convert(te.format,te.colorSpace),we=s.convert(te.type),Le=y(te.internalFormat,Re,we,te.colorSpace);G(T)?a.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,S(T),Le,T.width,T.height):F?r.renderbufferStorageMultisample(r.RENDERBUFFER,S(T),Le,T.width,T.height):r.renderbufferStorage(r.RENDERBUFFER,Le,T.width,T.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ae(P,T,F){const Q=T.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,P),!(T.depthTexture&&T.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ce=n.get(T.depthTexture);if(ce.__renderTarget=T,(!ce.__webglTexture||T.depthTexture.image.width!==T.width||T.depthTexture.image.height!==T.height)&&(T.depthTexture.image.width=T.width,T.depthTexture.image.height=T.height,T.depthTexture.needsUpdate=!0),Q){if(ce.__webglInit===void 0&&(ce.__webglInit=!0,T.depthTexture.addEventListener("dispose",E)),ce.__webglTexture===void 0){ce.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,ce.__webglTexture),Z(r.TEXTURE_CUBE_MAP,T.depthTexture);const Xe=s.convert(T.depthTexture.format),fe=s.convert(T.depthTexture.type);let Se;T.depthTexture.format===Yn?Se=r.DEPTH_COMPONENT24:T.depthTexture.format===xi&&(Se=r.DEPTH24_STENCIL8);for(let Oe=0;Oe<6;Oe++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,0,Se,T.width,T.height,0,Xe,fe,null)}}else z(T.depthTexture,0);const te=ce.__webglTexture,Re=S(T),we=Q?r.TEXTURE_CUBE_MAP_POSITIVE_X+F:r.TEXTURE_2D,Le=T.depthTexture.format===xi?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(T.depthTexture.format===Yn)G(T)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Le,we,te,0,Re):r.framebufferTexture2D(r.FRAMEBUFFER,Le,we,te,0);else if(T.depthTexture.format===xi)G(T)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Le,we,te,0,Re):r.framebufferTexture2D(r.FRAMEBUFFER,Le,we,te,0);else throw new Error("Unknown depthTexture format")}function ze(P){const T=n.get(P),F=P.isWebGLCubeRenderTarget===!0;if(T.__boundDepthTexture!==P.depthTexture){const Q=P.depthTexture;if(T.__depthDisposeCallback&&T.__depthDisposeCallback(),Q){const ce=()=>{delete T.__boundDepthTexture,delete T.__depthDisposeCallback,Q.removeEventListener("dispose",ce)};Q.addEventListener("dispose",ce),T.__depthDisposeCallback=ce}T.__boundDepthTexture=Q}if(P.depthTexture&&!T.__autoAllocateDepthBuffer)if(F)for(let Q=0;Q<6;Q++)Ae(T.__webglFramebuffer[Q],P,Q);else{const Q=P.texture.mipmaps;Q&&Q.length>0?Ae(T.__webglFramebuffer[0],P,0):Ae(T.__webglFramebuffer,P,0)}else if(F){T.__webglDepthbuffer=[];for(let Q=0;Q<6;Q++)if(t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer[Q]),T.__webglDepthbuffer[Q]===void 0)T.__webglDepthbuffer[Q]=r.createRenderbuffer(),ye(T.__webglDepthbuffer[Q],P,!1);else{const ce=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,te=T.__webglDepthbuffer[Q];r.bindRenderbuffer(r.RENDERBUFFER,te),r.framebufferRenderbuffer(r.FRAMEBUFFER,ce,r.RENDERBUFFER,te)}}else{const Q=P.texture.mipmaps;if(Q&&Q.length>0?t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer),T.__webglDepthbuffer===void 0)T.__webglDepthbuffer=r.createRenderbuffer(),ye(T.__webglDepthbuffer,P,!1);else{const ce=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,te=T.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,te),r.framebufferRenderbuffer(r.FRAMEBUFFER,ce,r.RENDERBUFFER,te)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function je(P,T,F){const Q=n.get(P);T!==void 0&&pe(Q.__webglFramebuffer,P,P.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),F!==void 0&&ze(P)}function He(P){const T=P.texture,F=n.get(P),Q=n.get(T);P.addEventListener("dispose",I);const ce=P.textures,te=P.isWebGLCubeRenderTarget===!0,Re=ce.length>1;if(Re||(Q.__webglTexture===void 0&&(Q.__webglTexture=r.createTexture()),Q.__version=T.version,o.memory.textures++),te){F.__webglFramebuffer=[];for(let we=0;we<6;we++)if(T.mipmaps&&T.mipmaps.length>0){F.__webglFramebuffer[we]=[];for(let Le=0;Le<T.mipmaps.length;Le++)F.__webglFramebuffer[we][Le]=r.createFramebuffer()}else F.__webglFramebuffer[we]=r.createFramebuffer()}else{if(T.mipmaps&&T.mipmaps.length>0){F.__webglFramebuffer=[];for(let we=0;we<T.mipmaps.length;we++)F.__webglFramebuffer[we]=r.createFramebuffer()}else F.__webglFramebuffer=r.createFramebuffer();if(Re)for(let we=0,Le=ce.length;we<Le;we++){const Xe=n.get(ce[we]);Xe.__webglTexture===void 0&&(Xe.__webglTexture=r.createTexture(),o.memory.textures++)}if(P.samples>0&&G(P)===!1){F.__webglMultisampledFramebuffer=r.createFramebuffer(),F.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let we=0;we<ce.length;we++){const Le=ce[we];F.__webglColorRenderbuffer[we]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,F.__webglColorRenderbuffer[we]);const Xe=s.convert(Le.format,Le.colorSpace),fe=s.convert(Le.type),Se=y(Le.internalFormat,Xe,fe,Le.colorSpace,P.isXRRenderTarget===!0),Oe=S(P);r.renderbufferStorageMultisample(r.RENDERBUFFER,Oe,Se,P.width,P.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+we,r.RENDERBUFFER,F.__webglColorRenderbuffer[we])}r.bindRenderbuffer(r.RENDERBUFFER,null),P.depthBuffer&&(F.__webglDepthRenderbuffer=r.createRenderbuffer(),ye(F.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(te){t.bindTexture(r.TEXTURE_CUBE_MAP,Q.__webglTexture),Z(r.TEXTURE_CUBE_MAP,T);for(let we=0;we<6;we++)if(T.mipmaps&&T.mipmaps.length>0)for(let Le=0;Le<T.mipmaps.length;Le++)pe(F.__webglFramebuffer[we][Le],P,T,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+we,Le);else pe(F.__webglFramebuffer[we],P,T,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+we,0);m(T)&&p(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Re){for(let we=0,Le=ce.length;we<Le;we++){const Xe=ce[we],fe=n.get(Xe);let Se=r.TEXTURE_2D;(P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(Se=P.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Se,fe.__webglTexture),Z(Se,Xe),pe(F.__webglFramebuffer,P,Xe,r.COLOR_ATTACHMENT0+we,Se,0),m(Xe)&&p(Se)}t.unbindTexture()}else{let we=r.TEXTURE_2D;if((P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(we=P.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(we,Q.__webglTexture),Z(we,T),T.mipmaps&&T.mipmaps.length>0)for(let Le=0;Le<T.mipmaps.length;Le++)pe(F.__webglFramebuffer[Le],P,T,r.COLOR_ATTACHMENT0,we,Le);else pe(F.__webglFramebuffer,P,T,r.COLOR_ATTACHMENT0,we,0);m(T)&&p(we),t.unbindTexture()}P.depthBuffer&&ze(P)}function w(P){const T=P.textures;for(let F=0,Q=T.length;F<Q;F++){const ce=T[F];if(m(ce)){const te=v(P),Re=n.get(ce).__webglTexture;t.bindTexture(te,Re),p(te),t.unbindTexture()}}}const q=[],k=[];function N(P){if(P.samples>0){if(G(P)===!1){const T=P.textures,F=P.width,Q=P.height;let ce=r.COLOR_BUFFER_BIT;const te=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Re=n.get(P),we=T.length>1;if(we)for(let Xe=0;Xe<T.length;Xe++)t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Xe,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Xe,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Re.__webglMultisampledFramebuffer);const Le=P.texture.mipmaps;Le&&Le.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglFramebuffer);for(let Xe=0;Xe<T.length;Xe++){if(P.resolveDepthBuffer&&(P.depthBuffer&&(ce|=r.DEPTH_BUFFER_BIT),P.stencilBuffer&&P.resolveStencilBuffer&&(ce|=r.STENCIL_BUFFER_BIT)),we){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Re.__webglColorRenderbuffer[Xe]);const fe=n.get(T[Xe]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,fe,0)}r.blitFramebuffer(0,0,F,Q,0,0,F,Q,ce,r.NEAREST),c===!0&&(q.length=0,k.length=0,q.push(r.COLOR_ATTACHMENT0+Xe),P.depthBuffer&&P.resolveDepthBuffer===!1&&(q.push(te),k.push(te),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,k)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,q))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),we)for(let Xe=0;Xe<T.length;Xe++){t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Xe,r.RENDERBUFFER,Re.__webglColorRenderbuffer[Xe]);const fe=n.get(T[Xe]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Xe,r.TEXTURE_2D,fe,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglMultisampledFramebuffer)}else if(P.depthBuffer&&P.resolveDepthBuffer===!1&&c){const T=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[T])}}}function S(P){return Math.min(i.maxSamples,P.samples)}function G(P){const T=n.get(P);return P.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&T.__useRenderToTexture!==!1}function K(P){const T=o.render.frame;h.get(P)!==T&&(h.set(P,T),P.update())}function ie(P,T){const F=P.colorSpace,Q=P.format,ce=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||F!==Xt&&F!==ri&&(rt.getTransfer(F)===ut?(Q!==rn||ce!==ln)&&Te("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",F)),T}function V(P){return typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement?(l.width=P.naturalWidth||P.width,l.height=P.naturalHeight||P.height):typeof VideoFrame<"u"&&P instanceof VideoFrame?(l.width=P.displayWidth,l.height=P.displayHeight):(l.width=P.width,l.height=P.height),l}this.allocateTextureUnit=O,this.resetTextureUnits=R,this.setTexture2D=z,this.setTexture2DArray=X,this.setTexture3D=H,this.setTextureCube=re,this.rebindTextures=je,this.setupRenderTarget=He,this.updateRenderTargetMipmap=w,this.updateMultisampleRenderTarget=N,this.setupDepthRenderbuffer=ze,this.setupFrameBufferTexture=pe,this.useMultisampledRTT=G,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Tm(r,e){function t(n,i=ri){let s;const o=rt.getTransfer(i);if(n===ln)return r.UNSIGNED_BYTE;if(n===Jo)return r.UNSIGNED_SHORT_4_4_4_4;if(n===$o)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Ql)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Kl)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Zl)return r.BYTE;if(n===Yl)return r.SHORT;if(n===Br)return r.UNSIGNED_SHORT;if(n===jo)return r.INT;if(n===En)return r.UNSIGNED_INT;if(n===nn)return r.FLOAT;if(n===Zn)return r.HALF_FLOAT;if(n===jl)return r.ALPHA;if(n===Jl)return r.RGB;if(n===rn)return r.RGBA;if(n===Yn)return r.DEPTH_COMPONENT;if(n===xi)return r.DEPTH_STENCIL;if(n===ea)return r.RED;if(n===Os)return r.RED_INTEGER;if(n===Gi)return r.RG;if(n===ta)return r.RG_INTEGER;if(n===na)return r.RGBA_INTEGER;if(n===Fs||n===zs||n===ks||n===Vs)if(o===ut)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Fs)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===zs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ks)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Vs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Fs)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===zs)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ks)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Vs)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ia||n===ra||n===sa||n===oa)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ia)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ra)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===sa)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===oa)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===aa||n===ca||n===la||n===ha||n===ua||n===fa||n===da)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===aa||n===ca)return o===ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===la)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===ha)return s.COMPRESSED_R11_EAC;if(n===ua)return s.COMPRESSED_SIGNED_R11_EAC;if(n===fa)return s.COMPRESSED_RG11_EAC;if(n===da)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===pa||n===ma||n===ga||n===_a||n===va||n===ya||n===xa||n===Aa||n===ba||n===wa||n===Sa||n===Ma||n===Ea||n===Ta)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===pa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ma)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ga)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===_a)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===va)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ya)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===xa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Aa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ba)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===wa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Sa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ma)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ea)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ta)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ca||n===Ia||n===Ra)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ca)return o===ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ia)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ra)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Pa||n===Da||n===La||n===Na)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Pa)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Da)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===La)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Na)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Or?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const Kb=`
3995
+ }`,Wb=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],qb=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],Em=new We,xo=new U,Ou=new U;function Xb(r,e,t){let n=new fs;const i=new he,s=new he,o=new gt,a=new nu,c=new iu,l={},h=t.maxTextureSize,u={[Wn]:en,[en]:Wn,[Sn]:Sn},f=new Cn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new he},radius:{value:4}},vertexShader:Hb,fragmentShader:Gb}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const g=new Ke;g.setAttribute("position",new ot(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new St(g,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ls;let p=this.type;this.render=function(E,I,D){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||E.length===0)return;E.type===bf&&(Te("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),E.type=Ls);const b=r.getRenderTarget(),C=r.getActiveCubeFace(),B=r.getActiveMipmapLevel(),R=r.state;R.setBlending(qn),R.buffers.depth.getReversed()===!0?R.buffers.color.setClear(0,0,0,0):R.buffers.color.setClear(1,1,1,1),R.buffers.depth.setTest(!0),R.setScissorTest(!1);const O=p!==this.type;O&&I.traverse(function(M){M.material&&(Array.isArray(M.material)?M.material.forEach(z=>z.needsUpdate=!0):M.material.needsUpdate=!0)});for(let M=0,z=E.length;M<z;M++){const X=E[M],H=X.shadow;if(H===void 0){Te("WebGLShadowMap:",X,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;i.copy(H.mapSize);const re=H.getFrameExtents();if(i.multiply(re),s.copy(H.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/re.x),i.x=s.x*re.x,H.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/re.y),i.y=s.y*re.y,H.mapSize.y=s.y)),H.map===null||O===!0){if(H.map!==null&&(H.map.depthTexture!==null&&(H.map.depthTexture.dispose(),H.map.depthTexture=null),H.map.dispose()),this.type===Dr){if(X.isPointLight){Te("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}H.map=new vn(i.x,i.y,{format:Gi,type:Zn,minFilter:pt,magFilter:pt,generateMipmaps:!1}),H.map.texture.name=X.name+".shadowMap",H.map.depthTexture=new ds(i.x,i.y,nn),H.map.depthTexture.name=X.name+".shadowMapDepth",H.map.depthTexture.format=Yn,H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=Mt,H.map.depthTexture.magFilter=Mt}else{X.isPointLight?(H.map=new Th(i.x),H.map.depthTexture=new Jd(i.x,En)):(H.map=new vn(i.x,i.y),H.map.depthTexture=new ds(i.x,i.y,En)),H.map.depthTexture.name=X.name+".shadowMap",H.map.depthTexture.format=Yn;const le=r.state.buffers.depth.getReversed();this.type===Ls?(H.map.depthTexture.compareFunction=le?za:Fa,H.map.depthTexture.minFilter=pt,H.map.depthTexture.magFilter=pt):(H.map.depthTexture.compareFunction=null,H.map.depthTexture.minFilter=Mt,H.map.depthTexture.magFilter=Mt)}H.camera.updateProjectionMatrix()}const J=H.map.isWebGLCubeRenderTarget?6:1;for(let le=0;le<J;le++){if(H.map.isWebGLCubeRenderTarget)r.setRenderTarget(H.map,le),r.clear();else{le===0&&(r.setRenderTarget(H.map),r.clear());const W=H.getViewport(le);o.set(s.x*W.x,s.y*W.y,s.x*W.z,s.y*W.w),R.viewport(o)}if(X.isPointLight){const W=H.camera,Z=H.matrix,ge=X.distance||W.far;ge!==W.far&&(W.far=ge,W.updateProjectionMatrix()),xo.setFromMatrixPosition(X.matrixWorld),W.position.copy(xo),Ou.copy(W.position),Ou.add(Wb[le]),W.up.copy(qb[le]),W.lookAt(Ou),W.updateMatrixWorld(),Z.makeTranslation(-xo.x,-xo.y,-xo.z),Em.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),H._frustum.setFromProjectionMatrix(Em,W.coordinateSystem,W.reversedDepth)}else H.updateMatrices(X);n=H.getFrustum(),x(I,D,H.camera,X,this.type)}H.isPointLightShadow!==!0&&this.type===Dr&&v(H,D),H.needsUpdate=!1}p=this.type,m.needsUpdate=!1,r.setRenderTarget(b,C,B)};function v(E,I){const D=e.update(_);f.defines.VSM_SAMPLES!==E.blurSamples&&(f.defines.VSM_SAMPLES=E.blurSamples,d.defines.VSM_SAMPLES=E.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),E.mapPass===null&&(E.mapPass=new vn(i.x,i.y,{format:Gi,type:Zn})),f.uniforms.shadow_pass.value=E.map.depthTexture,f.uniforms.resolution.value=E.mapSize,f.uniforms.radius.value=E.radius,r.setRenderTarget(E.mapPass),r.clear(),r.renderBufferDirect(I,null,D,f,_,null),d.uniforms.shadow_pass.value=E.mapPass.texture,d.uniforms.resolution.value=E.mapSize,d.uniforms.radius.value=E.radius,r.setRenderTarget(E.map),r.clear(),r.renderBufferDirect(I,null,D,d,_,null)}function y(E,I,D,b){let C=null;const B=D.isPointLight===!0?E.customDistanceMaterial:E.customDepthMaterial;if(B!==void 0)C=B;else if(C=D.isPointLight===!0?c:a,r.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0||I.alphaToCoverage===!0){const R=C.uuid,O=I.uuid;let M=l[R];M===void 0&&(M={},l[R]=M);let z=M[O];z===void 0&&(z=C.clone(),M[O]=z,I.addEventListener("dispose",A)),C=z}if(C.visible=I.visible,C.wireframe=I.wireframe,b===Dr?C.side=I.shadowSide!==null?I.shadowSide:I.side:C.side=I.shadowSide!==null?I.shadowSide:u[I.side],C.alphaMap=I.alphaMap,C.alphaTest=I.alphaToCoverage===!0?.5:I.alphaTest,C.map=I.map,C.clipShadows=I.clipShadows,C.clippingPlanes=I.clippingPlanes,C.clipIntersection=I.clipIntersection,C.displacementMap=I.displacementMap,C.displacementScale=I.displacementScale,C.displacementBias=I.displacementBias,C.wireframeLinewidth=I.wireframeLinewidth,C.linewidth=I.linewidth,D.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const R=r.properties.get(C);R.light=D}return C}function x(E,I,D,b,C){if(E.visible===!1)return;if(E.layers.test(I.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&C===Dr)&&(!E.frustumCulled||n.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,E.matrixWorld);const O=e.update(E),M=E.material;if(Array.isArray(M)){const z=O.groups;for(let X=0,H=z.length;X<H;X++){const re=z[X],J=M[re.materialIndex];if(J&&J.visible){const le=y(E,J,b,C);E.onBeforeShadow(r,E,I,D,O,le,re),r.renderBufferDirect(D,null,O,le,E,re),E.onAfterShadow(r,E,I,D,O,le,re)}}}else if(M.visible){const z=y(E,M,b,C);E.onBeforeShadow(r,E,I,D,O,z,null),r.renderBufferDirect(D,null,O,z,E,null),E.onAfterShadow(r,E,I,D,O,z,null)}}const R=E.children;for(let O=0,M=R.length;O<M;O++)x(R[O],I,D,b,C)}function A(E){E.target.removeEventListener("dispose",A);for(const D in l){const b=l[D],C=E.target.uuid;C in b&&(b[C].dispose(),delete b[C])}}}const Zb={[Vo]:Ho,[Go]:Xo,[Wo]:Zo,[Vi]:qo,[Ho]:Vo,[Xo]:Go,[Zo]:Wo,[qo]:Vi};function Yb(r,e){function t(){let Y=!1;const Pe=new gt;let be=null;const De=new gt(0,0,0,0);return{setMask:function(ve){be!==ve&&!Y&&(r.colorMask(ve,ve,ve,ve),be=ve)},setLocked:function(ve){Y=ve},setClear:function(ve,me,Ee,$e,vt){vt===!0&&(ve*=$e,me*=$e,Ee*=$e),Pe.set(ve,me,Ee,$e),De.equals(Pe)===!1&&(r.clearColor(ve,me,Ee,$e),De.copy(Pe))},reset:function(){Y=!1,be=null,De.set(-1,0,0,0)}}}function n(){let Y=!1,Pe=!1,be=null,De=null,ve=null;return{setReversed:function(me){if(Pe!==me){const Ee=e.get("EXT_clip_control");me?Ee.clipControlEXT(Ee.LOWER_LEFT_EXT,Ee.ZERO_TO_ONE_EXT):Ee.clipControlEXT(Ee.LOWER_LEFT_EXT,Ee.NEGATIVE_ONE_TO_ONE_EXT),Pe=me;const $e=ve;ve=null,this.setClear($e)}},getReversed:function(){return Pe},setTest:function(me){me?ee(r.DEPTH_TEST):pe(r.DEPTH_TEST)},setMask:function(me){be!==me&&!Y&&(r.depthMask(me),be=me)},setFunc:function(me){if(Pe&&(me=Zb[me]),De!==me){switch(me){case Vo:r.depthFunc(r.NEVER);break;case Ho:r.depthFunc(r.ALWAYS);break;case Go:r.depthFunc(r.LESS);break;case Vi:r.depthFunc(r.LEQUAL);break;case Wo:r.depthFunc(r.EQUAL);break;case qo:r.depthFunc(r.GEQUAL);break;case Xo:r.depthFunc(r.GREATER);break;case Zo:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}De=me}},setLocked:function(me){Y=me},setClear:function(me){ve!==me&&(Pe&&(me=1-me),r.clearDepth(me),ve=me)},reset:function(){Y=!1,be=null,De=null,ve=null,Pe=!1}}}function i(){let Y=!1,Pe=null,be=null,De=null,ve=null,me=null,Ee=null,$e=null,vt=null;return{setTest:function(ft){Y||(ft?ee(r.STENCIL_TEST):pe(r.STENCIL_TEST))},setMask:function(ft){Pe!==ft&&!Y&&(r.stencilMask(ft),Pe=ft)},setFunc:function(ft,ii,gi){(be!==ft||De!==ii||ve!==gi)&&(r.stencilFunc(ft,ii,gi),be=ft,De=ii,ve=gi)},setOp:function(ft,ii,gi){(me!==ft||Ee!==ii||$e!==gi)&&(r.stencilOp(ft,ii,gi),me=ft,Ee=ii,$e=gi)},setLocked:function(ft){Y=ft},setClear:function(ft){vt!==ft&&(r.clearStencil(ft),vt=ft)},reset:function(){Y=!1,Pe=null,be=null,De=null,ve=null,me=null,Ee=null,$e=null,vt=null}}}const s=new t,o=new n,a=new i,c=new WeakMap,l=new WeakMap;let h={},u={},f=new WeakMap,d=[],g=null,_=!1,m=null,p=null,v=null,y=null,x=null,A=null,E=null,I=new xe(0,0,0),D=0,b=!1,C=null,B=null,R=null,O=null,M=null;const z=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,H=0;const re=r.getParameter(r.VERSION);re.indexOf("WebGL")!==-1?(H=parseFloat(/^WebGL (\d)/.exec(re)[1]),X=H>=1):re.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(re)[1]),X=H>=2);let J=null,le={};const W=r.getParameter(r.SCISSOR_BOX),Z=r.getParameter(r.VIEWPORT),ge=new gt().fromArray(W),_e=new gt().fromArray(Z);function de(Y,Pe,be,De){const ve=new Uint8Array(4),me=r.createTexture();r.bindTexture(Y,me),r.texParameteri(Y,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(Y,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Ee=0;Ee<be;Ee++)Y===r.TEXTURE_3D||Y===r.TEXTURE_2D_ARRAY?r.texImage3D(Pe,0,r.RGBA,1,1,De,0,r.RGBA,r.UNSIGNED_BYTE,ve):r.texImage2D(Pe+Ee,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ve);return me}const oe={};oe[r.TEXTURE_2D]=de(r.TEXTURE_2D,r.TEXTURE_2D,1),oe[r.TEXTURE_CUBE_MAP]=de(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),oe[r.TEXTURE_2D_ARRAY]=de(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),oe[r.TEXTURE_3D]=de(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),ee(r.DEPTH_TEST),o.setFunc(Vi),k(!1),N(Bl),ee(r.CULL_FACE),w(qn);function ee(Y){h[Y]!==!0&&(r.enable(Y),h[Y]=!0)}function pe(Y){h[Y]!==!1&&(r.disable(Y),h[Y]=!1)}function ye(Y,Pe){return u[Y]!==Pe?(r.bindFramebuffer(Y,Pe),u[Y]=Pe,Y===r.DRAW_FRAMEBUFFER&&(u[r.FRAMEBUFFER]=Pe),Y===r.FRAMEBUFFER&&(u[r.DRAW_FRAMEBUFFER]=Pe),!0):!1}function Ae(Y,Pe){let be=d,De=!1;if(Y){be=f.get(Pe),be===void 0&&(be=[],f.set(Pe,be));const ve=Y.textures;if(be.length!==ve.length||be[0]!==r.COLOR_ATTACHMENT0){for(let me=0,Ee=ve.length;me<Ee;me++)be[me]=r.COLOR_ATTACHMENT0+me;be.length=ve.length,De=!0}}else be[0]!==r.BACK&&(be[0]=r.BACK,De=!0);De&&r.drawBuffers(be)}function ze(Y){return g!==Y?(r.useProgram(Y),g=Y,!0):!1}const je={[_i]:r.FUNC_ADD,[Sf]:r.FUNC_SUBTRACT,[Mf]:r.FUNC_REVERSE_SUBTRACT};je[Ef]=r.MIN,je[Tf]=r.MAX;const He={[Cf]:r.ZERO,[If]:r.ONE,[Rf]:r.SRC_COLOR,[zo]:r.SRC_ALPHA,[Bf]:r.SRC_ALPHA_SATURATE,[Nf]:r.DST_COLOR,[Df]:r.DST_ALPHA,[Pf]:r.ONE_MINUS_SRC_COLOR,[ko]:r.ONE_MINUS_SRC_ALPHA,[Uf]:r.ONE_MINUS_DST_COLOR,[Lf]:r.ONE_MINUS_DST_ALPHA,[Of]:r.CONSTANT_COLOR,[Ff]:r.ONE_MINUS_CONSTANT_COLOR,[zf]:r.CONSTANT_ALPHA,[kf]:r.ONE_MINUS_CONSTANT_ALPHA};function w(Y,Pe,be,De,ve,me,Ee,$e,vt,ft){if(Y===qn){_===!0&&(pe(r.BLEND),_=!1);return}if(_===!1&&(ee(r.BLEND),_=!0),Y!==wf){if(Y!==m||ft!==b){if((p!==_i||x!==_i)&&(r.blendEquation(r.FUNC_ADD),p=_i,x=_i),ft)switch(Y){case ki:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ol:r.blendFunc(r.ONE,r.ONE);break;case Fl:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case zl:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:Ge("WebGLState: Invalid blending: ",Y);break}else switch(Y){case ki:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ol:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Fl:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case zl:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",Y);break}v=null,y=null,A=null,E=null,I.set(0,0,0),D=0,m=Y,b=ft}return}ve=ve||Pe,me=me||be,Ee=Ee||De,(Pe!==p||ve!==x)&&(r.blendEquationSeparate(je[Pe],je[ve]),p=Pe,x=ve),(be!==v||De!==y||me!==A||Ee!==E)&&(r.blendFuncSeparate(He[be],He[De],He[me],He[Ee]),v=be,y=De,A=me,E=Ee),($e.equals(I)===!1||vt!==D)&&(r.blendColor($e.r,$e.g,$e.b,vt),I.copy($e),D=vt),m=Y,b=!1}function q(Y,Pe){Y.side===Sn?pe(r.CULL_FACE):ee(r.CULL_FACE);let be=Y.side===en;Pe&&(be=!be),k(be),Y.blending===ki&&Y.transparent===!1?w(qn):w(Y.blending,Y.blendEquation,Y.blendSrc,Y.blendDst,Y.blendEquationAlpha,Y.blendSrcAlpha,Y.blendDstAlpha,Y.blendColor,Y.blendAlpha,Y.premultipliedAlpha),o.setFunc(Y.depthFunc),o.setTest(Y.depthTest),o.setMask(Y.depthWrite),s.setMask(Y.colorWrite);const De=Y.stencilWrite;a.setTest(De),De&&(a.setMask(Y.stencilWriteMask),a.setFunc(Y.stencilFunc,Y.stencilRef,Y.stencilFuncMask),a.setOp(Y.stencilFail,Y.stencilZFail,Y.stencilZPass)),G(Y.polygonOffset,Y.polygonOffsetFactor,Y.polygonOffsetUnits),Y.alphaToCoverage===!0?ee(r.SAMPLE_ALPHA_TO_COVERAGE):pe(r.SAMPLE_ALPHA_TO_COVERAGE)}function k(Y){C!==Y&&(Y?r.frontFace(r.CW):r.frontFace(r.CCW),C=Y)}function N(Y){Y!==xf?(ee(r.CULL_FACE),Y!==B&&(Y===Bl?r.cullFace(r.BACK):Y===Af?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):pe(r.CULL_FACE),B=Y}function S(Y){Y!==R&&(X&&r.lineWidth(Y),R=Y)}function G(Y,Pe,be){Y?(ee(r.POLYGON_OFFSET_FILL),(O!==Pe||M!==be)&&(r.polygonOffset(Pe,be),O=Pe,M=be)):pe(r.POLYGON_OFFSET_FILL)}function K(Y){Y?ee(r.SCISSOR_TEST):pe(r.SCISSOR_TEST)}function ie(Y){Y===void 0&&(Y=r.TEXTURE0+z-1),J!==Y&&(r.activeTexture(Y),J=Y)}function V(Y,Pe,be){be===void 0&&(J===null?be=r.TEXTURE0+z-1:be=J);let De=le[be];De===void 0&&(De={type:void 0,texture:void 0},le[be]=De),(De.type!==Y||De.texture!==Pe)&&(J!==be&&(r.activeTexture(be),J=be),r.bindTexture(Y,Pe||oe[Y]),De.type=Y,De.texture=Pe)}function P(){const Y=le[J];Y!==void 0&&Y.type!==void 0&&(r.bindTexture(Y.type,null),Y.type=void 0,Y.texture=void 0)}function T(){try{r.compressedTexImage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function F(){try{r.compressedTexImage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Q(){try{r.texSubImage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function ce(){try{r.texSubImage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function te(){try{r.compressedTexSubImage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Re(){try{r.compressedTexSubImage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function we(){try{r.texStorage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Le(){try{r.texStorage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Xe(){try{r.texImage2D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function fe(){try{r.texImage3D(...arguments)}catch(Y){Ge("WebGLState:",Y)}}function Se(Y){ge.equals(Y)===!1&&(r.scissor(Y.x,Y.y,Y.z,Y.w),ge.copy(Y))}function Oe(Y){_e.equals(Y)===!1&&(r.viewport(Y.x,Y.y,Y.z,Y.w),_e.copy(Y))}function Ue(Y,Pe){let be=l.get(Pe);be===void 0&&(be=new WeakMap,l.set(Pe,be));let De=be.get(Y);De===void 0&&(De=r.getUniformBlockIndex(Pe,Y.name),be.set(Y,De))}function Me(Y,Pe){const De=l.get(Pe).get(Y);c.get(Pe)!==De&&(r.uniformBlockBinding(Pe,De,Y.__bindingPointIndex),c.set(Pe,De))}function it(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),o.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},J=null,le={},u={},f=new WeakMap,d=[],g=null,_=!1,m=null,p=null,v=null,y=null,x=null,A=null,E=null,I=new xe(0,0,0),D=0,b=!1,C=null,B=null,R=null,O=null,M=null,ge.set(0,0,r.canvas.width,r.canvas.height),_e.set(0,0,r.canvas.width,r.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:ee,disable:pe,bindFramebuffer:ye,drawBuffers:Ae,useProgram:ze,setBlending:w,setMaterial:q,setFlipSided:k,setCullFace:N,setLineWidth:S,setPolygonOffset:G,setScissorTest:K,activeTexture:ie,bindTexture:V,unbindTexture:P,compressedTexImage2D:T,compressedTexImage3D:F,texImage2D:Xe,texImage3D:fe,updateUBOMapping:Ue,uniformBlockBinding:Me,texStorage2D:we,texStorage3D:Le,texSubImage2D:Q,texSubImage3D:ce,compressedTexSubImage2D:te,compressedTexSubImage3D:Re,scissor:Se,viewport:Oe,reset:it}}function Qb(r,e,t,n,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new he,h=new WeakMap;let u;const f=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(P,T){return d?new OffscreenCanvas(P,T):Ws("canvas")}function _(P,T,F){let Q=1;const ce=V(P);if((ce.width>F||ce.height>F)&&(Q=F/Math.max(ce.width,ce.height)),Q<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 te=Math.floor(Q*ce.width),Re=Math.floor(Q*ce.height);u===void 0&&(u=g(te,Re));const we=T?g(te,Re):u;return we.width=te,we.height=Re,we.getContext("2d").drawImage(P,0,0,te,Re),Te("WebGLRenderer: Texture has been resized from ("+ce.width+"x"+ce.height+") to ("+te+"x"+Re+")."),we}else return"data"in P&&Te("WebGLRenderer: Image in DataTexture is too big ("+ce.width+"x"+ce.height+")."),P;return P}function m(P){return P.generateMipmaps}function p(P){r.generateMipmap(P)}function v(P){return P.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:P.isWebGL3DRenderTarget?r.TEXTURE_3D:P.isWebGLArrayRenderTarget||P.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function y(P,T,F,Q,ce=!1){if(P!==null){if(r[P]!==void 0)return r[P];Te("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let te=T;if(T===r.RED&&(F===r.FLOAT&&(te=r.R32F),F===r.HALF_FLOAT&&(te=r.R16F),F===r.UNSIGNED_BYTE&&(te=r.R8)),T===r.RED_INTEGER&&(F===r.UNSIGNED_BYTE&&(te=r.R8UI),F===r.UNSIGNED_SHORT&&(te=r.R16UI),F===r.UNSIGNED_INT&&(te=r.R32UI),F===r.BYTE&&(te=r.R8I),F===r.SHORT&&(te=r.R16I),F===r.INT&&(te=r.R32I)),T===r.RG&&(F===r.FLOAT&&(te=r.RG32F),F===r.HALF_FLOAT&&(te=r.RG16F),F===r.UNSIGNED_BYTE&&(te=r.RG8)),T===r.RG_INTEGER&&(F===r.UNSIGNED_BYTE&&(te=r.RG8UI),F===r.UNSIGNED_SHORT&&(te=r.RG16UI),F===r.UNSIGNED_INT&&(te=r.RG32UI),F===r.BYTE&&(te=r.RG8I),F===r.SHORT&&(te=r.RG16I),F===r.INT&&(te=r.RG32I)),T===r.RGB_INTEGER&&(F===r.UNSIGNED_BYTE&&(te=r.RGB8UI),F===r.UNSIGNED_SHORT&&(te=r.RGB16UI),F===r.UNSIGNED_INT&&(te=r.RGB32UI),F===r.BYTE&&(te=r.RGB8I),F===r.SHORT&&(te=r.RGB16I),F===r.INT&&(te=r.RGB32I)),T===r.RGBA_INTEGER&&(F===r.UNSIGNED_BYTE&&(te=r.RGBA8UI),F===r.UNSIGNED_SHORT&&(te=r.RGBA16UI),F===r.UNSIGNED_INT&&(te=r.RGBA32UI),F===r.BYTE&&(te=r.RGBA8I),F===r.SHORT&&(te=r.RGBA16I),F===r.INT&&(te=r.RGBA32I)),T===r.RGB&&(F===r.UNSIGNED_INT_5_9_9_9_REV&&(te=r.RGB9_E5),F===r.UNSIGNED_INT_10F_11F_11F_REV&&(te=r.R11F_G11F_B10F)),T===r.RGBA){const Re=ce?Gs:rt.getTransfer(Q);F===r.FLOAT&&(te=r.RGBA32F),F===r.HALF_FLOAT&&(te=r.RGBA16F),F===r.UNSIGNED_BYTE&&(te=Re===ut?r.SRGB8_ALPHA8:r.RGBA8),F===r.UNSIGNED_SHORT_4_4_4_4&&(te=r.RGBA4),F===r.UNSIGNED_SHORT_5_5_5_1&&(te=r.RGB5_A1)}return(te===r.R16F||te===r.R32F||te===r.RG16F||te===r.RG32F||te===r.RGBA16F||te===r.RGBA32F)&&e.get("EXT_color_buffer_float"),te}function x(P,T){let F;return P?T===null||T===En||T===Or?F=r.DEPTH24_STENCIL8:T===nn?F=r.DEPTH32F_STENCIL8:T===Br&&(F=r.DEPTH24_STENCIL8,Te("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):T===null||T===En||T===Or?F=r.DEPTH_COMPONENT24:T===nn?F=r.DEPTH_COMPONENT32F:T===Br&&(F=r.DEPTH_COMPONENT16),F}function A(P,T){return m(P)===!0||P.isFramebufferTexture&&P.minFilter!==Mt&&P.minFilter!==pt?Math.log2(Math.max(T.width,T.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?T.mipmaps.length:1}function E(P){const T=P.target;T.removeEventListener("dispose",E),D(T),T.isVideoTexture&&h.delete(T)}function I(P){const T=P.target;T.removeEventListener("dispose",I),C(T)}function D(P){const T=n.get(P);if(T.__webglInit===void 0)return;const F=P.source,Q=f.get(F);if(Q){const ce=Q[T.__cacheKey];ce.usedTimes--,ce.usedTimes===0&&b(P),Object.keys(Q).length===0&&f.delete(F)}n.remove(P)}function b(P){const T=n.get(P);r.deleteTexture(T.__webglTexture);const F=P.source,Q=f.get(F);delete Q[T.__cacheKey],o.memory.textures--}function C(P){const T=n.get(P);if(P.depthTexture&&(P.depthTexture.dispose(),n.remove(P.depthTexture)),P.isWebGLCubeRenderTarget)for(let Q=0;Q<6;Q++){if(Array.isArray(T.__webglFramebuffer[Q]))for(let ce=0;ce<T.__webglFramebuffer[Q].length;ce++)r.deleteFramebuffer(T.__webglFramebuffer[Q][ce]);else r.deleteFramebuffer(T.__webglFramebuffer[Q]);T.__webglDepthbuffer&&r.deleteRenderbuffer(T.__webglDepthbuffer[Q])}else{if(Array.isArray(T.__webglFramebuffer))for(let Q=0;Q<T.__webglFramebuffer.length;Q++)r.deleteFramebuffer(T.__webglFramebuffer[Q]);else r.deleteFramebuffer(T.__webglFramebuffer);if(T.__webglDepthbuffer&&r.deleteRenderbuffer(T.__webglDepthbuffer),T.__webglMultisampledFramebuffer&&r.deleteFramebuffer(T.__webglMultisampledFramebuffer),T.__webglColorRenderbuffer)for(let Q=0;Q<T.__webglColorRenderbuffer.length;Q++)T.__webglColorRenderbuffer[Q]&&r.deleteRenderbuffer(T.__webglColorRenderbuffer[Q]);T.__webglDepthRenderbuffer&&r.deleteRenderbuffer(T.__webglDepthRenderbuffer)}const F=P.textures;for(let Q=0,ce=F.length;Q<ce;Q++){const te=n.get(F[Q]);te.__webglTexture&&(r.deleteTexture(te.__webglTexture),o.memory.textures--),n.remove(F[Q])}n.remove(P)}let B=0;function R(){B=0}function O(){const P=B;return P>=i.maxTextures&&Te("WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+i.maxTextures),B+=1,P}function M(P){const T=[];return T.push(P.wrapS),T.push(P.wrapT),T.push(P.wrapR||0),T.push(P.magFilter),T.push(P.minFilter),T.push(P.anisotropy),T.push(P.internalFormat),T.push(P.format),T.push(P.type),T.push(P.generateMipmaps),T.push(P.premultiplyAlpha),T.push(P.flipY),T.push(P.unpackAlignment),T.push(P.colorSpace),T.join()}function z(P,T){const F=n.get(P);if(P.isVideoTexture&&K(P),P.isRenderTargetTexture===!1&&P.isExternalTexture!==!0&&P.version>0&&F.__version!==P.version){const Q=P.image;if(Q===null)Te("WebGLRenderer: Texture marked for update but no image data found.");else if(Q.complete===!1)Te("WebGLRenderer: Texture marked for update but image is incomplete");else{oe(F,P,T);return}}else P.isExternalTexture&&(F.__webglTexture=P.sourceTexture?P.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,F.__webglTexture,r.TEXTURE0+T)}function X(P,T){const F=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&F.__version!==P.version){oe(F,P,T);return}else P.isExternalTexture&&(F.__webglTexture=P.sourceTexture?P.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,F.__webglTexture,r.TEXTURE0+T)}function H(P,T){const F=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&F.__version!==P.version){oe(F,P,T);return}t.bindTexture(r.TEXTURE_3D,F.__webglTexture,r.TEXTURE0+T)}function re(P,T){const F=n.get(P);if(P.isCubeDepthTexture!==!0&&P.version>0&&F.__version!==P.version){ee(F,P,T);return}t.bindTexture(r.TEXTURE_CUBE_MAP,F.__webglTexture,r.TEXTURE0+T)}const J={[yi]:r.REPEAT,[tn]:r.CLAMP_TO_EDGE,[Nr]:r.MIRRORED_REPEAT},le={[Mt]:r.NEAREST,[Ko]:r.NEAREST_MIPMAP_NEAREST,[Hi]:r.NEAREST_MIPMAP_LINEAR,[pt]:r.LINEAR,[Ur]:r.LINEAR_MIPMAP_NEAREST,[Mn]:r.LINEAR_MIPMAP_LINEAR},W={[Kf]:r.NEVER,[td]:r.ALWAYS,[jf]:r.LESS,[Fa]:r.LEQUAL,[Jf]:r.EQUAL,[za]:r.GEQUAL,[$f]:r.GREATER,[ed]:r.NOTEQUAL};function Z(P,T){if(T.type===nn&&e.has("OES_texture_float_linear")===!1&&(T.magFilter===pt||T.magFilter===Ur||T.magFilter===Hi||T.magFilter===Mn||T.minFilter===pt||T.minFilter===Ur||T.minFilter===Hi||T.minFilter===Mn)&&Te("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(P,r.TEXTURE_WRAP_S,J[T.wrapS]),r.texParameteri(P,r.TEXTURE_WRAP_T,J[T.wrapT]),(P===r.TEXTURE_3D||P===r.TEXTURE_2D_ARRAY)&&r.texParameteri(P,r.TEXTURE_WRAP_R,J[T.wrapR]),r.texParameteri(P,r.TEXTURE_MAG_FILTER,le[T.magFilter]),r.texParameteri(P,r.TEXTURE_MIN_FILTER,le[T.minFilter]),T.compareFunction&&(r.texParameteri(P,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(P,r.TEXTURE_COMPARE_FUNC,W[T.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(T.magFilter===Mt||T.minFilter!==Hi&&T.minFilter!==Mn||T.type===nn&&e.has("OES_texture_float_linear")===!1)return;if(T.anisotropy>1||n.get(T).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");r.texParameterf(P,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(T.anisotropy,i.getMaxAnisotropy())),n.get(T).__currentAnisotropy=T.anisotropy}}}function ge(P,T){let F=!1;P.__webglInit===void 0&&(P.__webglInit=!0,T.addEventListener("dispose",E));const Q=T.source;let ce=f.get(Q);ce===void 0&&(ce={},f.set(Q,ce));const te=M(T);if(te!==P.__cacheKey){ce[te]===void 0&&(ce[te]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,F=!0),ce[te].usedTimes++;const Re=ce[P.__cacheKey];Re!==void 0&&(ce[P.__cacheKey].usedTimes--,Re.usedTimes===0&&b(T)),P.__cacheKey=te,P.__webglTexture=ce[te].texture}return F}function _e(P,T,F){return Math.floor(Math.floor(P/F)/T)}function de(P,T,F,Q){const te=P.updateRanges;if(te.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,T.width,T.height,F,Q,T.data);else{te.sort((fe,Se)=>fe.start-Se.start);let Re=0;for(let fe=1;fe<te.length;fe++){const Se=te[Re],Oe=te[fe],Ue=Se.start+Se.count,Me=_e(Oe.start,T.width,4),it=_e(Se.start,T.width,4);Oe.start<=Ue+1&&Me===it&&_e(Oe.start+Oe.count-1,T.width,4)===Me?Se.count=Math.max(Se.count,Oe.start+Oe.count-Se.start):(++Re,te[Re]=Oe)}te.length=Re+1;const we=r.getParameter(r.UNPACK_ROW_LENGTH),Le=r.getParameter(r.UNPACK_SKIP_PIXELS),Xe=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,T.width);for(let fe=0,Se=te.length;fe<Se;fe++){const Oe=te[fe],Ue=Math.floor(Oe.start/4),Me=Math.ceil(Oe.count/4),it=Ue%T.width,Y=Math.floor(Ue/T.width),Pe=Me,be=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,it),r.pixelStorei(r.UNPACK_SKIP_ROWS,Y),t.texSubImage2D(r.TEXTURE_2D,0,it,Y,Pe,be,F,Q,T.data)}P.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,we),r.pixelStorei(r.UNPACK_SKIP_PIXELS,Le),r.pixelStorei(r.UNPACK_SKIP_ROWS,Xe)}}function oe(P,T,F){let Q=r.TEXTURE_2D;(T.isDataArrayTexture||T.isCompressedArrayTexture)&&(Q=r.TEXTURE_2D_ARRAY),T.isData3DTexture&&(Q=r.TEXTURE_3D);const ce=ge(P,T),te=T.source;t.bindTexture(Q,P.__webglTexture,r.TEXTURE0+F);const Re=n.get(te);if(te.version!==Re.__version||ce===!0){t.activeTexture(r.TEXTURE0+F);const we=rt.getPrimaries(rt.workingColorSpace),Le=T.colorSpace===ri?null:rt.getPrimaries(T.colorSpace),Xe=T.colorSpace===ri||we===Le?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,T.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Xe);let fe=_(T.image,!1,i.maxTextureSize);fe=ie(T,fe);const Se=s.convert(T.format,T.colorSpace),Oe=s.convert(T.type);let Ue=y(T.internalFormat,Se,Oe,T.colorSpace,T.isVideoTexture);Z(Q,T);let Me;const it=T.mipmaps,Y=T.isVideoTexture!==!0,Pe=Re.__version===void 0||ce===!0,be=te.dataReady,De=A(T,fe);if(T.isDepthTexture)Ue=x(T.format===xi,T.type),Pe&&(Y?t.texStorage2D(r.TEXTURE_2D,1,Ue,fe.width,fe.height):t.texImage2D(r.TEXTURE_2D,0,Ue,fe.width,fe.height,0,Se,Oe,null));else if(T.isDataTexture)if(it.length>0){Y&&Pe&&t.texStorage2D(r.TEXTURE_2D,De,Ue,it[0].width,it[0].height);for(let ve=0,me=it.length;ve<me;ve++)Me=it[ve],Y?be&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,Me.width,Me.height,Se,Oe,Me.data):t.texImage2D(r.TEXTURE_2D,ve,Ue,Me.width,Me.height,0,Se,Oe,Me.data);T.generateMipmaps=!1}else Y?(Pe&&t.texStorage2D(r.TEXTURE_2D,De,Ue,fe.width,fe.height),be&&de(T,fe,Se,Oe)):t.texImage2D(r.TEXTURE_2D,0,Ue,fe.width,fe.height,0,Se,Oe,fe.data);else if(T.isCompressedTexture)if(T.isCompressedArrayTexture){Y&&Pe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,De,Ue,it[0].width,it[0].height,fe.depth);for(let ve=0,me=it.length;ve<me;ve++)if(Me=it[ve],T.format!==rn)if(Se!==null)if(Y){if(be)if(T.layerUpdates.size>0){const Ee=Cu(Me.width,Me.height,T.format,T.type);for(const $e of T.layerUpdates){const vt=Me.data.subarray($e*Ee/Me.data.BYTES_PER_ELEMENT,($e+1)*Ee/Me.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,$e,Me.width,Me.height,1,Se,vt)}T.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,0,Me.width,Me.height,fe.depth,Se,Me.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ve,Ue,Me.width,Me.height,fe.depth,0,Me.data,0,0);else Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Y?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,ve,0,0,0,Me.width,Me.height,fe.depth,Se,Oe,Me.data):t.texImage3D(r.TEXTURE_2D_ARRAY,ve,Ue,Me.width,Me.height,fe.depth,0,Se,Oe,Me.data)}else{Y&&Pe&&t.texStorage2D(r.TEXTURE_2D,De,Ue,it[0].width,it[0].height);for(let ve=0,me=it.length;ve<me;ve++)Me=it[ve],T.format!==rn?Se!==null?Y?be&&t.compressedTexSubImage2D(r.TEXTURE_2D,ve,0,0,Me.width,Me.height,Se,Me.data):t.compressedTexImage2D(r.TEXTURE_2D,ve,Ue,Me.width,Me.height,0,Me.data):Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Y?be&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,Me.width,Me.height,Se,Oe,Me.data):t.texImage2D(r.TEXTURE_2D,ve,Ue,Me.width,Me.height,0,Se,Oe,Me.data)}else if(T.isDataArrayTexture)if(Y){if(Pe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,De,Ue,fe.width,fe.height,fe.depth),be)if(T.layerUpdates.size>0){const ve=Cu(fe.width,fe.height,T.format,T.type);for(const me of T.layerUpdates){const Ee=fe.data.subarray(me*ve/fe.data.BYTES_PER_ELEMENT,(me+1)*ve/fe.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,me,fe.width,fe.height,1,Se,Oe,Ee)}T.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,fe.width,fe.height,fe.depth,Se,Oe,fe.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,Ue,fe.width,fe.height,fe.depth,0,Se,Oe,fe.data);else if(T.isData3DTexture)Y?(Pe&&t.texStorage3D(r.TEXTURE_3D,De,Ue,fe.width,fe.height,fe.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,fe.width,fe.height,fe.depth,Se,Oe,fe.data)):t.texImage3D(r.TEXTURE_3D,0,Ue,fe.width,fe.height,fe.depth,0,Se,Oe,fe.data);else if(T.isFramebufferTexture){if(Pe)if(Y)t.texStorage2D(r.TEXTURE_2D,De,Ue,fe.width,fe.height);else{let ve=fe.width,me=fe.height;for(let Ee=0;Ee<De;Ee++)t.texImage2D(r.TEXTURE_2D,Ee,Ue,ve,me,0,Se,Oe,null),ve>>=1,me>>=1}}else if(it.length>0){if(Y&&Pe){const ve=V(it[0]);t.texStorage2D(r.TEXTURE_2D,De,Ue,ve.width,ve.height)}for(let ve=0,me=it.length;ve<me;ve++)Me=it[ve],Y?be&&t.texSubImage2D(r.TEXTURE_2D,ve,0,0,Se,Oe,Me):t.texImage2D(r.TEXTURE_2D,ve,Ue,Se,Oe,Me);T.generateMipmaps=!1}else if(Y){if(Pe){const ve=V(fe);t.texStorage2D(r.TEXTURE_2D,De,Ue,ve.width,ve.height)}be&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Se,Oe,fe)}else t.texImage2D(r.TEXTURE_2D,0,Ue,Se,Oe,fe);m(T)&&p(Q),Re.__version=te.version,T.onUpdate&&T.onUpdate(T)}P.__version=T.version}function ee(P,T,F){if(T.image.length!==6)return;const Q=ge(P,T),ce=T.source;t.bindTexture(r.TEXTURE_CUBE_MAP,P.__webglTexture,r.TEXTURE0+F);const te=n.get(ce);if(ce.version!==te.__version||Q===!0){t.activeTexture(r.TEXTURE0+F);const Re=rt.getPrimaries(rt.workingColorSpace),we=T.colorSpace===ri?null:rt.getPrimaries(T.colorSpace),Le=T.colorSpace===ri||Re===we?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,T.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,T.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);const Xe=T.isCompressedTexture||T.image[0].isCompressedTexture,fe=T.image[0]&&T.image[0].isDataTexture,Se=[];for(let me=0;me<6;me++)!Xe&&!fe?Se[me]=_(T.image[me],!0,i.maxCubemapSize):Se[me]=fe?T.image[me].image:T.image[me],Se[me]=ie(T,Se[me]);const Oe=Se[0],Ue=s.convert(T.format,T.colorSpace),Me=s.convert(T.type),it=y(T.internalFormat,Ue,Me,T.colorSpace),Y=T.isVideoTexture!==!0,Pe=te.__version===void 0||Q===!0,be=ce.dataReady;let De=A(T,Oe);Z(r.TEXTURE_CUBE_MAP,T);let ve;if(Xe){Y&&Pe&&t.texStorage2D(r.TEXTURE_CUBE_MAP,De,it,Oe.width,Oe.height);for(let me=0;me<6;me++){ve=Se[me].mipmaps;for(let Ee=0;Ee<ve.length;Ee++){const $e=ve[Ee];T.format!==rn?Ue!==null?Y?be&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee,0,0,$e.width,$e.height,Ue,$e.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee,it,$e.width,$e.height,0,$e.data):Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee,0,0,$e.width,$e.height,Ue,Me,$e.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee,it,$e.width,$e.height,0,Ue,Me,$e.data)}}}else{if(ve=T.mipmaps,Y&&Pe){ve.length>0&&De++;const me=V(Se[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,De,it,me.width,me.height)}for(let me=0;me<6;me++)if(fe){Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,Se[me].width,Se[me].height,Ue,Me,Se[me].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,it,Se[me].width,Se[me].height,0,Ue,Me,Se[me].data);for(let Ee=0;Ee<ve.length;Ee++){const vt=ve[Ee].image[me].image;Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee+1,0,0,vt.width,vt.height,Ue,Me,vt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee+1,it,vt.width,vt.height,0,Ue,Me,vt.data)}}else{Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,Ue,Me,Se[me]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,it,Ue,Me,Se[me]);for(let Ee=0;Ee<ve.length;Ee++){const $e=ve[Ee];Y?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee+1,0,0,Ue,Me,$e.image[me]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,Ee+1,it,Ue,Me,$e.image[me])}}}m(T)&&p(r.TEXTURE_CUBE_MAP),te.__version=ce.version,T.onUpdate&&T.onUpdate(T)}P.__version=T.version}function pe(P,T,F,Q,ce,te){const Re=s.convert(F.format,F.colorSpace),we=s.convert(F.type),Le=y(F.internalFormat,Re,we,F.colorSpace),Xe=n.get(T),fe=n.get(F);if(fe.__renderTarget=T,!Xe.__hasExternalTextures){const Se=Math.max(1,T.width>>te),Oe=Math.max(1,T.height>>te);ce===r.TEXTURE_3D||ce===r.TEXTURE_2D_ARRAY?t.texImage3D(ce,te,Le,Se,Oe,T.depth,0,Re,we,null):t.texImage2D(ce,te,Le,Se,Oe,0,Re,we,null)}t.bindFramebuffer(r.FRAMEBUFFER,P),G(T)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Q,ce,fe.__webglTexture,0,S(T)):(ce===r.TEXTURE_2D||ce>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&ce<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Q,ce,fe.__webglTexture,te),t.bindFramebuffer(r.FRAMEBUFFER,null)}function ye(P,T,F){if(r.bindRenderbuffer(r.RENDERBUFFER,P),T.depthBuffer){const Q=T.depthTexture,ce=Q&&Q.isDepthTexture?Q.type:null,te=x(T.stencilBuffer,ce),Re=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;G(T)?a.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,S(T),te,T.width,T.height):F?r.renderbufferStorageMultisample(r.RENDERBUFFER,S(T),te,T.width,T.height):r.renderbufferStorage(r.RENDERBUFFER,te,T.width,T.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Re,r.RENDERBUFFER,P)}else{const Q=T.textures;for(let ce=0;ce<Q.length;ce++){const te=Q[ce],Re=s.convert(te.format,te.colorSpace),we=s.convert(te.type),Le=y(te.internalFormat,Re,we,te.colorSpace);G(T)?a.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,S(T),Le,T.width,T.height):F?r.renderbufferStorageMultisample(r.RENDERBUFFER,S(T),Le,T.width,T.height):r.renderbufferStorage(r.RENDERBUFFER,Le,T.width,T.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ae(P,T,F){const Q=T.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,P),!(T.depthTexture&&T.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ce=n.get(T.depthTexture);if(ce.__renderTarget=T,(!ce.__webglTexture||T.depthTexture.image.width!==T.width||T.depthTexture.image.height!==T.height)&&(T.depthTexture.image.width=T.width,T.depthTexture.image.height=T.height,T.depthTexture.needsUpdate=!0),Q){if(ce.__webglInit===void 0&&(ce.__webglInit=!0,T.depthTexture.addEventListener("dispose",E)),ce.__webglTexture===void 0){ce.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,ce.__webglTexture),Z(r.TEXTURE_CUBE_MAP,T.depthTexture);const Xe=s.convert(T.depthTexture.format),fe=s.convert(T.depthTexture.type);let Se;T.depthTexture.format===Yn?Se=r.DEPTH_COMPONENT24:T.depthTexture.format===xi&&(Se=r.DEPTH24_STENCIL8);for(let Oe=0;Oe<6;Oe++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,0,Se,T.width,T.height,0,Xe,fe,null)}}else z(T.depthTexture,0);const te=ce.__webglTexture,Re=S(T),we=Q?r.TEXTURE_CUBE_MAP_POSITIVE_X+F:r.TEXTURE_2D,Le=T.depthTexture.format===xi?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(T.depthTexture.format===Yn)G(T)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Le,we,te,0,Re):r.framebufferTexture2D(r.FRAMEBUFFER,Le,we,te,0);else if(T.depthTexture.format===xi)G(T)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Le,we,te,0,Re):r.framebufferTexture2D(r.FRAMEBUFFER,Le,we,te,0);else throw new Error("Unknown depthTexture format")}function ze(P){const T=n.get(P),F=P.isWebGLCubeRenderTarget===!0;if(T.__boundDepthTexture!==P.depthTexture){const Q=P.depthTexture;if(T.__depthDisposeCallback&&T.__depthDisposeCallback(),Q){const ce=()=>{delete T.__boundDepthTexture,delete T.__depthDisposeCallback,Q.removeEventListener("dispose",ce)};Q.addEventListener("dispose",ce),T.__depthDisposeCallback=ce}T.__boundDepthTexture=Q}if(P.depthTexture&&!T.__autoAllocateDepthBuffer)if(F)for(let Q=0;Q<6;Q++)Ae(T.__webglFramebuffer[Q],P,Q);else{const Q=P.texture.mipmaps;Q&&Q.length>0?Ae(T.__webglFramebuffer[0],P,0):Ae(T.__webglFramebuffer,P,0)}else if(F){T.__webglDepthbuffer=[];for(let Q=0;Q<6;Q++)if(t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer[Q]),T.__webglDepthbuffer[Q]===void 0)T.__webglDepthbuffer[Q]=r.createRenderbuffer(),ye(T.__webglDepthbuffer[Q],P,!1);else{const ce=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,te=T.__webglDepthbuffer[Q];r.bindRenderbuffer(r.RENDERBUFFER,te),r.framebufferRenderbuffer(r.FRAMEBUFFER,ce,r.RENDERBUFFER,te)}}else{const Q=P.texture.mipmaps;if(Q&&Q.length>0?t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,T.__webglFramebuffer),T.__webglDepthbuffer===void 0)T.__webglDepthbuffer=r.createRenderbuffer(),ye(T.__webglDepthbuffer,P,!1);else{const ce=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,te=T.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,te),r.framebufferRenderbuffer(r.FRAMEBUFFER,ce,r.RENDERBUFFER,te)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function je(P,T,F){const Q=n.get(P);T!==void 0&&pe(Q.__webglFramebuffer,P,P.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),F!==void 0&&ze(P)}function He(P){const T=P.texture,F=n.get(P),Q=n.get(T);P.addEventListener("dispose",I);const ce=P.textures,te=P.isWebGLCubeRenderTarget===!0,Re=ce.length>1;if(Re||(Q.__webglTexture===void 0&&(Q.__webglTexture=r.createTexture()),Q.__version=T.version,o.memory.textures++),te){F.__webglFramebuffer=[];for(let we=0;we<6;we++)if(T.mipmaps&&T.mipmaps.length>0){F.__webglFramebuffer[we]=[];for(let Le=0;Le<T.mipmaps.length;Le++)F.__webglFramebuffer[we][Le]=r.createFramebuffer()}else F.__webglFramebuffer[we]=r.createFramebuffer()}else{if(T.mipmaps&&T.mipmaps.length>0){F.__webglFramebuffer=[];for(let we=0;we<T.mipmaps.length;we++)F.__webglFramebuffer[we]=r.createFramebuffer()}else F.__webglFramebuffer=r.createFramebuffer();if(Re)for(let we=0,Le=ce.length;we<Le;we++){const Xe=n.get(ce[we]);Xe.__webglTexture===void 0&&(Xe.__webglTexture=r.createTexture(),o.memory.textures++)}if(P.samples>0&&G(P)===!1){F.__webglMultisampledFramebuffer=r.createFramebuffer(),F.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let we=0;we<ce.length;we++){const Le=ce[we];F.__webglColorRenderbuffer[we]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,F.__webglColorRenderbuffer[we]);const Xe=s.convert(Le.format,Le.colorSpace),fe=s.convert(Le.type),Se=y(Le.internalFormat,Xe,fe,Le.colorSpace,P.isXRRenderTarget===!0),Oe=S(P);r.renderbufferStorageMultisample(r.RENDERBUFFER,Oe,Se,P.width,P.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+we,r.RENDERBUFFER,F.__webglColorRenderbuffer[we])}r.bindRenderbuffer(r.RENDERBUFFER,null),P.depthBuffer&&(F.__webglDepthRenderbuffer=r.createRenderbuffer(),ye(F.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(te){t.bindTexture(r.TEXTURE_CUBE_MAP,Q.__webglTexture),Z(r.TEXTURE_CUBE_MAP,T);for(let we=0;we<6;we++)if(T.mipmaps&&T.mipmaps.length>0)for(let Le=0;Le<T.mipmaps.length;Le++)pe(F.__webglFramebuffer[we][Le],P,T,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+we,Le);else pe(F.__webglFramebuffer[we],P,T,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+we,0);m(T)&&p(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Re){for(let we=0,Le=ce.length;we<Le;we++){const Xe=ce[we],fe=n.get(Xe);let Se=r.TEXTURE_2D;(P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(Se=P.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Se,fe.__webglTexture),Z(Se,Xe),pe(F.__webglFramebuffer,P,Xe,r.COLOR_ATTACHMENT0+we,Se,0),m(Xe)&&p(Se)}t.unbindTexture()}else{let we=r.TEXTURE_2D;if((P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(we=P.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(we,Q.__webglTexture),Z(we,T),T.mipmaps&&T.mipmaps.length>0)for(let Le=0;Le<T.mipmaps.length;Le++)pe(F.__webglFramebuffer[Le],P,T,r.COLOR_ATTACHMENT0,we,Le);else pe(F.__webglFramebuffer,P,T,r.COLOR_ATTACHMENT0,we,0);m(T)&&p(we),t.unbindTexture()}P.depthBuffer&&ze(P)}function w(P){const T=P.textures;for(let F=0,Q=T.length;F<Q;F++){const ce=T[F];if(m(ce)){const te=v(P),Re=n.get(ce).__webglTexture;t.bindTexture(te,Re),p(te),t.unbindTexture()}}}const q=[],k=[];function N(P){if(P.samples>0){if(G(P)===!1){const T=P.textures,F=P.width,Q=P.height;let ce=r.COLOR_BUFFER_BIT;const te=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Re=n.get(P),we=T.length>1;if(we)for(let Xe=0;Xe<T.length;Xe++)t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Xe,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Xe,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Re.__webglMultisampledFramebuffer);const Le=P.texture.mipmaps;Le&&Le.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglFramebuffer);for(let Xe=0;Xe<T.length;Xe++){if(P.resolveDepthBuffer&&(P.depthBuffer&&(ce|=r.DEPTH_BUFFER_BIT),P.stencilBuffer&&P.resolveStencilBuffer&&(ce|=r.STENCIL_BUFFER_BIT)),we){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Re.__webglColorRenderbuffer[Xe]);const fe=n.get(T[Xe]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,fe,0)}r.blitFramebuffer(0,0,F,Q,0,0,F,Q,ce,r.NEAREST),c===!0&&(q.length=0,k.length=0,q.push(r.COLOR_ATTACHMENT0+Xe),P.depthBuffer&&P.resolveDepthBuffer===!1&&(q.push(te),k.push(te),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,k)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,q))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),we)for(let Xe=0;Xe<T.length;Xe++){t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Xe,r.RENDERBUFFER,Re.__webglColorRenderbuffer[Xe]);const fe=n.get(T[Xe]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Xe,r.TEXTURE_2D,fe,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglMultisampledFramebuffer)}else if(P.depthBuffer&&P.resolveDepthBuffer===!1&&c){const T=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[T])}}}function S(P){return Math.min(i.maxSamples,P.samples)}function G(P){const T=n.get(P);return P.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&T.__useRenderToTexture!==!1}function K(P){const T=o.render.frame;h.get(P)!==T&&(h.set(P,T),P.update())}function ie(P,T){const F=P.colorSpace,Q=P.format,ce=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||F!==Xt&&F!==ri&&(rt.getTransfer(F)===ut?(Q!==rn||ce!==ln)&&Te("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",F)),T}function V(P){return typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement?(l.width=P.naturalWidth||P.width,l.height=P.naturalHeight||P.height):typeof VideoFrame<"u"&&P instanceof VideoFrame?(l.width=P.displayWidth,l.height=P.displayHeight):(l.width=P.width,l.height=P.height),l}this.allocateTextureUnit=O,this.resetTextureUnits=R,this.setTexture2D=z,this.setTexture2DArray=X,this.setTexture3D=H,this.setTextureCube=re,this.rebindTextures=je,this.setupRenderTarget=He,this.updateRenderTargetMipmap=w,this.updateMultisampleRenderTarget=N,this.setupDepthRenderbuffer=ze,this.setupFrameBufferTexture=pe,this.useMultisampledRTT=G,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Tm(r,e){function t(n,i=ri){let s;const o=rt.getTransfer(i);if(n===ln)return r.UNSIGNED_BYTE;if(n===Jo)return r.UNSIGNED_SHORT_4_4_4_4;if(n===$o)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Ql)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Kl)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Zl)return r.BYTE;if(n===Yl)return r.SHORT;if(n===Br)return r.UNSIGNED_SHORT;if(n===jo)return r.INT;if(n===En)return r.UNSIGNED_INT;if(n===nn)return r.FLOAT;if(n===Zn)return r.HALF_FLOAT;if(n===jl)return r.ALPHA;if(n===Jl)return r.RGB;if(n===rn)return r.RGBA;if(n===Yn)return r.DEPTH_COMPONENT;if(n===xi)return r.DEPTH_STENCIL;if(n===ea)return r.RED;if(n===Os)return r.RED_INTEGER;if(n===Gi)return r.RG;if(n===ta)return r.RG_INTEGER;if(n===na)return r.RGBA_INTEGER;if(n===Fs||n===zs||n===ks||n===Vs)if(o===ut)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Fs)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===zs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ks)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Vs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Fs)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===zs)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ks)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Vs)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ia||n===ra||n===sa||n===oa)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ia)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ra)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===sa)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===oa)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===aa||n===ca||n===la||n===ha||n===ua||n===fa||n===da)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===aa||n===ca)return o===ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===la)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===ha)return s.COMPRESSED_R11_EAC;if(n===ua)return s.COMPRESSED_SIGNED_R11_EAC;if(n===fa)return s.COMPRESSED_RG11_EAC;if(n===da)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===pa||n===ma||n===ga||n===_a||n===va||n===ya||n===xa||n===Aa||n===ba||n===wa||n===Sa||n===Ma||n===Ea||n===Ta)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===pa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ma)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ga)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===_a)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===va)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ya)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===xa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Aa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ba)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===wa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Sa)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ma)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ea)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ta)return o===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ca||n===Ia||n===Ra)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ca)return o===ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ia)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ra)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Pa||n===Da||n===La||n===Na)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Pa)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Da)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===La)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Na)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Or?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const Kb=`
3996
3996
  void main() {
3997
3997
 
3998
3998
  gl_Position = vec4( position, 1.0 );
@@ -4016,9 +4016,9 @@ void main() {
4016
4016
 
4017
4017
  }
4018
4018
 
4019
- }`;class Jb{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Vh(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Cn({vertexShader:Kb,fragmentShader:jb,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new St(new rr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class $b extends Qn{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",c=1,l=null,h=null,u=null,f=null,d=null,g=null;const _=typeof XRWebGLBinding<"u",m=new Jb,p={},v=t.getContextAttributes();let y=null,x=null;const A=[],E=[],I=new he;let D=null;const b=new kt;b.viewport=new gt;const C=new kt;C.viewport=new gt;const B=[b,C],R=new Fp;let O=null,M=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(oe){let ee=A[oe];return ee===void 0&&(ee=new ac,A[oe]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(oe){let ee=A[oe];return ee===void 0&&(ee=new ac,A[oe]=ee),ee.getGripSpace()},this.getHand=function(oe){let ee=A[oe];return ee===void 0&&(ee=new ac,A[oe]=ee),ee.getHandSpace()};function z(oe){const ee=E.indexOf(oe.inputSource);if(ee===-1)return;const pe=A[ee];pe!==void 0&&(pe.update(oe.inputSource,oe.frame,l||o),pe.dispatchEvent({type:oe.type,data:oe.inputSource}))}function X(){i.removeEventListener("select",z),i.removeEventListener("selectstart",z),i.removeEventListener("selectend",z),i.removeEventListener("squeeze",z),i.removeEventListener("squeezestart",z),i.removeEventListener("squeezeend",z),i.removeEventListener("end",X),i.removeEventListener("inputsourceschange",H);for(let oe=0;oe<A.length;oe++){const ee=E[oe];ee!==null&&(E[oe]=null,A[oe].disconnect(ee))}O=null,M=null,m.reset();for(const oe in p)delete p[oe];e.setRenderTarget(y),d=null,f=null,u=null,i=null,x=null,de.stop(),n.isPresenting=!1,e.setPixelRatio(D),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(oe){s=oe,n.isPresenting===!0&&Te("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(oe){a=oe,n.isPresenting===!0&&Te("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(oe){l=oe},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return u===null&&_&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(oe){if(i=oe,i!==null){if(y=e.getRenderTarget(),i.addEventListener("select",z),i.addEventListener("selectstart",z),i.addEventListener("selectend",z),i.addEventListener("squeeze",z),i.addEventListener("squeezestart",z),i.addEventListener("squeezeend",z),i.addEventListener("end",X),i.addEventListener("inputsourceschange",H),v.xrCompatible!==!0&&await t.makeXRCompatible(),D=e.getPixelRatio(),e.getSize(I),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let pe=null,ye=null,Ae=null;v.depth&&(Ae=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,pe=v.stencil?xi:Yn,ye=v.stencil?Or:En);const ze={colorFormat:t.RGBA8,depthFormat:Ae,scaleFactor:s};u=this.getBinding(),f=u.createProjectionLayer(ze),i.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),x=new vn(f.textureWidth,f.textureHeight,{format:rn,type:ln,depthTexture:new ds(f.textureWidth,f.textureHeight,ye,void 0,void 0,void 0,void 0,void 0,void 0,pe),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const pe={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,pe),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),x=new vn(d.framebufferWidth,d.framebufferHeight,{format:rn,type:ln,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await i.requestReferenceSpace(a),de.setContext(i),de.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function H(oe){for(let ee=0;ee<oe.removed.length;ee++){const pe=oe.removed[ee],ye=E.indexOf(pe);ye>=0&&(E[ye]=null,A[ye].disconnect(pe))}for(let ee=0;ee<oe.added.length;ee++){const pe=oe.added[ee];let ye=E.indexOf(pe);if(ye===-1){for(let ze=0;ze<A.length;ze++)if(ze>=E.length){E.push(pe),ye=ze;break}else if(E[ze]===null){E[ze]=pe,ye=ze;break}if(ye===-1)break}const Ae=A[ye];Ae&&Ae.connect(pe)}}const re=new U,$=new U;function le(oe,ee,pe){re.setFromMatrixPosition(ee.matrixWorld),$.setFromMatrixPosition(pe.matrixWorld);const ye=re.distanceTo($),Ae=ee.projectionMatrix.elements,ze=pe.projectionMatrix.elements,je=Ae[14]/(Ae[10]-1),He=Ae[14]/(Ae[10]+1),w=(Ae[9]+1)/Ae[5],q=(Ae[9]-1)/Ae[5],k=(Ae[8]-1)/Ae[0],N=(ze[8]+1)/ze[0],S=je*k,G=je*N,K=ye/(-k+N),ie=K*-k;if(ee.matrixWorld.decompose(oe.position,oe.quaternion,oe.scale),oe.translateX(ie),oe.translateZ(K),oe.matrixWorld.compose(oe.position,oe.quaternion,oe.scale),oe.matrixWorldInverse.copy(oe.matrixWorld).invert(),Ae[10]===-1)oe.projectionMatrix.copy(ee.projectionMatrix),oe.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{const V=je+K,P=He+K,T=S-ie,F=G+(ye-ie),Q=w*He/P*V,ce=q*He/P*V;oe.projectionMatrix.makePerspective(T,F,Q,ce,V,P),oe.projectionMatrixInverse.copy(oe.projectionMatrix).invert()}}function W(oe,ee){ee===null?oe.matrixWorld.copy(oe.matrix):oe.matrixWorld.multiplyMatrices(ee.matrixWorld,oe.matrix),oe.matrixWorldInverse.copy(oe.matrixWorld).invert()}this.updateCamera=function(oe){if(i===null)return;let ee=oe.near,pe=oe.far;m.texture!==null&&(m.depthNear>0&&(ee=m.depthNear),m.depthFar>0&&(pe=m.depthFar)),R.near=C.near=b.near=ee,R.far=C.far=b.far=pe,(O!==R.near||M!==R.far)&&(i.updateRenderState({depthNear:R.near,depthFar:R.far}),O=R.near,M=R.far),R.layers.mask=oe.layers.mask|6,b.layers.mask=R.layers.mask&3,C.layers.mask=R.layers.mask&5;const ye=oe.parent,Ae=R.cameras;W(R,ye);for(let ze=0;ze<Ae.length;ze++)W(Ae[ze],ye);Ae.length===2?le(R,b,C):R.projectionMatrix.copy(b.projectionMatrix),Z(oe,R,ye)};function Z(oe,ee,pe){pe===null?oe.matrix.copy(ee.matrixWorld):(oe.matrix.copy(pe.matrixWorld),oe.matrix.invert(),oe.matrix.multiply(ee.matrixWorld)),oe.matrix.decompose(oe.position,oe.quaternion,oe.scale),oe.updateMatrixWorld(!0),oe.projectionMatrix.copy(ee.projectionMatrix),oe.projectionMatrixInverse.copy(ee.projectionMatrixInverse),oe.isPerspectiveCamera&&(oe.fov=Wr*2*Math.atan(1/oe.projectionMatrix.elements[5]),oe.zoom=1)}this.getCamera=function(){return R},this.getFoveation=function(){if(!(f===null&&d===null))return c},this.setFoveation=function(oe){c=oe,f!==null&&(f.fixedFoveation=oe),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=oe)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(R)},this.getCameraTexture=function(oe){return p[oe]};let ge=null;function _e(oe,ee){if(h=ee.getViewerPose(l||o),g=ee,h!==null){const pe=h.views;d!==null&&(e.setRenderTargetFramebuffer(x,d.framebuffer),e.setRenderTarget(x));let ye=!1;pe.length!==R.cameras.length&&(R.cameras.length=0,ye=!0);for(let He=0;He<pe.length;He++){const w=pe[He];let q=null;if(d!==null)q=d.getViewport(w);else{const N=u.getViewSubImage(f,w);q=N.viewport,He===0&&(e.setRenderTargetTextures(x,N.colorTexture,N.depthStencilTexture),e.setRenderTarget(x))}let k=B[He];k===void 0&&(k=new kt,k.layers.enable(He),k.viewport=new gt,B[He]=k),k.matrix.fromArray(w.transform.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale),k.projectionMatrix.fromArray(w.projectionMatrix),k.projectionMatrixInverse.copy(k.projectionMatrix).invert(),k.viewport.set(q.x,q.y,q.width,q.height),He===0&&(R.matrix.copy(k.matrix),R.matrix.decompose(R.position,R.quaternion,R.scale)),ye===!0&&R.cameras.push(k)}const Ae=i.enabledFeatures;if(Ae&&Ae.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){u=n.getBinding();const He=u.getDepthInformation(pe[0]);He&&He.isValid&&He.texture&&m.init(He,i.renderState)}if(Ae&&Ae.includes("camera-access")&&_){e.state.unbindTexture(),u=n.getBinding();for(let He=0;He<pe.length;He++){const w=pe[He].camera;if(w){let q=p[w];q||(q=new Vh,p[w]=q);const k=u.getCameraImage(w);q.sourceTexture=k}}}}for(let pe=0;pe<A.length;pe++){const ye=E[pe],Ae=A[pe];ye!==null&&Ae!==void 0&&Ae.update(ye,ee,l||o)}ge&&ge(oe,ee),ee.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ee}),g=null}const de=new em;de.setAnimationLoop(_e),this.setAnimationLoop=function(oe){ge=oe},this.dispose=function(){}}}const xr=new Zt,ew=new We;function tw(r,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,wd(r)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function i(m,p,v,y,x){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),f(m,p),p.isMeshPhysicalMaterial&&d(m,p,x)):p.isMeshMatcapMaterial?(s(m,p),g(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),_(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(o(m,p),p.isLineDashedMaterial&&a(m,p)):p.isPointsMaterial?c(m,p,v,y):p.isSpriteMaterial?l(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===en&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===en&&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,x=v.envMapRotation;y&&(m.envMap.value=y,xr.copy(x),xr.x*=-1,xr.y*=-1,xr.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(xr.y*=-1,xr.z*=-1),m.envMapRotation.value.setFromMatrix4(ew.makeRotationFromEuler(xr)),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 c(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 l(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 f(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 d(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===en&&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 g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function _(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:n,refreshMaterialUniforms:i}}function nw(r,e,t,n){let i={},s={},o=[];const a=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function c(v,y){const x=y.program;n.uniformBlockBinding(v,x)}function l(v,y){let x=i[v.id];x===void 0&&(g(v),x=h(v),i[v.id]=x,v.addEventListener("dispose",m));const A=y.program;n.updateUBOMapping(v,A);const E=e.render.frame;s[v.id]!==E&&(f(v),s[v.id]=E)}function h(v){const y=u();v.__bindingPointIndex=y;const x=r.createBuffer(),A=v.__size,E=v.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,A,E),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,x),x}function u(){for(let v=0;v<a;v++)if(o.indexOf(v)===-1)return o.push(v),v;return Ge("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(v){const y=i[v.id],x=v.uniforms,A=v.__cache;r.bindBuffer(r.UNIFORM_BUFFER,y);for(let E=0,I=x.length;E<I;E++){const D=Array.isArray(x[E])?x[E]:[x[E]];for(let b=0,C=D.length;b<C;b++){const B=D[b];if(d(B,E,b,A)===!0){const R=B.__offset,O=Array.isArray(B.value)?B.value:[B.value];let M=0;for(let z=0;z<O.length;z++){const X=O[z],H=_(X);typeof X=="number"||typeof X=="boolean"?(B.__data[0]=X,r.bufferSubData(r.UNIFORM_BUFFER,R+M,B.__data)):X.isMatrix3?(B.__data[0]=X.elements[0],B.__data[1]=X.elements[1],B.__data[2]=X.elements[2],B.__data[3]=0,B.__data[4]=X.elements[3],B.__data[5]=X.elements[4],B.__data[6]=X.elements[5],B.__data[7]=0,B.__data[8]=X.elements[6],B.__data[9]=X.elements[7],B.__data[10]=X.elements[8],B.__data[11]=0):(X.toArray(B.__data,M),M+=H.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,R,B.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function d(v,y,x,A){const E=v.value,I=y+"_"+x;if(A[I]===void 0)return typeof E=="number"||typeof E=="boolean"?A[I]=E:A[I]=E.clone(),!0;{const D=A[I];if(typeof E=="number"||typeof E=="boolean"){if(D!==E)return A[I]=E,!0}else if(D.equals(E)===!1)return D.copy(E),!0}return!1}function g(v){const y=v.uniforms;let x=0;const A=16;for(let I=0,D=y.length;I<D;I++){const b=Array.isArray(y[I])?y[I]:[y[I]];for(let C=0,B=b.length;C<B;C++){const R=b[C],O=Array.isArray(R.value)?R.value:[R.value];for(let M=0,z=O.length;M<z;M++){const X=O[M],H=_(X),re=x%A,$=re%H.boundary,le=re+$;x+=$,le!==0&&A-le<H.storage&&(x+=A-le),R.__data=new Float32Array(H.storage/Float32Array.BYTES_PER_ELEMENT),R.__offset=x,x+=H.storage}}}const E=x%A;return E>0&&(x+=A-E),v.__size=x,v.__cache={},this}function _(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?Te("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Te("WebGLRenderer: Unsupported uniform value type.",v),y}function m(v){const y=v.target;y.removeEventListener("dispose",m);const x=o.indexOf(y.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(i[y.id]),delete i[y.id],delete s[y.id]}function p(){for(const v in i)r.deleteBuffer(i[v]);o=[],i={},s={}}return{bind:c,update:l,dispose:p}}const iw=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let ei=null;function rw(){return ei===null&&(ei=new Fn(iw,16,16,Gi,Zn),ei.name="DFG_LUT",ei.minFilter=pt,ei.magFilter=pt,ei.wrapS=tn,ei.wrapT=tn,ei.generateMipmaps=!1,ei.needsUpdate=!0),ei}class Cm{constructor(e={}){const{canvas:t=rd(),context:n=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:f=!1,outputBufferType:d=ln}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=o;const _=d,m=new Set([na,ta,Os]),p=new Set([ln,En,Br,Or,Jo,$o]),v=new Uint32Array(4),y=new Int32Array(4);let x=null,A=null;const E=[],I=[];let D=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Nn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const b=this;let C=!1;this._outputColorSpace=Tt;let B=0,R=0,O=null,M=-1,z=null;const X=new gt,H=new gt;let re=null;const $=new xe(0);let le=0,W=t.width,Z=t.height,ge=1,_e=null,de=null;const oe=new gt(0,0,W,Z),ee=new gt(0,0,W,Z);let pe=!1;const ye=new fs;let Ae=!1,ze=!1;const je=new We,He=new U,w=new gt,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let k=!1;function N(){return O===null?ge:1}let S=n;function G(L,j){return t.getContext(L,j)}try{const L={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Yt}`),t.addEventListener("webglcontextlost",$e,!1),t.addEventListener("webglcontextrestored",vt,!1),t.addEventListener("webglcontextcreationerror",ft,!1),S===null){const j="webgl2";if(S=G(j,L),S===null)throw G(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(L){throw Ge("WebGLRenderer: "+L.message),L}let K,ie,V,P,T,F,Q,ce,te,Re,we,Le,Xe,fe,Se,Oe,Ue,Me,it,Y,Pe,be,De,ve;function me(){K=new s1(S),K.init(),be=new Tm(S,K),ie=new KA(S,K,e,be),V=new Yb(S,K),ie.reversedDepthBuffer&&f&&V.buffers.depth.setReversed(!0),P=new c1(S),T=new Lb,F=new Qb(S,K,V,T,ie,be,P),Q=new JA(b),ce=new r1(b),te=new Xy(S),De=new YA(S,te),Re=new o1(S,te,P,De),we=new h1(S,Re,te,P),it=new l1(S,ie,F),Oe=new jA(T),Le=new Db(b,Q,ce,K,ie,De,Oe),Xe=new tw(b,T),fe=new Ub,Se=new Vb(K),Me=new ZA(b,Q,ce,V,we,g,c),Ue=new Xb(b,we,ie),ve=new nw(S,P,ie,V),Y=new QA(S,K,P),Pe=new a1(S,K,P),P.programs=Le.programs,b.capabilities=ie,b.extensions=K,b.properties=T,b.renderLists=fe,b.shadowMap=Ue,b.state=V,b.info=P}me(),_!==ln&&(D=new f1(_,t.width,t.height,i,s));const Ee=new $b(b,S);this.xr=Ee,this.getContext=function(){return S},this.getContextAttributes=function(){return S.getContextAttributes()},this.forceContextLoss=function(){const L=K.get("WEBGL_lose_context");L&&L.loseContext()},this.forceContextRestore=function(){const L=K.get("WEBGL_lose_context");L&&L.restoreContext()},this.getPixelRatio=function(){return ge},this.setPixelRatio=function(L){L!==void 0&&(ge=L,this.setSize(W,Z,!1))},this.getSize=function(L){return L.set(W,Z)},this.setSize=function(L,j,ae=!0){if(Ee.isPresenting){Te("WebGLRenderer: Can't change size while VR device is presenting.");return}W=L,Z=j,t.width=Math.floor(L*ge),t.height=Math.floor(j*ge),ae===!0&&(t.style.width=L+"px",t.style.height=j+"px"),D!==null&&D.setSize(t.width,t.height),this.setViewport(0,0,L,j)},this.getDrawingBufferSize=function(L){return L.set(W*ge,Z*ge).floor()},this.setDrawingBufferSize=function(L,j,ae){W=L,Z=j,ge=ae,t.width=Math.floor(L*ae),t.height=Math.floor(j*ae),this.setViewport(0,0,L,j)},this.setEffects=function(L){if(_===ln){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(L){for(let j=0;j<L.length;j++)if(L[j].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}D.setEffects(L||[])},this.getCurrentViewport=function(L){return L.copy(X)},this.getViewport=function(L){return L.copy(oe)},this.setViewport=function(L,j,ae,se){L.isVector4?oe.set(L.x,L.y,L.z,L.w):oe.set(L,j,ae,se),V.viewport(X.copy(oe).multiplyScalar(ge).round())},this.getScissor=function(L){return L.copy(ee)},this.setScissor=function(L,j,ae,se){L.isVector4?ee.set(L.x,L.y,L.z,L.w):ee.set(L,j,ae,se),V.scissor(H.copy(ee).multiplyScalar(ge).round())},this.getScissorTest=function(){return pe},this.setScissorTest=function(L){V.setScissorTest(pe=L)},this.setOpaqueSort=function(L){_e=L},this.setTransparentSort=function(L){de=L},this.getClearColor=function(L){return L.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor(...arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha(...arguments)},this.clear=function(L=!0,j=!0,ae=!0){let se=0;if(L){let ne=!1;if(O!==null){const Ie=O.texture.format;ne=m.has(Ie)}if(ne){const Ie=O.texture.type,Fe=p.has(Ie),Ne=Me.getClearColor(),Ve=Me.getClearAlpha(),qe=Ne.r,Je=Ne.g,Ze=Ne.b;Fe?(v[0]=qe,v[1]=Je,v[2]=Ze,v[3]=Ve,S.clearBufferuiv(S.COLOR,0,v)):(y[0]=qe,y[1]=Je,y[2]=Ze,y[3]=Ve,S.clearBufferiv(S.COLOR,0,y))}else se|=S.COLOR_BUFFER_BIT}j&&(se|=S.DEPTH_BUFFER_BIT),ae&&(se|=S.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),S.clear(se)},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",$e,!1),t.removeEventListener("webglcontextrestored",vt,!1),t.removeEventListener("webglcontextcreationerror",ft,!1),Me.dispose(),fe.dispose(),Se.dispose(),T.dispose(),Q.dispose(),ce.dispose(),we.dispose(),De.dispose(),ve.dispose(),Le.dispose(),Ee.dispose(),Ee.removeEventListener("sessionstart",Jg),Ee.removeEventListener("sessionend",$g),Rr.stop()};function $e(L){L.preventDefault(),qs("WebGLRenderer: Context Lost."),C=!0}function vt(){qs("WebGLRenderer: Context Restored."),C=!1;const L=P.autoReset,j=Ue.enabled,ae=Ue.autoUpdate,se=Ue.needsUpdate,ne=Ue.type;me(),P.autoReset=L,Ue.enabled=j,Ue.autoUpdate=ae,Ue.needsUpdate=se,Ue.type=ne}function ft(L){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",L.statusMessage)}function ii(L){const j=L.target;j.removeEventListener("dispose",ii),gi(j)}function gi(L){TT(L),T.remove(L)}function TT(L){const j=T.get(L).programs;j!==void 0&&(j.forEach(function(ae){Le.releaseProgram(ae)}),L.isShaderMaterial&&Le.releaseShaderCache(L))}this.renderBufferDirect=function(L,j,ae,se,ne,Ie){j===null&&(j=q);const Fe=ne.isMesh&&ne.matrixWorld.determinant()<0,Ne=IT(L,j,ae,se,ne);V.setMaterial(se,Fe);let Ve=ae.index,qe=1;if(se.wireframe===!0){if(Ve=Re.getWireframeAttribute(ae),Ve===void 0)return;qe=2}const Je=ae.drawRange,Ze=ae.attributes.position;let st=Je.start*qe,mt=(Je.start+Je.count)*qe;Ie!==null&&(st=Math.max(st,Ie.start*qe),mt=Math.min(mt,(Ie.start+Ie.count)*qe)),Ve!==null?(st=Math.max(st,0),mt=Math.min(mt,Ve.count)):Ze!=null&&(st=Math.max(st,0),mt=Math.min(mt,Ze.count));const It=mt-st;if(It<0||It===1/0)return;De.setup(ne,se,Ne,ae,Ve);let Rt,_t=Y;if(Ve!==null&&(Rt=te.get(Ve),_t=Pe,_t.setIndex(Rt)),ne.isMesh)se.wireframe===!0?(V.setLineWidth(se.wireframeLinewidth*N()),_t.setMode(S.LINES)):_t.setMode(S.TRIANGLES);else if(ne.isLine){let Ye=se.linewidth;Ye===void 0&&(Ye=1),V.setLineWidth(Ye*N()),ne.isLineSegments?_t.setMode(S.LINES):ne.isLineLoop?_t.setMode(S.LINE_LOOP):_t.setMode(S.LINE_STRIP)}else ne.isPoints?_t.setMode(S.POINTS):ne.isSprite&&_t.setMode(S.TRIANGLES);if(ne.isBatchedMesh)if(ne._multiDrawInstances!==null)Gr("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),_t.renderMultiDrawInstances(ne._multiDrawStarts,ne._multiDrawCounts,ne._multiDrawCount,ne._multiDrawInstances);else if(K.get("WEBGL_multi_draw"))_t.renderMultiDraw(ne._multiDrawStarts,ne._multiDrawCounts,ne._multiDrawCount);else{const Ye=ne._multiDrawStarts,dt=ne._multiDrawCounts,ht=ne._multiDrawCount,bn=Ve?te.get(Ve).bytesPerElement:1,Ds=T.get(se).currentProgram.getUniforms();for(let wn=0;wn<ht;wn++)Ds.setValue(S,"_gl_DrawID",wn),_t.render(Ye[wn]/bn,dt[wn])}else if(ne.isInstancedMesh)_t.renderInstances(st,It,ne.count);else if(ae.isInstancedBufferGeometry){const Ye=ae._maxInstanceCount!==void 0?ae._maxInstanceCount:1/0,dt=Math.min(ae.instanceCount,Ye);_t.renderInstances(st,It,dt)}else _t.render(st,It)};function jg(L,j,ae){L.transparent===!0&&L.side===Sn&&L.forceSinglePass===!1?(L.side=en,L.needsUpdate=!0,Ul(L,j,ae),L.side=Wn,L.needsUpdate=!0,Ul(L,j,ae),L.side=Sn):Ul(L,j,ae)}this.compile=function(L,j,ae=null){ae===null&&(ae=L),A=Se.get(ae),A.init(j),I.push(A),ae.traverseVisible(function(ne){ne.isLight&&ne.layers.test(j.layers)&&(A.pushLight(ne),ne.castShadow&&A.pushShadow(ne))}),L!==ae&&L.traverseVisible(function(ne){ne.isLight&&ne.layers.test(j.layers)&&(A.pushLight(ne),ne.castShadow&&A.pushShadow(ne))}),A.setupLights();const se=new Set;return L.traverse(function(ne){if(!(ne.isMesh||ne.isPoints||ne.isLine||ne.isSprite))return;const Ie=ne.material;if(Ie)if(Array.isArray(Ie))for(let Fe=0;Fe<Ie.length;Fe++){const Ne=Ie[Fe];jg(Ne,ae,ne),se.add(Ne)}else jg(Ie,ae,ne),se.add(Ie)}),A=I.pop(),se},this.compileAsync=function(L,j,ae=null){const se=this.compile(L,j,ae);return new Promise(ne=>{function Ie(){if(se.forEach(function(Fe){T.get(Fe).currentProgram.isReady()&&se.delete(Fe)}),se.size===0){ne(L);return}setTimeout(Ie,10)}K.get("KHR_parallel_shader_compile")!==null?Ie():setTimeout(Ie,10)})};let _f=null;function CT(L){_f&&_f(L)}function Jg(){Rr.stop()}function $g(){Rr.start()}const Rr=new em;Rr.setAnimationLoop(CT),typeof self<"u"&&Rr.setContext(self),this.setAnimationLoop=function(L){_f=L,Ee.setAnimationLoop(L),L===null?Rr.stop():Rr.start()},Ee.addEventListener("sessionstart",Jg),Ee.addEventListener("sessionend",$g),this.render=function(L,j){if(j!==void 0&&j.isCamera!==!0){Ge("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;const ae=Ee.enabled===!0&&Ee.isPresenting===!0,se=D!==null&&(O===null||ae)&&D.begin(b,O);if(L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),Ee.enabled===!0&&Ee.isPresenting===!0&&(D===null||D.isCompositing()===!1)&&(Ee.cameraAutoUpdate===!0&&Ee.updateCamera(j),j=Ee.getCamera()),L.isScene===!0&&L.onBeforeRender(b,L,j,O),A=Se.get(L,I.length),A.init(j),I.push(A),je.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),ye.setFromProjectionMatrix(je,gn,j.reversedDepth),ze=this.localClippingEnabled,Ae=Oe.init(this.clippingPlanes,ze),x=fe.get(L,E.length),x.init(),E.push(x),Ee.enabled===!0&&Ee.isPresenting===!0){const Fe=b.xr.getDepthSensingMesh();Fe!==null&&vf(Fe,j,-1/0,b.sortObjects)}vf(L,j,0,b.sortObjects),x.finish(),b.sortObjects===!0&&x.sort(_e,de),k=Ee.enabled===!1||Ee.isPresenting===!1||Ee.hasDepthSensing()===!1,k&&Me.addToRenderList(x,L),this.info.render.frame++,Ae===!0&&Oe.beginShadows();const ne=A.state.shadowsArray;if(Ue.render(ne,L,j),Ae===!0&&Oe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(se&&D.hasRenderPass())===!1){const Fe=x.opaque,Ne=x.transmissive;if(A.setupLights(),j.isArrayCamera){const Ve=j.cameras;if(Ne.length>0)for(let qe=0,Je=Ve.length;qe<Je;qe++){const Ze=Ve[qe];t0(Fe,Ne,L,Ze)}k&&Me.render(L);for(let qe=0,Je=Ve.length;qe<Je;qe++){const Ze=Ve[qe];e0(x,L,Ze,Ze.viewport)}}else Ne.length>0&&t0(Fe,Ne,L,j),k&&Me.render(L),e0(x,L,j)}O!==null&&R===0&&(F.updateMultisampleRenderTarget(O),F.updateRenderTargetMipmap(O)),se&&D.end(b),L.isScene===!0&&L.onAfterRender(b,L,j),De.resetDefaultState(),M=-1,z=null,I.pop(),I.length>0?(A=I[I.length-1],Ae===!0&&Oe.setGlobalState(b.clippingPlanes,A.state.camera)):A=null,E.pop(),E.length>0?x=E[E.length-1]:x=null};function vf(L,j,ae,se){if(L.visible===!1)return;if(L.layers.test(j.layers)){if(L.isGroup)ae=L.renderOrder;else if(L.isLOD)L.autoUpdate===!0&&L.update(j);else if(L.isLight)A.pushLight(L),L.castShadow&&A.pushShadow(L);else if(L.isSprite){if(!L.frustumCulled||ye.intersectsSprite(L)){se&&w.setFromMatrixPosition(L.matrixWorld).applyMatrix4(je);const Fe=we.update(L),Ne=L.material;Ne.visible&&x.push(L,Fe,Ne,ae,w.z,null)}}else if((L.isMesh||L.isLine||L.isPoints)&&(!L.frustumCulled||ye.intersectsObject(L))){const Fe=we.update(L),Ne=L.material;if(se&&(L.boundingSphere!==void 0?(L.boundingSphere===null&&L.computeBoundingSphere(),w.copy(L.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),w.copy(Fe.boundingSphere.center)),w.applyMatrix4(L.matrixWorld).applyMatrix4(je)),Array.isArray(Ne)){const Ve=Fe.groups;for(let qe=0,Je=Ve.length;qe<Je;qe++){const Ze=Ve[qe],st=Ne[Ze.materialIndex];st&&st.visible&&x.push(L,Fe,st,ae,w.z,Ze)}}else Ne.visible&&x.push(L,Fe,Ne,ae,w.z,null)}}const Ie=L.children;for(let Fe=0,Ne=Ie.length;Fe<Ne;Fe++)vf(Ie[Fe],j,ae,se)}function e0(L,j,ae,se){const{opaque:ne,transmissive:Ie,transparent:Fe}=L;A.setupLightsView(ae),Ae===!0&&Oe.setGlobalState(b.clippingPlanes,ae),se&&V.viewport(X.copy(se)),ne.length>0&&Nl(ne,j,ae),Ie.length>0&&Nl(Ie,j,ae),Fe.length>0&&Nl(Fe,j,ae),V.buffers.depth.setTest(!0),V.buffers.depth.setMask(!0),V.buffers.color.setMask(!0),V.setPolygonOffset(!1)}function t0(L,j,ae,se){if((ae.isScene===!0?ae.overrideMaterial:null)!==null)return;if(A.state.transmissionRenderTarget[se.id]===void 0){const st=K.has("EXT_color_buffer_half_float")||K.has("EXT_color_buffer_float");A.state.transmissionRenderTarget[se.id]=new vn(1,1,{generateMipmaps:!0,type:st?Zn:ln,minFilter:Mn,samples:ie.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:rt.workingColorSpace})}const Ie=A.state.transmissionRenderTarget[se.id],Fe=se.viewport||X;Ie.setSize(Fe.z*b.transmissionResolutionScale,Fe.w*b.transmissionResolutionScale);const Ne=b.getRenderTarget(),Ve=b.getActiveCubeFace(),qe=b.getActiveMipmapLevel();b.setRenderTarget(Ie),b.getClearColor($),le=b.getClearAlpha(),le<1&&b.setClearColor(16777215,.5),b.clear(),k&&Me.render(ae);const Je=b.toneMapping;b.toneMapping=Nn;const Ze=se.viewport;if(se.viewport!==void 0&&(se.viewport=void 0),A.setupLightsView(se),Ae===!0&&Oe.setGlobalState(b.clippingPlanes,se),Nl(L,ae,se),F.updateMultisampleRenderTarget(Ie),F.updateRenderTargetMipmap(Ie),K.has("WEBGL_multisampled_render_to_texture")===!1){let st=!1;for(let mt=0,It=j.length;mt<It;mt++){const Rt=j[mt],{object:_t,geometry:Ye,material:dt,group:ht}=Rt;if(dt.side===Sn&&_t.layers.test(se.layers)){const bn=dt.side;dt.side=en,dt.needsUpdate=!0,n0(_t,ae,se,Ye,dt,ht),dt.side=bn,dt.needsUpdate=!0,st=!0}}st===!0&&(F.updateMultisampleRenderTarget(Ie),F.updateRenderTargetMipmap(Ie))}b.setRenderTarget(Ne,Ve,qe),b.setClearColor($,le),Ze!==void 0&&(se.viewport=Ze),b.toneMapping=Je}function Nl(L,j,ae){const se=j.isScene===!0?j.overrideMaterial:null;for(let ne=0,Ie=L.length;ne<Ie;ne++){const Fe=L[ne],{object:Ne,geometry:Ve,group:qe}=Fe;let Je=Fe.material;Je.allowOverride===!0&&se!==null&&(Je=se),Ne.layers.test(ae.layers)&&n0(Ne,j,ae,Ve,Je,qe)}}function n0(L,j,ae,se,ne,Ie){L.onBeforeRender(b,j,ae,se,ne,Ie),L.modelViewMatrix.multiplyMatrices(ae.matrixWorldInverse,L.matrixWorld),L.normalMatrix.getNormalMatrix(L.modelViewMatrix),ne.onBeforeRender(b,j,ae,se,L,Ie),ne.transparent===!0&&ne.side===Sn&&ne.forceSinglePass===!1?(ne.side=en,ne.needsUpdate=!0,b.renderBufferDirect(ae,j,se,ne,L,Ie),ne.side=Wn,ne.needsUpdate=!0,b.renderBufferDirect(ae,j,se,ne,L,Ie),ne.side=Sn):b.renderBufferDirect(ae,j,se,ne,L,Ie),L.onAfterRender(b,j,ae,se,ne,Ie)}function Ul(L,j,ae){j.isScene!==!0&&(j=q);const se=T.get(L),ne=A.state.lights,Ie=A.state.shadowsArray,Fe=ne.state.version,Ne=Le.getParameters(L,ne.state,Ie,j,ae),Ve=Le.getProgramCacheKey(Ne);let qe=se.programs;se.environment=L.isMeshStandardMaterial?j.environment:null,se.fog=j.fog,se.envMap=(L.isMeshStandardMaterial?ce:Q).get(L.envMap||se.environment),se.envMapRotation=se.environment!==null&&L.envMap===null?j.environmentRotation:L.envMapRotation,qe===void 0&&(L.addEventListener("dispose",ii),qe=new Map,se.programs=qe);let Je=qe.get(Ve);if(Je!==void 0){if(se.currentProgram===Je&&se.lightsStateVersion===Fe)return r0(L,Ne),Je}else Ne.uniforms=Le.getUniforms(L),L.onBeforeCompile(Ne,b),Je=Le.acquireProgram(Ne,Ve),qe.set(Ve,Je),se.uniforms=Ne.uniforms;const Ze=se.uniforms;return(!L.isShaderMaterial&&!L.isRawShaderMaterial||L.clipping===!0)&&(Ze.clippingPlanes=Oe.uniform),r0(L,Ne),se.needsLights=PT(L),se.lightsStateVersion=Fe,se.needsLights&&(Ze.ambientLightColor.value=ne.state.ambient,Ze.lightProbe.value=ne.state.probe,Ze.directionalLights.value=ne.state.directional,Ze.directionalLightShadows.value=ne.state.directionalShadow,Ze.spotLights.value=ne.state.spot,Ze.spotLightShadows.value=ne.state.spotShadow,Ze.rectAreaLights.value=ne.state.rectArea,Ze.ltc_1.value=ne.state.rectAreaLTC1,Ze.ltc_2.value=ne.state.rectAreaLTC2,Ze.pointLights.value=ne.state.point,Ze.pointLightShadows.value=ne.state.pointShadow,Ze.hemisphereLights.value=ne.state.hemi,Ze.directionalShadowMap.value=ne.state.directionalShadowMap,Ze.directionalShadowMatrix.value=ne.state.directionalShadowMatrix,Ze.spotShadowMap.value=ne.state.spotShadowMap,Ze.spotLightMatrix.value=ne.state.spotLightMatrix,Ze.spotLightMap.value=ne.state.spotLightMap,Ze.pointShadowMap.value=ne.state.pointShadowMap,Ze.pointShadowMatrix.value=ne.state.pointShadowMatrix),se.currentProgram=Je,se.uniformsList=null,Je}function i0(L){if(L.uniformsList===null){const j=L.currentProgram.getUniforms();L.uniformsList=hl.seqWithValue(j.seq,L.uniforms)}return L.uniformsList}function r0(L,j){const ae=T.get(L);ae.outputColorSpace=j.outputColorSpace,ae.batching=j.batching,ae.batchingColor=j.batchingColor,ae.instancing=j.instancing,ae.instancingColor=j.instancingColor,ae.instancingMorph=j.instancingMorph,ae.skinning=j.skinning,ae.morphTargets=j.morphTargets,ae.morphNormals=j.morphNormals,ae.morphColors=j.morphColors,ae.morphTargetsCount=j.morphTargetsCount,ae.numClippingPlanes=j.numClippingPlanes,ae.numIntersection=j.numClipIntersection,ae.vertexAlphas=j.vertexAlphas,ae.vertexTangents=j.vertexTangents,ae.toneMapping=j.toneMapping}function IT(L,j,ae,se,ne){j.isScene!==!0&&(j=q),F.resetTextureUnits();const Ie=j.fog,Fe=se.isMeshStandardMaterial?j.environment:null,Ne=O===null?b.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:Xt,Ve=(se.isMeshStandardMaterial?ce:Q).get(se.envMap||Fe),qe=se.vertexColors===!0&&!!ae.attributes.color&&ae.attributes.color.itemSize===4,Je=!!ae.attributes.tangent&&(!!se.normalMap||se.anisotropy>0),Ze=!!ae.morphAttributes.position,st=!!ae.morphAttributes.normal,mt=!!ae.morphAttributes.color;let It=Nn;se.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(It=b.toneMapping);const Rt=ae.morphAttributes.position||ae.morphAttributes.normal||ae.morphAttributes.color,_t=Rt!==void 0?Rt.length:0,Ye=T.get(se),dt=A.state.lights;if(Ae===!0&&(ze===!0||L!==z)){const cn=L===z&&se.id===M;Oe.setState(se,L,cn)}let ht=!1;se.version===Ye.__version?(Ye.needsLights&&Ye.lightsStateVersion!==dt.state.version||Ye.outputColorSpace!==Ne||ne.isBatchedMesh&&Ye.batching===!1||!ne.isBatchedMesh&&Ye.batching===!0||ne.isBatchedMesh&&Ye.batchingColor===!0&&ne.colorTexture===null||ne.isBatchedMesh&&Ye.batchingColor===!1&&ne.colorTexture!==null||ne.isInstancedMesh&&Ye.instancing===!1||!ne.isInstancedMesh&&Ye.instancing===!0||ne.isSkinnedMesh&&Ye.skinning===!1||!ne.isSkinnedMesh&&Ye.skinning===!0||ne.isInstancedMesh&&Ye.instancingColor===!0&&ne.instanceColor===null||ne.isInstancedMesh&&Ye.instancingColor===!1&&ne.instanceColor!==null||ne.isInstancedMesh&&Ye.instancingMorph===!0&&ne.morphTexture===null||ne.isInstancedMesh&&Ye.instancingMorph===!1&&ne.morphTexture!==null||Ye.envMap!==Ve||se.fog===!0&&Ye.fog!==Ie||Ye.numClippingPlanes!==void 0&&(Ye.numClippingPlanes!==Oe.numPlanes||Ye.numIntersection!==Oe.numIntersection)||Ye.vertexAlphas!==qe||Ye.vertexTangents!==Je||Ye.morphTargets!==Ze||Ye.morphNormals!==st||Ye.morphColors!==mt||Ye.toneMapping!==It||Ye.morphTargetsCount!==_t)&&(ht=!0):(ht=!0,Ye.__version=se.version);let bn=Ye.currentProgram;ht===!0&&(bn=Ul(se,j,ne));let Ds=!1,wn=!1,Fo=!1;const yt=bn.getUniforms(),pn=Ye.uniforms;if(V.useProgram(bn.program)&&(Ds=!0,wn=!0,Fo=!0),se.id!==M&&(M=se.id,wn=!0),Ds||z!==L){V.buffers.depth.getReversed()&&L.reversedDepth!==!0&&(L._reversedDepth=!0,L.updateProjectionMatrix()),yt.setValue(S,"projectionMatrix",L.projectionMatrix),yt.setValue(S,"viewMatrix",L.matrixWorldInverse);const mn=yt.map.cameraPosition;mn!==void 0&&mn.setValue(S,He.setFromMatrixPosition(L.matrixWorld)),ie.logarithmicDepthBuffer&&yt.setValue(S,"logDepthBufFC",2/(Math.log(L.far+1)/Math.LN2)),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&yt.setValue(S,"isOrthographic",L.isOrthographicCamera===!0),z!==L&&(z=L,wn=!0,Fo=!0)}if(Ye.needsLights&&(dt.state.directionalShadowMap.length>0&&yt.setValue(S,"directionalShadowMap",dt.state.directionalShadowMap,F),dt.state.spotShadowMap.length>0&&yt.setValue(S,"spotShadowMap",dt.state.spotShadowMap,F),dt.state.pointShadowMap.length>0&&yt.setValue(S,"pointShadowMap",dt.state.pointShadowMap,F)),ne.isSkinnedMesh){yt.setOptional(S,ne,"bindMatrix"),yt.setOptional(S,ne,"bindMatrixInverse");const cn=ne.skeleton;cn&&(cn.boneTexture===null&&cn.computeBoneTexture(),yt.setValue(S,"boneTexture",cn.boneTexture,F))}ne.isBatchedMesh&&(yt.setOptional(S,ne,"batchingTexture"),yt.setValue(S,"batchingTexture",ne._matricesTexture,F),yt.setOptional(S,ne,"batchingIdTexture"),yt.setValue(S,"batchingIdTexture",ne._indirectTexture,F),yt.setOptional(S,ne,"batchingColorTexture"),ne._colorsTexture!==null&&yt.setValue(S,"batchingColorTexture",ne._colorsTexture,F));const Ln=ae.morphAttributes;if((Ln.position!==void 0||Ln.normal!==void 0||Ln.color!==void 0)&&it.update(ne,ae,bn),(wn||Ye.receiveShadow!==ne.receiveShadow)&&(Ye.receiveShadow=ne.receiveShadow,yt.setValue(S,"receiveShadow",ne.receiveShadow)),se.isMeshGouraudMaterial&&se.envMap!==null&&(pn.envMap.value=Ve,pn.flipEnvMap.value=Ve.isCubeTexture&&Ve.isRenderTargetTexture===!1?-1:1),se.isMeshStandardMaterial&&se.envMap===null&&j.environment!==null&&(pn.envMapIntensity.value=j.environmentIntensity),pn.dfgLUT!==void 0&&(pn.dfgLUT.value=rw()),wn&&(yt.setValue(S,"toneMappingExposure",b.toneMappingExposure),Ye.needsLights&&RT(pn,Fo),Ie&&se.fog===!0&&Xe.refreshFogUniforms(pn,Ie),Xe.refreshMaterialUniforms(pn,se,ge,Z,A.state.transmissionRenderTarget[L.id]),hl.upload(S,i0(Ye),pn,F)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(hl.upload(S,i0(Ye),pn,F),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&yt.setValue(S,"center",ne.center),yt.setValue(S,"modelViewMatrix",ne.modelViewMatrix),yt.setValue(S,"normalMatrix",ne.normalMatrix),yt.setValue(S,"modelMatrix",ne.matrixWorld),se.isShaderMaterial||se.isRawShaderMaterial){const cn=se.uniformsGroups;for(let mn=0,yf=cn.length;mn<yf;mn++){const Pr=cn[mn];ve.update(Pr,bn),ve.bind(Pr,bn)}}return bn}function RT(L,j){L.ambientLightColor.needsUpdate=j,L.lightProbe.needsUpdate=j,L.directionalLights.needsUpdate=j,L.directionalLightShadows.needsUpdate=j,L.pointLights.needsUpdate=j,L.pointLightShadows.needsUpdate=j,L.spotLights.needsUpdate=j,L.spotLightShadows.needsUpdate=j,L.rectAreaLights.needsUpdate=j,L.hemisphereLights.needsUpdate=j}function PT(L){return L.isMeshLambertMaterial||L.isMeshToonMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isShadowMaterial||L.isShaderMaterial&&L.lights===!0}this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(L,j,ae){const se=T.get(L);se.__autoAllocateDepthBuffer=L.resolveDepthBuffer===!1,se.__autoAllocateDepthBuffer===!1&&(se.__useRenderToTexture=!1),T.get(L.texture).__webglTexture=j,T.get(L.depthTexture).__webglTexture=se.__autoAllocateDepthBuffer?void 0:ae,se.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(L,j){const ae=T.get(L);ae.__webglFramebuffer=j,ae.__useDefaultFramebuffer=j===void 0};const DT=S.createFramebuffer();this.setRenderTarget=function(L,j=0,ae=0){O=L,B=j,R=ae;let se=null,ne=!1,Ie=!1;if(L){const Ne=T.get(L);if(Ne.__useDefaultFramebuffer!==void 0){V.bindFramebuffer(S.FRAMEBUFFER,Ne.__webglFramebuffer),X.copy(L.viewport),H.copy(L.scissor),re=L.scissorTest,V.viewport(X),V.scissor(H),V.setScissorTest(re),M=-1;return}else if(Ne.__webglFramebuffer===void 0)F.setupRenderTarget(L);else if(Ne.__hasExternalTextures)F.rebindTextures(L,T.get(L.texture).__webglTexture,T.get(L.depthTexture).__webglTexture);else if(L.depthBuffer){const Je=L.depthTexture;if(Ne.__boundDepthTexture!==Je){if(Je!==null&&T.has(Je)&&(L.width!==Je.image.width||L.height!==Je.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");F.setupDepthRenderbuffer(L)}}const Ve=L.texture;(Ve.isData3DTexture||Ve.isDataArrayTexture||Ve.isCompressedArrayTexture)&&(Ie=!0);const qe=T.get(L).__webglFramebuffer;L.isWebGLCubeRenderTarget?(Array.isArray(qe[j])?se=qe[j][ae]:se=qe[j],ne=!0):L.samples>0&&F.useMultisampledRTT(L)===!1?se=T.get(L).__webglMultisampledFramebuffer:Array.isArray(qe)?se=qe[ae]:se=qe,X.copy(L.viewport),H.copy(L.scissor),re=L.scissorTest}else X.copy(oe).multiplyScalar(ge).floor(),H.copy(ee).multiplyScalar(ge).floor(),re=pe;if(ae!==0&&(se=DT),V.bindFramebuffer(S.FRAMEBUFFER,se)&&V.drawBuffers(L,se),V.viewport(X),V.scissor(H),V.setScissorTest(re),ne){const Ne=T.get(L.texture);S.framebufferTexture2D(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_CUBE_MAP_POSITIVE_X+j,Ne.__webglTexture,ae)}else if(Ie){const Ne=j;for(let Ve=0;Ve<L.textures.length;Ve++){const qe=T.get(L.textures[Ve]);S.framebufferTextureLayer(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0+Ve,qe.__webglTexture,ae,Ne)}}else if(L!==null&&ae!==0){const Ne=T.get(L.texture);S.framebufferTexture2D(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,Ne.__webglTexture,ae)}M=-1},this.readRenderTargetPixels=function(L,j,ae,se,ne,Ie,Fe,Ne=0){if(!(L&&L.isWebGLRenderTarget)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ve=T.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Fe!==void 0&&(Ve=Ve[Fe]),Ve){V.bindFramebuffer(S.FRAMEBUFFER,Ve);try{const qe=L.textures[Ne],Je=qe.format,Ze=qe.type;if(!ie.textureFormatReadable(Je)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ie.textureTypeReadable(Ze)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=L.width-se&&ae>=0&&ae<=L.height-ne&&(L.textures.length>1&&S.readBuffer(S.COLOR_ATTACHMENT0+Ne),S.readPixels(j,ae,se,ne,be.convert(Je),be.convert(Ze),Ie))}finally{const qe=O!==null?T.get(O).__webglFramebuffer:null;V.bindFramebuffer(S.FRAMEBUFFER,qe)}}},this.readRenderTargetPixelsAsync=async function(L,j,ae,se,ne,Ie,Fe,Ne=0){if(!(L&&L.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ve=T.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Fe!==void 0&&(Ve=Ve[Fe]),Ve)if(j>=0&&j<=L.width-se&&ae>=0&&ae<=L.height-ne){V.bindFramebuffer(S.FRAMEBUFFER,Ve);const qe=L.textures[Ne],Je=qe.format,Ze=qe.type;if(!ie.textureFormatReadable(Je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ie.textureTypeReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const st=S.createBuffer();S.bindBuffer(S.PIXEL_PACK_BUFFER,st),S.bufferData(S.PIXEL_PACK_BUFFER,Ie.byteLength,S.STREAM_READ),L.textures.length>1&&S.readBuffer(S.COLOR_ATTACHMENT0+Ne),S.readPixels(j,ae,se,ne,be.convert(Je),be.convert(Ze),0);const mt=O!==null?T.get(O).__webglFramebuffer:null;V.bindFramebuffer(S.FRAMEBUFFER,mt);const It=S.fenceSync(S.SYNC_GPU_COMMANDS_COMPLETE,0);return S.flush(),await Y0(S,It,4),S.bindBuffer(S.PIXEL_PACK_BUFFER,st),S.getBufferSubData(S.PIXEL_PACK_BUFFER,0,Ie),S.deleteBuffer(st),S.deleteSync(It),Ie}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(L,j=null,ae=0){const se=Math.pow(2,-ae),ne=Math.floor(L.image.width*se),Ie=Math.floor(L.image.height*se),Fe=j!==null?j.x:0,Ne=j!==null?j.y:0;F.setTexture2D(L,0),S.copyTexSubImage2D(S.TEXTURE_2D,ae,0,0,Fe,Ne,ne,Ie),V.unbindTexture()};const LT=S.createFramebuffer(),NT=S.createFramebuffer();this.copyTextureToTexture=function(L,j,ae=null,se=null,ne=0,Ie=null){Ie===null&&(ne!==0?(Gr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Ie=ne,ne=0):Ie=0);let Fe,Ne,Ve,qe,Je,Ze,st,mt,It;const Rt=L.isCompressedTexture?L.mipmaps[Ie]:L.image;if(ae!==null)Fe=ae.max.x-ae.min.x,Ne=ae.max.y-ae.min.y,Ve=ae.isBox3?ae.max.z-ae.min.z:1,qe=ae.min.x,Je=ae.min.y,Ze=ae.isBox3?ae.min.z:0;else{const Ln=Math.pow(2,-ne);Fe=Math.floor(Rt.width*Ln),Ne=Math.floor(Rt.height*Ln),L.isDataArrayTexture?Ve=Rt.depth:L.isData3DTexture?Ve=Math.floor(Rt.depth*Ln):Ve=1,qe=0,Je=0,Ze=0}se!==null?(st=se.x,mt=se.y,It=se.z):(st=0,mt=0,It=0);const _t=be.convert(j.format),Ye=be.convert(j.type);let dt;j.isData3DTexture?(F.setTexture3D(j,0),dt=S.TEXTURE_3D):j.isDataArrayTexture||j.isCompressedArrayTexture?(F.setTexture2DArray(j,0),dt=S.TEXTURE_2D_ARRAY):(F.setTexture2D(j,0),dt=S.TEXTURE_2D),S.pixelStorei(S.UNPACK_FLIP_Y_WEBGL,j.flipY),S.pixelStorei(S.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),S.pixelStorei(S.UNPACK_ALIGNMENT,j.unpackAlignment);const ht=S.getParameter(S.UNPACK_ROW_LENGTH),bn=S.getParameter(S.UNPACK_IMAGE_HEIGHT),Ds=S.getParameter(S.UNPACK_SKIP_PIXELS),wn=S.getParameter(S.UNPACK_SKIP_ROWS),Fo=S.getParameter(S.UNPACK_SKIP_IMAGES);S.pixelStorei(S.UNPACK_ROW_LENGTH,Rt.width),S.pixelStorei(S.UNPACK_IMAGE_HEIGHT,Rt.height),S.pixelStorei(S.UNPACK_SKIP_PIXELS,qe),S.pixelStorei(S.UNPACK_SKIP_ROWS,Je),S.pixelStorei(S.UNPACK_SKIP_IMAGES,Ze);const yt=L.isDataArrayTexture||L.isData3DTexture,pn=j.isDataArrayTexture||j.isData3DTexture;if(L.isDepthTexture){const Ln=T.get(L),cn=T.get(j),mn=T.get(Ln.__renderTarget),yf=T.get(cn.__renderTarget);V.bindFramebuffer(S.READ_FRAMEBUFFER,mn.__webglFramebuffer),V.bindFramebuffer(S.DRAW_FRAMEBUFFER,yf.__webglFramebuffer);for(let Pr=0;Pr<Ve;Pr++)yt&&(S.framebufferTextureLayer(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,T.get(L).__webglTexture,ne,Ze+Pr),S.framebufferTextureLayer(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,T.get(j).__webglTexture,Ie,It+Pr)),S.blitFramebuffer(qe,Je,Fe,Ne,st,mt,Fe,Ne,S.DEPTH_BUFFER_BIT,S.NEAREST);V.bindFramebuffer(S.READ_FRAMEBUFFER,null),V.bindFramebuffer(S.DRAW_FRAMEBUFFER,null)}else if(ne!==0||L.isRenderTargetTexture||T.has(L)){const Ln=T.get(L),cn=T.get(j);V.bindFramebuffer(S.READ_FRAMEBUFFER,LT),V.bindFramebuffer(S.DRAW_FRAMEBUFFER,NT);for(let mn=0;mn<Ve;mn++)yt?S.framebufferTextureLayer(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,Ln.__webglTexture,ne,Ze+mn):S.framebufferTexture2D(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,Ln.__webglTexture,ne),pn?S.framebufferTextureLayer(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,cn.__webglTexture,Ie,It+mn):S.framebufferTexture2D(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,cn.__webglTexture,Ie),ne!==0?S.blitFramebuffer(qe,Je,Fe,Ne,st,mt,Fe,Ne,S.COLOR_BUFFER_BIT,S.NEAREST):pn?S.copyTexSubImage3D(dt,Ie,st,mt,It+mn,qe,Je,Fe,Ne):S.copyTexSubImage2D(dt,Ie,st,mt,qe,Je,Fe,Ne);V.bindFramebuffer(S.READ_FRAMEBUFFER,null),V.bindFramebuffer(S.DRAW_FRAMEBUFFER,null)}else pn?L.isDataTexture||L.isData3DTexture?S.texSubImage3D(dt,Ie,st,mt,It,Fe,Ne,Ve,_t,Ye,Rt.data):j.isCompressedArrayTexture?S.compressedTexSubImage3D(dt,Ie,st,mt,It,Fe,Ne,Ve,_t,Rt.data):S.texSubImage3D(dt,Ie,st,mt,It,Fe,Ne,Ve,_t,Ye,Rt):L.isDataTexture?S.texSubImage2D(S.TEXTURE_2D,Ie,st,mt,Fe,Ne,_t,Ye,Rt.data):L.isCompressedTexture?S.compressedTexSubImage2D(S.TEXTURE_2D,Ie,st,mt,Rt.width,Rt.height,_t,Rt.data):S.texSubImage2D(S.TEXTURE_2D,Ie,st,mt,Fe,Ne,_t,Ye,Rt);S.pixelStorei(S.UNPACK_ROW_LENGTH,ht),S.pixelStorei(S.UNPACK_IMAGE_HEIGHT,bn),S.pixelStorei(S.UNPACK_SKIP_PIXELS,Ds),S.pixelStorei(S.UNPACK_SKIP_ROWS,wn),S.pixelStorei(S.UNPACK_SKIP_IMAGES,Fo),Ie===0&&j.generateMipmaps&&S.generateMipmap(dt),V.unbindTexture()},this.initRenderTarget=function(L){T.get(L).__webglFramebuffer===void 0&&F.setupRenderTarget(L)},this.initTexture=function(L){L.isCubeTexture?F.setTextureCube(L,0):L.isData3DTexture?F.setTexture3D(L,0):L.isDataArrayTexture||L.isCompressedArrayTexture?F.setTexture2DArray(L,0):F.setTexture2D(L,0),V.unbindTexture()},this.resetState=function(){B=0,R=0,O=null,V.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return gn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=rt._getDrawingBufferColorSpace(e),t.unpackColorSpace=rt._getUnpackColorSpace()}}const sw=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Yo,AddEquation:_i,AddOperation:Hf,AdditiveBlending:Ol,AgXToneMapping:Wl,AlphaFormat:jl,AlwaysCompare:td,AlwaysDepth:Ho,ArrayCamera:Fp,BackSide:en,BoxGeometry:ji,BufferAttribute:ot,BufferGeometry:Ke,ByteType:Zl,CineonToneMapping:Hl,ClampToEdgeWrapping:tn,Color:xe,ColorManagement:rt,ConstantAlphaFactor:zf,ConstantColorFactor:Of,CubeDepthTexture:Jd,CubeReflectionMapping:Xn,CubeRefractionMapping:vi,CubeTexture:Js,CubeUVReflectionMapping:Lr,CullFaceBack:Bl,CullFaceFront:Af,CullFaceNone:xf,CustomBlending:wf,CustomToneMapping:Gl,Data3DTexture:Ha,DataArrayTexture:Va,DataTexture:Fn,DepthFormat:Yn,DepthStencilFormat:xi,DepthTexture:ds,DoubleSide:Sn,DstAlphaFactor:Df,DstColorFactor:Nf,EqualCompare:Jf,EqualDepth:Wo,EquirectangularReflectionMapping:Us,EquirectangularRefractionMapping:Bs,Euler:Zt,EventDispatcher:Qn,ExternalTexture:Vh,Float32BufferAttribute:Be,FloatType:nn,FrontSide:Wn,Frustum:fs,GLSL3:nh,GreaterCompare:$f,GreaterDepth:Xo,GreaterEqualCompare:za,GreaterEqualDepth:qo,HalfFloatType:Zn,IntType:jo,Layers:Qa,LessCompare:jf,LessDepth:Go,LessEqualCompare:Fa,LessEqualDepth:Vi,LinearFilter:pt,LinearMipmapLinearFilter:Mn,LinearMipmapNearestFilter:Ur,LinearSRGBColorSpace:Xt,LinearToneMapping:kl,LinearTransfer:Gs,Matrix3:et,Matrix4:We,MaxEquation:Tf,Mesh:St,MeshBasicMaterial:un,MeshDepthMaterial:nu,MeshDistanceMaterial:iu,MinEquation:Ef,MirroredRepeatWrapping:Nr,MixOperation:Vf,MultiplyBlending:zl,MultiplyOperation:Ns,NearestFilter:Mt,NearestMipmapLinearFilter:Hi,NearestMipmapNearestFilter:Ko,NeutralToneMapping:ql,NeverCompare:Kf,NeverDepth:Vo,NoBlending:qn,NoColorSpace:ri,NoToneMapping:Nn,NormalBlending:ki,NotEqualCompare:ed,NotEqualDepth:Zo,ObjectSpaceNormalMap:Qf,OneFactor:If,OneMinusConstantAlphaFactor:kf,OneMinusConstantColorFactor:Ff,OneMinusDstAlphaFactor:Lf,OneMinusDstColorFactor:Uf,OneMinusSrcAlphaFactor:ko,OneMinusSrcColorFactor:Pf,OrthographicCamera:ur,PCFShadowMap:Ls,PCFSoftShadowMap:bf,PMREMGenerator:Lu,PerspectiveCamera:kt,Plane:Ri,PlaneGeometry:rr,R11_EAC_Format:ha,RED_GREEN_RGTC2_Format:La,RED_RGTC1_Format:Pa,REVISION:Yt,RG11_EAC_Format:fa,RGBAFormat:rn,RGBAIntegerFormat:na,RGBA_ASTC_10x10_Format:Ma,RGBA_ASTC_10x5_Format:ba,RGBA_ASTC_10x6_Format:wa,RGBA_ASTC_10x8_Format:Sa,RGBA_ASTC_12x10_Format:Ea,RGBA_ASTC_12x12_Format:Ta,RGBA_ASTC_4x4_Format:pa,RGBA_ASTC_5x4_Format:ma,RGBA_ASTC_5x5_Format:ga,RGBA_ASTC_6x5_Format:_a,RGBA_ASTC_6x6_Format:va,RGBA_ASTC_8x5_Format:ya,RGBA_ASTC_8x6_Format:xa,RGBA_ASTC_8x8_Format:Aa,RGBA_BPTC_Format:Ca,RGBA_ETC2_EAC_Format:la,RGBA_PVRTC_2BPPV1_Format:oa,RGBA_PVRTC_4BPPV1_Format:sa,RGBA_S3TC_DXT1_Format:zs,RGBA_S3TC_DXT3_Format:ks,RGBA_S3TC_DXT5_Format:Vs,RGBFormat:Jl,RGB_BPTC_SIGNED_Format:Ia,RGB_BPTC_UNSIGNED_Format:Ra,RGB_ETC1_Format:aa,RGB_ETC2_Format:ca,RGB_PVRTC_2BPPV1_Format:ra,RGB_PVRTC_4BPPV1_Format:ia,RGB_S3TC_DXT1_Format:Fs,RGFormat:Gi,RGIntegerFormat:ta,RawShaderMaterial:tu,RedFormat:ea,RedIntegerFormat:Os,ReinhardToneMapping:Vl,RepeatWrapping:yi,ReverseSubtractEquation:Mf,SIGNED_R11_EAC_Format:ua,SIGNED_RED_GREEN_RGTC2_Format:Na,SIGNED_RED_RGTC1_Format:Da,SIGNED_RG11_EAC_Format:da,SRGBColorSpace:Tt,SRGBTransfer:ut,ShaderChunk:nt,ShaderLib:Vn,ShaderMaterial:Cn,ShortType:Yl,SrcAlphaFactor:zo,SrcAlphaSaturateFactor:Bf,SrcColorFactor:Rf,SubtractEquation:Sf,SubtractiveBlending:Fl,TangentSpaceNormalMap:Ai,Texture:xt,Uint16BufferAttribute:wh,Uint32BufferAttribute:Sh,UniformsLib:Ce,UniformsUtils:Sd,UnsignedByteType:ln,UnsignedInt101111Type:Kl,UnsignedInt248Type:Or,UnsignedInt5999Type:Ql,UnsignedIntType:En,UnsignedShort4444Type:Jo,UnsignedShort5551Type:$o,UnsignedShortType:Br,VSMShadowMap:Dr,Vector2:he,Vector3:U,Vector4:gt,WebGLCoordinateSystem:gn,WebGLCubeRenderTarget:Th,WebGLRenderTarget:vn,WebGLRenderer:Cm,WebGLUtils:Tm,WebXRController:ac,ZeroFactor:Cf,createCanvasElement:rd,error:Ge,log:qs,warn:Te,warnOnce:Gr,AdditiveAnimationBlendMode:$l,AlwaysStencilFunc:th,AmbientLight:mu,AnimationAction:Hp,AnimationClip:vs,AnimationLoader:Ov,AnimationMixer:hy,AnimationObjectGroup:cy,AnimationUtils:Lv,ArcCurve:ep,ArrowHelper:Oy,AttachedBindMode:Xl,Audio:zp,AudioAnalyser:Jv,AudioContext:vu,AudioListener:Qv,AudioLoader:Xv,AxesHelper:Fy,BasicDepthPacking:Yf,BasicShadowMap:a0,BatchedMesh:Wd,Bone:mc,BooleanKeyframeTrack:or,Box2:Ay,Box3:Gt,Box3Helper:Uy,BoxHelper:Ny,BufferGeometryLoader:Dp,Cache:$n,Camera:oc,CameraHelper:Ly,CanvasTexture:nv,CapsuleGeometry:Rc,CatmullRomCurve3:tp,CircleGeometry:Pc,Clock:el,ColorKeyframeTrack:au,CompressedArrayTexture:ev,CompressedCubeTexture:tv,CompressedTexture:Ic,CompressedTextureLoader:Fv,ConeGeometry:co,Controls:ky,CubeCamera:Td,CubeTextureLoader:zv,CubicBezierCurve:Zh,CubicBezierCurve3:ip,CubicInterpolant:wp,CullFaceFrontBack:o0,Curve:zn,CurvePath:sp,CylinderGeometry:ao,Cylindrical:xy,DataTextureLoader:kv,DataUtils:M_,DecrementStencilOp:b0,DecrementWrapStencilOp:S0,DefaultLoadingManager:Ep,DetachedBindMode:Gf,DirectionalLight:jc,DirectionalLightHelper:Dy,DiscreteInterpolant:Sp,DodecahedronGeometry:Dc,DynamicCopyUsage:z0,DynamicDrawUsage:L0,DynamicReadUsage:B0,EdgesGeometry:$d,EllipseCurve:Bc,EqualStencilFunc:C0,ExtrudeGeometry:Hc,FileLoader:An,Float16BufferAttribute:D_,Fog:lc,FogExp2:cc,FramebufferTexture:$_,FrustumArray:yc,GLBufferAttribute:my,GLSL1:V0,GreaterEqualStencilFunc:D0,GreaterStencilFunc:R0,GridHelper:Ry,Group:Kn,HemisphereLight:hu,HemisphereLightHelper:Iy,IcosahedronGeometry:Gc,ImageBitmapLoader:Up,ImageLoader:_o,ImageUtils:hd,IncrementStencilOp:A0,IncrementWrapStencilOp:w0,InstancedBufferAttribute:Ji,InstancedBufferGeometry:Pp,InstancedInterleavedBuffer:py,InstancedMesh:_c,Int16BufferAttribute:R_,Int32BufferAttribute:P_,Int8BufferAttribute:T_,InterleavedBuffer:os,InterleavedBufferAttribute:fi,Interpolant:_s,InterpolateDiscrete:Fr,InterpolateLinear:zr,InterpolateSmooth:Ua,InterpolationSamplingMode:W0,InterpolationSamplingType:G0,InvertStencilOp:M0,KeepStencilOp:Xi,KeyframeTrack:Pn,LOD:Ld,LatheGeometry:Wc,LessEqualStencilFunc:I0,LessStencilFunc:T0,Light:Di,LightProbe:Rp,Line:di,Line3:Sy,LineBasicMaterial:qt,LineCurve:Yh,LineCurve3:rp,LineDashedMaterial:Ap,LineLoop:Fh,LineSegments:In,LinearInterpolant:ou,LinearMipMapLinearFilter:u0,LinearMipMapNearestFilter:h0,Loader:Jt,LoaderUtils:Li,LoadingManager:cu,LoopOnce:Wf,LoopPingPong:Xf,LoopRepeat:qf,MOUSE:zi,Material:zt,MaterialLoader:Jc,MathUtils:ka,Matrix2:Su,MeshLambertMaterial:yp,MeshMatcapMaterial:xp,MeshNormalMaterial:vp,MeshPhongMaterial:gp,MeshPhysicalMaterial:Rn,MeshStandardMaterial:gs,MeshToonMaterial:_p,NearestMipMapLinearFilter:l0,NearestMipMapNearestFilter:c0,NeverStencilFunc:E0,NoNormalPacking:g0,NormalAnimationBlendMode:Ba,NormalGAPacking:v0,NormalRGPacking:_0,NotEqualStencilFunc:P0,NumberKeyframeTrack:ar,Object3D:ct,ObjectLoader:Wv,OctahedronGeometry:go,Path:zc,PlaneHelper:By,PointLight:pu,PointLightHelper:Ty,Points:kh,PointsMaterial:Ec,PolarGridHelper:Py,PolyhedronGeometry:Pi,PositionalAudio:jv,PropertyBinding:lt,PropertyMixer:Vp,QuadraticBezierCurve:Qh,QuadraticBezierCurve3:Kh,Quaternion:wt,QuaternionKeyframeTrack:cr,QuaternionLinearInterpolant:Mp,RGBADepthPacking:d0,RGBDepthPacking:p0,RGBIntegerFormat:f0,RGDepthPacking:m0,Ray:Kr,Raycaster:gy,RectAreaLight:Ip,RenderTarget:ch,RenderTarget3D:uy,ReplaceStencilOp:x0,RingGeometry:qc,Scene:Ch,ShadowMaterial:mp,Shape:nr,ShapeGeometry:Xc,ShapePath:zy,ShapeUtils:kn,Skeleton:no,SkeletonHelper:Ey,SkinnedMesh:Lh,Source:wi,Sphere:Pt,SphereGeometry:ms,Spherical:yy,SphericalHarmonics3:gu,SplineCurve:jh,SpotLight:du,SpotLightHelper:My,Sprite:Pd,SpriteMaterial:Ih,StaticCopyUsage:F0,StaticDrawUsage:kr,StaticReadUsage:U0,StereoCamera:Zv,StreamCopyUsage:k0,StreamDrawUsage:N0,StreamReadUsage:O0,StringKeyframeTrack:lr,TOUCH:s0,TetrahedronGeometry:Zc,TextureLoader:lu,TextureUtils:qy,Timer:_y,TimestampQuery:H0,TorusGeometry:Yc,TorusKnotGeometry:Qc,Triangle:hn,TriangleFanDrawMode:Oa,TriangleStripDrawMode:eh,TrianglesDrawMode:Zf,TubeGeometry:Kc,UVMapping:Qo,Uint8BufferAttribute:C_,Uint8ClampedBufferAttribute:I_,Uniform:bu,UniformsGroup:dy,VectorKeyframeTrack:hr,VideoFrameTexture:J_,VideoTexture:jd,WebGL3DRenderTarget:m_,WebGLArrayRenderTarget:p_,WebGPUCoordinateSystem:Vr,WireframeGeometry:eu,WrapAroundEnding:Hs,ZeroCurvatureEnding:Wi,ZeroSlopeEnding:qi,ZeroStencilOp:y0,getConsoleFunction:Z0,setConsoleFunction:X0},Symbol.toStringTag,{value:"Module"}));var fl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ow=function(e){return aw(e)&&!cw(e)};function aw(r){return!!r&&typeof r=="object"}function cw(r){var e=Object.prototype.toString.call(r);return e==="[object RegExp]"||e==="[object Date]"||uw(r)}var lw=typeof Symbol=="function"&&Symbol.for,hw=lw?Symbol.for("react.element"):60103;function uw(r){return r.$$typeof===hw}function fw(r){return Array.isArray(r)?[]:{}}function Ao(r,e){return e.clone!==!1&&e.isMergeableObject(r)?Ss(fw(r),r,e):r}function dw(r,e,t){return r.concat(e).map(function(n){return Ao(n,t)})}function pw(r,e){if(!e.customMerge)return Ss;var t=e.customMerge(r);return typeof t=="function"?t:Ss}function mw(r){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r).filter(function(e){return Object.propertyIsEnumerable.call(r,e)}):[]}function Im(r){return Object.keys(r).concat(mw(r))}function Rm(r,e){try{return e in r}catch{return!1}}function gw(r,e){return Rm(r,e)&&!(Object.hasOwnProperty.call(r,e)&&Object.propertyIsEnumerable.call(r,e))}function _w(r,e,t){var n={};return t.isMergeableObject(r)&&Im(r).forEach(function(i){n[i]=Ao(r[i],t)}),Im(e).forEach(function(i){gw(r,i)||(Rm(r,i)&&t.isMergeableObject(e[i])?n[i]=pw(i,t)(r[i],e[i],t):n[i]=Ao(e[i],t))}),n}function Ss(r,e,t){t=t||{},t.arrayMerge=t.arrayMerge||dw,t.isMergeableObject=t.isMergeableObject||ow,t.cloneUnlessOtherwiseSpecified=Ao;var n=Array.isArray(e),i=Array.isArray(r),s=n===i;return s?n?t.arrayMerge(r,e,t):_w(r,e,t):Ao(e,t)}Ss.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(n,i){return Ss(n,i,t)},{})};var vw=Ss,yw=vw;const xw=`
4019
+ }`;class Jb{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Vh(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Cn({vertexShader:Kb,fragmentShader:jb,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new St(new rr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class $b extends Qn{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",c=1,l=null,h=null,u=null,f=null,d=null,g=null;const _=typeof XRWebGLBinding<"u",m=new Jb,p={},v=t.getContextAttributes();let y=null,x=null;const A=[],E=[],I=new he;let D=null;const b=new kt;b.viewport=new gt;const C=new kt;C.viewport=new gt;const B=[b,C],R=new Fp;let O=null,M=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(oe){let ee=A[oe];return ee===void 0&&(ee=new ac,A[oe]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(oe){let ee=A[oe];return ee===void 0&&(ee=new ac,A[oe]=ee),ee.getGripSpace()},this.getHand=function(oe){let ee=A[oe];return ee===void 0&&(ee=new ac,A[oe]=ee),ee.getHandSpace()};function z(oe){const ee=E.indexOf(oe.inputSource);if(ee===-1)return;const pe=A[ee];pe!==void 0&&(pe.update(oe.inputSource,oe.frame,l||o),pe.dispatchEvent({type:oe.type,data:oe.inputSource}))}function X(){i.removeEventListener("select",z),i.removeEventListener("selectstart",z),i.removeEventListener("selectend",z),i.removeEventListener("squeeze",z),i.removeEventListener("squeezestart",z),i.removeEventListener("squeezeend",z),i.removeEventListener("end",X),i.removeEventListener("inputsourceschange",H);for(let oe=0;oe<A.length;oe++){const ee=E[oe];ee!==null&&(E[oe]=null,A[oe].disconnect(ee))}O=null,M=null,m.reset();for(const oe in p)delete p[oe];e.setRenderTarget(y),d=null,f=null,u=null,i=null,x=null,de.stop(),n.isPresenting=!1,e.setPixelRatio(D),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(oe){s=oe,n.isPresenting===!0&&Te("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(oe){a=oe,n.isPresenting===!0&&Te("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(oe){l=oe},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return u===null&&_&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(oe){if(i=oe,i!==null){if(y=e.getRenderTarget(),i.addEventListener("select",z),i.addEventListener("selectstart",z),i.addEventListener("selectend",z),i.addEventListener("squeeze",z),i.addEventListener("squeezestart",z),i.addEventListener("squeezeend",z),i.addEventListener("end",X),i.addEventListener("inputsourceschange",H),v.xrCompatible!==!0&&await t.makeXRCompatible(),D=e.getPixelRatio(),e.getSize(I),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let pe=null,ye=null,Ae=null;v.depth&&(Ae=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,pe=v.stencil?xi:Yn,ye=v.stencil?Or:En);const ze={colorFormat:t.RGBA8,depthFormat:Ae,scaleFactor:s};u=this.getBinding(),f=u.createProjectionLayer(ze),i.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),x=new vn(f.textureWidth,f.textureHeight,{format:rn,type:ln,depthTexture:new ds(f.textureWidth,f.textureHeight,ye,void 0,void 0,void 0,void 0,void 0,void 0,pe),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const pe={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,pe),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),x=new vn(d.framebufferWidth,d.framebufferHeight,{format:rn,type:ln,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await i.requestReferenceSpace(a),de.setContext(i),de.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function H(oe){for(let ee=0;ee<oe.removed.length;ee++){const pe=oe.removed[ee],ye=E.indexOf(pe);ye>=0&&(E[ye]=null,A[ye].disconnect(pe))}for(let ee=0;ee<oe.added.length;ee++){const pe=oe.added[ee];let ye=E.indexOf(pe);if(ye===-1){for(let ze=0;ze<A.length;ze++)if(ze>=E.length){E.push(pe),ye=ze;break}else if(E[ze]===null){E[ze]=pe,ye=ze;break}if(ye===-1)break}const Ae=A[ye];Ae&&Ae.connect(pe)}}const re=new U,J=new U;function le(oe,ee,pe){re.setFromMatrixPosition(ee.matrixWorld),J.setFromMatrixPosition(pe.matrixWorld);const ye=re.distanceTo(J),Ae=ee.projectionMatrix.elements,ze=pe.projectionMatrix.elements,je=Ae[14]/(Ae[10]-1),He=Ae[14]/(Ae[10]+1),w=(Ae[9]+1)/Ae[5],q=(Ae[9]-1)/Ae[5],k=(Ae[8]-1)/Ae[0],N=(ze[8]+1)/ze[0],S=je*k,G=je*N,K=ye/(-k+N),ie=K*-k;if(ee.matrixWorld.decompose(oe.position,oe.quaternion,oe.scale),oe.translateX(ie),oe.translateZ(K),oe.matrixWorld.compose(oe.position,oe.quaternion,oe.scale),oe.matrixWorldInverse.copy(oe.matrixWorld).invert(),Ae[10]===-1)oe.projectionMatrix.copy(ee.projectionMatrix),oe.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{const V=je+K,P=He+K,T=S-ie,F=G+(ye-ie),Q=w*He/P*V,ce=q*He/P*V;oe.projectionMatrix.makePerspective(T,F,Q,ce,V,P),oe.projectionMatrixInverse.copy(oe.projectionMatrix).invert()}}function W(oe,ee){ee===null?oe.matrixWorld.copy(oe.matrix):oe.matrixWorld.multiplyMatrices(ee.matrixWorld,oe.matrix),oe.matrixWorldInverse.copy(oe.matrixWorld).invert()}this.updateCamera=function(oe){if(i===null)return;let ee=oe.near,pe=oe.far;m.texture!==null&&(m.depthNear>0&&(ee=m.depthNear),m.depthFar>0&&(pe=m.depthFar)),R.near=C.near=b.near=ee,R.far=C.far=b.far=pe,(O!==R.near||M!==R.far)&&(i.updateRenderState({depthNear:R.near,depthFar:R.far}),O=R.near,M=R.far),R.layers.mask=oe.layers.mask|6,b.layers.mask=R.layers.mask&3,C.layers.mask=R.layers.mask&5;const ye=oe.parent,Ae=R.cameras;W(R,ye);for(let ze=0;ze<Ae.length;ze++)W(Ae[ze],ye);Ae.length===2?le(R,b,C):R.projectionMatrix.copy(b.projectionMatrix),Z(oe,R,ye)};function Z(oe,ee,pe){pe===null?oe.matrix.copy(ee.matrixWorld):(oe.matrix.copy(pe.matrixWorld),oe.matrix.invert(),oe.matrix.multiply(ee.matrixWorld)),oe.matrix.decompose(oe.position,oe.quaternion,oe.scale),oe.updateMatrixWorld(!0),oe.projectionMatrix.copy(ee.projectionMatrix),oe.projectionMatrixInverse.copy(ee.projectionMatrixInverse),oe.isPerspectiveCamera&&(oe.fov=Wr*2*Math.atan(1/oe.projectionMatrix.elements[5]),oe.zoom=1)}this.getCamera=function(){return R},this.getFoveation=function(){if(!(f===null&&d===null))return c},this.setFoveation=function(oe){c=oe,f!==null&&(f.fixedFoveation=oe),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=oe)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(R)},this.getCameraTexture=function(oe){return p[oe]};let ge=null;function _e(oe,ee){if(h=ee.getViewerPose(l||o),g=ee,h!==null){const pe=h.views;d!==null&&(e.setRenderTargetFramebuffer(x,d.framebuffer),e.setRenderTarget(x));let ye=!1;pe.length!==R.cameras.length&&(R.cameras.length=0,ye=!0);for(let He=0;He<pe.length;He++){const w=pe[He];let q=null;if(d!==null)q=d.getViewport(w);else{const N=u.getViewSubImage(f,w);q=N.viewport,He===0&&(e.setRenderTargetTextures(x,N.colorTexture,N.depthStencilTexture),e.setRenderTarget(x))}let k=B[He];k===void 0&&(k=new kt,k.layers.enable(He),k.viewport=new gt,B[He]=k),k.matrix.fromArray(w.transform.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale),k.projectionMatrix.fromArray(w.projectionMatrix),k.projectionMatrixInverse.copy(k.projectionMatrix).invert(),k.viewport.set(q.x,q.y,q.width,q.height),He===0&&(R.matrix.copy(k.matrix),R.matrix.decompose(R.position,R.quaternion,R.scale)),ye===!0&&R.cameras.push(k)}const Ae=i.enabledFeatures;if(Ae&&Ae.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){u=n.getBinding();const He=u.getDepthInformation(pe[0]);He&&He.isValid&&He.texture&&m.init(He,i.renderState)}if(Ae&&Ae.includes("camera-access")&&_){e.state.unbindTexture(),u=n.getBinding();for(let He=0;He<pe.length;He++){const w=pe[He].camera;if(w){let q=p[w];q||(q=new Vh,p[w]=q);const k=u.getCameraImage(w);q.sourceTexture=k}}}}for(let pe=0;pe<A.length;pe++){const ye=E[pe],Ae=A[pe];ye!==null&&Ae!==void 0&&Ae.update(ye,ee,l||o)}ge&&ge(oe,ee),ee.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ee}),g=null}const de=new em;de.setAnimationLoop(_e),this.setAnimationLoop=function(oe){ge=oe},this.dispose=function(){}}}const xr=new Zt,ew=new We;function tw(r,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,wd(r)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function i(m,p,v,y,x){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),f(m,p),p.isMeshPhysicalMaterial&&d(m,p,x)):p.isMeshMatcapMaterial?(s(m,p),g(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),_(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(o(m,p),p.isLineDashedMaterial&&a(m,p)):p.isPointsMaterial?c(m,p,v,y):p.isSpriteMaterial?l(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===en&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===en&&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,x=v.envMapRotation;y&&(m.envMap.value=y,xr.copy(x),xr.x*=-1,xr.y*=-1,xr.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(xr.y*=-1,xr.z*=-1),m.envMapRotation.value.setFromMatrix4(ew.makeRotationFromEuler(xr)),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 c(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 l(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 f(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 d(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===en&&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 g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function _(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:n,refreshMaterialUniforms:i}}function nw(r,e,t,n){let i={},s={},o=[];const a=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function c(v,y){const x=y.program;n.uniformBlockBinding(v,x)}function l(v,y){let x=i[v.id];x===void 0&&(g(v),x=h(v),i[v.id]=x,v.addEventListener("dispose",m));const A=y.program;n.updateUBOMapping(v,A);const E=e.render.frame;s[v.id]!==E&&(f(v),s[v.id]=E)}function h(v){const y=u();v.__bindingPointIndex=y;const x=r.createBuffer(),A=v.__size,E=v.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,A,E),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,x),x}function u(){for(let v=0;v<a;v++)if(o.indexOf(v)===-1)return o.push(v),v;return Ge("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(v){const y=i[v.id],x=v.uniforms,A=v.__cache;r.bindBuffer(r.UNIFORM_BUFFER,y);for(let E=0,I=x.length;E<I;E++){const D=Array.isArray(x[E])?x[E]:[x[E]];for(let b=0,C=D.length;b<C;b++){const B=D[b];if(d(B,E,b,A)===!0){const R=B.__offset,O=Array.isArray(B.value)?B.value:[B.value];let M=0;for(let z=0;z<O.length;z++){const X=O[z],H=_(X);typeof X=="number"||typeof X=="boolean"?(B.__data[0]=X,r.bufferSubData(r.UNIFORM_BUFFER,R+M,B.__data)):X.isMatrix3?(B.__data[0]=X.elements[0],B.__data[1]=X.elements[1],B.__data[2]=X.elements[2],B.__data[3]=0,B.__data[4]=X.elements[3],B.__data[5]=X.elements[4],B.__data[6]=X.elements[5],B.__data[7]=0,B.__data[8]=X.elements[6],B.__data[9]=X.elements[7],B.__data[10]=X.elements[8],B.__data[11]=0):(X.toArray(B.__data,M),M+=H.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,R,B.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function d(v,y,x,A){const E=v.value,I=y+"_"+x;if(A[I]===void 0)return typeof E=="number"||typeof E=="boolean"?A[I]=E:A[I]=E.clone(),!0;{const D=A[I];if(typeof E=="number"||typeof E=="boolean"){if(D!==E)return A[I]=E,!0}else if(D.equals(E)===!1)return D.copy(E),!0}return!1}function g(v){const y=v.uniforms;let x=0;const A=16;for(let I=0,D=y.length;I<D;I++){const b=Array.isArray(y[I])?y[I]:[y[I]];for(let C=0,B=b.length;C<B;C++){const R=b[C],O=Array.isArray(R.value)?R.value:[R.value];for(let M=0,z=O.length;M<z;M++){const X=O[M],H=_(X),re=x%A,J=re%H.boundary,le=re+J;x+=J,le!==0&&A-le<H.storage&&(x+=A-le),R.__data=new Float32Array(H.storage/Float32Array.BYTES_PER_ELEMENT),R.__offset=x,x+=H.storage}}}const E=x%A;return E>0&&(x+=A-E),v.__size=x,v.__cache={},this}function _(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?Te("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Te("WebGLRenderer: Unsupported uniform value type.",v),y}function m(v){const y=v.target;y.removeEventListener("dispose",m);const x=o.indexOf(y.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(i[y.id]),delete i[y.id],delete s[y.id]}function p(){for(const v in i)r.deleteBuffer(i[v]);o=[],i={},s={}}return{bind:c,update:l,dispose:p}}const iw=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let ei=null;function rw(){return ei===null&&(ei=new Fn(iw,16,16,Gi,Zn),ei.name="DFG_LUT",ei.minFilter=pt,ei.magFilter=pt,ei.wrapS=tn,ei.wrapT=tn,ei.generateMipmaps=!1,ei.needsUpdate=!0),ei}class Cm{constructor(e={}){const{canvas:t=rd(),context:n=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:f=!1,outputBufferType:d=ln}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=o;const _=d,m=new Set([na,ta,Os]),p=new Set([ln,En,Br,Or,Jo,$o]),v=new Uint32Array(4),y=new Int32Array(4);let x=null,A=null;const E=[],I=[];let D=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Nn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const b=this;let C=!1;this._outputColorSpace=Tt;let B=0,R=0,O=null,M=-1,z=null;const X=new gt,H=new gt;let re=null;const J=new xe(0);let le=0,W=t.width,Z=t.height,ge=1,_e=null,de=null;const oe=new gt(0,0,W,Z),ee=new gt(0,0,W,Z);let pe=!1;const ye=new fs;let Ae=!1,ze=!1;const je=new We,He=new U,w=new gt,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let k=!1;function N(){return O===null?ge:1}let S=n;function G(L,j){return t.getContext(L,j)}try{const L={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Yt}`),t.addEventListener("webglcontextlost",$e,!1),t.addEventListener("webglcontextrestored",vt,!1),t.addEventListener("webglcontextcreationerror",ft,!1),S===null){const j="webgl2";if(S=G(j,L),S===null)throw G(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(L){throw Ge("WebGLRenderer: "+L.message),L}let K,ie,V,P,T,F,Q,ce,te,Re,we,Le,Xe,fe,Se,Oe,Ue,Me,it,Y,Pe,be,De,ve;function me(){K=new s1(S),K.init(),be=new Tm(S,K),ie=new KA(S,K,e,be),V=new Yb(S,K),ie.reversedDepthBuffer&&f&&V.buffers.depth.setReversed(!0),P=new c1(S),T=new Lb,F=new Qb(S,K,V,T,ie,be,P),Q=new JA(b),ce=new r1(b),te=new Xy(S),De=new YA(S,te),Re=new o1(S,te,P,De),we=new h1(S,Re,te,P),it=new l1(S,ie,F),Oe=new jA(T),Le=new Db(b,Q,ce,K,ie,De,Oe),Xe=new tw(b,T),fe=new Ub,Se=new Vb(K),Me=new ZA(b,Q,ce,V,we,g,c),Ue=new Xb(b,we,ie),ve=new nw(S,P,ie,V),Y=new QA(S,K,P),Pe=new a1(S,K,P),P.programs=Le.programs,b.capabilities=ie,b.extensions=K,b.properties=T,b.renderLists=fe,b.shadowMap=Ue,b.state=V,b.info=P}me(),_!==ln&&(D=new f1(_,t.width,t.height,i,s));const Ee=new $b(b,S);this.xr=Ee,this.getContext=function(){return S},this.getContextAttributes=function(){return S.getContextAttributes()},this.forceContextLoss=function(){const L=K.get("WEBGL_lose_context");L&&L.loseContext()},this.forceContextRestore=function(){const L=K.get("WEBGL_lose_context");L&&L.restoreContext()},this.getPixelRatio=function(){return ge},this.setPixelRatio=function(L){L!==void 0&&(ge=L,this.setSize(W,Z,!1))},this.getSize=function(L){return L.set(W,Z)},this.setSize=function(L,j,ae=!0){if(Ee.isPresenting){Te("WebGLRenderer: Can't change size while VR device is presenting.");return}W=L,Z=j,t.width=Math.floor(L*ge),t.height=Math.floor(j*ge),ae===!0&&(t.style.width=L+"px",t.style.height=j+"px"),D!==null&&D.setSize(t.width,t.height),this.setViewport(0,0,L,j)},this.getDrawingBufferSize=function(L){return L.set(W*ge,Z*ge).floor()},this.setDrawingBufferSize=function(L,j,ae){W=L,Z=j,ge=ae,t.width=Math.floor(L*ae),t.height=Math.floor(j*ae),this.setViewport(0,0,L,j)},this.setEffects=function(L){if(_===ln){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(L){for(let j=0;j<L.length;j++)if(L[j].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}D.setEffects(L||[])},this.getCurrentViewport=function(L){return L.copy(X)},this.getViewport=function(L){return L.copy(oe)},this.setViewport=function(L,j,ae,se){L.isVector4?oe.set(L.x,L.y,L.z,L.w):oe.set(L,j,ae,se),V.viewport(X.copy(oe).multiplyScalar(ge).round())},this.getScissor=function(L){return L.copy(ee)},this.setScissor=function(L,j,ae,se){L.isVector4?ee.set(L.x,L.y,L.z,L.w):ee.set(L,j,ae,se),V.scissor(H.copy(ee).multiplyScalar(ge).round())},this.getScissorTest=function(){return pe},this.setScissorTest=function(L){V.setScissorTest(pe=L)},this.setOpaqueSort=function(L){_e=L},this.setTransparentSort=function(L){de=L},this.getClearColor=function(L){return L.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor(...arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha(...arguments)},this.clear=function(L=!0,j=!0,ae=!0){let se=0;if(L){let ne=!1;if(O!==null){const Ie=O.texture.format;ne=m.has(Ie)}if(ne){const Ie=O.texture.type,Fe=p.has(Ie),Ne=Me.getClearColor(),Ve=Me.getClearAlpha(),qe=Ne.r,Je=Ne.g,Ze=Ne.b;Fe?(v[0]=qe,v[1]=Je,v[2]=Ze,v[3]=Ve,S.clearBufferuiv(S.COLOR,0,v)):(y[0]=qe,y[1]=Je,y[2]=Ze,y[3]=Ve,S.clearBufferiv(S.COLOR,0,y))}else se|=S.COLOR_BUFFER_BIT}j&&(se|=S.DEPTH_BUFFER_BIT),ae&&(se|=S.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),S.clear(se)},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",$e,!1),t.removeEventListener("webglcontextrestored",vt,!1),t.removeEventListener("webglcontextcreationerror",ft,!1),Me.dispose(),fe.dispose(),Se.dispose(),T.dispose(),Q.dispose(),ce.dispose(),we.dispose(),De.dispose(),ve.dispose(),Le.dispose(),Ee.dispose(),Ee.removeEventListener("sessionstart",Jg),Ee.removeEventListener("sessionend",$g),Rr.stop()};function $e(L){L.preventDefault(),qs("WebGLRenderer: Context Lost."),C=!0}function vt(){qs("WebGLRenderer: Context Restored."),C=!1;const L=P.autoReset,j=Ue.enabled,ae=Ue.autoUpdate,se=Ue.needsUpdate,ne=Ue.type;me(),P.autoReset=L,Ue.enabled=j,Ue.autoUpdate=ae,Ue.needsUpdate=se,Ue.type=ne}function ft(L){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",L.statusMessage)}function ii(L){const j=L.target;j.removeEventListener("dispose",ii),gi(j)}function gi(L){TT(L),T.remove(L)}function TT(L){const j=T.get(L).programs;j!==void 0&&(j.forEach(function(ae){Le.releaseProgram(ae)}),L.isShaderMaterial&&Le.releaseShaderCache(L))}this.renderBufferDirect=function(L,j,ae,se,ne,Ie){j===null&&(j=q);const Fe=ne.isMesh&&ne.matrixWorld.determinant()<0,Ne=IT(L,j,ae,se,ne);V.setMaterial(se,Fe);let Ve=ae.index,qe=1;if(se.wireframe===!0){if(Ve=Re.getWireframeAttribute(ae),Ve===void 0)return;qe=2}const Je=ae.drawRange,Ze=ae.attributes.position;let st=Je.start*qe,mt=(Je.start+Je.count)*qe;Ie!==null&&(st=Math.max(st,Ie.start*qe),mt=Math.min(mt,(Ie.start+Ie.count)*qe)),Ve!==null?(st=Math.max(st,0),mt=Math.min(mt,Ve.count)):Ze!=null&&(st=Math.max(st,0),mt=Math.min(mt,Ze.count));const It=mt-st;if(It<0||It===1/0)return;De.setup(ne,se,Ne,ae,Ve);let Rt,_t=Y;if(Ve!==null&&(Rt=te.get(Ve),_t=Pe,_t.setIndex(Rt)),ne.isMesh)se.wireframe===!0?(V.setLineWidth(se.wireframeLinewidth*N()),_t.setMode(S.LINES)):_t.setMode(S.TRIANGLES);else if(ne.isLine){let Ye=se.linewidth;Ye===void 0&&(Ye=1),V.setLineWidth(Ye*N()),ne.isLineSegments?_t.setMode(S.LINES):ne.isLineLoop?_t.setMode(S.LINE_LOOP):_t.setMode(S.LINE_STRIP)}else ne.isPoints?_t.setMode(S.POINTS):ne.isSprite&&_t.setMode(S.TRIANGLES);if(ne.isBatchedMesh)if(ne._multiDrawInstances!==null)Gr("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),_t.renderMultiDrawInstances(ne._multiDrawStarts,ne._multiDrawCounts,ne._multiDrawCount,ne._multiDrawInstances);else if(K.get("WEBGL_multi_draw"))_t.renderMultiDraw(ne._multiDrawStarts,ne._multiDrawCounts,ne._multiDrawCount);else{const Ye=ne._multiDrawStarts,dt=ne._multiDrawCounts,ht=ne._multiDrawCount,bn=Ve?te.get(Ve).bytesPerElement:1,Ds=T.get(se).currentProgram.getUniforms();for(let wn=0;wn<ht;wn++)Ds.setValue(S,"_gl_DrawID",wn),_t.render(Ye[wn]/bn,dt[wn])}else if(ne.isInstancedMesh)_t.renderInstances(st,It,ne.count);else if(ae.isInstancedBufferGeometry){const Ye=ae._maxInstanceCount!==void 0?ae._maxInstanceCount:1/0,dt=Math.min(ae.instanceCount,Ye);_t.renderInstances(st,It,dt)}else _t.render(st,It)};function jg(L,j,ae){L.transparent===!0&&L.side===Sn&&L.forceSinglePass===!1?(L.side=en,L.needsUpdate=!0,Ul(L,j,ae),L.side=Wn,L.needsUpdate=!0,Ul(L,j,ae),L.side=Sn):Ul(L,j,ae)}this.compile=function(L,j,ae=null){ae===null&&(ae=L),A=Se.get(ae),A.init(j),I.push(A),ae.traverseVisible(function(ne){ne.isLight&&ne.layers.test(j.layers)&&(A.pushLight(ne),ne.castShadow&&A.pushShadow(ne))}),L!==ae&&L.traverseVisible(function(ne){ne.isLight&&ne.layers.test(j.layers)&&(A.pushLight(ne),ne.castShadow&&A.pushShadow(ne))}),A.setupLights();const se=new Set;return L.traverse(function(ne){if(!(ne.isMesh||ne.isPoints||ne.isLine||ne.isSprite))return;const Ie=ne.material;if(Ie)if(Array.isArray(Ie))for(let Fe=0;Fe<Ie.length;Fe++){const Ne=Ie[Fe];jg(Ne,ae,ne),se.add(Ne)}else jg(Ie,ae,ne),se.add(Ie)}),A=I.pop(),se},this.compileAsync=function(L,j,ae=null){const se=this.compile(L,j,ae);return new Promise(ne=>{function Ie(){if(se.forEach(function(Fe){T.get(Fe).currentProgram.isReady()&&se.delete(Fe)}),se.size===0){ne(L);return}setTimeout(Ie,10)}K.get("KHR_parallel_shader_compile")!==null?Ie():setTimeout(Ie,10)})};let _f=null;function CT(L){_f&&_f(L)}function Jg(){Rr.stop()}function $g(){Rr.start()}const Rr=new em;Rr.setAnimationLoop(CT),typeof self<"u"&&Rr.setContext(self),this.setAnimationLoop=function(L){_f=L,Ee.setAnimationLoop(L),L===null?Rr.stop():Rr.start()},Ee.addEventListener("sessionstart",Jg),Ee.addEventListener("sessionend",$g),this.render=function(L,j){if(j!==void 0&&j.isCamera!==!0){Ge("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;const ae=Ee.enabled===!0&&Ee.isPresenting===!0,se=D!==null&&(O===null||ae)&&D.begin(b,O);if(L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),Ee.enabled===!0&&Ee.isPresenting===!0&&(D===null||D.isCompositing()===!1)&&(Ee.cameraAutoUpdate===!0&&Ee.updateCamera(j),j=Ee.getCamera()),L.isScene===!0&&L.onBeforeRender(b,L,j,O),A=Se.get(L,I.length),A.init(j),I.push(A),je.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),ye.setFromProjectionMatrix(je,gn,j.reversedDepth),ze=this.localClippingEnabled,Ae=Oe.init(this.clippingPlanes,ze),x=fe.get(L,E.length),x.init(),E.push(x),Ee.enabled===!0&&Ee.isPresenting===!0){const Fe=b.xr.getDepthSensingMesh();Fe!==null&&vf(Fe,j,-1/0,b.sortObjects)}vf(L,j,0,b.sortObjects),x.finish(),b.sortObjects===!0&&x.sort(_e,de),k=Ee.enabled===!1||Ee.isPresenting===!1||Ee.hasDepthSensing()===!1,k&&Me.addToRenderList(x,L),this.info.render.frame++,Ae===!0&&Oe.beginShadows();const ne=A.state.shadowsArray;if(Ue.render(ne,L,j),Ae===!0&&Oe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(se&&D.hasRenderPass())===!1){const Fe=x.opaque,Ne=x.transmissive;if(A.setupLights(),j.isArrayCamera){const Ve=j.cameras;if(Ne.length>0)for(let qe=0,Je=Ve.length;qe<Je;qe++){const Ze=Ve[qe];t0(Fe,Ne,L,Ze)}k&&Me.render(L);for(let qe=0,Je=Ve.length;qe<Je;qe++){const Ze=Ve[qe];e0(x,L,Ze,Ze.viewport)}}else Ne.length>0&&t0(Fe,Ne,L,j),k&&Me.render(L),e0(x,L,j)}O!==null&&R===0&&(F.updateMultisampleRenderTarget(O),F.updateRenderTargetMipmap(O)),se&&D.end(b),L.isScene===!0&&L.onAfterRender(b,L,j),De.resetDefaultState(),M=-1,z=null,I.pop(),I.length>0?(A=I[I.length-1],Ae===!0&&Oe.setGlobalState(b.clippingPlanes,A.state.camera)):A=null,E.pop(),E.length>0?x=E[E.length-1]:x=null};function vf(L,j,ae,se){if(L.visible===!1)return;if(L.layers.test(j.layers)){if(L.isGroup)ae=L.renderOrder;else if(L.isLOD)L.autoUpdate===!0&&L.update(j);else if(L.isLight)A.pushLight(L),L.castShadow&&A.pushShadow(L);else if(L.isSprite){if(!L.frustumCulled||ye.intersectsSprite(L)){se&&w.setFromMatrixPosition(L.matrixWorld).applyMatrix4(je);const Fe=we.update(L),Ne=L.material;Ne.visible&&x.push(L,Fe,Ne,ae,w.z,null)}}else if((L.isMesh||L.isLine||L.isPoints)&&(!L.frustumCulled||ye.intersectsObject(L))){const Fe=we.update(L),Ne=L.material;if(se&&(L.boundingSphere!==void 0?(L.boundingSphere===null&&L.computeBoundingSphere(),w.copy(L.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),w.copy(Fe.boundingSphere.center)),w.applyMatrix4(L.matrixWorld).applyMatrix4(je)),Array.isArray(Ne)){const Ve=Fe.groups;for(let qe=0,Je=Ve.length;qe<Je;qe++){const Ze=Ve[qe],st=Ne[Ze.materialIndex];st&&st.visible&&x.push(L,Fe,st,ae,w.z,Ze)}}else Ne.visible&&x.push(L,Fe,Ne,ae,w.z,null)}}const Ie=L.children;for(let Fe=0,Ne=Ie.length;Fe<Ne;Fe++)vf(Ie[Fe],j,ae,se)}function e0(L,j,ae,se){const{opaque:ne,transmissive:Ie,transparent:Fe}=L;A.setupLightsView(ae),Ae===!0&&Oe.setGlobalState(b.clippingPlanes,ae),se&&V.viewport(X.copy(se)),ne.length>0&&Nl(ne,j,ae),Ie.length>0&&Nl(Ie,j,ae),Fe.length>0&&Nl(Fe,j,ae),V.buffers.depth.setTest(!0),V.buffers.depth.setMask(!0),V.buffers.color.setMask(!0),V.setPolygonOffset(!1)}function t0(L,j,ae,se){if((ae.isScene===!0?ae.overrideMaterial:null)!==null)return;if(A.state.transmissionRenderTarget[se.id]===void 0){const st=K.has("EXT_color_buffer_half_float")||K.has("EXT_color_buffer_float");A.state.transmissionRenderTarget[se.id]=new vn(1,1,{generateMipmaps:!0,type:st?Zn:ln,minFilter:Mn,samples:ie.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:rt.workingColorSpace})}const Ie=A.state.transmissionRenderTarget[se.id],Fe=se.viewport||X;Ie.setSize(Fe.z*b.transmissionResolutionScale,Fe.w*b.transmissionResolutionScale);const Ne=b.getRenderTarget(),Ve=b.getActiveCubeFace(),qe=b.getActiveMipmapLevel();b.setRenderTarget(Ie),b.getClearColor(J),le=b.getClearAlpha(),le<1&&b.setClearColor(16777215,.5),b.clear(),k&&Me.render(ae);const Je=b.toneMapping;b.toneMapping=Nn;const Ze=se.viewport;if(se.viewport!==void 0&&(se.viewport=void 0),A.setupLightsView(se),Ae===!0&&Oe.setGlobalState(b.clippingPlanes,se),Nl(L,ae,se),F.updateMultisampleRenderTarget(Ie),F.updateRenderTargetMipmap(Ie),K.has("WEBGL_multisampled_render_to_texture")===!1){let st=!1;for(let mt=0,It=j.length;mt<It;mt++){const Rt=j[mt],{object:_t,geometry:Ye,material:dt,group:ht}=Rt;if(dt.side===Sn&&_t.layers.test(se.layers)){const bn=dt.side;dt.side=en,dt.needsUpdate=!0,n0(_t,ae,se,Ye,dt,ht),dt.side=bn,dt.needsUpdate=!0,st=!0}}st===!0&&(F.updateMultisampleRenderTarget(Ie),F.updateRenderTargetMipmap(Ie))}b.setRenderTarget(Ne,Ve,qe),b.setClearColor(J,le),Ze!==void 0&&(se.viewport=Ze),b.toneMapping=Je}function Nl(L,j,ae){const se=j.isScene===!0?j.overrideMaterial:null;for(let ne=0,Ie=L.length;ne<Ie;ne++){const Fe=L[ne],{object:Ne,geometry:Ve,group:qe}=Fe;let Je=Fe.material;Je.allowOverride===!0&&se!==null&&(Je=se),Ne.layers.test(ae.layers)&&n0(Ne,j,ae,Ve,Je,qe)}}function n0(L,j,ae,se,ne,Ie){L.onBeforeRender(b,j,ae,se,ne,Ie),L.modelViewMatrix.multiplyMatrices(ae.matrixWorldInverse,L.matrixWorld),L.normalMatrix.getNormalMatrix(L.modelViewMatrix),ne.onBeforeRender(b,j,ae,se,L,Ie),ne.transparent===!0&&ne.side===Sn&&ne.forceSinglePass===!1?(ne.side=en,ne.needsUpdate=!0,b.renderBufferDirect(ae,j,se,ne,L,Ie),ne.side=Wn,ne.needsUpdate=!0,b.renderBufferDirect(ae,j,se,ne,L,Ie),ne.side=Sn):b.renderBufferDirect(ae,j,se,ne,L,Ie),L.onAfterRender(b,j,ae,se,ne,Ie)}function Ul(L,j,ae){j.isScene!==!0&&(j=q);const se=T.get(L),ne=A.state.lights,Ie=A.state.shadowsArray,Fe=ne.state.version,Ne=Le.getParameters(L,ne.state,Ie,j,ae),Ve=Le.getProgramCacheKey(Ne);let qe=se.programs;se.environment=L.isMeshStandardMaterial?j.environment:null,se.fog=j.fog,se.envMap=(L.isMeshStandardMaterial?ce:Q).get(L.envMap||se.environment),se.envMapRotation=se.environment!==null&&L.envMap===null?j.environmentRotation:L.envMapRotation,qe===void 0&&(L.addEventListener("dispose",ii),qe=new Map,se.programs=qe);let Je=qe.get(Ve);if(Je!==void 0){if(se.currentProgram===Je&&se.lightsStateVersion===Fe)return r0(L,Ne),Je}else Ne.uniforms=Le.getUniforms(L),L.onBeforeCompile(Ne,b),Je=Le.acquireProgram(Ne,Ve),qe.set(Ve,Je),se.uniforms=Ne.uniforms;const Ze=se.uniforms;return(!L.isShaderMaterial&&!L.isRawShaderMaterial||L.clipping===!0)&&(Ze.clippingPlanes=Oe.uniform),r0(L,Ne),se.needsLights=PT(L),se.lightsStateVersion=Fe,se.needsLights&&(Ze.ambientLightColor.value=ne.state.ambient,Ze.lightProbe.value=ne.state.probe,Ze.directionalLights.value=ne.state.directional,Ze.directionalLightShadows.value=ne.state.directionalShadow,Ze.spotLights.value=ne.state.spot,Ze.spotLightShadows.value=ne.state.spotShadow,Ze.rectAreaLights.value=ne.state.rectArea,Ze.ltc_1.value=ne.state.rectAreaLTC1,Ze.ltc_2.value=ne.state.rectAreaLTC2,Ze.pointLights.value=ne.state.point,Ze.pointLightShadows.value=ne.state.pointShadow,Ze.hemisphereLights.value=ne.state.hemi,Ze.directionalShadowMap.value=ne.state.directionalShadowMap,Ze.directionalShadowMatrix.value=ne.state.directionalShadowMatrix,Ze.spotShadowMap.value=ne.state.spotShadowMap,Ze.spotLightMatrix.value=ne.state.spotLightMatrix,Ze.spotLightMap.value=ne.state.spotLightMap,Ze.pointShadowMap.value=ne.state.pointShadowMap,Ze.pointShadowMatrix.value=ne.state.pointShadowMatrix),se.currentProgram=Je,se.uniformsList=null,Je}function i0(L){if(L.uniformsList===null){const j=L.currentProgram.getUniforms();L.uniformsList=hl.seqWithValue(j.seq,L.uniforms)}return L.uniformsList}function r0(L,j){const ae=T.get(L);ae.outputColorSpace=j.outputColorSpace,ae.batching=j.batching,ae.batchingColor=j.batchingColor,ae.instancing=j.instancing,ae.instancingColor=j.instancingColor,ae.instancingMorph=j.instancingMorph,ae.skinning=j.skinning,ae.morphTargets=j.morphTargets,ae.morphNormals=j.morphNormals,ae.morphColors=j.morphColors,ae.morphTargetsCount=j.morphTargetsCount,ae.numClippingPlanes=j.numClippingPlanes,ae.numIntersection=j.numClipIntersection,ae.vertexAlphas=j.vertexAlphas,ae.vertexTangents=j.vertexTangents,ae.toneMapping=j.toneMapping}function IT(L,j,ae,se,ne){j.isScene!==!0&&(j=q),F.resetTextureUnits();const Ie=j.fog,Fe=se.isMeshStandardMaterial?j.environment:null,Ne=O===null?b.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:Xt,Ve=(se.isMeshStandardMaterial?ce:Q).get(se.envMap||Fe),qe=se.vertexColors===!0&&!!ae.attributes.color&&ae.attributes.color.itemSize===4,Je=!!ae.attributes.tangent&&(!!se.normalMap||se.anisotropy>0),Ze=!!ae.morphAttributes.position,st=!!ae.morphAttributes.normal,mt=!!ae.morphAttributes.color;let It=Nn;se.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(It=b.toneMapping);const Rt=ae.morphAttributes.position||ae.morphAttributes.normal||ae.morphAttributes.color,_t=Rt!==void 0?Rt.length:0,Ye=T.get(se),dt=A.state.lights;if(Ae===!0&&(ze===!0||L!==z)){const cn=L===z&&se.id===M;Oe.setState(se,L,cn)}let ht=!1;se.version===Ye.__version?(Ye.needsLights&&Ye.lightsStateVersion!==dt.state.version||Ye.outputColorSpace!==Ne||ne.isBatchedMesh&&Ye.batching===!1||!ne.isBatchedMesh&&Ye.batching===!0||ne.isBatchedMesh&&Ye.batchingColor===!0&&ne.colorTexture===null||ne.isBatchedMesh&&Ye.batchingColor===!1&&ne.colorTexture!==null||ne.isInstancedMesh&&Ye.instancing===!1||!ne.isInstancedMesh&&Ye.instancing===!0||ne.isSkinnedMesh&&Ye.skinning===!1||!ne.isSkinnedMesh&&Ye.skinning===!0||ne.isInstancedMesh&&Ye.instancingColor===!0&&ne.instanceColor===null||ne.isInstancedMesh&&Ye.instancingColor===!1&&ne.instanceColor!==null||ne.isInstancedMesh&&Ye.instancingMorph===!0&&ne.morphTexture===null||ne.isInstancedMesh&&Ye.instancingMorph===!1&&ne.morphTexture!==null||Ye.envMap!==Ve||se.fog===!0&&Ye.fog!==Ie||Ye.numClippingPlanes!==void 0&&(Ye.numClippingPlanes!==Oe.numPlanes||Ye.numIntersection!==Oe.numIntersection)||Ye.vertexAlphas!==qe||Ye.vertexTangents!==Je||Ye.morphTargets!==Ze||Ye.morphNormals!==st||Ye.morphColors!==mt||Ye.toneMapping!==It||Ye.morphTargetsCount!==_t)&&(ht=!0):(ht=!0,Ye.__version=se.version);let bn=Ye.currentProgram;ht===!0&&(bn=Ul(se,j,ne));let Ds=!1,wn=!1,Fo=!1;const yt=bn.getUniforms(),pn=Ye.uniforms;if(V.useProgram(bn.program)&&(Ds=!0,wn=!0,Fo=!0),se.id!==M&&(M=se.id,wn=!0),Ds||z!==L){V.buffers.depth.getReversed()&&L.reversedDepth!==!0&&(L._reversedDepth=!0,L.updateProjectionMatrix()),yt.setValue(S,"projectionMatrix",L.projectionMatrix),yt.setValue(S,"viewMatrix",L.matrixWorldInverse);const mn=yt.map.cameraPosition;mn!==void 0&&mn.setValue(S,He.setFromMatrixPosition(L.matrixWorld)),ie.logarithmicDepthBuffer&&yt.setValue(S,"logDepthBufFC",2/(Math.log(L.far+1)/Math.LN2)),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&yt.setValue(S,"isOrthographic",L.isOrthographicCamera===!0),z!==L&&(z=L,wn=!0,Fo=!0)}if(Ye.needsLights&&(dt.state.directionalShadowMap.length>0&&yt.setValue(S,"directionalShadowMap",dt.state.directionalShadowMap,F),dt.state.spotShadowMap.length>0&&yt.setValue(S,"spotShadowMap",dt.state.spotShadowMap,F),dt.state.pointShadowMap.length>0&&yt.setValue(S,"pointShadowMap",dt.state.pointShadowMap,F)),ne.isSkinnedMesh){yt.setOptional(S,ne,"bindMatrix"),yt.setOptional(S,ne,"bindMatrixInverse");const cn=ne.skeleton;cn&&(cn.boneTexture===null&&cn.computeBoneTexture(),yt.setValue(S,"boneTexture",cn.boneTexture,F))}ne.isBatchedMesh&&(yt.setOptional(S,ne,"batchingTexture"),yt.setValue(S,"batchingTexture",ne._matricesTexture,F),yt.setOptional(S,ne,"batchingIdTexture"),yt.setValue(S,"batchingIdTexture",ne._indirectTexture,F),yt.setOptional(S,ne,"batchingColorTexture"),ne._colorsTexture!==null&&yt.setValue(S,"batchingColorTexture",ne._colorsTexture,F));const Ln=ae.morphAttributes;if((Ln.position!==void 0||Ln.normal!==void 0||Ln.color!==void 0)&&it.update(ne,ae,bn),(wn||Ye.receiveShadow!==ne.receiveShadow)&&(Ye.receiveShadow=ne.receiveShadow,yt.setValue(S,"receiveShadow",ne.receiveShadow)),se.isMeshGouraudMaterial&&se.envMap!==null&&(pn.envMap.value=Ve,pn.flipEnvMap.value=Ve.isCubeTexture&&Ve.isRenderTargetTexture===!1?-1:1),se.isMeshStandardMaterial&&se.envMap===null&&j.environment!==null&&(pn.envMapIntensity.value=j.environmentIntensity),pn.dfgLUT!==void 0&&(pn.dfgLUT.value=rw()),wn&&(yt.setValue(S,"toneMappingExposure",b.toneMappingExposure),Ye.needsLights&&RT(pn,Fo),Ie&&se.fog===!0&&Xe.refreshFogUniforms(pn,Ie),Xe.refreshMaterialUniforms(pn,se,ge,Z,A.state.transmissionRenderTarget[L.id]),hl.upload(S,i0(Ye),pn,F)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(hl.upload(S,i0(Ye),pn,F),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&yt.setValue(S,"center",ne.center),yt.setValue(S,"modelViewMatrix",ne.modelViewMatrix),yt.setValue(S,"normalMatrix",ne.normalMatrix),yt.setValue(S,"modelMatrix",ne.matrixWorld),se.isShaderMaterial||se.isRawShaderMaterial){const cn=se.uniformsGroups;for(let mn=0,yf=cn.length;mn<yf;mn++){const Pr=cn[mn];ve.update(Pr,bn),ve.bind(Pr,bn)}}return bn}function RT(L,j){L.ambientLightColor.needsUpdate=j,L.lightProbe.needsUpdate=j,L.directionalLights.needsUpdate=j,L.directionalLightShadows.needsUpdate=j,L.pointLights.needsUpdate=j,L.pointLightShadows.needsUpdate=j,L.spotLights.needsUpdate=j,L.spotLightShadows.needsUpdate=j,L.rectAreaLights.needsUpdate=j,L.hemisphereLights.needsUpdate=j}function PT(L){return L.isMeshLambertMaterial||L.isMeshToonMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isShadowMaterial||L.isShaderMaterial&&L.lights===!0}this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(L,j,ae){const se=T.get(L);se.__autoAllocateDepthBuffer=L.resolveDepthBuffer===!1,se.__autoAllocateDepthBuffer===!1&&(se.__useRenderToTexture=!1),T.get(L.texture).__webglTexture=j,T.get(L.depthTexture).__webglTexture=se.__autoAllocateDepthBuffer?void 0:ae,se.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(L,j){const ae=T.get(L);ae.__webglFramebuffer=j,ae.__useDefaultFramebuffer=j===void 0};const DT=S.createFramebuffer();this.setRenderTarget=function(L,j=0,ae=0){O=L,B=j,R=ae;let se=null,ne=!1,Ie=!1;if(L){const Ne=T.get(L);if(Ne.__useDefaultFramebuffer!==void 0){V.bindFramebuffer(S.FRAMEBUFFER,Ne.__webglFramebuffer),X.copy(L.viewport),H.copy(L.scissor),re=L.scissorTest,V.viewport(X),V.scissor(H),V.setScissorTest(re),M=-1;return}else if(Ne.__webglFramebuffer===void 0)F.setupRenderTarget(L);else if(Ne.__hasExternalTextures)F.rebindTextures(L,T.get(L.texture).__webglTexture,T.get(L.depthTexture).__webglTexture);else if(L.depthBuffer){const Je=L.depthTexture;if(Ne.__boundDepthTexture!==Je){if(Je!==null&&T.has(Je)&&(L.width!==Je.image.width||L.height!==Je.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");F.setupDepthRenderbuffer(L)}}const Ve=L.texture;(Ve.isData3DTexture||Ve.isDataArrayTexture||Ve.isCompressedArrayTexture)&&(Ie=!0);const qe=T.get(L).__webglFramebuffer;L.isWebGLCubeRenderTarget?(Array.isArray(qe[j])?se=qe[j][ae]:se=qe[j],ne=!0):L.samples>0&&F.useMultisampledRTT(L)===!1?se=T.get(L).__webglMultisampledFramebuffer:Array.isArray(qe)?se=qe[ae]:se=qe,X.copy(L.viewport),H.copy(L.scissor),re=L.scissorTest}else X.copy(oe).multiplyScalar(ge).floor(),H.copy(ee).multiplyScalar(ge).floor(),re=pe;if(ae!==0&&(se=DT),V.bindFramebuffer(S.FRAMEBUFFER,se)&&V.drawBuffers(L,se),V.viewport(X),V.scissor(H),V.setScissorTest(re),ne){const Ne=T.get(L.texture);S.framebufferTexture2D(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_CUBE_MAP_POSITIVE_X+j,Ne.__webglTexture,ae)}else if(Ie){const Ne=j;for(let Ve=0;Ve<L.textures.length;Ve++){const qe=T.get(L.textures[Ve]);S.framebufferTextureLayer(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0+Ve,qe.__webglTexture,ae,Ne)}}else if(L!==null&&ae!==0){const Ne=T.get(L.texture);S.framebufferTexture2D(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,Ne.__webglTexture,ae)}M=-1},this.readRenderTargetPixels=function(L,j,ae,se,ne,Ie,Fe,Ne=0){if(!(L&&L.isWebGLRenderTarget)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ve=T.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Fe!==void 0&&(Ve=Ve[Fe]),Ve){V.bindFramebuffer(S.FRAMEBUFFER,Ve);try{const qe=L.textures[Ne],Je=qe.format,Ze=qe.type;if(!ie.textureFormatReadable(Je)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ie.textureTypeReadable(Ze)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=L.width-se&&ae>=0&&ae<=L.height-ne&&(L.textures.length>1&&S.readBuffer(S.COLOR_ATTACHMENT0+Ne),S.readPixels(j,ae,se,ne,be.convert(Je),be.convert(Ze),Ie))}finally{const qe=O!==null?T.get(O).__webglFramebuffer:null;V.bindFramebuffer(S.FRAMEBUFFER,qe)}}},this.readRenderTargetPixelsAsync=async function(L,j,ae,se,ne,Ie,Fe,Ne=0){if(!(L&&L.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ve=T.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Fe!==void 0&&(Ve=Ve[Fe]),Ve)if(j>=0&&j<=L.width-se&&ae>=0&&ae<=L.height-ne){V.bindFramebuffer(S.FRAMEBUFFER,Ve);const qe=L.textures[Ne],Je=qe.format,Ze=qe.type;if(!ie.textureFormatReadable(Je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ie.textureTypeReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const st=S.createBuffer();S.bindBuffer(S.PIXEL_PACK_BUFFER,st),S.bufferData(S.PIXEL_PACK_BUFFER,Ie.byteLength,S.STREAM_READ),L.textures.length>1&&S.readBuffer(S.COLOR_ATTACHMENT0+Ne),S.readPixels(j,ae,se,ne,be.convert(Je),be.convert(Ze),0);const mt=O!==null?T.get(O).__webglFramebuffer:null;V.bindFramebuffer(S.FRAMEBUFFER,mt);const It=S.fenceSync(S.SYNC_GPU_COMMANDS_COMPLETE,0);return S.flush(),await Y0(S,It,4),S.bindBuffer(S.PIXEL_PACK_BUFFER,st),S.getBufferSubData(S.PIXEL_PACK_BUFFER,0,Ie),S.deleteBuffer(st),S.deleteSync(It),Ie}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(L,j=null,ae=0){const se=Math.pow(2,-ae),ne=Math.floor(L.image.width*se),Ie=Math.floor(L.image.height*se),Fe=j!==null?j.x:0,Ne=j!==null?j.y:0;F.setTexture2D(L,0),S.copyTexSubImage2D(S.TEXTURE_2D,ae,0,0,Fe,Ne,ne,Ie),V.unbindTexture()};const LT=S.createFramebuffer(),NT=S.createFramebuffer();this.copyTextureToTexture=function(L,j,ae=null,se=null,ne=0,Ie=null){Ie===null&&(ne!==0?(Gr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Ie=ne,ne=0):Ie=0);let Fe,Ne,Ve,qe,Je,Ze,st,mt,It;const Rt=L.isCompressedTexture?L.mipmaps[Ie]:L.image;if(ae!==null)Fe=ae.max.x-ae.min.x,Ne=ae.max.y-ae.min.y,Ve=ae.isBox3?ae.max.z-ae.min.z:1,qe=ae.min.x,Je=ae.min.y,Ze=ae.isBox3?ae.min.z:0;else{const Ln=Math.pow(2,-ne);Fe=Math.floor(Rt.width*Ln),Ne=Math.floor(Rt.height*Ln),L.isDataArrayTexture?Ve=Rt.depth:L.isData3DTexture?Ve=Math.floor(Rt.depth*Ln):Ve=1,qe=0,Je=0,Ze=0}se!==null?(st=se.x,mt=se.y,It=se.z):(st=0,mt=0,It=0);const _t=be.convert(j.format),Ye=be.convert(j.type);let dt;j.isData3DTexture?(F.setTexture3D(j,0),dt=S.TEXTURE_3D):j.isDataArrayTexture||j.isCompressedArrayTexture?(F.setTexture2DArray(j,0),dt=S.TEXTURE_2D_ARRAY):(F.setTexture2D(j,0),dt=S.TEXTURE_2D),S.pixelStorei(S.UNPACK_FLIP_Y_WEBGL,j.flipY),S.pixelStorei(S.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),S.pixelStorei(S.UNPACK_ALIGNMENT,j.unpackAlignment);const ht=S.getParameter(S.UNPACK_ROW_LENGTH),bn=S.getParameter(S.UNPACK_IMAGE_HEIGHT),Ds=S.getParameter(S.UNPACK_SKIP_PIXELS),wn=S.getParameter(S.UNPACK_SKIP_ROWS),Fo=S.getParameter(S.UNPACK_SKIP_IMAGES);S.pixelStorei(S.UNPACK_ROW_LENGTH,Rt.width),S.pixelStorei(S.UNPACK_IMAGE_HEIGHT,Rt.height),S.pixelStorei(S.UNPACK_SKIP_PIXELS,qe),S.pixelStorei(S.UNPACK_SKIP_ROWS,Je),S.pixelStorei(S.UNPACK_SKIP_IMAGES,Ze);const yt=L.isDataArrayTexture||L.isData3DTexture,pn=j.isDataArrayTexture||j.isData3DTexture;if(L.isDepthTexture){const Ln=T.get(L),cn=T.get(j),mn=T.get(Ln.__renderTarget),yf=T.get(cn.__renderTarget);V.bindFramebuffer(S.READ_FRAMEBUFFER,mn.__webglFramebuffer),V.bindFramebuffer(S.DRAW_FRAMEBUFFER,yf.__webglFramebuffer);for(let Pr=0;Pr<Ve;Pr++)yt&&(S.framebufferTextureLayer(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,T.get(L).__webglTexture,ne,Ze+Pr),S.framebufferTextureLayer(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,T.get(j).__webglTexture,Ie,It+Pr)),S.blitFramebuffer(qe,Je,Fe,Ne,st,mt,Fe,Ne,S.DEPTH_BUFFER_BIT,S.NEAREST);V.bindFramebuffer(S.READ_FRAMEBUFFER,null),V.bindFramebuffer(S.DRAW_FRAMEBUFFER,null)}else if(ne!==0||L.isRenderTargetTexture||T.has(L)){const Ln=T.get(L),cn=T.get(j);V.bindFramebuffer(S.READ_FRAMEBUFFER,LT),V.bindFramebuffer(S.DRAW_FRAMEBUFFER,NT);for(let mn=0;mn<Ve;mn++)yt?S.framebufferTextureLayer(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,Ln.__webglTexture,ne,Ze+mn):S.framebufferTexture2D(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,Ln.__webglTexture,ne),pn?S.framebufferTextureLayer(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,cn.__webglTexture,Ie,It+mn):S.framebufferTexture2D(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_2D,cn.__webglTexture,Ie),ne!==0?S.blitFramebuffer(qe,Je,Fe,Ne,st,mt,Fe,Ne,S.COLOR_BUFFER_BIT,S.NEAREST):pn?S.copyTexSubImage3D(dt,Ie,st,mt,It+mn,qe,Je,Fe,Ne):S.copyTexSubImage2D(dt,Ie,st,mt,qe,Je,Fe,Ne);V.bindFramebuffer(S.READ_FRAMEBUFFER,null),V.bindFramebuffer(S.DRAW_FRAMEBUFFER,null)}else pn?L.isDataTexture||L.isData3DTexture?S.texSubImage3D(dt,Ie,st,mt,It,Fe,Ne,Ve,_t,Ye,Rt.data):j.isCompressedArrayTexture?S.compressedTexSubImage3D(dt,Ie,st,mt,It,Fe,Ne,Ve,_t,Rt.data):S.texSubImage3D(dt,Ie,st,mt,It,Fe,Ne,Ve,_t,Ye,Rt):L.isDataTexture?S.texSubImage2D(S.TEXTURE_2D,Ie,st,mt,Fe,Ne,_t,Ye,Rt.data):L.isCompressedTexture?S.compressedTexSubImage2D(S.TEXTURE_2D,Ie,st,mt,Rt.width,Rt.height,_t,Rt.data):S.texSubImage2D(S.TEXTURE_2D,Ie,st,mt,Fe,Ne,_t,Ye,Rt);S.pixelStorei(S.UNPACK_ROW_LENGTH,ht),S.pixelStorei(S.UNPACK_IMAGE_HEIGHT,bn),S.pixelStorei(S.UNPACK_SKIP_PIXELS,Ds),S.pixelStorei(S.UNPACK_SKIP_ROWS,wn),S.pixelStorei(S.UNPACK_SKIP_IMAGES,Fo),Ie===0&&j.generateMipmaps&&S.generateMipmap(dt),V.unbindTexture()},this.initRenderTarget=function(L){T.get(L).__webglFramebuffer===void 0&&F.setupRenderTarget(L)},this.initTexture=function(L){L.isCubeTexture?F.setTextureCube(L,0):L.isData3DTexture?F.setTexture3D(L,0):L.isDataArrayTexture||L.isCompressedArrayTexture?F.setTexture2DArray(L,0):F.setTexture2D(L,0),V.unbindTexture()},this.resetState=function(){B=0,R=0,O=null,V.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return gn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=rt._getDrawingBufferColorSpace(e),t.unpackColorSpace=rt._getUnpackColorSpace()}}const sw=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Yo,AddEquation:_i,AddOperation:Hf,AdditiveBlending:Ol,AgXToneMapping:Wl,AlphaFormat:jl,AlwaysCompare:td,AlwaysDepth:Ho,ArrayCamera:Fp,BackSide:en,BoxGeometry:ji,BufferAttribute:ot,BufferGeometry:Ke,ByteType:Zl,CineonToneMapping:Hl,ClampToEdgeWrapping:tn,Color:xe,ColorManagement:rt,ConstantAlphaFactor:zf,ConstantColorFactor:Of,CubeDepthTexture:Jd,CubeReflectionMapping:Xn,CubeRefractionMapping:vi,CubeTexture:Js,CubeUVReflectionMapping:Lr,CullFaceBack:Bl,CullFaceFront:Af,CullFaceNone:xf,CustomBlending:wf,CustomToneMapping:Gl,Data3DTexture:Ha,DataArrayTexture:Va,DataTexture:Fn,DepthFormat:Yn,DepthStencilFormat:xi,DepthTexture:ds,DoubleSide:Sn,DstAlphaFactor:Df,DstColorFactor:Nf,EqualCompare:Jf,EqualDepth:Wo,EquirectangularReflectionMapping:Us,EquirectangularRefractionMapping:Bs,Euler:Zt,EventDispatcher:Qn,ExternalTexture:Vh,Float32BufferAttribute:Be,FloatType:nn,FrontSide:Wn,Frustum:fs,GLSL3:nh,GreaterCompare:$f,GreaterDepth:Xo,GreaterEqualCompare:za,GreaterEqualDepth:qo,HalfFloatType:Zn,IntType:jo,Layers:Qa,LessCompare:jf,LessDepth:Go,LessEqualCompare:Fa,LessEqualDepth:Vi,LinearFilter:pt,LinearMipmapLinearFilter:Mn,LinearMipmapNearestFilter:Ur,LinearSRGBColorSpace:Xt,LinearToneMapping:kl,LinearTransfer:Gs,Matrix3:et,Matrix4:We,MaxEquation:Tf,Mesh:St,MeshBasicMaterial:un,MeshDepthMaterial:nu,MeshDistanceMaterial:iu,MinEquation:Ef,MirroredRepeatWrapping:Nr,MixOperation:Vf,MultiplyBlending:zl,MultiplyOperation:Ns,NearestFilter:Mt,NearestMipmapLinearFilter:Hi,NearestMipmapNearestFilter:Ko,NeutralToneMapping:ql,NeverCompare:Kf,NeverDepth:Vo,NoBlending:qn,NoColorSpace:ri,NoToneMapping:Nn,NormalBlending:ki,NotEqualCompare:ed,NotEqualDepth:Zo,ObjectSpaceNormalMap:Qf,OneFactor:If,OneMinusConstantAlphaFactor:kf,OneMinusConstantColorFactor:Ff,OneMinusDstAlphaFactor:Lf,OneMinusDstColorFactor:Uf,OneMinusSrcAlphaFactor:ko,OneMinusSrcColorFactor:Pf,OrthographicCamera:ur,PCFShadowMap:Ls,PCFSoftShadowMap:bf,PMREMGenerator:Lu,PerspectiveCamera:kt,Plane:Ri,PlaneGeometry:rr,R11_EAC_Format:ha,RED_GREEN_RGTC2_Format:La,RED_RGTC1_Format:Pa,REVISION:Yt,RG11_EAC_Format:fa,RGBAFormat:rn,RGBAIntegerFormat:na,RGBA_ASTC_10x10_Format:Ma,RGBA_ASTC_10x5_Format:ba,RGBA_ASTC_10x6_Format:wa,RGBA_ASTC_10x8_Format:Sa,RGBA_ASTC_12x10_Format:Ea,RGBA_ASTC_12x12_Format:Ta,RGBA_ASTC_4x4_Format:pa,RGBA_ASTC_5x4_Format:ma,RGBA_ASTC_5x5_Format:ga,RGBA_ASTC_6x5_Format:_a,RGBA_ASTC_6x6_Format:va,RGBA_ASTC_8x5_Format:ya,RGBA_ASTC_8x6_Format:xa,RGBA_ASTC_8x8_Format:Aa,RGBA_BPTC_Format:Ca,RGBA_ETC2_EAC_Format:la,RGBA_PVRTC_2BPPV1_Format:oa,RGBA_PVRTC_4BPPV1_Format:sa,RGBA_S3TC_DXT1_Format:zs,RGBA_S3TC_DXT3_Format:ks,RGBA_S3TC_DXT5_Format:Vs,RGBFormat:Jl,RGB_BPTC_SIGNED_Format:Ia,RGB_BPTC_UNSIGNED_Format:Ra,RGB_ETC1_Format:aa,RGB_ETC2_Format:ca,RGB_PVRTC_2BPPV1_Format:ra,RGB_PVRTC_4BPPV1_Format:ia,RGB_S3TC_DXT1_Format:Fs,RGFormat:Gi,RGIntegerFormat:ta,RawShaderMaterial:tu,RedFormat:ea,RedIntegerFormat:Os,ReinhardToneMapping:Vl,RepeatWrapping:yi,ReverseSubtractEquation:Mf,SIGNED_R11_EAC_Format:ua,SIGNED_RED_GREEN_RGTC2_Format:Na,SIGNED_RED_RGTC1_Format:Da,SIGNED_RG11_EAC_Format:da,SRGBColorSpace:Tt,SRGBTransfer:ut,ShaderChunk:nt,ShaderLib:Vn,ShaderMaterial:Cn,ShortType:Yl,SrcAlphaFactor:zo,SrcAlphaSaturateFactor:Bf,SrcColorFactor:Rf,SubtractEquation:Sf,SubtractiveBlending:Fl,TangentSpaceNormalMap:Ai,Texture:xt,Uint16BufferAttribute:wh,Uint32BufferAttribute:Sh,UniformsLib:Ce,UniformsUtils:Sd,UnsignedByteType:ln,UnsignedInt101111Type:Kl,UnsignedInt248Type:Or,UnsignedInt5999Type:Ql,UnsignedIntType:En,UnsignedShort4444Type:Jo,UnsignedShort5551Type:$o,UnsignedShortType:Br,VSMShadowMap:Dr,Vector2:he,Vector3:U,Vector4:gt,WebGLCoordinateSystem:gn,WebGLCubeRenderTarget:Th,WebGLRenderTarget:vn,WebGLRenderer:Cm,WebGLUtils:Tm,WebXRController:ac,ZeroFactor:Cf,createCanvasElement:rd,error:Ge,log:qs,warn:Te,warnOnce:Gr,AdditiveAnimationBlendMode:$l,AlwaysStencilFunc:th,AmbientLight:mu,AnimationAction:Hp,AnimationClip:vs,AnimationLoader:Ov,AnimationMixer:hy,AnimationObjectGroup:cy,AnimationUtils:Lv,ArcCurve:ep,ArrowHelper:Oy,AttachedBindMode:Xl,Audio:zp,AudioAnalyser:Jv,AudioContext:vu,AudioListener:Qv,AudioLoader:Xv,AxesHelper:Fy,BasicDepthPacking:Yf,BasicShadowMap:a0,BatchedMesh:Wd,Bone:mc,BooleanKeyframeTrack:or,Box2:Ay,Box3:Gt,Box3Helper:Uy,BoxHelper:Ny,BufferGeometryLoader:Dp,Cache:$n,Camera:oc,CameraHelper:Ly,CanvasTexture:nv,CapsuleGeometry:Rc,CatmullRomCurve3:tp,CircleGeometry:Pc,Clock:el,ColorKeyframeTrack:au,CompressedArrayTexture:ev,CompressedCubeTexture:tv,CompressedTexture:Ic,CompressedTextureLoader:Fv,ConeGeometry:co,Controls:ky,CubeCamera:Td,CubeTextureLoader:zv,CubicBezierCurve:Zh,CubicBezierCurve3:ip,CubicInterpolant:wp,CullFaceFrontBack:o0,Curve:zn,CurvePath:sp,CylinderGeometry:ao,Cylindrical:xy,DataTextureLoader:kv,DataUtils:M_,DecrementStencilOp:b0,DecrementWrapStencilOp:S0,DefaultLoadingManager:Ep,DetachedBindMode:Gf,DirectionalLight:jc,DirectionalLightHelper:Dy,DiscreteInterpolant:Sp,DodecahedronGeometry:Dc,DynamicCopyUsage:z0,DynamicDrawUsage:L0,DynamicReadUsage:B0,EdgesGeometry:$d,EllipseCurve:Bc,EqualStencilFunc:C0,ExtrudeGeometry:Hc,FileLoader:An,Float16BufferAttribute:D_,Fog:lc,FogExp2:cc,FramebufferTexture:$_,FrustumArray:yc,GLBufferAttribute:my,GLSL1:V0,GreaterEqualStencilFunc:D0,GreaterStencilFunc:R0,GridHelper:Ry,Group:Kn,HemisphereLight:hu,HemisphereLightHelper:Iy,IcosahedronGeometry:Gc,ImageBitmapLoader:Up,ImageLoader:_o,ImageUtils:hd,IncrementStencilOp:A0,IncrementWrapStencilOp:w0,InstancedBufferAttribute:Ji,InstancedBufferGeometry:Pp,InstancedInterleavedBuffer:py,InstancedMesh:_c,Int16BufferAttribute:R_,Int32BufferAttribute:P_,Int8BufferAttribute:T_,InterleavedBuffer:os,InterleavedBufferAttribute:fi,Interpolant:_s,InterpolateDiscrete:Fr,InterpolateLinear:zr,InterpolateSmooth:Ua,InterpolationSamplingMode:W0,InterpolationSamplingType:G0,InvertStencilOp:M0,KeepStencilOp:Xi,KeyframeTrack:Pn,LOD:Ld,LatheGeometry:Wc,LessEqualStencilFunc:I0,LessStencilFunc:T0,Light:Di,LightProbe:Rp,Line:di,Line3:Sy,LineBasicMaterial:qt,LineCurve:Yh,LineCurve3:rp,LineDashedMaterial:Ap,LineLoop:Fh,LineSegments:In,LinearInterpolant:ou,LinearMipMapLinearFilter:u0,LinearMipMapNearestFilter:h0,Loader:Jt,LoaderUtils:Li,LoadingManager:cu,LoopOnce:Wf,LoopPingPong:Xf,LoopRepeat:qf,MOUSE:zi,Material:zt,MaterialLoader:Jc,MathUtils:ka,Matrix2:Su,MeshLambertMaterial:yp,MeshMatcapMaterial:xp,MeshNormalMaterial:vp,MeshPhongMaterial:gp,MeshPhysicalMaterial:Rn,MeshStandardMaterial:gs,MeshToonMaterial:_p,NearestMipMapLinearFilter:l0,NearestMipMapNearestFilter:c0,NeverStencilFunc:E0,NoNormalPacking:g0,NormalAnimationBlendMode:Ba,NormalGAPacking:v0,NormalRGPacking:_0,NotEqualStencilFunc:P0,NumberKeyframeTrack:ar,Object3D:ct,ObjectLoader:Wv,OctahedronGeometry:go,Path:zc,PlaneHelper:By,PointLight:pu,PointLightHelper:Ty,Points:kh,PointsMaterial:Ec,PolarGridHelper:Py,PolyhedronGeometry:Pi,PositionalAudio:jv,PropertyBinding:lt,PropertyMixer:Vp,QuadraticBezierCurve:Qh,QuadraticBezierCurve3:Kh,Quaternion:wt,QuaternionKeyframeTrack:cr,QuaternionLinearInterpolant:Mp,RGBADepthPacking:d0,RGBDepthPacking:p0,RGBIntegerFormat:f0,RGDepthPacking:m0,Ray:Kr,Raycaster:gy,RectAreaLight:Ip,RenderTarget:ch,RenderTarget3D:uy,ReplaceStencilOp:x0,RingGeometry:qc,Scene:Ch,ShadowMaterial:mp,Shape:nr,ShapeGeometry:Xc,ShapePath:zy,ShapeUtils:kn,Skeleton:no,SkeletonHelper:Ey,SkinnedMesh:Lh,Source:wi,Sphere:Pt,SphereGeometry:ms,Spherical:yy,SphericalHarmonics3:gu,SplineCurve:jh,SpotLight:du,SpotLightHelper:My,Sprite:Pd,SpriteMaterial:Ih,StaticCopyUsage:F0,StaticDrawUsage:kr,StaticReadUsage:U0,StereoCamera:Zv,StreamCopyUsage:k0,StreamDrawUsage:N0,StreamReadUsage:O0,StringKeyframeTrack:lr,TOUCH:s0,TetrahedronGeometry:Zc,TextureLoader:lu,TextureUtils:qy,Timer:_y,TimestampQuery:H0,TorusGeometry:Yc,TorusKnotGeometry:Qc,Triangle:hn,TriangleFanDrawMode:Oa,TriangleStripDrawMode:eh,TrianglesDrawMode:Zf,TubeGeometry:Kc,UVMapping:Qo,Uint8BufferAttribute:C_,Uint8ClampedBufferAttribute:I_,Uniform:bu,UniformsGroup:dy,VectorKeyframeTrack:hr,VideoFrameTexture:J_,VideoTexture:jd,WebGL3DRenderTarget:m_,WebGLArrayRenderTarget:p_,WebGPUCoordinateSystem:Vr,WireframeGeometry:eu,WrapAroundEnding:Hs,ZeroCurvatureEnding:Wi,ZeroSlopeEnding:qi,ZeroStencilOp:y0,getConsoleFunction:Z0,setConsoleFunction:X0},Symbol.toStringTag,{value:"Module"}));var fl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ow=function(e){return aw(e)&&!cw(e)};function aw(r){return!!r&&typeof r=="object"}function cw(r){var e=Object.prototype.toString.call(r);return e==="[object RegExp]"||e==="[object Date]"||uw(r)}var lw=typeof Symbol=="function"&&Symbol.for,hw=lw?Symbol.for("react.element"):60103;function uw(r){return r.$$typeof===hw}function fw(r){return Array.isArray(r)?[]:{}}function Ao(r,e){return e.clone!==!1&&e.isMergeableObject(r)?Ss(fw(r),r,e):r}function dw(r,e,t){return r.concat(e).map(function(n){return Ao(n,t)})}function pw(r,e){if(!e.customMerge)return Ss;var t=e.customMerge(r);return typeof t=="function"?t:Ss}function mw(r){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r).filter(function(e){return Object.propertyIsEnumerable.call(r,e)}):[]}function Im(r){return Object.keys(r).concat(mw(r))}function Rm(r,e){try{return e in r}catch{return!1}}function gw(r,e){return Rm(r,e)&&!(Object.hasOwnProperty.call(r,e)&&Object.propertyIsEnumerable.call(r,e))}function _w(r,e,t){var n={};return t.isMergeableObject(r)&&Im(r).forEach(function(i){n[i]=Ao(r[i],t)}),Im(e).forEach(function(i){gw(r,i)||(Rm(r,i)&&t.isMergeableObject(e[i])?n[i]=pw(i,t)(r[i],e[i],t):n[i]=Ao(e[i],t))}),n}function Ss(r,e,t){t=t||{},t.arrayMerge=t.arrayMerge||dw,t.isMergeableObject=t.isMergeableObject||ow,t.cloneUnlessOtherwiseSpecified=Ao;var n=Array.isArray(e),i=Array.isArray(r),s=n===i;return s?n?t.arrayMerge(r,e,t):_w(r,e,t):Ao(e,t)}Ss.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(n,i){return Ss(n,i,t)},{})};var vw=Ss,yw=vw;const xw=`
4020
4020
  data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAGtWSURBVHhe7Z2LkiQ7jlx3JP3/H0uj9dSghevteJGMzMiqOGYwAO5g5OMWya2ulfa/Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHt7Nv/6THx5+DP/+979v+XP9r3/969//KR8efgTPBfLwVdz1cjjFc8k8fBPPBfJwS376RTHluVge7sizSR8+znNZrPFcKg+f5tm4D2/lCy6L6v3d+tB+LpWHd/JcIA+X8oEL4+4/02894J8L5eFKngvk4TgXXxo//Wf20gP/uVAeTvJcIA/bXHRhPD+b/+T4wf9cJg+7PJv0YYnDl8bVP4ef+jm/+oA+9vznMnlY4blAHtocvDTu9pxPc/LwPvKs50J56PBcIA8phy6N3Wf81p/TE4f41jOei+Qh47lAHv7iwKWxuv6Kn8dP/4xfcQCvPvO5TB6O8lwgDy82L41PXRg/5ed392B++4XyXCYP4LlAfjkbF8fKune+VodTz73qMN157nTt0ms9F8nv5qqN+XBj3nhpXD3PfMvP8+6he/Xl8FwmDy2+ZcM9HGDx4pismT7/6vlVotd51wF5pwti/Jmfi+T38K4N+fBBLr44Js++apbZWXslOwfrVZfE5Lmj9/BcJD+fu260h01ucmmcnjNWPts38OlL4vTcH57L5GfyUzfir2Xh4jh9yHfmTr8ms7rualYP0U9cAKdf88Vzkfws7rrRHoZcdHHcbcYznb8704P11CXwzpk/PBfJz+CnbcJfx4cujl0fdN93d86zsuYdrBya3TUnDvldH3Tf74vnIvlu7rrRHgouuDg+7YPODOjOZZx4hufEQdh9xomD/GofdGZePBfJd3J6Ez1czPDi6MxWM5m/6oHOewPdOTCZ/SSTw7I7W81l/pVrQWfmxXORfBffsuEe/pvB5VHN7firHtj1QWdGsbpuldWD8NSBnM1c4YFd/8VziXwP795UDwvc4OLI1q16YGetZzJ7JyYH5c7hfCcPVP6L5yK5P9+68X4Fb7o4VrzTzwOZByqfmc5fzfQw3D2EMz/y3rXGqPwXz0VyX+62yR7+mw9fHFMdnFwDMs/ozChW13VZPew661YP5GzddM3J1zAq/8VzkdyPqzfTw5Dm5VHNZH7kfUoHq56nO3cXuofh6uE71cFkzcnnG5X/XCI349s23Y/l0G8dUy+aP6FHs2D6fE9nBnTn3kX34OvMZTORN9FPPANMdZB5f3gukntwt03267j44jihXzULIh1kntGZMSazJ5gccJ3ZlUN3ol81C6Y6yLw/PBfJZ3n3pnpwHPjnqsib6LuzJ14LrHqg8jtMn3Hi4KqesXrARp7SdzSwOwsiHWTei+cS+RwnNt7DkAO/dZzQuxpgffd1wFQHmefpzr2b7kG3cqCe0N+hgVP6P3gukvdz1432Y3nzbx1318BUNyrf6M5dRfdQq+amh+tE72ir60BXA5EOMu/Fc4m8l09vrl/DF18cVz8fKM3IPFD5nsnsDpNDrJqdHqhdDbC++rzVdUBpINJB5r14LpL38K4N9avZvDwm+qp2agasPgtEOsg8UPnMdL5iemBV8ysHqNI72pXrVp9tTPU/PJfI9ZzeRA9E4/LIfOWtanebAUoDU92o/Izp2p3DqVo7PTSVvqpVPbhqBnQ1I/OeS+RidjbcQ8KbfutQcydmrloDdjQj80Dlf4rqMJselNF8Z7bqwXTNyjNAZwZM9T88F8k13HWjfTUbv3VMdNZWZnZ7cGIN6GpG5hmdmXfQObyyGeWd1N7dg5UZY6q/eC6R89xlg/0ILvito6OtzLy7ByszRqSDzPN0507RPayyuclB2dGqmWr+dA9WZoDSQKT/4blIzvHuTfVjecNvHWqumpn0J59lnFhjRDrIPE93bpfuAZXNTQ7IjnZlf/JZRmcGTPUXzyVyhndtqB/N4cujo53sd2bByXlDaSDSQeZ5unOrdA+mbG5yKHa0nf5TawH3oKuBSH/xXCL7XL2ZfjyLl0e0hvUr+1UP7KwFKzNGpIPMYyazXboHUjY3OQw72qS/wyyY9obSo9kXzyWyxxWb6Fdws986Ts2uemB11tjRPJXvmcxmTA+hbL57CHa0Sb86250Dp2aNrgYi/cVzkaxxagP9Ki6+PHb6E96JZ4BpDzozINJB5jGT2YzJ4ZPNTg4/1nb6E96JZ4DdHigNRPqL5xKZc2oD/RoO/pNVpbGf9Se803NgtwdKA1NdMZmt6B4+08NN6ayd7KMadOa6a8AJz9jR/vBcIjNObqAfT3F5TA401iZ911uZO70GZD17YEcDkR4xnWemB0403z3sOprvMw9Es91nnFwDuh6oeqA0EOnPJTJgd/P8Gj50eXS9lblpDXbnwLQHXc3IPGYyq5gcNtms8jrapD/hnarB7hyoeqA0EOnPJdJkd/P8eC78J6tJH9WgM3dFDVbmwGQWdDUj85jJrGJy0GSzyutokz6qQWfu6hqszIGqB13tD89FkrO7eX40H7o8ut7darAyB7JZ0NWMzPN05yq6h0w21z3cWPP9Ce/ONeh6gHvQ1f7wXCIxpzbQj+NNl0fXW5mzejILrqhB1wNVD5RmZB6o/FWqgybzOwdbNZPN36nuzILdOcA96Gp/eC4RzVUb6as59PeOSd/1JvXqOmC114DSoxnQqcG0B0oDke7pzKzQOWSimc6hNum73mr97nXA16Drgao3Iv25RARXbaSv5cOXx5X1rg9O1aDrAe6B0kCkg8w7SXbQTA4u1ib9u+pdH1xRg6oHXe3Fc4n8k3dtqK9g4fLoaL7vepN6d7ZaA1ZmQVSDrge4B13NU/mnqA6ZyGd9pz9R785Wa8DKLIhq0PWMrvbiuUT+P+/aULfnzZfHdO4Kf2UNWJ0FK3Og6o2pfjXRQdPV1ZzXsvlJfXL21BrQ9Y2VOaOrvXgukf/HpzbWrbjg8mA/8lbrFX9HA10f7NQg80BXA5FewetWD4xoXffAYs33UQ06c1av+Kc10PXBtAaZB7rai+cSWd9cP4YDl8ekn9Sn/MwDUw10fbBTg6oHSgORznTnmO4BEs11Dqys73pWVz7IZk9oygOnfBDVYNoDpb347ZfI6sb5EVx8eXQ9q1f8E9p0Huz6oJo3pr0R6Z7OTIfOIRLNsL7TV/WKf0KbzoNMA13f6HqAe6C0F7/5Ejm1gb6ON14e0Vw1f0Jb9UBnHnR9oGZBZy2oeiPSjcpfpTpIIp/1rO96ql7xOx6YzGcemGpgpwZVD5T24rdeIldtpFvzocujqrv+nTyQaaDrA1+DzANdzci8k2SHSfdg8hr7kVfVJ7Q7eKDrg04Nqh4o7cVvvETetaFuw40uj66feSCaPzUDJh7INDCtQdUDpRmZdwXZYdI5mLJ+tZ5qu97uDOjMg64PohpUPVDai992ibx7U32Uw5dH11P1CS3K4OoZ0PFA1wedGnAPulrEZBZMDoruIcSa77ue1V2/431iJpsFUw1ENeh6htJe/KZLZLppvpYPXx5df9fbmbUMdmbBVANRDaY9UJqReTtkB0fnEJr0k5oz6GhRBt1Zy+DELOh4oOsbXc9Q2ovfcolctZFuxQ0vj0zreDuzUQYnZsFUA50aVD1QmpF5J6gOjupgyvrVOtM6XpRBdzbK4MQsmGpG5GVzhtJe/IZL5OrN9HEuvDyiuWo+01ZmqgyUV/mdDCYemNReA1UPupqiO9c9GLoHDmtZX9VTrePtZtCdjTJYmQGnasA9UNqLn36JdDfMV/Kmy6Oqp1qVQXf2qgxWZkCmgU4Nqh4ojenMZHQOiM6hk/WRF81kfpRBNfPuDHZmQaaBaQ24B0p78ZMvkd3Nc1u+4PLoeHfPYGUGZBrwNeh6htKMzNslOiw6h07WV3XXz+a/NYOJB3ZqwD1Q2oufeolcuZE+SnKBdA4b36/WmbYys5OtBr4/lcGuB6Y1qHoj0iPU/OQQiGZZn/SqnmodbydbDXx/VQYrM2CnBtwDpT0XyDdxo8uj401mfO7MdHNnppPBygyY1qDqgdKMzJuQHQ6dQ6bbe13VmdbxVnJnpps7Mz6DnRmwUwPugdJ+5CVyagPdhi+9PK7InRnOnZlOBiszYFqDqjci/TTRQVEdPr6f1B0tm1nJnRnOnZkrMuh4YFoD7oHSftwl8q4N9RZ+4eXRmbHcmbHcmelkMJkBXd+oeqA0T+VnZAdC52DJ+knNGUTeTu7MWO7MWO7M7GQw1UCnBtwDpf2oS2Rn49yK4R/Ns35ST7WdfLeZlQwmHohqkHmgq52ke5Cw5vuq7vpX5LvNTDKYaqBTg6r/w0+5RK7eTG/hhpdHx1O5M8P5pKe0KzOYasDXoOqB0jyVz3QOADXjNfYjT9WZFmWAOuo7+d1elDszPoOJB6Y1qPo//IRLZLppbsngn64mvdVTreP53JmxfNLralHuzPgMVmZApwbcg652guhAmBwyVZ1pHS/LnRnLO5rlVY9zZ8aYeGBag6p/8VwgN2Dj7x7sKy+aZz+a596yr6s89U5rnDszkwymGohqwD1QmqKa6256NZcdLJM6007k1ZnTmuXM48waUHMqg6lmTPsX336JdDfVLXnjH80zrcrAa9Fcd2ZFq3zLSrOceZatBtlcJ4NpDareiPRVooNA6V6b1FMty7szK1rlW1aa5czjbDXI5nwGU83IPKC0r75ETm+it/Fll0c15/Mpbde3rDTLmbeSQVcDasbgHijNU/lGteE7h0fWW600wP6JPPUqbde33NWuyCDTQFQD7oHSvvYS6W6YW/HGP5pn2sl8Spv4vra8o0WZNeB1wDOZB6IaVL0n8yZkm786VHxf1ZxB5Km8OrOiRbXliW+5q53MINNAVIOq/8M3XiKnNtBbOfRH86rOtBN56q36ndpypSnfcuatZJBpIKoB90BpRuYpss2uvOwgmdRRBqirOZ+73kk/qi1PfM6Zt5NBpoGoBlX/4rlA3sCbLg9gdZUB6mrO51PaqdryxLesNMuZpzLoeKBTA+6NSF8l2vzZ4RF5aibTJvmUFtWWT9WWd7QTGWQaiGpQ9S++7RI5vYkuZePvHuxbH82wn80jR3Mqr2hX1JYzHXR8y0rjzBrwOohmfAZRDbgHSgORXhFtdqVnB0hVZ1onn9I6teWra8tdLcpWg2zOZ7BTG0r7qktkdeO8nYv/7pFp1Uw0p/KKtltHnuUVHUSa8k9kMK0B90BpJ+gcEr6PPDUTedGsry0rzXJUW2b9nbXlTAeVFmXWgJrzGWTzwNeg6v/wLZfIVRvpOBf+01WmdTyfp16ntsx15oGqzjyQ1ZYn/k4GmQai2uhqK0SbPTswJvWJXGkTP6szD1R15Fnu1Jwzz3LkgYkHohpU/YvnAjnIm/9o3vFUnnpX1ZkHrM48sFJb7mqdDDoe8DXg3oh0j5rpbGo1kx0aquYMIq+TK+1knXnA6swDu7VlpVnOPJVBxwNRDar+xTdcIp2N9FEO/d2jqjNtkle0lfrdHujWlrvaJAOlATVjcG9E+pRoo3cPDq93tE7uet0684CqVz1gdeaBrLasNMuZpzLoeKBTG0q7/SVyagNdxuHfPqbaJK9o3fpOHrA68iwrzXLmZRl0alD1nsxTZBubvaxXdaZleepxnXnA6jt5IKstd7VJBl0NqBmD+xfPBbLBh//uMckrWreeeLs96HjAat9bjmrOmacyyDQj84DSjMwD2YZWXnZQWK00wH4nV1rkcw9UPfGmPdj1ANeWu9pKBpkGfA2q/sWdL5Fqs3yMX3x5TLyre9DxQLfmnHk+g0wDygfcA6XtoDa51yZ1pqnc9VbqaQ8ib7cHHQ9wbbmrrWSQacDXoOpf3PUSOb2JjrF4gUzqKAOvRXPRzMTnuuqB95QG3tWDldqy0rIMOp5R9UakV0SbWules3qqZbnSuvXEu1sPstpyV7NsNcjmfAbTGnD/4rlABtzw7x5Tb6W+olca8L3SQLcHu/VKBplmcA+U5on8ahMrPzsgrOYMIi/LJ+uVXmnA90oDp3rQrS0rzXLmGRMP+BpU/Ys7XiLVRno7N/6nqxWtW6/0SgO+VxrwfVcDUQ9WastK62SgNKBmPErbYXIoVPUkV1rkcw8iT/VdDfheacD3SgPdHnRry12tk0GmAV+Dqn9xt0vk9Cba5qJ/usq0Sa60lbrTKw34/h0aiHrQ8UClcbYasA8yzdPVJkQbOjoQvK7qaC7yI69bq15pIOtPa8D3SgNRD1Zqy0qbZJBpIKoB9y+eCyThjf90tZOj2jLrWd3p36VFOuj2oOOBFc3oeMDXgHtP5kVEm7l7MFjNGUQeclRb7tYrfaRFOjilAd8rDZysT2SQaUbVv7jTJbKyaS4juECqQ8D3Vk81n7vexF/tJ1qkA9amOljtwUqdZdDxjKo3Ip2JNnD3QPC6qjt5t17pMx2wFumAtUgHWa80MPEsV77lzDOmmlH1zwWiuNk/XXW9br3ST7QVHQG6Oqg0EPWgW69k0KkNpXnYrzat8r1W1Su5W1ee0oDvI80C7OqANaUD3ysNRD3IastdLcsg00BUA+5f3OUSqTbRWzjwT1deV/VKrrRuXXkTbUVHAKUjwK4OVN31LCttkoHSAPdAaSuozRwdCqpmjXWVI417EHmdflVHAKUjQFcHKxqIetCtLSttkoGqvQaq/sUdLpFTG2iLN/3T1UqOastcVz3w3kTLdARQOgIo3QLs6qDbg6y2rDSfQcczuAdKm6A2sdeiw0DNZLnSsrrTR9qKbgGUjgBKR4COFulA1VUPIk35KxlkmlH1zwUCbvJPV12vW3f6iZbpFkDpFkDpFkDpCNDVQbcHXFtWWieDqAbcA6VVRJs32/hWZ1qWK43rld4HUDoCKN0CKN0CKN0CdLRIB90edGvOmeczyDQQ1YD7F5++RFY2zlFu9NtHpUU+9yDyMm1FtwBK5wBK9wGUbgEqDfieNaA8y13NZ9CpAfdGpDPZpo0OgarOcqWpHkRepmU6AijdB1A6B1C6BdjRwUpvOaotK62TQaYZVf+7L5CLf/vYySt1p4+0Fd0HUHoUQOk+gNIRoKuDqAfKs6y0TgZRbXQ1RbRpvR5tfjXTyZHGPYi8TMt0BFC6D6D0KIDSfYBdHXR70K1PZNCpAfcvPnmJdDfMJSz89lHVmaZypUU+9yDyMi3TEUDpHEDpWQClqwBKR4CODqIeZLVlpRmZBnwNuGfYrzZpttlVzRkob7fOtExHAKVHAZQeBVA6B7hCB5VnOaotK01lkGkgqgH3Lz51iVSb6DKav33wjPIyrZMrLatX+kq3AErnAErvBlC6CqB0C9DRwUo9ycDXIPN2yTa6qldyVnf6SrcASlcBlN4JoHQVQOkI0NVBtwdZbVlpnQwyzci8F7/qArnhP11VGtedPtIyHQGUHgVQ+koApasA/+M/WXmsKR10a8tK8xkoDVT9KtmGB9ZzBpGHvFKrPtPB//lPZi8LoPRJAKVHAZRuAbo66PaAa8tKW8mgUwPuX3ziEjm1gUbc4A/nldatVR9pmW4BlJ4FUPqpAErnAEpHgG4PsnqSQVQD7lfJNriqV3JWRxrwvQ+gdBVA6ScCKD0LoHQL0NVB1INubVlpWQaZZlT977hAbvTbR6VxXXmRlukWQOlVAKW/I4DSfYBKA1EPKk1lkGkepU2YbHSrJzmrO32kcQClXx1A6Z0ASrcAXR2oOvNApU0y6NSA+xfvvkR2N8+Yzd8+vN7RkJVmeaXu9JVuAZTeCaD0TwZY1UHlWbYaqBnQqQH3U7KNXdU+s688Vau+0hFA6VcFwD+VcW291SsBlG4BOjqIetCtOUce6Gqg6n/2BXLwt49My3KlZXWnjzQOoPQqgNIt8DcJZGB/n1DZz/j1prNma1mvAnR0EPWAa85WA/ZBVAPup2SbWtWcAerIN6/qgfd8AKVnAfwhz57v1cUAUFuOfNTWW70aQOk+QKWBqAdZbVlpWQaZBnwNuH/xzktkd/OMuPC3j0muNK47faT5AEqvAiido7oYrg6gdB+g0kC37mQQ1YbSOqiNGm14qyfZAqha9ZHGAeyAV/7p8K/FtZ/jAEqvAijdAlQaiHrAtWWlTTLo1ID7n3mBfMlvHxMv0yyA0rMASs/iExdGN4DSESDqgfIsK01l4GtQ9V3URlWbPdNU7taZZgGU/ulYuUT8mkkApSNApYGJZ1lpWQaZBnwNuH/xrktkdeOMWfjto6pX8kqt+kjLdBVA6ZO44vLgZwKlmwfdZ57hAJUGurXKINM8SuugNqna7Jnmc1Rb9gE6WhSAD3Fgtc3YvNdPxe7zgH/fnQBdHUQ96NYrGXRqwP3PukA++NtHpWV1p690DqD0nfCHt/InceIZKoDSLUC3ByqzBjLNo7Qu2Wa2OtOQK63bcwCl78bJi+T0pQSUrgJ0dBD1IKs5Z56RacDXgPsX77hEdjZOmw//9lFpXHf6SOMASj8dqwf/zoXhLy6V1RoOUGkgqy1bDZRv+BpwPyXbzFZHGvuZpvpK5wD2P7GrrNZ0YmWtva7V7J8MoHQfoNJA1AOuLSutk0GnBtz/jAvkgt8+Km9F6/aR5gMo/aqYXAKTWcR0vhNA6QiQaYDrSQa+BtxPyTay1ZHGPmtcq54DKH0nuge8XQqTeaVfGUDpFqDSQNSDFc3oeMDXgPsXV18iu5un5At++6i8SMv0d0fnoO9eBtMLCXTWAKVbgEwDWd3JwNeA+ynZRrZ6krnu9CoAsh3qvlbZr62iM9995vS1rwjQ0UG3B5XWyaBTA+6fCyTIQHkTjXvgvYmWBVB6FJMDHNGZr2ZOPGMnQKWBrO5kENWeSAdqQ0YbeSVzrfpIOxknLoDqGSuXx3QNUHoUYKoB5VlWmmXWgJozohpw/+LKSyTbKNvc6LePbq36SrcASt+J7qGdzV3h+ejOqQBdHWS1ZdaA0gD3QGketRmzjWy1z0qzzH7UV3oVOIhB90DO5lY9xInXXwmgdAvQ0cFKPcmgUwPuf/0Fwhl4LZpjL6s7vQ+g9Cuic0BHM1PdYnWdCqwBylMBKg1ktc9AaYB7oDRPtBmjTW21yt0607IAKwdvtGb1Mlh9HqIzcyqA0hGg24Os5swaUHNGVAPuv/MCaf7xnGesVzOT3K07faRNAqwcvhYrB3605pRuUfnTAJUGstpnkGkG9xXZxlV1li2Aqn0Apa/Guy6FqW5R+VHYOsBeN0ClgagHXFtWWpZBpwbcX3aJTDdNmy//7SPSOIDSJ9E5gLOZycE/mY30aNai8qMAXR1kdZaBrw2lVWQb1+osRxp7Xb0TKwd2tqYzjx6ceDZHZyYLoHQfoNJBxwMqswbUnBHVgPvvukB+2G8fFkDpp2L1YO7qam5Hy3QfnRkEUDoCRJplpakMonqFalNnuVtHAZRuB7bV7HNEM0pf1brrLDIPUfm7AZSOAN0ecG1ZaVkGSgNq5h9ccYnsbh7J4d8+AGvISrOc1Z2+0rsBugeoRTavvI529bpMPxWgW2cZRPUK0UZWGxqZfdM6/amYHNxqdlXrrlvRo8A8UF43QEcHUQ+45swaUHNGVAPuf8UFkmmd3K1VH2kWQOnT6By0k0O6o+32Ey3TVwN0estKM6LaUJpHbcJoI1utclZn2k7sHOBVr7SVNZGW6T46M50ASkeASgNZbVlpWQZKA2rmH5y+RKrNMuZNv31YrjSuO32ln4zsoO0ezmrOa9X87vMqHZF5VYBKB1xnGfgacF/R2bxZ5lr1kdaN7DDtHNzVzPQZ0/mOjsi8UwE6Ooh6wDXnyAOZBnwNuP91F8gkd2vVRxoHULqKyaE5OZRZm/TV8ybPinrAuveVngWodMB1loGvAfcdOhsZtfU+Z3WmdWJyCHe0rJ/MrvSRlukqOrMAc0D5PkClgW49ySDTDO7vfYEs/PG8qrNcaVx3+krfierwVH5Hy/rV2ck61UcaR2cGdHTAOuAMonqFaANb7XOkqb7SfVSHY/cAzvorvE4/0XxU/kqAjg6iHnBtWWk+g0wDUf2Hk5fI7ub5Bz/8tw8L0Dn4sojWdw9ir7G/4q2s6fSRZpF5CKB0C5DVWQa+9kR6tPHUps0y16r3AZRukR2W7HUOY99HdeadmJtqmX5VgEoD3Xolg6gG3P/ICyTTstytO32lr8b0AO1oWX+qzrxsTvWRxmEzwHrgZyxA1AOlAfY9SouINqrXUbPuM/sqgNKrw7Jz8GZ9p868ad3pJ5qPyu8GUDoCdHvAtWWlqQyUBtTMH255gVz8x3P2Iy+rVR9pV0R0gHYO226fzamZqPZ9pFdep48Cc0B5PkDUgyiDqJ4QbVSrVeZa9SpA9yDkuazveqdq30d6t4+0TD8doNJAt+ZsNYjmQFQD7o9dIqsb5y8+8M9XUW2Z9UqzAEqfRHZQKq+j+T7yOvqk7sxOvExbDZDVWQa+ZrwXbTi1cTvZAvh+J6YHbjQfzazWXuvolTfVODozUQClI0C3B1ndySDTDO6/8gJh33rOIPKQK63bR9rJyA7K6UGbzVsdza/MVn63Vn2krQSIehBl4GtDaUy2Qa1WOatPRHbodj2rKz+qT8xWntLUjEXmnQhQaUD1lruakWkgqv9w4hLpbJaSm/7xvNP7AErvRnUgdg7RrO940fyOr7xIj2rVR9pKgE4NvO7hvkO1YZF9bZn13egcpqZ5r6o/5U881Ueaj8rPAigdASoNcG1ZaZ0Mohpw/yMukExTudK4Vn2ln4rocKwO1qxXdeX7Olsznd+tM20aIOpBlIGvDaUBteHUplU5q3eiOjwndVer/MyLaq919G7vI/N2A1QaiHpQaSqDTDO4v8cFElweINqkqo409iOP607vAyi9G9kh2Dk0s76qo7XKX/HUTOV7jfvMywJzQHkWIKt9Br4G3GdEm9Vqn7OaA1jdOfCyA7Sqr9K68xOf604faRaZ1wmgdATo9oBrzlaDaA506j/sXiKTDSO50R/PuVZ9pJ2M6ECsDk7fR7Xv1UymdbzdmZVa9T68B7zHAVSfZeDrKbYB1WZFzmoVwPeTA9D3VZ1pq/PZjNKqee6jutNX+qkAlQa69SSDqAbcf/UFkmkqV1q39wGUPonu4ac09iNP1VOtyp2ZzmyldftKB5UOuFbZozSP2nCmZZlrH0DpFp3DMDpAoxnUyuOceZOZbLbSsrrTR5pF5lUBlG4Boh5ktWWl+QyUBtTMH77hAqlqzgB15LPHteoj7XR0D0Hfdz2rOXe11dyZ4VxpXKveR+YhQKRZVprh6wlqc6rMdaZxRIdbdmiqmnPm7cxWuat5r6N3+0g7GWCqgUrrZNCp/7BziaxunBc3/+eribYak0Mv6yMvmmE/yp2Zq3KlZbWPSOcAkWaZNeBrwD3Dm01tUGRfW/YBWFMRHXZeV3XXf1denenWlRdpmT4N0NFB1INKUxlkmsH9V14gmeZzpXHd6VUApSO6B5iaYy3rVT3V2OvM+tyZmeSJpvpIywKoPsvA1x2iTYraep9Z70bn0LN6qu1kq6u5SV7RuO70kRYFZgFnNesDVBrIastKMzqewf2tL5Cq5gxQK79bqz7SdiI72LKDseNF8+y/I3dmJrlbZ1oVQPUqA18D7g210UzLsgXwfSeqw89qpSl/kjszV+aojvzKi7RMXwnQ0UG3nmTQqf+weolgcy7R/O1jyuozeSZ6jo8JvJbXKy/qjciLtKvDDmrOKqLZTub6ivifQa8y19arUDNWR9lq378rqv8WKvuYzF4RQNVKM5SnfK8Br/voUq1hvfPszsyUo89cftiX/PNVpJ2IaBOx7vvIi2bY73jImbc7o7TuTKVlNYfyQKYBziCqFfw/qVmvMteZZtH5n5qt9zprO7mrrczs5Kj2GveZx5F5qwEqDWS1ZaX5DDLN4P79v4E0qDalaexlsyCqQbRW6VPsOep5Svd95VnmmjXLUWQHLgdQOkI9J9N8Vpr3LJTWiex/mle616z2WdVZ8Jxf7zPX1rM2jZ3vkv97+Owj05S3EkDlLADXlq0GPJP1Hu8pv0v0jEgzotowLcoeryn/CPhhGBP89rFL9SVE8Ey0BroPhek8a7pHeZFm2Xu+Zw2w1gmgdB/ZQeA1Nec19iMtyivROXztkPazvues6ix4zq/32WrVZ9GdU99j5zvvemquis4cULoFyDLXkQZ8DaLeax7vqwCRzig9mvV0Zqb89czVMx3/wU9x8stQc15jX/XqGR6b8QEsK3jWYI3nlAd85joKoHQfQOkc6oBQh0Dk+/W+Vl4WnbnuweojWmM6sqqz4Dm/3merfd8NXjN5RvTfwH/Hystqpan17w7gs9WAZ5RXaRWd2eiZrPm+Mx/RnTsC/uN/guhDVh/e+zyr1kKrnplh66PnsJ71qlYayPI7Az8f6qCoap+VpmZWwg5oDjWjaj/j6yr8nF+vPAvTVPg5Fdn31Pku1YzXotrP+lCaj8qvAkQ9YI09qwHXvgeZ5qNLtU7pvo9qI1pbzSp/G/yHvoLuGzevM6NgL5qFrgIo3YKJ/KzPaoP9TgCfq5hs+mg2mkFtvc9cn4zs4FWHs6r9nIXNeN9rrHPm8LNRKL9ak0X23wG5W/uIdIvKB0pHAJ9Zj3qvWa5qwD0wjXXD+1lkKL9aA1bXXQ7+o4+46H99V+GfGdVA9axFTOai1/G67yc1a5ZZzwIoXUW12RF+hmvrfe3nohnWVCifD9PJ4YpZm+faZ+9bdHTOqu4Ez6rvIfru1HebaVVt/aReCaB0FYBrzpMaWO81EOmrRM9izfed+YjO3F8zK38HwQ/Au7jyw6s10Cym+LW8vqNVtZ9nzQdQveVJAKVnB8LEsz6rKw1RHbrKt8NahZ/h2meuo1DzO8/yoTQf5kffHWtqDrXXua68EwEiLcoWIPIB10Y0YygNmO6joppXuu/VGk/kV+uOgx+O01RfhGlR9niN/ar3wJuEQnms+T6rLfsAWVYBMg14r9KryA4a7lWNzDVryosiOoh9+BmuOVvt+0jnGev9nNVR+LXKYy37bqLv13+vrE881V8dQPWWledry1YDrpXve4VfpyJD+dmajtddn80tgR+IOxJ9UNZVf/JLsudVr6N6y1HNOdI63jSygwCe93d6VfuI9CiqAzo6jBHwzLfah5rzkc1FNUfkeS1aG0Xnu+U66q1e6VcDcG2ZdQ7AGXitqg3V+9gleg5rvo/q24AfgjZv+PvHyvOjNSvvy9ZF61nPetYN9n3mAD4rj+uV6BwGnQPFa76PPK+zNgl/MFutwny/1oJnVPCc9VzbDIef8/1KdL5H36NWvWmTfhKgqrMAk8wayGrVe83wnvIV1Xz3OZ7Ja1f8NTP9Owh+MN5B9aYmvpqN1kPnMDKPYT/rq5q1KvsArEUBlN4NdWiog6XSfG+16ifBh7H3srBZO8B9eN2v8eHn/SzXfk0Wk9ksqu9d9ZmW9VcE4NqyDxB5FsDnqgbcA6V5zM8iQ/lei2ojen6kXwJ+OE5SvXnzOSumXjbvwVxn1uZ4Nuur2mcfoPIiDaj6RKjDA5o6ZCLN9KyvdIQ6bFlDHwXPWK20KngtP6N6js348Ho0g/DfUVRbz/5UU9GZA0pHgKpmzTJrQM1ZZg1wnfXANNZXiZ61+nxbl6333urrSPCDcBW7XwjDupqDtvq6wNZ3nq16w2o/E2VgcxbA50rjeiWiQyHT2TMt0qM533PwYdo5gFXAt7CeM9cqIp919FF4X9XVd+Kj8/1Gmte9lukrAZQeBeDaMgeIMvCaqoGvAfuG6cqryNax7vuovgX4AbkL6supvrDIh+4jojPHXtZzbbDmswWIfGB1plmArJ9GdpBEB43p3vOa6ayxHs1Eh7D1KirfQs3wWqtZ8z2H+TajatUjsu9E9ZHGHuvmKf1UgJV6JYNu7XvAvcfmfXgyz6PWVXRmwNKzJn8HwQ9Ki40/oFczE3/nPajIUDNZr2pkX09zVvsAqo4CKD07OOzAiWY6HvusW50drhw8m82bbzMqe98Heyp7XwX72WwV0feqtI7nfeVNA3R7UNUcoJNZA1xHHjCfdcVkFvBc1qtndl/nMvDD8i7sw3JWTD1o2Zou9hx+Fmuqt+xrg7Us+wCrdaZFAToHiB00atZ7PjI/W6dCHbys2WHNwfMqZxHNQM/Wm28zvo+0KtT3Vn3PHJXvozOTBYh6kNU+g8jzudKsBlz73jBdeRPUM3aeaWs5Xw5+IE7h3/TqB4jWsd6d64J1aq3Sfe991g32s1xpWa0CdDSLlQNicvj4qDxVRwex11Fnh7H3rfYR6Qi1nufRq2Df6mwNR/RdZbqK7pyPahasaKBbW1aayiDTANdZ78m8iMkaPxfVE0484y/wQ3FXqg8Z+dB9MOyrGaB0r1U1sq+rXGlZ3ekjjQNMDhYLO5A4zJvOrwQf0FF436/zGj8jW6PmOfyM1SoqP/p+/HdbfYc8eyrAiga6tWWlqQwyDfgaqJ41w7xORGRexMqa4+CH6Uq6HzKa87qa6TwfMz4q1BxrndowrcrAa5GvZoD17GeaCvuZUN5K2IFlhxeH97I5hPLtwJ0e0n6div8lNBX8vCi879eZZsGfUX1maBbsWfiZ1bDn7D4PVBro1gZrUQaZBnwN0He0XdTzvLb7ep31f810/5COH4ySC/9foE+fe9X7AHhO5/m+VzWyr7uZNaB84Hurp5oKoPRpTA4cP4s6C3UIc/DMJPwae8bqs3z4Z/hnVrpF9t3Yd1fFZBZh89N1RkcHUW8onetOBl7LfE+kKX1C9IzsuZP57DnHwA/HO7APw3kFtRbayjNtXeeZqjeszrQsVxrXUQ8qLQv7eVCeRXSgQLfg/uqwAzg7rNH78FpUqzC/WgPNwvdW80wVu9/pdL39d10NQ+ncg6xn3TL7VQa+NtjnGbUGqNmKbA3rk2fb7GTNNvhBOYF/06sfIHqGel70GtB9MJVvsJf16jmmdTPwWlWDqPc6ayqAZcC+hR0swGofak0Vfl30DP8aHNEhzAe2mvO61dPg5/hQczyT6Sr8d6LqO4Yx1UBWG6xVGWSaoXrWDPOimcwzMg94v5qNOPGMf4Afvp8MviQfFWou663261Yya4BrPxP1pgHWLYBl4LVOTA4szNq81T46M93ggxqZ6yzsOQh7/ypsRj1Dhc2qvBr+ffg6Cv/+pwEsA9ZsrgqgNMCa8i1H9SSDTDPQdzTGZjqzQM101n0c/HB9muiL8vrVXzCe1XkN31uttAheo9YiqxpEfaSxB6znmZPBB5c6xEyz2W7w4asOY39Qe597ey+r+M9iz7eatcw7EfZeVHRmVACsA17jDLhW4VF61rNumX0/BzI/0zyRpvQriF7nXa8fYj8cV1B9OOVna6L56nUyovWsq55RPmeP8rJa9ZHmdcDelZEdVHaQ2QzPsqci83AgqwPb6/Zap7Hn2mvx6/P7yMKepXqrOWyW10QzylcBlM4BfO3xczyTaUB5PgNfG5lWzaPmGbUGRHoH9Toge+Z0HlQ+6Mz8BX6QUg78b2AtvbGA6Fkrr7H6LO+rWdOqDCLN65FnmMYe67thKA8RHUymV5731awFr0Fkh7J5WPsu7H123lcW/Jmjz29zPjIPkXkIoPSVMLoeiHzAusG+mjeUx3NVb0C36JDNdp/RYetZnf9VXvwQvQt7M5MPNZ31wVQ+iNYZVT3NwGtKB8rz4WEvCqD0LKpDpxvqcDNtNfyBbDUynv0p8Nr+vfD724nou/O6eaxVAZS+G4zyOr2h6m4GmWaonjVP5JterWWi+Ww2e42j4IfrDvgPXH347peDOR8Zaoa1qvaagufUMwDXqvcaiPQMNeufowIoPTqkWEff0bw+CT6Y74J/T6uXR/T9KL2j7QSw3IWf4dcrDagZw2qvc45QvtfYr+YV8H2c4MRz/DO2n4cfrF2OviGBeubJ15k+S33eTPOeka0DqLMemJbp0zCUZwE6Gh9anYMNvYXSuoF1dwPvaefy4N5C6TwTaSqA0i2Az91gOp7BtfXRjMFzal5pwNeAe6C0Va5+/iXgh+qTfPoLiv6jeZ37DJurMoi0Tu814HUOgzXfcxjKOxHqwFN9pGWB2Tuj3rMK+9z+s3PPcz7YA1kfaRaG8laCUZ7qjaqussdrUQ2itUqf0Fkfzey+9hb4Ibsj/KWoLwna6pe3utavsbr7HDXvNaUb7APTlOdRvupVGEpnLQt/mHHd6SON41tQ792i89mtN03VHNm6LAzlIVaonsOa6g1VT3NGZwZ055hoXfa81dc6Dn6IrqD6gMpf/VIm6zCbzbPne1Vnmpox1DrANa9VmmHeSngiX+lRdA8nH34NatWb5nuLb0N9BhXR92E19+xFAaoeeI09oPwqFJGf9VE9wdZ1nwUv8jNPkT1nSrVm5Zkl+GGbcskbaZC9bufL68x4onmld5/t5zo1QB9pypvAz/HPUnq3B96ziA66rI56qxHfiv8M2Weu6ig6MwigdA5DeYgunbWsq95QdTd7vBbVhtIMeNEaH3dj/J7wAxbS/f/SN2Fn/XQt5i0A9xFqpupBpnH2eC2rea3SDPOm4Yk81rJ+N7LDksP0b8d/Fv5sUY3MdRVA1RxGpXndYD+KCDXT6Q1fd7D5zjo1U62D76ODmovWZrOcl6juAPwAvoPsw0w+YHf29JyRvf/oWcrv1AB9pLE+wT9DPYv1rPcBlJ5FdTBGPuKnYJ+HPzPXU60TQNXWA6UBr7NXwWvVeqV5vK9qzgb3HvUcQ63LnnUF7369FPzQ3Yl3fjnRa3kdtZrL3qd5/ByfQVb7HnBv2Ow0GOVzD5QPrPYBIi077Lxntc/e/yn4z+Y/q31OpXUC+Nytox54zeuAvSwy1AxrVe01Q2lG5LE+fe6EU895G/iBPMUVH/7K/1iK7NmT92L65L3yrOotThA9jzWem9Q7wYemPzxP/tzeBfts/rP6z3w6gKqVB9g3vM5el+oZrPk+qg3TquxRWsXKmg5XPNc/c+v5uxvxqi/tanbet1prWue5fobnVa+eaXrkMzzPa5Se9VXNAbK+ip9+eRj8Oa1WfRRA6Qjgs6oB18pnzfCeCkNpjPKjea9nz8zoPDtj9XXBp9Zu8cnNuPMf64ovm3XfqzXd92Bz0fP4Oeq5SvPAz0IR+az5vqpZs3wq7BD9qfjPyJ856i2A6jn7AJ3a4B6ouYzOvJqJtIyur+aytdVzp0TPY/30627zyQukS/fLrcD87rPUHGvWV7NRDaK1Sp9gz+g8X/WWo9qyCpD1KtRh+dPxnzv6/KxNAvjcraPe8LryK7J1rPFcVBumcVZEHuvZXPb8H8VdLpDVL/yq/1DVc5W/+154PfrodTgysjnlZT3rBvsqW4Csj8IO058Of+5OgEn2ASyDqAaqZ81jPoehNCbzMqbr1Hz1jBPve/o+jdV1R7nLBbJD5z9yNtNZH9Fd6+eiGqjnKY3BTBSKyGPN91b7tVxX2QL4vhu/Bf95VZ1pFiDKHu+pOa8D7oHSMjrz0Qxrvu/MG6ZHvmIyC6r5zJ++Fth5vSWuuECu+BDdNSe+oCvfn+Hnea161sp7UuA50fO9rnqfgdfYV5nrylPxW1Cf3QeINMsrHvCa0g32gWmsT8jWs+77qDZMU94O1fPYR2/x9fyE30CA+g/S+Y80+Y/YmbUZP6u0CjULbfIMw9Z1n+l777PuM2CtOzOpfxP2uX0Ari0rzTKHx3qvZ7XvAfeGms2o5ifPMlbWAL9u9RkePMPiR/FTLhDPyf9Q6jlX/BBMXge6eb5mMg8oz2ud2jAty5XGNcdvw39u/h64NpQWoZ7h10U1UD1rhnkcgPsI5XutWt+l85zqvZzgHa9xhLteIO/4sq7+j1Q9a/e1/HrUHBnKr9YAP2N1NwOvVTXg/jdhnz36PrLastJ89igvqkH0DKUrduaytdl8tC57Hqj8uzN5/6PPOr1APvlFvvu1q9dj3/ps3dTL5lfA8/iZkWawB0zjbChfzWZ15P027Luw78DXQNWZFmWP0gDr0dwJ8OzJewPd92Nz3flv422f68rfQH7qfxzm5OdUz4L2zu/Sv1ZUR6iZSkNtvdXc/1b8Z+fvQvWMacrzZHOsVT2AZnE10Wvsvna2Xnnv+KyKT73ui3f+E9bdv/Tsvey+T78+qq8Cr2HBsNZ5PzYTrVV+phlV/5vJvhvU3PvsYU/NGN7L5q4ger2V9zFd8+7PeiVHPkv2/6X7T/wj+p04+QP/yR/s7LWn78vP81rVT5//k1Cf3/eRl81UTOdBtmbyvJXX/o3c5nt6xwXyk34oftMPuPqs08/v5zs1QM/aw9/fi/reMiLfdOVXazzRLMg85tRrPryB8AI58H+N8KHH9Hs+8d8Fzzj1HMUnPtNPpvp+Jt/fqe/61H/jU+9nl7u8j6/i+Ses7+LUplXcbYM/G3qf7Dv8xPd75Ws+Py8f4LlAHk7ybOKHh1/Ec4E8GP/+T57Aa1aeEXHyWQ9/84nv98rXfH5ePkB4gfzrX/96/oO8h8n3jNnpvOLEMzKma1Ze4zdRfT+Rr/RT3/X0OZP3+PAlvOM3kOcH5J588r+Lf21+H+ifn5ka9b1lRL7pyq/WeKJZkHldTjwj4+rn/0ief8KaMf0h++YfSvXedz6/1UozVM/ab0V9F9F34/Xp9zedB9mayfMwO53/jdzmc7/zAlEf+lNfxPS97L7PaP3kfay+B6zrPnPy2qZVGWSaUfW/EXwH6nvxWqdmzOvMgGzuCqLXW3kf0zXv/qy3J/tzxpUXyG/5D3HyB1R50E58lyvPiN7PhOoZqKv+t2PfSfS9VDVnJvNZq3oDeuSdJHv9q3jH5+qSvZfL3+f0ArnTF3c108/6Dd+Neo+sRZ/D61Z3M8g0gNrP+P63or4D33NtPa8B7HVmGda7cyvgGeo52bOnr/uuZ72bt72Xu/4NRH0Bp7+U3deIZk2vns9+NZ+Bucksw+s7tWFalitN1cB6r/0W/Ofm7yGqgdd9rlBz6rlGNK90xc5ctrbj8Uy2BlT+3Zm8/9Fn/Yl/RMcXcOo/uHrOqWd7Vl4HvoXhNfY8mWd4X9WVxlTruFbeb8J/D/476NYrGWSawT1QmgGPA3C/SrW++/zOnJrZff/MO17jCD/lAsGXy1+w0pjJf5TJrMfWnXoteNNnRfOs82xVe82A5gOoXGkcvw37zP7zd2rDe50MfG2wpnq1DmQeUz2H6Ty3+9oZJ54B8JxTz7oNV1wg1Ze08iV213zqP5C9LucI7/NstBZ69dyMaL3Sfe991jlH2sTL9N+C//wcoKp9381RbXjd4B7YnPI6RGsrLaoN05THdGaMaha+n7G+WvcV/ITfQKr/ENV/LPaq3pN5QPle67wWNKUznRlgz+N51tg31Eym+cy16iPN9N+A+uwcgOsoW4Aog04N0LPP2i7qeSdfY+U5p17byJ53xfs7/f5vc4GsfrDjX8h/OP0f4orPB88HYM0iQvm+935WW1YaZwvg+0j7P5R/Ov6znwrAtc8gmuMZ3wPuPTbfiYjMA95XdXe9muuuVcCr1n893/AbSPQfYfofJ/sP2n1WNmceZ4/XuOb5aL2arfDr1HrWsp5ry5F2On466jNnASbZB+Da4Fr1XgNeZ68iW8da1qv1hnmdGYb1lWcoJrOe1XVH+eQFEn0BnS9m58vrvq7v1RrToucZlc9gntcobZfO62S9z1yzZpl1Dv5twzL7PxX+nPz5dwP4PKkN7oGa26HzGpPXi2azZ0ye71lZt/L+bsHuBXL7Dxiw875X1/p1ndrIXg/eNBjlsaZ8y1nNAZReBR+kPxX/GU8G4NpyVQPrKw14vRuKyPNaVav1imqe9e7chM7aK153i5O/gVzxIdQzr/yysmdn76XKHq9FNUAfrY+8Dn49P6PSrO4EUPo0+H8at/zTsM8WfV7LnQA+c600oGrrQaV5fUK2vtKi2jAtyorMi1hZ0+Gq5xpbz7/b30Cu/rI80Wt5vTPDKM+06Nm8RvUWEX5GRYSa8ZrpvgaRZ3WmZaEOzOgw/Sn4z6Q+p4/M6wbo1MD6SmP8jIoINaPWsG9YzfMR1Tzraq77WhWnnlNx7HXedYFkb3jyYU5/wZ3ndV+T56znDKIaVD2AxlGh1lgYlQ7Yr2oV2cEYaf7gtPqn4D+j/5xet/qKAKq2HigNeN1HRWee9ayPngHM41zBc2pd91mnePfrpaQXyIH/q4Sd/wAR09fGfBQZymfNeq8rrYN6BkCd9UBpHvNVZESzrGX9aqjDkQ9P65X+7djnsM/ma/WZIy0KMNERQGkg0hme86GIfNZUb1jNOUL50ZrJrAHfRwc1F63NZruvt8XKbyBveWOC7HWr9wS/Ws9+NK9007qZYV31aq3pke/hWRWG0ie9j+qAQ0QHo+pVfCvqc6nPz7WfqWofQOkIwD3wWqZzZFSzSs969QzDvCiDTAO+NpRmwIvWRN5VTF7rr9nql4ir/gmretPKn3xQz2QdZrN59nyv1mXPysA6W8uvkfXANNaB96pQRDOsTwJYnR1y1iPznOo5vg37LPa5+LN5raqzyOZA1psGIt3DMyoUkc+a6g2rOVeouWpt5EOfvG72nCkra7a52x/RI9SXk/0HqNhZC/xaq6cZZLXvgdKA6crL8Os4jMjLeo7sAGOPD0jVs+69b0F9nv8tNISf9Z/Xau7ZmwaIdKA8iw7VGuXxXORZPc3A1x7Wu3NdVp638lqr7y/l0xfIypd3EvU60LzeqQ3Tqgw6NUDPvg8Pe9MwlIcASp9EdvhZzweiiujAvTt4j+q9q++APe5N8/00QEezMJTXDU/lGex3amA9657ps5js2R0666967S1OXCBXfwD1/JOv2XmWnznxfqLncZ31wDTleXgmmvdzPoDSEeoAU4ec1yKfZ6rI/qf2u9H9TAj7DniN0lnL+mkApSMyOn70LNZUb0Q18OvUHM8DNWdE80pfIXr+rTn9G8iJD1w9o/samPORoWZYU3WmdbKqAdeq9xrwOofH9zyXBVD6JPyBZgegOvRURD5fItZj9i5E7zu6AH1En1vpppnu+0iLAii9E0DpPjxKV73hPa59ZpSfaQb3QGkRk9mME8/xz9h+3jv/CcverHrT0QeZfEDM+mAi3TPxrc40NQPUGoDar4k8w7RM3w2g9Cqiwyo62FSomWzexx0uEnuv9l46F0YU9j1YrOisdcJQ3jQ8lW74XnmGn+lkkGmG6lnzmO8DcK9QXjSfzWavcZTyAgn+17gmb/Dkh4meNX0/FgrWs2ebp2aUh5p7I6tVH2le9/BMJ4DSOaLDKTvMvKdmTO+G/5/o1YGN570L/9750qj6bkTfk9e9r3RE5vkAPlehiGYyzfA96wb7at5QHs9VvQde5nuy2e4zOpx8luTK30CqN6/8bE00X71ORrSedd+redD1Dd/7taoGUe814HUfCu9xBuZ3ojqkLJTHMycDB/S7LhL+HP51o7ob/vuKPI7KnwawbHBv+HU+PErv9D4DXxuZ1pmvegN65FWsrFNrqud0Xuevmc7/Q/J3/hNWRPQmva5myg83AM+avIbXVT3JrAGu/YzvgdcyXYVhtc8r0TmwbOZkqMOZD2n0PqDh/exin4mfb69hns/T8N+bfY8W7PvgWY7OTBVA6SqA0gBryjfUDGcj86s1BvcAmtKnRM/2nHidS7jDBXIl9h/ZokLNeI1r69VMNwOvVTWwPtIy/R2hDrLVw4qflQUf1MjRoW2e99Xrq+BnWM/h/Shz7YNfT4X5NhuFn/Vrrw6P0jMNZLXBWpVBpGU9UBpjM51ZoGZW172VUxeI/yCrHyp6hnpe9BrQfTCVD5Tn+8hjHbCnMmtA+SDqTfO914Hy3hXq8OpGtY4PX39Ac+3Dz6swvzOndIT3/LNOhf9uqu/J/3d4RxiRxz3IetYts19lkGmG6lkzzItmMs/IPFD5HfwzTjzvbb+B2JvlvIJaC23lmdk69rhW60zzfidHtaFmoh54reN9KviQ60R0GHud6yz8PGs+lK/mODCTrfW+1Qj1/ajvT9WfDKPrgag3lM51JwNfG+zzjFoD1GxFtob17hwwLVpzCa0L5MD/JlbE9LlXvo/oOV7nOauV5uG5bB1yVQPleQ2wbp7SO+EPMqt3Inp+NyYHMgd8FTteFN6vZqOYfj/+O7X66gCRDpTuaxB5XBusRRl4LfM9kab0CdEzsudO5rPnHOPq30C6H6LzJaiZyfMtMqK5rLfar6s0zpXGtfKA97MASs/i5KFkhxxH5nFEBzEf1lFUfhV+fee1bIbryPcRfS/+O+XwM35NFLy+G8DnbgClI0BWW1aayiDTgK8B+o62S/W83dfrrP9rpvt/yuPOf0Tf+WLh+fBknket8/he1ZmmMmsg8lf71Vg5YGyNP6QseI491rKIDuLoMDbPfJWziJ5htQr2edb6yWevZu377cbOeqB0BOAeZH1WW1ZalFkDUQ1Uz5phXie6dGYnz7uMkxeI/0CrHy5ax3o2N31tW6PWsa56Q9WZVs34AL4Gyuv0le6je5j4g8evsdyZq7ROqIOZgz2red7mLNjzmWsOe4Zfx3Xl+ci+SwvlI/xMFp1ZkM2B1R5w7TOIvGwWeJ/1rPdkXkS0ptKiesKJZ/zFO38DsTfNeYpaB231eZ7oOaxzbT3XlpXGOfIAz3EApe9E5wDpHEo2w3Os+z6K6FDlgzeb877vva68SDfP1yrYz2YR0XeidPWdet1H5fuoZuAD5U0DcG2wpuaiDLwW+VlvmK68CeoZO8+0tbvva0z7Atn4Q3o1Uz13ZT2DGR8V0azv2Vd1pqnsA2Qa8J4PkPVVZAeHHT7RjPd5hvWsz8IOXz6QVe9DzfrcCV6jnqcCHs9ab/VKqO8t+r45Kh+ReVmAbg9U3dGqzBqIaqB6iwo/2533ZL16XvQakX6cO/0NpPOheSZbA8+C8V40Y7CvekPVmZblSstq1Z+I6qBh3zTvdXu1XgUfwHxAs25eVXciW4veR6RbsJfNWvD3ZZFpyjOfNYvMWwnQrS0rrZOBqpFZz3rGfB9M5hnsZbNGZwYsPav7B3Rwxz+i+zcf1SD6kNAjL8PWZc/1+N6v49qy0qrsA0xqDqD0bkSHjkWmeV31Vk/CH7DqsIXmg3WeYU+FmuWeZ1lnX+msWUTfm/oOWUPvQ+nRrHlKVwGiHqjaB4i0aY5qw+uAe495kZ9RPdfj+6i+BacvkO6HNW/1C1HroK0+j7Fn8fNYU71htZ/JsgXI/KtDHRSrGnqLrGdvJaID2Xvet9pnrjnUnM/sR8F+NZ8Ff48WrKmZSFdzVwfwWWmWOUCUQacGqvdxguhZq8+3ddl6762+juTdv4FEb17p0YeuZj3QJ6FQftZntWUVQOkI4HNW+wBKj0IdJCvapLe6G3xYe880jsq3qHyEn7Gateo5NmNzvu+E+t4qDbXqvZ71kVYFmNSZZgF8rjwQ1aDqGfM7EaE8r0W1ET070i9hdIFc+Id0Y+X50Zrua3psXbSWPdUbqvbzk+wDsOYDKB0BlN4Ndch4LeutVr3XlIeIDlp1KKvI5ky3GTXHHtc8Z30WPNdd1wn/ffrvNOpN474z43vg+0mASOtm1kBWZ73HvMiPqJ45pbumM/fXzOTvH+COfwMB0YdgXfWjLyDBnqWemfV+nmuDNZvzAVT2AVjLgje7j8lBgbrbq9pHpFuoQzXSvG59pZtnOZpjj2ues95rla7qLKrvlL//bm/1SkzXg0jjzAFUntSAe2Ca8laInsOa76P6NlxxgVQf2jTOiomXzRqYqSKCfV4T+UDNdLQoQEfLItvo7GUHDHvWT+qViA5ZdTiznuVORLNeR23BM6dDfa/Z9+5nVD+ZXQnQ0TiAZcBa5KkacA+U5jE/iww1k63peN312dwSd/oNpPoysi8iW+OjQ7VG6b5n32qvV1qVfYCOlkX3sOA687j281Z3ws9HB7PXfJjvZ6xW2cJmOXgmymo2Cp6Jagv1nWZet7beao7M6wSYaFVWAbg2uPY9UBowPfIVnTWs+75a033m5YwvkDf8HUTh1/Jzovez83oeexY/j3WeiTyrWbN8p4gOF66tz2qvTaI6gBF2CHOoGas5W+17Dvat5my1hWkq/BxH5zvLZqL/Dit15vHcNIDSowAqT2pgvddApK8SPYs13++8dmftXzPTv3+Ad/wGkr0p89RM58NM18HrhiLyvG617w2lmxZ5Vd6NzqEwqZG55uB5tT6K6tDl4IPaap+5tt4He1z7zH43eH6yPvsuK61bRwGUrgIoHQE62QdgD0Q1iHrWPTyTRYTysnljdd3lXHWBVB8u8qsvKqoB+mh95GX4dbxeaUDNWfae771meTWA0jmqQ2F6sFidaT7vRudg5QPc95zZ932k+56z8qvozmWhvucVbVp77eoAPmca4Nr3gHtgcz4mZOuU7vuoNqK11azyt3n330C6H2L6ZUTzSmc6M4Y906/JNKA8g2csQNZzAKVPQh0CnYPD15kW5U6ow9UO6ih4lmuf2Z9oVvusag72rJ9E9V0qnzXkSuP6RACfOYDKPgDXRjQDrK80xjyfs3kQzbDm+858RHfuCEsXyMbfQaZ0nskz6KP3pwIo3YdCeaz5vltb5tr3nFdDHQqVZnWmId8h/OHMtc/sdzWufeaaw689Gdn3n/23Uh7XU20SwGcVwOeV2nqgNMN7foYz8DMWjNLVHNOZmfLXM1f+/gGu/A3EvyH15kyLssdrUQ2itUqfYM9Qz1I6a5P6qlCHA4f31DxryErrZq5PRnSQW+0z+1n4Oa59VvUkpmv4e4y+c5VVKG9H2wmQaaBTA+u9BrzO3grRc1jzfVQbpkXZ4zXlH+Ff/8lj/v3vf6u1rPle1Z1cad2eAyidA5es0n2oGdZ8H3lqJtN28u6M1Z1ZP9fRVB9pPkCmgSh7lAayjaoy16rniA5f1n1vdaZN8qo3menkqK58rlUfaRydGQRQugXo9qDSsgyiGnC//BtItFFaNC6Rqp7kbq36Sl+J6DCrDj72rY9m2O94K9lq7rNczXQ9rlVvGmAP+F7pIMrA1x3UBlWZ60xDRAdWdiBW9U7uzKzMqtz1VupMy/TVAJUGuvUkg079YvXyANNN8w82fgvJNJ8rjWvVRxoH8AeUZTWrQs2ylvWqnmrvzKxFc9FM5LO3EkD1WTa4Z3izWZ9lrlciOwy9p+pM28mdmU7uepHPfeZlWhSYBT5DBzzLAbo94Nqy0nwGmWZw/5UXCLC6kyut21f6JLIDrjoQ2Y88VXPOvGg26nfzisZ1pnUCRD2wDKK6S7ZhkbN6GtUhWNWcM+/dudI6fuVFWqZPA3R0EPWg0rIMohpwf7sLBHQ2qdUrOaun2qmIDjzWs35SZ9rKzGqeeqwrL9KqAFEPOANfA+6ZbENa7TPXqu9GdmByb7XSlF9lq7nfyV2vW3f6SDsdoNJAVq9k0Kn/8LELBNzwn7GA1arnAEqvojrgOoei7yOv0r0fadkMZ6u5z3KldWsfka4CZBqIMvD1BLU5VeZa9Z3oHIa+V3WmRbkzw3l1puNzn3mZZpF5VQClW4BObzmqswwyzeB+6/IAqxvnD2/8ZyzL3Vr1kXYy1MFXaexHnqozbdfrzFRaVqu+0jlApoEqG9xHRBszy1xnWhSdgzHqvb6qdbzJbKVldeVNtJMBKg1060kGUQ24v+0FArxe1ZwB6shnj+tO7wMovYrOIadmqkPU91ZHM9Usa6ue0pTXrVXvI/MQoNIB1z4DXxtKA9WGtN7nrM40FdHhx7rvI0/NZNoVXqRx36kjTc34qPwsgNIRoNsDrjmzBjINRPUfPn6BgDf8M5blSuv2kXYqosNP6dmhGtW+VzNdTfmZV2ndWvU+Ms8CZBrgWmWD+wreeNZn2QL4PtI4ssOuOjit93pVT7Xp/Eq90lf6iQBTDXBtWWkqg0wzuN++PMB000hu9M9YllmvNAug9CqqA0/5Hc33k3rFX1mzUmdapvsAlQaqDHwNuGeyjWl1lrnONBWTw9Fr7Csvmp/63bluXXkTzSLzqgBKR4BKA1m9kkFUA+5vf4GAaKOqOtOQJ1qnj7ST0T0kOwes7yf1ydnKn3ocmYcASkeArPYZRPWEaJOqnNU+gNItVg5Fr6/Wu7Ne6+hZHWlqJtNPBag0EPVA5cgDmQai+g+3uUDAG/8Zy3K37vQcQOlVVAcgQs1Uh6zvu15Vn1jHfeapvtJ9AMwB5am+kw3uK3jzWd/JXPsASufIDsXqYPV9x4tm1GzH932kV57qK92i8rMASkeAbg+yupNBphncH7k8wHTThFz0z1gAdeSzl9Wqr/STMTk8WfN913tnvdL7yDwfoNIA1yoDXxtKM6JNpzavylmdaVlMDlHWfN+pM8/qys/qlX6iXRGg0kC35mw1iOZAVAPu73eBgMYlwr71aibLlcZ1p/cBlD6J6lBUfkfL+qjOvJ2600eaReb5AJUOuM4y8LWhNKA2ndq4rHk9qzMtiuygXDlsozrzTtWdfqL5qPxOAKUjQLcHXFtWmspAaUDN/OHU5QGijbLEB/6YbjmrK6/Sr4jJIcu676vnTOvMy+ZUH2mZngWodMC1yiCqu3Q2rcpZ7QMoPYvokOwcuJO+U2ded26qZfoVASoNdOuVDKIacP91FwjobFyrM83nSuO60/sASl+N6tDsHMBVz1pUn/JUH2kWmZcFqDTAOrAMohpwH5FtUlUj+9oy15nWjewA7RzEk/4Kr9NXukXlTwIoHQG6PeDastJ8BpkGovoPt71AwAf+mG45qysv0qIASvfRPSijuc7BXM1U86uznd5H5nUDZBrgOsvA14bSPLz5or6TLYDvI20a2QGqPK+xP+l31qo+06NZjs4cULoKkGmg44HVDKIacH/08gDVZhlz+J+xAGvISrOc1Z2+0k/F9MBd0TprJvPKX9FXAmQa4FplENUrVJtZ5axW/W5MDmSln+zZ29UsMu9EgI4Ooh5wbVlpPoNMA74G3H/tBQKyTWu9munkSlM98F6kcQCld6JzoE4O445W9UpbWVPpuwEyDUyzwX2XaMN63Wvss+YDsHYipocwa6f7iZbpPjozUQCl+wCZBirPstKyDDLN4P745QFWN07KRX9MB16L5tjjutNX+lWRHb6TA5u1qldaZ6bSVahZwBoH6PSdDHxtKE2hNqLazKyxzlrUcwClIyaH5+SQ7mhVP9EyHZF5pwN0dBD1gGvOrAE1Z0Q14P7rLxCQbWDr1UwnV5rqgfciLdNPRHYAT713aJluUflRAKUjQLfOslH1EWojqs3cyRZA1T6A0jvROXAnBzlrnZlIj+YQmYeo/JUASkeASgNZbVlpWQZKA2rmH3zNBQIu/i0k8n3O6k4faRxA6VV0D9hsbnK4d7UV3aLyuwEqHXBtWWmGrwH3HvOqjRdtXqtVjjTVR9purBzcSu9qkR7NWlS+RXfOB1C6D1BpIOoB11G2GkRzIKoB95dcHiDbPFscukCA1Z1caVx3+kq/MjoHspqZXgBTHZF5JwJ0e8C1wZr3APdTos3rddaQI031kcYBVg5Ri2xt5Cl9MpvpFpV/VYBKA1EPsnqSgdKAmvkHX3eBgJv/FgKsVn2kWQCln4rOAb1ywJ9e46M7ZwGUjgCZBrLayDSD+y7djWy1z91a9RxA6VHgQAY7B7fyTj/PonruqQBKR4BuD7KaM2tAzRlRDbi/7PIAqxunxZf8FgKsnmo+gNKnceqwzvydtYjue+wG6Oggqy1bDdgHvgbcd8k2r6p9Xqk5gNJ3onNYRzNXXxDduU4ApVuAjg5W6kkGnRpw/+MuEJBtYFVzBqgj3+eVOtMyvQqAw5ezmu3E7kG/658O0O0B150MfA2475JtXqsnmWvVR1oUwA5esHIIV2t2fcTkfWEWVGuA0rMAUw0oz3JXMzoe8DXg/tLLA6xunDYf+i3E8kqt+kizAEq/KiYHe2f29POqAEpHgKgHWZ1lENWG0hRqU0Yb2+pO5rryfAClr8T0MFe6RfdZk9c8HaCjg24PKq2TQacG3P/YCwSw7ntVcwZei+Yij/XKyzQfQOmnY3qQv/uS6ASodKA8y0pTGUS1J9KNaENGG9vqTu7WPoDS3xGnLg+Ld1wiQOkWoNJA1IMVzeh4wNeA+xdff4GAG/0WYpnridfROYDSV2LncH/3WqB0DtDtAdedDKLaE+lGtCGjzW11J0dap+cASp/G6qG+su6KCwQo3Qfo6CDqAdeWldbJoFMD7i+/PEC1WY7wxt9CLCvNcrdWfaRlugqg9G7s/oaA9cBq9q8M0NFB1INpBr4G3BuRDqJNGW1uqyc5q1Vf6e+M3UtgZz1QehRgRQPd2rLSVAaZBnwNuH/xYy4Q8OHfQiyv1KqPNAug9CqAHeiAfR9XHfynnguUbgEqDXRq4HWVga8B90akRxsy29BWcwZeW6kzzQdQ+omwAx9ceXkAfi3Ac1WArg6iHnTrlQw6NeD+LZcHiDbKcS74LQSwpnKldWvVR5oPoPTfFqCjA9VbjmqfQaYZ3HuUF23KbEOrWuVK43qqdQL4QxxYvXs5fDKA0hGg0sDEs6y0LINMA74G3L/4cRcIuOFvIZa5rryJ5gMo/ScFULoFqDSQ1ZaV5jOIasC9h71sQyrPNO+xpnJUW2a90nwApf+0AEr3ASoNRD3g2rLSJhkoDVT92y4PkG2g43zwtxDLlZbVqo+0TLcASr97AKVnASoNRD2oNJWB0gD3CpvpbMhoY3udtSx3a9VXug+w+s9BdwqgdB9gRQPd2rLSsgwyDfgacP/ix14gYOG3EGC91zsastIsr9Sqj7RM9wGUvhvA/mBuGbqvLexvH8DrkwBKtwCZBpRnWWlZBkoD3BuRbkSbM9rcXlc1Ms9GHteqj7RM7wZQ+icDKN0H6Ogg6kG35hx5oKuBqn/r5QGqzXKcG/wWYrnSuO70kZbpFkDpKwHUJXE6gNItQEcH3dqy0gylATWjyLxog2ab2+pM87nSuJ5qPoDSdwIo/WQApVsApSPAag+4tqy0SQadGnD/4sdfIOADv4VwrrSs7vSRlukWQOmdAFdcHEDpHEDpCJBpIKstK81nkGnA14rMzzZotOFV3cmVFvUTTQVQ+koApa8GULoP0NFBtwdZbVlpWQaZZlT92y8PUG2kSzj4Wwiweifv1pEGfO8DKN0HUHoUQOmrAZTOAbo6iHrAtWWlZRl0ak+kM9FGzTa51ZHGfuWx3u0rnQMofRpA6Z0ASvcBlI4AWc8aWKl3MujUgPsXv+YCAZu/hQCrM62TKy2rO/2qbgGUrgIovRtA6T6A0i1ApYGoB1xzjjyQaQb3RqQz0UbNNrqqOznSuAeRl2k+gNJ9AKV3Ayg9CqB0C6B0BKg0EPUgqy0rrZNBphmZ9+ITlwfobpjjXPxbCGBN5Urr1p0+0jLdAiidAyg9CqD0KMCODqIecG1ZaVkGUQ24B0rLiDZstPm9Hmms+xxp3APvTTQLoHQOoPQsgNJVAKVbgK4OMg2s1JaVpjLINBDVgPuPXR5gummOcqM/qFuuNK4rb6JlOgIo3QdQugqgdAugdAugdATo9iCrOUceUBpQMwb3U6oN7ntVd3JUW2a921c6AijdB1C6CqB0DqB0BFA6AlQaiHqQ1ZaVtpJBpwbcv/i1Fwi44A/qgP1OrrRu3ekjLdMRQOkWQOk+gNItgNJ9gBUNdGvLSssy6NSeSO+gNm+28a3mDFBHvs9ZXXmZDlizAEq3AErnAEr3AZSOAF0ddHvQrS0rrZNBphlV/9HLA+xsnCN8yT9lWc7qlX6iWYCJzgGUjgBKR4CODnzPGujWnCMPZBrwtaG0FdQmjja/11nLcqVl9QnNAigdAZTOAZSOAEpHgI7GOvAea6Bbc848n0GmgagG3L/49RcIuNEf1Dnv1p1+omU6AigdAZRuAXZ04HulAa4tV34nA6WBqmfYrzaq8r2mas7Aa9Ece1m90q/qFkDpFuAqHXR7oDzLUb2TQaYZVf/xywNUm+gtXPRbCLB6krtet+70u5oP8G4dRD3oeKDSVAaZBnwNuDcinYk2bvcQ8DprnVxpnR54b6JlOgIoHQGUjgAdLdJBtwfd2rLSJhmo2mug6l88F4jjJv+UZbnSOv7EO6Gt6AhwlQZWas6sATVnRDXg3oj0iGjzZpu/qju50rieeCc0CzDREeCUBqYeWNGyDDINRDXg/sUdLg8w3TSXsXiBAN9bnWnsRb7Ku3XlXaGd0IHvlQaiHnTrlQwyzeAeKG2C2sjZIaBqzkB5lbZSRxrwfaRFOmBtqoOpBqae5ajmHHlg4gFfg6q/zeUBdjfPUW72T1mcK61bV15XA76PdOD7TAcrGqg8y1FtWWkqg0wDUW0obQW1obODQNUrudKyeqWfaJEOTmmg24NubVlpKxmo2mug6l88F0jCzf4py/KKltWVpzTg+9Ma8L3SQLcHWW1ZaZYjD3Q1wD1QmhF51cadHAhWZ1onR7VlrqseRN67NOB7pYGoBx0PTPxJBpkGohpw/+JOlwfINtFHeOM/ZQHWVO56HT/zgNWRBrK+qwHfKw10e9DxANfdbDVgH3RqwL0n8zzZJs4OgshTM51cad164kUa8H1XA75XGuj2oOOBSrOceSqDTAO+BlX/4rlAGnzgn7KA8pRmeUVTPVB1pIGdXmlgtQeq9r3lqN7JoFMD7o1I76A29ORwsJoziDzkrtetJ57qlQayXmlgtQeVZ7nyLWeeMfGAr0HVv7jb5QF2Ns6lBJdIpU3qE7nSdusTvdLAag8mte8tK20lA6UBNcNE+gpqc2cHg6qjDLKZqLa8Ul/Rswa8xxrwHmtgt7astJ0MpjXg/sUdLw9wcgMd5fA/ZQGrM20lV9puPe1B5O32QHmWO7VlpU0ymNaAe6byq41cHQi+tzrTKm9F69bTHkTe6R7s1paVtpJBpgFfg6p/8VwgC7zh7yGA/Ule0XbraQ8ij3uw41me+CsZTGvAPVDaBLWxJ4eE1VMNWWmWK61bTzzuQeRVPeh4oFtbrvyVDFQd+aDqX9z18gC7m+dy3vj3EMBaJ69oUW2Z9ayuehB53ANVZx7g2nLl72QQ1aDqgdJWiDZ4dkBUdaYhK41zpa3UmQesrnoQedyD3dpyV+tkkGmgUwPuX9z58gCnNtBlXPhPWcBqziDykDPP8oqW1asesHrVAyu1ZaXtZNCpAfdAaQzPdDaymqkOCuu9zlrlKc3yROMeVHXmAatXPWC17y13astKs5x5PoOOBzq1obTnAjnBh/8eApSnNM4rWrfOPGB15oGqjjzLnfpkBplmcA+UBiK9ItrcHb2qOYPI83nqnawzD1idecDqzAOrfpQjD0w8ENWg6l/c/fIAqxvn7dzkj+oAdTXn84q2W2ceOFlbrnzOVgPVqwwyDfgacA+UdgK14bPDoqozrZO7Xqe2zPpunXmgW1vuapxZA2rOZ5BpwNeg6l98w+UBrtpIxxlcIMBr7FsfzbB/Iq9oE5/rzAMrteWJzznzVAaZBqIaVL0n8xTZBlee1yZ1pk3yivYtteWudiIDVXsNRPOG0p4L5Are/PcQwNpO7npRbfmdteWJzznzsgymmlH1RqSv0Dkcsl7VmbaSu97Ev7q2PPEtK+1EBju1obSvuTzAyQ30Fn7JJWJ51Z/Wlju15a52IoNpDbgHSlOouc7Gjma8HtXAejUz8ZAzz3JUW171o9ryTm1ZaZYzbyWDTANRDar+xTddHqC7mW7FL75ELHdqy53a8sS3rDTO1QyYeCCqQdUbkT4l2vSTQ6SqM22Sr9Si2vK0ttzVLGfeSgaZBqIaVP2Lb7s8wKkN9FY2/h4CfK/qqbaTp16lRbXlXd/yqtfJINOA8kHVG5F+AnUITA4UVWfaTp56lTbxfW15R7OceZMMOh6IalD1f3gukDdywR/VgdVT7UTuepVvudIq37LSLGfeTgaZBqIacA+UBiJ9QrTxle419pWXadOZzOMc1Zyj2nKlVb5lpVnOvJUMphrwNeAeKO0rLw9wYvN8jEP/lAWs97qqM+1knnqVVvmWlWZ51etk0PFApza62km6h4bXJjVnEHkruatZjmrLpzXLmbeTwVQzMg8o7WsvD3D1ZrqcN/09BFidaSfzCU/5lrua5czjbDXI5lQGqo58kHlAaUbmdcg2f+cQ8X1VZ1rH89lq4HuVu57yLe9oljPvRAaZBjo1qPoX33x5gN3N83GSCwSwl/WTOtOiDLwWzal80lOa5cyz3JmZZDDVgK9B1QOlRfDsZKOr2epA8b2qp9rJPPW6muVV72QGmQY6Naj6PzwXyA344kvEstKq/G6Pc2dGZdDxgPJBNe9RmpF5E7JDQHleYz/yrM60jjfJuzNdjXNnhjNrQM2pDDINdGpQ9X/49ssDnNpAH2fjj+rA95M60zpeljszljszlle9KlsNsjmfwVQzMg9k8xGdGdDZ+GqmOlx8r+qp1vGyvDuTeZY7M1GOPBB5nVkwrQH3QGk/4vIA3Q3zFfzASyTKnRnLp2ZOZNDxQOWDae/JvBWyA6E6WNiPPKunWpWB16I5lU/NcO7MdDKYeGBaA+6B0n7M5QFOb6KPc8NLBLB2Ze7MWO7MnMhg4oFODaoeKI3pzDDVQdA5VLK+qqfalbkzY7kzcyKDiQemNeAeKO1HXR5gZdPcmuHfQwBrvp/UU+0OuTOzk0HHA13fmPaezNslOiA6h4zvJ3WmdbyTuTPzzgymGujUgHugtB93eYArN9LH+MJLBETeTu7MXJFBR1Me6NSg6oHSPJVfUR0KnQMm6yf1VHtn7syoDLwW6SqDqQY6NeAeKO3Fc4F8ER+8RIDVmbYyc/cMJh6ofBDNA+6B0kCkX0F0WFSHDvuRZ/UJ7VszmHgg00CnNlhTMy9+4uUB3rmh3s7wElGzXlutp1o3g+7s1RlMPLDiG1UPlGZk3g7VIVEdOFk/qTOt461mgLqa4wy6s5zBxAM7tcGamnnxUy8PcNVGug1ffomAyDuVQXeWM1iZATs1qHoj0kHmTagOiM4BBLzGvvXRjKqnWjeD7uxqBjuzINPAtDZYUzMvfvLlAU5toFtzk0sEWJ1pHS/KoDsbZdCdtQxOaMDXoOsB7j2Zp1Dz08Mgmu8cQF5brTOt401mphmcnAWZBnZqgzU18+KnXx5guqm+ljddIkB5J7SVmZVZy2BnBmQamNag6oHSQKSfJjo4OjrPZL2qT2grM5zByVkw8cCp2mBNzbz4DZcHeNeGugUXXiIg8qxe8SfeZGYyC1ZmwIoPfA2mPVCap/KnVAdG50ACrPl+tZ5qHW9lFlQz2Sw4oRmRx3MgW/sPfsvlAU5votvz4UsEWN31r/R2Z0BnHnR9o+sZSgOR7unMRFSHReQrnbWsr+oVP9M63mQWRF42AzINdH0j80A2/w9+0+UBdjbO1zK8RABrvu96VX1Cm8yAiQdW58FODaoeKA1E+tVkh8n0oOp40Uw1u6pNZkDkZTMg00DXB74GmQey+X/w2y4P8KmN9XEOXyLA9yfqqXZyPvNApoGuD6IaZB7oakbmnSY7TFYOKt9HNbC+mr9Ku8IDKz7o1KDqgdJe/MbLA7xzQ92OD10iwPrOfDabadN50NGUB7o+iGrQ9QD3RqSDzDtBdZB0DyavsR95q/UJ7cQ8yPxqDZjWoOqB0l781ssDXL2Zbs8bLxEQeape8T+lga4PohpkPXtAaSDSjcqf0jlEugcTa1l/uuYMrprramB1FnQ9wD1Q2ovffHmA05voK7n4EgG+P1Gf1sB0jdLATg2mPVAaiHRPZyaje4BEc6yrOa9l8yfqFf+0Bro+iGrQ9QD3QGkvfvvlAXY3z4/hwCUCvMZ+x4tmqnrFX1kDuj7o1KDrAe6B0ozMY7qz04Mjmu8cWJO+UwPrq/kVv6uBrg92ajDtgdJePJfH/2OyuX48F1wiwPddb1J/2gfVOhDNg65ndDUj866kOmQ6h9akj2qgvM7aU7PVGrAya6x6oKu9eC6P/8+nNtZt+dJLBKh61wcn1xlZzx6o1gOlGZl3JdlBE3msT/quN6nvMAs6Neh6Rld78Vwe/+RTG+vWLFwigPVJ3/Um9VWzYKcGXc9YmVF0Zk5RHTSrh9mkf1f97nVG1wPcg6724rk8/uadG+qr+MAlAnz/ibozC9Q86KzP1gDuQWcGRLpR+SfJDpvI6xxokz6qQWduUq+uAzs12O2NSH8uj4B3bqivo7hEgPI7WtZ3vW+pQdcD3IMdjenM7NA5aCYHWKWxn/XTGiivs/ZUDU54htJApD+XR8LVm+nr+dAlAnwf1aAzd3UNVubAtDemuqczs0rnsJkeYqz7PvNAd/ZTNdidA1UPutofnssj58qN9GNYvEQA62rOa9V8NNt9xhU1OOEZKzOezDM6Myt0D5tsrnPITfoTXqcG1kc6mNZgtwdd7Q/P5VFz1Ub6kRz6uwhgbdJ3vZNrVtaD3R50NRDpTHduyuTAiWY7B101U813Zzs1mK7prgddD3APlAYi/cVzefS4aiP9WG7yT1rA913vU3Og6kFnBkx1T2dml+rwyXzldbSdPqrBybnuGrDbA6WBSH8ujiHv2Ew/joOXCGB9p+96Vz8DZLOgWg+6mpF5Rmdmh84BlM10Dz01V834/oR34hmg6wHuwY72h+fymHP1ZvqxHPy7CGDtZH+FB1ZnAfegMwOmOtOdW6V7CGVz3cOPtenMnTyw2wOlgUh/8Vwea1y9mX40F18igLWdfnV2sg7s9obSJ7OK7twu3cMom1NeR6tmqvmsX/XA6izgHnQ1EOkvnstjnXdtqB/NzS+ST60F095QejQLMs/ozJymczBNDz2ls3Zl/861YGXGiPQXz8Wxzyc21Y/k8CUCWK96kM1Mnzd5Fth5nqE0EOkg84zOzFVUh1TmTw5G1qY98Nru87JngenzQFcDkf7iuTzO8MmN9eNoXCIgmlF6R6t64LXp+mkPTs2ASAeZZ3RmrqZzWGUzyutoKzN360FXMzLvuTwOcofN9eP4wG8j4MTM6R50NDUDprqnM/NuqoNreih2tJWZE2umPejMgKn+h+fyOMsdN9mPYOMSAcpb1VZmpj1YmQFKA1PdqPyM7trdQ6haPzkgV7WVmRNrOs8AXc3IvOfiuIidzfZQcME/aQGld7SVmauea3TWGpFuVD4zna+YHlDVfORPdNY6M6Bad9VzgdLAVP/Dc3lcx+lN9CD4ARcJWJkBXQ1MdZB5zGR2h8mBlc1OvZPaqRmwug5EOsi85+J4A+/aUL+ezUsERJ7SO9q71wGlgaluVD7ozFxJ9xBbPSiVd7V2ch3oPs/IvBfP5fEePr25fh1v/G0EKH1V23kW2J31VD7ozLyT7oG2cnBO9LtrYKr/4bk43svdNtmv4M2/jQClf0oDUx1kntGZuQPdQ+7UAav0d2hgd9bIvBfP5fF+vmXD/Ui+7CIBV6wHkQ4yD1R+xOq6jNUDrFoX+dk65U2ec1oDUx1k3ovn4vgcV2yihwHNSwRkc5E30d89C1Y9UPlGd+5KugdcNbdy0E70rgZ2Z0Gkg8z7w3N5fJY7bK6H/+bAbyMg8k/oVz7byDxQ+UZ37hN0D7xqLvI/oU+fAVa9F8/FcQ/uvNF+HYd+GwGRfzcdrHqe7lzE6voTh1jnGauHbeR9Sger3h+ey+M+7G68hwt4w0UCIu+UDk6u8XRmmJU1u6wcdNWa1QM48k7p4ArvD8/FcT8+sakemtz0IgEn14DMA5Xvmcx+gskhWM2uHsor3lQHmQcq/8VzcdyXu2+2h//mwxcJiLzV54FdH3RmKnafceJw6z5j50Be8U4/z6j8PzyXx705sQEf3sDgEgHV7I5/hQcqH3RmmJU1p1k5BHcP4R3/Cg9U/h+ei+M7uMPmehhwo4sEZP7us0FnBnTn7sbkkOzMZjPV+qvWgsr/w3NxfBffuvF+PYcvElDN7PgnXt/ozil21k7YOQS7aztz1Uzm76w1OjMvnovjO3nXhnq4iA9cJKCa2fWN7pwxnf8UK4fliQN71wenZl48F8d38y0b7qFgeJGAzvyJmVOv45nOZ5x41slDcPKsE4f5iWcY7ff+XBw/g5Mb8eEGXHSRgM7cqRkw/RzG6rp3snJ4njzEP/GsF8/F8bP4hs32sMDCRQI6a7rPPT1nrHyujN3nXXEgTp7Znf3U3Ivn4viZnN6MDzfjwovE6M5e8Uxmdd272TlMrzjgr3jmi+fi+Nl8y4Z7OMCNLhNw9XvpcPJ5pw/K6fOuml/6XM/F8Ts4vSEfvoDFiwRM1q28xjve153YOWSvujCM8Xt7Lo3fx7duvIcDbFwkYLr2DpfDu37eTx+kK89715rn4vjFvGtDPdycN18mYPdn7yf+7O4cxG+7MMBzaTyA5wJ5+IsPXCbGyZ/Hu/1snz5wV5+39T6ei+PB81wgDyGbF4mx+4znZ3Tv0N8+8J9L4yHi2ZwPLQ5dJuBuz7kLJw/p59J4eAvPBfIw5uBlAq76Gbzbz/ZVB/Kx5z6XxsOU5wJ52OLwZWI8P5ea4wf8c2k87PBs1IejXHShGL/p5/WSg/25MB5O8lwgD5dy8YXi+baf5bcd5M+l8XAVzwXy8FbeeKFUnH4ftzmknwvj4V08F8jDR7nRhfKVPJfFwyd5Nu/D7XguFc1zWTzcjWejPnwNv+VieS6Kh2/huUAefgzfcsE8F8TDT+G5QB5+PTsXz3MZPDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8rPBf//V/AXz1ggk1Y/LnAAAAAElFTkSuQmCC
4021
- `;class Aw{constructor(e){J(this,"size",84);J(this,"padding",4);J(this,"bubbleSizePrimary",8);J(this,"bubbleSizeSecondary",6);J(this,"lineWidth",2);J(this,"fontSize","12px");J(this,"fontFamily","arial");J(this,"fontWeight","bold");J(this,"fontColor","#222222");J(this,"className","gizmo-axis-canvas");J(this,"colorX","#f73c3c");J(this,"colorY","#6ccb26");J(this,"colorZ","#178cf0");J(this,"colorXSub","#942424");J(this,"colorYSub","#417a17");J(this,"colorZSub","#0e5490");this.size=e?.size??this.size,this.padding=e?.padding??this.padding,this.bubbleSizePrimary=e?.bubbleSizePrimary??this.bubbleSizePrimary,this.bubbleSizeSecondary=e?.bubbleSizeSecondary??this.bubbleSizeSecondary,this.lineWidth=e?.lineWidth??this.lineWidth,this.fontSize=e?.fontSize??this.fontSize,this.fontFamily=e?.fontFamily??this.fontFamily,this.fontWeight=e?.fontWeight??this.fontWeight,this.fontColor=e?.fontColor??this.fontColor,this.className=e?.className??this.className,this.colorX=e?.colorX??this.colorX,this.colorY=e?.colorY??this.colorY,this.colorZ=e?.colorZ??this.colorZ,this.colorXSub=e?.colorXSub??this.colorXSub,this.colorYSub=e?.colorYSub??this.colorYSub,this.colorZSub=e?.colorZSub??this.colorZSub}}const Pm={canvas:{id:void 0,resizeDelay:200},camera:{orthographic:!1,allowedMovement:new U(1,1,1),allowedRotation:new he(1,1),near:.01,far:15e3,fov:50,zoom:1,forward:new U(0,-.707,.707),controls:{orbit:!0,rotateSpeed:1,orbitSpeed:1,moveSpeed:1,lerpDuration:1,lerpEasing:"easeOutCubic"},gizmo:{enable:!1,size:.01,color:new xe(16777215),opacity:.5,opacityAlways:.125}},background:{color:new xe("#96999f")},groundPlane:{visible:!0,encoding:"base64",texture:xw,opacity:1,color:new xe(16777215),size:5},skylight:{skyColor:new xe().setHSL(.6,1,.6),groundColor:new xe().setHSL(.095,1,.75),intensity:.8},ambientLight:{color:new xe(16777215),intensity:.5},sunLights:[{position:new U(-45,40,-23),color:new xe().setHSL(.1,1,.95),intensity:.8},{position:new U(45,40,23),color:new xe().setHSL(.1,1,.95),intensity:.2}],rendering:{onDemand:!0,toneMapping:Yo,toneMappingExposure:1}};function bw(r){return r instanceof xe||r instanceof U||r instanceof he||r instanceof wt||r instanceof Zt||r instanceof We}function Ar(r){if(r instanceof xe)return r;if(r&&typeof r=="object"&&"r"in r&&"g"in r&&"b"in r){const e=r;return new xe(e.r,e.g,e.b)}return new xe(1,1,1)}function Fu(r){if(r instanceof U)return r;if(r&&typeof r=="object"&&"x"in r&&"y"in r&&"z"in r){const e=r;return new U(e.x,e.y,e.z)}return new U}function ww(r){if(r instanceof he)return r;if(r&&typeof r=="object"&&"x"in r&&"y"in r){const e=r;return new he(e.x,e.y)}return new he}function Sw(r){return r.camera.allowedMovement=Fu(r.camera.allowedMovement),r.camera.allowedRotation=ww(r.camera.allowedRotation),r.camera.forward=Fu(r.camera.forward),r.camera.gizmo.color=Ar(r.camera.gizmo.color),r.background.color!==null&&r.background.color!==void 0&&(r.background.color=Ar(r.background.color)),r.groundPlane.color=Ar(r.groundPlane.color),r.skylight.skyColor=Ar(r.skylight.skyColor),r.skylight.groundColor=Ar(r.skylight.groundColor),r.ambientLight.color=Ar(r.ambientLight.color),r.sunLights=r.sunLights.map(e=>({...e,position:Fu(e.position),color:Ar(e.color)})),r}function Dm(r){if(!r)return Pm;const e=yw(Pm,r,{isMergeableObject:t=>bw(t)?!1:t!==null&&typeof t=="object"&&!Array.isArray(t)});return Sw(e)}function Mw(r,e,t){return Math.max(e,Math.min(t,r))}var Ms={},bo={},br={},wr={},wo={};Object.defineProperty(wo,"__esModule",{value:!0}),wo.DispatcherWrapper=void 0;class Ew{constructor(e){this._subscribe=t=>e.subscribe(t),this._unsubscribe=t=>e.unsubscribe(t),this._one=t=>e.one(t),this._has=t=>e.has(t),this._clear=()=>e.clear(),this._count=()=>e.count,this._onSubscriptionChange=()=>e.onSubscriptionChange}get onSubscriptionChange(){return this._onSubscriptionChange()}get count(){return this._count()}subscribe(e){return this._subscribe(e)}sub(e){return this.subscribe(e)}unsubscribe(e){this._unsubscribe(e)}unsub(e){this.unsubscribe(e)}one(e){return this._one(e)}has(e){return this._has(e)}clear(){this._clear()}}wo.DispatcherWrapper=Ew;var So={};Object.defineProperty(So,"__esModule",{value:!0}),So.Subscription=void 0;class Tw{constructor(e,t){this.handler=e,this.isOnce=t,this.isExecuted=!1}execute(e,t,n){if(!this.isOnce||!this.isExecuted){this.isExecuted=!0;var i=this.handler;e?setTimeout(()=>{i.apply(t,n)},1):i.apply(t,n)}}}So.Subscription=Tw;var Es={};Object.defineProperty(Es,"__esModule",{value:!0}),Es.EventManagement=void 0;class Cw{constructor(e){this.unsub=e,this.propagationStopped=!1}stopPropagation(){this.propagationStopped=!0}}Es.EventManagement=Cw,Object.defineProperty(wr,"__esModule",{value:!0}),wr.SubscriptionChangeEventDispatcher=wr.DispatcherBase=void 0;const Iw=wo,Rw=So,Pw=Es;class Lm{constructor(){this._subscriptions=new Array}get count(){return this._subscriptions.length}get onSubscriptionChange(){return this._onSubscriptionChange==null&&(this._onSubscriptionChange=new Nm),this._onSubscriptionChange.asEvent()}subscribe(e){return e&&(this._subscriptions.push(this.createSubscription(e,!1)),this.triggerSubscriptionChange()),()=>{this.unsubscribe(e)}}sub(e){return this.subscribe(e)}one(e){return e&&(this._subscriptions.push(this.createSubscription(e,!0)),this.triggerSubscriptionChange()),()=>{this.unsubscribe(e)}}has(e){return e?this._subscriptions.some(t=>t.handler==e):!1}unsubscribe(e){if(!e)return;let t=!1;for(let n=0;n<this._subscriptions.length;n++)if(this._subscriptions[n].handler==e){this._subscriptions.splice(n,1),t=!0;break}t&&this.triggerSubscriptionChange()}unsub(e){this.unsubscribe(e)}_dispatch(e,t,n){for(let i of[...this._subscriptions]){let s=new Pw.EventManagement(()=>this.unsub(i.handler)),o=Array.prototype.slice.call(n);if(o.push(s),i.execute(e,t,o),this.cleanup(i),!e&&s.propagationStopped)return{propagationStopped:!0}}return e?null:{propagationStopped:!1}}createSubscription(e,t){return new Rw.Subscription(e,t)}cleanup(e){let t=!1;if(e.isOnce&&e.isExecuted){let n=this._subscriptions.indexOf(e);n>-1&&(this._subscriptions.splice(n,1),t=!0)}t&&this.triggerSubscriptionChange()}asEvent(){return this._wrap==null&&(this._wrap=new Iw.DispatcherWrapper(this)),this._wrap}clear(){this._subscriptions.length!=0&&(this._subscriptions.splice(0,this._subscriptions.length),this.triggerSubscriptionChange())}triggerSubscriptionChange(){this._onSubscriptionChange!=null&&this._onSubscriptionChange.dispatch(this.count)}}wr.DispatcherBase=Lm;class Nm extends Lm{dispatch(e){this._dispatch(!1,this,arguments)}}wr.SubscriptionChangeEventDispatcher=Nm;var Mo={};Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.DispatchError=void 0;class Dw extends Error{constructor(e){super(e)}}Mo.DispatchError=Dw;var dl={};Object.defineProperty(dl,"__esModule",{value:!0}),dl.EventListBase=void 0;class Lw{constructor(){this._events={}}get(e){let t=this._events[e];return t||(t=this.createDispatcher(),this._events[e]=t,t)}remove(e){delete this._events[e]}}dl.EventListBase=Lw;var pl={};Object.defineProperty(pl,"__esModule",{value:!0}),pl.HandlingBase=void 0;class Nw{constructor(e){this.events=e}one(e,t){this.events.get(e).one(t)}has(e,t){return this.events.get(e).has(t)}subscribe(e,t){this.events.get(e).subscribe(t)}sub(e,t){this.subscribe(e,t)}unsubscribe(e,t){this.events.get(e).unsubscribe(t)}unsub(e,t){this.unsubscribe(e,t)}}pl.HandlingBase=Nw;var ml={},Eo={};Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.PromiseSubscription=void 0;class Uw{constructor(e,t){this.handler=e,this.isOnce=t,this.isExecuted=!1}async execute(e,t,n){if(!this.isOnce||!this.isExecuted){this.isExecuted=!0;var i=this.handler;if(e){setTimeout(()=>{i.apply(t,n)},1);return}await i.apply(t,n)}}}Eo.PromiseSubscription=Uw,Object.defineProperty(ml,"__esModule",{value:!0}),ml.PromiseDispatcherBase=void 0;const Bw=Eo,Ow=Es,Fw=wr,zw=Mo;class kw extends Fw.DispatcherBase{_dispatch(e,t,n){throw new zw.DispatchError("_dispatch not supported. Use _dispatchAsPromise.")}createSubscription(e,t){return new Bw.PromiseSubscription(e,t)}async _dispatchAsPromise(e,t,n){for(let i of[...this._subscriptions]){let s=new Ow.EventManagement(()=>this.unsub(i.handler)),o=Array.prototype.slice.call(n);if(o.push(s),await i.execute(e,t,o),this.cleanup(i),!e&&s.propagationStopped)return{propagationStopped:!0}}return e?null:{propagationStopped:!1}}}ml.PromiseDispatcherBase=kw,function(r){/*!
4021
+ `;class Aw{constructor(e){$(this,"size",84);$(this,"padding",4);$(this,"bubbleSizePrimary",8);$(this,"bubbleSizeSecondary",6);$(this,"lineWidth",2);$(this,"fontSize","12px");$(this,"fontFamily","arial");$(this,"fontWeight","bold");$(this,"fontColor","#222222");$(this,"className","gizmo-axis-canvas");$(this,"colorX","#f73c3c");$(this,"colorY","#6ccb26");$(this,"colorZ","#178cf0");$(this,"colorXSub","#942424");$(this,"colorYSub","#417a17");$(this,"colorZSub","#0e5490");this.size=e?.size??this.size,this.padding=e?.padding??this.padding,this.bubbleSizePrimary=e?.bubbleSizePrimary??this.bubbleSizePrimary,this.bubbleSizeSecondary=e?.bubbleSizeSecondary??this.bubbleSizeSecondary,this.lineWidth=e?.lineWidth??this.lineWidth,this.fontSize=e?.fontSize??this.fontSize,this.fontFamily=e?.fontFamily??this.fontFamily,this.fontWeight=e?.fontWeight??this.fontWeight,this.fontColor=e?.fontColor??this.fontColor,this.className=e?.className??this.className,this.colorX=e?.colorX??this.colorX,this.colorY=e?.colorY??this.colorY,this.colorZ=e?.colorZ??this.colorZ,this.colorXSub=e?.colorXSub??this.colorXSub,this.colorYSub=e?.colorYSub??this.colorYSub,this.colorZSub=e?.colorZSub??this.colorZSub}}const Pm={canvas:{id:void 0,resizeDelay:200},camera:{orthographic:!1,allowedMovement:new U(1,1,1),allowedRotation:new he(1,1),near:.01,far:15e3,fov:50,zoom:1,forward:new U(0,-.707,.707),controls:{orbit:!0,rotateSpeed:1,orbitSpeed:1,moveSpeed:1},gizmo:{enable:!1,size:.01,color:new xe(16777215),opacity:.5,opacityAlways:.125}},background:{color:new xe("#96999f")},groundPlane:{visible:!0,encoding:"base64",texture:xw,opacity:1,color:new xe(16777215),size:5},skylight:{skyColor:new xe().setHSL(.6,1,.6),groundColor:new xe().setHSL(.095,1,.75),intensity:.8},ambientLight:{color:new xe(16777215),intensity:.5},sunLights:[{position:new U(-45,40,-23),color:new xe().setHSL(.1,1,.95),intensity:.8},{position:new U(45,40,23),color:new xe().setHSL(.1,1,.95),intensity:.2}],rendering:{onDemand:!0,toneMapping:Yo,toneMappingExposure:1}};function bw(r){return r instanceof xe||r instanceof U||r instanceof he||r instanceof wt||r instanceof Zt||r instanceof We}function Ar(r){if(r instanceof xe)return r;if(r&&typeof r=="object"&&"r"in r&&"g"in r&&"b"in r){const e=r;return new xe(e.r,e.g,e.b)}return new xe(1,1,1)}function Fu(r){if(r instanceof U)return r;if(r&&typeof r=="object"&&"x"in r&&"y"in r&&"z"in r){const e=r;return new U(e.x,e.y,e.z)}return new U}function ww(r){if(r instanceof he)return r;if(r&&typeof r=="object"&&"x"in r&&"y"in r){const e=r;return new he(e.x,e.y)}return new he}function Sw(r){return r.camera.allowedMovement=Fu(r.camera.allowedMovement),r.camera.allowedRotation=ww(r.camera.allowedRotation),r.camera.forward=Fu(r.camera.forward),r.camera.gizmo.color=Ar(r.camera.gizmo.color),r.background.color!==null&&r.background.color!==void 0&&(r.background.color=Ar(r.background.color)),r.groundPlane.color=Ar(r.groundPlane.color),r.skylight.skyColor=Ar(r.skylight.skyColor),r.skylight.groundColor=Ar(r.skylight.groundColor),r.ambientLight.color=Ar(r.ambientLight.color),r.sunLights=r.sunLights.map(e=>({...e,position:Fu(e.position),color:Ar(e.color)})),r}function Dm(r){if(!r)return Pm;const e=yw(Pm,r,{isMergeableObject:t=>bw(t)?!1:t!==null&&typeof t=="object"&&!Array.isArray(t)});return Sw(e)}function Mw(r,e,t){return Math.max(e,Math.min(t,r))}var Ms={},bo={},br={},wr={},wo={};Object.defineProperty(wo,"__esModule",{value:!0}),wo.DispatcherWrapper=void 0;class Ew{constructor(e){this._subscribe=t=>e.subscribe(t),this._unsubscribe=t=>e.unsubscribe(t),this._one=t=>e.one(t),this._has=t=>e.has(t),this._clear=()=>e.clear(),this._count=()=>e.count,this._onSubscriptionChange=()=>e.onSubscriptionChange}get onSubscriptionChange(){return this._onSubscriptionChange()}get count(){return this._count()}subscribe(e){return this._subscribe(e)}sub(e){return this.subscribe(e)}unsubscribe(e){this._unsubscribe(e)}unsub(e){this.unsubscribe(e)}one(e){return this._one(e)}has(e){return this._has(e)}clear(){this._clear()}}wo.DispatcherWrapper=Ew;var So={};Object.defineProperty(So,"__esModule",{value:!0}),So.Subscription=void 0;class Tw{constructor(e,t){this.handler=e,this.isOnce=t,this.isExecuted=!1}execute(e,t,n){if(!this.isOnce||!this.isExecuted){this.isExecuted=!0;var i=this.handler;e?setTimeout(()=>{i.apply(t,n)},1):i.apply(t,n)}}}So.Subscription=Tw;var Es={};Object.defineProperty(Es,"__esModule",{value:!0}),Es.EventManagement=void 0;class Cw{constructor(e){this.unsub=e,this.propagationStopped=!1}stopPropagation(){this.propagationStopped=!0}}Es.EventManagement=Cw,Object.defineProperty(wr,"__esModule",{value:!0}),wr.SubscriptionChangeEventDispatcher=wr.DispatcherBase=void 0;const Iw=wo,Rw=So,Pw=Es;class Lm{constructor(){this._subscriptions=new Array}get count(){return this._subscriptions.length}get onSubscriptionChange(){return this._onSubscriptionChange==null&&(this._onSubscriptionChange=new Nm),this._onSubscriptionChange.asEvent()}subscribe(e){return e&&(this._subscriptions.push(this.createSubscription(e,!1)),this.triggerSubscriptionChange()),()=>{this.unsubscribe(e)}}sub(e){return this.subscribe(e)}one(e){return e&&(this._subscriptions.push(this.createSubscription(e,!0)),this.triggerSubscriptionChange()),()=>{this.unsubscribe(e)}}has(e){return e?this._subscriptions.some(t=>t.handler==e):!1}unsubscribe(e){if(!e)return;let t=!1;for(let n=0;n<this._subscriptions.length;n++)if(this._subscriptions[n].handler==e){this._subscriptions.splice(n,1),t=!0;break}t&&this.triggerSubscriptionChange()}unsub(e){this.unsubscribe(e)}_dispatch(e,t,n){for(let i of[...this._subscriptions]){let s=new Pw.EventManagement(()=>this.unsub(i.handler)),o=Array.prototype.slice.call(n);if(o.push(s),i.execute(e,t,o),this.cleanup(i),!e&&s.propagationStopped)return{propagationStopped:!0}}return e?null:{propagationStopped:!1}}createSubscription(e,t){return new Rw.Subscription(e,t)}cleanup(e){let t=!1;if(e.isOnce&&e.isExecuted){let n=this._subscriptions.indexOf(e);n>-1&&(this._subscriptions.splice(n,1),t=!0)}t&&this.triggerSubscriptionChange()}asEvent(){return this._wrap==null&&(this._wrap=new Iw.DispatcherWrapper(this)),this._wrap}clear(){this._subscriptions.length!=0&&(this._subscriptions.splice(0,this._subscriptions.length),this.triggerSubscriptionChange())}triggerSubscriptionChange(){this._onSubscriptionChange!=null&&this._onSubscriptionChange.dispatch(this.count)}}wr.DispatcherBase=Lm;class Nm extends Lm{dispatch(e){this._dispatch(!1,this,arguments)}}wr.SubscriptionChangeEventDispatcher=Nm;var Mo={};Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.DispatchError=void 0;class Dw extends Error{constructor(e){super(e)}}Mo.DispatchError=Dw;var dl={};Object.defineProperty(dl,"__esModule",{value:!0}),dl.EventListBase=void 0;class Lw{constructor(){this._events={}}get(e){let t=this._events[e];return t||(t=this.createDispatcher(),this._events[e]=t,t)}remove(e){delete this._events[e]}}dl.EventListBase=Lw;var pl={};Object.defineProperty(pl,"__esModule",{value:!0}),pl.HandlingBase=void 0;class Nw{constructor(e){this.events=e}one(e,t){this.events.get(e).one(t)}has(e,t){return this.events.get(e).has(t)}subscribe(e,t){this.events.get(e).subscribe(t)}sub(e,t){this.subscribe(e,t)}unsubscribe(e,t){this.events.get(e).unsubscribe(t)}unsub(e,t){this.unsubscribe(e,t)}}pl.HandlingBase=Nw;var ml={},Eo={};Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.PromiseSubscription=void 0;class Uw{constructor(e,t){this.handler=e,this.isOnce=t,this.isExecuted=!1}async execute(e,t,n){if(!this.isOnce||!this.isExecuted){this.isExecuted=!0;var i=this.handler;if(e){setTimeout(()=>{i.apply(t,n)},1);return}await i.apply(t,n)}}}Eo.PromiseSubscription=Uw,Object.defineProperty(ml,"__esModule",{value:!0}),ml.PromiseDispatcherBase=void 0;const Bw=Eo,Ow=Es,Fw=wr,zw=Mo;class kw extends Fw.DispatcherBase{_dispatch(e,t,n){throw new zw.DispatchError("_dispatch not supported. Use _dispatchAsPromise.")}createSubscription(e,t){return new Bw.PromiseSubscription(e,t)}async _dispatchAsPromise(e,t,n){for(let i of[...this._subscriptions]){let s=new Ow.EventManagement(()=>this.unsub(i.handler)),o=Array.prototype.slice.call(n);if(o.push(s),await i.execute(e,t,o),this.cleanup(i),!e&&s.propagationStopped)return{propagationStopped:!0}}return e?null:{propagationStopped:!1}}}ml.PromiseDispatcherBase=kw,function(r){/*!
4022
4022
  * Strongly Typed Events for TypeScript - Core
4023
4023
  * https://github.com/KeesCBakker/StronlyTypedEvents/
4024
4024
  * http://keestalkstech.com
@@ -4032,8 +4032,8 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
4032
4032
  *
4033
4033
  * Copyright Kees C. Bakker / KeesTalksTech
4034
4034
  * Released under the MIT license
4035
- */Object.defineProperty(r,"__esModule",{value:!0}),r.SignalList=r.SignalHandlingBase=r.SignalDispatcher=void 0;const e=bo;Object.defineProperty(r,"SignalDispatcher",{enumerable:!0,get:function(){return e.SignalDispatcher}});const t=gl;Object.defineProperty(r,"SignalHandlingBase",{enumerable:!0,get:function(){return t.SignalHandlingBase}});const n=To;Object.defineProperty(r,"SignalList",{enumerable:!0,get:function(){return n.SignalList}})}(Ms);class Yw{constructor(e){J(this,"camera");this.camera=e}applySettings(e){this.camera.fov=e.camera.fov,this.camera.zoom=e.camera.zoom,this.camera.near=e.camera.near,this.camera.far=e.camera.far,this.camera.updateProjectionMatrix()}updateProjection(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}frustrumSizeAt(e){const n=this.camera.position.distanceTo(e)*Math.tan(this.camera.fov/2*(Math.PI/180));return new he(n,n)}}class Qw{constructor(e){J(this,"camera");this.camera=e}applySettings(e){this.camera.zoom=e.camera.zoom,this.camera.near=-e.camera.far,this.camera.far=e.camera.far,this.camera.updateProjectionMatrix()}updateProjection(e,t){const n=Math.max(e.x,e.y);this.camera.left=-n*t,this.camera.right=n*t,this.camera.top=n,this.camera.bottom=-n,this.camera.updateProjectionMatrix()}}class Bm{constructor(e){J(this,"_camera");this._camera=e}move2(e,t){const n=t==="XY"?new U(-e.x,e.y,0):t==="XZ"?new U(-e.x,0,e.y):void 0;n&&this.move3(n)}move1(e,t){const n=new U(t==="X"?-e:0,t==="Y"?e:0,t==="Z"?e:0);this.move3(n)}orbitTowards(e){const t=this._camera.forward,n=t.clone().setY(0),i=e.clone().setY(0),s=n.angleTo(i)*Math.sign(n.cross(i).y),o=Math.asin(e.y)-Math.asin(t.y),a=new he(o,s);a.multiplyScalar(180/Math.PI),this.orbit(a)}frame(e,t){e instanceof Gt&&(e=e.getBoundingSphere(new Pt)),e instanceof Pt&&this.frameSphere(e,t??this._camera.forward)}frameSphere(e,t){const n=this._camera.camPerspective.camera.fov*Math.PI/180,i=e.radius*1.2/Math.tan(n/2),s=t.clone().multiplyScalar(-i).add(e.center);this.set(s,e.center)}}class Kw extends Bm{constructor(t,n,i="easeOutCubic"){super(t);J(this,"_movement");J(this,"_clock",new el);J(this,"onProgress");J(this,"_duration",1);J(this,"_easing","easeOutCubic");this._movement=n,this._easing=i}init(t,n){this.cancel(),this._duration=t,n!==void 0&&(this._easing=n),this._clock.start(),this.animate()}cancel(){this._clock.stop(),this.onProgress=void 0}animate(){this._clock.running&&(this.update(),requestAnimationFrame(()=>this.animate()))}applyEasing(t){switch(this._easing){case"linear":return t;case"easeOutCubic":return 1-Math.pow(1-t,3);case"easeInOutCubic":return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;case"easeOutQuad":return 1-(1-t)*(1-t);default:return 1-Math.pow(1-t,3)}}update(){let t=this._clock.getElapsedTime()/this._duration;t=this.applyEasing(t),t>=1&&(t=1,this._clock.stop(),this.onProgress=void 0),this.onProgress?.(t)}move3(t){const n=t.clone();n.applyQuaternion(this._camera.quaternion);const i=this._camera.position.clone(),s=this._camera.position.clone().add(n),o=new U;this.onProgress=a=>{o.copy(i),o.lerp(s,a),this._movement.move3(o)}}rotate(t){const n=new Zt(0,0,0,"YXZ");n.setFromQuaternion(this._camera.quaternion),n.x+=t.x,n.y+=t.y,n.z=0;const i=Math.PI*.48;n.x=Math.max(-i,Math.min(i,n.x));const s=this._camera.quaternion.clone(),o=new wt().setFromEuler(n),a=new wt;this.onProgress=c=>{a.copy(s),a.slerp(o,c),this._movement.applyRotation(a)}}zoom(t){const n=this._camera.orbitDistance*t;this.setDistance(n)}setDistance(t){const n=this._camera.position.clone(),i=this._camera.target.clone().lerp(n,t/this._camera.orbitDistance);this.onProgress=s=>{this._camera.position.copy(n),this._camera.position.lerp(i,s)}}orbit(t){const n=this._camera.position.clone(),i=this._camera.target.clone(),s=new he;this.onProgress=o=>{s.set(0,0),s.lerp(t,o),this._movement.set(n,i),this._movement.orbit(s)}}target(t){const i=t.clone().sub(this._camera.position),s=this._camera.quaternion.clone(),o=new wt().setFromUnitVectors(new U(0,0,-1),i.normalize());this.onProgress=a=>{const c=s.clone().slerp(o,a);this._movement.applyRotation(c)}}reset(){this.set(this._camera._savedPosition,this._camera._savedTarget)}set(t,n){const i=n??this._camera.target,s=this._camera.position.clone(),o=this._camera.target.clone();this.onProgress=a=>{this._movement.set(s.clone().lerp(t,a),o.clone().lerp(i,a))}}}class jw extends Bm{zoom(e){const t=this._camera.orbitDistance*e;this.setDistance(t)}reset(){this.set(this._camera._savedPosition,this._camera._savedTarget)}setDistance(e){const t=this._camera.target.clone().sub(this._camera.forward.multiplyScalar(e));this.set(t,this._camera.target)}rotate(e){const t=e.clone().multiply(this._camera.allowedRotation),n=this.predictRotate(t);this.applyRotation(n)}applyRotation(e){this._camera.quaternion.copy(e);const t=this._camera.forward.multiplyScalar(this._camera.orbitDistance).add(this._camera.position);this.set(this._camera.position,t)}target(e){this.set(this._camera.position,e)}orbit(e){const t=e.clone().multiply(this._camera.allowedRotation),n=this.predictOrbit(t);this.set(n)}move3(e){const t=e.clone();t.applyQuaternion(this._camera.quaternion);const n=this.lockVector(t,new U),i=this._camera.position.clone().add(n),s=this._camera.target.clone().add(n);this.set(i,s)}set(e,t){const n=this.lockVector(e,this._camera.position);this._camera.position.copy(n),t=t??this._camera.target,this._camera.target.copy(t),this._camera.camPerspective.camera.lookAt(t),this._camera.camPerspective.camera.up.set(0,1,0)}lockVector(e,t){const n=this._camera.allowedMovement.x===0?t.x:e.x,i=this._camera.allowedMovement.y===0?t.y:e.y,s=this._camera.allowedMovement.z===0?t.z:e.z;return new U(n,i,s)}predictOrbit(e){const t=this.predictRotate(e),n=new U(0,0,1).applyQuaternion(t).multiplyScalar(this._camera.orbitDistance);return this._camera.target.clone().add(n)}predictRotate(e){const t=new Zt(0,0,0,"YXZ");t.setFromQuaternion(this._camera.quaternion),t.x+=e.x*Math.PI/180,t.y+=e.y*Math.PI/180,t.z=0;const n=Math.PI*.4999;return t.x=Math.max(-n,Math.min(n,t.x)),new wt().setFromEuler(t)}}class Jw{constructor(e,t){J(this,"camPerspective");J(this,"camOrthographic");J(this,"_viewport");J(this,"_lerp");J(this,"_movement");J(this,"_inputVelocity",new U);J(this,"_velocity",new U);J(this,"_speed",0);J(this,"_orthographic",!1);J(this,"_target",new U);J(this,"_lastPosition",new U);J(this,"_lastQuaternion",new wt);J(this,"_lastTarget",new U);J(this,"_savedPosition",new U(0,0,-5));J(this,"_savedTarget",new U(0,0,0));J(this,"_onValueChanged",new Ms.SignalDispatcher);J(this,"_hasMoved");J(this,"_onMoved",new Ms.SignalDispatcher);J(this,"_force",!1);J(this,"_allowedMovement",new U(1,1,1));J(this,"_allowedRotation",new he(1,1));J(this,"_defaultForward",new U(0,0,1));J(this,"_velocityBlendFactor",1e-4);J(this,"_moveSpeed",1);J(this,"_lerpDuration",1);J(this,"_lerpEasing","easeOutCubic");this.camPerspective=new Yw(new kt),this.camOrthographic=new Qw(new ur),this._movement=new jw(this),this._lerpDuration=t.camera.controls.lerpDuration,this._lerpEasing=t.camera.controls.lerpEasing,this._lerp=new Kw(this,this._movement,this._lerpEasing),this._viewport=e,this.applySettings(t),this.do().orbitTowards(this._defaultForward),this.do().setDistance(-1e3)}get onValueChanged(){return this._onValueChanged.asEvent()}get hasMoved(){return this._hasMoved}get onMoved(){return this._onMoved.asEvent()}get allowedMovement(){return this._force?new U(1,1,1):this._allowedMovement}set allowedMovement(e){this._allowedMovement.copy(e),this._allowedMovement.x=this._allowedMovement.x===0?0:1,this._allowedMovement.y=this._allowedMovement.y===0?0:1,this._allowedMovement.z=this._allowedMovement.z===0?0:1}get allowedRotation(){return this._force?new he(1,1):this._allowedRotation}set allowedRotation(e){this._allowedRotation.copy(e),this._allowedRotation.x=this._allowedRotation.x===0?0:1,this._allowedRotation.y=this._allowedRotation.y===0?0:1}get defaultForward(){return this._defaultForward}set defaultForward(e){e.x===0&&e.y===0&&e.z===0?this._defaultForward.set(0,0,1):this._defaultForward.copy(e)}do(e=!1){return this._force=e,this._lerp.cancel(),this._movement}lerp(e,t=!1){this.stop(),this._force=t;const n=e??this._lerpDuration;return this._lerp.init(n,this._lerpEasing),this._lerp}frustrumSizeAt(e){return this.camPerspective.frustrumSizeAt(e)}notifyMovement(){this._hasMoved=!0,this._onMoved.dispatch()}get three(){return this._orthographic?this.camOrthographic.camera:this.camPerspective.camera}get quaternion(){return this.camPerspective.camera.quaternion}get position(){return this.camPerspective.camera.position}get matrix(){return this.camPerspective.camera.updateMatrix(),this.camPerspective.camera.matrix}get forward(){return this.camPerspective.camera.getWorldDirection(new U)}get speed(){return this._speed}set speed(e){this._speed=Mw(e,-25,25),this._onValueChanged.dispatch()}get localVelocity(){const e=this._velocity.clone();return e.applyQuaternion(this.quaternion.clone().invert()),e.setZ(-e.z),e}set localVelocity(e){this._lerp.cancel(),this._inputVelocity.copy(e),this._inputVelocity.setZ(-this._inputVelocity.z)}stop(){this._inputVelocity.set(0,0,0),this._velocity.set(0,0,0)}get target(){return this._target}applySettings(e){this._defaultForward=new U().copy(e.camera.forward),this._orthographic=e.camera.orthographic,this.allowedMovement=e.camera.allowedMovement,this.allowedRotation=e.camera.allowedRotation,this.camPerspective.applySettings(e),this.camOrthographic.applySettings(e),this._moveSpeed=e.camera.controls.moveSpeed,this._lerpDuration=e.camera.controls.lerpDuration,this._lerpEasing=e.camera.controls.lerpEasing,this._onValueChanged.dispatch()}get orbitDistance(){return this.position.distanceTo(this._target)}save(){this._lerp.cancel(),this._savedPosition.copy(this.position),this._savedTarget.copy(this._target)}updateProjection(){const e=this._viewport.getAspectRatio();this.camPerspective.updateProjection(e);const t=this.camPerspective.frustrumSizeAt(this.target);this.camOrthographic.updateProjection(t,e)}get orthographic(){return this._orthographic}set orthographic(e){e!==this._orthographic&&(this._orthographic=e,this._onValueChanged.dispatch())}update(e){this.applyVelocity(e)&&this.updateOrthographic();const t=this.checkForMovement();return t&&(this.camOrthographic.camera.position.copy(this.position),this.camOrthographic.camera.quaternion.copy(this.quaternion)),this.updateProjection(),t}applyVelocity(e){if(this._inputVelocity.x===0&&this._inputVelocity.y===0&&this._inputVelocity.z===0&&this._velocity.x===0&&this._velocity.y===0&&this._velocity.z===0)return!1;const t=Math.pow(this._velocityBlendFactor,e),n=1-t;this._velocity.multiplyScalar(t);const i=this._inputVelocity.clone().multiplyScalar(n);if(this._velocity.add(i),this._velocity.lengthSq()<e/10)return this._velocity.set(0,0,0),!1;const s=this._velocity.clone().multiplyScalar(e*this.getVelocityMultiplier());return this.do().move3(s),!0}updateOrthographic(){if(this.orthographic){const t=this._lastTarget.clone().sub(this.position).dot(this.forward);this.target.copy(this.forward).multiplyScalar(t).add(this.position);const n=this._lastPosition.clone().sub(this._target),i=this.position.clone().sub(this._target);(n.dot(i)<0||i.lengthSq()<1)&&this.position.copy(this._target).add(this.forward.multiplyScalar(-1))}}getVelocityMultiplier(){const t=!this._lastQuaternion.equals(this.quaternion)?1:1.66;return Math.pow(1.25,this.speed)*this._moveSpeed*t*100}checkForMovement(){return this._hasMoved=!1,(!this._lastPosition.equals(this.position)||!this._lastQuaternion.equals(this.quaternion)||!this._lastTarget.equals(this._target))&&(this._hasMoved=!0,this._onMoved.dispatch()),this._lastPosition.copy(this.position),this._lastQuaternion.copy(this.quaternion),this._lastTarget.copy(this._target),this._hasMoved}}class zu{constructor(e){J(this,"_viewer");J(this,"_unregisters",[]);J(this,"reg",(e,t,n)=>{e.addEventListener(t,n),this._unregisters.push(()=>e.removeEventListener(t,n))});this._viewer=e}register(){this._unregisters.length>0||this.addListeners()}addListeners(){}unregister(){this._unregisters.forEach(e=>e()),this._unregisters.length=0,this.reset()}reset(){}}const At={KEY_0:48,KEY_1:49,KEY_2:50,KEY_3:51,KEY_4:52,KEY_5:53,KEY_6:54,KEY_7:55,KEY_8:56,KEY_9:57,KEY_LEFT:37,KEY_RIGHT:39,KEY_UP:38,KEY_DOWN:40,KEY_CTRL:17,KEY_SHIFT:16,KEY_ENTER:13,KEY_SPACE:32,KEY_TAB:9,KEY_ESCAPE:27,KEY_BACKSPACE:8,KEY_HOME:36,KEY_END:35,KEY_INSERT:45,KEY_DELETE:46,KEY_ALT:18,KEY_F1:112,KEY_F2:113,KEY_F3:114,KEY_F4:115,KEY_F5:116,KEY_F6:117,KEY_F7:118,KEY_F8:119,KEY_F9:120,KEY_F10:121,KEY_F11:122,KEY_F12:123,KEY_NUMPAD0:96,KEY_NUMPAD1:97,KEY_NUMPAD2:98,KEY_NUMPAD3:99,KEY_NUMPAD4:100,KEY_NUMPAD5:101,KEY_NUMPAD6:102,KEY_NUMPAD7:103,KEY_NUMPAD8:104,KEY_NUMPAD9:105,KEY_ADD:107,KEY_SUBTRACT:109,KEY_MULTIPLY:106,KEY_DIVIDE:111,KEY_SEPARATOR:108,KEY_DECIMAL:110,KEY_OEM_PLUS:187,KEY_OEM_MINUS:189,KEY_A:65,KEY_B:66,KEY_C:67,KEY_D:68,KEY_E:69,KEY_F:70,KEY_G:71,KEY_H:72,KEY_I:73,KEY_J:74,KEY_K:75,KEY_L:76,KEY_M:77,KEY_N:78,KEY_O:79,KEY_P:80,KEY_Q:81,KEY_R:82,KEY_S:83,KEY_T:84,KEY_U:85,KEY_V:86,KEY_W:87,KEY_X:88,KEY_Y:89,KEY_Z:90},$w=new Set(Object.values(At));class eS extends zu{constructor(){super(...arguments);J(this,"SHIFT_MULTIPLIER",3);J(this,"isUpPressed",!1);J(this,"isDownPressed",!1);J(this,"isLeftPressed",!1);J(this,"isRightPressed",!1);J(this,"isEPressed",!1);J(this,"isQPressed",!1);J(this,"isShiftPressed",!1);J(this,"isCtrlPressed",!1);J(this,"arrowsEnabled",!0)}addListeners(){this.reg(document,"keydown",t=>this.onKeyDown(t)),this.reg(document,"keyup",t=>this.onKeyUp(t)),this.reg(this._viewer.viewport.canvas,"focusout",()=>this.reset()),this.reg(window,"resize",()=>this.reset())}reset(){this.isUpPressed=!1,this.isDownPressed=!1,this.isLeftPressed=!1,this.isRightPressed=!1,this.isEPressed=!1,this.isQPressed=!1,this.isShiftPressed=!1,this.isCtrlPressed=!1,this.applyMove()}get camera(){return this._viewer.camera}onKeyUp(t){this.onKey(t,!1)}onKeyDown(t){this.onKey(t,!0)}onKey(t,n){switch(!n&&$w.has(t.keyCode)&&this._viewer.inputs.KeyAction(t.keyCode)&&t.preventDefault(),t.keyCode){case At.KEY_W:case At.KEY_UP:this.isUpPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_S:case At.KEY_DOWN:this.isDownPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_D:case At.KEY_RIGHT:this.isRightPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_A:case At.KEY_LEFT:this.isLeftPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_E:this.isEPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_Q:this.isQPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_SHIFT:this.isShiftPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_CTRL:this.isCtrlPressed=n,t.preventDefault();break}}applyMove(){const t=new U((this.isRightPressed?1:0)-(this.isLeftPressed?1:0),(this.isEPressed?1:0)-(this.isQPressed?1:0),(this.isUpPressed?1:0)-(this.isDownPressed?1:0)),n=this.isShiftPressed?this.SHIFT_MULTIPLIER:1;t.multiplyScalar(n),this.arrowsEnabled&&(this.camera.localVelocity=t)}}class tS extends zu{constructor(t){super(t);J(this,"TAP_DURATION_MS",500);J(this,"DOUBLE_TAP_DELAY_MS",500);J(this,"TAP_MAX_MOVE_PIXEL",5);J(this,"ZOOM_SPEED",1);J(this,"MOVE_SPEED",100);J(this,"rotateSpeed",1);J(this,"orbitSpeed",1);J(this,"_touch");J(this,"_touch1");J(this,"_touch2");J(this,"_touchStartTime");J(this,"_lastTapMs");J(this,"_touchStart");J(this,"reset",()=>{this._touch=this._touch1=this._touch2=this._touchStartTime=void 0});J(this,"onTap",t=>{const n=new Date().getTime();this._lastTapMs&&n-this._lastTapMs<this.DOUBLE_TAP_DELAY_MS,this._lastTapMs=new Date().getTime()});J(this,"onTouchStart",t=>{t.preventDefault(),!(!t||!t.touches||!t.touches.length)&&(this._touchStartTime=new Date().getTime(),t.touches.length===1?(this._touch=this.touchToVector(t.touches[0]),this._touch1=this._touch2=void 0):t.touches.length===2&&(this._touch1=this.touchToVector(t.touches[0]),this._touch2=this.touchToVector(t.touches[1]),this._touch=this.average(this._touch1,this._touch2)),this._touchStart=this._touch)});J(this,"onDrag",t=>{this._viewer.inputs.pointerActive==="orbit"?this.camera.do().orbit(this.toRotation(t,this.orbitSpeed)):this.camera.do().rotate(this.toRotation(t,this.rotateSpeed))});J(this,"onDoubleDrag",t=>{const n=t.clone().multiplyScalar(this.MOVE_SPEED);this.camera.do().move2(n,"XY")});J(this,"onPinchOrSpread",t=>{this._viewer.inputs.pointerActive==="orbit"?this.camera.do().zoom(1+t*this.ZOOM_SPEED):this.camera.do().move1(t*this.ZOOM_SPEED,"Z")});J(this,"onTouchMove",t=>{if(t.preventDefault(),!(!t||!t.touches||!t.touches.length)&&!!this._touch){if(t.touches.length===1){const n=this.touchToVector(t.touches[0]),i=this.viewport.getSize(),s=n.clone().sub(this._touch).multiply(new he(1/i.x,1/i.y));this._touch=n,this.onDrag(s);return}if(!(!this._touch1||!this._touch2)&&t.touches.length>=2){const n=this.touchToVector(t.touches[0]),i=this.touchToVector(t.touches[1]),s=this.average(n,i),o=this.viewport.getSize(),a=this._touch.clone().sub(s).multiply(new he(-1/o.x,-1/o.y)),c=n.distanceTo(i),l=this._touch1.distanceTo(this._touch2),h=Math.min(o.x,o.y),u=(c-l)/-h;this._touch=s,this._touch1=n,this._touch2=i,a.length()>Math.abs(u)?this.onDoubleDrag(a):this.onPinchOrSpread(u)}}});J(this,"onTouchEnd",t=>{if(this.isSingleTouch()&&this._touchStart&&this._touch){const n=new Date().getTime()-this._touchStartTime,i=this._touch.distanceTo(this._touchStart);n<this.TAP_DURATION_MS&&i<this.TAP_MAX_MOVE_PIXEL&&this.onTap(this._touch)}this.reset()});this.rotateSpeed=t.settings.camera.controls.rotateSpeed,this.orbitSpeed=t.settings.camera.controls.orbitSpeed}get camera(){return this._viewer.camera}get viewport(){return this._viewer.viewport}addListeners(){const t=this.viewport.canvas;this.reg(t,"touchstart",this.onTouchStart),this.reg(t,"touchend",this.onTouchEnd),this.reg(t,"touchmove",this.onTouchMove)}toRotation(t,n){const i=new he;return i.x=t.y,i.y=t.x,i.multiplyScalar(-180*n),i}isSingleTouch(){return this._touch!==void 0&&this._touchStartTime!==void 0&&this._touch1===void 0&&this._touch2===void 0}touchToVector(t){return new he(t.pageX,t.pageY)}average(t,n){return t.clone().lerp(n,.5)}}class nS extends zu{constructor(t){super(t);J(this,"_idleDelayMs",150);J(this,"zoomSpeed",1);J(this,"panSpeed",100);J(this,"rotateSpeed",1);J(this,"orbitSpeed",1);J(this,"_buttonDown");J(this,"_hasMouseMoved",!1);J(this,"_hasCameraMoved",!1);J(this,"_idleTimeout");J(this,"_idlePosition");J(this,"_lastPosition");J(this,"_downPosition");J(this,"reset",()=>{this._buttonDown=void 0,this._hasMouseMoved=!1,this._lastPosition=this._downPosition=void 0,clearTimeout(this._idleTimeout)});J(this,"onMouseOut",t=>{t.stopImmediatePropagation(),this._buttonDown=void 0,this._hasMouseMoved=!1,this._lastPosition=void 0,this.resetIdle()});J(this,"onCameraMoved",()=>{this.resetIdle(),this._hasCameraMoved=!0});J(this,"onMouseMove",t=>{t.stopImmediatePropagation(),this._lastPosition=new he(t.offsetX,t.offsetY),(!this._idlePosition||this._lastPosition.distanceTo(this._idlePosition)>5)&&this.resetIdle(),this._buttonDown&&this.onMouseDrag(t)});J(this,"onMouseDown",t=>{if(t.stopImmediatePropagation(),t.preventDefault(),this._buttonDown)return;this.inputs.ContextMenu(void 0),this._hasCameraMoved=!1,this._downPosition=new he(t.offsetX,t.offsetY),this._hasMouseMoved=!1,this.viewport.canvas.focus(),this._buttonDown=this.getButton(t);const n=this._buttonDown==="middle"?"pan":this._buttonDown==="right"?"look":void 0;this.inputs.pointerOverride=n});J(this,"onMouseWheel",t=>{t.preventDefault(),t.stopImmediatePropagation();const n=Math.sign(t.deltaY);if(t.ctrlKey)this.camera.speed-=n;else{const i=Math.pow(1.3,n);this.camera.lerp().zoom(i)}});J(this,"onMouseUp",t=>{t.stopImmediatePropagation(),this.resetIdle(),this.getButton(t)!==this._buttonDown&&(t.preventDefault(),this._buttonDown&&(t.button===2&&!this._hasMouseMoved&&this.inputs.ContextMenu(new he(t.clientX,t.clientY)),this._buttonDown=void 0,this.inputs.pointerOverride=void 0))});this.rotateSpeed=t.settings.camera.controls.rotateSpeed,this.orbitSpeed=t.settings.camera.controls.orbitSpeed}get camera(){return this._viewer.camera}get viewport(){return this._viewer.viewport}get canvas(){return this.viewport.canvas}get inputs(){return this._viewer.inputs}addListeners(){this.reg(this.canvas,"mousedown",this.onMouseDown),this.reg(this.canvas,"wheel",this.onMouseWheel),this.reg(this.canvas,"mousemove",this.onMouseMove),this.reg(this.canvas,"mouseup",this.onMouseUp),this.reg(this.canvas,"mouseout",this.onMouseOut),this.reg(this.canvas,"contextmenu",t=>t.preventDefault()),this._unregisters.push(this.camera.onMoved.subscribe(()=>this.onCameraMoved()))}resetIdle(){this._idlePosition&&(this._idlePosition=void 0),clearTimeout(this._idleTimeout)}onMouseDrag(t){t.stopImmediatePropagation(),t.preventDefault();const n=t.movementX||t.mozMovementX||t.webkitMovementX||0,i=t.movementY||t.mozMovementY||t.webkitMovementY||0,s=this.viewport.getSize(),o=new he(n/s.x,i/s.y),a=new he(t.offsetX,t.offsetY);switch(this._hasMouseMoved=this._hasMouseMoved||this._downPosition&&this._downPosition?.distanceTo(a)>4,this._buttonDown){case"main":this.onMouseMainDrag(o);break;case"middle":this.onMouseMiddleDrag(o);break;case"right":this.onMouseRightDrag(o);break}}toRotation(t,n){const i=t.clone();return i.x=-t.y,i.y=-t.x,i.multiplyScalar(180*n),i}onMouseMainDrag(t){switch(this.inputs.pointerActive){case"orbit":this.camera.do().orbit(this.toRotation(t,this.orbitSpeed));break;case"look":this.camera.do().rotate(this.toRotation(t,this.rotateSpeed));break;case"pan":this.camera.do().move2(t.multiplyScalar(this.panSpeed),"XY");break;case"zoom":this.camera.do().zoom(1+t.y*this.zoomSpeed);break}}onMouseMiddleDrag(t){this.camera.do().move2(t.multiplyScalar(100),"XY")}onMouseRightDrag(t){this.camera.do().rotate(this.toRotation(t,this.rotateSpeed))}getButton(t){return t.buttons&1?"main":t.buttons&2?"right":t.buttons&4?"middle":void 0}getModifier(t){return t.ctrlKey?"ctrl":t.shiftKey?"shift":"none"}}var Om={},Ts={};Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.SimpleEventDispatcher=void 0;const Fm=br;class iS extends Fm.DispatcherBase{constructor(){super()}dispatch(e){const t=this._dispatch(!1,this,arguments);if(t==null)throw new Fm.DispatchError("Got `null` back from dispatch.");return t}dispatchAsync(e){this._dispatch(!0,this,arguments)}asEvent(){return super.asEvent()}}Ts.SimpleEventDispatcher=iS;var _l={},Co={};Object.defineProperty(Co,"__esModule",{value:!0}),Co.SimpleEventList=void 0;const rS=br,sS=Ts;class oS extends rS.EventListBase{constructor(){super()}createDispatcher(){return new sS.SimpleEventDispatcher}}Co.SimpleEventList=oS,Object.defineProperty(_l,"__esModule",{value:!0}),_l.SimpleEventHandlingBase=void 0;const aS=br,cS=Co;class lS extends aS.HandlingBase{constructor(){super(new cS.SimpleEventList)}}_l.SimpleEventHandlingBase=lS;var vl={};Object.defineProperty(vl,"__esModule",{value:!0}),vl.NonUniformSimpleEventList=void 0;const hS=Ts;class uS{constructor(){this._events={}}get(e){if(this._events[e])return this._events[e];const t=this.createDispatcher();return this._events[e]=t,t}remove(e){delete this._events[e]}createDispatcher(){return new hS.SimpleEventDispatcher}}vl.NonUniformSimpleEventList=uS,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.NonUniformSimpleEventList=r.SimpleEventList=r.SimpleEventHandlingBase=r.SimpleEventDispatcher=void 0;const e=Ts;Object.defineProperty(r,"SimpleEventDispatcher",{enumerable:!0,get:function(){return e.SimpleEventDispatcher}});const t=_l;Object.defineProperty(r,"SimpleEventHandlingBase",{enumerable:!0,get:function(){return t.SimpleEventHandlingBase}});const n=vl;Object.defineProperty(r,"NonUniformSimpleEventList",{enumerable:!0,get:function(){return n.NonUniformSimpleEventList}});const i=Co;Object.defineProperty(r,"SimpleEventList",{enumerable:!0,get:function(){return i.SimpleEventList}})}(Om);class zm{constructor(e){J(this,"_viewer");this._viewer=e}onKeyAction(e){const t=this._viewer.camera;switch(e){case At.KEY_P:return t.orthographic=!t.orthographic,!0;case At.KEY_ADD:case At.KEY_OEM_PLUS:return t.speed+=1,!0;case At.KEY_SUBTRACT:case At.KEY_OEM_MINUS:return t.speed-=1,!0;case At.KEY_F8:case At.KEY_SPACE:return this._viewer.inputs.pointerActive=this._viewer.inputs.pointerFallback,!0;case At.KEY_HOME:return t.lerp(1).reset(),!0;case At.KEY_ESCAPE:return!0;case At.KEY_Z:case At.KEY_F:return t.lerp(1).frame("all"),!0;default:return!1}}}class fS{constructor(e){J(this,"_viewer");J(this,"_scheme");J(this,"touch");J(this,"mouse");J(this,"keyboard");J(this,"_pointerActive","orbit");J(this,"_pointerFallback","look");J(this,"_pointerOverride");J(this,"_onPointerModeChanged",new Ms.SignalDispatcher);J(this,"_onPointerOverrideChanged",new Ms.SignalDispatcher);J(this,"_onContextMenu",new Om.SimpleEventDispatcher);J(this,"unregisterAll",()=>{this.mouse.unregister(),this.keyboard.unregister(),this.touch.unregister()});this._viewer=e,this._scheme=new zm(e),this.keyboard=new eS(e),this.mouse=new nS(e),this.touch=new tS(e),this.pointerActive=e.settings.camera.controls.orbit?"orbit":"look",this._pointerFallback=e.settings.camera.controls.orbit?"look":"orbit"}get pointerFallback(){return this._pointerFallback}get pointerActive(){return this._pointerActive}get pointerOverride(){return this._pointerOverride}set pointerOverride(e){e!==this._pointerOverride&&(this._pointerOverride=e,this._onPointerOverrideChanged.dispatch())}set pointerActive(e){e!==this._pointerActive&&(e==="look"?this._pointerFallback="orbit":e==="orbit"&&(this._pointerFallback="look"),this._pointerActive=e,this._onPointerModeChanged.dispatch())}get onPointerModeChanged(){return this._onPointerModeChanged.asEvent()}get onPointerOverrideChanged(){return this._onPointerOverrideChanged.asEvent()}get onContextMenu(){return this._onContextMenu.asEvent()}get scheme(){return this._scheme}KeyAction(e){return this._scheme.onKeyAction(e)}ContextMenu(e){this._onContextMenu.dispatch(e)}registerAll(){this.keyboard.register(),this.mouse.register(),this.touch.register()}resetAll(){this.mouse.reset(),this.keyboard.reset(),this.touch.reset()}}class dS{constructor(){J(this,"mesh");J(this,"_source");J(this,"_size",1);J(this,"_geometry");J(this,"_material");J(this,"_texture");this._geometry=new rr,this._material=new un({transparent:!0,depthTest:!0,depthWrite:!1}),this.mesh=new St(this._geometry,this._material),this.mesh.renderOrder=-1}applyViewerSettings(e){this._size=e.groundPlane.size,this.mesh.visible=e.groundPlane.visible,this.applyTexture(e.groundPlane.encoding,e.groundPlane.texture),this._material.color.copy(e.groundPlane.color),this._material.opacity=e.groundPlane.opacity}adaptToContent(e){const t=e.getCenter(new U),n=new U(t.x,e.min.y-Math.abs(e.min.y)*.01,t.z);this.mesh.position.copy(n),this.mesh.quaternion.copy(new wt().setFromEuler(new Zt(1.5*Math.PI,0,0)));const s=(e?.getBoundingSphere(new Pt)?.radius??1)*this._size,o=new U(1,1,1).multiplyScalar(s);this.mesh.scale.copy(o)}applyTexture(e,t){if(t!==this._source&&(this._source=t,this._texture?.dispose(),this._texture=void 0,!(!t||!e))){if(e==="url"){const n=new lu;this._texture=n.load(t)}if(e==="base64"){const n=new Image;n.src=t;const i=new xt;this._texture=i,this._texture.image=n,n.onload=()=>{i.needsUpdate=!0}}if(!this._texture){console.error("Failed to load texture: "+t);return}this._material.map=this._texture}}dispose(){this._geometry?.dispose(),this._material?.dispose(),this._texture?.dispose(),this._texture=void 0}}class pS{constructor(e){J(this,"skyLight");J(this,"ambientLight");J(this,"sunLights");J(this,"_groundPlane");this._groundPlane=new dS,this.skyLight=new hu,this.ambientLight=new mu,this.sunLights=[],this.applySettings(e)}get groundPlane(){return this._groundPlane.mesh}loadGroundTexture(e,t){this._groundPlane.applyTexture(e,t)}getObjects(){return[this._groundPlane.mesh,this.skyLight,this.ambientLight,...this.sunLights]}applySettings(e){this._groundPlane.applyViewerSettings(e),this.skyLight.color.copy(e.skylight.skyColor),this.skyLight.groundColor.copy(e.skylight.groundColor),this.skyLight.intensity=e.skylight.intensity,this.ambientLight.color.copy(e.ambientLight.color),this.ambientLight.intensity=e.ambientLight.intensity;const t=e.sunLights.length;for(let n=0;n<t;n++){this.sunLights[n]||(this.sunLights[n]=new jc);const i=e.sunLights[n].color,s=e.sunLights[n].position,o=e.sunLights[n].intensity;i&&this.sunLights[n].color.copy(i),s&&this.sunLights[n].position.copy(s),o&&(this.sunLights[n].intensity=o)}}adaptToContent(e){this._groundPlane.adaptToContent(e)}dispose(){this.sunLights.forEach(e=>e.dispose()),this.skyLight.dispose(),this.ambientLight.dispose(),this._groundPlane.dispose()}}class mS{constructor(e,t,n,i){J(this,"_renderer");J(this,"_camera");J(this,"_inputs");J(this,"_size",1);J(this,"_fov",50);J(this,"_color",new xe("blue"));J(this,"_opacity",.2);J(this,"_opacityAlways",.5);J(this,"_fadeDurationMs",200);J(this,"_showDurationMs",1e3);J(this,"_box");J(this,"_wireframe");J(this,"_material");J(this,"_materialAlways");J(this,"_gizmos");J(this,"_disconnectCamera");J(this,"_timeout");J(this,"_fadeEnd",0);J(this,"_active",!0);J(this,"_animation",0);this._renderer=e,this._camera=t,this._inputs=n,this.applySettings(i),this.connect()}connect(){const e=this._inputs.onPointerModeChanged.subscribe(()=>this.onUpdate()),t=this._camera.onMoved.subscribe(()=>this.onUpdate()),n=this._camera.onValueChanged.subscribe(()=>this.onUpdate());this._disconnectCamera=()=>{e(),t(),n()}}onUpdate(){this.updateScale(),this.setPosition(this._camera.target),this.show(!0)}dispose(){cancelAnimationFrame(this._animation),clearTimeout(this._timeout),this._box?.dispose(),this._wireframe?.dispose(),this._material?.dispose(),this._materialAlways?.dispose(),this._disconnectCamera?.(),this._box=void 0,this._wireframe=void 0,this._material=void 0,this._materialAlways=void 0,this._disconnectCamera=void 0,this._gizmos&&(this._renderer.remove(this._gizmos),this._gizmos=void 0)}get enabled(){return this._active}set enabled(e){this._active=e}show(e=!0){!this._active||(this._gizmos||this.createGizmo(),clearTimeout(this._timeout),this._gizmos.visible=e,e&&(this._timeout=setTimeout(()=>this.fadeOut(),this._showDurationMs)))}fadeOut(e){const t=new Date().getTime();if(e||(this._fadeEnd=t+this._fadeDurationMs),t>this._fadeEnd)this._gizmos.visible=!1,this._material.opacity=this._opacity,this._materialAlways.opacity=this._opacityAlways;else{this._animation=requestAnimationFrame(()=>this.fadeOut(!0));const n=Math.pow((this._fadeEnd-t)/this._fadeDurationMs,4);this._material.opacity=ka.lerp(0,this._opacity,n),this._materialAlways.opacity=ka.lerp(0,this._opacityAlways,n)}this._renderer.needsUpdate=!0}setPosition(e){this._gizmos?.position.copy(e),this.updateScale()}setSize(e){this._size=e}setOpacity(e,t){this._opacity=e,this._opacityAlways=t,this._gizmos&&(this._material.opacity=e,this._materialAlways.opacity=t)}setColor(e){this._color=e,this._gizmos&&(this._material.color=e,this._materialAlways.color=e)}applySettings(e){this._active=e.camera.gizmo.enable,this._fov=e.camera.fov,this.setColor(e.camera.gizmo.color),this.setSize(e.camera.gizmo.size),this.setOpacity(e.camera.gizmo.opacity,e.camera.gizmo.opacityAlways)}updateScale(){if(!this._gizmos)return;const e=this._camera.frustrumSizeAt(this._gizmos.position),n=Math.min(e.x,e.y)*this._size;this._gizmos.scale.set(n,n,n)}createGizmo(){this._box=new ms(1),this._wireframe=new eu(this._box),this._wireframe.addGroup(0,1/0,0),this._wireframe.addGroup(0,1/0,1),this._material=new qt({depthTest:!0,opacity:this._opacity,color:this._color,transparent:!0}),this._materialAlways=new qt({depthTest:!1,opacity:this._opacityAlways,color:this._color,transparent:!0}),this._gizmos=new In(this._wireframe,[this._material,this._materialAlways]),this._renderer.add(this._gizmos),this.updateScale()}}const Cs=new U,km=new We,Vm=new We,Hm=new U,Gm=new U;class gS{constructor(e={}){const t=this;let n,i,s,o;const a={objects:new WeakMap},c=e.element!==void 0?e.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c,this.sortObjects=!0,this.getSize=function(){return{width:n,height:i}},this.render=function(g,_){g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),_.parent===null&&_.matrixWorldAutoUpdate===!0&&_.updateMatrixWorld(),km.copy(_.matrixWorldInverse),Vm.multiplyMatrices(_.projectionMatrix,km),h(g,g,_),this.sortObjects&&d(g)},this.setSize=function(g,_){n=g,i=_,s=n/2,o=i/2,c.style.width=g+"px",c.style.height=_+"px"};function l(g){g.isCSS2DObject&&(g.element.style.display="none");for(let _=0,m=g.children.length;_<m;_++)l(g.children[_])}function h(g,_,m){if(g.visible===!1){l(g);return}if(g.isCSS2DObject){Cs.setFromMatrixPosition(g.matrixWorld),Cs.applyMatrix4(Vm);const p=Cs.z>=-1&&Cs.z<=1&&g.layers.test(m.layers)===!0,v=g.element;v.style.display=p===!0?"":"none",p===!0&&(g.onBeforeRender(t,_,m),v.style.transform="translate("+-100*g.center.x+"%,"+-100*g.center.y+"%)translate("+(Cs.x*s+s)+"px,"+(-Cs.y*o+o)+"px)",v.parentNode!==c&&c.appendChild(v),g.onAfterRender(t,_,m));const y={distanceToCameraSquared:u(m,g)};a.objects.set(g,y)}for(let p=0,v=g.children.length;p<v;p++)h(g.children[p],_,m)}function u(g,_){return Hm.setFromMatrixPosition(g.matrixWorld),Gm.setFromMatrixPosition(_.matrixWorld),Hm.distanceToSquared(Gm)}function f(g){const _=[];return g.traverseVisible(function(m){m.isCSS2DObject&&_.push(m)}),_}function d(g){const _=f(g).sort(function(p,v){if(p.renderOrder!==v.renderOrder)return v.renderOrder-p.renderOrder;const y=a.objects.get(p).distanceToCameraSquared,x=a.objects.get(v).distanceToCameraSquared;return y-x}),m=_.length;for(let p=0,v=_.length;p<v;p++)_[p].element.style.zIndex=m-p}}}class ku{constructor(e){J(this,"canvas");J(this,"text");J(this,"_unregisterResize");J(this,"_ownedCanvas");J(this,"_onResize",new Ms.SignalDispatcher);const[t,n]=ku.getOrCreateCanvas(e.canvas.id);this.canvas=t,this._ownedCanvas=n,this.watchResize(e.canvas.resizeDelay)}get onResize(){return this._onResize.asEvent()}static getOrCreateCanvas(e){let t=e?document.getElementById(e):void 0;return t?[t,!1]:(t=document.createElement("canvas"),t.className="ara3d-canvas",t.tabIndex=0,t.style.backgroundColor="black",document.body.appendChild(t),[t,!0])}createTextRenderer(){if(console.log("Creating text renderer"),!this.canvas.parentElement)throw new Error("Cannot create text renderer without a canvas");const e=this.getParentSize(),t=new gS;return t.setSize(e.x,e.y),this.text=t.domElement,this.text.className="ara3d-text-renderer",this.text.style.position="absolute",this.text.style.top="0px",this.text.style.pointerEvents="none",this.canvas.parentElement.append(this.text),t}dispose(){this._unregisterResize?.(),this._unregisterResize=void 0,this._ownedCanvas&&this.canvas.remove()}getParentSize(){return new he(this.canvas.parentElement?.clientWidth??this.canvas.clientWidth,this.canvas.parentElement?.clientHeight??this.canvas.clientHeight)}getSize(){return new he(this.canvas.clientWidth,this.canvas.clientHeight)}getAspectRatio(){const e=this.getParentSize();return e.x/e.y}ResizeToParent(){this._onResize.dispatch()}watchResize(e){let t;const n=()=>{t!==void 0&&(clearTimeout(t),t=void 0),t=setTimeout(()=>{t=void 0,this._onResize.dispatch()},e)};window.addEventListener("resize",n),this._unregisterResize=()=>window.removeEventListener("resize",n)}}class _S{constructor(e,t,n,i){J(this,"renderer");J(this,"antialias",!0);J(this,"scene");J(this,"viewport");J(this,"camera");J(this,"needsUpdate");J(this,"_lastSize",new he);J(this,"fitViewport",()=>{const e=this.viewport.getParentSize();if(e.x===this._lastSize.x&&e.y===this._lastSize.y)return;this._lastSize.copy(e);const t=1.5;this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,t)),this.renderer.setSize(e.x,e.y),this.needsUpdate=!0});this.viewport=t,this.scene=e,this.camera=n,this.renderer=new Cm({canvas:t.canvas,antialias:!0,precision:"highp",alpha:!0,stencil:!1,powerPreference:"high-performance",logarithmicDepthBuffer:!0}),this.fitViewport(),this.viewport.onResize.subscribe(()=>this.fitViewport()),this.camera.onValueChanged.sub(()=>{this.needsUpdate=!0}),this.background=i.background.color,this.applyRenderingSettings(i)}applyRenderingSettings(e){this.renderer.toneMapping=e.rendering.toneMapping,this.renderer.toneMappingExposure=e.rendering.toneMappingExposure}dispose(){this.clear(),this.renderer.clear(),this.renderer.forceContextLoss(),this.renderer.dispose()}get background(){return this.scene.background}set background(e){this.scene.background=e,e===null?this.renderer.setClearColor(0,0):this.renderer.setClearColor(0,1),this.needsUpdate=!0}render(){!this.needsUpdate&&!this.camera.hasMoved||this.renderer.render(this.scene,this.camera.camPerspective.camera)}add(e){return this.scene.add(e),this.needsUpdate=!0,!0}remove(e){this.scene.remove(e),this.needsUpdate=!0}clear(){this.scene.clear(),this.needsUpdate=!0}}class vS{constructor(e){J(this,"settings");J(this,"renderer");J(this,"viewport");J(this,"inputs");J(this,"camera");J(this,"environment");J(this,"gizmoOrbit");J(this,"running",!1);J(this,"updateId",null);J(this,"clock",new el);J(this,"scene",new Ch);J(this,"animate",()=>{if(!this.running)return;this.updateId=requestAnimationFrame(this.animate);const e=this.clock.getDelta(),t=this.camera.update(e);this.renderer.needsUpdate=this.renderer.needsUpdate||t,this.renderer.render()});this.settings=Dm(e),this.viewport=new ku(this.settings),this.camera=new Jw(this.viewport,this.settings),this.renderer=new _S(this.scene,this.viewport,this.camera,this.settings),this.inputs=new fS(this),this.settings.camera.gizmo.enable&&(this.gizmoOrbit=new mS(this.renderer,this.camera,this.inputs,this.settings)),this.environment=new pS(this.settings),this.environment.getObjects().forEach(t=>this.renderer.add(t)),this.inputs.registerAll(),this.start()}start(){this.running||(this.running=!0,this.clock.start(),this.animate())}stop(){this.running=!1,this.updateId!==null&&(cancelAnimationFrame(this.updateId),this.updateId=null)}add(e,t=!0){if(console.log("Adding object"),this.renderer.needsUpdate=!0,!this.renderer.add(e))throw new Error("Could not load object")}clear(){this.renderer.clear()}dispose(){cancelAnimationFrame(this.updateId),this.environment.dispose(),this.gizmoOrbit.dispose(),this.viewport.dispose(),this.renderer.dispose(),this.inputs.unregisterAll()}}function Wm(r,e){if(e===Zf)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===Oa||e===eh){let t=r.getIndex();if(t===null){const o=[],a=r.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)o.push(c);r.setIndex(o),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(e===Oa)for(let o=1;o<=n;o++)i.push(t.getX(0)),i.push(t.getX(o)),i.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(i.push(t.getX(o)),i.push(t.getX(o+1)),i.push(t.getX(o+2))):(i.push(t.getX(o+2)),i.push(t.getX(o+1)),i.push(t.getX(o)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}class yS extends Jt{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new SS(t)}),this.register(function(t){return new MS(t)}),this.register(function(t){return new NS(t)}),this.register(function(t){return new US(t)}),this.register(function(t){return new BS(t)}),this.register(function(t){return new TS(t)}),this.register(function(t){return new CS(t)}),this.register(function(t){return new IS(t)}),this.register(function(t){return new RS(t)}),this.register(function(t){return new wS(t)}),this.register(function(t){return new PS(t)}),this.register(function(t){return new ES(t)}),this.register(function(t){return new LS(t)}),this.register(function(t){return new DS(t)}),this.register(function(t){return new AS(t)}),this.register(function(t){return new OS(t)}),this.register(function(t){return new FS(t)})}load(e,t,n,i){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const l=Li.extractUrlBase(e);o=Li.resolveURL(l,this.path)}else o=Li.extractUrlBase(e);this.manager.itemStart(e);const a=function(l){i?i(l):console.error(l),s.manager.itemError(e),s.manager.itemEnd(e)},c=new An(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{s.parse(l,o,function(h){t(h),s.manager.itemEnd(e)},a)}catch(h){a(h)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return 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,n,i){let s;const o={},a={},c=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===qm){try{o[at.KHR_BINARY_GLTF]=new zS(e)}catch(u){i&&i(u);return}s=JSON.parse(o[at.KHR_BINARY_GLTF].content)}else s=JSON.parse(c.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new JS(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](l);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],f=s.extensionsRequired||[];switch(u){case at.KHR_MATERIALS_UNLIT:o[u]=new bS;break;case at.KHR_DRACO_MESH_COMPRESSION:o[u]=new kS(s,this.dracoLoader);break;case at.KHR_TEXTURE_TRANSFORM:o[u]=new VS;break;case at.KHR_MESH_QUANTIZATION:o[u]=new HS;break;default:f.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function xS(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const at={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 AS{constructor(e){this.parser=e,this.name=at.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const s=t[n];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,n="light:"+e;let i=t.cache.get(n);if(i)return i;const s=t.json,c=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let l;const h=new xe(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],Xt);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new jc(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new pu(h),l.distance=u;break;case"spot":l=new du(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),ti(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(c){return n._getNodeRef(t.cache,a,c)})}}class bS{constructor(){this.name=at.KHR_MATERIALS_UNLIT}getMaterialType(){return un}extendParams(e,t,n){const i=[];e.color=new xe(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],Xt),e.opacity=o[3]}s.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",s.baseColorTexture,Tt))}return Promise.all(i)}}class wS{constructor(e){this.parser=e,this.name=at.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 s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class SS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new he(a,a)}return Promise.all(s)}}class MS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class ES{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(n.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(n.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class TS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new xe(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=i.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],Xt)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(n.assignTexture(t,"sheenColorMap",o.sheenColorTexture,Tt)),o.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class CS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class IS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new xe().setRGB(a[0],a[1],a[2],Xt),Promise.all(s)}}class RS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class PS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new xe().setRGB(a[0],a[1],a[2],Xt),o.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularColorMap",o.specularColorTexture,Tt)),Promise.all(s)}}class DS{constructor(e){this.parser=e,this.name=at.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(n.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(s)}}class LS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.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(n.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class NS{constructor(e){this.parser=e,this.name=at.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class US{constructor(e){this.parser=e,this.name=at.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return n.loadTextureImage(e,o.source,c)}}class BS{constructor(e){this.parser=e,this.name=at.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return n.loadTextureImage(e,o.source,c)}}class OS{constructor(e){this.name=at.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.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 c=i.byteOffset||0,l=i.byteLength||0,h=i.count,u=i.byteStride,f=new Uint8Array(a,c,l);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,u,f,i.mode,i.filter).then(function(d){return d.buffer}):o.ready.then(function(){const d=new ArrayBuffer(h*u);return o.decodeGltfBuffer(new Uint8Array(d),h,u,f,i.mode,i.filter),d})})}else return null}}class FS{constructor(e){this.name=at.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const l of i.primitives)if(l.mode!==Dn.TRIANGLES&&l.mode!==Dn.TRIANGLE_STRIP&&l.mode!==Dn.TRIANGLE_FAN&&l.mode!==void 0)return null;const o=n.extensions[this.name].attributes,a=[],c={};for(const l in o)a.push(this.parser.getDependency("accessor",o[l]).then(h=>(c[l]=h,c[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(l=>{const h=l.pop(),u=h.isGroup?h.children:[h],f=l[0].count,d=[];for(const g of u){const _=new We,m=new U,p=new wt,v=new U(1,1,1),y=new _c(g.geometry,g.material,f);for(let x=0;x<f;x++)c.TRANSLATION&&m.fromBufferAttribute(c.TRANSLATION,x),c.ROTATION&&p.fromBufferAttribute(c.ROTATION,x),c.SCALE&&v.fromBufferAttribute(c.SCALE,x),y.setMatrixAt(x,_.compose(m,p,v));for(const x in c)if(x==="_COLOR_0"){const A=c[x];y.instanceColor=new Ji(A.array,A.itemSize,A.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,c[x]);ct.prototype.copy.call(y,g),this.parser.assignFinalMaterial(y),d.push(y)}return h.isGroup?(h.clear(),h.add(...d),h):d[0]}))}}const qm="glTF",Io=12,Xm={JSON:1313821514,BIN:5130562};class zS{constructor(e){this.name=at.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Io),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==qm)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Io,s=new DataView(e,Io);let o=0;for(;o<i;){const a=s.getUint32(o,!0);o+=4;const c=s.getUint32(o,!0);if(o+=4,c===Xm.JSON){const l=new Uint8Array(e,Io+o,a);this.content=n.decode(l)}else if(c===Xm.BIN){const l=Io+o;this.body=e.slice(l,l+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class kS{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=at.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},c={},l={};for(const h in o){const u=Hu[h]||h.toLowerCase();a[u]=o[h]}for(const h in e.attributes){const u=Hu[h]||h.toLowerCase();if(o[h]!==void 0){const f=n.accessors[e.attributes[h]],d=Is[f.componentType];l[u]=d.name,c[u]=f.normalized===!0}}return t.getDependency("bufferView",s).then(function(h){return new Promise(function(u,f){i.decodeDracoFile(h,function(d){for(const g in d.attributes){const _=d.attributes[g],m=c[g];m!==void 0&&(_.normalized=m)}u(d)},a,l,Xt,f)})})}}class VS{constructor(){this.name=at.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 HS{constructor(){this.name=at.KHR_MESH_QUANTIZATION}}class Zm extends _s{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let o=0;o!==i;o++)t[o]=n[s+o];return t}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=a*2,l=a*3,h=i-t,u=(n-t)/h,f=u*u,d=f*u,g=e*l,_=g-l,m=-2*d+3*f,p=d-f,v=1-m,y=p-f+u;for(let x=0;x!==a;x++){const A=o[_+x+a],E=o[_+x+c]*h,I=o[g+x+a],D=o[g+x]*h;s[x]=v*A+y*E+m*I+p*D}return s}}const GS=new wt;class WS extends Zm{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return GS.fromArray(s).normalize().toArray(s),s}}const Dn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Is={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ym={9728:Mt,9729:pt,9984:Ko,9985:Ur,9986:Hi,9987:Mn},Qm={33071:tn,33648:Nr,10497:yi},Vu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Hu={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"},Bi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},qS={CUBICSPLINE:void 0,LINEAR:zr,STEP:Fr},Gu={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function XS(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new gs({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Wn})),r.DefaultMaterial}function Sr(r,e,t){for(const n in t.extensions)r[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function ti(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function ZS(r,e,t){let n=!1,i=!1,s=!1;for(let l=0,h=e.length;l<h;l++){const u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(s=!0),n&&i&&s)break}if(!n&&!i&&!s)return Promise.resolve(r);const o=[],a=[],c=[];for(let l=0,h=e.length;l<h;l++){const u=e[l];if(n){const f=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):r.attributes.position;o.push(f)}if(i){const f=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):r.attributes.normal;a.push(f)}if(s){const f=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):r.attributes.color;c.push(f)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(l){const h=l[0],u=l[1],f=l[2];return n&&(r.morphAttributes.position=h),i&&(r.morphAttributes.normal=u),s&&(r.morphAttributes.color=f),r.morphTargetsRelative=!0,r})}function YS(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)r.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function QS(r){let e;const t=r.extensions&&r.extensions[at.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Wu(t.attributes):e=r.indices+":"+Wu(r.attributes)+":"+r.mode,r.targets!==void 0)for(let n=0,i=r.targets.length;n<i;n++)e+=":"+Wu(r.targets[n]);return e}function Wu(r){let e="";const t=Object.keys(r).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+r[t[n]]+";";return e}function qu(r){switch(r){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.")}}function KS(r){return r.search(/\.jpe?g($|\?)/i)>0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":r.search(/\.ktx2($|\?)/i)>0||r.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const jS=new We;class JS{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new xS,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;const c=a.match(/Version\/(\d+)/);i=n&&c?parseInt(c[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||s&&o<98?this.textureLoader=new lu(this.options.manager):this.textureLoader=new Up(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new An(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 n=this,i=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([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:n,userData:{}};return Sr(s,a,i),ti(a,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){for(const c of a.scenes)c.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){const o=t[i].joints;for(let a=0,c=o.length;a<c;a++)e[o[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const o=e[i];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[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,n){if(e.refs[t]<=1)return n;const i=n.clone(),s=(o,a)=>{const c=this.associations.get(o);c!=null&&this.associations.set(a,c);for(const[l,h]of o.children.entries())s(h,a.children[l])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const s=e(t[i]);s&&n.push(s)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(s,o){return n.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=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[at.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,o){n.load(Li.resolveURL(t.uri,i.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(n){const i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const o=Vu[i.type],a=Is[i.componentType],c=i.normalized===!0,l=new a(i.count*o);return Promise.resolve(new ot(l,o,c))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(o){const a=o[0],c=Vu[i.type],l=Is[i.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,f=i.byteOffset||0,d=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,g=i.normalized===!0;let _,m;if(d&&d!==u){const p=Math.floor(f/d),v="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count;let y=t.cache.get(v);y||(_=new l(a,p*d,i.count*d/h),y=new os(_,d/h),t.cache.add(v,y)),m=new fi(y,c,f%d/h,g)}else a===null?_=new l(i.count*c):_=new l(a,f,i.count*c),m=new ot(_,c,g);if(i.sparse!==void 0){const p=Vu.SCALAR,v=Is[i.sparse.indices.componentType],y=i.sparse.indices.byteOffset||0,x=i.sparse.values.byteOffset||0,A=new v(o[1],y,i.sparse.count*p),E=new l(o[2],x,i.sparse.count*c);a!==null&&(m=new ot(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let I=0,D=A.length;I<D;I++){const b=A[I];if(m.setX(b,E[I*c]),c>=2&&m.setY(b,E[I*c+1]),c>=3&&m.setZ(b,E[I*c+2]),c>=4&&m.setW(b,E[I*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const c=n.manager.getHandler(o.uri);c!==null&&(a=c)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){const i=this,s=this.json,o=s.textures[e],a=s.images[t],c=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(t,n).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 f=(s.samplers||{})[o.sampler]||{};return h.magFilter=Ym[f.magFilter]||pt,h.minFilter=Ym[f.minFilter]||Mn,h.wrapS=Qm[f.wrapS]||yi,h.wrapT=Qm[f.wrapT]||yi,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==Mt&&h.minFilter!==pt,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=i.images[e],a=self.URL||self.webkitURL;let c=o.uri||"",l=!1;if(o.bufferView!==void 0)c=n.getDependency("bufferView",o.bufferView).then(function(u){l=!0;const f=new Blob([u],{type:o.mimeType});return c=a.createObjectURL(f),c});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(c).then(function(u){return new Promise(function(f,d){let g=f;t.isImageBitmapLoader===!0&&(g=function(_){const m=new xt(_);m.needsUpdate=!0,f(m)}),t.load(Li.resolveURL(u,s.path),g,void 0,d)})}).then(function(u){return l===!0&&a.revokeObjectURL(c),ti(u,o),u.userData.mimeType=o.mimeType||KS(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),s.extensions[at.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[at.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const c=s.associations.get(o);o=s.extensions[at.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,c)}}return i!==void 0&&(o.colorSpace=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new Ec,zt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(a,c)),n=c}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new qt,zt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(a,c)),n=c}if(i||s||o){let a="ClonedMaterial:"+n.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=n.clone(),s&&(c.vertexColors=!0),o&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(a,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return gs}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let o;const a={},c=s.extensions||{},l=[];if(c[at.KHR_MATERIALS_UNLIT]){const u=i[at.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),l.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new xe(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Xt),a.opacity=f[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(a,"map",u.baseColorTexture,Tt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=Sn);const h=s.alphaMode||Gu.OPAQUE;if(h===Gu.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===Gu.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==un&&(l.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new he(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==un&&(l.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==un){const u=s.emissiveFactor;a.emissive=new xe().setRGB(u[0],u[1],u[2],Xt)}return s.emissiveTexture!==void 0&&o!==un&&l.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,Tt)),Promise.all(l).then(function(){const u=new o(a);return s.name&&(u.name=s.name),ti(u,s),t.associations.set(u,{materials:e}),s.extensions&&Sr(i,u,s),u})}createUniqueName(e){const t=lt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(a){return n[at.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(c){return Km(c,a,t)})}const o=[];for(let a=0,c=e.length;a<c;a++){const l=e[a],h=QS(l),u=i[h];if(u)o.push(u.promise);else{let f;l.extensions&&l.extensions[at.KHR_DRACO_MESH_COMPRESSION]?f=s(l):f=Km(new Ke,l,t),i[h]={primitive:l,promise:f},o.push(f)}}return Promise.all(o)}loadMesh(e){const t=this,n=this.json,i=this.extensions,s=n.meshes[e],o=s.primitives,a=[];for(let c=0,l=o.length;c<l;c++){const h=o[c].material===void 0?XS(this.cache):this.getDependency("material",o[c].material);a.push(h)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(c){const l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let d=0,g=h.length;d<g;d++){const _=h[d],m=o[d];let p;const v=l[d];if(m.mode===Dn.TRIANGLES||m.mode===Dn.TRIANGLE_STRIP||m.mode===Dn.TRIANGLE_FAN||m.mode===void 0)p=s.isSkinnedMesh===!0?new Lh(_,v):new St(_,v),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),m.mode===Dn.TRIANGLE_STRIP?p.geometry=Wm(p.geometry,eh):m.mode===Dn.TRIANGLE_FAN&&(p.geometry=Wm(p.geometry,Oa));else if(m.mode===Dn.LINES)p=new In(_,v);else if(m.mode===Dn.LINE_STRIP)p=new di(_,v);else if(m.mode===Dn.LINE_LOOP)p=new Fh(_,v);else if(m.mode===Dn.POINTS)p=new kh(_,v);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(p.geometry.morphAttributes).length>0&&YS(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),ti(p,s),m.extensions&&Sr(i,p,m),t.assignFinalMaterial(p),u.push(p)}for(let d=0,g=u.length;d<g;d++)t.associations.set(u[d],{meshes:e,primitives:d});if(u.length===1)return s.extensions&&Sr(i,u[0],s),u[0];const f=new Kn;s.extensions&&Sr(i,f,s),t.associations.set(f,{meshes:e});for(let d=0,g=u.length;d<g;d++)f.add(u[d]);return f})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new kt(ka.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new ur(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ti(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i<s;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const s=i.pop(),o=i,a=[],c=[];for(let l=0,h=o.length;l<h;l++){const u=o[l];if(u){a.push(u);const f=new We;s!==null&&f.fromArray(s.array,l*16),c.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new no(a,c)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],s=i.name?i.name:"animation_"+e,o=[],a=[],c=[],l=[],h=[];for(let u=0,f=i.channels.length;u<f;u++){const d=i.channels[u],g=i.samplers[d.sampler],_=d.target,m=_.node,p=i.parameters!==void 0?i.parameters[g.input]:g.input,v=i.parameters!==void 0?i.parameters[g.output]:g.output;_.node!==void 0&&(o.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",v)),l.push(g),h.push(_))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){const f=u[0],d=u[1],g=u[2],_=u[3],m=u[4],p=[];for(let y=0,x=f.length;y<x;y++){const A=f[y],E=d[y],I=g[y],D=_[y],b=m[y];if(A===void 0)continue;A.updateMatrix&&A.updateMatrix();const C=n._createAnimationTracks(A,E,I,D,b);if(C)for(let B=0;B<C.length;B++)p.push(C[B])}const v=new vs(s,void 0,p);return ti(v,i),v})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(s){const o=n._getNodeRef(n.meshCache,i.mesh,s);return i.weights!==void 0&&o.traverse(function(a){if(!!a.isMesh)for(let c=0,l=i.weights.length;c<l;c++)a.morphTargetInfluences[c]=i.weights[c]}),o})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),o=[],a=i.children||[];for(let l=0,h=a.length;l<h;l++)o.push(n.getDependency("node",a[l]));const c=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(o),c]).then(function(l){const h=l[0],u=l[1],f=l[2];f!==null&&h.traverse(function(d){!d.isSkinnedMesh||d.bind(f,jS)});for(let d=0,g=u.length;d<g;d++)h.add(u[d]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],o=s.name?i.createUniqueName(s.name):"",a=[],c=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&a.push(c),s.camera!==void 0&&a.push(i.getDependency("camera",s.camera).then(function(l){return i._getNodeRef(i.cameraCache,s.camera,l)})),i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),this.nodeCache[e]=Promise.all(a).then(function(l){let h;if(s.isBone===!0?h=new mc:l.length>1?h=new Kn:l.length===1?h=l[0]:h=new ct,h!==l[0])for(let u=0,f=l.length;u<f;u++)h.add(l[u]);if(s.name&&(h.userData.name=s.name,h.name=o),ti(h,s),s.extensions&&Sr(n,h,s),s.matrix!==void 0){const u=new We;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);if(!i.associations.has(h))i.associations.set(h,{});else if(s.mesh!==void 0&&i.meshCache.refs[s.mesh]>1){const u=i.associations.get(h);i.associations.set(h,{...u})}return i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,s=new Kn;n.name&&(s.name=i.createUniqueName(n.name)),ti(s,n),n.extensions&&Sr(t,s,n);const o=n.nodes||[],a=[];for(let c=0,l=o.length;c<l;c++)a.push(i.getDependency("node",o[c]));return Promise.all(a).then(function(c){for(let h=0,u=c.length;h<u;h++)s.add(c[h]);const l=h=>{const u=new Map;for(const[f,d]of i.associations)(f instanceof zt||f instanceof xt)&&u.set(f,d);return h.traverse(f=>{const d=i.associations.get(f);d!=null&&u.set(f,d)}),u};return i.associations=l(s),s})}_createAnimationTracks(e,t,n,i,s){const o=[],a=e.name?e.name:e.uuid,c=[];Bi[s.path]===Bi.weights?e.traverse(function(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}):c.push(a);let l;switch(Bi[s.path]){case Bi.weights:l=ar;break;case Bi.rotation:l=cr;break;case Bi.translation:case Bi.scale:l=hr;break;default:switch(n.itemSize){case 1:l=ar;break;case 2:case 3:default:l=hr;break}break}const h=i.interpolation!==void 0?qS[i.interpolation]:zr,u=this._getArrayFromAccessor(n);for(let f=0,d=c.length;f<d;f++){const g=new l(c[f]+"."+Bi[s.path],t.array,u,h);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),o.push(g)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=qu(t.constructor),i=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)i[s]=t[s]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof cr?WS:Zm;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function $S(r,e,t){const n=e.attributes,i=new Gt;if(n.POSITION!==void 0){const a=t.json.accessors[n.POSITION],c=a.min,l=a.max;if(c!==void 0&&l!==void 0){if(i.set(new U(c[0],c[1],c[2]),new U(l[0],l[1],l[2])),a.normalized){const h=qu(Is[a.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new U,c=new U;for(let l=0,h=s.length;l<h;l++){const u=s[l];if(u.POSITION!==void 0){const f=t.json.accessors[u.POSITION],d=f.min,g=f.max;if(d!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(d[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(d[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(d[2]),Math.abs(g[2]))),f.normalized){const _=qu(Is[f.componentType]);c.multiplyScalar(_)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(a)}r.boundingBox=i;const o=new Pt;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,r.boundingSphere=o}function Km(r,e,t){const n=e.attributes,i=[];function s(o,a){return t.getDependency("accessor",o).then(function(c){r.setAttribute(a,c)})}for(const o in n){const a=Hu[o]||o.toLowerCase();a in r.attributes||i.push(s(n[o],a))}if(e.indices!==void 0&&!r.index){const o=t.getDependency("accessor",e.indices).then(function(a){r.setIndex(a)});i.push(o)}return rt.workingColorSpace!==Xt&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${rt.workingColorSpace}" not supported.`),ti(r,e),$S(r,e,t),Promise.all(i).then(function(){return e.targets!==void 0?ZS(r,e.targets,t):r})}const Xu=new WeakMap;class eM extends Jt{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,n,i){const s=new An(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,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,Tt,n).catch(n)}decodeDracoFile(e,t,n,i,s=Xt,o=()=>{}){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:s};return this.decodeGeometry(e,a).then(t).catch(o)}decodeGeometry(e,t){const n=JSON.stringify(t);if(Xu.has(e)){const c=Xu.get(e);if(c.key===n)return c.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 i;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(c=>(i=c,new Promise((l,h)=>{i._callbacks[s]={resolve:l,reject:h},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),Xu.set(e,{key:n,promise:a}),a}_createGeometry(e){const t=new Ke;e.index&&t.setIndex(new ot(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const{name:i,array:s,itemSize:o,stride:a,vertexColorSpace:c}=e.attributes[n];let l;if(o===a)l=new ot(s,o);else{const h=new os(s,a);l=new fi(h,o,0)}i==="color"&&(this._assignVertexColorSpace(l,c),l.normalized=!(s instanceof Float32Array)),t.setAttribute(i,l)}return t}_assignVertexColorSpace(e,t){if(t!==Tt)return;const n=new xe;for(let i=0,s=e.count;i<s;i++)n.fromBufferAttribute(e,i),rt.colorSpaceToWorking(n,Tt),e.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new An(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,s)=>{n.load(e,i,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(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const s=tM.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
4036
- `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){const o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_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 tM(){let r,e;onmessage=function(o){const a=o.data;switch(a.type){case"init":r=a.decoderConfig,e=new Promise(function(h){r.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(r)});break;case"decode":const c=a.buffer,l=a.taskConfig;e.then(h=>{const u=h.draco,f=new u.Decoder;try{const d=t(u,f,new Int8Array(c),l),g=d.attributes.map(_=>_.array.buffer);d.index&&g.push(d.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:d},g)}catch(d){console.error(d),self.postMessage({type:"error",id:a.id,error:d.message})}finally{u.destroy(f)}});break}};function t(o,a,c,l){const h=l.attributeIDs,u=l.attributeTypes;let f,d;const g=a.GetEncodedGeometryType(c);if(g===o.TRIANGULAR_MESH)f=new o.Mesh,d=a.DecodeArrayToMesh(c,c.byteLength,f);else if(g===o.POINT_CLOUD)f=new o.PointCloud,d=a.DecodeArrayToPointCloud(c,c.byteLength,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());const _={index:null,attributes:[]};for(const m in h){const p=self[u[m]];let v,y;if(l.useUniqueIDs)y=h[m],v=a.GetAttributeByUniqueId(f,y);else{if(y=a.GetAttributeId(f,o[h[m]]),y===-1)continue;v=a.GetAttribute(f,y)}const x=i(o,a,f,m,p,v);m==="color"&&(x.vertexColorSpace=l.vertexColorSpace),_.attributes.push(x)}return g===o.TRIANGULAR_MESH&&(_.index=n(o,a,f)),o.destroy(f),_}function n(o,a,c){const h=c.num_faces()*3,u=h*4,f=o._malloc(u);a.GetTrianglesUInt32Array(c,u,f);const d=new Uint32Array(o.HEAPF32.buffer,f,h).slice();return o._free(f),{array:d,itemSize:1}}function i(o,a,c,l,h,u){const f=c.num_points(),d=u.num_components(),g=s(o,h),_=d*h.BYTES_PER_ELEMENT,m=Math.ceil(_/4)*4,p=m/h.BYTES_PER_ELEMENT,v=f*_,y=f*m,x=o._malloc(v);a.GetAttributeDataArrayForAllPoints(c,u,g,v,x);const A=new h(o.HEAPF32.buffer,x,v/h.BYTES_PER_ELEMENT);let E;if(_===m)E=A.slice();else{E=new h(y/h.BYTES_PER_ELEMENT);let I=0;for(let D=0,b=A.length;D<b;D++){for(let C=0;C<d;C++)E[I+C]=A[D*d+C];I+=p}}return o._free(x),{name:l,count:f,itemSize:d,array:E,stride:p}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}class nM{constructor(){J(this,"loader");this.loader=new yS;const e=new eM;e.setDecoderPath("/draco/"),this.loader.setDRACOLoader(e)}async load(e){return this.loadFromUrlOrZip(e)}async loadFromUrlOrZip(e){return e.toLowerCase().endsWith(".zip")?this.loadFromZipUrl(e):new Promise((t,n)=>{this.loader.load(e,i=>{const s=i.scene||i.scenes[0];if(!s)return n(new Error("Model contains no scene and cannot be viewed."));t(s)},void 0,n)})}async loadFromZipUrl(e){throw new Error("Not implemented")}}function yl(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jm={exports:{}};/*!
4035
+ */Object.defineProperty(r,"__esModule",{value:!0}),r.SignalList=r.SignalHandlingBase=r.SignalDispatcher=void 0;const e=bo;Object.defineProperty(r,"SignalDispatcher",{enumerable:!0,get:function(){return e.SignalDispatcher}});const t=gl;Object.defineProperty(r,"SignalHandlingBase",{enumerable:!0,get:function(){return t.SignalHandlingBase}});const n=To;Object.defineProperty(r,"SignalList",{enumerable:!0,get:function(){return n.SignalList}})}(Ms);class Yw{constructor(e){$(this,"camera");this.camera=e}applySettings(e){this.camera.fov=e.camera.fov,this.camera.zoom=e.camera.zoom,this.camera.near=e.camera.near,this.camera.far=e.camera.far,this.camera.updateProjectionMatrix()}updateProjection(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}frustrumSizeAt(e){const n=this.camera.position.distanceTo(e)*Math.tan(this.camera.fov/2*(Math.PI/180));return new he(n,n)}}class Qw{constructor(e){$(this,"camera");this.camera=e}applySettings(e){this.camera.zoom=e.camera.zoom,this.camera.near=-e.camera.far,this.camera.far=e.camera.far,this.camera.updateProjectionMatrix()}updateProjection(e,t){const n=Math.max(e.x,e.y);this.camera.left=-n*t,this.camera.right=n*t,this.camera.top=n,this.camera.bottom=-n,this.camera.updateProjectionMatrix()}}class Bm{constructor(e){$(this,"_camera");this._camera=e}move2(e,t){const n=t==="XY"?new U(-e.x,e.y,0):t==="XZ"?new U(-e.x,0,e.y):void 0;n&&this.move3(n)}move1(e,t){const n=new U(t==="X"?-e:0,t==="Y"?e:0,t==="Z"?e:0);this.move3(n)}orbitTowards(e){const t=this._camera.forward,n=t.clone().setY(0),i=e.clone().setY(0),s=n.angleTo(i)*Math.sign(n.cross(i).y),o=Math.asin(e.y)-Math.asin(t.y),a=new he(o,s);a.multiplyScalar(180/Math.PI),this.orbit(a)}frame(e,t){e instanceof Gt&&(e=e.getBoundingSphere(new Pt)),e instanceof Pt&&this.frameSphere(e,t??this._camera.forward)}frameSphere(e,t){const n=this._camera.camPerspective.camera.fov*Math.PI/180,i=e.radius*1.2/Math.tan(n/2),s=t.clone().multiplyScalar(-i).add(e.center);this.set(s,e.center)}}class Kw extends Bm{constructor(t,n){super(t);$(this,"_movement");$(this,"_clock",new el);$(this,"onProgress");$(this,"_duration",1);this._movement=n}init(t){this.cancel(),this._duration=t,this._clock.start(),this.animate()}cancel(){this._clock.stop(),this.onProgress=void 0}animate(){this._clock.running&&(this.update(),requestAnimationFrame(()=>this.animate()))}easeOutCubic(t){return 1-Math.pow(1-t,3)}update(){let t=this._clock.getElapsedTime()/this._duration;t=this.easeOutCubic(t),t>=1&&(t=1,this._clock.stop(),this.onProgress=void 0),this.onProgress?.(t)}move3(t){const n=t.clone();n.applyQuaternion(this._camera.quaternion);const i=this._camera.position.clone(),s=this._camera.position.clone().add(n),o=new U;this.onProgress=a=>{o.copy(i),o.lerp(s,a),this._movement.move3(o)}}rotate(t){const n=new Zt(0,0,0,"YXZ");n.setFromQuaternion(this._camera.quaternion),n.x+=t.x,n.y+=t.y,n.z=0;const i=Math.PI*.48;n.x=Math.max(-i,Math.min(i,n.x));const s=this._camera.quaternion.clone(),o=new wt().setFromEuler(n),a=new wt;this.onProgress=c=>{a.copy(s),a.slerp(o,c),this._movement.applyRotation(a)}}zoom(t){const n=this._camera.orbitDistance*t;this.setDistance(n)}setDistance(t){const n=this._camera.position.clone(),i=this._camera.target.clone().lerp(n,t/this._camera.orbitDistance);this.onProgress=s=>{this._camera.position.copy(n),this._camera.position.lerp(i,s)}}orbit(t){const n=this._camera.position.clone(),i=this._camera.target.clone(),s=new he;this.onProgress=o=>{s.set(0,0),s.lerp(t,o),this._movement.set(n,i),this._movement.orbit(s)}}target(t){const i=t.clone().sub(this._camera.position),s=this._camera.quaternion.clone(),o=new wt().setFromUnitVectors(new U(0,0,-1),i.normalize());this.onProgress=a=>{const c=s.clone().slerp(o,a);this._movement.applyRotation(c)}}reset(){this.set(this._camera._savedPosition,this._camera._savedTarget)}set(t,n){const i=n??this._camera.target,s=this._camera.position.clone(),o=this._camera.target.clone();this.onProgress=a=>{this._movement.set(s.clone().lerp(t,a),o.clone().lerp(i,a))}}}class jw extends Bm{zoom(e){const t=this._camera.orbitDistance*e;this.setDistance(t)}reset(){this.set(this._camera._savedPosition,this._camera._savedTarget)}setDistance(e){const t=this._camera.target.clone().sub(this._camera.forward.multiplyScalar(e));this.set(t,this._camera.target)}rotate(e){const t=e.clone().multiply(this._camera.allowedRotation),n=this.predictRotate(t);this.applyRotation(n)}applyRotation(e){this._camera.quaternion.copy(e);const t=this._camera.forward.multiplyScalar(this._camera.orbitDistance).add(this._camera.position);this.set(this._camera.position,t)}target(e){this.set(this._camera.position,e)}orbit(e){const t=e.clone().multiply(this._camera.allowedRotation),n=this.predictOrbit(t);this.set(n)}move3(e){const t=e.clone();t.applyQuaternion(this._camera.quaternion);const n=this.lockVector(t,new U),i=this._camera.position.clone().add(n),s=this._camera.target.clone().add(n);this.set(i,s)}set(e,t){const n=this.lockVector(e,this._camera.position);this._camera.position.copy(n),t=t??this._camera.target,this._camera.target.copy(t),this._camera.camPerspective.camera.lookAt(t),this._camera.camPerspective.camera.up.set(0,1,0)}lockVector(e,t){const n=this._camera.allowedMovement.x===0?t.x:e.x,i=this._camera.allowedMovement.y===0?t.y:e.y,s=this._camera.allowedMovement.z===0?t.z:e.z;return new U(n,i,s)}predictOrbit(e){const t=this.predictRotate(e),n=new U(0,0,1).applyQuaternion(t).multiplyScalar(this._camera.orbitDistance);return this._camera.target.clone().add(n)}predictRotate(e){const t=new Zt(0,0,0,"YXZ");t.setFromQuaternion(this._camera.quaternion),t.x+=e.x*Math.PI/180,t.y+=e.y*Math.PI/180,t.z=0;const n=Math.PI*.4999;return t.x=Math.max(-n,Math.min(n,t.x)),new wt().setFromEuler(t)}}class Jw{constructor(e,t){$(this,"camPerspective");$(this,"camOrthographic");$(this,"_viewport");$(this,"_lerp");$(this,"_movement");$(this,"_inputVelocity",new U);$(this,"_velocity",new U);$(this,"_speed",0);$(this,"_orthographic",!1);$(this,"_target",new U);$(this,"_lastPosition",new U);$(this,"_lastQuaternion",new wt);$(this,"_lastTarget",new U);$(this,"_savedPosition",new U(0,0,-5));$(this,"_savedTarget",new U(0,0,0));$(this,"_onValueChanged",new Ms.SignalDispatcher);$(this,"_hasMoved");$(this,"_onMoved",new Ms.SignalDispatcher);$(this,"_force",!1);$(this,"_allowedMovement",new U(1,1,1));$(this,"_allowedRotation",new he(1,1));$(this,"_defaultForward",new U(0,0,1));$(this,"_velocityBlendFactor",1e-4);$(this,"_moveSpeed",1);this.camPerspective=new Yw(new kt),this.camOrthographic=new Qw(new ur),this._movement=new jw(this),this._lerp=new Kw(this,this._movement),this._viewport=e,this.applySettings(t),this.do().orbitTowards(this._defaultForward),this.do().setDistance(-1e3)}get onValueChanged(){return this._onValueChanged.asEvent()}get hasMoved(){return this._hasMoved}get onMoved(){return this._onMoved.asEvent()}get allowedMovement(){return this._force?new U(1,1,1):this._allowedMovement}set allowedMovement(e){this._allowedMovement.copy(e),this._allowedMovement.x=this._allowedMovement.x===0?0:1,this._allowedMovement.y=this._allowedMovement.y===0?0:1,this._allowedMovement.z=this._allowedMovement.z===0?0:1}get allowedRotation(){return this._force?new he(1,1):this._allowedRotation}set allowedRotation(e){this._allowedRotation.copy(e),this._allowedRotation.x=this._allowedRotation.x===0?0:1,this._allowedRotation.y=this._allowedRotation.y===0?0:1}get defaultForward(){return this._defaultForward}set defaultForward(e){e.x===0&&e.y===0&&e.z===0?this._defaultForward.set(0,0,1):this._defaultForward.copy(e)}do(e=!1){return this._force=e,this._lerp.cancel(),this._movement}lerp(e=1,t=!1){return this.stop(),this._force=t,this._lerp.init(e),this._lerp}frustrumSizeAt(e){return this.camPerspective.frustrumSizeAt(e)}notifyMovement(){this._hasMoved=!0,this._onMoved.dispatch()}get three(){return this._orthographic?this.camOrthographic.camera:this.camPerspective.camera}get quaternion(){return this.camPerspective.camera.quaternion}get position(){return this.camPerspective.camera.position}get matrix(){return this.camPerspective.camera.updateMatrix(),this.camPerspective.camera.matrix}get forward(){return this.camPerspective.camera.getWorldDirection(new U)}get speed(){return this._speed}set speed(e){this._speed=Mw(e,-25,25),this._onValueChanged.dispatch()}get localVelocity(){const e=this._velocity.clone();return e.applyQuaternion(this.quaternion.clone().invert()),e.setZ(-e.z),e}set localVelocity(e){this._lerp.cancel(),this._inputVelocity.copy(e),this._inputVelocity.setZ(-this._inputVelocity.z)}stop(){this._inputVelocity.set(0,0,0),this._velocity.set(0,0,0)}get target(){return this._target}applySettings(e){this._defaultForward=new U().copy(e.camera.forward),this._orthographic=e.camera.orthographic,this.allowedMovement=e.camera.allowedMovement,this.allowedRotation=e.camera.allowedRotation,this.camPerspective.applySettings(e),this.camOrthographic.applySettings(e),this._moveSpeed=e.camera.controls.moveSpeed,this._onValueChanged.dispatch()}get orbitDistance(){return this.position.distanceTo(this._target)}save(){this._lerp.cancel(),this._savedPosition.copy(this.position),this._savedTarget.copy(this._target)}updateProjection(){const e=this._viewport.getAspectRatio();this.camPerspective.updateProjection(e);const t=this.camPerspective.frustrumSizeAt(this.target);this.camOrthographic.updateProjection(t,e)}get orthographic(){return this._orthographic}set orthographic(e){e!==this._orthographic&&(this._orthographic=e,this._onValueChanged.dispatch())}update(e){this.applyVelocity(e)&&this.updateOrthographic();const t=this.checkForMovement();return t&&(this.camOrthographic.camera.position.copy(this.position),this.camOrthographic.camera.quaternion.copy(this.quaternion)),this.updateProjection(),t}applyVelocity(e){if(this._inputVelocity.x===0&&this._inputVelocity.y===0&&this._inputVelocity.z===0&&this._velocity.x===0&&this._velocity.y===0&&this._velocity.z===0)return!1;const t=Math.pow(this._velocityBlendFactor,e),n=1-t;this._velocity.multiplyScalar(t);const i=this._inputVelocity.clone().multiplyScalar(n);if(this._velocity.add(i),this._velocity.lengthSq()<e/10)return this._velocity.set(0,0,0),!1;const s=this._velocity.clone().multiplyScalar(e*this.getVelocityMultiplier());return this.do().move3(s),!0}updateOrthographic(){if(this.orthographic){const t=this._lastTarget.clone().sub(this.position).dot(this.forward);this.target.copy(this.forward).multiplyScalar(t).add(this.position);const n=this._lastPosition.clone().sub(this._target),i=this.position.clone().sub(this._target);(n.dot(i)<0||i.lengthSq()<1)&&this.position.copy(this._target).add(this.forward.multiplyScalar(-1))}}getVelocityMultiplier(){const t=!this._lastQuaternion.equals(this.quaternion)?1:1.66;return Math.pow(1.25,this.speed)*this._moveSpeed*t*100}checkForMovement(){return this._hasMoved=!1,(!this._lastPosition.equals(this.position)||!this._lastQuaternion.equals(this.quaternion)||!this._lastTarget.equals(this._target))&&(this._hasMoved=!0,this._onMoved.dispatch()),this._lastPosition.copy(this.position),this._lastQuaternion.copy(this.quaternion),this._lastTarget.copy(this._target),this._hasMoved}}class zu{constructor(e){$(this,"_viewer");$(this,"_unregisters",[]);$(this,"reg",(e,t,n)=>{e.addEventListener(t,n),this._unregisters.push(()=>e.removeEventListener(t,n))});this._viewer=e}register(){this._unregisters.length>0||this.addListeners()}addListeners(){}unregister(){this._unregisters.forEach(e=>e()),this._unregisters.length=0,this.reset()}reset(){}}const At={KEY_0:48,KEY_1:49,KEY_2:50,KEY_3:51,KEY_4:52,KEY_5:53,KEY_6:54,KEY_7:55,KEY_8:56,KEY_9:57,KEY_LEFT:37,KEY_RIGHT:39,KEY_UP:38,KEY_DOWN:40,KEY_CTRL:17,KEY_SHIFT:16,KEY_ENTER:13,KEY_SPACE:32,KEY_TAB:9,KEY_ESCAPE:27,KEY_BACKSPACE:8,KEY_HOME:36,KEY_END:35,KEY_INSERT:45,KEY_DELETE:46,KEY_ALT:18,KEY_F1:112,KEY_F2:113,KEY_F3:114,KEY_F4:115,KEY_F5:116,KEY_F6:117,KEY_F7:118,KEY_F8:119,KEY_F9:120,KEY_F10:121,KEY_F11:122,KEY_F12:123,KEY_NUMPAD0:96,KEY_NUMPAD1:97,KEY_NUMPAD2:98,KEY_NUMPAD3:99,KEY_NUMPAD4:100,KEY_NUMPAD5:101,KEY_NUMPAD6:102,KEY_NUMPAD7:103,KEY_NUMPAD8:104,KEY_NUMPAD9:105,KEY_ADD:107,KEY_SUBTRACT:109,KEY_MULTIPLY:106,KEY_DIVIDE:111,KEY_SEPARATOR:108,KEY_DECIMAL:110,KEY_OEM_PLUS:187,KEY_OEM_MINUS:189,KEY_A:65,KEY_B:66,KEY_C:67,KEY_D:68,KEY_E:69,KEY_F:70,KEY_G:71,KEY_H:72,KEY_I:73,KEY_J:74,KEY_K:75,KEY_L:76,KEY_M:77,KEY_N:78,KEY_O:79,KEY_P:80,KEY_Q:81,KEY_R:82,KEY_S:83,KEY_T:84,KEY_U:85,KEY_V:86,KEY_W:87,KEY_X:88,KEY_Y:89,KEY_Z:90},$w=new Set(Object.values(At));class eS extends zu{constructor(){super(...arguments);$(this,"SHIFT_MULTIPLIER",3);$(this,"isUpPressed",!1);$(this,"isDownPressed",!1);$(this,"isLeftPressed",!1);$(this,"isRightPressed",!1);$(this,"isEPressed",!1);$(this,"isQPressed",!1);$(this,"isShiftPressed",!1);$(this,"isCtrlPressed",!1);$(this,"arrowsEnabled",!0)}addListeners(){this.reg(document,"keydown",t=>this.onKeyDown(t)),this.reg(document,"keyup",t=>this.onKeyUp(t)),this.reg(this._viewer.viewport.canvas,"focusout",()=>this.reset()),this.reg(window,"resize",()=>this.reset())}reset(){this.isUpPressed=!1,this.isDownPressed=!1,this.isLeftPressed=!1,this.isRightPressed=!1,this.isEPressed=!1,this.isQPressed=!1,this.isShiftPressed=!1,this.isCtrlPressed=!1,this.applyMove()}get camera(){return this._viewer.camera}onKeyUp(t){this.onKey(t,!1)}onKeyDown(t){this.onKey(t,!0)}onKey(t,n){switch(!n&&$w.has(t.keyCode)&&this._viewer.inputs.KeyAction(t.keyCode)&&t.preventDefault(),t.keyCode){case At.KEY_W:case At.KEY_UP:this.isUpPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_S:case At.KEY_DOWN:this.isDownPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_D:case At.KEY_RIGHT:this.isRightPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_A:case At.KEY_LEFT:this.isLeftPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_E:this.isEPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_Q:this.isQPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_SHIFT:this.isShiftPressed=n,this.applyMove(),t.preventDefault();break;case At.KEY_CTRL:this.isCtrlPressed=n,t.preventDefault();break}}applyMove(){const t=new U((this.isRightPressed?1:0)-(this.isLeftPressed?1:0),(this.isEPressed?1:0)-(this.isQPressed?1:0),(this.isUpPressed?1:0)-(this.isDownPressed?1:0)),n=this.isShiftPressed?this.SHIFT_MULTIPLIER:1;t.multiplyScalar(n),this.arrowsEnabled&&(this.camera.localVelocity=t)}}class tS extends zu{constructor(t){super(t);$(this,"TAP_DURATION_MS",500);$(this,"DOUBLE_TAP_DELAY_MS",500);$(this,"TAP_MAX_MOVE_PIXEL",5);$(this,"ZOOM_SPEED",1);$(this,"MOVE_SPEED",100);$(this,"rotateSpeed",1);$(this,"orbitSpeed",1);$(this,"_touch");$(this,"_touch1");$(this,"_touch2");$(this,"_touchStartTime");$(this,"_lastTapMs");$(this,"_touchStart");$(this,"reset",()=>{this._touch=this._touch1=this._touch2=this._touchStartTime=void 0});$(this,"onTap",t=>{const n=new Date().getTime();this._lastTapMs&&n-this._lastTapMs<this.DOUBLE_TAP_DELAY_MS,this._lastTapMs=new Date().getTime()});$(this,"onTouchStart",t=>{t.preventDefault(),!(!t||!t.touches||!t.touches.length)&&(this._touchStartTime=new Date().getTime(),t.touches.length===1?(this._touch=this.touchToVector(t.touches[0]),this._touch1=this._touch2=void 0):t.touches.length===2&&(this._touch1=this.touchToVector(t.touches[0]),this._touch2=this.touchToVector(t.touches[1]),this._touch=this.average(this._touch1,this._touch2)),this._touchStart=this._touch)});$(this,"onDrag",t=>{this._viewer.inputs.pointerActive==="orbit"?this.camera.do().orbit(this.toRotation(t,this.orbitSpeed)):this.camera.do().rotate(this.toRotation(t,this.rotateSpeed))});$(this,"onDoubleDrag",t=>{const n=t.clone().multiplyScalar(this.MOVE_SPEED);this.camera.do().move2(n,"XY")});$(this,"onPinchOrSpread",t=>{this._viewer.inputs.pointerActive==="orbit"?this.camera.do().zoom(1+t*this.ZOOM_SPEED):this.camera.do().move1(t*this.ZOOM_SPEED,"Z")});$(this,"onTouchMove",t=>{if(t.preventDefault(),!(!t||!t.touches||!t.touches.length)&&!!this._touch){if(t.touches.length===1){const n=this.touchToVector(t.touches[0]),i=this.viewport.getSize(),s=n.clone().sub(this._touch).multiply(new he(1/i.x,1/i.y));this._touch=n,this.onDrag(s);return}if(!(!this._touch1||!this._touch2)&&t.touches.length>=2){const n=this.touchToVector(t.touches[0]),i=this.touchToVector(t.touches[1]),s=this.average(n,i),o=this.viewport.getSize(),a=this._touch.clone().sub(s).multiply(new he(-1/o.x,-1/o.y)),c=n.distanceTo(i),l=this._touch1.distanceTo(this._touch2),h=Math.min(o.x,o.y),u=(c-l)/-h;this._touch=s,this._touch1=n,this._touch2=i,a.length()>Math.abs(u)?this.onDoubleDrag(a):this.onPinchOrSpread(u)}}});$(this,"onTouchEnd",t=>{if(this.isSingleTouch()&&this._touchStart&&this._touch){const n=new Date().getTime()-this._touchStartTime,i=this._touch.distanceTo(this._touchStart);n<this.TAP_DURATION_MS&&i<this.TAP_MAX_MOVE_PIXEL&&this.onTap(this._touch)}this.reset()});this.rotateSpeed=t.settings.camera.controls.rotateSpeed,this.orbitSpeed=t.settings.camera.controls.orbitSpeed}get camera(){return this._viewer.camera}get viewport(){return this._viewer.viewport}addListeners(){const t=this.viewport.canvas;this.reg(t,"touchstart",this.onTouchStart),this.reg(t,"touchend",this.onTouchEnd),this.reg(t,"touchmove",this.onTouchMove)}toRotation(t,n){const i=new he;return i.x=t.y,i.y=t.x,i.multiplyScalar(-180*n),i}isSingleTouch(){return this._touch!==void 0&&this._touchStartTime!==void 0&&this._touch1===void 0&&this._touch2===void 0}touchToVector(t){return new he(t.pageX,t.pageY)}average(t,n){return t.clone().lerp(n,.5)}}class nS extends zu{constructor(t){super(t);$(this,"_idleDelayMs",150);$(this,"zoomSpeed",1);$(this,"panSpeed",100);$(this,"rotateSpeed",1);$(this,"orbitSpeed",1);$(this,"_buttonDown");$(this,"_hasMouseMoved",!1);$(this,"_hasCameraMoved",!1);$(this,"_idleTimeout");$(this,"_idlePosition");$(this,"_lastPosition");$(this,"_downPosition");$(this,"reset",()=>{this._buttonDown=void 0,this._hasMouseMoved=!1,this._lastPosition=this._downPosition=void 0,clearTimeout(this._idleTimeout)});$(this,"onMouseOut",t=>{t.stopImmediatePropagation(),this._buttonDown=void 0,this._hasMouseMoved=!1,this._lastPosition=void 0,this.resetIdle()});$(this,"onCameraMoved",()=>{this.resetIdle(),this._hasCameraMoved=!0});$(this,"onMouseMove",t=>{t.stopImmediatePropagation(),this._lastPosition=new he(t.offsetX,t.offsetY),(!this._idlePosition||this._lastPosition.distanceTo(this._idlePosition)>5)&&this.resetIdle(),this._buttonDown&&this.onMouseDrag(t)});$(this,"onMouseDown",t=>{if(t.stopImmediatePropagation(),t.preventDefault(),this._buttonDown)return;this.inputs.ContextMenu(void 0),this._hasCameraMoved=!1,this._downPosition=new he(t.offsetX,t.offsetY),this._hasMouseMoved=!1,this.viewport.canvas.focus(),this._buttonDown=this.getButton(t);const n=this._buttonDown==="middle"?"pan":this._buttonDown==="right"?"look":void 0;this.inputs.pointerOverride=n});$(this,"onMouseWheel",t=>{t.preventDefault(),t.stopImmediatePropagation();const n=Math.sign(t.deltaY);if(t.ctrlKey)this.camera.speed-=n;else{const i=Math.pow(1.3,n);this.camera.lerp(.3).zoom(i)}});$(this,"onMouseUp",t=>{t.stopImmediatePropagation(),this.resetIdle(),this.getButton(t)!==this._buttonDown&&(t.preventDefault(),this._buttonDown&&(t.button===2&&!this._hasMouseMoved&&this.inputs.ContextMenu(new he(t.clientX,t.clientY)),this._buttonDown=void 0,this.inputs.pointerOverride=void 0))});this.rotateSpeed=t.settings.camera.controls.rotateSpeed,this.orbitSpeed=t.settings.camera.controls.orbitSpeed}get camera(){return this._viewer.camera}get viewport(){return this._viewer.viewport}get canvas(){return this.viewport.canvas}get inputs(){return this._viewer.inputs}addListeners(){this.reg(this.canvas,"mousedown",this.onMouseDown),this.reg(this.canvas,"wheel",this.onMouseWheel),this.reg(this.canvas,"mousemove",this.onMouseMove),this.reg(this.canvas,"mouseup",this.onMouseUp),this.reg(this.canvas,"mouseout",this.onMouseOut),this.reg(this.canvas,"contextmenu",t=>t.preventDefault()),this._unregisters.push(this.camera.onMoved.subscribe(()=>this.onCameraMoved()))}resetIdle(){this._idlePosition&&(this._idlePosition=void 0),clearTimeout(this._idleTimeout)}onMouseDrag(t){t.stopImmediatePropagation(),t.preventDefault();const n=t.movementX||t.mozMovementX||t.webkitMovementX||0,i=t.movementY||t.mozMovementY||t.webkitMovementY||0,s=this.viewport.getSize(),o=new he(n/s.x,i/s.y),a=new he(t.offsetX,t.offsetY);switch(this._hasMouseMoved=this._hasMouseMoved||this._downPosition&&this._downPosition?.distanceTo(a)>4,this._buttonDown){case"main":this.onMouseMainDrag(o);break;case"middle":this.onMouseMiddleDrag(o);break;case"right":this.onMouseRightDrag(o);break}}toRotation(t,n){const i=t.clone();return i.x=-t.y,i.y=-t.x,i.multiplyScalar(180*n),i}onMouseMainDrag(t){switch(this.inputs.pointerActive){case"orbit":this.camera.do().orbit(this.toRotation(t,this.orbitSpeed));break;case"look":this.camera.do().rotate(this.toRotation(t,this.rotateSpeed));break;case"pan":this.camera.do().move2(t.multiplyScalar(this.panSpeed),"XY");break;case"zoom":this.camera.do().zoom(1+t.y*this.zoomSpeed);break}}onMouseMiddleDrag(t){this.camera.do().move2(t.multiplyScalar(100),"XY")}onMouseRightDrag(t){this.camera.do().rotate(this.toRotation(t,this.rotateSpeed))}getButton(t){return t.buttons&1?"main":t.buttons&2?"right":t.buttons&4?"middle":void 0}getModifier(t){return t.ctrlKey?"ctrl":t.shiftKey?"shift":"none"}}var Om={},Ts={};Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.SimpleEventDispatcher=void 0;const Fm=br;class iS extends Fm.DispatcherBase{constructor(){super()}dispatch(e){const t=this._dispatch(!1,this,arguments);if(t==null)throw new Fm.DispatchError("Got `null` back from dispatch.");return t}dispatchAsync(e){this._dispatch(!0,this,arguments)}asEvent(){return super.asEvent()}}Ts.SimpleEventDispatcher=iS;var _l={},Co={};Object.defineProperty(Co,"__esModule",{value:!0}),Co.SimpleEventList=void 0;const rS=br,sS=Ts;class oS extends rS.EventListBase{constructor(){super()}createDispatcher(){return new sS.SimpleEventDispatcher}}Co.SimpleEventList=oS,Object.defineProperty(_l,"__esModule",{value:!0}),_l.SimpleEventHandlingBase=void 0;const aS=br,cS=Co;class lS extends aS.HandlingBase{constructor(){super(new cS.SimpleEventList)}}_l.SimpleEventHandlingBase=lS;var vl={};Object.defineProperty(vl,"__esModule",{value:!0}),vl.NonUniformSimpleEventList=void 0;const hS=Ts;class uS{constructor(){this._events={}}get(e){if(this._events[e])return this._events[e];const t=this.createDispatcher();return this._events[e]=t,t}remove(e){delete this._events[e]}createDispatcher(){return new hS.SimpleEventDispatcher}}vl.NonUniformSimpleEventList=uS,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.NonUniformSimpleEventList=r.SimpleEventList=r.SimpleEventHandlingBase=r.SimpleEventDispatcher=void 0;const e=Ts;Object.defineProperty(r,"SimpleEventDispatcher",{enumerable:!0,get:function(){return e.SimpleEventDispatcher}});const t=_l;Object.defineProperty(r,"SimpleEventHandlingBase",{enumerable:!0,get:function(){return t.SimpleEventHandlingBase}});const n=vl;Object.defineProperty(r,"NonUniformSimpleEventList",{enumerable:!0,get:function(){return n.NonUniformSimpleEventList}});const i=Co;Object.defineProperty(r,"SimpleEventList",{enumerable:!0,get:function(){return i.SimpleEventList}})}(Om);class zm{constructor(e){$(this,"_viewer");this._viewer=e}onKeyAction(e){const t=this._viewer.camera;switch(e){case At.KEY_P:return t.orthographic=!t.orthographic,!0;case At.KEY_ADD:case At.KEY_OEM_PLUS:return t.speed+=1,!0;case At.KEY_SUBTRACT:case At.KEY_OEM_MINUS:return t.speed-=1,!0;case At.KEY_F8:case At.KEY_SPACE:return this._viewer.inputs.pointerActive=this._viewer.inputs.pointerFallback,!0;case At.KEY_HOME:return t.lerp(1).reset(),!0;case At.KEY_ESCAPE:return!0;case At.KEY_Z:case At.KEY_F:return t.lerp(1).frame("all"),!0;default:return!1}}}class fS{constructor(e){$(this,"_viewer");$(this,"_scheme");$(this,"touch");$(this,"mouse");$(this,"keyboard");$(this,"_pointerActive","orbit");$(this,"_pointerFallback","look");$(this,"_pointerOverride");$(this,"_onPointerModeChanged",new Ms.SignalDispatcher);$(this,"_onPointerOverrideChanged",new Ms.SignalDispatcher);$(this,"_onContextMenu",new Om.SimpleEventDispatcher);$(this,"unregisterAll",()=>{this.mouse.unregister(),this.keyboard.unregister(),this.touch.unregister()});this._viewer=e,this._scheme=new zm(e),this.keyboard=new eS(e),this.mouse=new nS(e),this.touch=new tS(e),this.pointerActive=e.settings.camera.controls.orbit?"orbit":"look",this._pointerFallback=e.settings.camera.controls.orbit?"look":"orbit"}get pointerFallback(){return this._pointerFallback}get pointerActive(){return this._pointerActive}get pointerOverride(){return this._pointerOverride}set pointerOverride(e){e!==this._pointerOverride&&(this._pointerOverride=e,this._onPointerOverrideChanged.dispatch())}set pointerActive(e){e!==this._pointerActive&&(e==="look"?this._pointerFallback="orbit":e==="orbit"&&(this._pointerFallback="look"),this._pointerActive=e,this._onPointerModeChanged.dispatch())}get onPointerModeChanged(){return this._onPointerModeChanged.asEvent()}get onPointerOverrideChanged(){return this._onPointerOverrideChanged.asEvent()}get onContextMenu(){return this._onContextMenu.asEvent()}get scheme(){return this._scheme}KeyAction(e){return this._scheme.onKeyAction(e)}ContextMenu(e){this._onContextMenu.dispatch(e)}registerAll(){this.keyboard.register(),this.mouse.register(),this.touch.register()}resetAll(){this.mouse.reset(),this.keyboard.reset(),this.touch.reset()}}class dS{constructor(){$(this,"mesh");$(this,"_source");$(this,"_size",1);$(this,"_geometry");$(this,"_material");$(this,"_texture");this._geometry=new rr,this._material=new un({transparent:!0,depthTest:!0,depthWrite:!1}),this.mesh=new St(this._geometry,this._material),this.mesh.renderOrder=-1}applyViewerSettings(e){this._size=e.groundPlane.size,this.mesh.visible=e.groundPlane.visible,this.applyTexture(e.groundPlane.encoding,e.groundPlane.texture),this._material.color.copy(e.groundPlane.color),this._material.opacity=e.groundPlane.opacity}adaptToContent(e){const t=e.getCenter(new U),n=new U(t.x,e.min.y-Math.abs(e.min.y)*.01,t.z);this.mesh.position.copy(n),this.mesh.quaternion.copy(new wt().setFromEuler(new Zt(1.5*Math.PI,0,0)));const s=(e?.getBoundingSphere(new Pt)?.radius??1)*this._size,o=new U(1,1,1).multiplyScalar(s);this.mesh.scale.copy(o)}applyTexture(e,t){if(t!==this._source&&(this._source=t,this._texture?.dispose(),this._texture=void 0,!(!t||!e))){if(e==="url"){const n=new lu;this._texture=n.load(t)}if(e==="base64"){const n=new Image;n.src=t;const i=new xt;this._texture=i,this._texture.image=n,n.onload=()=>{i.needsUpdate=!0}}if(!this._texture){console.error("Failed to load texture: "+t);return}this._material.map=this._texture}}dispose(){this._geometry?.dispose(),this._material?.dispose(),this._texture?.dispose(),this._texture=void 0}}class pS{constructor(e){$(this,"skyLight");$(this,"ambientLight");$(this,"sunLights");$(this,"_groundPlane");this._groundPlane=new dS,this.skyLight=new hu,this.ambientLight=new mu,this.sunLights=[],this.applySettings(e)}get groundPlane(){return this._groundPlane.mesh}loadGroundTexture(e,t){this._groundPlane.applyTexture(e,t)}getObjects(){return[this._groundPlane.mesh,this.skyLight,this.ambientLight,...this.sunLights]}applySettings(e){this._groundPlane.applyViewerSettings(e),this.skyLight.color.copy(e.skylight.skyColor),this.skyLight.groundColor.copy(e.skylight.groundColor),this.skyLight.intensity=e.skylight.intensity,this.ambientLight.color.copy(e.ambientLight.color),this.ambientLight.intensity=e.ambientLight.intensity;const t=e.sunLights.length;for(let n=0;n<t;n++){this.sunLights[n]||(this.sunLights[n]=new jc);const i=e.sunLights[n].color,s=e.sunLights[n].position,o=e.sunLights[n].intensity;i&&this.sunLights[n].color.copy(i),s&&this.sunLights[n].position.copy(s),o&&(this.sunLights[n].intensity=o)}}adaptToContent(e){this._groundPlane.adaptToContent(e)}dispose(){this.sunLights.forEach(e=>e.dispose()),this.skyLight.dispose(),this.ambientLight.dispose(),this._groundPlane.dispose()}}class mS{constructor(e,t,n,i){$(this,"_renderer");$(this,"_camera");$(this,"_inputs");$(this,"_size",1);$(this,"_fov",50);$(this,"_color",new xe("blue"));$(this,"_opacity",.2);$(this,"_opacityAlways",.5);$(this,"_fadeDurationMs",200);$(this,"_showDurationMs",1e3);$(this,"_box");$(this,"_wireframe");$(this,"_material");$(this,"_materialAlways");$(this,"_gizmos");$(this,"_disconnectCamera");$(this,"_timeout");$(this,"_fadeEnd",0);$(this,"_active",!0);$(this,"_animation",0);this._renderer=e,this._camera=t,this._inputs=n,this.applySettings(i),this.connect()}connect(){const e=this._inputs.onPointerModeChanged.subscribe(()=>this.onUpdate()),t=this._camera.onMoved.subscribe(()=>this.onUpdate()),n=this._camera.onValueChanged.subscribe(()=>this.onUpdate());this._disconnectCamera=()=>{e(),t(),n()}}onUpdate(){this.updateScale(),this.setPosition(this._camera.target),this.show(!0)}dispose(){cancelAnimationFrame(this._animation),clearTimeout(this._timeout),this._box?.dispose(),this._wireframe?.dispose(),this._material?.dispose(),this._materialAlways?.dispose(),this._disconnectCamera?.(),this._box=void 0,this._wireframe=void 0,this._material=void 0,this._materialAlways=void 0,this._disconnectCamera=void 0,this._gizmos&&(this._renderer.remove(this._gizmos),this._gizmos=void 0)}get enabled(){return this._active}set enabled(e){this._active=e}show(e=!0){!this._active||(this._gizmos||this.createGizmo(),clearTimeout(this._timeout),this._gizmos.visible=e,e&&(this._timeout=setTimeout(()=>this.fadeOut(),this._showDurationMs)))}fadeOut(e){const t=new Date().getTime();if(e||(this._fadeEnd=t+this._fadeDurationMs),t>this._fadeEnd)this._gizmos.visible=!1,this._material.opacity=this._opacity,this._materialAlways.opacity=this._opacityAlways;else{this._animation=requestAnimationFrame(()=>this.fadeOut(!0));const n=Math.pow((this._fadeEnd-t)/this._fadeDurationMs,4);this._material.opacity=ka.lerp(0,this._opacity,n),this._materialAlways.opacity=ka.lerp(0,this._opacityAlways,n)}this._renderer.needsUpdate=!0}setPosition(e){this._gizmos?.position.copy(e),this.updateScale()}setSize(e){this._size=e}setOpacity(e,t){this._opacity=e,this._opacityAlways=t,this._gizmos&&(this._material.opacity=e,this._materialAlways.opacity=t)}setColor(e){this._color=e,this._gizmos&&(this._material.color=e,this._materialAlways.color=e)}applySettings(e){this._active=e.camera.gizmo.enable,this._fov=e.camera.fov,this.setColor(e.camera.gizmo.color),this.setSize(e.camera.gizmo.size),this.setOpacity(e.camera.gizmo.opacity,e.camera.gizmo.opacityAlways)}updateScale(){if(!this._gizmos)return;const e=this._camera.frustrumSizeAt(this._gizmos.position),n=Math.min(e.x,e.y)*this._size;this._gizmos.scale.set(n,n,n)}createGizmo(){this._box=new ms(1),this._wireframe=new eu(this._box),this._wireframe.addGroup(0,1/0,0),this._wireframe.addGroup(0,1/0,1),this._material=new qt({depthTest:!0,opacity:this._opacity,color:this._color,transparent:!0}),this._materialAlways=new qt({depthTest:!1,opacity:this._opacityAlways,color:this._color,transparent:!0}),this._gizmos=new In(this._wireframe,[this._material,this._materialAlways]),this._renderer.add(this._gizmos),this.updateScale()}}const Cs=new U,km=new We,Vm=new We,Hm=new U,Gm=new U;class gS{constructor(e={}){const t=this;let n,i,s,o;const a={objects:new WeakMap},c=e.element!==void 0?e.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c,this.sortObjects=!0,this.getSize=function(){return{width:n,height:i}},this.render=function(g,_){g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),_.parent===null&&_.matrixWorldAutoUpdate===!0&&_.updateMatrixWorld(),km.copy(_.matrixWorldInverse),Vm.multiplyMatrices(_.projectionMatrix,km),h(g,g,_),this.sortObjects&&d(g)},this.setSize=function(g,_){n=g,i=_,s=n/2,o=i/2,c.style.width=g+"px",c.style.height=_+"px"};function l(g){g.isCSS2DObject&&(g.element.style.display="none");for(let _=0,m=g.children.length;_<m;_++)l(g.children[_])}function h(g,_,m){if(g.visible===!1){l(g);return}if(g.isCSS2DObject){Cs.setFromMatrixPosition(g.matrixWorld),Cs.applyMatrix4(Vm);const p=Cs.z>=-1&&Cs.z<=1&&g.layers.test(m.layers)===!0,v=g.element;v.style.display=p===!0?"":"none",p===!0&&(g.onBeforeRender(t,_,m),v.style.transform="translate("+-100*g.center.x+"%,"+-100*g.center.y+"%)translate("+(Cs.x*s+s)+"px,"+(-Cs.y*o+o)+"px)",v.parentNode!==c&&c.appendChild(v),g.onAfterRender(t,_,m));const y={distanceToCameraSquared:u(m,g)};a.objects.set(g,y)}for(let p=0,v=g.children.length;p<v;p++)h(g.children[p],_,m)}function u(g,_){return Hm.setFromMatrixPosition(g.matrixWorld),Gm.setFromMatrixPosition(_.matrixWorld),Hm.distanceToSquared(Gm)}function f(g){const _=[];return g.traverseVisible(function(m){m.isCSS2DObject&&_.push(m)}),_}function d(g){const _=f(g).sort(function(p,v){if(p.renderOrder!==v.renderOrder)return v.renderOrder-p.renderOrder;const y=a.objects.get(p).distanceToCameraSquared,x=a.objects.get(v).distanceToCameraSquared;return y-x}),m=_.length;for(let p=0,v=_.length;p<v;p++)_[p].element.style.zIndex=m-p}}}class ku{constructor(e){$(this,"canvas");$(this,"text");$(this,"_unregisterResize");$(this,"_ownedCanvas");$(this,"_onResize",new Ms.SignalDispatcher);const[t,n]=ku.getOrCreateCanvas(e.canvas.id);this.canvas=t,this._ownedCanvas=n,this.watchResize(e.canvas.resizeDelay)}get onResize(){return this._onResize.asEvent()}static getOrCreateCanvas(e){let t=e?document.getElementById(e):void 0;return t?[t,!1]:(t=document.createElement("canvas"),t.className="ara3d-canvas",t.tabIndex=0,t.style.backgroundColor="black",document.body.appendChild(t),[t,!0])}createTextRenderer(){if(console.log("Creating text renderer"),!this.canvas.parentElement)throw new Error("Cannot create text renderer without a canvas");const e=this.getParentSize(),t=new gS;return t.setSize(e.x,e.y),this.text=t.domElement,this.text.className="ara3d-text-renderer",this.text.style.position="absolute",this.text.style.top="0px",this.text.style.pointerEvents="none",this.canvas.parentElement.append(this.text),t}dispose(){this._unregisterResize?.(),this._unregisterResize=void 0,this._ownedCanvas&&this.canvas.remove()}getParentSize(){return new he(this.canvas.parentElement?.clientWidth??this.canvas.clientWidth,this.canvas.parentElement?.clientHeight??this.canvas.clientHeight)}getSize(){return new he(this.canvas.clientWidth,this.canvas.clientHeight)}getAspectRatio(){const e=this.getParentSize();return e.x/e.y}ResizeToParent(){this._onResize.dispatch()}watchResize(e){let t;const n=()=>{t!==void 0&&(clearTimeout(t),t=void 0),t=setTimeout(()=>{t=void 0,this._onResize.dispatch()},e)};window.addEventListener("resize",n),this._unregisterResize=()=>window.removeEventListener("resize",n)}}class _S{constructor(e,t,n,i){$(this,"renderer");$(this,"antialias",!0);$(this,"scene");$(this,"viewport");$(this,"camera");$(this,"needsUpdate");$(this,"_lastSize",new he);$(this,"fitViewport",()=>{const e=this.viewport.getParentSize();if(e.x===this._lastSize.x&&e.y===this._lastSize.y)return;this._lastSize.copy(e);const t=1.5;this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,t)),this.renderer.setSize(e.x,e.y),this.needsUpdate=!0});this.viewport=t,this.scene=e,this.camera=n,this.renderer=new Cm({canvas:t.canvas,antialias:!0,precision:"highp",alpha:!0,stencil:!1,powerPreference:"high-performance",logarithmicDepthBuffer:!0}),this.fitViewport(),this.viewport.onResize.subscribe(()=>this.fitViewport()),this.camera.onValueChanged.sub(()=>{this.needsUpdate=!0}),this.background=i.background.color,this.applyRenderingSettings(i)}applyRenderingSettings(e){this.renderer.toneMapping=e.rendering.toneMapping,this.renderer.toneMappingExposure=e.rendering.toneMappingExposure}dispose(){this.clear(),this.renderer.clear(),this.renderer.forceContextLoss(),this.renderer.dispose()}get background(){return this.scene.background}set background(e){this.scene.background=e,e===null?this.renderer.setClearColor(0,0):this.renderer.setClearColor(0,1),this.needsUpdate=!0}render(){!this.needsUpdate&&!this.camera.hasMoved||this.renderer.render(this.scene,this.camera.camPerspective.camera)}add(e){return this.scene.add(e),this.needsUpdate=!0,!0}remove(e){this.scene.remove(e),this.needsUpdate=!0}clear(){this.scene.clear(),this.needsUpdate=!0}}class vS{constructor(e){$(this,"settings");$(this,"renderer");$(this,"viewport");$(this,"inputs");$(this,"camera");$(this,"environment");$(this,"gizmoOrbit");$(this,"running",!1);$(this,"updateId",null);$(this,"clock",new el);$(this,"scene",new Ch);$(this,"animate",()=>{if(!this.running)return;this.updateId=requestAnimationFrame(this.animate);const e=this.clock.getDelta(),t=this.camera.update(e);this.renderer.needsUpdate=this.renderer.needsUpdate||t,this.renderer.render()});this.settings=Dm(e),this.viewport=new ku(this.settings),this.camera=new Jw(this.viewport,this.settings),this.renderer=new _S(this.scene,this.viewport,this.camera,this.settings),this.inputs=new fS(this),this.settings.camera.gizmo.enable&&(this.gizmoOrbit=new mS(this.renderer,this.camera,this.inputs,this.settings)),this.environment=new pS(this.settings),this.environment.getObjects().forEach(t=>this.renderer.add(t)),this.inputs.registerAll(),this.start()}start(){this.running||(this.running=!0,this.clock.start(),this.animate())}stop(){this.running=!1,this.updateId!==null&&(cancelAnimationFrame(this.updateId),this.updateId=null)}add(e,t=!0){if(console.log("Adding object"),this.renderer.needsUpdate=!0,!this.renderer.add(e))throw new Error("Could not load object")}clear(){this.renderer.clear()}dispose(){cancelAnimationFrame(this.updateId),this.environment.dispose(),this.gizmoOrbit.dispose(),this.viewport.dispose(),this.renderer.dispose(),this.inputs.unregisterAll()}}function Wm(r,e){if(e===Zf)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===Oa||e===eh){let t=r.getIndex();if(t===null){const o=[],a=r.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)o.push(c);r.setIndex(o),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(e===Oa)for(let o=1;o<=n;o++)i.push(t.getX(0)),i.push(t.getX(o)),i.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(i.push(t.getX(o)),i.push(t.getX(o+1)),i.push(t.getX(o+2))):(i.push(t.getX(o+2)),i.push(t.getX(o+1)),i.push(t.getX(o)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}class yS extends Jt{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new SS(t)}),this.register(function(t){return new MS(t)}),this.register(function(t){return new NS(t)}),this.register(function(t){return new US(t)}),this.register(function(t){return new BS(t)}),this.register(function(t){return new TS(t)}),this.register(function(t){return new CS(t)}),this.register(function(t){return new IS(t)}),this.register(function(t){return new RS(t)}),this.register(function(t){return new wS(t)}),this.register(function(t){return new PS(t)}),this.register(function(t){return new ES(t)}),this.register(function(t){return new LS(t)}),this.register(function(t){return new DS(t)}),this.register(function(t){return new AS(t)}),this.register(function(t){return new OS(t)}),this.register(function(t){return new FS(t)})}load(e,t,n,i){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const l=Li.extractUrlBase(e);o=Li.resolveURL(l,this.path)}else o=Li.extractUrlBase(e);this.manager.itemStart(e);const a=function(l){i?i(l):console.error(l),s.manager.itemError(e),s.manager.itemEnd(e)},c=new An(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{s.parse(l,o,function(h){t(h),s.manager.itemEnd(e)},a)}catch(h){a(h)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return 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,n,i){let s;const o={},a={},c=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===qm){try{o[at.KHR_BINARY_GLTF]=new zS(e)}catch(u){i&&i(u);return}s=JSON.parse(o[at.KHR_BINARY_GLTF].content)}else s=JSON.parse(c.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new JS(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](l);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],f=s.extensionsRequired||[];switch(u){case at.KHR_MATERIALS_UNLIT:o[u]=new bS;break;case at.KHR_DRACO_MESH_COMPRESSION:o[u]=new kS(s,this.dracoLoader);break;case at.KHR_TEXTURE_TRANSFORM:o[u]=new VS;break;case at.KHR_MESH_QUANTIZATION:o[u]=new HS;break;default:f.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function xS(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const at={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 AS{constructor(e){this.parser=e,this.name=at.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const s=t[n];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,n="light:"+e;let i=t.cache.get(n);if(i)return i;const s=t.json,c=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let l;const h=new xe(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],Xt);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new jc(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new pu(h),l.distance=u;break;case"spot":l=new du(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),ti(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(c){return n._getNodeRef(t.cache,a,c)})}}class bS{constructor(){this.name=at.KHR_MATERIALS_UNLIT}getMaterialType(){return un}extendParams(e,t,n){const i=[];e.color=new xe(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],Xt),e.opacity=o[3]}s.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",s.baseColorTexture,Tt))}return Promise.all(i)}}class wS{constructor(e){this.parser=e,this.name=at.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 s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class SS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new he(a,a)}return Promise.all(s)}}class MS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class ES{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(n.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(n.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class TS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new xe(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=i.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],Xt)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(n.assignTexture(t,"sheenColorMap",o.sheenColorTexture,Tt)),o.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class CS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class IS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new xe().setRGB(a[0],a[1],a[2],Xt),Promise.all(s)}}class RS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class PS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new xe().setRGB(a[0],a[1],a[2],Xt),o.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularColorMap",o.specularColorTexture,Tt)),Promise.all(s)}}class DS{constructor(e){this.parser=e,this.name=at.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(n.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(s)}}class LS{constructor(e){this.parser=e,this.name=at.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.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(n.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class NS{constructor(e){this.parser=e,this.name=at.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class US{constructor(e){this.parser=e,this.name=at.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return n.loadTextureImage(e,o.source,c)}}class BS{constructor(e){this.parser=e,this.name=at.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let c=n.textureLoader;if(a.uri){const l=n.options.manager.getHandler(a.uri);l!==null&&(c=l)}return n.loadTextureImage(e,o.source,c)}}class OS{constructor(e){this.name=at.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.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 c=i.byteOffset||0,l=i.byteLength||0,h=i.count,u=i.byteStride,f=new Uint8Array(a,c,l);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,u,f,i.mode,i.filter).then(function(d){return d.buffer}):o.ready.then(function(){const d=new ArrayBuffer(h*u);return o.decodeGltfBuffer(new Uint8Array(d),h,u,f,i.mode,i.filter),d})})}else return null}}class FS{constructor(e){this.name=at.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const l of i.primitives)if(l.mode!==Dn.TRIANGLES&&l.mode!==Dn.TRIANGLE_STRIP&&l.mode!==Dn.TRIANGLE_FAN&&l.mode!==void 0)return null;const o=n.extensions[this.name].attributes,a=[],c={};for(const l in o)a.push(this.parser.getDependency("accessor",o[l]).then(h=>(c[l]=h,c[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(l=>{const h=l.pop(),u=h.isGroup?h.children:[h],f=l[0].count,d=[];for(const g of u){const _=new We,m=new U,p=new wt,v=new U(1,1,1),y=new _c(g.geometry,g.material,f);for(let x=0;x<f;x++)c.TRANSLATION&&m.fromBufferAttribute(c.TRANSLATION,x),c.ROTATION&&p.fromBufferAttribute(c.ROTATION,x),c.SCALE&&v.fromBufferAttribute(c.SCALE,x),y.setMatrixAt(x,_.compose(m,p,v));for(const x in c)if(x==="_COLOR_0"){const A=c[x];y.instanceColor=new Ji(A.array,A.itemSize,A.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,c[x]);ct.prototype.copy.call(y,g),this.parser.assignFinalMaterial(y),d.push(y)}return h.isGroup?(h.clear(),h.add(...d),h):d[0]}))}}const qm="glTF",Io=12,Xm={JSON:1313821514,BIN:5130562};class zS{constructor(e){this.name=at.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Io),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==qm)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Io,s=new DataView(e,Io);let o=0;for(;o<i;){const a=s.getUint32(o,!0);o+=4;const c=s.getUint32(o,!0);if(o+=4,c===Xm.JSON){const l=new Uint8Array(e,Io+o,a);this.content=n.decode(l)}else if(c===Xm.BIN){const l=Io+o;this.body=e.slice(l,l+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class kS{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=at.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},c={},l={};for(const h in o){const u=Hu[h]||h.toLowerCase();a[u]=o[h]}for(const h in e.attributes){const u=Hu[h]||h.toLowerCase();if(o[h]!==void 0){const f=n.accessors[e.attributes[h]],d=Is[f.componentType];l[u]=d.name,c[u]=f.normalized===!0}}return t.getDependency("bufferView",s).then(function(h){return new Promise(function(u,f){i.decodeDracoFile(h,function(d){for(const g in d.attributes){const _=d.attributes[g],m=c[g];m!==void 0&&(_.normalized=m)}u(d)},a,l,Xt,f)})})}}class VS{constructor(){this.name=at.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 HS{constructor(){this.name=at.KHR_MESH_QUANTIZATION}}class Zm extends _s{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let o=0;o!==i;o++)t[o]=n[s+o];return t}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=a*2,l=a*3,h=i-t,u=(n-t)/h,f=u*u,d=f*u,g=e*l,_=g-l,m=-2*d+3*f,p=d-f,v=1-m,y=p-f+u;for(let x=0;x!==a;x++){const A=o[_+x+a],E=o[_+x+c]*h,I=o[g+x+a],D=o[g+x]*h;s[x]=v*A+y*E+m*I+p*D}return s}}const GS=new wt;class WS extends Zm{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return GS.fromArray(s).normalize().toArray(s),s}}const Dn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Is={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ym={9728:Mt,9729:pt,9984:Ko,9985:Ur,9986:Hi,9987:Mn},Qm={33071:tn,33648:Nr,10497:yi},Vu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Hu={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"},Bi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},qS={CUBICSPLINE:void 0,LINEAR:zr,STEP:Fr},Gu={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function XS(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new gs({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Wn})),r.DefaultMaterial}function Sr(r,e,t){for(const n in t.extensions)r[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function ti(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function ZS(r,e,t){let n=!1,i=!1,s=!1;for(let l=0,h=e.length;l<h;l++){const u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(s=!0),n&&i&&s)break}if(!n&&!i&&!s)return Promise.resolve(r);const o=[],a=[],c=[];for(let l=0,h=e.length;l<h;l++){const u=e[l];if(n){const f=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):r.attributes.position;o.push(f)}if(i){const f=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):r.attributes.normal;a.push(f)}if(s){const f=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):r.attributes.color;c.push(f)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(l){const h=l[0],u=l[1],f=l[2];return n&&(r.morphAttributes.position=h),i&&(r.morphAttributes.normal=u),s&&(r.morphAttributes.color=f),r.morphTargetsRelative=!0,r})}function YS(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)r.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function QS(r){let e;const t=r.extensions&&r.extensions[at.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Wu(t.attributes):e=r.indices+":"+Wu(r.attributes)+":"+r.mode,r.targets!==void 0)for(let n=0,i=r.targets.length;n<i;n++)e+=":"+Wu(r.targets[n]);return e}function Wu(r){let e="";const t=Object.keys(r).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+r[t[n]]+";";return e}function qu(r){switch(r){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.")}}function KS(r){return r.search(/\.jpe?g($|\?)/i)>0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":r.search(/\.ktx2($|\?)/i)>0||r.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const jS=new We;class JS{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new xS,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;const c=a.match(/Version\/(\d+)/);i=n&&c?parseInt(c[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||s&&o<98?this.textureLoader=new lu(this.options.manager):this.textureLoader=new Up(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new An(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 n=this,i=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([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:n,userData:{}};return Sr(s,a,i),ti(a,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){for(const c of a.scenes)c.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){const o=t[i].joints;for(let a=0,c=o.length;a<c;a++)e[o[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const o=e[i];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[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,n){if(e.refs[t]<=1)return n;const i=n.clone(),s=(o,a)=>{const c=this.associations.get(o);c!=null&&this.associations.set(a,c);for(const[l,h]of o.children.entries())s(h,a.children[l])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const s=e(t[i]);s&&n.push(s)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(s,o){return n.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=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[at.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,o){n.load(Li.resolveURL(t.uri,i.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(n){const i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const o=Vu[i.type],a=Is[i.componentType],c=i.normalized===!0,l=new a(i.count*o);return Promise.resolve(new ot(l,o,c))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(o){const a=o[0],c=Vu[i.type],l=Is[i.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,f=i.byteOffset||0,d=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,g=i.normalized===!0;let _,m;if(d&&d!==u){const p=Math.floor(f/d),v="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count;let y=t.cache.get(v);y||(_=new l(a,p*d,i.count*d/h),y=new os(_,d/h),t.cache.add(v,y)),m=new fi(y,c,f%d/h,g)}else a===null?_=new l(i.count*c):_=new l(a,f,i.count*c),m=new ot(_,c,g);if(i.sparse!==void 0){const p=Vu.SCALAR,v=Is[i.sparse.indices.componentType],y=i.sparse.indices.byteOffset||0,x=i.sparse.values.byteOffset||0,A=new v(o[1],y,i.sparse.count*p),E=new l(o[2],x,i.sparse.count*c);a!==null&&(m=new ot(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let I=0,D=A.length;I<D;I++){const b=A[I];if(m.setX(b,E[I*c]),c>=2&&m.setY(b,E[I*c+1]),c>=3&&m.setZ(b,E[I*c+2]),c>=4&&m.setW(b,E[I*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const c=n.manager.getHandler(o.uri);c!==null&&(a=c)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){const i=this,s=this.json,o=s.textures[e],a=s.images[t],c=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(t,n).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 f=(s.samplers||{})[o.sampler]||{};return h.magFilter=Ym[f.magFilter]||pt,h.minFilter=Ym[f.minFilter]||Mn,h.wrapS=Qm[f.wrapS]||yi,h.wrapT=Qm[f.wrapT]||yi,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==Mt&&h.minFilter!==pt,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=i.images[e],a=self.URL||self.webkitURL;let c=o.uri||"",l=!1;if(o.bufferView!==void 0)c=n.getDependency("bufferView",o.bufferView).then(function(u){l=!0;const f=new Blob([u],{type:o.mimeType});return c=a.createObjectURL(f),c});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(c).then(function(u){return new Promise(function(f,d){let g=f;t.isImageBitmapLoader===!0&&(g=function(_){const m=new xt(_);m.needsUpdate=!0,f(m)}),t.load(Li.resolveURL(u,s.path),g,void 0,d)})}).then(function(u){return l===!0&&a.revokeObjectURL(c),ti(u,o),u.userData.mimeType=o.mimeType||KS(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),s.extensions[at.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[at.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const c=s.associations.get(o);o=s.extensions[at.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,c)}}return i!==void 0&&(o.colorSpace=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new Ec,zt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(a,c)),n=c}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new qt,zt.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(a,c)),n=c}if(i||s||o){let a="ClonedMaterial:"+n.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=n.clone(),s&&(c.vertexColors=!0),o&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(a,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return gs}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let o;const a={},c=s.extensions||{},l=[];if(c[at.KHR_MATERIALS_UNLIT]){const u=i[at.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),l.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new xe(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Xt),a.opacity=f[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(a,"map",u.baseColorTexture,Tt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=Sn);const h=s.alphaMode||Gu.OPAQUE;if(h===Gu.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===Gu.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==un&&(l.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new he(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==un&&(l.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==un){const u=s.emissiveFactor;a.emissive=new xe().setRGB(u[0],u[1],u[2],Xt)}return s.emissiveTexture!==void 0&&o!==un&&l.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,Tt)),Promise.all(l).then(function(){const u=new o(a);return s.name&&(u.name=s.name),ti(u,s),t.associations.set(u,{materials:e}),s.extensions&&Sr(i,u,s),u})}createUniqueName(e){const t=lt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(a){return n[at.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(c){return Km(c,a,t)})}const o=[];for(let a=0,c=e.length;a<c;a++){const l=e[a],h=QS(l),u=i[h];if(u)o.push(u.promise);else{let f;l.extensions&&l.extensions[at.KHR_DRACO_MESH_COMPRESSION]?f=s(l):f=Km(new Ke,l,t),i[h]={primitive:l,promise:f},o.push(f)}}return Promise.all(o)}loadMesh(e){const t=this,n=this.json,i=this.extensions,s=n.meshes[e],o=s.primitives,a=[];for(let c=0,l=o.length;c<l;c++){const h=o[c].material===void 0?XS(this.cache):this.getDependency("material",o[c].material);a.push(h)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(c){const l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let d=0,g=h.length;d<g;d++){const _=h[d],m=o[d];let p;const v=l[d];if(m.mode===Dn.TRIANGLES||m.mode===Dn.TRIANGLE_STRIP||m.mode===Dn.TRIANGLE_FAN||m.mode===void 0)p=s.isSkinnedMesh===!0?new Lh(_,v):new St(_,v),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),m.mode===Dn.TRIANGLE_STRIP?p.geometry=Wm(p.geometry,eh):m.mode===Dn.TRIANGLE_FAN&&(p.geometry=Wm(p.geometry,Oa));else if(m.mode===Dn.LINES)p=new In(_,v);else if(m.mode===Dn.LINE_STRIP)p=new di(_,v);else if(m.mode===Dn.LINE_LOOP)p=new Fh(_,v);else if(m.mode===Dn.POINTS)p=new kh(_,v);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(p.geometry.morphAttributes).length>0&&YS(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),ti(p,s),m.extensions&&Sr(i,p,m),t.assignFinalMaterial(p),u.push(p)}for(let d=0,g=u.length;d<g;d++)t.associations.set(u[d],{meshes:e,primitives:d});if(u.length===1)return s.extensions&&Sr(i,u[0],s),u[0];const f=new Kn;s.extensions&&Sr(i,f,s),t.associations.set(f,{meshes:e});for(let d=0,g=u.length;d<g;d++)f.add(u[d]);return f})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new kt(ka.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new ur(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ti(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i<s;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const s=i.pop(),o=i,a=[],c=[];for(let l=0,h=o.length;l<h;l++){const u=o[l];if(u){a.push(u);const f=new We;s!==null&&f.fromArray(s.array,l*16),c.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new no(a,c)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],s=i.name?i.name:"animation_"+e,o=[],a=[],c=[],l=[],h=[];for(let u=0,f=i.channels.length;u<f;u++){const d=i.channels[u],g=i.samplers[d.sampler],_=d.target,m=_.node,p=i.parameters!==void 0?i.parameters[g.input]:g.input,v=i.parameters!==void 0?i.parameters[g.output]:g.output;_.node!==void 0&&(o.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",v)),l.push(g),h.push(_))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){const f=u[0],d=u[1],g=u[2],_=u[3],m=u[4],p=[];for(let y=0,x=f.length;y<x;y++){const A=f[y],E=d[y],I=g[y],D=_[y],b=m[y];if(A===void 0)continue;A.updateMatrix&&A.updateMatrix();const C=n._createAnimationTracks(A,E,I,D,b);if(C)for(let B=0;B<C.length;B++)p.push(C[B])}const v=new vs(s,void 0,p);return ti(v,i),v})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(s){const o=n._getNodeRef(n.meshCache,i.mesh,s);return i.weights!==void 0&&o.traverse(function(a){if(!!a.isMesh)for(let c=0,l=i.weights.length;c<l;c++)a.morphTargetInfluences[c]=i.weights[c]}),o})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),o=[],a=i.children||[];for(let l=0,h=a.length;l<h;l++)o.push(n.getDependency("node",a[l]));const c=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(o),c]).then(function(l){const h=l[0],u=l[1],f=l[2];f!==null&&h.traverse(function(d){!d.isSkinnedMesh||d.bind(f,jS)});for(let d=0,g=u.length;d<g;d++)h.add(u[d]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],o=s.name?i.createUniqueName(s.name):"",a=[],c=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&a.push(c),s.camera!==void 0&&a.push(i.getDependency("camera",s.camera).then(function(l){return i._getNodeRef(i.cameraCache,s.camera,l)})),i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),this.nodeCache[e]=Promise.all(a).then(function(l){let h;if(s.isBone===!0?h=new mc:l.length>1?h=new Kn:l.length===1?h=l[0]:h=new ct,h!==l[0])for(let u=0,f=l.length;u<f;u++)h.add(l[u]);if(s.name&&(h.userData.name=s.name,h.name=o),ti(h,s),s.extensions&&Sr(n,h,s),s.matrix!==void 0){const u=new We;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);if(!i.associations.has(h))i.associations.set(h,{});else if(s.mesh!==void 0&&i.meshCache.refs[s.mesh]>1){const u=i.associations.get(h);i.associations.set(h,{...u})}return i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,s=new Kn;n.name&&(s.name=i.createUniqueName(n.name)),ti(s,n),n.extensions&&Sr(t,s,n);const o=n.nodes||[],a=[];for(let c=0,l=o.length;c<l;c++)a.push(i.getDependency("node",o[c]));return Promise.all(a).then(function(c){for(let h=0,u=c.length;h<u;h++)s.add(c[h]);const l=h=>{const u=new Map;for(const[f,d]of i.associations)(f instanceof zt||f instanceof xt)&&u.set(f,d);return h.traverse(f=>{const d=i.associations.get(f);d!=null&&u.set(f,d)}),u};return i.associations=l(s),s})}_createAnimationTracks(e,t,n,i,s){const o=[],a=e.name?e.name:e.uuid,c=[];Bi[s.path]===Bi.weights?e.traverse(function(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}):c.push(a);let l;switch(Bi[s.path]){case Bi.weights:l=ar;break;case Bi.rotation:l=cr;break;case Bi.translation:case Bi.scale:l=hr;break;default:switch(n.itemSize){case 1:l=ar;break;case 2:case 3:default:l=hr;break}break}const h=i.interpolation!==void 0?qS[i.interpolation]:zr,u=this._getArrayFromAccessor(n);for(let f=0,d=c.length;f<d;f++){const g=new l(c[f]+"."+Bi[s.path],t.array,u,h);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),o.push(g)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=qu(t.constructor),i=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)i[s]=t[s]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof cr?WS:Zm;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function $S(r,e,t){const n=e.attributes,i=new Gt;if(n.POSITION!==void 0){const a=t.json.accessors[n.POSITION],c=a.min,l=a.max;if(c!==void 0&&l!==void 0){if(i.set(new U(c[0],c[1],c[2]),new U(l[0],l[1],l[2])),a.normalized){const h=qu(Is[a.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new U,c=new U;for(let l=0,h=s.length;l<h;l++){const u=s[l];if(u.POSITION!==void 0){const f=t.json.accessors[u.POSITION],d=f.min,g=f.max;if(d!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(d[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(d[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(d[2]),Math.abs(g[2]))),f.normalized){const _=qu(Is[f.componentType]);c.multiplyScalar(_)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(a)}r.boundingBox=i;const o=new Pt;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,r.boundingSphere=o}function Km(r,e,t){const n=e.attributes,i=[];function s(o,a){return t.getDependency("accessor",o).then(function(c){r.setAttribute(a,c)})}for(const o in n){const a=Hu[o]||o.toLowerCase();a in r.attributes||i.push(s(n[o],a))}if(e.indices!==void 0&&!r.index){const o=t.getDependency("accessor",e.indices).then(function(a){r.setIndex(a)});i.push(o)}return rt.workingColorSpace!==Xt&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${rt.workingColorSpace}" not supported.`),ti(r,e),$S(r,e,t),Promise.all(i).then(function(){return e.targets!==void 0?ZS(r,e.targets,t):r})}const Xu=new WeakMap;class eM extends Jt{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,n,i){const s=new An(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,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,Tt,n).catch(n)}decodeDracoFile(e,t,n,i,s=Xt,o=()=>{}){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:s};return this.decodeGeometry(e,a).then(t).catch(o)}decodeGeometry(e,t){const n=JSON.stringify(t);if(Xu.has(e)){const c=Xu.get(e);if(c.key===n)return c.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 i;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(c=>(i=c,new Promise((l,h)=>{i._callbacks[s]={resolve:l,reject:h},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),Xu.set(e,{key:n,promise:a}),a}_createGeometry(e){const t=new Ke;e.index&&t.setIndex(new ot(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const{name:i,array:s,itemSize:o,stride:a,vertexColorSpace:c}=e.attributes[n];let l;if(o===a)l=new ot(s,o);else{const h=new os(s,a);l=new fi(h,o,0)}i==="color"&&(this._assignVertexColorSpace(l,c),l.normalized=!(s instanceof Float32Array)),t.setAttribute(i,l)}return t}_assignVertexColorSpace(e,t){if(t!==Tt)return;const n=new xe;for(let i=0,s=e.count;i<s;i++)n.fromBufferAttribute(e,i),rt.colorSpaceToWorking(n,Tt),e.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new An(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,s)=>{n.load(e,i,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(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const s=tM.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
4036
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){const o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_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 tM(){let r,e;onmessage=function(o){const a=o.data;switch(a.type){case"init":r=a.decoderConfig,e=new Promise(function(h){r.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(r)});break;case"decode":const c=a.buffer,l=a.taskConfig;e.then(h=>{const u=h.draco,f=new u.Decoder;try{const d=t(u,f,new Int8Array(c),l),g=d.attributes.map(_=>_.array.buffer);d.index&&g.push(d.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:d},g)}catch(d){console.error(d),self.postMessage({type:"error",id:a.id,error:d.message})}finally{u.destroy(f)}});break}};function t(o,a,c,l){const h=l.attributeIDs,u=l.attributeTypes;let f,d;const g=a.GetEncodedGeometryType(c);if(g===o.TRIANGULAR_MESH)f=new o.Mesh,d=a.DecodeArrayToMesh(c,c.byteLength,f);else if(g===o.POINT_CLOUD)f=new o.PointCloud,d=a.DecodeArrayToPointCloud(c,c.byteLength,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());const _={index:null,attributes:[]};for(const m in h){const p=self[u[m]];let v,y;if(l.useUniqueIDs)y=h[m],v=a.GetAttributeByUniqueId(f,y);else{if(y=a.GetAttributeId(f,o[h[m]]),y===-1)continue;v=a.GetAttribute(f,y)}const x=i(o,a,f,m,p,v);m==="color"&&(x.vertexColorSpace=l.vertexColorSpace),_.attributes.push(x)}return g===o.TRIANGULAR_MESH&&(_.index=n(o,a,f)),o.destroy(f),_}function n(o,a,c){const h=c.num_faces()*3,u=h*4,f=o._malloc(u);a.GetTrianglesUInt32Array(c,u,f);const d=new Uint32Array(o.HEAPF32.buffer,f,h).slice();return o._free(f),{array:d,itemSize:1}}function i(o,a,c,l,h,u){const f=c.num_points(),d=u.num_components(),g=s(o,h),_=d*h.BYTES_PER_ELEMENT,m=Math.ceil(_/4)*4,p=m/h.BYTES_PER_ELEMENT,v=f*_,y=f*m,x=o._malloc(v);a.GetAttributeDataArrayForAllPoints(c,u,g,v,x);const A=new h(o.HEAPF32.buffer,x,v/h.BYTES_PER_ELEMENT);let E;if(_===m)E=A.slice();else{E=new h(y/h.BYTES_PER_ELEMENT);let I=0;for(let D=0,b=A.length;D<b;D++){for(let C=0;C<d;C++)E[I+C]=A[D*d+C];I+=p}}return o._free(x),{name:l,count:f,itemSize:d,array:E,stride:p}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}class nM{constructor(){$(this,"loader");this.loader=new yS;const e=new eM;e.setDecoderPath("/draco/"),this.loader.setDRACOLoader(e)}async load(e){return this.loadFromUrlOrZip(e)}async loadFromUrlOrZip(e){return e.toLowerCase().endsWith(".zip")?this.loadFromZipUrl(e):new Promise((t,n)=>{this.loader.load(e,i=>{const s=i.scene||i.scenes[0];if(!s)return n(new Error("Model contains no scene and cannot be viewed."));t(s)},void 0,n)})}async loadFromZipUrl(e){throw new Error("Not implemented")}}function yl(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jm={exports:{}};/*!
4037
4037
 
4038
4038
  JSZip v3.10.1 - A JavaScript class for generating and reading zip files
4039
4039
  <http://stuartk.com/jszip>
@@ -4043,8 +4043,8 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
4043
4043
 
4044
4044
  JSZip uses the library pako released under the MIT license :
4045
4045
  https://github.com/nodeca/pako/blob/main/LICENSE
4046
- */(function(r,e){(function(t){r.exports=t()})(function(){return function t(n,i,s){function o(l,h){if(!i[l]){if(!n[l]){var u=typeof yl=="function"&&yl;if(!h&&u)return u(l,!0);if(a)return a(l,!0);var f=new Error("Cannot find module '"+l+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[l]={exports:{}};n[l][0].call(d.exports,function(g){var _=n[l][1][g];return o(_||g)},d,d.exports,t,n,i,s)}return i[l].exports}for(var a=typeof yl=="function"&&yl,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(t,n,i){var s=t("./utils"),o=t("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(c){for(var l,h,u,f,d,g,_,m=[],p=0,v=c.length,y=v,x=s.getTypeOf(c)!=="string";p<c.length;)y=v-p,u=x?(l=c[p++],h=p<v?c[p++]:0,p<v?c[p++]:0):(l=c.charCodeAt(p++),h=p<v?c.charCodeAt(p++):0,p<v?c.charCodeAt(p++):0),f=l>>2,d=(3&l)<<4|h>>4,g=1<y?(15&h)<<2|u>>6:64,_=2<y?63&u:64,m.push(a.charAt(f)+a.charAt(d)+a.charAt(g)+a.charAt(_));return m.join("")},i.decode=function(c){var l,h,u,f,d,g,_=0,m=0,p="data:";if(c.substr(0,p.length)===p)throw new Error("Invalid base64 input, it looks like a data url.");var v,y=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===a.charAt(64)&&y--,c.charAt(c.length-2)===a.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=o.uint8array?new Uint8Array(0|y):new Array(0|y);_<c.length;)l=a.indexOf(c.charAt(_++))<<2|(f=a.indexOf(c.charAt(_++)))>>4,h=(15&f)<<4|(d=a.indexOf(c.charAt(_++)))>>2,u=(3&d)<<6|(g=a.indexOf(c.charAt(_++))),v[m++]=l,d!==64&&(v[m++]=h),g!==64&&(v[m++]=u);return v}},{"./support":30,"./utils":32}],2:[function(t,n,i){var s=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),c=t("./stream/DataLengthProbe");function l(h,u,f,d,g){this.compressedSize=h,this.uncompressedSize=u,this.crc32=f,this.compression=d,this.compressedContent=g}l.prototype={getContentWorker:function(){var h=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),u=this;return h.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(h,u,f){return h.pipe(new a).pipe(new c("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",u)},n.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,n,i){var s=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,n,i){var s=t("./utils"),o=function(){for(var a,c=[],l=0;l<256;l++){a=l;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;c[l]=a}return c}();n.exports=function(a,c){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(l,h,u,f){var d=o,g=f+u;l^=-1;for(var _=f;_<g;_++)l=l>>>8^d[255&(l^h[_])];return-1^l}(0|c,a,a.length,0):function(l,h,u,f){var d=o,g=f+u;l^=-1;for(var _=f;_<g;_++)l=l>>>8^d[255&(l^h.charCodeAt(_))];return-1^l}(0|c,a,a.length,0):0}},{"./utils":32}],5:[function(t,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,n,i){var s=null;s=typeof Promise<"u"?Promise:t("lie"),n.exports={Promise:s}},{lie:37}],7:[function(t,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),c=t("./stream/GenericWorker"),l=s?"uint8array":"array";function h(u,f){c.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(h,c),h.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(l,u.data),!1)},h.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(f){u.push({data:f,meta:u.meta})}},i.compressWorker=function(u){return new h("Deflate",u)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,n,i){function s(d,g){var _,m="";for(_=0;_<g;_++)m+=String.fromCharCode(255&d),d>>>=8;return m}function o(d,g,_,m,p,v){var y,x,A=d.file,E=d.compression,I=v!==l.utf8encode,D=a.transformTo("string",v(A.name)),b=a.transformTo("string",l.utf8encode(A.name)),C=A.comment,B=a.transformTo("string",v(C)),R=a.transformTo("string",l.utf8encode(C)),O=b.length!==A.name.length,M=R.length!==C.length,z="",X="",H="",re=A.dir,$=A.date,le={crc32:0,compressedSize:0,uncompressedSize:0};g&&!_||(le.crc32=d.crc32,le.compressedSize=d.compressedSize,le.uncompressedSize=d.uncompressedSize);var W=0;g&&(W|=8),I||!O&&!M||(W|=2048);var Z=0,ge=0;re&&(Z|=16),p==="UNIX"?(ge=798,Z|=function(de,oe){var ee=de;return de||(ee=oe?16893:33204),(65535&ee)<<16}(A.unixPermissions,re)):(ge=20,Z|=function(de){return 63&(de||0)}(A.dosPermissions)),y=$.getUTCHours(),y<<=6,y|=$.getUTCMinutes(),y<<=5,y|=$.getUTCSeconds()/2,x=$.getUTCFullYear()-1980,x<<=4,x|=$.getUTCMonth()+1,x<<=5,x|=$.getUTCDate(),O&&(X=s(1,1)+s(h(D),4)+b,z+="up"+s(X.length,2)+X),M&&(H=s(1,1)+s(h(B),4)+R,z+="uc"+s(H.length,2)+H);var _e="";return _e+=`
4047
- \0`,_e+=s(W,2),_e+=E.magic,_e+=s(y,2),_e+=s(x,2),_e+=s(le.crc32,4),_e+=s(le.compressedSize,4),_e+=s(le.uncompressedSize,4),_e+=s(D.length,2),_e+=s(z.length,2),{fileRecord:u.LOCAL_FILE_HEADER+_e+D+z,dirRecord:u.CENTRAL_FILE_HEADER+s(ge,2)+_e+s(B.length,2)+"\0\0\0\0"+s(Z,4)+s(m,4)+D+z+B}}var a=t("../utils"),c=t("../stream/GenericWorker"),l=t("../utf8"),h=t("../crc32"),u=t("../signature");function f(d,g,_,m){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=_,this.encodeFileName=m,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,c),f.prototype.push=function(d){var g=d.meta.percent||0,_=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,c.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:_?(g+100*(_-m-1))/_:100}}))},f.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var g=this.streamFiles&&!d.file.dir;if(g){var _=o(d,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:_.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(d){this.accumulate=!1;var g=this.streamFiles&&!d.file.dir,_=o(d,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(_.dirRecord),g)this.push({data:function(m){return u.DATA_DESCRIPTOR+s(m.crc32,4)+s(m.compressedSize,4)+s(m.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:_.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var d=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var _=this.bytesWritten-d,m=function(p,v,y,x,A){var E=a.transformTo("string",A(x));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(p,2)+s(p,2)+s(v,4)+s(y,4)+s(E.length,2)+E}(this.dirRecords.length,_,d,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(d){this._sources.push(d);var g=this;return d.on("data",function(_){g.processChunk(_)}),d.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),d.on("error",function(_){g.error(_)}),this},f.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(d){var g=this._sources;if(!c.prototype.error.call(this,d))return!1;for(var _=0;_<g.length;_++)try{g[_].error(d)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var d=this._sources,g=0;g<d.length;g++)d[g].lock()},n.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,n,i){var s=t("../compressions"),o=t("./ZipFileWorker");i.generateWorker=function(a,c,l){var h=new o(c.streamFiles,l,c.platform,c.encodeFileName),u=0;try{a.forEach(function(f,d){u++;var g=function(v,y){var x=v||y,A=s[x];if(!A)throw new Error(x+" is not a valid compression method !");return A}(d.options.compression,c.compression),_=d.options.compressionOptions||c.compressionOptions||{},m=d.dir,p=d.date;d._compressWorker(g,_).withStreamInfo("file",{name:f,dir:m,date:p,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(h)}),h.entriesCount=u}catch(f){h.error(f)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,n,i){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new s;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(s.prototype=t("./object")).loadAsync=t("./load"),s.support=t("./support"),s.defaults=t("./defaults"),s.version="3.10.1",s.loadAsync=function(o,a){return new s().loadAsync(o,a)},s.external=t("./external"),n.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,n,i){var s=t("./utils"),o=t("./external"),a=t("./utf8"),c=t("./zipEntries"),l=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function u(f){return new o.Promise(function(d,g){var _=f.decompressed.getContentWorker().pipe(new l);_.on("error",function(m){g(m)}).on("end",function(){_.streamInfo.crc32!==f.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}n.exports=function(f,d){var g=this;return d=s.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",f,!0,d.optimizedBinaryString,d.base64).then(function(_){var m=new c(d);return m.load(_),m}).then(function(_){var m=[o.Promise.resolve(_)],p=_.files;if(d.checkCRC32)for(var v=0;v<p.length;v++)m.push(u(p[v]));return o.Promise.all(m)}).then(function(_){for(var m=_.shift(),p=m.files,v=0;v<p.length;v++){var y=p[v],x=y.fileNameStr,A=s.resolve(y.fileNameStr);g.file(A,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:d.createFolders}),y.dir||(g.file(A).unsafeOriginalName=x)}return m.zipComment.length&&(g.comment=m.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,n,i){var s=t("../utils"),o=t("../stream/GenericWorker");function a(c,l){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(l)}s.inherits(a,o),a.prototype._bindStream=function(c){var l=this;(this._stream=c).pause(),c.on("data",function(h){l.push({data:h,meta:{percent:0}})}).on("error",function(h){l.isPaused?this.generatedError=h:l.error(h)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},a.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,n,i){var s=t("readable-stream").Readable;function o(a,c,l){s.call(this,c),this._helper=a;var h=this;a.on("data",function(u,f){h.push(u)||h._helper.pause(),l&&l(f)}).on("error",function(u){h.emit("error",u)}).on("end",function(){h.push(null)})}t("../utils").inherits(o,s),o.prototype._read=function(){this._helper.resume()},n.exports=o},{"../utils":32,"readable-stream":16}],14:[function(t,n,i){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,o);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,o)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var o=new Buffer(s);return o.fill(0),o},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(t,n,i){function s(A,E,I){var D,b=a.getTypeOf(E),C=a.extend(I||{},h);C.date=C.date||new Date,C.compression!==null&&(C.compression=C.compression.toUpperCase()),typeof C.unixPermissions=="string"&&(C.unixPermissions=parseInt(C.unixPermissions,8)),C.unixPermissions&&16384&C.unixPermissions&&(C.dir=!0),C.dosPermissions&&16&C.dosPermissions&&(C.dir=!0),C.dir&&(A=p(A)),C.createFolders&&(D=m(A))&&v.call(this,D,!0);var B=b==="string"&&C.binary===!1&&C.base64===!1;I&&I.binary!==void 0||(C.binary=!B),(E instanceof u&&E.uncompressedSize===0||C.dir||!E||E.length===0)&&(C.base64=!1,C.binary=!0,E="",C.compression="STORE",b="string");var R=null;R=E instanceof u||E instanceof c?E:g.isNode&&g.isStream(E)?new _(A,E):a.prepareContent(A,E,C.binary,C.optimizedBinaryString,C.base64);var O=new f(A,R,C);this.files[A]=O}var o=t("./utf8"),a=t("./utils"),c=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),h=t("./defaults"),u=t("./compressedObject"),f=t("./zipObject"),d=t("./generate"),g=t("./nodejsUtils"),_=t("./nodejs/NodejsStreamInputAdapter"),m=function(A){A.slice(-1)==="/"&&(A=A.substring(0,A.length-1));var E=A.lastIndexOf("/");return 0<E?A.substring(0,E):""},p=function(A){return A.slice(-1)!=="/"&&(A+="/"),A},v=function(A,E){return E=E!==void 0?E:h.createFolders,A=p(A),this.files[A]||s.call(this,A,null,{dir:!0,createFolders:E}),this.files[A]};function y(A){return Object.prototype.toString.call(A)==="[object RegExp]"}var x={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(A){var E,I,D;for(E in this.files)D=this.files[E],(I=E.slice(this.root.length,E.length))&&E.slice(0,this.root.length)===this.root&&A(I,D)},filter:function(A){var E=[];return this.forEach(function(I,D){A(I,D)&&E.push(D)}),E},file:function(A,E,I){if(arguments.length!==1)return A=this.root+A,s.call(this,A,E,I),this;if(y(A)){var D=A;return this.filter(function(C,B){return!B.dir&&D.test(C)})}var b=this.files[this.root+A];return b&&!b.dir?b:null},folder:function(A){if(!A)return this;if(y(A))return this.filter(function(b,C){return C.dir&&A.test(b)});var E=this.root+A,I=v.call(this,E),D=this.clone();return D.root=I.name,D},remove:function(A){A=this.root+A;var E=this.files[A];if(E||(A.slice(-1)!=="/"&&(A+="/"),E=this.files[A]),E&&!E.dir)delete this.files[A];else for(var I=this.filter(function(b,C){return C.name.slice(0,A.length)===A}),D=0;D<I.length;D++)delete this.files[I[D].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(A){var E,I={};try{if((I=a.extend(A||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=I.type.toLowerCase(),I.compression=I.compression.toUpperCase(),I.type==="binarystring"&&(I.type="string"),!I.type)throw new Error("No output type specified.");a.checkSupport(I.type),I.platform!=="darwin"&&I.platform!=="freebsd"&&I.platform!=="linux"&&I.platform!=="sunos"||(I.platform="UNIX"),I.platform==="win32"&&(I.platform="DOS");var D=I.comment||this.comment||"";E=d.generateWorker(this,I,D)}catch(b){(E=new c("error")).error(b)}return new l(E,I.type||"string",I.mimeType)},generateAsync:function(A,E){return this.generateInternalStream(A).accumulate(E)},generateNodeStream:function(A,E){return(A=A||{}).type||(A.type="nodebuffer"),this.generateInternalStream(A).toNodejsStream(E)}};n.exports=x},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,n,i){n.exports=t("stream")},{stream:void 0}],17:[function(t,n,i){var s=t("./DataReader");function o(a){s.call(this,a);for(var c=0;c<this.data.length;c++)a[c]=255&a[c]}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data[this.zero+a]},o.prototype.lastIndexOfSignature=function(a){for(var c=a.charCodeAt(0),l=a.charCodeAt(1),h=a.charCodeAt(2),u=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===l&&this.data[f+2]===h&&this.data[f+3]===u)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(a){var c=a.charCodeAt(0),l=a.charCodeAt(1),h=a.charCodeAt(2),u=a.charCodeAt(3),f=this.readData(4);return c===f[0]&&l===f[1]&&h===f[2]&&u===f[3]},o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=o},{"../utils":32,"./DataReader":18}],18:[function(t,n,i){var s=t("../utils");function o(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var c,l=0;for(this.checkOffset(a),c=this.index+a-1;c>=this.index;c--)l=(l<<8)+this.byteAt(c);return this.index+=a,l},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=o},{"../utils":32}],19:[function(t,n,i){var s=t("./Uint8ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,n,i){var s=t("./DataReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,n,i){var s=t("./ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,n,i){var s=t("../utils"),o=t("../support"),a=t("./ArrayReader"),c=t("./StringReader"),l=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");n.exports=function(u){var f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new l(u):o.uint8array?new h(s.transformTo("uint8array",u)):new a(s.transformTo("array",u)):new c(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,n,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,n,i){var s=t("./GenericWorker"),o=t("../utils");function a(c){s.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(a,s),a.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,n,i){var s=t("./GenericWorker"),o=t("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,s),a.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,n,i){var s=t("../utils"),o=t("./GenericWorker");function a(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(a,o),a.prototype.processChunk=function(c){if(c){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+c.data.length}o.prototype.processChunk.call(this,c)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,n,i){var s=t("../utils"),o=t("./GenericWorker");function a(c){o.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(h){l.dataIsReady=!0,l.data=h,l.max=h&&h.length||0,l.type=s.getTypeOf(h),l.isPaused||l._tickAndRepeat()},function(h){l.error(h)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,l);break;case"uint8array":c=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":c=this.data.slice(this.index,l)}return this.index=l,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,n,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,a)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var a=this;return o.on("data",function(c){a.processChunk(c)}),o.on("end",function(){a.end()}),o.on("error",function(c){a.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,a){return this.extraStreamInfo[o]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},n.exports=s},{}],29:[function(t,n,i){var s=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),c=t("../base64"),l=t("../support"),h=t("../external"),u=null;if(l.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(g,_){return new h.Promise(function(m,p){var v=[],y=g._internalType,x=g._outputType,A=g._mimeType;g.on("data",function(E,I){v.push(E),_&&_(I)}).on("error",function(E){v=[],p(E)}).on("end",function(){try{var E=function(I,D,b){switch(I){case"blob":return s.newBlob(s.transformTo("arraybuffer",D),b);case"base64":return c.encode(D);default:return s.transformTo(I,D)}}(x,function(I,D){var b,C=0,B=null,R=0;for(b=0;b<D.length;b++)R+=D[b].length;switch(I){case"string":return D.join("");case"array":return Array.prototype.concat.apply([],D);case"uint8array":for(B=new Uint8Array(R),b=0;b<D.length;b++)B.set(D[b],C),C+=D[b].length;return B;case"nodebuffer":return Buffer.concat(D);default:throw new Error("concat : unsupported type '"+I+"'")}}(y,v),A);m(E)}catch(I){p(I)}v=[]}).resume()})}function d(g,_,m){var p=_;switch(_){case"blob":case"arraybuffer":p="uint8array";break;case"base64":p="string"}try{this._internalType=p,this._outputType=_,this._mimeType=m,s.checkSupport(p),this._worker=g.pipe(new o(p)),g.lock()}catch(v){this._worker=new a("error"),this._worker.error(v)}}d.prototype={accumulate:function(g){return f(this,g)},on:function(g,_){var m=this;return g==="data"?this._worker.on(g,function(p){_.call(m,p.data,p.meta)}):this._worker.on(g,function(){s.delay(_,arguments,m)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:this._outputType!=="nodebuffer"},g)}},n.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,n,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,n,i){for(var s=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),c=t("./stream/GenericWorker"),l=new Array(256),h=0;h<256;h++)l[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;l[254]=l[254]=1;function u(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}i.utf8encode=function(d){return o.nodebuffer?a.newBufferFrom(d,"utf-8"):function(g){var _,m,p,v,y,x=g.length,A=0;for(v=0;v<x;v++)(64512&(m=g.charCodeAt(v)))==55296&&v+1<x&&(64512&(p=g.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(p-56320),v++),A+=m<128?1:m<2048?2:m<65536?3:4;for(_=o.uint8array?new Uint8Array(A):new Array(A),v=y=0;y<A;v++)(64512&(m=g.charCodeAt(v)))==55296&&v+1<x&&(64512&(p=g.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(p-56320),v++),m<128?_[y++]=m:(m<2048?_[y++]=192|m>>>6:(m<65536?_[y++]=224|m>>>12:(_[y++]=240|m>>>18,_[y++]=128|m>>>12&63),_[y++]=128|m>>>6&63),_[y++]=128|63&m);return _}(d)},i.utf8decode=function(d){return o.nodebuffer?s.transformTo("nodebuffer",d).toString("utf-8"):function(g){var _,m,p,v,y=g.length,x=new Array(2*y);for(_=m=0;_<y;)if((p=g[_++])<128)x[m++]=p;else if(4<(v=l[p]))x[m++]=65533,_+=v-1;else{for(p&=v===2?31:v===3?15:7;1<v&&_<y;)p=p<<6|63&g[_++],v--;1<v?x[m++]=65533:p<65536?x[m++]=p:(p-=65536,x[m++]=55296|p>>10&1023,x[m++]=56320|1023&p)}return x.length!==m&&(x.subarray?x=x.subarray(0,m):x.length=m),s.applyFromCharCode(x)}(d=s.transformTo(o.uint8array?"uint8array":"array",d))},s.inherits(u,c),u.prototype.processChunk=function(d){var g=s.transformTo(o.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var _=g;(g=new Uint8Array(_.length+this.leftOver.length)).set(this.leftOver,0),g.set(_,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var m=function(v,y){var x;for((y=y||v.length)>v.length&&(y=v.length),x=y-1;0<=x&&(192&v[x])==128;)x--;return x<0||x===0?y:x+l[v[x]]>y?x:y}(g),p=g;m!==g.length&&(o.uint8array?(p=g.subarray(0,m),this.leftOver=g.subarray(m,g.length)):(p=g.slice(0,m),this.leftOver=g.slice(m,g.length))),this.push({data:i.utf8decode(p),meta:d.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,s.inherits(f,c),f.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,n,i){var s=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),c=t("./external");function l(_){return _}function h(_,m){for(var p=0;p<_.length;++p)m[p]=255&_.charCodeAt(p);return m}t("setimmediate"),i.newBlob=function(_,m){i.checkSupport("blob");try{return new Blob([_],{type:m})}catch{try{var p=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return p.append(_),p.getBlob(m)}catch{throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(_,m,p){var v=[],y=0,x=_.length;if(x<=p)return String.fromCharCode.apply(null,_);for(;y<x;)m==="array"||m==="nodebuffer"?v.push(String.fromCharCode.apply(null,_.slice(y,Math.min(y+p,x)))):v.push(String.fromCharCode.apply(null,_.subarray(y,Math.min(y+p,x)))),y+=p;return v.join("")},stringifyByChar:function(_){for(var m="",p=0;p<_.length;p++)m+=String.fromCharCode(_[p]);return m},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function f(_){var m=65536,p=i.getTypeOf(_),v=!0;if(p==="uint8array"?v=u.applyCanBeUsed.uint8array:p==="nodebuffer"&&(v=u.applyCanBeUsed.nodebuffer),v)for(;1<m;)try{return u.stringifyByChunk(_,p,m)}catch{m=Math.floor(m/2)}return u.stringifyByChar(_)}function d(_,m){for(var p=0;p<_.length;p++)m[p]=_[p];return m}i.applyFromCharCode=f;var g={};g.string={string:l,array:function(_){return h(_,new Array(_.length))},arraybuffer:function(_){return g.string.uint8array(_).buffer},uint8array:function(_){return h(_,new Uint8Array(_.length))},nodebuffer:function(_){return h(_,a.allocBuffer(_.length))}},g.array={string:f,array:l,arraybuffer:function(_){return new Uint8Array(_).buffer},uint8array:function(_){return new Uint8Array(_)},nodebuffer:function(_){return a.newBufferFrom(_)}},g.arraybuffer={string:function(_){return f(new Uint8Array(_))},array:function(_){return d(new Uint8Array(_),new Array(_.byteLength))},arraybuffer:l,uint8array:function(_){return new Uint8Array(_)},nodebuffer:function(_){return a.newBufferFrom(new Uint8Array(_))}},g.uint8array={string:f,array:function(_){return d(_,new Array(_.length))},arraybuffer:function(_){return _.buffer},uint8array:l,nodebuffer:function(_){return a.newBufferFrom(_)}},g.nodebuffer={string:f,array:function(_){return d(_,new Array(_.length))},arraybuffer:function(_){return g.nodebuffer.uint8array(_).buffer},uint8array:function(_){return d(_,new Uint8Array(_.length))},nodebuffer:l},i.transformTo=function(_,m){if(m=m||"",!_)return m;i.checkSupport(_);var p=i.getTypeOf(m);return g[p][_](m)},i.resolve=function(_){for(var m=_.split("/"),p=[],v=0;v<m.length;v++){var y=m[v];y==="."||y===""&&v!==0&&v!==m.length-1||(y===".."?p.pop():p.push(y))}return p.join("/")},i.getTypeOf=function(_){return typeof _=="string"?"string":Object.prototype.toString.call(_)==="[object Array]"?"array":s.nodebuffer&&a.isBuffer(_)?"nodebuffer":s.uint8array&&_ instanceof Uint8Array?"uint8array":s.arraybuffer&&_ instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(_){if(!s[_.toLowerCase()])throw new Error(_+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(_){var m,p,v="";for(p=0;p<(_||"").length;p++)v+="\\x"+((m=_.charCodeAt(p))<16?"0":"")+m.toString(16).toUpperCase();return v},i.delay=function(_,m,p){setImmediate(function(){_.apply(p||null,m||[])})},i.inherits=function(_,m){function p(){}p.prototype=m.prototype,_.prototype=new p},i.extend=function(){var _,m,p={};for(_=0;_<arguments.length;_++)for(m in arguments[_])Object.prototype.hasOwnProperty.call(arguments[_],m)&&p[m]===void 0&&(p[m]=arguments[_][m]);return p},i.prepareContent=function(_,m,p,v,y){return c.Promise.resolve(m).then(function(x){return s.blob&&(x instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(x))!==-1)&&typeof FileReader<"u"?new c.Promise(function(A,E){var I=new FileReader;I.onload=function(D){A(D.target.result)},I.onerror=function(D){E(D.target.error)},I.readAsArrayBuffer(x)}):x}).then(function(x){var A=i.getTypeOf(x);return A?(A==="arraybuffer"?x=i.transformTo("uint8array",x):A==="string"&&(y?x=o.decode(x):p&&v!==!0&&(x=function(E){return h(E,s.uint8array?new Uint8Array(E.length):new Array(E.length))}(x))),x):c.Promise.reject(new Error("Can't read the data of '"+_+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,n,i){var s=t("./reader/readerFor"),o=t("./utils"),a=t("./signature"),c=t("./zipEntry"),l=t("./support");function h(u){this.files=[],this.loadOptions=u}h.prototype={checkSignature:function(u){if(!this.reader.readAndCheckSignature(u)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(u)+")")}},isSignature:function(u,f){var d=this.reader.index;this.reader.setIndex(u);var g=this.reader.readString(4)===f;return this.reader.setIndex(d),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var u=this.reader.readData(this.zipCommentLength),f=l.uint8array?"uint8array":"array",d=o.transformTo(f,u);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var u,f,d,g=this.zip64EndOfCentralSize-44;0<g;)u=this.reader.readInt(2),f=this.reader.readInt(4),d=this.reader.readData(f),this.zip64ExtensibleData[u]={id:u,length:f,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var u,f;for(u=0;u<this.files.length;u++)f=this.files[u],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var u;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(u=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(u);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var u=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(u<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(u);var f=u;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(u=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(u),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var g=f-d;if(0<g)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(u){this.reader=s(u)},load:function(u){this.prepareReader(u),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,n,i){var s=t("./reader/readerFor"),o=t("./utils"),a=t("./compressedObject"),c=t("./crc32"),l=t("./utf8"),h=t("./compressions"),u=t("./support");function f(d,g){this.options=d,this.loadOptions=g}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var g,_;if(d.skip(22),this.fileNameLength=d.readInt(2),_=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(_),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=function(m){for(var p in h)if(Object.prototype.hasOwnProperty.call(h,p)&&h[p].magic===m)return h[p];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,g,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var g=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(g),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var g,_,m,p=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<p;)g=d.readInt(2),_=d.readInt(2),m=d.readData(_),this.extraFields[g]={id:g,length:_,value:m};d.setIndex(p)},handleUTF8:function(){var d=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var _=o.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(_)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var p=o.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(p)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var g=s(d.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:l.utf8decode(g.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var g=s(d.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:l.utf8decode(g.readData(d.length-5))}return null}},n.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,n,i){function s(g,_,m){this.name=g,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=_,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var o=t("./stream/StreamHelper"),a=t("./stream/DataWorker"),c=t("./utf8"),l=t("./compressedObject"),h=t("./stream/GenericWorker");s.prototype={internalStream:function(g){var _=null,m="string";try{if(!g)throw new Error("No output type specified.");var p=(m=g.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),_=this._decompressWorker();var v=!this._dataBinary;v&&!p&&(_=_.pipe(new c.Utf8EncodeWorker)),!v&&p&&(_=_.pipe(new c.Utf8DecodeWorker))}catch(y){(_=new h("error")).error(y)}return new o(_,m,"")},async:function(g,_){return this.internalStream(g).accumulate(_)},nodeStream:function(g,_){return this.internalStream(g||"nodebuffer").toNodejsStream(_)},_compressWorker:function(g,_){if(this._data instanceof l&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new c.Utf8EncodeWorker)),l.createWorkerFrom(m,g,_)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof h?this._data:new a(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<u.length;d++)s.prototype[u[d]]=f;n.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,n,i){(function(s){var o,a,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var l=0,h=new c(g),u=s.document.createTextNode("");h.observe(u,{characterData:!0}),o=function(){u.data=l=++l%2}}else if(s.setImmediate||s.MessageChannel===void 0)o="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var _=s.document.createElement("script");_.onreadystatechange=function(){g(),_.onreadystatechange=null,_.parentNode.removeChild(_),_=null},s.document.documentElement.appendChild(_)}:function(){setTimeout(g,0)};else{var f=new s.MessageChannel;f.port1.onmessage=g,o=function(){f.port2.postMessage(0)}}var d=[];function g(){var _,m;a=!0;for(var p=d.length;p;){for(m=d,d=[],_=-1;++_<p;)m[_]();p=d.length}a=!1}n.exports=function(_){d.push(_)!==1||a||o()}}).call(this,typeof fl<"u"?fl:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,n,i){var s=t("immediate");function o(){}var a={},c=["REJECTED"],l=["FULFILLED"],h=["PENDING"];function u(p){if(typeof p!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,p!==o&&_(this,p)}function f(p,v,y){this.promise=p,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function d(p,v,y){s(function(){var x;try{x=v(y)}catch(A){return a.reject(p,A)}x===p?a.reject(p,new TypeError("Cannot resolve promise with itself")):a.resolve(p,x)})}function g(p){var v=p&&p.then;if(p&&(typeof p=="object"||typeof p=="function")&&typeof v=="function")return function(){v.apply(p,arguments)}}function _(p,v){var y=!1;function x(I){y||(y=!0,a.reject(p,I))}function A(I){y||(y=!0,a.resolve(p,I))}var E=m(function(){v(A,x)});E.status==="error"&&x(E.value)}function m(p,v){var y={};try{y.value=p(v),y.status="success"}catch(x){y.status="error",y.value=x}return y}(n.exports=u).prototype.finally=function(p){if(typeof p!="function")return this;var v=this.constructor;return this.then(function(y){return v.resolve(p()).then(function(){return y})},function(y){return v.resolve(p()).then(function(){throw y})})},u.prototype.catch=function(p){return this.then(null,p)},u.prototype.then=function(p,v){if(typeof p!="function"&&this.state===l||typeof v!="function"&&this.state===c)return this;var y=new this.constructor(o);return this.state!==h?d(y,this.state===l?p:v,this.outcome):this.queue.push(new f(y,p,v)),y},f.prototype.callFulfilled=function(p){a.resolve(this.promise,p)},f.prototype.otherCallFulfilled=function(p){d(this.promise,this.onFulfilled,p)},f.prototype.callRejected=function(p){a.reject(this.promise,p)},f.prototype.otherCallRejected=function(p){d(this.promise,this.onRejected,p)},a.resolve=function(p,v){var y=m(g,v);if(y.status==="error")return a.reject(p,y.value);var x=y.value;if(x)_(p,x);else{p.state=l,p.outcome=v;for(var A=-1,E=p.queue.length;++A<E;)p.queue[A].callFulfilled(v)}return p},a.reject=function(p,v){p.state=c,p.outcome=v;for(var y=-1,x=p.queue.length;++y<x;)p.queue[y].callRejected(v);return p},u.resolve=function(p){return p instanceof this?p:a.resolve(new this(o),p)},u.reject=function(p){var v=new this(o);return a.reject(v,p)},u.all=function(p){var v=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=p.length,x=!1;if(!y)return this.resolve([]);for(var A=new Array(y),E=0,I=-1,D=new this(o);++I<y;)b(p[I],I);return D;function b(C,B){v.resolve(C).then(function(R){A[B]=R,++E!==y||x||(x=!0,a.resolve(D,A))},function(R){x||(x=!0,a.reject(D,R))})}},u.race=function(p){var v=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=p.length,x=!1;if(!y)return this.resolve([]);for(var A=-1,E=new this(o);++A<y;)I=p[A],v.resolve(I).then(function(D){x||(x=!0,a.resolve(E,D))},function(D){x||(x=!0,a.reject(E,D))});var I;return E}},{immediate:36}],38:[function(t,n,i){var s={};(0,t("./lib/utils/common").assign)(s,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),n.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,n,i){var s=t("./zlib/deflate"),o=t("./utils/common"),a=t("./utils/strings"),c=t("./zlib/messages"),l=t("./zlib/zstream"),h=Object.prototype.toString,u=0,f=-1,d=0,g=8;function _(p){if(!(this instanceof _))return new _(p);this.options=o.assign({level:f,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},p||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var y=s.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(y!==u)throw new Error(c[y]);if(v.header&&s.deflateSetHeader(this.strm,v.header),v.dictionary){var x;if(x=typeof v.dictionary=="string"?a.string2buf(v.dictionary):h.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(y=s.deflateSetDictionary(this.strm,x))!==u)throw new Error(c[y]);this._dict_set=!0}}function m(p,v){var y=new _(v);if(y.push(p,!0),y.err)throw y.msg||c[y.err];return y.result}_.prototype.push=function(p,v){var y,x,A=this.strm,E=this.options.chunkSize;if(this.ended)return!1;x=v===~~v?v:v===!0?4:0,typeof p=="string"?A.input=a.string2buf(p):h.call(p)==="[object ArrayBuffer]"?A.input=new Uint8Array(p):A.input=p,A.next_in=0,A.avail_in=A.input.length;do{if(A.avail_out===0&&(A.output=new o.Buf8(E),A.next_out=0,A.avail_out=E),(y=s.deflate(A,x))!==1&&y!==u)return this.onEnd(y),!(this.ended=!0);A.avail_out!==0&&(A.avail_in!==0||x!==4&&x!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(o.shrinkBuf(A.output,A.next_out))):this.onData(o.shrinkBuf(A.output,A.next_out)))}while((0<A.avail_in||A.avail_out===0)&&y!==1);return x===4?(y=s.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===u):x!==2||(this.onEnd(u),!(A.avail_out=0))},_.prototype.onData=function(p){this.chunks.push(p)},_.prototype.onEnd=function(p){p===u&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},i.Deflate=_,i.deflate=m,i.deflateRaw=function(p,v){return(v=v||{}).raw=!0,m(p,v)},i.gzip=function(p,v){return(v=v||{}).gzip=!0,m(p,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,n,i){var s=t("./zlib/inflate"),o=t("./utils/common"),a=t("./utils/strings"),c=t("./zlib/constants"),l=t("./zlib/messages"),h=t("./zlib/zstream"),u=t("./zlib/gzheader"),f=Object.prototype.toString;function d(_){if(!(this instanceof d))return new d(_);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},_||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||_&&_.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&(15&m.windowBits)==0&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var p=s.inflateInit2(this.strm,m.windowBits);if(p!==c.Z_OK)throw new Error(l[p]);this.header=new u,s.inflateGetHeader(this.strm,this.header)}function g(_,m){var p=new d(m);if(p.push(_,!0),p.err)throw p.msg||l[p.err];return p.result}d.prototype.push=function(_,m){var p,v,y,x,A,E,I=this.strm,D=this.options.chunkSize,b=this.options.dictionary,C=!1;if(this.ended)return!1;v=m===~~m?m:m===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof _=="string"?I.input=a.binstring2buf(_):f.call(_)==="[object ArrayBuffer]"?I.input=new Uint8Array(_):I.input=_,I.next_in=0,I.avail_in=I.input.length;do{if(I.avail_out===0&&(I.output=new o.Buf8(D),I.next_out=0,I.avail_out=D),(p=s.inflate(I,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&b&&(E=typeof b=="string"?a.string2buf(b):f.call(b)==="[object ArrayBuffer]"?new Uint8Array(b):b,p=s.inflateSetDictionary(this.strm,E)),p===c.Z_BUF_ERROR&&C===!0&&(p=c.Z_OK,C=!1),p!==c.Z_STREAM_END&&p!==c.Z_OK)return this.onEnd(p),!(this.ended=!0);I.next_out&&(I.avail_out!==0&&p!==c.Z_STREAM_END&&(I.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=a.utf8border(I.output,I.next_out),x=I.next_out-y,A=a.buf2string(I.output,y),I.next_out=x,I.avail_out=D-x,x&&o.arraySet(I.output,I.output,y,x,0),this.onData(A)):this.onData(o.shrinkBuf(I.output,I.next_out)))),I.avail_in===0&&I.avail_out===0&&(C=!0)}while((0<I.avail_in||I.avail_out===0)&&p!==c.Z_STREAM_END);return p===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(p=s.inflateEnd(this.strm),this.onEnd(p),this.ended=!0,p===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(I.avail_out=0))},d.prototype.onData=function(_){this.chunks.push(_)},d.prototype.onEnd=function(_){_===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=_,this.msg=this.strm.msg},i.Inflate=d,i.inflate=g,i.inflateRaw=function(_,m){return(m=m||{}).raw=!0,g(_,m)},i.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(c){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var h=l.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var u in h)h.hasOwnProperty(u)&&(c[u]=h[u])}}return c},i.shrinkBuf=function(c,l){return c.length===l?c:c.subarray?c.subarray(0,l):(c.length=l,c)};var o={arraySet:function(c,l,h,u,f){if(l.subarray&&c.subarray)c.set(l.subarray(h,h+u),f);else for(var d=0;d<u;d++)c[f+d]=l[h+d]},flattenChunks:function(c){var l,h,u,f,d,g;for(l=u=0,h=c.length;l<h;l++)u+=c[l].length;for(g=new Uint8Array(u),l=f=0,h=c.length;l<h;l++)d=c[l],g.set(d,f),f+=d.length;return g}},a={arraySet:function(c,l,h,u,f){for(var d=0;d<u;d++)c[f+d]=l[h+d]},flattenChunks:function(c){return[].concat.apply([],c)}};i.setTyped=function(c){c?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,o)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(s)},{}],42:[function(t,n,i){var s=t("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var c=new s.Buf8(256),l=0;l<256;l++)c[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function h(u,f){if(f<65537&&(u.subarray&&a||!u.subarray&&o))return String.fromCharCode.apply(null,s.shrinkBuf(u,f));for(var d="",g=0;g<f;g++)d+=String.fromCharCode(u[g]);return d}c[254]=c[254]=1,i.string2buf=function(u){var f,d,g,_,m,p=u.length,v=0;for(_=0;_<p;_++)(64512&(d=u.charCodeAt(_)))==55296&&_+1<p&&(64512&(g=u.charCodeAt(_+1)))==56320&&(d=65536+(d-55296<<10)+(g-56320),_++),v+=d<128?1:d<2048?2:d<65536?3:4;for(f=new s.Buf8(v),_=m=0;m<v;_++)(64512&(d=u.charCodeAt(_)))==55296&&_+1<p&&(64512&(g=u.charCodeAt(_+1)))==56320&&(d=65536+(d-55296<<10)+(g-56320),_++),d<128?f[m++]=d:(d<2048?f[m++]=192|d>>>6:(d<65536?f[m++]=224|d>>>12:(f[m++]=240|d>>>18,f[m++]=128|d>>>12&63),f[m++]=128|d>>>6&63),f[m++]=128|63&d);return f},i.buf2binstring=function(u){return h(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),d=0,g=f.length;d<g;d++)f[d]=u.charCodeAt(d);return f},i.buf2string=function(u,f){var d,g,_,m,p=f||u.length,v=new Array(2*p);for(d=g=0;d<p;)if((_=u[d++])<128)v[g++]=_;else if(4<(m=c[_]))v[g++]=65533,d+=m-1;else{for(_&=m===2?31:m===3?15:7;1<m&&d<p;)_=_<<6|63&u[d++],m--;1<m?v[g++]=65533:_<65536?v[g++]=_:(_-=65536,v[g++]=55296|_>>10&1023,v[g++]=56320|1023&_)}return h(v,g)},i.utf8border=function(u,f){var d;for((f=f||u.length)>u.length&&(f=u.length),d=f-1;0<=d&&(192&u[d])==128;)d--;return d<0||d===0?f:d+c[u[d]]>f?d:f}},{"./common":41}],43:[function(t,n,i){n.exports=function(s,o,a,c){for(var l=65535&s|0,h=s>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3<a?2e3:a;h=h+(l=l+o[c++]|0)|0,--u;);l%=65521,h%=65521}return l|h<<16|0}},{}],44:[function(t,n,i){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,n,i){var s=function(){for(var o,a=[],c=0;c<256;c++){o=c;for(var l=0;l<8;l++)o=1&o?3988292384^o>>>1:o>>>1;a[c]=o}return a}();n.exports=function(o,a,c,l){var h=s,u=l+c;o^=-1;for(var f=l;f<u;f++)o=o>>>8^h[255&(o^a[f])];return-1^o}},{}],46:[function(t,n,i){var s,o=t("../utils/common"),a=t("./trees"),c=t("./adler32"),l=t("./crc32"),h=t("./messages"),u=0,f=4,d=0,g=-2,_=-1,m=4,p=2,v=8,y=9,x=286,A=30,E=19,I=2*x+1,D=15,b=3,C=258,B=C+b+1,R=42,O=113,M=1,z=2,X=3,H=4;function re(w,q){return w.msg=h[q],q}function $(w){return(w<<1)-(4<w?9:0)}function le(w){for(var q=w.length;0<=--q;)w[q]=0}function W(w){var q=w.state,k=q.pending;k>w.avail_out&&(k=w.avail_out),k!==0&&(o.arraySet(w.output,q.pending_buf,q.pending_out,k,w.next_out),w.next_out+=k,q.pending_out+=k,w.total_out+=k,w.avail_out-=k,q.pending-=k,q.pending===0&&(q.pending_out=0))}function Z(w,q){a._tr_flush_block(w,0<=w.block_start?w.block_start:-1,w.strstart-w.block_start,q),w.block_start=w.strstart,W(w.strm)}function ge(w,q){w.pending_buf[w.pending++]=q}function _e(w,q){w.pending_buf[w.pending++]=q>>>8&255,w.pending_buf[w.pending++]=255&q}function de(w,q){var k,N,S=w.max_chain_length,G=w.strstart,K=w.prev_length,ie=w.nice_match,V=w.strstart>w.w_size-B?w.strstart-(w.w_size-B):0,P=w.window,T=w.w_mask,F=w.prev,Q=w.strstart+C,ce=P[G+K-1],te=P[G+K];w.prev_length>=w.good_match&&(S>>=2),ie>w.lookahead&&(ie=w.lookahead);do if(P[(k=q)+K]===te&&P[k+K-1]===ce&&P[k]===P[G]&&P[++k]===P[G+1]){G+=2,k++;do;while(P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&G<Q);if(N=C-(Q-G),G=Q-C,K<N){if(w.match_start=q,ie<=(K=N))break;ce=P[G+K-1],te=P[G+K]}}while((q=F[q&T])>V&&--S!=0);return K<=w.lookahead?K:w.lookahead}function oe(w){var q,k,N,S,G,K,ie,V,P,T,F=w.w_size;do{if(S=w.window_size-w.lookahead-w.strstart,w.strstart>=F+(F-B)){for(o.arraySet(w.window,w.window,F,F,0),w.match_start-=F,w.strstart-=F,w.block_start-=F,q=k=w.hash_size;N=w.head[--q],w.head[q]=F<=N?N-F:0,--k;);for(q=k=F;N=w.prev[--q],w.prev[q]=F<=N?N-F:0,--k;);S+=F}if(w.strm.avail_in===0)break;if(K=w.strm,ie=w.window,V=w.strstart+w.lookahead,P=S,T=void 0,T=K.avail_in,P<T&&(T=P),k=T===0?0:(K.avail_in-=T,o.arraySet(ie,K.input,K.next_in,T,V),K.state.wrap===1?K.adler=c(K.adler,ie,T,V):K.state.wrap===2&&(K.adler=l(K.adler,ie,T,V)),K.next_in+=T,K.total_in+=T,T),w.lookahead+=k,w.lookahead+w.insert>=b)for(G=w.strstart-w.insert,w.ins_h=w.window[G],w.ins_h=(w.ins_h<<w.hash_shift^w.window[G+1])&w.hash_mask;w.insert&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[G+b-1])&w.hash_mask,w.prev[G&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=G,G++,w.insert--,!(w.lookahead+w.insert<b)););}while(w.lookahead<B&&w.strm.avail_in!==0)}function ee(w,q){for(var k,N;;){if(w.lookahead<B){if(oe(w),w.lookahead<B&&q===u)return M;if(w.lookahead===0)break}if(k=0,w.lookahead>=b&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+b-1])&w.hash_mask,k=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),k!==0&&w.strstart-k<=w.w_size-B&&(w.match_length=de(w,k)),w.match_length>=b)if(N=a._tr_tally(w,w.strstart-w.match_start,w.match_length-b),w.lookahead-=w.match_length,w.match_length<=w.max_lazy_match&&w.lookahead>=b){for(w.match_length--;w.strstart++,w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+b-1])&w.hash_mask,k=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart,--w.match_length!=0;);w.strstart++}else w.strstart+=w.match_length,w.match_length=0,w.ins_h=w.window[w.strstart],w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+1])&w.hash_mask;else N=a._tr_tally(w,0,w.window[w.strstart]),w.lookahead--,w.strstart++;if(N&&(Z(w,!1),w.strm.avail_out===0))return M}return w.insert=w.strstart<b-1?w.strstart:b-1,q===f?(Z(w,!0),w.strm.avail_out===0?X:H):w.last_lit&&(Z(w,!1),w.strm.avail_out===0)?M:z}function pe(w,q){for(var k,N,S;;){if(w.lookahead<B){if(oe(w),w.lookahead<B&&q===u)return M;if(w.lookahead===0)break}if(k=0,w.lookahead>=b&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+b-1])&w.hash_mask,k=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),w.prev_length=w.match_length,w.prev_match=w.match_start,w.match_length=b-1,k!==0&&w.prev_length<w.max_lazy_match&&w.strstart-k<=w.w_size-B&&(w.match_length=de(w,k),w.match_length<=5&&(w.strategy===1||w.match_length===b&&4096<w.strstart-w.match_start)&&(w.match_length=b-1)),w.prev_length>=b&&w.match_length<=w.prev_length){for(S=w.strstart+w.lookahead-b,N=a._tr_tally(w,w.strstart-1-w.prev_match,w.prev_length-b),w.lookahead-=w.prev_length-1,w.prev_length-=2;++w.strstart<=S&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+b-1])&w.hash_mask,k=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),--w.prev_length!=0;);if(w.match_available=0,w.match_length=b-1,w.strstart++,N&&(Z(w,!1),w.strm.avail_out===0))return M}else if(w.match_available){if((N=a._tr_tally(w,0,w.window[w.strstart-1]))&&Z(w,!1),w.strstart++,w.lookahead--,w.strm.avail_out===0)return M}else w.match_available=1,w.strstart++,w.lookahead--}return w.match_available&&(N=a._tr_tally(w,0,w.window[w.strstart-1]),w.match_available=0),w.insert=w.strstart<b-1?w.strstart:b-1,q===f?(Z(w,!0),w.strm.avail_out===0?X:H):w.last_lit&&(Z(w,!1),w.strm.avail_out===0)?M:z}function ye(w,q,k,N,S){this.good_length=w,this.max_lazy=q,this.nice_length=k,this.max_chain=N,this.func=S}function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*I),this.dyn_dtree=new o.Buf16(2*(2*A+1)),this.bl_tree=new o.Buf16(2*(2*E+1)),le(this.dyn_ltree),le(this.dyn_dtree),le(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(D+1),this.heap=new o.Buf16(2*x+1),le(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*x+1),le(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ze(w){var q;return w&&w.state?(w.total_in=w.total_out=0,w.data_type=p,(q=w.state).pending=0,q.pending_out=0,q.wrap<0&&(q.wrap=-q.wrap),q.status=q.wrap?R:O,w.adler=q.wrap===2?0:1,q.last_flush=u,a._tr_init(q),d):re(w,g)}function je(w){var q=ze(w);return q===d&&function(k){k.window_size=2*k.w_size,le(k.head),k.max_lazy_match=s[k.level].max_lazy,k.good_match=s[k.level].good_length,k.nice_match=s[k.level].nice_length,k.max_chain_length=s[k.level].max_chain,k.strstart=0,k.block_start=0,k.lookahead=0,k.insert=0,k.match_length=k.prev_length=b-1,k.match_available=0,k.ins_h=0}(w.state),q}function He(w,q,k,N,S,G){if(!w)return g;var K=1;if(q===_&&(q=6),N<0?(K=0,N=-N):15<N&&(K=2,N-=16),S<1||y<S||k!==v||N<8||15<N||q<0||9<q||G<0||m<G)return re(w,g);N===8&&(N=9);var ie=new Ae;return(w.state=ie).strm=w,ie.wrap=K,ie.gzhead=null,ie.w_bits=N,ie.w_size=1<<ie.w_bits,ie.w_mask=ie.w_size-1,ie.hash_bits=S+7,ie.hash_size=1<<ie.hash_bits,ie.hash_mask=ie.hash_size-1,ie.hash_shift=~~((ie.hash_bits+b-1)/b),ie.window=new o.Buf8(2*ie.w_size),ie.head=new o.Buf16(ie.hash_size),ie.prev=new o.Buf16(ie.w_size),ie.lit_bufsize=1<<S+6,ie.pending_buf_size=4*ie.lit_bufsize,ie.pending_buf=new o.Buf8(ie.pending_buf_size),ie.d_buf=1*ie.lit_bufsize,ie.l_buf=3*ie.lit_bufsize,ie.level=q,ie.strategy=G,ie.method=k,je(w)}s=[new ye(0,0,0,0,function(w,q){var k=65535;for(k>w.pending_buf_size-5&&(k=w.pending_buf_size-5);;){if(w.lookahead<=1){if(oe(w),w.lookahead===0&&q===u)return M;if(w.lookahead===0)break}w.strstart+=w.lookahead,w.lookahead=0;var N=w.block_start+k;if((w.strstart===0||w.strstart>=N)&&(w.lookahead=w.strstart-N,w.strstart=N,Z(w,!1),w.strm.avail_out===0)||w.strstart-w.block_start>=w.w_size-B&&(Z(w,!1),w.strm.avail_out===0))return M}return w.insert=0,q===f?(Z(w,!0),w.strm.avail_out===0?X:H):(w.strstart>w.block_start&&(Z(w,!1),w.strm.avail_out),M)}),new ye(4,4,8,4,ee),new ye(4,5,16,8,ee),new ye(4,6,32,32,ee),new ye(4,4,16,16,pe),new ye(8,16,32,32,pe),new ye(8,16,128,128,pe),new ye(8,32,128,256,pe),new ye(32,128,258,1024,pe),new ye(32,258,258,4096,pe)],i.deflateInit=function(w,q){return He(w,q,v,15,8,0)},i.deflateInit2=He,i.deflateReset=je,i.deflateResetKeep=ze,i.deflateSetHeader=function(w,q){return w&&w.state?w.state.wrap!==2?g:(w.state.gzhead=q,d):g},i.deflate=function(w,q){var k,N,S,G;if(!w||!w.state||5<q||q<0)return w?re(w,g):g;if(N=w.state,!w.output||!w.input&&w.avail_in!==0||N.status===666&&q!==f)return re(w,w.avail_out===0?-5:g);if(N.strm=w,k=N.last_flush,N.last_flush=q,N.status===R)if(N.wrap===2)w.adler=0,ge(N,31),ge(N,139),ge(N,8),N.gzhead?(ge(N,(N.gzhead.text?1:0)+(N.gzhead.hcrc?2:0)+(N.gzhead.extra?4:0)+(N.gzhead.name?8:0)+(N.gzhead.comment?16:0)),ge(N,255&N.gzhead.time),ge(N,N.gzhead.time>>8&255),ge(N,N.gzhead.time>>16&255),ge(N,N.gzhead.time>>24&255),ge(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),ge(N,255&N.gzhead.os),N.gzhead.extra&&N.gzhead.extra.length&&(ge(N,255&N.gzhead.extra.length),ge(N,N.gzhead.extra.length>>8&255)),N.gzhead.hcrc&&(w.adler=l(w.adler,N.pending_buf,N.pending,0)),N.gzindex=0,N.status=69):(ge(N,0),ge(N,0),ge(N,0),ge(N,0),ge(N,0),ge(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),ge(N,3),N.status=O);else{var K=v+(N.w_bits-8<<4)<<8;K|=(2<=N.strategy||N.level<2?0:N.level<6?1:N.level===6?2:3)<<6,N.strstart!==0&&(K|=32),K+=31-K%31,N.status=O,_e(N,K),N.strstart!==0&&(_e(N,w.adler>>>16),_e(N,65535&w.adler)),w.adler=1}if(N.status===69)if(N.gzhead.extra){for(S=N.pending;N.gzindex<(65535&N.gzhead.extra.length)&&(N.pending!==N.pending_buf_size||(N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),W(w),S=N.pending,N.pending!==N.pending_buf_size));)ge(N,255&N.gzhead.extra[N.gzindex]),N.gzindex++;N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),N.gzindex===N.gzhead.extra.length&&(N.gzindex=0,N.status=73)}else N.status=73;if(N.status===73)if(N.gzhead.name){S=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),W(w),S=N.pending,N.pending===N.pending_buf_size)){G=1;break}G=N.gzindex<N.gzhead.name.length?255&N.gzhead.name.charCodeAt(N.gzindex++):0,ge(N,G)}while(G!==0);N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),G===0&&(N.gzindex=0,N.status=91)}else N.status=91;if(N.status===91)if(N.gzhead.comment){S=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),W(w),S=N.pending,N.pending===N.pending_buf_size)){G=1;break}G=N.gzindex<N.gzhead.comment.length?255&N.gzhead.comment.charCodeAt(N.gzindex++):0,ge(N,G)}while(G!==0);N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),G===0&&(N.status=103)}else N.status=103;if(N.status===103&&(N.gzhead.hcrc?(N.pending+2>N.pending_buf_size&&W(w),N.pending+2<=N.pending_buf_size&&(ge(N,255&w.adler),ge(N,w.adler>>8&255),w.adler=0,N.status=O)):N.status=O),N.pending!==0){if(W(w),w.avail_out===0)return N.last_flush=-1,d}else if(w.avail_in===0&&$(q)<=$(k)&&q!==f)return re(w,-5);if(N.status===666&&w.avail_in!==0)return re(w,-5);if(w.avail_in!==0||N.lookahead!==0||q!==u&&N.status!==666){var ie=N.strategy===2?function(V,P){for(var T;;){if(V.lookahead===0&&(oe(V),V.lookahead===0)){if(P===u)return M;break}if(V.match_length=0,T=a._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++,T&&(Z(V,!1),V.strm.avail_out===0))return M}return V.insert=0,P===f?(Z(V,!0),V.strm.avail_out===0?X:H):V.last_lit&&(Z(V,!1),V.strm.avail_out===0)?M:z}(N,q):N.strategy===3?function(V,P){for(var T,F,Q,ce,te=V.window;;){if(V.lookahead<=C){if(oe(V),V.lookahead<=C&&P===u)return M;if(V.lookahead===0)break}if(V.match_length=0,V.lookahead>=b&&0<V.strstart&&(F=te[Q=V.strstart-1])===te[++Q]&&F===te[++Q]&&F===te[++Q]){ce=V.strstart+C;do;while(F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&Q<ce);V.match_length=C-(ce-Q),V.match_length>V.lookahead&&(V.match_length=V.lookahead)}if(V.match_length>=b?(T=a._tr_tally(V,1,V.match_length-b),V.lookahead-=V.match_length,V.strstart+=V.match_length,V.match_length=0):(T=a._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++),T&&(Z(V,!1),V.strm.avail_out===0))return M}return V.insert=0,P===f?(Z(V,!0),V.strm.avail_out===0?X:H):V.last_lit&&(Z(V,!1),V.strm.avail_out===0)?M:z}(N,q):s[N.level].func(N,q);if(ie!==X&&ie!==H||(N.status=666),ie===M||ie===X)return w.avail_out===0&&(N.last_flush=-1),d;if(ie===z&&(q===1?a._tr_align(N):q!==5&&(a._tr_stored_block(N,0,0,!1),q===3&&(le(N.head),N.lookahead===0&&(N.strstart=0,N.block_start=0,N.insert=0))),W(w),w.avail_out===0))return N.last_flush=-1,d}return q!==f?d:N.wrap<=0?1:(N.wrap===2?(ge(N,255&w.adler),ge(N,w.adler>>8&255),ge(N,w.adler>>16&255),ge(N,w.adler>>24&255),ge(N,255&w.total_in),ge(N,w.total_in>>8&255),ge(N,w.total_in>>16&255),ge(N,w.total_in>>24&255)):(_e(N,w.adler>>>16),_e(N,65535&w.adler)),W(w),0<N.wrap&&(N.wrap=-N.wrap),N.pending!==0?d:1)},i.deflateEnd=function(w){var q;return w&&w.state?(q=w.state.status)!==R&&q!==69&&q!==73&&q!==91&&q!==103&&q!==O&&q!==666?re(w,g):(w.state=null,q===O?re(w,-3):d):g},i.deflateSetDictionary=function(w,q){var k,N,S,G,K,ie,V,P,T=q.length;if(!w||!w.state||(G=(k=w.state).wrap)===2||G===1&&k.status!==R||k.lookahead)return g;for(G===1&&(w.adler=c(w.adler,q,T,0)),k.wrap=0,T>=k.w_size&&(G===0&&(le(k.head),k.strstart=0,k.block_start=0,k.insert=0),P=new o.Buf8(k.w_size),o.arraySet(P,q,T-k.w_size,k.w_size,0),q=P,T=k.w_size),K=w.avail_in,ie=w.next_in,V=w.input,w.avail_in=T,w.next_in=0,w.input=q,oe(k);k.lookahead>=b;){for(N=k.strstart,S=k.lookahead-(b-1);k.ins_h=(k.ins_h<<k.hash_shift^k.window[N+b-1])&k.hash_mask,k.prev[N&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=N,N++,--S;);k.strstart=N,k.lookahead=b-1,oe(k)}return k.strstart+=k.lookahead,k.block_start=k.strstart,k.insert=k.lookahead,k.lookahead=0,k.match_length=k.prev_length=b-1,k.match_available=0,w.next_in=ie,w.input=V,w.avail_in=K,k.wrap=G,d},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,n,i){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,n,i){n.exports=function(s,o){var a,c,l,h,u,f,d,g,_,m,p,v,y,x,A,E,I,D,b,C,B,R,O,M,z;a=s.state,c=s.next_in,M=s.input,l=c+(s.avail_in-5),h=s.next_out,z=s.output,u=h-(o-s.avail_out),f=h+(s.avail_out-257),d=a.dmax,g=a.wsize,_=a.whave,m=a.wnext,p=a.window,v=a.hold,y=a.bits,x=a.lencode,A=a.distcode,E=(1<<a.lenbits)-1,I=(1<<a.distbits)-1;e:do{y<15&&(v+=M[c++]<<y,y+=8,v+=M[c++]<<y,y+=8),D=x[v&E];t:for(;;){if(v>>>=b=D>>>24,y-=b,(b=D>>>16&255)===0)z[h++]=65535&D;else{if(!(16&b)){if((64&b)==0){D=x[(65535&D)+(v&(1<<b)-1)];continue t}if(32&b){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}C=65535&D,(b&=15)&&(y<b&&(v+=M[c++]<<y,y+=8),C+=v&(1<<b)-1,v>>>=b,y-=b),y<15&&(v+=M[c++]<<y,y+=8,v+=M[c++]<<y,y+=8),D=A[v&I];n:for(;;){if(v>>>=b=D>>>24,y-=b,!(16&(b=D>>>16&255))){if((64&b)==0){D=A[(65535&D)+(v&(1<<b)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if(B=65535&D,y<(b&=15)&&(v+=M[c++]<<y,(y+=8)<b&&(v+=M[c++]<<y,y+=8)),d<(B+=v&(1<<b)-1)){s.msg="invalid distance too far back",a.mode=30;break e}if(v>>>=b,y-=b,(b=h-u)<B){if(_<(b=B-b)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(O=p,(R=0)===m){if(R+=g-b,b<C){for(C-=b;z[h++]=p[R++],--b;);R=h-B,O=z}}else if(m<b){if(R+=g+m-b,(b-=m)<C){for(C-=b;z[h++]=p[R++],--b;);if(R=0,m<C){for(C-=b=m;z[h++]=p[R++],--b;);R=h-B,O=z}}}else if(R+=m-b,b<C){for(C-=b;z[h++]=p[R++],--b;);R=h-B,O=z}for(;2<C;)z[h++]=O[R++],z[h++]=O[R++],z[h++]=O[R++],C-=3;C&&(z[h++]=O[R++],1<C&&(z[h++]=O[R++]))}else{for(R=h-B;z[h++]=z[R++],z[h++]=z[R++],z[h++]=z[R++],2<(C-=3););C&&(z[h++]=z[R++],1<C&&(z[h++]=z[R++]))}break}}break}}while(c<l&&h<f);c-=C=y>>3,v&=(1<<(y-=C<<3))-1,s.next_in=c,s.next_out=h,s.avail_in=c<l?l-c+5:5-(c-l),s.avail_out=h<f?f-h+257:257-(h-f),a.hold=v,a.bits=y}},{}],49:[function(t,n,i){var s=t("../utils/common"),o=t("./adler32"),a=t("./crc32"),c=t("./inffast"),l=t("./inftrees"),h=1,u=2,f=0,d=-2,g=1,_=852,m=592;function p(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(R){var O;return R&&R.state?(O=R.state,R.total_in=R.total_out=O.total=0,R.msg="",O.wrap&&(R.adler=1&O.wrap),O.mode=g,O.last=0,O.havedict=0,O.dmax=32768,O.head=null,O.hold=0,O.bits=0,O.lencode=O.lendyn=new s.Buf32(_),O.distcode=O.distdyn=new s.Buf32(m),O.sane=1,O.back=-1,f):d}function x(R){var O;return R&&R.state?((O=R.state).wsize=0,O.whave=0,O.wnext=0,y(R)):d}function A(R,O){var M,z;return R&&R.state?(z=R.state,O<0?(M=0,O=-O):(M=1+(O>>4),O<48&&(O&=15)),O&&(O<8||15<O)?d:(z.window!==null&&z.wbits!==O&&(z.window=null),z.wrap=M,z.wbits=O,x(R))):d}function E(R,O){var M,z;return R?(z=new v,(R.state=z).window=null,(M=A(R,O))!==f&&(R.state=null),M):d}var I,D,b=!0;function C(R){if(b){var O;for(I=new s.Buf32(512),D=new s.Buf32(32),O=0;O<144;)R.lens[O++]=8;for(;O<256;)R.lens[O++]=9;for(;O<280;)R.lens[O++]=7;for(;O<288;)R.lens[O++]=8;for(l(h,R.lens,0,288,I,0,R.work,{bits:9}),O=0;O<32;)R.lens[O++]=5;l(u,R.lens,0,32,D,0,R.work,{bits:5}),b=!1}R.lencode=I,R.lenbits=9,R.distcode=D,R.distbits=5}function B(R,O,M,z){var X,H=R.state;return H.window===null&&(H.wsize=1<<H.wbits,H.wnext=0,H.whave=0,H.window=new s.Buf8(H.wsize)),z>=H.wsize?(s.arraySet(H.window,O,M-H.wsize,H.wsize,0),H.wnext=0,H.whave=H.wsize):(z<(X=H.wsize-H.wnext)&&(X=z),s.arraySet(H.window,O,M-z,X,H.wnext),(z-=X)?(s.arraySet(H.window,O,M-z,z,0),H.wnext=z,H.whave=H.wsize):(H.wnext+=X,H.wnext===H.wsize&&(H.wnext=0),H.whave<H.wsize&&(H.whave+=X))),0}i.inflateReset=x,i.inflateReset2=A,i.inflateResetKeep=y,i.inflateInit=function(R){return E(R,15)},i.inflateInit2=E,i.inflate=function(R,O){var M,z,X,H,re,$,le,W,Z,ge,_e,de,oe,ee,pe,ye,Ae,ze,je,He,w,q,k,N,S=0,G=new s.Buf8(4),K=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return d;(M=R.state).mode===12&&(M.mode=13),re=R.next_out,X=R.output,le=R.avail_out,H=R.next_in,z=R.input,$=R.avail_in,W=M.hold,Z=M.bits,ge=$,_e=le,q=f;e:for(;;)switch(M.mode){case g:if(M.wrap===0){M.mode=13;break}for(;Z<16;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if(2&M.wrap&&W===35615){G[M.check=0]=255&W,G[1]=W>>>8&255,M.check=a(M.check,G,2,0),Z=W=0,M.mode=2;break}if(M.flags=0,M.head&&(M.head.done=!1),!(1&M.wrap)||(((255&W)<<8)+(W>>8))%31){R.msg="incorrect header check",M.mode=30;break}if((15&W)!=8){R.msg="unknown compression method",M.mode=30;break}if(Z-=4,w=8+(15&(W>>>=4)),M.wbits===0)M.wbits=w;else if(w>M.wbits){R.msg="invalid window size",M.mode=30;break}M.dmax=1<<w,R.adler=M.check=1,M.mode=512&W?10:12,Z=W=0;break;case 2:for(;Z<16;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if(M.flags=W,(255&M.flags)!=8){R.msg="unknown compression method",M.mode=30;break}if(57344&M.flags){R.msg="unknown header flags set",M.mode=30;break}M.head&&(M.head.text=W>>8&1),512&M.flags&&(G[0]=255&W,G[1]=W>>>8&255,M.check=a(M.check,G,2,0)),Z=W=0,M.mode=3;case 3:for(;Z<32;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}M.head&&(M.head.time=W),512&M.flags&&(G[0]=255&W,G[1]=W>>>8&255,G[2]=W>>>16&255,G[3]=W>>>24&255,M.check=a(M.check,G,4,0)),Z=W=0,M.mode=4;case 4:for(;Z<16;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}M.head&&(M.head.xflags=255&W,M.head.os=W>>8),512&M.flags&&(G[0]=255&W,G[1]=W>>>8&255,M.check=a(M.check,G,2,0)),Z=W=0,M.mode=5;case 5:if(1024&M.flags){for(;Z<16;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}M.length=W,M.head&&(M.head.extra_len=W),512&M.flags&&(G[0]=255&W,G[1]=W>>>8&255,M.check=a(M.check,G,2,0)),Z=W=0}else M.head&&(M.head.extra=null);M.mode=6;case 6:if(1024&M.flags&&($<(de=M.length)&&(de=$),de&&(M.head&&(w=M.head.extra_len-M.length,M.head.extra||(M.head.extra=new Array(M.head.extra_len)),s.arraySet(M.head.extra,z,H,de,w)),512&M.flags&&(M.check=a(M.check,z,de,H)),$-=de,H+=de,M.length-=de),M.length))break e;M.length=0,M.mode=7;case 7:if(2048&M.flags){if($===0)break e;for(de=0;w=z[H+de++],M.head&&w&&M.length<65536&&(M.head.name+=String.fromCharCode(w)),w&&de<$;);if(512&M.flags&&(M.check=a(M.check,z,de,H)),$-=de,H+=de,w)break e}else M.head&&(M.head.name=null);M.length=0,M.mode=8;case 8:if(4096&M.flags){if($===0)break e;for(de=0;w=z[H+de++],M.head&&w&&M.length<65536&&(M.head.comment+=String.fromCharCode(w)),w&&de<$;);if(512&M.flags&&(M.check=a(M.check,z,de,H)),$-=de,H+=de,w)break e}else M.head&&(M.head.comment=null);M.mode=9;case 9:if(512&M.flags){for(;Z<16;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if(W!==(65535&M.check)){R.msg="header crc mismatch",M.mode=30;break}Z=W=0}M.head&&(M.head.hcrc=M.flags>>9&1,M.head.done=!0),R.adler=M.check=0,M.mode=12;break;case 10:for(;Z<32;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}R.adler=M.check=p(W),Z=W=0,M.mode=11;case 11:if(M.havedict===0)return R.next_out=re,R.avail_out=le,R.next_in=H,R.avail_in=$,M.hold=W,M.bits=Z,2;R.adler=M.check=1,M.mode=12;case 12:if(O===5||O===6)break e;case 13:if(M.last){W>>>=7&Z,Z-=7&Z,M.mode=27;break}for(;Z<3;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}switch(M.last=1&W,Z-=1,3&(W>>>=1)){case 0:M.mode=14;break;case 1:if(C(M),M.mode=20,O!==6)break;W>>>=2,Z-=2;break e;case 2:M.mode=17;break;case 3:R.msg="invalid block type",M.mode=30}W>>>=2,Z-=2;break;case 14:for(W>>>=7&Z,Z-=7&Z;Z<32;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if((65535&W)!=(W>>>16^65535)){R.msg="invalid stored block lengths",M.mode=30;break}if(M.length=65535&W,Z=W=0,M.mode=15,O===6)break e;case 15:M.mode=16;case 16:if(de=M.length){if($<de&&(de=$),le<de&&(de=le),de===0)break e;s.arraySet(X,z,H,de,re),$-=de,H+=de,le-=de,re+=de,M.length-=de;break}M.mode=12;break;case 17:for(;Z<14;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if(M.nlen=257+(31&W),W>>>=5,Z-=5,M.ndist=1+(31&W),W>>>=5,Z-=5,M.ncode=4+(15&W),W>>>=4,Z-=4,286<M.nlen||30<M.ndist){R.msg="too many length or distance symbols",M.mode=30;break}M.have=0,M.mode=18;case 18:for(;M.have<M.ncode;){for(;Z<3;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}M.lens[K[M.have++]]=7&W,W>>>=3,Z-=3}for(;M.have<19;)M.lens[K[M.have++]]=0;if(M.lencode=M.lendyn,M.lenbits=7,k={bits:M.lenbits},q=l(0,M.lens,0,19,M.lencode,0,M.work,k),M.lenbits=k.bits,q){R.msg="invalid code lengths set",M.mode=30;break}M.have=0,M.mode=19;case 19:for(;M.have<M.nlen+M.ndist;){for(;ye=(S=M.lencode[W&(1<<M.lenbits)-1])>>>16&255,Ae=65535&S,!((pe=S>>>24)<=Z);){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if(Ae<16)W>>>=pe,Z-=pe,M.lens[M.have++]=Ae;else{if(Ae===16){for(N=pe+2;Z<N;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if(W>>>=pe,Z-=pe,M.have===0){R.msg="invalid bit length repeat",M.mode=30;break}w=M.lens[M.have-1],de=3+(3&W),W>>>=2,Z-=2}else if(Ae===17){for(N=pe+3;Z<N;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}Z-=pe,w=0,de=3+(7&(W>>>=pe)),W>>>=3,Z-=3}else{for(N=pe+7;Z<N;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}Z-=pe,w=0,de=11+(127&(W>>>=pe)),W>>>=7,Z-=7}if(M.have+de>M.nlen+M.ndist){R.msg="invalid bit length repeat",M.mode=30;break}for(;de--;)M.lens[M.have++]=w}}if(M.mode===30)break;if(M.lens[256]===0){R.msg="invalid code -- missing end-of-block",M.mode=30;break}if(M.lenbits=9,k={bits:M.lenbits},q=l(h,M.lens,0,M.nlen,M.lencode,0,M.work,k),M.lenbits=k.bits,q){R.msg="invalid literal/lengths set",M.mode=30;break}if(M.distbits=6,M.distcode=M.distdyn,k={bits:M.distbits},q=l(u,M.lens,M.nlen,M.ndist,M.distcode,0,M.work,k),M.distbits=k.bits,q){R.msg="invalid distances set",M.mode=30;break}if(M.mode=20,O===6)break e;case 20:M.mode=21;case 21:if(6<=$&&258<=le){R.next_out=re,R.avail_out=le,R.next_in=H,R.avail_in=$,M.hold=W,M.bits=Z,c(R,_e),re=R.next_out,X=R.output,le=R.avail_out,H=R.next_in,z=R.input,$=R.avail_in,W=M.hold,Z=M.bits,M.mode===12&&(M.back=-1);break}for(M.back=0;ye=(S=M.lencode[W&(1<<M.lenbits)-1])>>>16&255,Ae=65535&S,!((pe=S>>>24)<=Z);){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if(ye&&(240&ye)==0){for(ze=pe,je=ye,He=Ae;ye=(S=M.lencode[He+((W&(1<<ze+je)-1)>>ze)])>>>16&255,Ae=65535&S,!(ze+(pe=S>>>24)<=Z);){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}W>>>=ze,Z-=ze,M.back+=ze}if(W>>>=pe,Z-=pe,M.back+=pe,M.length=Ae,ye===0){M.mode=26;break}if(32&ye){M.back=-1,M.mode=12;break}if(64&ye){R.msg="invalid literal/length code",M.mode=30;break}M.extra=15&ye,M.mode=22;case 22:if(M.extra){for(N=M.extra;Z<N;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}M.length+=W&(1<<M.extra)-1,W>>>=M.extra,Z-=M.extra,M.back+=M.extra}M.was=M.length,M.mode=23;case 23:for(;ye=(S=M.distcode[W&(1<<M.distbits)-1])>>>16&255,Ae=65535&S,!((pe=S>>>24)<=Z);){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if((240&ye)==0){for(ze=pe,je=ye,He=Ae;ye=(S=M.distcode[He+((W&(1<<ze+je)-1)>>ze)])>>>16&255,Ae=65535&S,!(ze+(pe=S>>>24)<=Z);){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}W>>>=ze,Z-=ze,M.back+=ze}if(W>>>=pe,Z-=pe,M.back+=pe,64&ye){R.msg="invalid distance code",M.mode=30;break}M.offset=Ae,M.extra=15&ye,M.mode=24;case 24:if(M.extra){for(N=M.extra;Z<N;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}M.offset+=W&(1<<M.extra)-1,W>>>=M.extra,Z-=M.extra,M.back+=M.extra}if(M.offset>M.dmax){R.msg="invalid distance too far back",M.mode=30;break}M.mode=25;case 25:if(le===0)break e;if(de=_e-le,M.offset>de){if((de=M.offset-de)>M.whave&&M.sane){R.msg="invalid distance too far back",M.mode=30;break}oe=de>M.wnext?(de-=M.wnext,M.wsize-de):M.wnext-de,de>M.length&&(de=M.length),ee=M.window}else ee=X,oe=re-M.offset,de=M.length;for(le<de&&(de=le),le-=de,M.length-=de;X[re++]=ee[oe++],--de;);M.length===0&&(M.mode=21);break;case 26:if(le===0)break e;X[re++]=M.length,le--,M.mode=21;break;case 27:if(M.wrap){for(;Z<32;){if($===0)break e;$--,W|=z[H++]<<Z,Z+=8}if(_e-=le,R.total_out+=_e,M.total+=_e,_e&&(R.adler=M.check=M.flags?a(M.check,X,_e,re-_e):o(M.check,X,_e,re-_e)),_e=le,(M.flags?W:p(W))!==M.check){R.msg="incorrect data check",M.mode=30;break}Z=W=0}M.mode=28;case 28:if(M.wrap&&M.flags){for(;Z<32;){if($===0)break e;$--,W+=z[H++]<<Z,Z+=8}if(W!==(4294967295&M.total)){R.msg="incorrect length check",M.mode=30;break}Z=W=0}M.mode=29;case 29:q=1;break e;case 30:q=-3;break e;case 31:return-4;case 32:default:return d}return R.next_out=re,R.avail_out=le,R.next_in=H,R.avail_in=$,M.hold=W,M.bits=Z,(M.wsize||_e!==R.avail_out&&M.mode<30&&(M.mode<27||O!==4))&&B(R,R.output,R.next_out,_e-R.avail_out)?(M.mode=31,-4):(ge-=R.avail_in,_e-=R.avail_out,R.total_in+=ge,R.total_out+=_e,M.total+=_e,M.wrap&&_e&&(R.adler=M.check=M.flags?a(M.check,X,_e,R.next_out-_e):o(M.check,X,_e,R.next_out-_e)),R.data_type=M.bits+(M.last?64:0)+(M.mode===12?128:0)+(M.mode===20||M.mode===15?256:0),(ge==0&&_e===0||O===4)&&q===f&&(q=-5),q)},i.inflateEnd=function(R){if(!R||!R.state)return d;var O=R.state;return O.window&&(O.window=null),R.state=null,f},i.inflateGetHeader=function(R,O){var M;return R&&R.state?(2&(M=R.state).wrap)==0?d:((M.head=O).done=!1,f):d},i.inflateSetDictionary=function(R,O){var M,z=O.length;return R&&R.state?(M=R.state).wrap!==0&&M.mode!==11?d:M.mode===11&&o(1,O,z,0)!==M.check?-3:B(R,O,z,z)?(M.mode=31,-4):(M.havedict=1,f):d},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,n,i){var s=t("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(h,u,f,d,g,_,m,p){var v,y,x,A,E,I,D,b,C,B=p.bits,R=0,O=0,M=0,z=0,X=0,H=0,re=0,$=0,le=0,W=0,Z=null,ge=0,_e=new s.Buf16(16),de=new s.Buf16(16),oe=null,ee=0;for(R=0;R<=15;R++)_e[R]=0;for(O=0;O<d;O++)_e[u[f+O]]++;for(X=B,z=15;1<=z&&_e[z]===0;z--);if(z<X&&(X=z),z===0)return g[_++]=20971520,g[_++]=20971520,p.bits=1,0;for(M=1;M<z&&_e[M]===0;M++);for(X<M&&(X=M),R=$=1;R<=15;R++)if($<<=1,($-=_e[R])<0)return-1;if(0<$&&(h===0||z!==1))return-1;for(de[1]=0,R=1;R<15;R++)de[R+1]=de[R]+_e[R];for(O=0;O<d;O++)u[f+O]!==0&&(m[de[u[f+O]]++]=O);if(I=h===0?(Z=oe=m,19):h===1?(Z=o,ge-=257,oe=a,ee-=257,256):(Z=c,oe=l,-1),R=M,E=_,re=O=W=0,x=-1,A=(le=1<<(H=X))-1,h===1&&852<le||h===2&&592<le)return 1;for(;;){for(D=R-re,C=m[O]<I?(b=0,m[O]):m[O]>I?(b=oe[ee+m[O]],Z[ge+m[O]]):(b=96,0),v=1<<R-re,M=y=1<<H;g[E+(W>>re)+(y-=v)]=D<<24|b<<16|C|0,y!==0;);for(v=1<<R-1;W&v;)v>>=1;if(v!==0?(W&=v-1,W+=v):W=0,O++,--_e[R]==0){if(R===z)break;R=u[f+m[O]]}if(X<R&&(W&A)!==x){for(re===0&&(re=X),E+=M,$=1<<(H=R-re);H+re<z&&!(($-=_e[H+re])<=0);)H++,$<<=1;if(le+=1<<H,h===1&&852<le||h===2&&592<le)return 1;g[x=W&A]=X<<24|H<<16|E-_|0}}return W!==0&&(g[E+W]=R-re<<24|64<<16|0),p.bits=X,0}},{"../utils/common":41}],51:[function(t,n,i){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,n,i){var s=t("../utils/common"),o=0,a=1;function c(S){for(var G=S.length;0<=--G;)S[G]=0}var l=0,h=29,u=256,f=u+1+h,d=30,g=19,_=2*f+1,m=15,p=16,v=7,y=256,x=16,A=17,E=18,I=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],D=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=new Array(2*(f+2));c(B);var R=new Array(2*d);c(R);var O=new Array(512);c(O);var M=new Array(256);c(M);var z=new Array(h);c(z);var X,H,re,$=new Array(d);function le(S,G,K,ie,V){this.static_tree=S,this.extra_bits=G,this.extra_base=K,this.elems=ie,this.max_length=V,this.has_stree=S&&S.length}function W(S,G){this.dyn_tree=S,this.max_code=0,this.stat_desc=G}function Z(S){return S<256?O[S]:O[256+(S>>>7)]}function ge(S,G){S.pending_buf[S.pending++]=255&G,S.pending_buf[S.pending++]=G>>>8&255}function _e(S,G,K){S.bi_valid>p-K?(S.bi_buf|=G<<S.bi_valid&65535,ge(S,S.bi_buf),S.bi_buf=G>>p-S.bi_valid,S.bi_valid+=K-p):(S.bi_buf|=G<<S.bi_valid&65535,S.bi_valid+=K)}function de(S,G,K){_e(S,K[2*G],K[2*G+1])}function oe(S,G){for(var K=0;K|=1&S,S>>>=1,K<<=1,0<--G;);return K>>>1}function ee(S,G,K){var ie,V,P=new Array(m+1),T=0;for(ie=1;ie<=m;ie++)P[ie]=T=T+K[ie-1]<<1;for(V=0;V<=G;V++){var F=S[2*V+1];F!==0&&(S[2*V]=oe(P[F]++,F))}}function pe(S){var G;for(G=0;G<f;G++)S.dyn_ltree[2*G]=0;for(G=0;G<d;G++)S.dyn_dtree[2*G]=0;for(G=0;G<g;G++)S.bl_tree[2*G]=0;S.dyn_ltree[2*y]=1,S.opt_len=S.static_len=0,S.last_lit=S.matches=0}function ye(S){8<S.bi_valid?ge(S,S.bi_buf):0<S.bi_valid&&(S.pending_buf[S.pending++]=S.bi_buf),S.bi_buf=0,S.bi_valid=0}function Ae(S,G,K,ie){var V=2*G,P=2*K;return S[V]<S[P]||S[V]===S[P]&&ie[G]<=ie[K]}function ze(S,G,K){for(var ie=S.heap[K],V=K<<1;V<=S.heap_len&&(V<S.heap_len&&Ae(G,S.heap[V+1],S.heap[V],S.depth)&&V++,!Ae(G,ie,S.heap[V],S.depth));)S.heap[K]=S.heap[V],K=V,V<<=1;S.heap[K]=ie}function je(S,G,K){var ie,V,P,T,F=0;if(S.last_lit!==0)for(;ie=S.pending_buf[S.d_buf+2*F]<<8|S.pending_buf[S.d_buf+2*F+1],V=S.pending_buf[S.l_buf+F],F++,ie===0?de(S,V,G):(de(S,(P=M[V])+u+1,G),(T=I[P])!==0&&_e(S,V-=z[P],T),de(S,P=Z(--ie),K),(T=D[P])!==0&&_e(S,ie-=$[P],T)),F<S.last_lit;);de(S,y,G)}function He(S,G){var K,ie,V,P=G.dyn_tree,T=G.stat_desc.static_tree,F=G.stat_desc.has_stree,Q=G.stat_desc.elems,ce=-1;for(S.heap_len=0,S.heap_max=_,K=0;K<Q;K++)P[2*K]!==0?(S.heap[++S.heap_len]=ce=K,S.depth[K]=0):P[2*K+1]=0;for(;S.heap_len<2;)P[2*(V=S.heap[++S.heap_len]=ce<2?++ce:0)]=1,S.depth[V]=0,S.opt_len--,F&&(S.static_len-=T[2*V+1]);for(G.max_code=ce,K=S.heap_len>>1;1<=K;K--)ze(S,P,K);for(V=Q;K=S.heap[1],S.heap[1]=S.heap[S.heap_len--],ze(S,P,1),ie=S.heap[1],S.heap[--S.heap_max]=K,S.heap[--S.heap_max]=ie,P[2*V]=P[2*K]+P[2*ie],S.depth[V]=(S.depth[K]>=S.depth[ie]?S.depth[K]:S.depth[ie])+1,P[2*K+1]=P[2*ie+1]=V,S.heap[1]=V++,ze(S,P,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(te,Re){var we,Le,Xe,fe,Se,Oe,Ue=Re.dyn_tree,Me=Re.max_code,it=Re.stat_desc.static_tree,Y=Re.stat_desc.has_stree,Pe=Re.stat_desc.extra_bits,be=Re.stat_desc.extra_base,De=Re.stat_desc.max_length,ve=0;for(fe=0;fe<=m;fe++)te.bl_count[fe]=0;for(Ue[2*te.heap[te.heap_max]+1]=0,we=te.heap_max+1;we<_;we++)De<(fe=Ue[2*Ue[2*(Le=te.heap[we])+1]+1]+1)&&(fe=De,ve++),Ue[2*Le+1]=fe,Me<Le||(te.bl_count[fe]++,Se=0,be<=Le&&(Se=Pe[Le-be]),Oe=Ue[2*Le],te.opt_len+=Oe*(fe+Se),Y&&(te.static_len+=Oe*(it[2*Le+1]+Se)));if(ve!==0){do{for(fe=De-1;te.bl_count[fe]===0;)fe--;te.bl_count[fe]--,te.bl_count[fe+1]+=2,te.bl_count[De]--,ve-=2}while(0<ve);for(fe=De;fe!==0;fe--)for(Le=te.bl_count[fe];Le!==0;)Me<(Xe=te.heap[--we])||(Ue[2*Xe+1]!==fe&&(te.opt_len+=(fe-Ue[2*Xe+1])*Ue[2*Xe],Ue[2*Xe+1]=fe),Le--)}}(S,G),ee(P,ce,S.bl_count)}function w(S,G,K){var ie,V,P=-1,T=G[1],F=0,Q=7,ce=4;for(T===0&&(Q=138,ce=3),G[2*(K+1)+1]=65535,ie=0;ie<=K;ie++)V=T,T=G[2*(ie+1)+1],++F<Q&&V===T||(F<ce?S.bl_tree[2*V]+=F:V!==0?(V!==P&&S.bl_tree[2*V]++,S.bl_tree[2*x]++):F<=10?S.bl_tree[2*A]++:S.bl_tree[2*E]++,P=V,ce=(F=0)===T?(Q=138,3):V===T?(Q=6,3):(Q=7,4))}function q(S,G,K){var ie,V,P=-1,T=G[1],F=0,Q=7,ce=4;for(T===0&&(Q=138,ce=3),ie=0;ie<=K;ie++)if(V=T,T=G[2*(ie+1)+1],!(++F<Q&&V===T)){if(F<ce)for(;de(S,V,S.bl_tree),--F!=0;);else V!==0?(V!==P&&(de(S,V,S.bl_tree),F--),de(S,x,S.bl_tree),_e(S,F-3,2)):F<=10?(de(S,A,S.bl_tree),_e(S,F-3,3)):(de(S,E,S.bl_tree),_e(S,F-11,7));P=V,ce=(F=0)===T?(Q=138,3):V===T?(Q=6,3):(Q=7,4)}}c($);var k=!1;function N(S,G,K,ie){_e(S,(l<<1)+(ie?1:0),3),function(V,P,T,F){ye(V),F&&(ge(V,T),ge(V,~T)),s.arraySet(V.pending_buf,V.window,P,T,V.pending),V.pending+=T}(S,G,K,!0)}i._tr_init=function(S){k||(function(){var G,K,ie,V,P,T=new Array(m+1);for(V=ie=0;V<h-1;V++)for(z[V]=ie,G=0;G<1<<I[V];G++)M[ie++]=V;for(M[ie-1]=V,V=P=0;V<16;V++)for($[V]=P,G=0;G<1<<D[V];G++)O[P++]=V;for(P>>=7;V<d;V++)for($[V]=P<<7,G=0;G<1<<D[V]-7;G++)O[256+P++]=V;for(K=0;K<=m;K++)T[K]=0;for(G=0;G<=143;)B[2*G+1]=8,G++,T[8]++;for(;G<=255;)B[2*G+1]=9,G++,T[9]++;for(;G<=279;)B[2*G+1]=7,G++,T[7]++;for(;G<=287;)B[2*G+1]=8,G++,T[8]++;for(ee(B,f+1,T),G=0;G<d;G++)R[2*G+1]=5,R[2*G]=oe(G,5);X=new le(B,I,u+1,f,m),H=new le(R,D,0,d,m),re=new le(new Array(0),b,0,g,v)}(),k=!0),S.l_desc=new W(S.dyn_ltree,X),S.d_desc=new W(S.dyn_dtree,H),S.bl_desc=new W(S.bl_tree,re),S.bi_buf=0,S.bi_valid=0,pe(S)},i._tr_stored_block=N,i._tr_flush_block=function(S,G,K,ie){var V,P,T=0;0<S.level?(S.strm.data_type===2&&(S.strm.data_type=function(F){var Q,ce=4093624447;for(Q=0;Q<=31;Q++,ce>>>=1)if(1&ce&&F.dyn_ltree[2*Q]!==0)return o;if(F.dyn_ltree[18]!==0||F.dyn_ltree[20]!==0||F.dyn_ltree[26]!==0)return a;for(Q=32;Q<u;Q++)if(F.dyn_ltree[2*Q]!==0)return a;return o}(S)),He(S,S.l_desc),He(S,S.d_desc),T=function(F){var Q;for(w(F,F.dyn_ltree,F.l_desc.max_code),w(F,F.dyn_dtree,F.d_desc.max_code),He(F,F.bl_desc),Q=g-1;3<=Q&&F.bl_tree[2*C[Q]+1]===0;Q--);return F.opt_len+=3*(Q+1)+5+5+4,Q}(S),V=S.opt_len+3+7>>>3,(P=S.static_len+3+7>>>3)<=V&&(V=P)):V=P=K+5,K+4<=V&&G!==-1?N(S,G,K,ie):S.strategy===4||P===V?(_e(S,2+(ie?1:0),3),je(S,B,R)):(_e(S,4+(ie?1:0),3),function(F,Q,ce,te){var Re;for(_e(F,Q-257,5),_e(F,ce-1,5),_e(F,te-4,4),Re=0;Re<te;Re++)_e(F,F.bl_tree[2*C[Re]+1],3);q(F,F.dyn_ltree,Q-1),q(F,F.dyn_dtree,ce-1)}(S,S.l_desc.max_code+1,S.d_desc.max_code+1,T+1),je(S,S.dyn_ltree,S.dyn_dtree)),pe(S),ie&&ye(S)},i._tr_tally=function(S,G,K){return S.pending_buf[S.d_buf+2*S.last_lit]=G>>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&G,S.pending_buf[S.l_buf+S.last_lit]=255&K,S.last_lit++,G===0?S.dyn_ltree[2*K]++:(S.matches++,G--,S.dyn_ltree[2*(M[K]+u+1)]++,S.dyn_dtree[2*Z(G)]++),S.last_lit===S.lit_bufsize-1},i._tr_align=function(S){_e(S,2,3),de(S,y,B),function(G){G.bi_valid===16?(ge(G,G.bi_buf),G.bi_buf=0,G.bi_valid=0):8<=G.bi_valid&&(G.pending_buf[G.pending++]=255&G.bi_buf,G.bi_buf>>=8,G.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(t,n,i){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,n,i){(function(s){(function(o,a){if(!o.setImmediate){var c,l,h,u,f=1,d={},g=!1,_=o.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(o);m=m&&m.setTimeout?m:o,c={}.toString.call(o.process)==="[object process]"?function(x){process.nextTick(function(){v(x)})}:function(){if(o.postMessage&&!o.importScripts){var x=!0,A=o.onmessage;return o.onmessage=function(){x=!1},o.postMessage("","*"),o.onmessage=A,x}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",y,!1):o.attachEvent("onmessage",y),function(x){o.postMessage(u+x,"*")}):o.MessageChannel?((h=new MessageChannel).port1.onmessage=function(x){v(x.data)},function(x){h.port2.postMessage(x)}):_&&"onreadystatechange"in _.createElement("script")?(l=_.documentElement,function(x){var A=_.createElement("script");A.onreadystatechange=function(){v(x),A.onreadystatechange=null,l.removeChild(A),A=null},l.appendChild(A)}):function(x){setTimeout(v,0,x)},m.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var A=new Array(arguments.length-1),E=0;E<A.length;E++)A[E]=arguments[E+1];var I={callback:x,args:A};return d[f]=I,c(f),f++},m.clearImmediate=p}function p(x){delete d[x]}function v(x){if(g)setTimeout(v,0,x);else{var A=d[x];if(A){g=!0;try{(function(E){var I=E.callback,D=E.args;switch(D.length){case 0:I();break;case 1:I(D[0]);break;case 2:I(D[0],D[1]);break;case 3:I(D[0],D[1],D[2]);break;default:I.apply(a,D)}})(A)}finally{p(x),g=!1}}}}function y(x){x.source===o&&typeof x.data=="string"&&x.data.indexOf(u)===0&&v(+x.data.slice(u.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof fl<"u"?fl:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(jm);const iM=jm.exports,Jm=["BOOLEAN","INT32","INT64","INT96","FLOAT","DOUBLE","BYTE_ARRAY","FIXED_LEN_BYTE_ARRAY"],Mr=["PLAIN","GROUP_VAR_INT","PLAIN_DICTIONARY","RLE","BIT_PACKED","DELTA_BINARY_PACKED","DELTA_LENGTH_BYTE_ARRAY","DELTA_BYTE_ARRAY","RLE_DICTIONARY","BYTE_STREAM_SPLIT"],rM=["REQUIRED","OPTIONAL","REPEATED"],sM=["UTF8","MAP","MAP_KEY_VALUE","LIST","ENUM","DECIMAL","DATE","TIME_MILLIS","TIME_MICROS","TIMESTAMP_MILLIS","TIMESTAMP_MICROS","UINT_8","UINT_16","UINT_32","UINT_64","INT_8","INT_16","INT_32","INT_64","JSON","BSON","INTERVAL"],oM=["UNCOMPRESSED","SNAPPY","GZIP","LZO","BROTLI","LZ4","ZSTD","LZ4_RAW"],$m=["DATA_PAGE","INDEX_PAGE","DICTIONARY_PAGE","DATA_PAGE_V2"],aM=["SPHERICAL","VINCENTY","THOMAS","ANDOYER","KARNEY"];function Zu(r){const e=xl(r);if(e.type===1)return{type:"Point",coordinates:Yu(r,e)};if(e.type===2)return{type:"LineString",coordinates:Qu(r,e)};if(e.type===3)return{type:"Polygon",coordinates:eg(r,e)};if(e.type===4){const t=[];for(let n=0;n<e.count;n++)t.push(Yu(r,xl(r)));return{type:"MultiPoint",coordinates:t}}else if(e.type===5){const t=[];for(let n=0;n<e.count;n++)t.push(Qu(r,xl(r)));return{type:"MultiLineString",coordinates:t}}else if(e.type===6){const t=[];for(let n=0;n<e.count;n++)t.push(eg(r,xl(r)));return{type:"MultiPolygon",coordinates:t}}else if(e.type===7){const t=[];for(let n=0;n<e.count;n++)t.push(Zu(r));return{type:"GeometryCollection",geometries:t}}else throw new Error(`Unsupported geometry type: ${e.type}`)}function xl(r){const{view:e}=r,t=e.getUint8(r.offset++)===1,n=e.getUint32(r.offset,t);r.offset+=4;const i=n%1e3,s=Math.floor(n/1e3);let o=0;i>1&&i<=7&&(o=e.getUint32(r.offset,t),r.offset+=4);let a=2;return s&&a++,s===3&&a++,{littleEndian:t,type:i,dim:a,count:o}}function Yu(r,e){const t=[];for(let n=0;n<e.dim;n++){const i=r.view.getFloat64(r.offset,e.littleEndian);r.offset+=8,t.push(i)}return t}function Qu(r,e){const t=[];for(let n=0;n<e.count;n++)t.push(Yu(r,e));return t}function eg(r,e){const{view:t}=r,n=[];for(let i=0;i<e.count;i++){const s=t.getUint32(r.offset,e.littleEndian);r.offset+=4,n.push(Qu(r,{...e,count:s}))}return n}const tg=new TextDecoder,ng={timestampFromMilliseconds(r){return new Date(Number(r))},timestampFromMicroseconds(r){return new Date(Number(r/1000n))},timestampFromNanoseconds(r){return new Date(Number(r/1000000n))},dateFromDays(r){return new Date(r*864e5)},stringFromBytes(r){return r&&tg.decode(r)},geometryFromBytes(r){return r&&Zu({view:new DataView(r.buffer,r.byteOffset,r.byteLength),offset:0})},geographyFromBytes(r){return r&&Zu({view:new DataView(r.buffer,r.byteOffset,r.byteLength),offset:0})}};function ig(r,e,t,n){if(e&&t.endsWith("_DICTIONARY")){let i=r;r instanceof Uint8Array&&!(e instanceof Uint8Array)&&(i=new e.constructor(r.length));for(let s=0;s<r.length;s++)i[s]=e[r[s]];return i}else return rg(r,n)}function rg(r,e){const{element:t,parsers:n,utf8:i=!0}=e,{type:s,converted_type:o,logical_type:a}=t;if(o==="DECIMAL"){const l=10**-(t.scale||0),h=new Array(r.length);for(let u=0;u<h.length;u++)r[u]instanceof Uint8Array?h[u]=sg(r[u])*l:h[u]=Number(r[u])*l;return h}if(!o&&s==="INT96")return Array.from(r).map(c=>n.timestampFromNanoseconds(cM(c)));if(o==="DATE")return Array.from(r).map(c=>n.dateFromDays(c));if(o==="TIMESTAMP_MILLIS")return Array.from(r).map(c=>n.timestampFromMilliseconds(c));if(o==="TIMESTAMP_MICROS")return Array.from(r).map(c=>n.timestampFromMicroseconds(c));if(o==="JSON")return r.map(c=>JSON.parse(tg.decode(c)));if(o==="BSON")throw new Error("parquet bson not supported");if(o==="INTERVAL")throw new Error("parquet interval not supported");if(a?.type==="GEOMETRY")return r.map(c=>n.geometryFromBytes(c));if(a?.type==="GEOGRAPHY")return r.map(c=>n.geographyFromBytes(c));if(o==="UTF8"||a?.type==="STRING"||i&&s==="BYTE_ARRAY")return r.map(c=>n.stringFromBytes(c));if(o==="UINT_64"||a?.type==="INTEGER"&&a.bitWidth===64&&!a.isSigned){if(r instanceof BigInt64Array)return new BigUint64Array(r.buffer,r.byteOffset,r.length);const c=new BigUint64Array(r.length);for(let l=0;l<c.length;l++)c[l]=BigInt(r[l]);return c}if(o==="UINT_32"||a?.type==="INTEGER"&&a.bitWidth===32&&!a.isSigned){if(r instanceof Int32Array)return new Uint32Array(r.buffer,r.byteOffset,r.length);const c=new Uint32Array(r.length);for(let l=0;l<c.length;l++)c[l]=r[l];return c}if(a?.type==="FLOAT16")return Array.from(r).map(og);if(a?.type==="TIMESTAMP"){const{unit:c}=a;let l=n.timestampFromMilliseconds;c==="MICROS"&&(l=n.timestampFromMicroseconds),c==="NANOS"&&(l=n.timestampFromNanoseconds);const h=new Array(r.length);for(let u=0;u<h.length;u++)h[u]=l(r[u]);return h}return r}function sg(r){if(!r.length)return 0;let e=0n;for(const n of r)e=e*256n+BigInt(n);const t=r.length*8;return e>=2n**BigInt(t-1)&&(e-=2n**BigInt(t)),Number(e)}function cM(r){const e=(r>>64n)-2440588n,t=r&0xffffffffffffffffn;return e*86400000000000n+t}function og(r){if(!r)return;const e=r[1]<<8|r[0],t=e>>15?-1:1,n=e>>10&31,i=e&1023;return n===0?t*2**-14*(i/1024):n===31?i?NaN:t*(1/0):t*2**(n-15)*(1+i/1024)}function ag(r,e,t){const n=r[e],i=[];let s=1;if(n.num_children)for(;i.length<n.num_children;){const o=r[e+s],a=ag(r,e+s,[...t,o.name]);s+=a.count,i.push(a)}return{count:s,element:n,children:i,path:t}}function cg(r,e){let t=ag(r,0,[]);const n=[t];for(const i of e){const s=t.children.find(o=>o.element.name===i);if(!s)throw new Error(`parquet schema element not found: ${e}`);n.push(s),t=s}return n}function lM(r){const e=[];function t(n){if(n.children.length)for(const i of n.children)t(i);else e.push(n.path.join("."))}return t(r),e}function lg(r){let e=0;for(const{element:t}of r)t.repetition_type==="REPEATED"&&e++;return e}function Ku(r){let e=0;for(const{element:t}of r.slice(1))t.repetition_type!=="REQUIRED"&&e++;return e}function hM(r){if(!r||r.element.converted_type!=="LIST"||r.children.length>1)return!1;const e=r.children[0];return!(e.children.length>1||e.element.repetition_type!=="REPEATED")}function uM(r){if(!r||r.element.converted_type!=="MAP"||r.children.length>1)return!1;const e=r.children[0];return!(e.children.length!==2||e.element.repetition_type!=="REPEATED"||e.children.find(i=>i.element.name==="key")?.element.repetition_type==="REPEATED"||e.children.find(i=>i.element.name==="value")?.element.repetition_type==="REPEATED")}function hg(r){if(r.length!==2)return!1;const[,e]=r;return!(e.element.repetition_type==="REPEATED"||e.children.length)}const $t={STOP:0,TRUE:1,FALSE:2,BYTE:3,I16:4,I32:5,I64:6,DOUBLE:7,BINARY:8,LIST:9,SET:10,MAP:11,STRUCT:12,UUID:13};function ju(r){let e=0;const t={};for(;r.offset<r.view.byteLength;){const[n,i,s]=fg(r,e);if(e=s,n===$t.STOP)break;t[`field_${i}`]=Al(r,n)}return t}function Al(r,e){switch(e){case $t.TRUE:return!0;case $t.FALSE:return!1;case $t.BYTE:return r.view.getInt8(r.offset++);case $t.I16:case $t.I32:return ug(r);case $t.I64:return Ju(r);case $t.DOUBLE:{const t=r.view.getFloat64(r.offset,!0);return r.offset+=8,t}case $t.BINARY:{const t=Er(r),n=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,t);return r.offset+=t,n}case $t.LIST:{const t=r.view.getUint8(r.offset++),n=t&15;let i=t>>4;i===15&&(i=Er(r));const s=n===$t.TRUE||n===$t.FALSE,o=new Array(i);for(let a=0;a<i;a++)o[a]=s?Al(r,$t.BYTE)===1:Al(r,n);return o}case $t.STRUCT:{const t={};let n=0;for(;;){const[i,s,o]=fg(r,n);if(n=o,i===$t.STOP)break;t[`field_${s}`]=Al(r,i)}return t}default:throw new Error(`thrift unhandled type: ${e}`)}}function Er(r){let e=0,t=0;for(;;){const n=r.view.getUint8(r.offset++);if(e|=(n&127)<<t,!(n&128))return e;t+=7}}function fM(r){let e=0n,t=0n;for(;;){const n=r.view.getUint8(r.offset++);if(e|=BigInt(n&127)<<t,!(n&128))return e;t+=7n}}function ug(r){const e=Er(r);return e>>>1^-(e&1)}function Ju(r){const e=fM(r);return e>>1n^-(e&1n)}function fg(r,e){const t=r.view.getUint8(r.offset++),n=t&15;if(n===$t.STOP)return[0,0,e];const i=t>>4,s=i?e+i:ug(r);return[n,s,s]}function dM(r,e){const t=new Map,n=e?.find(({key:s})=>s==="geo")?.value,i=(n&&JSON.parse(n)?.columns)??{};for(const[s,o]of Object.entries(i)){if(o.encoding!=="WKB")continue;const a=o.edges==="spherical"?"GEOGRAPHY":"GEOMETRY",c=o.crs?.id??o.crs?.ids?.[0],l=c?`${c.authority}:${c.code.toString()}`:void 0;t.set(s,{type:a,crs:l})}for(let s=1;s<r.length;s++){const o=r[s],{logical_type:a,name:c,num_children:l,repetition_type:h,type:u}=o;if(l){s+=l;continue}u==="BYTE_ARRAY"&&a===void 0&&h!=="REPEATED"&&(o.logical_type=t.get(c))}}const pM=1<<19,mM=new TextDecoder;function ni(r){return r&&mM.decode(r)}async function dg(r,{parsers:e,initialFetchSize:t=pM,geoparquet:n=!0}={}){if(!r||!(r.byteLength>=0))throw new Error("parquet expected AsyncBuffer");const i=Math.max(0,r.byteLength-t),s=await r.slice(i,r.byteLength),o=new DataView(s);if(o.getUint32(s.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const a=o.getUint32(s.byteLength-8,!0);if(a>r.byteLength-8)throw new Error(`parquet metadata length ${a} exceeds available buffer ${r.byteLength-8}`);if(a+8>t){const c=r.byteLength-a-8,l=await r.slice(c,i),h=new ArrayBuffer(a+8),u=new Uint8Array(h);return u.set(new Uint8Array(l)),u.set(new Uint8Array(s),i-c),pg(h,{parsers:e,geoparquet:n})}else return pg(s,{parsers:e,geoparquet:n})}function pg(r,{parsers:e,geoparquet:t=!0}={}){if(!(r instanceof ArrayBuffer))throw new Error("parquet expected ArrayBuffer");const n=new DataView(r);if(e={...ng,...e},n.byteLength<8)throw new Error("parquet file is too short");if(n.getUint32(n.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const i=n.byteLength-8,s=n.getUint32(i,!0);if(s>n.byteLength-8)throw new Error(`parquet metadata length ${s} exceeds available buffer ${n.byteLength-8}`);const o=i-s,c=ju({view:n,offset:o}),l=c.field_1,h=c.field_2.map(m=>({type:Jm[m.field_1],type_length:m.field_2,repetition_type:rM[m.field_3],name:ni(m.field_4),num_children:m.field_5,converted_type:sM[m.field_6],scale:m.field_7,precision:m.field_8,field_id:m.field_9,logical_type:gM(m.field_10)})),u=h.filter(m=>m.type),f=c.field_3,d=c.field_4.map(m=>({columns:m.field_1.map((p,v)=>({file_path:ni(p.field_1),file_offset:p.field_2,meta_data:p.field_3&&{type:Jm[p.field_3.field_1],encodings:p.field_3.field_2?.map(y=>Mr[y]),path_in_schema:p.field_3.field_3.map(ni),codec:oM[p.field_3.field_4],num_values:p.field_3.field_5,total_uncompressed_size:p.field_3.field_6,total_compressed_size:p.field_3.field_7,key_value_metadata:p.field_3.field_8?.map(y=>({key:ni(y.field_1),value:ni(y.field_2)})),data_page_offset:p.field_3.field_9,index_page_offset:p.field_3.field_10,dictionary_page_offset:p.field_3.field_11,statistics:_M(p.field_3.field_12,u[v],e),encoding_stats:p.field_3.field_13?.map(y=>({page_type:$m[y.field_1],encoding:Mr[y.field_2],count:y.field_3})),bloom_filter_offset:p.field_3.field_14,bloom_filter_length:p.field_3.field_15,size_statistics:p.field_3.field_16&&{unencoded_byte_array_data_bytes:p.field_3.field_16.field_1,repetition_level_histogram:p.field_3.field_16.field_2,definition_level_histogram:p.field_3.field_16.field_3},geospatial_statistics:p.field_3.field_17&&{bbox:p.field_3.field_17.field_1&&{xmin:p.field_3.field_17.field_1.field_1,xmax:p.field_3.field_17.field_1.field_2,ymin:p.field_3.field_17.field_1.field_3,ymax:p.field_3.field_17.field_1.field_4,zmin:p.field_3.field_17.field_1.field_5,zmax:p.field_3.field_17.field_1.field_6,mmin:p.field_3.field_17.field_1.field_7,mmax:p.field_3.field_17.field_1.field_8},geospatial_types:p.field_3.field_17.field_2}},offset_index_offset:p.field_4,offset_index_length:p.field_5,column_index_offset:p.field_6,column_index_length:p.field_7,crypto_metadata:p.field_8,encrypted_column_metadata:p.field_9})),total_byte_size:m.field_2,num_rows:m.field_3,sorting_columns:m.field_4?.map(p=>({column_idx:p.field_1,descending:p.field_2,nulls_first:p.field_3})),file_offset:m.field_5,total_compressed_size:m.field_6,ordinal:m.field_7})),g=c.field_5?.map(m=>({key:ni(m.field_1),value:ni(m.field_2)})),_=ni(c.field_6);return t&&dM(h,g),{version:l,schema:h,num_rows:f,row_groups:d,key_value_metadata:g,created_by:_,metadata_length:s}}function $u({schema:r}){return cg(r,[])[0]}function gM(r){return r?.field_1?{type:"STRING"}:r?.field_2?{type:"MAP"}:r?.field_3?{type:"LIST"}:r?.field_4?{type:"ENUM"}:r?.field_5?{type:"DECIMAL",scale:r.field_5.field_1,precision:r.field_5.field_2}:r?.field_6?{type:"DATE"}:r?.field_7?{type:"TIME",isAdjustedToUTC:r.field_7.field_1,unit:mg(r.field_7.field_2)}:r?.field_8?{type:"TIMESTAMP",isAdjustedToUTC:r.field_8.field_1,unit:mg(r.field_8.field_2)}:r?.field_10?{type:"INTEGER",bitWidth:r.field_10.field_1,isSigned:r.field_10.field_2}:r?.field_11?{type:"NULL"}:r?.field_12?{type:"JSON"}:r?.field_13?{type:"BSON"}:r?.field_14?{type:"UUID"}:r?.field_15?{type:"FLOAT16"}:r?.field_16?{type:"VARIANT",specification_version:r.field_16.field_1}:r?.field_17?{type:"GEOMETRY",crs:ni(r.field_17.field_1)}:r?.field_18?{type:"GEOGRAPHY",crs:ni(r.field_18.field_1),algorithm:aM[r.field_18.field_2]}:r}function mg(r){if(r.field_1)return"MILLIS";if(r.field_2)return"MICROS";if(r.field_3)return"NANOS";throw new Error("parquet time unit required")}function _M(r,e,t){return r&&{max:bl(r.field_1,e,t),min:bl(r.field_2,e,t),null_count:r.field_3,distinct_count:r.field_4,max_value:bl(r.field_5,e,t),min_value:bl(r.field_6,e,t),is_max_value_exact:r.field_7,is_min_value_exact:r.field_8}}function bl(r,e,t){const{type:n,converted_type:i,logical_type:s}=e;if(r===void 0)return r;if(n==="BOOLEAN")return r[0]===1;if(n==="BYTE_ARRAY")return t.stringFromBytes(r);const o=new DataView(r.buffer,r.byteOffset,r.byteLength);return n==="FLOAT"&&o.byteLength===4?o.getFloat32(0,!0):n==="DOUBLE"&&o.byteLength===8?o.getFloat64(0,!0):n==="INT32"&&i==="DATE"?t.dateFromDays(o.getInt32(0,!0)):n==="INT64"&&i==="TIMESTAMP_MILLIS"?t.timestampFromMilliseconds(o.getBigInt64(0,!0)):n==="INT64"&&i==="TIMESTAMP_MICROS"?t.timestampFromMicroseconds(o.getBigInt64(0,!0)):n==="INT64"&&s?.type==="TIMESTAMP"&&s?.unit==="NANOS"?t.timestampFromNanoseconds(o.getBigInt64(0,!0)):n==="INT64"&&s?.type==="TIMESTAMP"&&s?.unit==="MICROS"?t.timestampFromMicroseconds(o.getBigInt64(0,!0)):n==="INT64"&&s?.type==="TIMESTAMP"?t.timestampFromMilliseconds(o.getBigInt64(0,!0)):n==="INT32"&&o.byteLength===4?o.getInt32(0,!0):n==="INT64"&&o.byteLength===8?o.getBigInt64(0,!0):i==="DECIMAL"?sg(r)*10**-(e.scale||0):s?.type==="FLOAT16"?og(r):r}function vM(r){const e=ju(r);return{page_locations:e.field_1.map(yM),unencoded_byte_array_data_bytes:e.field_2}}function yM(r){return{offset:r.field_1,compressed_page_size:r.field_2,first_row_index:r.field_3}}function gg(r,e){for(let n=0;n<e.length;n+=1e4)r.push(...e.slice(n,n+1e4))}function mi(r,e,t=!0){if(t?r===e:r==e)return!0;if(r instanceof Uint8Array&&e instanceof Uint8Array)return mi(Array.from(r),Array.from(e),t);if(!r||!e||typeof r!=typeof e)return!1;if(Array.isArray(r)&&Array.isArray(e)){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!mi(r[i],e[i],t))return!1;return!0}if(typeof r!="object")return!1;const n=Object.keys(r);if(n.length!==Object.keys(e).length)return!1;for(const i of n)if(!mi(r[i],e[i],t))return!1;return!0}function _g(r){if(!r)return[];if(r.length===1)return r[0];const e=[];for(const t of r)gg(e,t);return e}function wl(r){if(!r)return[];const e=[];return"$and"in r&&Array.isArray(r.$and)?e.push(...r.$and.flatMap(wl)):"$or"in r&&Array.isArray(r.$or)?e.push(...r.$or.flatMap(wl)):"$nor"in r&&Array.isArray(r.$nor)?e.push(...r.$nor.flatMap(wl)):e.push(...Object.keys(r)),e}function Ro(r,e,t=!0){return"$and"in e&&Array.isArray(e.$and)?e.$and.every(n=>Ro(r,n,t)):"$or"in e&&Array.isArray(e.$or)?e.$or.some(n=>Ro(r,n,t)):"$nor"in e&&Array.isArray(e.$nor)?!e.$nor.some(n=>Ro(r,n,t)):Object.entries(e).every(([n,i])=>{const s=r[n];return typeof i!="object"||i===null||Array.isArray(i)?mi(s,i,t):Object.entries(i||{}).every(([o,a])=>o==="$gt"?s>a:o==="$gte"?s>=a:o==="$lt"?s<a:o==="$lte"?s<=a:o==="$eq"?mi(s,a,t):o==="$ne"?!mi(s,a,t):o==="$in"?Array.isArray(a)&&a.includes(s):o==="$nin"?Array.isArray(a)&&!a.includes(s):o==="$not"?!Ro({[n]:s},{[n]:a},t):!0)})}function ef({rowGroup:r,physicalColumns:e,filter:t,strict:n=!0}){if(!t)return!1;if("$and"in t&&Array.isArray(t.$and))return t.$and.some(i=>ef({rowGroup:r,physicalColumns:e,filter:i,strict:n}));if("$or"in t&&Array.isArray(t.$or))return t.$or.every(i=>ef({rowGroup:r,physicalColumns:e,filter:i,strict:n}));if("$nor"in t&&Array.isArray(t.$nor))return!1;for(const[i,s]of Object.entries(t)){const o=e.indexOf(i);if(o===-1)continue;const a=r.columns[o].meta_data?.statistics;if(!a)continue;const{min:c,max:l,min_value:h,max_value:u}=a,f=h!==void 0?h:c,d=u!==void 0?u:l;if(!(f===void 0||d===void 0)){for(const[g,_]of Object.entries(s||{}))if(g==="$gt"&&d<=_||g==="$gte"&&d<_||g==="$lt"&&f>=_||g==="$lte"&&f>_||g==="$eq"&&(_<f||_>d)||g==="$ne"&&mi(f,d,n)&&mi(f,_,n)||g==="$in"&&Array.isArray(_)&&_.every(m=>m<f||m>d)||g==="$nin"&&Array.isArray(_)&&mi(f,d,n)&&_.includes(f))return!0}}return!1}const xM=1<<21;function AM({metadata:r,rowStart:e=0,rowEnd:t=1/0,columns:n,filter:i,filterStrict:s=!0,useOffsetIndex:o=!1}){if(!r)throw new Error("parquetPlan requires metadata");const a=[],c=[],l=[],h=lM($u(r));let u=0;for(const f of r.row_groups){const d=Number(f.num_rows),g=u+d;if(d>0&&g>e&&u<t&&!ef({rowGroup:f,physicalColumns:h,filter:i,strict:s})){const _=[];for(const y of f.columns){const x=y.meta_data;if(y.file_path)throw new Error("parquet file_path not supported");if(!x)throw new Error("parquet column metadata is undefined");if(!n||n.includes(x.path_in_schema[0])){const A=x.dictionary_page_offset||x.data_page_offset,E=Number(A),I=Number(A+x.total_compressed_size);if(o&&y.offset_index_offset&&y.offset_index_length){const D=Number(y.offset_index_offset);_.push({columnMetadata:x,offsetIndex:{startByte:D,endByte:D+y.offset_index_length},bounds:{startByte:E,endByte:I}})}else _.push({columnMetadata:x,range:{startByte:E,endByte:I}})}}const m=Math.max(e-u,0),p=Math.min(t-u,d);a.push({chunks:_,rowGroup:f,groupStart:u,groupRows:d,selectStart:m,selectEnd:p});let v;for(const y of _)if("offsetIndex"in y)l.push(y.offsetIndex);else{const{range:x}=y;n?c.push(x):v&&x.endByte-v.startByte<=xM?v.endByte=x.endByte:(v&&c.push(v),v={...x})}v&&c.push(v)}u=g}return isFinite(t)||(t=u),c.push(...l),{metadata:r,rowStart:e,rowEnd:t,columns:n,fetches:c,groups:a}}function bM(r,{fetches:e}){const t=e.map(({startByte:n,endByte:i})=>r.slice(n,i));return{byteLength:r.byteLength,slice(n,i=r.byteLength){const s=e.findIndex(({startByte:o,endByte:a})=>o<=n&&i<=a);if(s<0)return r.slice(n,i);if(e[s].startByte!==n||e[s].endByte!==i){const o=n-e[s].startByte,a=i-e[s].startByte;return t[s]instanceof Promise?t[s].then(c=>c.slice(o,a)):t[s].slice(o,a)}else return t[s]}}}function vg(r,e,t,n,i){const s=e?.length||t.length;if(!s)return n;const o=Ku(i),a=i.map(({element:g})=>g.repetition_type);let c=0;const l=[r];let h=r,u=0,f=0,d=0;if(t[0])for(;u<a.length-2&&d<t[0];)u++,a[u]!=="REQUIRED"&&(h=h.at(-1),l.push(h),f++),a[u]==="REPEATED"&&d++;for(let g=0;g<s;g++){const _=e?.length?e[g]:o,m=t[g];for(;u&&(m<d||a[u]!=="REPEATED");)a[u]!=="REQUIRED"&&(l.pop(),f--),a[u]==="REPEATED"&&d--,u--;for(h=l.at(-1);(u<a.length-2||a[u+1]==="REPEATED")&&(f<_||a[u+1]==="REQUIRED");){if(u++,a[u]!=="REQUIRED"){const p=[];h.push(p),h=p,l.push(p),f++}a[u]==="REPEATED"&&d++}_===o?h.push(n[c++]):u===a.length-2?h.push(null):h.push([])}if(!r.length)for(let g=0;g<o;g++){const _=[];h.push(_),h=_}return r}function Po(r,e,t=0){const n=e.path.join("."),i=e.element.repetition_type==="OPTIONAL",s=i?t+1:t;if(hM(e)){let o=e.children[0],a=s;o.children.length===1&&(o=o.children[0],a++),Po(r,o,a);const c=o.path.join("."),l=r.get(c);if(!l)throw new Error("parquet list column missing values");i&&Sl(l,t),r.set(n,l),r.delete(c);return}if(uM(e)){const o=e.children[0].element.name;Po(r,e.children[0].children[0],s+1),Po(r,e.children[0].children[1],s+1);const a=r.get(`${n}.${o}.key`),c=r.get(`${n}.${o}.value`);if(!a)throw new Error("parquet map column missing keys");if(!c)throw new Error("parquet map column missing values");if(a.length!==c.length)throw new Error("parquet map column key/value length mismatch");const l=yg(a,c,s);i&&Sl(l,t),r.delete(`${n}.${o}.key`),r.delete(`${n}.${o}.value`),r.set(n,l);return}if(e.children.length){const o=e.element.repetition_type==="REQUIRED"?t:t+1,a={};for(const l of e.children){Po(r,l,o);const h=r.get(l.path.join("."));if(!h)throw new Error("parquet struct missing child data");a[l.element.name]=h}for(const l of e.children)r.delete(l.path.join("."));const c=xg(a,o);i&&Sl(c,t),r.set(n,c)}}function Sl(r,e){for(let t=0;t<r.length;t++)e?Sl(r[t],e-1):r[t]=r[t][0]}function yg(r,e,t){const n=[];for(let i=0;i<r.length;i++)if(t)n.push(yg(r[i],e[i],t-1));else if(r[i]){const s={};for(let o=0;o<r[i].length;o++){const a=e[i][o];s[r[i][o]]=a===void 0?null:a}n.push(s)}else n.push(void 0);return n}function xg(r,e){const t=Object.keys(r),n=r[t[0]]?.length,i=[];for(let s=0;s<n;s++){const o={};for(const a of t){if(r[a].length!==n)throw new Error("parquet struct parsing error");o[a]=r[a][s]}e?i.push(xg(o,e-1)):i.push(o)}return i}function Do(r,e,t){const n=t instanceof Int32Array,i=Er(r),s=Er(r);Er(r);let o=Ju(r),a=0;t[a++]=n?Number(o):o;const c=i/s;for(;a<e;){const l=Ju(r),h=new Uint8Array(s);for(let u=0;u<s;u++)h[u]=r.view.getUint8(r.offset++);for(let u=0;u<s&&a<e;u++){const f=BigInt(h[u]);if(f){let d=0n,g=c;const _=(1n<<f)-1n;for(;g&&a<e;){let m=BigInt(r.view.getUint8(r.offset))>>d&_;for(d+=f;d>=8;)d-=8n,r.offset++,d&&(m|=BigInt(r.view.getUint8(r.offset))<<f-d&_);const p=l+m;o+=p,t[a++]=n?Number(o):o,g--}g&&(r.offset+=Math.ceil((g*Number(f)+Number(d))/8))}else for(let d=0;d<c&&a<e;d++)o+=l,t[a++]=n?Number(o):o}}}function Ag(r,e,t){const n=new Int32Array(e);Do(r,e,n);for(let i=0;i<e;i++)t[i]=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,n[i]),r.offset+=n[i]}function wM(r,e,t){const n=new Int32Array(e);Do(r,e,n);const i=new Int32Array(e);Do(r,e,i);for(let s=0;s<e;s++){const o=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,i[s]);n[s]?(t[s]=new Uint8Array(n[s]+i[s]),t[s].set(t[s-1].subarray(0,n[s])),t[s].set(o,n[s])):t[s]=o,r.offset+=i[s]}}function Ml(r){return 32-Math.clz32(r)}function Oi(r,e,t,n){n===void 0&&(n=r.view.getUint32(r.offset,!0),r.offset+=4);const i=r.offset;let s=0;for(;s<t.length;){const o=Er(r);if(o&1)s=MM(r,o,e,t,s);else{const a=o>>>1;SM(r,a,e,t,s),s+=a}}r.offset=i+n}function SM(r,e,t,n,i){const s=t+7>>3;let o=0;for(let a=0;a<s;a++)o|=r.view.getUint8(r.offset++)<<(a<<3);for(let a=0;a<e;a++)n[i+a]=o}function MM(r,e,t,n,i){let s=e>>1<<3;const o=(1<<t)-1;let a=0;if(r.offset<r.view.byteLength)a=r.view.getUint8(r.offset++);else if(o)throw new Error(`parquet bitpack offset ${r.offset} out of range`);let c=8,l=0;for(;s;)l>8?(l-=8,c-=8,a>>>=8):c-l<t?(a|=r.view.getUint8(r.offset)<<c,r.offset++,c+=8):(i<n.length&&(n[i++]=a>>l&o),s--,l+=t);return i}function bg(r,e,t,n){const i=EM(t,n),s=new Uint8Array(e*i);for(let o=0;o<i;o++)for(let a=0;a<e;a++)s[a*i+o]=r.view.getUint8(r.offset++);if(t==="FLOAT")return new Float32Array(s.buffer);if(t==="DOUBLE")return new Float64Array(s.buffer);if(t==="INT32")return new Int32Array(s.buffer);if(t==="INT64")return new BigInt64Array(s.buffer);if(t==="FIXED_LEN_BYTE_ARRAY"){const o=new Array(e);for(let a=0;a<e;a++)o[a]=s.subarray(a*i,(a+1)*i);return o}throw new Error(`parquet byte_stream_split unsupported type: ${t}`)}function EM(r,e){switch(r){case"INT32":case"FLOAT":return 4;case"INT64":case"DOUBLE":return 8;case"FIXED_LEN_BYTE_ARRAY":if(!e)throw new Error("parquet byteWidth missing type_length");return e;default:throw new Error(`parquet unsupported type: ${r}`)}}function tf(r,e,t,n){if(t===0)return[];if(e==="BOOLEAN")return TM(r,t);if(e==="INT32")return CM(r,t);if(e==="INT64")return IM(r,t);if(e==="INT96")return RM(r,t);if(e==="FLOAT")return PM(r,t);if(e==="DOUBLE")return DM(r,t);if(e==="BYTE_ARRAY")return LM(r,t);if(e==="FIXED_LEN_BYTE_ARRAY"){if(!n)throw new Error("parquet missing fixed length");return NM(r,t,n)}else throw new Error(`parquet unhandled type: ${e}`)}function TM(r,e){const t=new Array(e);for(let n=0;n<e;n++){const i=r.offset+(n/8|0),s=n%8,o=r.view.getUint8(i);t[n]=(o&1<<s)!==0}return r.offset+=Math.ceil(e/8),t}function CM(r,e){const t=(r.view.byteOffset+r.offset)%4?new Int32Array(El(r.view.buffer,r.view.byteOffset+r.offset,e*4)):new Int32Array(r.view.buffer,r.view.byteOffset+r.offset,e);return r.offset+=e*4,t}function IM(r,e){const t=(r.view.byteOffset+r.offset)%8?new BigInt64Array(El(r.view.buffer,r.view.byteOffset+r.offset,e*8)):new BigInt64Array(r.view.buffer,r.view.byteOffset+r.offset,e);return r.offset+=e*8,t}function RM(r,e){const t=new Array(e);for(let n=0;n<e;n++){const i=r.view.getBigInt64(r.offset+n*12,!0),s=r.view.getInt32(r.offset+n*12+8,!0);t[n]=BigInt(s)<<64n|i}return r.offset+=e*12,t}function PM(r,e){const t=(r.view.byteOffset+r.offset)%4?new Float32Array(El(r.view.buffer,r.view.byteOffset+r.offset,e*4)):new Float32Array(r.view.buffer,r.view.byteOffset+r.offset,e);return r.offset+=e*4,t}function DM(r,e){const t=(r.view.byteOffset+r.offset)%8?new Float64Array(El(r.view.buffer,r.view.byteOffset+r.offset,e*8)):new Float64Array(r.view.buffer,r.view.byteOffset+r.offset,e);return r.offset+=e*8,t}function LM(r,e){const t=new Array(e);for(let n=0;n<e;n++){const i=r.view.getUint32(r.offset,!0);r.offset+=4,t[n]=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,i),r.offset+=i}return t}function NM(r,e,t){const n=new Array(e);for(let i=0;i<e;i++)n[i]=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,t),r.offset+=t;return n}function El(r,e,t){const n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(r,e,t)),n}const UM=[0,255,65535,16777215,4294967295];function wg(r,e,t,n,i){for(let s=0;s<i;s++)t[n+s]=r[e+s]}function BM(r,e){const t=r.byteLength,n=e.byteLength;let i=0,s=0;for(;i<t;){const o=r[i];if(i++,o<128)break}if(n&&i>=t)throw new Error("invalid snappy length header");for(;i<t;){const o=r[i];let a=0;if(i++,i>=t)throw new Error("missing eof marker");if((o&3)===0){let c=(o>>>2)+1;if(c>60){if(i+3>=t)throw new Error("snappy error literal pos + 3 >= inputLength");const l=c-60;c=r[i]+(r[i+1]<<8)+(r[i+2]<<16)+(r[i+3]<<24),c=(c&UM[l])+1,i+=l}if(i+c>t)throw new Error("snappy error literal exceeds input length");wg(r,i,e,s,c),i+=c,s+=c}else{let c=0;switch(o&3){case 1:a=(o>>>2&7)+4,c=r[i]+(o>>>5<<8),i++;break;case 2:if(t<=i+1)throw new Error("snappy error end of input");a=(o>>>2)+1,c=r[i]+(r[i+1]<<8),i+=2;break;case 3:if(t<=i+3)throw new Error("snappy error end of input");a=(o>>>2)+1,c=r[i]+(r[i+1]<<8)+(r[i+2]<<16)+(r[i+3]<<24),i+=4;break}if(c===0||isNaN(c))throw new Error(`invalid offset ${c} pos ${i} inputLength ${t}`);if(c>s)throw new Error("cannot copy from before start of buffer");wg(e,s-c,e,s,a),s+=a}}if(s!==n)throw new Error("premature end of input")}function OM(r,e,{type:t,element:n,schemaPath:i}){const s=new DataView(r.buffer,r.byteOffset,r.byteLength),o={view:s,offset:0};let a;const c=FM(o,e,i),{definitionLevels:l,numNulls:h}=zM(o,e,i),u=e.num_values-h;if(e.encoding==="PLAIN")a=tf(o,t,u,n.type_length);else if(e.encoding==="PLAIN_DICTIONARY"||e.encoding==="RLE_DICTIONARY"||e.encoding==="RLE"){const f=t==="BOOLEAN"?1:s.getUint8(o.offset++);f?(a=new Array(u),t==="BOOLEAN"?(Oi(o,f,a),a=a.map(d=>!!d)):Oi(o,f,a,s.byteLength-o.offset)):a=new Uint8Array(u)}else if(e.encoding==="BYTE_STREAM_SPLIT")a=bg(o,u,t,n.type_length);else if(e.encoding==="DELTA_BINARY_PACKED")a=t==="INT32"?new Int32Array(u):new BigInt64Array(u),Do(o,u,a);else if(e.encoding==="DELTA_LENGTH_BYTE_ARRAY")a=new Array(u),Ag(o,u,a);else throw new Error(`parquet unsupported encoding: ${e.encoding}`);return{definitionLevels:l,repetitionLevels:c,dataPage:a}}function FM(r,e,t){if(t.length>1){const n=lg(t);if(n){const i=new Array(e.num_values);return Oi(r,Ml(n),i),i}}return[]}function zM(r,e,t){const n=Ku(t);if(!n)return{definitionLevels:[],numNulls:0};const i=new Array(e.num_values);Oi(r,Ml(n),i);let s=e.num_values;for(const o of i)o===n&&s--;return s===0&&(i.length=0),{definitionLevels:i,numNulls:s}}function nf(r,e,t,n){let i;const s=n?.[t];if(t==="UNCOMPRESSED")i=r;else if(s)i=s(r,e);else if(t==="SNAPPY")i=new Uint8Array(e),BM(r,i);else throw new Error(`parquet unsupported compression codec: ${t}`);if(i?.length!==e)throw new Error(`parquet decompressed page length ${i?.length} does not match header ${e}`);return i}function kM(r,e,t){const i={view:new DataView(r.buffer,r.byteOffset,r.byteLength),offset:0},{type:s,element:o,schemaPath:a,codec:c,compressors:l}=t,h=e.data_page_header_v2;if(!h)throw new Error("parquet data page header v2 is undefined");const u=VM(i,h,a);i.offset=h.repetition_levels_byte_length;const f=HM(i,h,a),d=e.uncompressed_page_size-h.definition_levels_byte_length-h.repetition_levels_byte_length;let g=r.subarray(i.offset);h.is_compressed!==!1&&(g=nf(g,d,c,l));const _=new DataView(g.buffer,g.byteOffset,g.byteLength),m={view:_,offset:0};let p;const v=h.num_values-h.num_nulls;if(h.encoding==="PLAIN")p=tf(m,s,v,o.type_length);else if(h.encoding==="RLE")p=new Array(v),Oi(m,1,p),p=p.map(y=>!!y);else if(h.encoding==="PLAIN_DICTIONARY"||h.encoding==="RLE_DICTIONARY"){const y=_.getUint8(m.offset++);p=new Array(v),Oi(m,y,p,d-1)}else if(h.encoding==="DELTA_BINARY_PACKED")p=s==="INT32"?new Int32Array(v):new BigInt64Array(v),Do(m,v,p);else if(h.encoding==="DELTA_LENGTH_BYTE_ARRAY")p=new Array(v),Ag(m,v,p);else if(h.encoding==="DELTA_BYTE_ARRAY")p=new Array(v),wM(m,v,p);else if(h.encoding==="BYTE_STREAM_SPLIT")p=bg(m,v,s,o.type_length);else throw new Error(`parquet unsupported encoding: ${h.encoding}`);return{definitionLevels:f,repetitionLevels:u,dataPage:p}}function VM(r,e,t){const n=lg(t);if(!n)return[];const i=new Array(e.num_values);return Oi(r,Ml(n),i,e.repetition_levels_byte_length),i}function HM(r,e,t){const n=Ku(t);if(n){const i=new Array(e.num_values);return Oi(r,Ml(n),i,e.definition_levels_byte_length),i}}function Sg(r,{groupStart:e,selectStart:t,selectEnd:n},i,s){const{pathInSchema:o,schemaPath:a}=i,c=hg(a),l=[];let h,u,f=0;const d=s&&(()=>{u&&s({pathInSchema:o,columnData:u,rowStart:e+f-u.length,rowEnd:e+f})});for(;(c?f<n:r.offset<r.view.byteLength-1)&&!(r.offset>=r.view.byteLength-1);){const g=GM(r);if(g.type==="DICTIONARY_PAGE")h=Mg(r,g,i,h,void 0,0),h=rg(h,i);else{const _=u?.length||0,m=Mg(r,g,i,h,u,t-f);u===m?f+=m.length-_:(d?.(),l.push(m),f+=m.length,u=m)}}return d?.(),f>n&&u&&(l[l.length-1]=u.slice(0,n-(f-u.length))),l}function Mg(r,e,t,n,i,s){const{type:o,element:a,schemaPath:c,codec:l,compressors:h}=t,u=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,e.compressed_page_size);if(r.offset+=e.compressed_page_size,e.type==="DATA_PAGE"){const f=e.data_page_header;if(!f)throw new Error("parquet data page header is undefined");if(s>f.num_values&&hg(c))return new Array(f.num_values);const d=nf(u,Number(e.uncompressed_page_size),l,h),{definitionLevels:g,repetitionLevels:_,dataPage:m}=OM(d,f,t);let p=ig(m,n,f.encoding,t);if(_.length||g?.length){const v=Array.isArray(i)?i:[];return vg(v,g,_,p,c)}else{for(let v=2;v<c.length;v++)c[v].element.repetition_type!=="REQUIRED"&&(p=Array.from(p,y=>[y]));return p}}else if(e.type==="DATA_PAGE_V2"){const f=e.data_page_header_v2;if(!f)throw new Error("parquet data page header v2 is undefined");if(s>f.num_rows)return new Array(f.num_values);const{definitionLevels:d,repetitionLevels:g,dataPage:_}=kM(u,e,t),m=ig(_,n,f.encoding,t),p=Array.isArray(i)?i:[];return vg(p,d,g,m,c)}else if(e.type==="DICTIONARY_PAGE"){const f=e.dictionary_page_header;if(!f)throw new Error("parquet dictionary page header is undefined");const d=nf(u,Number(e.uncompressed_page_size),l,h),g={view:new DataView(d.buffer,d.byteOffset,d.byteLength),offset:0};return tf(g,o,f.num_values,a.type_length)}else throw new Error(`parquet unsupported page type: ${e.type}`)}function GM(r){const e=ju(r),t=$m[e.field_1],n=e.field_2,i=e.field_3,s=e.field_4,o=e.field_5&&{num_values:e.field_5.field_1,encoding:Mr[e.field_5.field_2],definition_level_encoding:Mr[e.field_5.field_3],repetition_level_encoding:Mr[e.field_5.field_4],statistics:e.field_5.field_5&&{max:e.field_5.field_5.field_1,min:e.field_5.field_5.field_2,null_count:e.field_5.field_5.field_3,distinct_count:e.field_5.field_5.field_4,max_value:e.field_5.field_5.field_5,min_value:e.field_5.field_5.field_6}},a=e.field_6,c=e.field_7&&{num_values:e.field_7.field_1,encoding:Mr[e.field_7.field_2],is_sorted:e.field_7.field_3},l=e.field_8&&{num_values:e.field_8.field_1,num_nulls:e.field_8.field_2,num_rows:e.field_8.field_3,encoding:Mr[e.field_8.field_4],definition_levels_byte_length:e.field_8.field_5,repetition_levels_byte_length:e.field_8.field_6,is_compressed:e.field_8.field_7===void 0?!0:e.field_8.field_7,statistics:e.field_8.field_8};return{type:t,uncompressed_page_size:n,compressed_page_size:i,crc:s,data_page_header:o,index_page_header:a,dictionary_page_header:c,data_page_header_v2:l}}function WM(r,{metadata:e},t){const{file:n,compressors:i,utf8:s}=r,o=[],a={...ng,...r.parsers};for(const c of t.chunks){const{columnMetadata:l}=c,h=cg(e.schema,l.path_in_schema),u={pathInSchema:l.path_in_schema,type:l.type,element:h[h.length-1].element,schemaPath:h,codec:l.codec,parsers:a,compressors:i,utf8:s};if(!("offsetIndex"in c)){o.push({pathInSchema:l.path_in_schema,data:Promise.resolve(n.slice(c.range.startByte,c.range.endByte)).then(f=>{const d={view:new DataView(f),offset:0};return{pageSkip:0,data:Sg(d,t,u,r.onPage)}})});continue}o.push({pathInSchema:l.path_in_schema,data:Promise.resolve(n.slice(c.offsetIndex.startByte,c.offsetIndex.endByte)).then(async f=>{const d=vM({view:new DataView(f),offset:0}),{selectStart:g,selectEnd:_}=t,m=d.page_locations;let p=NaN,v=NaN,y=0;for(let I=0;I<m.length;I++){const D=m[I],b=Number(D.first_row_index),C=I+1<m.length?Number(m[I+1].first_row_index):t.groupRows;b<_&&C>g&&(Number.isNaN(p)&&(p=Number(D.offset),y=b),v=Number(D.offset)+D.compressed_page_size)}const x=await n.slice(p,v),A={view:new DataView(x),offset:0},E=y?{...t,groupStart:t.groupStart+y,selectStart:t.selectStart-y,selectEnd:t.selectEnd-y}:t;return{data:Sg(A,E,u,r.onPage),pageSkip:y}})})}return{groupStart:t.groupStart,groupRows:t.groupRows,asyncColumns:o}}async function Eg({asyncColumns:r},e,t,n,i){const s=await Promise.all(r.map(async({data:u})=>{const f=await u;return{...f,data:_g(f.data)}})),o=r.map(u=>u.pathInSchema[0]).filter(u=>!n||n.includes(u)),a=n??o,c=a.map(u=>r.findIndex(f=>f.pathInSchema[0]===u)),l=t-e;if(i==="object"){const u=Array(l);for(let f=0;f<l;f++){const d=e+f,g={};for(let _=0;_<r.length;_++){const{data:m,pageSkip:p}=s[_];g[r[_].pathInSchema[0]]=m[d-p]}u[f]=g}return u}const h=Array(l);for(let u=0;u<l;u++){const f=e+u,d=Array(r.length);for(let g=0;g<a.length;g++){const _=c[g];if(_>=0){const{data:m,pageSkip:p}=s[_];d[g]=m[f-p]}}h[u]=d}return h}function qM(r,e){const{asyncColumns:t}=r,n=[];for(const i of e.children)if(i.children.length){const s=t.filter(c=>c.pathInSchema[0]===i.element.name);if(!s.length)continue;const o=new Map,a=Promise.all(s.map(c=>c.data.then(({data:l})=>{o.set(c.pathInSchema.join("."),_g(l))}))).then(()=>{Po(o,i);const c=o.get(i.path.join("."));if(!c)throw new Error("parquet column data not assembled");return{data:[c],pageSkip:0}});n.push({pathInSchema:i.path,data:a})}else{const s=t.find(o=>o.pathInSchema[0]===i.element.name);s&&n.push(s)}return{...r,asyncColumns:n}}async function XM(r){r.metadata??=await dg(r.file,r);const{rowStart:e=0,rowEnd:t,columns:n,onChunk:i,onComplete:s,rowFormat:o,filter:a,filterStrict:c=!0}=r;if(a&&o!=="object")throw new Error('parquet filter requires rowFormat: "object"');const l=wl(a);if(l.length){const m=$u(r.metadata).children.map(v=>v.element.name),p=l.filter(v=>!m.includes(v));if(p.length)throw new Error(`parquet filter columns not found: ${p.join(", ")}`)}let h=n,u=!1;if(n&&a){const m=l.filter(p=>!n.includes(p));m.length&&(h=[...n,...m],u=!0)}const f=h!==n?{...r,columns:h}:r,d=ZM(f);if(!s&&!i){for(const{asyncColumns:m}of d)for(const{data:p}of m)await p;return}const g=$u(r.metadata),_=d.map(m=>qM(m,g));if(i)for(const m of _)for(const p of m.asyncColumns)p.data.then(({data:v,pageSkip:y})=>{let x=m.groupStart+y;for(const A of v)i({columnName:p.pathInSchema[0],columnData:A,rowStart:x,rowEnd:x+A.length}),x+=A.length});if(s){const m=[];for(const p of _){const v=Math.max(e-p.groupStart,0),y=Math.min((t??1/0)-p.groupStart,p.groupRows),x=o==="object"?await Eg(p,v,y,h,"object"):await Eg(p,v,y,n,"array");if(a){for(const A of x)if(Ro(A,a,c)){if(u&&n)for(const E of l)n.includes(E)||delete A[E];m.push(A)}}else gg(m,x)}s(m)}else for(const{asyncColumns:m}of _)for(const{data:p}of m)await p}function ZM(r){if(!r.metadata)throw new Error("parquet requires metadata");const e=AM(r);return r.file=bM(r.file,e),e.groups.map(t=>WM(r,e,t))}var YM=ArrayBuffer,Lt=Uint8Array,Tl=Uint16Array,QM=Int16Array,Cl=Int32Array,rf=function(r,e,t){if(Lt.prototype.slice)return Lt.prototype.slice.call(r,e,t);(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var n=new Lt(t-e);return n.set(r.subarray(e,t)),n},Lo=function(r,e,t,n){if(Lt.prototype.fill)return Lt.prototype.fill.call(r,e,t,n);for((t==null||t<0)&&(t=0),(n==null||n>r.length)&&(n=r.length);t<n;++t)r[t]=e;return r},KM=function(r,e,t,n){if(Lt.prototype.copyWithin)return Lt.prototype.copyWithin.call(r,e,t,n);for((t==null||t<0)&&(t=0),(n==null||n>r.length)&&(n=r.length);t<n;)r[e++]=r[t++]},jM=["invalid zstd data","window size too large (>2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],Ot=function(r,e,t){var n=new Error(e||jM[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,Ot),!t)throw n;return n},Tg=function(r,e,t){for(var n=0,i=0;n<t;++n)i|=r[e++]<<(n<<3);return i},JM=function(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0},$M=function(r,e){var t=r[0]|r[1]<<8|r[2]<<16;if(t==3126568&&r[3]==253){var n=r[4],i=n>>5&1,s=n>>2&1,o=n&3,a=n>>6;n&8&&Ot(0);var c=6-i,l=o==3?4:o,h=Tg(r,c,l);c+=l;var u=a?1<<a:i,f=Tg(r,c,u)+(a==1&&256),d=f;if(!i){var g=1<<10+(r[5]>>3);d=g+(g>>3)*(r[5]&7)}d>2145386496&&Ot(1);var _=new Lt((e==1?f||d:e?0:d)+12);return _[0]=1,_[4]=4,_[8]=8,{b:c+u,y:0,l:0,d:h,w:e&&e!=1?e:_.subarray(12),e:d,o:new Cl(_.buffer,0,3),u:f,c:s,m:Math.min(131072,d)}}else if((t>>4|r[3]<<20)==25481893)return JM(r,4)+8;Ot(0)},Tr=function(r){for(var e=0;1<<e<=r;++e);return e-1},No=function(r,e,t){var n=(e<<3)+4,i=(r[e]&15)+5;i>t&&Ot(3);for(var s=1<<i,o=s,a=-1,c=-1,l=-1,h=s,u=new YM(512+(s<<2)),f=new QM(u,0,256),d=new Tl(u,0,256),g=new Tl(u,512,s),_=512+(s<<1),m=new Lt(u,_,s),p=new Lt(u,_+s);a<255&&o>0;){var v=Tr(o+1),y=n>>3,x=(1<<v+1)-1,A=(r[y]|r[y+1]<<8|r[y+2]<<16)>>(n&7)&x,E=(1<<v)-1,I=x-o-1,D=A&E;if(D<I?(n+=v,A=D):(n+=v+1,A>E&&(A-=I)),f[++a]=--A,A==-1?(o+=A,m[--h]=a):o-=A,!A)do{var b=n>>3;c=(r[b]|r[b+1]<<8)>>(n&7)&3,n+=2,a+=c}while(c==3)}(a>255||o)&&Ot(0);for(var C=0,B=(s>>1)+(s>>3)+3,R=s-1,O=0;O<=a;++O){var M=f[O];if(M<1){d[O]=-M;continue}for(l=0;l<M;++l){m[C]=O;do C=C+B&R;while(C>=h)}}for(C&&Ot(0),l=0;l<s;++l){var z=d[m[l]]++,X=p[l]=i-Tr(z);g[l]=(z<<X)-s}return[n+7>>3,{b:i,s:m,n:p,t:g}]},eE=function(r,e){var t=0,n=-1,i=new Lt(292),s=r[e],o=i.subarray(0,256),a=i.subarray(256,268),c=new Tl(i.buffer,268);if(s<128){var l=No(r,e+1,6),h=l[0],u=l[1];e+=s;var f=h<<3,d=r[e];d||Ot(0);for(var g=0,_=0,m=u.b,p=m,v=(++e<<3)-8+Tr(d);v-=m,!(v<f);){var y=v>>3;if(g+=(r[y]|r[y+1]<<8)>>(v&7)&(1<<m)-1,o[++n]=u.s[g],v-=p,v<f)break;y=v>>3,_+=(r[y]|r[y+1]<<8)>>(v&7)&(1<<p)-1,o[++n]=u.s[_],m=u.n[g],g=u.t[g],p=u.n[_],_=u.t[_]}++n>255&&Ot(0)}else{for(n=s-127;t<n;t+=2){var x=r[++e];o[t]=x>>4,o[t+1]=x&15}++e}var A=0;for(t=0;t<n;++t){var E=o[t];E>11&&Ot(0),A+=E&&1<<E-1}var I=Tr(A)+1,D=1<<I,b=D-A;for(b&b-1&&Ot(0),o[n++]=Tr(b)+1,t=0;t<n;++t){var E=o[t];++a[o[t]=E&&I+1-E]}var C=new Lt(D<<1),B=C.subarray(0,D),R=C.subarray(D);for(c[I]=0,t=I;t>0;--t){var O=c[t];Lo(R,t,O,c[t-1]=O+a[t]*(1<<I-t))}for(c[0]!=D&&Ot(0),t=0;t<n;++t){var M=o[t];if(M){var z=c[M];Lo(B,t,z,c[M]=z+(1<<I-M))}}return[e,{n:R,b:I,s:B}]},tE=No(new Lt([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],nE=No(new Lt([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],iE=No(new Lt([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],Cg=function(r,e){for(var t=r.length,n=new Cl(t),i=0;i<t;++i)n[i]=e,e+=1<<r[i];return n},sf=new Lt(new Cl([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),rE=Cg(sf,0),of=new Lt(new Cl([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),sE=Cg(of,3),Uo=function(r,e,t){var n=r.length,i=e.length,s=r[n-1],o=(1<<t.b)-1,a=-t.b;s||Ot(0);for(var c=0,l=t.b,h=(n<<3)-8+Tr(s)-l,u=-1;h>a&&u<i;){var f=h>>3,d=(r[f]|r[f+1]<<8|r[f+2]<<16)>>(h&7);c=(c<<l|d)&o,e[++u]=t.s[c],h-=l=t.n[c]}(h!=a||u+1!=i)&&Ot(0)},oE=function(r,e,t){var n=6,i=e.length,s=i+3>>2,o=s<<1,a=s+o;Uo(r.subarray(n,n+=r[0]|r[1]<<8),e.subarray(0,s),t),Uo(r.subarray(n,n+=r[2]|r[3]<<8),e.subarray(s,o),t),Uo(r.subarray(n,n+=r[4]|r[5]<<8),e.subarray(o,a),t),Uo(r.subarray(n),e.subarray(a),t)},aE=function(r,e,t){var n,i=e.b,s=r[i],o=s>>1&3;e.l=s&1;var a=s>>3|r[i+1]<<5|r[i+2]<<13,c=(i+=3)+a;if(o==1)return i>=r.length?void 0:(e.b=i+1,t?(Lo(t,r[i],e.y,e.y+=a),t):Lo(new Lt(a),r[i]));if(!(c>r.length)){if(o==0)return e.b=c,t?(t.set(r.subarray(i,c),e.y),e.y+=a,t):rf(r,i,c);if(o==2){var l=r[i],h=l&3,u=l>>2&3,f=l>>4,d=0,g=0;h<2?u&1?f|=r[++i]<<4|(u&2&&r[++i]<<12):f=l>>3:(g=u,u<2?(f|=(r[++i]&63)<<4,d=r[i]>>6|r[++i]<<2):u==2?(f|=r[++i]<<4|(r[++i]&3)<<12,d=r[i]>>2|r[++i]<<6):(f|=r[++i]<<4|(r[++i]&63)<<12,d=r[i]>>6|r[++i]<<2|r[++i]<<10)),++i;var _=t?t.subarray(e.y,e.y+e.m):new Lt(e.m),m=_.length-f;if(h==0)_.set(r.subarray(i,i+=f),m);else if(h==1)Lo(_,r[i++],m);else{var p=e.h;if(h==2){var v=eE(r,i);d+=i-(i=v[0]),e.h=p=v[1]}else p||Ot(0);(g?oE:Uo)(r.subarray(i,i+=d),_.subarray(m),p)}var y=r[i++];if(y){y==255?y=(r[i++]|r[i++]<<8)+32512:y>127&&(y=y-128<<8|r[i++]);var x=r[i++];x&3&&Ot(0);for(var A=[nE,iE,tE],E=2;E>-1;--E){var I=x>>(E<<1)+2&3;if(I==1){var D=new Lt([0,0,r[i++]]);A[E]={s:D.subarray(2,3),n:D.subarray(0,1),t:new Tl(D.buffer,0,1),b:0}}else I==2?(n=No(r,i,9-(E&1)),i=n[0],A[E]=n[1]):I==3&&(e.t||Ot(0),A[E]=e.t[E])}var b=e.t=A,C=b[0],B=b[1],R=b[2],O=r[c-1];O||Ot(0);var M=(c<<3)-8+Tr(O)-R.b,z=M>>3,X=0,H=(r[z]|r[z+1]<<8)>>(M&7)&(1<<R.b)-1;z=(M-=B.b)>>3;var re=(r[z]|r[z+1]<<8)>>(M&7)&(1<<B.b)-1;z=(M-=C.b)>>3;var $=(r[z]|r[z+1]<<8)>>(M&7)&(1<<C.b)-1;for(++y;--y;){var le=R.s[H],W=R.n[H],Z=C.s[$],ge=C.n[$],_e=B.s[re],de=B.n[re];z=(M-=_e)>>3;var oe=1<<_e,ee=oe+((r[z]|r[z+1]<<8|r[z+2]<<16|r[z+3]<<24)>>>(M&7)&oe-1);z=(M-=of[Z])>>3;var pe=sE[Z]+((r[z]|r[z+1]<<8|r[z+2]<<16)>>(M&7)&(1<<of[Z])-1);z=(M-=sf[le])>>3;var ye=rE[le]+((r[z]|r[z+1]<<8|r[z+2]<<16)>>(M&7)&(1<<sf[le])-1);if(z=(M-=W)>>3,H=R.t[H]+((r[z]|r[z+1]<<8)>>(M&7)&(1<<W)-1),z=(M-=ge)>>3,$=C.t[$]+((r[z]|r[z+1]<<8)>>(M&7)&(1<<ge)-1),z=(M-=de)>>3,re=B.t[re]+((r[z]|r[z+1]<<8)>>(M&7)&(1<<de)-1),ee>3)e.o[2]=e.o[1],e.o[1]=e.o[0],e.o[0]=ee-=3;else{var Ae=ee-(ye!=0);Ae?(ee=Ae==3?e.o[0]-1:e.o[Ae],Ae>1&&(e.o[2]=e.o[1]),e.o[1]=e.o[0],e.o[0]=ee):ee=e.o[0]}for(var E=0;E<ye;++E)_[X+E]=_[m+E];X+=ye,m+=ye;var ze=X-ee;if(ze<0){var je=-ze,He=e.e+ze;je>pe&&(je=pe);for(var E=0;E<je;++E)_[X+E]=e.w[He+E];X+=je,pe-=je,ze=0}for(var E=0;E<pe;++E)_[X+E]=_[ze+E];X+=pe}if(X!=m)for(;m<_.length;)_[X++]=_[m++];else X=_.length;t?e.y+=X:_=rf(_,0,X)}else if(t){if(e.y+=f,m)for(var E=0;E<f;++E)_[E]=_[m+E]}else m&&(_=rf(_,m));return e.b=c,_}Ot(2)}},cE=function(r,e){if(r.length==1)return r[0];for(var t=new Lt(e),n=0,i=0;n<r.length;++n){var s=r[n];t.set(s,i),i+=s.length}return t};function lE(r,e){for(var t=[],n=+!e,i=0,s=0;r.length;){var o=$M(r,n||e);if(typeof o=="object"){for(n?(e=null,o.w.length==o.u&&(t.push(e=o.w),s+=o.u)):(t.push(e),o.e=0);!o.l;){var a=aE(r,o,e);a||Ot(5),e?o.e=o.y:(t.push(a),s+=a.length,KM(o.w,0,a.length),o.w.set(a,o.w.length-a.length))}i=o.b+o.c*4}else i=o;r=r.subarray(i)}return cE(t,s)}function hE(){const r=uE();return(e,t)=>{const{memory:n,uncompress:i}=r.exports,s=68e3,o=s+e.byteLength,a=s+e.byteLength+t;if(n.buffer.byteLength<a){const u=n.buffer.byteLength/65536,d=Math.ceil(a/65536)-u;n.grow(d)}const c=new Uint8Array(n.buffer);c.set(e,s);const l=i(s,e.byteLength,o);if(l===-1)throw new Error("invalid snappy length header");if(l===-2)throw new Error("missing eof marker");if(l===-3)throw new Error("premature end of input");if(l)throw new Error(`failed to uncompress data ${l}`);return c.slice(o,o+t)}}function uE(){const r=atob(fE),e=new Uint8Array(r.length);for(let n=0;n<r.length;n+=1)e[n]=r.charCodeAt(n);const t=new WebAssembly.Module(e);return new WebAssembly.Instance(t)}const fE="AGFzbQEAAAABEANgAABgA39/fwF/YAF/AX8DBgUAAQEBAgUDAQACBj8KfwFBoIwEC38AQYAIC38AQaAMC38AQaAMC38AQaCMBAt/AEGACAt/AEGgjAQLfwBBgIAIC38AQQALfwBBAQsHwQEOBm1lbW9yeQIAEV9fd2FzbV9jYWxsX2N0b3JzAAAGbWVtY3B5AAEHbWVtbW92ZQACCnVuY29tcHJlc3MAAwxfX2Rzb19oYW5kbGUDAQpfX2RhdGFfZW5kAwILX19zdGFja19sb3cDAwxfX3N0YWNrX2hpZ2gDBA1fX2dsb2JhbF9iYXNlAwULX19oZWFwX2Jhc2UDBgpfX2hlYXBfZW5kAwcNX19tZW1vcnlfYmFzZQMIDF9fdGFibGVfYmFzZQMJCuASBQIAC8sBAQN/AkAgAkUNAAJAAkAgAkEHcSIDDQAgACEEIAIhBQwBCyAAIQQgAiEFA0AgBCABLQAAOgAAIARBAWohBCABQQFqIQEgBUF/aiEFIANBf2oiAw0ACwsgAkEISQ0AA0AgBCABLQAAOgAAIAQgAS0AAToAASAEIAEtAAI6AAIgBCABLQADOgADIAQgAS0ABDoABCAEIAEtAAU6AAUgBCABLQAGOgAGIAQgAS0ABzoAByAEQQhqIQQgAUEIaiEBIAVBeGoiBQ0ACwsgAAugAwEEfwJAIAAgAUYNAAJAAkAgACABSQ0AIAEgAmoiAyAASw0BCyACRQ0BAkACQCACQQdxIgMNACAAIQQgAiEFDAELIAAhBCACIQUDQCAEIAEtAAA6AAAgBEEBaiEEIAFBAWohASAFQX9qIQUgA0F/aiIDDQALCyACQQhJDQEDQCAEIAEtAAA6AAAgBCABLQABOgABIAQgAS0AAjoAAiAEIAEtAAM6AAMgBCABLQAEOgAEIAQgAS0ABToABSAEIAEtAAY6AAYgBCABLQAHOgAHIARBCGohBCABQQhqIQEgBUF4aiIFDQAMAgsLIAJFDQACQAJAIAJBA3EiBA0AIAAgAmohBiACIQUMAQsgAiEFA0AgBUF/aiIFIABqIgYgBSABaiIDLQAAOgAAIARBf2oiBA0ACwsgAkEESQ0AIAZBfGohASADQXxqIQQDQCABQQNqIARBA2otAAA6AAAgAUECaiAEQQJqLQAAOgAAIAFBAWogBEEBai0AADoAACABIAQtAAA6AAAgAUF8aiEBIARBfGohBCAFQXxqIgUNAAsLIAALswoBCX8jgICAgABBIGsiAySAgICAACADQQlqQgA3AAAgA0IANwIEIAMgA0EYajYCAEF/IQQCQCABRQ0AIAMgAUF/aiIFNgIcIAMgAEEBajYCGCAALAAAIgZB/wBxIQcCQCAGQX9KDQAgBUUNASADIAFBfmoiBTYCHCADIABBAmo2AhggACwAASIGQf8AcUEHdCAHciEHQX8hBCAGQX9KDQAgBUUNASADIAFBfWoiBTYCHCADIABBA2o2AhggACwAAiIGQf8AcUEOdCAHciEHQX8hBCAGQX9KDQAgBUUNASADIAFBfGoiBTYCHCADIABBBGo2AhggACwAAyIGQf8AcUEVdCAHciEHQX8hBCAGQX9KDQAgBUUNASADIAFBe2o2AhwgAyAAQQVqNgIYIAAsAAQiAUEASA0BIAFBHHQgB3IhBwsgAiAHaiEIAkACQCADEISAgIAADQAgAiEADAELIAMoAgQhASACIQADQAJAIAMoAgggAWtBBEoNACADIAE2AgQgAxCEgICAAEUNAiADKAIEIQELIAFBAWohBQJAAkAgAS0AACIGQQNxDQAgCCAAayEJIAMoAggiCiAFayEEIAZBAnYiC0EBaiEHAkAgBkE/Sw0AIARBEEkNACAJQRBIDQAgACABKAIBNgIAIAAgASgCBTYCBCAAIAEoAgk2AgggACABKAINNgIMIAAgB2ohACADKAIIIAUgB2oiAWtBBEoNAyADIAE2AgQgAxCEgICAAEUNBAwCCwJAAkAgBkHwAU8NACAFIQYMAQsgCiAFIAtBRWoiAWoiBmshBCABQQJ0QYCIgIAAaigCACAFKAIAcUEBaiEHCwJAIAcgBE0NAANAIAggAGsgBEkNBSAAIAYgBBCBgICAACEAIAMoAgAiASABKAIAIgkgAygCDCIFaiIGNgIAIAFBBGoiASABKAIAIgogBWsiATYCACADIAE2AgwgACAEaiEAIAFFDQUgAyAJIApqNgIIIAcgBGshByABIQQgByABSw0ACyAIIABrIQkLIAkgB0kNAyAAIAYgBxCBgICAACAHaiEAIAMoAgggBiAHaiIBa0EESg0CIAMgATYCBCADEISAgIAADQEMAwsgACACayAGQQF0QaCIgIAAai8BACIBQQt2IgpBAnRBgIiAgABqKAIAIAUoAgBxIAFBgA5xaiIHQX9qTQ0CIAggAGshBAJAAkAgAUH/AXEiCUEQSw0AIAdBCEkNACAEQRBJDQAgACAAIAdrIgEoAgA2AgAgACABKAIENgIEIAAgASgCCDYCCCAAIAFBDGooAgA2AgwMAQsCQAJAAkAgBCAJQQpqSQ0AIAAgB2shBCAAIQEgCSEGIAdBB0wNAQwCCyAEIAlJDQUgCUEBaiEEQQAgB2shByAAIQEDQCABIAEgB2otAAA6AAAgAUEBaiEBIARBf2oiBEEBSw0ADAMLCwNAIAEgBCgCADYCACABIAQoAgQ2AgQgBiAHayEGIAEgB2oiASAEayIHQQhIDQALCyAGQQFIDQAgBkEIaiEHA0AgASAEKAIANgIAIAEgBCgCBDYCBCABQQhqIQEgBEEIaiEEIAdBeGoiB0EISw0ACwsgACAJaiEAIAMoAgggBSAKaiIBa0EESg0BIAMgATYCBCADEISAgIAARQ0CCyADKAIEIQEMAAsLIAMoAgAiASABKAIEIAMoAgwiBGs2AgQgASAEIAEoAgBqNgIAAkAgAy0AEA0AQX4hBAwBC0EAQX0gCCAARhshBAsgA0EgaiSAgICAACAEC7YDAQd/AkAgACgCBCIBIAAoAggiAkcNACAAKAIAIgIgAigCACIDIAAoAgwiBGoiATYCACACQQRqIgIgAigCACICIARrIgU2AgAgACAFNgIMAkAgAiAERw0AIABBAToAEEEADwsgACADIAJqIgI2AggLAkACQAJAIAIgAWsiAiABLQAAQQF0QaCIgIAAai8BAEELdkEBaiIFTw0AIABBEWogASACEIKAgIAAIQYgACgCDCEEQQAhByAAQQA2AgwgACgCACIBIAEoAgQgBGs2AgQgASAEIAEoAgBqIgM2AgADQCABQQRqKAIAIgFFDQMgBiACaiADIAUgAmsiBCABIAQgAUkbIgQQgYCAgAAaIAAoAgAiASABKAIEIARrNgIEIAEgASgCACAEaiIDNgIAIAQgAmoiAiAFSQ0ACyAAIAY2AgQgACAGIAVqNgIIDAELAkAgAkEESw0AIAAgAEERaiABIAIQgoCAgAAiASACajYCCCAAIAE2AgQgACgCDCECIABBADYCDCAAKAIAIgEgASgCBCACazYCBCABIAIgASgCAGo2AgAMAQsgACABNgIEC0EBIQcLIAcLC6gEAQBBgAgLoAQAAAAA/wAAAP//AAD///8A/////wAAAAAAAAAAAAAAAAEABAgBEAEgAgAFCAIQAiADAAYIAxADIAQABwgEEAQgBQAICAUQBSAGAAkIBhAGIAcACggHEAcgCAALCAgQCCAJAAQJCRAJIAoABQkKEAogCwAGCQsQCyAMAAcJDBAMIA0ACAkNEA0gDgAJCQ4QDiAPAAoJDxAPIBAACwkQEBAgEQAEChEQESASAAUKEhASIBMABgoTEBMgFAAHChQQFCAVAAgKFRAVIBYACQoWEBYgFwAKChcQFyAYAAsKGBAYIBkABAsZEBkgGgAFCxoQGiAbAAYLGxAbIBwABwscEBwgHQAICx0QHSAeAAkLHhAeIB8ACgsfEB8gIAALCyAQICAhAAQMIRAhICIABQwiECIgIwAGDCMQIyAkAAcMJBAkICUACAwlECUgJgAJDCYQJiAnAAoMJxAnICgACwwoECggKQAEDSkQKSAqAAUNKhAqICsABg0rECsgLAAHDSwQLCAtAAgNLRAtIC4ACQ0uEC4gLwAKDS8QLyAwAAsNMBAwIDEABA4xEDEgMgAFDjIQMiAzAAYOMxAzIDQABw40EDQgNQAIDjUQNSA2AAkONhA2IDcACg43EDcgOAALDjgQOCA5AAQPORA5IDoABQ86EDogOwAGDzsQOyA8AAcPPBA8IAEICA89ED0gARAJDz4QPiABGAoPPxA/IAEgCw9AEEAgAGQEbmFtZQE9BQARX193YXNtX2NhbGxfY3RvcnMBBm1lbWNweQIHbWVtbW92ZQMKdW5jb21wcmVzcwQKcmVmaWxsX3RhZwcSAQAPX19zdGFja19wb2ludGVyCQoBAAcucm9kYXRhADIJcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDFVidW50dSBjbGFuZwsxNi4wLjYgKDE1KQAsD3RhcmdldF9mZWF0dXJlcwIrD211dGFibGUtZ2xvYmFscysIc2lnbi1leHQ=",Cr=4096,dE=2*Cr+32,Ig=2*Cr-1,pE=new Uint32Array([0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215]);function Hn(r){this.buf_=new Uint8Array(dE),this.input_=r,this.buf_ptr_=0,this.val_=0,this.pos_=0,this.reset()}Hn.READ_SIZE=Cr,Hn.IBUF_MASK=Ig,Hn.prototype.reset=function(){this.buf_ptr_=0,this.val_=0,this.pos_=0,this.bit_pos_=0,this.bit_end_pos_=0,this.eos_=0,this.readMoreInput();for(let r=0;r<4;r++)this.val_|=this.buf_[this.pos_]<<8*r,this.pos_++;return this.bit_end_pos_>0},Hn.prototype.readMoreInput=function(){if(!(this.bit_end_pos_>256))if(this.eos_){if(this.bit_pos_>this.bit_end_pos_)throw new Error("Unexpected end of input "+this.bit_pos_+" "+this.bit_end_pos_)}else{const r=this.buf_ptr_,e=this.input_.read(this.buf_,r,Cr);if(e<0)throw new Error("Unexpected end of input");if(e<Cr){this.eos_=1;for(let t=0;t<32;t++)this.buf_[r+e+t]=0}if(r===0){for(let t=0;t<32;t++)this.buf_[(Cr<<1)+t]=this.buf_[t];this.buf_ptr_=Cr}else this.buf_ptr_=0;this.bit_end_pos_+=e<<3}},Hn.prototype.fillBitWindow=function(){for(;this.bit_pos_>=8;)this.val_>>>=8,this.val_|=this.buf_[this.pos_&Ig]<<24,this.pos_++,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},Hn.prototype.readBits=function(r){32-this.bit_pos_<r&&this.fillBitWindow();const e=this.val_>>>this.bit_pos_&pE[r];return this.bit_pos_+=r,e};const mE=8,af=8,gE=255,cf=18,_E=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),vE=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function bt(r,e){this.bits=r,this.value=e}const Rg=16,Rs=15;function Pg(r,e){let t=1<<e-1;for(;r&t;)t>>=1;return(r&t-1)+t}function Dg(r,e,t,n,i){do n-=t,r[e+n]=new bt(i.bits,i.value);while(n>0)}function yE(r,e,t){let n=1<<e-t;for(;e<Rs&&(n-=r[e],!(n<=0));)++e,n<<=1;return e-t}function Lg(r,e,t,n,i){const s=e,o=new Int32Array(Rs+1),a=new Int32Array(Rs+1),c=new Int32Array(i);for(let m=0;m<i;m++)o[n[m]]++;a[1]=0;for(let m=1;m<Rs;m++)a[m+1]=a[m]+o[m];for(let m=0;m<i;m++)n[m]!==0&&(c[a[n[m]]++]=m);let l=t,h=1<<l,u=h;if(a[Rs]===1){for(let m=0;m<u;++m)r[e+m]=new bt(0,c[0]&65535);return u}let f=0,d=0;for(let m=1,p=2;m<=t;++m,p<<=1)for(;o[m]>0;--o[m]){const v=new bt(m&255,c[d++]&65535);Dg(r,e+f,p,h,v),f=Pg(f,m)}const g=u-1;let _=-1;for(let m=t+1,p=2;m<=Rs;++m,p<<=1)for(;o[m]>0;--o[m]){(f&g)!==_&&(e+=h,l=yE(o,m,t),h=1<<l,u+=h,_=f&g,r[s+_]=new bt(l+t&255,e-s-_&65535));const v=new bt(m-t&255,c[d++]&65535);Dg(r,e+(f>>t),p,h,v),f=Pg(f,m)}return u}function Il(r,e,t,n){const i=new Uint8Array(r);n.readMoreInput();const s=n.readBits(2);if(s===1){let a=r-1,c=0;const l=new Int32Array(4),h=n.readBits(2)+1;for(;a;)a>>=1,c++;for(let u=0;u<h;u++)l[u]=n.readBits(c)%r,i[l[u]]=2;switch(i[l[0]]=1,h){case 1:break;case 3:if(l[0]===l[1]||l[0]===l[2]||l[1]===l[2])throw new Error("[ReadHuffmanCode] invalid symbols");break;case 2:if(l[0]===l[1])throw new Error("[ReadHuffmanCode] invalid symbols");i[l[1]]=1;break;case 4:if(l[0]===l[1]||l[0]===l[2]||l[0]===l[3]||l[1]===l[2]||l[1]===l[3]||l[2]===l[3])throw new Error("[ReadHuffmanCode] invalid symbols");n.readBits(1)?(i[l[2]]=3,i[l[3]]=3):i[l[0]]=2;break}}else{const a=new Uint8Array(cf);let c=32,l=0;const h=[new bt(2,0),new bt(2,4),new bt(2,3),new bt(3,2),new bt(2,0),new bt(2,4),new bt(2,3),new bt(4,1),new bt(2,0),new bt(2,4),new bt(2,3),new bt(3,2),new bt(2,0),new bt(2,4),new bt(2,3),new bt(4,5)];for(let u=s;u<cf&&c>0;u++){const f=_E[u];let d=0;n.fillBitWindow(),d+=n.val_>>>n.bit_pos_&15,n.bit_pos_+=h[d].bits;const g=h[d].value;a[f]=g,g!==0&&(c-=32>>g,l++)}if(!(l===1||c===0))throw new Error("[ReadHuffmanCode] invalid num_codes or space");xE(a,r,i,n)}const o=Lg(e,t,af,i,r);if(!o)throw new Error("brotli BuildHuffmanTable failed");return o}function Ps(r,e,t){t.fillBitWindow(),e+=t.val_>>>t.bit_pos_&gE;const n=r[e].bits-af;return n>0&&(t.bit_pos_+=af,e+=r[e].value,e+=t.val_>>>t.bit_pos_&(1<<n)-1),t.bit_pos_+=r[e].bits,r[e].value}function xE(r,e,t,n){let i=0,s=mE,o=0,a=0,c=32768;const l=[];for(let h=0;h<32;h++)l.push(new bt(0,0));for(Lg(l,0,5,r,cf);i<e&&c>0;){let h=0;n.readMoreInput(),n.fillBitWindow(),h+=n.val_>>>n.bit_pos_&31,n.bit_pos_+=l[h].bits;const u=l[h].value&255;if(u<Rg)o=0,t[i++]=u,u!==0&&(s=u,c-=32768>>u);else{const f=u-14;let d=0;u===Rg&&(d=s),a!==d&&(o=0,a=d);const g=o;o>0&&(o-=2,o<<=f),o+=n.readBits(f)+3;const _=o-g;if(i+_>e)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(let m=0;m<_;m++)t[i+m]=a;i+=_,a!==0&&(c-=_<<15-a)}}if(c!==0)throw new Error("[ReadHuffmanCodeLengths] space = "+c);for(;i<e;i++)t[i]=0}function Ir(r,e){this.alphabet_size=r,this.num_htrees=e,this.codes=new Array(e+e*vE[r+31>>>5]),this.htrees=new Uint32Array(e)}Ir.prototype.decode=function(r){let e=0;for(let t=0;t<this.num_htrees;t++)this.htrees[t]=e,e+=Il(this.alphabet_size,this.codes,e,r)};function lf([r,e]){return{offset:r,nbits:e}}const AE=[[1,2],[5,2],[9,2],[13,2],[17,3],[25,3],[33,3],[41,3],[49,4],[65,4],[81,4],[97,4],[113,5],[145,5],[177,5],[209,5],[241,6],[305,6],[369,7],[497,8],[753,9],[1265,10],[2289,11],[4337,12],[8433,13],[16625,24]].map(lf),bE=[[0,0],[1,0],[2,0],[3,0],[4,0],[5,0],[6,1],[8,1],[10,2],[14,2],[18,3],[26,3],[34,4],[50,4],[66,5],[98,5],[130,6],[194,7],[322,8],[578,9],[1090,10],[2114,12],[6210,14],[22594,24]].map(lf),wE=[[2,0],[3,0],[4,0],[5,0],[6,0],[7,0],[8,0],[9,0],[10,1],[12,1],[14,2],[18,2],[22,3],[30,3],[38,4],[54,4],[70,5],[102,5],[134,6],[198,7],[326,8],[582,9],[1094,10],[2118,24]].map(lf),SE=[0,0,8,8,0,16,8,16,16],ME=[0,8,0,8,16,0,16,8,16],Fi=1080,Ng=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ug=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]);function Bg(r,e){const t=new Uint16Array(31);for(let i=0;i<31;i++)t[i]=e+=1<<r[i-1];const n=new Int32Array(t[30]);for(let i=1;i<30;i++)for(let s=t[i];s<t[i+1];++s)n[s]=s-t[i]<<5|i;return{base:t,rev:n}}const{base:Og,rev:EE}=Bg(Ng,2);Og[28]=258,EE[258]=28;const{base:TE}=Bg(Ug,0),hf=new Uint16Array(32768);for(let r=0;r<32768;r++){let e=(r&43690)>>1|(r&21845)<<1;e=(e&52428)>>2|(e&13107)<<2,e=(e&61680)>>4|(e&3855)<<4,hf[r]=((e&65280)>>8|(e&255)<<8)>>1}function Bo(r,e,t){const n=new Uint16Array(e);for(let o=0;o<r.length;o++)r[o]&&++n[r[o]-1];const i=new Uint16Array(e);for(let o=1;o<e;o++)i[o]=i[o-1]+n[o-1]<<1;let s;if(t){s=new Uint16Array(1<<e);const o=15-e;for(let a=0;a<r.length;a++)if(r[a]){const c=a<<4|r[a],l=e-r[a];let h=i[r[a]-1]++<<l;for(const u=h|(1<<l)-1;h<=u;h++)s[hf[h]>>o]=c}}else{s=new Uint16Array(r.length);for(let o=0;o<r.length;o++)r[o]&&(s[o]=hf[i[r[o]-1]++]>>15-r[o])}return s}const Oo=new Uint8Array(288);for(let r=0;r<144;r++)Oo[r]=8;for(let r=144;r<256;r++)Oo[r]=9;for(let r=256;r<280;r++)Oo[r]=7;for(let r=280;r<288;r++)Oo[r]=8;const Fg=new Uint8Array(32);for(let r=0;r<32;r++)Fg[r]=5;const CE=Bo(Oo,9,1),IE=Bo(Fg,5,1);function uf(r,e,t,n,i,s,o){const a=t*2,c=t,l=Ps(e,t*Fi,o);let h;l===0?h=i[a+(s[c]&1)]:l===1?h=i[a+(s[c]-1&1)]+1:h=l-2,h>=r&&(h-=r),n[t]=h,i[a+(s[c]&1)]=h,s[c]++}function RE(r){const e={meta_block_length:0,input_end:0,is_uncompressed:0,is_metadata:!1};if(e.input_end=r.readBits(1),e.input_end&&r.readBits(1))return e;const t=r.readBits(2)+4;if(t===7){if(e.is_metadata=!0,r.readBits(1)!==0)throw new Error("Invalid reserved bit");const n=r.readBits(2);if(n===0)return e;for(let i=0;i<n;i++){const s=r.readBits(8);if(i+1===n&&n>1&&s===0)throw new Error("Invalid size byte");e.meta_block_length|=s<<i*8}}else for(let n=0;n<t;n++){const i=r.readBits(4);if(n+1===t&&t>4&&i===0)throw new Error("Invalid size nibble");e.meta_block_length|=i<<n*4}return e.meta_block_length++,!e.input_end&&!e.is_metadata&&(e.is_uncompressed=r.readBits(1)),e}function PE(r,e,t,n,i,s){const o=i+1;let a=t&i,c=s.pos_&Hn.IBUF_MASK;if(e<8||s.bit_pos_+(e<<3)<s.bit_end_pos_){for(;e-- >0;)s.readMoreInput(),n[a++]=s.readBits(8),a===o&&(r.write(n,o),a=0);return}if(s.bit_end_pos_<32)throw new Error("copyUncompressedBlockToOutput: br.bit_end_pos_ < 32");for(;s.bit_pos_<32;)n[a]=s.val_>>>s.bit_pos_,s.bit_pos_+=8,a++,e--;let l=s.bit_end_pos_-s.bit_pos_>>3;if(c+l>Hn.IBUF_MASK){const h=Hn.IBUF_MASK+1-c;for(let u=0;u<h;u++)n[a+u]=s.buf_[c+u];l-=h,a+=h,e-=h,c=0}for(let h=0;h<l;h++)n[a+h]=s.buf_[c+h];if(a+=l,e-=l,a>=o){r.write(n,o),a-=o;for(let h=0;h<a;h++)n[h]=n[o+h]}for(;a+e>=o;){if(l=o-a,s.input_.read(n,a,l)<l)throw new Error("copyUncompressedBlockToOutput: not enough bytes");r.write(n,o),e-=l,a=0}if(s.input_.read(n,a,e)<e)throw new Error("copyUncompressedBlockToOutput: not enough bytes");s.reset()}function zg(r){if(r.readBits(1)){const e=r.readBits(3);return e===0?1:r.readBits(e)+(1<<e)}return 0}function DE(r){if(r.readBits(1)===0)return 16;let e=r.readBits(3);return e>0?17+e:(e=r.readBits(3),e>0?8+e:17)}function LE(r){const e=r.bit_pos_+7&-8;return!r.readBits(e-r.bit_pos_)}function Rl(r,e,t){const n=Ps(r,e,t),{offset:i,nbits:s}=AE[n];return i+t.readBits(s)}const kg=new Uint8Array([0,0,0,0,0,0,0,0,0,4,4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,12,16,12,12,20,12,16,24,28,12,12,32,12,36,12,44,44,44,44,44,44,44,44,44,44,32,32,24,40,28,12,12,48,52,52,52,48,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,24,12,28,12,12,12,56,60,60,60,56,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,24,12,28,12,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,40,40,40,40,41,41,41,41,42,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Pl=new Uint16Array([1024,1536,1280,1536,0,256,768,512]);function Vg(r,e){let t=0;e.readMoreInput();const n=zg(e)+1,i=new Uint8Array(r);if(n<=1)return[n,i];e.readBits(1)&&(t=e.readBits(4)+1);const o=[];for(let a=0;a<Fi;a++)o[a]=new bt(0,0);Il(n+t,o,0,e);for(let a=0;a<r;){e.readMoreInput();const c=Ps(o,0,e);if(c===0)i[a]=0,a++;else if(c<=t){let l=1+(1<<c)+e.readBits(c);for(;--l;){if(a>=r)throw new Error("[DecodeContextMap] i >= context_map_size");i[a]=0,a++}}else i[a]=c-t,a++}return e.readBits(1)&&UE(i,r),[n,i]}function NE(r,e){const t=r[e];for(let n=e;n;n--)r[n]=r[n-1];r[0]=t}function UE(r,e){const t=new Uint8Array(256);for(let n=0;n<256;n++)t[n]=n;for(let n=0;n<e;n++){const i=r[n];r[n]=t[i],i&&NE(t,i)}}function Hg(r){this.buffer=r,this.pos=0}Hg.prototype.read=function(r,e,t){this.pos+t>this.buffer.length&&(t=this.buffer.length-this.pos);for(let n=0;n<t;n++)r[e+n]=this.buffer[this.pos+n];return this.pos+=t,t};function Gg(r){this.buffer=r,this.pos=0}Gg.prototype.write=function(r,e){if(this.pos+e>this.buffer.length)throw new Error("brotli output buffer is not large enough");return this.buffer.set(r.subarray(0,e),this.pos),this.pos+=e,e};const BE=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);function Gn(r,e,t){const n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t}function ff(r,e){const t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)}function OE(r){return(r+7)/8|0}function FE(r,e){if(r[e++]!==31||r[e++]!==139||r[e++]!==8)return 0;const t=r[e++];e+=6,t&4&&(e+=(r[e+10]|r[e+11]<<8)+2);for(let n=(t>>3&1)+(t>>4&1);n>0;n-=Number(!r[e++]));return e+(t&2)}function df(r,e,t=0,n=0){let i=e??new Uint8Array(1024);if(!(r.length-t))return i;const s=FE(r,t);if(s===r.length-8)return i;if(s>r.length-8)throw new Error("unexpected EOF");let o=s*8,a=0,c=0,l=0,h,u;const f=r.length*8;function d(g){if(!e&&g>i.length){const _=i;i=new Uint8Array(Math.max(_.length*2,g)),i.set(_)}}do{if(!h){a=Gn(r,o,1);const p=Gn(r,o+1,3);if(o+=3,p)if(p===1)h=CE,u=IE,c=9,l=5;else if(p===2){const v=Gn(r,o,31)+257,y=Gn(r,o+10,15)+4,x=v+Gn(r,o+5,31)+1;o+=14;const A=new Uint8Array(x),E=new Uint8Array(19);for(let R=0;R<y;++R)E[BE[R]]=Gn(r,o+R*3,7);o+=y*3;const I=Math.max(...E),D=(1<<I)-1,b=Bo(E,I,1);for(let R=0;R<x;){const O=b[Gn(r,o,D)];o+=O&15;const M=O>>4;if(M<16)A[R++]=M;else{let z=0,X=0;for(M===16?(X=3+Gn(r,o,3),o+=2,z=A[R-1]):M===17?(X=3+Gn(r,o,7),o+=3):M===18&&(X=11+Gn(r,o,127),o+=7);X--;)A[R++]=z}}const C=A.subarray(0,v),B=A.subarray(v);c=Math.max(...C),l=Math.max(...B),h=Bo(C,c,1),u=Bo(B,l,1)}else throw new Error("invalid block type");else{const v=OE(o)+4,y=r[v-4]|r[v-3]<<8,x=v+y;if(x>r.length)throw new Error("unexpected EOF");d(n+y),i.set(r.subarray(v,x),n),n+=y,o=x*8;continue}if(o>f)throw new Error("unexpected EOF")}d(n+131072);const g=(1<<c)-1,_=(1<<l)-1;let m=o;for(;;m=o){const p=h[ff(r,o)&g],v=p>>4;if(o+=p&15,o>f)throw new Error("unexpected EOF");if(!p)throw new Error("invalid length/literal");if(v<256)i[n++]=v;else if(v===256){m=o,h=void 0;break}else{let y=v-254;if(v>264){const D=v-257,b=Ng[D];y=Gn(r,o,(1<<b)-1)+Og[D],o+=b}if(!u)throw new Error("invalid distance map");const x=u[ff(r,o)&_],A=x>>4;if(!x)throw new Error("invalid distance");o+=x&15;let E=TE[A];if(A>3){const D=Ug[A];E+=ff(r,o)&(1<<D)-1,o+=D}if(o>f)throw new Error("unexpected EOF");const I=n+y;if(n<E)throw new Error("unexpected dictionary case");for(d(I);n<I;n++)i[n]=i[n-E]}}o=m,h&&(a=1)}while(!a);if(n<i.length){const g=Math.ceil(o/8)+8;df(r,i,g,n)}return e?i:i.subarray(0,n)}const zE=`
4046
+ */(function(r,e){(function(t){r.exports=t()})(function(){return function t(n,i,s){function o(l,h){if(!i[l]){if(!n[l]){var u=typeof yl=="function"&&yl;if(!h&&u)return u(l,!0);if(a)return a(l,!0);var f=new Error("Cannot find module '"+l+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[l]={exports:{}};n[l][0].call(d.exports,function(g){var _=n[l][1][g];return o(_||g)},d,d.exports,t,n,i,s)}return i[l].exports}for(var a=typeof yl=="function"&&yl,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(t,n,i){var s=t("./utils"),o=t("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(c){for(var l,h,u,f,d,g,_,m=[],p=0,v=c.length,y=v,x=s.getTypeOf(c)!=="string";p<c.length;)y=v-p,u=x?(l=c[p++],h=p<v?c[p++]:0,p<v?c[p++]:0):(l=c.charCodeAt(p++),h=p<v?c.charCodeAt(p++):0,p<v?c.charCodeAt(p++):0),f=l>>2,d=(3&l)<<4|h>>4,g=1<y?(15&h)<<2|u>>6:64,_=2<y?63&u:64,m.push(a.charAt(f)+a.charAt(d)+a.charAt(g)+a.charAt(_));return m.join("")},i.decode=function(c){var l,h,u,f,d,g,_=0,m=0,p="data:";if(c.substr(0,p.length)===p)throw new Error("Invalid base64 input, it looks like a data url.");var v,y=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===a.charAt(64)&&y--,c.charAt(c.length-2)===a.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=o.uint8array?new Uint8Array(0|y):new Array(0|y);_<c.length;)l=a.indexOf(c.charAt(_++))<<2|(f=a.indexOf(c.charAt(_++)))>>4,h=(15&f)<<4|(d=a.indexOf(c.charAt(_++)))>>2,u=(3&d)<<6|(g=a.indexOf(c.charAt(_++))),v[m++]=l,d!==64&&(v[m++]=h),g!==64&&(v[m++]=u);return v}},{"./support":30,"./utils":32}],2:[function(t,n,i){var s=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),c=t("./stream/DataLengthProbe");function l(h,u,f,d,g){this.compressedSize=h,this.uncompressedSize=u,this.crc32=f,this.compression=d,this.compressedContent=g}l.prototype={getContentWorker:function(){var h=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),u=this;return h.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(h,u,f){return h.pipe(new a).pipe(new c("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new c("compressedSize")).withStreamInfo("compression",u)},n.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,n,i){var s=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,n,i){var s=t("./utils"),o=function(){for(var a,c=[],l=0;l<256;l++){a=l;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;c[l]=a}return c}();n.exports=function(a,c){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(l,h,u,f){var d=o,g=f+u;l^=-1;for(var _=f;_<g;_++)l=l>>>8^d[255&(l^h[_])];return-1^l}(0|c,a,a.length,0):function(l,h,u,f){var d=o,g=f+u;l^=-1;for(var _=f;_<g;_++)l=l>>>8^d[255&(l^h.charCodeAt(_))];return-1^l}(0|c,a,a.length,0):0}},{"./utils":32}],5:[function(t,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,n,i){var s=null;s=typeof Promise<"u"?Promise:t("lie"),n.exports={Promise:s}},{lie:37}],7:[function(t,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),c=t("./stream/GenericWorker"),l=s?"uint8array":"array";function h(u,f){c.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(h,c),h.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(l,u.data),!1)},h.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(f){u.push({data:f,meta:u.meta})}},i.compressWorker=function(u){return new h("Deflate",u)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,n,i){function s(d,g){var _,m="";for(_=0;_<g;_++)m+=String.fromCharCode(255&d),d>>>=8;return m}function o(d,g,_,m,p,v){var y,x,A=d.file,E=d.compression,I=v!==l.utf8encode,D=a.transformTo("string",v(A.name)),b=a.transformTo("string",l.utf8encode(A.name)),C=A.comment,B=a.transformTo("string",v(C)),R=a.transformTo("string",l.utf8encode(C)),O=b.length!==A.name.length,M=R.length!==C.length,z="",X="",H="",re=A.dir,J=A.date,le={crc32:0,compressedSize:0,uncompressedSize:0};g&&!_||(le.crc32=d.crc32,le.compressedSize=d.compressedSize,le.uncompressedSize=d.uncompressedSize);var W=0;g&&(W|=8),I||!O&&!M||(W|=2048);var Z=0,ge=0;re&&(Z|=16),p==="UNIX"?(ge=798,Z|=function(de,oe){var ee=de;return de||(ee=oe?16893:33204),(65535&ee)<<16}(A.unixPermissions,re)):(ge=20,Z|=function(de){return 63&(de||0)}(A.dosPermissions)),y=J.getUTCHours(),y<<=6,y|=J.getUTCMinutes(),y<<=5,y|=J.getUTCSeconds()/2,x=J.getUTCFullYear()-1980,x<<=4,x|=J.getUTCMonth()+1,x<<=5,x|=J.getUTCDate(),O&&(X=s(1,1)+s(h(D),4)+b,z+="up"+s(X.length,2)+X),M&&(H=s(1,1)+s(h(B),4)+R,z+="uc"+s(H.length,2)+H);var _e="";return _e+=`
4047
+ \0`,_e+=s(W,2),_e+=E.magic,_e+=s(y,2),_e+=s(x,2),_e+=s(le.crc32,4),_e+=s(le.compressedSize,4),_e+=s(le.uncompressedSize,4),_e+=s(D.length,2),_e+=s(z.length,2),{fileRecord:u.LOCAL_FILE_HEADER+_e+D+z,dirRecord:u.CENTRAL_FILE_HEADER+s(ge,2)+_e+s(B.length,2)+"\0\0\0\0"+s(Z,4)+s(m,4)+D+z+B}}var a=t("../utils"),c=t("../stream/GenericWorker"),l=t("../utf8"),h=t("../crc32"),u=t("../signature");function f(d,g,_,m){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=_,this.encodeFileName=m,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,c),f.prototype.push=function(d){var g=d.meta.percent||0,_=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,c.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:_?(g+100*(_-m-1))/_:100}}))},f.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var g=this.streamFiles&&!d.file.dir;if(g){var _=o(d,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:_.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(d){this.accumulate=!1;var g=this.streamFiles&&!d.file.dir,_=o(d,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(_.dirRecord),g)this.push({data:function(m){return u.DATA_DESCRIPTOR+s(m.crc32,4)+s(m.compressedSize,4)+s(m.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:_.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var d=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var _=this.bytesWritten-d,m=function(p,v,y,x,A){var E=a.transformTo("string",A(x));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(p,2)+s(p,2)+s(v,4)+s(y,4)+s(E.length,2)+E}(this.dirRecords.length,_,d,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(d){this._sources.push(d);var g=this;return d.on("data",function(_){g.processChunk(_)}),d.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),d.on("error",function(_){g.error(_)}),this},f.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(d){var g=this._sources;if(!c.prototype.error.call(this,d))return!1;for(var _=0;_<g.length;_++)try{g[_].error(d)}catch{}return!0},f.prototype.lock=function(){c.prototype.lock.call(this);for(var d=this._sources,g=0;g<d.length;g++)d[g].lock()},n.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,n,i){var s=t("../compressions"),o=t("./ZipFileWorker");i.generateWorker=function(a,c,l){var h=new o(c.streamFiles,l,c.platform,c.encodeFileName),u=0;try{a.forEach(function(f,d){u++;var g=function(v,y){var x=v||y,A=s[x];if(!A)throw new Error(x+" is not a valid compression method !");return A}(d.options.compression,c.compression),_=d.options.compressionOptions||c.compressionOptions||{},m=d.dir,p=d.date;d._compressWorker(g,_).withStreamInfo("file",{name:f,dir:m,date:p,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(h)}),h.entriesCount=u}catch(f){h.error(f)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,n,i){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new s;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(s.prototype=t("./object")).loadAsync=t("./load"),s.support=t("./support"),s.defaults=t("./defaults"),s.version="3.10.1",s.loadAsync=function(o,a){return new s().loadAsync(o,a)},s.external=t("./external"),n.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,n,i){var s=t("./utils"),o=t("./external"),a=t("./utf8"),c=t("./zipEntries"),l=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function u(f){return new o.Promise(function(d,g){var _=f.decompressed.getContentWorker().pipe(new l);_.on("error",function(m){g(m)}).on("end",function(){_.streamInfo.crc32!==f.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}n.exports=function(f,d){var g=this;return d=s.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",f,!0,d.optimizedBinaryString,d.base64).then(function(_){var m=new c(d);return m.load(_),m}).then(function(_){var m=[o.Promise.resolve(_)],p=_.files;if(d.checkCRC32)for(var v=0;v<p.length;v++)m.push(u(p[v]));return o.Promise.all(m)}).then(function(_){for(var m=_.shift(),p=m.files,v=0;v<p.length;v++){var y=p[v],x=y.fileNameStr,A=s.resolve(y.fileNameStr);g.file(A,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:d.createFolders}),y.dir||(g.file(A).unsafeOriginalName=x)}return m.zipComment.length&&(g.comment=m.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,n,i){var s=t("../utils"),o=t("../stream/GenericWorker");function a(c,l){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(l)}s.inherits(a,o),a.prototype._bindStream=function(c){var l=this;(this._stream=c).pause(),c.on("data",function(h){l.push({data:h,meta:{percent:0}})}).on("error",function(h){l.isPaused?this.generatedError=h:l.error(h)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},a.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,n,i){var s=t("readable-stream").Readable;function o(a,c,l){s.call(this,c),this._helper=a;var h=this;a.on("data",function(u,f){h.push(u)||h._helper.pause(),l&&l(f)}).on("error",function(u){h.emit("error",u)}).on("end",function(){h.push(null)})}t("../utils").inherits(o,s),o.prototype._read=function(){this._helper.resume()},n.exports=o},{"../utils":32,"readable-stream":16}],14:[function(t,n,i){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,o);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,o)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var o=new Buffer(s);return o.fill(0),o},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(t,n,i){function s(A,E,I){var D,b=a.getTypeOf(E),C=a.extend(I||{},h);C.date=C.date||new Date,C.compression!==null&&(C.compression=C.compression.toUpperCase()),typeof C.unixPermissions=="string"&&(C.unixPermissions=parseInt(C.unixPermissions,8)),C.unixPermissions&&16384&C.unixPermissions&&(C.dir=!0),C.dosPermissions&&16&C.dosPermissions&&(C.dir=!0),C.dir&&(A=p(A)),C.createFolders&&(D=m(A))&&v.call(this,D,!0);var B=b==="string"&&C.binary===!1&&C.base64===!1;I&&I.binary!==void 0||(C.binary=!B),(E instanceof u&&E.uncompressedSize===0||C.dir||!E||E.length===0)&&(C.base64=!1,C.binary=!0,E="",C.compression="STORE",b="string");var R=null;R=E instanceof u||E instanceof c?E:g.isNode&&g.isStream(E)?new _(A,E):a.prepareContent(A,E,C.binary,C.optimizedBinaryString,C.base64);var O=new f(A,R,C);this.files[A]=O}var o=t("./utf8"),a=t("./utils"),c=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),h=t("./defaults"),u=t("./compressedObject"),f=t("./zipObject"),d=t("./generate"),g=t("./nodejsUtils"),_=t("./nodejs/NodejsStreamInputAdapter"),m=function(A){A.slice(-1)==="/"&&(A=A.substring(0,A.length-1));var E=A.lastIndexOf("/");return 0<E?A.substring(0,E):""},p=function(A){return A.slice(-1)!=="/"&&(A+="/"),A},v=function(A,E){return E=E!==void 0?E:h.createFolders,A=p(A),this.files[A]||s.call(this,A,null,{dir:!0,createFolders:E}),this.files[A]};function y(A){return Object.prototype.toString.call(A)==="[object RegExp]"}var x={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(A){var E,I,D;for(E in this.files)D=this.files[E],(I=E.slice(this.root.length,E.length))&&E.slice(0,this.root.length)===this.root&&A(I,D)},filter:function(A){var E=[];return this.forEach(function(I,D){A(I,D)&&E.push(D)}),E},file:function(A,E,I){if(arguments.length!==1)return A=this.root+A,s.call(this,A,E,I),this;if(y(A)){var D=A;return this.filter(function(C,B){return!B.dir&&D.test(C)})}var b=this.files[this.root+A];return b&&!b.dir?b:null},folder:function(A){if(!A)return this;if(y(A))return this.filter(function(b,C){return C.dir&&A.test(b)});var E=this.root+A,I=v.call(this,E),D=this.clone();return D.root=I.name,D},remove:function(A){A=this.root+A;var E=this.files[A];if(E||(A.slice(-1)!=="/"&&(A+="/"),E=this.files[A]),E&&!E.dir)delete this.files[A];else for(var I=this.filter(function(b,C){return C.name.slice(0,A.length)===A}),D=0;D<I.length;D++)delete this.files[I[D].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(A){var E,I={};try{if((I=a.extend(A||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=I.type.toLowerCase(),I.compression=I.compression.toUpperCase(),I.type==="binarystring"&&(I.type="string"),!I.type)throw new Error("No output type specified.");a.checkSupport(I.type),I.platform!=="darwin"&&I.platform!=="freebsd"&&I.platform!=="linux"&&I.platform!=="sunos"||(I.platform="UNIX"),I.platform==="win32"&&(I.platform="DOS");var D=I.comment||this.comment||"";E=d.generateWorker(this,I,D)}catch(b){(E=new c("error")).error(b)}return new l(E,I.type||"string",I.mimeType)},generateAsync:function(A,E){return this.generateInternalStream(A).accumulate(E)},generateNodeStream:function(A,E){return(A=A||{}).type||(A.type="nodebuffer"),this.generateInternalStream(A).toNodejsStream(E)}};n.exports=x},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,n,i){n.exports=t("stream")},{stream:void 0}],17:[function(t,n,i){var s=t("./DataReader");function o(a){s.call(this,a);for(var c=0;c<this.data.length;c++)a[c]=255&a[c]}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data[this.zero+a]},o.prototype.lastIndexOfSignature=function(a){for(var c=a.charCodeAt(0),l=a.charCodeAt(1),h=a.charCodeAt(2),u=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===c&&this.data[f+1]===l&&this.data[f+2]===h&&this.data[f+3]===u)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(a){var c=a.charCodeAt(0),l=a.charCodeAt(1),h=a.charCodeAt(2),u=a.charCodeAt(3),f=this.readData(4);return c===f[0]&&l===f[1]&&h===f[2]&&u===f[3]},o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=o},{"../utils":32,"./DataReader":18}],18:[function(t,n,i){var s=t("../utils");function o(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var c,l=0;for(this.checkOffset(a),c=this.index+a-1;c>=this.index;c--)l=(l<<8)+this.byteAt(c);return this.index+=a,l},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=o},{"../utils":32}],19:[function(t,n,i){var s=t("./Uint8ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,n,i){var s=t("./DataReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,n,i){var s=t("./ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,n,i){var s=t("../utils"),o=t("../support"),a=t("./ArrayReader"),c=t("./StringReader"),l=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");n.exports=function(u){var f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new l(u):o.uint8array?new h(s.transformTo("uint8array",u)):new a(s.transformTo("array",u)):new c(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,n,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,n,i){var s=t("./GenericWorker"),o=t("../utils");function a(c){s.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(a,s),a.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,n,i){var s=t("./GenericWorker"),o=t("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,s),a.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,n,i){var s=t("../utils"),o=t("./GenericWorker");function a(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(a,o),a.prototype.processChunk=function(c){if(c){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+c.data.length}o.prototype.processChunk.call(this,c)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,n,i){var s=t("../utils"),o=t("./GenericWorker");function a(c){o.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(h){l.dataIsReady=!0,l.data=h,l.max=h&&h.length||0,l.type=s.getTypeOf(h),l.isPaused||l._tickAndRepeat()},function(h){l.error(h)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,l);break;case"uint8array":c=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":c=this.data.slice(this.index,l)}return this.index=l,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,n,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,a)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var a=this;return o.on("data",function(c){a.processChunk(c)}),o.on("end",function(){a.end()}),o.on("error",function(c){a.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,a){return this.extraStreamInfo[o]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},n.exports=s},{}],29:[function(t,n,i){var s=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),c=t("../base64"),l=t("../support"),h=t("../external"),u=null;if(l.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(g,_){return new h.Promise(function(m,p){var v=[],y=g._internalType,x=g._outputType,A=g._mimeType;g.on("data",function(E,I){v.push(E),_&&_(I)}).on("error",function(E){v=[],p(E)}).on("end",function(){try{var E=function(I,D,b){switch(I){case"blob":return s.newBlob(s.transformTo("arraybuffer",D),b);case"base64":return c.encode(D);default:return s.transformTo(I,D)}}(x,function(I,D){var b,C=0,B=null,R=0;for(b=0;b<D.length;b++)R+=D[b].length;switch(I){case"string":return D.join("");case"array":return Array.prototype.concat.apply([],D);case"uint8array":for(B=new Uint8Array(R),b=0;b<D.length;b++)B.set(D[b],C),C+=D[b].length;return B;case"nodebuffer":return Buffer.concat(D);default:throw new Error("concat : unsupported type '"+I+"'")}}(y,v),A);m(E)}catch(I){p(I)}v=[]}).resume()})}function d(g,_,m){var p=_;switch(_){case"blob":case"arraybuffer":p="uint8array";break;case"base64":p="string"}try{this._internalType=p,this._outputType=_,this._mimeType=m,s.checkSupport(p),this._worker=g.pipe(new o(p)),g.lock()}catch(v){this._worker=new a("error"),this._worker.error(v)}}d.prototype={accumulate:function(g){return f(this,g)},on:function(g,_){var m=this;return g==="data"?this._worker.on(g,function(p){_.call(m,p.data,p.meta)}):this._worker.on(g,function(){s.delay(_,arguments,m)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:this._outputType!=="nodebuffer"},g)}},n.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,n,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,n,i){for(var s=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),c=t("./stream/GenericWorker"),l=new Array(256),h=0;h<256;h++)l[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;l[254]=l[254]=1;function u(){c.call(this,"utf-8 decode"),this.leftOver=null}function f(){c.call(this,"utf-8 encode")}i.utf8encode=function(d){return o.nodebuffer?a.newBufferFrom(d,"utf-8"):function(g){var _,m,p,v,y,x=g.length,A=0;for(v=0;v<x;v++)(64512&(m=g.charCodeAt(v)))==55296&&v+1<x&&(64512&(p=g.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(p-56320),v++),A+=m<128?1:m<2048?2:m<65536?3:4;for(_=o.uint8array?new Uint8Array(A):new Array(A),v=y=0;y<A;v++)(64512&(m=g.charCodeAt(v)))==55296&&v+1<x&&(64512&(p=g.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(p-56320),v++),m<128?_[y++]=m:(m<2048?_[y++]=192|m>>>6:(m<65536?_[y++]=224|m>>>12:(_[y++]=240|m>>>18,_[y++]=128|m>>>12&63),_[y++]=128|m>>>6&63),_[y++]=128|63&m);return _}(d)},i.utf8decode=function(d){return o.nodebuffer?s.transformTo("nodebuffer",d).toString("utf-8"):function(g){var _,m,p,v,y=g.length,x=new Array(2*y);for(_=m=0;_<y;)if((p=g[_++])<128)x[m++]=p;else if(4<(v=l[p]))x[m++]=65533,_+=v-1;else{for(p&=v===2?31:v===3?15:7;1<v&&_<y;)p=p<<6|63&g[_++],v--;1<v?x[m++]=65533:p<65536?x[m++]=p:(p-=65536,x[m++]=55296|p>>10&1023,x[m++]=56320|1023&p)}return x.length!==m&&(x.subarray?x=x.subarray(0,m):x.length=m),s.applyFromCharCode(x)}(d=s.transformTo(o.uint8array?"uint8array":"array",d))},s.inherits(u,c),u.prototype.processChunk=function(d){var g=s.transformTo(o.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var _=g;(g=new Uint8Array(_.length+this.leftOver.length)).set(this.leftOver,0),g.set(_,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var m=function(v,y){var x;for((y=y||v.length)>v.length&&(y=v.length),x=y-1;0<=x&&(192&v[x])==128;)x--;return x<0||x===0?y:x+l[v[x]]>y?x:y}(g),p=g;m!==g.length&&(o.uint8array?(p=g.subarray(0,m),this.leftOver=g.subarray(m,g.length)):(p=g.slice(0,m),this.leftOver=g.slice(m,g.length))),this.push({data:i.utf8decode(p),meta:d.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,s.inherits(f,c),f.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,n,i){var s=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),c=t("./external");function l(_){return _}function h(_,m){for(var p=0;p<_.length;++p)m[p]=255&_.charCodeAt(p);return m}t("setimmediate"),i.newBlob=function(_,m){i.checkSupport("blob");try{return new Blob([_],{type:m})}catch{try{var p=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return p.append(_),p.getBlob(m)}catch{throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(_,m,p){var v=[],y=0,x=_.length;if(x<=p)return String.fromCharCode.apply(null,_);for(;y<x;)m==="array"||m==="nodebuffer"?v.push(String.fromCharCode.apply(null,_.slice(y,Math.min(y+p,x)))):v.push(String.fromCharCode.apply(null,_.subarray(y,Math.min(y+p,x)))),y+=p;return v.join("")},stringifyByChar:function(_){for(var m="",p=0;p<_.length;p++)m+=String.fromCharCode(_[p]);return m},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function f(_){var m=65536,p=i.getTypeOf(_),v=!0;if(p==="uint8array"?v=u.applyCanBeUsed.uint8array:p==="nodebuffer"&&(v=u.applyCanBeUsed.nodebuffer),v)for(;1<m;)try{return u.stringifyByChunk(_,p,m)}catch{m=Math.floor(m/2)}return u.stringifyByChar(_)}function d(_,m){for(var p=0;p<_.length;p++)m[p]=_[p];return m}i.applyFromCharCode=f;var g={};g.string={string:l,array:function(_){return h(_,new Array(_.length))},arraybuffer:function(_){return g.string.uint8array(_).buffer},uint8array:function(_){return h(_,new Uint8Array(_.length))},nodebuffer:function(_){return h(_,a.allocBuffer(_.length))}},g.array={string:f,array:l,arraybuffer:function(_){return new Uint8Array(_).buffer},uint8array:function(_){return new Uint8Array(_)},nodebuffer:function(_){return a.newBufferFrom(_)}},g.arraybuffer={string:function(_){return f(new Uint8Array(_))},array:function(_){return d(new Uint8Array(_),new Array(_.byteLength))},arraybuffer:l,uint8array:function(_){return new Uint8Array(_)},nodebuffer:function(_){return a.newBufferFrom(new Uint8Array(_))}},g.uint8array={string:f,array:function(_){return d(_,new Array(_.length))},arraybuffer:function(_){return _.buffer},uint8array:l,nodebuffer:function(_){return a.newBufferFrom(_)}},g.nodebuffer={string:f,array:function(_){return d(_,new Array(_.length))},arraybuffer:function(_){return g.nodebuffer.uint8array(_).buffer},uint8array:function(_){return d(_,new Uint8Array(_.length))},nodebuffer:l},i.transformTo=function(_,m){if(m=m||"",!_)return m;i.checkSupport(_);var p=i.getTypeOf(m);return g[p][_](m)},i.resolve=function(_){for(var m=_.split("/"),p=[],v=0;v<m.length;v++){var y=m[v];y==="."||y===""&&v!==0&&v!==m.length-1||(y===".."?p.pop():p.push(y))}return p.join("/")},i.getTypeOf=function(_){return typeof _=="string"?"string":Object.prototype.toString.call(_)==="[object Array]"?"array":s.nodebuffer&&a.isBuffer(_)?"nodebuffer":s.uint8array&&_ instanceof Uint8Array?"uint8array":s.arraybuffer&&_ instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(_){if(!s[_.toLowerCase()])throw new Error(_+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(_){var m,p,v="";for(p=0;p<(_||"").length;p++)v+="\\x"+((m=_.charCodeAt(p))<16?"0":"")+m.toString(16).toUpperCase();return v},i.delay=function(_,m,p){setImmediate(function(){_.apply(p||null,m||[])})},i.inherits=function(_,m){function p(){}p.prototype=m.prototype,_.prototype=new p},i.extend=function(){var _,m,p={};for(_=0;_<arguments.length;_++)for(m in arguments[_])Object.prototype.hasOwnProperty.call(arguments[_],m)&&p[m]===void 0&&(p[m]=arguments[_][m]);return p},i.prepareContent=function(_,m,p,v,y){return c.Promise.resolve(m).then(function(x){return s.blob&&(x instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(x))!==-1)&&typeof FileReader<"u"?new c.Promise(function(A,E){var I=new FileReader;I.onload=function(D){A(D.target.result)},I.onerror=function(D){E(D.target.error)},I.readAsArrayBuffer(x)}):x}).then(function(x){var A=i.getTypeOf(x);return A?(A==="arraybuffer"?x=i.transformTo("uint8array",x):A==="string"&&(y?x=o.decode(x):p&&v!==!0&&(x=function(E){return h(E,s.uint8array?new Uint8Array(E.length):new Array(E.length))}(x))),x):c.Promise.reject(new Error("Can't read the data of '"+_+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,n,i){var s=t("./reader/readerFor"),o=t("./utils"),a=t("./signature"),c=t("./zipEntry"),l=t("./support");function h(u){this.files=[],this.loadOptions=u}h.prototype={checkSignature:function(u){if(!this.reader.readAndCheckSignature(u)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(u)+")")}},isSignature:function(u,f){var d=this.reader.index;this.reader.setIndex(u);var g=this.reader.readString(4)===f;return this.reader.setIndex(d),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var u=this.reader.readData(this.zipCommentLength),f=l.uint8array?"uint8array":"array",d=o.transformTo(f,u);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var u,f,d,g=this.zip64EndOfCentralSize-44;0<g;)u=this.reader.readInt(2),f=this.reader.readInt(4),d=this.reader.readData(f),this.zip64ExtensibleData[u]={id:u,length:f,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var u,f;for(u=0;u<this.files.length;u++)f=this.files[u],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var u;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(u=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(u);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var u=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(u<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(u);var f=u;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(u=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(u),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var g=f-d;if(0<g)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(u){this.reader=s(u)},load:function(u){this.prepareReader(u),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,n,i){var s=t("./reader/readerFor"),o=t("./utils"),a=t("./compressedObject"),c=t("./crc32"),l=t("./utf8"),h=t("./compressions"),u=t("./support");function f(d,g){this.options=d,this.loadOptions=g}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var g,_;if(d.skip(22),this.fileNameLength=d.readInt(2),_=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(_),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=function(m){for(var p in h)if(Object.prototype.hasOwnProperty.call(h,p)&&h[p].magic===m)return h[p];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,g,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var g=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(g),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var g,_,m,p=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<p;)g=d.readInt(2),_=d.readInt(2),m=d.readData(_),this.extraFields[g]={id:g,length:_,value:m};d.setIndex(p)},handleUTF8:function(){var d=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var _=o.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(_)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var p=o.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(p)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var g=s(d.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:l.utf8decode(g.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var g=s(d.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:l.utf8decode(g.readData(d.length-5))}return null}},n.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,n,i){function s(g,_,m){this.name=g,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=_,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var o=t("./stream/StreamHelper"),a=t("./stream/DataWorker"),c=t("./utf8"),l=t("./compressedObject"),h=t("./stream/GenericWorker");s.prototype={internalStream:function(g){var _=null,m="string";try{if(!g)throw new Error("No output type specified.");var p=(m=g.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),_=this._decompressWorker();var v=!this._dataBinary;v&&!p&&(_=_.pipe(new c.Utf8EncodeWorker)),!v&&p&&(_=_.pipe(new c.Utf8DecodeWorker))}catch(y){(_=new h("error")).error(y)}return new o(_,m,"")},async:function(g,_){return this.internalStream(g).accumulate(_)},nodeStream:function(g,_){return this.internalStream(g||"nodebuffer").toNodejsStream(_)},_compressWorker:function(g,_){if(this._data instanceof l&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new c.Utf8EncodeWorker)),l.createWorkerFrom(m,g,_)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof h?this._data:new a(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<u.length;d++)s.prototype[u[d]]=f;n.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,n,i){(function(s){var o,a,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var l=0,h=new c(g),u=s.document.createTextNode("");h.observe(u,{characterData:!0}),o=function(){u.data=l=++l%2}}else if(s.setImmediate||s.MessageChannel===void 0)o="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var _=s.document.createElement("script");_.onreadystatechange=function(){g(),_.onreadystatechange=null,_.parentNode.removeChild(_),_=null},s.document.documentElement.appendChild(_)}:function(){setTimeout(g,0)};else{var f=new s.MessageChannel;f.port1.onmessage=g,o=function(){f.port2.postMessage(0)}}var d=[];function g(){var _,m;a=!0;for(var p=d.length;p;){for(m=d,d=[],_=-1;++_<p;)m[_]();p=d.length}a=!1}n.exports=function(_){d.push(_)!==1||a||o()}}).call(this,typeof fl<"u"?fl:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,n,i){var s=t("immediate");function o(){}var a={},c=["REJECTED"],l=["FULFILLED"],h=["PENDING"];function u(p){if(typeof p!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,p!==o&&_(this,p)}function f(p,v,y){this.promise=p,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function d(p,v,y){s(function(){var x;try{x=v(y)}catch(A){return a.reject(p,A)}x===p?a.reject(p,new TypeError("Cannot resolve promise with itself")):a.resolve(p,x)})}function g(p){var v=p&&p.then;if(p&&(typeof p=="object"||typeof p=="function")&&typeof v=="function")return function(){v.apply(p,arguments)}}function _(p,v){var y=!1;function x(I){y||(y=!0,a.reject(p,I))}function A(I){y||(y=!0,a.resolve(p,I))}var E=m(function(){v(A,x)});E.status==="error"&&x(E.value)}function m(p,v){var y={};try{y.value=p(v),y.status="success"}catch(x){y.status="error",y.value=x}return y}(n.exports=u).prototype.finally=function(p){if(typeof p!="function")return this;var v=this.constructor;return this.then(function(y){return v.resolve(p()).then(function(){return y})},function(y){return v.resolve(p()).then(function(){throw y})})},u.prototype.catch=function(p){return this.then(null,p)},u.prototype.then=function(p,v){if(typeof p!="function"&&this.state===l||typeof v!="function"&&this.state===c)return this;var y=new this.constructor(o);return this.state!==h?d(y,this.state===l?p:v,this.outcome):this.queue.push(new f(y,p,v)),y},f.prototype.callFulfilled=function(p){a.resolve(this.promise,p)},f.prototype.otherCallFulfilled=function(p){d(this.promise,this.onFulfilled,p)},f.prototype.callRejected=function(p){a.reject(this.promise,p)},f.prototype.otherCallRejected=function(p){d(this.promise,this.onRejected,p)},a.resolve=function(p,v){var y=m(g,v);if(y.status==="error")return a.reject(p,y.value);var x=y.value;if(x)_(p,x);else{p.state=l,p.outcome=v;for(var A=-1,E=p.queue.length;++A<E;)p.queue[A].callFulfilled(v)}return p},a.reject=function(p,v){p.state=c,p.outcome=v;for(var y=-1,x=p.queue.length;++y<x;)p.queue[y].callRejected(v);return p},u.resolve=function(p){return p instanceof this?p:a.resolve(new this(o),p)},u.reject=function(p){var v=new this(o);return a.reject(v,p)},u.all=function(p){var v=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=p.length,x=!1;if(!y)return this.resolve([]);for(var A=new Array(y),E=0,I=-1,D=new this(o);++I<y;)b(p[I],I);return D;function b(C,B){v.resolve(C).then(function(R){A[B]=R,++E!==y||x||(x=!0,a.resolve(D,A))},function(R){x||(x=!0,a.reject(D,R))})}},u.race=function(p){var v=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=p.length,x=!1;if(!y)return this.resolve([]);for(var A=-1,E=new this(o);++A<y;)I=p[A],v.resolve(I).then(function(D){x||(x=!0,a.resolve(E,D))},function(D){x||(x=!0,a.reject(E,D))});var I;return E}},{immediate:36}],38:[function(t,n,i){var s={};(0,t("./lib/utils/common").assign)(s,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),n.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,n,i){var s=t("./zlib/deflate"),o=t("./utils/common"),a=t("./utils/strings"),c=t("./zlib/messages"),l=t("./zlib/zstream"),h=Object.prototype.toString,u=0,f=-1,d=0,g=8;function _(p){if(!(this instanceof _))return new _(p);this.options=o.assign({level:f,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},p||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var y=s.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(y!==u)throw new Error(c[y]);if(v.header&&s.deflateSetHeader(this.strm,v.header),v.dictionary){var x;if(x=typeof v.dictionary=="string"?a.string2buf(v.dictionary):h.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(y=s.deflateSetDictionary(this.strm,x))!==u)throw new Error(c[y]);this._dict_set=!0}}function m(p,v){var y=new _(v);if(y.push(p,!0),y.err)throw y.msg||c[y.err];return y.result}_.prototype.push=function(p,v){var y,x,A=this.strm,E=this.options.chunkSize;if(this.ended)return!1;x=v===~~v?v:v===!0?4:0,typeof p=="string"?A.input=a.string2buf(p):h.call(p)==="[object ArrayBuffer]"?A.input=new Uint8Array(p):A.input=p,A.next_in=0,A.avail_in=A.input.length;do{if(A.avail_out===0&&(A.output=new o.Buf8(E),A.next_out=0,A.avail_out=E),(y=s.deflate(A,x))!==1&&y!==u)return this.onEnd(y),!(this.ended=!0);A.avail_out!==0&&(A.avail_in!==0||x!==4&&x!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(o.shrinkBuf(A.output,A.next_out))):this.onData(o.shrinkBuf(A.output,A.next_out)))}while((0<A.avail_in||A.avail_out===0)&&y!==1);return x===4?(y=s.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===u):x!==2||(this.onEnd(u),!(A.avail_out=0))},_.prototype.onData=function(p){this.chunks.push(p)},_.prototype.onEnd=function(p){p===u&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},i.Deflate=_,i.deflate=m,i.deflateRaw=function(p,v){return(v=v||{}).raw=!0,m(p,v)},i.gzip=function(p,v){return(v=v||{}).gzip=!0,m(p,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,n,i){var s=t("./zlib/inflate"),o=t("./utils/common"),a=t("./utils/strings"),c=t("./zlib/constants"),l=t("./zlib/messages"),h=t("./zlib/zstream"),u=t("./zlib/gzheader"),f=Object.prototype.toString;function d(_){if(!(this instanceof d))return new d(_);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},_||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||_&&_.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&(15&m.windowBits)==0&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var p=s.inflateInit2(this.strm,m.windowBits);if(p!==c.Z_OK)throw new Error(l[p]);this.header=new u,s.inflateGetHeader(this.strm,this.header)}function g(_,m){var p=new d(m);if(p.push(_,!0),p.err)throw p.msg||l[p.err];return p.result}d.prototype.push=function(_,m){var p,v,y,x,A,E,I=this.strm,D=this.options.chunkSize,b=this.options.dictionary,C=!1;if(this.ended)return!1;v=m===~~m?m:m===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof _=="string"?I.input=a.binstring2buf(_):f.call(_)==="[object ArrayBuffer]"?I.input=new Uint8Array(_):I.input=_,I.next_in=0,I.avail_in=I.input.length;do{if(I.avail_out===0&&(I.output=new o.Buf8(D),I.next_out=0,I.avail_out=D),(p=s.inflate(I,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&b&&(E=typeof b=="string"?a.string2buf(b):f.call(b)==="[object ArrayBuffer]"?new Uint8Array(b):b,p=s.inflateSetDictionary(this.strm,E)),p===c.Z_BUF_ERROR&&C===!0&&(p=c.Z_OK,C=!1),p!==c.Z_STREAM_END&&p!==c.Z_OK)return this.onEnd(p),!(this.ended=!0);I.next_out&&(I.avail_out!==0&&p!==c.Z_STREAM_END&&(I.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=a.utf8border(I.output,I.next_out),x=I.next_out-y,A=a.buf2string(I.output,y),I.next_out=x,I.avail_out=D-x,x&&o.arraySet(I.output,I.output,y,x,0),this.onData(A)):this.onData(o.shrinkBuf(I.output,I.next_out)))),I.avail_in===0&&I.avail_out===0&&(C=!0)}while((0<I.avail_in||I.avail_out===0)&&p!==c.Z_STREAM_END);return p===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(p=s.inflateEnd(this.strm),this.onEnd(p),this.ended=!0,p===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(I.avail_out=0))},d.prototype.onData=function(_){this.chunks.push(_)},d.prototype.onEnd=function(_){_===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=_,this.msg=this.strm.msg},i.Inflate=d,i.inflate=g,i.inflateRaw=function(_,m){return(m=m||{}).raw=!0,g(_,m)},i.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(c){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var h=l.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var u in h)h.hasOwnProperty(u)&&(c[u]=h[u])}}return c},i.shrinkBuf=function(c,l){return c.length===l?c:c.subarray?c.subarray(0,l):(c.length=l,c)};var o={arraySet:function(c,l,h,u,f){if(l.subarray&&c.subarray)c.set(l.subarray(h,h+u),f);else for(var d=0;d<u;d++)c[f+d]=l[h+d]},flattenChunks:function(c){var l,h,u,f,d,g;for(l=u=0,h=c.length;l<h;l++)u+=c[l].length;for(g=new Uint8Array(u),l=f=0,h=c.length;l<h;l++)d=c[l],g.set(d,f),f+=d.length;return g}},a={arraySet:function(c,l,h,u,f){for(var d=0;d<u;d++)c[f+d]=l[h+d]},flattenChunks:function(c){return[].concat.apply([],c)}};i.setTyped=function(c){c?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,o)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(s)},{}],42:[function(t,n,i){var s=t("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var c=new s.Buf8(256),l=0;l<256;l++)c[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function h(u,f){if(f<65537&&(u.subarray&&a||!u.subarray&&o))return String.fromCharCode.apply(null,s.shrinkBuf(u,f));for(var d="",g=0;g<f;g++)d+=String.fromCharCode(u[g]);return d}c[254]=c[254]=1,i.string2buf=function(u){var f,d,g,_,m,p=u.length,v=0;for(_=0;_<p;_++)(64512&(d=u.charCodeAt(_)))==55296&&_+1<p&&(64512&(g=u.charCodeAt(_+1)))==56320&&(d=65536+(d-55296<<10)+(g-56320),_++),v+=d<128?1:d<2048?2:d<65536?3:4;for(f=new s.Buf8(v),_=m=0;m<v;_++)(64512&(d=u.charCodeAt(_)))==55296&&_+1<p&&(64512&(g=u.charCodeAt(_+1)))==56320&&(d=65536+(d-55296<<10)+(g-56320),_++),d<128?f[m++]=d:(d<2048?f[m++]=192|d>>>6:(d<65536?f[m++]=224|d>>>12:(f[m++]=240|d>>>18,f[m++]=128|d>>>12&63),f[m++]=128|d>>>6&63),f[m++]=128|63&d);return f},i.buf2binstring=function(u){return h(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),d=0,g=f.length;d<g;d++)f[d]=u.charCodeAt(d);return f},i.buf2string=function(u,f){var d,g,_,m,p=f||u.length,v=new Array(2*p);for(d=g=0;d<p;)if((_=u[d++])<128)v[g++]=_;else if(4<(m=c[_]))v[g++]=65533,d+=m-1;else{for(_&=m===2?31:m===3?15:7;1<m&&d<p;)_=_<<6|63&u[d++],m--;1<m?v[g++]=65533:_<65536?v[g++]=_:(_-=65536,v[g++]=55296|_>>10&1023,v[g++]=56320|1023&_)}return h(v,g)},i.utf8border=function(u,f){var d;for((f=f||u.length)>u.length&&(f=u.length),d=f-1;0<=d&&(192&u[d])==128;)d--;return d<0||d===0?f:d+c[u[d]]>f?d:f}},{"./common":41}],43:[function(t,n,i){n.exports=function(s,o,a,c){for(var l=65535&s|0,h=s>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3<a?2e3:a;h=h+(l=l+o[c++]|0)|0,--u;);l%=65521,h%=65521}return l|h<<16|0}},{}],44:[function(t,n,i){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,n,i){var s=function(){for(var o,a=[],c=0;c<256;c++){o=c;for(var l=0;l<8;l++)o=1&o?3988292384^o>>>1:o>>>1;a[c]=o}return a}();n.exports=function(o,a,c,l){var h=s,u=l+c;o^=-1;for(var f=l;f<u;f++)o=o>>>8^h[255&(o^a[f])];return-1^o}},{}],46:[function(t,n,i){var s,o=t("../utils/common"),a=t("./trees"),c=t("./adler32"),l=t("./crc32"),h=t("./messages"),u=0,f=4,d=0,g=-2,_=-1,m=4,p=2,v=8,y=9,x=286,A=30,E=19,I=2*x+1,D=15,b=3,C=258,B=C+b+1,R=42,O=113,M=1,z=2,X=3,H=4;function re(w,q){return w.msg=h[q],q}function J(w){return(w<<1)-(4<w?9:0)}function le(w){for(var q=w.length;0<=--q;)w[q]=0}function W(w){var q=w.state,k=q.pending;k>w.avail_out&&(k=w.avail_out),k!==0&&(o.arraySet(w.output,q.pending_buf,q.pending_out,k,w.next_out),w.next_out+=k,q.pending_out+=k,w.total_out+=k,w.avail_out-=k,q.pending-=k,q.pending===0&&(q.pending_out=0))}function Z(w,q){a._tr_flush_block(w,0<=w.block_start?w.block_start:-1,w.strstart-w.block_start,q),w.block_start=w.strstart,W(w.strm)}function ge(w,q){w.pending_buf[w.pending++]=q}function _e(w,q){w.pending_buf[w.pending++]=q>>>8&255,w.pending_buf[w.pending++]=255&q}function de(w,q){var k,N,S=w.max_chain_length,G=w.strstart,K=w.prev_length,ie=w.nice_match,V=w.strstart>w.w_size-B?w.strstart-(w.w_size-B):0,P=w.window,T=w.w_mask,F=w.prev,Q=w.strstart+C,ce=P[G+K-1],te=P[G+K];w.prev_length>=w.good_match&&(S>>=2),ie>w.lookahead&&(ie=w.lookahead);do if(P[(k=q)+K]===te&&P[k+K-1]===ce&&P[k]===P[G]&&P[++k]===P[G+1]){G+=2,k++;do;while(P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&P[++G]===P[++k]&&G<Q);if(N=C-(Q-G),G=Q-C,K<N){if(w.match_start=q,ie<=(K=N))break;ce=P[G+K-1],te=P[G+K]}}while((q=F[q&T])>V&&--S!=0);return K<=w.lookahead?K:w.lookahead}function oe(w){var q,k,N,S,G,K,ie,V,P,T,F=w.w_size;do{if(S=w.window_size-w.lookahead-w.strstart,w.strstart>=F+(F-B)){for(o.arraySet(w.window,w.window,F,F,0),w.match_start-=F,w.strstart-=F,w.block_start-=F,q=k=w.hash_size;N=w.head[--q],w.head[q]=F<=N?N-F:0,--k;);for(q=k=F;N=w.prev[--q],w.prev[q]=F<=N?N-F:0,--k;);S+=F}if(w.strm.avail_in===0)break;if(K=w.strm,ie=w.window,V=w.strstart+w.lookahead,P=S,T=void 0,T=K.avail_in,P<T&&(T=P),k=T===0?0:(K.avail_in-=T,o.arraySet(ie,K.input,K.next_in,T,V),K.state.wrap===1?K.adler=c(K.adler,ie,T,V):K.state.wrap===2&&(K.adler=l(K.adler,ie,T,V)),K.next_in+=T,K.total_in+=T,T),w.lookahead+=k,w.lookahead+w.insert>=b)for(G=w.strstart-w.insert,w.ins_h=w.window[G],w.ins_h=(w.ins_h<<w.hash_shift^w.window[G+1])&w.hash_mask;w.insert&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[G+b-1])&w.hash_mask,w.prev[G&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=G,G++,w.insert--,!(w.lookahead+w.insert<b)););}while(w.lookahead<B&&w.strm.avail_in!==0)}function ee(w,q){for(var k,N;;){if(w.lookahead<B){if(oe(w),w.lookahead<B&&q===u)return M;if(w.lookahead===0)break}if(k=0,w.lookahead>=b&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+b-1])&w.hash_mask,k=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),k!==0&&w.strstart-k<=w.w_size-B&&(w.match_length=de(w,k)),w.match_length>=b)if(N=a._tr_tally(w,w.strstart-w.match_start,w.match_length-b),w.lookahead-=w.match_length,w.match_length<=w.max_lazy_match&&w.lookahead>=b){for(w.match_length--;w.strstart++,w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+b-1])&w.hash_mask,k=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart,--w.match_length!=0;);w.strstart++}else w.strstart+=w.match_length,w.match_length=0,w.ins_h=w.window[w.strstart],w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+1])&w.hash_mask;else N=a._tr_tally(w,0,w.window[w.strstart]),w.lookahead--,w.strstart++;if(N&&(Z(w,!1),w.strm.avail_out===0))return M}return w.insert=w.strstart<b-1?w.strstart:b-1,q===f?(Z(w,!0),w.strm.avail_out===0?X:H):w.last_lit&&(Z(w,!1),w.strm.avail_out===0)?M:z}function pe(w,q){for(var k,N,S;;){if(w.lookahead<B){if(oe(w),w.lookahead<B&&q===u)return M;if(w.lookahead===0)break}if(k=0,w.lookahead>=b&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+b-1])&w.hash_mask,k=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),w.prev_length=w.match_length,w.prev_match=w.match_start,w.match_length=b-1,k!==0&&w.prev_length<w.max_lazy_match&&w.strstart-k<=w.w_size-B&&(w.match_length=de(w,k),w.match_length<=5&&(w.strategy===1||w.match_length===b&&4096<w.strstart-w.match_start)&&(w.match_length=b-1)),w.prev_length>=b&&w.match_length<=w.prev_length){for(S=w.strstart+w.lookahead-b,N=a._tr_tally(w,w.strstart-1-w.prev_match,w.prev_length-b),w.lookahead-=w.prev_length-1,w.prev_length-=2;++w.strstart<=S&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+b-1])&w.hash_mask,k=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),--w.prev_length!=0;);if(w.match_available=0,w.match_length=b-1,w.strstart++,N&&(Z(w,!1),w.strm.avail_out===0))return M}else if(w.match_available){if((N=a._tr_tally(w,0,w.window[w.strstart-1]))&&Z(w,!1),w.strstart++,w.lookahead--,w.strm.avail_out===0)return M}else w.match_available=1,w.strstart++,w.lookahead--}return w.match_available&&(N=a._tr_tally(w,0,w.window[w.strstart-1]),w.match_available=0),w.insert=w.strstart<b-1?w.strstart:b-1,q===f?(Z(w,!0),w.strm.avail_out===0?X:H):w.last_lit&&(Z(w,!1),w.strm.avail_out===0)?M:z}function ye(w,q,k,N,S){this.good_length=w,this.max_lazy=q,this.nice_length=k,this.max_chain=N,this.func=S}function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*I),this.dyn_dtree=new o.Buf16(2*(2*A+1)),this.bl_tree=new o.Buf16(2*(2*E+1)),le(this.dyn_ltree),le(this.dyn_dtree),le(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(D+1),this.heap=new o.Buf16(2*x+1),le(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*x+1),le(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ze(w){var q;return w&&w.state?(w.total_in=w.total_out=0,w.data_type=p,(q=w.state).pending=0,q.pending_out=0,q.wrap<0&&(q.wrap=-q.wrap),q.status=q.wrap?R:O,w.adler=q.wrap===2?0:1,q.last_flush=u,a._tr_init(q),d):re(w,g)}function je(w){var q=ze(w);return q===d&&function(k){k.window_size=2*k.w_size,le(k.head),k.max_lazy_match=s[k.level].max_lazy,k.good_match=s[k.level].good_length,k.nice_match=s[k.level].nice_length,k.max_chain_length=s[k.level].max_chain,k.strstart=0,k.block_start=0,k.lookahead=0,k.insert=0,k.match_length=k.prev_length=b-1,k.match_available=0,k.ins_h=0}(w.state),q}function He(w,q,k,N,S,G){if(!w)return g;var K=1;if(q===_&&(q=6),N<0?(K=0,N=-N):15<N&&(K=2,N-=16),S<1||y<S||k!==v||N<8||15<N||q<0||9<q||G<0||m<G)return re(w,g);N===8&&(N=9);var ie=new Ae;return(w.state=ie).strm=w,ie.wrap=K,ie.gzhead=null,ie.w_bits=N,ie.w_size=1<<ie.w_bits,ie.w_mask=ie.w_size-1,ie.hash_bits=S+7,ie.hash_size=1<<ie.hash_bits,ie.hash_mask=ie.hash_size-1,ie.hash_shift=~~((ie.hash_bits+b-1)/b),ie.window=new o.Buf8(2*ie.w_size),ie.head=new o.Buf16(ie.hash_size),ie.prev=new o.Buf16(ie.w_size),ie.lit_bufsize=1<<S+6,ie.pending_buf_size=4*ie.lit_bufsize,ie.pending_buf=new o.Buf8(ie.pending_buf_size),ie.d_buf=1*ie.lit_bufsize,ie.l_buf=3*ie.lit_bufsize,ie.level=q,ie.strategy=G,ie.method=k,je(w)}s=[new ye(0,0,0,0,function(w,q){var k=65535;for(k>w.pending_buf_size-5&&(k=w.pending_buf_size-5);;){if(w.lookahead<=1){if(oe(w),w.lookahead===0&&q===u)return M;if(w.lookahead===0)break}w.strstart+=w.lookahead,w.lookahead=0;var N=w.block_start+k;if((w.strstart===0||w.strstart>=N)&&(w.lookahead=w.strstart-N,w.strstart=N,Z(w,!1),w.strm.avail_out===0)||w.strstart-w.block_start>=w.w_size-B&&(Z(w,!1),w.strm.avail_out===0))return M}return w.insert=0,q===f?(Z(w,!0),w.strm.avail_out===0?X:H):(w.strstart>w.block_start&&(Z(w,!1),w.strm.avail_out),M)}),new ye(4,4,8,4,ee),new ye(4,5,16,8,ee),new ye(4,6,32,32,ee),new ye(4,4,16,16,pe),new ye(8,16,32,32,pe),new ye(8,16,128,128,pe),new ye(8,32,128,256,pe),new ye(32,128,258,1024,pe),new ye(32,258,258,4096,pe)],i.deflateInit=function(w,q){return He(w,q,v,15,8,0)},i.deflateInit2=He,i.deflateReset=je,i.deflateResetKeep=ze,i.deflateSetHeader=function(w,q){return w&&w.state?w.state.wrap!==2?g:(w.state.gzhead=q,d):g},i.deflate=function(w,q){var k,N,S,G;if(!w||!w.state||5<q||q<0)return w?re(w,g):g;if(N=w.state,!w.output||!w.input&&w.avail_in!==0||N.status===666&&q!==f)return re(w,w.avail_out===0?-5:g);if(N.strm=w,k=N.last_flush,N.last_flush=q,N.status===R)if(N.wrap===2)w.adler=0,ge(N,31),ge(N,139),ge(N,8),N.gzhead?(ge(N,(N.gzhead.text?1:0)+(N.gzhead.hcrc?2:0)+(N.gzhead.extra?4:0)+(N.gzhead.name?8:0)+(N.gzhead.comment?16:0)),ge(N,255&N.gzhead.time),ge(N,N.gzhead.time>>8&255),ge(N,N.gzhead.time>>16&255),ge(N,N.gzhead.time>>24&255),ge(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),ge(N,255&N.gzhead.os),N.gzhead.extra&&N.gzhead.extra.length&&(ge(N,255&N.gzhead.extra.length),ge(N,N.gzhead.extra.length>>8&255)),N.gzhead.hcrc&&(w.adler=l(w.adler,N.pending_buf,N.pending,0)),N.gzindex=0,N.status=69):(ge(N,0),ge(N,0),ge(N,0),ge(N,0),ge(N,0),ge(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),ge(N,3),N.status=O);else{var K=v+(N.w_bits-8<<4)<<8;K|=(2<=N.strategy||N.level<2?0:N.level<6?1:N.level===6?2:3)<<6,N.strstart!==0&&(K|=32),K+=31-K%31,N.status=O,_e(N,K),N.strstart!==0&&(_e(N,w.adler>>>16),_e(N,65535&w.adler)),w.adler=1}if(N.status===69)if(N.gzhead.extra){for(S=N.pending;N.gzindex<(65535&N.gzhead.extra.length)&&(N.pending!==N.pending_buf_size||(N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),W(w),S=N.pending,N.pending!==N.pending_buf_size));)ge(N,255&N.gzhead.extra[N.gzindex]),N.gzindex++;N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),N.gzindex===N.gzhead.extra.length&&(N.gzindex=0,N.status=73)}else N.status=73;if(N.status===73)if(N.gzhead.name){S=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),W(w),S=N.pending,N.pending===N.pending_buf_size)){G=1;break}G=N.gzindex<N.gzhead.name.length?255&N.gzhead.name.charCodeAt(N.gzindex++):0,ge(N,G)}while(G!==0);N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),G===0&&(N.gzindex=0,N.status=91)}else N.status=91;if(N.status===91)if(N.gzhead.comment){S=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),W(w),S=N.pending,N.pending===N.pending_buf_size)){G=1;break}G=N.gzindex<N.gzhead.comment.length?255&N.gzhead.comment.charCodeAt(N.gzindex++):0,ge(N,G)}while(G!==0);N.gzhead.hcrc&&N.pending>S&&(w.adler=l(w.adler,N.pending_buf,N.pending-S,S)),G===0&&(N.status=103)}else N.status=103;if(N.status===103&&(N.gzhead.hcrc?(N.pending+2>N.pending_buf_size&&W(w),N.pending+2<=N.pending_buf_size&&(ge(N,255&w.adler),ge(N,w.adler>>8&255),w.adler=0,N.status=O)):N.status=O),N.pending!==0){if(W(w),w.avail_out===0)return N.last_flush=-1,d}else if(w.avail_in===0&&J(q)<=J(k)&&q!==f)return re(w,-5);if(N.status===666&&w.avail_in!==0)return re(w,-5);if(w.avail_in!==0||N.lookahead!==0||q!==u&&N.status!==666){var ie=N.strategy===2?function(V,P){for(var T;;){if(V.lookahead===0&&(oe(V),V.lookahead===0)){if(P===u)return M;break}if(V.match_length=0,T=a._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++,T&&(Z(V,!1),V.strm.avail_out===0))return M}return V.insert=0,P===f?(Z(V,!0),V.strm.avail_out===0?X:H):V.last_lit&&(Z(V,!1),V.strm.avail_out===0)?M:z}(N,q):N.strategy===3?function(V,P){for(var T,F,Q,ce,te=V.window;;){if(V.lookahead<=C){if(oe(V),V.lookahead<=C&&P===u)return M;if(V.lookahead===0)break}if(V.match_length=0,V.lookahead>=b&&0<V.strstart&&(F=te[Q=V.strstart-1])===te[++Q]&&F===te[++Q]&&F===te[++Q]){ce=V.strstart+C;do;while(F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&F===te[++Q]&&Q<ce);V.match_length=C-(ce-Q),V.match_length>V.lookahead&&(V.match_length=V.lookahead)}if(V.match_length>=b?(T=a._tr_tally(V,1,V.match_length-b),V.lookahead-=V.match_length,V.strstart+=V.match_length,V.match_length=0):(T=a._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++),T&&(Z(V,!1),V.strm.avail_out===0))return M}return V.insert=0,P===f?(Z(V,!0),V.strm.avail_out===0?X:H):V.last_lit&&(Z(V,!1),V.strm.avail_out===0)?M:z}(N,q):s[N.level].func(N,q);if(ie!==X&&ie!==H||(N.status=666),ie===M||ie===X)return w.avail_out===0&&(N.last_flush=-1),d;if(ie===z&&(q===1?a._tr_align(N):q!==5&&(a._tr_stored_block(N,0,0,!1),q===3&&(le(N.head),N.lookahead===0&&(N.strstart=0,N.block_start=0,N.insert=0))),W(w),w.avail_out===0))return N.last_flush=-1,d}return q!==f?d:N.wrap<=0?1:(N.wrap===2?(ge(N,255&w.adler),ge(N,w.adler>>8&255),ge(N,w.adler>>16&255),ge(N,w.adler>>24&255),ge(N,255&w.total_in),ge(N,w.total_in>>8&255),ge(N,w.total_in>>16&255),ge(N,w.total_in>>24&255)):(_e(N,w.adler>>>16),_e(N,65535&w.adler)),W(w),0<N.wrap&&(N.wrap=-N.wrap),N.pending!==0?d:1)},i.deflateEnd=function(w){var q;return w&&w.state?(q=w.state.status)!==R&&q!==69&&q!==73&&q!==91&&q!==103&&q!==O&&q!==666?re(w,g):(w.state=null,q===O?re(w,-3):d):g},i.deflateSetDictionary=function(w,q){var k,N,S,G,K,ie,V,P,T=q.length;if(!w||!w.state||(G=(k=w.state).wrap)===2||G===1&&k.status!==R||k.lookahead)return g;for(G===1&&(w.adler=c(w.adler,q,T,0)),k.wrap=0,T>=k.w_size&&(G===0&&(le(k.head),k.strstart=0,k.block_start=0,k.insert=0),P=new o.Buf8(k.w_size),o.arraySet(P,q,T-k.w_size,k.w_size,0),q=P,T=k.w_size),K=w.avail_in,ie=w.next_in,V=w.input,w.avail_in=T,w.next_in=0,w.input=q,oe(k);k.lookahead>=b;){for(N=k.strstart,S=k.lookahead-(b-1);k.ins_h=(k.ins_h<<k.hash_shift^k.window[N+b-1])&k.hash_mask,k.prev[N&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=N,N++,--S;);k.strstart=N,k.lookahead=b-1,oe(k)}return k.strstart+=k.lookahead,k.block_start=k.strstart,k.insert=k.lookahead,k.lookahead=0,k.match_length=k.prev_length=b-1,k.match_available=0,w.next_in=ie,w.input=V,w.avail_in=K,k.wrap=G,d},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,n,i){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,n,i){n.exports=function(s,o){var a,c,l,h,u,f,d,g,_,m,p,v,y,x,A,E,I,D,b,C,B,R,O,M,z;a=s.state,c=s.next_in,M=s.input,l=c+(s.avail_in-5),h=s.next_out,z=s.output,u=h-(o-s.avail_out),f=h+(s.avail_out-257),d=a.dmax,g=a.wsize,_=a.whave,m=a.wnext,p=a.window,v=a.hold,y=a.bits,x=a.lencode,A=a.distcode,E=(1<<a.lenbits)-1,I=(1<<a.distbits)-1;e:do{y<15&&(v+=M[c++]<<y,y+=8,v+=M[c++]<<y,y+=8),D=x[v&E];t:for(;;){if(v>>>=b=D>>>24,y-=b,(b=D>>>16&255)===0)z[h++]=65535&D;else{if(!(16&b)){if((64&b)==0){D=x[(65535&D)+(v&(1<<b)-1)];continue t}if(32&b){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}C=65535&D,(b&=15)&&(y<b&&(v+=M[c++]<<y,y+=8),C+=v&(1<<b)-1,v>>>=b,y-=b),y<15&&(v+=M[c++]<<y,y+=8,v+=M[c++]<<y,y+=8),D=A[v&I];n:for(;;){if(v>>>=b=D>>>24,y-=b,!(16&(b=D>>>16&255))){if((64&b)==0){D=A[(65535&D)+(v&(1<<b)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if(B=65535&D,y<(b&=15)&&(v+=M[c++]<<y,(y+=8)<b&&(v+=M[c++]<<y,y+=8)),d<(B+=v&(1<<b)-1)){s.msg="invalid distance too far back",a.mode=30;break e}if(v>>>=b,y-=b,(b=h-u)<B){if(_<(b=B-b)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(O=p,(R=0)===m){if(R+=g-b,b<C){for(C-=b;z[h++]=p[R++],--b;);R=h-B,O=z}}else if(m<b){if(R+=g+m-b,(b-=m)<C){for(C-=b;z[h++]=p[R++],--b;);if(R=0,m<C){for(C-=b=m;z[h++]=p[R++],--b;);R=h-B,O=z}}}else if(R+=m-b,b<C){for(C-=b;z[h++]=p[R++],--b;);R=h-B,O=z}for(;2<C;)z[h++]=O[R++],z[h++]=O[R++],z[h++]=O[R++],C-=3;C&&(z[h++]=O[R++],1<C&&(z[h++]=O[R++]))}else{for(R=h-B;z[h++]=z[R++],z[h++]=z[R++],z[h++]=z[R++],2<(C-=3););C&&(z[h++]=z[R++],1<C&&(z[h++]=z[R++]))}break}}break}}while(c<l&&h<f);c-=C=y>>3,v&=(1<<(y-=C<<3))-1,s.next_in=c,s.next_out=h,s.avail_in=c<l?l-c+5:5-(c-l),s.avail_out=h<f?f-h+257:257-(h-f),a.hold=v,a.bits=y}},{}],49:[function(t,n,i){var s=t("../utils/common"),o=t("./adler32"),a=t("./crc32"),c=t("./inffast"),l=t("./inftrees"),h=1,u=2,f=0,d=-2,g=1,_=852,m=592;function p(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(R){var O;return R&&R.state?(O=R.state,R.total_in=R.total_out=O.total=0,R.msg="",O.wrap&&(R.adler=1&O.wrap),O.mode=g,O.last=0,O.havedict=0,O.dmax=32768,O.head=null,O.hold=0,O.bits=0,O.lencode=O.lendyn=new s.Buf32(_),O.distcode=O.distdyn=new s.Buf32(m),O.sane=1,O.back=-1,f):d}function x(R){var O;return R&&R.state?((O=R.state).wsize=0,O.whave=0,O.wnext=0,y(R)):d}function A(R,O){var M,z;return R&&R.state?(z=R.state,O<0?(M=0,O=-O):(M=1+(O>>4),O<48&&(O&=15)),O&&(O<8||15<O)?d:(z.window!==null&&z.wbits!==O&&(z.window=null),z.wrap=M,z.wbits=O,x(R))):d}function E(R,O){var M,z;return R?(z=new v,(R.state=z).window=null,(M=A(R,O))!==f&&(R.state=null),M):d}var I,D,b=!0;function C(R){if(b){var O;for(I=new s.Buf32(512),D=new s.Buf32(32),O=0;O<144;)R.lens[O++]=8;for(;O<256;)R.lens[O++]=9;for(;O<280;)R.lens[O++]=7;for(;O<288;)R.lens[O++]=8;for(l(h,R.lens,0,288,I,0,R.work,{bits:9}),O=0;O<32;)R.lens[O++]=5;l(u,R.lens,0,32,D,0,R.work,{bits:5}),b=!1}R.lencode=I,R.lenbits=9,R.distcode=D,R.distbits=5}function B(R,O,M,z){var X,H=R.state;return H.window===null&&(H.wsize=1<<H.wbits,H.wnext=0,H.whave=0,H.window=new s.Buf8(H.wsize)),z>=H.wsize?(s.arraySet(H.window,O,M-H.wsize,H.wsize,0),H.wnext=0,H.whave=H.wsize):(z<(X=H.wsize-H.wnext)&&(X=z),s.arraySet(H.window,O,M-z,X,H.wnext),(z-=X)?(s.arraySet(H.window,O,M-z,z,0),H.wnext=z,H.whave=H.wsize):(H.wnext+=X,H.wnext===H.wsize&&(H.wnext=0),H.whave<H.wsize&&(H.whave+=X))),0}i.inflateReset=x,i.inflateReset2=A,i.inflateResetKeep=y,i.inflateInit=function(R){return E(R,15)},i.inflateInit2=E,i.inflate=function(R,O){var M,z,X,H,re,J,le,W,Z,ge,_e,de,oe,ee,pe,ye,Ae,ze,je,He,w,q,k,N,S=0,G=new s.Buf8(4),K=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return d;(M=R.state).mode===12&&(M.mode=13),re=R.next_out,X=R.output,le=R.avail_out,H=R.next_in,z=R.input,J=R.avail_in,W=M.hold,Z=M.bits,ge=J,_e=le,q=f;e:for(;;)switch(M.mode){case g:if(M.wrap===0){M.mode=13;break}for(;Z<16;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if(2&M.wrap&&W===35615){G[M.check=0]=255&W,G[1]=W>>>8&255,M.check=a(M.check,G,2,0),Z=W=0,M.mode=2;break}if(M.flags=0,M.head&&(M.head.done=!1),!(1&M.wrap)||(((255&W)<<8)+(W>>8))%31){R.msg="incorrect header check",M.mode=30;break}if((15&W)!=8){R.msg="unknown compression method",M.mode=30;break}if(Z-=4,w=8+(15&(W>>>=4)),M.wbits===0)M.wbits=w;else if(w>M.wbits){R.msg="invalid window size",M.mode=30;break}M.dmax=1<<w,R.adler=M.check=1,M.mode=512&W?10:12,Z=W=0;break;case 2:for(;Z<16;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if(M.flags=W,(255&M.flags)!=8){R.msg="unknown compression method",M.mode=30;break}if(57344&M.flags){R.msg="unknown header flags set",M.mode=30;break}M.head&&(M.head.text=W>>8&1),512&M.flags&&(G[0]=255&W,G[1]=W>>>8&255,M.check=a(M.check,G,2,0)),Z=W=0,M.mode=3;case 3:for(;Z<32;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}M.head&&(M.head.time=W),512&M.flags&&(G[0]=255&W,G[1]=W>>>8&255,G[2]=W>>>16&255,G[3]=W>>>24&255,M.check=a(M.check,G,4,0)),Z=W=0,M.mode=4;case 4:for(;Z<16;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}M.head&&(M.head.xflags=255&W,M.head.os=W>>8),512&M.flags&&(G[0]=255&W,G[1]=W>>>8&255,M.check=a(M.check,G,2,0)),Z=W=0,M.mode=5;case 5:if(1024&M.flags){for(;Z<16;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}M.length=W,M.head&&(M.head.extra_len=W),512&M.flags&&(G[0]=255&W,G[1]=W>>>8&255,M.check=a(M.check,G,2,0)),Z=W=0}else M.head&&(M.head.extra=null);M.mode=6;case 6:if(1024&M.flags&&(J<(de=M.length)&&(de=J),de&&(M.head&&(w=M.head.extra_len-M.length,M.head.extra||(M.head.extra=new Array(M.head.extra_len)),s.arraySet(M.head.extra,z,H,de,w)),512&M.flags&&(M.check=a(M.check,z,de,H)),J-=de,H+=de,M.length-=de),M.length))break e;M.length=0,M.mode=7;case 7:if(2048&M.flags){if(J===0)break e;for(de=0;w=z[H+de++],M.head&&w&&M.length<65536&&(M.head.name+=String.fromCharCode(w)),w&&de<J;);if(512&M.flags&&(M.check=a(M.check,z,de,H)),J-=de,H+=de,w)break e}else M.head&&(M.head.name=null);M.length=0,M.mode=8;case 8:if(4096&M.flags){if(J===0)break e;for(de=0;w=z[H+de++],M.head&&w&&M.length<65536&&(M.head.comment+=String.fromCharCode(w)),w&&de<J;);if(512&M.flags&&(M.check=a(M.check,z,de,H)),J-=de,H+=de,w)break e}else M.head&&(M.head.comment=null);M.mode=9;case 9:if(512&M.flags){for(;Z<16;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if(W!==(65535&M.check)){R.msg="header crc mismatch",M.mode=30;break}Z=W=0}M.head&&(M.head.hcrc=M.flags>>9&1,M.head.done=!0),R.adler=M.check=0,M.mode=12;break;case 10:for(;Z<32;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}R.adler=M.check=p(W),Z=W=0,M.mode=11;case 11:if(M.havedict===0)return R.next_out=re,R.avail_out=le,R.next_in=H,R.avail_in=J,M.hold=W,M.bits=Z,2;R.adler=M.check=1,M.mode=12;case 12:if(O===5||O===6)break e;case 13:if(M.last){W>>>=7&Z,Z-=7&Z,M.mode=27;break}for(;Z<3;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}switch(M.last=1&W,Z-=1,3&(W>>>=1)){case 0:M.mode=14;break;case 1:if(C(M),M.mode=20,O!==6)break;W>>>=2,Z-=2;break e;case 2:M.mode=17;break;case 3:R.msg="invalid block type",M.mode=30}W>>>=2,Z-=2;break;case 14:for(W>>>=7&Z,Z-=7&Z;Z<32;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if((65535&W)!=(W>>>16^65535)){R.msg="invalid stored block lengths",M.mode=30;break}if(M.length=65535&W,Z=W=0,M.mode=15,O===6)break e;case 15:M.mode=16;case 16:if(de=M.length){if(J<de&&(de=J),le<de&&(de=le),de===0)break e;s.arraySet(X,z,H,de,re),J-=de,H+=de,le-=de,re+=de,M.length-=de;break}M.mode=12;break;case 17:for(;Z<14;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if(M.nlen=257+(31&W),W>>>=5,Z-=5,M.ndist=1+(31&W),W>>>=5,Z-=5,M.ncode=4+(15&W),W>>>=4,Z-=4,286<M.nlen||30<M.ndist){R.msg="too many length or distance symbols",M.mode=30;break}M.have=0,M.mode=18;case 18:for(;M.have<M.ncode;){for(;Z<3;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}M.lens[K[M.have++]]=7&W,W>>>=3,Z-=3}for(;M.have<19;)M.lens[K[M.have++]]=0;if(M.lencode=M.lendyn,M.lenbits=7,k={bits:M.lenbits},q=l(0,M.lens,0,19,M.lencode,0,M.work,k),M.lenbits=k.bits,q){R.msg="invalid code lengths set",M.mode=30;break}M.have=0,M.mode=19;case 19:for(;M.have<M.nlen+M.ndist;){for(;ye=(S=M.lencode[W&(1<<M.lenbits)-1])>>>16&255,Ae=65535&S,!((pe=S>>>24)<=Z);){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if(Ae<16)W>>>=pe,Z-=pe,M.lens[M.have++]=Ae;else{if(Ae===16){for(N=pe+2;Z<N;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if(W>>>=pe,Z-=pe,M.have===0){R.msg="invalid bit length repeat",M.mode=30;break}w=M.lens[M.have-1],de=3+(3&W),W>>>=2,Z-=2}else if(Ae===17){for(N=pe+3;Z<N;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}Z-=pe,w=0,de=3+(7&(W>>>=pe)),W>>>=3,Z-=3}else{for(N=pe+7;Z<N;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}Z-=pe,w=0,de=11+(127&(W>>>=pe)),W>>>=7,Z-=7}if(M.have+de>M.nlen+M.ndist){R.msg="invalid bit length repeat",M.mode=30;break}for(;de--;)M.lens[M.have++]=w}}if(M.mode===30)break;if(M.lens[256]===0){R.msg="invalid code -- missing end-of-block",M.mode=30;break}if(M.lenbits=9,k={bits:M.lenbits},q=l(h,M.lens,0,M.nlen,M.lencode,0,M.work,k),M.lenbits=k.bits,q){R.msg="invalid literal/lengths set",M.mode=30;break}if(M.distbits=6,M.distcode=M.distdyn,k={bits:M.distbits},q=l(u,M.lens,M.nlen,M.ndist,M.distcode,0,M.work,k),M.distbits=k.bits,q){R.msg="invalid distances set",M.mode=30;break}if(M.mode=20,O===6)break e;case 20:M.mode=21;case 21:if(6<=J&&258<=le){R.next_out=re,R.avail_out=le,R.next_in=H,R.avail_in=J,M.hold=W,M.bits=Z,c(R,_e),re=R.next_out,X=R.output,le=R.avail_out,H=R.next_in,z=R.input,J=R.avail_in,W=M.hold,Z=M.bits,M.mode===12&&(M.back=-1);break}for(M.back=0;ye=(S=M.lencode[W&(1<<M.lenbits)-1])>>>16&255,Ae=65535&S,!((pe=S>>>24)<=Z);){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if(ye&&(240&ye)==0){for(ze=pe,je=ye,He=Ae;ye=(S=M.lencode[He+((W&(1<<ze+je)-1)>>ze)])>>>16&255,Ae=65535&S,!(ze+(pe=S>>>24)<=Z);){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}W>>>=ze,Z-=ze,M.back+=ze}if(W>>>=pe,Z-=pe,M.back+=pe,M.length=Ae,ye===0){M.mode=26;break}if(32&ye){M.back=-1,M.mode=12;break}if(64&ye){R.msg="invalid literal/length code",M.mode=30;break}M.extra=15&ye,M.mode=22;case 22:if(M.extra){for(N=M.extra;Z<N;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}M.length+=W&(1<<M.extra)-1,W>>>=M.extra,Z-=M.extra,M.back+=M.extra}M.was=M.length,M.mode=23;case 23:for(;ye=(S=M.distcode[W&(1<<M.distbits)-1])>>>16&255,Ae=65535&S,!((pe=S>>>24)<=Z);){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if((240&ye)==0){for(ze=pe,je=ye,He=Ae;ye=(S=M.distcode[He+((W&(1<<ze+je)-1)>>ze)])>>>16&255,Ae=65535&S,!(ze+(pe=S>>>24)<=Z);){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}W>>>=ze,Z-=ze,M.back+=ze}if(W>>>=pe,Z-=pe,M.back+=pe,64&ye){R.msg="invalid distance code",M.mode=30;break}M.offset=Ae,M.extra=15&ye,M.mode=24;case 24:if(M.extra){for(N=M.extra;Z<N;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}M.offset+=W&(1<<M.extra)-1,W>>>=M.extra,Z-=M.extra,M.back+=M.extra}if(M.offset>M.dmax){R.msg="invalid distance too far back",M.mode=30;break}M.mode=25;case 25:if(le===0)break e;if(de=_e-le,M.offset>de){if((de=M.offset-de)>M.whave&&M.sane){R.msg="invalid distance too far back",M.mode=30;break}oe=de>M.wnext?(de-=M.wnext,M.wsize-de):M.wnext-de,de>M.length&&(de=M.length),ee=M.window}else ee=X,oe=re-M.offset,de=M.length;for(le<de&&(de=le),le-=de,M.length-=de;X[re++]=ee[oe++],--de;);M.length===0&&(M.mode=21);break;case 26:if(le===0)break e;X[re++]=M.length,le--,M.mode=21;break;case 27:if(M.wrap){for(;Z<32;){if(J===0)break e;J--,W|=z[H++]<<Z,Z+=8}if(_e-=le,R.total_out+=_e,M.total+=_e,_e&&(R.adler=M.check=M.flags?a(M.check,X,_e,re-_e):o(M.check,X,_e,re-_e)),_e=le,(M.flags?W:p(W))!==M.check){R.msg="incorrect data check",M.mode=30;break}Z=W=0}M.mode=28;case 28:if(M.wrap&&M.flags){for(;Z<32;){if(J===0)break e;J--,W+=z[H++]<<Z,Z+=8}if(W!==(4294967295&M.total)){R.msg="incorrect length check",M.mode=30;break}Z=W=0}M.mode=29;case 29:q=1;break e;case 30:q=-3;break e;case 31:return-4;case 32:default:return d}return R.next_out=re,R.avail_out=le,R.next_in=H,R.avail_in=J,M.hold=W,M.bits=Z,(M.wsize||_e!==R.avail_out&&M.mode<30&&(M.mode<27||O!==4))&&B(R,R.output,R.next_out,_e-R.avail_out)?(M.mode=31,-4):(ge-=R.avail_in,_e-=R.avail_out,R.total_in+=ge,R.total_out+=_e,M.total+=_e,M.wrap&&_e&&(R.adler=M.check=M.flags?a(M.check,X,_e,R.next_out-_e):o(M.check,X,_e,R.next_out-_e)),R.data_type=M.bits+(M.last?64:0)+(M.mode===12?128:0)+(M.mode===20||M.mode===15?256:0),(ge==0&&_e===0||O===4)&&q===f&&(q=-5),q)},i.inflateEnd=function(R){if(!R||!R.state)return d;var O=R.state;return O.window&&(O.window=null),R.state=null,f},i.inflateGetHeader=function(R,O){var M;return R&&R.state?(2&(M=R.state).wrap)==0?d:((M.head=O).done=!1,f):d},i.inflateSetDictionary=function(R,O){var M,z=O.length;return R&&R.state?(M=R.state).wrap!==0&&M.mode!==11?d:M.mode===11&&o(1,O,z,0)!==M.check?-3:B(R,O,z,z)?(M.mode=31,-4):(M.havedict=1,f):d},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,n,i){var s=t("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(h,u,f,d,g,_,m,p){var v,y,x,A,E,I,D,b,C,B=p.bits,R=0,O=0,M=0,z=0,X=0,H=0,re=0,J=0,le=0,W=0,Z=null,ge=0,_e=new s.Buf16(16),de=new s.Buf16(16),oe=null,ee=0;for(R=0;R<=15;R++)_e[R]=0;for(O=0;O<d;O++)_e[u[f+O]]++;for(X=B,z=15;1<=z&&_e[z]===0;z--);if(z<X&&(X=z),z===0)return g[_++]=20971520,g[_++]=20971520,p.bits=1,0;for(M=1;M<z&&_e[M]===0;M++);for(X<M&&(X=M),R=J=1;R<=15;R++)if(J<<=1,(J-=_e[R])<0)return-1;if(0<J&&(h===0||z!==1))return-1;for(de[1]=0,R=1;R<15;R++)de[R+1]=de[R]+_e[R];for(O=0;O<d;O++)u[f+O]!==0&&(m[de[u[f+O]]++]=O);if(I=h===0?(Z=oe=m,19):h===1?(Z=o,ge-=257,oe=a,ee-=257,256):(Z=c,oe=l,-1),R=M,E=_,re=O=W=0,x=-1,A=(le=1<<(H=X))-1,h===1&&852<le||h===2&&592<le)return 1;for(;;){for(D=R-re,C=m[O]<I?(b=0,m[O]):m[O]>I?(b=oe[ee+m[O]],Z[ge+m[O]]):(b=96,0),v=1<<R-re,M=y=1<<H;g[E+(W>>re)+(y-=v)]=D<<24|b<<16|C|0,y!==0;);for(v=1<<R-1;W&v;)v>>=1;if(v!==0?(W&=v-1,W+=v):W=0,O++,--_e[R]==0){if(R===z)break;R=u[f+m[O]]}if(X<R&&(W&A)!==x){for(re===0&&(re=X),E+=M,J=1<<(H=R-re);H+re<z&&!((J-=_e[H+re])<=0);)H++,J<<=1;if(le+=1<<H,h===1&&852<le||h===2&&592<le)return 1;g[x=W&A]=X<<24|H<<16|E-_|0}}return W!==0&&(g[E+W]=R-re<<24|64<<16|0),p.bits=X,0}},{"../utils/common":41}],51:[function(t,n,i){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,n,i){var s=t("../utils/common"),o=0,a=1;function c(S){for(var G=S.length;0<=--G;)S[G]=0}var l=0,h=29,u=256,f=u+1+h,d=30,g=19,_=2*f+1,m=15,p=16,v=7,y=256,x=16,A=17,E=18,I=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],D=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=new Array(2*(f+2));c(B);var R=new Array(2*d);c(R);var O=new Array(512);c(O);var M=new Array(256);c(M);var z=new Array(h);c(z);var X,H,re,J=new Array(d);function le(S,G,K,ie,V){this.static_tree=S,this.extra_bits=G,this.extra_base=K,this.elems=ie,this.max_length=V,this.has_stree=S&&S.length}function W(S,G){this.dyn_tree=S,this.max_code=0,this.stat_desc=G}function Z(S){return S<256?O[S]:O[256+(S>>>7)]}function ge(S,G){S.pending_buf[S.pending++]=255&G,S.pending_buf[S.pending++]=G>>>8&255}function _e(S,G,K){S.bi_valid>p-K?(S.bi_buf|=G<<S.bi_valid&65535,ge(S,S.bi_buf),S.bi_buf=G>>p-S.bi_valid,S.bi_valid+=K-p):(S.bi_buf|=G<<S.bi_valid&65535,S.bi_valid+=K)}function de(S,G,K){_e(S,K[2*G],K[2*G+1])}function oe(S,G){for(var K=0;K|=1&S,S>>>=1,K<<=1,0<--G;);return K>>>1}function ee(S,G,K){var ie,V,P=new Array(m+1),T=0;for(ie=1;ie<=m;ie++)P[ie]=T=T+K[ie-1]<<1;for(V=0;V<=G;V++){var F=S[2*V+1];F!==0&&(S[2*V]=oe(P[F]++,F))}}function pe(S){var G;for(G=0;G<f;G++)S.dyn_ltree[2*G]=0;for(G=0;G<d;G++)S.dyn_dtree[2*G]=0;for(G=0;G<g;G++)S.bl_tree[2*G]=0;S.dyn_ltree[2*y]=1,S.opt_len=S.static_len=0,S.last_lit=S.matches=0}function ye(S){8<S.bi_valid?ge(S,S.bi_buf):0<S.bi_valid&&(S.pending_buf[S.pending++]=S.bi_buf),S.bi_buf=0,S.bi_valid=0}function Ae(S,G,K,ie){var V=2*G,P=2*K;return S[V]<S[P]||S[V]===S[P]&&ie[G]<=ie[K]}function ze(S,G,K){for(var ie=S.heap[K],V=K<<1;V<=S.heap_len&&(V<S.heap_len&&Ae(G,S.heap[V+1],S.heap[V],S.depth)&&V++,!Ae(G,ie,S.heap[V],S.depth));)S.heap[K]=S.heap[V],K=V,V<<=1;S.heap[K]=ie}function je(S,G,K){var ie,V,P,T,F=0;if(S.last_lit!==0)for(;ie=S.pending_buf[S.d_buf+2*F]<<8|S.pending_buf[S.d_buf+2*F+1],V=S.pending_buf[S.l_buf+F],F++,ie===0?de(S,V,G):(de(S,(P=M[V])+u+1,G),(T=I[P])!==0&&_e(S,V-=z[P],T),de(S,P=Z(--ie),K),(T=D[P])!==0&&_e(S,ie-=J[P],T)),F<S.last_lit;);de(S,y,G)}function He(S,G){var K,ie,V,P=G.dyn_tree,T=G.stat_desc.static_tree,F=G.stat_desc.has_stree,Q=G.stat_desc.elems,ce=-1;for(S.heap_len=0,S.heap_max=_,K=0;K<Q;K++)P[2*K]!==0?(S.heap[++S.heap_len]=ce=K,S.depth[K]=0):P[2*K+1]=0;for(;S.heap_len<2;)P[2*(V=S.heap[++S.heap_len]=ce<2?++ce:0)]=1,S.depth[V]=0,S.opt_len--,F&&(S.static_len-=T[2*V+1]);for(G.max_code=ce,K=S.heap_len>>1;1<=K;K--)ze(S,P,K);for(V=Q;K=S.heap[1],S.heap[1]=S.heap[S.heap_len--],ze(S,P,1),ie=S.heap[1],S.heap[--S.heap_max]=K,S.heap[--S.heap_max]=ie,P[2*V]=P[2*K]+P[2*ie],S.depth[V]=(S.depth[K]>=S.depth[ie]?S.depth[K]:S.depth[ie])+1,P[2*K+1]=P[2*ie+1]=V,S.heap[1]=V++,ze(S,P,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(te,Re){var we,Le,Xe,fe,Se,Oe,Ue=Re.dyn_tree,Me=Re.max_code,it=Re.stat_desc.static_tree,Y=Re.stat_desc.has_stree,Pe=Re.stat_desc.extra_bits,be=Re.stat_desc.extra_base,De=Re.stat_desc.max_length,ve=0;for(fe=0;fe<=m;fe++)te.bl_count[fe]=0;for(Ue[2*te.heap[te.heap_max]+1]=0,we=te.heap_max+1;we<_;we++)De<(fe=Ue[2*Ue[2*(Le=te.heap[we])+1]+1]+1)&&(fe=De,ve++),Ue[2*Le+1]=fe,Me<Le||(te.bl_count[fe]++,Se=0,be<=Le&&(Se=Pe[Le-be]),Oe=Ue[2*Le],te.opt_len+=Oe*(fe+Se),Y&&(te.static_len+=Oe*(it[2*Le+1]+Se)));if(ve!==0){do{for(fe=De-1;te.bl_count[fe]===0;)fe--;te.bl_count[fe]--,te.bl_count[fe+1]+=2,te.bl_count[De]--,ve-=2}while(0<ve);for(fe=De;fe!==0;fe--)for(Le=te.bl_count[fe];Le!==0;)Me<(Xe=te.heap[--we])||(Ue[2*Xe+1]!==fe&&(te.opt_len+=(fe-Ue[2*Xe+1])*Ue[2*Xe],Ue[2*Xe+1]=fe),Le--)}}(S,G),ee(P,ce,S.bl_count)}function w(S,G,K){var ie,V,P=-1,T=G[1],F=0,Q=7,ce=4;for(T===0&&(Q=138,ce=3),G[2*(K+1)+1]=65535,ie=0;ie<=K;ie++)V=T,T=G[2*(ie+1)+1],++F<Q&&V===T||(F<ce?S.bl_tree[2*V]+=F:V!==0?(V!==P&&S.bl_tree[2*V]++,S.bl_tree[2*x]++):F<=10?S.bl_tree[2*A]++:S.bl_tree[2*E]++,P=V,ce=(F=0)===T?(Q=138,3):V===T?(Q=6,3):(Q=7,4))}function q(S,G,K){var ie,V,P=-1,T=G[1],F=0,Q=7,ce=4;for(T===0&&(Q=138,ce=3),ie=0;ie<=K;ie++)if(V=T,T=G[2*(ie+1)+1],!(++F<Q&&V===T)){if(F<ce)for(;de(S,V,S.bl_tree),--F!=0;);else V!==0?(V!==P&&(de(S,V,S.bl_tree),F--),de(S,x,S.bl_tree),_e(S,F-3,2)):F<=10?(de(S,A,S.bl_tree),_e(S,F-3,3)):(de(S,E,S.bl_tree),_e(S,F-11,7));P=V,ce=(F=0)===T?(Q=138,3):V===T?(Q=6,3):(Q=7,4)}}c(J);var k=!1;function N(S,G,K,ie){_e(S,(l<<1)+(ie?1:0),3),function(V,P,T,F){ye(V),F&&(ge(V,T),ge(V,~T)),s.arraySet(V.pending_buf,V.window,P,T,V.pending),V.pending+=T}(S,G,K,!0)}i._tr_init=function(S){k||(function(){var G,K,ie,V,P,T=new Array(m+1);for(V=ie=0;V<h-1;V++)for(z[V]=ie,G=0;G<1<<I[V];G++)M[ie++]=V;for(M[ie-1]=V,V=P=0;V<16;V++)for(J[V]=P,G=0;G<1<<D[V];G++)O[P++]=V;for(P>>=7;V<d;V++)for(J[V]=P<<7,G=0;G<1<<D[V]-7;G++)O[256+P++]=V;for(K=0;K<=m;K++)T[K]=0;for(G=0;G<=143;)B[2*G+1]=8,G++,T[8]++;for(;G<=255;)B[2*G+1]=9,G++,T[9]++;for(;G<=279;)B[2*G+1]=7,G++,T[7]++;for(;G<=287;)B[2*G+1]=8,G++,T[8]++;for(ee(B,f+1,T),G=0;G<d;G++)R[2*G+1]=5,R[2*G]=oe(G,5);X=new le(B,I,u+1,f,m),H=new le(R,D,0,d,m),re=new le(new Array(0),b,0,g,v)}(),k=!0),S.l_desc=new W(S.dyn_ltree,X),S.d_desc=new W(S.dyn_dtree,H),S.bl_desc=new W(S.bl_tree,re),S.bi_buf=0,S.bi_valid=0,pe(S)},i._tr_stored_block=N,i._tr_flush_block=function(S,G,K,ie){var V,P,T=0;0<S.level?(S.strm.data_type===2&&(S.strm.data_type=function(F){var Q,ce=4093624447;for(Q=0;Q<=31;Q++,ce>>>=1)if(1&ce&&F.dyn_ltree[2*Q]!==0)return o;if(F.dyn_ltree[18]!==0||F.dyn_ltree[20]!==0||F.dyn_ltree[26]!==0)return a;for(Q=32;Q<u;Q++)if(F.dyn_ltree[2*Q]!==0)return a;return o}(S)),He(S,S.l_desc),He(S,S.d_desc),T=function(F){var Q;for(w(F,F.dyn_ltree,F.l_desc.max_code),w(F,F.dyn_dtree,F.d_desc.max_code),He(F,F.bl_desc),Q=g-1;3<=Q&&F.bl_tree[2*C[Q]+1]===0;Q--);return F.opt_len+=3*(Q+1)+5+5+4,Q}(S),V=S.opt_len+3+7>>>3,(P=S.static_len+3+7>>>3)<=V&&(V=P)):V=P=K+5,K+4<=V&&G!==-1?N(S,G,K,ie):S.strategy===4||P===V?(_e(S,2+(ie?1:0),3),je(S,B,R)):(_e(S,4+(ie?1:0),3),function(F,Q,ce,te){var Re;for(_e(F,Q-257,5),_e(F,ce-1,5),_e(F,te-4,4),Re=0;Re<te;Re++)_e(F,F.bl_tree[2*C[Re]+1],3);q(F,F.dyn_ltree,Q-1),q(F,F.dyn_dtree,ce-1)}(S,S.l_desc.max_code+1,S.d_desc.max_code+1,T+1),je(S,S.dyn_ltree,S.dyn_dtree)),pe(S),ie&&ye(S)},i._tr_tally=function(S,G,K){return S.pending_buf[S.d_buf+2*S.last_lit]=G>>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&G,S.pending_buf[S.l_buf+S.last_lit]=255&K,S.last_lit++,G===0?S.dyn_ltree[2*K]++:(S.matches++,G--,S.dyn_ltree[2*(M[K]+u+1)]++,S.dyn_dtree[2*Z(G)]++),S.last_lit===S.lit_bufsize-1},i._tr_align=function(S){_e(S,2,3),de(S,y,B),function(G){G.bi_valid===16?(ge(G,G.bi_buf),G.bi_buf=0,G.bi_valid=0):8<=G.bi_valid&&(G.pending_buf[G.pending++]=255&G.bi_buf,G.bi_buf>>=8,G.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(t,n,i){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,n,i){(function(s){(function(o,a){if(!o.setImmediate){var c,l,h,u,f=1,d={},g=!1,_=o.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(o);m=m&&m.setTimeout?m:o,c={}.toString.call(o.process)==="[object process]"?function(x){process.nextTick(function(){v(x)})}:function(){if(o.postMessage&&!o.importScripts){var x=!0,A=o.onmessage;return o.onmessage=function(){x=!1},o.postMessage("","*"),o.onmessage=A,x}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",y,!1):o.attachEvent("onmessage",y),function(x){o.postMessage(u+x,"*")}):o.MessageChannel?((h=new MessageChannel).port1.onmessage=function(x){v(x.data)},function(x){h.port2.postMessage(x)}):_&&"onreadystatechange"in _.createElement("script")?(l=_.documentElement,function(x){var A=_.createElement("script");A.onreadystatechange=function(){v(x),A.onreadystatechange=null,l.removeChild(A),A=null},l.appendChild(A)}):function(x){setTimeout(v,0,x)},m.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var A=new Array(arguments.length-1),E=0;E<A.length;E++)A[E]=arguments[E+1];var I={callback:x,args:A};return d[f]=I,c(f),f++},m.clearImmediate=p}function p(x){delete d[x]}function v(x){if(g)setTimeout(v,0,x);else{var A=d[x];if(A){g=!0;try{(function(E){var I=E.callback,D=E.args;switch(D.length){case 0:I();break;case 1:I(D[0]);break;case 2:I(D[0],D[1]);break;case 3:I(D[0],D[1],D[2]);break;default:I.apply(a,D)}})(A)}finally{p(x),g=!1}}}}function y(x){x.source===o&&typeof x.data=="string"&&x.data.indexOf(u)===0&&v(+x.data.slice(u.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof fl<"u"?fl:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(jm);const iM=jm.exports,Jm=["BOOLEAN","INT32","INT64","INT96","FLOAT","DOUBLE","BYTE_ARRAY","FIXED_LEN_BYTE_ARRAY"],Mr=["PLAIN","GROUP_VAR_INT","PLAIN_DICTIONARY","RLE","BIT_PACKED","DELTA_BINARY_PACKED","DELTA_LENGTH_BYTE_ARRAY","DELTA_BYTE_ARRAY","RLE_DICTIONARY","BYTE_STREAM_SPLIT"],rM=["REQUIRED","OPTIONAL","REPEATED"],sM=["UTF8","MAP","MAP_KEY_VALUE","LIST","ENUM","DECIMAL","DATE","TIME_MILLIS","TIME_MICROS","TIMESTAMP_MILLIS","TIMESTAMP_MICROS","UINT_8","UINT_16","UINT_32","UINT_64","INT_8","INT_16","INT_32","INT_64","JSON","BSON","INTERVAL"],oM=["UNCOMPRESSED","SNAPPY","GZIP","LZO","BROTLI","LZ4","ZSTD","LZ4_RAW"],$m=["DATA_PAGE","INDEX_PAGE","DICTIONARY_PAGE","DATA_PAGE_V2"],aM=["SPHERICAL","VINCENTY","THOMAS","ANDOYER","KARNEY"];function Zu(r){const e=xl(r);if(e.type===1)return{type:"Point",coordinates:Yu(r,e)};if(e.type===2)return{type:"LineString",coordinates:Qu(r,e)};if(e.type===3)return{type:"Polygon",coordinates:eg(r,e)};if(e.type===4){const t=[];for(let n=0;n<e.count;n++)t.push(Yu(r,xl(r)));return{type:"MultiPoint",coordinates:t}}else if(e.type===5){const t=[];for(let n=0;n<e.count;n++)t.push(Qu(r,xl(r)));return{type:"MultiLineString",coordinates:t}}else if(e.type===6){const t=[];for(let n=0;n<e.count;n++)t.push(eg(r,xl(r)));return{type:"MultiPolygon",coordinates:t}}else if(e.type===7){const t=[];for(let n=0;n<e.count;n++)t.push(Zu(r));return{type:"GeometryCollection",geometries:t}}else throw new Error(`Unsupported geometry type: ${e.type}`)}function xl(r){const{view:e}=r,t=e.getUint8(r.offset++)===1,n=e.getUint32(r.offset,t);r.offset+=4;const i=n%1e3,s=Math.floor(n/1e3);let o=0;i>1&&i<=7&&(o=e.getUint32(r.offset,t),r.offset+=4);let a=2;return s&&a++,s===3&&a++,{littleEndian:t,type:i,dim:a,count:o}}function Yu(r,e){const t=[];for(let n=0;n<e.dim;n++){const i=r.view.getFloat64(r.offset,e.littleEndian);r.offset+=8,t.push(i)}return t}function Qu(r,e){const t=[];for(let n=0;n<e.count;n++)t.push(Yu(r,e));return t}function eg(r,e){const{view:t}=r,n=[];for(let i=0;i<e.count;i++){const s=t.getUint32(r.offset,e.littleEndian);r.offset+=4,n.push(Qu(r,{...e,count:s}))}return n}const tg=new TextDecoder,ng={timestampFromMilliseconds(r){return new Date(Number(r))},timestampFromMicroseconds(r){return new Date(Number(r/1000n))},timestampFromNanoseconds(r){return new Date(Number(r/1000000n))},dateFromDays(r){return new Date(r*864e5)},stringFromBytes(r){return r&&tg.decode(r)},geometryFromBytes(r){return r&&Zu({view:new DataView(r.buffer,r.byteOffset,r.byteLength),offset:0})},geographyFromBytes(r){return r&&Zu({view:new DataView(r.buffer,r.byteOffset,r.byteLength),offset:0})}};function ig(r,e,t,n){if(e&&t.endsWith("_DICTIONARY")){let i=r;r instanceof Uint8Array&&!(e instanceof Uint8Array)&&(i=new e.constructor(r.length));for(let s=0;s<r.length;s++)i[s]=e[r[s]];return i}else return rg(r,n)}function rg(r,e){const{element:t,parsers:n,utf8:i=!0}=e,{type:s,converted_type:o,logical_type:a}=t;if(o==="DECIMAL"){const l=10**-(t.scale||0),h=new Array(r.length);for(let u=0;u<h.length;u++)r[u]instanceof Uint8Array?h[u]=sg(r[u])*l:h[u]=Number(r[u])*l;return h}if(!o&&s==="INT96")return Array.from(r).map(c=>n.timestampFromNanoseconds(cM(c)));if(o==="DATE")return Array.from(r).map(c=>n.dateFromDays(c));if(o==="TIMESTAMP_MILLIS")return Array.from(r).map(c=>n.timestampFromMilliseconds(c));if(o==="TIMESTAMP_MICROS")return Array.from(r).map(c=>n.timestampFromMicroseconds(c));if(o==="JSON")return r.map(c=>JSON.parse(tg.decode(c)));if(o==="BSON")throw new Error("parquet bson not supported");if(o==="INTERVAL")throw new Error("parquet interval not supported");if(a?.type==="GEOMETRY")return r.map(c=>n.geometryFromBytes(c));if(a?.type==="GEOGRAPHY")return r.map(c=>n.geographyFromBytes(c));if(o==="UTF8"||a?.type==="STRING"||i&&s==="BYTE_ARRAY")return r.map(c=>n.stringFromBytes(c));if(o==="UINT_64"||a?.type==="INTEGER"&&a.bitWidth===64&&!a.isSigned){if(r instanceof BigInt64Array)return new BigUint64Array(r.buffer,r.byteOffset,r.length);const c=new BigUint64Array(r.length);for(let l=0;l<c.length;l++)c[l]=BigInt(r[l]);return c}if(o==="UINT_32"||a?.type==="INTEGER"&&a.bitWidth===32&&!a.isSigned){if(r instanceof Int32Array)return new Uint32Array(r.buffer,r.byteOffset,r.length);const c=new Uint32Array(r.length);for(let l=0;l<c.length;l++)c[l]=r[l];return c}if(a?.type==="FLOAT16")return Array.from(r).map(og);if(a?.type==="TIMESTAMP"){const{unit:c}=a;let l=n.timestampFromMilliseconds;c==="MICROS"&&(l=n.timestampFromMicroseconds),c==="NANOS"&&(l=n.timestampFromNanoseconds);const h=new Array(r.length);for(let u=0;u<h.length;u++)h[u]=l(r[u]);return h}return r}function sg(r){if(!r.length)return 0;let e=0n;for(const n of r)e=e*256n+BigInt(n);const t=r.length*8;return e>=2n**BigInt(t-1)&&(e-=2n**BigInt(t)),Number(e)}function cM(r){const e=(r>>64n)-2440588n,t=r&0xffffffffffffffffn;return e*86400000000000n+t}function og(r){if(!r)return;const e=r[1]<<8|r[0],t=e>>15?-1:1,n=e>>10&31,i=e&1023;return n===0?t*2**-14*(i/1024):n===31?i?NaN:t*(1/0):t*2**(n-15)*(1+i/1024)}function ag(r,e,t){const n=r[e],i=[];let s=1;if(n.num_children)for(;i.length<n.num_children;){const o=r[e+s],a=ag(r,e+s,[...t,o.name]);s+=a.count,i.push(a)}return{count:s,element:n,children:i,path:t}}function cg(r,e){let t=ag(r,0,[]);const n=[t];for(const i of e){const s=t.children.find(o=>o.element.name===i);if(!s)throw new Error(`parquet schema element not found: ${e}`);n.push(s),t=s}return n}function lM(r){const e=[];function t(n){if(n.children.length)for(const i of n.children)t(i);else e.push(n.path.join("."))}return t(r),e}function lg(r){let e=0;for(const{element:t}of r)t.repetition_type==="REPEATED"&&e++;return e}function Ku(r){let e=0;for(const{element:t}of r.slice(1))t.repetition_type!=="REQUIRED"&&e++;return e}function hM(r){if(!r||r.element.converted_type!=="LIST"||r.children.length>1)return!1;const e=r.children[0];return!(e.children.length>1||e.element.repetition_type!=="REPEATED")}function uM(r){if(!r||r.element.converted_type!=="MAP"||r.children.length>1)return!1;const e=r.children[0];return!(e.children.length!==2||e.element.repetition_type!=="REPEATED"||e.children.find(i=>i.element.name==="key")?.element.repetition_type==="REPEATED"||e.children.find(i=>i.element.name==="value")?.element.repetition_type==="REPEATED")}function hg(r){if(r.length!==2)return!1;const[,e]=r;return!(e.element.repetition_type==="REPEATED"||e.children.length)}const $t={STOP:0,TRUE:1,FALSE:2,BYTE:3,I16:4,I32:5,I64:6,DOUBLE:7,BINARY:8,LIST:9,SET:10,MAP:11,STRUCT:12,UUID:13};function ju(r){let e=0;const t={};for(;r.offset<r.view.byteLength;){const[n,i,s]=fg(r,e);if(e=s,n===$t.STOP)break;t[`field_${i}`]=Al(r,n)}return t}function Al(r,e){switch(e){case $t.TRUE:return!0;case $t.FALSE:return!1;case $t.BYTE:return r.view.getInt8(r.offset++);case $t.I16:case $t.I32:return ug(r);case $t.I64:return Ju(r);case $t.DOUBLE:{const t=r.view.getFloat64(r.offset,!0);return r.offset+=8,t}case $t.BINARY:{const t=Er(r),n=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,t);return r.offset+=t,n}case $t.LIST:{const t=r.view.getUint8(r.offset++),n=t&15;let i=t>>4;i===15&&(i=Er(r));const s=n===$t.TRUE||n===$t.FALSE,o=new Array(i);for(let a=0;a<i;a++)o[a]=s?Al(r,$t.BYTE)===1:Al(r,n);return o}case $t.STRUCT:{const t={};let n=0;for(;;){const[i,s,o]=fg(r,n);if(n=o,i===$t.STOP)break;t[`field_${s}`]=Al(r,i)}return t}default:throw new Error(`thrift unhandled type: ${e}`)}}function Er(r){let e=0,t=0;for(;;){const n=r.view.getUint8(r.offset++);if(e|=(n&127)<<t,!(n&128))return e;t+=7}}function fM(r){let e=0n,t=0n;for(;;){const n=r.view.getUint8(r.offset++);if(e|=BigInt(n&127)<<t,!(n&128))return e;t+=7n}}function ug(r){const e=Er(r);return e>>>1^-(e&1)}function Ju(r){const e=fM(r);return e>>1n^-(e&1n)}function fg(r,e){const t=r.view.getUint8(r.offset++),n=t&15;if(n===$t.STOP)return[0,0,e];const i=t>>4,s=i?e+i:ug(r);return[n,s,s]}function dM(r,e){const t=new Map,n=e?.find(({key:s})=>s==="geo")?.value,i=(n&&JSON.parse(n)?.columns)??{};for(const[s,o]of Object.entries(i)){if(o.encoding!=="WKB")continue;const a=o.edges==="spherical"?"GEOGRAPHY":"GEOMETRY",c=o.crs?.id??o.crs?.ids?.[0],l=c?`${c.authority}:${c.code.toString()}`:void 0;t.set(s,{type:a,crs:l})}for(let s=1;s<r.length;s++){const o=r[s],{logical_type:a,name:c,num_children:l,repetition_type:h,type:u}=o;if(l){s+=l;continue}u==="BYTE_ARRAY"&&a===void 0&&h!=="REPEATED"&&(o.logical_type=t.get(c))}}const pM=1<<19,mM=new TextDecoder;function ni(r){return r&&mM.decode(r)}async function dg(r,{parsers:e,initialFetchSize:t=pM,geoparquet:n=!0}={}){if(!r||!(r.byteLength>=0))throw new Error("parquet expected AsyncBuffer");const i=Math.max(0,r.byteLength-t),s=await r.slice(i,r.byteLength),o=new DataView(s);if(o.getUint32(s.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const a=o.getUint32(s.byteLength-8,!0);if(a>r.byteLength-8)throw new Error(`parquet metadata length ${a} exceeds available buffer ${r.byteLength-8}`);if(a+8>t){const c=r.byteLength-a-8,l=await r.slice(c,i),h=new ArrayBuffer(a+8),u=new Uint8Array(h);return u.set(new Uint8Array(l)),u.set(new Uint8Array(s),i-c),pg(h,{parsers:e,geoparquet:n})}else return pg(s,{parsers:e,geoparquet:n})}function pg(r,{parsers:e,geoparquet:t=!0}={}){if(!(r instanceof ArrayBuffer))throw new Error("parquet expected ArrayBuffer");const n=new DataView(r);if(e={...ng,...e},n.byteLength<8)throw new Error("parquet file is too short");if(n.getUint32(n.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const i=n.byteLength-8,s=n.getUint32(i,!0);if(s>n.byteLength-8)throw new Error(`parquet metadata length ${s} exceeds available buffer ${n.byteLength-8}`);const o=i-s,c=ju({view:n,offset:o}),l=c.field_1,h=c.field_2.map(m=>({type:Jm[m.field_1],type_length:m.field_2,repetition_type:rM[m.field_3],name:ni(m.field_4),num_children:m.field_5,converted_type:sM[m.field_6],scale:m.field_7,precision:m.field_8,field_id:m.field_9,logical_type:gM(m.field_10)})),u=h.filter(m=>m.type),f=c.field_3,d=c.field_4.map(m=>({columns:m.field_1.map((p,v)=>({file_path:ni(p.field_1),file_offset:p.field_2,meta_data:p.field_3&&{type:Jm[p.field_3.field_1],encodings:p.field_3.field_2?.map(y=>Mr[y]),path_in_schema:p.field_3.field_3.map(ni),codec:oM[p.field_3.field_4],num_values:p.field_3.field_5,total_uncompressed_size:p.field_3.field_6,total_compressed_size:p.field_3.field_7,key_value_metadata:p.field_3.field_8?.map(y=>({key:ni(y.field_1),value:ni(y.field_2)})),data_page_offset:p.field_3.field_9,index_page_offset:p.field_3.field_10,dictionary_page_offset:p.field_3.field_11,statistics:_M(p.field_3.field_12,u[v],e),encoding_stats:p.field_3.field_13?.map(y=>({page_type:$m[y.field_1],encoding:Mr[y.field_2],count:y.field_3})),bloom_filter_offset:p.field_3.field_14,bloom_filter_length:p.field_3.field_15,size_statistics:p.field_3.field_16&&{unencoded_byte_array_data_bytes:p.field_3.field_16.field_1,repetition_level_histogram:p.field_3.field_16.field_2,definition_level_histogram:p.field_3.field_16.field_3},geospatial_statistics:p.field_3.field_17&&{bbox:p.field_3.field_17.field_1&&{xmin:p.field_3.field_17.field_1.field_1,xmax:p.field_3.field_17.field_1.field_2,ymin:p.field_3.field_17.field_1.field_3,ymax:p.field_3.field_17.field_1.field_4,zmin:p.field_3.field_17.field_1.field_5,zmax:p.field_3.field_17.field_1.field_6,mmin:p.field_3.field_17.field_1.field_7,mmax:p.field_3.field_17.field_1.field_8},geospatial_types:p.field_3.field_17.field_2}},offset_index_offset:p.field_4,offset_index_length:p.field_5,column_index_offset:p.field_6,column_index_length:p.field_7,crypto_metadata:p.field_8,encrypted_column_metadata:p.field_9})),total_byte_size:m.field_2,num_rows:m.field_3,sorting_columns:m.field_4?.map(p=>({column_idx:p.field_1,descending:p.field_2,nulls_first:p.field_3})),file_offset:m.field_5,total_compressed_size:m.field_6,ordinal:m.field_7})),g=c.field_5?.map(m=>({key:ni(m.field_1),value:ni(m.field_2)})),_=ni(c.field_6);return t&&dM(h,g),{version:l,schema:h,num_rows:f,row_groups:d,key_value_metadata:g,created_by:_,metadata_length:s}}function $u({schema:r}){return cg(r,[])[0]}function gM(r){return r?.field_1?{type:"STRING"}:r?.field_2?{type:"MAP"}:r?.field_3?{type:"LIST"}:r?.field_4?{type:"ENUM"}:r?.field_5?{type:"DECIMAL",scale:r.field_5.field_1,precision:r.field_5.field_2}:r?.field_6?{type:"DATE"}:r?.field_7?{type:"TIME",isAdjustedToUTC:r.field_7.field_1,unit:mg(r.field_7.field_2)}:r?.field_8?{type:"TIMESTAMP",isAdjustedToUTC:r.field_8.field_1,unit:mg(r.field_8.field_2)}:r?.field_10?{type:"INTEGER",bitWidth:r.field_10.field_1,isSigned:r.field_10.field_2}:r?.field_11?{type:"NULL"}:r?.field_12?{type:"JSON"}:r?.field_13?{type:"BSON"}:r?.field_14?{type:"UUID"}:r?.field_15?{type:"FLOAT16"}:r?.field_16?{type:"VARIANT",specification_version:r.field_16.field_1}:r?.field_17?{type:"GEOMETRY",crs:ni(r.field_17.field_1)}:r?.field_18?{type:"GEOGRAPHY",crs:ni(r.field_18.field_1),algorithm:aM[r.field_18.field_2]}:r}function mg(r){if(r.field_1)return"MILLIS";if(r.field_2)return"MICROS";if(r.field_3)return"NANOS";throw new Error("parquet time unit required")}function _M(r,e,t){return r&&{max:bl(r.field_1,e,t),min:bl(r.field_2,e,t),null_count:r.field_3,distinct_count:r.field_4,max_value:bl(r.field_5,e,t),min_value:bl(r.field_6,e,t),is_max_value_exact:r.field_7,is_min_value_exact:r.field_8}}function bl(r,e,t){const{type:n,converted_type:i,logical_type:s}=e;if(r===void 0)return r;if(n==="BOOLEAN")return r[0]===1;if(n==="BYTE_ARRAY")return t.stringFromBytes(r);const o=new DataView(r.buffer,r.byteOffset,r.byteLength);return n==="FLOAT"&&o.byteLength===4?o.getFloat32(0,!0):n==="DOUBLE"&&o.byteLength===8?o.getFloat64(0,!0):n==="INT32"&&i==="DATE"?t.dateFromDays(o.getInt32(0,!0)):n==="INT64"&&i==="TIMESTAMP_MILLIS"?t.timestampFromMilliseconds(o.getBigInt64(0,!0)):n==="INT64"&&i==="TIMESTAMP_MICROS"?t.timestampFromMicroseconds(o.getBigInt64(0,!0)):n==="INT64"&&s?.type==="TIMESTAMP"&&s?.unit==="NANOS"?t.timestampFromNanoseconds(o.getBigInt64(0,!0)):n==="INT64"&&s?.type==="TIMESTAMP"&&s?.unit==="MICROS"?t.timestampFromMicroseconds(o.getBigInt64(0,!0)):n==="INT64"&&s?.type==="TIMESTAMP"?t.timestampFromMilliseconds(o.getBigInt64(0,!0)):n==="INT32"&&o.byteLength===4?o.getInt32(0,!0):n==="INT64"&&o.byteLength===8?o.getBigInt64(0,!0):i==="DECIMAL"?sg(r)*10**-(e.scale||0):s?.type==="FLOAT16"?og(r):r}function vM(r){const e=ju(r);return{page_locations:e.field_1.map(yM),unencoded_byte_array_data_bytes:e.field_2}}function yM(r){return{offset:r.field_1,compressed_page_size:r.field_2,first_row_index:r.field_3}}function gg(r,e){for(let n=0;n<e.length;n+=1e4)r.push(...e.slice(n,n+1e4))}function mi(r,e,t=!0){if(t?r===e:r==e)return!0;if(r instanceof Uint8Array&&e instanceof Uint8Array)return mi(Array.from(r),Array.from(e),t);if(!r||!e||typeof r!=typeof e)return!1;if(Array.isArray(r)&&Array.isArray(e)){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!mi(r[i],e[i],t))return!1;return!0}if(typeof r!="object")return!1;const n=Object.keys(r);if(n.length!==Object.keys(e).length)return!1;for(const i of n)if(!mi(r[i],e[i],t))return!1;return!0}function _g(r){if(!r)return[];if(r.length===1)return r[0];const e=[];for(const t of r)gg(e,t);return e}function wl(r){if(!r)return[];const e=[];return"$and"in r&&Array.isArray(r.$and)?e.push(...r.$and.flatMap(wl)):"$or"in r&&Array.isArray(r.$or)?e.push(...r.$or.flatMap(wl)):"$nor"in r&&Array.isArray(r.$nor)?e.push(...r.$nor.flatMap(wl)):e.push(...Object.keys(r)),e}function Ro(r,e,t=!0){return"$and"in e&&Array.isArray(e.$and)?e.$and.every(n=>Ro(r,n,t)):"$or"in e&&Array.isArray(e.$or)?e.$or.some(n=>Ro(r,n,t)):"$nor"in e&&Array.isArray(e.$nor)?!e.$nor.some(n=>Ro(r,n,t)):Object.entries(e).every(([n,i])=>{const s=r[n];return typeof i!="object"||i===null||Array.isArray(i)?mi(s,i,t):Object.entries(i||{}).every(([o,a])=>o==="$gt"?s>a:o==="$gte"?s>=a:o==="$lt"?s<a:o==="$lte"?s<=a:o==="$eq"?mi(s,a,t):o==="$ne"?!mi(s,a,t):o==="$in"?Array.isArray(a)&&a.includes(s):o==="$nin"?Array.isArray(a)&&!a.includes(s):o==="$not"?!Ro({[n]:s},{[n]:a},t):!0)})}function ef({rowGroup:r,physicalColumns:e,filter:t,strict:n=!0}){if(!t)return!1;if("$and"in t&&Array.isArray(t.$and))return t.$and.some(i=>ef({rowGroup:r,physicalColumns:e,filter:i,strict:n}));if("$or"in t&&Array.isArray(t.$or))return t.$or.every(i=>ef({rowGroup:r,physicalColumns:e,filter:i,strict:n}));if("$nor"in t&&Array.isArray(t.$nor))return!1;for(const[i,s]of Object.entries(t)){const o=e.indexOf(i);if(o===-1)continue;const a=r.columns[o].meta_data?.statistics;if(!a)continue;const{min:c,max:l,min_value:h,max_value:u}=a,f=h!==void 0?h:c,d=u!==void 0?u:l;if(!(f===void 0||d===void 0)){for(const[g,_]of Object.entries(s||{}))if(g==="$gt"&&d<=_||g==="$gte"&&d<_||g==="$lt"&&f>=_||g==="$lte"&&f>_||g==="$eq"&&(_<f||_>d)||g==="$ne"&&mi(f,d,n)&&mi(f,_,n)||g==="$in"&&Array.isArray(_)&&_.every(m=>m<f||m>d)||g==="$nin"&&Array.isArray(_)&&mi(f,d,n)&&_.includes(f))return!0}}return!1}const xM=1<<21;function AM({metadata:r,rowStart:e=0,rowEnd:t=1/0,columns:n,filter:i,filterStrict:s=!0,useOffsetIndex:o=!1}){if(!r)throw new Error("parquetPlan requires metadata");const a=[],c=[],l=[],h=lM($u(r));let u=0;for(const f of r.row_groups){const d=Number(f.num_rows),g=u+d;if(d>0&&g>e&&u<t&&!ef({rowGroup:f,physicalColumns:h,filter:i,strict:s})){const _=[];for(const y of f.columns){const x=y.meta_data;if(y.file_path)throw new Error("parquet file_path not supported");if(!x)throw new Error("parquet column metadata is undefined");if(!n||n.includes(x.path_in_schema[0])){const A=x.dictionary_page_offset||x.data_page_offset,E=Number(A),I=Number(A+x.total_compressed_size);if(o&&y.offset_index_offset&&y.offset_index_length){const D=Number(y.offset_index_offset);_.push({columnMetadata:x,offsetIndex:{startByte:D,endByte:D+y.offset_index_length},bounds:{startByte:E,endByte:I}})}else _.push({columnMetadata:x,range:{startByte:E,endByte:I}})}}const m=Math.max(e-u,0),p=Math.min(t-u,d);a.push({chunks:_,rowGroup:f,groupStart:u,groupRows:d,selectStart:m,selectEnd:p});let v;for(const y of _)if("offsetIndex"in y)l.push(y.offsetIndex);else{const{range:x}=y;n?c.push(x):v&&x.endByte-v.startByte<=xM?v.endByte=x.endByte:(v&&c.push(v),v={...x})}v&&c.push(v)}u=g}return isFinite(t)||(t=u),c.push(...l),{metadata:r,rowStart:e,rowEnd:t,columns:n,fetches:c,groups:a}}function bM(r,{fetches:e}){const t=e.map(({startByte:n,endByte:i})=>r.slice(n,i));return{byteLength:r.byteLength,slice(n,i=r.byteLength){const s=e.findIndex(({startByte:o,endByte:a})=>o<=n&&i<=a);if(s<0)return r.slice(n,i);if(e[s].startByte!==n||e[s].endByte!==i){const o=n-e[s].startByte,a=i-e[s].startByte;return t[s]instanceof Promise?t[s].then(c=>c.slice(o,a)):t[s].slice(o,a)}else return t[s]}}}function vg(r,e,t,n,i){const s=e?.length||t.length;if(!s)return n;const o=Ku(i),a=i.map(({element:g})=>g.repetition_type);let c=0;const l=[r];let h=r,u=0,f=0,d=0;if(t[0])for(;u<a.length-2&&d<t[0];)u++,a[u]!=="REQUIRED"&&(h=h.at(-1),l.push(h),f++),a[u]==="REPEATED"&&d++;for(let g=0;g<s;g++){const _=e?.length?e[g]:o,m=t[g];for(;u&&(m<d||a[u]!=="REPEATED");)a[u]!=="REQUIRED"&&(l.pop(),f--),a[u]==="REPEATED"&&d--,u--;for(h=l.at(-1);(u<a.length-2||a[u+1]==="REPEATED")&&(f<_||a[u+1]==="REQUIRED");){if(u++,a[u]!=="REQUIRED"){const p=[];h.push(p),h=p,l.push(p),f++}a[u]==="REPEATED"&&d++}_===o?h.push(n[c++]):u===a.length-2?h.push(null):h.push([])}if(!r.length)for(let g=0;g<o;g++){const _=[];h.push(_),h=_}return r}function Po(r,e,t=0){const n=e.path.join("."),i=e.element.repetition_type==="OPTIONAL",s=i?t+1:t;if(hM(e)){let o=e.children[0],a=s;o.children.length===1&&(o=o.children[0],a++),Po(r,o,a);const c=o.path.join("."),l=r.get(c);if(!l)throw new Error("parquet list column missing values");i&&Sl(l,t),r.set(n,l),r.delete(c);return}if(uM(e)){const o=e.children[0].element.name;Po(r,e.children[0].children[0],s+1),Po(r,e.children[0].children[1],s+1);const a=r.get(`${n}.${o}.key`),c=r.get(`${n}.${o}.value`);if(!a)throw new Error("parquet map column missing keys");if(!c)throw new Error("parquet map column missing values");if(a.length!==c.length)throw new Error("parquet map column key/value length mismatch");const l=yg(a,c,s);i&&Sl(l,t),r.delete(`${n}.${o}.key`),r.delete(`${n}.${o}.value`),r.set(n,l);return}if(e.children.length){const o=e.element.repetition_type==="REQUIRED"?t:t+1,a={};for(const l of e.children){Po(r,l,o);const h=r.get(l.path.join("."));if(!h)throw new Error("parquet struct missing child data");a[l.element.name]=h}for(const l of e.children)r.delete(l.path.join("."));const c=xg(a,o);i&&Sl(c,t),r.set(n,c)}}function Sl(r,e){for(let t=0;t<r.length;t++)e?Sl(r[t],e-1):r[t]=r[t][0]}function yg(r,e,t){const n=[];for(let i=0;i<r.length;i++)if(t)n.push(yg(r[i],e[i],t-1));else if(r[i]){const s={};for(let o=0;o<r[i].length;o++){const a=e[i][o];s[r[i][o]]=a===void 0?null:a}n.push(s)}else n.push(void 0);return n}function xg(r,e){const t=Object.keys(r),n=r[t[0]]?.length,i=[];for(let s=0;s<n;s++){const o={};for(const a of t){if(r[a].length!==n)throw new Error("parquet struct parsing error");o[a]=r[a][s]}e?i.push(xg(o,e-1)):i.push(o)}return i}function Do(r,e,t){const n=t instanceof Int32Array,i=Er(r),s=Er(r);Er(r);let o=Ju(r),a=0;t[a++]=n?Number(o):o;const c=i/s;for(;a<e;){const l=Ju(r),h=new Uint8Array(s);for(let u=0;u<s;u++)h[u]=r.view.getUint8(r.offset++);for(let u=0;u<s&&a<e;u++){const f=BigInt(h[u]);if(f){let d=0n,g=c;const _=(1n<<f)-1n;for(;g&&a<e;){let m=BigInt(r.view.getUint8(r.offset))>>d&_;for(d+=f;d>=8;)d-=8n,r.offset++,d&&(m|=BigInt(r.view.getUint8(r.offset))<<f-d&_);const p=l+m;o+=p,t[a++]=n?Number(o):o,g--}g&&(r.offset+=Math.ceil((g*Number(f)+Number(d))/8))}else for(let d=0;d<c&&a<e;d++)o+=l,t[a++]=n?Number(o):o}}}function Ag(r,e,t){const n=new Int32Array(e);Do(r,e,n);for(let i=0;i<e;i++)t[i]=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,n[i]),r.offset+=n[i]}function wM(r,e,t){const n=new Int32Array(e);Do(r,e,n);const i=new Int32Array(e);Do(r,e,i);for(let s=0;s<e;s++){const o=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,i[s]);n[s]?(t[s]=new Uint8Array(n[s]+i[s]),t[s].set(t[s-1].subarray(0,n[s])),t[s].set(o,n[s])):t[s]=o,r.offset+=i[s]}}function Ml(r){return 32-Math.clz32(r)}function Oi(r,e,t,n){n===void 0&&(n=r.view.getUint32(r.offset,!0),r.offset+=4);const i=r.offset;let s=0;for(;s<t.length;){const o=Er(r);if(o&1)s=MM(r,o,e,t,s);else{const a=o>>>1;SM(r,a,e,t,s),s+=a}}r.offset=i+n}function SM(r,e,t,n,i){const s=t+7>>3;let o=0;for(let a=0;a<s;a++)o|=r.view.getUint8(r.offset++)<<(a<<3);for(let a=0;a<e;a++)n[i+a]=o}function MM(r,e,t,n,i){let s=e>>1<<3;const o=(1<<t)-1;let a=0;if(r.offset<r.view.byteLength)a=r.view.getUint8(r.offset++);else if(o)throw new Error(`parquet bitpack offset ${r.offset} out of range`);let c=8,l=0;for(;s;)l>8?(l-=8,c-=8,a>>>=8):c-l<t?(a|=r.view.getUint8(r.offset)<<c,r.offset++,c+=8):(i<n.length&&(n[i++]=a>>l&o),s--,l+=t);return i}function bg(r,e,t,n){const i=EM(t,n),s=new Uint8Array(e*i);for(let o=0;o<i;o++)for(let a=0;a<e;a++)s[a*i+o]=r.view.getUint8(r.offset++);if(t==="FLOAT")return new Float32Array(s.buffer);if(t==="DOUBLE")return new Float64Array(s.buffer);if(t==="INT32")return new Int32Array(s.buffer);if(t==="INT64")return new BigInt64Array(s.buffer);if(t==="FIXED_LEN_BYTE_ARRAY"){const o=new Array(e);for(let a=0;a<e;a++)o[a]=s.subarray(a*i,(a+1)*i);return o}throw new Error(`parquet byte_stream_split unsupported type: ${t}`)}function EM(r,e){switch(r){case"INT32":case"FLOAT":return 4;case"INT64":case"DOUBLE":return 8;case"FIXED_LEN_BYTE_ARRAY":if(!e)throw new Error("parquet byteWidth missing type_length");return e;default:throw new Error(`parquet unsupported type: ${r}`)}}function tf(r,e,t,n){if(t===0)return[];if(e==="BOOLEAN")return TM(r,t);if(e==="INT32")return CM(r,t);if(e==="INT64")return IM(r,t);if(e==="INT96")return RM(r,t);if(e==="FLOAT")return PM(r,t);if(e==="DOUBLE")return DM(r,t);if(e==="BYTE_ARRAY")return LM(r,t);if(e==="FIXED_LEN_BYTE_ARRAY"){if(!n)throw new Error("parquet missing fixed length");return NM(r,t,n)}else throw new Error(`parquet unhandled type: ${e}`)}function TM(r,e){const t=new Array(e);for(let n=0;n<e;n++){const i=r.offset+(n/8|0),s=n%8,o=r.view.getUint8(i);t[n]=(o&1<<s)!==0}return r.offset+=Math.ceil(e/8),t}function CM(r,e){const t=(r.view.byteOffset+r.offset)%4?new Int32Array(El(r.view.buffer,r.view.byteOffset+r.offset,e*4)):new Int32Array(r.view.buffer,r.view.byteOffset+r.offset,e);return r.offset+=e*4,t}function IM(r,e){const t=(r.view.byteOffset+r.offset)%8?new BigInt64Array(El(r.view.buffer,r.view.byteOffset+r.offset,e*8)):new BigInt64Array(r.view.buffer,r.view.byteOffset+r.offset,e);return r.offset+=e*8,t}function RM(r,e){const t=new Array(e);for(let n=0;n<e;n++){const i=r.view.getBigInt64(r.offset+n*12,!0),s=r.view.getInt32(r.offset+n*12+8,!0);t[n]=BigInt(s)<<64n|i}return r.offset+=e*12,t}function PM(r,e){const t=(r.view.byteOffset+r.offset)%4?new Float32Array(El(r.view.buffer,r.view.byteOffset+r.offset,e*4)):new Float32Array(r.view.buffer,r.view.byteOffset+r.offset,e);return r.offset+=e*4,t}function DM(r,e){const t=(r.view.byteOffset+r.offset)%8?new Float64Array(El(r.view.buffer,r.view.byteOffset+r.offset,e*8)):new Float64Array(r.view.buffer,r.view.byteOffset+r.offset,e);return r.offset+=e*8,t}function LM(r,e){const t=new Array(e);for(let n=0;n<e;n++){const i=r.view.getUint32(r.offset,!0);r.offset+=4,t[n]=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,i),r.offset+=i}return t}function NM(r,e,t){const n=new Array(e);for(let i=0;i<e;i++)n[i]=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,t),r.offset+=t;return n}function El(r,e,t){const n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(r,e,t)),n}const UM=[0,255,65535,16777215,4294967295];function wg(r,e,t,n,i){for(let s=0;s<i;s++)t[n+s]=r[e+s]}function BM(r,e){const t=r.byteLength,n=e.byteLength;let i=0,s=0;for(;i<t;){const o=r[i];if(i++,o<128)break}if(n&&i>=t)throw new Error("invalid snappy length header");for(;i<t;){const o=r[i];let a=0;if(i++,i>=t)throw new Error("missing eof marker");if((o&3)===0){let c=(o>>>2)+1;if(c>60){if(i+3>=t)throw new Error("snappy error literal pos + 3 >= inputLength");const l=c-60;c=r[i]+(r[i+1]<<8)+(r[i+2]<<16)+(r[i+3]<<24),c=(c&UM[l])+1,i+=l}if(i+c>t)throw new Error("snappy error literal exceeds input length");wg(r,i,e,s,c),i+=c,s+=c}else{let c=0;switch(o&3){case 1:a=(o>>>2&7)+4,c=r[i]+(o>>>5<<8),i++;break;case 2:if(t<=i+1)throw new Error("snappy error end of input");a=(o>>>2)+1,c=r[i]+(r[i+1]<<8),i+=2;break;case 3:if(t<=i+3)throw new Error("snappy error end of input");a=(o>>>2)+1,c=r[i]+(r[i+1]<<8)+(r[i+2]<<16)+(r[i+3]<<24),i+=4;break}if(c===0||isNaN(c))throw new Error(`invalid offset ${c} pos ${i} inputLength ${t}`);if(c>s)throw new Error("cannot copy from before start of buffer");wg(e,s-c,e,s,a),s+=a}}if(s!==n)throw new Error("premature end of input")}function OM(r,e,{type:t,element:n,schemaPath:i}){const s=new DataView(r.buffer,r.byteOffset,r.byteLength),o={view:s,offset:0};let a;const c=FM(o,e,i),{definitionLevels:l,numNulls:h}=zM(o,e,i),u=e.num_values-h;if(e.encoding==="PLAIN")a=tf(o,t,u,n.type_length);else if(e.encoding==="PLAIN_DICTIONARY"||e.encoding==="RLE_DICTIONARY"||e.encoding==="RLE"){const f=t==="BOOLEAN"?1:s.getUint8(o.offset++);f?(a=new Array(u),t==="BOOLEAN"?(Oi(o,f,a),a=a.map(d=>!!d)):Oi(o,f,a,s.byteLength-o.offset)):a=new Uint8Array(u)}else if(e.encoding==="BYTE_STREAM_SPLIT")a=bg(o,u,t,n.type_length);else if(e.encoding==="DELTA_BINARY_PACKED")a=t==="INT32"?new Int32Array(u):new BigInt64Array(u),Do(o,u,a);else if(e.encoding==="DELTA_LENGTH_BYTE_ARRAY")a=new Array(u),Ag(o,u,a);else throw new Error(`parquet unsupported encoding: ${e.encoding}`);return{definitionLevels:l,repetitionLevels:c,dataPage:a}}function FM(r,e,t){if(t.length>1){const n=lg(t);if(n){const i=new Array(e.num_values);return Oi(r,Ml(n),i),i}}return[]}function zM(r,e,t){const n=Ku(t);if(!n)return{definitionLevels:[],numNulls:0};const i=new Array(e.num_values);Oi(r,Ml(n),i);let s=e.num_values;for(const o of i)o===n&&s--;return s===0&&(i.length=0),{definitionLevels:i,numNulls:s}}function nf(r,e,t,n){let i;const s=n?.[t];if(t==="UNCOMPRESSED")i=r;else if(s)i=s(r,e);else if(t==="SNAPPY")i=new Uint8Array(e),BM(r,i);else throw new Error(`parquet unsupported compression codec: ${t}`);if(i?.length!==e)throw new Error(`parquet decompressed page length ${i?.length} does not match header ${e}`);return i}function kM(r,e,t){const i={view:new DataView(r.buffer,r.byteOffset,r.byteLength),offset:0},{type:s,element:o,schemaPath:a,codec:c,compressors:l}=t,h=e.data_page_header_v2;if(!h)throw new Error("parquet data page header v2 is undefined");const u=VM(i,h,a);i.offset=h.repetition_levels_byte_length;const f=HM(i,h,a),d=e.uncompressed_page_size-h.definition_levels_byte_length-h.repetition_levels_byte_length;let g=r.subarray(i.offset);h.is_compressed!==!1&&(g=nf(g,d,c,l));const _=new DataView(g.buffer,g.byteOffset,g.byteLength),m={view:_,offset:0};let p;const v=h.num_values-h.num_nulls;if(h.encoding==="PLAIN")p=tf(m,s,v,o.type_length);else if(h.encoding==="RLE")p=new Array(v),Oi(m,1,p),p=p.map(y=>!!y);else if(h.encoding==="PLAIN_DICTIONARY"||h.encoding==="RLE_DICTIONARY"){const y=_.getUint8(m.offset++);p=new Array(v),Oi(m,y,p,d-1)}else if(h.encoding==="DELTA_BINARY_PACKED")p=s==="INT32"?new Int32Array(v):new BigInt64Array(v),Do(m,v,p);else if(h.encoding==="DELTA_LENGTH_BYTE_ARRAY")p=new Array(v),Ag(m,v,p);else if(h.encoding==="DELTA_BYTE_ARRAY")p=new Array(v),wM(m,v,p);else if(h.encoding==="BYTE_STREAM_SPLIT")p=bg(m,v,s,o.type_length);else throw new Error(`parquet unsupported encoding: ${h.encoding}`);return{definitionLevels:f,repetitionLevels:u,dataPage:p}}function VM(r,e,t){const n=lg(t);if(!n)return[];const i=new Array(e.num_values);return Oi(r,Ml(n),i,e.repetition_levels_byte_length),i}function HM(r,e,t){const n=Ku(t);if(n){const i=new Array(e.num_values);return Oi(r,Ml(n),i,e.definition_levels_byte_length),i}}function Sg(r,{groupStart:e,selectStart:t,selectEnd:n},i,s){const{pathInSchema:o,schemaPath:a}=i,c=hg(a),l=[];let h,u,f=0;const d=s&&(()=>{u&&s({pathInSchema:o,columnData:u,rowStart:e+f-u.length,rowEnd:e+f})});for(;(c?f<n:r.offset<r.view.byteLength-1)&&!(r.offset>=r.view.byteLength-1);){const g=GM(r);if(g.type==="DICTIONARY_PAGE")h=Mg(r,g,i,h,void 0,0),h=rg(h,i);else{const _=u?.length||0,m=Mg(r,g,i,h,u,t-f);u===m?f+=m.length-_:(d?.(),l.push(m),f+=m.length,u=m)}}return d?.(),f>n&&u&&(l[l.length-1]=u.slice(0,n-(f-u.length))),l}function Mg(r,e,t,n,i,s){const{type:o,element:a,schemaPath:c,codec:l,compressors:h}=t,u=new Uint8Array(r.view.buffer,r.view.byteOffset+r.offset,e.compressed_page_size);if(r.offset+=e.compressed_page_size,e.type==="DATA_PAGE"){const f=e.data_page_header;if(!f)throw new Error("parquet data page header is undefined");if(s>f.num_values&&hg(c))return new Array(f.num_values);const d=nf(u,Number(e.uncompressed_page_size),l,h),{definitionLevels:g,repetitionLevels:_,dataPage:m}=OM(d,f,t);let p=ig(m,n,f.encoding,t);if(_.length||g?.length){const v=Array.isArray(i)?i:[];return vg(v,g,_,p,c)}else{for(let v=2;v<c.length;v++)c[v].element.repetition_type!=="REQUIRED"&&(p=Array.from(p,y=>[y]));return p}}else if(e.type==="DATA_PAGE_V2"){const f=e.data_page_header_v2;if(!f)throw new Error("parquet data page header v2 is undefined");if(s>f.num_rows)return new Array(f.num_values);const{definitionLevels:d,repetitionLevels:g,dataPage:_}=kM(u,e,t),m=ig(_,n,f.encoding,t),p=Array.isArray(i)?i:[];return vg(p,d,g,m,c)}else if(e.type==="DICTIONARY_PAGE"){const f=e.dictionary_page_header;if(!f)throw new Error("parquet dictionary page header is undefined");const d=nf(u,Number(e.uncompressed_page_size),l,h),g={view:new DataView(d.buffer,d.byteOffset,d.byteLength),offset:0};return tf(g,o,f.num_values,a.type_length)}else throw new Error(`parquet unsupported page type: ${e.type}`)}function GM(r){const e=ju(r),t=$m[e.field_1],n=e.field_2,i=e.field_3,s=e.field_4,o=e.field_5&&{num_values:e.field_5.field_1,encoding:Mr[e.field_5.field_2],definition_level_encoding:Mr[e.field_5.field_3],repetition_level_encoding:Mr[e.field_5.field_4],statistics:e.field_5.field_5&&{max:e.field_5.field_5.field_1,min:e.field_5.field_5.field_2,null_count:e.field_5.field_5.field_3,distinct_count:e.field_5.field_5.field_4,max_value:e.field_5.field_5.field_5,min_value:e.field_5.field_5.field_6}},a=e.field_6,c=e.field_7&&{num_values:e.field_7.field_1,encoding:Mr[e.field_7.field_2],is_sorted:e.field_7.field_3},l=e.field_8&&{num_values:e.field_8.field_1,num_nulls:e.field_8.field_2,num_rows:e.field_8.field_3,encoding:Mr[e.field_8.field_4],definition_levels_byte_length:e.field_8.field_5,repetition_levels_byte_length:e.field_8.field_6,is_compressed:e.field_8.field_7===void 0?!0:e.field_8.field_7,statistics:e.field_8.field_8};return{type:t,uncompressed_page_size:n,compressed_page_size:i,crc:s,data_page_header:o,index_page_header:a,dictionary_page_header:c,data_page_header_v2:l}}function WM(r,{metadata:e},t){const{file:n,compressors:i,utf8:s}=r,o=[],a={...ng,...r.parsers};for(const c of t.chunks){const{columnMetadata:l}=c,h=cg(e.schema,l.path_in_schema),u={pathInSchema:l.path_in_schema,type:l.type,element:h[h.length-1].element,schemaPath:h,codec:l.codec,parsers:a,compressors:i,utf8:s};if(!("offsetIndex"in c)){o.push({pathInSchema:l.path_in_schema,data:Promise.resolve(n.slice(c.range.startByte,c.range.endByte)).then(f=>{const d={view:new DataView(f),offset:0};return{pageSkip:0,data:Sg(d,t,u,r.onPage)}})});continue}o.push({pathInSchema:l.path_in_schema,data:Promise.resolve(n.slice(c.offsetIndex.startByte,c.offsetIndex.endByte)).then(async f=>{const d=vM({view:new DataView(f),offset:0}),{selectStart:g,selectEnd:_}=t,m=d.page_locations;let p=NaN,v=NaN,y=0;for(let I=0;I<m.length;I++){const D=m[I],b=Number(D.first_row_index),C=I+1<m.length?Number(m[I+1].first_row_index):t.groupRows;b<_&&C>g&&(Number.isNaN(p)&&(p=Number(D.offset),y=b),v=Number(D.offset)+D.compressed_page_size)}const x=await n.slice(p,v),A={view:new DataView(x),offset:0},E=y?{...t,groupStart:t.groupStart+y,selectStart:t.selectStart-y,selectEnd:t.selectEnd-y}:t;return{data:Sg(A,E,u,r.onPage),pageSkip:y}})})}return{groupStart:t.groupStart,groupRows:t.groupRows,asyncColumns:o}}async function Eg({asyncColumns:r},e,t,n,i){const s=await Promise.all(r.map(async({data:u})=>{const f=await u;return{...f,data:_g(f.data)}})),o=r.map(u=>u.pathInSchema[0]).filter(u=>!n||n.includes(u)),a=n??o,c=a.map(u=>r.findIndex(f=>f.pathInSchema[0]===u)),l=t-e;if(i==="object"){const u=Array(l);for(let f=0;f<l;f++){const d=e+f,g={};for(let _=0;_<r.length;_++){const{data:m,pageSkip:p}=s[_];g[r[_].pathInSchema[0]]=m[d-p]}u[f]=g}return u}const h=Array(l);for(let u=0;u<l;u++){const f=e+u,d=Array(r.length);for(let g=0;g<a.length;g++){const _=c[g];if(_>=0){const{data:m,pageSkip:p}=s[_];d[g]=m[f-p]}}h[u]=d}return h}function qM(r,e){const{asyncColumns:t}=r,n=[];for(const i of e.children)if(i.children.length){const s=t.filter(c=>c.pathInSchema[0]===i.element.name);if(!s.length)continue;const o=new Map,a=Promise.all(s.map(c=>c.data.then(({data:l})=>{o.set(c.pathInSchema.join("."),_g(l))}))).then(()=>{Po(o,i);const c=o.get(i.path.join("."));if(!c)throw new Error("parquet column data not assembled");return{data:[c],pageSkip:0}});n.push({pathInSchema:i.path,data:a})}else{const s=t.find(o=>o.pathInSchema[0]===i.element.name);s&&n.push(s)}return{...r,asyncColumns:n}}async function XM(r){r.metadata??=await dg(r.file,r);const{rowStart:e=0,rowEnd:t,columns:n,onChunk:i,onComplete:s,rowFormat:o,filter:a,filterStrict:c=!0}=r;if(a&&o!=="object")throw new Error('parquet filter requires rowFormat: "object"');const l=wl(a);if(l.length){const m=$u(r.metadata).children.map(v=>v.element.name),p=l.filter(v=>!m.includes(v));if(p.length)throw new Error(`parquet filter columns not found: ${p.join(", ")}`)}let h=n,u=!1;if(n&&a){const m=l.filter(p=>!n.includes(p));m.length&&(h=[...n,...m],u=!0)}const f=h!==n?{...r,columns:h}:r,d=ZM(f);if(!s&&!i){for(const{asyncColumns:m}of d)for(const{data:p}of m)await p;return}const g=$u(r.metadata),_=d.map(m=>qM(m,g));if(i)for(const m of _)for(const p of m.asyncColumns)p.data.then(({data:v,pageSkip:y})=>{let x=m.groupStart+y;for(const A of v)i({columnName:p.pathInSchema[0],columnData:A,rowStart:x,rowEnd:x+A.length}),x+=A.length});if(s){const m=[];for(const p of _){const v=Math.max(e-p.groupStart,0),y=Math.min((t??1/0)-p.groupStart,p.groupRows),x=o==="object"?await Eg(p,v,y,h,"object"):await Eg(p,v,y,n,"array");if(a){for(const A of x)if(Ro(A,a,c)){if(u&&n)for(const E of l)n.includes(E)||delete A[E];m.push(A)}}else gg(m,x)}s(m)}else for(const{asyncColumns:m}of _)for(const{data:p}of m)await p}function ZM(r){if(!r.metadata)throw new Error("parquet requires metadata");const e=AM(r);return r.file=bM(r.file,e),e.groups.map(t=>WM(r,e,t))}var YM=ArrayBuffer,Lt=Uint8Array,Tl=Uint16Array,QM=Int16Array,Cl=Int32Array,rf=function(r,e,t){if(Lt.prototype.slice)return Lt.prototype.slice.call(r,e,t);(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var n=new Lt(t-e);return n.set(r.subarray(e,t)),n},Lo=function(r,e,t,n){if(Lt.prototype.fill)return Lt.prototype.fill.call(r,e,t,n);for((t==null||t<0)&&(t=0),(n==null||n>r.length)&&(n=r.length);t<n;++t)r[t]=e;return r},KM=function(r,e,t,n){if(Lt.prototype.copyWithin)return Lt.prototype.copyWithin.call(r,e,t,n);for((t==null||t<0)&&(t=0),(n==null||n>r.length)&&(n=r.length);t<n;)r[e++]=r[t++]},jM=["invalid zstd data","window size too large (>2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],Ot=function(r,e,t){var n=new Error(e||jM[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,Ot),!t)throw n;return n},Tg=function(r,e,t){for(var n=0,i=0;n<t;++n)i|=r[e++]<<(n<<3);return i},JM=function(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0},$M=function(r,e){var t=r[0]|r[1]<<8|r[2]<<16;if(t==3126568&&r[3]==253){var n=r[4],i=n>>5&1,s=n>>2&1,o=n&3,a=n>>6;n&8&&Ot(0);var c=6-i,l=o==3?4:o,h=Tg(r,c,l);c+=l;var u=a?1<<a:i,f=Tg(r,c,u)+(a==1&&256),d=f;if(!i){var g=1<<10+(r[5]>>3);d=g+(g>>3)*(r[5]&7)}d>2145386496&&Ot(1);var _=new Lt((e==1?f||d:e?0:d)+12);return _[0]=1,_[4]=4,_[8]=8,{b:c+u,y:0,l:0,d:h,w:e&&e!=1?e:_.subarray(12),e:d,o:new Cl(_.buffer,0,3),u:f,c:s,m:Math.min(131072,d)}}else if((t>>4|r[3]<<20)==25481893)return JM(r,4)+8;Ot(0)},Tr=function(r){for(var e=0;1<<e<=r;++e);return e-1},No=function(r,e,t){var n=(e<<3)+4,i=(r[e]&15)+5;i>t&&Ot(3);for(var s=1<<i,o=s,a=-1,c=-1,l=-1,h=s,u=new YM(512+(s<<2)),f=new QM(u,0,256),d=new Tl(u,0,256),g=new Tl(u,512,s),_=512+(s<<1),m=new Lt(u,_,s),p=new Lt(u,_+s);a<255&&o>0;){var v=Tr(o+1),y=n>>3,x=(1<<v+1)-1,A=(r[y]|r[y+1]<<8|r[y+2]<<16)>>(n&7)&x,E=(1<<v)-1,I=x-o-1,D=A&E;if(D<I?(n+=v,A=D):(n+=v+1,A>E&&(A-=I)),f[++a]=--A,A==-1?(o+=A,m[--h]=a):o-=A,!A)do{var b=n>>3;c=(r[b]|r[b+1]<<8)>>(n&7)&3,n+=2,a+=c}while(c==3)}(a>255||o)&&Ot(0);for(var C=0,B=(s>>1)+(s>>3)+3,R=s-1,O=0;O<=a;++O){var M=f[O];if(M<1){d[O]=-M;continue}for(l=0;l<M;++l){m[C]=O;do C=C+B&R;while(C>=h)}}for(C&&Ot(0),l=0;l<s;++l){var z=d[m[l]]++,X=p[l]=i-Tr(z);g[l]=(z<<X)-s}return[n+7>>3,{b:i,s:m,n:p,t:g}]},eE=function(r,e){var t=0,n=-1,i=new Lt(292),s=r[e],o=i.subarray(0,256),a=i.subarray(256,268),c=new Tl(i.buffer,268);if(s<128){var l=No(r,e+1,6),h=l[0],u=l[1];e+=s;var f=h<<3,d=r[e];d||Ot(0);for(var g=0,_=0,m=u.b,p=m,v=(++e<<3)-8+Tr(d);v-=m,!(v<f);){var y=v>>3;if(g+=(r[y]|r[y+1]<<8)>>(v&7)&(1<<m)-1,o[++n]=u.s[g],v-=p,v<f)break;y=v>>3,_+=(r[y]|r[y+1]<<8)>>(v&7)&(1<<p)-1,o[++n]=u.s[_],m=u.n[g],g=u.t[g],p=u.n[_],_=u.t[_]}++n>255&&Ot(0)}else{for(n=s-127;t<n;t+=2){var x=r[++e];o[t]=x>>4,o[t+1]=x&15}++e}var A=0;for(t=0;t<n;++t){var E=o[t];E>11&&Ot(0),A+=E&&1<<E-1}var I=Tr(A)+1,D=1<<I,b=D-A;for(b&b-1&&Ot(0),o[n++]=Tr(b)+1,t=0;t<n;++t){var E=o[t];++a[o[t]=E&&I+1-E]}var C=new Lt(D<<1),B=C.subarray(0,D),R=C.subarray(D);for(c[I]=0,t=I;t>0;--t){var O=c[t];Lo(R,t,O,c[t-1]=O+a[t]*(1<<I-t))}for(c[0]!=D&&Ot(0),t=0;t<n;++t){var M=o[t];if(M){var z=c[M];Lo(B,t,z,c[M]=z+(1<<I-M))}}return[e,{n:R,b:I,s:B}]},tE=No(new Lt([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],nE=No(new Lt([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],iE=No(new Lt([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],Cg=function(r,e){for(var t=r.length,n=new Cl(t),i=0;i<t;++i)n[i]=e,e+=1<<r[i];return n},sf=new Lt(new Cl([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),rE=Cg(sf,0),of=new Lt(new Cl([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),sE=Cg(of,3),Uo=function(r,e,t){var n=r.length,i=e.length,s=r[n-1],o=(1<<t.b)-1,a=-t.b;s||Ot(0);for(var c=0,l=t.b,h=(n<<3)-8+Tr(s)-l,u=-1;h>a&&u<i;){var f=h>>3,d=(r[f]|r[f+1]<<8|r[f+2]<<16)>>(h&7);c=(c<<l|d)&o,e[++u]=t.s[c],h-=l=t.n[c]}(h!=a||u+1!=i)&&Ot(0)},oE=function(r,e,t){var n=6,i=e.length,s=i+3>>2,o=s<<1,a=s+o;Uo(r.subarray(n,n+=r[0]|r[1]<<8),e.subarray(0,s),t),Uo(r.subarray(n,n+=r[2]|r[3]<<8),e.subarray(s,o),t),Uo(r.subarray(n,n+=r[4]|r[5]<<8),e.subarray(o,a),t),Uo(r.subarray(n),e.subarray(a),t)},aE=function(r,e,t){var n,i=e.b,s=r[i],o=s>>1&3;e.l=s&1;var a=s>>3|r[i+1]<<5|r[i+2]<<13,c=(i+=3)+a;if(o==1)return i>=r.length?void 0:(e.b=i+1,t?(Lo(t,r[i],e.y,e.y+=a),t):Lo(new Lt(a),r[i]));if(!(c>r.length)){if(o==0)return e.b=c,t?(t.set(r.subarray(i,c),e.y),e.y+=a,t):rf(r,i,c);if(o==2){var l=r[i],h=l&3,u=l>>2&3,f=l>>4,d=0,g=0;h<2?u&1?f|=r[++i]<<4|(u&2&&r[++i]<<12):f=l>>3:(g=u,u<2?(f|=(r[++i]&63)<<4,d=r[i]>>6|r[++i]<<2):u==2?(f|=r[++i]<<4|(r[++i]&3)<<12,d=r[i]>>2|r[++i]<<6):(f|=r[++i]<<4|(r[++i]&63)<<12,d=r[i]>>6|r[++i]<<2|r[++i]<<10)),++i;var _=t?t.subarray(e.y,e.y+e.m):new Lt(e.m),m=_.length-f;if(h==0)_.set(r.subarray(i,i+=f),m);else if(h==1)Lo(_,r[i++],m);else{var p=e.h;if(h==2){var v=eE(r,i);d+=i-(i=v[0]),e.h=p=v[1]}else p||Ot(0);(g?oE:Uo)(r.subarray(i,i+=d),_.subarray(m),p)}var y=r[i++];if(y){y==255?y=(r[i++]|r[i++]<<8)+32512:y>127&&(y=y-128<<8|r[i++]);var x=r[i++];x&3&&Ot(0);for(var A=[nE,iE,tE],E=2;E>-1;--E){var I=x>>(E<<1)+2&3;if(I==1){var D=new Lt([0,0,r[i++]]);A[E]={s:D.subarray(2,3),n:D.subarray(0,1),t:new Tl(D.buffer,0,1),b:0}}else I==2?(n=No(r,i,9-(E&1)),i=n[0],A[E]=n[1]):I==3&&(e.t||Ot(0),A[E]=e.t[E])}var b=e.t=A,C=b[0],B=b[1],R=b[2],O=r[c-1];O||Ot(0);var M=(c<<3)-8+Tr(O)-R.b,z=M>>3,X=0,H=(r[z]|r[z+1]<<8)>>(M&7)&(1<<R.b)-1;z=(M-=B.b)>>3;var re=(r[z]|r[z+1]<<8)>>(M&7)&(1<<B.b)-1;z=(M-=C.b)>>3;var J=(r[z]|r[z+1]<<8)>>(M&7)&(1<<C.b)-1;for(++y;--y;){var le=R.s[H],W=R.n[H],Z=C.s[J],ge=C.n[J],_e=B.s[re],de=B.n[re];z=(M-=_e)>>3;var oe=1<<_e,ee=oe+((r[z]|r[z+1]<<8|r[z+2]<<16|r[z+3]<<24)>>>(M&7)&oe-1);z=(M-=of[Z])>>3;var pe=sE[Z]+((r[z]|r[z+1]<<8|r[z+2]<<16)>>(M&7)&(1<<of[Z])-1);z=(M-=sf[le])>>3;var ye=rE[le]+((r[z]|r[z+1]<<8|r[z+2]<<16)>>(M&7)&(1<<sf[le])-1);if(z=(M-=W)>>3,H=R.t[H]+((r[z]|r[z+1]<<8)>>(M&7)&(1<<W)-1),z=(M-=ge)>>3,J=C.t[J]+((r[z]|r[z+1]<<8)>>(M&7)&(1<<ge)-1),z=(M-=de)>>3,re=B.t[re]+((r[z]|r[z+1]<<8)>>(M&7)&(1<<de)-1),ee>3)e.o[2]=e.o[1],e.o[1]=e.o[0],e.o[0]=ee-=3;else{var Ae=ee-(ye!=0);Ae?(ee=Ae==3?e.o[0]-1:e.o[Ae],Ae>1&&(e.o[2]=e.o[1]),e.o[1]=e.o[0],e.o[0]=ee):ee=e.o[0]}for(var E=0;E<ye;++E)_[X+E]=_[m+E];X+=ye,m+=ye;var ze=X-ee;if(ze<0){var je=-ze,He=e.e+ze;je>pe&&(je=pe);for(var E=0;E<je;++E)_[X+E]=e.w[He+E];X+=je,pe-=je,ze=0}for(var E=0;E<pe;++E)_[X+E]=_[ze+E];X+=pe}if(X!=m)for(;m<_.length;)_[X++]=_[m++];else X=_.length;t?e.y+=X:_=rf(_,0,X)}else if(t){if(e.y+=f,m)for(var E=0;E<f;++E)_[E]=_[m+E]}else m&&(_=rf(_,m));return e.b=c,_}Ot(2)}},cE=function(r,e){if(r.length==1)return r[0];for(var t=new Lt(e),n=0,i=0;n<r.length;++n){var s=r[n];t.set(s,i),i+=s.length}return t};function lE(r,e){for(var t=[],n=+!e,i=0,s=0;r.length;){var o=$M(r,n||e);if(typeof o=="object"){for(n?(e=null,o.w.length==o.u&&(t.push(e=o.w),s+=o.u)):(t.push(e),o.e=0);!o.l;){var a=aE(r,o,e);a||Ot(5),e?o.e=o.y:(t.push(a),s+=a.length,KM(o.w,0,a.length),o.w.set(a,o.w.length-a.length))}i=o.b+o.c*4}else i=o;r=r.subarray(i)}return cE(t,s)}function hE(){const r=uE();return(e,t)=>{const{memory:n,uncompress:i}=r.exports,s=68e3,o=s+e.byteLength,a=s+e.byteLength+t;if(n.buffer.byteLength<a){const u=n.buffer.byteLength/65536,d=Math.ceil(a/65536)-u;n.grow(d)}const c=new Uint8Array(n.buffer);c.set(e,s);const l=i(s,e.byteLength,o);if(l===-1)throw new Error("invalid snappy length header");if(l===-2)throw new Error("missing eof marker");if(l===-3)throw new Error("premature end of input");if(l)throw new Error(`failed to uncompress data ${l}`);return c.slice(o,o+t)}}function uE(){const r=atob(fE),e=new Uint8Array(r.length);for(let n=0;n<r.length;n+=1)e[n]=r.charCodeAt(n);const t=new WebAssembly.Module(e);return new WebAssembly.Instance(t)}const fE="AGFzbQEAAAABEANgAABgA39/fwF/YAF/AX8DBgUAAQEBAgUDAQACBj8KfwFBoIwEC38AQYAIC38AQaAMC38AQaAMC38AQaCMBAt/AEGACAt/AEGgjAQLfwBBgIAIC38AQQALfwBBAQsHwQEOBm1lbW9yeQIAEV9fd2FzbV9jYWxsX2N0b3JzAAAGbWVtY3B5AAEHbWVtbW92ZQACCnVuY29tcHJlc3MAAwxfX2Rzb19oYW5kbGUDAQpfX2RhdGFfZW5kAwILX19zdGFja19sb3cDAwxfX3N0YWNrX2hpZ2gDBA1fX2dsb2JhbF9iYXNlAwULX19oZWFwX2Jhc2UDBgpfX2hlYXBfZW5kAwcNX19tZW1vcnlfYmFzZQMIDF9fdGFibGVfYmFzZQMJCuASBQIAC8sBAQN/AkAgAkUNAAJAAkAgAkEHcSIDDQAgACEEIAIhBQwBCyAAIQQgAiEFA0AgBCABLQAAOgAAIARBAWohBCABQQFqIQEgBUF/aiEFIANBf2oiAw0ACwsgAkEISQ0AA0AgBCABLQAAOgAAIAQgAS0AAToAASAEIAEtAAI6AAIgBCABLQADOgADIAQgAS0ABDoABCAEIAEtAAU6AAUgBCABLQAGOgAGIAQgAS0ABzoAByAEQQhqIQQgAUEIaiEBIAVBeGoiBQ0ACwsgAAugAwEEfwJAIAAgAUYNAAJAAkAgACABSQ0AIAEgAmoiAyAASw0BCyACRQ0BAkACQCACQQdxIgMNACAAIQQgAiEFDAELIAAhBCACIQUDQCAEIAEtAAA6AAAgBEEBaiEEIAFBAWohASAFQX9qIQUgA0F/aiIDDQALCyACQQhJDQEDQCAEIAEtAAA6AAAgBCABLQABOgABIAQgAS0AAjoAAiAEIAEtAAM6AAMgBCABLQAEOgAEIAQgAS0ABToABSAEIAEtAAY6AAYgBCABLQAHOgAHIARBCGohBCABQQhqIQEgBUF4aiIFDQAMAgsLIAJFDQACQAJAIAJBA3EiBA0AIAAgAmohBiACIQUMAQsgAiEFA0AgBUF/aiIFIABqIgYgBSABaiIDLQAAOgAAIARBf2oiBA0ACwsgAkEESQ0AIAZBfGohASADQXxqIQQDQCABQQNqIARBA2otAAA6AAAgAUECaiAEQQJqLQAAOgAAIAFBAWogBEEBai0AADoAACABIAQtAAA6AAAgAUF8aiEBIARBfGohBCAFQXxqIgUNAAsLIAALswoBCX8jgICAgABBIGsiAySAgICAACADQQlqQgA3AAAgA0IANwIEIAMgA0EYajYCAEF/IQQCQCABRQ0AIAMgAUF/aiIFNgIcIAMgAEEBajYCGCAALAAAIgZB/wBxIQcCQCAGQX9KDQAgBUUNASADIAFBfmoiBTYCHCADIABBAmo2AhggACwAASIGQf8AcUEHdCAHciEHQX8hBCAGQX9KDQAgBUUNASADIAFBfWoiBTYCHCADIABBA2o2AhggACwAAiIGQf8AcUEOdCAHciEHQX8hBCAGQX9KDQAgBUUNASADIAFBfGoiBTYCHCADIABBBGo2AhggACwAAyIGQf8AcUEVdCAHciEHQX8hBCAGQX9KDQAgBUUNASADIAFBe2o2AhwgAyAAQQVqNgIYIAAsAAQiAUEASA0BIAFBHHQgB3IhBwsgAiAHaiEIAkACQCADEISAgIAADQAgAiEADAELIAMoAgQhASACIQADQAJAIAMoAgggAWtBBEoNACADIAE2AgQgAxCEgICAAEUNAiADKAIEIQELIAFBAWohBQJAAkAgAS0AACIGQQNxDQAgCCAAayEJIAMoAggiCiAFayEEIAZBAnYiC0EBaiEHAkAgBkE/Sw0AIARBEEkNACAJQRBIDQAgACABKAIBNgIAIAAgASgCBTYCBCAAIAEoAgk2AgggACABKAINNgIMIAAgB2ohACADKAIIIAUgB2oiAWtBBEoNAyADIAE2AgQgAxCEgICAAEUNBAwCCwJAAkAgBkHwAU8NACAFIQYMAQsgCiAFIAtBRWoiAWoiBmshBCABQQJ0QYCIgIAAaigCACAFKAIAcUEBaiEHCwJAIAcgBE0NAANAIAggAGsgBEkNBSAAIAYgBBCBgICAACEAIAMoAgAiASABKAIAIgkgAygCDCIFaiIGNgIAIAFBBGoiASABKAIAIgogBWsiATYCACADIAE2AgwgACAEaiEAIAFFDQUgAyAJIApqNgIIIAcgBGshByABIQQgByABSw0ACyAIIABrIQkLIAkgB0kNAyAAIAYgBxCBgICAACAHaiEAIAMoAgggBiAHaiIBa0EESg0CIAMgATYCBCADEISAgIAADQEMAwsgACACayAGQQF0QaCIgIAAai8BACIBQQt2IgpBAnRBgIiAgABqKAIAIAUoAgBxIAFBgA5xaiIHQX9qTQ0CIAggAGshBAJAAkAgAUH/AXEiCUEQSw0AIAdBCEkNACAEQRBJDQAgACAAIAdrIgEoAgA2AgAgACABKAIENgIEIAAgASgCCDYCCCAAIAFBDGooAgA2AgwMAQsCQAJAAkAgBCAJQQpqSQ0AIAAgB2shBCAAIQEgCSEGIAdBB0wNAQwCCyAEIAlJDQUgCUEBaiEEQQAgB2shByAAIQEDQCABIAEgB2otAAA6AAAgAUEBaiEBIARBf2oiBEEBSw0ADAMLCwNAIAEgBCgCADYCACABIAQoAgQ2AgQgBiAHayEGIAEgB2oiASAEayIHQQhIDQALCyAGQQFIDQAgBkEIaiEHA0AgASAEKAIANgIAIAEgBCgCBDYCBCABQQhqIQEgBEEIaiEEIAdBeGoiB0EISw0ACwsgACAJaiEAIAMoAgggBSAKaiIBa0EESg0BIAMgATYCBCADEISAgIAARQ0CCyADKAIEIQEMAAsLIAMoAgAiASABKAIEIAMoAgwiBGs2AgQgASAEIAEoAgBqNgIAAkAgAy0AEA0AQX4hBAwBC0EAQX0gCCAARhshBAsgA0EgaiSAgICAACAEC7YDAQd/AkAgACgCBCIBIAAoAggiAkcNACAAKAIAIgIgAigCACIDIAAoAgwiBGoiATYCACACQQRqIgIgAigCACICIARrIgU2AgAgACAFNgIMAkAgAiAERw0AIABBAToAEEEADwsgACADIAJqIgI2AggLAkACQAJAIAIgAWsiAiABLQAAQQF0QaCIgIAAai8BAEELdkEBaiIFTw0AIABBEWogASACEIKAgIAAIQYgACgCDCEEQQAhByAAQQA2AgwgACgCACIBIAEoAgQgBGs2AgQgASAEIAEoAgBqIgM2AgADQCABQQRqKAIAIgFFDQMgBiACaiADIAUgAmsiBCABIAQgAUkbIgQQgYCAgAAaIAAoAgAiASABKAIEIARrNgIEIAEgASgCACAEaiIDNgIAIAQgAmoiAiAFSQ0ACyAAIAY2AgQgACAGIAVqNgIIDAELAkAgAkEESw0AIAAgAEERaiABIAIQgoCAgAAiASACajYCCCAAIAE2AgQgACgCDCECIABBADYCDCAAKAIAIgEgASgCBCACazYCBCABIAIgASgCAGo2AgAMAQsgACABNgIEC0EBIQcLIAcLC6gEAQBBgAgLoAQAAAAA/wAAAP//AAD///8A/////wAAAAAAAAAAAAAAAAEABAgBEAEgAgAFCAIQAiADAAYIAxADIAQABwgEEAQgBQAICAUQBSAGAAkIBhAGIAcACggHEAcgCAALCAgQCCAJAAQJCRAJIAoABQkKEAogCwAGCQsQCyAMAAcJDBAMIA0ACAkNEA0gDgAJCQ4QDiAPAAoJDxAPIBAACwkQEBAgEQAEChEQESASAAUKEhASIBMABgoTEBMgFAAHChQQFCAVAAgKFRAVIBYACQoWEBYgFwAKChcQFyAYAAsKGBAYIBkABAsZEBkgGgAFCxoQGiAbAAYLGxAbIBwABwscEBwgHQAICx0QHSAeAAkLHhAeIB8ACgsfEB8gIAALCyAQICAhAAQMIRAhICIABQwiECIgIwAGDCMQIyAkAAcMJBAkICUACAwlECUgJgAJDCYQJiAnAAoMJxAnICgACwwoECggKQAEDSkQKSAqAAUNKhAqICsABg0rECsgLAAHDSwQLCAtAAgNLRAtIC4ACQ0uEC4gLwAKDS8QLyAwAAsNMBAwIDEABA4xEDEgMgAFDjIQMiAzAAYOMxAzIDQABw40EDQgNQAIDjUQNSA2AAkONhA2IDcACg43EDcgOAALDjgQOCA5AAQPORA5IDoABQ86EDogOwAGDzsQOyA8AAcPPBA8IAEICA89ED0gARAJDz4QPiABGAoPPxA/IAEgCw9AEEAgAGQEbmFtZQE9BQARX193YXNtX2NhbGxfY3RvcnMBBm1lbWNweQIHbWVtbW92ZQMKdW5jb21wcmVzcwQKcmVmaWxsX3RhZwcSAQAPX19zdGFja19wb2ludGVyCQoBAAcucm9kYXRhADIJcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDFVidW50dSBjbGFuZwsxNi4wLjYgKDE1KQAsD3RhcmdldF9mZWF0dXJlcwIrD211dGFibGUtZ2xvYmFscysIc2lnbi1leHQ=",Cr=4096,dE=2*Cr+32,Ig=2*Cr-1,pE=new Uint32Array([0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215]);function Hn(r){this.buf_=new Uint8Array(dE),this.input_=r,this.buf_ptr_=0,this.val_=0,this.pos_=0,this.reset()}Hn.READ_SIZE=Cr,Hn.IBUF_MASK=Ig,Hn.prototype.reset=function(){this.buf_ptr_=0,this.val_=0,this.pos_=0,this.bit_pos_=0,this.bit_end_pos_=0,this.eos_=0,this.readMoreInput();for(let r=0;r<4;r++)this.val_|=this.buf_[this.pos_]<<8*r,this.pos_++;return this.bit_end_pos_>0},Hn.prototype.readMoreInput=function(){if(!(this.bit_end_pos_>256))if(this.eos_){if(this.bit_pos_>this.bit_end_pos_)throw new Error("Unexpected end of input "+this.bit_pos_+" "+this.bit_end_pos_)}else{const r=this.buf_ptr_,e=this.input_.read(this.buf_,r,Cr);if(e<0)throw new Error("Unexpected end of input");if(e<Cr){this.eos_=1;for(let t=0;t<32;t++)this.buf_[r+e+t]=0}if(r===0){for(let t=0;t<32;t++)this.buf_[(Cr<<1)+t]=this.buf_[t];this.buf_ptr_=Cr}else this.buf_ptr_=0;this.bit_end_pos_+=e<<3}},Hn.prototype.fillBitWindow=function(){for(;this.bit_pos_>=8;)this.val_>>>=8,this.val_|=this.buf_[this.pos_&Ig]<<24,this.pos_++,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},Hn.prototype.readBits=function(r){32-this.bit_pos_<r&&this.fillBitWindow();const e=this.val_>>>this.bit_pos_&pE[r];return this.bit_pos_+=r,e};const mE=8,af=8,gE=255,cf=18,_E=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),vE=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function bt(r,e){this.bits=r,this.value=e}const Rg=16,Rs=15;function Pg(r,e){let t=1<<e-1;for(;r&t;)t>>=1;return(r&t-1)+t}function Dg(r,e,t,n,i){do n-=t,r[e+n]=new bt(i.bits,i.value);while(n>0)}function yE(r,e,t){let n=1<<e-t;for(;e<Rs&&(n-=r[e],!(n<=0));)++e,n<<=1;return e-t}function Lg(r,e,t,n,i){const s=e,o=new Int32Array(Rs+1),a=new Int32Array(Rs+1),c=new Int32Array(i);for(let m=0;m<i;m++)o[n[m]]++;a[1]=0;for(let m=1;m<Rs;m++)a[m+1]=a[m]+o[m];for(let m=0;m<i;m++)n[m]!==0&&(c[a[n[m]]++]=m);let l=t,h=1<<l,u=h;if(a[Rs]===1){for(let m=0;m<u;++m)r[e+m]=new bt(0,c[0]&65535);return u}let f=0,d=0;for(let m=1,p=2;m<=t;++m,p<<=1)for(;o[m]>0;--o[m]){const v=new bt(m&255,c[d++]&65535);Dg(r,e+f,p,h,v),f=Pg(f,m)}const g=u-1;let _=-1;for(let m=t+1,p=2;m<=Rs;++m,p<<=1)for(;o[m]>0;--o[m]){(f&g)!==_&&(e+=h,l=yE(o,m,t),h=1<<l,u+=h,_=f&g,r[s+_]=new bt(l+t&255,e-s-_&65535));const v=new bt(m-t&255,c[d++]&65535);Dg(r,e+(f>>t),p,h,v),f=Pg(f,m)}return u}function Il(r,e,t,n){const i=new Uint8Array(r);n.readMoreInput();const s=n.readBits(2);if(s===1){let a=r-1,c=0;const l=new Int32Array(4),h=n.readBits(2)+1;for(;a;)a>>=1,c++;for(let u=0;u<h;u++)l[u]=n.readBits(c)%r,i[l[u]]=2;switch(i[l[0]]=1,h){case 1:break;case 3:if(l[0]===l[1]||l[0]===l[2]||l[1]===l[2])throw new Error("[ReadHuffmanCode] invalid symbols");break;case 2:if(l[0]===l[1])throw new Error("[ReadHuffmanCode] invalid symbols");i[l[1]]=1;break;case 4:if(l[0]===l[1]||l[0]===l[2]||l[0]===l[3]||l[1]===l[2]||l[1]===l[3]||l[2]===l[3])throw new Error("[ReadHuffmanCode] invalid symbols");n.readBits(1)?(i[l[2]]=3,i[l[3]]=3):i[l[0]]=2;break}}else{const a=new Uint8Array(cf);let c=32,l=0;const h=[new bt(2,0),new bt(2,4),new bt(2,3),new bt(3,2),new bt(2,0),new bt(2,4),new bt(2,3),new bt(4,1),new bt(2,0),new bt(2,4),new bt(2,3),new bt(3,2),new bt(2,0),new bt(2,4),new bt(2,3),new bt(4,5)];for(let u=s;u<cf&&c>0;u++){const f=_E[u];let d=0;n.fillBitWindow(),d+=n.val_>>>n.bit_pos_&15,n.bit_pos_+=h[d].bits;const g=h[d].value;a[f]=g,g!==0&&(c-=32>>g,l++)}if(!(l===1||c===0))throw new Error("[ReadHuffmanCode] invalid num_codes or space");xE(a,r,i,n)}const o=Lg(e,t,af,i,r);if(!o)throw new Error("brotli BuildHuffmanTable failed");return o}function Ps(r,e,t){t.fillBitWindow(),e+=t.val_>>>t.bit_pos_&gE;const n=r[e].bits-af;return n>0&&(t.bit_pos_+=af,e+=r[e].value,e+=t.val_>>>t.bit_pos_&(1<<n)-1),t.bit_pos_+=r[e].bits,r[e].value}function xE(r,e,t,n){let i=0,s=mE,o=0,a=0,c=32768;const l=[];for(let h=0;h<32;h++)l.push(new bt(0,0));for(Lg(l,0,5,r,cf);i<e&&c>0;){let h=0;n.readMoreInput(),n.fillBitWindow(),h+=n.val_>>>n.bit_pos_&31,n.bit_pos_+=l[h].bits;const u=l[h].value&255;if(u<Rg)o=0,t[i++]=u,u!==0&&(s=u,c-=32768>>u);else{const f=u-14;let d=0;u===Rg&&(d=s),a!==d&&(o=0,a=d);const g=o;o>0&&(o-=2,o<<=f),o+=n.readBits(f)+3;const _=o-g;if(i+_>e)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(let m=0;m<_;m++)t[i+m]=a;i+=_,a!==0&&(c-=_<<15-a)}}if(c!==0)throw new Error("[ReadHuffmanCodeLengths] space = "+c);for(;i<e;i++)t[i]=0}function Ir(r,e){this.alphabet_size=r,this.num_htrees=e,this.codes=new Array(e+e*vE[r+31>>>5]),this.htrees=new Uint32Array(e)}Ir.prototype.decode=function(r){let e=0;for(let t=0;t<this.num_htrees;t++)this.htrees[t]=e,e+=Il(this.alphabet_size,this.codes,e,r)};function lf([r,e]){return{offset:r,nbits:e}}const AE=[[1,2],[5,2],[9,2],[13,2],[17,3],[25,3],[33,3],[41,3],[49,4],[65,4],[81,4],[97,4],[113,5],[145,5],[177,5],[209,5],[241,6],[305,6],[369,7],[497,8],[753,9],[1265,10],[2289,11],[4337,12],[8433,13],[16625,24]].map(lf),bE=[[0,0],[1,0],[2,0],[3,0],[4,0],[5,0],[6,1],[8,1],[10,2],[14,2],[18,3],[26,3],[34,4],[50,4],[66,5],[98,5],[130,6],[194,7],[322,8],[578,9],[1090,10],[2114,12],[6210,14],[22594,24]].map(lf),wE=[[2,0],[3,0],[4,0],[5,0],[6,0],[7,0],[8,0],[9,0],[10,1],[12,1],[14,2],[18,2],[22,3],[30,3],[38,4],[54,4],[70,5],[102,5],[134,6],[198,7],[326,8],[582,9],[1094,10],[2118,24]].map(lf),SE=[0,0,8,8,0,16,8,16,16],ME=[0,8,0,8,16,0,16,8,16],Fi=1080,Ng=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ug=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]);function Bg(r,e){const t=new Uint16Array(31);for(let i=0;i<31;i++)t[i]=e+=1<<r[i-1];const n=new Int32Array(t[30]);for(let i=1;i<30;i++)for(let s=t[i];s<t[i+1];++s)n[s]=s-t[i]<<5|i;return{base:t,rev:n}}const{base:Og,rev:EE}=Bg(Ng,2);Og[28]=258,EE[258]=28;const{base:TE}=Bg(Ug,0),hf=new Uint16Array(32768);for(let r=0;r<32768;r++){let e=(r&43690)>>1|(r&21845)<<1;e=(e&52428)>>2|(e&13107)<<2,e=(e&61680)>>4|(e&3855)<<4,hf[r]=((e&65280)>>8|(e&255)<<8)>>1}function Bo(r,e,t){const n=new Uint16Array(e);for(let o=0;o<r.length;o++)r[o]&&++n[r[o]-1];const i=new Uint16Array(e);for(let o=1;o<e;o++)i[o]=i[o-1]+n[o-1]<<1;let s;if(t){s=new Uint16Array(1<<e);const o=15-e;for(let a=0;a<r.length;a++)if(r[a]){const c=a<<4|r[a],l=e-r[a];let h=i[r[a]-1]++<<l;for(const u=h|(1<<l)-1;h<=u;h++)s[hf[h]>>o]=c}}else{s=new Uint16Array(r.length);for(let o=0;o<r.length;o++)r[o]&&(s[o]=hf[i[r[o]-1]++]>>15-r[o])}return s}const Oo=new Uint8Array(288);for(let r=0;r<144;r++)Oo[r]=8;for(let r=144;r<256;r++)Oo[r]=9;for(let r=256;r<280;r++)Oo[r]=7;for(let r=280;r<288;r++)Oo[r]=8;const Fg=new Uint8Array(32);for(let r=0;r<32;r++)Fg[r]=5;const CE=Bo(Oo,9,1),IE=Bo(Fg,5,1);function uf(r,e,t,n,i,s,o){const a=t*2,c=t,l=Ps(e,t*Fi,o);let h;l===0?h=i[a+(s[c]&1)]:l===1?h=i[a+(s[c]-1&1)]+1:h=l-2,h>=r&&(h-=r),n[t]=h,i[a+(s[c]&1)]=h,s[c]++}function RE(r){const e={meta_block_length:0,input_end:0,is_uncompressed:0,is_metadata:!1};if(e.input_end=r.readBits(1),e.input_end&&r.readBits(1))return e;const t=r.readBits(2)+4;if(t===7){if(e.is_metadata=!0,r.readBits(1)!==0)throw new Error("Invalid reserved bit");const n=r.readBits(2);if(n===0)return e;for(let i=0;i<n;i++){const s=r.readBits(8);if(i+1===n&&n>1&&s===0)throw new Error("Invalid size byte");e.meta_block_length|=s<<i*8}}else for(let n=0;n<t;n++){const i=r.readBits(4);if(n+1===t&&t>4&&i===0)throw new Error("Invalid size nibble");e.meta_block_length|=i<<n*4}return e.meta_block_length++,!e.input_end&&!e.is_metadata&&(e.is_uncompressed=r.readBits(1)),e}function PE(r,e,t,n,i,s){const o=i+1;let a=t&i,c=s.pos_&Hn.IBUF_MASK;if(e<8||s.bit_pos_+(e<<3)<s.bit_end_pos_){for(;e-- >0;)s.readMoreInput(),n[a++]=s.readBits(8),a===o&&(r.write(n,o),a=0);return}if(s.bit_end_pos_<32)throw new Error("copyUncompressedBlockToOutput: br.bit_end_pos_ < 32");for(;s.bit_pos_<32;)n[a]=s.val_>>>s.bit_pos_,s.bit_pos_+=8,a++,e--;let l=s.bit_end_pos_-s.bit_pos_>>3;if(c+l>Hn.IBUF_MASK){const h=Hn.IBUF_MASK+1-c;for(let u=0;u<h;u++)n[a+u]=s.buf_[c+u];l-=h,a+=h,e-=h,c=0}for(let h=0;h<l;h++)n[a+h]=s.buf_[c+h];if(a+=l,e-=l,a>=o){r.write(n,o),a-=o;for(let h=0;h<a;h++)n[h]=n[o+h]}for(;a+e>=o;){if(l=o-a,s.input_.read(n,a,l)<l)throw new Error("copyUncompressedBlockToOutput: not enough bytes");r.write(n,o),e-=l,a=0}if(s.input_.read(n,a,e)<e)throw new Error("copyUncompressedBlockToOutput: not enough bytes");s.reset()}function zg(r){if(r.readBits(1)){const e=r.readBits(3);return e===0?1:r.readBits(e)+(1<<e)}return 0}function DE(r){if(r.readBits(1)===0)return 16;let e=r.readBits(3);return e>0?17+e:(e=r.readBits(3),e>0?8+e:17)}function LE(r){const e=r.bit_pos_+7&-8;return!r.readBits(e-r.bit_pos_)}function Rl(r,e,t){const n=Ps(r,e,t),{offset:i,nbits:s}=AE[n];return i+t.readBits(s)}const kg=new Uint8Array([0,0,0,0,0,0,0,0,0,4,4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,12,16,12,12,20,12,16,24,28,12,12,32,12,36,12,44,44,44,44,44,44,44,44,44,44,32,32,24,40,28,12,12,48,52,52,52,48,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,24,12,28,12,12,12,56,60,60,60,56,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,24,12,28,12,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,40,40,40,40,41,41,41,41,42,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Pl=new Uint16Array([1024,1536,1280,1536,0,256,768,512]);function Vg(r,e){let t=0;e.readMoreInput();const n=zg(e)+1,i=new Uint8Array(r);if(n<=1)return[n,i];e.readBits(1)&&(t=e.readBits(4)+1);const o=[];for(let a=0;a<Fi;a++)o[a]=new bt(0,0);Il(n+t,o,0,e);for(let a=0;a<r;){e.readMoreInput();const c=Ps(o,0,e);if(c===0)i[a]=0,a++;else if(c<=t){let l=1+(1<<c)+e.readBits(c);for(;--l;){if(a>=r)throw new Error("[DecodeContextMap] i >= context_map_size");i[a]=0,a++}}else i[a]=c-t,a++}return e.readBits(1)&&UE(i,r),[n,i]}function NE(r,e){const t=r[e];for(let n=e;n;n--)r[n]=r[n-1];r[0]=t}function UE(r,e){const t=new Uint8Array(256);for(let n=0;n<256;n++)t[n]=n;for(let n=0;n<e;n++){const i=r[n];r[n]=t[i],i&&NE(t,i)}}function Hg(r){this.buffer=r,this.pos=0}Hg.prototype.read=function(r,e,t){this.pos+t>this.buffer.length&&(t=this.buffer.length-this.pos);for(let n=0;n<t;n++)r[e+n]=this.buffer[this.pos+n];return this.pos+=t,t};function Gg(r){this.buffer=r,this.pos=0}Gg.prototype.write=function(r,e){if(this.pos+e>this.buffer.length)throw new Error("brotli output buffer is not large enough");return this.buffer.set(r.subarray(0,e),this.pos),this.pos+=e,e};const BE=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);function Gn(r,e,t){const n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t}function ff(r,e){const t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)}function OE(r){return(r+7)/8|0}function FE(r,e){if(r[e++]!==31||r[e++]!==139||r[e++]!==8)return 0;const t=r[e++];e+=6,t&4&&(e+=(r[e+10]|r[e+11]<<8)+2);for(let n=(t>>3&1)+(t>>4&1);n>0;n-=Number(!r[e++]));return e+(t&2)}function df(r,e,t=0,n=0){let i=e??new Uint8Array(1024);if(!(r.length-t))return i;const s=FE(r,t);if(s===r.length-8)return i;if(s>r.length-8)throw new Error("unexpected EOF");let o=s*8,a=0,c=0,l=0,h,u;const f=r.length*8;function d(g){if(!e&&g>i.length){const _=i;i=new Uint8Array(Math.max(_.length*2,g)),i.set(_)}}do{if(!h){a=Gn(r,o,1);const p=Gn(r,o+1,3);if(o+=3,p)if(p===1)h=CE,u=IE,c=9,l=5;else if(p===2){const v=Gn(r,o,31)+257,y=Gn(r,o+10,15)+4,x=v+Gn(r,o+5,31)+1;o+=14;const A=new Uint8Array(x),E=new Uint8Array(19);for(let R=0;R<y;++R)E[BE[R]]=Gn(r,o+R*3,7);o+=y*3;const I=Math.max(...E),D=(1<<I)-1,b=Bo(E,I,1);for(let R=0;R<x;){const O=b[Gn(r,o,D)];o+=O&15;const M=O>>4;if(M<16)A[R++]=M;else{let z=0,X=0;for(M===16?(X=3+Gn(r,o,3),o+=2,z=A[R-1]):M===17?(X=3+Gn(r,o,7),o+=3):M===18&&(X=11+Gn(r,o,127),o+=7);X--;)A[R++]=z}}const C=A.subarray(0,v),B=A.subarray(v);c=Math.max(...C),l=Math.max(...B),h=Bo(C,c,1),u=Bo(B,l,1)}else throw new Error("invalid block type");else{const v=OE(o)+4,y=r[v-4]|r[v-3]<<8,x=v+y;if(x>r.length)throw new Error("unexpected EOF");d(n+y),i.set(r.subarray(v,x),n),n+=y,o=x*8;continue}if(o>f)throw new Error("unexpected EOF")}d(n+131072);const g=(1<<c)-1,_=(1<<l)-1;let m=o;for(;;m=o){const p=h[ff(r,o)&g],v=p>>4;if(o+=p&15,o>f)throw new Error("unexpected EOF");if(!p)throw new Error("invalid length/literal");if(v<256)i[n++]=v;else if(v===256){m=o,h=void 0;break}else{let y=v-254;if(v>264){const D=v-257,b=Ng[D];y=Gn(r,o,(1<<b)-1)+Og[D],o+=b}if(!u)throw new Error("invalid distance map");const x=u[ff(r,o)&_],A=x>>4;if(!x)throw new Error("invalid distance");o+=x&15;let E=TE[A];if(A>3){const D=Ug[A];E+=ff(r,o)&(1<<D)-1,o+=D}if(o>f)throw new Error("unexpected EOF");const I=n+y;if(n<E)throw new Error("unexpected dictionary case");for(d(I);n<I;n++)i[n]=i[n-E]}}o=m,h&&(a=1)}while(!a);if(n<i.length){const g=Math.ceil(o/8)+8;df(r,i,g,n)}return e?i:i.subarray(0,n)}const zE=`
4048
4048
  H4sIAAAAAAAAAzy96XIcx7Uu+tuI4DuU2meLxDbRAElNJgYHR0neGrgFyr7bPg5FdlV2dwHVVa3KKoBN
4049
4049
  SRHggIHgAFKcBc4zJQIgOGIggYjDF6D+kf8U56K6GxH3Ie73rYRsGRLQnZWVwxq+tXKtlYlf0V40GAZ+
4050
4050
  UQe6mBSU2+9GnvZUokw5GozCoGb8RLt+UouqOuxLTRL4/boYaz0Yxf2J3pfUtIqjAR0XIq8W4JdiFFcK
@@ -5016,5 +5016,5 @@ MTkwg9sJOkT8/jQ3KmnzBOLJyS9wLo3ELR3NZZ75gRlhN8fndGHhOc1ZSa3T8F7PabYqsjMvqRWKVy/i
5016
5016
  YEruPHv9jvnYZxalzUMH9iWulTvIaLTXEa5ZX8xVa61fFraX9QCIAKg5bh8rVRiy7m8o4pJl5O0ogZ8d
5017
5017
  vmbCnCfH5TJKTBFva0O4Wl+l/Ix13xO6KCJPD5H51fete+aO/R8EyzZRoN8BAA==`;let Dl;function kE(){if(!Dl){Dl=new Uint8Array(122784);const r=atob(zE),e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);df(e,Dl)}return Dl}const ke=0,Wg=1,VE=2,HE=3,GE=4,WE=5,qE=6,XE=7,ZE=8,qg=9,Nt=10,Ft=11,pf=12,YE=13,QE=14,KE=15,jE=16,JE=17,$E=18,eT=20;function ue(r,e,t){this.prefix=new Uint8Array(r.length),this.transform=e,this.suffix=new Uint8Array(t.length);for(let n=0;n<r.length;n++)this.prefix[n]=r.charCodeAt(n);for(let n=0;n<t.length;n++)this.suffix[n]=t.charCodeAt(n)}const Ll=[new ue("",ke,""),new ue("",ke," "),new ue(" ",ke," "),new ue("",pf,""),new ue("",Nt," "),new ue("",ke," the "),new ue(" ",ke,""),new ue("s ",ke," "),new ue("",ke," of "),new ue("",Nt,""),new ue("",ke," and "),new ue("",YE,""),new ue("",Wg,""),new ue(", ",ke," "),new ue("",ke,", "),new ue(" ",Nt," "),new ue("",ke," in "),new ue("",ke," to "),new ue("e ",ke," "),new ue("",ke,'"'),new ue("",ke,"."),new ue("",ke,'">'),new ue("",ke,`
5018
5018
  `),new ue("",HE,""),new ue("",ke,"]"),new ue("",ke," for "),new ue("",QE,""),new ue("",VE,""),new ue("",ke," a "),new ue("",ke," that "),new ue(" ",Nt,""),new ue("",ke,". "),new ue(".",ke,""),new ue(" ",ke,", "),new ue("",KE,""),new ue("",ke," with "),new ue("",ke,"'"),new ue("",ke," from "),new ue("",ke," by "),new ue("",jE,""),new ue("",JE,""),new ue(" the ",ke,""),new ue("",GE,""),new ue("",ke,". The "),new ue("",Ft,""),new ue("",ke," on "),new ue("",ke," as "),new ue("",ke," is "),new ue("",XE,""),new ue("",Wg,"ing "),new ue("",ke,`
5019
- `),new ue("",ke,":"),new ue(" ",ke,". "),new ue("",ke,"ed "),new ue("",eT,""),new ue("",$E,""),new ue("",qE,""),new ue("",ke,"("),new ue("",Nt,", "),new ue("",ZE,""),new ue("",ke," at "),new ue("",ke,"ly "),new ue(" the ",ke," of "),new ue("",WE,""),new ue("",qg,""),new ue(" ",Nt,", "),new ue("",Nt,'"'),new ue(".",ke,"("),new ue("",Ft," "),new ue("",Nt,'">'),new ue("",ke,'="'),new ue(" ",ke,"."),new ue(".com/",ke,""),new ue(" the ",ke," of the "),new ue("",Nt,"'"),new ue("",ke,". This "),new ue("",ke,","),new ue(".",ke," "),new ue("",Nt,"("),new ue("",Nt,"."),new ue("",ke," not "),new ue(" ",ke,'="'),new ue("",ke,"er "),new ue(" ",Ft," "),new ue("",ke,"al "),new ue(" ",Ft,""),new ue("",ke,"='"),new ue("",Ft,'"'),new ue("",Nt,". "),new ue(" ",ke,"("),new ue("",ke,"ful "),new ue(" ",Nt,". "),new ue("",ke,"ive "),new ue("",ke,"less "),new ue("",Ft,"'"),new ue("",ke,"est "),new ue(" ",Nt,"."),new ue("",Ft,'">'),new ue(" ",ke,"='"),new ue("",Nt,","),new ue("",ke,"ize "),new ue("",Ft,"."),new ue("\xC2\xA0",ke,""),new ue(" ",ke,","),new ue("",Nt,'="'),new ue("",Ft,'="'),new ue("",ke,"ous "),new ue("",Ft,", "),new ue("",Nt,"='"),new ue(" ",Nt,","),new ue(" ",Ft,'="'),new ue(" ",Ft,", "),new ue("",Ft,","),new ue("",Ft,"("),new ue("",Ft,". "),new ue(" ",Ft,"."),new ue("",Ft,"='"),new ue(" ",Ft,". "),new ue(" ",Nt,'="'),new ue(" ",Ft,"='"),new ue(" ",Nt,"='")],tT=Ll.length;function Xg(r,e){return r[e]<192?(r[e]>=97&&r[e]<=122&&(r[e]^=32),1):r[e]<224?(r[e+1]^=32,2):(r[e+2]^=5,3)}function nT(r,e,t,n,i){const s=kE(),{prefix:o}=Ll[i],{suffix:a}=Ll[i],c=Ll[i].transform;let l=c<pf?0:c-(pf-1);const h=e;l>n&&(l=n);let u=0;for(;u<o.length;)r[e++]=o[u++];t+=l,n-=l,c<=qg&&(n-=c);for(let g=0;g<n;g++)r[e++]=s[t+g];let f=e-n;if(c===Nt)Xg(r,f);else if(c===Ft)for(;n>0;){const g=Xg(r,f);f+=g,n-=g}let d=0;for(;d<a.length;)r[e++]=a[d++];return e-h}const iT=256,rT=704,sT=26,Zg=6,Yg=2,mf=16,oT=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),aT=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),cT=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),lT=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),hT=4,Qg=24;function uT(r,e){const t=new Uint8Array(e),n=new Hg(r),i=new Gg(t);return fT(n,i),t}function fT(r,e){let t=0,n=0,i=0,s=0;const o=[16,15,11,4];let a=0,c=0,l=0;const h=[new Ir(0,0),new Ir(0,0),new Ir(0,0)],u=128+Hn.READ_SIZE,f=new Hn(r);i=DE(f);const d=(1<<i)-16,g=1<<i,_=g-1,m=new Uint8Array(g+u+Qg),p=g,v=[],y=[];for(let x=0;x<3*Fi;x++)v[x]=new bt(0,0),y[x]=new bt(0,0);for(;!n;){let x=0;const A=[1<<28,1<<28,1<<28],E=[0],I=[1,1,1],D=[0,1,0,1,0,1],b=[0];let C=0;for(let ee=0;ee<3;ee++)h[ee].codes=[],h[ee].htrees=new Uint32Array;f.readMoreInput();const B=RE(f);if(x=B.meta_block_length,t+x>e.buffer.length){const ee=new Uint8Array(t+x);ee.set(e.buffer),e.buffer=ee}if(n=B.input_end,B.is_metadata){for(LE(f);x>0;--x)f.readMoreInput(),f.readBits(8);continue}if(x===0)continue;if(B.is_uncompressed){f.bit_pos_=f.bit_pos_+7&-8,PE(e,x,t,m,_,f),t+=x;continue}for(let ee=0;ee<3;ee++)I[ee]=zg(f)+1,I[ee]>=2&&(Il(I[ee]+2,v,ee*Fi,f),Il(sT,y,ee*Fi,f),A[ee]=Rl(y,ee*Fi,f),b[ee]=1);f.readMoreInput();const R=f.readBits(2),O=mf+(f.readBits(4)<<R),M=(1<<R)-1,z=O+(48<<R),X=new Uint8Array(I[0]);for(let ee=0;ee<I[0];ee++)f.readMoreInput(),X[ee]=f.readBits(2)<<1;const[H,re]=Vg(I[0]<<Zg,f),[$,le]=Vg(I[2]<<Yg,f);h[0]=new Ir(iT,H),h[1]=new Ir(rT,I[1]),h[2]=new Ir(z,$);for(let ee=0;ee<3;++ee)h[ee].decode(f);let W=0,Z=0,ge=X[E[0]],_e=Pl[ge],de=Pl[ge+1],oe=h[1].htrees[0];for(;x>0;){let ee;f.readMoreInput(),A[1]===0&&(uf(I[1],v,1,E,D,b,f),A[1]=Rl(y,Fi,f),oe=h[1].htrees[E[1]]),A[1]--;const pe=Ps(h[1].codes,oe,f);let ye=pe>>6;ye>=2?(ye-=2,ee=-1):ee=0;const Ae=SE[ye]+(pe>>3&7),ze=bE[Ae],je=ze.offset+f.readBits(ze.nbits),He=ME[ye]+(pe&7),w=wE[He],q=w.offset+f.readBits(w.nbits);c=m[t-1&_],l=m[t-2&_];for(let S=0;S<je;S++){f.readMoreInput(),A[0]===0&&(uf(I[0],v,0,E,D,b,f),A[0]=Rl(y,0,f),C=E[0]<<Zg,W=C,ge=X[E[0]],_e=Pl[ge],de=Pl[ge+1]);const G=kg[_e+c]|kg[de+l],K=re[W+G];A[0]--,l=c,c=Ps(h[0].codes,h[0].htrees[K],f),m[t&_]=c,(t&_)===_&&e.write(m,g),t++}if(x-=je,x<=0)break;if(ee<0){f.readMoreInput(),A[2]===0&&(uf(I[2],v,2,E,D,b,f),A[2]=Rl(y,2*Fi,f),Z=E[2]<<Yg),A[2]--;const S=(q>4?3:q-2)&255,G=le[Z+S];if(ee=Ps(h[2].codes,h[2].htrees[G],f),ee>=O){ee-=O;const K=ee&M;ee>>=R;const ie=(ee>>1)+1,V=(2+(ee&1)<<ie)-4;ee=O+(V+f.readBits(ie)<<R)+K}}const k=dT(ee,o,a);if(k<0)throw new Error("[BrotliDecompress] invalid distance");t<d&&s!==d?s=t:s=d;let N=t&_;if(k>s)if(q>=hT&&q<=Qg){let S=cT[q];const G=k-s-1,K=lT[q],ie=(1<<K)-1,V=G&ie,P=G>>K;if(S+=V*q,P<tT){const T=nT(m,N,S,q,P);if(N+=T,t+=T,x-=T,N>=p){e.write(m,g);for(let F=0;F<N-p;F++)m[F]=m[p+F]}}else throw new Error("Invalid backward reference")}else throw new Error("Invalid backward reference");else{if(ee>0&&(o[a&3]=k,a++),q>x)throw new Error("Invalid backward reference");for(let S=0;S<q;S++)m[t&_]=m[t-k&_],(t&_)===_&&e.write(m,g),t++,x--}c=m[t-1&_],l=m[t-2&_]}t&=1073741823}e.write(m,t&_)}function dT(r,e,t){return r<mf?(t+=oT[r],t&=3,e[t]+aT[r]):r-mf+1}function pT(r,e){const t=new Uint8Array(e);try{let n=0,i=0;for(;n<r.length-8;){const s=r[n++]<<24|r[n++]<<16|r[n++]<<8|r[n++],o=r[n++]<<24|r[n++]<<16|r[n++]<<8|r[n++];if(r.length-n<o)throw new Error("lz4 not hadoop");if(t.length<s)throw new Error("lz4 not hadoop");if(gf(r.subarray(n,n+o),t,i)!==s)throw new Error("lz4 not hadoop");if(n+=o,i+=s,n===r.length)return t}if(n<r.length)throw new Error("lz4 not hadoop")}catch(n){if(n instanceof Error&&n.message!=="lz4 not hadoop")throw n;gf(r,t,0)}return t}function mT(r,e){const t=new Uint8Array(e);return gf(r,t,0),t}function gf(r,e,t){let n=t;for(let i=0;i<r.length;){const s=r[i++];let o=s>>4;if(o){let f=o+240;for(;f===255;)o+=f=r[i++];if(e.set(r.subarray(i,i+o),n),n+=o,i+=o,i>=r.length)return n-t}const a=r[i++]|r[i++]<<8;if(!a||a>n)throw new Error(`lz4 offset out of range ${a}`);let c=(s&15)+4,l=c+240;for(;l===255;)c+=l=r[i++];let h=n-a;const u=n+c;for(;n<u;)e[n++]=e[h++]}return n-t}const gT={SNAPPY:hE(),GZIP:(r,e)=>df(r,new Uint8Array(e)),BROTLI:uT,ZSTD:r=>lE(r),LZ4:pT,LZ4_RAW:mT};function _T(r){console.time("Building geometry");const e=new Kn,t=r.VertexX.length,n=r.IndexBuffer.length,i=r.MeshVertexOffset.length,s=r.MaterialRed.length,o=r.InstanceMeshIndex.length,a=r.TransformTX.length;console.log({vertexCount:t,indexCount:n,meshCount:i,materialCount:s,instanceCount:o,transformCount:a});const c=yT(r),l=bT(r),h=wT(r),u=AT(r);console.log("Created %d instance groups",u.length);const f=ST(u);console.log("Created %d material groups",Array.from(f.keys()).length);const d=MT(r,l,h,c,u);console.log("Created %d instanced meshes",d.length);const g=vT(r,l,h,c,f);console.log("Create %d merged meshes",g.length);let _=0;for(const m of d)_+=m.geometry.index.count/3*m.count,e.add(m);for(const m of g)_+=m.geometry.index.count/3,e.add(m);return console.log("Total polygon count = %d",_),e.rotation.x=-Math.PI/2,console.timeEnd("Building geometry"),e}function vT(r,e,t,n,i){const s=new We,o=[];for(const[a,c]of i){if(!c||c.length===0)continue;const l=t[a];if(c.length===1){const d=c[0],g=r.InstanceMeshIndex[d],_=r.InstanceTransformIndex[d],m=e[g],p=n[_],v=new St(m,l);v.matrixAutoUpdate=!1,v.matrix.copy(p),o.push(v);continue}const h=[];for(const d of c){const g=r.InstanceMeshIndex[d],_=r.InstanceTransformIndex[d],m=e[g],p=n[_];p.equals(s)||m.applyMatrix4(p),h.push(m)}const u=xT(h),f=new St(u,l);f.name=`MergedStatic_Material_${a}`,o.push(f)}return o}function yT(r){const{TransformTX:e,TransformTY:t,TransformTZ:n,TransformQX:i,TransformQY:s,TransformQZ:o,TransformQW:a,TransformSX:c,TransformSY:l,TransformSZ:h}=r,u=new U,f=new wt,d=new U,g=e.length,_=new Array(g);for(let m=0;m<g;m++){const p=e[m],v=t[m],y=n[m],x=c[m],A=l[m],E=h[m],I=i[m],D=s[m],b=o[m],C=a[m],B=new We;u.set(p,v,y),f.set(I,D,b,C),d.set(x,A,E),B.compose(u,f,d),_[m]=B}return _}function xT(r){let e=0,t=0;for(let c=0,l=r.length;c<l;c++){const h=r[c],u=h.getIndex(),f=h.getAttribute("position");e+=u.count,t+=f.count}const n=new Float32Array(t*3),i=new Uint32Array(e);let s=0,o=0;for(let c=0,l=r.length;c<l;c++){const h=r[c],u=h.getAttribute("position"),f=h.getIndex(),d=u.array,g=f.array,_=u.count,m=f.count,p=u.itemSize,v=_*p,y=o*p;n.set(d.subarray(0,v),y);for(let x=0;x<m;x++)i[s+x]=g[x]+o;o+=_,s+=m}const a=new Ke;return a.setAttribute("position",new ot(n,3)),a.setIndex(new ot(i,1)),a}function AT(r){const e=r.InstanceEntityIndex.length,t=new Map;for(let n=0;n<e;n++){const i=r.InstanceMeshIndex[n],s=r.InstanceMaterialIndex[n],o=`${i}|${s}`;let a=t.get(o);a?a.instanceIndices.push(n):(a={meshIndex:i,materialIndex:s,instanceIndices:[n]},t.set(o,a))}return Array.from(t.values())}function bT(r){const e=r.MeshVertexOffset.length,t=r.IndexBuffer.length,n=r.VertexX.length,i=new Array(e),{VertexX:s,VertexY:o,VertexZ:a,IndexBuffer:c,MeshVertexOffset:l,MeshIndexOffset:h}=r;for(let u=0;u<e;u++){const f=h[u],d=u+1<e?h[u+1]:t,g=d-f,_=l[u],p=(u+1<e?l[u+1]:n)-_;if(g===0||p===0)continue;const v=c.subarray(f,d),y=1e4,x=new Float32Array(p*3);for(let E=0;E<p;E++)x[E*3+0]=s[E+_]/y,x[E*3+1]=o[E+_]/y,x[E*3+2]=a[E+_]/y;const A=new Ke;A.setAttribute("position",new ot(x,3)),A.setIndex(new ot(v,1)),i[u]=A}return i}function wT(r){const e=r.MaterialAlpha.length,t=new Array(e);for(let n=0;n<e;n++){const i=r.MaterialRed[n]/255,s=r.MaterialGreen[n]/255,o=r.MaterialBlue[n]/255,a=r.MaterialAlpha[n]/255,c=r.MaterialRoughness[n]/255,l=r.MaterialMetallic[n]/255,h=new gs({color:new xe(i,s,o),opacity:a,flatShading:!0,transparent:a<.999,roughness:c,metalness:l,side:Sn});t[n]=h}return t}function ST(r){const e=new Map;for(const t of r){const{materialIndex:n,instanceIndices:i}=t;if(i.length===1){const s=i[0];let o=e.get(n);o||(o=[],e.set(n,o)),o.push(s)}}return e}function MT(r,e,t,n,i){const s=new Array;for(const o of i){const{meshIndex:a,materialIndex:c,instanceIndices:l}=o,h=l.length;if(h<=1)continue;const u=e[a],f=t[c],d=new _c(u,f,h);d.instanceMatrix.setUsage(kr);for(let g=0;g<h;g++){const _=l[g],m=r.InstanceTransformIndex[_];d.setMatrixAt(g,n[m])}d.userData.meshIndex=a,d.userData.materialIndex=c,d.frustumCulled=!1,d.matrixAutoUpdate=!1,d.matrixWorldNeedsUpdate=!1,s.push(d)}return s}class ET{async load(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch BOS from ${e}: ${t.status} ${t.statusText}`);const n=await t.arrayBuffer(),i=await iM.loadAsync(n),s=await Kg(i);return _T(s)}}async function Kg(r){function e(i){const s=i.toLowerCase(),o=Object.keys(r.files).find(a=>a.toLowerCase().endsWith(s));if(!o)throw new Error(`Could not find "${i}" in zip archive.`);return o}async function t(i,s,o){const a=e(i),c=await r.files[a].async("arraybuffer"),l=await dg(c);await XM({file:c,compressors:gT,metadata:l,onChunk(h){let u=h.columnData;u.constructor.name!=o.name&&(u=new o(u)),s[h.columnName]=o&&new o(u)}})}console.time("Reading parquet tables");const n={};return await t("Instances.parquet",n,Int32Array),await t("VertexBuffer.parquet",n,Int32Array),await t("IndexBuffer.parquet",n,Uint32Array),await t("Meshes.parquet",n,Int32Array),await t("Materials.parquet",n,Uint8Array),await t("Transforms.parquet",n,Float32Array),console.timeEnd("Reading parquet tables"),n}Ut.BimOpenSchemaLoader=ET,Ut.DefaultInputScheme=zm,Ut.GizmoOptions=Aw,Ut.GltfLoader=nM,Ut.KEYS=At,Ut.THREE=sw,Ut.Viewer=vS,Ut.getSettings=Dm,Ut.loadBimGeometryFromZip=Kg,Object.defineProperties(Ut,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
5019
+ `),new ue("",ke,":"),new ue(" ",ke,". "),new ue("",ke,"ed "),new ue("",eT,""),new ue("",$E,""),new ue("",qE,""),new ue("",ke,"("),new ue("",Nt,", "),new ue("",ZE,""),new ue("",ke," at "),new ue("",ke,"ly "),new ue(" the ",ke," of "),new ue("",WE,""),new ue("",qg,""),new ue(" ",Nt,", "),new ue("",Nt,'"'),new ue(".",ke,"("),new ue("",Ft," "),new ue("",Nt,'">'),new ue("",ke,'="'),new ue(" ",ke,"."),new ue(".com/",ke,""),new ue(" the ",ke," of the "),new ue("",Nt,"'"),new ue("",ke,". This "),new ue("",ke,","),new ue(".",ke," "),new ue("",Nt,"("),new ue("",Nt,"."),new ue("",ke," not "),new ue(" ",ke,'="'),new ue("",ke,"er "),new ue(" ",Ft," "),new ue("",ke,"al "),new ue(" ",Ft,""),new ue("",ke,"='"),new ue("",Ft,'"'),new ue("",Nt,". "),new ue(" ",ke,"("),new ue("",ke,"ful "),new ue(" ",Nt,". "),new ue("",ke,"ive "),new ue("",ke,"less "),new ue("",Ft,"'"),new ue("",ke,"est "),new ue(" ",Nt,"."),new ue("",Ft,'">'),new ue(" ",ke,"='"),new ue("",Nt,","),new ue("",ke,"ize "),new ue("",Ft,"."),new ue("\xC2\xA0",ke,""),new ue(" ",ke,","),new ue("",Nt,'="'),new ue("",Ft,'="'),new ue("",ke,"ous "),new ue("",Ft,", "),new ue("",Nt,"='"),new ue(" ",Nt,","),new ue(" ",Ft,'="'),new ue(" ",Ft,", "),new ue("",Ft,","),new ue("",Ft,"("),new ue("",Ft,". "),new ue(" ",Ft,"."),new ue("",Ft,"='"),new ue(" ",Ft,". "),new ue(" ",Nt,'="'),new ue(" ",Ft,"='"),new ue(" ",Nt,"='")],tT=Ll.length;function Xg(r,e){return r[e]<192?(r[e]>=97&&r[e]<=122&&(r[e]^=32),1):r[e]<224?(r[e+1]^=32,2):(r[e+2]^=5,3)}function nT(r,e,t,n,i){const s=kE(),{prefix:o}=Ll[i],{suffix:a}=Ll[i],c=Ll[i].transform;let l=c<pf?0:c-(pf-1);const h=e;l>n&&(l=n);let u=0;for(;u<o.length;)r[e++]=o[u++];t+=l,n-=l,c<=qg&&(n-=c);for(let g=0;g<n;g++)r[e++]=s[t+g];let f=e-n;if(c===Nt)Xg(r,f);else if(c===Ft)for(;n>0;){const g=Xg(r,f);f+=g,n-=g}let d=0;for(;d<a.length;)r[e++]=a[d++];return e-h}const iT=256,rT=704,sT=26,Zg=6,Yg=2,mf=16,oT=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),aT=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),cT=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),lT=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),hT=4,Qg=24;function uT(r,e){const t=new Uint8Array(e),n=new Hg(r),i=new Gg(t);return fT(n,i),t}function fT(r,e){let t=0,n=0,i=0,s=0;const o=[16,15,11,4];let a=0,c=0,l=0;const h=[new Ir(0,0),new Ir(0,0),new Ir(0,0)],u=128+Hn.READ_SIZE,f=new Hn(r);i=DE(f);const d=(1<<i)-16,g=1<<i,_=g-1,m=new Uint8Array(g+u+Qg),p=g,v=[],y=[];for(let x=0;x<3*Fi;x++)v[x]=new bt(0,0),y[x]=new bt(0,0);for(;!n;){let x=0;const A=[1<<28,1<<28,1<<28],E=[0],I=[1,1,1],D=[0,1,0,1,0,1],b=[0];let C=0;for(let ee=0;ee<3;ee++)h[ee].codes=[],h[ee].htrees=new Uint32Array;f.readMoreInput();const B=RE(f);if(x=B.meta_block_length,t+x>e.buffer.length){const ee=new Uint8Array(t+x);ee.set(e.buffer),e.buffer=ee}if(n=B.input_end,B.is_metadata){for(LE(f);x>0;--x)f.readMoreInput(),f.readBits(8);continue}if(x===0)continue;if(B.is_uncompressed){f.bit_pos_=f.bit_pos_+7&-8,PE(e,x,t,m,_,f),t+=x;continue}for(let ee=0;ee<3;ee++)I[ee]=zg(f)+1,I[ee]>=2&&(Il(I[ee]+2,v,ee*Fi,f),Il(sT,y,ee*Fi,f),A[ee]=Rl(y,ee*Fi,f),b[ee]=1);f.readMoreInput();const R=f.readBits(2),O=mf+(f.readBits(4)<<R),M=(1<<R)-1,z=O+(48<<R),X=new Uint8Array(I[0]);for(let ee=0;ee<I[0];ee++)f.readMoreInput(),X[ee]=f.readBits(2)<<1;const[H,re]=Vg(I[0]<<Zg,f),[J,le]=Vg(I[2]<<Yg,f);h[0]=new Ir(iT,H),h[1]=new Ir(rT,I[1]),h[2]=new Ir(z,J);for(let ee=0;ee<3;++ee)h[ee].decode(f);let W=0,Z=0,ge=X[E[0]],_e=Pl[ge],de=Pl[ge+1],oe=h[1].htrees[0];for(;x>0;){let ee;f.readMoreInput(),A[1]===0&&(uf(I[1],v,1,E,D,b,f),A[1]=Rl(y,Fi,f),oe=h[1].htrees[E[1]]),A[1]--;const pe=Ps(h[1].codes,oe,f);let ye=pe>>6;ye>=2?(ye-=2,ee=-1):ee=0;const Ae=SE[ye]+(pe>>3&7),ze=bE[Ae],je=ze.offset+f.readBits(ze.nbits),He=ME[ye]+(pe&7),w=wE[He],q=w.offset+f.readBits(w.nbits);c=m[t-1&_],l=m[t-2&_];for(let S=0;S<je;S++){f.readMoreInput(),A[0]===0&&(uf(I[0],v,0,E,D,b,f),A[0]=Rl(y,0,f),C=E[0]<<Zg,W=C,ge=X[E[0]],_e=Pl[ge],de=Pl[ge+1]);const G=kg[_e+c]|kg[de+l],K=re[W+G];A[0]--,l=c,c=Ps(h[0].codes,h[0].htrees[K],f),m[t&_]=c,(t&_)===_&&e.write(m,g),t++}if(x-=je,x<=0)break;if(ee<0){f.readMoreInput(),A[2]===0&&(uf(I[2],v,2,E,D,b,f),A[2]=Rl(y,2*Fi,f),Z=E[2]<<Yg),A[2]--;const S=(q>4?3:q-2)&255,G=le[Z+S];if(ee=Ps(h[2].codes,h[2].htrees[G],f),ee>=O){ee-=O;const K=ee&M;ee>>=R;const ie=(ee>>1)+1,V=(2+(ee&1)<<ie)-4;ee=O+(V+f.readBits(ie)<<R)+K}}const k=dT(ee,o,a);if(k<0)throw new Error("[BrotliDecompress] invalid distance");t<d&&s!==d?s=t:s=d;let N=t&_;if(k>s)if(q>=hT&&q<=Qg){let S=cT[q];const G=k-s-1,K=lT[q],ie=(1<<K)-1,V=G&ie,P=G>>K;if(S+=V*q,P<tT){const T=nT(m,N,S,q,P);if(N+=T,t+=T,x-=T,N>=p){e.write(m,g);for(let F=0;F<N-p;F++)m[F]=m[p+F]}}else throw new Error("Invalid backward reference")}else throw new Error("Invalid backward reference");else{if(ee>0&&(o[a&3]=k,a++),q>x)throw new Error("Invalid backward reference");for(let S=0;S<q;S++)m[t&_]=m[t-k&_],(t&_)===_&&e.write(m,g),t++,x--}c=m[t-1&_],l=m[t-2&_]}t&=1073741823}e.write(m,t&_)}function dT(r,e,t){return r<mf?(t+=oT[r],t&=3,e[t]+aT[r]):r-mf+1}function pT(r,e){const t=new Uint8Array(e);try{let n=0,i=0;for(;n<r.length-8;){const s=r[n++]<<24|r[n++]<<16|r[n++]<<8|r[n++],o=r[n++]<<24|r[n++]<<16|r[n++]<<8|r[n++];if(r.length-n<o)throw new Error("lz4 not hadoop");if(t.length<s)throw new Error("lz4 not hadoop");if(gf(r.subarray(n,n+o),t,i)!==s)throw new Error("lz4 not hadoop");if(n+=o,i+=s,n===r.length)return t}if(n<r.length)throw new Error("lz4 not hadoop")}catch(n){if(n instanceof Error&&n.message!=="lz4 not hadoop")throw n;gf(r,t,0)}return t}function mT(r,e){const t=new Uint8Array(e);return gf(r,t,0),t}function gf(r,e,t){let n=t;for(let i=0;i<r.length;){const s=r[i++];let o=s>>4;if(o){let f=o+240;for(;f===255;)o+=f=r[i++];if(e.set(r.subarray(i,i+o),n),n+=o,i+=o,i>=r.length)return n-t}const a=r[i++]|r[i++]<<8;if(!a||a>n)throw new Error(`lz4 offset out of range ${a}`);let c=(s&15)+4,l=c+240;for(;l===255;)c+=l=r[i++];let h=n-a;const u=n+c;for(;n<u;)e[n++]=e[h++]}return n-t}const gT={SNAPPY:hE(),GZIP:(r,e)=>df(r,new Uint8Array(e)),BROTLI:uT,ZSTD:r=>lE(r),LZ4:pT,LZ4_RAW:mT};function _T(r){console.time("Building geometry");const e=new Kn,t=r.VertexX.length,n=r.IndexBuffer.length,i=r.MeshVertexOffset.length,s=r.MaterialRed.length,o=r.InstanceMeshIndex.length,a=r.TransformTX.length;console.log({vertexCount:t,indexCount:n,meshCount:i,materialCount:s,instanceCount:o,transformCount:a});const c=yT(r),l=bT(r),h=wT(r),u=AT(r);console.log("Created %d instance groups",u.length);const f=ST(u);console.log("Created %d material groups",Array.from(f.keys()).length);const d=MT(r,l,h,c,u);console.log("Created %d instanced meshes",d.length);const g=vT(r,l,h,c,f);console.log("Create %d merged meshes",g.length);let _=0;for(const m of d)_+=m.geometry.index.count/3*m.count,e.add(m);for(const m of g)_+=m.geometry.index.count/3,e.add(m);return console.log("Total polygon count = %d",_),e.rotation.x=-Math.PI/2,console.timeEnd("Building geometry"),e}function vT(r,e,t,n,i){const s=new We,o=[];for(const[a,c]of i){if(!c||c.length===0)continue;const l=t[a];if(c.length===1){const d=c[0],g=r.InstanceMeshIndex[d],_=r.InstanceTransformIndex[d],m=e[g],p=n[_],v=new St(m,l);v.matrixAutoUpdate=!1,v.matrix.copy(p),o.push(v);continue}const h=[];for(const d of c){const g=r.InstanceMeshIndex[d],_=r.InstanceTransformIndex[d],m=e[g],p=n[_];p.equals(s)||m.applyMatrix4(p),h.push(m)}const u=xT(h),f=new St(u,l);f.name=`MergedStatic_Material_${a}`,o.push(f)}return o}function yT(r){const{TransformTX:e,TransformTY:t,TransformTZ:n,TransformQX:i,TransformQY:s,TransformQZ:o,TransformQW:a,TransformSX:c,TransformSY:l,TransformSZ:h}=r,u=new U,f=new wt,d=new U,g=e.length,_=new Array(g);for(let m=0;m<g;m++){const p=e[m],v=t[m],y=n[m],x=c[m],A=l[m],E=h[m],I=i[m],D=s[m],b=o[m],C=a[m],B=new We;u.set(p,v,y),f.set(I,D,b,C),d.set(x,A,E),B.compose(u,f,d),_[m]=B}return _}function xT(r){let e=0,t=0;for(let c=0,l=r.length;c<l;c++){const h=r[c],u=h.getIndex(),f=h.getAttribute("position");e+=u.count,t+=f.count}const n=new Float32Array(t*3),i=new Uint32Array(e);let s=0,o=0;for(let c=0,l=r.length;c<l;c++){const h=r[c],u=h.getAttribute("position"),f=h.getIndex(),d=u.array,g=f.array,_=u.count,m=f.count,p=u.itemSize,v=_*p,y=o*p;n.set(d.subarray(0,v),y);for(let x=0;x<m;x++)i[s+x]=g[x]+o;o+=_,s+=m}const a=new Ke;return a.setAttribute("position",new ot(n,3)),a.setIndex(new ot(i,1)),a}function AT(r){const e=r.InstanceEntityIndex.length,t=new Map;for(let n=0;n<e;n++){const i=r.InstanceMeshIndex[n],s=r.InstanceMaterialIndex[n],o=`${i}|${s}`;let a=t.get(o);a?a.instanceIndices.push(n):(a={meshIndex:i,materialIndex:s,instanceIndices:[n]},t.set(o,a))}return Array.from(t.values())}function bT(r){const e=r.MeshVertexOffset.length,t=r.IndexBuffer.length,n=r.VertexX.length,i=new Array(e),{VertexX:s,VertexY:o,VertexZ:a,IndexBuffer:c,MeshVertexOffset:l,MeshIndexOffset:h}=r;for(let u=0;u<e;u++){const f=h[u],d=u+1<e?h[u+1]:t,g=d-f,_=l[u],p=(u+1<e?l[u+1]:n)-_;if(g===0||p===0)continue;const v=c.subarray(f,d),y=1e4,x=new Float32Array(p*3);for(let E=0;E<p;E++)x[E*3+0]=s[E+_]/y,x[E*3+1]=o[E+_]/y,x[E*3+2]=a[E+_]/y;const A=new Ke;A.setAttribute("position",new ot(x,3)),A.setIndex(new ot(v,1)),i[u]=A}return i}function wT(r){const e=r.MaterialAlpha.length,t=new Array(e);for(let n=0;n<e;n++){const i=r.MaterialRed[n]/255,s=r.MaterialGreen[n]/255,o=r.MaterialBlue[n]/255,a=r.MaterialAlpha[n]/255,c=r.MaterialRoughness[n]/255,l=r.MaterialMetallic[n]/255,h=new gs({color:new xe(i,s,o),opacity:a,flatShading:!0,transparent:a<.999,roughness:c,metalness:l,side:Sn});t[n]=h}return t}function ST(r){const e=new Map;for(const t of r){const{materialIndex:n,instanceIndices:i}=t;if(i.length===1){const s=i[0];let o=e.get(n);o||(o=[],e.set(n,o)),o.push(s)}}return e}function MT(r,e,t,n,i){const s=new Array;for(const o of i){const{meshIndex:a,materialIndex:c,instanceIndices:l}=o,h=l.length;if(h<=1)continue;const u=e[a],f=t[c],d=new _c(u,f,h);d.instanceMatrix.setUsage(kr);for(let g=0;g<h;g++){const _=l[g],m=r.InstanceTransformIndex[_];d.setMatrixAt(g,n[m])}d.userData.meshIndex=a,d.userData.materialIndex=c,d.frustumCulled=!1,d.matrixAutoUpdate=!1,d.matrixWorldNeedsUpdate=!1,s.push(d)}return s}class ET{async load(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch BOS from ${e}: ${t.status} ${t.statusText}`);const n=await t.arrayBuffer(),i=await iM.loadAsync(n),s=await Kg(i);return _T(s)}}async function Kg(r){function e(i){const s=i.toLowerCase(),o=Object.keys(r.files).find(a=>a.toLowerCase().endsWith(s));if(!o)throw new Error(`Could not find "${i}" in zip archive.`);return o}async function t(i,s,o){const a=e(i),c=await r.files[a].async("arraybuffer"),l=await dg(c);await XM({file:c,compressors:gT,metadata:l,onChunk(h){let u=h.columnData;u.constructor.name!=o.name&&(u=new o(u)),s[h.columnName]=o&&new o(u)}})}console.time("Reading parquet tables");const n={};return await t("Instances.parquet",n,Int32Array),await t("VertexBuffer.parquet",n,Int32Array),await t("IndexBuffer.parquet",n,Uint32Array),await t("Meshes.parquet",n,Int32Array),await t("Materials.parquet",n,Uint8Array),await t("Transforms.parquet",n,Float32Array),console.timeEnd("Reading parquet tables"),n}Ut.BimOpenSchemaLoader=ET,Ut.DefaultInputScheme=zm,Ut.GizmoOptions=Aw,Ut.GltfLoader=nM,Ut.KEYS=At,Ut.THREE=sw,Ut.Viewer=vS,Ut.getSettings=Dm,Ut.loadBimGeometryFromZip=Kg,Object.defineProperties(Ut,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
5020
5020
  //# sourceMappingURL=ara3d-webgl.umd.js.map